|
@@ -74,17 +74,16 @@ class InvoiceController extends DooController {
|
|
|
if (empty ( $icm ))
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
|
- //单独判断应收款访问权限
|
|
|
- if ($action == 'invoiceAggregateCompanyDetail' ) {
|
|
|
+ // 单独判断应收款访问权限
|
|
|
+ if ($action == 'invoiceAggregateCompanyDetail') {
|
|
|
Doo::loadModel ( "invoiceCompanyManage" );
|
|
|
$invoiceCompanyManage = new invoiceCompanyManage ();
|
|
|
-
|
|
|
+
|
|
|
$icm = $invoiceCompanyManage->getInvoiceCMByStaff ( $sid );
|
|
|
if (empty ( $icm ))
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (! $flag)
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
@@ -2135,7 +2134,7 @@ class InvoiceController extends DooController {
|
|
|
if (empty ( $divApproval ))
|
|
|
return '/invoiceApproval';
|
|
|
else
|
|
|
- return '/invoiceApprovalAchieve';
|
|
|
+ return '/invoiceApprovalAchieve/PEND';
|
|
|
}
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
@@ -2299,7 +2298,7 @@ class InvoiceController extends DooController {
|
|
|
$con .= ' and printTime BETWEEN "' . $D1 . '" AND "' . $D2 . '" ';
|
|
|
|
|
|
if (! empty ( $MebSea )) {
|
|
|
- $con .= ' and ( invoiceTitle like "%' . $MebSea . '%" or invoiceCompany like "%' . $MebSea . '%" or invoicePrice like "%' . $MebSea . '%" )';
|
|
|
+ $con .= ' and ( invoiceTitle like "%' . $MebSea . '%" or invoiceCompany like "%' . $MebSea . '%" or invoicePrice like "%' . $MebSea . '%" or invoiceNo like "%' . $MebSea . '%" )';
|
|
|
}
|
|
|
$pageinfo ['page'] = array (
|
|
|
'previous' => ''
|
|
@@ -2867,12 +2866,12 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
Doo::db ()->beginTransaction ();
|
|
|
// 批量存储收款--由于必须获得收款ID,
|
|
|
- $sql = 'INSERT INTO CLD_invoiceReceivables (receivablesPrice, receivablesMessage,receivablesSerial,receivablesBank,receivablesDate,inputStaff,date,receivablesCategory,receivablesStaff,bankBatchNumber,recepitTitleMark)
|
|
|
+ $sql = 'INSERT INTO CLD_invoiceReceivables (OriginalPrice,receivablesPrice, receivablesMessage,receivablesSerial,receivablesBank,receivablesDate,inputStaff,date,receivablesCategory,receivablesStaff,bankBatchNumber,recepitTitleMark)
|
|
|
VALUES ';
|
|
|
$date = date ( "Y-m-d" );
|
|
|
$receivablesList = array ();
|
|
|
foreach ( $exlArray as $key => $value ) {
|
|
|
- $receivablesSql = '(' . $value ["receivablesPrice"] . ',"' . $value ["receivablesMessage"] . '",' . '"#SK' . date ( "Ymd" ) . mt_rand ( 1000, 9999 ) . '","' . $value ["receivablesBank"] . '","' . $value ["receivablesDate"] . '","' . $this->staff [0] ['username'] . '","' . $date . '","PUBLIC","PUBLIC","' . $bankBatchNumber . '","' . $value ["receivablesMessage"] . '")';
|
|
|
+ $receivablesSql = '(' . $value ["receivablesPrice"] . ',' . $value ["receivablesPrice"] . ',"' . $value ["receivablesMessage"] . '",' . '"#SK' . date ( "Ymd" ) . mt_rand ( 1000, 9999 ) . '","' . $value ["receivablesBank"] . '","' . $value ["receivablesDate"] . '","' . $this->staff [0] ['username'] . '","' . $date . '","PUBLIC","PUBLIC","' . $bankBatchNumber . '","' . $value ["receivablesMessage"] . '")';
|
|
|
array_push ( $receivablesList, $receivablesSql );
|
|
|
}
|
|
|
$sql = $sql . implode ( ',', $receivablesList );
|
|
@@ -3090,6 +3089,7 @@ class InvoiceController extends DooController {
|
|
|
'bindPrice' => $invoiceDetail ['invoicePrice'],
|
|
|
'bindDate' => date ( "Y-m-d H:i:s" ),
|
|
|
'receivablesPrice' => $receivablesPrice,
|
|
|
+ 'OriginalPrice' => $receivablesPrice,
|
|
|
'receivablesMessage' => $receivablesMessage,
|
|
|
'receivablesSerial' => $receivablesSerial,
|
|
|
'receivablesBank' => $receivablesBank,
|
|
@@ -3219,6 +3219,7 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$item = array (
|
|
|
'receivablesPrice' => $receivablesPrice,
|
|
|
+ 'OriginalPrice' => $receivablesPrice,
|
|
|
'receivablesMessage' => $receivablesMessage,
|
|
|
'receivablesSerial' => "#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ),
|
|
|
'receivablesBank' => $receivablesBank,
|
|
@@ -3426,7 +3427,10 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
function invoiceReceivablesDelete() {
|
|
|
$claimKey = $this->get_args ( 'claimKey' ) ? $this->get_args ( 'claimKey' ) : "";
|
|
|
+ $skll = $this->get_args ( 'skll' ) ? $this->get_args ( 'skll' ) : "";
|
|
|
|
|
|
+ if ($skll!='删除到款')
|
|
|
+ die ( 'illegal request' );
|
|
|
if (empty ( $claimKey ))
|
|
|
die ( 'illegal request' );
|
|
|
|
|
@@ -3439,6 +3443,30 @@ class InvoiceController extends DooController {
|
|
|
die ( 'illegal request' );
|
|
|
|
|
|
$invoiceReceivables->delInvoiceReceivablesByIrid ( $detail ['irid'] );
|
|
|
+
|
|
|
+ //扣除收款汇总信息 汇总
|
|
|
+ Doo::loadModel ( 'invoiceStatistics' );
|
|
|
+ $invoiceStatistics = new invoiceStatistics ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => $detail['receivablesDate'],
|
|
|
+ 'priceClass' => 2,
|
|
|
+ 'irid' => $detail['irid'],
|
|
|
+ 'receivablesPrice' => -$detail['receivablesPrice']
|
|
|
+ );
|
|
|
+ if ($detail['receivablesCategory'] != 'PUBLIC') {
|
|
|
+ $receivablesCategory = explode ( ":", $detail['receivablesCategory'] );
|
|
|
+ $item += array (
|
|
|
+ 'cid' => $receivablesCategory [0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if ($detail['receivablesStaff'] != 'PUBLIC') {
|
|
|
+ $receivablesStaff = explode ( "-", $detail['receivablesStaff'] );
|
|
|
+ $item += array (
|
|
|
+ 'staff' => $receivablesStaff [0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
|
|
|
+
|
|
|
return '/invoiceReceivablesAS';
|
|
|
}
|
|
|
|
|
@@ -4854,7 +4882,7 @@ class InvoiceController extends DooController {
|
|
|
$get = "/" . $status . "?date=" . urlencode ( $date ) . "&MebSea=" . urlencode ( $MebSea );
|
|
|
|
|
|
if (! empty ( $MebSea )) {
|
|
|
- $con .= ' and ( invoiceTitle like "%' . $MebSea . '%" or invoiceCompany like "%' . $MebSea . '%" )';
|
|
|
+ $con .= ' and ( invoiceTitle like "%' . $MebSea . '%" or invoiceCompany like "%' . $MebSea . '%" or invoiceNo like "%' . $MebSea . '%" )';
|
|
|
}
|
|
|
$pageinfo ['page'] = array (
|
|
|
'previous' => ''
|
|
@@ -4926,6 +4954,8 @@ class InvoiceController extends DooController {
|
|
|
$con .= ' and a.bindStatus=0 and a.receivablesStaff="PUBLIC"';
|
|
|
elseif ($status == 'BBN')
|
|
|
$con .= ' and a.bankBatchNumber!=""';
|
|
|
+ elseif ($status == 'REFUND')
|
|
|
+ $con .= ' and ( (a.bindStatus=0 and a.refundLog!="" ) or a.bindStatus=2)';
|
|
|
|
|
|
$get = "/" . $status . "?date=" . urlencode ( $date ) . "&MebSea=" . urlencode ( $MebSea );
|
|
|
|
|
@@ -4968,6 +4998,246 @@ class InvoiceController extends DooController {
|
|
|
$this->render ( "/admin/invoiceReceivablesAS", $this->data );
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除一条收款
|
|
|
+ */
|
|
|
+ function delInvoiceReceivables() {
|
|
|
+ $iridKey = $this->get_args ( 'iridKey' ) ? $this->get_args ( 'iridKey' ) : "";
|
|
|
+
|
|
|
+ if (empty ( $iridKey ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ $irid = $XDeode->decode ( $iridKey );
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+
|
|
|
+
|
|
|
+ $detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
+ if (empty ( $detail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $invoiceReceivables->delInvoiceReceivablesByIrid ( $detail ['irid'] );
|
|
|
+
|
|
|
+ //扣除收款汇总信息 汇总
|
|
|
+ Doo::loadModel ( 'invoiceStatistics' );
|
|
|
+ $invoiceStatistics = new invoiceStatistics ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => $detail['receivablesDate'],
|
|
|
+ 'priceClass' => 2,
|
|
|
+ 'irid' => $detail['irid'],
|
|
|
+ 'receivablesPrice' => -$detail['receivablesPrice']
|
|
|
+ );
|
|
|
+ if ($detail['receivablesCategory'] != 'PUBLIC') {
|
|
|
+ $receivablesCategory = explode ( ":", $detail['receivablesCategory'] );
|
|
|
+ $item += array (
|
|
|
+ 'cid' => $receivablesCategory [0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if ($detail['receivablesStaff'] != 'PUBLIC') {
|
|
|
+ $receivablesStaff = explode ( "-", $detail['receivablesStaff'] );
|
|
|
+ $item += array (
|
|
|
+ 'staff' => $receivablesStaff [0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
|
|
|
+
|
|
|
+ return '/invoiceReceivablesAS';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加退款信息
|
|
|
+ */
|
|
|
+ function setInvoiceReceivablesRefund() {
|
|
|
+ $iridKey = $this->get_args ( 'iridKey' ) ? $this->get_args ( 'iridKey' ) : '';
|
|
|
+
|
|
|
+ $refundType = $this->get_args ( 'refundType' ) && is_numeric ( $this->get_args ( 'refundType' ) ) ? $this->get_args ( 'refundType' ) : '0';
|
|
|
+ $refundCompany = $this->get_args ( 'refundCompany' ) ? $this->get_args ( 'refundCompany' ) : "";
|
|
|
+ $refundNumber = $this->get_args ( 'refundNumber' ) ? $this->get_args ( 'refundNumber' ) : "";
|
|
|
+ $refundPrice = $this->get_args ( 'refundPrice' ) ? $this->get_args ( 'refundPrice' ) : "";
|
|
|
+
|
|
|
+ if($refundPrice<0)
|
|
|
+ die ( 'illegal request' );
|
|
|
+ if (! empty ( $iridKey ) && ! empty ( $refundCompany ) && ! empty ( $refundNumber ) && ! empty ( $refundPrice )) {
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadModel ( 'invoiceRefund' );
|
|
|
+ $invoiceRefund = new invoiceRefund ();
|
|
|
+
|
|
|
+ $irid = $invoiceReceivables->authcode ( $iridKey );
|
|
|
+ $irDetail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
+
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ $refundLog = $this->staff [0] ['username'] . ' 退款 <b class="colRed">¥' . $refundPrice . '</b>
|
|
|
+ <br/><a href="#refunded" onclick="getRefundByDetail(\'' . $iridKey . '\')" data-toggle="modal">退款信息</a> <br/>' . date ( "Y-m-d H:i:s" ) . '
|
|
|
+ ';
|
|
|
+ $item = array (
|
|
|
+ 'irid' => $irid,
|
|
|
+ 'refundCompany' => $refundCompany,
|
|
|
+ 'refundNumber' => $refundNumber,
|
|
|
+ 'refundPrice' => $refundPrice,
|
|
|
+ 'refundLog' => $refundLog
|
|
|
+ );
|
|
|
+ if ($refundType == 1) {
|
|
|
+ $item += array (
|
|
|
+ 'refundType' => $refundType,
|
|
|
+ 'receivablesPrice' => $refundPrice,
|
|
|
+ 'bindStatus' => 2
|
|
|
+ );
|
|
|
+ } elseif ($refundType == 0 && $irDetail ['receivablesPrice'] <= $refundPrice) {
|
|
|
+ $item += array (
|
|
|
+ 'refundType' => 1,
|
|
|
+ 'receivablesPrice' => $irDetail ['receivablesPrice'] -$refundPrice,
|
|
|
+ 'bindStatus' => 2
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ $item += array (
|
|
|
+ 'refundType' => $refundType,
|
|
|
+ 'receivablesPrice' => $irDetail ['receivablesPrice'] - $refundPrice
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
|
|
|
+
|
|
|
+ // 添加退款记录
|
|
|
+ $item = array (
|
|
|
+ 'irid' => $irid,
|
|
|
+ 'refundType' => $refundType,
|
|
|
+ 'refundCompany' => $refundCompany,
|
|
|
+ 'refundNumber' => $refundNumber,
|
|
|
+ 'refundPrice' => $refundPrice,
|
|
|
+ 'refundLog' => $refundLog,
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ $invoiceRefund->addInvoiceRefund ( $item );
|
|
|
+
|
|
|
+
|
|
|
+ //扣除收款汇总信息 汇总
|
|
|
+ Doo::loadModel ( 'invoiceStatistics' );
|
|
|
+ $invoiceStatistics = new invoiceStatistics ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => $irDetail['receivablesDate'],
|
|
|
+ 'priceClass' => 2,
|
|
|
+ 'irid' => $irDetail['irid'],
|
|
|
+ 'receivablesPrice' => -$refundPrice
|
|
|
+ );
|
|
|
+ if ($irDetail['receivablesCategory'] != 'PUBLIC') {
|
|
|
+ $receivablesCategory = explode ( ":", $irDetail['receivablesCategory'] );
|
|
|
+ $item += array (
|
|
|
+ 'cid' => $receivablesCategory [0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if ($irDetail['receivablesStaff'] != 'PUBLIC') {
|
|
|
+ $receivablesStaff = explode ( "-", $irDetail['receivablesStaff'] );
|
|
|
+ $item += array (
|
|
|
+ 'staff' => $receivablesStaff [0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return '/invoiceReceivablesAS';
|
|
|
+ }
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得收款退款信息
|
|
|
+ */
|
|
|
+ function getRefundByDetail() {
|
|
|
+ $iridKey = $this->get_args ( 'iridKey' ) ? $this->get_args ( 'iridKey' ) : '';
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ if (! empty ( $iridKey )) {
|
|
|
+ $irid = $invoiceReceivables->authcode ( $iridKey );
|
|
|
+ $irDetail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'irDetail' => $irDetail
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据收款序列号获得收款退款信息
|
|
|
+ */
|
|
|
+ function ajaxGetInvoiceReceivablesBySerial() {
|
|
|
+ $receivablesSerial = $this->get_args ( 'receivablesSerial' ) ? $this->get_args ( 'receivablesSerial' ) : '';
|
|
|
+
|
|
|
+ if (! empty ( $receivablesSerial )) {
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+
|
|
|
+ $irDetail = $invoiceReceivables->getInvoiceReceivablesBySerial ( $receivablesSerial, ' and refundLog=""' );
|
|
|
+ $html = '';
|
|
|
+ if (! empty ( $irDetail ))
|
|
|
+ $html = '<td><b>¥' . $irDetail ['receivablesPrice'] . '</b></td>
|
|
|
+ <td>' . $irDetail ['receivablesMessage'] . '</td>
|
|
|
+ <td>' . $irDetail ['receivablesBank'] . '<br>' . $irDetail ['receivablesDate'] . '</td>
|
|
|
+ <td>' . $irDetail ['title'] . '-' . $irDetail ['username'] . '<br>' . $irDetail ['confirmTime'] . '</td>
|
|
|
+ <td>' . $irDetail ['recepitTitleMark'] . '
|
|
|
+ <input type="hidden" name="iridKey" id="iridKey" value="' . $irDetail ['iridKey'] . '">
|
|
|
+ </td>';
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'html' => $html,
|
|
|
+ 'irDetail' => $irDetail
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定新收款
|
|
|
+ */
|
|
|
+ function relationNewInvoiceReceivables() {
|
|
|
+ $iridKeyOld = $this->get_args ( 'iridKeyOld' ) ? $this->get_args ( 'iridKeyOld' ) : '';
|
|
|
+ $iridKey = $this->get_args ( 'iridKey' ) ? $this->get_args ( 'iridKey' ) : '';
|
|
|
+
|
|
|
+ if (! empty ( $iridKeyOld ) && ! empty ( $iridKey )) {
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+
|
|
|
+ $irid = $XDeode->decode ( $iridKey );
|
|
|
+ $iridOld = $invoiceReceivables->authcode ( $iridKeyOld );
|
|
|
+ echo $irid . 'bbb' . $iridOld;
|
|
|
+ $oldIrDetail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $iridOld );
|
|
|
+ $IrDetail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
+
|
|
|
+ if (empty ( $oldIrDetail ) || empty ( $IrDetail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $relationLog = $this->staff [0] ['username'] . ' 关联新款 <a href="#billing" onclick="invoiceReceivblesDivShow(\'' . $iridKey . '\',\'receivables\')" data-toggle="modal">' . $IrDetail ['receivablesSerial'] . '</a>
|
|
|
+ <br/>' . date ( "Y-m-d H:i:s" ) . '
|
|
|
+ ';
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ $item = array (
|
|
|
+ 'irid' => $iridOld,
|
|
|
+ 'relationIrid' => $irid,
|
|
|
+ 'relationLog' => $relationLog
|
|
|
+ );
|
|
|
+ $invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
|
|
|
+
|
|
|
+ return '/invoiceReceivablesAS';
|
|
|
+ }
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
// function invoiceApprovalAchieve() {
|
|
|
// Doo::loadModel ( 'invoice' );
|
|
|
// $invoice = new invoice ();
|
|
@@ -5451,10 +5721,9 @@ class InvoiceController extends DooController {
|
|
|
* 公司应收款
|
|
|
*/
|
|
|
function invoiceAggregateCompanyDetail() {
|
|
|
-
|
|
|
$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : '';
|
|
|
$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : '';
|
|
|
- $year = $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : date("Y");
|
|
|
+ $year = $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : 'ALL';
|
|
|
$month = $this->get_args ( 'month' ) ? $this->get_args ( 'month' ) : "";
|
|
|
$invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
|
|
|
|
|
@@ -5469,38 +5738,43 @@ class InvoiceController extends DooController {
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$category = new L_category ();
|
|
|
|
|
|
- $sid='';
|
|
|
- if (!empty($sidKey))
|
|
|
+ $sid = '';
|
|
|
+ if (! empty ( $sidKey ))
|
|
|
$sid = $XDeode->decode ( $sidKey );
|
|
|
$staffDetail = $staff->getStaffBySid ( $sid );
|
|
|
|
|
|
- $cid='';
|
|
|
- if (!empty($cidKey))
|
|
|
+ $cid = '';
|
|
|
+ if (! empty ( $cidKey ))
|
|
|
$cid = $XDeode->decode ( $cidKey );
|
|
|
|
|
|
$imcStaff = $invoiceCompanyManage->getInvoiceCMByStaff ( $this->staff [0] ['sid'] );
|
|
|
$cidList = array ();
|
|
|
foreach ( $imcStaff as $key => $value ) {
|
|
|
array_push ( $cidList, $value ['cid'] );
|
|
|
-
|
|
|
}
|
|
|
$categoryList = $category->getCategoryInCid ( implode ( ',', $cidList ) );
|
|
|
|
|
|
$cidString = implode ( ',', $cidList );
|
|
|
- $staffList = $staff->getStaffInCid ( $cidString );
|
|
|
+
|
|
|
+ if (empty ( $cid ))
|
|
|
+ $staffList = $staff->getStaffInCid ( $cidString );
|
|
|
+ else
|
|
|
+ $staffList = $staff->getStaffByCid ( $cid ); //
|
|
|
|
|
|
$MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : "";
|
|
|
|
|
|
- $page_size = 2;
|
|
|
+ $page_size = 25;
|
|
|
$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
|
|
|
$status = isset ( $this->params ['status'] ) ? $this->params ['status'] : 'All';
|
|
|
|
|
|
- $con = ' status=2 ';
|
|
|
- if (! empty ( $year ))
|
|
|
- $con .= ' and Year(printTime)=' . $year . '';
|
|
|
- if ( ! empty ( $month )&&is_numeric($month))
|
|
|
- $con .= ' and Month(printTime)="' . $month . '" ';
|
|
|
-
|
|
|
+ $con = ' status=2 and untreadStatus!=2 ';
|
|
|
+
|
|
|
+ $statisticsCon = '';
|
|
|
+ if (! empty ( $year ) && is_numeric ( $year ))
|
|
|
+ $con .= ' and Year(printTime)=' . $year . '';
|
|
|
+ if (! empty ( $month ) && is_numeric ( $month ))
|
|
|
+ $con .= ' and Month(printTime)="' . $month . '" ';
|
|
|
+
|
|
|
if ($status == 'UNRECORD')
|
|
|
$con .= ' and printStatus=1 and untreadStatus=0';
|
|
|
elseif ($status == 'RECORD')
|
|
@@ -5510,20 +5784,22 @@ class InvoiceController extends DooController {
|
|
|
elseif ($status == 'PARTRECORD')
|
|
|
$con .= ' and untreadStatus=0 and printStatus=1 and irid!=""';
|
|
|
elseif ($status == 'All') {
|
|
|
- $con .= ' and printStatus=1 and ( untreadStatus=2 or untreadStatus=0 or untreadStatus=3 )';
|
|
|
+ $con .= ' and printStatus=1 and ( untreadStatus=0 or untreadStatus=3 )';
|
|
|
}
|
|
|
|
|
|
- if(!empty($sid)&&is_numeric($sid))
|
|
|
+ if (! empty ( $sid ) && is_numeric ( $sid ))
|
|
|
$con .= ' and sid=' . $sid;
|
|
|
|
|
|
- if(!empty($cid)&&is_numeric($cid))
|
|
|
+ if (! empty ( $cid ) && is_numeric ( $cid ))
|
|
|
$con .= ' and cid=' . $cid;
|
|
|
- //开票内容筛选
|
|
|
- if(!empty($invoiceElement)&&$invoiceElement!='ALL'){
|
|
|
- $con .= ' and invoiceElement="' . $invoiceElement.'"';
|
|
|
+ else
|
|
|
+ $con .= ' and cid in (' . $cidString . ')';
|
|
|
+ // 开票内容筛选
|
|
|
+ if (! empty ( $invoiceElement ) && $invoiceElement != 'ALL') {
|
|
|
+ $con .= ' and invoiceElement="' . $invoiceElement . '"';
|
|
|
}
|
|
|
-
|
|
|
- $get = "/" . $status . "?cidKey=".$cidKey."&sidKey=".$sidKey."&year=".$year."&month=".$month."&invoiceElement=".$invoiceElement ;
|
|
|
+
|
|
|
+ $get = "/" . $status . "?cidKey=" . $cidKey . "&sidKey=" . $sidKey . "&year=" . $year . "&month=" . $month . "&invoiceElement=" . $invoiceElement;
|
|
|
|
|
|
if (! empty ( $MebSea )) {
|
|
|
$con .= ' and ( invoiceTitle like "%' . $MebSea . '%" or invoiceCompany like "%' . $MebSea . '%" )';
|
|
@@ -5535,35 +5811,39 @@ class InvoiceController extends DooController {
|
|
|
$pageinfo = $this->get_page ( "CLD_invoice", $con, $page, $page_size, "invoiceAggregateCompanyDetail", $get, "" );
|
|
|
$limit = $pageinfo ['lower'] . ',' . $page_size;
|
|
|
|
|
|
- //应收款合计
|
|
|
- $ics=$invoice->getInvoiceCompanyStatistics($con);
|
|
|
+ // 应收款合计
|
|
|
+ $ics = $invoice->getInvoiceCompanyStatistics ( $con );
|
|
|
|
|
|
$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $con );
|
|
|
$monthHtml = "";
|
|
|
- for($i = 1; $i <= 12; $i ++) {
|
|
|
- if ($i == $month)
|
|
|
- $monthHtml .= '<option selected value="' . $i . '">' . $i . '</option>';
|
|
|
- else
|
|
|
- $monthHtml .= '<option value="' . $i . '">' . $i . '</option>';
|
|
|
+ if ($year != "ALL") {
|
|
|
+ for($i = 1; $i <= 12; $i ++) {
|
|
|
+ if ($i == $month)
|
|
|
+ $monthHtml .= '<option selected value="' . $i . '">' . $i . '</option>';
|
|
|
+ else
|
|
|
+ $monthHtml .= '<option value="' . $i . '">' . $i . '</option>';
|
|
|
+ }
|
|
|
}
|
|
|
$this->data ['monthHtml'] = $monthHtml;
|
|
|
$this->data ['year'] = $year;
|
|
|
$this->data ['month'] = $month;
|
|
|
|
|
|
- $this->data['ics']=$ics;
|
|
|
- $this->data ['cidKey']=$cidKey;
|
|
|
- $this->data ['sid'] =$sid;
|
|
|
+ $this->data ['ics'] = $ics;
|
|
|
+ $this->data ['cidKey'] = $cidKey;
|
|
|
+ $this->data ['sid'] = $sid;
|
|
|
$this->data ['staffDetail'] = $staffDetail;
|
|
|
$this->data ['staffList'] = $staffList;
|
|
|
$this->data ['MebSeaEn'] = $MebSea;
|
|
|
$this->data ['MebSea'] = urlencode ( $MebSea );
|
|
|
-
|
|
|
- $this->data ['invoiceDetail'] = array('invoiceElement'=>$invoiceElement);
|
|
|
+
|
|
|
+ $this->data ['invoiceDetail'] = array (
|
|
|
+ 'invoiceElement' => $invoiceElement
|
|
|
+ );
|
|
|
$this->data ['page'] = $pageinfo;
|
|
|
$this->data ['get'] = $get;
|
|
|
$this->data ['list'] = $list;
|
|
|
$this->data ['status'] = $status;
|
|
|
- $this->data ['categoryList'] =$categoryList;
|
|
|
+ $this->data ['categoryList'] = $categoryList;
|
|
|
|
|
|
$this->data ['memu'] = "invoice";
|
|
|
$this->data ['staff'] = $this->staff;
|
|
@@ -5987,12 +6267,18 @@ class InvoiceController extends DooController {
|
|
|
} elseif ($type == 'RECEIVABLES') {
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
- //
|
|
|
+ Doo::loadModel ( 'invoiceRefund' );
|
|
|
+ $invoiceRefund = new invoiceRefund ();
|
|
|
+
|
|
|
$detail = $invoiceReceivables->getInvoiceReceivablesByIrsid ( $serial );
|
|
|
+ $ireList = $invoiceRefund->getInvoiceRefundIrid ( $detail ['irid'] );
|
|
|
+
|
|
|
if (empty ( $detail ))
|
|
|
$html = '';
|
|
|
else {
|
|
|
- $html = '<div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><h3>收款单详情</h3></div><div class="modal-body saeaList"><table class="table table-bordered table-condensed">
|
|
|
+ $html = '<div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><h3>收款单详情</h3></div><div class="modal-body saeaList">
|
|
|
+
|
|
|
+ <table class="table table-bordered table-condensed">
|
|
|
<tbody><tr>
|
|
|
<th class="taC">收款流水号</th><td>' . $detail ['receivablesSerial'] . '</td>
|
|
|
<th class="taC">录入收款</th><td>' . $detail ['inputStaff'] . ' ' . $detail ['date'] . '</td>
|
|
@@ -6007,7 +6293,36 @@ class InvoiceController extends DooController {
|
|
|
<tr>
|
|
|
<th class="taC">认领收款</th><td colspan="3">' . $detail ['inputStaff'] . ' 转入 ' . $detail ['username'] . ' ' . $detail ['confirmTime'] . '</td>
|
|
|
</tr>
|
|
|
- </tbody></table></div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';
|
|
|
+ </tbody></table>';
|
|
|
+ if (! empty ( $ireList )) {
|
|
|
+ $html .= '
|
|
|
+ <table class="table table-bordered table-condensed"><tbody><tr><th class="taC" colspan="2">退款记录</th></tr>';
|
|
|
+
|
|
|
+ foreach ( $ireList as $key => $value ) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $refundLogList=explode("<br/>",$value['refundLog']);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $html .= '
|
|
|
+ <tr>
|
|
|
+ <th class="taC">退款单位名称</th><td>' . $value ['refundCompany'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC">退款的账号</th><td>' . $value ['refundNumber'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC">退款金额</th><td class="colRed">¥' . $value ['refundPrice'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC">退款</th><td>' . $refundLogList [0].$refundLogList [2] . '</td>
|
|
|
+ </tr>
|
|
|
+ ';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $html .= '</tbody></table></div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';
|
|
|
}
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|