|  | @@ -13,7 +13,6 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	public $data;
 | 
	
		
			
				|  |  |  	private $INVOICEKEY = "APPROVAL";
 | 
	
		
			
				|  |  |  	private $INVOICECOLLECTPATH = "protected/cache/invoiceCollect/";
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  |  	public function beforeRun($resource, $action) {
 | 
	
		
			
				|  |  |  		Doo::loadModel ( "invoiceManage" );
 | 
	
		
			
				|  |  |  		$invoiceManage = new invoiceManage ();
 | 
	
	
		
			
				|  | @@ -49,9 +48,6 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if (! $flag)
 | 
	
		
			
				|  |  |  			die ( 'illegal request' );
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  |  	function __construct() {
 | 
	
		
			
				|  |  |  		if (isset ( $_COOKIE ["staff"] )) {
 | 
	
		
			
				|  |  |  			if (! empty ( $_COOKIE ["staff"] )) {
 | 
	
	
		
			
				|  | @@ -70,7 +66,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  				// if (!$falg)
 | 
	
		
			
				|  |  |  				// return Doo::conf()->APP_URL;
 | 
	
		
			
				|  |  |  				
 | 
	
		
			
				|  |  | -				$this->data['new']=$this->isInvoiceNew();
 | 
	
		
			
				|  |  | +				$this->data ['new'] = $this->isInvoiceNew ();
 | 
	
		
			
				|  |  |  				
 | 
	
		
			
				|  |  |  				$this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );
 | 
	
		
			
				|  |  |  				return "/";
 | 
	
	
		
			
				|  | @@ -112,9 +108,9 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		$expressList = $express->getExpressByAll ();
 | 
	
		
			
				|  |  |  		$invoiceList = $invoice->getMyInvoice ( $_COOKIE ["staff"] );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		//$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 | 
	
		
			
				|  |  | +		// $list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$list=$invoice->getInvoiceByUntreadStatusPage(4,$_COOKIE ["staff"]);
 | 
	
		
			
				|  |  | +		$list = $invoice->getInvoiceByUntreadStatusPage ( 4, $_COOKIE ["staff"] );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		// print_r($list);
 | 
	
		
			
				|  |  |  		
 | 
	
	
		
			
				|  | @@ -1035,12 +1031,13 @@ 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" ) 
 | 
	
		
			
				|  |  |  				);
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  			$irid = $invoiceReceivables->addInvoiceReceivables ( $item );
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  | +			$item=array();
 | 
	
		
			
				|  |  |  			// 收款操作日志
 | 
	
		
			
				|  |  |  			if ($receivablesCategory == 'PUBLIC' && $receivablesStaff == 'PUBLIC')
 | 
	
		
			
				|  |  |  				$item = array (
 | 
	
	
		
			
				|  | @@ -1053,7 +1050,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			elseif ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
 | 
	
		
			
				|  |  |  				$receivablesStaff = explode ( '-', $receivablesStaff );
 | 
	
		
			
				|  |  |  				$item = array (
 | 
	
		
			
				|  |  | -						'operation' => $this->staff [0] ['username'] . " 转入 " . $receivablesStaff [1]
 | 
	
		
			
				|  |  | +						'operation' => $this->staff [0] ['username'] . " 转入 " . $receivablesStaff [1] 
 | 
	
		
			
				|  |  |  				);
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			$item += array (
 | 
	
	
		
			
				|  | @@ -1109,6 +1106,85 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  | +	 * 更新收款相关数据
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  | +	function invoiceReceivablesUpdateClaim() {
 | 
	
		
			
				|  |  | +		$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' ) : "";
 | 
	
		
			
				|  |  | +		$receivablesDate = $this->get_args ( 'receivablesDate' ) ? $this->get_args ( 'receivablesDate' ) : "";
 | 
	
		
			
				|  |  | +		$receivablesCategory = $this->get_args ( 'receivablesCategory' ) ? $this->get_args ( 'receivablesCategory' ) : "";
 | 
	
		
			
				|  |  | +		$receivablesStaff = $receivablesStaff2 = $this->get_args ( 'receivablesStaff' ) ? $this->get_args ( 'receivablesStaff' ) : "";
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$claimKey = $this->get_args ( 'claimKey' ) ? $this->get_args ( 'claimKey' ) : "";
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		if (empty ( $claimKey ))
 | 
	
		
			
				|  |  | +			die ( 'illegal request' );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'invoiceReceivables' );
 | 
	
		
			
				|  |  | +		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'invoiceROLog' );
 | 
	
		
			
				|  |  | +		$invoiceROLog = new invoiceROLog ();
 | 
	
		
			
				|  |  | +		$con = ' and iid=0 and receivablesCategory!="PUBLIC" and receivablesStaff!="PUBLIC"';
 | 
	
		
			
				|  |  | +		$detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $claimKey, $con );
 | 
	
		
			
				|  |  | +		if (empty ( $detail ))
 | 
	
		
			
				|  |  | +			die ( 'illegal request' );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		/*
 | 
	
		
			
				|  |  | +		 * 'receivablesPrice' => $receivablesPrice, 'receivablesMessage' => $receivablesMessage, 'receivablesSerial' => "#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ), 'receivablesBank' => $receivablesBank, 'receivablesDate' => $receivablesDate, 'inputStaff' => $this->staff [0] ['username'], 'date' => date ( "Y-m-d" ), 'receivablesCategory' => $receivablesCategory, 'receivablesStaff' => $receivablesStaff
 | 
	
		
			
				|  |  | +		 */
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$item = array (
 | 
	
		
			
				|  |  | +				'irid' => $detail ['irid'] 
 | 
	
		
			
				|  |  | +		);
 | 
	
		
			
				|  |  | +		if ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
 | 
	
		
			
				|  |  | +			$item += array (
 | 
	
		
			
				|  |  | +					'confirmTime' => date ( "Y-m-d H:i:s" )
 | 
	
		
			
				|  |  | +			);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if (! empty ( $receivablesCategory ))
 | 
	
		
			
				|  |  | +			$item += array (
 | 
	
		
			
				|  |  | +					'receivablesCategory' => $receivablesCategory 
 | 
	
		
			
				|  |  | +			);
 | 
	
		
			
				|  |  | +		if (! empty ( $receivablesStaff ))
 | 
	
		
			
				|  |  | +			$item += array (
 | 
	
		
			
				|  |  | +					'receivablesStaff' => $receivablesStaff 
 | 
	
		
			
				|  |  | +			);
 | 
	
		
			
				|  |  | +		$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		// 收款操作日志
 | 
	
		
			
				|  |  | +		$item=array();
 | 
	
		
			
				|  |  | +		if ($receivablesCategory == 'PUBLIC' && $receivablesStaff == 'PUBLIC')
 | 
	
		
			
				|  |  | +			$item = array (
 | 
	
		
			
				|  |  | +					'operation' => $this->staff [0] ['username'] . " 转入 公共待认领款项 " 
 | 
	
		
			
				|  |  | +			);
 | 
	
		
			
				|  |  | +		elseif ($receivablesCategory != 'PUBLIC' && $receivablesStaff == 'PUBLIC')
 | 
	
		
			
				|  |  | +			$item = array (
 | 
	
		
			
				|  |  | +					'operation' => $this->staff [0] ['username'] . "转入 办事处待认领款项" 
 | 
	
		
			
				|  |  | +			);
 | 
	
		
			
				|  |  | +		elseif ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {
 | 
	
		
			
				|  |  | +			$receivablesStaff = explode ( '-', $receivablesStaff );
 | 
	
		
			
				|  |  | +			$item = array (
 | 
	
		
			
				|  |  | +					'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'],
 | 
	
		
			
				|  |  | +				'uid' => $this->staff [0] ['sid'],
 | 
	
		
			
				|  |  | +				'category' => $this->staff [0] ['category'],
 | 
	
		
			
				|  |  | +				'irid' => $detail ['irid'] 
 | 
	
		
			
				|  |  | +		);
 | 
	
		
			
				|  |  | +		$invoiceROLog->setInvoiceROLog ( $item );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		return '/invoiceReceivablesAS';
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	/**
 | 
	
		
			
				|  |  |  	 * 管理员录入的收款 ,确认认领到谁的名下.统计收款金额
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	function invoiceReceivablesAscription() {
 | 
	
	
		
			
				|  | @@ -1269,6 +1345,9 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if (empty ( $detail ))
 | 
	
		
			
				|  |  |  			die ( 'illegal request' );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | +		if (empty ( $detail ['irid'] ))
 | 
	
		
			
				|  |  | +			die ( 'illegal request' );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		$item = array (
 | 
	
		
			
				|  |  |  				'untreadStatus' => 3,
 | 
	
		
			
				|  |  |  				'updateTime' => date ( "Y-m-d H:i:s" ),
 | 
	
	
		
			
				|  | @@ -1634,142 +1713,145 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  |  		$invoice = new invoice ();
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$MebSea = isset($this->params ['MebSea']) ? urldecode($this->params ['MebSea']) : '';
 | 
	
		
			
				|  |  | +		$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';
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$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;
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$get="/".$date;
 | 
	
		
			
				|  |  | +		$con = '';
 | 
	
		
			
				|  |  | +		if ($date == 'MONTHO')
 | 
	
		
			
				|  |  | +			$con = ' and updateTime>DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
 | 
	
		
			
				|  |  | +		elseif ($date == 'MONTHT')
 | 
	
		
			
				|  |  | +			$con = ' and updateTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)';
 | 
	
		
			
				|  |  | +		elseif ($date == 'MONTHY')
 | 
	
		
			
				|  |  | +			$con = ' and updateTime>DATE_SUB(CURDATE(), INTERVAL 1 YEAR)';
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$con='';
 | 
	
		
			
				|  |  | -		if ($date=='MONTHO')
 | 
	
		
			
				|  |  | -			$con=' and updateTime>DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
 | 
	
		
			
				|  |  | -		elseif ($date=='MONTHT')
 | 
	
		
			
				|  |  | -			$con=' and updateTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)';
 | 
	
		
			
				|  |  | -		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;
 | 
	
		
			
				|  |  | +		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",$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;
 | 
	
		
			
				|  |  | +		$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", $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;
 | 
	
		
			
				|  |  | +		$this->data ['date'] = $date;
 | 
	
		
			
				|  |  |  		$this->data ['memu'] = "invoice";
 | 
	
		
			
				|  |  |  		$this->data ['staff'] = $this->staff;
 | 
	
		
			
				|  |  |  		$this->data ['receiptMemu'] = 'invoice';
 | 
	
		
			
				|  |  |  		$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;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$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;
 | 
	
		
			
				|  |  | +		$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 ['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";
 | 
	
		
			
				|  |  | +		$MebSea = isset ( $this->params ['MebSea'] ) ? urldecode ( $this->params ['MebSea'] ) : '';
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$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';
 | 
	
		
			
				|  |  | +		$page_size = 12;
 | 
	
		
			
				|  |  | +		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
 | 
	
		
			
				|  |  | +		$status = isset ( $this->params ['status'] ) ? $this->params ['status'] : 'All';
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		$get="/".$status."/".$year."/".$month;
 | 
	
		
			
				|  |  | -			
 | 
	
		
			
				|  |  | -		if (!empty($MebSea)){
 | 
	
		
			
				|  |  | -			$con.=' and ( receivablesMessage like "%'.$MebSea.'%"  or receivablesPrice like "%'.$MebSea.'%" )';
 | 
	
		
			
				|  |  | -			$get.="/".$MebSea;
 | 
	
		
			
				|  |  | +		$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>';
 | 
	
		
			
				|  |  | +		$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>';
 | 
	
		
			
				|  |  | +				$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 ['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 ['status'] = $status;
 | 
	
		
			
				|  |  |  		$this->data ['memu'] = "invoice";
 | 
	
		
			
				|  |  |  		$this->data ['staff'] = $this->staff;
 | 
	
		
			
				|  |  |  		$this->data ['receiptMemu'] = 'invoiceReceivables';
 | 
	
	
		
			
				|  | @@ -1978,11 +2060,12 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$price = 0;
 | 
	
		
			
				|  |  | -		$priceStatus = 0;$isReceivables=0;
 | 
	
		
			
				|  |  | +		$priceStatus = 0;
 | 
	
		
			
				|  |  | +		$isReceivables = 0;
 | 
	
		
			
				|  |  |  		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  |  		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );
 | 
	
		
			
				|  |  | -		if (!empty($list))
 | 
	
		
			
				|  |  | -			$isReceivables=1;
 | 
	
		
			
				|  |  | +		if (! empty ( $list ))
 | 
	
		
			
				|  |  | +			$isReceivables = 1;
 | 
	
		
			
				|  |  |  		$receivablesPrice = 0;
 | 
	
		
			
				|  |  |  		foreach ( $list as $key => $value ) {
 | 
	
		
			
				|  |  |  			$receivablesPrice += $value ['receivablesPrice'];
 | 
	
	
		
			
				|  | @@ -1990,8 +2073,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if ($receivablesPrice > $detail ['invoicePrice']) {
 | 
	
		
			
				|  |  |  			$price = $receivablesPrice - $detail ['invoicePrice'];
 | 
	
		
			
				|  |  |  			$priceStatus = 1;
 | 
	
		
			
				|  |  | -		}elseif($receivablesPrice < $detail ['invoicePrice']){
 | 
	
		
			
				|  |  | -			$price = $detail ['invoicePrice']-$receivablesPrice;
 | 
	
		
			
				|  |  | +		} elseif ($receivablesPrice < $detail ['invoicePrice']) {
 | 
	
		
			
				|  |  | +			$price = $detail ['invoicePrice'] - $receivablesPrice;
 | 
	
		
			
				|  |  |  			$priceStatus = 2;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
	
		
			
				|  | @@ -2045,7 +2128,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  				',
 | 
	
		
			
				|  |  |  				'price' => $price,
 | 
	
		
			
				|  |  |  				'priceStatus' => $priceStatus,
 | 
	
		
			
				|  |  | -				'isReceivables'=>$isReceivables
 | 
	
		
			
				|  |  | +				'isReceivables' => $isReceivables 
 | 
	
		
			
				|  |  |  		) );
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
	
		
			
				|  | @@ -2104,12 +2187,13 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		$invoiceOperationLog->setInvoiceOperationLog ( $item );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$price = 0;
 | 
	
		
			
				|  |  | -		$priceStatus = 0;$isReceivables=0;
 | 
	
		
			
				|  |  | +		$priceStatus = 0;
 | 
	
		
			
				|  |  | +		$isReceivables = 0;
 | 
	
		
			
				|  |  |  		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  |  		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $invoiceIrid );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		if (!empty($list))
 | 
	
		
			
				|  |  | -			$isReceivables=1;
 | 
	
		
			
				|  |  | +		if (! empty ( $list ))
 | 
	
		
			
				|  |  | +			$isReceivables = 1;
 | 
	
		
			
				|  |  |  		$receivablesPrice = 0;
 | 
	
		
			
				|  |  |  		foreach ( $list as $key => $value ) {
 | 
	
		
			
				|  |  |  			$receivablesPrice += $value ['receivablesPrice'];
 | 
	
	
		
			
				|  | @@ -2117,8 +2201,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if ($receivablesPrice > $detail ['invoicePrice']) {
 | 
	
		
			
				|  |  |  			$price = $receivablesPrice - $detail ['invoicePrice'];
 | 
	
		
			
				|  |  |  			$priceStatus = 1;
 | 
	
		
			
				|  |  | -		}elseif($receivablesPrice < $detail ['invoicePrice']){
 | 
	
		
			
				|  |  | -			$price = $detail ['invoicePrice']-$receivablesPrice;
 | 
	
		
			
				|  |  | +		} elseif ($receivablesPrice < $detail ['invoicePrice']) {
 | 
	
		
			
				|  |  | +			$price = $detail ['invoicePrice'] - $receivablesPrice;
 | 
	
		
			
				|  |  |  			$priceStatus = 2;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
	
		
			
				|  | @@ -2175,8 +2259,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  					</script>
 | 
	
		
			
				|  |  |  				',
 | 
	
		
			
				|  |  |  				'price' => $price,
 | 
	
		
			
				|  |  | -				'priceStatus' => $priceStatus ,
 | 
	
		
			
				|  |  | -				'isReceivables'=>$isReceivables
 | 
	
		
			
				|  |  | +				'priceStatus' => $priceStatus,
 | 
	
		
			
				|  |  | +				'isReceivables' => $isReceivables 
 | 
	
		
			
				|  |  |  		) );
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
	
		
			
				|  | @@ -2342,10 +2426,11 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$price = 0;
 | 
	
		
			
				|  |  | -		$priceStatus = 0;$isReceivables=0;
 | 
	
		
			
				|  |  | +		$priceStatus = 0;
 | 
	
		
			
				|  |  | +		$isReceivables = 0;
 | 
	
		
			
				|  |  |  		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );
 | 
	
		
			
				|  |  | -		if (!empty($list))
 | 
	
		
			
				|  |  | -			$isReceivables=1;
 | 
	
		
			
				|  |  | +		if (! empty ( $list ))
 | 
	
		
			
				|  |  | +			$isReceivables = 1;
 | 
	
		
			
				|  |  |  		$receivablesPrice = 0;
 | 
	
		
			
				|  |  |  		foreach ( $list as $key => $value ) {
 | 
	
		
			
				|  |  |  			$receivablesPrice += $value ['receivablesPrice'];
 | 
	
	
		
			
				|  | @@ -2353,8 +2438,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if ($receivablesPrice > $detail ['invoicePrice']) {
 | 
	
		
			
				|  |  |  			$price = $receivablesPrice - $detail ['invoicePrice'];
 | 
	
		
			
				|  |  |  			$priceStatus = 1;
 | 
	
		
			
				|  |  | -		}elseif($receivablesPrice < $detail ['invoicePrice']){
 | 
	
		
			
				|  |  | -			$price = $detail ['invoicePrice']-$receivablesPrice;
 | 
	
		
			
				|  |  | +		} elseif ($receivablesPrice < $detail ['invoicePrice']) {
 | 
	
		
			
				|  |  | +			$price = $detail ['invoicePrice'] - $receivablesPrice;
 | 
	
		
			
				|  |  |  			$priceStatus = 2;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
	
		
			
				|  | @@ -2364,8 +2449,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  				'html2' => $html2,
 | 
	
		
			
				|  |  |  				'price' => $price,
 | 
	
		
			
				|  |  |  				'priceStatus' => $priceStatus,
 | 
	
		
			
				|  |  | -				'isReceivables'=>$isReceivables
 | 
	
		
			
				|  |  | -				
 | 
	
		
			
				|  |  | +				'isReceivables' => $isReceivables 
 | 
	
		
			
				|  |  |  		) );
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	function ajaxGetInvoiceInfoByType() {
 | 
	
	
		
			
				|  | @@ -2467,6 +2551,57 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			die ();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | +	function ajaxGetInvoiceReceivablesByStaff() {
 | 
	
		
			
				|  |  | +		$postData = $this->get_args ( 'postData' ) ? $this->get_args ( 'postData' ) : "";
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		if (empty ( $postData )) {
 | 
	
		
			
				|  |  | +			echo json_encode ( array (
 | 
	
		
			
				|  |  | +					'status' => 2,
 | 
	
		
			
				|  |  | +					'msg' => 'illegal request' 
 | 
	
		
			
				|  |  | +			) );
 | 
	
		
			
				|  |  | +			die ();
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'invoiceReceivables' );
 | 
	
		
			
				|  |  | +		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $postData );
 | 
	
		
			
				|  |  | +		if (empty ( $detail )) {
 | 
	
		
			
				|  |  | +			echo json_encode ( array (
 | 
	
		
			
				|  |  | +					'status' => 2,
 | 
	
		
			
				|  |  | +					'msg' => 'illegal request' 
 | 
	
		
			
				|  |  | +			) );
 | 
	
		
			
				|  |  | +			die ();
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'L_category' );
 | 
	
		
			
				|  |  | +		$lCategory = new L_category ();
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'staff' );
 | 
	
		
			
				|  |  | +		$staff = new staff ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$staffList = $staff->getStaffByCid ( $detail ['cid'] );
 | 
	
		
			
				|  |  | +		$category = $lCategory->getCategory ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$categoryHtml = '<option post-data="PUBLIC" value="PUBLIC" >公共待认领款项</option>';
 | 
	
		
			
				|  |  | +		$staffHtml = '<option value="PUBLIC">办事处待认领款项</option>';
 | 
	
		
			
				|  |  | +		foreach ( $category as $key => $value ) {
 | 
	
		
			
				|  |  | +			$categoryHtml .= '<option  post-data="' . $value ['cid'] . '" value="' . $value ['cid'] . ':' . $value ['title'] . '" >' . $value ['title'] . '</option>';
 | 
	
		
			
				|  |  | +			if ($value ['cid'] == $detail ['cid'])
 | 
	
		
			
				|  |  | +				$categoryHtml .= '<option selected  post-data="' . $value ['cid'] . '" value="' . $value ['cid'] . ':' . $value ['title'] . '" >' . $value ['title'] . '</option>';
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		foreach ( $staffList as $key => $value ) {
 | 
	
		
			
				|  |  | +			$staffHtml .= '<option value="' . $value ['sid'] . '-' . $value ['username'] . '">' . $value ['category'] . '-' . $value ['username'] . '</option>';
 | 
	
		
			
				|  |  | +			if ($value ['sid'] == $detail ['sid'])
 | 
	
		
			
				|  |  | +				$staffHtml .= '<option selected value="' . $value ['sid'] . '-' . $value ['username'] . '">' . $value ['category'] . '-' . $value ['username'] . '</option>';
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		echo json_encode ( array (
 | 
	
		
			
				|  |  | +				'status' => 1,
 | 
	
		
			
				|  |  | +				'categoryHtml' => $categoryHtml,
 | 
	
		
			
				|  |  | +				'staffHtml' => $staffHtml ,
 | 
	
		
			
				|  |  | +				'detail'=>$detail
 | 
	
		
			
				|  |  | +		) );
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  |  	function _GetFileEXT($filename) {
 | 
	
		
			
				|  |  |  		$pics = explode ( '.', $filename );
 | 
	
		
			
				|  |  |  		$num = count ( $pics );
 | 
	
	
		
			
				|  | @@ -2526,33 +2661,30 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		$page ['on_page'] = $on_page;
 | 
	
		
			
				|  |  |  		$total_count = $this->get_table_count ( $table, $condition );
 | 
	
		
			
				|  |  |  		$total = intval ( $total_count / $page_size );
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		$page ['total_page'] = ($total_count % $page_size) == 0 ? $total : $total + 1;
 | 
	
		
			
				|  |  |  		$page ['total_data'] = $total_count;
 | 
	
		
			
				|  |  |  		$page ['next'] = $on_page == $page ['total_page'] ? $page ['total_page'] : $on_page + 1;
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		$i = 1;
 | 
	
		
			
				|  |  |  		$page_max = 1;
 | 
	
		
			
				|  |  | -		$page_width=3;
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +		$page_width = 3;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		if ($on_page >= $page_width) {
 | 
	
		
			
				|  |  |  			$page_max = intval ( $on_page / $page_width ) + 1;
 | 
	
		
			
				|  |  |  			$i = intval ( $on_page / $page_width ) * $page_width - 1;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		for(; $i <= $page ['total_page']; $i ++) {
 | 
	
		
			
				|  |  |  			if ($i == $on_page)
 | 
	
		
			
				|  |  |  				$page_c .= '<li class="active"><a href="javascript:void(0)">' . $i . '</a></li>';
 | 
	
		
			
				|  |  | -				else
 | 
	
		
			
				|  |  | -					$page_c .= '<li><a href="/' . $action .'/'. $i . $get . '">' . $i . '</a></li>';
 | 
	
		
			
				|  |  | -						
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -					if ($i == ($page_width * $page_max))
 | 
	
		
			
				|  |  | -						break;
 | 
	
		
			
				|  |  | +			else
 | 
	
		
			
				|  |  | +				$page_c .= '<li><a href="/' . $action . '/' . $i . $get . '">' . $i . '</a></li>';
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +			if ($i == ($page_width * $page_max))
 | 
	
		
			
				|  |  | +				break;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		$page ['page'] = $page_c;
 | 
	
		
			
				|  |  |  		$page ['lower'] = (-- $on_page) * $page_size;
 | 
	
		
			
				|  |  |  		return $page;
 | 
	
	
		
			
				|  | @@ -2570,16 +2702,14 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	 * @param unknown_type $condition
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	public function get_table_count($table = "", $condition = "") {
 | 
	
		
			
				|  |  | -		//$sql = "select count(*) as count from " . $table . " where 1 " . $condition;
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +		// $sql = "select count(*) as count from " . $table . " where 1 " . $condition;
 | 
	
		
			
				|  |  |  		$sql = "select count(*) as count from " . $table . " where  " . $condition;
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -		//echo $sql;die;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		// echo $sql;die;
 | 
	
		
			
				|  |  |  		$query = Doo::db ()->query ( $sql );
 | 
	
		
			
				|  |  |  		$result = $query->fetch ();
 | 
	
		
			
				|  |  |  		return $result ['count'];
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  |  	function isInvoiceNew($type = "GLOBAL") {
 | 
	
		
			
				|  |  |  		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  |  		$invoice = new invoice ();
 | 
	
	
		
			
				|  | @@ -2592,10 +2722,10 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		// 我的发票待处理
 | 
	
		
			
				|  |  |  		$pendingInvoice = $invoice->getOne ( array (
 | 
	
		
			
				|  |  | -					'where' => "(status=3 or status=4 or (status=2 and printStatus=1 and untreadStatus=0 ) or (status=2 and printStatus=1 and untreadStatus=2 )  )  and isDelete=0 and sid=" . $_COOKIE ["staff"],
 | 
	
		
			
				|  |  | -					'desc' => 'iid',
 | 
	
		
			
				|  |  | -					'asArray' => TRUE 
 | 
	
		
			
				|  |  | -			) );
 | 
	
		
			
				|  |  | +				'where' => "(status=3 or status=4 or (status=2 and printStatus=1 and untreadStatus=0 ) or (status=2 and printStatus=1 and untreadStatus=2 )  )  and isDelete=0 and sid=" . $_COOKIE ["staff"],
 | 
	
		
			
				|  |  | +				'desc' => 'iid',
 | 
	
		
			
				|  |  | +				'asArray' => TRUE 
 | 
	
		
			
				|  |  | +		) );
 | 
	
		
			
				|  |  |  		// 我的收款待入账
 | 
	
		
			
				|  |  |  		$myClaim = $invoiceReceivables->getOne ( array (
 | 
	
		
			
				|  |  |  				'where' => " receivablesStaff like '" . $_COOKIE ["staff"] . "-%' and receivablesCategory like '" . $st [0] ['cid'] . ":%' and bindStatus=0",
 | 
	
	
		
			
				|  | @@ -2649,7 +2779,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  			$new ['print'] = TRUE;
 | 
	
		
			
				|  |  |  		if (! empty ( $untread ))
 | 
	
		
			
				|  |  |  			$new ['untread'] = TRUE;
 | 
	
		
			
				|  |  | -		return $new ;
 | 
	
		
			
				|  |  | +		return $new;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |