Procházet zdrojové kódy

修正收款入账一些问题

caipin před 7 roky
rodič
revize
052bda5efc

binární
global/images/btn-hover.gif


+ 25 - 5
protected/controller/InvoiceController.php

@@ -799,7 +799,7 @@ class InvoiceController extends DooController {
 			else
 				array_push ( $irDetail, $value ['invoiceTitle'] );
 			array_push ( $irDetail, $value ['TIN'] );
-			
+			array_push ( $irDetail, $value ['userName'] );
 			if (empty ( $value ['mailItems'] ) && $value ['apStatus'] != 1) {
 				array_push ( $irDetail, '<a href="#confirm-erro" onclick="invoiceStoreMail(\'' . $value ['storeKey'] . '\')" data-toggle="modal">设置邮寄物品</a>' );
 			} else
@@ -971,7 +971,7 @@ class InvoiceController extends DooController {
 				$invoice->status = 2;
 				$invoice->postStatus = 1;
 				$invoice->untreadStatus = 0;
-				$invoice->invoiceSerial = "#F" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
+				//$invoice->invoiceSerial = "#F" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
 				
 				$invoice->TIN = $value ['TIN'];
 				$invoice->address = $value ['address'];
@@ -1874,8 +1874,7 @@ class InvoiceController extends DooController {
 	 * 删除已终止的开票
 	 */
 	function invoiceDelDo() {
-		Doo::loadClass ( 'XDeode' );
-		$XDeode = new XDeode ( 5 );
+		
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
 		Doo::loadModel ( 'invoiceOperationLog' );
@@ -1885,6 +1884,8 @@ class InvoiceController extends DooController {
 		$sid = $XDeode->decode ( $_COOKIE ["staff"] );
 		$iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";
 		$iid = $XDeode->decode ( $iid );
+		Doo::loadModel ( 'invoiceStore' );
+		$invoiceStore = new invoiceStore ();
 		
 		if (! is_numeric ( $iid ))
 			die ( 'illegal request' );
@@ -1908,6 +1909,8 @@ class InvoiceController extends DooController {
 				'iid' => $iid 
 		);
 		$invoiceOperationLog->setInvoiceOperationLog ( $item );
+		//删除培训班发票仓库里的发票
+		$invoiceStore->delInvoiceStoreByIsid($invoiceDetail['isid']);
 		return "/invoice";
 	}
 	function invoiceApproval() {
@@ -1941,6 +1944,23 @@ class InvoiceController extends DooController {
 		}
 		
 		$ilist = $invoice->getInvoiceByProcessStatus ();
+		foreach ( $ilist as $key => $value ) {
+			$ilist [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
+				
+			$lastApprover = json_decode ( $value ['processApprovals'], true );
+			if (! empty ( $lastApprover )) {
+				$lastApproverKey = array_keys ( $lastApprover );
+				$lastApprover = end ( $lastApprover );
+		
+				$staffDetail = $staff->getOne ( array (
+						'where' => 'sid=' . end ( $lastApproverKey ),
+						'asArray' => true
+				) );
+				$lastApprover ['username'] = $staffDetail ['username'];
+			}
+			$ilist [$key] ['lastApprover'] = $lastApprover;
+		}
+		
 		
 		// print_r($ilist);
 		
@@ -4719,7 +4739,7 @@ class InvoiceController extends DooController {
 							<th class="taC">银行到账</th><td>' . $detail ['receivablesDate'] . '</td>
 						</tr>
 						<tr>
-							<th class="taC">认领收款</th><td colspan="3">' . $detail ['inputStaff'] . ' 转入 ' . $detail ['username'] . ' ' . $detail ['bindDate'] . '</td>
+							<th class="taC">认领收款</th><td colspan="3">' . $detail ['inputStaff'] . ' 转入 ' . $detail ['username'] . ' ' . $detail ['confirmTime'] . '</td>
 						</tr>
 						</tbody></table></div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';
 			}

+ 10 - 1
protected/controller/ReceiptController.php

@@ -11632,10 +11632,13 @@ class ReceiptController extends DooController {
 				$n = substr ( $num, strlen ( $num ) - 1, 1 );
 			} else {
 				$n = $num % 10;
+				
+				
 			}
 			// 每次将最后一位数字转化为中文
 			$p1 = substr ( $c1, 3 * $n, 3 );
 			$p2 = substr ( $c2, 3 * $i, 3 );
+			
 			if ($n != '0' || ($n == '0' && ($p2 == '亿' || $p2 == '万' || $p2 == '元'))) {
 				$c = $p1 . $p2 . $c;
 			} else {
@@ -11643,13 +11646,19 @@ class ReceiptController extends DooController {
 			}
 			$i = $i + 1;
 			// 去掉数字最后一位了
+			
 			$num = $num / 10;
-			$num = ( int ) $num;
+			//echo $num.'</br>';
+			//$num = (int)$num;
+			//$num =floor($num);
+			$num=round($num, 0, PHP_ROUND_HALF_DOWN);
+			//echo $num.'</br>';
 			// 结束循环
 			if ($num == 0) {
 				break;
 			}
 		}
+		//echo $c.'</br>';
 		$j = 0;
 		$slen = strlen ( $c );
 		while ( $j < $slen ) {

+ 9 - 2
protected/model/invoice.php

@@ -596,6 +596,7 @@ class invoice extends DooModel {
 					'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'] );
@@ -751,14 +752,20 @@ class invoice extends DooModel {
 		
 		foreach ( $list as $key => $value ) {
 			$list [$key] ['iidKeyK'] = $XDeode->encode ( $value ['iid'] );
-			$list [$key] ['operationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], 2 );
+			$list [$key] ['operationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], $value['status'] );
 		}
+		
 		return $list;
 	}
 	function getInvoiceByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc', $olStatus = "desc") {
 		if (empty ( $limit ) || empty ( $con ))
 			return array ();
 		
+		$listCount=$this->count(array (
+				'where' => $con,
+				'asArray' => TRUE 
+		) )	;
+			
 		$list = $this->find ( array (
 				'where' => $con,
 				'limit' => $limit,
@@ -773,7 +780,7 @@ class invoice extends DooModel {
 		$invoiceOperationLog = new invoiceOperationLog ();
 		
 		foreach ( $list as $key => $value ) {
-			
+			$list [$key] ['count'] = $listCount;
 			$list [$key] ['iidKey'] = $this->authcode ( $value ['iid'], '' );
 			$list [$key] ['iidKeyK'] = $XDeode->encode ( $value ['iid'] );
 			

+ 2 - 0
protected/model/invoiceReceivables.php

@@ -137,6 +137,8 @@ class invoiceReceivables extends DooModel {
 		$query = Doo::db ()->query ( $sql );
 		$list = $query->fetchAll ();
 		
+		if (empty($list))
+			return array ();
 		if ($list [0] ['irid'] == NULL) {
 			return array ();
 		}

+ 26 - 19
protected/model/invoiceStore.php

@@ -267,7 +267,7 @@ class invoiceStore extends DooModel {
 		if (! empty ( $itid ) && is_numeric ( $itid )) {
 			
 			$field = 'a.apStatus,a.isid,a.invoiceCompany,a.invoiceTitle,a.TIN,a.address,a.phone,a.bank,a.bankAccount,a.invoiceElement,a.invoiceQuantity,a.invoiceUnitPrice,a.invoicePrice,a.invoiceType,a.remark
-					,a.mailItems,a.recipientsAddress,a.recipients,a.recipientsPhone,a.remark,a.remark,a.remark,a.remark
+					,a.mailItems,a.recipientsAddress,a.recipients,a.recipientsPhone,a.remark,a.remark,a.remark,a.remark,a.userName
 					,b.invoiceSerial,b.printTime,b.invoiceNo,b.status,b.printStatus,b.untreadStatus,b.irid';
 			
 			$sql = "select " . $field . " from " . $this->_table . " as a left join CLD_invoice as b on (a.iid=b.iid)  where   a.trainId=" . $itid;
@@ -275,33 +275,37 @@ class invoiceStore extends DooModel {
 			$list = $query->fetchAll ();
 		}
 		
-		//获得收款流水号
-		$iridList=array();
+		// 获得收款流水号
+		$iridList = array ();
 		foreach ( $list as $key => $value ) {
 			$list [$key] ['storeKey'] = $XDeode->encode ( $value ['isid'] );
-			$list [$key]['iridArray']=array();
-			if (!empty($value['irid'])){
-				array_push($iridList, $value['irid']);
-				$list [$key]['iridArray']=explode(',', $value['irid']);
+			$list [$key] ['iridArray'] = array ();
+			if (! empty ( $value ['irid'] )) {
+				array_push ( $iridList, $value ['irid'] );
+				$list [$key] ['iridArray'] = explode ( ',', $value ['irid'] );
 			}
-			$list[$key]['invoiceReceivables']=array();
+			$list [$key] ['invoiceReceivables'] = array ();
 		}
 		$iridString = implode ( ',', $iridList );
 		
 		Doo::loadModel ( 'invoiceReceivables' );
 		$invoiceReceivables = new invoiceReceivables ();
 		
-		$irlist=$invoiceReceivables->getInvoiceReceivablesInIridString($iridString);
-		foreach ($irlist as $key=>$value){
-			foreach ($list as $k=>$v){
-				if (in_array($value['irid'],$v['iridArray'])){
-					array_push($list[$k]['invoiceReceivables'], array($value['irid'],$value['receivablesSerial'],$value['iridKeyK']));
+		$irlist = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );
+		foreach ( $irlist as $key => $value ) {
+			foreach ( $list as $k => $v ) {
+				if (in_array ( $value ['irid'], $v ['iridArray'] )) {
+					array_push ( $list [$k] ['invoiceReceivables'], array (
+							$value ['irid'],
+							$value ['receivablesSerial'],
+							$value ['iridKeyK'] 
+					) );
 				}
 			}
 		}
 		
-		//print_r($list);
-		//echo $iridString;
+		// print_r($list);
+		// echo $iridString;
 		
 		return $list;
 	}
@@ -425,8 +429,12 @@ class invoiceStore extends DooModel {
 		
 		return Doo::db ()->lastInsertId ();
 	}
-	
-
+	function delInvoiceStoreByIsid($isid='') {
+		if (empty ( $isid ))
+			return '';
+		$sql = "DELETE FROM " . $this->_table . " WHERE `isid`=" . $isid;
+		$query = Doo::db ()->query ( $sql );
+	}
 	
 	/**
 	 * 批量更新
@@ -436,10 +444,9 @@ class invoiceStore extends DooModel {
 	function UpdateBatchInvoiceStore($sql = "") {
 		if (empty ( $sql ))
 			return 0;
-	
+		
 		$query = Doo::db ()->query ( $sql );
 	}
-	
 }
 
 ?>

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

@@ -166,7 +166,13 @@
 							
 							
 							<div class="clearfix">
-								<legend><div class="fR"><a href="/invoiceMyUnAccountAchieve">查看更多</a></div>待入账({{countArray(myInvoiceUnAccount)}})</legend>
+								<legend><div class="fR"><a href="/invoiceMyUnAccountAchieve">查看更多</a></div>待入账(
+								<!-- if isset({{myInvoiceUnAccount.0}}) -->
+								{{myInvoiceUnAccount.0.count}}
+								<!-- else -->
+								0
+								<!-- endif -->
+								)</legend>
 								<!-- if !empty({{myInvoiceUnAccount}}) -->
 								<table class="table table-bordered table-condensed">
 									<tbody>

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

@@ -94,7 +94,7 @@
                                    <!-- elseif {{ilist' value.operationLog.status}}==4 -->
                                    <span class="colRed">终止</span>
                                    <!-- endif -->
-                                    	{{ilist' value.operationLog.username}} {{ilist' value.operationLog.date}}</td>
+                                    	{{ilist' value.lastApprover.username}} {{ilist' value.operationLog.date}}</td>
                                 </tr>
                                  <!-- endloop -->
                                 

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

@@ -268,7 +268,7 @@
 					<tr>
 						<th class="taC">收款金额</th>
 						<td><input  name="receivablesPrice" checkInvoicePrice=true placeholder="输入开票金额" pattern="[0-9]" min="0" step="0.01" type="number">
-						<span class="colRed colTip"><span style="position:absolute;z-index=1;width:150px;top:-12px"  checkInvoicePrice=msg></span></span></td>
+						<span class="colRed colTip"><span style=""  checkInvoicePrice=msg></span></span></td>
 					</tr>
 					<tr>
 						<th class="taC">收款信息</th><td><input type="text" name="receivablesMessage"  ></td>

+ 9 - 6
protected/view/admin/invoiceTrainingDetail.html

@@ -39,14 +39,15 @@ table.DTFC_Cloned thead,table.DTFC_Cloned tfoot{background-color:white}div.DTFC_
 				debug: false,
 
 				// Button settings
-				//button_image_url: "<?= WEB_SITE_GLOBAL ?>images/btn-normal.gif",	// Relative to the Flash file
+				button_image_url: "<?= WEB_SITE_GLOBAL ?>images/btn-normal1.jpg",	// Relative to the Flash file
+				
 				button_width: "200",
-				button_height: "50",
+				button_height: "40",
 				button_placeholder_id: "spanButtonPlaceHolder",
-				button_text: '<span class="theFont">浏览</span>',
-				button_text_style: ".theFont { font-size: 16; }",
-				button_text_left_padding: 12,
-				button_text_top_padding: 3,
+				//button_text: '<span class="theFont">浏览</span>',
+				//button_text_style: ".theFont { font-size: 16; }",
+				//button_text_left_padding: 12,
+				//button_text_top_padding: 3,
 
 				// The event handler functions are defined in handlers.js
 				file_queued_handler : fileQueued,
@@ -119,6 +120,8 @@ table.DTFC_Cloned thead,table.DTFC_Cloned tfoot{background-color:white}div.DTFC_
 							<th>开票单位(抬头)</th>
 							<th>纳税人识别码</th>
 							
+							<th>归属人</th>
+							
 							<th>邮寄物品</th>
 							<th>邮寄地址</th>
 							

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

@@ -90,7 +90,7 @@
 	  						<tr><th colspan="2" class="taC">办事处相关费用</th></tr>
 	  						<!-- loop acItem -->
 		  						<!-- if {{acItem' value.category}} =="日常相关费用" -->
-			  						<!-- if {{acItem' value.name}}=="办公费用" || {{acItem' value.name}}=="其他费用" || {{acItem' value.name}}=="公积金" || {{acItem' value.name}}=="社保" -->
+			  						<!-- if {{acItem' value.name}}=="办公费用" || {{acItem' value.name}}=="其他费用" || {{acItem' value.name}}=="公积金" || {{acItem' value.name}}=="社保" || {{acItem' value.name}}=="邮寄费" -->
 			  						<tr>
 			  						<th>{{acItem' value.name}}</th>
 			  						<td  width="200" class="taR">¥<input type="number" id="agency_{{acItem' value.aid}}" name="agency[]" value="0" placeholder="输入{{acItem' value.name}}" pattern="[0-9]" step="0.01" min="0" class="span2">