|
@@ -1041,24 +1041,22 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 发票收入多个收款数据
|
|
|
+ * 发票收款完成
|
|
|
*/
|
|
|
function invoiceEnterReceivables(){
|
|
|
$invoiceKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
- $invoiceClaim = $this->get_args ( 'invoiceClaim' ) ? $this->get_args ( 'invoiceClaim' ) : "";
|
|
|
+ //$invoiceClaim = $this->get_args ( 'invoiceClaim' ) ? $this->get_args ( 'invoiceClaim' ) : "";
|
|
|
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
- Doo::loadModel ( 'invoiceReceivables' );
|
|
|
- $invoiceReceivables = new invoiceReceivables ();
|
|
|
Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
$invoiceOperationLog = new invoiceOperationLog ();
|
|
|
|
|
|
$detail=$invoice->getInvoiceByIid($invoiceKey);
|
|
|
|
|
|
- if (empty($detail)||empty($invoiceClaim))
|
|
|
+ if (empty($detail))
|
|
|
die ( 'illegal request' );
|
|
|
-
|
|
|
+ /*
|
|
|
$receivablesPrice=0;$iridString=$detail['irid'];$iridList=array();
|
|
|
foreach ($invoiceClaim as $key=>$value){
|
|
|
$detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($value);
|
|
@@ -1074,10 +1072,10 @@ class InvoiceController extends DooController {
|
|
|
$price=$receivablesPrice-$detail['invoicePrice'];
|
|
|
die('<p>收款金额超出开票金额 ¥'.$price.'元,请谨慎操作</p><a href="/invoice">返回</a>');
|
|
|
}
|
|
|
-
|
|
|
+ */
|
|
|
+
|
|
|
$item = array (
|
|
|
- 'irid' => $iridString,
|
|
|
- 'bindTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'untreadStatus' => 3,
|
|
|
'updateTime'=> date ( "Y-m-d H:i:s" ),
|
|
|
'iid' => $detail['iid']
|
|
|
);
|
|
@@ -1086,8 +1084,8 @@ class InvoiceController extends DooController {
|
|
|
//操作日志
|
|
|
$item = array (
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
- 'operation' => "多个收款入账到发票".$detail['invoiceSerial'],
|
|
|
- 'status' => 8,
|
|
|
+ 'operation' => "发票".$detail['invoiceSerial']."收款完成",
|
|
|
+ 'status' => 9,
|
|
|
'img' => $this->staff [0] ['avatar'],
|
|
|
'username' => $this->staff [0] ['username'],
|
|
|
'uid' => $this->staff [0] ['sid'],
|
|
@@ -1096,6 +1094,7 @@ class InvoiceController extends DooController {
|
|
|
);
|
|
|
$invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
+ /*
|
|
|
foreach ($iridList as $key=>$value){
|
|
|
$item = array (
|
|
|
'iid' => $detail['iid'],
|
|
@@ -1106,7 +1105,7 @@ class InvoiceController extends DooController {
|
|
|
);
|
|
|
$invoiceReceivables->setInvoiceReceivablesByCondition($item);
|
|
|
}
|
|
|
-
|
|
|
+ */
|
|
|
return "/invoice";
|
|
|
}
|
|
|
|
|
@@ -1120,7 +1119,7 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$list = $invoice->getInvoiceByReceivables ( $this->staff [0] ['sid'] );
|
|
|
|
|
|
- $html = "";
|
|
|
+ $html = "";$i=1;
|
|
|
foreach ( $list as $key => $value ) {
|
|
|
$html .= '<tr>
|
|
|
<td>' . $value ['invoiceElement'] . '</td>
|
|
@@ -1133,14 +1132,14 @@ class InvoiceController extends DooController {
|
|
|
<td>' . $value ['invoiceTitle'] . '</td>';
|
|
|
}
|
|
|
|
|
|
- $html .= '<td><label><input type="radio" node-Claim="true" p-data="'.$value ['iidKey'].'" name="invoiceClaim"> 使用Ta</label></td></tr>
|
|
|
+ $html .= '<td><label><input type="radio" node-Claim="true_'.$i.'" p-data="'.$value ['iidKey'].'" name="invoiceClaim"> 使用Ta</label></td></tr>
|
|
|
<script>
|
|
|
- $(\'input[node-Claim="true"]\').click(function() {
|
|
|
+ $(\'input[node-Claim="true_'.$i.'"]\').click(function() {
|
|
|
|
|
|
var invoiceKey= $(this).attr("p-data");
|
|
|
var claimKey=$("input[name=\'key\']").val();
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
- var url = "/ajaxCompareClaimPrice";
|
|
|
+ var url = "/ajaxCompareInvoicePrice";
|
|
|
$.ajax({
|
|
|
url : url,
|
|
|
type : "post",
|
|
@@ -1165,6 +1164,7 @@ class InvoiceController extends DooController {
|
|
|
});
|
|
|
</script>
|
|
|
';
|
|
|
+ $i++;
|
|
|
}
|
|
|
|
|
|
echo json_encode ( array (
|
|
@@ -1173,37 +1173,6 @@ class InvoiceController extends DooController {
|
|
|
) );
|
|
|
}
|
|
|
|
|
|
- function ajaxCompareClaimPrice(){
|
|
|
- $claimKey = $this->get_args ( 'claimKey' ) ? $this->get_args ( 'claimKey' ) : "";
|
|
|
- $invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
|
|
|
-
|
|
|
- Doo::loadModel ( 'invoice' );
|
|
|
- $invoice = new invoice ();
|
|
|
- Doo::loadModel ( 'invoiceReceivables' );
|
|
|
- $invoiceReceivables = new invoiceReceivables ();
|
|
|
-
|
|
|
- $detail=$invoice->getInvoiceByIid($invoiceKey);
|
|
|
-
|
|
|
-
|
|
|
- $keyList=explode(';', $claimKey);$receivablesPrice=0;
|
|
|
- foreach ($keyList as $key=>$value){
|
|
|
- $detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($value);
|
|
|
- $receivablesPrice+=$detailM['receivablesPrice'];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if ($receivablesPrice>=$detail['invoicePrice']){
|
|
|
- $price=$receivablesPrice-$detail['invoicePrice'];
|
|
|
- echo json_encode ( array (
|
|
|
- 'status' => 1,
|
|
|
- 'price'=>$price
|
|
|
- ) );
|
|
|
- }else
|
|
|
- echo json_encode ( array (
|
|
|
- 'status' => 2
|
|
|
- ) );
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取一条收款信息
|
|
|
*/
|
|
@@ -1282,6 +1251,117 @@ class InvoiceController extends DooController {
|
|
|
) );
|
|
|
}
|
|
|
|
|
|
+ function ajaxCompareClaimPrice(){
|
|
|
+ $irid = $this->get_args ( 'irid' ) ? $this->get_args ( 'irid' ) : "";
|
|
|
+ $invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $detail=$invoice->getInvoiceByIid($invoiceKey);
|
|
|
+ $detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($irid);
|
|
|
+
|
|
|
+ if (empty($detail)||empty($detailM)){
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2,
|
|
|
+ 'msg'=>'非法请求,请重新登录'
|
|
|
+ ) );die;
|
|
|
+ }
|
|
|
+
|
|
|
+ $iridString="";
|
|
|
+ if (empty($detail['irid']))
|
|
|
+ $iridString=$detailM['irid'];
|
|
|
+ else
|
|
|
+ $iridString=$detail['irid'].','.$detailM['irid'];
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'irid' => $iridString,
|
|
|
+ 'bindTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'updateTime'=> date ( "Y-m-d H:i:s" ),
|
|
|
+ 'iid' => $detail['iid']
|
|
|
+ );
|
|
|
+ $invoice->setInvoiceByCondition($item);
|
|
|
+
|
|
|
+ //操作日志
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => "收款入账".$detailM['receivablesSerial']."到发票".$detail['invoiceSerial'],
|
|
|
+ 'status' => 8,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $detail['iid']
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $detail['iid'],
|
|
|
+ 'irid' => $detailM['irid'],
|
|
|
+ 'bindDate'=>date ( "Y-m-d H:i:s" ),
|
|
|
+ 'bindStatus' => 1
|
|
|
+
|
|
|
+ );
|
|
|
+ $invoiceReceivables->setInvoiceReceivablesByCondition($item);
|
|
|
+
|
|
|
+ $price=0;$priceStatus=0;
|
|
|
+ $list=$invoiceReceivables->getInvoiceReceivablesInIridString($iridString);
|
|
|
+ $receivablesPrice=0;
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ $receivablesPrice+=$value['receivablesPrice'];
|
|
|
+ }
|
|
|
+ if ($receivablesPrice>=$detail['invoicePrice']){
|
|
|
+ $price=$receivablesPrice-$detail['invoicePrice'];
|
|
|
+ $priceStatus=1;
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'html'=>'<tr><td>¥'.$detailM['receivablesPrice'].'</td><td>'.$detailM['receivablesMessage'].'</td><td>'.$detailM['receivablesBank'].'</td>
|
|
|
+ <td>'.$detailM['receivablesDate'].'</td><td><a href="">移除</a></td></tr>',
|
|
|
+ 'price'=>$price,
|
|
|
+ 'priceStatus'=>$priceStatus
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的收款中 选择哪个发票入账,进行金额判断
|
|
|
+ */
|
|
|
+ function ajaxCompareInvoicePrice(){
|
|
|
+ $claimKey = $this->get_args ( 'claimKey' ) ? $this->get_args ( 'claimKey' ) : "";
|
|
|
+ $invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+
|
|
|
+ $detail=$invoice->getInvoiceByIid($invoiceKey);
|
|
|
+
|
|
|
+
|
|
|
+ $keyList=explode(';', $claimKey);$receivablesPrice=0;
|
|
|
+ foreach ($keyList as $key=>$value){
|
|
|
+ $detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($value);
|
|
|
+ $receivablesPrice+=$detailM['receivablesPrice'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if ($receivablesPrice>=$detail['invoicePrice']){
|
|
|
+ $price=$receivablesPrice-$detail['invoicePrice'];
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'price'=>$price
|
|
|
+ ) );
|
|
|
+ }else
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* 获得与我有关收款数据
|
|
|
*/
|
|
@@ -1289,28 +1369,31 @@ class InvoiceController extends DooController {
|
|
|
$iid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
|
|
|
+ $detail=$invoice->getInvoiceByIid($iid);
|
|
|
$list =$invoiceReceivables->getInvoiceReceivablesByClaim($this->staff [0] ['cid'],$this->staff [0] ['sid']);
|
|
|
|
|
|
$html = "";
|
|
|
+ $i=1;
|
|
|
foreach ( $list['myClaim'] as $key => $value ) {
|
|
|
- $html .= '<tr>
|
|
|
+ $html .= '<tr id="'.$value ['receivablesSerial'].'" >
|
|
|
<td>¥' . $value ['receivablesPrice'] . '</td>
|
|
|
<td>' . $value ['receivablesMessage'] . '</td>
|
|
|
<td>' . $value ['receivablesBank'] . '</td>
|
|
|
<td>' . $value ['receivablesDate'] . '</td>';
|
|
|
- $html .= '<td><label><input type="checkbox" node-Claim="true" value="'.$value ['iidKey'].'" name="invoiceClaim[]"> 使用Ta</label></td></tr>
|
|
|
+ $html .= '<td>
|
|
|
+ <a href="javascript:void(0)" node-Claim="true_'.$i.'" p-data="'.$value ['iidKey'].'" name="invoiceClaim" class="button">入账</a>
|
|
|
+ </td></tr>
|
|
|
<script>
|
|
|
- $(\'input[node-Claim="true"]\').click(function() {
|
|
|
-
|
|
|
- var result = new Array();
|
|
|
- $("[node-Claim=\'true\']:checkbox").each(function () {
|
|
|
- if ($(this).is(":checked")) {
|
|
|
- result.push($(this).attr("value"));
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ $(\'a[node-Claim="true_'.$i.'"]\').click(function() {
|
|
|
var invoiceKey=$("input[name=\'key\']").val();
|
|
|
+ var irid= $(this).attr("p-data");
|
|
|
+ var element=($(this));
|
|
|
+ $("p[node-loading=\"true\"]").show();
|
|
|
+ $("p[node-loading=\"true\"]").html("入账处理中...");
|
|
|
+
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
var url = "/ajaxCompareClaimPrice";
|
|
|
$.ajax({
|
|
@@ -1319,7 +1402,61 @@ class InvoiceController extends DooController {
|
|
|
cache : false,
|
|
|
dataType : "json",
|
|
|
data : {
|
|
|
- claimKey : result.join(";"),
|
|
|
+ irid : irid,
|
|
|
+ invoiceKey:invoiceKey
|
|
|
+ },
|
|
|
+ global : true,
|
|
|
+ success : function(data) {
|
|
|
+ $("input[name=\'invoiceKey\']").val("'.$value ['iidKey'].'");
|
|
|
+ if (data.status == 1) {
|
|
|
+ $(element).parent().parent().remove();
|
|
|
+ $("tbody[box-enter=\"true\"]").append(data.html);
|
|
|
+ $("p[node-loading=\"true\"]").hide();
|
|
|
+ if(data.priceStatus == 1){
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
+ }
|
|
|
+ }else if(data.status == 2){
|
|
|
+ $("p[node-loading=\"true\"]").html(data.msg);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : function(err) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ ';
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ $html2="";
|
|
|
+ $list2 =$invoiceReceivables->getInvoiceReceivablesByIid($iid,1);
|
|
|
+ foreach ( $list2 as $key => $value ) {
|
|
|
+ $html2 .= '<tr id="'.$value ['receivablesSerial'].'" >
|
|
|
+ <td>¥' . $value ['receivablesPrice'] . '</td>
|
|
|
+ <td>' . $value ['receivablesMessage'] . '</td>
|
|
|
+ <td>' . $value ['receivablesBank'] . '</td>
|
|
|
+ <td>' . $value ['receivablesDate'] . '</td>';
|
|
|
+ $html2 .= '<td>
|
|
|
+ <a href="javascript:void(0)" node-Claim="true_'.$i.'" p-data="'.$value ['iidKey'].'" name="invoiceClaim" >移除</a>
|
|
|
+ </td></tr>
|
|
|
+ <script>
|
|
|
+ $(\'a[node-Claim="true_'.$i.'"]\').click(function() {
|
|
|
+ var invoiceKey=$("input[name=\'key\']").val();
|
|
|
+ var irid= $(this).attr("p-data");
|
|
|
+ var element=($(this));
|
|
|
+ $("p[node-loading=\"true\"]").show();
|
|
|
+ $("p[node-loading=\"true\"]").html("入账处理中...");
|
|
|
+
|
|
|
+ $("p[node-msg=\"true\"]").hide();
|
|
|
+ //var url = "/ajaxCompareClaimPrice";
|
|
|
+ $.ajax({
|
|
|
+ url : url,
|
|
|
+ type : "post",
|
|
|
+ cache : false,
|
|
|
+ dataType : "json",
|
|
|
+ data : {
|
|
|
+ irid : irid,
|
|
|
invoiceKey:invoiceKey
|
|
|
},
|
|
|
global : true,
|
|
@@ -1327,8 +1464,15 @@ class InvoiceController extends DooController {
|
|
|
$("input[name=\'invoiceKey\']").val("'.$value ['iidKey'].'");
|
|
|
if (data.status == 1) {
|
|
|
|
|
|
- $("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
- $("p[node-msg=\"true\"]").show();
|
|
|
+ $(element).parent().parent().remove();
|
|
|
+ $("tbody[box-enter=\"true\"]").append(data.html);
|
|
|
+ $("p[node-loading=\"true\"]").hide();
|
|
|
+ if(data.priceStatus == 1){
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
+ }
|
|
|
+ }else if(data.status == 2){
|
|
|
+ $("p[node-loading=\"true\"]").html(data.msg);
|
|
|
}
|
|
|
},
|
|
|
error : function(err) {
|
|
@@ -1337,11 +1481,26 @@ class InvoiceController extends DooController {
|
|
|
});
|
|
|
</script>
|
|
|
';
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ $price=0;$priceStatus=0;
|
|
|
+ $list=$invoiceReceivables->getInvoiceReceivablesInIridString($detail['irid']);
|
|
|
+ $receivablesPrice=0;
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ $receivablesPrice+=$value['receivablesPrice'];
|
|
|
+ }
|
|
|
+ if ($receivablesPrice>=$detail['invoicePrice']){
|
|
|
+ $price=$receivablesPrice-$detail['invoicePrice'];
|
|
|
+ $priceStatus=1;
|
|
|
}
|
|
|
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'html' => $html
|
|
|
+ 'html' => $html,
|
|
|
+ 'html2'=>$html2,
|
|
|
+ 'price'=>$price,
|
|
|
+ 'priceStatus'=>$priceStatus
|
|
|
) );
|
|
|
}
|
|
|
|