|
|
@@ -169,21 +169,24 @@ class InvoiceController extends DooController {
|
|
|
$XDeode = new XDeode ( 5 );
|
|
|
$sid = $XDeode->decode ( $_COOKIE ["staff"] );
|
|
|
|
|
|
-
|
|
|
Doo::loadModel ( 'invoiceStatistics' );
|
|
|
$invoiceStatistics = new invoiceStatistics ();
|
|
|
|
|
|
- $isMonth = $invoiceStatistics->getStatisticsByMonth ($sid);
|
|
|
+ $isMonth = $invoiceStatistics->getStatisticsByMonth ( $sid );
|
|
|
|
|
|
+ // 缓存统计结果
|
|
|
$year = date ( "Y" );
|
|
|
$tmp_date = date ( "Ym" );
|
|
|
$tmp_year = substr ( $tmp_date, 0, 4 );
|
|
|
$tmp_mon = substr ( $tmp_date, 4, 2 );
|
|
|
$tmp_forwardmonth = mktime ( 0, 0, 0, $tmp_mon - 1, 1, $tmp_year );
|
|
|
$fm_forward_month = date ( "m", $tmp_forwardmonth );
|
|
|
- $path = SITE_PATH . $this->INVOICECOLLECTPATH . "invoiceCollect_" . $year . "_" . $fm_forward_month . ".htm";
|
|
|
- $htm = $this->showCache ( $path );
|
|
|
+ $path = SITE_PATH . $this->INVOICECOLLECTPATH . "invoiceCollect_" . $year . "_" . $fm_forward_month . "_" . $sid . ".htm";
|
|
|
|
|
|
+ if (is_file ( $path ))
|
|
|
+ $htm = file_get_contents ( $path );
|
|
|
+ else
|
|
|
+ $htm = $this->showCache ( $path, $sid );
|
|
|
|
|
|
$invoiceList = $invoice->getMyInvoice ( $sid );
|
|
|
|
|
|
@@ -1927,6 +1930,7 @@ class InvoiceController extends DooController {
|
|
|
$invoiceList = $invoice->find ( array (
|
|
|
'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'],
|
|
|
'desc' => 'iid',
|
|
|
+ 'limit' => 10,
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
foreach ( $invoiceList as $key => $value ) {
|
|
|
@@ -2952,7 +2956,6 @@ class InvoiceController extends DooController {
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
|
|
|
|
|
|
-
|
|
|
// 收款操作日志
|
|
|
$item = array (
|
|
|
'operation' => $this->staff [0] ['username'] . " 转入 公共待认领款项 ",
|
|
|
@@ -2966,10 +2969,10 @@ class InvoiceController extends DooController {
|
|
|
);
|
|
|
$invoiceROLog->setInvoiceROLog ( $item );
|
|
|
|
|
|
- if (empty($action))
|
|
|
- return '/invoiceReceivables';
|
|
|
+ if (empty ( $action ))
|
|
|
+ return '/invoiceReceivables';
|
|
|
else
|
|
|
- return "/invoiceReceivablesAS";
|
|
|
+ return "/invoiceReceivablesAS";
|
|
|
}
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
|
@@ -3430,7 +3433,7 @@ class InvoiceController extends DooController {
|
|
|
Doo::loadModel ( 'invoiceStatistics' );
|
|
|
$invoiceStatistics = new invoiceStatistics ();
|
|
|
|
|
|
- $isMonth = $invoiceStatistics->getStatisticsByMonth ($this->staff[0]['sid']);
|
|
|
+ $isMonth = $invoiceStatistics->getStatisticsByMonth ( $this->staff [0] ['sid'] );
|
|
|
|
|
|
$year = date ( "Y" );
|
|
|
$tmp_date = date ( "Ym" );
|
|
|
@@ -3454,6 +3457,179 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 纸票管理
|
|
|
+ */
|
|
|
+ function invoicePaper() {
|
|
|
+ $status = $this->get_args ( 'status' ) ? $this->get_args ( 'status' ) : 'ALL';
|
|
|
+ $invoiceType = $this->get_args ( 'invoiceType' ) ? $this->get_args ( 'invoiceType' ) : "ALL";
|
|
|
+
|
|
|
+ $date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
|
|
|
+
|
|
|
+ $this->data ['dateString'] = $date;
|
|
|
+ $this->data ['status'] = $status;
|
|
|
+ $this->data ['invoiceType'] = $invoiceType;
|
|
|
+
|
|
|
+ $this->data ['memu'] = "invoice";
|
|
|
+ $this->data ['staff'] = $this->staff;
|
|
|
+ $this->data ['receiptMemu'] = 'invoicePaper';
|
|
|
+ $this->render ( "/admin/invoicePaper", $this->data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得纸票分页数据
|
|
|
+ */
|
|
|
+ function ajaxGetinvoicePaperAchieve() {
|
|
|
+ Doo::loadModel ( 'invoicePaper' );
|
|
|
+ $invoicePaper = new invoicePaper ();
|
|
|
+
|
|
|
+ $status = $this->get_args ( 'status' ) ? $this->get_args ( 'status' ) : 'ALL';
|
|
|
+ $invoiceType = $this->get_args ( 'invoiceType' ) ? $this->get_args ( 'invoiceType' ) : "ALL";
|
|
|
+
|
|
|
+ $invoiceTrain = $this->get_args ( 'invoiceTrain' ) ? $this->get_args ( 'invoiceTrain' ) : "ORDINARY";
|
|
|
+ $date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
|
|
|
+
|
|
|
+ $page = $this->get_args ( 'start' ) && is_numeric ( $this->get_args ( 'start' ) ) ? $this->get_args ( 'start' ) : 0;
|
|
|
+ $draw = $this->get_args ( 'draw' ) && is_numeric ( $this->get_args ( 'draw' ) ) ? $this->get_args ( 'draw' ) : 1;
|
|
|
+ $length = $this->get_args ( 'length' ) && is_numeric ( $this->get_args ( 'length' ) ) ? $this->get_args ( 'length' ) : 10;
|
|
|
+
|
|
|
+ $MebSea = $this->get_args ( 'search' );
|
|
|
+ $MebSea = $MebSea ['value'];
|
|
|
+
|
|
|
+ $page_size = $length;
|
|
|
+
|
|
|
+ $con = '';
|
|
|
+ if ($status == 'ALL')
|
|
|
+ $con = ' where 1 ';
|
|
|
+ elseif ($status == 'PRINTED')
|
|
|
+ $con = ' where b.isDelete=0 and b.status=2 and b.untreadStatus=0 and b.printStatus=1 ';
|
|
|
+ elseif ($status == 'UNPRINT')
|
|
|
+ $con = ' where b.isDelete=0 and b.status=2 and b.untreadStatus=0 and b.printStatus=0 ';
|
|
|
+ elseif ($status == 'TICKET')
|
|
|
+ $con = ' where b.isDelete=0 and b.untreadStatus=2';
|
|
|
+
|
|
|
+ if ($invoiceType == 'ORDINARY')
|
|
|
+ $con .= ' and a.invoiceType=0 ';
|
|
|
+ elseif ($invoiceType == 'SPECIAL')
|
|
|
+ $con .= ' and a.invoiceType=1 ';
|
|
|
+
|
|
|
+ $dateArr = explode ( ':', $date );
|
|
|
+ $D1 = $dateString = '';
|
|
|
+ $D2 = '';
|
|
|
+ if (! empty ( $date )) {
|
|
|
+ $D1 = $dateArr [0];
|
|
|
+ if (isset ( $dateArr [1] ))
|
|
|
+ $D2 = $dateArr [1];
|
|
|
+ else
|
|
|
+ $D2 = '';
|
|
|
+ $dateString = $D1 . " : " . $D2;
|
|
|
+ }
|
|
|
+ if (! empty ( $D1 ) && ! empty ( $D2 ))
|
|
|
+ $con .= ' and b.printTime BETWEEN "' . $D1 . '" AND "' . $D2 . '" ';
|
|
|
+ elseif (! empty ( $D1 ) && empty ( $D2 ))
|
|
|
+ $con .= ' and b.printTime like "%' . $D1 . '%" ';
|
|
|
+
|
|
|
+ if (! empty ( $MebSea ))
|
|
|
+ $con .= ' and ( b.invoiceTitle like "%' . $MebSea . '%" or b.invoiceCompany like "%' . $MebSea . '%" or a.invoiceNo like "%' . $MebSea . '%" )';
|
|
|
+
|
|
|
+ $invoiceTotal = $invoicePaper->getInvoicePaperCount ();
|
|
|
+
|
|
|
+ $sql = ' ' . $con;
|
|
|
+ $limit = $page . ',' . $page_size;
|
|
|
+ $list = $invoicePaper->getInvoicePaper ( $limit, $sql, 'desc' );
|
|
|
+
|
|
|
+ $paperList = array ();
|
|
|
+ foreach ( $list as $key => $value ) {
|
|
|
+ $irDetail = array ();
|
|
|
+ if($value ['iid']==0)
|
|
|
+ array_push ( $irDetail, '<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/invoicePaperDel/' . $value ['ipidKey'] . '\'" >删除</a>' );
|
|
|
+ else
|
|
|
+ array_push ( $irDetail, '' );
|
|
|
+ array_push ( $irDetail, $value ['invoiceCode'] );
|
|
|
+ array_push ( $irDetail, $value ['invoiceNo'] );
|
|
|
+ array_push ( $irDetail, '<a href="#approvalInvice" onclick="nodeInvoice(\'' . $value ['iidKey'] . '\')" data-toggle="modal">' . $value ['invoiceSerial'] . '</a>' );
|
|
|
+ if ($value ['invoiceType'] == 1)
|
|
|
+ array_push ( $irDetail, $value ['invoiceCompany'] );
|
|
|
+ else
|
|
|
+ array_push ( $irDetail, $value ['invoiceTitle'] );
|
|
|
+ if ($value ['invoiceType'] == 1)
|
|
|
+ array_push ( $irDetail, '¥' . $value ['invoicePrice'] . '<sup>专</sup>' );
|
|
|
+ else
|
|
|
+ array_push ( $irDetail, '¥' . $value ['invoicePrice'] );
|
|
|
+ array_push ( $irDetail, $value ['invoiceElement'] );
|
|
|
+ array_push ( $irDetail, $value ['categoryName'] . '-' . $value ['userName'] );
|
|
|
+ array_push ( $irDetail, $value ['printTime'] );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ array_push ( $paperList, $irDetail );
|
|
|
+ }
|
|
|
+ // $approvalListJson = json_encode ( $approvalList );
|
|
|
+
|
|
|
+ $recordsFiltered = $invoiceTotal;
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ "draw" => intval ( $draw ),
|
|
|
+ "recordsTotal" => intval ( $invoiceTotal ),
|
|
|
+ "recordsFiltered" => intval ( $recordsFiltered ),
|
|
|
+ "data" => $paperList
|
|
|
+ ), JSON_UNESCAPED_UNICODE );
|
|
|
+ }
|
|
|
+
|
|
|
+ function invoicePaperDel(){
|
|
|
+ $ipidKey = isset ( $this->params ['ipidKey'] ) ? $this->params ['ipidKey'] : "";
|
|
|
+
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ $ipid = $XDeode->decode ( $ipidKey );
|
|
|
+
|
|
|
+ if (empty ( $ipid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoicePaper' );
|
|
|
+ $invoicePaper = new invoicePaper ();
|
|
|
+ $invoicePaper->delete ( array (
|
|
|
+ 'where' => 'ipid=' . $ipid.' and iid!=0',
|
|
|
+ 'limit' => 1
|
|
|
+ ) );
|
|
|
+
|
|
|
+ return '/invoicePaper';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加纸质发票号
|
|
|
+ */
|
|
|
+ function invoicePaperAdd() {
|
|
|
+ $invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : '0';
|
|
|
+ $invoiceCode = $this->get_args ( 'invoiceCode' ) ? $this->get_args ( 'invoiceCode' ) : "";
|
|
|
+ $invoiceNoStart = $this->get_args ( 'invoiceNoStart' ) && is_numeric ( $this->get_args ( 'invoiceNoStart' ) ) ? $this->get_args ( 'invoiceNoStart' ) : 0;
|
|
|
+ $invoiceNoTotal = $this->get_args ( 'invoiceNoTotal' ) && is_numeric ( $this->get_args ( 'invoiceNoTotal' ) ) ? $this->get_args ( 'invoiceNoTotal' ) : 0;
|
|
|
+
|
|
|
+ if ($invoiceType != '' && ! empty ( $invoiceCode ) && ! empty ( $invoiceNoStart ) && ! empty ( $invoiceNoTotal )) {
|
|
|
+
|
|
|
+ $sum = $invoiceNoStart + $invoiceNoTotal;
|
|
|
+ if (empty ( $sum ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ Doo::db ()->beginTransaction ();
|
|
|
+ // 批量存储纸质发票
|
|
|
+ $date = date ( "Y-m-d H:i:s" );
|
|
|
+ $sql = 'INSERT INTO CLD_invoicePaper (invoiceType, invoiceCode,invoiceNo,date)
|
|
|
+ VALUES ';
|
|
|
+ $paperList = array ();
|
|
|
+ for($invoiceNoStart; $invoiceNoStart <= $sum; $invoiceNoStart ++) {
|
|
|
+ $paperSql = '(' . $invoiceType . ',"' . $invoiceCode . '","' . $invoiceNoStart . '","' . $date . '")';
|
|
|
+ array_push ( $paperList, $paperSql );
|
|
|
+ }
|
|
|
+ if (empty ( $paperList ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ $sql = $sql . implode ( ',', $paperList );
|
|
|
+ Doo::db ()->query ( $sql );
|
|
|
+ Doo::db ()->commit ();
|
|
|
+ return 'invoicePaper';
|
|
|
+ }
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 收款绑定发票 ,一个收款只能绑定一个发票
|
|
|
*/
|
|
|
function invoiceBindReceivables() {
|
|
|
@@ -4398,12 +4574,6 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $con );
|
|
|
|
|
|
- // foreach ($list as $key=>$value){
|
|
|
- // $list[$key]['rpSum']=0;
|
|
|
- // if (!empty($value['irid']))
|
|
|
- // $list[$key]['rpSum']=$invoiceReceivables->getSumOfReceivablesPrice($value['irid']);
|
|
|
- // }
|
|
|
-
|
|
|
$this->data ['MebSeaEn'] = $MebSea;
|
|
|
$this->data ['MebSea'] = urlencode ( $MebSea );
|
|
|
$this->data ['date'] = $date;
|
|
|
@@ -4457,14 +4627,15 @@ class InvoiceController extends DooController {
|
|
|
$con .= ' and ' . $descField . ' BETWEEN "' . $D1 . '" AND "' . $D2 . '" ';
|
|
|
elseif (! empty ( $D1 ) && empty ( $D2 ))
|
|
|
$con .= ' and ' . $descField . ' like "%' . $D1 . '%" ';
|
|
|
-
|
|
|
- // echo $con;
|
|
|
+
|
|
|
if ($status == 'Unclaimed')
|
|
|
$con .= ' and a.bindStatus=0';
|
|
|
elseif ($status == 'Credited')
|
|
|
$con .= ' and a.bindStatus=1';
|
|
|
elseif ($status == 'Claim')
|
|
|
$con .= ' and a.bindStatus=0 and a.receivablesStaff="PUBLIC"';
|
|
|
+ elseif ($status == 'BBN')
|
|
|
+ $con .= ' and a.bankBatchNumber!=""';
|
|
|
|
|
|
$get = "/" . $status . "?date=" . urlencode ( $date ) . "&MebSea=" . urlencode ( $MebSea );
|
|
|
|
|
|
@@ -4483,6 +4654,13 @@ class InvoiceController extends DooController {
|
|
|
$pageinfo = $this->getPageBySql ( $sql, $page, $page_size, "invoiceReceivablesAS", $get, "" );
|
|
|
$limit = $pageinfo ['lower'] . ',' . $page_size;
|
|
|
$list = $invoiceReceivables->getInvoiceReceivablesByConditionPage ( $limit, $con, 'desc', $descField );
|
|
|
+ foreach ( $list as $key => $value ) {
|
|
|
+ $list [$key] ['category'] = '';
|
|
|
+ if ($value ['receivablesCategory'] != 'PUBLIC') {
|
|
|
+ $receivablesCategory = explode ( ":", $value ['receivablesCategory'] );
|
|
|
+ $list [$key] ['category'] = $receivablesCategory [1];
|
|
|
+ }
|
|
|
+ }
|
|
|
// print_r($list);
|
|
|
|
|
|
$this->data ['category'] = $category;
|
|
|
@@ -6269,14 +6447,14 @@ class InvoiceController extends DooController {
|
|
|
$num = count ( $pics );
|
|
|
return $pics [$num - 1];
|
|
|
}
|
|
|
- function showCache($path = "") {
|
|
|
+ function showCache($path = "", $sid = 0) {
|
|
|
// if (file_exists ( $path )) {
|
|
|
// $htm = file_get_contents ( $path );
|
|
|
// } else {
|
|
|
Doo::loadModel ( 'invoiceStatistics' );
|
|
|
$invoiceStatistics = new invoiceStatistics ();
|
|
|
|
|
|
- $isBriefly = $invoiceStatistics->getBrieflyStatistics ();
|
|
|
+ $isBriefly = $invoiceStatistics->getBrieflyStatistics ( $sid );
|
|
|
$htm = '<tr><th class="taC">' . $isBriefly ['statisticsMonth'] [0] ['month'] . '月累计开票</th>
|
|
|
<td>¥' . $isBriefly ['statisticsMonth'] [0] ['invoicePrice'] . '</td>
|
|
|
<th class="taC">' . $isBriefly ['statisticsMonth'] [0] ['month'] . '月累计入账</th>
|
|
|
@@ -6284,7 +6462,7 @@ class InvoiceController extends DooController {
|
|
|
/*
|
|
|
* '<tr><th class="taC">今年累计开票</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['invoicePrice'] . '</td> <th class="taC">今年累计入账</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['accountPrice'] . '</td></tr>';
|
|
|
*/
|
|
|
- file_put_contents ( $path, $htm, FILE_APPEND );
|
|
|
+ file_put_contents ( $path, $htm );
|
|
|
// }
|
|
|
return $htm;
|
|
|
}
|