|
@@ -992,6 +992,7 @@ class InvoiceController extends DooController {
|
|
|
'iid' => $iid,
|
|
|
'printStatus' => 1,
|
|
|
'updateTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'printer'=> $this->staff [0] ['username'],
|
|
|
'printTime' => date ( "Y-m-d H:i:s" ),
|
|
|
'invoiceNo' => $invoiceNo
|
|
|
);
|
|
@@ -1184,6 +1185,11 @@ class InvoiceController extends DooController {
|
|
|
$invoiceUnAccount [$key] ['lastApprover'] = $lastApprover;
|
|
|
}
|
|
|
|
|
|
+ $receivablesInput=$invoiceReceivables->getInvoiceReceivablesByInput();
|
|
|
+
|
|
|
+ //print_r($receivablesInput);
|
|
|
+
|
|
|
+ $this->data ['receivablesInput'] = $receivablesInput;
|
|
|
$this->data ['year'] = date ( 'Y' );
|
|
|
$this->data ['invoiceUnAccount'] = $invoiceUnAccount;
|
|
|
$this->data ['receivablesList'] = $receivablesList;
|
|
@@ -1227,8 +1233,12 @@ class InvoiceController extends DooController {
|
|
|
$invoiceDetail = $invoice->getInvoiceByIid ( $iidKey );
|
|
|
$receivablesSerial="#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
|
|
|
|
|
|
- // 收款录入
|
|
|
+ // 收款录入 并绑定发票
|
|
|
+ Doo::db ()->beginTransaction ();
|
|
|
$item = array (
|
|
|
+ 'bindStatus' => 1,
|
|
|
+ 'iid' => $invoiceDetail ['iid'],
|
|
|
+ 'bindDate' => date ( "Y-m-d H:i:s" ),
|
|
|
'receivablesPrice' => $receivablesPrice,
|
|
|
'receivablesMessage' => $receivablesMessage,
|
|
|
'receivablesSerial' => $receivablesSerial,
|
|
@@ -1298,6 +1308,8 @@ class InvoiceController extends DooController {
|
|
|
'iid' => $detail ['iid']
|
|
|
);
|
|
|
$invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+ Doo::db ()->commit ();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return '/invoiceReceivables';
|
|
@@ -1343,7 +1355,8 @@ class InvoiceController extends DooController {
|
|
|
);
|
|
|
if ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
|
|
|
$item += array (
|
|
|
- 'confirmTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ 'confirmTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'inputType' => 1
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -1407,7 +1420,7 @@ class InvoiceController extends DooController {
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
|
|
|
- $receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'] );
|
|
|
+ $receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'],$this->staff [0] ['sid'] );
|
|
|
|
|
|
$this->data ['receivablesList'] = $receivablesList;
|
|
|
|
|
@@ -1530,6 +1543,8 @@ class InvoiceController extends DooController {
|
|
|
*/
|
|
|
function invoiceReceivablesAscription() {
|
|
|
$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
+ $recepitTitleMark = $this->get_args ( 'recepitTitleMark' ) ? $this->get_args ( 'recepitTitleMark' ) : "";
|
|
|
+
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
Doo::loadModel ( 'invoiceROLog' );
|
|
@@ -1539,12 +1554,13 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
|
|
|
- if (! empty ( $detail ) && $detail ['receivablesStaff'] == 'PUBLIC') {
|
|
|
+ if (! empty ( $detail ) && $detail ['receivablesStaff'] == 'PUBLIC'&&!empty($recepitTitleMark)) {
|
|
|
$item = array (
|
|
|
'irid' => $detail ['irid'],
|
|
|
'receivablesCategory' => $this->staff [0] ['cid'] . ":" . $this->staff [0] ['category'],
|
|
|
'receivablesStaff' => $this->staff [0] ['sid'] . "-" . $this->staff [0] ['username'],
|
|
|
'confirmTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'recepitTitleMark' => $recepitTitleMark,
|
|
|
'source' => 1
|
|
|
);
|
|
|
$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
|
|
@@ -1624,7 +1640,9 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
if (empty ( $detail ) && empty ( $detailM ))
|
|
|
die ( 'illegal request' );
|
|
|
-
|
|
|
+ if(!empty($detail['irid']))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
// if ($detailM ['receivablesPrice'] >= $detail ['invoicePrice']) {
|
|
|
// $price = $detailM ['receivablesPrice'] - $detail ['invoicePrice'];
|
|
|
// die ( '<p>收款金额超出开票金额 ¥' . $price . '元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>' );
|
|
@@ -1662,7 +1680,7 @@ class InvoiceController extends DooController {
|
|
|
);
|
|
|
$invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
- return "/invoiceMyReceivables";
|
|
|
+ return "/invoiceReceivables";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2058,7 +2076,7 @@ class InvoiceController extends DooController {
|
|
|
$sid = $XDeode->decode ( $_COOKIE ["staff"] );
|
|
|
$MebSea = isset ( $this->params ['MebSea'] ) ? urldecode ( $this->params ['MebSea'] ) : '';
|
|
|
|
|
|
- $page_size = 1;
|
|
|
+ $page_size = 18;
|
|
|
$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
|
|
|
$date = isset ( $this->params ['date'] ) ? $this->params ['date'] : 'MONTHO';
|
|
|
|
|
@@ -3226,6 +3244,156 @@ class InvoiceController extends DooController {
|
|
|
'detail' => $detail
|
|
|
) );
|
|
|
}
|
|
|
+
|
|
|
+ function ajaxGetInvoiceReceivablesByIrid(){
|
|
|
+ $irid = $this->get_args ( 'irid' ) ? $this->get_args ( 'irid' ) : "";
|
|
|
+
|
|
|
+ if (empty ( $irid )) {
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2,
|
|
|
+ 'msg' => 'illegal request'
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+
|
|
|
+ $detail=$invoiceReceivables->getInvoiceReceivablesByIrid($irid);
|
|
|
+ $invoiceDetail=$invoice->getInvoiceByTitle($detail['recepitTitleMark'],'EXACTLY'," and status=2 and printStatus=1 and irid='' ");//
|
|
|
+
|
|
|
+ $receivablesHtml='<table class="table table-bordered table-condensed"><tbody><tr><th class="taC" width="70">收款金额</th><th class="taC">银行到帐信息</th><th class="taC">银行/到帐时间</th><th class="taC">收款认领</th><th class="taC">开票单位</th></tr>
|
|
|
+ <tr>
|
|
|
+ <td><b>¥'.$detail['receivablesPrice'].'</b></td>
|
|
|
+ <td>'.$detail['receivablesMessage'].'</td>
|
|
|
+ <td>'.$detail['receivablesBank'].'<br>'.$detail['receivablesDate'].'</td>
|
|
|
+ <td>'.$detail['title'].'-'.$detail['username'].'<br>'.$detail['confirmTime'].'</td>
|
|
|
+ <td>'.$detail['recepitTitleMark'].'</td>
|
|
|
+ </tr></tbody></table>';
|
|
|
+
|
|
|
+
|
|
|
+ $isInvoice=false;$invoiceHtml='';
|
|
|
+ if(empty($invoiceDetail)){
|
|
|
+ $isInvoice=true;
|
|
|
+ }else{
|
|
|
+ $invoiceHtml='<table class="table table-bordered table-condensed">
|
|
|
+ <thead><tr><th>开票单位(抬头)</th><th>开票金额</th><th>提交开票</th><th>出票</th><th>开票流水号</th><th width="80">入账</th></tr></thead><tbody><tr>';
|
|
|
+ if (! empty ( $invoiceDetail ['invoiceType'] )) {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoiceCompany'] . '</td>';
|
|
|
+ } else {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoiceTitle'] . '</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (! empty ( $invoiceDetail ['invoiceType'] )) {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '专</td>';
|
|
|
+ } else {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $invoiceHtml.='
|
|
|
+ <td>' . $invoiceDetail ['categoryName'].$invoiceDetail ['userName'] . ' ' . $invoiceDetail ['date']. '</td>
|
|
|
+ <td>' . $invoiceDetail ['printer']. ' ' . $invoiceDetail ['printTime']. '</td>
|
|
|
+ <td>' . $invoiceDetail ['invoiceSerial']. '</td><td><a class="button btn-block" bind-receivables="ir'.$invoiceDetail ['iidKeyXD'].'" data-ikey="'.$invoiceDetail ['iidKey'].'" href="javascript:void(0)">入账</a></td>
|
|
|
+ </tr>
|
|
|
+ ';
|
|
|
+ $invoiceHtml.='</tbody></table>
|
|
|
+
|
|
|
+
|
|
|
+ <script>
|
|
|
+ $(\'a[bind-receivables="ir' . $invoiceDetail ['iidKeyXD'] . '"]\').click(function() {
|
|
|
+ $("input[name=\'invoiceKey\']").val("'.$invoiceDetail ['iidKey'].'");
|
|
|
+ var invoiceKey=$("input[name=\'invoiceKey\']").val();
|
|
|
+ if(invoiceKey==""){
|
|
|
+ alert("入账错误,请重新刷新页面");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(window.confirm("确定入账吗?")){
|
|
|
+ $("#IBR").submit();
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+
|
|
|
+
|
|
|
+ ';
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'irkey'=>$detail['iridEn'],
|
|
|
+ 'receivablesHtml' => $receivablesHtml,
|
|
|
+ 'isInvoice'=>$isInvoice,
|
|
|
+ 'invoiceHtml' => $invoiceHtml
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ function ajaxGetInvoiceReceivablesByTitle(){
|
|
|
+ $title = $this->get_args ( 'title' ) ? $this->get_args ( 'title' ) : "";
|
|
|
+
|
|
|
+ if (empty ( $title )) {
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2,
|
|
|
+ 'msg' => 'illegal request'
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+
|
|
|
+ $invoiceDetail=$invoice->getInvoiceByTitle($title,'EXACTLY'," and status=2 and printStatus=1 and irid='' ");
|
|
|
+
|
|
|
+ $invoiceHtml='';
|
|
|
+ if(!empty($invoiceDetail)){
|
|
|
+ $invoiceHtml='<table class="table table-bordered table-condensed">
|
|
|
+ <thead><tr><th>开票单位(抬头)</th><th>开票金额</th><th>提交开票</th><th>出票</th><th>开票流水号</th><th width="80">入账</th></tr></thead><tbody><tr>';
|
|
|
+ if (! empty ( $invoiceDetail ['invoiceType'] )) {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoiceCompany'] . '</td>';
|
|
|
+ } else {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoiceTitle'] . '</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (! empty ( $invoiceDetail ['invoiceType'] )) {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '专</td>';
|
|
|
+ } else {
|
|
|
+ $invoiceHtml .= '<td>' . $invoiceDetail ['invoicePrice'] . '</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $invoiceHtml.='
|
|
|
+ <td>' . $invoiceDetail ['categoryName'].$invoiceDetail ['userName'] . ' ' . $invoiceDetail ['date']. '</td>
|
|
|
+ <td>' . $invoiceDetail ['printer']. ' ' . $invoiceDetail ['printTime']. '</td>
|
|
|
+ <td>' . $invoiceDetail ['invoiceSerial']. '</td><td><a class="button btn-block" bind-receivables="ir'.$invoiceDetail ['iidKeyXD'].'" data-ikey="'.$invoiceDetail ['iidKey'].'" href="#">入账</a></td>
|
|
|
+ </tr>
|
|
|
+ ';
|
|
|
+ $invoiceHtml.='</tbody></table>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ $(\'a[bind-receivables="ir' . $invoiceDetail ['iidKeyXD'] . '"]\').click(function() {
|
|
|
+ $("input[name=\'invoiceKey\']").val("'.$invoiceDetail ['iidKey'].'");
|
|
|
+ var invoiceKey=$("input[name=\'invoiceKey\']").val();
|
|
|
+ if(invoiceKey==""){
|
|
|
+ alert("入账错误,请重新刷新页面");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(window.confirm("确定入账吗?")){
|
|
|
+ $("#IBR").submit();
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ ';
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'invoiceHtml' => $invoiceHtml
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
function _GetFileEXT($filename) {
|
|
|
$pics = explode ( '.', $filename );
|
|
|
$num = count ( $pics );
|