|
@@ -1033,6 +1033,12 @@ class InvoiceController extends DooController {
|
|
|
'receivablesCategory' => $receivablesCategory,
|
|
|
'receivablesStaff' => $receivablesStaff
|
|
|
);
|
|
|
+ if ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
|
|
|
+ $item += array (
|
|
|
+ 'confirmTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
$irid = $invoiceReceivables->addInvoiceReceivables ( $item );
|
|
|
|
|
|
// 收款操作日志
|
|
@@ -1047,13 +1053,11 @@ class InvoiceController extends DooController {
|
|
|
elseif ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
|
|
|
$receivablesStaff = explode ( '-', $receivablesStaff );
|
|
|
$item = array (
|
|
|
- 'operation' => $this->staff [0] ['username'] . " 转入 " . $receivablesStaff [1],
|
|
|
- 'bindDate' => date ( "Y-m-d H:i:s" )
|
|
|
+ 'operation' => $this->staff [0] ['username'] . " 转入 " . $receivablesStaff [1]
|
|
|
);
|
|
|
}
|
|
|
$item += array (
|
|
|
'date' => date ( "Y-m-d" ),
|
|
|
-
|
|
|
'status' => 1,
|
|
|
'img' => $this->staff [0] ['avatar'],
|
|
|
'username' => $this->staff [0] ['username'],
|
|
@@ -1630,10 +1634,15 @@ class InvoiceController extends DooController {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
|
|
|
+ $MebSea = isset($this->params ['MebSea']) ? urldecode($this->params ['MebSea']) : '';
|
|
|
+
|
|
|
+
|
|
|
$page_size=1;
|
|
|
$page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
|
|
|
$date = isset($this->params ['date']) ? $this->params ['date'] : 'MONTHO';
|
|
|
|
|
|
+ $get="/".$date;
|
|
|
+
|
|
|
$con='';
|
|
|
if ($date=='MONTHO')
|
|
|
$con=' and updateTime>DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
|
|
@@ -1642,15 +1651,21 @@ class InvoiceController extends DooController {
|
|
|
elseif ($date=='MONTHY')
|
|
|
$con=' and updateTime>DATE_SUB(CURDATE(), INTERVAL 1 YEAR)';
|
|
|
|
|
|
+ if (!empty($MebSea)){
|
|
|
+ $con.=' and ( invoiceTitle like "%'.$MebSea.'%" or invoiceCompany like "%'.$MebSea.'%" or invoicePrice like "%'.$MebSea.'%" )';
|
|
|
+ $get.="/".$MebSea;
|
|
|
+ }
|
|
|
$pageinfo['page']=array('previous'=>'');
|
|
|
$sql='status=2 and untreadStatus=3 and sid='.$_COOKIE ["staff"].$con;
|
|
|
- $pageinfo=$this->get_page("CLD_invoice", $sql, $page, $page_size, "invoiceAchieve","","");
|
|
|
+ $pageinfo=$this->get_page("CLD_invoice", $sql, $page, $page_size, "invoiceAchieve",$get,"");
|
|
|
|
|
|
$limit=$pageinfo ['lower'].','.$page_size;
|
|
|
|
|
|
$list=$invoice->getInvoiceByUntreadStatusPage($limit,$_COOKIE ["staff"],$con);
|
|
|
//print_r($pageinfo);
|
|
|
-
|
|
|
+ $this->data['MebSeaEn']=$MebSea;
|
|
|
+ $this->data['MebSea']=urlencode($MebSea);
|
|
|
+ $this->data['get']=$get;
|
|
|
$this->data['page']=$pageinfo;
|
|
|
$this->data ['list'] = $list;
|
|
|
$this->data ['date']=$date;
|
|
@@ -1660,6 +1675,107 @@ class InvoiceController extends DooController {
|
|
|
$this->render ( "/admin/invoiceAchieve", $this->data );
|
|
|
}
|
|
|
|
|
|
+ function invoiceReceivablesAchieve() {
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+
|
|
|
+ $MebSea = isset($this->params ['MebSea']) ? urldecode($this->params ['MebSea']) : '';
|
|
|
+
|
|
|
+ $page_size=1;
|
|
|
+ $page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
|
|
|
+ $date = isset($this->params ['date']) ? $this->params ['date'] : 'MONTHO';
|
|
|
+
|
|
|
+ $get="/".$date;
|
|
|
+
|
|
|
+ $con='';
|
|
|
+ if ($date=='MONTHO')
|
|
|
+ $con=' and bindDate>DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
|
|
|
+ elseif ($date=='MONTHT')
|
|
|
+ $con=' and bindDate>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)';
|
|
|
+ elseif ($date=='MONTHY')
|
|
|
+ $con=' and bindDate>DATE_SUB(CURDATE(), INTERVAL 1 YEAR)';
|
|
|
+
|
|
|
+ if (!empty($MebSea)){
|
|
|
+ $con.=' and ( receivablesMessage like "%'.$MebSea.'%" or receivablesPrice like "%'.$MebSea.'%" )';
|
|
|
+ $get.="/".$MebSea;
|
|
|
+ }
|
|
|
+ $pageinfo['page']=array('previous'=>'');
|
|
|
+ $sql=" bindStatus=1 and receivablesStaff like '" . $_COOKIE ["staff"] . "_%' ".$con;
|
|
|
+ $pageinfo=$this->get_page("CLD_invoiceReceivables", $sql, $page, $page_size, "invoiceReceivablesAchieve",$get,"");
|
|
|
+
|
|
|
+ $limit=$pageinfo ['lower'].','.$page_size;
|
|
|
+
|
|
|
+ $list=$invoiceReceivables->getReceivablesByUntreadStatusPage($limit,$sql);
|
|
|
+ //print_r($pageinfo);
|
|
|
+ $this->data['MebSeaEn']=$MebSea;
|
|
|
+ $this->data['MebSea']=urlencode($MebSea);
|
|
|
+ $this->data['get']=$get;
|
|
|
+ $this->data['page']=$pageinfo;
|
|
|
+ $this->data ['list'] = $list;
|
|
|
+ $this->data ['date']=$date;
|
|
|
+ $this->data ['memu'] = "invoice";
|
|
|
+ $this->data ['staff'] = $this->staff;
|
|
|
+ $this->data ['receiptMemu'] = 'invoiceMyReceivables';
|
|
|
+ $this->render ( "/admin/invoiceReceivablesAchieve", $this->data );
|
|
|
+ }
|
|
|
+
|
|
|
+ function invoiceReceivablesAS() {
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+
|
|
|
+ $MebSea = isset($this->params ['MebSea']) ? urldecode($this->params ['MebSea']) : '';
|
|
|
+
|
|
|
+ $page_size=1;
|
|
|
+ $page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
|
|
|
+ $status = isset($this->params ['status']) ? $this->params ['status'] : 'All';
|
|
|
+
|
|
|
+ $year=isset($this->params ['year'])&&is_numeric ( $this->params ['year'] )?$this->params ['year']:date('Y');
|
|
|
+ $month=isset($this->params ['month'])&&is_numeric ( $this->params ['month'] )?$this->params ['month']:"All";
|
|
|
+
|
|
|
+ $con="Year(date) =".$year;
|
|
|
+ if($month!="All")
|
|
|
+ $con="Year(date) =".$year." and Month(date) = ".$month;
|
|
|
+
|
|
|
+ if ($status=='Unclaimed')
|
|
|
+ $con.=' and bindStatus=0';
|
|
|
+ elseif ($status=='Credited')
|
|
|
+ $con.=' and bindStatus=1';
|
|
|
+
|
|
|
+ $get="/".$status."/".$year."/".$month;
|
|
|
+
|
|
|
+ if (!empty($MebSea)){
|
|
|
+ $con.=' and ( receivablesMessage like "%'.$MebSea.'%" or receivablesPrice like "%'.$MebSea.'%" )';
|
|
|
+ $get.="/".$MebSea;
|
|
|
+ }
|
|
|
+ $pageinfo['page']=array('previous'=>'');
|
|
|
+ $pageinfo=$this->get_page("CLD_invoiceReceivables", $con, $page, $page_size, "invoiceReceivablesAS",$get,"");
|
|
|
+ $limit=$pageinfo ['lower'].','.$page_size;
|
|
|
+
|
|
|
+ $list=$invoiceReceivables->getReceivablesByUntreadStatusPage($limit,$con);
|
|
|
+ //print_r($pageinfo);
|
|
|
+ $mothHtml="";
|
|
|
+ for($i=1;$i<=12;$i++){
|
|
|
+ if($month==$i)
|
|
|
+ $mothHtml.='<option selected value="'.$i.'">'.$i.'月</option>';
|
|
|
+ else
|
|
|
+ $mothHtml.='<option value="'.$i.'">'.$i.'月</option>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->data['MebSeaEn']=$MebSea;
|
|
|
+ $this->data['MebSea']=urlencode($MebSea);
|
|
|
+ $this->data['mothHtml']=$mothHtml;
|
|
|
+ $this->data['year']=$year;
|
|
|
+ $this->data['month']=$month;
|
|
|
+ $this->data['page']=$pageinfo;
|
|
|
+ $this->data['get']=$get;
|
|
|
+ $this->data ['list'] = $list;
|
|
|
+ $this->data ['status']=$status;
|
|
|
+ $this->data ['memu'] = "invoice";
|
|
|
+ $this->data ['staff'] = $this->staff;
|
|
|
+ $this->data ['receiptMemu'] = 'invoiceReceivables';
|
|
|
+ $this->render ( "/admin/invoiceReceivablesAS", $this->data );
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获得与我有关可收款的发票
|
|
|
*/
|
|
@@ -1691,6 +1807,7 @@ class InvoiceController extends DooController {
|
|
|
var invoiceKey= $(this).attr("p-data");
|
|
|
var claimKey=$("input[name=\'key\']").val();
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
+
|
|
|
var url = "/ajaxCompareInvoicePrice";
|
|
|
$.ajax({
|
|
|
url : url,
|
|
@@ -1797,6 +1914,7 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$select = "iid,recipients,recipientsPhone,recipientsAddress,mailItems,expressCompany,expressNumber,actualItems";
|
|
|
$invoiceDetail = $invoice->getInvoiceByIid ( $iid, $select );
|
|
|
+
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
'invoiceDetail' => $invoiceDetail
|
|
@@ -1860,17 +1978,21 @@ class InvoiceController extends DooController {
|
|
|
$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
|
|
|
|
|
|
$price = 0;
|
|
|
- $priceStatus = 0;
|
|
|
+ $priceStatus = 0;$isReceivables=0;
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );
|
|
|
+ if (!empty($list))
|
|
|
+ $isReceivables=1;
|
|
|
$receivablesPrice = 0;
|
|
|
-
|
|
|
foreach ( $list as $key => $value ) {
|
|
|
$receivablesPrice += $value ['receivablesPrice'];
|
|
|
}
|
|
|
if ($receivablesPrice > $detail ['invoicePrice']) {
|
|
|
$price = $receivablesPrice - $detail ['invoicePrice'];
|
|
|
$priceStatus = 1;
|
|
|
+ }elseif($receivablesPrice < $detail ['invoicePrice']){
|
|
|
+ $price = $detail ['invoicePrice']-$receivablesPrice;
|
|
|
+ $priceStatus = 2;
|
|
|
}
|
|
|
|
|
|
echo json_encode ( array (
|
|
@@ -1885,7 +2007,7 @@ class InvoiceController extends DooController {
|
|
|
var element=($(this));
|
|
|
$("p[node-loading=\"true\"]").show();
|
|
|
$("p[node-loading=\"true\"]").html("移除处理中...");
|
|
|
-
|
|
|
+ $("p[node-msg=\"true2\"]").hide();
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
var url = "/ajaxReceivablesRemove";
|
|
|
$.ajax({
|
|
@@ -1907,6 +2029,9 @@ class InvoiceController extends DooController {
|
|
|
if(data.priceStatus == 1){
|
|
|
$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
$("p[node-msg=\"true\"]").show();
|
|
|
+ }else if(data.priceStatus == 2&& data.isReceivables != 0){
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
}
|
|
|
}else if(data.status == 2){
|
|
|
$("p[node-loading=\"true\"]").html(data.msg);
|
|
@@ -1919,7 +2044,8 @@ class InvoiceController extends DooController {
|
|
|
</script>
|
|
|
',
|
|
|
'price' => $price,
|
|
|
- 'priceStatus' => $priceStatus
|
|
|
+ 'priceStatus' => $priceStatus,
|
|
|
+ 'isReceivables'=>$isReceivables
|
|
|
) );
|
|
|
}
|
|
|
|
|
@@ -1978,15 +2104,22 @@ class InvoiceController extends DooController {
|
|
|
$invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
$price = 0;
|
|
|
- $priceStatus = 0;
|
|
|
+ $priceStatus = 0;$isReceivables=0;
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $invoiceIrid );
|
|
|
+
|
|
|
+ if (!empty($list))
|
|
|
+ $isReceivables=1;
|
|
|
$receivablesPrice = 0;
|
|
|
foreach ( $list as $key => $value ) {
|
|
|
$receivablesPrice += $value ['receivablesPrice'];
|
|
|
}
|
|
|
- if ($receivablesPrice >= $detail ['invoicePrice']) {
|
|
|
+ if ($receivablesPrice > $detail ['invoicePrice']) {
|
|
|
$price = $receivablesPrice - $detail ['invoicePrice'];
|
|
|
$priceStatus = 1;
|
|
|
+ }elseif($receivablesPrice < $detail ['invoicePrice']){
|
|
|
+ $price = $detail ['invoicePrice']-$receivablesPrice;
|
|
|
+ $priceStatus = 2;
|
|
|
}
|
|
|
|
|
|
echo json_encode ( array (
|
|
@@ -2005,7 +2138,7 @@ class InvoiceController extends DooController {
|
|
|
var element=($(this));
|
|
|
$("p[node-loading=\"true\"]").show();
|
|
|
$("p[node-loading=\"true\"]").html("入账处理中...");
|
|
|
-
|
|
|
+ $("p[node-msg=\"true2\"]").hide();
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
var url = "/ajaxCompareClaimPrice";
|
|
|
$.ajax({
|
|
@@ -2027,7 +2160,10 @@ class InvoiceController extends DooController {
|
|
|
if(data.priceStatus == 1){
|
|
|
$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
$("p[node-msg=\"true\"]").show();
|
|
|
- }
|
|
|
+ }else if(data.priceStatus == 2&& data.isReceivables != 0){
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
+ }
|
|
|
}else if(data.status == 2){
|
|
|
$("p[node-loading=\"true\"]").html(data.msg);
|
|
|
}
|
|
@@ -2039,7 +2175,8 @@ class InvoiceController extends DooController {
|
|
|
</script>
|
|
|
',
|
|
|
'price' => $price,
|
|
|
- 'priceStatus' => $priceStatus
|
|
|
+ 'priceStatus' => $priceStatus ,
|
|
|
+ 'isReceivables'=>$isReceivables
|
|
|
) );
|
|
|
}
|
|
|
|
|
@@ -2107,7 +2244,7 @@ class InvoiceController extends DooController {
|
|
|
var element=($(this));
|
|
|
$("p[node-loading=\"true\"]").show();
|
|
|
$("p[node-loading=\"true\"]").html("入账处理中...");
|
|
|
-
|
|
|
+ $("p[node-msg=\"true2\"]").hide();
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
var url = "/ajaxCompareClaimPrice";
|
|
|
$.ajax({
|
|
@@ -2129,7 +2266,10 @@ class InvoiceController extends DooController {
|
|
|
if(data.priceStatus == 1){
|
|
|
$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
$("p[node-msg=\"true\"]").show();
|
|
|
- }
|
|
|
+ }else if(data.priceStatus == 2&& data.isReceivables != 0){
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
+ }
|
|
|
}else if(data.status == 2){
|
|
|
$("p[node-loading=\"true\"]").html(data.msg);
|
|
|
}
|
|
@@ -2162,7 +2302,7 @@ class InvoiceController extends DooController {
|
|
|
var element=($(this));
|
|
|
$("p[node-loading=\"true\"]").show();
|
|
|
$("p[node-loading=\"true\"]").html("移除处理中...");
|
|
|
-
|
|
|
+ $("p[node-msg=\"true2\"]").hide();
|
|
|
$("p[node-msg=\"true\"]").hide();
|
|
|
var url = "/ajaxReceivablesRemove";
|
|
|
$.ajax({
|
|
@@ -2184,6 +2324,9 @@ class InvoiceController extends DooController {
|
|
|
if(data.priceStatus == 1){
|
|
|
$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
$("p[node-msg=\"true\"]").show();
|
|
|
+ }else if(data.priceStatus == 2&& data.isReceivables != 0){
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
}
|
|
|
}else if(data.status == 2){
|
|
|
$("p[node-loading=\"true\"]").html(data.msg);
|
|
@@ -2199,15 +2342,20 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
$price = 0;
|
|
|
- $priceStatus = 0;
|
|
|
+ $priceStatus = 0;$isReceivables=0;
|
|
|
$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );
|
|
|
+ if (!empty($list))
|
|
|
+ $isReceivables=1;
|
|
|
$receivablesPrice = 0;
|
|
|
foreach ( $list as $key => $value ) {
|
|
|
$receivablesPrice += $value ['receivablesPrice'];
|
|
|
}
|
|
|
- if ($receivablesPrice >= $detail ['invoicePrice']) {
|
|
|
+ if ($receivablesPrice > $detail ['invoicePrice']) {
|
|
|
$price = $receivablesPrice - $detail ['invoicePrice'];
|
|
|
$priceStatus = 1;
|
|
|
+ }elseif($receivablesPrice < $detail ['invoicePrice']){
|
|
|
+ $price = $detail ['invoicePrice']-$receivablesPrice;
|
|
|
+ $priceStatus = 2;
|
|
|
}
|
|
|
|
|
|
echo json_encode ( array (
|
|
@@ -2215,7 +2363,9 @@ class InvoiceController extends DooController {
|
|
|
'html' => $html,
|
|
|
'html2' => $html2,
|
|
|
'price' => $price,
|
|
|
- 'priceStatus' => $priceStatus
|
|
|
+ 'priceStatus' => $priceStatus,
|
|
|
+ 'isReceivables'=>$isReceivables
|
|
|
+
|
|
|
) );
|
|
|
}
|
|
|
function ajaxGetInvoiceInfoByType() {
|