|  | @@ -37,7 +37,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			foreach ( $moldList as $value ) {
 | 
	
		
			
				|  |  |  				// echo $value['mold'];
 | 
	
		
			
				|  |  |  				// echo $action;
 | 
	
		
			
				|  |  | -				
 | 
	
		
			
				|  |  | +				//删除审批人后的权限加入问题
 | 
	
		
			
				|  |  |  				if (Doo::acl ()->isAllowed ( $value ['mold'], $resource, $action )) {
 | 
	
		
			
				|  |  |  					$flag = true;
 | 
	
		
			
				|  |  |  					break;
 | 
	
	
		
			
				|  | @@ -79,6 +79,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	function invoice() {
 | 
	
		
			
				|  |  |  		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  |  		$invoice = new invoice ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  // 		Doo::loadModel ( 'express' );
 | 
	
		
			
				|  |  |  // 		$express = new express ();
 | 
	
		
			
				|  |  |  // 		$expressList = $express->getExpressByAll ();
 | 
	
	
		
			
				|  | @@ -222,6 +223,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  			$invoiceManageList = $invoiceManage->getInvoiceByAll ();
 | 
	
		
			
				|  |  |  			$invoiceManageDetail = $invoiceManage->getInvoiceByMold ( "发票审批" );
 | 
	
		
			
				|  |  | +// 			print_r(current($invoiceManageDetail ['staffList']));
 | 
	
		
			
				|  |  | +// 			die;
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  			$moldManage = array ();
 | 
	
		
			
				|  |  |  			foreach ( $invoiceManageList as $key => $value ) {
 | 
	
	
		
			
				|  | @@ -247,7 +250,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  					'sid' => $this->staff [0] ['sid'],
 | 
	
		
			
				|  |  |  					'userName' => $this->staff [0] ['username'],
 | 
	
		
			
				|  |  |  					'invoiceManage' => $invoiceManageDetail ['staff'],
 | 
	
		
			
				|  |  | -					'pendingApprovals' => $invoiceManageDetail ['staffList'] [0] [0],
 | 
	
		
			
				|  |  | +					'pendingApprovals' => current($invoiceManageDetail ['staffList']) [0],
 | 
	
		
			
				|  |  |  					'moldManage' => json_encode ( $moldManage ),
 | 
	
		
			
				|  |  |  					'remark' => $remark 
 | 
	
		
			
				|  |  |  			);
 | 
	
	
		
			
				|  | @@ -991,6 +994,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			Doo::loadModel ( 'invoiceOperationLog' );
 | 
	
		
			
				|  |  |  			$invoiceOperationLog = new invoiceOperationLog ();
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  |  			$invoicePrintDetail = $invoice->getInvoiceByPrint ( $iid );
 | 
	
		
			
				|  |  |  			if (empty ( $invoicePrintDetail ))
 | 
	
		
			
				|  |  |  				die ( 'illegal request' );
 | 
	
	
		
			
				|  | @@ -1014,6 +1019,13 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  					'iid' => $iid 
 | 
	
		
			
				|  |  |  			);
 | 
	
		
			
				|  |  |  			$invoiceOperationLog->setInvoiceOperationLog ( $item );
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  |  			return "/invoicePrint";
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -1066,7 +1078,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		);
 | 
	
		
			
				|  |  |  		$invoice->setInvoiceByCondition ( $item );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		// $this->setWXMsg ( $iid, 41 );
 | 
	
		
			
				|  |  | +		 $this->setWXMsg ( $iid );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		return '/invoicePost';
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -1389,6 +1401,27 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  					'iid' => $detail ['iid'] 
 | 
	
		
			
				|  |  |  			);
 | 
	
		
			
				|  |  |  			$invoiceOperationLog->setInvoiceOperationLog ( $item );
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			Doo::loadModel ( 'invoiceStatistics' );
 | 
	
		
			
				|  |  | +			$invoiceStatistics = new invoiceStatistics ();
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );
 | 
	
		
			
				|  |  | +			$accountPrice = 0;
 | 
	
		
			
				|  |  | +			foreach ( $list as $key => $value ) {
 | 
	
		
			
				|  |  | +				$accountPrice += $value ['receivablesPrice'];
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			$item = array (
 | 
	
		
			
				|  |  | +					'date' => date ( "Y-m-d H:i:s" ),
 | 
	
		
			
				|  |  | +					'priceClass' => 3,
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +					'cid' => $this->staff [0] ['cid'],
 | 
	
		
			
				|  |  | +					'staff' => $this->staff [0] ['sid'],
 | 
	
		
			
				|  |  | +					'accountPrice' => $accountPrice
 | 
	
		
			
				|  |  | +			);
 | 
	
		
			
				|  |  | +			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  |  			Doo::db ()->commit ();
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  		}
 | 
	
	
		
			
				|  | @@ -1762,12 +1795,31 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		);
 | 
	
		
			
				|  |  |  		$invoiceOperationLog->setInvoiceOperationLog ( $item );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'invoiceStatistics' );
 | 
	
		
			
				|  |  | +		$invoiceStatistics = new invoiceStatistics ();
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );
 | 
	
		
			
				|  |  | +		$accountPrice = 0;
 | 
	
		
			
				|  |  | +		foreach ( $list as $key => $value ) {
 | 
	
		
			
				|  |  | +			$accountPrice += $value ['receivablesPrice'];
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		$item = array (
 | 
	
		
			
				|  |  | +				'date' => date ( "Y-m-d H:i:s" ),
 | 
	
		
			
				|  |  | +				'priceClass' => 3,
 | 
	
		
			
				|  |  | +					
 | 
	
		
			
				|  |  | +				'cid' => $this->staff [0] ['cid'],
 | 
	
		
			
				|  |  | +				'staff' => $this->staff [0] ['sid'],
 | 
	
		
			
				|  |  | +				'accountPrice' => $accountPrice
 | 
	
		
			
				|  |  | +		);
 | 
	
		
			
				|  |  | +		$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		return "/invoiceReceivables";
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  | -	 * @deprecated
 | 
	
		
			
				|  |  | +	 * 核销 动作,确认入账统计
 | 
	
		
			
				|  |  |  	 * 发票收款完成--需求更变 废弃
 | 
	
		
			
				|  |  |  	function invoiceEnterReceivables() {
 | 
	
		
			
				|  |  |  		$invoiceKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
 | 
	
	
		
			
				|  | @@ -3150,6 +3202,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  								$html .= '<span class="colOrange">退回</span>';
 | 
	
		
			
				|  |  |  							} elseif ($value ['status'] == 5) {
 | 
	
		
			
				|  |  |  								$html .= '<span class="colGreen">打印</span>';
 | 
	
		
			
				|  |  | +							}elseif($value ['status'] == 4){
 | 
	
		
			
				|  |  | +								$html .= '<span class="colRed">终止</span>';
 | 
	
		
			
				|  |  |  							}
 | 
	
		
			
				|  |  |  							$html .= $value ['operation'] . '</p></blockquote>';
 | 
	
		
			
				|  |  |  						}
 | 
	
	
		
			
				|  | @@ -3352,7 +3406,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		$invoice = new invoice ();
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$detail=$invoiceReceivables->getInvoiceReceivablesByIrid($irid);
 | 
	
		
			
				|  |  | -		$invoiceDetail=$invoice->getInvoiceByTitle($detail['recepitTitleMark'],'EXACTLY'," and status=2 and printStatus=1 and irid='' ");//
 | 
	
		
			
				|  |  | +		$invoiceDetail=$invoice->getInvoiceByTitle($detail['recepitTitleMark'],'EXACTLY'," and status=2 and printStatus=1 and doPost=1 and postStatus=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>
 | 
	
	
		
			
				|  | @@ -3484,6 +3538,29 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		) );
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  | +	function ajaxInvoicePushNotice(){
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  | +		$invoice = new invoice ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$approval = $invoice->getOne ( array (
 | 
	
		
			
				|  |  | +				'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'],
 | 
	
		
			
				|  |  | +				'desc' => 'iid',
 | 
	
		
			
				|  |  | +				'asArray' => true
 | 
	
		
			
				|  |  | +		) );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$isNotice=false;
 | 
	
		
			
				|  |  | +		if (!empty($approval))
 | 
	
		
			
				|  |  | +			$isNotice=true;
 | 
	
		
			
				|  |  | +		$response = array(
 | 
	
		
			
				|  |  | +				'error' => 0,
 | 
	
		
			
				|  |  | +				'isNotice' => $isNotice
 | 
	
		
			
				|  |  | +		);
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		echo json_encode($response);
 | 
	
		
			
				|  |  | +		exit();
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  |  	function _GetFileEXT($filename) {
 | 
	
		
			
				|  |  |  		$pics = explode ( '.', $filename );
 | 
	
		
			
				|  |  |  		$num = count ( $pics );
 | 
	
	
		
			
				|  | @@ -3761,52 +3838,62 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			$new ['untread'] = TRUE;
 | 
	
		
			
				|  |  |  		return $new;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	function setWXMsg($rid, $uid) {
 | 
	
		
			
				|  |  | +	function setWXMsg($rid) {
 | 
	
		
			
				|  |  |  		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  |  		$invoice = new invoice ();
 | 
	
		
			
				|  |  | -		$receiptDetail = $invoice->getOne ( array (
 | 
	
		
			
				|  |  | +		$invoiceDetail = $invoice->getOne ( array (
 | 
	
		
			
				|  |  |  				'where' => 'iid=' . $rid,
 | 
	
		
			
				|  |  |  				'asArray' => true 
 | 
	
		
			
				|  |  |  		) );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		if (! empty ( $receiptDetail )) {
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		if (! empty ( $invoiceDetail )) {
 | 
	
		
			
				|  |  |  			Doo::loadModel ( 'staff' );
 | 
	
		
			
				|  |  |  			$staff = new staff ();
 | 
	
		
			
				|  |  |  			$staffmsg = $staff->getOne ( array (
 | 
	
		
			
				|  |  | -					'where' => "sid='" . $uid . "'",
 | 
	
		
			
				|  |  | +					'where' => "sid='" . $invoiceDetail['sid'] . "'",
 | 
	
		
			
				|  |  |  					'asArray' => TRUE 
 | 
	
		
			
				|  |  |  			) );
 | 
	
		
			
				|  |  |  			if (! empty ( $staffmsg ['wxid'] )) {
 | 
	
		
			
				|  |  |  				require_once (SITE_PATH . '/protected/class/client.php');
 | 
	
		
			
				|  |  |  				$client = new client ( 'http://m.cld.smartcost.com.cn/' );
 | 
	
		
			
				|  |  |  				$user = $staffmsg ['wxid'];
 | 
	
		
			
				|  |  | -				$receiptName = '费用';
 | 
	
		
			
				|  |  | -				$msg = '';
 | 
	
		
			
				|  |  | -				// switch ($receiptDetail ['Rtype']) {
 | 
	
		
			
				|  |  | -				// case 0 :
 | 
	
		
			
				|  |  | -				// $receiptName = '报销';
 | 
	
		
			
				|  |  | -				// break;
 | 
	
		
			
				|  |  | -				// case 1 :
 | 
	
		
			
				|  |  | -				// $receiptName = '借款';
 | 
	
		
			
				|  |  | -				// break;
 | 
	
		
			
				|  |  | -				// case 2 :
 | 
	
		
			
				|  |  | -				// $receiptName = '对公汇款';
 | 
	
		
			
				|  |  | -				// break;
 | 
	
		
			
				|  |  | -				// }
 | 
	
		
			
				|  |  |  				
 | 
	
		
			
				|  |  | -				// 单位名称 金额 开票内容 已邮寄,顺丰 123123213
 | 
	
		
			
				|  |  | +				$expCom=explode(":",$invoiceDetail ['expressCompany']);
 | 
	
		
			
				|  |  | +				if (empty($expCom))
 | 
	
		
			
				|  |  | +					$expCom[0]='';
 | 
	
		
			
				|  |  | +					
 | 
	
		
			
				|  |  | +				$msg = '太好了,您的发票' . $invoiceDetail['invoiceSerial'] . ' 已邮寄  ' . $expCom [0] . ' ,快递号: ' . $invoiceDetail ['expressNumber'];
 | 
	
		
			
				|  |  |  				
 | 
	
		
			
				|  |  | -				switch (2) {
 | 
	
		
			
				|  |  | -					case 1 :
 | 
	
		
			
				|  |  | -						$msg = '太好了,您的' . $receiptName . ' ' . $receiptDetail ['invoiceElement'] . ',¥' . $receiptDetail ['invoicePrice'] . ',已同意支付。';
 | 
	
		
			
				|  |  | -						break;
 | 
	
		
			
				|  |  | -					case 2 :
 | 
	
		
			
				|  |  | -						$msg = '注意,您的' . $receiptName . ' ' . $receiptDetail ['invoiceElement'] . ',¥' . $receiptDetail ['invoicePrice'] . ',已被撤回,请及时处理。';
 | 
	
		
			
				|  |  | -						break;
 | 
	
		
			
				|  |  | -					case 3 :
 | 
	
		
			
				|  |  | -						$msg = '很遗憾,您的' . $receiptName . ' ' . $receiptDetail ['receiptOrder'] . ',¥' . $receiptDetail ['sum'] . ',已被终止。';
 | 
	
		
			
				|  |  | -						break;
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | +				
 | 
	
		
			
				|  |  | +// 				$receiptName = '费用';
 | 
	
		
			
				|  |  | +// 				$msg = '';
 | 
	
		
			
				|  |  | +// 				// switch ($receiptDetail ['Rtype']) {
 | 
	
		
			
				|  |  | +// 				// case 0 :
 | 
	
		
			
				|  |  | +// 				// $receiptName = '报销';
 | 
	
		
			
				|  |  | +// 				// break;
 | 
	
		
			
				|  |  | +// 				// case 1 :
 | 
	
		
			
				|  |  | +// 				// $receiptName = '借款';
 | 
	
		
			
				|  |  | +// 				// break;
 | 
	
		
			
				|  |  | +// 				// case 2 :
 | 
	
		
			
				|  |  | +// 				// $receiptName = '对公汇款';
 | 
	
		
			
				|  |  | +// 				// break;
 | 
	
		
			
				|  |  | +// 				// }
 | 
	
		
			
				|  |  | +				
 | 
	
		
			
				|  |  | +// 				// 单位名称 金额 开票内容 已邮寄,顺丰 123123213
 | 
	
		
			
				|  |  | +				
 | 
	
		
			
				|  |  | +// 				switch (2) {
 | 
	
		
			
				|  |  | +// 					case 1 :
 | 
	
		
			
				|  |  | +// 						$msg = '太好了,您的' . $receiptName . ' ' . $receiptDetail ['invoiceElement'] . ',¥' . $receiptDetail ['invoicePrice'] . ',已同意支付。';
 | 
	
		
			
				|  |  | +// 						break;
 | 
	
		
			
				|  |  | +// 					case 2 :
 | 
	
		
			
				|  |  | +// 						$msg = '注意,您的' . $receiptName . ' ' . $receiptDetail ['invoiceElement'] . ',¥' . $receiptDetail ['invoicePrice'] . ',已被撤回,请及时处理。';
 | 
	
		
			
				|  |  | +// 						break;
 | 
	
		
			
				|  |  | +// 					case 3 :
 | 
	
		
			
				|  |  | +// 						$msg = '很遗憾,您的' . $receiptName . ' ' . $receiptDetail ['receiptOrder'] . ',¥' . $receiptDetail ['sum'] . ',已被终止。';
 | 
	
		
			
				|  |  | +// 						break;
 | 
	
		
			
				|  |  | +// 				}
 | 
	
		
			
				|  |  |  				
 | 
	
		
			
				|  |  |  				$result = $client->SendMsg ( $user, $msg, 'text' );
 | 
	
		
			
				|  |  |  			}
 |