| 
					
				 | 
			
			
				@@ -812,7 +812,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'expressCompany' => $expressCompany, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'expressNumber' => $expressNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'actualItems' => $actualItems, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				'poster' => $staff [0] ['username']  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'poster' => $this->staff [0] ['username']  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoice->setInvoiceByCondition ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return '/invoicePost'; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -991,6 +991,8 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoice = new invoice (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Doo::loadModel ( 'invoiceReceivables' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceReceivables = new invoiceReceivables (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Doo::loadModel ( 'invoiceOperationLog' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceOperationLog = new invoiceOperationLog (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$detail=$invoice->getInvoiceByIid($invoiceKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($claimKey); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1021,10 +1023,94 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'irid' => $iridString 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoice->setInvoiceByCondition($item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//操作日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'date' => date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'operation' => "收款".$detailM['receivablesSerial']."入账到发票".$detail['invoiceSerial'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'status' => 8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'img' => $this->staff [0] ['avatar'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'username' => $this->staff [0] ['username'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'uid' => $this->staff [0] ['sid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'category' => $this->staff [0] ['category'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'iid' => $detail['iid'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceOperationLog->setInvoiceOperationLog ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return "/invoiceMyReceivables"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 * 发票收入多个收款数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	function invoiceEnterReceivables(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceClaim = $this->get_args ( 'invoiceClaim' ) ? $this->get_args ( 'invoiceClaim' ) : ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Doo::loadModel ( 'invoice' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoice = new invoice (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Doo::loadModel ( 'invoiceReceivables' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceReceivables = new invoiceReceivables (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Doo::loadModel ( 'invoiceOperationLog' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceOperationLog = new invoiceOperationLog (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$detail=$invoice->getInvoiceByIid($invoiceKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (empty($detail)||empty($invoiceClaim)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			die ( 'illegal request' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$receivablesPrice=0;$iridString=$detail['irid'];$iridList=array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($invoiceClaim as $key=>$value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$receivablesPrice+=$detailM['receivablesPrice']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (empty($iridString)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$iridString=$detailM['irid']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$iridString.=",".$detailM['irid']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			array_push($iridList, $detailM['irid']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($receivablesPrice>=$detail['invoicePrice']){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$price=$receivablesPrice-$detail['invoicePrice']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			die('<p>收款金额超出开票金额 ¥'.$price.'元,请谨慎操作</p><a href="/invoice">返回</a>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			'irid' => $iridString, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			'bindTime' => date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			'updateTime'=> date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			'iid' => $detail['iid'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoice->setInvoiceByCondition($item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//操作日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'date' => date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'operation' => "多个收款入账到发票".$detail['invoiceSerial'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'status' => 8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'img' => $this->staff [0] ['avatar'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'username' => $this->staff [0] ['username'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'uid' => $this->staff [0] ['sid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'category' => $this->staff [0] ['category'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				'iid' => $detail['iid'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$invoiceOperationLog->setInvoiceOperationLog ( $item ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($iridList as $key=>$value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$item = array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'iid' => $detail['iid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'irid' => $value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'bindDate'=>date ( "Y-m-d H:i:s" ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					'bindStatus' => 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$invoiceReceivables->setInvoiceReceivablesByCondition($item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return "/invoice"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * 获得与我有关可收款的发票 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	function ajaxGetInvoiceByStaff() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1097,10 +1183,17 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$invoiceReceivables = new invoiceReceivables (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$detail=$invoice->getInvoiceByIid($invoiceKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($claimKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if ($detailM['receivablesPrice']>=$detail['invoicePrice']){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$price=$detailM['receivablesPrice']-$detail['invoicePrice']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$keyList=explode(';', $claimKey);$receivablesPrice=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($keyList as $key=>$value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$detailM=$invoiceReceivables->getInvoiceReceivablesByIrid($value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$receivablesPrice+=$detailM['receivablesPrice']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($receivablesPrice>=$detail['invoicePrice']){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$price=$receivablesPrice-$detail['invoicePrice']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			echo json_encode ( array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'status' => 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					'price'=>$price 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1199,19 +1292,25 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$list =$invoiceReceivables->getInvoiceReceivablesByClaim($this->staff [0] ['cid'],$this->staff [0] ['sid']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$html = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		foreach ( $list['myClaim'] as $key => $value ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$html .= '<tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					<td>' . $value ['receivablesPrice'] . '</td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					<td>¥' . $value ['receivablesMessage'] . '</td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					<td>¥' . $value ['receivablesPrice'] . '</td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					<td>' . $value ['receivablesMessage'] . '</td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					<td>' . $value ['receivablesBank'] . '</td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					<td>' . $value ['receivablesDate'] . '</td>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$html .= '<td><label><input type="radio" node-Claim="true" p-data="'.$value ['iidKey'].'" name="invoiceClaim"> 使用Ta</label></td></tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$html .= '<td><label><input type="checkbox" node-Claim="true" value="'.$value ['iidKey'].'" name="invoiceClaim[]"> 使用Ta</label></td></tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					<script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					$(\'input[node-Claim="true"]\').click(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						var invoiceKey=  $(this).attr("p-data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						var claimKey=$("input[name=\'key\']").val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						var result = new Array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		                $("[node-Claim=\'true\']:checkbox").each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		                    if ($(this).is(":checked")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		                        result.push($(this).attr("value")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						var invoiceKey=$("input[name=\'key\']").val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						$("p[node-msg=\"true\"]").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						var url = "/ajaxCompareClaimPrice"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						$.ajax({ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1220,7 +1319,7 @@ class InvoiceController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							cache : false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							dataType : "json", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							data : { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-								claimKey : claimKey, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+								claimKey : result.join(";"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 								invoiceKey:invoiceKey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							global : true, 
			 |