| 
					
				 | 
			
			
				@@ -76,6 +76,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$this->ACTION = $uriPartsOrig [1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$this->data ['new'] = $this->isInvoiceNew (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return "/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -93,11 +94,16 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	function testSend(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$title2 = '[结果]您的发票333完成打印'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$msg = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$url = 'http://m.cld.smartcost.com.cn/invoicePrintDetail/1.html'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$hfreult = $this->msgSend ( $msg, $title2, $url, 'caipin' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$msTouser='caipin|outaozhen'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$toparty= $this->getToparty('广东办'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$msg = '[测试]你有一笔待认领款项,请及时领取'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$toparty=26; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//$msg = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//$url = 'http://m.cld.smartcost.com.cn/invoicePrintDetail/1.html'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$hfreult = $this->msgSendToparty ( $msg, '', '', $toparty,'text' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	function invoice() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -434,6 +440,10 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceQuantity = $this->get_args ( 'invoiceQuantity' ) && is_numeric ( $this->get_args ( 'invoiceQuantity' ) ) ? $this->get_args ( 'invoiceQuantity' ) : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceUnitPrice = $this->get_args ( 'invoiceUnitPrice' ) && is_numeric ( $this->get_args ( 'invoiceUnitPrice' ) ) ? $this->get_args ( 'invoiceUnitPrice' ) : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceTitle = $this->get_args ( 'invoiceTitle' ) ? $this->get_args ( 'invoiceTitle' ) : ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceCompany = $this->get_args ( 'invoiceCompany' ) ? $this->get_args ( 'invoiceCompany' ) : ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -463,7 +473,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$instructionsNum = $this->get_args ( 'instructionsNum' ) ? $this->get_args ( 'instructionsNum' ) : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$remittance = $this->get_args ( 'remittance' ) ? $this->get_args ( 'remittance' ) : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if (! empty ( $cid ) && ! empty ( $invoicePrice ) && ! empty ( $invoiceElement ) && ! empty ( $iid )) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (! empty ( $cid ) && ! empty ( $invoiceQuantity ) && ! empty ( $invoiceUnitPrice ) && ! empty ( $invoiceElement ) && ! empty ( $iid )) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Doo::loadModel ( 'invoiceManage' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$invoiceManage = new invoiceManage (); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -485,11 +495,17 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					$moldManage [$value ['mold']] = $value ['staffList']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$invoicePrice=$invoiceQuantity*$invoiceUnitPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'iid' => $iid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'cid' => $cid [0], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'categoryName' => $cid [1], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'invoiceElement' => $invoiceElement, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'invoiceQuantity' => $invoiceQuantity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'invoiceUnitPrice' => $invoiceUnitPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'invoicePrice' => $invoicePrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'invoiceType' => $invoiceType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'doPost' => $doPost, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1042,6 +1058,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$invoicePrintDetail = $invoice->getInvoiceByPrint ( $iid ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (empty ( $invoicePrintDetail )) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				die ( 'illegal request' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'iid' => $iid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'printStatus' => 1, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1064,15 +1081,16 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$invoiceOperationLog->setInvoiceOperationLog ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 去统计--负票不汇总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'date' => date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'priceClass' => 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'cid' => $invoicePrintDetail ['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'staff' => $invoicePrintDetail ['sid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'invoicePrice' => $invoicePrintDetail ['invoicePrice']  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if($invoicePrintDetail['untreadStatus']!=4){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'date' => date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'priceClass' => 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'cid' => $invoicePrintDetail ['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'staff' => $invoicePrintDetail ['sid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'invoicePrice' => $invoicePrintDetail ['invoicePrice']  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$invoiceStatistics->setInvoiceStatisticsByCondition ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 发送通知信息到微信-去除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// $this->setWXMsg($iid,'PRINT'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1112,6 +1130,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoicePosted = $invoice->getPostByInvoice ( 1 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$expressList = $express->getExpressByAll (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$this->data ['expressList'] = $expressList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$this->data ['invoicePost'] = $invoicePost; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$this->data ['invoicePosted'] = $invoicePosted; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1242,7 +1261,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'previous' => ''  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// printStatus=1 and 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$sql = "  untreadStatus=0  and status=2 and sid=" . $this->staff [0] ['sid'] . $con; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$sql = "  (untreadStatus=0 or untreadStatus=3)  and status=2 and sid=" . $this->staff [0] ['sid'] . $con; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$action = "invoiceUntreadIsAchieve"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$pageinfo = $this->get_page ( "CLD_invoice", $sql, $page, $page_size, $action, $get, "" ); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1402,6 +1421,9 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'userName' => $this->staff [0] ['username'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'cid' => $this->staff [0] ['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'categoryName' => $this->staff [0] ['category'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'invoiceQuantity'=>-$invoiceDetail['invoiceQuantity'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'invoicePrice' => -$invoiceDetail['invoicePrice'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'invoiceSerial' => $invoiceSerial, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1538,6 +1560,9 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$iidKey = $XDeode->decode ( $iidKey ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$invoiceDetail = $invoice->getInvoiceByIid ( $iidKey ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (!($invoiceDetail['status']==2&&$invoiceDetail['printStatus']==1&&$invoiceDetail['untreadStatus']==0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				die ( 'illegal request' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$receivablesSerial = "#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 收款录入 并绑定发票 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1669,6 +1694,8 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Doo::loadModel ( 'invoiceStatistics' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceStatistics = new invoiceStatistics (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (! empty ( $receivablesPrice ) && ! empty ( $receivablesMessage ) && ! empty ( $receivablesBank ) && ! empty ( $receivablesDate ) && ! empty ( $receivablesCategory ) && ! empty ( $receivablesStaff )) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$item = array ( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1738,6 +1765,12 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$toparty= $this->getToparty($receivablesCategory[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$msg = '[通知]你有一笔待认领款项,请及时领取'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($toparty!=0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$this->msgSendToparty ( $msg, '', '', $toparty,'text' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return "/invoiceReceivables"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2647,17 +2680,19 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$D2 = $dateArr [1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$con = '1'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$con = ' status=2  '; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (! empty ( $D1 ) && ! empty ( $D2 )) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$con .= ' and date BETWEEN "' . $D1 . '" AND "' . $D2 . '" '; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($status == 'UNRECORD') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$con .= ' and untreadStatus=0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$con .= ' and printStatus=1 and untreadStatus=0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		elseif ($status == 'RECORD') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$con .= ' and untreadStatus=3'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$con .= ' and printStatus=1 and untreadStatus=3'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		elseif ($status == 'BOUNCED') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$con .= ' and untreadStatus=2'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		elseif($status == 'All'){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$con .= ' and ( untreadStatus=2 or untreadStatus=0 or untreadStatus=3 )'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$get = "/" . $status . "?date=" . urlencode ( $date ) . "&MebSea=" . urlencode ( $MebSea ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (! empty ( $MebSea )) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2783,7 +2818,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$pageinfo ['page'] = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'previous' => ''  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$sql = '(status=1 or status=3 or status=4) and processApprovals!=""' . $con; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$sql = '(status=1 or status=2 or status=3 or status=4) and processApprovals!=""' . $con; //echo $sql; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$pageinfo = $this->get_page ( "CLD_invoice", $sql, $page, $page_size, "invoiceApprovalAchieve", $get, "" ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$limit = $pageinfo ['lower'] . ',' . $page_size; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2843,8 +2878,8 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// and untreadStatus=0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$sql = "postStatus=1 and doPost=1 and status=2 and isDelete=0" . $con; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$action = "invoicePostAchieve"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} elseif ($this->ACTION == 'invoiceUntreadAchieve') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$sql = " printStatus=1 and untreadStatus=2 and status=2 " . $con; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} elseif ($this->ACTION == 'invoiceUntreadAchieve') {//printStatus=1 and 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$sql = "  untreadStatus=2 and status=2 " . $con; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$action = "invoiceUntreadAchieve"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4155,7 +4190,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// 发票邮寄 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$post = $invoice->getOne ( array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				'where' => "postStatus=0 and doPost=1 and status=2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'where' => "postStatus=0 and  printStatus=1 and isDelete=0 and doPost=1 and status=2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'asArray' => TRUE  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// 发票打印 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4231,6 +4266,41 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	function getToparty($category=''){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$token = $this->getAccessToken ();// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$result = json_decode ( $this->httpGet ( "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token={$token}&id=5" ),true ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$toparty=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($result['department'] as $key=>$value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($value['name']==$category) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$toparty=$value['id']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $toparty; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	function msgSendToparty($msg, $title, $url, $toparty, $text = '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$token = $this->getAccessToken (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($text == 'text') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$data = '{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				"touser": "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				"toparty": "' . $toparty . '", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				"totag": "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  				"msgtype": "text", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				"agentid": 1000002, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				"text": { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       				"content": "' . $msg . '" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   				"safe":0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$result = json_decode ( $this->httpPOST ( "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={$token}", $data ) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($result->errmsg != 'ok') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private function msgSend($msg, $title, $url, $user, $text = '') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$token = $this->getAccessToken (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($text == 'text') { 
			 |