Prechádzať zdrojové kódy

重构报销单金额调整

caipin 7 rokov pred
rodič
commit
4f49892333

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

@@ -247,7 +247,9 @@ $route['*']['/staffCollect'] = array('ReceiptController', 'staffCollect');
 $route['*']['/staffCollectDetail/:staffname'] = array('ReceiptController', 'staffCollectDetail');
 $route['*']['/staffCollectDetail'] = array('ReceiptController', 'staffCollectDetail');
 $route['*']['/eMail'] = array('ReceiptController', 'eMail');
-$route['*']['/revocationAdjustment/:sid/:price/:rid'] = array('ReceiptController', 'revocationAdjustment');
+
+$route['*']['/revocationAdjustment/:sidKey/:price/:ridKey/:reviseKey'] = array('ReceiptController', 'revocationAdjustment');
+
 $route['*']['/staffCollectMonthDetail/:year/:month'] = array('ReceiptController', 'staffCollectMonthDetail');
 $route['*']['/staffCollectMonthDetail2/:year/:month'] = array('ReceiptController', 'staffCollectMonthDetail2');
 
@@ -453,8 +455,8 @@ $route['*']['/invoiceDetail/:iid'] = array('InvoiceController', 'invoiceDetail',
 $route['*']['/invoiceApprovalDo'] = array('InvoiceController', 'invoiceApprovalDo');
 $route['get']['/invoiceApprovalAchieve'] = array('InvoiceController', 'invoiceApprovalAchieve');
 $route['get']['/invoiceApprovalAchieve/:page'] = array('InvoiceController', 'invoiceApprovalAchieve');
-$route['get']['/invoiceApprovalAchieve/:page/:date'] = array('InvoiceController', 'invoiceApprovalAchieve');
-$route['get']['/invoiceApprovalAchieve/:page/:date/:MebSea'] = array('InvoiceController', 'invoiceApprovalAchieve');
+$route['get']['/invoiceApprovalAchieve/:page/:status'] = array('InvoiceController', 'invoiceApprovalAchieve');
+$route['get']['/invoiceApprovalAchieve/:page/:status/:MebSea'] = array('InvoiceController', 'invoiceApprovalAchieve');
 
 //新加信息推送
 $route['get']['/ajaxInvoicePushNotice'] = array('InvoiceController', 'ajaxInvoicePushNotice');

+ 7 - 7
protected/controller/InvoiceController.php

@@ -4338,17 +4338,17 @@ class InvoiceController extends DooController {
 		
 		$page_size = 12;
 		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
-		$date = isset ( $this->params ['date'] ) ? $this->params ['date'] : 'MONTHO';
+		$date = isset ( $this->params ['status'] ) ? $this->params ['status'] : 'ALL';
 		
 		$get = "/" . $date;
 		
 		$con = '';
-		if ($date == 'MONTHO')
-			$con = ' and approvalTime>DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
-		elseif ($date == 'MONTHT')
-			$con = ' and approvalTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)';
-		elseif ($date == 'MONTHY')
-			$con = ' and approvalTime>DATE_SUB(CURDATE(), INTERVAL 1 YEAR)';
+		if ($date == 'ALL')
+			$con = ' and isDelete=0 and untreadStatus=0';
+		elseif ($date == 'PEND')
+			$con = ' and isDelete=0 and untreadStatus=0 ';
+		elseif ($date == 'APPROVED')
+			$con = ' and isDelete=0 and untreadStatus=0 ';
 		
 		if (! empty ( $MebSea )) {
 			$con .= ' and ( invoiceTitle like "%' . $MebSea . '%" or invoiceCompany like "%' . $MebSea . '%" or invoicePrice like "%' . $MebSea . '%" )';

+ 52 - 16
protected/controller/ReceiptController.php

@@ -4836,12 +4836,30 @@ class ReceiptController extends DooController {
 		$button = 0;
 		if ($ap == 4)
 			$status = 4;
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
 		foreach ( $receiptList as $key => $value ) {
+			
+			$receiptList[$key]['ridKey']=$XDeode->encode ( $value ['rid'] );
+			
 			$receiptList [$key] ['Locate'] = $Locate;
 			$Locate ++;
 			$receiptList [$key] ['reviseDetail'] = array ();
-			if (! empty ( $value ['reviseDetail'] ))
-				$receiptList [$key] ['reviseDetail'] = json_decode ( $value ['reviseDetail'], true );
+			//调整金额 代码调整
+			if (! empty ( $value ['reviseDetail'] )){
+				
+				$reviseDetail=json_decode ( $value ['reviseDetail'], true );
+				foreach ($reviseDetail as $ry=>$re){
+					
+					$reviseDetail[$ry]['sidKey']=$XDeode->encode ( $re ['sid'] );
+					$reviseDetail[$ry]['reviseKey']=$XDeode->encode ($ry);
+				}
+				
+				$receiptList [$key] ['reviseDetail'] = $reviseDetail;
+			//print_r($reviseDetail);
+			}
+				
 			$receiptList [$key] ['accountItem'] = json_decode ( $value ['accountItem'], true );
 			$receiptList [$key] ['loanItem'] = json_decode ( $value ['loanItem'], true );
 			$categoryDetil = $Lcategory->getOne ( array (
@@ -7758,43 +7776,61 @@ class ReceiptController extends DooController {
 		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/saeaReportListPay", $data );
 	}
+	/**
+	 * 金额调整,提高稳定性
+	 * @return string
+	 */
 	function revocationAdjustment() {
-		$sid = isset ( $this->params ['sid'] ) && is_numeric ( $this->params ['sid'] ) ? $this->params ['sid'] : 0;
+		$sidKey = isset ( $this->params ['sidKey'] )  ? $this->params ['sidKey'] : '';
 		$price = isset ( $this->params ['price'] ) && is_numeric ( $this->params ['price'] ) ? $this->params ['price'] : - 99999;
-		$rid = isset ( $this->params ['rid'] ) && is_numeric ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
+		$ridKey = isset ( $this->params ['ridKey'] )  ? $this->params ['ridKey'] : '';
+		$reviseKey = isset ( $this->params ['reviseKey'] )  ? $this->params ['reviseKey'] : '';
 		
-		// echo $price;die;
-		
-		if ((! empty ( $sid )) && ($price != - 99999) && (! empty ( $rid ))) {
+		if ((! empty ( $sidKey )) && ($price != - 99999) && (! empty ( $ridKey )&&(!empty($reviseKey)))) {
+			
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
 			Doo::loadModel ( 'receipt' );
 			$receipt = new receipt ();
 			
+			$sid = $XDeode->decode ( $sidKey );
+			$rid = $XDeode->decode ( $ridKey );
+			$reviseKey = $XDeode->decode ( $reviseKey );
+			if(!is_numeric($sid)&&!is_numeric($rid)&&!is_numeric($reviseKey))
+				die ( 'illegal request' );
+			
 			$receiptDetail = $receipt->getOne ( array (
 					'where' => 'rid=' . $rid,
 					'asArray' => true 
 			) );
-			if (empty ( $receiptDetail ['reviseDetail'] ))
-				return "/approval";
+			
+			if (empty($receiptDetail)||empty ( $receiptDetail ['reviseDetail'] ))
+				die ( 'illegal request' );
 			
 			$reviseDetail = json_decode ( $receiptDetail ['reviseDetail'], true );
 			
+			if (!isset($reviseDetail[$reviseKey]))
+				die ( 'illegal request' );
+			if($reviseDetail[$reviseKey]['sid']==$sid&&$reviseDetail[$reviseKey]['price']==$price)
+				unset($reviseDetail[$reviseKey]);
+				
+			$revisePrice=0;
 			foreach ( $reviseDetail as $key => $value ) {
-				if ($value ['price'] == $price && $value ['sid'] == $sid){
-					unset($reviseDetail[$key]);
-					break;
-				}
+				$revisePrice+=$value['price'];
 			}
 			
 			$reviseDetailString = json_encode ( $reviseDetail );
 			$receipt->reviseDetail = $reviseDetailString;
 			$receipt->sum = $receiptDetail ['sum'] - $price;
-			$receipt->revisePrice = $receiptDetail ['revisePrice'] - $price;
+			$receipt->revisePrice = $revisePrice;
 			$receipt->update ( array (
 					'where' => 'rid=' . $rid 
 			) );
-		}
+			return '/receiptburEdi/' . $rid;
+		}else 
+			die ( 'illegal request2' );
+		
 		
-		return '/receiptburEdi/' . $rid;
 	}
 	function updateApprovalReceipt() {
 		$opinion = $this->get_args ( 'opinion' ) ? $this->get_args ( 'opinion' ) : "";

+ 47 - 3
protected/view/admin/invoiceApprovalAchieve.html

@@ -18,9 +18,53 @@
 			</div>
 			<div class="adminContent autoHeight">
 				<legend>
-					审批发票
+					审批发票
 				</legend>
 				<div class="demandCate">
+				
+				<form action="/invoiceApprovalAchieve/1/{{date}}" id="ira" method="get" >
+				<ul class="cateList">
+						<li>
+							<a class="now" href="/invoiceApprovalAchieve/1/ALL">所有</a>
+							<a href="/invoiceApprovalAchieve/1/PEND" title="待审批发票">待审批发票</a>
+							<a href="/invoiceApprovalAchieve/1/APPROVED" title="已审批发票">已审批发票</a>
+						</li>
+						<li>
+							<select name="invoiceType" >
+								<option value="ALL">类型</option>
+								<option value="0">普通发票</option>
+								<option value="1">专用发票</option>
+							</select>
+						</li>
+						<li>
+							<select class="select">
+								<option>个人发票</option>
+								<option>培训班发票</option>
+							</select>
+						</li>
+						<li>
+							<div class="search">
+								<div class="input-append">
+									<input class="datepicker-here span3" placeholder="按时间筛选" type="text" data-range="true" data-multiple-dates-separator=" - " data-language="zh">
+									<button class="btn btn-small" type="button">查询</button>
+								</div>
+							</div></li>
+						<li>
+							<div class="search">
+								<div class="input-append">
+									
+								<input class="span3" type="text"  data-irmMebSea value="{{MebSeaEn}}" placeholder="发票抬头、开票金额">
+								<button class="btn btn-small" node-iramMebSea type="button">搜索</button>
+								
+								</div>
+							</div></li>
+					</ul>
+					</form>
+				
+				
+				
+				
+				
 					<ul class="cateList">
 						<li><a <!-- if {{date}}=='MONTHO' --> class="now" <!-- endif --> href="/invoiceApprovalAchieve/1/MONTHO/{{MebSea}}">最近一个月</a>
 	  					<a <!-- if {{date}}=='MONTHT' --> class="now" <!-- endif --> href="/invoiceApprovalAchieve/1/MONTHT/{{MebSea}}">最近三个月</a>
@@ -29,10 +73,10 @@
 						<li>
 							<div class="search">
 								<div class="input-append">
-									<form action="/invoiceApprovalAchieve/1/{{date}}" id="ira" method="get" >
+									
 								<input class="span3" type="text"  data-irmMebSea value="{{MebSeaEn}}" placeholder="发票抬头、开票金额">
 								<button class="btn btn-small" node-iramMebSea type="button">搜索</button>
-								</form>
+								
 								</div>
 							</div></li>
 					</ul>

+ 2 - 2
protected/view/admin/receiptburEdi.html

@@ -112,7 +112,7 @@
 	  						</tr>
 	  						<!-- endif -->
 	  						<!-- loop receiptList' value.reviseDetail -->
-	  						<tr><th><a href="/revocationAdjustment/{{receiptList' value' value.sid}}/{{receiptList' value' value.price}}/{{receiptList' value.rid}}">撤销</a><span class="interval">|</span>{{receiptList' value' value.name}}:{{receiptList' value' value.description}}</th><td class="taR">¥{{receiptList' value' value.price}}</td></tr>
+	  						<tr><th><a href="/revocationAdjustment/{{receiptList' value' value.sidKey}}/{{receiptList' value' value.price}}/{{receiptList' value.ridKey}}/{{receiptList' value' value.reviseKey}}">撤销</a><span class="interval">|</span>{{receiptList' value' value.name}}:{{receiptList' value' value.description}}</th><td class="taR">¥{{receiptList' value' value.price}}</td></tr>
 	  						<!-- endloop -->
 	  						<tr><th class="taR">合计</th><td class="colOrange taR">¥{{receiptList' value.revisePrice}}</td></tr>
 	  						
@@ -187,7 +187,7 @@
 	  						<!-- elseif -->
 	  						<tr><th colspan="2" class="taC">报销金额调整</th></tr>
 	  						<!-- loop receiptList' value.reviseDetail -->
-	  						<tr><th><a href="/revocationAdjustment/{{receiptList' value' value.sid}}/{{receiptList' value' value.price}}/{{receiptList' value.rid}}">撤销</a><span class="interval">|</span>{{receiptList' value' value.name}}:{{receiptList' value' value.description}}</th><td class="taR">¥{{receiptList' value' value.price}}</td></tr>
+	  						<tr><th><a href="/revocationAdjustment/{{receiptList' value' value.sidKey}}/{{receiptList' value' value.price}}/{{receiptList' value.ridKey}}/{{receiptList' value' value.reviseKey}}">撤销</a><span class="interval">|</span>{{receiptList' value' value.name}}:{{receiptList' value' value.description}}</th><td class="taR">¥{{receiptList' value' value.price}}</td></tr>
 	  						<!-- endloop -->
 	  						<tr><th class="taR">合计</th><td class="colOrange taR">¥{{receiptList' value.revisePrice}}</td></tr>
 	  						<!-- endif -->