caipin 5 tahun lalu
induk
melakukan
03966f40f8
37 mengubah file dengan 1615 tambahan dan 837 penghapusan
  1. 4 7
      global/css/global.css
  2. 47 0
      protected/class/receipt.func.php
  3. 6 2
      protected/config/acl.conf.php
  4. 3 1
      protected/config/js.edition.conf.php
  5. 10 0
      protected/config/routes.conf.php
  6. 23 18
      protected/controller/InvoiceController.php
  7. 508 385
      protected/controller/InvoiceExtendController.php
  8. 11 0
      protected/controller/ReceiptAjaxController.php
  9. 576 14
      protected/controller/ReceiptController.php
  10. 21 5
      protected/controller/SoftController.php
  11. 12 0
      protected/model/accountBook.php
  12. 36 8
      protected/model/invoice.php
  13. 1 1
      protected/model/wasteBook.php
  14. 1 0
      protected/view/admin/hisImplement.html
  15. 45 3
      protected/view/admin/invoiceAS.html
  16. 2 5
      protected/view/admin/invoiceAdd.html
  17. 2 0
      protected/view/admin/invoiceUntread.html
  18. 224 129
      protected/view/admin/invoiceUntreadAchieve.html
  19. 3 1
      protected/view/expenses/payments.html
  20. 3 1
      protected/view/expenses/paymentsAchieve.html
  21. 1 1
      protected/view/expenses/wasteBookExpenditure.html
  22. 8 3
      protected/view/expenses/wasteBookIncome.html
  23. 0 3
      protected/view/menu.html
  24. 1 8
      protected/view/receipt/feeAgency.html
  25. 1 8
      protected/view/receipt/feeAgencyEdi.html
  26. 1 8
      protected/view/receipt/feeInternalTrain.html
  27. 1 8
      protected/view/receipt/feeInternalTrainEdi.html
  28. 1 10
      protected/view/receipt/feeLoanReceipt.html
  29. 1 3
      protected/view/receipt/feeLoanReceiptAgencyEdi.html
  30. 1 3
      protected/view/receipt/feeLoanReceiptITEdi.html
  31. 9 15
      protected/view/receipt/feeLoanReceiptTrave.html
  32. 5 4
      protected/view/receipt/feeLoanReceiptTraveEdi.html
  33. 7 85
      protected/view/receipt/feeTraveApproval.html
  34. 11 64
      protected/view/receipt/feeTravel.html
  35. 7 13
      protected/view/receipt/feeTravelEdi.html
  36. 7 12
      protected/view/receipt/receiptFee.html
  37. 15 9
      protected/view/receipt/receiptImplementLoan.html

+ 4 - 7
global/css/global.css

@@ -2096,7 +2096,7 @@ table .taC{
 .saeaList table .cost-item span{
   display: inline-block;
   width:170px;
-  padding:4px 5px;
+  padding:4px 6px;
   border-right:1px solid #dddddd;
   border-bottom:1px solid #dddddd;
 }
@@ -4027,20 +4027,17 @@ td div.dlLev3{
   font-size: 16px;
 }
 .itineraryCon ul li .pointLine{
-  margin:8px 0;
+  margin:10px 0;
   padding-left: 15px;
   background:url(down_arrow.png) no-repeat 0 bottom;
 }
-.priceList{
+.priceList,.timeList{
   margin-bottom: 10px;
 }
-.timeList{
-  padding: 5px 0 0 23px;
-}
 .itineraryCon ul li:last-child .pointLine{
   background:url(down_arrow2.png) no-repeat 0 bottom;
 }
-.priceTitle,.routeTitle{
+.priceTitle,.timeTitle,.routeTitle{
   display: inline-block;
   padding: 3px 8px;
   background: #999;

+ 47 - 0
protected/class/receipt.func.php

@@ -1,5 +1,52 @@
 <?php
 
+function _verifyItineraryDate($date,$sid){
+	Doo::loadModel ( 'itinerary' );
+	$itinerary = new itinerary ();
+	
+	$listbak=$list=$itinerary->find(array (
+			'where' => 'sid=' .$sid,
+			'asc'=>'rid,itineraryDate',
+			'groupby'=>'itineraryDate',
+			'asArray' => true
+	) );
+	
+	$dateList=array();
+	$keyList=array();
+	foreach ($list as $key=>$value){
+		array_push($keyList, $value['rid']);
+	}
+	$keyList=array_unique($keyList);
+	
+	foreach ($keyList as $key=>$value){
+		$dateList[$value]=array();
+		foreach ($list as $k=>$v){
+			if($value==$v['rid']){
+				array_push($dateList[$value], $v['itineraryDate']);
+			}
+		}
+	}
+	$time=array();
+	foreach ($dateList as $key=>$value){
+		$time[$key][0]=strtotime(date($value[0].'00:00:00'));
+		$time[$key][1]=strtotime(date(end($value).'23:59:59'));
+	}
+	
+	$selectedDate=strtotime(date($date));
+	
+// 	print_r($dateList);
+// 	print_r($time);
+	
+	$falt=true;
+	foreach ($time as $key=>$value){
+		if($value[0]<=$selectedDate&&$value[1]>=$selectedDate){
+			$falt=false;
+			break;
+		}
+	}
+	return $falt;
+}
+
 /*
  * 办事处汇总明细
  */

+ 6 - 2
protected/config/acl.conf.php

@@ -291,8 +291,10 @@ $acl ['INVOICEEXTEND'] ['allow'] = array (
 		'InvoiceExtendController' => array (
 				'invoiceSettlementChange',
                 'invoiceUntreadAdd',
-                'invoiceUntreadAddDo'
-				
+                'invoiceUntreadAddDo',
+				'invoiceInvalid',
+				'invoiceUndoInvalid',
+				'invoiceBadDebt',
 		)
 );
 
@@ -410,6 +412,7 @@ $acl ['RECEIPTS'] ['allow'] = array (
 				'remitEdit',
 				'remitEdiDo',
 				'expensesDoc',
+				'expensesDocPrint',
 				'expensesRetreats',
 				'hisImplement',
 				'remittanceHky',
@@ -522,6 +525,7 @@ $acl ['RECEIPTSAJAX'] ['allow'] = array (
 				'ajaxGetReceiptTrainLoan',
 				'ajaxSetRceiptAmountByRid',
 				'ajaxGetReceiptDetailByJson',
+				'ajaxItineraryDate',
 		)
 );
 //人资

+ 3 - 1
protected/config/js.edition.conf.php

@@ -4,7 +4,9 @@ define ( "index", WEB_SITE_GLOBAL.'js/index.js?1.09' );
 define ( "receiptExtend", WEB_SITE_GLOBAL.'js/receiptExtend.js?1.03' );
 
 define ( "receipt", WEB_SITE_GLOBAL.'js/receipt.js?1.10' );
-define ( "itinerary", WEB_SITE_GLOBAL.'js/itinerary.js?1.11' );
+define ( "itinerary", WEB_SITE_GLOBAL.'js/itinerary.js?1.13' );
+define ( "itineraryView", WEB_SITE_GLOBAL.'js/itineraryView.js?1.11' );
+
 define ( "invoice", WEB_SITE_GLOBAL.'js/invoice.js?1.02' );
 define ( "payments", WEB_SITE_GLOBAL.'js/payments.js?1.03' );
 define ( "invoiceValidator", WEB_SITE_GLOBAL.'js/invoice.validator.js?1.02' );

+ 10 - 0
protected/config/routes.conf.php

@@ -154,6 +154,7 @@ $route['*']['/addReceipt'] = array('ReceiptController', 'addReceipt');
 $route['*']['/addFeeTravel'] = array('ReceiptController', 'addFeeTravel');
 $route['*']['/addFeeInternalTrain'] = array('ReceiptController', 'addFeeInternalTrain');
 
+$route['*']['/api/itinerary/date'] = array('ReceiptAjaxController', 'ajaxItineraryDate');
 
 //审批请求
 $route['*']['/expensesEdi/:rid'] = array('ReceiptController', 'expensesEdi');
@@ -178,6 +179,9 @@ $route['*']['/remitAddDo'] = array('ReceiptController', 'remitAddDo');
 $route['*']['/remitEdit/:rid'] = array('ReceiptController', 'remitEdit','extension'=>'.html');
 $route['*']['/remitEdiDo'] = array('ReceiptController', 'remitEdiDo');
 $route['*']['/expensesDoc/:rid'] = array('ReceiptController', 'expensesDoc');
+$route['*']['/expensesDocPrint/:rid'] = array('ReceiptController', 'expensesDocPrint');
+
+
 $route['*']['/expensesRetreats/:rid'] = array('ReceiptController', 'expensesRetreats');
 $route['*']['/hisImplement'] = array('ReceiptController', 'hisImplement');
 $route['*']['/hisImplement/:item'] = array('ReceiptController', 'hisImplement');
@@ -451,6 +455,10 @@ $route['*']['/invoiceAdd'] = array('InvoiceController', 'invoiceAdd');
 //退票重新开票
 $route['*']['/invoiceUntreadAdd/:iidKey'] = array('InvoiceExtendController', 'invoiceUntreadAdd','extension'=>'.html');
 $route['*']['/invoiceUntreadAddDo'] = array('InvoiceExtendController', 'invoiceUntreadAddDo');
+//发票作废
+$route['*']['/invoiceInvalid'] = array('InvoiceExtendController', 'invoiceInvalid');
+$route['*']['/invoiceUndoInvalid'] = array('InvoiceExtendController', 'invoiceUndoInvalid');
+$route['post']['/invoiceBadDebt'] = array('InvoiceExtendController', 'invoiceBadDebt');
 
 
 $route['*']['/invoiceAdd/AUTOFILL'] = array('InvoiceController', 'invoiceAddFill');
@@ -597,6 +605,8 @@ $route['get']['/invoicePostAchieve/:page/:date/:MebSea'] = array('InvoiceControl
 
 
 //发票退票
+
+
 $route['get']['/invoiceUntread'] = array('InvoiceController', 'invoiceUntread');
 $route['post']['/invoiceUntreadEstablishedDo'] = array('InvoiceController', 'invoiceUntreadEstablishedDo');
 

+ 23 - 18
protected/controller/InvoiceController.php

@@ -521,6 +521,7 @@ class InvoiceController extends DooController {
 		}
 		
 		
+	
 		if($invoiceForm=='electronic'){
 		if(empty(trim($electronicPhone))&&empty(trim($electronicEmail))){
 			die ( '请至少填写一种联系方式--电子发票' );
@@ -532,10 +533,14 @@ class InvoiceController extends DooController {
 			$temporary = $invoiceQuantity * $invoiceUnitPrice;
 			if ($temporary > 100001) {
 				header ( 'Content-Type:text/html;charset=utf-8' );
-				die ( '专用发票总金额暂时不能超过100000.00(一万)元。' );
-				// die ( 'illegal request-Please priceError' );
+				die ( '专用发票总金额暂时不能超过100000.00(十万)元。' );
 			}
 		}elseif($invoiceType == 0){
+			$temporary = $invoiceQuantity * $invoiceUnitPrice;
+			if ($temporary > 100001) {
+				header ( 'Content-Type:text/html;charset=utf-8' );
+				die ( '专用发票总金额暂时不能超过100000.00(十万)元。' );
+			}
 		}else{
 			die ( 'illegal request-invoiceType' );
 		}
@@ -2554,7 +2559,7 @@ class InvoiceController extends DooController {
 	function invoiceUntreadDo() {
 		$untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';
 		$untreadReason = $this->get_args ( 'untreadReason' ) ? $this->get_args ( 'untreadReason' ) : "";
-		$untreadPost = $this->get_args ( 'untreadPost' ) ? $this->get_args ( 'untreadPost' ) : "";
+		$untreadPost = $this->get_args ( 'untreadPost' ) ? $this->get_args ( 'untreadPost' ) : 0;
 		
 		Doo::loadModel ( 'invoice' );
 		$invoice = new invoice ();
@@ -3087,7 +3092,7 @@ class InvoiceController extends DooController {
 		
 		$iid = $invoice->authcode ( $iid );
 		if (! is_numeric ( $iid ))
-			die ( 'illegal request' );
+			die ( 'illegal request-iid' );
 		if (! empty ( $iid ) && ! empty ( $invoiceNo )) {
 			
 			Doo::loadModel ( 'invoiceOperationLog' );
@@ -3100,13 +3105,13 @@ class InvoiceController extends DooController {
 			
 			$invoicePrintDetail = $invoice->getInvoiceByPrint ( $iid );
 			if (empty ( $invoicePrintDetail ))
-				die ( 'illegal request' );
+				die ( 'illegal request-data_empty' );
 				
 				//
 			$ipid = $XDeode->decode ( $invoiceNo );
 			$paperDetail = $invoicePaper->getInvoicePaperByIpid ( $ipid );
 			if (empty ( $paperDetail ))
-				die ( 'illegal request' );
+				die ( 'illegal request-paper_empty' );
 			$invoicePaper = new invoicePaper ();
 			$item = array (
 					'iid' => $iid,
@@ -3405,15 +3410,15 @@ class InvoiceController extends DooController {
 		
 		$untreadInvoice = $invoice->getInvoiceByUntreadStatus ( 1, 0, 50 );
 		$establishedInvoice = $invoice->getInvoiceByUntreadStatus ( 2 );
-		
-		foreach ( $establishedInvoice as $key => $value ) {
-			// months
-			$lossDate = strtotime ( "+1 month", strtotime ( $value ['OperationLog'] ['date'] ) );
-			$nowDate = strtotime ( 'now' );
-			$establishedInvoice [$key] ['lossShow'] = false;
-			if ($lossDate < $nowDate)
-				$establishedInvoice [$key] ['lossShow'] = true;
-		}
+		//print_r($establishedInvoice);
+// 		foreach ( $establishedInvoice as $key => $value ) {
+// 			// months
+// 			$lossDate = strtotime ( "+1 month", strtotime ( $value ['OperationLog'] ['date'] ) );
+// 			$nowDate = strtotime ( 'now' );
+// 			$establishedInvoice [$key] ['lossShow'] = false;
+// 			if ($lossDate < $nowDate)
+// 				$establishedInvoice [$key] ['lossShow'] = true;
+// 		}
 		
 		$this->data ['untreadInvoice'] = $untreadInvoice;
 		$this->data ['establishedInvoice'] = $establishedInvoice;
@@ -3450,6 +3455,7 @@ class InvoiceController extends DooController {
 				'iid' => $iid,
 				// 'irid'=>'',
 				'untreadStatus' => 2,
+				'untreadTime'=>date ( "Y-m-d H:i:s" ) ,
 				'updateTime' => date ( "Y-m-d H:i:s" ) 
 		);
 		$invoice->setInvoiceByCondition ( $item );
@@ -6939,7 +6945,7 @@ class InvoiceController extends DooController {
 			$this->data ['list'] = $list;
 			$this->render ( "/admin/invoicePostAchieve", $this->data );
 		} elseif ($this->ACTION == 'invoiceUntreadAchieve') {
-			$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $sql );
+			$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $sql,'desc','desc','untreadTime' );
 			$this->data ['receiptMemu'] = 'invoiceUntread';
 			$this->data ['list'] = $list;
 			$this->render ( "/admin/invoiceUntreadAchieve", $this->data );
@@ -6958,7 +6964,6 @@ class InvoiceController extends DooController {
 		
 		$titleORno = $this->get_args ( 'titleORno' ) ? $this->get_args ( 'titleORno' ) : "";
 		
-		
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'invoice' );
@@ -7003,7 +7008,7 @@ class InvoiceController extends DooController {
 		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
 		$status = isset ( $this->params ['status'] ) ? $this->params ['status'] : 'All';
 		
-		$con = ' status=2 and untreadStatus!=2  ';
+		$con = ' status=2 and untreadStatus!=2 and invalid=0 and isDelete=0 and badDebt=0 ';
 		
 		$statisticsCon = '';
 		if (! empty ( $year ) && is_numeric ( $year ))

+ 508 - 385
protected/controller/InvoiceExtendController.php

@@ -90,7 +90,7 @@ class InvoiceExtendController extends DooController {
 		$detail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
 		
 		$accessModular = 'INVOICEEXTEND';
-		$accessAuthority='INVOICE';
+		$accessAuthority = 'INVOICE';
 		if (empty ( $detail ['cldAccessArray'] ))
 			die ( 'illegal request' );
 		else {
@@ -156,22 +156,22 @@ class InvoiceExtendController extends DooController {
 			
 			$iid = $XDeode->decode ( $iidKey );
 			
-			$invoiceDetail=$invoice->getInvoiceByIid($iid);
-			if(empty($invoiceDetail)){
+			$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
+			if (empty ( $invoiceDetail )) {
 				die ( 'illegal request-invoiceData NULL' );
 			}
 			$trainId = $XDeode->decode ( $trainId );
 			
-			$itDetail=$invoiceTraining->getInvoiceTrainingByItid($trainId);
+			$itDetail = $invoiceTraining->getInvoiceTrainingByItid ( $trainId );
 			
 			$st = '';
 			if ($settlementType == 'SOFTWARE') {
 				$st = 0;
 				$trainId = 0;
-				$operation=' 结算方式 改 软件销售';
+				$operation = ' 结算方式 改 软件销售';
 			} elseif ($settlementType == 'TRAINING') {
 				$st = 1;
-				$operation=' 结算方式 改 '.$itDetail['trainName'];
+				$operation = ' 结算方式 改 ' . $itDetail ['trainName'];
 				if (empty ( $trainId ) && ! is_numeric ( $trainId )) {
 					die ( 'illegal request-trainingIdError' );
 				}
@@ -179,33 +179,32 @@ class InvoiceExtendController extends DooController {
 				die ( 'illegal request-settlementError' );
 			}
 			
-			$invoice->settlementType=$st;
-			$invoice->trainId=$trainId;
+			$invoice->settlementType = $st;
+			$invoice->trainId = $trainId;
 			
-			$invoice->update(array (
-				'where' => 'iid = ' . $iid 
-			));
+			$invoice->update ( array (
+					'where' => 'iid = ' . $iid 
+			) );
 			
 			Doo::loadModel ( 'invoiceStore' );
 			$invoiceStore = new invoiceStore ();
 			
-			//重置结算方式的相关数据 
-			$isSuccess=$invoiceStore->delete ( array (
-				'where' => 'iid=' . $iid,
-				'limit' => 1 
+			// 重置结算方式的相关数据
+			$isSuccess = $invoiceStore->delete ( array (
+					'where' => 'iid=' . $iid,
+					'limit' => 1 
 			) );
 			
-// 			if($isSuccess){
-// 				$detailIT = $invoiceTraining->getInvoiceTrainingByItid ( $invoiceDetail['trainId'] );
-// 				if (!empty($detailIT)){
-// 				$item = array (
-// 						'itid' => $invoiceDetail['trainId'],
-// 						'invoiceTotal' => $detailIT ['invoiceTotal'] - 1,
-// 				);
-// 				$itid = $invoiceTraining->setInvoiceTrainByCondition ( $item );
-// 				}
-// 			}
-			
+			// if($isSuccess){
+			// $detailIT = $invoiceTraining->getInvoiceTrainingByItid ( $invoiceDetail['trainId'] );
+			// if (!empty($detailIT)){
+			// $item = array (
+			// 'itid' => $invoiceDetail['trainId'],
+			// 'invoiceTotal' => $detailIT ['invoiceTotal'] - 1,
+			// );
+			// $itid = $invoiceTraining->setInvoiceTrainByCondition ( $item );
+			// }
+			// }
 			
 			// 如果是培训班结算 创建培训班发票到培训班备份中
 			if (! empty ( $st ) && $st == 1) {
@@ -214,19 +213,18 @@ class InvoiceExtendController extends DooController {
 						'isid' => $isid,
 						'ipSource' => 1,
 						'apStatus' => 1,
-						'iid' => $iid
+						'iid' => $iid 
 				);
 				$invoiceStore->setInvoiceStoreByCondition ( $itemIS );
-			
+				
 				// 更新培训班总数量
 				$item = array (
 						'itid' => $trainId,
-						'submitStatus' => 1
+						'submitStatus' => 1 
 				);
 				$itid = $invoiceTraining->setInvoiceTrainByCondition ( $item );
 			}
 			
-			
 			Doo::loadModel ( 'invoiceOperationLog' );
 			$invoiceOperationLog = new invoiceOperationLog ();
 			
@@ -246,359 +244,486 @@ class InvoiceExtendController extends DooController {
 		}
 		return "/invoiceApprovalAchieve";
 	}
-
-	function invoiceUntreadAdd(){
-        session_start ();
-        Doo::loadClass ( 'XDeode' );
-        $XDeode = new XDeode ( 5 );
-
-        $iidKey = isset ( $this->params ['iidKey'] ) ? $this->params ['iidKey'] : "";
-        $iid = $XDeode->decode ( $iidKey );
-        if (! is_numeric ( $iid ))
-            die ( 'illegal request' );
-
-        Doo::loadModel ( 'invoice' );
-        $invoice = new invoice ();
-        Doo::loadModel ( 'invoiceOperationLog' );
-        $invoiceOperationLog = new invoiceOperationLog ();
-
-        $invoiceDetail = $invoice->getInvoiceByIid ( $iid );
-        $operation = $invoiceOperationLog->getInvoiceOperationByDropped ( $iid );
-        //获得继承发票金额合计
-        $restrictPrice=$invoiceDetail['invoicePrice'];
-        if (!empty($invoiceDetail['inheritIid'])){
-            $restrictList=$invoice->getInvoiceInIid($invoiceDetail['inheritIid']);
-            foreach ($restrictList as $key=>$value){
-                $restrictPrice-=$value['invoicePrice'];
-            }
-        }
-        if ($restrictPrice<0){
-            $restrictPrice=0;
-        }
-
-        $invoiceDetail ['mailItemsJson'] = json_decode ( $invoiceDetail ['mailItemsJson'], true );
-
-        $token = $this->set_token ();
-        $_SESSION ['token_' . $this->staff [0] ['sidKey']] = $token;
-        $this->data ['token'] = $token;
-
-        $this->data ['restrictPrice'] = floatval($restrictPrice);
-        $this->data ['operation'] = $operation;
-        $this->data ['invoiceDetail'] = $invoiceDetail;
-        $this->data ['memu'] = "invoice";
-        $this->data ['staff'] = $this->staff;
-        $this->data ['receiptMemu'] = 'invoice';
-        $this->render ( "/invoice/invoiceUntreadAdd", $this->data );
-    }
-
-    function invoiceUntreadAddDo(){
-
-        $iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
-        Doo::loadModel ( 'invoice' );
-        $invoice = new invoice ();
-        $iid = $invoice->authcode ( $iidKey );
-        if (! empty ( $iid ) && ! is_numeric ( $iid ))
-            die ( 'illegal request' );
-
-        $cid = $this->get_args ( 'cid' ) && is_numeric ( $this->get_args ( 'cid' ) ) ? $this->get_args ( 'cid' ) : 0;
-        $invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0;
-        $doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0;
-        // $invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : "";
-
-        $invoiceQuantity = $this->get_args ( 'invoiceQuantity' ) && is_numeric ( $this->get_args ( 'invoiceQuantity' ) ) ? $this->get_args ( 'invoiceQuantity' ) : 0;
-        $invoiceUnitPrice = $this->get_args ( 'invoiceUnitPrice' ) && is_numeric ( $this->get_args ( 'invoiceUnitPrice' ) ) ? $this->get_args ( 'invoiceUnitPrice' ) : 0;
-
-        $invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
-        $invoiceTitle = $this->get_args ( 'invoiceTitle' ) ? $this->get_args ( 'invoiceTitle' ) : "";
-        $invoiceCompany = $this->get_args ( 'invoiceCompany' ) ? $this->get_args ( 'invoiceCompany' ) : "";
-        $TIN = $this->get_args ( 'TIN' ) ? $this->get_args ( 'TIN' ) : "";
-        $address = $this->get_args ( 'address' ) ? $this->get_args ( 'address' ) : "";
-        $phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : "";
-        $bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";
-        $bankAccount = $this->get_args ( 'bankAccount' ) ? $this->get_args ( 'bankAccount' ) : "";
-        $recipients = $this->get_args ( 'recipients' ) ? $this->get_args ( 'recipients' ) : "";
-        $recipientsPhone = $this->get_args ( 'recipientsPhone' ) ? $this->get_args ( 'recipientsPhone' ) : "";
-        $recipientsAddress = $this->get_args ( 'recipientsAddress' ) ? $this->get_args ( 'recipientsAddress' ) : "";
-
-        $remark = $this->get_args ( 'remark' ) ? $this->get_args ( 'remark' ) : "";
-
-        $TINT = $this->get_args ( 'TINT' ) ? $this->get_args ( 'TINT' ) : "";
-        $addressT = $this->get_args ( 'addressT' ) ? $this->get_args ( 'addressT' ) : "";
-        $phoneT = $this->get_args ( 'phoneT' ) ? $this->get_args ( 'phoneT' ) : "";
-        $bankT = $this->get_args ( 'bankT' ) ? $this->get_args ( 'bankT' ) : "";
-        $bankAccountT = $this->get_args ( 'bankAccountT' ) ? $this->get_args ( 'bankAccountT' ) : "";
-
-        $softLock = $this->get_args ( 'softLock' ) ? $this->get_args ( 'softLock' ) : 0;
-        $softLockNum = $this->get_args ( 'softLockNum' ) ? $this->get_args ( 'softLockNum' ) : 0;
-        $contract = $this->get_args ( 'contract' ) ? $this->get_args ( 'contract' ) : 0;
-        $contractNum = $this->get_args ( 'contractNum' ) ? $this->get_args ( 'contractNum' ) : 0;
-        $instructions = $this->get_args ( 'instructions' ) ? $this->get_args ( 'instructions' ) : 0;
-        $instructionsNum = $this->get_args ( 'instructionsNum' ) ? $this->get_args ( 'instructionsNum' ) : 0;
-        $remittance = $this->get_args ( 'remittance' ) ? $this->get_args ( 'remittance' ) : 0;
-
-        $mailItems = $this->get_args ( 'mailItems' ) ? $this->get_args ( 'mailItems' ) : "";
-
-        $token = $this->get_args ( 'token' ) ? $this->get_args ( 'token' ) : "";
-        if (empty ( $token )) {
-            die ( 'illegal request-token' );
-        } else {
-            session_start ();
-            if ($_SESSION ['token_' . $this->staff [0] ['sidKey']] != $token) {
-                header ( 'Content-Type:text/html;charset=utf-8' );
-                die ( '请勿重复申请发票' );
-            } else {
-                $_SESSION ['token_' . $this->staff [0] ['sidKey']] = '';
-            }
-        }
-
-        $temporary = $invoiceQuantity * $invoiceUnitPrice;
-        if ($invoiceType == 1) {
-            if ($temporary > 10000) {
-                header ( 'Content-Type:text/html;charset=utf-8' );
-                die ( '专用发票总金额暂时不能超过10000.00(一万)元。' );
-                // die ( 'illegal request-Please priceError' );
-            }
-        }
-
-        if (empty ( $this->staff [0] ))
-            die ( 'illegal request-Please login' );
-
-        if (! empty ( $cid ) && ! empty ( $invoiceQuantity ) && ! empty ( $invoiceUnitPrice ) && ! empty ( $invoiceElement ) ) {
-
-            Doo::loadModel ( 'L_category' );
-            $lCategory = new L_category ();
-            Doo::loadModel ( 'invoiceManage' );
-            $invoiceManage = new invoiceManage ();
-            Doo::loadModel ( 'invoiceOperationLog' );
-            $invoiceOperationLog = new invoiceOperationLog ();
-
-            Doo::loadClass ( 'XDeode' );
-            $XDeode = new XDeode ( 5 );
-
-
-            $categoryDetil = $lCategory->getOne ( array (
-                'SELECT' => 'title',
-                'where' => 'cid=' . $cid,
-                'asArray' => true
-            ) );
-
-            $invoicePrice = $invoiceQuantity * $invoiceUnitPrice;
-
-            $invoiceManageList = $invoiceManage->getInvoiceByAll ();
-            $invoiceManageDetail = $invoiceManage->getInvoiceByMold ( "发票审批" );
-            // print_r(current($invoiceManageDetail ['staffList']));
-            // die;
-
-            $moldManage = array ();
-            foreach ( $invoiceManageList as $key => $value ) {
-                if ($value ['mold'] == '发票打印')
-                    $moldManage [$value ['mold']] = $value ['staffList'];
-                elseif ($value ['mold'] == '发票邮寄')
-                    $moldManage [$value ['mold']] = $value ['staffList'];
-                elseif ($value ['mold'] == '发票退票')
-                    $moldManage [$value ['mold']] = $value ['staffList'];
-            }
-
-            $pendingApprovalsSid = current ( $invoiceManageDetail ['staffList'] ) [0];
-
-            //培训班ID--新增关联-发票关系  发票IID关联
-            $invoice = new invoice ();
-            $invoiceDetail=$invoice->getInvoiceByIid($iid);
-            //退票后,重新开票金额的限制
-            $restrictPrice=$invoiceDetail['invoicePrice'];
-            if (!empty($invoiceDetail['inheritIid'])){
-                $restrictList=$invoice->getInvoiceInIid($invoiceDetail['inheritIid']);
-                foreach ($restrictList as $key=>$value){
-                    $restrictPrice-=$value['invoicePrice'];
-                }
-            }
-            if ($restrictPrice<0){
-                header ( 'Content-Type:text/html;charset=utf-8' );
-                die ( '开票金额超出原退票金额-0' );
-            }else{
-                if($restrictPrice<$temporary){
-                    header ( 'Content-Type:text/html;charset=utf-8' );
-                    die ( '开票金额超出原退票金额-1' );
-                }
-            }
-
-            $trainId=$invoiceDetail['trainId'];
-            $st = 1;
-            if (empty ( $trainId ) && ! is_numeric ( $trainId )) {
-                die ( 'illegal request-trainingIdError' );
-            }
-
-            $invoice = new invoice ();
-            $item = array (
-                'cid' => $cid,
-                'categoryName' => $categoryDetil ['title'],
-                'invoiceElement' => $invoiceElement,
-
-                'invoiceQuantity' => $invoiceQuantity,
-                'invoiceUnitPrice' => $invoiceUnitPrice,
-
-                'invoicePrice' => $invoicePrice,
-                'invoiceType' => $invoiceType,
-                'settlementType' => $st,
-                'doPost' => $doPost,
-                'status' => 1,
-                'invoiceSerial' => "#F" . date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT),
-                'date' => date ( "Y-m-d H:i:s" ),
-                'updateTime' => date ( "Y-m-d H:i:s" ),
-                'sid' => $this->staff [0] ['sid'],
-                'userName' => $this->staff [0] ['username'],
-                'invoiceManage' => $invoiceManageDetail ['staff'],
-                'pendingApprovals' => $pendingApprovalsSid,
-                'moldManage' => json_encode ( $moldManage ),
-                'remark' => $remark,
-                'trainId' => $trainId,
-                'parentUntreadIid'=>$trainId
-            );
-            if ($invoiceType == 0)
-                $item += array (
-                    'invoiceTitle' => $invoiceTitle,
-                    'TIN' => $TINT,
-                    'address' => $addressT,
-                    'phone' => $phoneT,
-                    'bank' => $bankT,
-                    'bankAccount' => $bankAccountT
-                );
-            else {
-                $item += array (
-                    'invoiceCompany' => $invoiceCompany,
-                    'TIN' => $TIN,
-                    'address' => $address,
-                    'phone' => $phone,
-                    'bank' => $bank,
-                    'bankAccount' => $bankAccount
-                );
-            }
-            if ($doPost == 1) {
-                $mailList = array (
-                    'invoice' => 1,
-                    'mailItems' => $mailItems
-                );
-                if (! empty ( $softLock ))
-                    $mailList += array (
-                        'softLock' => $softLockNum
-                    );
-                else
-                    $mailList += array (
-                        'softLock' => 0
-                    );
-                if (! empty ( $contract ))
-                    $mailList += array (
-                        'contract' => $contractNum
-                    );
-                else
-                    $mailList += array (
-                        'contract' => 0
-                    );
-                if (! empty ( $instructions ))
-                    $mailList += array (
-                        'instructions' => $instructionsNum
-                    );
-                else
-                    $mailList += array (
-                        'instructions' => 0
-                    );
-                if (! empty ( $remittance ))
-                    $mailList += array (
-                        'remittance' => $remittance
-                    );
-                else
-                    $mailList += array (
-                        'remittance' => ''
-                    );
-
-                $mailString = '发票x1张,备注:' . $mailItems;
-                if (! empty ( $softLock ))
-                    $mailString .= ',软件锁x' . $softLockNum . '个';
-                if (! empty ( $contract ))
-                    $mailString .= ',合同x' . $contractNum . '份';
-                if (! empty ( $instructions ))
-                    $mailString .= ',说明书x' . $instructionsNum . '本';
-                if (! empty ( $remittance ))
-                    $mailString .= ',汇款账号单(张)';
-
-                $item += array (
-                    'recipients' => $recipients,
-                    'recipientsPhone' => $recipientsPhone,
-                    'recipientsAddress' => $recipientsAddress,
-                    'mailItems' => $mailString,
-                    'mailItemsJson' => json_encode ( $mailList )
-                );
-            }
-            $iid = $invoice->addInvoice ( $item );
-
-            $invoice = new invoice ();
-            if (!empty($invoiceDetail['inheritIid'])){
-                $inheritIid=$invoiceDetail['inheritIid'].','.$iid;
-            }else{
-                $inheritIid=$iid;
-            }
-
-            $item = array (
-                'iid' => $invoiceDetail['iid'],
-                'inheritIid' => $inheritIid
-            );
-            $invoice->setInvoiceByCondition($item);
-
-
-            // 如果是培训班结算 创建培训班发票到培训班备份中
-            if (! empty ( $st ) && $st == 1) {
-                Doo::loadModel ( 'invoiceStore' );
-                $invoiceStore = new invoiceStore ();
-                Doo::loadModel ( 'invoiceTraining' );
-                $invoiceTraining = new invoiceTraining ();
-
-                $isid = $invoiceStore->setInvoiceToInvoiceStore ( $iid );
-                $itemIS = array (
-                    'isid' => $isid,
-                    'ipSource' => 1,
-                    'apStatus' => 1,
-                    'iid' => $iid
-                );
-                $invoiceStore->setInvoiceStoreByCondition ( $itemIS );
-
-                // 更新培训班总数量
-                $detailIT = $invoiceTraining->getInvoiceTrainingByItid ( $trainId );
-                $item = array (
-                    'itid' => $trainId,
-                    'invoiceTotal' => $detailIT ['invoiceTotal'] + 1,
-                    'submitStatus' => 1
-                );
-                $itid = $invoiceTraining->setInvoiceTrainByCondition ( $item );
-            }
-
-            // 操作日志
-            $item = array (
-                'date' => date ( "Y-m-d H:i:s" ),
-                'operation' => "创建",
-                'status' => 1,
-                'img' => $this->staff [0] ['avatar'],
-                'username' => $this->staff [0] ['username'],
-                'uid' => $this->staff [0] ['sid'],
-                'category' => $this->staff [0] ['category'],
-                'iid' => $iid
-            );
-            $invoiceOperationLog->setInvoiceOperationLog ( $item );
-            $item = array (
-                'date' => date ( "Y-m-d H:i:s" ),
-                'operation' => "提交审批",
-                'status' => 1,
-                'img' => $this->staff [0] ['avatar'],
-                'username' => $this->staff [0] ['username'],
-                'uid' => $this->staff [0] ['sid'],
-                'category' => $this->staff [0] ['category'],
-                'iid' => $iid
-            );
-            $invoiceOperationLog->setInvoiceOperationLog ( $item );
-
-        }
-        return "/invoiceUntreadED";
-    }
-
+	function invoiceUntreadAdd() {
+		session_start ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$iidKey = isset ( $this->params ['iidKey'] ) ? $this->params ['iidKey'] : "";
+		$iid = $XDeode->decode ( $iidKey );
+		if (! is_numeric ( $iid ))
+			die ( 'illegal request' );
+		
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadModel ( 'invoiceOperationLog' );
+		$invoiceOperationLog = new invoiceOperationLog ();
+		
+		$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
+		$operation = $invoiceOperationLog->getInvoiceOperationByDropped ( $iid );
+		// 获得继承发票金额合计
+		$restrictPrice = $invoiceDetail ['invoicePrice'];
+		if (! empty ( $invoiceDetail ['inheritIid'] )) {
+			$restrictList = $invoice->getInvoiceInIid ( $invoiceDetail ['inheritIid'] );
+			foreach ( $restrictList as $key => $value ) {
+				$restrictPrice -= $value ['invoicePrice'];
+			}
+		}
+		if ($restrictPrice < 0) {
+			$restrictPrice = 0;
+		}
+		
+		$invoiceDetail ['mailItemsJson'] = json_decode ( $invoiceDetail ['mailItemsJson'], true );
+		
+		$token = $this->set_token ();
+		$_SESSION ['token_' . $this->staff [0] ['sidKey']] = $token;
+		$this->data ['token'] = $token;
+		
+		$this->data ['restrictPrice'] = floatval ( $restrictPrice );
+		$this->data ['operation'] = $operation;
+		$this->data ['invoiceDetail'] = $invoiceDetail;
+		$this->data ['memu'] = "invoice";
+		$this->data ['staff'] = $this->staff;
+		$this->data ['receiptMemu'] = 'invoice';
+		$this->render ( "/invoice/invoiceUntreadAdd", $this->data );
+	}
+	function invoiceUntreadAddDo() {
+		$iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		$iid = $invoice->authcode ( $iidKey );
+		if (! empty ( $iid ) && ! is_numeric ( $iid ))
+			die ( 'illegal request' );
+		
+		$cid = $this->get_args ( 'cid' ) && is_numeric ( $this->get_args ( 'cid' ) ) ? $this->get_args ( 'cid' ) : 0;
+		$invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0;
+		$doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0;
+		// $invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : "";
+		
+		$invoiceQuantity = $this->get_args ( 'invoiceQuantity' ) && is_numeric ( $this->get_args ( 'invoiceQuantity' ) ) ? $this->get_args ( 'invoiceQuantity' ) : 0;
+		$invoiceUnitPrice = $this->get_args ( 'invoiceUnitPrice' ) && is_numeric ( $this->get_args ( 'invoiceUnitPrice' ) ) ? $this->get_args ( 'invoiceUnitPrice' ) : 0;
+		
+		$invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
+		$invoiceTitle = $this->get_args ( 'invoiceTitle' ) ? $this->get_args ( 'invoiceTitle' ) : "";
+		$invoiceCompany = $this->get_args ( 'invoiceCompany' ) ? $this->get_args ( 'invoiceCompany' ) : "";
+		$TIN = $this->get_args ( 'TIN' ) ? $this->get_args ( 'TIN' ) : "";
+		$address = $this->get_args ( 'address' ) ? $this->get_args ( 'address' ) : "";
+		$phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : "";
+		$bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";
+		$bankAccount = $this->get_args ( 'bankAccount' ) ? $this->get_args ( 'bankAccount' ) : "";
+		$recipients = $this->get_args ( 'recipients' ) ? $this->get_args ( 'recipients' ) : "";
+		$recipientsPhone = $this->get_args ( 'recipientsPhone' ) ? $this->get_args ( 'recipientsPhone' ) : "";
+		$recipientsAddress = $this->get_args ( 'recipientsAddress' ) ? $this->get_args ( 'recipientsAddress' ) : "";
+		
+		$remark = $this->get_args ( 'remark' ) ? $this->get_args ( 'remark' ) : "";
+		
+		$TINT = $this->get_args ( 'TINT' ) ? $this->get_args ( 'TINT' ) : "";
+		$addressT = $this->get_args ( 'addressT' ) ? $this->get_args ( 'addressT' ) : "";
+		$phoneT = $this->get_args ( 'phoneT' ) ? $this->get_args ( 'phoneT' ) : "";
+		$bankT = $this->get_args ( 'bankT' ) ? $this->get_args ( 'bankT' ) : "";
+		$bankAccountT = $this->get_args ( 'bankAccountT' ) ? $this->get_args ( 'bankAccountT' ) : "";
+		
+		$softLock = $this->get_args ( 'softLock' ) ? $this->get_args ( 'softLock' ) : 0;
+		$softLockNum = $this->get_args ( 'softLockNum' ) ? $this->get_args ( 'softLockNum' ) : 0;
+		$contract = $this->get_args ( 'contract' ) ? $this->get_args ( 'contract' ) : 0;
+		$contractNum = $this->get_args ( 'contractNum' ) ? $this->get_args ( 'contractNum' ) : 0;
+		$instructions = $this->get_args ( 'instructions' ) ? $this->get_args ( 'instructions' ) : 0;
+		$instructionsNum = $this->get_args ( 'instructionsNum' ) ? $this->get_args ( 'instructionsNum' ) : 0;
+		$remittance = $this->get_args ( 'remittance' ) ? $this->get_args ( 'remittance' ) : 0;
+		
+		$mailItems = $this->get_args ( 'mailItems' ) ? $this->get_args ( 'mailItems' ) : "";
+		
+		$token = $this->get_args ( 'token' ) ? $this->get_args ( 'token' ) : "";
+		if (empty ( $token )) {
+			die ( 'illegal request-token' );
+		} else {
+			session_start ();
+			if ($_SESSION ['token_' . $this->staff [0] ['sidKey']] != $token) {
+				header ( 'Content-Type:text/html;charset=utf-8' );
+				die ( '请勿重复申请发票' );
+			} else {
+				$_SESSION ['token_' . $this->staff [0] ['sidKey']] = '';
+			}
+		}
+		
+		$temporary = $invoiceQuantity * $invoiceUnitPrice;
+		if ($invoiceType == 1) {
+			if ($temporary > 10000) {
+				header ( 'Content-Type:text/html;charset=utf-8' );
+				die ( '专用发票总金额暂时不能超过10000.00(一万)元。' );
+				// die ( 'illegal request-Please priceError' );
+			}
+		}
+		
+		if (empty ( $this->staff [0] ))
+			die ( 'illegal request-Please login' );
+		
+		if (! empty ( $cid ) && ! empty ( $invoiceQuantity ) && ! empty ( $invoiceUnitPrice ) && ! empty ( $invoiceElement )) {
+			
+			Doo::loadModel ( 'L_category' );
+			$lCategory = new L_category ();
+			Doo::loadModel ( 'invoiceManage' );
+			$invoiceManage = new invoiceManage ();
+			Doo::loadModel ( 'invoiceOperationLog' );
+			$invoiceOperationLog = new invoiceOperationLog ();
+			
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			
+			$categoryDetil = $lCategory->getOne ( array (
+					'SELECT' => 'title',
+					'where' => 'cid=' . $cid,
+					'asArray' => true 
+			) );
+			
+			$invoicePrice = $invoiceQuantity * $invoiceUnitPrice;
+			
+			$invoiceManageList = $invoiceManage->getInvoiceByAll ();
+			$invoiceManageDetail = $invoiceManage->getInvoiceByMold ( "发票审批" );
+			// print_r(current($invoiceManageDetail ['staffList']));
+			// die;
+			
+			$moldManage = array ();
+			foreach ( $invoiceManageList as $key => $value ) {
+				if ($value ['mold'] == '发票打印')
+					$moldManage [$value ['mold']] = $value ['staffList'];
+				elseif ($value ['mold'] == '发票邮寄')
+					$moldManage [$value ['mold']] = $value ['staffList'];
+				elseif ($value ['mold'] == '发票退票')
+					$moldManage [$value ['mold']] = $value ['staffList'];
+			}
+			
+			$pendingApprovalsSid = current ( $invoiceManageDetail ['staffList'] ) [0];
+			
+			// 培训班ID--新增关联-发票关系 发票IID关联
+			$invoice = new invoice ();
+			$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
+			// 退票后,重新开票金额的限制
+			$restrictPrice = $invoiceDetail ['invoicePrice'];
+			if (! empty ( $invoiceDetail ['inheritIid'] )) {
+				$restrictList = $invoice->getInvoiceInIid ( $invoiceDetail ['inheritIid'] );
+				foreach ( $restrictList as $key => $value ) {
+					$restrictPrice -= $value ['invoicePrice'];
+				}
+			}
+			if ($restrictPrice < 0) {
+				header ( 'Content-Type:text/html;charset=utf-8' );
+				die ( '开票金额超出原退票金额-0' );
+			} else {
+				if ($restrictPrice < $temporary) {
+					header ( 'Content-Type:text/html;charset=utf-8' );
+					die ( '开票金额超出原退票金额-1' );
+				}
+			}
+			
+			$trainId = $invoiceDetail ['trainId'];
+			$st = 1;
+			if (empty ( $trainId ) && ! is_numeric ( $trainId )) {
+				die ( 'illegal request-trainingIdError' );
+			}
+			
+			$invoice = new invoice ();
+			$item = array (
+					'cid' => $cid,
+					'categoryName' => $categoryDetil ['title'],
+					'invoiceElement' => $invoiceElement,
+					
+					'invoiceQuantity' => $invoiceQuantity,
+					'invoiceUnitPrice' => $invoiceUnitPrice,
+					
+					'invoicePrice' => $invoicePrice,
+					'invoiceType' => $invoiceType,
+					'settlementType' => $st,
+					'doPost' => $doPost,
+					'status' => 1,
+					'invoiceSerial' => "#F" . date ( 'Ymd' ) . str_pad ( mt_rand ( 1, 99999 ), 5, '0', STR_PAD_LEFT ),
+					'date' => date ( "Y-m-d H:i:s" ),
+					'updateTime' => date ( "Y-m-d H:i:s" ),
+					'sid' => $this->staff [0] ['sid'],
+					'userName' => $this->staff [0] ['username'],
+					'invoiceManage' => $invoiceManageDetail ['staff'],
+					'pendingApprovals' => $pendingApprovalsSid,
+					'moldManage' => json_encode ( $moldManage ),
+					'remark' => $remark,
+					'trainId' => $trainId,
+					'parentUntreadIid' => $trainId 
+			);
+			if ($invoiceType == 0)
+				$item += array (
+						'invoiceTitle' => $invoiceTitle,
+						'TIN' => $TINT,
+						'address' => $addressT,
+						'phone' => $phoneT,
+						'bank' => $bankT,
+						'bankAccount' => $bankAccountT 
+				);
+			else {
+				$item += array (
+						'invoiceCompany' => $invoiceCompany,
+						'TIN' => $TIN,
+						'address' => $address,
+						'phone' => $phone,
+						'bank' => $bank,
+						'bankAccount' => $bankAccount 
+				);
+			}
+			if ($doPost == 1) {
+				$mailList = array (
+						'invoice' => 1,
+						'mailItems' => $mailItems 
+				);
+				if (! empty ( $softLock ))
+					$mailList += array (
+							'softLock' => $softLockNum 
+					);
+				else
+					$mailList += array (
+							'softLock' => 0 
+					);
+				if (! empty ( $contract ))
+					$mailList += array (
+							'contract' => $contractNum 
+					);
+				else
+					$mailList += array (
+							'contract' => 0 
+					);
+				if (! empty ( $instructions ))
+					$mailList += array (
+							'instructions' => $instructionsNum 
+					);
+				else
+					$mailList += array (
+							'instructions' => 0 
+					);
+				if (! empty ( $remittance ))
+					$mailList += array (
+							'remittance' => $remittance 
+					);
+				else
+					$mailList += array (
+							'remittance' => '' 
+					);
+				
+				$mailString = '发票x1张,备注:' . $mailItems;
+				if (! empty ( $softLock ))
+					$mailString .= ',软件锁x' . $softLockNum . '个';
+				if (! empty ( $contract ))
+					$mailString .= ',合同x' . $contractNum . '份';
+				if (! empty ( $instructions ))
+					$mailString .= ',说明书x' . $instructionsNum . '本';
+				if (! empty ( $remittance ))
+					$mailString .= ',汇款账号单(张)';
+				
+				$item += array (
+						'recipients' => $recipients,
+						'recipientsPhone' => $recipientsPhone,
+						'recipientsAddress' => $recipientsAddress,
+						'mailItems' => $mailString,
+						'mailItemsJson' => json_encode ( $mailList ) 
+				);
+			}
+			$iid = $invoice->addInvoice ( $item );
+			
+			$invoice = new invoice ();
+			if (! empty ( $invoiceDetail ['inheritIid'] )) {
+				$inheritIid = $invoiceDetail ['inheritIid'] . ',' . $iid;
+			} else {
+				$inheritIid = $iid;
+			}
+			
+			$item = array (
+					'iid' => $invoiceDetail ['iid'],
+					'inheritIid' => $inheritIid 
+			);
+			$invoice->setInvoiceByCondition ( $item );
+			
+			// 如果是培训班结算 创建培训班发票到培训班备份中
+			if (! empty ( $st ) && $st == 1) {
+				Doo::loadModel ( 'invoiceStore' );
+				$invoiceStore = new invoiceStore ();
+				Doo::loadModel ( 'invoiceTraining' );
+				$invoiceTraining = new invoiceTraining ();
+				
+				$isid = $invoiceStore->setInvoiceToInvoiceStore ( $iid );
+				$itemIS = array (
+						'isid' => $isid,
+						'ipSource' => 1,
+						'apStatus' => 1,
+						'iid' => $iid 
+				);
+				$invoiceStore->setInvoiceStoreByCondition ( $itemIS );
+				
+				// 更新培训班总数量
+				$detailIT = $invoiceTraining->getInvoiceTrainingByItid ( $trainId );
+				$item = array (
+						'itid' => $trainId,
+						'invoiceTotal' => $detailIT ['invoiceTotal'] + 1,
+						'submitStatus' => 1 
+				);
+				$itid = $invoiceTraining->setInvoiceTrainByCondition ( $item );
+			}
+			
+			// 操作日志
+			$item = array (
+					'date' => date ( "Y-m-d H:i:s" ),
+					'operation' => "创建",
+					'status' => 1,
+					'img' => $this->staff [0] ['avatar'],
+					'username' => $this->staff [0] ['username'],
+					'uid' => $this->staff [0] ['sid'],
+					'category' => $this->staff [0] ['category'],
+					'iid' => $iid 
+			);
+			$invoiceOperationLog->setInvoiceOperationLog ( $item );
+			$item = array (
+					'date' => date ( "Y-m-d H:i:s" ),
+					'operation' => "提交审批",
+					'status' => 1,
+					'img' => $this->staff [0] ['avatar'],
+					'username' => $this->staff [0] ['username'],
+					'uid' => $this->staff [0] ['sid'],
+					'category' => $this->staff [0] ['category'],
+					'iid' => $iid 
+			);
+			$invoiceOperationLog->setInvoiceOperationLog ( $item );
+		}
+		return "/invoiceUntreadED";
+	}
+	
+	//发票作废
+	function invoiceInvalid() {
+		$invalidId = $this->get_args ( 'invalidId' ) ? $this->get_args ( 'invalidId' ) : "";
+		$date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "MONTHO";
+		
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'invoiceStatistics' );
+		
+		$iid = $XDeode->decode ( $invalidId );
+		if (! is_numeric ( $iid )){
+			die ( 'illegal request-id' );
+		}
+		
+		$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
+		if (empty ( $invoiceDetail )){
+			die ( 'illegal request-emptyData' );
+		}
+		
+		if ( $invoiceDetail['untreadStatus']==2&&$invoiceDetail['status']==2&&$invoiceDetail['isDelete']==0&&$invoiceDetail['invalid']==0 ){
+			$invoice = new invoice ();
+			$invoice->iid = $iid;
+			$invoice->invalid = 1;
+			$invoice->update ();
+			
+			$invoiceStatistics = new invoiceStatistics ();
+			$item = array (
+					'date' => $invoiceDetail['date'] ,
+					'priceClass' => 1,
+					'cid' => $invoiceDetail ['cid'],
+					'staff' => $invoiceDetail ['sid'],
+					'invoicePrice' => -$invoiceDetail ['invoicePrice']
+			);
+			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
+			
+			return "/invoiceUntreadAchieve/1/".$date;
+		}else{
+			die ( 'illegal request-status' );
+		}
+	}
+	
+	//发票撤销作废
+	function invoiceUndoInvalid() {
+		$invalidId = $this->get_args ( 'invalidId' ) ? $this->get_args ( 'invalidId' ) : "";
+		$date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "MONTHO";
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		Doo::loadModel ( 'invoiceStatistics' );
+		
+		$iid = $XDeode->decode ( $invalidId );
+		if (! is_numeric ( $iid )){
+			die ( 'illegal request-id' );
+		}
+		
+		$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
+		if (empty ( $invoiceDetail )){
+			die ( 'illegal request-emptyData' );
+		}
+		if ( $invoiceDetail['untreadStatus']==2&&$invoiceDetail['status']==2&&$invoiceDetail['isDelete']==0&&$invoiceDetail['invalid']==1 ){
+			$invoice = new invoice ();
+			$invoice->iid = $iid;
+			$invoice->invalid = 0;
+			$invoice->update ();
+			
+			$invoiceStatistics = new invoiceStatistics ();
+			$item = array (
+					'date' => $invoiceDetail['date'] ,
+					'priceClass' => 1,
+					'cid' => $invoiceDetail ['cid'],
+					'staff' => $invoiceDetail ['sid'],
+					'invoicePrice' => $invoiceDetail ['invoicePrice']
+			);
+			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
+			
+			return "/invoiceUntreadAchieve/1/".$date;
+		}else{
+			die ( 'illegal request-status' );
+		}
+	}
+	
+	//发票坏账
+	function invoiceBadDebt(){
+		$invalidId = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
+		$status = $this->get_args ( 'status' ) ? $this->get_args ( 'status' ) : "";
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		
+		
+		$iid = $XDeode->decode ( $invalidId );
+		if (! is_numeric ( $iid )){
+			die ( 'illegal request-id' );
+		}
+		
+		$invoiceDetail = $invoice->getInvoiceByIid ( $iid );
+		if (empty ( $invoiceDetail )){
+			die ( 'illegal request-emptyData' );
+		}
+		if ($invoiceDetail['untreadStatus']==0&&$invoiceDetail['status']==2&&$invoiceDetail['isDelete']==0&&$invoiceDetail['badDebt']==0 ){
+			$invoice = new invoice ();
+			$invoice->iid = $iid;
+			$invoice->badDebt = 1;
+			$invoice->update ();
+				
+// 			Doo::loadModel ( 'invoiceStatistics' );
+// 			$invoiceStatistics = new invoiceStatistics ();
+// 			$item = array (
+// 					'date' => $invoiceDetail['date'] ,
+// 					'priceClass' => 1,
+// 					'cid' => $invoiceDetail ['cid'],
+// 					'staff' => $invoiceDetail ['sid'],
+// 					'invoicePrice' => $invoiceDetail ['invoicePrice']
+// 			);
+// 			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
+			
+			if(empty($status)){
+				return "/invoiceAS";
+			}else{
+				return "/invoiceAS/1/".$status;
+			}
+			
+		}else{
+			die ( 'illegal request-status' );
+		}
+	}
+	
 	/**
 	 * 旧输入导入
 	 */
@@ -1183,5 +1308,3 @@ class InvoiceExtendController extends DooController {
 		return $res;
 	}
 }
-
-?>

+ 11 - 0
protected/controller/ReceiptAjaxController.php

@@ -131,6 +131,17 @@ class ReceiptAjaxController extends DooController {
 		}
 	}
 	
+	function ajaxItineraryDate(){
+		$date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : '';
+		
+		Doo::loadClass ( 'receipt.func' );
+		$falt=_verifyItineraryDate($date,$this->staff['sid']);
+		
+		echo json_encode ( array (
+				'status' => $falt
+		) );
+	}
+	
 	/**
 	 * 默认获得属于自己和所在办事处10条最新的数据
 	 */

+ 576 - 14
protected/controller/ReceiptController.php

@@ -57,6 +57,19 @@ class ReceiptController extends DooController {
 		$collectHtml .= '<td class="taR colGreen">¥' . $sumPrice . '</td>';
 		return $collectHtml;
 	}
+	
+	private function _itineraryDateMin(){
+		Doo::loadModel ( "itinerary" );
+		$itinerary = new itinerary ();
+		$itineraryDetail=$itinerary->getOne(array (
+				'where'=>'sid ='.$this->staff [0] ['sid'],
+				'desc'=>'itineraryDate',
+				'asArray' => true
+		));
+		
+		return date("Y-m-d",strtotime("+1 day",strtotime($itineraryDetail['itineraryDate'])));
+	}
+	
 	public function beforeRun($resource, $action) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
@@ -285,6 +298,8 @@ class ReceiptController extends DooController {
 		Doo::loadModel ( "role" );
 		$role = new role ();
 		
+		
+		
 		$acItem = $accountItem->find ( array (
 				'asArray' => true
 		) );
@@ -293,6 +308,8 @@ class ReceiptController extends DooController {
 		$data ['category'] = $lCategory->find ( array (
 				'asArray' => true
 		) );
+		
+		$data ['itineraryDate'] = $this->_itineraryDateMin();
 		$data ['veList'] = $veList;
 		$data ['acItem'] = $acItem;
 		
@@ -408,7 +425,13 @@ class ReceiptController extends DooController {
 	private function _verificationItinerary($itinerary){
 		Doo::loadModel ( 'itinerary' );
 		$itineraryObj = new itinerary ();
+		
+		if(empty($itinerary)){
+			return false;
+		}
+		
 		$itineraryJson=json_decode($itinerary,true);
+		
 		$itineraryDate=array();$sql=array();
 		foreach ($itineraryJson as $key=>$value){
 			if($key==0){
@@ -463,11 +486,18 @@ class ReceiptController extends DooController {
 				die ( '请填写联行号' );
 			}
 			
-			if($this->_verificationItinerary($itinerary)){
-				header ( 'Content-Type:text/html;charset=utf-8' );
-				die ( '已申请过类此日期的行程' );
+			
+			if($receiptClass==2){
+				if($this->_verificationItinerary($itinerary)){
+					header ( 'Content-Type:text/html;charset=utf-8' );
+					die ( '已申请过类此日期的行程' );
+				}
 			}
 			
+			echo $itinerary;
+			
+			die;
+			
 			Doo::loadModel ( 'receipt' );
 			Doo::loadModel ( 'receiptDetail' );
 			Doo::loadModel ( 'accountItem' );
@@ -788,7 +818,7 @@ class ReceiptController extends DooController {
 		$rid = $XDeode->decode ( $ridKey );
 		
 		if (empty ( $rid )) {
-			die ( 'illegal request' );
+			die ( 'illegal request-id' );
 		}
 		// echo $rid.'sd';
 		Doo::loadModel ( 'accountItem' );
@@ -809,7 +839,7 @@ class ReceiptController extends DooController {
 				'asArray' => true 
 		) );
 		if (empty ( $receiptDetail )) {
-			die ( 'illegal request' );
+			die ( 'illegal request-emptyData' );
 		}
 		$enclosurList = $enclosur->getEnclosurByRid ( $receiptDetail ['rid'] );
 		$acItem = $accountItem->find ( array (
@@ -872,7 +902,8 @@ class ReceiptController extends DooController {
 		}elseif($receiptDetail['receiptClass']==3){
 			$this->render ( "/receipt/feeInternalTrainEdi", $data );
 		}else{
-			die ( 'illegal request' );
+			$this->render ( "/admin/saea_edit", $data );
+			//die ( 'illegal request-renderHtml' );
 		}
 	}
 	
@@ -1878,6 +1909,8 @@ class ReceiptController extends DooController {
 		
 		$veList = $verify->getVerifyBySubordinate('LOAN'); 
 		
+		
+		
 		$data ['category'] = $lCategory->find ( array (
 				'asArray' => true 
 		) );
@@ -2430,6 +2463,7 @@ class ReceiptController extends DooController {
 		) );
 		$data ['veList'] = $veList;
 		$data ['acItem'] = $acItem;
+		$data['itineraryDate']=$this->_itineraryDateMin();
 		
 		$data ['memu'] = "receipt";
 		$data ['staff'] = $this->staff;
@@ -2454,7 +2488,7 @@ class ReceiptController extends DooController {
 		$other = $this->get_args ( 'other' );
         $inttrain = $this->get_args ( 'inttrain' );
 
-        $itinerary = $this->get_args ( 'itinerary' ) ? $this->get_args ( 'itinerary' ) : "";
+        $itinerary = $_POST['itinerary'];//$this->get_args ( 'itinerary' ) ? $this->get_args ( 'itinerary' ) : "";
         $receiptClass = $this->get_args ( 'receiptClass' ) ? $this->get_args ( 'receiptClass' ) : "";
         
         
@@ -2481,6 +2515,7 @@ class ReceiptController extends DooController {
 				$receiptClass=1;
 			}elseif($receiptClass=='trave'){
 				$receiptClass=2;
+				
 				if($this->_verificationItinerary($itinerary)){
 					header ( 'Content-Type:text/html;charset=utf-8' );
 					die ( '已申请过类此日期的行程' );
@@ -4965,7 +5000,14 @@ class ReceiptController extends DooController {
 		$data ['receiptMemu'] = 'expenses';
 		$data ['verifyId'] = $this->verifyId;
 		$data ['executeId'] = $this->executeId;
-		$this->render ( "/admin/expensesCollect", $data );
+		
+		if($receiptList[0]['receiptClass']==2){
+			$this->render ( "/receipt/feeTraveDetail", $data );
+			//$this->render ( "/admin/expensesCollect", $data );
+		}else{
+			$this->render ( "/admin/expensesCollect", $data );
+		}
+		
 	}
 	function approvalExpenses() {
 		$status = isset ( $this->params ['status'] ) ? $this->params ['status'] : 0;
@@ -5260,7 +5302,8 @@ class ReceiptController extends DooController {
 		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/approvalExpenses", $data );
 	}
-	function expensesDoc() {
+
+	private function _expensesDoc(){
 		$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
 		
 		Doo::loadClass ( 'XDeode' );
@@ -5754,8 +5797,518 @@ class ReceiptController extends DooController {
 		$data ['receiptMemu'] = 'approvalExpenses';
 		$data ['verifyId'] = $this->verifyId;
 		$data ['executeId'] = $this->executeId;
+
+		return $data;
+	}
+
+	function expensesDoc() {
+		$data=$this->_expensesDoc();
+
+
+// 		$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
+		
+// 		Doo::loadClass ( 'XDeode' );
+// 		$XDeode = new XDeode ( 5 );
+// 		if (! empty ( $rid ) && ! is_numeric ( $rid ))
+// 			$rid = $XDeode->decode ( $rid );
+// 		if (! is_numeric ( $rid ))
+// 			die ( 'illegal request' );
+		
+// 		Doo::loadModel ( 'receipt' );
+// 		$receipt = new receipt ();
+		
+// 		Doo::loadModel ( 'L_category' );
+// 		$Lcategory = new L_category ();
+// 		Doo::loadModel ( 'verify' );
+// 		Doo::loadModel ( 'statistics' );
+// 		$statistics = new statistics ();
+// 		$verify = new verify ();
+// 		Doo::loadModel ( 'staff' );
+// 		$staff = new staff ();
+		
+// 		Doo::loadModel ( 'loanReceipt' );
+// 		$loanReceipt = new loanReceipt ();
+		
+// 		$receiptList = $receipt->find ( array (
+// 				'where' => ' rid=' . $rid,
+// 				'desc' => 'rid',
+// 				'asArray' => true 
+// 		) );
+		
+// 		$loanList = array ();
+// 		if (! empty ( $receiptList ))
+// 			$loanList = $loanReceipt->find ( array (
+// 					'where' => 'rid=' . $receiptList [0] ['loanRid'],
+// 					'desc' => 'rid',
+// 					'asArray' => true 
+// 			) );
+		
+// 		$Locate = 0;
+// 		$roleId = 0;
+// 		$button = 0;
+// 		foreach ( $loanList as $key => $value ) {
+// 			$loanList [$key] ['Locate'] = $Locate;
+// 			$Locate ++;
+// 			$loanList [$key] ['reviseDetail'] = array ();
+// 			if (! empty ( $value ['reviseDetail'] ))
+// 				$loanList [$key] ['reviseDetail'] = json_decode ( $value ['reviseDetail'], true );
+// 			$loanList [$key] ['accountItem'] = json_decode ( $value ['accountItem'], true );
+// 			$loanList [$key] ['loanItem'] = json_decode ( $value ['loanItem'], true );
+// 			$categoryDetil = $Lcategory->getOne ( array (
+// 					'where' => 'cid=' . $value ['cid'],
+// 					'asArray' => true 
+// 			) );
+// 			$loanList [$key] ['category'] = $categoryDetil ['title'];
+			
+// 			// 检测编辑状态
+// 			if ($value ['status'] == 3 || $value ['status'] == 1 || $value ['status'] == 8 || $value ['status'] == 9)
+// 				$verifyList ['staff'] = $value ['verifyBreakup'];
+// 			else
+// 				$verifyList = $verify->getOne ( array (
+// 						'where' => 'vid=' . $value ['verify'],
+// 						'asArray' => true 
+// 				) );
+			
+// 			$verifyList = json_decode ( $verifyList ['staff'], true ); // status opinion
+// 			$verifyStaff = json_decode ( $value ['verifyStaff'], true );
+			
+// 			Doo::loadModel ( 'role' );
+// 			$role = new role ();
+			
+// 			$flag = true;
+// 			$roleKey = 0;
+// 			$endStaffArray = array ();
+// 			$roleArrayCopy = array ();
+// 			foreach ( $verifyList as $k => $v ) {
+// 				// init verifyStaff
+				
+// 				if ($v [1] == 'ROLE') {
+					
+// 					if (! empty ( $verifyStaff )) {
+// 						$endStaffArray = end ( $verifyStaff );
+// 						// if ($v[0]==$endStaffArray['nextStaff']){
+// 						// $roleId=$v[0];
+// 						// }
+// 					}
+					
+// 					$roleVerify = json_decode ( $v [3], true );
+// 					$roleKey = $k;
+// 					$roleArray = array ();
+// 					$rolename = $role->getOne ( array (
+// 							'where' => 'rid=' . $v [0],
+// 							'asArray' => true 
+// 					) );
+					
+// 					foreach ( $roleVerify as $o => $p ) {
+// 						$staffID = explode ( '_', $p );
+// 						$staffInfo = $staff->getOne ( array (
+// 								'where' => 'sid=' . $staffID [0],
+// 								'asArray' => true 
+// 						) );
+// 						// print_r($staffID);
+// 						$exp = array (
+// 								0 => $staffInfo ['sid'],
+// 								1 => $staffID [1],
+// 								2 => $staffInfo ['avatar'],
+// 								'date' => '',
+// 								'date' => '',
+// 								'opinion' => '',
+// 								'status' => '',
+// 								'rolename' => $rolename ['name'] 
+// 						);
+// 						array_push ( $roleArray, $exp );
+// 					}
+// 					$roleArrayCopy [$v [0]] = $roleArray;
+// 					// $verifyList[$k]['roleArray']=$roleArray;
+// 				}
+				
+// 				$verifyList [$k] ['date'] = "";
+// 				$verifyList [$k] ['opinion'] = "";
+// 				$verifyList [$k] ['status'] = "";
+// 				if (empty ( $verifyStaff )) {
+// 					$verifyList [$k] ['date'] = "";
+// 					$verifyList [$k] ['opinion'] = "";
+// 					if (($verifyList [0] [0] == $this->staff [0] ['sid']) && $flag) {
+// 						$verifyList [$k] ['status'] = 4;
+// 						$flag = false;
+// 					}
+// 				} else {
+					
+// 					foreach ( $verifyStaff as $m => $u ) {
+// 						if ($v [0] == $m) {
+// 							$verifyList [$k] ['date'] = $u ['date'];
+// 							$verifyList [$k] ['opinion'] = $u ['opinion'];
+// 							$verifyList [$k] ['status'] = $u ['status'];
+// 							$flag = false;
+// 							break;
+// 						}
+// 					}
+					
+// 					$endStaffArray = end ( $verifyStaff );
+// 					if (isset ( $endStaffArray ['ROLE'] )) {
+// 					} else {
+// 						// $endKey=key($verifyStaff);
+// 						// if ($v[0]==$endStaffArray['nextStaff']&&$endStaffArray['nextStaff']==$this->staff[0]['sid']){
+// 						// $button=4;
+// 						// $verifyList[$k]['status']=4;
+// 						// }
+// 					}
+// 				}
+// 			}
+			
+// 			$rolename ['name'] = '';
+// 			if (! empty ( $roleId )) {
+// 				Doo::loadModel ( 'role' );
+// 				$role = new role ();
+// 				$rolename = $role->getOne ( array (
+// 						'where' => 'rid=' . $roleId,
+// 						'asArray' => true 
+// 				) );
+// 			}
+			
+// 			if (! empty ( $verifyStaff ))
+// 				$endStaffArray = end ( $verifyStaff );
+			
+// 			$KOP = false;
+// 			foreach ( $roleArrayCopy as $P => $A ) {
+				
+// 				foreach ( $A as $MKI => $AVL ) {
+// 					if (! empty ( $verifyStaff )) {
+// 						// &&$rolename['rid']==$endStaffArray['nextStaff']
+// 						if ($this->staff [0] ['sid'] == $AVL [0] && isset ( $endStaffArray ['ROLE'] ) && $rolename ['rid'] == $endStaffArray ['nextStaff']) {
+// 							$button = 4;
+// 							$roleArrayCopy [$P] [$MKI] ['status'] = 4;
+// 						}
+						
+// 						foreach ( $verifyStaff as $m => $u ) {
+// 							$AVLFK = $AVL [0] . '_R';
+// 							// echo $AVLFK.'=='.$m;var_dump($AVLFK==$m);echo '<br/>';
+							
+// 							if (strcmp ( $AVLFK, $m ) == 0) { // &&isset($u['ROLE'])&&$u['ROLE']==1
+// 								$roleArrayCopy [$P] [$MKI] ['date'] = $u ['date'];
+// 								$roleArrayCopy [$P] [$MKI] ['opinion'] = $u ['opinion'];
+// 								$roleArrayCopy [$P] [$MKI] ['status'] = $u ['status'];
+								
+// 								break;
+// 							}
+// 						}
+// 					} else {
+						
+// 						if ($this->staff [0] ['sid'] == $AVL [0] && $verifyList [0] [1] == 'ROLE') {
+// 							$button = 4;
+// 							$roleArrayCopy [$P] [$MKI] ['status'] = 4;
+// 						}
+// 					}
+// 					// $roleArray[$MKI]['rolename']=$rolename['name'];
+// 					$KOP = true;
+// 				}
+// 			}
+			
+// 			foreach ( $roleArrayCopy as $k => $v ) {
+// 				foreach ( $verifyList as $m => $n ) {
+// 					if ($n [0] == $k) {
+// 						array_splice ( $verifyList, $m, 1, $v );
+// 					}
+// 				}
+// 			}
+			
+// 			$loanList [$key] ['verifyList'] = $verifyList;
+// 			$loanList [$key] ['staffDetail'] = $staff->getOne ( array (
+// 					'where' => 'sid=' . $value ['staff'],
+// 					'asArray' => true 
+// 			) );
+// 			$loanList [$key] ['button'] = $button;
+			
+// 			//$loanList[$key]['sumCN']=$this->NumToCNMoney($value['sum']);
+// 		}
+// 		$data ['loanList'] = $loanList;
+		
+// 		//print_r($loanList);
+		
+// 		$Locate = 0;
+// 		$roleId = 0;
+// 		$button = 0;
+// 		foreach ( $receiptList as $key => $value ) {
+// 			$receiptList [$key] ['Locate'] = $Locate;
+// 			$Locate ++;
+// 			$receiptList [$key] ['reviseDetail'] = array ();
+// 			if (! empty ( $value ['reviseDetail'] ))
+// 				$receiptList [$key] ['reviseDetail'] = json_decode ( $value ['reviseDetail'], true );
+// 			$receiptList [$key] ['accountItem'] = json_decode ( $value ['accountItem'], true );
+// 			$receiptList [$key] ['loanItem'] = json_decode ( $value ['loanItem'], true );
+// 			$categoryDetil = $Lcategory->getOne ( array (
+// 					'where' => 'cid=' . $value ['cid'],
+// 					'asArray' => true 
+// 			) );
+// 			$receiptList [$key] ['category'] = $categoryDetil ['title'];
+			
+// 			// 检测编辑状态
+// 			if ($value ['status'] == 3 || $value ['status'] == 1 || $value ['status'] == 9) {
+// 				$verifyList ['staff'] = $value ['verifyBreakup'];
+// 			} else
+// 				$verifyList = $verify->getOne ( array (
+// 						'where' => 'vid=' . $value ['verify'],
+// 						'asArray' => true 
+// 				) );
+			
+// 			$verifyList = json_decode ( $verifyList ['staff'], true ); // status opinion
+			
+// 			$verifyStaff = json_decode ( $value ['verifyStaff'], true );
+			
+// 			Doo::loadModel ( 'role' );
+// 			$role = new role ();
+			
+// 			if ($verifyList == NULL)
+// 				$verifyList = array ();
+// 			$flag = true;
+// 			$roleKey = 0;
+// 			$endStaffArray = array ();
+// 			$roleArrayCopy = array ();
+// 			foreach ( $verifyList as $k => $v ) {
+// 				// init verifyStaff
+				
+// 				if ($v [1] == 'ROLE') {
+					
+// 					if (! empty ( $verifyStaff )) {
+// 						$endStaffArray = end ( $verifyStaff );
+// 						// if ($v[0]==$endStaffArray['nextStaff']){
+// 						// $roleId=$v[0];
+// 						// }
+// 					}
+					
+// 					$roleVerify = json_decode ( $v [3], true );
+// 					$roleKey = $k;
+// 					$roleArray = array ();
+// 					$rolename = $role->getOne ( array (
+// 							'where' => 'rid=' . $v [0],
+// 							'asArray' => true 
+// 					) );
+					
+// 					foreach ( $roleVerify as $o => $p ) {
+// 						$staffID = explode ( '_', $p );
+// 						$staffInfo = $staff->getOne ( array (
+// 								'where' => 'sid=' . $staffID [0],
+// 								'asArray' => true 
+// 						) );
+// 						// print_r($staffID);
+// 						$exp = array (
+// 								0 => $staffInfo ['sid'],
+// 								1 => $staffID [1],
+// 								2 => $staffInfo ['avatar'],
+// 								'date' => '',
+// 								'date' => '',
+// 								'opinion' => '',
+// 								'status' => '',
+// 								'rolename' => $rolename ['name'] 
+// 						);
+// 						array_push ( $roleArray, $exp );
+// 					}
+// 					$roleArrayCopy [$v [0]] = $roleArray;
+// 					// $verifyList[$k]['roleArray']=$roleArray;
+// 				}
+				
+// 				$verifyList [$k] ['date'] = "";
+// 				$verifyList [$k] ['opinion'] = "";
+// 				$verifyList [$k] ['status'] = "";
+// 				if (empty ( $verifyStaff )) {
+// 					$verifyList [$k] ['date'] = "";
+// 					$verifyList [$k] ['opinion'] = "";
+// 					if (($verifyList [0] [0] == $this->staff [0] ['sid']) && $flag) {
+// 						$verifyList [$k] ['status'] = 4;
+// 						$flag = false;
+// 					}
+// 				} else {
+					
+// 					foreach ( $verifyStaff as $m => $u ) {
+// 						if ($v [0] == $m) {
+// 							$verifyList [$k] ['date'] = $u ['date'];
+// 							$verifyList [$k] ['opinion'] = $u ['opinion'];
+// 							$verifyList [$k] ['status'] = $u ['status'];
+// 							$flag = false;
+// 							break;
+// 						}
+// 					}
+					
+// 					$endStaffArray = end ( $verifyStaff );
+// 					if (isset ( $endStaffArray ['ROLE'] )) {
+// 					} else {
+// 						// $endKey=key($verifyStaff);
+// 						// if ($v[0]==$endStaffArray['nextStaff']&&$endStaffArray['nextStaff']==$this->staff[0]['sid']){
+// 						// $button=4;
+// 						// $verifyList[$k]['status']=4;
+// 						// }
+// 					}
+// 				}
+// 			}
+			
+// 			$FC = @$rolename ['name'];
+// 			$rolename ['name'] = '';
+// 			if (! empty ( $roleId )) {
+// 				Doo::loadModel ( 'role' );
+// 				$role = new role ();
+// 				$rolename = $role->getOne ( array (
+// 						'where' => 'rid=' . $roleId,
+// 						'asArray' => true 
+// 				) );
+// 			}
+			
+// 			if (! empty ( $verifyStaff ))
+// 				$endStaffArray = end ( $verifyStaff );
+			
+// 			$KOP = false;
+// 			foreach ( $roleArrayCopy as $P => $A ) {
+				
+// 				foreach ( $A as $MKI => $AVL ) {
+// 					if (! empty ( $verifyStaff )) {
+// 						// &&$rolename['rid']==$endStaffArray['nextStaff']
+// 						if ($this->staff [0] ['sid'] == $AVL [0] && isset ( $endStaffArray ['ROLE'] ) && $rolename ['rid'] == $endStaffArray ['nextStaff']) {
+// 							$button = 4;
+// 							$roleArrayCopy [$P] [$MKI] ['status'] = 4;
+// 						}
+						
+// 						foreach ( $verifyStaff as $m => $u ) {
+// 							$AVLFK = $AVL [0] . '_R';
+// 							// echo $AVLFK.'=='.$m;var_dump($AVLFK==$m);echo '<br/>';
+							
+// 							if (strcmp ( $AVLFK, $m ) == 0) { // &&isset($u['ROLE'])&&$u['ROLE']==1
+// 								$roleArrayCopy [$P] [$MKI] ['date'] = $u ['date'];
+// 								$roleArrayCopy [$P] [$MKI] ['opinion'] = $u ['opinion'];
+// 								$roleArrayCopy [$P] [$MKI] ['status'] = $u ['status'];
+								
+// 								break;
+// 							}
+// 						}
+// 					} else {
+						
+// 						if ($this->staff [0] ['sid'] == $AVL [0] && $verifyList [0] [1] == 'ROLE') {
+// 							$button = 4;
+// 							$roleArrayCopy [$P] [$MKI] ['status'] = 4;
+// 						}
+// 					}
+// 					// $roleArray[$MKI]['rolename']=$rolename['name'];
+// 					$KOP = true;
+// 				}
+// 			}
+			
+// 			foreach ( $roleArrayCopy as $k => $v ) {
+// 				foreach ( $verifyList as $m => $n ) {
+// 					if ($n [0] == $k) {
+// 						array_splice ( $verifyList, $m, 1, $v );
+// 					}
+// 				}
+// 			}
+			
+// 			// 费用执行人相关数据
+// 			$executeCopy = json_decode ( $value ['executeCopy'], true );
+// 			$executeStaff = json_decode ( $value ['executeStaff'], true );
+// 			foreach ( $executeCopy as $k => $v ) {
+// 				$executeCopy [$k] ['date'] = '';
+// 				$executeCopy [$k] ['opinion'] = '';
+// 				$executeCopy [$k] ['status'] = '';
+// 				if (! empty ( $executeStaff ))
+// 					foreach ( $executeStaff as $m => $u ) {
+// 						if ($v [0] == $m) {
+// 							$executeCopy [$k] ['date'] = $u ['date'];
+// 							$executeCopy [$k] ['opinion'] = $u ['opinion'];
+// 							$executeCopy [$k] ['status'] = $u ['status'];
+// 							break;
+// 						}
+// 					}
+// 			}
+// 			$receiptList [$key] ['executeCopy'] = $executeCopy;
+// 			// print_r($verifyList);
+// 			$receiptList [$key] ['verifyList'] = $verifyList;
+// 			$receiptList [$key] ['staffDetail'] = $staff->getOne ( array (
+// 					'where' => 'sid=' . $value ['staff'],
+// 					'asArray' => true 
+// 			) );
+// 			$receiptList [$key] ['button'] = $button;
+			
+// 			$receiptList [$key] ['sumCN'] = $this->num_to_rmb ( $value ['sum'] );
+// 			$receiptList [$key] ['loanSumCN'] = $this->num_to_rmb ( $value ['loanSum'] );
+			
+// 			$relust = bcsub ( $value ['sum'], $value ['loanSum'], 2 );
+// 			$receiptList [$key] ['relust'] = $relust;
+// 			$receiptList [$key] ['relustCN'] = $this->num_to_rmb ( abs ( $relust ) );
+// 		}
+		
+// 		// print_r($receiptList);
+		
+// 		// 获取审批日志
+// 		Doo::loadModel ( 'receiptLog' );
+// 		$receiptLog = new receiptLog ();
+		
+// 		$rlList = array ();
+// 		$rlInfo = $receiptLog->getOne ( array (
+// 				'where' => 'rid=' . $rid . ' and status=4',
+// 				'asArray' => true 
+// 		) );
+// //		$tijdate = $receiptLog->getOne ( array (
+// //				'where' => 'rid=' . $rid . ' and status=2',
+// //				'asc' => 'rlid',
+// //				'asArray' => true
+// //		) );
+// 		if (! empty ( $rlInfo )) {
+// 			$rlList = $receiptLog->find ( array (
+// 					'where' => 'rid=' . $rid,
+// 					'asc' => 'rlid',
+// 					'asArray' => true 
+// 			) );
+// 		}
+
+//         $RN=array();
+// 		if (!empty( $rolename ['staff'])){
+//             $RN = @json_decode ( $rolename ['staff'] );
+//         }
+
+// 		//
+// 		foreach ( $rlList as $key => $value ) {
+// 			$rlList [$key] ['rolename'] = '';
+// 			foreach ( $RN as $k => $v ) {
+// 				$id = explode ( "_", $v );
+				
+// 				if ($id [0] == $value ['uid']) {
+					
+// 					$rlList [$key] ['rolename'] = $FC;
+// 					break;
+// 				}
+// 			}
+// 		}
+		
+// 		Doo::loadModel ( 'enclosur' );
+// 		$enclosur = new enclosur ();
+// 		$enclosurList = $enclosur->find ( array (
+// 				'where' => 'rid=' . $rid,
+// 				'asArray' => true 
+// 		) );
+// 		$enclosurHtml = '';
+// 		foreach ( $enclosurList as $value ) {
+// 			$enclosurHtml .= '<a href="/upload/swfupload/' . $value ['name'] . '" class="sFile" target="_blank">' . $value ['name'] . '</a>';
+// 		}
+		
+// 		$data ['enclosurHtml'] = $enclosurHtml;
+// 		$receiptList [0] ['rlList'] = $rlList;
+// 		$data ['receiptList'] = $receiptList;
+		
+// 		// print_r($receiptList);
+		
+// 		$data ['memu'] = "receipt";
+// 		$data ['staff'] = $this->staff;
+		
+// 		$data ['receiptMemu'] = 'approvalExpenses';
+// 		$data ['verifyId'] = $this->verifyId;
+// 		$data ['executeId'] = $this->executeId;
 		$this->render ( "/admin/expensesDoc", $data );
 	}
+
+	function expensesDocPrint(){
+		$data=$this->_expensesDoc();
+		$this->render ( "/receipt/expensesDocPrint", $data );
+	}
+
+
+
+
 	function expensesEdi() {
 		$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
 		
@@ -7037,7 +7590,12 @@ class ReceiptController extends DooController {
 		if ($Rtype=="loan"){
 			$this->render ( "/receipt/receiptImplementLoan", $data );
 		}elseif($Rtype=="receipt"){
-			$this->render ( "/receipt/receiptImplement", $data );
+			if($receiptList[0]['receiptClass']==2){
+				$this->render ( "/receipt/receiptImplementTrave", $data );
+			}else{
+				$this->render ( "/receipt/receiptImplement", $data );
+			}
+			
 		}elseif($Rtype=="public"){
 			$this->render ( "/receipt/receiptImplementPublic", $data );
 		}else{
@@ -7718,6 +8276,7 @@ class ReceiptController extends DooController {
 			$this->render ( "/admin/receiptburEdi", $data );
 		}
 	}
+
 	function hisImplement() {
 		$item = isset ( $this->params ['item'] ) ? $this->params ['item'] : "";
 		if (empty ( $item ))
@@ -7777,10 +8336,12 @@ class ReceiptController extends DooController {
 			$condition .= ' and (status=1 or status=6) and (executeCopy like "%[\"' . $this->staff [0] ['sid'] . '\"%"  and (executeStaff not like "%{\"' . $this->staff [0] ['sid'] . '\"%" or executeStaff is null ) ) ';
 		} elseif ($status == 'alerpts') {
 			$statusCon = '(status=8 or status=9 )';
-			if (empty ( $rdate ))
-				$dateCondition .= " and Year(date) =" . $year;
-			else
-				$dateCondition .= " and date_format(executeDate,'%Y-%m-%d')='" . $rdate . "' ";
+			if (empty ( $rdate )){
+				$dateCondition = " and Year(date) =" . $year;
+			}else{
+				
+				$dateCondition = " and date_format(executeDate,'%Y-%m-%d')='" . $rdate . "' ";
+			}
 		}
 		
 		if ($sop != 'SOP')
@@ -8144,6 +8705,7 @@ class ReceiptController extends DooController {
 		$data ['sop'] = $sop;
 		$this->render ( "/admin/hisImplement", $data );
 	}
+
 	/**
 	 * 导出汇款信息的exelc
 	 */

+ 21 - 5
protected/controller/SoftController.php

@@ -32,9 +32,12 @@ class SoftController extends DooController {
 		echo json_encode(array('status'=>1,'productList'=>$product),JSON_UNESCAPED_UNICODE);die;
 	}
 	
+	
+	
 	function addLockApi(){
 
 		$longleList=isset($_POST['longle'])?$_POST['longle']:"";
+		//$longleList='[{"key_num":"ZH-04400","serialnumber":"273800F808338043","product":"全国专业+固化清单全功能+全国专业","make_day":"2020/1/2 17:44:37","alloted_time":"","version":"","cid":"6","title":"江西办","licences":"0"}]';
 //echo $longleList.'dddd';die;
         header ( 'Content-Type:text/html;charset=utf-8' );
 		if($longleList!=""){
@@ -42,7 +45,7 @@ class SoftController extends DooController {
 			Doo::loadModel ( 'longle_log' );
 
 			//$exlArray=$this->_format_excel_to_array(DOO::conf()->SITE_PATH."upload/".iconv("UTF-8", "GB2312", $path));
-            //file_put_contents ( "protected/config/longle.bak", $longleList );
+            //file_put_contents ( "protected/config/longle2.bak", $longleList );
 
 			$longleList=json_decode($longleList,TRUE);
 
@@ -52,12 +55,25 @@ class SoftController extends DooController {
 
 			//数组格式化,新增字段需要在这新增
 			$longleList=$this->array_unique_fb($longleList);
-
+			
+// print_r($longleList);
 			//$category=$L_category->getCategoryById($cid);
 			try {
 			Doo::db()->beginTransaction();
 			foreach ($longleList as $key=>$value){
-
+// 				echo 'key_num like "%'.$value['key_num'].'%" or SerialNumber like "%'.$value['serialnumber'].'%"';
+				$longle = new longle ();
+				$repeatDetail=$longle->getOne(array (
+						'where' => 'key_num like "%'.$value['key_num'].'%" or SerialNumber like "%'.$value['serialnumber'].'%"',
+						'limit' => '1',
+						'asArray' => TRUE
+				));
+				
+				if(!empty($repeatDetail)){
+					echo json_encode(array('status'=>3,'dataDetail'=>$repeatDetail,'msg'=>'已存在该锁的数据'),JSON_UNESCAPED_UNICODE);die;
+				}
+				
+				
 				//锁记录
 				$longle = new longle ();
 				$longle->key_num=$value['key_num'];
@@ -83,7 +99,7 @@ class SoftController extends DooController {
 				$longle_log->category='总部';
 				$longle_log->dateline=date("Y-m-d");
 				$id=$longle_log->insert();
-
+				break;
 			}
 			//记录日常行为
 			Doo::loadModel("action_log");
@@ -133,7 +149,7 @@ class SoftController extends DooController {
 		
 		//print_r($longleList);
 		
-		file_put_contents ( "protected/config/longle.bak", $longleList );
+		//file_put_contents ( "protected/config/longle.bak", $longleList );
 		
 		$longleList=json_decode($longleList,TRUE);
 		

+ 12 - 0
protected/model/accountBook.php

@@ -58,6 +58,9 @@ class accountBook extends DooModel {
 		
 		foreach ( $list as $key => $value ) {
 			$list [$key] ['aidKey'] = $XDeode->encode ( $value ['aid'] );
+			if($value['receivedBank']=='华润银行'){
+				$list [$key] ['receivedBank']='广发纵横知道';
+			}
 		}
 		
 		return $list;
@@ -87,6 +90,9 @@ class accountBook extends DooModel {
 		foreach ( $list as $key => $value ) {
 			// $list [$key] ['count'] = $listCount;
 			$list [$key] ['aidKey'] = $XDeode->encode ( $value ['aid'] );
+			if($value['receivedBank']=='华润银行'){
+				$list [$key] ['receivedBank']='广发纵横知道';
+			}
 		}
 		
 		return $list;
@@ -139,6 +145,8 @@ class accountBook extends DooModel {
             $Detail['expenditureTypeMsg']='广发存款';
         }elseif($Detail ['expenditureType']==9){
             $Detail['expenditureTypeMsg']='工行存款';
+        }elseif($Detail ['expenditureType']==10){
+            $Detail['expenditureTypeMsg']='工资';
         }
 		
 		$Detail['incomeTypeMsg']='';
@@ -168,6 +176,10 @@ class accountBook extends DooModel {
             $Detail['incomeTypeMsg']='工行存款';
         }
 		
+        if($Detail['receivedBank']=='华润银行'){
+        	$Detail['receivedBank']='广发纵横知道';
+        }
+        
 		$Detail['staffDetail']=$staff->getStaffBySid($Detail['inputStaff']);
 		
 		return $Detail;

+ 36 - 8
protected/model/invoice.php

@@ -203,6 +203,10 @@ class invoice extends DooModel {
 	
 	public $electronicPhone;
 	public $electronicEmail;
+	
+	public $invalid;
+	public $badDebt;
+	public $untreadTime;
 
 	public $_table = 'CLD_invoice';
 	public $_primarykey = 'iid';
@@ -271,6 +275,9 @@ class invoice extends DooModel {
         'inheritIid',
 			'electronicPhone',
 			'electronicEmail',
+			'invalid',
+			'badDebt',
+			'untreadTime',
 	);
 
 	function get_invoice($filter){
@@ -661,7 +668,12 @@ class invoice extends DooModel {
 	
 	
 	
-	// 获得培训班发票
+	/**
+	 * 获得培训班发票
+	 *
+	 * @param integer $itid
+	 * @return void
+	 */
 	function getInvoiceByTrainingCount($itid = 0) {
 		if (empty ( $itid ))
 			return 0;
@@ -712,7 +724,7 @@ class invoice extends DooModel {
 	 */
 	public function getInvoiceByPrint($iid = 0, $select = "") {
 		$condition = array (
-				'where' => "iid= '" . $iid . "' and status=2 and untreadStatus=0 ",
+				'where' => "iid= '" . $iid . "' and status=2 and (untreadStatus=0 or untreadStatus=4 )",
 				'asArray' => TRUE 
 		);
 		if (! empty ( $select ))
@@ -803,14 +815,14 @@ class invoice extends DooModel {
 		$list = array ();
 		if (! empty ( $sid ) && empty ( $iid ))
 			$list = $this->find ( array (
-					'where' => "status=2 and printStatus=" . $status . " and untreadStatus=0 and moldManage like '%[\"" . $sid . "\",%'",
+					'where' => "status=2 and printStatus=" . $status . " and (untreadStatus=0 or untreadStatus=4) and moldManage like '%[\"" . $sid . "\",%'",
 					'desc' => 'approvalTime',
 					'limit' => 10,
 					'asArray' => TRUE 
 			) );
 		elseif (! empty ( $sid ) && ! empty ( $iid ))
 			$list = $this->getOne ( array (
-					'where' => "status=2 and printStatus=" . $status . " and untreadStatus=0 and moldManage like '%[\"" . $sid . "\",%' and iid=" . $iid,
+					'where' => "status=2 and printStatus=" . $status . " and (untreadStatus=0 or untreadStatus=4) and moldManage like '%[\"" . $sid . "\",%' and iid=" . $iid,
 					
 					'asArray' => TRUE 
 			) );
@@ -1039,6 +1051,14 @@ class invoice extends DooModel {
 					$detail ['iidKeyK'] = $XDeode->encode ( $detail ['iid'] );
 					$list [$key] ['lossDetail'] = $detail;
 				}
+				
+				$lossDate= date('m',strtotime ( $list [$key] ['OperationLog'] ['date'] ));
+				$printMonth=date('m',strtotime ( $value['printTime']));
+				$list [$key] ['lossShow'] = false;
+				if($printMonth<$lossDate){
+					$list [$key] ['lossShow'] = true;
+				}
+				
 			}
 		} else {
 			$list = $this->getOne ( array (
@@ -1170,12 +1190,20 @@ class invoice extends DooModel {
 				$detail ['iidKeyK'] = $XDeode->encode ( $detail ['iid'] );
 				$list [$key] ['lossDetail'] = $detail;
 			}
-			$lossDate = strtotime ( "+1 month", strtotime ( $list [$key] ['OperationLog'] ['date'] ) );
-			$nowDate = strtotime ( 'now' );
+			//$lossDate = strtotime ( "+1 month", strtotime ( $list [$key] ['OperationLog'] ['date'] ) );
+			//$nowDate = strtotime ( 'now' );
+// 			$list [$key] ['lossShow'] = false;
+// 			if ($lossDate < $nowDate){
+// 				$list [$key] ['lossShow'] = true;
+// 			}
+			
+			$lossDate= date('m',strtotime ( $list [$key] ['OperationLog'] ['date'] ));
+			$printMonth=date('m',strtotime ( $value['printTime']));
 			$list [$key] ['lossShow'] = false;
-			if ($lossDate < $nowDate)
+			if($printMonth<$lossDate){
 				$list [$key] ['lossShow'] = true;
-		
+			}
+			
 				
 		}
 		

+ 1 - 1
protected/model/wasteBook.php

@@ -148,7 +148,7 @@ class wasteBook extends DooModel {
 			}elseif($value['accountBank']=='ICBCDeposit'){
 				$list[$key]['accountBankMsg']='纵横工行';
 			}elseif($value['accountBank']=='HUADeposit'){
-				$list[$key]['accountBankMsg']='华润银行';
+				$list[$key]['accountBankMsg']='广发纵横知道';
 			}elseif($value['accountBank']=='PersonalDeposit'){
 				$list[$key]['accountBankMsg']='个人广发';
 			}

+ 1 - 0
protected/view/admin/hisImplement.html

@@ -252,6 +252,7 @@
 									<a href="/receiptTrain/implement/{{receiptList' value.ridKey7}}.html"  target="_blank">详情</a>
 								<!-- else -->
 									<a href="/expensesDoc/{{receiptList' value.rid}}" target="_blank">详情</a>
+									<a href="/expensesDocPrint/{{receiptList' value.rid}}" target="_blank">打印</a>
 								<!-- endif -->
 							<!-- endif -->
 							</td>

+ 45 - 3
protected/view/admin/invoiceAS.html

@@ -128,8 +128,12 @@
 							</td>
 							
 							<td>
-							<!-- if ({{list' value.sumPrice}}<{{list' value.invoicePrice}}||{{list' value.sumPrice}}==0)&& {{list' value.untreadStatus}}==0 && {{list' value.status}}==2 && {{list' value.printStatus}}==1 -->
-							<a href="#recorded" node-invoiceReceivables='INFO' data-isKey="{{list' value.iidKeyK}}" data-toggle="modal">入账</a>
+							<!-- if ({{list' value.sumPrice}}<{{list' value.invoicePrice}}||{{list' value.sumPrice}}==0)&& {{list' value.untreadStatus}}==0 && {{list' value.status}}==2 && {{list' value.printStatus}}==1 -->							
+								<!-- if {{list' value.badDebt}}==0 -->
+								<a href="#recorded" node-invoiceReceivables='INFO' data-isKey="{{list' value.iidKeyK}}" data-toggle="modal">入账</a>
+								<br/>
+								<a href="#Baddebt" badDebt dataId="{{list' value.iidKeyK}}" data-toggle="modal">坏账</a>
+								<!-- endif -->
 							<!-- endif -->
 							</td>
 						</tr>
@@ -182,6 +186,7 @@
 		
 		<form action="/invoiceCompareClaimPrice" method="post" name="receivablesInvoice">
 			<input type="hidden" name="iidKey" id="inKey" value="">
+			
 			<div class="modal-header">
 				<h3>发票入账</h3>
 			</div>
@@ -228,6 +233,31 @@
 </div>
 	
 	
+<div class="modal hide fade" id="Baddebt">
+<form action="/invoiceBadDebt" method="post" name="invoiceBadDebt">
+			<input type="hidden" name="iidKey" id="badDebtKey" value="">
+			<input type="hidden" name="status" id="status" value="{{status}}">
+	<div class="modal-dialog">
+		<div class="modal-content">
+    <div class="modal-header">
+    <h3>确认坏账</h3>
+    </div>
+    <div class="modal-body">
+
+		请确认已经该发票坏账处理。
+		<p class="alert alert-erro" style="margin-top: 15px;">坏账处理将影响公司到款金额</p>
+
+	</div>
+	<div class="modal-footer">
+		<input type="submit" class="button"  value="确认坏账">
+	    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+	</div>
+			</div></div>
+</form>
+</div>
+	
+	
+	
 	
 	
 	<div loading-msg='true' style="position:absolute;  left:50%;  top:50%;  "></div>
@@ -240,5 +270,17 @@
 	<div class="modal  fade" id="billing">
 		<div id="nr"></div>
 	</div>
-<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+
+$(function () {
+
+	$("a[badDebt]").click(function () {
+		let dataId=$(this).attr("dataId");
+		$("#badDebtKey").val(dataId);
+	});
+
+})
+
+autoFlashHeight();
+</script>
 </body>

+ 2 - 5
protected/view/admin/invoiceAdd.html

@@ -18,16 +18,13 @@ $(function() {
 		window.open("https://www.tianyancha.com/search?key="+tianyancha);
 	});
 
-
-
-
 $('input[amount]').keyup(function() {
 	var invoiceQuantity=$('#invoiceQuantity').val();
 	var invoiceUnitPrice=$('#invoiceUnitPrice').val();
 	
 	var invoiceType=$("input[name='invoiceType']:checked").val();
-	
-	if(invoiceType==1&&invoiceQuantity != "" && invoiceQuantity != null && invoiceQuantity != 'undefined' && invoiceUnitPrice != "" && invoiceUnitPrice != null && invoiceUnitPrice != 'undefined'){ // "",null,undefined
+	//invoiceType==1&&
+	if(invoiceQuantity != "" && invoiceQuantity != null && invoiceQuantity != 'undefined' && invoiceUnitPrice != "" && invoiceUnitPrice != null && invoiceUnitPrice != 'undefined'){ // "",null,undefined
 		var amount=invoiceQuantity*invoiceUnitPrice;
 		
 		if (!isNaN(amount) ){

+ 2 - 0
protected/view/admin/invoiceUntread.html

@@ -118,12 +118,14 @@
                                     </td>
                                     <td>
                                     	<!-- if {{establishedInvoice' value.lossShow}} -->
+                                    	
 	                                    	<!-- if {{establishedInvoice' value.lossIid}}==0 -->
 	                                    	<a class="button btn-block" href="#request" node-invoiceLoss='INFO' data-isKey="{{establishedInvoice' value.iidKeyK}}" data-toggle="modal">申请打印</a>
 	                                    	<!-- else -->
 	                                    	<a href="#invdetail" node-invoice='INFO' data-isKey="{{invoiceList' value.lossDetail.iidKeyK}}" data-toggle="modal">{{invoiceList' value.lossDetail.invoiceSerial}}</a>
 	                                    	<!-- endif -->
                                     	<!-- else -->
+                                    	
                                    		当月退票
                                    		<!-- endif -->
                                     </td>

+ 224 - 129
protected/view/admin/invoiceUntreadAchieve.html

@@ -1,5 +1,6 @@
 <!-- include 'header' -->
 <script src="<?= WEB_SITE_GLOBAL ?>js/invoice.js"></script>
+
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">
@@ -9,7 +10,7 @@
 					<!-- include 'menuReceipt' -->
 				</ul>
 			</div>
-			
+
 		</div>
 		<div class="warpContent">
 			<div class="subMenu fL">
@@ -23,162 +24,256 @@
 				</legend>
 				<div class="demandCate">
 					<ul class="cateList">
-						<li><a <!-- if {{date}}=='MONTHO' --> class="now" <!-- endif --> href="/invoiceUntreadAchieve/1/MONTHO/{{MebSea}}">最近一个月</a>
-	  					<a <!-- if {{date}}=='MONTHT' --> class="now" <!-- endif --> href="/invoiceUntreadAchieve/1/MONTHT/{{MebSea}}">最近三个月</a>
-	  					<a <!-- if {{date}}=='MONTHY' --> class="now" <!-- endif --> href="/invoiceUntreadAchieve/1/MONTHY/{{MebSea}}" >今年</a>
-	  					<a <!-- if {{date}}=='MONTHA' --> class="now" <!-- endif --> href="/invoiceUntreadAchieve/1/MONTHA/{{MebSea}}" >更旧</a></li>
+						<li><a <!-- if {{date}}=='MONTHO' --> class="now"
+								<!-- endif --> href="/invoiceUntreadAchieve/1/MONTHO/{{MebSea}}">最近一个月</a>
+							<a <!-- if {{date}}=='MONTHT' --> class="now"
+								<!-- endif --> href="/invoiceUntreadAchieve/1/MONTHT/{{MebSea}}">最近三个月</a>
+							<a <!-- if {{date}}=='MONTHY' --> class="now"
+								<!-- endif --> href="/invoiceUntreadAchieve/1/MONTHY/{{MebSea}}" >今年</a>
+							<a <!-- if {{date}}=='MONTHA' --> class="now"
+								<!-- endif --> href="/invoiceUntreadAchieve/1/MONTHA/{{MebSea}}" >更旧</a></li>
 						<li>
 							<div class="search">
 								<div class="input-append">
-									<form action="/invoiceUntreadAchieve/1/{{date}}" id="iaa" method="get" >
-								<input class="span3" type="text"  data-irmMebSea value="{{MebSeaEn}}" placeholder="发票抬头、开票金额">
-								<button class="btn btn-small" node-iramMebSea type="button">搜索</button>
-								</form>
+									<form action="/invoiceUntreadAchieve/1/{{date}}" id="iaa" 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>
+							</div>
+						</li>
 					</ul>
 				</div>
 				<div class="saeaList">
 					<table class="table table-hover">
 						<tbody>
-						<tr class="thead"><th>开票流水号</th><th>开票单位(抬头)</th><th>开票金额</th><th>发票号</th>
-						<th>退票原因</th>
-						<th>提交退票</th><th>快递信息</th><th>确认退票</th>
-						<th >负票抵销</th></tr>
-						
-						<!-- loop list -->
-						<tr>
-							<td><a href="#invdetail" node-invoice='INFO' data-isKey="{{pendingInvoice' value.iidKeyK}}" data-toggle="modal">{{list' value.invoiceSerial}}</a></td>
-							<td><!-- if !empty({{list' value.invoiceType}}) -->
-	                                   	{{list' value.invoiceCompany}}
-	                                    <!-- else -->
-	                                    {{list' value.invoiceTitle}}
-	                                    <!-- endif --></td>
-							<td>
-							<!-- if !empty({{list' value.invoiceType}}) -->
-	                        <b>¥{{list' value.invoicePrice}}</b><sup>专</sup>
-	                          <!-- else -->
-	                          <b>¥{{list' value.invoicePrice}}</b>
-	                          <!-- endif -->
-							</td>
-							
-							<td>{{list' value.invoiceNo}}</td>
-							<td>{{list' value.untreadReason}}</td>
-							
-							<td>{{list' value.categoryName}}{{list' value.userName}} {{list' value.date}}</td>
-							<td>{{invoiceList' value.untreadCompany}}:
-                                    <a href="#shipping" title="{{invoiceList' value.untreadItems}}" node-express="untread" data-toggle="modal">{{invoiceList' value.untreadNumber}}</a> 
-                                    <a target="_blank" href="http://www.kuaidi100.com/chaxun?com={{invoiceList' value.untreadCom}}&nu={{invoiceList' value.untreadNumber}}">查询快递</a> 
-                                    </td>
-							<td>{{establishedInvoice' value.OperationLog.username}} {{establishedInvoice' value.OperationLog.date}}</td>
-							<td>
-                                   <!-- if {{establishedInvoice' value.lossShow}} -->
-	                                   <!-- if {{establishedInvoice' value.lossIid}}==0 -->
-	                                    <a href="#request" node-invoiceLoss='INFO' data-isKey="{{establishedInvoice' value.iidKeyK}}" data-toggle="modal">申请打印</a>
-	                                   <!-- else -->
-	                                   <a href="#invdetail" node-invoice='INFO' data-isKey="{{invoiceList' value.lossDetail.iidKeyK}}" data-toggle="modal">{{invoiceList' value.lossDetail.invoiceSerial}}</a>
-	                                   <!-- endif -->
-                                   <!-- else -->
-                                   	当月退票
-                                   <!-- endif -->
-                                    </td>
-						</tr>
-						<!-- endloop -->
-						
+							<tr class="thead">
+								<th>开票流水号</th>
+								<th>开票单位(抬头)</th>
+								<th>开票金额</th>
+								<th>发票号</th>
+								<th>退票原因</th>
+								<th>提交退票</th>
+								<th>快递信息</th>
+								<th>打印时间</th>
+								<th>确认退票</th>
+								<th>负票抵销</th>
+							</tr>
+
+							<!-- loop list -->
+							<tr>
+								<td><a href="#invdetail" node-invoice='INFO'
+										data-isKey="{{pendingInvoice' value.iidKeyK}}"
+										data-toggle="modal">{{list' value.invoiceSerial}}</a></td>
+								<td>
+									<!-- if !empty({{list' value.invoiceType}}) -->
+									{{list' value.invoiceCompany}}
+									<!-- else -->
+									{{list' value.invoiceTitle}}
+									<!-- endif -->
+								</td>
+								<td>
+									<!-- if !empty({{list' value.invoiceType}}) -->
+									<b>¥{{list' value.invoicePrice}}</b><sup>专</sup>
+									<!-- else -->
+									<b>¥{{list' value.invoicePrice}}</b>
+									<!-- endif -->
+								</td>
+
+								<td>{{list' value.invoiceNo}}</td>
+								<td>{{list' value.untreadReason}}</td>
+
+								<td>{{list' value.categoryName}}{{list' value.userName}} {{list' value.date}}</td>
+								<td>{{invoiceList' value.untreadCompany}}:
+									<a href="#shipping" title="{{invoiceList' value.untreadItems}}"
+										node-express="untread"
+										data-toggle="modal">{{invoiceList' value.untreadNumber}}</a>
+									<a target="_blank"
+										href="http://www.kuaidi100.com/chaxun?com={{invoiceList' value.untreadCom}}&nu={{invoiceList' value.untreadNumber}}">查询快递</a>
+								</td>
+
+								<td>{{list' value.printTime}}</td>
+								<td>{{establishedInvoice' value.OperationLog.username}}
+									{{establishedInvoice' value.OperationLog.date}}</td>
+								<td>
+									<!-- if {{establishedInvoice' value.lossShow}} -->
+										<!-- if {{establishedInvoice' value.lossIid}}==0 -->
+										<a href="#request" node-invoiceLoss='INFO' data-isKey="{{establishedInvoice' value.iidKeyK}}" data-toggle="modal">申请打印</a>
+										<!-- else -->
+										<a href="#invdetail" node-invoice='INFO' data-isKey="{{invoiceList' value.lossDetail.iidKeyK}}" data-toggle="modal">{{invoiceList' value.lossDetail.invoiceSerial}}</a>
+										<!-- endif -->
+									<!-- else -->
+									
+									<!-- if {{establishedInvoice' value.invalid}}==0 -->
+									<a href="#invalid" data-toggle="modal" invoiceInvalid
+										dataId="{{invoiceList' value.iidKeyK}}">作废</a>
+									<!-- else -->
+									<a href="#reinvalid" data-toggle="modal" invoiceUndoInvalid
+										dataId="{{invoiceList' value.iidKeyK}}">取消作废</a>
+									<!-- endif -->
+									
+									
+									当月退票
+									<!-- endif -->
+								</td>
+							</tr>
+							<!-- endloop -->
+
 						</tbody>
 					</table>
 				</div>
-						  		<!--翻页-->
+				<!--翻页-->
 				<div class="demandPage">
 					<ul class="pagination fL">
-	  							<!-- if {{page.previous}}==0 -->
-								<li><a href="javascript:void(0)" title="上一页">&lt;</a></li>
-								<!-- else -->
-								<li><a href="/invoiceUntreadAchieve/{{page.previous}}{{get}}" title="上一页">&lt;</a></li>
-								<!-- endif -->	
-								
-	  							<!-- if {{page.on_page}}>=3 -->
-	  							<li><a href="/invoiceUntreadAchieve/1{{get}}" title="上一页">1</a></li>
-	  							<li class="point"><span>...</span></li>
-	  							<!-- endif -->
-	  							
-	  							{{page.page}}
-	  							
-	  							<!-- if {{page.on_page}}<3 && {{page.total_page}}>5 -->
-	  							<li><a href="/invoiceUntreadAchieve/4{{get}}" >4</a></li>
-	  							<li><a href="/invoiceUntreadAchieve/5{{get}}" >5</a></li>
-	  							<!-- endif -->
-	  							
-	  							<!-- if {{page.total_page}}>3 -->
-	  							<li class="point"><span>...</span></li>
-			  					<!-- endif -->
-			  					
-			  					<!-- if {{page.next}}=={{page.on_page}} -->
-								<li><a href="javascript:void(0)" title="下一页">&gt;</a></li>
-								<!-- else -->
-								<li><a href="/invoiceUntreadAchieve/{{page.next}}{{get}}" title="下一页">&gt;</a></li>
-								<!-- endif -->
-			  		</ul>
-			  	</div>				
+						<!-- if {{page.previous}}==0 -->
+						<li><a href="javascript:void(0)" title="上一页">&lt;</a></li>
+						<!-- else -->
+						<li><a href="/invoiceUntreadAchieve/{{page.previous}}{{get}}" title="上一页">&lt;</a></li>
+						<!-- endif -->
+
+						<!-- if {{page.on_page}}>=3 -->
+						<li><a href="/invoiceUntreadAchieve/1{{get}}" title="上一页">1</a></li>
+						<li class="point"><span>...</span></li>
+						<!-- endif -->
+
+						{{page.page}}
+
+						<!-- if {{page.on_page}}<3 && {{page.total_page}}>5 -->
+						<li><a href="/invoiceUntreadAchieve/4{{get}}">4</a></li>
+						<li><a href="/invoiceUntreadAchieve/5{{get}}">5</a></li>
+						<!-- endif -->
+
+						<!-- if {{page.total_page}}>3 -->
+						<li class="point"><span>...</span></li>
+						<!-- endif -->
+
+						<!-- if {{page.next}}=={{page.on_page}} -->
+						<li><a href="javascript:void(0)" title="下一页">&gt;</a></li>
+						<!-- else -->
+						<li><a href="/invoiceUntreadAchieve/{{page.next}}{{get}}" title="下一页">&gt;</a></li>
+						<!-- endif -->
+					</ul>
+				</div>
 			</div>
 		</div>
 	</div>
-	
-	
-<div class="modal hide fade" id="request">
-	<div class="modal-dialog modal-lg">
-		<div class="modal-content">
-		
-		<form action="/invoiceLossDo" method="post" name="receivablesInvoiceBind">
-			<input type="hidden" name="iidKey" id="inKey" value="">
-			<div class="modal-header">
-				<h3>打印信息</h3>
-			</div>
-			<div class="modal-body saeaList">
-				
-				<div id="irtc"></div>
+
+
+	<div class="modal hide fade" id="reinvalid">
+		<form action="/invoiceUndoInvalid" method="post" name="receivablesInvoiceBind">
+			
+			<input type="hidden" name="invalidId" id="undoInvalidId" value="" />
+			<input type="hidden" name="date" value="{{date}}" />
+			
+			<div class="modal-dialog">
+				<div class="modal-content">
+					<div class="modal-header">
+						<h3>确认取消作废</h3>
+					</div>
+					<div class="modal-body">请确认已经该发票取消作废处理。</div>
+					<div class="modal-footer">
+					<input type="submit" class="button" value="确认取消">
+						<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+					</div>
+				</div>
 			</div>
-			<div class="modal-footer">
-				<input type="submit" class="button"  value="确认提交">
-				
-				<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+		</form>
+	</div>
+	<div class="modal hide fade" id="invalid">
+		<form action="/invoiceInvalid" method="post" name="receivablesInvoiceBind">
+			<input type="hidden" name="invalidId" id="invalidId" value="" />
+			<input type="hidden" name="date" value="{{date}}" />
+			<div class="modal-dialog">
+				<div class="modal-content">
+					<div class="modal-header">
+						<h3>确认作废</h3>
+					</div>
+					<div class="modal-body">
+						请确认已经该发票作废处理。
+					</div>
+					<div class="modal-footer">
+						<input type="submit" class="button" value="确认作废">
+						<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+					</div>
+				</div>
 			</div>
 		</form>
+	</div>
+
+	<div class="modal hide fade" id="request">
+		<div class="modal-dialog modal-lg">
+			<div class="modal-content">
+
+				<form action="/invoiceLossDo" method="post" name="receivablesInvoiceBind">
+					<input type="hidden" name="iidKey" id="inKey" value="">
+					<div class="modal-header">
+						<h3>打印信息</h3>
+					</div>
+					<div class="modal-body saeaList">
+
+						<div id="irtc"></div>
+					</div>
+					<div class="modal-footer">
+						<input type="submit" class="button" value="确认提交">
+
+						<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+					</div>
+				</form>
+			</div>
 		</div>
 	</div>
-</div>
+
+	
 	
 	
+
 	<!--弹出快递跟踪-->
-<div class="modal hide fade" id="shipping">
-	<div class="modal-dialog">
-		<div class="modal-content">
-    <div class="modal-header">
-    <h3>邮寄物品</h3>
-    </div>
-    <div class="modal-body saeaList">
-		<table class="table table-bordered table-condensed">
-			<tbody>
-			<tr>
-				<th class="taC">退票邮寄物品</th>
-			</tr>
-			<tr>
-				<td node-express="msg">发票</td>
-			</tr>
-			</tbody>
-		</table>
-		
-    </div>
-	<div class="modal-footer">
-	    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+	<div class="modal hide fade" id="shipping">
+		<div class="modal-dialog">
+			<div class="modal-content">
+				<div class="modal-header">
+					<h3>邮寄物品</h3>
+				</div>
+				<div class="modal-body saeaList">
+					<table class="table table-bordered table-condensed">
+						<tbody>
+							<tr>
+								<th class="taC">退票邮寄物品</th>
+							</tr>
+							<tr>
+								<td node-express="msg">发票</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>
 	</div>
-			</div></div>
-</div>
 	<div loading-msg='true' style="position:absolute;  left:50%;  top:50%;  "></div>
-	
+
 	<div class="modal  fade" id="invdetail">
-		
+
 		<div id="nc"></div>
 	</div>
-<script type="text/javascript">autoFlashHeight();</script>	
+	<script type="text/javascript">
+		$(function () {
+
+			$("a[invoiceinvalid]").click(function () {
+				let dataId=$(this).attr("dataId");
+				$("#invalidId").val(dataId);
+			});
+
+			$("a[invoiceUndoInvalid]").click(function () {
+				let dataId=$(this).attr("dataId");
+				$("#undoInvalidId").val(dataId);
+			});
+			
+		})
+		autoFlashHeight();
+	</script>
 </body>

+ 3 - 1
protected/view/expenses/payments.html

@@ -95,7 +95,7 @@
 											<td>
 											
 											<!-- if {{list' value.expenditureType}}==1 -->
-											理财本金
+											银行手续费
 											<!-- elseif {{list' value.expenditureType}}==2 -->
 											总部电话费
 											<!-- elseif {{list' value.expenditureType}}==3 -->
@@ -112,6 +112,8 @@
 											保证金
 											<!-- elseif {{list' value.expenditureType}}==7 -->
 											理财支出
+											<!-- elseif {{list' value.expenditureType}}==10 -->
+											工资
 											<!-- endif -->
 											
 											</td>

+ 3 - 1
protected/view/expenses/paymentsAchieve.html

@@ -194,7 +194,7 @@
 								<th><span class="colRed">支出</span></th>
 								<td>
 								<!-- if {{list' value.expenditureType}}==1 -->
-											理财本金
+											银行手续费
 											<!-- elseif {{list' value.expenditureType}}==2 -->
 											总部电话费
 											<!-- elseif {{list' value.expenditureType}}==3 -->
@@ -211,6 +211,8 @@
 									广发存款
 									<!-- elseif {{list' value.expenditureType}}==9 -->
 									工行存款
+									<!-- elseif {{list' value.expenditureType}}==10 -->
+											工资
 											<!-- endif -->
 								<!-- if {{list' value.expenditureMsg}}!='' -->				
 								/ {{list' value.expenditureMsg}}				

+ 1 - 1
protected/view/expenses/wasteBookExpenditure.html

@@ -20,7 +20,7 @@
 				</div>
 			</div>
 			<div class="adminContent autoHeight" style="height: 821px;">
-				<legend><div class="fR"></div>公司流水所有收</legend>
+				<legend><div class="fR"></div>公司流水所有收</legend>
 				<div class="demandCate">
 				
 				<form action="/wasteBookExpenditure" id="ira" method="get">

+ 8 - 3
protected/view/expenses/wasteBookIncome.html

@@ -20,7 +20,7 @@
 				</div>
 			</div>
 			<div class="adminContent autoHeight" style="height: 821px;">
-				<legend><div class="fR"></div>公司流水所有收</legend>
+				<legend><div class="fR"></div>公司流水所有收</legend>
 				<div class="demandCate">
 				
 				<form action="/wasteBookIncome" id="ira" method="get">
@@ -88,8 +88,13 @@
 	  			<div class="entry">
 	  				<table class="table table-bordered table-condensed">
 	  					<tr>
-	  					<th class="taC">支出项</th>
-	  					
+	  					<th class="taC">
+	  					<!-- if 'INVOICE' == {{accountType}} -->
+	  					支出项
+	  					<!-- else -->
+	  					收入项
+	  					<!-- endif -->
+	  					</th>
 	  					<!-- if 'INVOICE' == {{accountType}} -->
 	  					<th class="taC">办事处</th>
 	  					<th class="taC">开票单位(抬头)</th>

+ 0 - 3
protected/view/menu.html

@@ -69,6 +69,3 @@
 </li> 
 
 <li data-placement="right" data-toggle="ctooltip" data-original-title="退出系统"><a href="/out" class="icon-">G</a></li>
-<!--流量统计-->
-				<div style="position:absolute;left:-100px"><script type="text/javascript">document.write(unescape("%3Cspan id='cnzz_stat_icon_1278817584'%3E%3C/span%3E%3Cscript src='https://v1.cnzz.com/stat.php%3Fid%3D1278817584%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script></div>
-				<!--流量统计-->

+ 1 - 8
protected/view/receipt/feeAgency.html

@@ -218,14 +218,7 @@
 			  					</form>
 			  				</div>
 			  				<div class="seCensor receipt-censor">
-			  					<div class="title">
-			  					报销单填写说明
-			  					</div>
-				  				<div class="detail">
-				  					<p>1 办事处水电费标准100元,标准内实报;</p>
-				  					<p>2 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;</p>
-				  					<p>3 邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。</p>
-			  					</div>
+			  					
 			  				</div>
 			  			</div>
 					</div>

+ 1 - 8
protected/view/receipt/feeAgencyEdi.html

@@ -222,14 +222,7 @@
 			  					</form>
 			  				</div>
 			  				<div class="seCensor receipt-censor">
-			  					<div class="title">
-			  					报销单填写说明
-			  					</div>
-				  				<div class="detail">
-				  					<p>1 办事处水电费标准100元,标准内实报;</p>
-				  					<p>2 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;</p>
-				  					<p>3 邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。</p>
-			  					</div>
+			  					
 			  				</div>
 			  			</div>
 					</div>

+ 1 - 8
protected/view/receipt/feeInternalTrain.html

@@ -187,14 +187,7 @@
 			  					</form>
 			  				</div>
 			  				<div class="seCensor receipt-censor">
-			  					<div class="title">
-			  					报销单填写说明
-			  					</div>
-				  				<div class="detail">
-				  					<p>1 办事处水电费标准100元,标准内实报;</p>
-				  					<p>2 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;</p>
-				  					<p>3 邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。</p>
-			  					</div>
+			  					
 			  				</div>
 			  			</div>
 					</div>

+ 1 - 8
protected/view/receipt/feeInternalTrainEdi.html

@@ -153,14 +153,7 @@
 			  					</form>
 			  				</div>
 			  				<div class="seCensor receipt-censor">
-			  					<div class="title">
-			  					报销单填写说明
-			  					</div>
-				  				<div class="detail">
-				  					<p>1 办事处水电费标准100元,标准内实报;</p>
-				  					<p>2 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;</p>
-				  					<p>3 邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。</p>
-			  					</div>
+			  					
 			  				</div>
 			  			</div>
 					</div>

+ 1 - 10
protected/view/receipt/feeLoanReceipt.html

@@ -281,16 +281,7 @@
 	  				</form>	
 	  				</div>
 	  				<div class="seCensor loan-censor">
-	  					<div class="title">
-	  					报销单填写说明
-	  					</div>
-	  					<div class="detail">
-		  					<p>1 请按先后发生顺序填写报销明细,交通费(市内交通费及往来交通费)、邮寄费需在批注明注明费用明细(例:珠海-广州70元-佛山20元);</p>
-		  					<p>2 出差补助30元/天,不需提供发票,只需在报销单上填写清楚;</p>
-		  					<p>3 办事处水电费标准100元,标准内实报;</p>
-		  					<p>4 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;</p>
-		  					<p>5 市内交通费、邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。</p>
-	  					</div>
+	  					
 	  				</div>
 	  			</div>
 			</div>

+ 1 - 3
protected/view/receipt/feeLoanReceiptAgencyEdi.html

@@ -263,9 +263,7 @@
 	  				</form>	
 	  				</div>
 	  				<div class="seCensor">
-	  					<div class="title">
-	  					报销单填写说明
-	  					</div>
+	  					
 	  				</div>
 	  			</div>
 			</div>

+ 1 - 3
protected/view/receipt/feeLoanReceiptITEdi.html

@@ -256,9 +256,7 @@
 	  				</form>	
 	  				</div>
 	  				<div class="seCensor">
-	  					<div class="title">
-	  					报销单填写说明
-	  					</div>
+	  					
 	  				</div>
 	  			</div>
 			</div>

+ 9 - 15
protected/view/receipt/feeLoanReceiptTrave.html

@@ -262,16 +262,7 @@
 	  				</form>	
 	  				</div>
 	  				<div class="seCensor loan-censor">
-	  					<div class="title">
-	  					报销单填写说明
-	  					</div>
-	  					<div class="detail">
-		  					<p>1 请按先后发生顺序填写报销明细,交通费(市内交通费及往来交通费)、邮寄费需在批注明注明费用明细(例:珠海-广州70元-佛山20元);</p>
-		  					<p>2 出差补助30元/天,不需提供发票,只需在报销单上填写清楚;</p>
-		  					<p>3 办事处水电费标准100元,标准内实报;</p>
-		  					<p>4 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;</p>
-		  					<p>5 市内交通费、邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。</p>
-	  					</div>
+	  					
 	  					
 	  					<div class="itinerary">
 			  						<h2 class="itineraryTitle">总行程单</h2>
@@ -309,10 +300,10 @@
 							<tr>
 								<th>出发地</th>
 								<td>
-								<select departureProvince >
+								<select departureProvince  >
 								
 								</select>
-								<select departureCity>
+								<select departureCity >
 								
 								</select>
 								</td>
@@ -324,9 +315,12 @@
 							</tr>
 							<tr>
 								<th>出发日期</th>
-								<td><input type="date" departureDate ></td>
+								<td><input type="date" departureDate min="{{itineraryDate}}" ></td>
 								<th>到达日期</th>
-								<td><input type="date" arrivalsDate ></td>
+								<td><input type="date" arrivalsDate min="{{itineraryDate}}" ></td>
+							</tr>
+							<tr>
+								<td colspan="4" class="" msg></td>
 							</tr>
 							<tr>
 								<td colspan="4" class="colGray">如果是停留,出发地和到达地填写住宿地。(如:广东省珠海市-广东省珠海市)</td>
@@ -345,7 +339,7 @@
 							</select><a href="#" feeTravelItem class="button">添加费用</a>
 						<table class="table table-bordered table-condensed">
 							<tr>
-								<th colspan="4" class="taC">费用详情</th>
+								<th colspan="3" class="taC">费用详情</th>
 							</tr>
 							<tbody feeTravelItem >
 							</tbody>

+ 5 - 4
protected/view/receipt/feeLoanReceiptTraveEdi.html

@@ -252,9 +252,7 @@
 	  				</form>	
 	  				</div>
 	  				<div class="seCensor">
-	  					<div class="title">
-	  					报销单填写说明
-	  					</div>
+	  					
 	  					
 	  					<div class="itinerary">
 			  						<h2 class="itineraryTitle">总行程单</h2>
@@ -312,6 +310,9 @@
 								<td><input type="date" arrivalsDate ></td>
 							</tr>
 							<tr>
+								<td colspan="4" class="" msg></td>
+							</tr>
+							<tr>
 								<td colspan="4" class="colGray">如果是停留,出发地和到达地填写住宿地。(如:广东省珠海市-广东省珠海市)</td>
 							</tr>
 						</table>
@@ -328,7 +329,7 @@
 							</select><a href="#" feeTravelItem class="button">添加费用</a>
 						<table class="table table-bordered table-condensed">
 							<tr>
-								<th colspan="4" class="taC">费用详情</th>
+								<th colspan="3" class="taC">费用详情</th>
 							</tr>
 							<tbody feeTravelItem >
 							</tbody>

+ 7 - 85
protected/view/receipt/feeTraveApproval.html

@@ -105,12 +105,12 @@
 	  						
 	  						
 	  						
-	  						<tr>
+	  						<!-- <tr>
 											<th colspan="2" class="taC">行程详细</th>
 										</tr>
 										<tbody itinerary >
 											
-										</tbody>
+										</tbody> -->
 	  						
 	  						
 	  						
@@ -358,89 +358,11 @@
 		</div>
 	</div>
 	<script type="text/javascript">
-	function buildItinerary(feeTraveItem){
-				var html='';
-				
-				
-				for(let k=0;k<feeTraveItem.length;k++){
-					html+=`<p class="routeW">
-					<b class="fR">¥${feeTraveItem[k].price}</b>
-					<b>${feeTraveItem[k].name}</b>
-					</p><p class="colGray">#${feeTraveItem[k].detail}</p>
-				<p></p>`;
-				}
-				return html;
-				
-			}
-	//构建总行程单
-	function buildItineraryProcess(data){
-		let html='';
-		let dataJson=data;
-		if(typeof data==='string'){
-			dataJson=JSON.parse(data);
-		}
-		
-		let last=dataJson.length-1;
-		
-		
-		for(let i=0;i<dataJson.length;i++){
-			let price=0;
-			for(let p=0;p<dataJson[i].feeTraveItem.length;p++){
-				price+=parseFloat(dataJson[i].feeTraveItem[p].price);
-			}
-			
-			let feeTraveItem=dataJson[i].feeTraveItem;
-			let itemHtml=buildItinerary(feeTraveItem);
-			
-			
-			html+=`<li>
-				<div class="itineraryList">
-					<div class="addressName"><i class="contactsMark icon-">P</i> <b>${dataJson[i].departurecity}</b></div>
-					<div class="pointLine">
-						<div class="priceList">
-							<span class="priceTitle">金额</span>
-							<span class="price colGreen">¥${price}</span>
-						</div>
-						<div class="timeList">
-							<span class="timeTitle">时间</span>
-							<span class="time">${dataJson[i].departuredate}${dataJson[i].arrivalsdate}</span>
-						</div>
-						<div class="routeList clearfix">
-							<span class="routeTitle fL">详情</span>
-							<span class="route fL">
-							
-								${itemHtml}
-							</span>
-						</div>
-					</div>
-				</div>
-			</li>`;
-			
-			if(i===last){
-				let arrivalscity=dataJson[i].arrivalscity.substring(1);
-				
-				html+=`<li>
-				<div class="itineraryList">
-					<div class="addressName"><i class="contactsMark icon-">P</i> <b>${arrivalscity}</b></div>
-					
-				</div>
-			</li>`;
-				
-			}
-		}
-		
-		$("ul[itineraryinfo]").html(html);
-	}
-	$(function() {
-				
-				var sessionStorage= window.sessionStorage;
-				sessionStorage.setItem("itineraryListApproval",'{{receiptList.0.itinerary}}');
-				var sessionItinerary= sessionStorage.getItem("itineraryListApproval");
-				if(typeof sessionItinerary!=='object'){
-					buildItinerary(JSON.parse(sessionItinerary));
-					buildItineraryProcess(sessionItinerary);
-				}
-	})
+	var sessionStorageList='itineraryListApproval';
+	sessionStorage.setItem(sessionStorageList,'{{receiptList.0.itinerary}}');
+	
 	</script>	
+	<script src="<?= itineraryView ?>"></script>
+	
 <script type="text/javascript">autoFlashHeight();</script>	
 </body>

+ 11 - 64
protected/view/receipt/feeTravel.html

@@ -47,57 +47,9 @@
 										</tr>
 										<tbody itinerary >
 											
-
-											
 										</tbody>
 
-										<tr>
-											<td colspan="2">
-											<div class="itinerary">
-													<div class="itineraryCon">
-														<ul itineraryinfo>
-															<li>
-																<div class="itineraryList">
-																	<div class="fR">
-																		<a href="">编辑</a>
-																	</div>
-																	<div class="addressName">
-																		<i class="contactsMark icon-">P</i> <b>珠海</b>
-																	</div>
-																	<div class="timeList">
-																		<span class="timeTitle"><i
-																			class="contactsMark icon-">Q</i></span> <span class="time">2020-05-12</span>
-																	</div>
-																	<div class="pointLine">
-																		<div class="priceList">
-																			<span class="priceTitle">费用</span> <span
-																				class="price colGreen">¥100</span>
-																		</div>
-
-																		<div class="routeList clearfix">
-																			<span class="routeTitle fL">详情</span> <span
-																				class="route fL">
-																				<p class="routeW">
-																					<b class="fR">¥75.00</b> <b>往来交通费</b>
-																				</p>
-																				<p class="colGray">#高铁</p>
-																				<p></p>
-																				<p class="routeW">
-																					<b class="fR">¥25.00</b> <b>市内交通费</b>
-																				</p>
-																				<p class="colGray">#出租车</p>
-																				<p></p>
-																			</span>
-																		</div>
-																	</div>
-																</div>
-															</li>
-															
-														</ul>
-													</div>
-												</div>
-												</td>
-										</tr>
+										
 
 
 
@@ -260,25 +212,16 @@
 								</form>
 							</div>
 							<div class="seCensor receipt-censor">
-								<div class="title">报销单填写说明</div>
-								<div class="detail">
-									<p>1 办事处水电费标准100元,标准内实报;</p>
-									<p>
-										2 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;
-									</p>
-									<p>
-										3 邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。
-									</p>
-								</div>
 								
-								<!-- <div class="itinerary">
+								
+								<div class="itinerary">
 			  						<h2 class="itineraryTitle">总行程单</h2>
 			  						<div class="itineraryCon" >
 			  							<ul itineraryinfo>
 			  								
 			  							</ul>
 			  						</div>
-			  					</div> -->
+			  					</div>
 								
 							</div>
 						</div>
@@ -317,10 +260,14 @@
 								</td>
 							</tr>
 							<tr>
+							<!-- min="{{itineraryDate}}" -->
 								<th>出发日期</th>
-								<td><input type="date" departureDate ></td>
+								<td><input type="date" departureDate  ></td>
 								<th>到达日期</th>
-								<td><input type="date" arrivalsDate ></td>
+								<td><input type="date" arrivalsDate   ></td>
+							</tr>
+							<tr>
+								<td colspan="4" class="" msg></td>
 							</tr>
 							<tr>
 								<td colspan="4" class="colGray">如果是停留,出发地和到达地填写住宿地。(如:广东省珠海市-广东省珠海市)</td>
@@ -339,7 +286,7 @@
 							</select><a href="#" feeTravelItem class="button">添加费用</a>
 						<table class="table table-bordered table-condensed">
 							<tr>
-								<th colspan="4" class="taC">费用详情</th>
+								<th colspan="3" class="taC">费用详情</th>
 							</tr>
 							<tbody feeTravelItem >
 							</tbody>

+ 7 - 13
protected/view/receipt/feeTravelEdi.html

@@ -178,16 +178,7 @@
 								</form>
 							</div>
 							<div class="seCensor receipt-censor">
-								<div class="title">报销单填写说明</div>
-								<div class="detail">
-									<p>1 办事处水电费标准100元,标准内实报;</p>
-									<p>
-										2 <b>产生费用所在办事处</b> 默认使用您所在的第一个办事处;
-									</p>
-									<p>
-										3 邮寄费、公关费、办公费等详细说明请填写到 <b>报销说明</b>。
-									</p>
-								</div>
+								
 								
 								<div class="itinerary">
 			  						<h2 class="itineraryTitle">总行程单</h2>
@@ -236,9 +227,12 @@
 							</tr>
 							<tr>
 								<th>出发日期</th>
-								<td><input type="date" departureDate ></td>
+								<td><input type="date" departureDate  ></td>
 								<th>到达日期</th>
-								<td><input type="date" arrivalsDate ></td>
+								<td><input type="date" arrivalsDate  ></td>
+							</tr>
+							<tr>
+								<td colspan="4" class="" msg></td>
 							</tr>
 							<tr>
 								<td colspan="4" class="colGray">如果是停留,出发地和到达地填写住宿地。(如:广东省珠海市-广东省珠海市)</td>
@@ -257,7 +251,7 @@
 							</select><a href="#" feeTravelItem class="button">添加费用</a>
 						<table class="table table-bordered table-condensed">
 							<tr>
-								<th colspan="4" class="taC">费用详情</th>
+								<th colspan="3" class="taC">费用详情</th>
 							</tr>
 							<tbody feeTravelItem >
 							</tbody>

+ 7 - 12
protected/view/receipt/receiptFee.html

@@ -277,7 +277,7 @@
 					<div>
 						<!--办事处相关费用-->
 						<table feeType1 class="table table-bordered table-condensed" >
-							<tr><th class="taC" colspan="3">日常相关费用</th></tr>
+							<tr><th class="taC">日常相关费用</th></tr>
 							<tr><td>
 							<div class="cost-item">
 							<!-- loop acItem -->
@@ -290,7 +290,7 @@
 							</div></td>
 	  						</tr>
 	  						
-							<tr><th class="taC" colspan="3">其他</th></tr>
+							<tr><th class="taC">其他</th></tr>
 							<tr><td>
 							<div class="cost-item">
 							<!-- loop acItem -->
@@ -304,26 +304,21 @@
 						</table>
 						<!--差旅相关费用-->
 						<table feeType2 class="table table-bordered table-condensed" style="display:none">
-							<tr><th class="taC" colspan="3">差旅相关费用</th></tr>
+							<tr><th class="taC">差旅相关费用</th></tr>
 							<tr><td>
-							<div class="cost-item">
-							<!-- loop acItem -->
-		  						<!-- if {{acItem' value.category}} =="差旅相关费用" -->
-		  							<span>{{acItem' value.name}}</span>
-		  						<!-- endif -->
-	  						<!-- endloop -->
-							</div>
+							<div class="cost-item" ><!-- loop acItem -->
+							<!-- if {{acItem' value.category}} =="差旅相关费用" --><span >{{acItem' value.name}}</span><!-- endif --><!-- endloop --></div>
 							</td>
 							
 							</tr>
 						</table>
 						<!--内部培训费用-->
 						<table feeType3 class="table table-bordered table-condensed" style="display:none">
-							<tr><th class="taC" colspan="3">内部培训费用</th></tr>
+							<tr><th class="taC">内部培训费用</th></tr>
 							<tr><td>
 							<div class="cost-item">
 							<!-- loop acItem -->
-		  						<!-- if {{acItem' value.category}} =="差旅相关费用" -->
+		  						<!-- if {{acItem' value.category}} =="内部培训费用" -->
 		  							<span>{{acItem' value.name}}</span>
 		  						<!-- endif -->
 	  						<!-- endloop -->

+ 15 - 9
protected/view/receipt/receiptImplementLoan.html

@@ -120,12 +120,13 @@
 	  						<tr><th class="taR">合计</th><td class="colGreen taR">¥{{receiptDetail' value.accountItem.cSum.otherSum}}</td></tr>
 	  					<!-- elseif {{receiptList' value.receiptClass}}==2 -->
 	  					
-	  					<tr>
-											<th colspan="2" class="taC">行程详细</th>
-										</tr>
-										<tbody itinerary >
-											
-										</tbody>
+	  					<tr><th colspan="2" class="taC">总行程单</th></tr>
+	  						<tr><td colspan="2"><div class="itinerary">
+			  						<div class="itineraryCon">
+			  							<ul itineraryinfo >
+			  								
+			  							</ul>
+			  						</div></div></td></tr>
 	  					
 	  					
 	  						<tr><th colspan="2" class="taC">差旅相关费用</th></tr>
@@ -543,7 +544,7 @@
 	</div>
 	
 	<script type="text/javascript">
-	function buildItinerary(list){
+	/* function buildItinerary(list){
 				var html='';
 				for(let i=0;i<list.length;i++){
 					html+='<tr><th colspan="2" class="ta"><i class="contactsMark icon-">P</i> '+list[i].departuredate+list[i].arrivalsdate+' '+list[i].departurecity+list[i].arrivalscity+'';
@@ -568,8 +569,13 @@
 					buildItinerary(JSON.parse(sessionItinerary));
 					
 				}
-	})
+	}) */
 	</script>
 	
-<script type="text/javascript">autoFlashHeight();</script>	
+<script type="text/javascript">
+autoFlashHeight();
+var sessionStorageList='itineraryListLoan';
+sessionStorage.setItem(sessionStorageList,'{{receiptList.0.itinerary}}');
+</script>	
+<script src="<?= itineraryView ?>"></script>
 </body>