caipin před 8 roky
rodič
revize
c98a1db398

+ 31 - 0
global/js/invoice.js

@@ -134,6 +134,36 @@ $(function() {
 					$("td[node-bank]").html(data.detail.receivablesBank);
 					$("td[node-date]").html(data.detail.receivablesDate);
 				} 
+				
+			},
+			error : function(err) {
+			}
+		});
+	});
+	
+	$('a[node-recording="true"]').click(function() {
+		var postData =  $(this).attr("data-key");
+		var url = "/ajaxGetInvoiceByStaff";
+		$.ajax({
+			url : url,
+			type : "post",
+			cache : false,
+			dataType : "json",
+			data : {
+				key : postData
+			},
+			global : true,
+			success : function(data) {
+//				if (data.status == 1) {
+//					$("input[name='key']").val(postData);
+//					
+//					$("td[node-receivablesSerial]").html(data.detail.receivablesSerial);
+//					$("td[node-inputStaff]").html(data.detail.inputStaff+" "+data.detail.date);
+//					$("td[node-price]").html("<b>"+data.detail.receivablesPrice+"</b>");
+//					$("td[node-message]").html(data.detail.receivablesMessage);
+//					$("td[node-bank]").html(data.detail.receivablesBank);
+//					$("td[node-date]").html(data.detail.receivablesDate);
+//				} 
 				//else
 				//	$("div[loading-msg='true']").html("illegal request");
 			},
@@ -142,4 +172,5 @@ $(function() {
 		});
 	});
 	
+	
 })

+ 3 - 1
protected/config/routes.conf.php

@@ -372,12 +372,14 @@ $route['get']['/invoiceReceivables'] = array('InvoiceController', 'invoiceReceiv
 $route['get']['/invoiceReceivablesClaim'] = array('InvoiceController', 'invoiceReceivablesClaim');
 $route['post']['/invoiceReceivablesDo'] = array('InvoiceController', 'invoiceReceivablesDo');
 $route['post']['/invoiceReceivablesAscription'] = array('InvoiceController', 'invoiceReceivablesAscription');
-
+$route['get']['/invoiceMyReceivables'] = array('InvoiceController', 'invoiceMyReceivables');
 
 
 $route['post']['/ajaxGetInvoicePostDetail'] = array('InvoiceController', 'ajaxGetInvoicePostDetail');
 $route['post']['/ajaxGetStaffByCategory'] = array('InvoiceController', 'ajaxGetStaffByCategory');
 $route['post']['/ajaxGetInvoiceReceivables'] = array('InvoiceController', 'ajaxGetInvoiceReceivables');
+$route['post']['/ajaxGetInvoiceByStaff'] = array('InvoiceController', 'ajaxGetInvoiceByStaff');
+
 
 //假期管理
 $route['*']['/myList'] = array('HolidayController', 'myList');

+ 37 - 1
protected/controller/InvoiceController.php

@@ -956,7 +956,8 @@ class InvoiceController extends DooController {
 				'irid' =>$detail['irid'],
 				'receivablesCategory' =>$this->staff[0]['cid'].":".$this->staff[0]['category'],
 				'receivablesStaff' => $this->staff[0]['sid']."-".$this->staff[0]['username'],
-				'confirmTime' => date ( "Y-m-d H:i:s" )
+				'confirmTime' => date ( "Y-m-d H:i:s" ),
+				'source' =>1
 			);
 			$invoiceReceivables->setInvoiceReceivablesByCondition( $item );
 		}
@@ -964,6 +965,41 @@ class InvoiceController extends DooController {
 		return "/invoiceReceivablesClaim";
 	}
 	
+	/**
+	 * 
+	 */
+	function invoiceMyReceivables(){
+		Doo::loadModel ( 'invoiceReceivables' );
+		$invoiceReceivables = new invoiceReceivables ();
+		
+		$list=$invoiceReceivables->getInvoiceReceivablesByClaim($this->staff[0]['cid'],$this->staff[0]['sid']);
+		
+		$data ['list'] = $list;
+		
+		$data ['memu'] = "invoice";
+		$data ['staff'] = $this->staff;
+		$data ['receiptMemu'] = 'invoiceMyReceivables';
+		$this->render ( "/admin/invoiceMyReceivables", $data );
+	}
+	
+	/**
+	 * 获得与我有关可收款的发票
+	 */
+	function ajaxGetInvoiceByStaff(){
+		$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		
+		$list=$invoice->getInvoiceByReceivables($this->staff[0]['sid']);
+		echo json_encode ( array (
+				'status' => 1,
+				'list' => $list
+		) );
+	}
+	
+	/**
+	 * 获取一条收款信息
+	 */
 	function ajaxGetInvoiceReceivables(){
 		$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
 		Doo::loadModel ( 'invoiceReceivables' );

+ 26 - 6
protected/model/invoice.php

@@ -377,6 +377,26 @@ class invoice extends DooModel {
 	}
 	
 	/**
+	 * 获得与我有关可收款的发票,已经出票的发票
+	 * @param number $sid 开票人ID
+	 */
+	public function getInvoiceByReceivables($sid = 0) {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		$list ['handleInvoice'] = $this->find ( array (
+				'where' => "(status=2 and printStatus=1 and untreadStatus=0 )  and isDelete=0 and sid=" . $sid,
+				'desc' => 'iid',
+				'asArray' => TRUE 
+		) );
+		foreach ( $list ['handleInvoice'] as $key => $value ) {
+			$list ['handleInvoice'] [$key] ['iidKey'] = $this->authcode ( $value ['iid'], '' );
+			$list ['handleInvoice'] [$key] ['iidKeyUrl'] = $XDeode->encode ( $value ['iid'] );
+			// $list ['handleInvoice'] [$key] ['OperationLog'] = $invoiceOperationLog->getInvoiceOperationLogByIid ( $value ['iid'], 'desc' );
+		}
+		return $list['handleInvoice'];
+	}
+	
+	/**
 	 * 获取需要邮寄的发票
 	 * @param integer $postStatus 0为获取需要邮寄的发票,1为获取已经邮寄的发票
 	 * @return array|array() 返回相关数据
@@ -404,14 +424,14 @@ class invoice extends DooModel {
 	 * @param number $untreadStatus 退票状态
 	 * @param number $iid 发票ID
 	 */
-	public function getInvoiceByUntreadStatus( $untreadStatus = 1,$iid = 0) {
+	public function getInvoiceByUntreadStatus($untreadStatus = 1, $iid = 0) {
 		if (empty ( $iid )) {
 			$list = $this->find ( array (
-					'where' => " printStatus=1 and untreadStatus=".$untreadStatus." and status=2 ",
+					'where' => " printStatus=1 and untreadStatus=" . $untreadStatus . " and status=2 ",
 					'asArray' => TRUE 
 			) );
 			
-			if ($untreadStatus==2){
+			if ($untreadStatus == 2) {
 				Doo::loadModel ( 'invoiceOperationLog' );
 				$invoiceOperationLog = new invoiceOperationLog ();
 			}
@@ -424,13 +444,13 @@ class invoice extends DooModel {
 					$list [$key] ['untreadCompany'] = $express [0];
 					$list [$key] ['untreadCom'] = $express [1];
 				}
-				if ($untreadStatus==2){
-					$list[$key] ['OperationLog']=$invoiceOperationLog->getInvoiceOperationByStatus($value['iid'],6);
+				if ($untreadStatus == 2) {
+					$list [$key] ['OperationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], 6 );
 				}
 			}
 		} else {
 			$list = $this->getOne ( array (
-					'where' => "iid=" . $iid . " and printStatus=1 and untreadStatus=".$untreadStatus." and status=2",
+					'where' => "iid=" . $iid . " and printStatus=1 and untreadStatus=" . $untreadStatus . " and status=2",
 					'asArray' => TRUE 
 			) );
 		}

+ 45 - 28
protected/model/invoiceReceivables.php

@@ -18,6 +18,7 @@ class invoiceReceivables extends DooModel {
 	public $receivablesCategory;
 	public $receivablesStaff;
 	public $inputStaff;
+	public $source;
 	public $date;
 	public $confirmTime;
 	
@@ -33,39 +34,55 @@ class invoiceReceivables extends DooModel {
 			'receivablesCategory',
 			'receivablesStaff',
 			'inputStaff',
+			'source',
 			'date',
 			'confirmTime'
 	);
 
-	public function getInvoiceReceivablesByClaim($cid){
-		$list['csClaim'] = $this->find ( array (
-				'where' => "receivablesCategory='public' and receivablesStaff='public' ",
-				'desc' => 'irid',
-				'asArray' => TRUE
-		) );
-		foreach ( $list ['csClaim'] as $key => $value ) {
-			$list ['csClaim'] [$key] ['iidKey'] = $this->authcode ( $value ['irid'], '' );
-			//$list ['csClaim'] [$key] ['iidKeyUrl'] = $XDeode->encode ( $value ['iid'] );
-		}
-		
-		$list['sClaim'] = $this->find ( array (
-				'where' => "receivablesCategory!='public' and receivablesStaff='public' and receivablesCategory like '".$cid.":%'",
-				'desc' => 'irid',
-				'asArray' => TRUE
-		) );
-		foreach ( $list ['sClaim'] as $key => $value ) {
-			$list ['sClaim'] [$key] ['iidKey'] = $this->authcode ( $value ['irid'], '' );
+	public function getInvoiceReceivablesByClaim($cid=0,$sid=0){
+		if (empty($sid)){
+			$list['csClaim'] = $this->find ( array (
+					'where' => "receivablesCategory='public' and receivablesStaff='public' ",
+					'desc' => 'irid',
+					'asArray' => TRUE
+			) );
+			foreach ( $list ['csClaim'] as $key => $value ) {
+				$list ['csClaim'] [$key] ['iidKey'] = $this->authcode ( $value ['irid'], '' );
+				//$list ['csClaim'] [$key] ['iidKeyUrl'] = $XDeode->encode ( $value ['iid'] );
+			}
+			
+			$list['sClaim'] = $this->find ( array (
+					'where' => "receivablesCategory!='public' and receivablesStaff='public' and receivablesCategory like '".$cid.":%'",
+					'desc' => 'irid',
+					'asArray' => TRUE
+			) );
+			foreach ( $list ['sClaim'] as $key => $value ) {
+				$list ['sClaim'] [$key] ['iidKey'] = $this->authcode ( $value ['irid'], '' );
+			}
+			
+			$list['arClaim'] = $this->find ( array (
+					'where' => "receivablesCategory!='public' and receivablesStaff!='public' and receivablesCategory like '".$cid.":%'",
+					'desc' => 'irid',
+					'asArray' => TRUE
+			) );
+			foreach ( $list ['arClaim'] as $key => $value ) {
+				$staff = explode ( "-", $value ['receivablesStaff'] );
+				$list ['arClaim'] [$key] ['sid'] = $staff [0];
+				$list ['arClaim'] [$key] ['username'] = $staff [1];
+			}
 		}
-		
-		$list['arClaim'] = $this->find ( array (
-				'where' => "receivablesCategory!='public' and receivablesStaff!='public' and receivablesCategory like '".$cid.":%'",
-				'desc' => 'irid',
-				'asArray' => TRUE
-		) );
-		foreach ( $list ['arClaim'] as $key => $value ) {
-			$staff = explode ( "-", $value ['receivablesStaff'] );
-			$list ['arClaim'] [$key] ['sid'] = $staff [0];
-			$list ['arClaim'] [$key] ['username'] = $staff [1];
+		if (!empty($cid)&&!empty($sid)){
+			$list['myClaim'] = $this->find ( array (
+					'where' => " receivablesStaff like '".$sid."-%' and receivablesCategory like '".$cid.":%'",
+					'desc' => 'irid',
+					'asArray' => TRUE
+			) );
+			foreach ( $list ['myClaim'] as $key => $value ) {
+				$list ['myClaim'] [$key] ['iidKey'] = $this->authcode ( $value ['irid'], '' );
+				$staff = explode ( "-", $value ['receivablesStaff'] );
+				$list ['myClaim'] [$key] ['sid'] = $staff [0];
+				$list ['myClaim'] [$key] ['username'] = $staff [1];
+			}
 		}
 		
 		return $list;

+ 1 - 1
protected/view/admin/invoiceMenu.html

@@ -4,7 +4,7 @@
 			<!-- if {{receiptMemu}}=="invoice" --> class="selected" <!-- endif -->
 			>我的发票
 	</a></li>
-	<li class="news"><a href="invoice-billing-my.html">我的收款</a></li>
+	<li class="news"><a <!-- if {{receiptMemu}}=="invoiceMyReceivables" --> class="selected" <!-- endif --> href="/invoiceMyReceivables">我的收款</a></li>
 	<li><a <!-- if {{receiptMemu}}=="invoiceReceivablesClaim" --> class="selected" <!-- endif --> href="/invoiceReceivablesClaim">收款认领</a></li>