|
@@ -875,11 +875,11 @@ class InvoiceController extends DooController {
|
|
|
function invoiceReceivables() {
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
|
- Doo::loadModel('staff');
|
|
|
- $staff=new staff();
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
|
|
|
$category = $lCategory->getCategory ();
|
|
|
- $staffList = $staff->getStaffByCid($this->staff[0]['cid']);
|
|
|
+ $staffList = $staff->getStaffByCid ( $this->staff [0] ['cid'] );
|
|
|
|
|
|
$data ['staffList'] = $staffList;
|
|
|
$data ['category'] = $category;
|
|
@@ -895,7 +895,6 @@ class InvoiceController extends DooController {
|
|
|
* @return string
|
|
|
*/
|
|
|
function invoiceReceivablesDo() {
|
|
|
-
|
|
|
$receivablesPrice = $this->get_args ( 'receivablesPrice' ) ? $this->get_args ( 'receivablesPrice' ) : "";
|
|
|
$receivablesMessage = $this->get_args ( 'receivablesMessage' ) ? $this->get_args ( 'receivablesMessage' ) : "";
|
|
|
$receivablesBank = $this->get_args ( 'receivablesBank' ) ? $this->get_args ( 'receivablesBank' ) : "";
|
|
@@ -909,17 +908,17 @@ class InvoiceController extends DooController {
|
|
|
if (! empty ( $receivablesPrice ) && ! empty ( $receivablesMessage ) && ! empty ( $receivablesBank ) && ! empty ( $receivablesDate ) && ! empty ( $receivablesCategory ) && ! empty ( $receivablesStaff )) {
|
|
|
|
|
|
$item = array (
|
|
|
- 'receivablesPrice' =>$receivablesPrice,
|
|
|
- 'receivablesMessage' =>$receivablesMessage,
|
|
|
- 'receivablesSerial' =>"#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ),
|
|
|
- 'receivablesBank' =>$receivablesBank,
|
|
|
- 'receivablesDate' =>$receivablesDate,
|
|
|
- 'inputStaff' =>$this->staff[0]['username'],
|
|
|
+ 'receivablesPrice' => $receivablesPrice,
|
|
|
+ 'receivablesMessage' => $receivablesMessage,
|
|
|
+ 'receivablesSerial' => "#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ),
|
|
|
+ 'receivablesBank' => $receivablesBank,
|
|
|
+ 'receivablesDate' => $receivablesDate,
|
|
|
+ 'inputStaff' => $this->staff [0] ['username'],
|
|
|
|
|
|
- 'receivablesCategory' =>$receivablesCategory,
|
|
|
- 'receivablesStaff' => $receivablesStaff
|
|
|
+ 'receivablesCategory' => $receivablesCategory,
|
|
|
+ 'receivablesStaff' => $receivablesStaff
|
|
|
);
|
|
|
- $irid = $invoiceReceivables->addInvoiceReceivables( $item );
|
|
|
+ $irid = $invoiceReceivables->addInvoiceReceivables ( $item );
|
|
|
}
|
|
|
|
|
|
return "/invoiceReceivables";
|
|
@@ -927,11 +926,11 @@ class InvoiceController extends DooController {
|
|
|
/**
|
|
|
* 收款认领页面-包括公共认领 办事处认领 最近已认领数据
|
|
|
*/
|
|
|
- function invoiceReceivablesClaim(){
|
|
|
+ function invoiceReceivablesClaim() {
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
|
|
|
- $receivablesList=$invoiceReceivables->getInvoiceReceivablesByClaim($this->staff[0]['cid']);
|
|
|
+ $receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'] );
|
|
|
|
|
|
$data ['receivablesList'] = $receivablesList;
|
|
|
|
|
@@ -944,35 +943,34 @@ class InvoiceController extends DooController {
|
|
|
/**
|
|
|
* 管理员录入的收款 ,确认认领到谁的名下
|
|
|
*/
|
|
|
- function invoiceReceivablesAscription(){
|
|
|
+ function invoiceReceivablesAscription() {
|
|
|
$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
|
|
|
- $detail=$invoiceReceivables->getInvoiceReceivablesByIrid($irid);
|
|
|
+ $detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
|
|
|
- if (!empty($detail)&&$detail['receivablesStaff']=='PUBLIC'){
|
|
|
+ if (! empty ( $detail ) && $detail ['receivablesStaff'] == 'PUBLIC') {
|
|
|
$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" ),
|
|
|
- 'source' =>1
|
|
|
+ '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" ),
|
|
|
+ 'source' => 1
|
|
|
);
|
|
|
- $invoiceReceivables->setInvoiceReceivablesByCondition( $item );
|
|
|
+ $invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
|
|
|
}
|
|
|
|
|
|
return "/invoiceReceivablesClaim";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
*/
|
|
|
- function invoiceMyReceivables(){
|
|
|
+ function invoiceMyReceivables() {
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
|
|
|
- $list=$invoiceReceivables->getInvoiceReceivablesByClaim($this->staff[0]['cid'],$this->staff[0]['sid']);
|
|
|
+ $list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
|
|
|
|
|
|
$data ['list'] = $list;
|
|
|
|
|
@@ -983,33 +981,149 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 收款绑定发票 ,一个收款只能绑定一个发票
|
|
|
+ */
|
|
|
+ function invoiceBindReceivables(){
|
|
|
+ $claimKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
+ $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);
|
|
|
+ $detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($claimKey);
|
|
|
+
|
|
|
+ if (empty($detail)&&empty($detailM))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ if ($detailM['receivablesPrice']>=$detail['invoicePrice']){
|
|
|
+ $price=$detailM['receivablesPrice']-$detail['invoicePrice'];
|
|
|
+ die('<p>收款金额超出开票金额 ¥'.$price.'元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>');
|
|
|
+ }
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'irid' => $detailM['irid'],
|
|
|
+ 'bindStatus' => 1,
|
|
|
+ 'iid' => $detail['iid'],
|
|
|
+ 'bindDate'=>date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ $invoiceReceivables->setInvoiceReceivablesByCondition($item);
|
|
|
+
|
|
|
+ $iridString="";
|
|
|
+ if (empty($detail['irid']))
|
|
|
+ $iridString=$detailM['irid'];
|
|
|
+ else
|
|
|
+ $iridString=$detail['irid'].','.$detailM['irid'];
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $detail['iid'],
|
|
|
+ 'irid' => $iridString
|
|
|
+ );
|
|
|
+ $invoice->setInvoiceByCondition($item);
|
|
|
+ return "/invoiceMyReceivables";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获得与我有关可收款的发票
|
|
|
*/
|
|
|
- function ajaxGetInvoiceByStaff(){
|
|
|
+ function ajaxGetInvoiceByStaff() {
|
|
|
$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
|
|
|
- $list=$invoice->getInvoiceByReceivables($this->staff[0]['sid']);
|
|
|
+ $list = $invoice->getInvoiceByReceivables ( $this->staff [0] ['sid'] );
|
|
|
+
|
|
|
+ $html = "";
|
|
|
+ foreach ( $list as $key => $value ) {
|
|
|
+ $html .= '<tr>
|
|
|
+ <td>' . $value ['invoiceElement'] . '</td>
|
|
|
+ <td>¥' . $value ['invoicePrice'] . '</td>';
|
|
|
+ if (! empty ( $value ['invoiceType'] )) {
|
|
|
+ $html .= '<td>增值税专用发票</td>
|
|
|
+ <td>' . $value ['invoiceCompany'] . '</td>';
|
|
|
+ } else {
|
|
|
+ $html .= '<td>增值税普通发票</td>
|
|
|
+ <td>' . $value ['invoiceTitle'] . '</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $html .= '<td><label><input type="radio" node-Claim="true" p-data="'.$value ['iidKey'].'" name="invoiceClaim"> 使用Ta</label></td></tr>
|
|
|
+ <script>
|
|
|
+ $(\'input[node-Claim="true"]\').click(function() {
|
|
|
+
|
|
|
+ var invoiceKey= $(this).attr("p-data");
|
|
|
+ var claimKey=$("input[name=\'key\']").val();
|
|
|
+ $("p[node-msg=\"true\"]").hide();
|
|
|
+ var url = "/ajaxCompareClaimPrice";
|
|
|
+ $.ajax({
|
|
|
+ url : url,
|
|
|
+ type : "post",
|
|
|
+ cache : false,
|
|
|
+ dataType : "json",
|
|
|
+ data : {
|
|
|
+ claimKey : claimKey,
|
|
|
+ invoiceKey:invoiceKey
|
|
|
+ },
|
|
|
+ global : true,
|
|
|
+ success : function(data) {
|
|
|
+ $("input[name=\'invoiceKey\']").val("'.$value ['iidKey'].'");
|
|
|
+ if (data.status == 1) {
|
|
|
+
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : function(err) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ ';
|
|
|
+ }
|
|
|
+
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'list' => $list
|
|
|
+ 'html' => $html
|
|
|
) );
|
|
|
}
|
|
|
|
|
|
+ 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);
|
|
|
+ $detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($claimKey);
|
|
|
+
|
|
|
+ if ($detailM['receivablesPrice']>=$detail['invoicePrice']){
|
|
|
+ $price=$detailM['receivablesPrice']-$detail['invoicePrice'];
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'price'=>$price
|
|
|
+ ) );
|
|
|
+ }else
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取一条收款信息
|
|
|
*/
|
|
|
- function ajaxGetInvoiceReceivables(){
|
|
|
+ function ajaxGetInvoiceReceivables() {
|
|
|
$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
|
|
|
- $detail=$invoiceReceivables->getInvoiceReceivablesByIrid($irid);
|
|
|
+ $detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );
|
|
|
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'detail' => $detail
|
|
|
+ 'detail' => $detail
|
|
|
) );
|
|
|
}
|
|
|
|
|
@@ -1018,13 +1132,13 @@ class InvoiceController extends DooController {
|
|
|
*/
|
|
|
function ajaxGetStaffByCategory() {
|
|
|
$cid = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : "";
|
|
|
- Doo::loadModel('staff');
|
|
|
- $staff=new staff();
|
|
|
-
|
|
|
- if ($cid=="PUBLIC"){
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+
|
|
|
+ if ($cid == "PUBLIC") {
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'html' => '<option value="PUBLIC">办事处待认领款项</option>'
|
|
|
+ 'html' => '<option value="PUBLIC">办事处待认领款项</option>'
|
|
|
) );
|
|
|
die ();
|
|
|
}
|
|
@@ -1032,21 +1146,21 @@ class InvoiceController extends DooController {
|
|
|
if (! is_numeric ( $cid )) {
|
|
|
echo json_encode ( array (
|
|
|
'status' => 0,
|
|
|
- 'msg' => 'illegal request'
|
|
|
+ 'msg' => 'illegal request'
|
|
|
) );
|
|
|
die ();
|
|
|
}
|
|
|
-
|
|
|
- $staffList = $staff->getStaffByCid($cid);
|
|
|
|
|
|
- $html='<option value="PUBLIC">办事处待认领款项</option>';
|
|
|
- foreach ($staffList as $key=>$value){
|
|
|
- $html.='<option value="'.$value['sid'].'-'.$value['username'].'">'.$value['category'].'-'.$value['username'].'</option>';
|
|
|
+ $staffList = $staff->getStaffByCid ( $cid );
|
|
|
+
|
|
|
+ $html = '<option value="PUBLIC">办事处待认领款项</option>';
|
|
|
+ foreach ( $staffList as $key => $value ) {
|
|
|
+ $html .= '<option value="' . $value ['sid'] . '-' . $value ['username'] . '">' . $value ['category'] . '-' . $value ['username'] . '</option>';
|
|
|
}
|
|
|
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'html' => $html
|
|
|
+ 'html' => $html
|
|
|
) );
|
|
|
}
|
|
|
|
|
@@ -1074,6 +1188,64 @@ class InvoiceController extends DooController {
|
|
|
'invoiceDetail' => $invoiceDetail
|
|
|
) );
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 获得与我有关收款数据
|
|
|
+ */
|
|
|
+ function ajaxGetReceivalblesByStaff(){
|
|
|
+ $iid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+
|
|
|
+ $list =$invoiceReceivables->getInvoiceReceivablesByClaim($this->staff [0] ['cid'],$this->staff [0] ['sid']);
|
|
|
+
|
|
|
+
|
|
|
+ $html = "";
|
|
|
+ foreach ( $list['myClaim'] as $key => $value ) {
|
|
|
+ $html .= '<tr>
|
|
|
+ <td>' . $value ['receivablesPrice'] . '</td>
|
|
|
+ <td>¥' . $value ['receivablesMessage'] . '</td>
|
|
|
+ <td>' . $value ['receivablesBank'] . '</td>
|
|
|
+ <td>' . $value ['receivablesDate'] . '</td>';
|
|
|
+ $html .= '<td><label><input type="radio" node-Claim="true" p-data="'.$value ['iidKey'].'" name="invoiceClaim"> 使用Ta</label></td></tr>
|
|
|
+ <script>
|
|
|
+ $(\'input[node-Claim="true"]\').click(function() {
|
|
|
+ var invoiceKey= $(this).attr("p-data");
|
|
|
+ var claimKey=$("input[name=\'key\']").val();
|
|
|
+ $("p[node-msg=\"true\"]").hide();
|
|
|
+ var url = "/ajaxCompareClaimPrice";
|
|
|
+ $.ajax({
|
|
|
+ url : url,
|
|
|
+ type : "post",
|
|
|
+ cache : false,
|
|
|
+ dataType : "json",
|
|
|
+ data : {
|
|
|
+ claimKey : claimKey,
|
|
|
+ invoiceKey:invoiceKey
|
|
|
+ },
|
|
|
+ global : true,
|
|
|
+ success : function(data) {
|
|
|
+ $("input[name=\'invoiceKey\']").val("'.$value ['iidKey'].'");
|
|
|
+ if (data.status == 1) {
|
|
|
+
|
|
|
+ $("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
|
|
|
+ $("p[node-msg=\"true\"]").show();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : function(err) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ ';
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'html' => $html
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
function _GetFileEXT($filename) {
|
|
|
$pics = explode ( '.', $filename );
|
|
|
$num = count ( $pics );
|