Browse Source

培训班结算

caipin 6 years ago
parent
commit
471f44cf67

+ 13 - 0
global/css/global.css

@@ -99,6 +99,9 @@ a:hover,a:focus {color:#333;text-decoration:none}
 .width950{width:950px;margin:0 auto}
 h3{font-size:24px}
 a.disenable{color:#ccc}
+.datepickers-container{
+  z-index: 9999
+}
 /**/
 .clearB {clear:both}
 .fL {float:left}
@@ -334,6 +337,10 @@ table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span
 .modalClientTable .infoFlowList{
   margin-top:15px;
 }
+.table .text-truncate {
+  width:80px;
+  display: inline-block;
+}
 /*table*/
 /*tooltips*/
 .ctooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);}.ctooltip.in{opacity:0.8;filter:alpha(opacity=80);}
@@ -1508,6 +1515,12 @@ border-color: #d6e9c6;
 .contactPanel table td select{
   margin:0
 }
+.contactPanel table td .lockContent{
+  display:block;
+  overflow: auto;
+  width: 100%;
+  max-height:70px
+}
 .header .contactPanel{
   background:none;
   margin:0;

+ 38 - 21
global/js/autoTag.js

@@ -6,8 +6,10 @@ $(function() {
 	$("#tags").blur(function(){
 		
 		var url="/checkClient";
+		//var name=$(this).val();
 		
-		var name=$(this).val();
+		var name=$("#tags").attr('data-name');
+		var company=$("#tags").attr('data-company');
 		
 		$.ajax({
 			url:url,
@@ -15,7 +17,8 @@ $(function() {
 			cache: false,
 			dataType: "json",
 			data: {
-				name:name
+				name:name,
+				company:company
 			},
 			global: true,
 			success: function(data){
@@ -43,13 +46,14 @@ $(function() {
                     searchDbInforItem: request.term
                 },
                 success: function( data ) {
-                	
                     response( $.map( data, function( item ) {
                     	
                         return {
-                            name:item.clientname+"-"+item.companyname,
-                            
-                            value: item.clientname+"-"+item.companyname
+                        	name:item.clientname,
+                        	value: item.clientname+"-"+item.companyname,
+                        	company:item.companyname
+//                            name:item.clientname+"-"+item.companyname,
+//                            value: item.clientname+"-"+item.companyname
                         }
                     }));
                 }
@@ -57,7 +61,12 @@ $(function() {
         },
         minLength: 1,
         select: function( event, ui ) {
-            $("#tags").val(ui.item.dbId);
+        	$("#tags").attr('data-name',ui.item.name);
+        	$("#tags").attr('data-company',ui.item.company);
+        	$("#name").val(ui.item.name);
+        	$("#company").val(ui.item.company);
+        	//console.log(ui.item.lebal);
+            $("#tags").val(ui.item.value);
             
         }
     });
@@ -66,7 +75,8 @@ $(function() {
 		
 		var url="/checkClient";
 		
-		var name=$(this).val();
+		var name=$("#tags2").attr('data-name');
+		var company=$("#tags2").attr('data-company');
 		
 		$.ajax({
 			url:url,
@@ -74,7 +84,8 @@ $(function() {
 			cache: false,
 			dataType: "json",
 			data: {
-				name:name
+				name:name,
+				company:company
 			},
 			global: true,
 			success: function(data){
@@ -106,9 +117,9 @@ $(function() {
                     response( $.map( data, function( item ) {
                     	
                         return {
-                            name:item.clientname+"-"+item.companyname,
-                            
-                            value: item.clientname+"-"+item.companyname
+                        	name:item.clientname,
+                        	value: item.clientname+"-"+item.companyname,
+                        	company:item.companyname
                         }
                     }));
                 }
@@ -116,8 +127,10 @@ $(function() {
         },
         minLength: 1,
         select: function( event, ui ) {
-        	//var str=ui.item.dbId;console.log(str);
-        	//var str2=str.split(" ");
+        	$("#tags2").attr('data-name',ui.item.name);
+        	$("#tags2").attr('data-company',ui.item.company);
+        	$("#name").val(ui.item.name);
+        	$("#company").val(ui.item.company);
            $("#tags2").val(ui.item.dbId);
             
         }
@@ -189,7 +202,8 @@ $("#tags3").blur(function(){
 		
 		var url="/checkClient";
 		
-		var name=$(this).val();
+		var name=$("#tags4").attr('data-name');
+		var company=$("#tags4").attr('data-company');
 		
 		$.ajax({
 			url:url,
@@ -197,7 +211,8 @@ $("#tags3").blur(function(){
 			cache: false,
 			dataType: "json",
 			data: {
-				name:name
+				name:name,
+				company:company
 			},
 			global: true,
 			success: function(data){
@@ -229,9 +244,9 @@ $("#tags3").blur(function(){
                     response( $.map( data, function( item ) {
                     	
                         return {
-                            name:item.clientname+"-"+item.companyname,
-                            
-                            value: item.clientname+"-"+item.companyname
+                        	name:item.clientname,
+                        	value: item.clientname+"-"+item.companyname,
+                        	company:item.companyname
                         }
                     }));
                 }
@@ -239,8 +254,10 @@ $("#tags3").blur(function(){
         },
         minLength: 1,
         select: function( event, ui ) {
-        	//var str=ui.item.dbId;console.log(str);
-        	//var str2=str.split(" ");
+        	$("#tags4").attr('data-name',ui.item.name);
+        	$("#tags4").attr('data-company',ui.item.company);
+        	$("#name").val(ui.item.name);
+        	$("#company").val(ui.item.company);
            $("#tags4").val(ui.item.dbId);
             
         }

+ 16 - 1
global/js/index.js

@@ -108,8 +108,15 @@ function RLongMsg(){
 	
 	var longleStatus=$('input:radio[name=longleStatus]:checked').val();
 	var klid=$('#klid').val();
+	
+	var name=$("#name").val();
+	var company=$("#company").val();
+	
 	var browseClient=$("input[name='browseClient']").val();
 	var sellClient=$("input[name='sellClient']").val();
+	
+	
+	
 	var giftClient=$("input[name='giftClient']").val();
 	var newProduct=$("#newProduct").val();
 	var key_num=$("input[name='key_num']").val();
@@ -125,8 +132,14 @@ function RLongMsg(){
 		data: {
 			longleStatus:longleStatus,
 			klid:klid,
+			
+			name:name,
+			company:company,
+			
+			
 			browseClient:browseClient,
 			sellClient:sellClient,
+			
 			giftClient:giftClient,
 			newProduct:newProduct,
 			key_num:key_num,
@@ -153,7 +166,9 @@ function RLongMsg(){
 
 function departmentC(dep){
 	$("div[id^='PART_']").hide();
-	$('#PART_'+dep).show();
+	$("div[id='PART_"+dep+"']").show();
+	
+	//$('#PART_'+dep).show();
 	if(dep==""||dep==undefined)
 		$("div[id^='PART_']").show();
 	

+ 12 - 3
global/js/invoice.validator.js

@@ -65,9 +65,18 @@ $(function () {
 	        ,isMail: function() {
 	        	return $('#isMail').prop('checked');
 	        }
-	        ,isSettlementType: function() {console.log('ddd');
+	        ,isSettlementType: function() {
 	        	return $('#settlementType').prop('checked');
 	        }
+//	        ,isInvoicePrice: function() {
+//	        	var invoicePrice=$('#isInvoicePrice').val();
+//	        	console.log(invoicePrice);
+//	        	if(invoicePrice>10000){
+//	        		return false;
+//	        	}
+//	        	//return $('#isMail').prop('checked');
+//	        }
+	        
 	    },
 	    fields: {//tel(invoiceCompany);digits(invoiceCompany)  
 	    	invoiceTitle: 'required(invoiceTitle);',
@@ -77,8 +86,8 @@ $(function () {
 	    	phone:'required(invoiceCompany);',//mobile|tel;
 	    	bank:'required(invoiceCompany);',
 	    	bankAccount:'required(invoiceCompany);'
-	    	//invoicePrice: 'required; '
-	    	,invoiceQuantity: 'required; '
+	    	,invoicePrice: 'match(lte, 10000)'
+	    	,invoiceQuantity: ' required;'
 	    	,invoiceUnitPrice: 'required; '
 	    	
 	    	,trainId:'required(isSettlementType); '

+ 1 - 1
global/js/receipt.js

@@ -602,7 +602,7 @@ $(function() {
 			success: function(data){
 				var html='';
 				for(var i=0;i<data.invoiceTrainingList.length;i++){
-					html +='<option value="'+data.invoiceTrainingList[i].itidKey+'">'+data.invoiceTrainingList[i].trainName+'</option>';
+					html +='<option value="'+data.invoiceTrainingList[i].itidKey+'">'+data.invoiceTrainingList[i].trainDate+'&nbsp;'+data.invoiceTrainingList[i].trainName+'</option>';
 				}
 				$("select[receiptInvoieSelect]").html(html);
 			},

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

@@ -271,9 +271,18 @@ $acl ['INVOICE'] ['allow'] = array (
 				'ajaxInvoicePushNotice',
 				'invoiceAddFill',
 				'ajaxGetInvoiceByNew',
+				'invoiceUntreadRecallDo',
 				'invoiceUntreadED'
 		)
 );
+
+$acl ['INVOICEEXTEND'] ['allow'] = array (
+		'InvoiceExtendController' => array (
+				'invoiceSettlementChange',
+				
+		)
+);
+
 //信息中心
 $acl ['INFORMATION'] ['allow'] = array (
 		'MainController' => array (
@@ -453,6 +462,7 @@ $acl ['RECEIPTS'] ['allow'] = array (
 				'receiptTrainLecturerDelDo',
 				'h5Upload',
 				'receiptTrainDo',
+				'BUGFLAG',
 		)
 );
 $acl ['RECEIPTSEXTEND'] ['allow'] = array (

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

@@ -1 +1 @@
-,41,58,50,41,58,58
+,41,58,50,41,58,58,142,142

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

@@ -1 +1 @@
-
+{"\u53d1\u7968\u5ba1\u6279":",142"}

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

@@ -448,6 +448,10 @@ $route['post']['/invoiceStoreBatchDelete'] = array('InvoiceController', 'invoice
 $route['post']['/invoiceStoreBatchMailItemSet'] = array('InvoiceController', 'invoiceStoreBatchMailItemSet');
 $route['post']['/invoiceStoreBatchApproval'] = array('InvoiceController', 'invoiceStoreBatchApproval');
 
+$route['post']['/invoiceSettlementChange'] = array('InvoiceExtendController', 'invoiceSettlementChange');
+
+
+
 $route['post']['/ajaxGetInvoiceByNew'] = array('InvoiceController', 'ajaxGetInvoiceByNew');
 $route['post']['/ajaxGetMailItemByIstore'] = array('InvoiceController', 'ajaxGetMailItemByIstore');
 
@@ -456,6 +460,12 @@ $route['post']['/ajaxGetMailItemByIstore'] = array('InvoiceController', 'ajaxGet
 $route['post']['/ajaxGetInvoiceInfoByType'] = array('InvoiceController', 'ajaxGetInvoiceInfoByType');
 $route['post']['/ajaxGetInvoiceReceivables'] = array('InvoiceController', 'ajaxGetInvoiceReceivables');
 
+$route['post']['/ajaxGetInvoice'] = array('InvoiceAjaxController', 'ajaxGetInvoice');
+
+
+
+
+
 //$route['post']['/ajaxGetInvoiceByStaff'] = array('InvoiceController', 'ajaxGetInvoiceByStaff');废弃
 
 $route['post']['/ajaxCompareInvoicePrice'] = array('InvoiceController', 'ajaxCompareInvoicePrice');
@@ -542,6 +552,9 @@ $route['get']['/invoiceUntreadAchieve/:page/:date'] = array('InvoiceController',
 $route['get']['/invoiceUntreadAchieve/:page/:date/:MebSea'] = array('InvoiceController', 'invoiceTAchieve');
 
 $route['get']['/invoiceUntreadED'] = array('InvoiceController', 'invoiceUntreadED');
+$route['get']['/invoiceUntreadED/:page'] = array('InvoiceController', 'invoiceUntreadED');
+
+$route['get']['/invoiceUntreadRecallDo/:iidKey'] = array('InvoiceController', 'invoiceUntreadRecallDo');
 
 
 //新加路由
@@ -784,6 +797,7 @@ $route['*']['/holidayattendance/day/:day/type/:type/page/:pindex'] = array('Holi
 $route['*']['/holidayattendance/day/:day/cate/:cate/type/:type'] = array('HolidayController', 'holidayAttendance');
 $route['*']['/holidayattendance/day/:day/cate/:cate/type/:type/page/:pindex'] = array('HolidayController', 'holidayAttendance');
 
+$route['*']['/holidayapprovalList'] = array('HolidayController', 'holidayApprovalList');
 
 // 建筑-CLD接口
 $route['*']['/api/building/category/staff/:cid'] = array('BuildingApiController', 'categoryStaff');

+ 9 - 2
protected/controller/AdminController.php

@@ -618,8 +618,10 @@ class AdminController extends DooController {
 				}
 				$list [$key] ['staff'] .= " " . $v [1];
 			}
+			$list[$key]['subordinateList']=explode(',', $value['subordinate']);
+			
 		}
-		
+		//print_r($list);
 		$data ['roleList'] = $roleList;
 		$data ['verify'] = $list;
 		$data ['memu'] = "verify";
@@ -633,9 +635,13 @@ class AdminController extends DooController {
 		$staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
 		
 		$uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";
-		
 		$uidlist = explode ( ",", $uidlist );
 		
+		$subordinate = $this->get_args ( 'subordinate' ) ? $this->get_args ( 'subordinate' ) : "";
+		if (!empty($subordinate)){
+			$subordinate = implode( ",", $subordinate );
+		}
+		
 		Doo::loadModel ( "role" );
 		$role = new role ();
 		
@@ -658,6 +664,7 @@ class AdminController extends DooController {
 			
 			$verify->description = $description;
 			$verify->staff = json_encode ( $list );
+			$verify->subordinate=$subordinate;
 			$verify->insert ();
 		}
 		

+ 3 - 2
protected/controller/HumanResourceController.php

@@ -904,8 +904,9 @@ class HumanResourceController extends DooController {
 			// 用户名检测
 			$detailStaff = $staff->getStaffByName ( $username );
 			// print_r($detailStaff);
-			if (! empty ( $detailStaff ))
-				die ( 'illegal request3' );
+			if (! empty ( $detailStaff )){header ( 'Content-Type:text/html;charset=utf-8' );
+				die ( 'illegal request-username-用户名重复' );
+			}
 			
 			$staff->username = $username;
 			$staff->hiredate = $hiredate;

File diff suppressed because it is too large
+ 248 - 171
protected/controller/InvoiceController.php


+ 23 - 35
protected/controller/MainController.php

@@ -3334,6 +3334,8 @@ class MainController extends DooController {
 		
 		$status = $this->get_args ( 'longleStatus' ) ? $this->get_args ( 'longleStatus' ) : 0;
 		$lid = $this->get_args ( 'klid' ) ? $this->get_args ( 'klid' ) : 0;
+		$name = $this->get_args ( 'name' ) ? $this->get_args ( 'name' ) : "";
+		$company = $this->get_args ( 'company' ) ? $this->get_args ( 'company' ) : '';
 		
 		if (empty ( $lid ))
 			return "/keyonline/";
@@ -3344,19 +3346,13 @@ class MainController extends DooController {
 			return "/keyonline/" . $lid;
 		elseif ($status == 3) {
 			
-			$client = $this->get_args ( 'browseClient' ) ? $this->get_args ( 'browseClient' ) : "";
-			
-			$client = explode ( '-', $client );
-			
-			$product = $this->get_args ( 'browseProduct' ) ? $this->get_args ( 'browseProduct' ) : "";
-			
-			$clientname = $clientobj->getClientByName2 ( $client [0], $client [1] );
+			$clientname = $clientobj->getClientByName2 ( $name, $company );
 			
 			if (empty ( $clientname ))
 				return "/keyonline/" . $lid;
 			
-			if ($client [0] != "") {
-				$longle->client = $client [0];
+			if ($name != "") {
+				$longle->client = $name;
 				$longle->clientid = $clientname [0] ['cid'];
 			}
 			// if($product!="")
@@ -3364,14 +3360,14 @@ class MainController extends DooController {
 			
 			$longle->statusT = "借出";
 			
-			$longle_log->client = $client [0];
+			$longle_log->client = $name;
 			$longle_log->clientid = $clientname [0] ['cid'];
 			$longle_log->product = $linfo [0] ['product'];
 			$longle_log->statusT = "借出";
 			// 日常行为
 			$action_log = new action_log ();
 			
-			$action_log->action = $this->staff [0] ['category'] . '<b href="javascript:void(0)" onclick="showStaff(\'' . $this->staff [0] ['sid'] . '\')">' . $this->staff [0] ['username'] . '</b>借出<a href="javascript:void(0)" onclick="showLook(\'' . $linfo [0] ['key_num'] . '\')">' . $linfo [0] ['key_num'] . '</a>给<a href="javascript:void(0)" onclick="showClick(\'' . $clientname [0] ['cid'] . '\')">' . $client [0] . '</a>(' . $clientname [0] ['companyname'] . ')';
+			$action_log->action = $this->staff [0] ['category'] . '<b href="javascript:void(0)" onclick="showStaff(\'' . $this->staff [0] ['sid'] . '\')">' . $this->staff [0] ['username'] . '</b>借出<a href="javascript:void(0)" onclick="showLook(\'' . $linfo [0] ['key_num'] . '\')">' . $linfo [0] ['key_num'] . '</a>给<a href="javascript:void(0)" onclick="showClick(\'' . $clientname [0] ['cid'] . '\')">' . $name . '</a>(' . $clientname [0] ['companyname'] . ')';
 			$action_log->sid = $this->staff [0] ['sid'];
 			$action_log->cid = $this->staff [0] ['cid'];
 			$action_log->updatetime = date ( "Y-m-d" );
@@ -3398,27 +3394,19 @@ class MainController extends DooController {
 			$action_log->insert ();
 		} elseif ($status == 4) {
 			
-			$product = $this->get_args ( 'sellProduct' ) ? $this->get_args ( 'sellProduct' ) : "";
-			
-			$client = $this->get_args ( 'sellClient' ) ? $this->get_args ( 'sellClient' ) : "";
-			
-			$client = explode ( '-', $client );
-			
-			$clientname = $clientobj->getClientByName2 ( $client [0], $client [1] );
+			$clientname = $clientobj->getClientByName2 ( $name, $company );
 			
 			if (empty ( $clientname ))
 				return "/keyonline/" . $lid;
 			
-			if ($client [0] != "") {
-				$longle->client = $client [0];
+			if ($name != "") {
+				$longle->client = $name;
 				$longle->clientid = $clientname [0] ['cid'];
 			}
-			// if($product!="")
-			// $longle->product=$product;
 			
 			$longle->statusT = "销售";
 			
-			$longle_log->client = $client [0];
+			$longle_log->client = $name;
 			$longle_log->clientid = $clientname [0] ['cid'];
 			$longle_log->product = $linfo [0] ['product'];
 			$longle_log->statusT = "销售";
@@ -3426,7 +3414,7 @@ class MainController extends DooController {
 			// 日常行为
 			$action_log = new action_log ();
 			
-			$action_log->action = $this->staff [0] ['category'] . '<b href="javascript:void(0)" onclick="showStaff(\'' . $this->staff [0] ['sid'] . '\')">' . $this->staff [0] ['username'] . '</b>销售<a href="javascript:void(0)" onclick="showLook(\'' . $linfo [0] ['key_num'] . '\')">' . $linfo [0] ['key_num'] . '</a>给<a href="javascript:void(0)" onclick="showClick(\'' . $clientname [0] ['cid'] . '\')">' . $client [0] . '</a>(' . $clientname [0] ['companyname'] . ')';
+			$action_log->action = $this->staff [0] ['category'] . '<b href="javascript:void(0)" onclick="showStaff(\'' . $this->staff [0] ['sid'] . '\')">' . $this->staff [0] ['username'] . '</b>销售<a href="javascript:void(0)" onclick="showLook(\'' . $linfo [0] ['key_num'] . '\')">' . $linfo [0] ['key_num'] . '</a>给<a href="javascript:void(0)" onclick="showClick(\'' . $clientname [0] ['cid'] . '\')">' . $name . '</a>(' . $clientname [0] ['companyname'] . ')';
 			$action_log->sid = $this->staff [0] ['sid'];
 			$action_log->cid = $this->staff [0] ['cid'];
 			$action_log->updatetime = date ( "Y-m-d" );
@@ -3627,23 +3615,22 @@ class MainController extends DooController {
 		} elseif ($status == 9) {
 			$longle->statusT = "赠送";
 			$longle_log->statusT = "赠送";
-			$client = $this->get_args ( 'giftClient' ) ? $this->get_args ( 'giftClient' ) : "";
-			$client = explode ( '-', $client );
-			$clientname = $clientobj->getClientByName2 ( $client [0], $client [1] );
+			
+			$clientname = $clientobj->getClientByName2 ($name, $company );
 			
 			if (empty ( $clientname ))
 				return "/keyonline/" . $lid;
 			
-			if ($client [0] != "") {
-				$longle->client = $client [0];
+			if ($name != "") {
+				$longle->client = $name;
 				$longle->clientid = $clientname [0] ['cid'];
 			}
-			$longle_log->client = $client [0];
+			$longle_log->client = $name;
 			$longle_log->clientid = $clientname [0] ['cid'];
 			
 			// 日常行为
 			$action_log = new action_log ();
-			$action_log->action = $this->staff [0] ['category'] . '<b href="javascript:void(0)" onclick="showStaff(\'' . $this->staff [0] ['username'] . '\')">' . $this->staff [0] ['username'] . '</b>赠送<a href="javascript:void(0)" onclick="showLook(\'' . $linfo [0] ['key_num'] . '\')">' . $linfo [0] ['key_num'] . '</a>给<a href="javascript:void(0)" onclick="showClick(\'' . $clientname [0] ['cid'] . '\')">' . $client [0] . '</a>(' . $clientname [0] ['companyname'] . ')';
+			$action_log->action = $this->staff [0] ['category'] . '<b href="javascript:void(0)" onclick="showStaff(\'' . $this->staff [0] ['username'] . '\')">' . $this->staff [0] ['username'] . '</b>赠送<a href="javascript:void(0)" onclick="showLook(\'' . $linfo [0] ['key_num'] . '\')">' . $linfo [0] ['key_num'] . '</a>给<a href="javascript:void(0)" onclick="showClick(\'' . $clientname [0] ['cid'] . '\')">' . $name . '</a>(' . $clientname [0] ['companyname'] . ')';
 			$action_log->updatetime = date ( "Y-m-d" );
 			$action_log->time = date ( "H:i" );
 			$action_log->class = $action_log->iconRecycle;
@@ -4892,17 +4879,18 @@ class MainController extends DooController {
 	function ajaxGetCompanyInfo() {
 	}
 	function checkClient() {
-		$searchDbInforItem = $this->get_args ( 'name' ) ? $this->get_args ( 'name' ) : "";
+		$name = $this->get_args ( 'name' ) ? $this->get_args ( 'name' ) : "";
+		$company = $this->get_args ( 'company' ) ? $this->get_args ( 'company' ) : "";
 		
-		$searchDbInforItem = explode ( '-', $searchDbInforItem );
 		
-		if (! empty ( $searchDbInforItem )) {
+		
+		if (! empty ( $name )&&! empty ( $company )) {
 			
 			Doo::loadModel ( 'client' );
 			
 			$client = new client ();
 			
-			$clientInfo = $client->getClientByName2 ( $searchDbInforItem [0], $searchDbInforItem [1] );
+			$clientInfo = $client->getClientByName2 ( $name, $company );
 			if (! empty ( $clientInfo ))
 				echo json_encode ( array (
 						"success" => true 

+ 212 - 231
protected/controller/ReceiptController.php

@@ -169,9 +169,9 @@ class ReceiptController extends DooController {
 	}
 	function saeaBorad() {
 		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
 		Doo::loadModel ( 'verify' );
 		$verify = new verify ();
-		$receipt = new receipt ();
 		Doo::loadModel ( 'L_category' );
 		$lCategory = new L_category ();
 		Doo::loadModel ( "role" );
@@ -251,28 +251,11 @@ class ReceiptController extends DooController {
 		$acItem = $accountItem->find ( array (
 				'asArray' => true 
 		) );
-		$veList = $verify->find ( array (
-				'asArray' => true 
-		) );
 		
-		foreach ( $veList as $key => $value ) {
-			$v = json_decode ( $value ['staff'] );
-			
-			$list = array ();
-			foreach ( $v as $n => $m ) {
-				if ($m ['1'] == 'ROLE') {
-					$roleInfo = $role->getOne ( array (
-							'where' => 'rid=' . $m [0],
-							'asArray' => true 
-					) );
-					$v [$n] [1] = $roleInfo ['name'];
-					array_push ( $list, $roleInfo ['name'] );
-				} else {
-					array_push ( $list, $v [$n] [1] );
-				}
-			}
-			$veList [$key] ['staff'] = implode ( '>', $list );
-		}
+		$veList = $verify->getVerifyBySubordinate('REMIT');
+		
+		
+		
 		
 		$data ['category'] = $lCategory->find ( array (
 				'asArray' => true 
@@ -459,28 +442,9 @@ class ReceiptController extends DooController {
 		$acItem = $accountItem->find ( array (
 				'asArray' => true 
 		) );
-		$veList = $verify->find ( array (
-				'asArray' => true 
-		) );
+		$veList = $verify->getVerifyBySubordinate('REMIT'); 
+		
 		
-		foreach ( $veList as $key => $value ) {
-			$v = json_decode ( $value ['staff'] );
-			
-			$list = array ();
-			foreach ( $v as $n => $m ) {
-				if ($m ['1'] == 'ROLE') {
-					$roleInfo = $role->getOne ( array (
-							'where' => 'rid=' . $m [0],
-							'asArray' => true 
-					) );
-					$v [$n] [1] = $roleInfo ['name'];
-					array_push ( $list, $roleInfo ['name'] );
-				} else {
-					array_push ( $list, $v [$n] [1] );
-				}
-			}
-			$veList [$key] ['staff'] = implode ( '>', $list );
-		}
 		
 		// 配置编辑信息
 		$accountItemList = json_decode ( $receiptDetail ['accountItem'], true );
@@ -989,28 +953,9 @@ class ReceiptController extends DooController {
 		Doo::loadModel ( 'L_category' );
 		$lCategory = new L_category ();
 		
-		$veList = $verify->find ( array (
-				'asArray' => true 
-		) );
+		$veList = $verify->getVerifyBySubordinate('LOAN'); 
+		
 		
-		foreach ( $veList as $key => $value ) {
-			$v = json_decode ( $value ['staff'] );
-			
-			$list = array ();
-			foreach ( $v as $n => $m ) {
-				if ($m ['1'] == 'ROLE') {
-					$roleInfo = $role->getOne ( array (
-							'where' => 'rid=' . $m [0],
-							'asArray' => true 
-					) );
-					$v [$n] [1] = $roleInfo ['name'];
-					array_push ( $list, $roleInfo ['name'] );
-				} else {
-					array_push ( $list, $v [$n] [1] );
-				}
-			}
-			$veList [$key] ['staff'] = implode ( '>', $list );
-		}
 		
 		$data ['category'] = $lCategory->find ( array (
 				'asArray' => true 
@@ -1171,6 +1116,7 @@ class ReceiptController extends DooController {
 		) );
 		
 		$veList = $verify->find ( array (
+				'where'=>'subordinate like "%LOAN%"',
 				'asArray' => true 
 		) );
 		
@@ -1549,28 +1495,9 @@ class ReceiptController extends DooController {
 				'asArray' => true 
 		) );
 		
-		$veList = $verify->find ( array (
-				'asArray' => true 
-		) );
+		$veList = $verify->getVerifyBySubordinate('RECEIPT','LOAN');
+		
 		
-		foreach ( $veList as $key => $value ) {
-			$v = json_decode ( $value ['staff'] );
-			
-			$list = array ();
-			foreach ( $v as $n => $m ) {
-				if ($m ['1'] == 'ROLE') {
-					$roleInfo = $role->getOne ( array (
-							'where' => 'rid=' . $m [0],
-							'asArray' => true 
-					) );
-					$v [$n] [1] = $roleInfo ['name'];
-					array_push ( $list, $roleInfo ['name'] );
-				} else {
-					array_push ( $list, $v [$n] [1] );
-				}
-			}
-			$veList [$key] ['staff'] = implode ( '>', $list );
-		}
 		
 		$data ['rid'] = $rid;
 		
@@ -2106,7 +2033,7 @@ class ReceiptController extends DooController {
 		// 审批组
 		Doo::loadModel ( 'verify' );
 		$verify = new verify ();
-		$veList = $verify->getVerifyByAll ();
+		$veList = $verify->getVerifyBySubordinate('TRAIN');
 		// 办事处
 		Doo::loadModel ( 'L_category' );
 		$lCategory = new L_category ();
@@ -2234,6 +2161,20 @@ class ReceiptController extends DooController {
 			die ('illegal request--status');
 		}
 		
+		//如有已入账已收款的发票,自动取消办事处已收款
+// 		Doo::loadModel ( 'RIExtend' );
+// 		$RIExtend = new RIExtend ();
+// 		$RIExtendList=$RIExtend->getRIExtendByRid($rid);
+// 		if (!empty($RIExtendList)){
+// 			foreach ($RIExtendList as $key=>$value){
+// 				$RIExtend = new RIExtend ();
+// 				$RIExtend->delete(array (
+// 						'where' => 'iid=' . $value['iid'],
+// 						'limit' => 1
+// 				));
+// 			}
+// 		}
+		
 		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
 		
 		// 汇总表合计
@@ -2279,17 +2220,21 @@ class ReceiptController extends DooController {
 		$companyProfit=$profit * 0.6;
 		$categoryProfit=$profit * 0.4;
 		
-		$data ['profit'] = number_format ( $profit, 2 );
-		$data ['companyProfit'] = number_format ($companyProfit, 2, '.', '' );
-		$data ['categoryProfit'] = number_format ( $categoryProfit, 2, '.', '' );
+		$data ['profit'] = sprintf("%.2f",$profit);
+		$data ['companyProfit'] = sprintf("%.2f",$companyProfit); 
+		$data ['categoryProfit'] = sprintf("%.2f",$categoryProfit);  
 		//发票利润
 		$data ['invoiceProfit'] = $invoiceTrainingDetail ['invoiceTotalAmount'] - $aiData ['total'];
-		$data ['invoiceCompanyProfit'] = $data ['invoiceProfit'] * 0.6;//发票公司利润
-		$data ['invoiceCategoryProfit'] = $data ['invoiceProfit'] * 0.4;
+		//发票公司利润
+		$invoiceCompanyProfit=$data ['invoiceProfit'] * 0.6;
+		$data ['invoiceCompanyProfit'] = sprintf("%.2f",$invoiceCompanyProfit);  
+		//办事处利润
+		$invoiceCategoryProfit=$data ['invoiceProfit'] * 0.4;
+		$data ['invoiceCategoryProfit'] = sprintf("%.2f",$invoiceCategoryProfit);  
 		
 		// print_r($aiData['dataList']);
 		$categoryActualExpenditure= $aiData ['total'] - $aiData ['categoryActualExpenditure'];
-		$data ['categoryActualExpenditure'] = number_format ( $categoryActualExpenditure, 2 );
+		$data ['categoryActualExpenditure'] = sprintf("%.2f",$categoryActualExpenditure);   
 		// 备用金
 		$sum = 0;
 		$data ['receiptLoanDetail'] = array (
@@ -2301,46 +2246,46 @@ class ReceiptController extends DooController {
 		}
 		
 		$payment=$sum + $RIAmount - $categoryActualExpenditure;
-		$data ['payment'] = number_format ( $payment, 2 );
+		$data ['payment'] = sprintf("%.2f",$payment);    
 		
-		$data ['total'] = number_format ( $aiData ['total'], 2 );
+		$data ['total'] =  sprintf("%.2f",$aiData ['total']); 
 		$data ['aiCount'] = count ( $aiData ['dataList'] ) + 5;
 		$data ['aiList'] = $aiData ['dataList'];
 		
 		// 占比计算
 		if ($invoiceArriveAmount != 0) {
-			$data ['totalProportion'] = number_format ( $aiData ['total'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['profitProportion'] = number_format ( $profit / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['sumProportion'] = number_format ( $sum / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['invoiceTotalAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['RIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['companyProfitProportion'] = number_format ( $companyProfit / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['categoryProportion'] = number_format ( $categoryProfit / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['categoryActualExpenditureProportion'] = number_format ( $categoryActualExpenditure / $invoiceArriveAmount, 2, '.', '' ) * 100;
-			$data ['paymentProportion'] = number_format ( $payment / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['totalProportion'] = sprintf("%.2f",$aiData ['total'] / $invoiceArriveAmount* 100)  ;
+			$data ['profitProportion'] = sprintf("%.2f",$profit / $invoiceArriveAmount*100)  ;  //number_format ( $profit / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['sumProportion'] = sprintf("%.2f",$sum / $invoiceArriveAmount*100)  ; //number_format ( $sum / $invoiceArriveAmount, 2, '.', '' ) * 100;
+			$data ['invoiceTotalAmountProportion'] = sprintf("%.2f",$data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceArriveAmount*100)  ; 
+			$data ['RIAmountProportion'] =  sprintf("%.2f",$data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceArriveAmount*100)  ;  
+			$data ['companyProfitProportion'] = sprintf("%.2f",$companyProfit / $invoiceArriveAmount*100)  ;  
+			$data ['categoryProportion'] = sprintf("%.2f",$categoryProfit / $invoiceArriveAmount*100)  ;   
+			$data ['categoryActualExpenditureProportion'] = sprintf("%.2f",$categoryActualExpenditure / $invoiceArriveAmount*100)  ; 
+			$data ['paymentProportion'] = sprintf("%.2f",$payment / $invoiceArriveAmount*100)  ;  
 		} else {
 			$data ['totalProportion'] = $data ['profitProportion'] = $data ['sumProportion'] = $data ['invoiceTotalAmountProportion'] = $data ['RIAmountProportion'] = $data ['companyProfitProportion'] = $data ['categoryActualExpenditureProportion'] = $data ['paymentProportion'] = $data ['categoryProportion'] = 0;
 		}
 		//发票金额占比计算
 		if ($invoiceTrainingDetail ['invoiceTotalAmount'] != 0) {
 			//支出
-			$data ['invoicetotalProportion'] = number_format ( $aiData ['total'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
+			$data ['invoicetotalProportion'] = sprintf("%.2f",$aiData ['total'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ; 
 			//利润
-			$data ['invoiceprofitProportion'] = number_format ( $data ['invoiceProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
+			$data ['invoiceprofitProportion'] = sprintf("%.2f",$data ['invoiceProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;  
 			//公司利润
-			$data ['invoicecompanyProfitProportion'] = number_format ( $data ['invoiceCompanyProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
+			$data ['invoicecompanyProfitProportion'] = sprintf("%.2f", $invoiceCompanyProfit / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;  
 			//办事处利润
-			$data ['invoicecategoryProportion'] = number_format ( $data ['invoiceCategoryProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
+			$data ['invoicecategoryProportion'] = sprintf("%.2f", $invoiceCategoryProfit / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;  
 			//公司收款
-			$data ['invoiceTotalAmountProportionB'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
+			$data ['invoiceTotalAmountProportionB'] = sprintf("%.2f", $data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;  
 			//备用金
-			$data ['invoicesumProportion'] = number_format ( $sum / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
+			$data ['invoicesumProportion'] = sprintf("%.2f", $sum / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;   
 			//办事处收款
-			$data ['invoiceRIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
+			$data ['invoiceRIAmountProportion'] = sprintf("%.2f", $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;  
 			//办事处实际支出
-			$data ['ICAEP'] = number_format ( $categoryActualExpenditure / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
+			$data ['ICAEP'] = sprintf("%.2f", $categoryActualExpenditure / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;   
 			//付总部款
-			$data ['invoicepaymentProportion'] = number_format ( $payment / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
+			$data ['invoicepaymentProportion'] = sprintf("%.2f", $payment / $invoiceTrainingDetail ['invoiceTotalAmount']* 100)  ;  
 		}else{
 			$data ['invoiceprofitProportion'] =$data ['invoiceRIAmountProportion'] =$data ['invoicetotalProportion'] =$data ['invoiceTotalAmountProportionB'] =$data ['invoicesumProportion'] =$data ['ICAEP'] =$data ['invoicepaymentProportion'] =$data ['invoicecompanyProfitProportion'] =$data ['invoicecategoryProportion'] =0;
 		}
@@ -2354,7 +2299,7 @@ class ReceiptController extends DooController {
 		// 审批组
 		Doo::loadModel ( 'verify' );
 		$verify = new verify ();
-		$veList = $verify->getVerifyByAll ();
+		$veList = $verify->getVerifyBySubordinate('TRAIN');
 		
 		// 办事处
 		Doo::loadModel ( 'L_category' );
@@ -2624,6 +2569,9 @@ class ReceiptController extends DooController {
 		Doo::loadModel ( 'invoiceTraining' );
 		$invoiceTraining = new invoiceTraining ();
 		
+		
+		
+		
 		$receiptDetail = $receipt->getReceiptByRid ( $rid );
 		if (! ($receiptDetail ['status'] == 5 || $receiptDetail ['status'] == 4))
 			die ();
@@ -2634,7 +2582,7 @@ class ReceiptController extends DooController {
 			$invoiceList = $invoice->getInvoicePrintedByItid ( $receiptDetail ['invoiceTrainId'] );
 			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
 		}
-		// print_r($invoiceList);
+		//print_r($invoiceList);
 		$data ['invoiceList'] = $invoiceList;
 		$data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
 		$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
@@ -2719,6 +2667,7 @@ class ReceiptController extends DooController {
 		if (! is_numeric ( $rid ) || ! is_numeric ( $iid ))
 			die ( 'illegal request-iid' );
 		
+		
 		Doo::loadModel ( 'RIExtend' );
 		$RIExtend = new RIExtend ();
 		
@@ -2728,17 +2677,25 @@ class ReceiptController extends DooController {
 			$RIExtend->RIstatus = 1;
 			$RIExtend->insert ();
 			
-			$XDeode = new XDeode ( 7 );
-			return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
+			echo json_encode ( array (
+					'status' => 1,
+			) );
+			die ( );
 		} elseif ($doType == 'CANCEL') {
 			$RIExtend->delete ( array (
 					'where' => 'rid=' . $rid . ' and iid=' . $iid,
 					'limit' => 1 
 			) );
-			$XDeode = new XDeode ( 7 );
-			return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
+			
+			echo json_encode ( array (
+					'status' => 1,
+			) );
+			die ( );
 		} else {
-			die ( 'illegal request' );
+			echo json_encode ( array (
+					'status' => 2,
+			) );
+			die ( );
 		}
 	}
 	
@@ -2791,7 +2748,9 @@ class ReceiptController extends DooController {
 	 * 编辑培训班结算
 	 */
 	function receiptTrainItemEdi() {
+		//include Doo::conf()->BASE_PATH.'diagnostic/debug.php';
 		$ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
+		$name = $this->get_args ( 'name' ) ? $this->get_args ( 'name' ) : '';
 		
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 7 );
@@ -2814,15 +2773,16 @@ class ReceiptController extends DooController {
 			die ();
 		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
 		
-		$RItemList = $RItem->getRItemByRid ( $rid );
-		$aiList = $accountItem->getAccountBookByCategory ( '培训班费用' );
+		$RItemList = $RItem->getRItemByRid ( $rid,$name );
+		$aiList = $accountItem->getAccountBookByCategory ( '培训班费用' );//print_r($aiList);
 // 		foreach ($aiList as $key=>$value){//不需要添加税款,在添加收入时自动添加
 // 			if($value['name']=='税款'){
 // 				unset($aiList[$key]);break;
 // 			}
 // 		}
 		
-		//print_r($aiList);
+		//print_r($RItemList);
+		$data ['name'] = $name;
 		$data ['RItemList'] = $RItemList;
 		$data ['aiList'] = $aiList;
 		
@@ -2885,6 +2845,7 @@ class ReceiptController extends DooController {
 			$RItem->describe = $describe;
 			
 			$RItem->creater=$this->staff['0']['username'];
+			$RItem->createrId=$this->staff['0']['sid'];
 			$RItem->creatDate=date ( "Y-m-d H:i:s" ) ;
 			
 			$RItem->insert ();
@@ -5500,7 +5461,15 @@ class ReceiptController extends DooController {
 				$loanReceipt->status = 1;
 				$loanReceipt->pastDate = date ( "Y-m-d" );
 				
-				$loanReceipt->amount = $receiptDetail ['amount'];
+				//生成流水后 不更新汇款金额
+				Doo::loadModel ( 'wasteBook' );
+				$wasteBook = new wasteBook ();
+				$wbDetail = $wasteBook->getWateBookByAD ( 1, $rid );
+				if (empty($wbDetail)){
+					$loanReceipt->amount = $receiptDetail ['amount'];
+				}
+				
+				
 				$loanReceipt->update ( array (
 						'where' => ' rid = ' . $receiptDetail ['loanRid'] 
 				) );
@@ -6022,11 +5991,10 @@ class ReceiptController extends DooController {
 		if ($receiptList [0] ['Rtype'] == 0) {
 			$accountType = 3;
 		} elseif ($receiptList [0] ['Rtype'] == 1) {
-			if ($receiptList [0] ['Rtype'] == 0) {
-				$accountType = 1;
-			} elseif ($receiptList [0] ['Rtype'] == 1) {
-				$accountType = 2;
-			}
+			if (!empty($receiptList [0]['accountItem']) )
+					$accountType = 2;
+				else
+					$accountType = 1;
 		} elseif ($receiptList [0] ['Rtype'] == 2) {
 			$accountType = 4;
 		} elseif ($receiptList [0] ['Rtype'] == 3) {
@@ -6037,6 +6005,12 @@ class ReceiptController extends DooController {
 		$wbDetail = $wasteBook->getWateBookByAD ( $accountType, $receiptList [0] ['rid'] );
 		$data ['wbDetail'] = $wbDetail;
 		
+		$wbDetailLoan=array();
+		if ($accountType==2){
+			$wbDetailLoan = $wasteBook->getWateBookByAD ( 1, $receiptList [0] ['rid'] );
+		}
+		$data ['wbDetailLoan'] = $wbDetailLoan;
+		
 		
 		//print_r($receiptList);
 		
@@ -6081,19 +6055,19 @@ class ReceiptController extends DooController {
 			
 			$rinfo = $receipt->getReceiptByRid ( $rid );
 			
-			$accountType = '';
-			if ($rinfo ['Rtype'] == 1) {
-				if ($rinfo ['loanRid'] != 0)
-					$accountType = 2;
-				else
-					$accountType = 1;
-			} elseif ($rinfo ['Rtype'] == 2) {
-				$accountType = 4;
-			} elseif ($rinfo ['Rtype'] == 0)
-				$accountType = 3;
+// 			$accountType = '';
+// 			if ($rinfo ['Rtype'] == 1) {
+// 				if ($rinfo ['loanRid'] != 0)//判断有问题
+// 					$accountType = 2;
+// 				else
+// 					$accountType = 1;
+// 			} elseif ($rinfo ['Rtype'] == 2) {
+// 				$accountType = 4;
+// 			} elseif ($rinfo ['Rtype'] == 0)
+// 				$accountType = 3;
 			
-			if (empty ( $accountType ))
-				die ( 'illegal request' );
+// 			if (empty ( $accountType ))
+// 				die ( 'illegal request' );
 			
 			$executeCopy = json_decode ( $rinfo ['executeCopy'], true );
 			$executeStaff = json_decode ( $rinfo ['executeStaff'], true );
@@ -6131,7 +6105,7 @@ class ReceiptController extends DooController {
 			} else {
 				$receipt->executeStaff = json_encode ( $executeStaff );
 			}
-			$receipt->amount = $amount;
+			//$receipt->amount = $amount;
 			$receipt->update ( array (
 					'where' => 'rid=' . $rid 
 			) );
@@ -7429,28 +7403,9 @@ class ReceiptController extends DooController {
 		$acItem = $accountItem->find ( array (
 				'asArray' => true 
 		) );
-		$veList = $verify->find ( array (
-				'asArray' => true 
-		) );
+		$veList = $verify->getVerifyBySubordinate('RECEIPT');
+		
 		
-		foreach ( $veList as $key => $value ) {
-			$v = json_decode ( $value ['staff'] );
-			
-			$list = array ();
-			foreach ( $v as $n => $m ) {
-				if ($m ['1'] == 'ROLE') {
-					$roleInfo = $role->getOne ( array (
-							'where' => 'rid=' . $m [0],
-							'asArray' => true 
-					) );
-					$v [$n] [1] = $roleInfo ['name'];
-					array_push ( $list, $roleInfo ['name'] );
-				} else {
-					array_push ( $list, $v [$n] [1] );
-				}
-			}
-			$veList [$key] ['staff'] = implode ( '>', $list );
-		}
 		
 		$data ['category'] = $lCategory->find ( array (
 				'asArray' => true 
@@ -7768,28 +7723,9 @@ class ReceiptController extends DooController {
 		$acItem = $accountItem->find ( array (
 				'asArray' => true 
 		) );
-		$veList = $verify->find ( array (
-				'asArray' => true 
-		) );
+		$veList = $verify->getVerifyBySubordinate('RECEIPT');
+		
 		
-		foreach ( $veList as $key => $value ) {
-			$v = json_decode ( $value ['staff'] );
-			
-			$list = array ();
-			foreach ( $v as $n => $m ) {
-				if ($m ['1'] == 'ROLE') {
-					$roleInfo = $role->getOne ( array (
-							'where' => 'rid=' . $m [0],
-							'asArray' => true 
-					) );
-					$v [$n] [1] = $roleInfo ['name'];
-					array_push ( $list, $roleInfo ['name'] );
-				} else {
-					array_push ( $list, $v [$n] [1] );
-				}
-			}
-			$veList [$key] ['staff'] = implode ( '>', $list );
-		}
 		
 		// 配置编辑信息
 		$accountItemList = json_decode ( $receiptDetail ['accountItem'], true );
@@ -10144,7 +10080,21 @@ class ReceiptController extends DooController {
 				// 微信企业号通知
 				$this->setWXMsg ( $rid, 1 );
 			}
-			$receipt->amount = $amount;
+			//是否有流水
+			Doo::loadModel ( 'wasteBook' );
+			$wasteBook = new wasteBook ();
+			$accountType=3;
+			if ($receiptDetail['Rtype']==1){
+				$accountType=2;
+			}elseif($receiptDetail['Rtype']==2){
+				$accountType=4;
+			}
+			$wbDetail = $wasteBook->getWateBookByAD ( $accountType, $rid );
+			if (empty($wbDetail)){
+				$receipt->amount = $amount;
+			}
+			
+			
 			$receipt->update ( array (
 					'where' => ' rid = ' . $rid 
 			) );
@@ -13298,6 +13248,7 @@ class ReceiptController extends DooController {
 	 */
 	function ajaxGetWasteReceipt() {
 		$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
+		$accountTypeKey = $this->get_args ( 'accountTypeKey' ) ? $this->get_args ( 'accountTypeKey' ) : "";
 		
 		Doo::loadModel ( 'receipt' );
 		$receipt = new receipt ();
@@ -13305,6 +13256,8 @@ class ReceiptController extends DooController {
 		$XDeode = new XDeode ( 5 );
 		
 		$rid = $XDeode->decode ( $serial );
+		$accountType= $XDeode->decode ( $accountTypeKey );
+		
 		
 		// 获得个数据
 		$detail = $receipt->getReceiptByRid ( $rid );
@@ -13319,7 +13272,7 @@ class ReceiptController extends DooController {
 		$detail ['sumCN'] = $this->num_to_rmb ( $detail ['sum'] );
 		
 		// 获得费用html
-		$html = $this->getWasteReceiptHtml ( $detail );
+		$html = $this->getWasteReceiptHtml ( $detail ,$accountType);
 		// 获得费用审批人数据
 		$detail = $this->getReceiptApproverHtml ( $detail );
 		
@@ -13347,14 +13300,30 @@ class ReceiptController extends DooController {
 			';
 		}
 		$html .= '	</tbody></table>';
-		
+		if($accountType==1){
+			Doo::loadModel ( 'loanReceipt' );
+			$loanReceipt = new loanReceipt ();
+			$loanList = $loanReceipt->getOne ( array (
+					'where' => 'rid=' . $detail ['loanRid'],
+					'desc' => 'rid',
+					'asArray' => true
+			) );
+			
+			
+			$html .= '<table class="table table-bordered table-condensed">
+		<tr class="warning">
+		<td class="taR"><b>汇款金额</b></td>
+		<td width="140" class="taR"><b style="font-size: 24px">¥'.$loanList['amount'].'</b></td>
+		</tr>
+		</table>';
+		}else{
 		$html .= '<table class="table table-bordered table-condensed">
 		<tr class="warning">
 		<td class="taR"><b>汇款金额</b></td>
 		<td width="140" class="taR"><b style="font-size: 24px">¥' . $detail ['amount'] . '</b></td>
 		</tr>
 		</table>';
-		
+		}
 		// print_r($detail['verifyList']);
 		// header ( 'Content-Type:text/html;charset=utf-8' );
 		// echo $html;
@@ -13545,7 +13514,7 @@ class ReceiptController extends DooController {
 		$detail ['verifyList'] = $verifyList;
 		return $detail;
 	}
-	function getWasteReceiptHtml($detail = array()) {
+	function getWasteReceiptHtml($detail = array(),$accountType=1) {
 		if (empty ( $detail ))
 			return '';
 		
@@ -13647,7 +13616,7 @@ class ReceiptController extends DooController {
 							</tr>
 	  						</tbody>
 					</table>';
-		} elseif ($detail ['Rtype'] == 2) {
+		} elseif ($detail ['Rtype'] == 2) {//对公汇款
 			$html .= '
 					<table class="table table-bordered table-condensed">
 						<tbody>
@@ -13679,10 +13648,56 @@ class ReceiptController extends DooController {
 							</tr>
 	  						</tbody>
 					</table>';
-		} elseif ($detail ['Rtype'] == 1) {
+		} elseif ($detail ['Rtype'] == 1) {//借款 或者借款报销
+			
+
+			Doo::loadModel ( 'loanReceipt' );
+			$loanReceipt = new loanReceipt ();
+				
+			$loanList = $loanReceipt->getOne ( array (
+					'where' => 'rid=' . $detail ['loanRid'],
+					'desc' => 'rid',
+					'asArray' => true
+			) );
+			// print_r($loanList);
+				
+			$loanList ['sumCN']=$this->num_to_rmb($loanList ['sum']);
+				
+			$html .= '<table class="table table-bordered table-condensed">
+						<tbody>
+							<tr>
+								<th colspan="2" class="taC">借款费用</th>
+							</tr>';
+			foreach ( $detail ['loanItem'] ['借款费用'] as $key => $value ) {
+				$html .= '<tr>
+						<th>' . $value ['name'] . '</th>
+						<td width="140" class="taR">¥' . $value ['price'] . '</td>
+				</tr>';
+			}
+			$html .= '<tr>
+								<th class="taC" colspan="2">产生费用所在办事处</th>
+							</tr>
+							<tr>
+								<th style="text-align: center" colspan="2">' . $detail ['category'] [0] ['title'] . '</th>
+							</tr>
+							<tr>
+								<th class="taC" colspan="2">费用说明</th>
+							</tr>
+							<tr>
+								<td colspan="2">' . $loanList ['explanation'] . '</td>
+							</tr>
+							<tr class="warning">
+								<td class="taR"><b>(' . $loanList ['receiptOrder'] . ')本次费用合计</b></td>
+								<td class="taR"><b style="font-size: 24px">¥' . $loanList ['sum'] . '</b><br>' . $loanList ['sumCN'] . '</td>
+							</tr>
+						</tbody>
+					</table>
+					';
 			
-			if ($detail ['loanRid'] != 0 && ! empty ( $detail ['accountItem'] )) {
+			if ( $accountType==2) {
 				
+				$balance=$detail ['sum']-$loanList ['sum'];
+				$balanceCN=$this->num_to_rmb($balance);
 				$html .= '<table class="table table-bordered table-condensed">
 						<tbody>
 					<tr>
@@ -13775,50 +13790,16 @@ class ReceiptController extends DooController {
 								<td class="taR"><b>(' . $detail ['receiptOrder'] . ')本次报销费用合计</b></td>
 								<td class="colGreed taR"><b style="font-size: 24px">¥' . $detail ['sum'] . '</b><br>' . $detail ['sumCN'] . '</td>
 							</tr>
+				<tr class="success">
+                                <td class="taR"><b>借款结余</b></td>
+                                <td class="taR"><b style="font-size:24px">¥'.$balance.'</b><br>'.$balanceCN.'</td>
+                            </tr>						
+										
+										
 	  						</tbody>
 					</table>';
 			}
 			
-			Doo::loadModel ( 'loanReceipt' );
-			$loanReceipt = new loanReceipt ();
-			
-			$loanList = $loanReceipt->getOne ( array (
-					'where' => 'rid=' . $detail ['loanRid'],
-					'desc' => 'rid',
-					'asArray' => true 
-			) );
-			// print_r($loanList);
-			
-			$html .= '<table class="table table-bordered table-condensed">
-						<tbody>
-							<tr>
-								<th colspan="2" class="taC">借款费用</th>
-							</tr>';
-			foreach ( $detail ['loanItem'] ['借款费用'] as $key => $value ) {
-				$html .= '<tr>
-						<th>' . $value ['name'] . '</th>
-						<td width="140" class="taR">¥' . $value ['price'] . '</td>
-				</tr>';
-			}
-			$html .= '<tr>
-								<th class="taC" colspan="2">产生费用所在办事处</th>
-							</tr>
-							<tr>
-								<th style="text-align: center" colspan="2">' . $detail ['category'] [0] ['title'] . '</th>
-							</tr>
-							<tr>
-								<th class="taC" colspan="2">费用说明</th>
-							</tr>
-							<tr>
-								<td colspan="2">' . $loanList ['explanation'] . '</td>
-							</tr>
-							<tr class="warning">
-								<td class="taR"><b>(' . $loanList ['receiptOrder'] . ')本次费用合计</b></td>
-								<td class="taR"><b style="font-size: 24px">¥' . $detail ['loanSum'] . '</b><br>' . $detail ['loanSumCN'] . '</td>
-							</tr>
-						</tbody>
-					</table>
-					';
 		}
 		
 		return $html;

+ 13 - 12
protected/model/accountItem.php

@@ -43,6 +43,7 @@ class accountItem extends DooModel {
 	 * 根据项目获得ITEM
 	 */
 	function getAccountBookByCategory($category=''){
+		
 		$list = $this->find ( array (
 				'where' => ' category like "%' . $category.'%"',
 				'asArray' => TRUE
@@ -138,32 +139,32 @@ class accountItem extends DooModel {
 			if ($invoiceArriveAmount!=0){
 	 			if($v['name']=='办公费'||$v['name']=='邮寄费'){
 	 				$proportion=$aiList[$k]['categoryPrice']/$invoiceArriveAmount;
-	 				$aiList[$k]['categoryProportion']=number_format ( $proportion, 4, '.', '' )*100;
+	 				$aiList[$k]['categoryProportion']= sprintf("%.2f",$proportion*100);     
 	 				$proportion=$aiList[$k]['companyPrice']/$invoiceArriveAmount;
-	 				$aiList[$k]['companyProportion']=number_format ( $proportion, 4, '.', '' )*100;
+	 				$aiList[$k]['companyProportion']=sprintf("%.2f",$proportion*100);   
 	 			}elseif($v['name']=='讲课费'){
 	 				$proportion=$aiList[$k]['insidePrice']/$invoiceArriveAmount;
-	 				$aiList[$k]['insideProportion']=number_format ( $proportion, 4, '.', '' )*100;
+	 				$aiList[$k]['insideProportion']=sprintf("%.2f",$proportion*100);   
 	 				
 	 				$proportion=$aiList[$k]['outsideTaxPrice']/$invoiceArriveAmount;
-	 				$aiList[$k]['outsideTaxProportion']=number_format ( $proportion, 4, '.', '' )*100;
+	 				$aiList[$k]['outsideTaxProportion']= sprintf("%.2f",$proportion*100);   
 	 				
 	 				$proportion=$aiList[$k]['outsideNoTaxPrice']/$invoiceArriveAmount;
-	 				$aiList[$k]['outsideNoTaxProportion']=number_format ( $proportion, 4, '.', '' )*100;
+	 				$aiList[$k]['outsideNoTaxProportion']= sprintf("%.2f",$proportion*100);   
 	 			}else{
 	 				$proportion=$aiList[$k]['price']/$invoiceArriveAmount;
-	 				$aiList[$k]['proportion']=number_format ( $proportion, 4, '.', '' )*100;
+	 				$aiList[$k]['proportion']=sprintf("%.2f",$proportion*100);  
 	 			}
 			}
 			
 			//$aiList[$k]['companyPrice']=number_format ($aiList[$k]['companyPrice'],2);
-			$aiList[$k]['outsideTaxPrice']=number_format ($aiList[$k]['outsideTaxPrice'],2);
-			$aiList[$k]['outsideNoTaxPrice']=number_format ($aiList[$k]['outsideNoTaxPrice'],2);
-			$aiList[$k]['insidePrice']=number_format ($aiList[$k]['insidePrice'],2);
+			$aiList[$k]['outsideTaxPrice']=sprintf("%.2f",$aiList[$k]['outsideTaxPrice']);  
+			$aiList[$k]['outsideNoTaxPrice']=sprintf("%.2f",$aiList[$k]['outsideNoTaxPrice']);  
+			$aiList[$k]['insidePrice']=sprintf("%.2f",$aiList[$k]['insidePrice']);  
 			
-			$aiList[$k]['companyPrice']=number_format ($aiList[$k]['companyPrice'],2);
-			$aiList[$k]['categoryPrice']=number_format ($aiList[$k]['categoryPrice'],2);
-			$aiList[$k]['priceFormat']=number_format ($aiList[$k]['price'],2);
+			$aiList[$k]['companyPrice']=sprintf("%.2f",$aiList[$k]['companyPrice']);  
+			$aiList[$k]['categoryPrice']=sprintf("%.2f",$aiList[$k]['categoryPrice']);  
+			$aiList[$k]['priceFormat']=sprintf("%.2f",$aiList[$k]['price']);  
 			
 		}
 		

+ 66 - 7
protected/model/invoice.php

@@ -194,6 +194,10 @@ class invoice extends DooModel {
 	public $printTime;
 	public $postTime;
 	public $settlementType;
+	public $accountingTime;
+	
+	
+	
 	public $_table = 'CLD_invoice';
 	public $_primarykey = 'iid';
 	public $_fields = array (
@@ -253,7 +257,8 @@ class invoice extends DooModel {
 			'printTime',
 			'postTime',
 			'bindTime',
-			'settlementType' 
+			'settlementType',
+			'accountingTime'
 	);
 	/**
 	 * 根据发票ID获取一条发票数据
@@ -298,6 +303,7 @@ class invoice extends DooModel {
 		Doo::loadModel ( 'L_category' );
 		$lCategory = new L_category ();
 		$Detail ['category'] = $lCategory->getCategory ();
+		
 		return $Detail;
 	}
 	
@@ -308,7 +314,7 @@ class invoice extends DooModel {
 		
 		$sql = 'select a.*,b.RIstatus as RIstatus
 				from ' . $this->_table . ' as a left join  CLD_RIExtend  as b on (a.iid=b.iid)
-				where a.trainId = ' . $trainId . ' and a.status=2 and a.printStatus=1 and (a.untreadStatus=0 or a.untreadStatus=3)';
+				where a.trainId = ' . $trainId . ' and a.status=2 and a.printStatus=1 and (a.untreadStatus=0 or a.untreadStatus=3) ORDER BY a.iid ASC';
 		$query = Doo::db ()->query ( $sql );
 		$result = $query->fetchAll ();
 		Doo::loadClass ( 'XDeode' );
@@ -316,7 +322,7 @@ class invoice extends DooModel {
 		Doo::loadModel ( 'invoiceReceivables' );
 		$invoiceReceivables = new invoiceReceivables ();
 		foreach ($result as $key=>$value){
-			$result [$key] ['irDetail'] =$invoiceReceivables->getInvoiceReceivablesByIrid($value ['irid']);
+			$result [$key] ['irDetail'] =$invoiceReceivables->getInvoiceReceivablesByIridList($value ['irid']);
 			$result [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
 		}
 		
@@ -337,6 +343,7 @@ class invoice extends DooModel {
 				from CLD_RIExtend  as b left join ' . $this->_table . ' as a  on (a.iid=b.iid)
 				where (a.trainId in (' . $itidSql . ') and a.status=2 and a.printStatus=1 and  a.untreadStatus=3) or b.RIstatus=1
 				GROUP BY a.trainId';
+		//echo $sql;
 		$query = Doo::db ()->query ( $sql );
 		return $result = $query->fetchAll ();
 	}
@@ -515,8 +522,8 @@ class invoice extends DooModel {
 		if (empty ( $itid ))
 			return 0;
 		$sql = 'select count(*) as count from CLD_invoiceStore as a left join ' . $this->_table . ' as b on (a.iid=b.iid)
-				where  a.trainId= ' . $itid . ' and (b.untreadStatus is null or b.untreadStatus!=2) and (b.isDelete is null or b.isDelete=0 )';
-		
+				where  a.trainId= ' . $itid . ' and b.status!=4 and (b.untreadStatus is null or b.untreadStatus!=2) and (b.isDelete is null or b.isDelete=0 )';
+		//echo $sql;
 		//echo $sql;
 		$query = Doo::db ()->query ( $sql );
 		$result = $query->fetchAll ();
@@ -799,6 +806,58 @@ class invoice extends DooModel {
 	 * @param number $untreadStatus 退票状态
 	 * @param number $iid 发票ID
 	 */
+	public function getMyInvoiceByUntreadStatus($untreadStatus = 1, $iid = 0,$limit=10,$sid=0) {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		if (empty ( $iid )) {
+			$list = $this->find ( array ( // printStatus=1 and
+					'where' => " untreadStatus=" . $untreadStatus . " and status=2 and sid=".$sid,
+					'limit' => $limit,
+					'asArray' => TRUE
+			) );
+				
+			if ($untreadStatus == 2) {
+				Doo::loadModel ( 'invoiceOperationLog' );
+				$invoiceOperationLog = new invoiceOperationLog ();
+			}
+			foreach ( $list as $key => $value ) {
+				$list [$key] ['iidKey'] = $this->authcode ( $value ['iid'], '' );
+				$list [$key] ['iidKeyK'] = $XDeode->encode ( $value ['iid'] );
+				$list [$key] ['untreadCompany'] = '';
+				$list [$key] ['untreadCom'] = '';
+				if (! empty ( $value ['untreadCompany'] )) {
+					$express = explode ( ":", $value ['untreadCompany'] );
+					$list [$key] ['untreadCompany'] = $express [0];
+					$list [$key] ['untreadCom'] = $express [1];
+				}
+				if ($untreadStatus == 2) {
+					$list [$key] ['OperationLog'] = $invoiceOperationLog->getInvoiceOperationByStatus ( $value ['iid'], 6 );
+				}
+	
+				$list [$key] ['lossDetail'] = array ();
+				if ($value ['lossIid'] != 0) {
+					$detail = $this->getOne ( array (
+							'where' => "iid=" . $value ['lossIid'],
+							'asArray' => TRUE
+					) );
+					$detail ['iidKeyK'] = $XDeode->encode ( $detail ['iid'] );
+					$list [$key] ['lossDetail'] = $detail;
+				}
+			}
+		} else {
+			$list = $this->getOne ( array (
+					'where' => "iid=" . $iid . " and printStatus=1 and untreadStatus=" . $untreadStatus . " and status=2",
+					'asArray' => TRUE
+			) );
+		}
+		return $list;
+	}
+	
+	/**
+	 * 根据退票状态获得相关数据,iid有值时只获得一条数据
+	 * @param number $untreadStatus 退票状态
+	 * @param number $iid 发票ID
+	 */
 	public function getInvoiceByUntreadStatus($untreadStatus = 1, $iid = 0,$limit=10) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
@@ -870,7 +929,7 @@ class invoice extends DooModel {
 		
 		return $list;
 	}
-	function getInvoiceByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc', $olStatus = "desc") {
+	function getInvoiceByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc', $olStatus = "desc",$descField="bindTime") {
 		if (empty ( $limit ) || empty ( $con ))
 			return array ();
 		
@@ -882,7 +941,7 @@ class invoice extends DooModel {
 		$list = $this->find ( array (
 				'where' => $con,
 				'limit' => $limit,
-				$desc => 'approvalTime',
+				$desc => $descField,
 				'asArray' => TRUE 
 		) ); // echo $con;
 		Doo::loadClass ( 'XDeode' );

+ 78 - 36
protected/model/invoiceReceivables.php

@@ -79,7 +79,7 @@ class invoiceReceivables extends DooModel {
 			'refundRemarks',
 			'refundLog',
 			'relationIrid',
-			'relationLog'
+			'relationLog' 
 	);
 	public function getSumOfReceivablesPrice($iridString = "") {
 		if (empty ( $iridString ))
@@ -124,7 +124,7 @@ class invoiceReceivables extends DooModel {
 		if (empty ( $bankBatchNumber ))
 			return array ();
 		$list = $this->find ( array (
-				'where' => "bankBatchNumber= '".$bankBatchNumber."'",
+				'where' => "bankBatchNumber= '" . $bankBatchNumber . "'",
 				'asArray' => TRUE 
 		) );
 		return $list;
@@ -134,7 +134,6 @@ class invoiceReceivables extends DooModel {
 	 * 获得最近录入发票,不包含已经绑定的
 	 */
 	public function getInvoiceReceivablesByInput() {
-		
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		
@@ -148,7 +147,7 @@ class invoiceReceivables extends DooModel {
 			if ($value ['receivablesCategory'] != 'PUBLIC')
 				$list [$key] ['receivablesCategory'] = explode ( ':', $value ['receivablesCategory'] );
 			
-			$list [$key]['iridKeyXD'] = $XDeode->encode ( $value ['irid'] );
+			$list [$key] ['iridKeyXD'] = $XDeode->encode ( $value ['irid'] );
 			
 			if ($value ['receivablesStaff'] != 'PUBLIC')
 				$list [$key] ['receivablesStaff'] = explode ( '-', $value ['receivablesStaff'] );
@@ -360,6 +359,51 @@ class invoiceReceivables extends DooModel {
 	}
 	
 	/**
+	 * 获得一组irid的收款
+	 * @param string $iridList
+	 * @param string $con
+	 * @return unknown|string[]|unknown[]|mixed[]
+	 */
+	public function getInvoiceReceivablesByIridList($iridList = "", $con = "") {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$list = array ();
+		if (! empty ( $iridList )) {
+			$list = $this->find ( array (
+					'where' => " irid in( " . $iridList." ) " . $con,
+					'asArray' => TRUE 
+			) );
+		}
+		
+		if (empty ( $list )){
+			return $list;
+		}
+		foreach ($list as $key=>$value){
+			$list [$key] ['cid'] = '';
+			$list [$key] ['title'] = '';
+			if ($list [$key] ['receivablesCategory'] != "PUBLIC") {
+				$category = explode ( ":", $list [$key] ['receivablesCategory'] );
+				$list [$key] ['cid'] = $category [0];
+				$list [$key] ['title'] = $category [1];
+			}
+			
+			$list [$key] ['sid'] = '';
+			$list [$key] ['username'] = '';
+			if ($list [$key] ['receivablesStaff'] != "PUBLIC") {
+				$staff = explode ( "-", $list [$key] ['receivablesStaff'] );
+				$list [$key] ['sid'] = $staff [0];
+				$list [$key] ['username'] = $staff [1];
+			}
+			
+			$list [$key] ['iridKey'] = $XDeode->encode ( $list [$key] ['irid'] );
+			$list [$key] ['iridEn'] = $this->authcode ( $list [$key] ['irid'], '' );
+		}
+		
+		return $list;
+	}
+	
+	/**
 	 * 根据收款序列号获取一条相关数据
 	 * @param string $irid
 	 * @param string $con 附加获取收款条件 可以为空
@@ -368,38 +412,36 @@ class invoiceReceivables extends DooModel {
 	public function getInvoiceReceivablesBySerial($receivablesSerial = "", $con = "") {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-		if (!empty($receivablesSerial))
-			
+		if (! empty ( $receivablesSerial ))
 			
-				$detail = $this->getOne ( array (
-						'where' => " receivablesSerial like '%" . $receivablesSerial."%'" . $con,
-						'limit'=>1,
-						'asArray' => TRUE
-				) );
-	
-				if (empty ( $detail ))
-					return $detail;
-					$detail ['cid'] = '';
-					$detail ['title'] = '';
-					if ($detail ['receivablesCategory'] != "PUBLIC") {
-						$category = explode ( ":", $detail ['receivablesCategory'] );
-						$detail ['cid'] = $category [0];
-						$detail ['title'] = $category [1];
-					}
-	
-					$detail ['sid'] = '';
-					$detail ['username'] = '';
-					if ($detail ['receivablesStaff'] != "PUBLIC") {
-						$staff = explode ( "-", $detail ['receivablesStaff'] );
-						$detail ['sid'] = $staff [0];
-						$detail ['username'] = $staff [1];
-					}
-	
-					$detail ['iridKey'] = $XDeode->encode ( $detail ['irid'] );
-					$detail ['iridEn'] = $this->authcode ( $detail ['irid'], '' );
-					return $detail;
+			$detail = $this->getOne ( array (
+					'where' => " receivablesSerial like '%" . $receivablesSerial . "%'" . $con,
+					'limit' => 1,
+					'asArray' => TRUE 
+			) );
+		
+		if (empty ( $detail ))
+			return $detail;
+		$detail ['cid'] = '';
+		$detail ['title'] = '';
+		if ($detail ['receivablesCategory'] != "PUBLIC") {
+			$category = explode ( ":", $detail ['receivablesCategory'] );
+			$detail ['cid'] = $category [0];
+			$detail ['title'] = $category [1];
+		}
+		
+		$detail ['sid'] = '';
+		$detail ['username'] = '';
+		if ($detail ['receivablesStaff'] != "PUBLIC") {
+			$staff = explode ( "-", $detail ['receivablesStaff'] );
+			$detail ['sid'] = $staff [0];
+			$detail ['username'] = $staff [1];
+		}
+		
+		$detail ['iridKey'] = $XDeode->encode ( $detail ['irid'] );
+		$detail ['iridEn'] = $this->authcode ( $detail ['irid'], '' );
+		return $detail;
 	}
-	
 	public function getInvoiceReceivablesByIrsid($irid = "", $sid = "") {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
@@ -419,8 +461,8 @@ class invoiceReceivables extends DooModel {
 				) );
 			
 			$detail ['sid'] = '';
-			$detail ['username'] = '';//
-			if (! empty ( $detail ['receivablesStaff'] )&&$detail ['receivablesStaff'] !='PUBLIC') {
+			$detail ['username'] = ''; //
+			if (! empty ( $detail ['receivablesStaff'] ) && $detail ['receivablesStaff'] != 'PUBLIC') {
 				$staff = explode ( "-", $detail ['receivablesStaff'] );
 				$detail ['sid'] = $staff [0];
 				

File diff suppressed because it is too large
+ 1 - 0
protected/model/invoiceStore.php


+ 3 - 1
protected/model/invoiceTraining.php

@@ -352,7 +352,7 @@ class invoiceTraining extends DooModel {
 			// 获得开票金额合计 入账金额合计 入账完成度
 			Doo::loadModel ( 'invoice' );
 			$invoice = new invoice ();
-			
+			//echo $itid;
 			$invoiceList=$companyList=$RIList = $invoiceRecelvablesList = array ();
 			if (! empty ( $itid )) {
 				$itidSql = $itid;
@@ -363,6 +363,7 @@ class invoiceTraining extends DooModel {
 				$companyList = $invoice->sumOfInvoiceRecelvablesCompany ( $itidSql );
 				//获得办事处已收款
 				$RIList=$invoice->sumOfInvoiceByItid($itid);
+				//print_r($RIList);
 			}
 			 //print_r($invoiceRecelvablesList);
 			
@@ -389,6 +390,7 @@ class invoiceTraining extends DooModel {
 			foreach ($RIList as $key=>$value){
 				if ($detail ['itid'] == $value ['trainId']) {
 					$detail ['RIAmount'] = $value ['invoicePrice'];
+					
 					break;
 				}
 			}

+ 68 - 76
protected/model/receipt.php

@@ -37,8 +37,6 @@ class receipt extends DooModel {
 	public $trainId;
 	public $trainLoanRid;
 	public $invoiceTrainId;
-	
-	
 	public $_table = 'CLD_receipt';
 	public $_primarykey = 'rid';
 	public $_fields = array (
@@ -77,7 +75,7 @@ class receipt extends DooModel {
 			'remittanceBankType',
 			'trainId',
 			'trainLoanRid',
-			'invoiceTrainId'
+			'invoiceTrainId' 
 	);
 	function receiptByYear($dateCondition, $sid) {
 		$sql = "select sum(sum) as sum from " . $this->_table . " where staff= '" . $sid . "' " . $dateCondition . " and status=2 ";
@@ -118,82 +116,78 @@ class receipt extends DooModel {
 		if (! is_numeric ( $rid ))
 			$rid = $XDeode->decode ( $rid );
 		
-		
 		$rinfo = $this->getOne ( array (
 				'where' => 'rid=' . $rid,
 				'asArray' => true 
 		) );
 		
-		$rinfo['ridKey']=$XDeode->encode ( $rinfo ['rid'] );
-		$rinfo['trainLoanRidKey']=$XDeode->encode ( $rinfo ['trainLoanRid'] );
+		$rinfo ['ridKey'] = $XDeode->encode ( $rinfo ['rid'] );
+		$rinfo ['trainLoanRidKey'] = $XDeode->encode ( $rinfo ['trainLoanRid'] );
 		$XDeode = new XDeode ( 7 );
-		$rinfo['ridKey7']=$XDeode->encode ( $rinfo ['rid'] );
+		$rinfo ['ridKey7'] = $XDeode->encode ( $rinfo ['rid'] );
 		
-		$rinfo['category']=$Lcategory->getCategoryById($rinfo['cid']);
-		$rinfo['staffDetail']=$staff->getStaffBySid($rinfo['staff']);
+		$rinfo ['category'] = $Lcategory->getCategoryById ( $rinfo ['cid'] );
+		$rinfo ['staffDetail'] = $staff->getStaffBySid ( $rinfo ['staff'] );
 		
-		//$rinfo['sum']=number_format ($rinfo['sum'],2);
+		// $rinfo['sum']=number_format ($rinfo['sum'],2);
 		
 		return $rinfo;
 	}
-	
-	function getReceiptByinvoiceTrainId($invoiceTrainId = '') {
+	function getReceiptByinvoiceTrainId($invoiceTrainId = 0) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-	
+		
 		Doo::loadModel ( 'L_category' );
 		$Lcategory = new L_category ();
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
-	
+		
 		if (! is_numeric ( $invoiceTrainId ))
 			$invoiceTrainId = $XDeode->decode ( $invoiceTrainId );
-	
-	
-			$rinfo = $this->getOne ( array (
-					'where' => 'invoiceTrainId=' . $invoiceTrainId,
-					'asArray' => true
-			) );
-	
-			if (empty($rinfo)){
-				return array();
-			}
-			
-			$rinfo['ridKey']=$XDeode->encode ( $rinfo ['rid'] );
-			$rinfo['trainLoanRidKey']=$XDeode->encode ( $rinfo ['trainLoanRid'] );
-			$XDeode = new XDeode ( 7 );
-			$rinfo['ridKey7']=$XDeode->encode ( $rinfo ['rid'] );
-	
-			$rinfo['category']=$Lcategory->getCategoryById($rinfo['cid']);
-			$rinfo['staffDetail']=$staff->getStaffBySid($rinfo['staff']);
-	
-			return $rinfo;
+		
+		$rinfo = $this->getOne ( array (
+				'where' => 'invoiceTrainId=' . $invoiceTrainId,
+				'asArray' => true 
+		) );
+		
+		if (empty ( $rinfo )) {
+			return array ();
+		}
+		
+		$rinfo ['ridKey'] = $XDeode->encode ( $rinfo ['rid'] );
+		$rinfo ['trainLoanRidKey'] = $XDeode->encode ( $rinfo ['trainLoanRid'] );
+		$XDeode = new XDeode ( 7 );
+		$rinfo ['ridKey7'] = $XDeode->encode ( $rinfo ['rid'] );
+		
+		$rinfo ['category'] = $Lcategory->getCategoryById ( $rinfo ['cid'] );
+		$rinfo ['staffDetail'] = $staff->getStaffBySid ( $rinfo ['staff'] );
+		
+		return $rinfo;
 	}
 	
-	
 	/**
 	 * 默认获得10条
 	 * @param unknown $sid
 	 * @param unknown $cid
 	 * @param unknown $limit
 	 */
-	function getReceiptLoanByStatus($sid,$cid,$status,$limit=10){
-		$sql='';
-		if ($sid!==false&&is_numeric($sid)){
-			$sql.=' and staff='.$sid;
+	function getReceiptLoanByStatus($sid, $cid, $status, $limit = 10) {
+		$sql = '';
+		if ($sid !== false && is_numeric ( $sid )) {
+			$sql .= ' and staff=' . $sid;
 		}
-		if ($cid!==false&&is_numeric($cid)){
-			$sql.=' and cid='.$cid;
+		if ($cid !== false && is_numeric ( $cid )) {
+			$sql .= ' and cid=' . $cid;
 		}
 		
 		$list = $this->find ( array (
-				'where' => 'Rtype=1 and status=' . $status.$sql,
-				'asArray' => true
+				'where' => 'Rtype=1 and status=' . $status . $sql,
+				'asArray' => true 
 		) );
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-		foreach ($list as $key=>$value){
-			$list[$key]['ridKey']=$XDeode->encode ( $list[$key] ['rid'] );
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['ridKey'] = $XDeode->encode ( $list [$key] ['rid'] );
 		}
 		return $list;
 	}
@@ -203,11 +197,10 @@ class receipt extends DooModel {
 	 * @param unknown $status
 	 * @return string
 	 */
-	function getReceiptByWaste(){
-		
+	function getReceiptByWaste() {
 		$list = $this->find ( array (
 				'where' => 'status=2 or status=6 or status=1',
-				'asArray' => true
+				'asArray' => true 
 		) );
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
@@ -215,33 +208,33 @@ class receipt extends DooModel {
 		Doo::loadModel ( 'wasteBook' );
 		$wasteBook = new wasteBook ();
 		
-		$accountType=0;
-		foreach ($list as $key=>$value){
-			$list[$key]['ridKey7']=$XDeode7->encode ( $list[$key] ['rid'] );
-			$list[$key]['ridKey']=$XDeode->encode ( $list[$key] ['rid'] );
+		$accountType = 0;
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['ridKey7'] = $XDeode7->encode ( $list [$key] ['rid'] );
+			$list [$key] ['ridKey'] = $XDeode->encode ( $list [$key] ['rid'] );
 			
-			if ($list[$key] ['Rtype']==0){
-				$accountType=3;
-			}elseif ($list[$key] ['Rtype']==1){
-				if($list[$key] ['Rtype']==0){
-					$accountType=1;
-				}elseif($list[$key] ['Rtype']==1){
-					$accountType=2;
-				}
-			}elseif ($list[$key] ['Rtype']==2){
-				$accountType=4;
-			}elseif ($list[$key] ['Rtype']==3){
-				$accountType=12;
+			if ($list [$key] ['Rtype'] == 0) {
+				$accountType = 3;
+			} elseif ($list [$key] ['Rtype'] == 1) {
+				if (! empty ( $list [$key] ['accountItem'] ))
+					$accountType = 2;
+				else
+					$accountType = 1;
+			} elseif ($list [$key] ['Rtype'] == 2) {
+				$accountType = 4;
+			} elseif ($list [$key] ['Rtype'] == 3) {
+				$accountType = 12;
 			}
-			//是否已经生成流水
-			$wbDetail=array();
-			if (!empty($accountType)){
-				$wbDetail=$wasteBook->getWateBookByAD($accountType,$list[$key] ['rid']);
-				if (!empty($wbDetail)){
-					unset($list[$key]);
+			
+			// 是否已经生成流水
+			$wbDetail = array ();
+			if (! empty ( $accountType )) {
+				$wbDetail = $wasteBook->getWateBookByAD ( $accountType, $list [$key] ['rid'] );
+				if (! empty ( $wbDetail )) {
+					unset ( $list [$key] );
 				}
-			}else{
-				unset($list[$key]);
+			} else {
+				unset ( $list [$key] );
 			}
 		}
 		return $list;
@@ -254,16 +247,16 @@ class receipt extends DooModel {
 	 */
 	public function setReceiptByCondition($item = array(), $rid = "") {
 		$lid = 0;
-	
+		
 		if (is_array ( $item ) && ! empty ( $item )) {
 			foreach ( $item as $key => $value ) {
 				$this->$key = $value;
 			}
-				
+			
 			if (! empty ( $isid )) {
 				$condition = array (
 						'where' => "rid in (" . $rid . ")",
-						'asArray' => TRUE
+						'asArray' => TRUE 
 				);
 				$this->update ( $condition );
 			} else
@@ -271,7 +264,6 @@ class receipt extends DooModel {
 		}
 		return $lid;
 	}
-	
 }
 
 ?>

+ 37 - 1
protected/model/verify.php

@@ -7,11 +7,12 @@ class verify extends DooModel {
     public $vid;
     public $description;
     public $staff;
+    public $subordinate;
     
     public $_table = 'CLD_verify';
     public $_primarykey = 'vid';
     
-    public $_fields = array('vid', 'description', 'staff');
+    public $_fields = array('vid', 'description', 'staff','subordinate');
 	
     /**
      * 获得所有审批组
@@ -42,6 +43,41 @@ class verify extends DooModel {
     	return $veList;
     }
     
+    
+    function getVerifyBySubordinate($subordinate='',$subordinate2=''){
+    	if (empty($subordinate)){
+    		return array();
+    	}
+    	$con='subordinate like "%'.$subordinate.'%"';
+    	if (!empty($subordinate2)){
+    		$con='subordinate like "%'.$subordinate.'%" or subordinate like "%'.$subordinate2.'%"';
+    	}
+    	$veList = $this->find ( array (
+    			'where'=>$con,
+    			'asArray' => true
+    	) );
+    	Doo::loadModel ( "role" );
+    	$role = new role ();
+    	foreach ( $veList as $key => $value ) {
+    		$v = json_decode ( $value ['staff'] );
+    		$list = array ();
+    		foreach ( $v as $n => $m ) {
+    			if ($m ['1'] == 'ROLE') {
+    				$roleInfo = $role->getOne ( array (
+    						'where' => 'rid=' . $m [0],
+    						'asArray' => true
+    				) );
+    				$v [$n] [1] = $roleInfo ['name'];
+    				array_push ( $list, $roleInfo ['name'] );
+    			} else {
+    				array_push ( $list, $v [$n] [1] );
+    			}
+    		}
+    		$veList [$key] ['staff'] = implode ( '>', $list );
+    	}
+    	return $veList;
+    }
+    
     /**
      * 获得某费用单的审批信息
      */

+ 40 - 0
protected/view/admin/admin_reportGroup.html

@@ -58,6 +58,27 @@
 				           	  </div>
 			              <label class="control-label"><a href="/adminRole">编辑角色</a></label>
 
+
+ <label class="control-label">可见</label>
+<label style="display:inline">
+<input type="checkbox" name="subordinate[]"  value="LOAN">
+借款
+ </label>
+ <label style="display:inline">
+<input type="checkbox" name="subordinate[]"  value="RECEIPT">
+报销
+ </label>
+ <label style="display:inline">
+<input type="checkbox" name="subordinate[]"  value="TRAIN">
+培训班结算
+ </label>
+ <label style="display:inline">
+<input type="checkbox" name="subordinate[]"  value="REMIT">
+对公汇款
+ </label>
+
+
+
 					<div class="control-group">
 					<input type="hidden" name="uidlist" id="uidlist" value="">
 			              <label class="control-label">已选审批人</label>
@@ -68,6 +89,8 @@
 			            </div>
 
 
+
+
 &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="CLEARTUIL()">清除</a>
 			            	</div>
 			            
@@ -84,6 +107,7 @@
                 <tr>
                   <th>组描述</th>
                   <th>成员</th>
+                  <th>可见</th>
                 </tr>
               </thead>
               <tbody>
@@ -91,6 +115,22 @@
                 <tr>
                   <td>{{verify' value.description}}</td>
                   <td>{{verify' value.staff}}</td>
+                  <td>
+                  <!-- loop verify' value.subordinateList -->
+                  		<!-- if {{verify' value' value}}=='LOAN' -->
+                  		借款 
+                  		<!-- endif -->
+                  		<!-- if {{verify' value' value}}=='RECEIPT'  -->
+                  		报销 
+                  		<!-- endif -->
+                  		<!-- if {{verify' value' value}}=='TRAIN'  -->
+                  		培训班结算
+                  		<!-- endif -->
+                  		<!-- if {{verify' value' value}}=='REMIT'  -->
+                  		对公汇款
+                  		<!-- endif -->
+                  <!-- endloop -->
+                  </td>
                 </tr>
                <!-- endloop -->
                

+ 31 - 0
protected/view/admin/implement.html

@@ -66,6 +66,37 @@
 							<td class="taR"><b style="font-size:24px">¥{{receiptDetail' value.loanSum}}</b><br>{{receiptDetail' value.loanSumCN}}</td></tr>
 							</tbody>
 						</table>
+						
+						<br/>
+						<!-- if empty({{wbDetailLoan}}) -->
+						<div class="alert" style="margin:0">该费用没有生成流水。</div>
+						<br/>
+						<!-- else -->
+						<div class="alert alert-erro" style="margin:0">该费用已生成流水。</div>
+						<br/>
+						<table class="table table-bordered table-condensed table-hover">
+									<tbody>
+										<tr><th colspan="2" class="taC">银行水流详情</th></tr>
+										<tr><th>流水类型("支出"由公司汇出,"收入"提交人汇款至公司。)</th>
+										<td class="taR" width="200">
+										<!-- if {{wbDetailLoan.expensesType}}==1 -->
+										收入
+										<!-- elseif {{wbDetailLoan.expensesType}}==2 -->
+										支出
+										<!-- endif -->
+										</td></tr>
+										<tr><th>汇款金额</th><td class="taR" width="220">¥{{wbDetailLoan.accountPriceShow}}
+										</td></tr>
+										<tr><th>提交人</th><td class="taR" width="220">
+										{{wbDetailLoan.category}}-{{wbDetailLoan.name}}</td></tr>
+										<tr><th>备注</th><td class="taR" width="220">{{wbDetailLoan.remarks}}
+										</td></tr>
+										</tbody>
+						</table>
+						<!-- endif -->
+						
+						
+						
 						<br/>
 						<table class="table table-bordered table-condensed table-hover">
 	  					<tbody>

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

@@ -3,7 +3,7 @@
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>js/invoice.validator.js"></script>
-<script src="<?= WEB_SITE_GLOBAL ?>js/invoice.js"></script>
+<script src="<?= invoice ?>"></script>
 
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/notifications/notifications.js"></script>
 
@@ -249,7 +249,7 @@
 							<!-- endif -->
 							</div>
 							
-							<div class="clearfix" style="display:none;">
+							<div class="clearfix" >
 							<legend><div class="fR"><a href="/invoiceUntreadED">查看更多</a></div>已退发票</legend>
 							<!-- if !empty({{untreadStatusList}}) -->
 								<table class="table table-bordered table-condensed">

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

@@ -64,7 +64,7 @@
 							<!-- endloop -->
 							</td>
 							<td><b>¥{{list' value.sumPrice}}</b></td>
-							<td>{{list' value.updateTime}}</td>
+							<td>{{list' value.bindTime}}</td>
 						</tr>
 						<!-- endloop -->
 						

+ 140 - 11
protected/view/admin/invoiceAdd.html

@@ -2,7 +2,134 @@
 <link rel=stylesheet href="<?= WEB_SITE_GLOBAL ?>css/jquery.validator.css"> 
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/jquery.validator.min.js"></script>
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
-<script src="<?= WEB_SITE_GLOBAL ?>js/invoice.validator.js"></script>
+<script src="<?= invoiceValidator ?>"></script>
+
+<script>
+$(function() {
+	
+$('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
+		var amount=invoiceQuantity*invoiceUnitPrice;
+		if (!isNaN(amount) ){
+			$("#invoicePrice").val(amount);
+			if(amount>10000){
+				var msgHtml='<span class="msg-box n-right" for="invoicePrice"><span role="alert" class="msg-wrap n-error"><span class="n-icon"></span><span class="n-msg">此处必须小于10000</span></span></span>';
+				$("#msgMaxPrice").html(msgHtml);
+			}else{
+				$("#msgMaxPrice").html('');
+			}
+		}else{
+			$("#invoicePrice").val('');
+			$("#msgMaxPrice").html('');
+		}
+    }else{
+		$("#invoicePrice").val('');
+		$("#msgMaxPrice").html('');
+	}
+});
+
+$('#invoicePlain').click(function() {
+	$("#invoicePrice").val('');
+	$("#msgMaxPrice").html('');
+});
+
+$('#invoiceSpecial').click(function() {
+	var invoiceQuantity=$('#invoiceQuantity').val();
+	var invoiceUnitPrice=$('#invoiceUnitPrice').val();
+	var amount=invoiceQuantity*invoiceUnitPrice;
+	if (!isNaN(amount) ){
+		$("#invoicePrice").val(amount);
+		if(amount>10000){
+			var msgHtml='<span class="msg-box n-right" for="invoicePrice"><span role="alert" class="msg-wrap n-error"><span class="n-icon"></span><span class="n-msg">此处必须小于10000</span></span></span>';
+			$("#msgMaxPrice").html(msgHtml);
+		}else{
+			$("#msgMaxPrice").html('');
+		}
+	}else{
+		$("#invoicePrice").val('');
+		$("#msgMaxPrice").html('');
+	}
+});
+
+
+$('button[invoiceDetalfn]').click(function() {
+	
+	var cid=$('#cid option:selected').html();
+	var st=$("input[name='settlementType']:checked").val();
+	var settlementType='';
+	if(st=='SOFTWARE'){
+		settlementType='软件销售 ';
+	}else if(st=='TRAINING'){
+		settlementType='培训班 ';
+	}
+	
+	var it=$("input[name='invoiceType']:checked").val();
+	
+	
+	var invoiceTitle=$("#invoiceTitle").val();
+	var TINT=$("#TINT").val();
+	var addressT=$("#addressT").val();
+	var phoneT=$("#phoneT").val();
+	var bankT=$("#bankT").val();
+	var bankAccountT=$("#bankAccountT").val();
+	
+	var invoiceCompany=$("#invoiceCompany").val();
+	var TIN=$("#TIN").val();
+	var address=$("#address").val();
+	var phone=$("#phone").val();
+	var bank=$("#bank").val();
+	var bankAccount=$("#bankAccount").val();
+	
+	var invoiceType='';
+	if(it=='0'){
+		invoiceType='增值税普通发票  ';
+		
+	}else if(it=='1'){
+		invoiceType='增值税专用发票 ';
+		invoiceTitle=invoiceCompany;
+		
+		TINT=TIN;
+		addressT=address;
+		phoneT=phone;
+		bankT=bank;
+		bankAccountT=bankAccount;
+	}
+	
+	var invoiceElement=$('#invoiceElement option:selected').html();
+	var invoiceQuantity=$("#invoiceQuantity").val();
+	var invoiceUnitPrice=$("#invoiceUnitPrice").val();
+	var invoicePrice=invoiceQuantity*invoiceUnitPrice;
+	
+	var html='<div class="modal-body"><table class="table table-condensed table-bordered"><tbody><tr><th class="taC">开票信息</th><th class="taC">发票内容</th></tr><tr><td>';
+		html+='<p><span class="text-truncate">所在办事处:</span><span>'+cid+'</span></p>';
+		html+='<p><span class="text-truncate">结算方式:</span><span class="colRed">'+settlementType+'</span>';
+		html+='</p><p><span class="text-truncate">发票类型:</span><span class="colRed">'+invoiceType+'</span></p>';
+		html+='</td><td>';
+		html+='<p><span class="text-truncate">开票内容:</span><span class="colRed">'+invoiceElement+'</span>';
+		html+='</p><p><span class="text-truncate">数量:</span><span>'+invoiceQuantity+'</span>';
+		html+='</p><p><span class="text-truncate">单价:</span><span>'+invoiceUnitPrice+'</span>';
+		html+='</p><p><span class="text-truncate">开票金额:</span><span class="colRed">'+invoicePrice+'</span>';
+		html+='</p><p><span class="text-truncate">单位名称:</span><span class="colRed">'+invoiceTitle+'</span>';
+		html+='</p><p><span>纳税人识别码:</span><span class="colRed">'+TINT+'</span></p>';
+		html+='<p><span class="text-truncate">注册地址:</span><span class="colRed">'+addressT+'</span></p>';
+		html+='<p><span class="text-truncate">注册电话:</span><span class="colRed">'+phoneT+'</span></p>';
+		html+='<p><span class="text-truncate">开户银行:</span><span class="colRed">'+bankT+'</span></p>';
+		html+='<p><span class="text-truncate">银行帐号:</span><span class="colRed">'+bankAccountT+'</span></p>';
+		html+='</td></tr></tbody></table><p>红字为重要内容!请谨慎确认无误!申请提交后开票信息将不能修改!</p></div>';
+	
+		$("#modalBody").html(html);
+		
+});
+
+
+})
+
+</script>
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">
@@ -25,6 +152,7 @@
 				<div class="borad-news">
 					<div class="saeaList">
 						<form action="/invoiceAddDo"  method="post" id="invoice">
+						<input type="hidden" name="token" value="{{token}}">
 						<table class="table table-bordered table-condensed">
 								<tbody>
 								<blockquote><p class=""><a href="/invoiceAdd/AUTOFILL" copy-invoice>加载上一张开票信息</a></p></blockquote>
@@ -32,7 +160,7 @@
 								<tr>
 									<th class="taC" width="150">所在办事处</th>
 									<td>
-										<select name="cid">
+										<select name="cid" id="cid">
 								<!-- loop category -->
 								<option <!-- if {{category' value.cid}} == {{staff.0.cid}}  --> selected <!-- endif --> value="{{category' value.cid}}" >{{category' value.title}}</option>
 								<!-- endloop -->
@@ -48,19 +176,20 @@
 								<tr>
 									<th class="taC"><span class="colRed">*</span>数量</th>
 									<td>
-										<input style="width:60px" name="invoiceQuantity" id="invoiceQuantity" value="1" placeholder="输入数量" pattern="[0-9]" type="number" min="1" step="1">
+										<input style="width:60px" name="invoiceQuantity" amount id="invoiceQuantity" value="1" placeholder="输入数量" pattern="[0-9]" type="number" min="1" step="1">
 									</td>
 									<th class="taC"><span class="colRed">*</span>单价</th>
-									<td><input style="width:100px" name="invoiceUnitPrice" id="invoiceUnitPrice"  placeholder="输入单价" pattern="[0-9]" type="number" min="1" step="100"></td>
+									<td><input style="width:100px" name="invoiceUnitPrice" amount id="invoiceUnitPrice"  placeholder="输入单价" pattern="[0-9]" type="number" min="1" step="100"></td>
 								</tr>
 								<tr>
 									<th class="taC"><span class="colRed">*</span>开票金额</th>
 									<td colspan="3">
 									
-										<p class="colGray">数量*单价=开票金额&nbsp;&nbsp;&nbsp;&nbsp;<span class="colRed">根据公司规定:专用发票总金额暂时不能超过10000.00(一万)元。</span></p>
+										<p class="colGray">数量*单价=开票金额&nbsp;&nbsp;&nbsp;&nbsp;<span class="colRed">专用发票总金额暂时不能超过10000.00(一万)元。</span></p>
 										<b class="colOrange" id="tp" style="font-size:18px">¥0</b>
-									
-									<input value="0"  placeholder="输入开票金额" pattern="[0-9]" name="invoicePrice" id="invoicePrice" type="hidden" min="0" step="0.01">
+										<span id="msgMaxPrice"></span>
+										<input  name="10000" id="10000" type="hidden" value="10000">
+									<input  placeholder="输入开票金额" pattern="[0-9]" name="invoicePrice" id="invoicePrice" type="hidden" min="0" step="0.01">
 									</td>
 									
 								</tr>
@@ -87,7 +216,7 @@
 									<select name='trainId' id='trainId' >
 									<option selected value="">请选择</option>
 									<!-- loop itList -->
-									<option value="{{itList' value.itidKey}}">{{itList' value.trainName}}</option>
+									<option value="{{itList' value.itidKey}}">{{itList' value.trainDate}}&nbsp;{{itList' value.trainName}}</option>
 									<!-- endloop -->
 									</select>
 									</label>
@@ -227,7 +356,7 @@
 								</tr>
 								</tbody>
 							</table>
-						<p class="taR"><button type="button" class="button" href="#confirm" data-toggle="modal">提交申请</button></p>
+						<p class="taR"><button type="button" class="button" invoiceDetalfn href="#confirm" data-toggle="modal">提交申请</button></p>
 						
 						<div class="modal hide fade" id="confirm">
   <div class="modal-dialog">
@@ -235,8 +364,8 @@
     <div class="modal-header">
     <h3>确认信息无误</h3>
     </div>
-    <div class="modal-body">
-    	申请提交后开票信息将不能修改,请确认信息无误;邮寄信息可在发票邮寄前联系相关人员更正修改。
+    <div class="modal-body" id="modalBody">
+    	
     </div>
 	<div class="modal-footer">
 	<input type="submit" class="button" value="无误,提交申请">

+ 81 - 2
protected/view/admin/invoiceApprovalAchieve.html

@@ -1,5 +1,5 @@
 <!-- include 'header' -->
-<script src="<?= WEB_SITE_GLOBAL ?>js/invoice.js"></script>
+<script src="<?= invoice ?>"></script>
 <link href="<?= WEB_SITE_GLOBAL ?>css/datepicker.min.css" rel="stylesheet" type="text/css">
 <script src="<?= WEB_SITE_GLOBAL ?>js/datepicker.min.js"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>js/datepicker.zh.js"></script>
@@ -7,6 +7,45 @@
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/DataTables/jquery.dataTables.min.js"></script>
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/dataTables.fixedColumns.min.js"></script>
 
+<script>
+$(function() {
+	
+	$('.fnSettlementType').live('click', function() {
+		var iidKey=$(this).attr("data-iidKey");
+		$.ajax({
+			url: '/ajaxGetInvoice',
+			type : "post",
+			cache : false,
+			dataType : "json",
+			data : {
+				iidKey : iidKey
+			},
+			global : true,
+			success : function(data) {
+				if (data.status == 1) {
+					if(data.invoiceDetail.settlementType==0){
+						$("#SOFTWARE").attr("checked","checked");
+						//$("#rdo1").removeAttr("checked");
+					}else if(data.invoiceDetail.settlementType==1){
+						$("#TRAINING").attr("checked","checked");
+					}
+					$("#trainId").html(data.settlementHtml);
+					$("#iidKey").val(iidKey);
+				} else{
+					alert('数据获取失败');
+				}	
+			},
+			error : function(err) {
+				alert('操作失败');
+			}
+		});
+		
+	});
+	
+})
+
+</script>
+
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">
@@ -94,6 +133,7 @@
 							<th>单价</th>
 							<th>开票金额</th>
 							
+							<th>结算方式</th>
 							
 							<th>收件人~电话</th>
 							<th>收件地址</th>
@@ -126,7 +166,46 @@
 		
 		<div id="nc"></div>
 	</div>
-    <!--弹出内容-->        	
+    <!--弹出内容-->   
+    
+    
+    <!--弹出修改结算方式-->
+	<div class="modal hide fade" id="editPay">
+	<form action="/invoiceSettlementChange" method="post" >
+	<input type="hidden" name="iidKey" id="iidKey" value="">
+		<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">
+						<tr>
+							<th class="taC" rowspan="2"><span class="colRed">*</span>结算方式</th><td colspan="3">
+							<label class="radio"><input type="radio" name="settlementType" id="SOFTWARE" value="SOFTWARE">软件销售</label>
+							</td>
+						</tr>
+						<tr>
+							<td>
+							<label class="radio"><input type="radio" name="settlementType" id="TRAINING" value="TRAINING" >培训班</label>
+								<select name='trainId' id='trainId' >
+									
+									
+								</select>
+							</td>
+						</tr>
+					</table>
+				</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>
+    
+         	
 <script type="text/javascript">autoFlashHeight();</script>	
 <script type="text/javascript">
 $(document).ready( function () {

+ 9 - 0
protected/view/admin/invoiceElement.html

@@ -1,5 +1,8 @@
 
 <!-- if isset({{invoiceDetail}}) -->
+<option <!-- if {{invoiceDetail.invoiceElement}}=='纵横公路工程造价管理软件V10.1' --> selected <!-- endif --> value="纵横公路工程造价管理软件V10.1">纵横公路工程造价管理软件V10.1</option>
+<option <!-- if {{invoiceDetail.invoiceElement}}=='纵横公路造价编审软件V10.1' --> selected <!-- endif --> value="纵横公路造价编审软件V10.1">纵横公路造价编审软件V10.1</option>
+
 <option <!-- if {{invoiceDetail.invoiceElement}}=='纵横公路工程造价管理系统V9.0' --> selected <!-- endif --> value="纵横公路工程造价管理系统V9.0">纵横公路工程造价管理系统V9.0</option>
 <option <!-- if {{invoiceDetail.invoiceElement}}=='纵横公路工程设计数量表算量软件V3.3' --> selected <!-- endif --> value="纵横公路工程设计数量表算量软件V3.3">纵横公路工程设计数量表算量软件V3.3</option>
 <option <!-- if {{invoiceDetail.invoiceElement}}=='纵横公路工程计量支付决算一体化软件V3.3' --> selected <!-- endif --> value="纵横公路工程计量支付决算一体化软件V3.3">纵横公路工程计量支付决算一体化软件V3.3</option>
@@ -11,7 +14,11 @@
 <option <!-- if {{invoiceDetail.invoiceElement}}=='软件培训费' --> selected <!-- endif --> value="软件培训费">软件培训费</option>
 <option <!-- if {{invoiceDetail.invoiceElement}}=='软件服务费' --> selected <!-- endif --> value="软件服务费">软件服务费</option>
 <option <!-- if {{invoiceDetail.invoiceElement}}=='报表定制费' --> selected <!-- endif --> value="报表定制费">报表定制费</option>
+<option <!-- if {{invoiceDetail.invoiceElement}}=='软件升级费' --> selected <!-- endif --> value="软件升级费">软件升级费</option>
 <!-- else -->
+<option value="纵横公路工程造价管理软件V10.1">纵横公路工程造价管理软件V10.1</option>
+<option value="纵横公路造价编审软件V10.1">纵横公路造价编审软件V10.1</option>
+
 <option value="纵横公路工程造价管理系统V9.0">纵横公路工程造价管理系统V9.0</option>
 <option value="纵横公路工程设计数量表算量软件V3.3">纵横公路工程设计数量表算量软件V3.3</option>
 <option value="纵横公路工程计量支付决算一体化软件V3.3">纵横公路工程计量支付决算一体化软件V3.3</option>
@@ -23,4 +30,6 @@
 <option value="软件培训费">软件培训费</option>
 <option value="软件服务费">软件服务费</option>
 <option value="报表定制费">报表定制费</option>
+<option value="软件升级费">软件升级费</option>
+
 <!-- endif -->

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

@@ -68,7 +68,12 @@
                                     <a target="_blank" href="http://www.kuaidi100.com/chaxun?com={{invoiceList' value.untreadCom}}&nu={{invoiceList' value.untreadNumber}}">查询快递</a> 
                                     <!-- endif -->
                                     </td>
-                                    <td><a class="button btn-block" diss-data="{{pendingInvoice' value.iidKey}}" node-invoice="untreadInvoice"  href="#return" data-toggle="modal">确认退票</a></td>
+                                    <td>
+                                    <div class="btn-group">
+                                    <a class="button btn-inline" diss-data="{{pendingInvoice' value.iidKey}}" node-invoice="untreadInvoice"  href="#return" data-toggle="modal">确认退票</a>
+                                    <a class="button btn-gray btn-inline" href="javascript:if(window.confirm('确认撤回申请?'))window.location='/invoiceUntreadRecallDo/{{invoiceList' value.iidKeyK}}'" data-toggle="modal">退回申请</a>
+                                    </div>
+                                    </td>
                                 </tr>
                                 <!-- endloop -->
 								</tbody>
@@ -84,7 +89,7 @@
 							<table class="table table-bordered table-condensed">
 								<tbody>
 								<tr><th class="taC">开票流水号</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>
+								<th class="taC" width="90">负票抵销</th>
 								</tr>
 								
 								<!-- loop establishedInvoice -->

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

@@ -63,17 +63,7 @@
 	  						<tr><th class="taR">合计</th><td class="colGreen taR" id="travelResult">¥0.00</td></tr>
 	  						
 	  						
-	  						<tr><th colspan="2" class="taC">培训班费用</th></tr>
-	  						<!-- loop acItem -->
-		  						<!-- if {{acItem' value.category}} =="培训班费用" -->
-	  						<tr>
-	  						<th>{{acItem' value.name}}</th>
-	  						<td  width="200" class="taR">¥<input type="number" id="train_{{acItem' value.aid}}" name="train[]" value="0" placeholder="输入{{acItem' value.name}}" pattern="[0-9]" step="0.01" min="0" class="span2"></td>
-	  						</tr>
-	  							<!-- endif -->
-	  						<!-- endloop -->
 	  						
-	  						<tr><th class="taR">合计</th><td class="colGreen taR" id="trainResult">¥0.00</td></tr>
 	  						
 	  						<tr><th colspan="2" class="taC">其他</th></tr>
 	  						<!-- loop acItem -->

+ 0 - 10
protected/view/admin/saea_edit.html

@@ -65,17 +65,7 @@
 	  						<tr><th class="taR">合计</th><td class="colGreen taR" id="travelResult">¥{{cSum.travelSum}}</td></tr>
 	  						
 	  						
-	  						<tr><th colspan="2" class="taC">培训班费用</th></tr>
-	  						<!-- loop acItem -->
-		  						<!-- if {{acItem' value.category}} =="培训班费用" -->
-	  						<tr>
-	  						<th>{{acItem' value.name}}</th>
-	  						<td  width="200" class="taR">¥<input type="number" id="train_{{acItem' value.aid}}" name="train[]" <!-- if !empty({{acItem' value.price}}) --> value="{{acItem' value.price}}" <!-- else --> value="0" <!-- endif --> placeholder="输入{{acItem' value.name}}" pattern="[0-9]" step="0.01" min="0" class="span2"></td>
-	  						</tr>
-	  							<!-- endif -->
-	  						<!-- endloop -->
 	  						
-	  						<tr><th class="taR">合计</th><td class="colGreen taR" id="trainResult">¥{{cSum.trainSum}}</td></tr>
 	  						
 	  						<tr><th colspan="2" class="taC">其他</th></tr>
 	  						<!-- loop acItem -->

+ 20 - 12
protected/view/app.html

@@ -10,18 +10,26 @@
 			</div>
 		</div>
 		<div class="warpContent">
-       <div class="appDown autoHeight">
-       		<div class="phone"></div>
-       		<div class="title"></div>
-       		<div class="down hide">
-       			<h1>即将上线</h1>
-       		</div>
-       		<div class="down ">
-       			<div class="qrcode" title="扫描二维码下载"><div class="saoma"></div>
-       			</div>
-       			<a href="http://cld.smartcost.com.cn/global/app/cld_app.apk" class="downButton" title="下载到电脑"></a>
-       		</div>
-       </div>
+	       <div class="appDown autoHeight">
+				<div class="iphone-panel">
+					<legend>iPhone</legend>
+					<p><h3>第一步 下载安装APP</h3></p>
+					<p><div class="qrcode qrcode2" title="扫描二维码下载"><div class="saoma"></div></div></p>
+					<p><h3>第二步 进入 设置-通用-设备管理(iOS 9+)</h3></p>
+					<p><img src="<?= WEB_SITE_GLOBAL ?>images/iphonedemo1.jpg"></p>
+					<p><img src="<?= WEB_SITE_GLOBAL ?>images/iphonedemo2.jpg"></p>
+					<p><h3>第三步 信任CLD APP应用</h3></p>
+					<p><img src="<?= WEB_SITE_GLOBAL ?>images/iphonedemo3.jpg"></p>
+					<p><img src="<?= WEB_SITE_GLOBAL ?>images/iphonedemo4.jpg"></p>
+				</div>
+				<div class="android-panel">
+					<legend>Android Phones</legend>
+					<p><h3>扫码下载</h3></p>
+					<p><div class="qrcode" title="扫描二维码下载"><div class="saoma"></div></div></p>
+					<p><h3>或 下载APK到电脑</h3></p>
+					<p><a href="http://cld.smartcost.com.cn/global/app/cld_app.apk" class="downButton" title="下载到电脑"></a></p>
+				</div>
+			</div>
 		</div>
 	</div>
 <script type="text/javascript">autoFlashHeight();</script>	

+ 13 - 4
protected/view/lock_look.html

@@ -6,7 +6,8 @@
 <script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.widget.js"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.position.js"></script>
 <script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.autocomplete.js"></script>
-<script src="<?= WEB_SITE_GLOBAL ?>/js/autoTag.js"></script>
+
+<script src="<?= autoTag ?>"></script>
 
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>/js/bootstrap.min.js"></script>
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
@@ -103,6 +104,11 @@
 	  				<div class="toolItem clearfix">
 	  				<form name="lock" action="/addDoLockLog" method="post">
 	  				<input type="hidden" name="klid" id="klid" ></input>
+	  				
+	  				<input type="hidden" name="name" id="name" ></input>
+	  				<input type="hidden" name="company" id="company" ></input>
+	  				
+	  				
 						  <div class="control-group">
 						    <label class="control-label" for="inputEmail">记录类型</label>
 						    <div class="controls">
@@ -134,7 +140,8 @@
 						  <div class="control-group"  >
 						    <label class="control-label" for="inputPassword">借出客户</label>
 						    <div class="controls">
-						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户,若输入客户不存在,请先添加该客户。"><input type="text" name="browseClient" id="tags" value=""></span>
+						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户,若输入客户不存在,请先添加该客户。">
+						      <input type="text" name="browseClient" id="tags" data-name='' data-company='' value=""></span>
 						    </div>
 						  </div>
 						  <div class="control-group" style="display:none">
@@ -153,7 +160,8 @@
 						  <div class="control-group">
 						    <label class="control-label" for="inputPassword">销售客户</label>
 						    <div class="controls">
-						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户,若输入客户不存在,请先添加该客户。"><input type="text" name="sellClient" id="tags2" value=""></span>
+						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户,若输入客户不存在,请先添加该客户。">
+						      <input type="text" name="sellClient" data-name='' data-company='' id="tags2" value=""></span>
 						    </div>
 						  </div>
 						  <div class="control-group" style="display:none">
@@ -170,7 +178,8 @@
 						  <div class="control-group">
 						    <label class="control-label" for="inputPassword">赠送客户</label>
 						    <div class="controls">
-						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户,若输入客户不存在,请先添加该客户。"><input type="text" name="giftClient" id="tags4" value=""></span>
+						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户,若输入客户不存在,请先添加该客户。">
+						      <input type="text" name="giftClient" data-name='' data-company='' id="tags4" value=""></span>
 						    </div>
 						  </div>