Browse Source

申请退票

caipin 7 years ago
parent
commit
f8d2ae88dc

+ 2 - 3
global/js/invoice.js

@@ -78,12 +78,11 @@ $(function() {
 		$("input[name='droppedIidKey']").val($(this).attr("diss-data"));
 	});
 	
-	/*
-	 * 废弃
+	
 	$("a[node-invoice='untreadInvoice']").click(function() {
 		$("input[name='untreadIidKey']").val($(this).attr("diss-data"));
 	});
-	*/
+	
 	
 	$('a[bind-receivables="true"]').click(function() {
 		console.log('ddd');

+ 5 - 5
global/js/invoice.validator.js

@@ -47,14 +47,14 @@ $(function () {
 	    	invoiceCompany:'required(invoiceCompany);',
 	    	TIN:'required(invoiceCompany);',
 	    	address:'required(invoiceCompany);',
-	    	phone:'tel;required(invoiceCompany);',
+	    	phone:'required(invoiceCompany);tel(invoiceCompany);',
 	    	bank:'required(invoiceCompany);',
 	    	bankAccount:'required(invoiceCompany);',
-	    	'invoicePrice': 'required; '
+	    	invoicePrice: 'required; '
 		    ,invoiceElement: 'required; '
-		    ,'invoiceType': 'required'
+		    ,invoiceType: 'required'
 			,recipients: 'required(isMail); '
-			,recipientsPhone: 'digits;required(isMail); '
+			,recipientsPhone: 'required(isMail);digits(isMail); '
 			,recipientsAddress: 'required(isMail); '
 	    }
 	});
@@ -64,7 +64,7 @@ $(function () {
 	    focusCleanup: true,
 	    theme:"yellow_top",
 	    fields: {
-	        //'opinion': 'required; '
+	        'opinion': 'required; '
 	    }
 	});
 	

+ 3 - 3
protected/config/acl.conf.php

@@ -24,11 +24,11 @@ $acl ['ordinary'] ['allow'] = array (
 				//'ajaxGetInvoiceByStaff',
 				
 				'ajaxCompareInvoicePrice',
-				
-				
+				//新加普通
+				'invoiceUntreadIsAchieve',
 				
 				//删除核销相关操作
-				//'invoiceUntreadDo',
+				'invoiceUntreadDo',
 				//'ajaxGetReceivalblesByStaff',
 				//'ajaxCompareClaimPrice',
 				//'ajaxReceivablesRemove'

+ 0 - 1
protected/config/invoice/invoice.ini

@@ -1 +0,0 @@
-{"\u53d1\u7968\u6253\u5370":"43,58","\u53d1\u7968\u5ba1\u6279":",50,9,2"}

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

@@ -397,7 +397,9 @@ $route['post']['/ajaxGetInvoiceReceivables'] = array('InvoiceController', 'ajaxG
 //$route['post']['/ajaxGetInvoiceByStaff'] = array('InvoiceController', 'ajaxGetInvoiceByStaff');废弃
 
 $route['post']['/ajaxCompareInvoicePrice'] = array('InvoiceController', 'ajaxCompareInvoicePrice');
-
+//普通新加路由
+$route['get']['/invoiceUntreadIsAchieve'] = array('InvoiceController', 'invoiceUntreadIsAchieve');
+$route['get']['/invoiceUntreadIsAchieve/:page'] = array('InvoiceController', 'invoiceUntreadIsAchieve');
 
 
 

+ 98 - 21
protected/controller/InvoiceController.php

@@ -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 
 		) );

+ 18 - 3
protected/controller/ReceiptController.php

@@ -3561,9 +3561,16 @@ class ReceiptController extends DooController {
 					'asArray' => true 
 			) );
 			
+			$nslist=explode(',', $receiptDetail['nowStaff']);
+			$nsflag=true;
+			foreach ($nslist as $value){
+				if ($value==$this->staff['0']['sid']){
+					$nsflag=false;break;
+				}
+			}
+			//print_r($nslist);die;
 			
-			
-			if (empty ( $receiptDetail )||$receiptDetail['nowStaff']!=$this->staff['0']['sid'])
+			if (empty ( $receiptDetail )||$nsflag)
 				return "/approvalExpenses/pendApproval";
 			
 			$verifyDetail = $verify->getOne ( array (
@@ -7698,7 +7705,15 @@ class ReceiptController extends DooController {
 					'asArray' => true 
 			) );
 			
-			if (empty ( $receiptDetail ))
+			$nslist=explode(',', $receiptDetail['nowStaff']);
+			$nsflag=true;
+			foreach ($nslist as $value){
+				if ($value==$this->staff['0']['sid']){
+					$nsflag=false;break;
+				}
+			}
+			
+			if (empty ( $receiptDetail )||$nsflag)
 				return "/approval";
 			
 			$verifyDetail = $verify->getOne ( array (

+ 2 - 2
protected/plugin/TemplateTag.php

@@ -44,8 +44,8 @@ function isInvoiceNew($type = "GLOBAL") {
 	
 	
 	// 我的发票待处理
-	$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=" . $st[0]['sid'],
+	$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'],
 			'desc' => 'iid',
 			'asArray' => TRUE 
 	) );

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

@@ -42,7 +42,7 @@
 							</div>
 							<div class="clearfix">
 								
-								<legend><div class="fR"></div>待处理</legend>
+								<legend><div class="fR"><a href="/invoiceUntreadIsAchieve">申请退票</a></div>待处理</legend>
 								<!-- if !empty({{invoiceList.handleInvoice}}) -->
 								<table class="table table-bordered table-condensed">
 									<tbody>

+ 12 - 4
protected/view/admin/invoiceReceivables.html

@@ -32,6 +32,7 @@
 					
 						<div class="clearfix">
 							<legend><div class="fR"><a href="/invoiceReceivablesAS/1/Unclaimed/{{year}}/All/">查看所有</a></div>未入账发票</legend>
+							<!-- if !empty({{invoiceUnAccount}}) -->
 							<div class="input-append">
 							<form action="/invoiceReceivables" id="ira" method="post">
 									<input name="invoiceTC" class="datepicker-here span6" placeholder="输入开票单位查询" data-range="true" data-multiple-dates-separator=" - " data-language="zh" type="text">
@@ -68,13 +69,18 @@
 									<!-- endloop -->
 								</tbody>
 							</table>
+							
+							<!-- else -->
+							<blockquote><p class="colGray">暂时未入账发票</p></blockquote>
+							<!-- endif -->
 						</div>
 					
 					
 					
 					<div class="clearfix">
-					<!-- if !empty({{receivablesInput}}) -->
+					
 							<legend><div class="fR"><a href="/invoiceReceivablesAS/1/Unclaimed/{{year}}/All/">查看所有</a></div>最近认领&amp;录入</legend>
+							<!-- if !empty({{receivablesInput}}) -->
 							<table class="table table-bordered table-condensed">
 								<tbody>
 								<tr><th class="taC" width="70">收款金额</th><th class="taC">银行到帐信息</th><th class="taC">银行/到帐时间</th><th class="taC">收款录入</th><th class="taC">收款认领</th><th class="taC">开票单位</th><th class="taC" width="80">绑定发票</th></tr>
@@ -109,16 +115,18 @@
 								<!-- endloop -->
 								
 								</tbody>
+								
 							</table>
 							<!-- else -->
-							<blockquote><p class="colGray">暂时没有认领的收款</p></blockquote>
+							<blockquote><p class="colGray">暂时没有最近认领的收款</p></blockquote>
 							<!-- endif -->
 						</div>
 					
 					
 						<div class="clearfix">
-							<!-- if !empty({{receivablesList}}) -->
+							
 							<legend><div class="fR"><a href="/invoiceReceivablesAS">查看更多</a></div>最近入账</legend>
+							<!-- if !empty({{receivablesList}}) -->
 							<table class="table table-bordered table-condensed">
 								<tbody>
 								<tr><th class="taC" width="70">收款金额</th><th class="taC">银行到帐信息</th><th class="taC">银行/到帐时间</th><th class="taC">收款录入</th><th class="taC">收款认领</th></tr>
@@ -135,7 +143,7 @@
 								</tbody>
 							</table>
 							<!-- else -->
-							<blockquote><p class="colGray">暂时没有已认领的收款</p></blockquote>
+							<blockquote><p class="colGray">暂时没有最近入账</p></blockquote>
 							<!-- endif -->
 						</div>
 					</div>