|  | @@ -51,6 +51,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if (! $flag)
 | 
	
		
			
				|  |  |  			die ( 'illegal request' );
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  |  	function __construct() {
 | 
	
		
			
				|  |  |  		if (isset ( $_COOKIE ["staff"] )) {
 | 
	
		
			
				|  |  |  			if (! empty ( $_COOKIE ["staff"] )) {
 | 
	
	
		
			
				|  | @@ -78,11 +79,14 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	function invoice() {
 | 
	
		
			
				|  |  |  		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  |  		$invoice = new invoice ();
 | 
	
		
			
				|  |  | -		Doo::loadModel ( 'express' );
 | 
	
		
			
				|  |  | -		$express = new express ();
 | 
	
		
			
				|  |  | +// 		Doo::loadModel ( 'express' );
 | 
	
		
			
				|  |  | +// 		$express = new express ();
 | 
	
		
			
				|  |  | +// 		$expressList = $express->getExpressByAll ();
 | 
	
		
			
				|  |  | +// 		$this->data ['expressList'] = $expressList;
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		Doo::loadModel ( 'invoiceReceivables' );
 | 
	
		
			
				|  |  | -		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  | +// 		Doo::loadModel ( 'invoiceReceivables' );
 | 
	
		
			
				|  |  | +// 		$invoiceReceivables = new invoiceReceivables ();
 | 
	
		
			
				|  |  | +// 		$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		Doo::loadModel ( 'invoiceStatistics' );
 | 
	
		
			
				|  |  |  		$invoiceStatistics = new invoiceStatistics ();
 | 
	
	
		
			
				|  | @@ -100,11 +104,8 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		Doo::loadClass ( 'XDeode' );
 | 
	
		
			
				|  |  |  		$XDeode = new XDeode ( 5 );
 | 
	
		
			
				|  |  |  		$sid = $XDeode->decode ( $_COOKIE ["staff"] );
 | 
	
		
			
				|  |  | -		//$expressList = $express->getExpressByAll ();
 | 
	
		
			
				|  |  | -		$invoiceList = $invoice->getMyInvoice ( $sid );
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		// $list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | +		$invoiceList = $invoice->getMyInvoice ( $sid );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$sql = 'status=2 and printStatus=1 and irid!="" and sid=' . $sid;
 | 
	
		
			
				|  |  |  		$list = $invoice->getInvoiceByUntreadStatusPage ( 4, $sql );
 | 
	
	
		
			
				|  | @@ -114,9 +115,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		$this->data ['isMonth'] = $isMonth;
 | 
	
		
			
				|  |  |  		$this->data ['htm'] = $htm;
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		//$this->data ['expressList'] = $expressList;
 | 
	
		
			
				|  |  |  		$this->data ['invoiceList'] = $invoiceList;
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  |  		$this->data ['receivablesList'] = $list;
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$this->data ['memu'] = "invoice";
 | 
	
	
		
			
				|  | @@ -600,8 +599,9 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		return "/invoice";
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  | -	 * @deprecated
 | 
	
		
			
				|  |  | -	 * 申请退票 --需求变更 废弃
 | 
	
		
			
				|  |  | +	 * 
 | 
	
		
			
				|  |  | +	 * 申请退票 --
 | 
	
		
			
				|  |  | +	*/
 | 
	
		
			
				|  |  |  	function invoiceUntreadDo() {
 | 
	
		
			
				|  |  |  		$untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';
 | 
	
		
			
				|  |  |  		$untreadReason = $this->get_args ( 'untreadReason' ) ? $this->get_args ( 'untreadReason' ) : "";
 | 
	
	
		
			
				|  | @@ -621,13 +621,14 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		if (! empty ( $iid ) && ! is_numeric ( $iid ))
 | 
	
		
			
				|  |  |  			die ( 'illegal request' );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | +		/* 需求变革 有绑定收款也可以退票
 | 
	
		
			
				|  |  |  		$lt = $invoiceReceivables->getInvoiceReceivablesByIid ( $untreadIidKey );
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  |  		if (! empty ( $lt )) {
 | 
	
		
			
				|  |  |  			header ( 'Content-Type:text/html;charset=utf-8' );
 | 
	
		
			
				|  |  |  			die ( '该发票有收款绑定,请先移除!' );
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +		*/
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  |  		$item = array (
 | 
	
		
			
				|  |  |  				'iid' => $iid,
 | 
	
		
			
				|  |  |  				'untreadStatus' => 1,
 | 
	
	
		
			
				|  | @@ -657,7 +658,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		return "/invoice";
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	*/
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 删除已终止的开票
 | 
	
	
		
			
				|  | @@ -758,6 +759,9 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  				'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'] . ' and iid=' . $iid,
 | 
	
		
			
				|  |  |  				'asArray' => true 
 | 
	
		
			
				|  |  |  		) );
 | 
	
		
			
				|  |  | +		if (empty($invoiceDetail))
 | 
	
		
			
				|  |  | +			die ( 'illegal request' );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  |  		$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $iid );
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		$this->data ['invoiceDetail'] = $invoiceDetail;
 | 
	
	
		
			
				|  | @@ -1095,6 +1099,78 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  | +	 * 可退票管理
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  | +	function invoiceUntreadIsAchieve(){
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'invoice' );
 | 
	
		
			
				|  |  | +		$invoice = new invoice ();
 | 
	
		
			
				|  |  | +		Doo::loadClass ( 'XDeode' );
 | 
	
		
			
				|  |  | +		$XDeode = new XDeode ( 5 );
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'staff' );
 | 
	
		
			
				|  |  | +		$staff = new staff ();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$MebSea =$this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : ""; 
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$page_size = 18;
 | 
	
		
			
				|  |  | +		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
 | 
	
		
			
				|  |  | +		$date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$get = "?date=" . urlencode ($date)."&MebSea=".urlencode ($MebSea);
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$dateArr=explode(':', $date);$D1='';$D2='';
 | 
	
		
			
				|  |  | +		if (!empty($date)){
 | 
	
		
			
				|  |  | +			$D1=$dateArr[0];
 | 
	
		
			
				|  |  | +			$D2=$dateArr[1];
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		$con = '';
 | 
	
		
			
				|  |  | +		if (!empty($D1)&&!empty($D2))
 | 
	
		
			
				|  |  | +			$con=' and bindTime BETWEEN "'.$D1.'" AND "'.$D2.'" ';
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +// 		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 . '%" )';
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		$pageinfo ['page'] = array (
 | 
	
		
			
				|  |  | +					'previous' => ''
 | 
	
		
			
				|  |  | +		);
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | + 		$sql = " printStatus=1 and untreadStatus=0 and status=2 " . $con;
 | 
	
		
			
				|  |  | + 		$action = "invoiceUntreadIsAchieve";
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$pageinfo = $this->get_page ( "CLD_invoice", $sql, $page, $page_size, $action, $get, "" );
 | 
	
		
			
				|  |  | +		$limit = $pageinfo ['lower'] . ',' . $page_size;
 | 
	
		
			
				|  |  | +		$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $sql );
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Doo::loadModel ( 'express' );
 | 
	
		
			
				|  |  | +		$express = new express ();
 | 
	
		
			
				|  |  | +		$expressList = $express->getExpressByAll ();
 | 
	
		
			
				|  |  | +		$this->data ['expressList'] = $expressList;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		//print_r($list);
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$this->data ['MebSeaEn'] = $MebSea;
 | 
	
		
			
				|  |  | +		//$this->data ['MebSea'] = urlencode ( $MebSea );
 | 
	
		
			
				|  |  | +		$this->data ['get'] = $get;
 | 
	
		
			
				|  |  | +		$this->data ['page'] = $pageinfo;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		$this->data ['date'] = $date;
 | 
	
		
			
				|  |  | +		$this->data ['list'] = $list;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | + 		$this->data ['memu'] = "invoice";
 | 
	
		
			
				|  |  | +		$this->data ['staff'] = $this->staff;
 | 
	
		
			
				|  |  | +		$this->data ['receiptMemu'] = 'invoice';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		$this->render ( "/admin/invoiceUntreadIsAchieve", $this->data );
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	/**
 | 
	
		
			
				|  |  |  	 * 退票处理页面
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	function invoiceUntread() {
 | 
	
	
		
			
				|  | @@ -1624,8 +1700,9 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  | -	 * @deprecated
 | 
	
		
			
				|  |  | -	 * 收款绑定发票 ,一个收款只能绑定一个发票 --废弃
 | 
	
		
			
				|  |  | +	 *
 | 
	
		
			
				|  |  | +	 * 收款绑定发票 ,一个收款只能绑定一个发票 
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  |  	function invoiceBindReceivables() {
 | 
	
		
			
				|  |  |  		$claimKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
 | 
	
		
			
				|  |  |  		$invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
 | 
	
	
		
			
				|  | @@ -1687,7 +1764,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		return "/invoiceReceivables";
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	*/
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * @deprecated
 | 
	
	
		
			
				|  | @@ -3603,10 +3680,10 @@ 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'];
 | 
	
	
		
			
				|  | @@ -3623,7 +3700,7 @@ class InvoiceController extends DooController {
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		// 我的发票待处理
 | 
	
		
			
				|  |  |  		$pendingInvoice = $invoice->getOne ( array (//or (status=2 and printStatus=1 and untreadStatus=0 ) or (status=2 and printStatus=1 and untreadStatus=2 )
 | 
	
		
			
				|  |  | -				'where' => "(status=3 or status=4   )  and isDelete=0 and sid=" . $st [0] ['sid'],
 | 
	
		
			
				|  |  | +				'where' => "(status=3 or status=4) and isDelete=0 and sid=" . $st [0] ['sid'],
 | 
	
		
			
				|  |  |  				'desc' => 'iid',
 | 
	
		
			
				|  |  |  				'asArray' => TRUE 
 | 
	
		
			
				|  |  |  		) );
 |