caipin před 5 roky
rodič
revize
f917a66bfc
32 změnil soubory, kde provedl 952 přidání a 125 odebrání
  1. 1 1
      global/css/global.css
  2. 38 0
      global/js/email.js
  3. 12 12
      global/js/index.js
  4. 13 3
      global/js/receipt.js
  5. 2 1
      protected/config/js.edition.conf.php
  6. 2 0
      protected/config/routes.conf.php
  7. 53 15
      protected/controller/MainController.php
  8. 51 1
      protected/controller/ReceiptAjaxController.php
  9. 156 8
      protected/controller/ReceiptController.php
  10. 241 24
      protected/controller/ReceiptExtendController.php
  11. 5 4
      protected/model/company.php
  12. 5 0
      protected/model/district.php
  13. 2 2
      protected/model/longle.php
  14. 2 0
      protected/model/wasteBook.php
  15. 31 1
      protected/view/admin/expenses.html
  16. 4 0
      protected/view/admin/expensesCollect.html
  17. 50 11
      protected/view/admin/hisImplement.html
  18. 20 10
      protected/view/admin/implement.html
  19. 24 4
      protected/view/admin/invoiceAdd.html
  20. 19 2
      protected/view/admin/invoiceAddFill.html
  21. 1 1
      protected/view/admin/receiptburEdi.html
  22. 8 0
      protected/view/admin/remitAdd.html
  23. 11 0
      protected/view/admin/saeaLoanAdd.html
  24. 1 0
      protected/view/admin/saeaLoanAddReceipt.html
  25. 8 0
      protected/view/admin/saea_create.html
  26. 6 2
      protected/view/contacts_client.html
  27. 1 1
      protected/view/contacts_company.html
  28. 15 10
      protected/view/mail_create.html
  29. 58 5
      protected/view/receipt/receiptTrain.html
  30. 70 2
      protected/view/receipt/receiptTrainImplement.html
  31. 3 1
      protected/view/receipt/receiptTrainItem.html
  32. 39 4
      protected/view/receipt/receiptWasteBook.html

+ 1 - 1
global/css/global.css

@@ -2340,7 +2340,7 @@ table .taC{
   border:none;
   cursor:pointer;
 }
-.seCensor .reportButton a,.seCensor .reportButton button{
+.seCensor .reportButton > a,.seCensor .reportButton > button{
   width:50%;
   float:left;
   text-align:center;

+ 38 - 0
global/js/email.js

@@ -15,6 +15,44 @@ function tabC(a,b){
 
 $(function() {
 
+
+	$("select[node-city]").change(function(){
+
+		var id=$(this).val();
+
+		var city=$("select[city]");
+
+		var url="/ajaxGetLv2";
+		$.ajax({
+			url:url,
+			type: "post",
+			cache: false,
+			dataType: "json",
+			data: {
+				lv1:id
+			},
+			global: true,
+			success: function(data){
+				var optionHtml='<option value="ALL">全部</option>';
+				for(let i=0;i<data.info.length;i++){
+					optionHtml+='<option value="'+data.info[i]['idKey']+'">'+data.info[i]['name']+'</option>';
+					console.log(data.info[i]);
+				}
+
+				city.html(optionHtml);
+			},
+			error:function(err){
+			}
+		});
+
+
+
+
+
+
+
+
+	});
 	
 	$("a[node-mail]").click(function(){
 		$(this).attr('disabled',"true");

+ 12 - 12
global/js/index.js

@@ -304,14 +304,14 @@ function checkadcl(){
 	var op = $("#lv21 option:selected");
 	
 	if(adclientname==""){
-		$('#admsg').html('请填写客户名称');
-		$('#admsg').attr('class','bsAlert bsDanger fL');
+		$('#akdmsg').html('请填写客户名称');
+		$('#akdmsg').attr('class','bsAlert bsDanger fL');
 		return false;
 	}
 
 	if(companyname==""){
-		$('#admsg').html('请填写公司名称');
-		$('#admsg').attr('class','bsAlert bsDanger fL');
+		$('#akdmsg').html('请填写公司名称');
+		$('#akdmsg').attr('class','bsAlert bsDanger fL');
 		return false;
 	}
 	
@@ -319,24 +319,24 @@ function checkadcl(){
 	
 	
 	if(op.html()=="请选择"){
-		$('#admsg').html('请选择地区');
-		$('#admsg').attr('class','bsAlert bsDanger fL');
+		$('#akdmsg').html('请选择地区');
+		$('#akdmsg').attr('class','bsAlert bsDanger fL');
 		return false;
 	}
 	
 	var op2=$("#lv22 option:selected");
 	
 	if(op2.html()=="请选择"){
-		$('#admsg').html('请选择地区');
-		$('#admsg').attr('class','bsAlert bsDanger fL');
+		$('#akdmsg').html('请选择地区');
+		$('#akdmsg').attr('class','bsAlert bsDanger fL');
 		return false;
 	}
 	
 	var op3=$("#lv23 option:selected");
 	
 	if(op3.html()=="请选择"){
-		$('#admsg').html('请选择地区');
-		$('#admsg').attr('class','bsAlert bsDanger fL');
+		$('#akdmsg').html('请选择地区');
+		$('#akdmsg').attr('class','bsAlert bsDanger fL');
 		return false;
 	}
 	
@@ -358,7 +358,7 @@ function checkadcl(){
 		//global: true,
 		success: function(data){
 			if(!data.success){
-				$('#admsg').html('已经存在客户');
+				$('#akdmsg').html('已经存在客户');
 				//$('#admsg').attr('class','bsAlert bsDanger fL');
 				return false;
 			}else
@@ -366,7 +366,7 @@ function checkadcl(){
 		},
 		error:function(err){
 			if(!data.success){
-				$('#admsg').html('已经存在客户');
+				$('#akdmsg').html('已经存在客户');
 				//$('#admsg').attr('class','bsAlert bsDanger fL');
 				return false;
 			}

+ 13 - 3
global/js/receipt.js

@@ -80,12 +80,11 @@ function setExeReceipt(tr,rid){
 	 
 	 var accountBank=$('#accountBankSelect'+tr).val();
 	 
-	 console.log(amount);
 	 if(amount=='')
 		 return alert('请填写汇款金额');
 	 $("#amountInp"+tr).val(amount);
 	 $("#accountBank"+tr).val(accountBank);
-	 form.submit(); 
+	 //form.submit(); 
 }
 
 function expensesDefray(status,rid){
@@ -222,9 +221,20 @@ $(function() {
 				}
 				
 				var count=data.receipt.length;
+				console.log(data.receipt.Rtype);
+				
 				
 				if(count!=0){
-					window.location.href="/implement/"+data.receipt.ridKey+".html"; 
+					if(data.receipt.Rtype==0){
+						window.location.href="/implement/receipt/"+data.receipt.ridKey+".html"; 
+					}else if(data.receipt.Rtype==1){
+						window.location.href="/implement/loan/"+data.receipt.ridKey+".html"; 
+					}else if(data.receipt.Rtype==2){
+						window.location.href="/implement/public/"+data.receipt.ridKey+".html"; 
+					}else if(data.receipt.Rtype==3){
+						
+					}
+					//
 					
 				}else
 					alert('没有需要审批的费用');

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

@@ -1,6 +1,6 @@
 <?php
 
-define ( "index", WEB_SITE_GLOBAL.'js/index.js?1.05' );
+define ( "index", WEB_SITE_GLOBAL.'js/index.js?1.06' );
 define ( "receiptExtend", WEB_SITE_GLOBAL.'js/receiptExtend.js?1.02' );
 
 define ( "receipt", WEB_SITE_GLOBAL.'js/receipt.js?1.04' );
@@ -9,4 +9,5 @@ define ( "payments", WEB_SITE_GLOBAL.'js/payments.js?1.02' );
 define ( "invoiceValidator", WEB_SITE_GLOBAL.'js/invoice.validator.js?1' );
 
 define ( "autoTag", WEB_SITE_GLOBAL.'js/autoTag.js?1' );
+define ( "email", WEB_SITE_GLOBAL.'js/email.js?1' );
 ?>

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

@@ -145,6 +145,8 @@ $route['*']['/remitApproval/:rid'] = array('ReceiptController', 'remitApproval')
 //执行请求
 $route['post']['/exportRemittance'] = array('ReceiptController', 'exportRemittance');
 $route['*']['/implement/:rid'] = array('ReceiptController', 'implement','extension'=>'.html');
+$route['*']['/implement/:Rtype/:rid'] = array('ReceiptController', 'implement','extension'=>'.html');
+
 $route['*']['/approvalExpenses/:status/:page'] = array('ReceiptController', 'approvalExpenses');
 $route['*']['/saeaLoanReceiptAdd/:rid'] = array('ReceiptController', 'saeaLoanReceiptAdd');
 $route['*']['/saeaLoanReceiptAddDo'] = array('ReceiptController', 'saeaLoanReceiptAddDo');

+ 53 - 15
protected/controller/MainController.php

@@ -1475,6 +1475,20 @@ class MainController extends DooController {
 		
 		$clientname = trim ( $clientname );
 		
+		$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']] = '';
+			}
+		}
+		
 		// $companyname = trim ( $companyname );
 		
 		if (empty ( $companyname ))
@@ -1831,7 +1845,7 @@ class MainController extends DooController {
 			}
 		}
 		
-		
+
 		if (empty ( $this->staff [0] ['sid'] ))
 			return "/contacts";
 		
@@ -2157,19 +2171,24 @@ class MainController extends DooController {
 			$search = urldecode ( isset ( $this->params ['search'] ) ? $this->params ['search'] : "" );
 		
 		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
-		
+
+		$data['search']=$search;
+
+
+
 		$data ['memu'] = "contacts";
-		
 		$data ['staff'] = $this->staff;
-		
+
+        //Doo::loadModel ( 'tag' );
+        //$tag = new tag ();
+
 		Doo::loadModel ( 'district' );
 		Doo::loadModel ( 'company' );
 		Doo::loadModel ( 'client' );
-		Doo::loadModel ( 'tag' );
 		Doo::loadModel ( 'L_category' );
 		
 		$lcategory = new L_category ();
-		$tag = new tag ();
+
 		$client = new client ();
 		$company = new company ();
 		$district = new district ();
@@ -2179,9 +2198,9 @@ class MainController extends DooController {
 		$tagCompanyNexus = new tagCompanyNexus ();
 		
 		$data ['district2'] = $district->get_lv ( 1 );
-		$category = $lcategory->getCategoryById ( $this->staff [0] ['cid'], $this->staff [0] ['othercid'] );
+		//$category = $lcategory->getCategoryById ( $this->staff [0] ['cid'], $this->staff [0] ['othercid'] );
 		$cateStr = " cid =0 ";
-		
+
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		
@@ -2261,7 +2280,11 @@ class MainController extends DooController {
 		
 		if (! empty ( $condition ))
 			$cateStr = $condition;
-		
+
+        if (!empty($search)){
+            $cateStr.=" and companyname like '%".$search."%' ";
+        }
+
 		if (! empty ( $nature ))
 			$cateStr .= " and nature like '%" . $nature . "%'";
 			
@@ -2435,6 +2458,9 @@ class MainController extends DooController {
 		$this->render ( "/contacts_company", $data );
 	}
 	function contacts() {
+		
+		session_start ();
+		
 		$data ['memu'] = "contacts";
 		$data ['staff'] = $this->staff;
 		
@@ -2741,6 +2767,10 @@ class MainController extends DooController {
 			$remindList [$key] ['Etime'] = date ( 'm-d', strtotime ( $value ['time'] . " +" . $value ['day'] . " days" ) );
 		}
 		
+		$token = $this->set_token ();
+		$_SESSION ['token_' . $this->staff [0] ['sidKey']] = $token;
+		$data ['token'] = $token;
+		
 		$data ['remindCount'] = $rc;
 		$data ['remindList'] = $remindList;
 		$data ['CC1'] = $CC1;
@@ -3196,13 +3226,9 @@ class MainController extends DooController {
 		}
 		
 		if (! empty ( $lv1 )) {
-			
 			Doo::loadModel ( 'district' );
-			
 			$district = new district ();
-			
 			$district = $district->get_lvByid ( $s, $lv1 );
-			
 			echo json_encode ( array (
 					"success" => true,
 					"info" => $district 
@@ -6020,9 +6046,11 @@ class MainController extends DooController {
 		
 		$tagList = $tag->getAllBySid ( $this->staff [0] ['sid'] );
 		$districtList = $district->get_lv ( 1 );
-		
+
+        $districtlv2List=$district->get_lvByid(2,$districtList[0]['id']);
 		$data ['tagList'] = $tagList;
 		$data ['districtList'] = $districtList;
+        $data ['districtlv2List'] = $districtlv2List;
 		$data ['memu'] = "eMailTask";
 		$data ['staff'] = $this->staff;
 		$data ['mailMemu'] = 'eMailTask';
@@ -6675,6 +6703,7 @@ class MainController extends DooController {
 		$natureNULL = $this->get_args ( 'natureNULL' ) ? $this->get_args ( 'natureNULL' ) : "";
 		
 		$did = $this->get_args ( 'did' ) ? $this->get_args ( 'did' ) : "";
+        $didCity = $this->get_args ( 'didCity' ) ? $this->get_args ( 'didCity' ) : "";
 		$stype = $this->get_args ( 'stype' ) ? $this->get_args ( 'stype' ) : "";
 		
 		if (! empty ( $title ) && (! empty ( $tagId ) || ! empty ( $did ))) {
@@ -6982,9 +7011,18 @@ class MainController extends DooController {
 						$cidList = '';
 				}
 				// 'select'=>'email,cid,nicename as clientname,companyname,district'
+                $where='district like "' . $did . ',%" ' . $cidList;
+                if ($didCity!="ALL"){
+                    Doo::loadClass ( 'XDeode' );
+                    $XDeode = new XDeode ( 5 );
+                    $didCity = $XDeode->decode ( $didCity );
+                    $where='district like "' . $did . ','.$didCity.',%" ' . $cidList;
+
+                }
+
 				$clientEmailList = $client->find ( array (
 						'select' => 'email,cid,nicename as clientname,companyname,district',
-						'where' => 'district like "' . $did . ',%" ' . $cidList,
+						'where' => $where,
 						'asArray' => true 
 				) );
 			}

+ 51 - 1
protected/controller/ReceiptAjaxController.php

@@ -164,7 +164,57 @@ class ReceiptAjaxController extends DooController {
 		$receipt = new receipt ();
 	
 		$detail = $receipt->getReceiptByRid ( $rid );
-	
+		
+
+		// 收入合计
+		Doo::loadModel ( 'invoiceTraining' );
+		$invoiceTraining = new invoiceTraining ();
+		$invoiceTrainingDetail = array (
+				'invoiceArriveAmount' => '0.00',
+				'RIAmount' => '0.00',
+				'invoiceTotalAmount' => '0.00',
+				'invoiceCompanyAmount' => '0.00',
+				'invoiceArriveAmountM'=>'0.00',
+				'invoiceCompanyAmountM'=>'0.00'
+		);
+		if ($detail ['invoiceTrainId'] != 0) {
+			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $detail ['invoiceTrainId'] );
+		}
+		// print_r($invoiceTrainingDetail);
+		$invoiceArriveAmount = $RIAmount = 0;
+		if (! empty ( $invoiceTrainingDetail )) {
+			$invoiceArriveAmount = $invoiceTrainingDetail ['invoiceArriveAmount'];
+			$RIAmount = $invoiceTrainingDetail ['RIAmount'];
+		}
+		
+		// 备用金
+		$sum = 0;
+		if (! empty ( $receiptDetail ['trainLoanRid'] )) {
+			$receiptLoanDetail = $receipt->getReceiptByRid ( $detail ['trainLoanRid'] );
+			$sum = $receiptLoanDetail ['sum'];
+		}
+		
+		// 支出项金额详情
+		// 项目金额合计
+		Doo::loadModel ( 'RItem' );
+		$RItem = new RItem ();
+		Doo::loadModel ( 'accountItem' );
+		$accountItem = new accountItem ();
+		// 讲师获得
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		$RItemList = $RItem->getRItemByRid ( $rid );
+		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+		// 支出项金额详情
+		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceArriveAmount );
+		$categoryActualExpenditure = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
+		
+		$payment = $sum + $RIAmount - $categoryActualExpenditure;
+		
+		$detail['payment']=$payment;
+		Doo::loadClass ( 'authcode.func' );
+		$detail['paymentAuthCode']=authcode($payment,'');
+		
 		echo json_encode ( array (
 				'status' => 1,
 				'detail' => $detail

+ 156 - 8
protected/controller/ReceiptController.php

@@ -3481,6 +3481,18 @@ class ReceiptController extends DooController {
 		$roleId = 0;
 		$button = 0;
 		foreach ( $receiptList as $key => $value ) {
+			
+			$receiptList[$key]['balance']='';
+			if($value['Rtype']==1){
+				$receiptList[$key]['balance']=$value['sum']-=$value['loanSum'];
+				$receiptList[$key]['balanceABS']=abs($receiptList[$key]['balance']);
+			}elseif($value['Rtype']==3){
+				$payment=$this->_getReceiptTrainPayment($value['invoiceTrainId'],$value['trainLoanRid'],$value['rid']);
+				$receiptList[$key]['payment']=$payment;
+				$receiptList[$key]['paymentABS']=abs($payment);
+			}
+			
+			
 			$receiptList [$key] ['Locate'] = $Locate;
 			$Locate ++;
 			$receiptList [$key] ['reviseDetail'] = array ();
@@ -5535,6 +5547,8 @@ class ReceiptController extends DooController {
 	}
 	function implement() {
 		$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
+		$Rtype = isset ( $this->params ['Rtype'] ) ? $this->params ['Rtype'] : '';
+		
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'receipt' );
@@ -5969,7 +5983,19 @@ class ReceiptController extends DooController {
 			$relust = bcsub ( $value ['sum'], $value ['loanSum'], 2 );
 			$receiptList [$key] ['relust'] = $relust;
 			$receiptList [$key] ['relustCN'] = $this->num_to_rmb ( $relust );
+			
+			$receiptList [$key] ['amountABS'] = abs ( $value ['amount'] );
+		}
+		
+		//执行人是否是最后一位
+		$executeCopy = json_decode ( $receiptList [0] ['executeCopy'], true );
+		$executeStaff = json_decode ( $receiptList [0] ['executeStaff'], true );
+		$executePrimary=count($executeCopy)-1;
+		$lastOne=true;
+		if($executePrimary!=count($executeStaff)){
+			$lastOne=false;
 		}
+		$data['lastOne']=$lastOne;
 		
 		
 		// 是否写入过流水
@@ -5997,7 +6023,7 @@ class ReceiptController extends DooController {
 		}
 		$data ['wbDetailLoan'] = $wbDetailLoan;
 		
-		
+		$data['inputDate']=date ( "Y-m-d H:i:s" );
 		//print_r($wbDetail);
 		
 		$data ['receiptList'] = $receiptList;
@@ -6006,10 +6032,22 @@ class ReceiptController extends DooController {
 		$data ['receiptMemu'] = 'implement';
 		$data ['verifyId'] = $this->verifyId;
 		$data ['executeId'] = $this->executeId;
-		$this->render ( "/admin/implement", $data );
+		
+		if ($Rtype=="loan"){
+			$this->render ( "/receipt/receiptImplementLoan", $data );
+		}elseif($Rtype=="receipt"){
+			$this->render ( "/receipt/receiptImplement", $data );
+		}elseif($Rtype=="public"){
+			$this->render ( "/receipt/receiptImplementPublic", $data );
+		}else{
+			//$this->render ( "/admin/implement", $data );
+		}
 	}
+	
+	
+	
 	function implementDo() {
-		$rid = $this->get_args ( 'rid' ) && is_numeric ( $this->get_args ( 'rid' ) ) ? $this->get_args ( 'rid' ) : 0;
+		$rid = $this->get_args ( 'rid' )  ? $this->get_args ( 'rid' ) : "";
 		$implementOpinions = $this->get_args ( 'opinion' ) ? $this->get_args ( 'opinion' ) : "";
 		
 // 		$amount = $this->get_args ( 'amount' ) && is_numeric ( $this->get_args ( 'amount' ) ) ? $this->get_args ( 'amount' ) : '';
@@ -6027,18 +6065,27 @@ class ReceiptController extends DooController {
 // 		if (empty ( $ab ))
 // 			die ( 'illegal request--22' );
 		
+
+
 		if (! empty ( $rid )) {
 			Doo::loadModel ( 'receipt' );
 			$receipt = new receipt ();
 			
-// 			Doo::loadClass ( 'XDeode' );
-// 			$XDeode = new XDeode ( 5 );
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			
+			$rid=$XDeode->decode($rid);
+			if (!is_numeric($rid)){
+				die;
+			}
 			
 			// $rinfo = $receipt->getOne ( array (
 			// 'where' => 'rid=' . $rid,
 			// 'asArray' => true
 			// ) );
 			
+			
+			
 			$rinfo = $receipt->getReceiptByRid ( $rid );
 			
 // 			$accountType = '';
@@ -6078,7 +6125,6 @@ class ReceiptController extends DooController {
 			
 			if (count ( $executeStaff ) == count ( $executeCopy )) {
 				$receipt->executeStaff = json_encode ( $executeStaff );
-				
 				$receipt->status = 8;
 				if ($rinfo ['Rtype'] == 1 && $rinfo ['isBK'] == 1 && $rinfo ['status'] == 1)
 					$receipt->status = 9;
@@ -6585,6 +6631,7 @@ class ReceiptController extends DooController {
 			$receiptList [$key] ['sumCN'] = $this->num_to_rmb ( $value ['sum'] );
 			$relust = bcsub ( $value ['sum'], $value ['loanSum'], 2 );
 			$receiptList [$key] ['relust'] = $relust;
+			$receiptList [$key] ['relustABS'] = abs ( $relust );
 			$receiptList [$key] ['relustCN'] = $this->num_to_rmb ( abs ( $relust ) );
 		}
 
@@ -6961,9 +7008,60 @@ class ReceiptController extends DooController {
 					'asArray' => true 
 			) );
 			$receiptList [$key] ['staffDetail'] = $staffDetail;
-			
 			$receiptList [$key] ['button'] = $button;
 			
+			if ($value['Rtype']==1){
+			$receiptList [$key] ['relust'] = $value['sum']-$value['loanSum'];
+			$receiptList [$key] ['relustABS'] = abs($receiptList [$key] ['relust']);
+			}elseif($value['Rtype']==3){
+				// 收入合计
+				Doo::loadModel ( 'invoiceTraining' );
+				$invoiceTraining = new invoiceTraining ();
+				$invoiceTrainingDetail = array (
+						'invoiceArriveAmount' => '0.00',
+						'RIAmount' => '0.00',
+						'invoiceTotalAmount' => '0.00',
+						'invoiceCompanyAmount' => '0.00',
+						'invoiceArriveAmountM'=>'0.00',
+						'invoiceCompanyAmountM'=>'0.00'
+				);
+				if ($value ['invoiceTrainId'] != 0) {
+					$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $value['invoiceTrainId'] );
+				}
+				$invoiceArriveAmount = $RIAmount = 0;
+				if (! empty ( $invoiceTrainingDetail )) {
+					$invoiceArriveAmount = $invoiceTrainingDetail ['invoiceArriveAmount'];
+					$RIAmount = $invoiceTrainingDetail ['RIAmount'];
+				}
+					
+				// 备用金
+				$sum = 0;
+				if (! empty ( $value ['trainLoanRid'] )) {
+					$receiptLoanDetailBak = $receipt->getReceiptByRid ( $value ['trainLoanRid'] );
+					$sum = $receiptLoanDetailBak ['sum'];
+				}
+					
+				// 支出项金额详情
+				// 项目金额合计
+				Doo::loadModel ( 'RItem' );
+				$RItem = new RItem ();
+				Doo::loadModel ( 'accountItem' );
+				$accountItem = new accountItem ();
+				// 讲师获得
+				Doo::loadModel ( 'RILecturer' );
+				$RILecturer = new RILecturer ();
+				$RItemList = $RItem->getRItemByRid ( $value['rid'] );
+				$RILecturerList = $RILecturer->getRILecturerByRid ( $value['rid'] );
+				// 支出项金额详情
+				$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceArriveAmount );
+				$categoryActualExpenditure = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
+					
+				$payment = $sum + $RIAmount - $categoryActualExpenditure;
+				$receiptList [$key] ['payment'] =$payment;
+				$receiptList [$key] ['paymentABS'] =abs($payment);
+				
+			}
+			
 			// 设置导出汇款execl
 			if (! empty ( $value ['remittanceName'] ) && ! empty ( $value ['bankName'] ) && ! empty ( $value ['bankNumber'] )) {
 				$remittanceDetail = array (
@@ -9031,7 +9129,7 @@ class ReceiptController extends DooController {
 		if ($day != 'DAY' && $moth != 'MONTH')
 			$dateCondition = " and Year(executeDate) =" . $year . " and Month(executeDate) = " . $moth . " and day(executeDate)=" . $day;
 		
-		$sql = ' (status =8 or status=9 ) and amount!=0  ' . $dateCondition;
+		$sql = ' (status =8 or status=9 ) and amount>0  ' . $dateCondition;
 		$table = '(SELECT count(*) FROM CLD_receipt WHERE ' . $sql . ' group by executeDate ) a ';
 		$pageinfo = $this->get_page ( $table, '  ', $page, $page_size, "remittanceHky", $get, "" );
 		$limit = $pageinfo ['lower'] . ',' . $page_size;
@@ -16294,6 +16392,56 @@ class ReceiptController extends DooController {
 	function get_previous($on_page = 1) {
 		return $on_page != 0 ? $on_page - 1 : $on_page;
 	}
+	
+	function _getReceiptTrainPayment($invoiceTrainId,$trainLoanRid,$rid){
+		// 收入合计
+		Doo::loadModel ( 'invoiceTraining' );
+		$invoiceTraining = new invoiceTraining ();
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		$invoiceTrainingDetail = array (
+				'invoiceArriveAmount' => '0.00',
+				'RIAmount' => '0.00',
+				'invoiceTotalAmount' => '0.00',
+				'invoiceCompanyAmount' => '0.00',
+				'invoiceArriveAmountM'=>'0.00',
+				'invoiceCompanyAmountM'=>'0.00'
+		);
+		if ($invoiceTrainId != 0) {
+			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $invoiceTrainId );
+		}
+		$invoiceArriveAmount = $RIAmount = 0;
+		if (! empty ( $invoiceTrainingDetail )) {
+			$invoiceArriveAmount = $invoiceTrainingDetail ['invoiceArriveAmount'];
+			$RIAmount = $invoiceTrainingDetail ['RIAmount'];
+		}
+			
+		// 备用金
+		$sum = 0;
+		if (! empty ( $value ['trainLoanRid'] )) {
+			$receiptLoanDetailBak = $receipt->getReceiptByRid ( trainLoanRid );
+			$sum = $receiptLoanDetailBak ['sum'];
+		}
+			
+		// 支出项金额详情
+		// 项目金额合计
+		Doo::loadModel ( 'RItem' );
+		$RItem = new RItem ();
+		Doo::loadModel ( 'accountItem' );
+		$accountItem = new accountItem ();
+		// 讲师获得
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		$RItemList = $RItem->getRItemByRid ($rid );
+		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+		// 支出项金额详情
+		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceArriveAmount );
+		$categoryActualExpenditure = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
+			
+		$payment = $sum + $RIAmount - $categoryActualExpenditure;
+		return $payment;
+	}
+	
 }
 
 ?>

+ 241 - 24
protected/controller/ReceiptExtendController.php

@@ -227,7 +227,9 @@ class ReceiptExtendController extends DooController {
 				'invoiceArriveAmount' => '0.00',
 				'RIAmount' => '0.00',
 				'invoiceTotalAmount' => '0.00',
-				'invoiceCompanyAmount' => '0.00' 
+				'invoiceCompanyAmount' => '0.00',
+				'invoiceArriveAmountM'=>'0.00',
+				'invoiceCompanyAmountM'=>'0.00'
 		);
 		if ($receiptDetail ['invoiceTrainId'] != 0) {
 			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
@@ -287,7 +289,11 @@ class ReceiptExtendController extends DooController {
 		
 		$payment = $sum + $RIAmount - $categoryActualExpenditure;
 		$data ['payment'] = sprintf ( "%.2f", $payment );
-		
+		$data ['paymentAbs']=sprintf ( "%.2f",abs($payment));
+
+        Doo::loadClass ( 'authcode.func' );
+        $data ['paymentAuthCode'] = authcode($payment,'');
+
 		$data ['total'] = sprintf ( "%.2f", $aiData ['total'] );
 		$data ['aiCount'] = count ( $aiData ['dataList'] ) + 5;
 		$data ['aiList'] = $aiData ['dataList'];
@@ -445,7 +451,7 @@ class ReceiptExtendController extends DooController {
 		$data ['summaryJson'] =URLEncode(json_encode($summaryJson));
 		$data ['aiListJson'] =URLEncode(json_encode($data ['aiList']));
 		 
-		
+		$data['inputDate']=date ( "Y-m-d H:i:s" );
 		
 		$data ['memu'] = "receipt";
 		$data ['staff'] = $this->staff;
@@ -554,7 +560,7 @@ class ReceiptExtendController extends DooController {
 		$data ['showType'] = $showType;
 		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
 		
-		$invoiceList = $invoiceTrainingDetail = array ();
+		$invoiceList = $invoiceTrainingDetail = array ('invoiceTotalAmount'=>0,'invoiceArriveAmount'=>0);
 		if ($receiptDetail ['invoiceTrainId'] != 0) {
 			$invoiceList = $invoice->getInvoicePrintedByItid ( $receiptDetail ['invoiceTrainId'] );
 			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
@@ -996,6 +1002,26 @@ class ReceiptExtendController extends DooController {
 			}
 		}
 		
+		//执行人是否是最后一位
+		$executeCopy = json_decode ( $receiptDetail ['executeCopy'], true );
+		$executeStaff = json_decode ( $receiptDetail ['executeStaff'], true );
+		$executePrimary=count($executeCopy)-1;
+		$lastOne=true;
+		if($executePrimary!=count($executeStaff)){
+			$lastOne=false;
+		}
+		$data['lastOne']=$lastOne;
+		// 是否写入过流水
+		$accountType = 0;
+		if ($receiptDetail ['Rtype'] == 3) {
+			$accountType = 12;
+		}
+		Doo::loadModel ( 'wasteBook' );
+		$wasteBook = new wasteBook ();
+		$wbDetail = $wasteBook->getWateBookByAD ( $accountType, $receiptDetail ['rid'] );
+		$data ['wbDetail'] = $wbDetail;
+		
+		
 		$data ['button2'] = $button2;
 		$data ['executeList'] = $executeList;
 		
@@ -1047,6 +1073,55 @@ class ReceiptExtendController extends DooController {
 					'asArray' => true 
 			) );
 			
+			//计算汇款金额
+			// 收入合计
+			Doo::loadModel ( 'invoiceTraining' );
+			$invoiceTraining = new invoiceTraining ();
+			$invoiceTrainingDetail = array (
+					'invoiceArriveAmount' => '0.00',
+					'RIAmount' => '0.00',
+					'invoiceTotalAmount' => '0.00',
+					'invoiceCompanyAmount' => '0.00',
+					'invoiceArriveAmountM'=>'0.00',
+					'invoiceCompanyAmountM'=>'0.00'
+			);
+			if ($receiptDetail ['invoiceTrainId'] != 0) {
+				$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail['invoiceTrainId'] );
+			}
+			$invoiceArriveAmount = $RIAmount = 0;
+			if (! empty ( $invoiceTrainingDetail )) {
+				$invoiceArriveAmount = $invoiceTrainingDetail ['invoiceArriveAmount'];
+				$RIAmount = $invoiceTrainingDetail ['RIAmount'];
+			}
+			
+			// 备用金
+			$sum = 0;
+			if (! empty ( $receiptDetail ['trainLoanRid'] )) {
+				$receiptLoanDetailBak = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
+				$sum = $receiptLoanDetailBak ['sum'];
+			}
+			
+			// 支出项金额详情
+			// 项目金额合计
+			Doo::loadModel ( 'RItem' );
+			$RItem = new RItem ();
+			Doo::loadModel ( 'accountItem' );
+			$accountItem = new accountItem ();
+			// 讲师获得
+			Doo::loadModel ( 'RILecturer' );
+			$RILecturer = new RILecturer ();
+			$RItemList = $RItem->getRItemByRid ( $rid );
+			$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+			// 支出项金额详情
+			$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceArriveAmount );
+			$categoryActualExpenditure = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
+			
+			$payment = $sum + $RIAmount - $categoryActualExpenditure;
+			
+			
+			
+			
+			
 			$nslist = explode ( ',', $receiptDetail ['nowStaff'] );
 			$nsflag = true;
 			foreach ( $nslist as $value ) {
@@ -1474,6 +1549,10 @@ class ReceiptExtendController extends DooController {
 				// 微信企业号通知
 				// $this->setWXMsg ( $rid, 1 );
 			}
+			
+			//汇款金额
+			$receipt->amount=$payment;
+			
 			$receipt->update ( array (
 					'where' => ' rid = ' . $rid 
 			) );
@@ -1952,9 +2031,12 @@ class ReceiptExtendController extends DooController {
 		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : '';
 		$bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";
 		
-		$amountTrain = $this->get_args ( 'amount' ) && is_numeric ( $this->get_args ( 'amount' ) ) ? $this->get_args ( 'amount' ) : '';
+		$amountTrain = $this->get_args ( 'amount' )  ? $this->get_args ( 'amount' ) : '';
 		$expensesType = $this->get_args ( 'expensesType' ) ? $this->get_args ( 'expensesType' ) : "";
 		
+		$inputDate = $this->get_args ( 'inputDate' ) ? $this->get_args ( 'inputDate' ) : date ( "Y-m-d H:i:s" );
+		$remarks = $this->get_args ( 'remarks' ) ? $this->get_args ( 'remarks' ) : "";
+		
 		$actionType = $this->get_args ( 'actionType' ) ? $this->get_args ( 'actionType' ) : "";
 		if (! empty ( $actionType )) {
 			if ($actionType != 'NOTRAIN')
@@ -1995,8 +2077,19 @@ class ReceiptExtendController extends DooController {
 			} elseif ($rinfo ['Rtype'] == 2) {
 				$accountType = 4;
 				$expensesType='EXPENDITURE';
-			} elseif ($rinfo ['Rtype'] == 3) {
+			} elseif ($rinfo ['Rtype'] == 3) {//培训班结算 收支类型
 				$accountType = 12;
+                Doo::loadClass ( 'authcode.func' );
+                $amountTrain=authcode($amountTrain);
+                if(!is_numeric ( $amountTrain )) {
+                    die('illegal request--payType');
+                }
+
+				if($amountTrain>=0){
+					$expensesType='INCOME';
+				}else{
+					$expensesType='EXPENDITURE';
+				}
 				$amount=$amountTrain;
 			}
 			
@@ -2059,7 +2152,8 @@ class ReceiptExtendController extends DooController {
 						'cid' => $rinfo ['category'] [0] ['cid'],
 						'name' => $rinfo ['staffDetail'] ['username'],
 						'sid' => $rinfo ['staffDetail'] ['sid'],
-						'inputDate' => date ( "Y-m-d H:i:s" ) 
+						'inputDate' => $inputDate,
+						'remarks'=>$remarks
 				);
 				$wasteBook->setAccountBookStatistics ( $item );
 			}
@@ -2070,7 +2164,14 @@ class ReceiptExtendController extends DooController {
 			return '/receiptTrain/implement/' . $XDeode->encode ( $rid ) . '.html?trainEdiType=COLLECT';
 		} elseif ($actionType == 'NOTRAIN') {
 			$XDeode = new XDeode ( 5 );
-			return "/implement/" . $XDeode->encode ( $rid ) . ".html";
+			if ($rinfo['Rtype']==1){
+				return "/implement/loan/" . $XDeode->encode ( $rid ) . ".html";
+			}elseif($rinfo['Rtype']==0){
+				return "/implement/receipt/" . $XDeode->encode ( $rid ) . ".html";
+			}elseif($rinfo['Rtype']==2){
+				return "/implement/public/" . $XDeode->encode ( $rid ) . ".html";
+			}
+			
 		}
 	}
 	
@@ -2087,10 +2188,14 @@ class ReceiptExtendController extends DooController {
 		foreach ($receiptList as $key=>$value){
 			$receiptList[$key]['balance']='';
 			if($value['Rtype']==1){
-				if($value['isBK']==1){
-					$receiptList[$key]['balance']=$value['sum']-=$value['loanSum'];
-				}
+				$receiptList[$key]['balance']=$value['sum']-=$value['loanSum'];
+				$receiptList[$key]['balanceABS']=abs($receiptList[$key]['balance']);
+			}elseif($value['Rtype']==3){
+				$payment=$this->_getReceiptTrainPayment($value['invoiceTrainId'],$value['trainLoanRid'],$value['rid']);
+				$receiptList[$key]['payment']=$payment;
+				$receiptList[$key]['paymentABS']=abs($payment);
 			}
+			$receiptList[$key]['amountABS']=abs($value['amount']);
 		}
 		
 		
@@ -2107,6 +2212,55 @@ class ReceiptExtendController extends DooController {
 		$this->render ( "/receipt/receiptWasteBook", $data );
 	}
 	
+	function _getReceiptTrainPayment($invoiceTrainId,$trainLoanRid,$rid){
+		// 收入合计
+		Doo::loadModel ( 'invoiceTraining' );
+		$invoiceTraining = new invoiceTraining ();
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		$invoiceTrainingDetail = array (
+				'invoiceArriveAmount' => '0.00',
+				'RIAmount' => '0.00',
+				'invoiceTotalAmount' => '0.00',
+				'invoiceCompanyAmount' => '0.00',
+				'invoiceArriveAmountM'=>'0.00',
+				'invoiceCompanyAmountM'=>'0.00'
+		);
+		if ($invoiceTrainId != 0) {
+			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $invoiceTrainId );
+		}
+		$invoiceArriveAmount = $RIAmount = 0;
+		if (! empty ( $invoiceTrainingDetail )) {
+			$invoiceArriveAmount = $invoiceTrainingDetail ['invoiceArriveAmount'];
+			$RIAmount = $invoiceTrainingDetail ['RIAmount'];
+		}
+			
+		// 备用金
+		$sum = 0;
+		if (! empty ( $value ['trainLoanRid'] )) {
+			$receiptLoanDetailBak = $receipt->getReceiptByRid ( trainLoanRid );
+			$sum = $receiptLoanDetailBak ['sum'];
+		}
+			
+		// 支出项金额详情
+		// 项目金额合计
+		Doo::loadModel ( 'RItem' );
+		$RItem = new RItem ();
+		Doo::loadModel ( 'accountItem' );
+		$accountItem = new accountItem ();
+		// 讲师获得
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		$RItemList = $RItem->getRItemByRid ($rid );
+		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+		// 支出项金额详情
+		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceArriveAmount );
+		$categoryActualExpenditure = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
+			
+		$payment = $sum + $RIAmount - $categoryActualExpenditure;
+		return $payment;
+	}
+	
 	/**
 	 * 费用流水新增
 	 */
@@ -2116,24 +2270,29 @@ class ReceiptExtendController extends DooController {
 			die ( 'illegal request--ridKey' );
 		}
 		
+		$receivedBank = $this->get_args ( 'receivedBank' ) ? $this->get_args ( 'receivedBank' ) : "";
+		$receivedRemarks = $this->get_args ( 'receivedRemarks' ) ? $this->get_args ( 'receivedRemarks' ) : "";
+		$receivedInputDate = $this->get_args ( 'receivedInputDate' ) ? $this->get_args ( 'receivedInputDate' ) : date ( "Y-m-d H:i:s" );
+		$amountTrain = $this->get_args ( 'paymentAuthCode' )  ? $this->get_args ( 'paymentAuthCode' ) : '';
+		
+		if ( empty ( $receivedBank )) {
+			die ( 'illegal request--Bank' );
+		}
+		
+		
+		/*
 		$expensesType = $this->get_args ( 'expensesType' ) ? $this->get_args ( 'expensesType' ) : "";
 		$expenditureBank = $this->get_args ( 'expenditureBank' ) ? $this->get_args ( 'expenditureBank' ) : "";
 		$expenditurePrice = $this->get_args ( 'expenditurePrice' ) ? $this->get_args ( 'expenditurePrice' ) : "";
 		$expenditureRemarks = $this->get_args ( 'expenditureRemarks' ) ? $this->get_args ( 'expenditureRemarks' ) : "";
 		$expenditureInputDate = $this->get_args ( 'expenditureInputDate' ) ? $this->get_args ( 'expenditureInputDate' ) : date ( "Y-m-d H:i:s" );
-		
-		$receivedBank = $this->get_args ( 'receivedBank' ) ? $this->get_args ( 'receivedBank' ) : "";
 		$receivedPrice = $this->get_args ( 'receivedPrice' ) ? $this->get_args ( 'receivedPrice' ) : "";
-		$receivedRemarks = $this->get_args ( 'receivedRemarks' ) ? $this->get_args ( 'receivedRemarks' ) : "";
-		$receivedInputDate = $this->get_args ( 'receivedInputDate' ) ? $this->get_args ( 'receivedInputDate' ) : date ( "Y-m-d H:i:s" );
-
-        $expenditurePrice=str_replace(',','',$expenditurePrice);
-        $receivedPrice=str_replace(',','',$receivedPrice);
-
-        if (empty ( $expenditureBank ) || empty ( $receivedBank )) {
+		
+		if (empty ( $expenditureBank ) || empty ( $receivedBank )) {
 			die ( 'illegal request--Bank' );
 		}
-
+        $expenditurePrice=str_replace(',','',$expenditurePrice);
+        $receivedPrice=str_replace(',','',$receivedPrice);
         if ($expensesType == "INCOME") {
             if(!is_numeric($receivedPrice)){
                 die ( 'illegal request--receivedPrice' );
@@ -2143,6 +2302,7 @@ class ReceiptExtendController extends DooController {
                 die ( 'illegal request--expenditurePrice' );
             }
         }
+        */
 
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
@@ -2155,8 +2315,10 @@ class ReceiptExtendController extends DooController {
 		if (empty ( $detail )) {
 			die ( 'illegal request--noData' );
 		}
+		$amount=$detail['amount'];
 		
 		$accountType = '';
+		/*
 		if ($detail ['Rtype'] == 1) {
 			if (! empty ( $detail ['accountItem'] ))
 				$accountType = 2;
@@ -2169,7 +2331,60 @@ class ReceiptExtendController extends DooController {
 		} elseif ($detail ['Rtype'] == 3) {
 			$accountType = 12;
 		}
+		*/
+		
+		if ($detail ['Rtype'] == 0) {
+			$accountType = 3;
+			$expensesType='EXPENDITURE';
+		} elseif ($detail ['Rtype'] == 1) {
+			if (! empty ( $rinfo ['accountItem'] )){
+				$accountType = 2;
+				if ($amount>=0){
+					$expensesType='EXPENDITURE';
+				}else{
+					$expensesType='INCOME';
+				}
+			}else{
+				$accountType = 1;
+				$expensesType='EXPENDITURE';
+			}
+		} elseif ($detail ['Rtype'] == 2) {
+			$accountType = 4;
+			$expensesType='EXPENDITURE';
+		} elseif ($detail ['Rtype'] == 3) {//培训班结算 收支类型
+			$accountType = 12;
+			Doo::loadClass ( 'authcode.func' );
+			$amountTrain=authcode($amountTrain);
+			if(!is_numeric ( $amountTrain )) {
+				die('illegal request--payType');
+			}
+			
+			if($amountTrain>=0){
+				$expensesType='INCOME';
+			}else{
+				$expensesType='EXPENDITURE';
+			}
+			$amount=$amountTrain;
+		}
+		
+		//汇款金额正数
+		$amount=abs($amount);
+		//$accountType = 12;
+		$accountBank = $receivedBank;
+		$inputDate = $receivedInputDate;
+		if ($expensesType == "INCOME") {
+			$expensesTypeWaste = 1;
+			$accountPriceShow = $accountPrice = $amount;
+		} elseif ($expensesType == "EXPENDITURE") {
+			$expensesTypeWaste = 2;
+			$accountPriceShow = $amount;
+			$accountPrice = - $amount;
+		} else {
+			die ( 'illegal request--expensesType' );
+		}
+		
 		
+		/*
 		$accountPriceShow = $accountPrice = 0;
 		$expensesTypeWaste = 0;
 		$accountBank = '';
@@ -2189,22 +2404,24 @@ class ReceiptExtendController extends DooController {
 		} else {
 			die ( 'illegal request--expensesType' );
 		}
+		*/
 		
 		$receipt = new receipt ();
-		$receipt->amount = $accountPriceShow;
+		$receipt->amount = $accountPrice;
 		$receipt->update ( array (
 				'where' => 'rid=' . $rid 
 		) );
 		
+		
 		// 更新借款汇款金额
 		if ($accountType == 1) {
 			Doo::loadModel ( 'loanReceipt' );
 			$loanReceipt = new loanReceipt ();
-			$loanReceipt->amount = $accountPriceShow;
+			$loanReceipt->amount = $accountPrice;
 			
 			$loanReceipt->update ( array (
 					'where' => ' rid = ' . $detail ['loanRid'] 
-			) );
+			));
 		}
 		
 		// 公司流水记录

+ 5 - 4
protected/model/company.php

@@ -48,16 +48,17 @@ class company extends DooModel {
 		if($isadmin!=0){
 			if($tagSQL){
 				$sql = "select b.cid,a.tag,b.companyname,b.nature,b.local,b.fax,b.webservice,b.position,b.office,b.address,b.ride,b.district,b.landmarks from CLD_tagCompanyNexus as a left join CLD_company as b on (a.company=b.cid )  where ".$district." limit ".$page.','.$size ;
-		    	
+
 				$query = Doo::db ()->query ( $sql );
 				$result = $query->fetchAll ();
 				
-			}else
-				$result= $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where'=>$district,'limit'=>$page.','.$size, 'asArray' => TRUE ) );
+			}else{
+                $result= $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where'=>$district,'limit'=>$page.','.$size, 'asArray' => TRUE ) );
+            }
 		}else{//"staffid= '".$sid."' and ".
 			$result= $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where' => $district, 'limit'=>$page.','.$size, 'asArray' => TRUE ) );
 		}
-		
+
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		foreach ($result as $key=>$value){

+ 5 - 0
protected/model/district.php

@@ -79,6 +79,11 @@ class district extends DooModel {
     
 	public function get_lvByid($lv,$id) {
         $archive_list = $this->find(array( 'asc' => 'id','where'=>' upid='.$id,  'asArray' => true));
+        Doo::loadClass ( 'XDeode' );
+        $XDeode = new XDeode ( 5 );
+        foreach ($archive_list as $key=>$value){
+            $archive_list[$key]['idKey']=$XDeode->encode($value['id']);
+        }
         return $archive_list;
     }
     

+ 2 - 2
protected/model/longle.php

@@ -56,9 +56,9 @@ class longle extends DooModel {
 				//echo $str.$str2.$str3.$str4;
 				
 //			'select * form CLD_longle as a left join CLD_client as b on (a.clientid =b.cid) where ( status=3 or statuslog like "%3%" ) and make_day like "%2015%" and cid =10';
-			return $this->find ( array ('where' => $str.$str2.$str3.$str4.$str5, 'asArray' => TRUE ) );
+			return $this->find ( array ('where' => $str.$str2.$str3.$str4.$str5, 'desc'=>'make_day', 'asArray' => TRUE ) );
 		}else{
-			return $this->find ( array ('where' => " key_num like '%".$search."%'", 'asArray' => TRUE ) );
+			return $this->find ( array ('where' => " key_num like '%".$search."%'",'desc'=>'make_day', 'asArray' => TRUE ) );
 		}
 	}
 	

+ 2 - 0
protected/model/wasteBook.php

@@ -15,6 +15,7 @@ class wasteBook extends DooModel {
 	public $dailyExpenditureType;
 	public $inputDate;
 	public $dataID;
+	public $remarks;
 	
 	public $accountPriceShow;
 	
@@ -37,6 +38,7 @@ class wasteBook extends DooModel {
 			'dailyExpenditureType',
 			'inputDate' ,
 			'dataID',
+			'remarks',
 			
 			'accountPriceShow',
 	);

+ 31 - 1
protected/view/admin/expenses.html

@@ -55,7 +55,11 @@
 	  		<div class="saeaList">
 				<div class="entry">
 					<table class="table table-bordered table-condensed">
-						<thead><tr><th width="100" class="taC">费用类型</th><th width="100" class="taC">费用金额</th><th width="120" class="taC">费用所在办事处</th><th width="120" class="taC">费用单号</th><th class="taC">费用说明</th><th width="100" class="taC">状态</th><th width="80" class="taC">操作</th></tr></thead>
+						<thead><tr><th width="100" class="taC">费用类型</th>
+						<th width="100" class="taC">费用金额</th>
+						<th width="100" class="taC">结算费用</th>
+						<th width="120" class="taC">费用所在办事处</th>
+						<th width="120" class="taC">费用单号</th><th class="taC">费用说明</th><th width="100" class="taC">状态</th><th width="80" class="taC">操作</th></tr></thead>
 						<tbody>
 						<!-- loop receiptList -->
 						<tr>
@@ -77,6 +81,32 @@
 			  					¥{{receiptList' value.loanSum}}</b>
 			  				<!-- endif -->
 							</td>
+							
+							<td class="taR">
+										<!-- if {{receiptList' value.Rtype}}==2||{{receiptList' value.Rtype}}==0 --> 
+							<span class="colGreen">收入</span>¥{{receiptList' value.sum}}
+							<!-- else -->
+								<!-- if {{receiptList' value.Rtype}}==1 -->
+									<!-- if {{receiptList' value.balance}}>=0 -->
+									<span class="colGreen">收入</span>
+									<!-- else -->
+									<span class="colRed">支出</span>
+									<!-- endif -->
+									¥{{receiptList' value.balanceABS}}
+								<!-- elseif {{receiptList' value.Rtype}}==3 -->
+									<!-- if {{receiptList' value.payment}}<=0 -->
+									<span class="colGreen">收入</span>
+									<!-- else -->
+									<span class="colRed">支出</span>
+									<!-- endif -->
+									¥{{receiptList' value.paymentABS}}
+								<!-- endif -->
+							
+							<!-- endif -->
+										
+										</td>
+							
+							
 							<td>{{receiptList' value.category}}</td>
 							<td>{{receiptList' value.receiptOrder}}<p class="colGray">{{receiptList' value.date}}</p></td>
 							<td>{{receiptList' value.explanation}}</td>

+ 4 - 0
protected/view/admin/expensesCollect.html

@@ -17,6 +17,8 @@
 					<!-- include 'receipt_menu' -->
 				</div>
 			</div>
+			<div class="borad-news">
+			
 			<div class="adminContent autoHeight" style="height: 821px;">
 				<legend><div class="fR"></div>以下是您的费用详情</legend>
 				
@@ -572,6 +574,8 @@
 			</div>
 				
 			</div>
+		
+		</div>
 		</div>
 	</div>
 <script type="text/javascript">autoFlashHeight();</script>

+ 50 - 11
protected/view/admin/hisImplement.html

@@ -84,7 +84,13 @@
 	  		<div class="saeaList">
 				<div class="entry">
 					<table class="table table-bordered table-condensed">
-						<thead><tr><th width="54" >上报人</th><th width="100" class="taC">费用类型</th><th width="100" class="taC">费用金额</th><th width="120" class="taC">费用所在办事处</th><th width="120" class="taC">费用单号</th><th class="taC">费用说明</th><th width="100" class="taC">状态</th><th width="80" class="taC">操作</th></tr></thead>
+						<thead><tr><th width="54" >上报人</th>
+						<th width="100" class="taC">费用类型</th>
+						<th width="100" class="taC">费用金额</th>
+						<th width="100" class="taC">结算费用</th>
+						<th width="120" class="taC">费用所在办事处</th>
+						<th width="120" class="taC">费用单号</th>
+						<th class="taC">费用说明</th><th width="100" class="taC">状态</th><th width="80" class="taC">操作</th></tr></thead>
 						<tbody>
 						<!-- loop receiptList -->
 						<!-- if {{item}}=="pendImplement" -->
@@ -110,6 +116,9 @@
 			  					¥{{receiptList' value.loanSum}}</b>
 			  				<!-- endif -->
 							</td>
+							
+							<td></td>
+							
 							<td>{{receiptList' value.category}}</td>
 							<td>{{receiptList' value.receiptOrder}}<p class="colGray">{{receiptDetail' value.date}}</p></td>
 							<td>{{receiptList' value.explanation}}</td>
@@ -173,6 +182,32 @@
 			  					¥{{receiptList' value.loanSum}}</b>
 			  				<!-- endif -->
 							</td>
+							
+							<td>
+							<!-- if {{receiptList' value.Rtype}}==2||{{receiptList' value.Rtype}}==0 --> 
+							<span class="colRed">支出</span>¥{{receiptList' value.sum}}
+							<!-- else -->
+								<!-- if {{receiptList' value.Rtype}}==1 -->
+									<!-- if {{receiptList' value.relust}}>=0 -->
+									<span class="colRed">支出</span>
+									<!-- else -->
+									<span class="colGreen">收入</span>
+									<!-- endif -->
+									¥{{receiptList' value.relustABS}}
+								<!-- elseif {{receiptList' value.Rtype}}==3 -->
+									<!-- if {{receiptList' value.payment}}<=0 -->
+									<span class="colRed">支出</span>
+									<!-- else -->
+									<span class="colGreen">收入</span>
+									<!-- endif -->
+									¥{{receiptList' value.paymentABS}}
+								<!-- endif -->
+							
+							<!-- endif -->
+							
+							
+							</td>
+							
 							<td>{{receiptList' value.category}}</td>
 							<td>{{receiptList' value.receiptOrder}}<p class="colGray">{{receiptDetail' value.date}}</p></td>
 							<td>{{receiptList' value.explanation}}</td>
@@ -201,19 +236,23 @@
 							
 							</td>
 							<td>
+							<!-- if {{receiptList' value.Texe}}=='true'&&{{receiptList' value.TRexe}}=='true'&&({{receiptList' value.status}}==1 || {{receiptList' value.status}}==6) -->
+								<!-- if {{receiptList' value.Rtype}}==3 -->
+									<a href="/receiptTrain/implement/{{receiptList' value.ridKey7}}.html" class="button" target="_blank">去执行</a>
+								<!-- elseif {{receiptList' value.Rtype}}==1 -->	
+									<a href="/implement/loan/{{receiptList' value.ridKey}}.html" class="button" target="_blank">去执行</a>
+								<!-- elseif {{receiptList' value.Rtype}}==0 -->	
+									<a href="/implement/receipt/{{receiptList' value.ridKey}}.html" class="button" target="_blank">去执行</a>
+								<!-- elseif {{receiptList' value.Rtype}}==2 -->	
+								<a href="/implement/public/{{receiptList' value.ridKey}}.html" class="button" target="_blank">去执行</a>
+								<!-- endif -->
 							
-							<!-- if {{receiptList' value.Rtype}}==3 -->
-								<!-- if {{receiptList' value.Texe}}=='true'&&{{receiptList' value.TRexe}}=='true'&&({{receiptList' value.status}}==1 || {{receiptList' value.status}}==6) -->
-								<a href="/receiptTrain/implement/{{receiptList' value.ridKey7}}.html" class="button" target="_blank">去执行</a>
+							<!-- else -->
+								<!-- if {{receiptList' value.Rtype}}==3 -->
+									<a href="/receiptTrain/implement/{{receiptList' value.ridKey7}}.html"  target="_blank">详情</a>
 								<!-- else -->
-								<a href="/receiptTrain/implement/{{receiptList' value.ridKey7}}.html"  target="_blank">详情</a>
+									<a href="/expensesDoc/{{receiptList' value.rid}}" target="_blank">详情</a>
 								<!-- endif -->
-							<!-- else -->
-							<!-- if {{receiptList' value.Texe}}=='true'&&{{receiptList' value.TRexe}}=='true'&&({{receiptList' value.status}}==1 || {{receiptList' value.status}}==6) -->
-								<a href="/implement/{{receiptList' value.ridKey}}.html" class="button" target="_blank">去执行</a>
-							<!-- else -->
-							<a href="/expensesDoc/{{receiptList' value.rid}}" target="_blank">详情</a>
-							<!-- endif -->
 							<!-- endif -->
 							</td>
 						</tr>

+ 20 - 10
protected/view/admin/implement.html

@@ -172,7 +172,8 @@
 	  						<td class="taR"><b>本次报销金额</b></td>
 	  						<td class="colGreed taR"><b style="font-size:24px">¥{{receiptDetail' value.sum}}</b><br>{{receiptDetail' value.sumCN}}</td>
 	  						</tr>
-	  						<tr <!-- if {{receiptDetail' value.relust}}>=0 --> class="success" <!-- else --> class="error" <!-- endif --> ><td class="taR"><b>差额</b></td>
+	  						<tr <!-- if {{receiptDetail' value.relust}}>=0 --> class="success" <!-- else --> class="error" <!-- endif --> >
+	  						<td class="taR"><span class="colGray">报销 - 借款 = </span><b>差额</b></td>
 	  						<td class="taR"><b style="font-size:24px">¥{{receiptDetail' value.relust}}</b><br>{{receiptDetail' value.relustCN}}</td></tr>
 	  						</tbody>
 	  					</table>
@@ -256,7 +257,7 @@
 								</td>
 								</tr>
 								
-								<tr><th>汇款金额</th><td class="taR" width="220">¥{{receiptDetail' value.amount}}
+								<tr><th>汇款金额</th><td class="taR" width="220">¥{{receiptDetail' value.amountABS}}
 									
 								</td></tr>
 								
@@ -279,6 +280,17 @@
 									<option value="PersonalDeposit">个人广发</option>
 									</select>
 								</td></tr>
+									
+									<tr>
+							<th >录入时间</th>
+							<td><input class="datepicker-here span3" name="inputDate" value='{{inputDate}}' placeholder="按时间筛选" type="text" data-timepicker="true" data-language="zh" data-time-format="hh:ii:00"></td>
+						</tr>
+										
+										<tr>
+							<th >备注</th>
+							<td><textarea name="remarks"></textarea></td>
+						</tr>
+						
 										
 								</tbody>
 								</table>
@@ -302,6 +314,10 @@
 										</td></tr>
 										<tr><th>提交人</th><td class="taR" width="220">
 										{{wbDetail.category}}-{{wbDetail.name}}</td></tr>
+										<tr>
+							<th >录入时间</th>
+							<td class="taR">{{inputDate}}</td>
+						</tr>
 										<tr><th>备注</th><td class="taR" width="220">{{wbDetail.remarks}}
 										</td></tr>
 										</tbody>
@@ -371,19 +387,13 @@
 			  							</div>
 			  							<!-- endif -->
 										
-										
-										
-										
-										
 									</li>
 								<!-- endloop -->
 	  						
 	  					</ul>
 	  					<!-- if {{receiptDetail' value.button2}}==1 -->
-	  					<div class="reportButton">
-								
-							<a href="javascript:void(0)" onClick="setExeReceipt('Loan',{{receiptList' value.rid}})" class="buttonDone buttonBlock">执行完成</a>
-	  					</div>
+	  				
+	  					
 	  					<!-- endif -->
 	  					</form>
 	  					</div>

+ 24 - 4
protected/view/admin/invoiceAdd.html

@@ -11,7 +11,15 @@
 
 <script>
 $(function() {
-	
+
+	$('a[tianyancha]').click(function() {
+		var tianyancha=$("#tianyancha").val();
+		window.open("https://www.tianyancha.com/search?key="+tianyancha);
+	});
+
+
+
+
 $('input[amount]').keyup(function() {
 	var invoiceQuantity=$('#invoiceQuantity').val();
 	var invoiceUnitPrice=$('#invoiceUnitPrice').val();
@@ -357,7 +365,8 @@ $("input[autoIFBTIN]").autocomplete({
 									<th class="taC"><span class="colRed"></span>银行账号</th>
 									<td><input type="text" name="bankAccountT" id="bankAccountT"></td>
 								</tr>
-								
+
+
 								
 								</tbody>
 							</table>
@@ -385,10 +394,21 @@ $("input[autoIFBTIN]").autocomplete({
 									<th class="taC"><span class="colRed">*</span>银行账号</th>
 									<td><input type="text" name="bankAccount" id="bankAccount"></td>
 								</tr>
+
 								</tbody>
 							</table>
-							
-							
+
+							<table class="table table-bordered table-condensed" style="margin-top: -21px;">
+							<tr>
+								<td colspan="4" class="taC"><img src="<?= WEB_SITE_GLOBAL ?>/images/tianyancha.png">
+									<div class="input-append" style="margin:0">
+
+										<input class="span3" type="text" id="tianyancha" value="">
+										<a class="btn btn-small btn-primary" tianyancha href="javascript:void(0)" target="_blank">天眼一下</a>
+									</div>
+								</td>
+							</table>
+
 						<table class="table table-bordered table-condensed">
 								
 								<tr>

+ 19 - 2
protected/view/admin/invoiceAddFill.html

@@ -12,6 +12,11 @@
 
 <script>
 $(function() {
+
+	$('a[tianyancha]').click(function() {
+		var tianyancha=$("#tianyancha").val();
+		window.open("https://www.tianyancha.com/search?key="+tianyancha);
+	});
 $('button[invoiceDetalfn]').click(function() {
 	
 	var cid=$('#cid option:selected').html();
@@ -307,7 +312,7 @@ $("input[autoIFBTIN]").autocomplete({
 									<th class="taC"><span class="colRed"></span>银行账号</th>
 									<td><input type="text" name="bankAccountT" id="bankAccountT" value="{{invoiceDetail.bankAccount}}"></td>
 								</tr>
-								
+
 								</tbody>
 							</table>
 							
@@ -337,7 +342,19 @@ $("input[autoIFBTIN]").autocomplete({
 								</tr>
 								</tbody>
 							</table>
-							
+							<table class="table table-bordered table-condensed" style="margin-top: -21px;">
+								<tr>
+									<td colspan="4" class="taC"><img src="<?= WEB_SITE_GLOBAL ?>/images/tianyancha.png">
+										<div class="input-append" style="margin:0">
+											<!-- if !empty({{invoiceDetail.invoiceCompany}}) -->
+											<input class="span3" type="text" id="tianyancha" value="{{invoiceDetail.invoiceCompany}}">
+											<!-- else -->
+											<input class="span3" type="text" id="tianyancha" value="{{invoiceDetail.invoiceTitle}}">
+											<!-- endif -->
+											<a class="btn btn-small btn-primary" tianyancha href="javascript:void(0)" target="_blank">天眼一下</a>
+										</div>
+									</td>
+							</table>
 							
 						<table class="table table-bordered table-condensed">
 								

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

@@ -327,7 +327,7 @@
 				</tr>
 				<tr><th>汇款金额</th><td class="taR" width="200">¥
 				<!-- if {{receiptList' value.Rtype}}==1 -->
-				{{receiptDetail' value.relust}}
+				{{receiptDetail' value.relustABS}}
 				<!-- else -->
 				{{receiptDetail' value.sum}}
 				<!-- endif -->

+ 8 - 0
protected/view/admin/remitAdd.html

@@ -22,7 +22,11 @@
 					</ul>
 				</div>
 			</div>
+			
+			
+			
 			<div class="adminContent autoHeight" style="height: 821px;">
+			<div class="borad-news">
 				<legend><div class="fR"></div>申请对公汇款</legend>
 	  		<div class="saeaList">
 	  			<div class="entry public-list">
@@ -163,7 +167,11 @@
 	  				</div>
 	  			</div>
 			</div>
+		
 		</div>
+		</div>
+	
+	
 	</div>
 	<!--弹出-->
 <div class="modal hide fade" id="addCallout">

+ 11 - 0
protected/view/admin/saeaLoanAdd.html

@@ -20,7 +20,11 @@
 					<!-- include 'receipt_menu' -->
 				</div>
 			</div>
+			
+			
+			
 			<div class="adminContent autoHeight" style="height: 821px;">
+			<div class="borad-news">
 				<legend><div class="fR"></div>申请借款</legend>
 	  		<div class="saeaList">
 	  		<form action="/saeaLoanAddDo" name="recepitAdd" method="post">
@@ -110,7 +114,14 @@
 	  			</div>
 	  			</form>
 			</div>
+		
 		</div>
+		</div>
+	
+	
+	
+	
+	
 	</div>
 <script type="text/javascript">autoFlashHeight();</script>	
 </body>

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

@@ -198,6 +198,7 @@
 								<th>选择审批组</th>
 								<td class="taR">
 								<select name="verify">
+								<option value="">请选择审批组</option>
 								<!-- loop veList -->
 								<option value="{{veList' value.vid}}" >{{veList' value.description}}(
 								{{veList' value.staff}}

+ 8 - 0
protected/view/admin/saea_create.html

@@ -46,7 +46,11 @@
 					</ul>
 				</div>
 			</div>
+			
+			
 			<div class="adminContent autoHeight" style="height: 821px;">
+			<div class="borad-news">
+			
 				<legend><div class="fR"></div>创建报销单</legend>
 	  		<div class="saeaList">
 	  			<div class="entry receipt-list">
@@ -219,7 +223,11 @@
 	  				</div>
 	  			</div>
 			</div>
+		
+		</div>
 		</div>
+	
+	
 	</div>
 	<!--弹出-->
 <div class="modal hide fade" id="addCallout">

+ 6 - 2
protected/view/contacts_client.html

@@ -283,7 +283,7 @@
 				</div>
 				<div  style="display:none;" id="addClient">
 					<form name="adcl" id="adcl" action="/addClient" method="post" >
-						
+						<input type="hidden" name="token" value="{{token}}">
 						<div class="contactInfo">
 				  			<div class="contactPanel">
 				  				<div class="bsAlert bsInfo"><b>添加新客户</b>前,可先搜索是否有其他同事已经添加了该客户。</div>
@@ -354,7 +354,11 @@
 				  					<tr><th>乘车路线</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写出差至该单位的乘车路线" ><input type="text" name="ride"></span></td></tr>
 				  					<tr><th>地标建筑</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写单位附近比较显眼的地标建筑等" ><input type="text" name="landmarks"></span></td></tr>
 				  					<tr><th>参考住宿</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写可供选择的出差住宿方式"><input type="text" name="stay"></span></td></tr>
-				  					<tr><td colspan="4"><input type="button" onclick="checkadcl()" value="确定" class="button"></input><span id="admsg"></span></td></tr>
+				  					<tr ><td colspan="4" >
+
+										<input  type="button" onclick="checkadcl()" value="确定" class="button"><label id="akdmsg"></label>
+									</td>
+									</tr>
 				  				</tbody></table>
 				  			</div>
 				  			<!--添加前提示-->

+ 1 - 1
protected/view/contacts_company.html

@@ -55,7 +55,7 @@ function deleteTagCompany(tid,cid,obj){
 				<a href="/contacts">我的客户</a><a href="/mycompany" class="now">我的单位</a><a href="/communication" >内部通讯</a>
 				<div class="searchItem">
 				<form action="/searchMyCompany" method="post">
-				<input type="text" name="search" placeholder="输入姓名或单位名称进行搜索"><input type="submit" value="搜索" class="subBtn">
+				<input type="text" name="search" value="{{search}}" placeholder="输入单位名称进行搜索"><input type="submit" value="搜索" class="subBtn">
 				</form>
 				</div>
 				<div class="tabButton">

+ 15 - 10
protected/view/mail_create.html

@@ -1,5 +1,5 @@
  <!-- include 'admin/header' -->
-<script src="<?= WEB_SITE_GLOBAL ?>js/email.js"></script>
+<script src="<?= email ?>"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>js/ueditor/ueditor.config.js"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>js/ueditor/ueditor.all.js"></script>
 
@@ -348,16 +348,21 @@
 			  				
 			  				<ul class="cateList">
 				              <li>
-				              	
-				             
-			  				
-			  				<select name="did" >
+			  				<select name="did" node-city >
 			  				<!-- loop districtList -->
-					    						    		<option value="{{districtList' value.id}}">{{districtList' value.name}}</option>
-					    						    <!-- endloop -->
-					    						    		
-					    						    	</select>
-					    						    </li>
+								<option value="{{districtList' value.id}}">{{districtList' value.name}}</option>
+							<!-- endloop -->
+							</select>
+
+							 <select name="didCity" city >
+								 <option value="ALL">全部</option>
+							 <!-- loop districtlv2List -->
+							 <option value="{{districtList' value.id}}">{{districtList' value.name}}</option>
+							 <!-- endloop -->
+							 </select>
+
+					    	</li>
+
 				              <li>
 				              
 			  				<!-- loop nature -->

+ 58 - 5
protected/view/receipt/receiptTrain.html

@@ -321,7 +321,10 @@ $(function() {
 								<tr><th colspan="2" class="taC">确认汇款金额</th></tr>
 								<tr><th>汇款金额(用于生成汇款单)</th>
 								<td class="taR" width="200">
-								¥<input data="{{receiptDetail.ridKey}}" receiptAmount value='{{receiptDetail.amount}}' placeholder="输入汇款金额" pattern="[0-9]" step="1" min="0" class="span2" type="number">
+								¥{{payment}}
+								<!-- 
+								<input data="{{receiptDetail.ridKey}}" receiptAmount value='{{receiptDetail.amount}}' placeholder="输入汇款金额" pattern="[0-9]" step="1" min="0" class="span2" type="number">
+								 -->
 								</td>
 								</tr>
 							</tbody>
@@ -331,22 +334,39 @@ $(function() {
 						<!-- if {{showType}}=='implement'&&inarray({{staff.0.sid}},{{executeId}}) -->
 						<form action="/receiptTrainImplementWateDo"  method="post" class="nice-validator n-yellow" novalidate="novalidate">
 						<input type="hidden" name="ridKey" value="{{receiptDetail.ridKey}}">
-						
+						<input type="hidden" name="amount" value="{{paymentAuthCode}}">
 						<table class="table table-bordered table-condensed table-hover">
 							<tbody>
 								<tr><th colspan="2" class="taC">确认汇款金额</th></tr>
+								
+								<tr><th>结算结果<br><span class="colGray">("支出"由公司汇出,"收入"提交人需汇款至公司。)</span></th>
+				<td class="taR" width="200">
+				
+					<!-- if {{payment}}>=0 -->
+					<span class="colGreen">收入</span>
+					<!-- else -->
+					<span class="colRed">支出</span>
+					<!-- endif -->
+				
+				
+				
+				</td>
+				</tr>
+					<tr><th>汇款金额(用于生成汇款单)</th><td class="taR" width="220">¥
+				{{paymentAbs}}
+					</td></tr>			
+								<!-- 
 								<tr><th>汇款金额(用于生成汇款单)</th><td class="taR" width="220">¥
-									<input name='amount' placeholder="输入汇款金额" pattern="[0-9]" step="1" min="0" class="span2" type="number">
+									<input name='amount' placeholder= "输入汇款金额" pattern="[0-9]" step="1" min="0" class="span2" type="number">
 								</td></tr>
 								<tr><th>流水类型("支出"由公司汇出,"收入"提交人汇款至公司。)</th>
 								<td class="taR" width="200">
-								
 								<select name="expensesType" >
 									<option value="INCOME">收入</option>
 									<option value="EXPENDITURE">支出</option>
 								</select>
-								
 								</td></tr>
+								 -->
 										
 								<tr><th>银行</th>
 								<td class="taR" width="200">
@@ -358,6 +378,19 @@ $(function() {
 									</select>
 								</td></tr>
 										
+										
+									<tr>
+							<th >录入时间</th>
+							<td><input class="datepicker-here span3" name="inputDate" value='{{inputDate}}' placeholder="按时间筛选" type="text" data-timepicker="true" data-language="zh" data-time-format="hh:ii:00"></td>
+						</tr>
+										
+										<tr>
+							<th >备注</th>
+							<td><textarea name="remarks"></textarea></td>
+						</tr>	
+										
+										
+										
 								</tbody>
 								</table>
 								<p class="taR"><input class="button" type="submit" value="确定生成流水"></p>
@@ -383,8 +416,28 @@ $(function() {
 										</td></tr>
 										<tr><th>汇款金额</th><td class="taR" width="220">¥{{wbDetail.accountPriceShow}}
 										</td></tr>
+										<tr>
+							<th >银行</th>
+							<td class="taR">
+							<!-- if {{wbDetail.accountBank}}=='CGBDeposit' -->
+							纵横广发
+							<!-- elseif {{wbDetail.accountBank}}=='ICBCDeposit' -->
+							纵横工行
+							<!-- elseif {{wbDetail.accountBank}}=='HUADeposit' -->
+							华润银行
+							<!-- elseif {{wbDetail.accountBank}}=='PersonalDeposit' -->
+							个人广发
+							<!-- endif -->
+
+		</td>
+						</tr>
 										<tr><th>提交人</th><td class="taR" width="220">
 										{{wbDetail.category}}-{{wbDetail.name}}</td></tr>
+										<tr>
+							<th >录入时间</th>
+							<td  class="taR">
+							{{wbDetail.inputDate}}</td>
+						</tr>
 										<tr><th>备注</th><td class="taR" width="220">{{wbDetail.remarks}}
 										</td></tr>
 										</tbody>

+ 70 - 2
protected/view/receipt/receiptTrainImplement.html

@@ -131,11 +131,79 @@ function receiptTrainApprovalBackDo(ridKey){
 			  								<p class="colGray">{{executeList' value.1}}(费用执行)</p>
 			  								<p><textarea name="opinion" id="opinion_{{receiptList' value.rid}}" placeholder="填写审批意见(可选)"></textarea></p>
 			  								<!-- if {{button2}}==1 -->
+			  								
+			  								
+			  								
+			  								
+			  								
+			  								<div class="reportButton">
+	  					<!-- if empty({{wbDetail}}) -->
+	  					
+	  					<!-- if {{lastOne}} -->
+	  					<div class="modal fade" id="confirm2">
+	<div class="modal-dialog">
+		<div class="modal-content">
+		    <div class="modal-header">
+		    	<h3>该费用未生成流水</h3>
+		    </div>
+		    <div class="modal-body saeaList">
+		    	<p>请生成流水后继续执行。</p>
+		    </div>
+			<div class="modal-footer">
+				<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+			</div>
+		</div>
+	</div>
+</div>
+	<div class="invoButton clearfix">
+	  	<a  href="#confirm2"  data-toggle="modal"  class="buttonDone buttonBlock">执行完成</a>	
+	  					</div>
+	  					<!-- else -->
+	  					
+	  					<div class="modal fade" id="confirm1">
+		<div class="modal-dialog">
+			<div class="modal-content">
+			    <div class="modal-header">
+			    	<h3>该费用未生成流水</h3>
+			    </div>
+			    <div class="modal-body saeaList">
+			    	<p>该费用有多个执行人,请确认是否需要生成流水;</p>
+			    	<p>若您不生成流水,将由其他执行人生成。</p>
+			    </div>
+				<div class="modal-footer">
+				<input type="submit" value="确认执行(不生成流水)" class="button buttonDone buttonBlock" >
+					
+					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a>
+				</div>
+			</div>
+		</div>
+	</div>
+	
+	
+	<div class="invoButton clearfix">
+	  			<a  href="#confirm1"  data-toggle="modal"  class="buttonDone buttonBlock">执行完成</a>		
+	  			</div>	
+	  					<!-- endif -->
+	  					
+	  					
+	  					<!-- else -->
 	  					<div class="invoButton clearfix">
 	  					<input type="submit" class="buttonDone buttonBlock" value="执行完成">
+	  					</div>	
+	  					
+<!-- endif -->
+			  								
+			  								
+			  								
+			  								
+			  								
+			  								
+						  				
 											
-										</div>
-							<!-- endif -->
+											
+											
+											
+											<!-- endif -->
 			  							</div>
 			  							<!-- else -->
 			  							

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

@@ -105,7 +105,8 @@ $(function() {
 										<td>{{RItemList' value.describe}}</td>
 										<td>{{RItemList' value.creater}}/{{RItemList' value.creatDate}}</td>
 										<td>
-										<!-- if {{showType}}=='approval'&&inarray({{staff.0.sid}},{{verifyId}})&&{{receiptDetail.status}}==2||{{receiptDetail.status}}==4||{{receiptDetail.status}}==5||{{receiptDetail.status}}==1 -->
+										<!-- if {{showType}}=='approval' -->
+										<!-- if inarray({{staff.0.sid}},{{verifyId}})&&{{receiptDetail.status}}==2||{{receiptDetail.status}}==4||{{receiptDetail.status}}==5||{{receiptDetail.status}}==1 -->
 										<!-- if {{RItemList' value.creater}}=={{staff.0.username}}||{{RItemList' value.createrId}}=={{staff.0.sid}} -->
 				<!-- if {{RItemList' value.payType}}==1 -->						
 <a href="#edi-expenses" ediItem data='["{{RItemList' value.date}}","{{RItemList' value.item}}","{{RItemList' value.price}}","{{RItemList' value.inputer}}"]' 
@@ -118,6 +119,7 @@ ridKey="{{receiptDetail.ridKey}}" data-toggle="modal" >编辑</a>
 									
 										<!-- endif -->
 										<!-- endif -->
+										<!-- endif -->
 										</td>
 									</tr>
 									<!-- endloop -->

+ 39 - 4
protected/view/receipt/receiptWasteBook.html

@@ -55,7 +55,13 @@ $('select[expensesType]').change(function() {
 									<legend><div class="fR"></div>需要您处理</legend>
 									<table class="table table-bordered table-condensed">
 										<tbody>
-										<tr><th class="taC" width="140">费用类型</th><th class="taC">单号</th><th class="taC">金额</th><th class="taC">汇款金额</th><th class="taC">状态</th><th class="taC">操作</th></tr>
+										<tr><th class="taC" width="140">费用类型</th>
+										<th class="taC">单号</th>
+										<th class="taC">金额</th>
+										<th class="taC">汇款金额</th>
+										<th class="taC">结算费用</th>
+										<th class="taC">状态</th>
+										<th class="taC">操作</th></tr>
 										<!-- loop receiptList -->
 										<tr>
 										<th>
@@ -87,17 +93,44 @@ $('select[expensesType]').change(function() {
 										
 										</td>
 										<td class="taR">¥{{receiptList' value.sum}}</td>
+										
 										<td class="taR">¥
 										<!-- if {{receiptList' value.Rtype}}==1 -->
 											<!-- if {{receiptList' value.isBK}}==1 -->
-											{{receiptList' value.balance}}
+											{{receiptList' value.balanceABS}}
 											<!-- else -->
-											{{receiptList' value.amount}}
+											{{receiptList' value.amountABS}}
 											<!-- endif -->
 										<!-- else -->
-										{{receiptList' value.amount}}
+										{{receiptList' value.amountABS}}
 										<!-- endif -->
 										</td>
+										
+										<td class="taR">
+										
+										<!-- if {{receiptList' value.Rtype}}==2||{{receiptList' value.Rtype}}==0 --> 
+							<span class="colRed">支出</span>¥{{receiptList' value.sum}}
+							<!-- else -->
+								<!-- if {{receiptList' value.Rtype}}==1 -->
+									<!-- if {{receiptList' value.balance}}>=0 -->
+									<span class="colRed">支出</span>
+									<!-- else -->
+									<span class="colGreen">收入</span>
+									<!-- endif -->
+									¥{{receiptList' value.balanceABS}}
+								<!-- elseif {{receiptList' value.Rtype}}==3 -->
+									<!-- if {{receiptList' value.payment}}<=0 -->
+									<span class="colRed">支出</span>
+									<!-- else -->
+									<span class="colGreen">收入</span>
+									<!-- endif -->
+									¥{{receiptList' value.paymentABS}}
+								<!-- endif -->
+							
+							<!-- endif -->
+										
+										</td>
+										
 										<td>
 										<!-- if {{receiptDetail' value.status}}==2 --> 
 										<span class="">审批中</span>
@@ -123,6 +156,8 @@ $('select[expensesType]').change(function() {
 		<div class="modal-content">
 		<form action="/receiptWasteBookAddDo" name="recepitAdd" method="post" class="nice-validator n-yellow" novalidate="novalidate">
 		<input type="hidden" name="ridKey" id="ridKey" value="">
+		<input type="hidden" name="paymentAuthCode" id="paymentAuthCode" value="">
+		
 		    <div class="modal-header">
 		    	<h3>生成流水</h3>
 		    </div>