Selaa lähdekoodia

退票 后重新开票

caipin 5 vuotta sitten
vanhempi
commit
84515b78aa

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 3 - 10
global/js/index.js


+ 2 - 6
global/js/invoice.js

@@ -167,16 +167,12 @@ $(function() {
 		var start=$(this).val();
 		
 		var total=$('#invoiceNoStart').val();
-		
-		
-		
-		
+
 		var s=Number(start)+Number(total); 
 		
 		var k=Number(total);
 		var stLenght=total.length;
-		
-		
+
 		stLenght=Number(s.toString().length)+Number(stLenght)-Number(k.toString().length);
 		
 		

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

@@ -279,6 +279,8 @@ $acl ['INVOICE'] ['allow'] = array (
 $acl ['INVOICEEXTEND'] ['allow'] = array (
 		'InvoiceExtendController' => array (
 				'invoiceSettlementChange',
+                'invoiceUntreadAdd',
+                'invoiceUntreadAddDo'
 				
 		)
 );

+ 11 - 1
protected/config/routes.conf.php

@@ -118,6 +118,12 @@ $route['*']['/delRole/:rid'] = array('AdminController', 'delRole');
 $route['*']['/ajaxRoleStaff'] = array('AdminController', 'ajaxRoleStaff');
 $route['*']['/updateRole'] = array('AdminController', 'updateRole');
 
+/* 培训班结算营收权限设置 */
+$route['*']['/adminReceiptTrain'] = array('AdminController', 'adminReceiptTrain');
+$route['*']['/addReceiptTrainManage'] = array('AdminController', 'addReceiptTrainManage');
+$route['*']['/delReceiptTrainManage/:sidKey/:icidKey'] = array('AdminController', 'delReceiptTrainManage');
+
+
 /* 报销单新流程 */
 $route['*']['/saeaBorad'] = array('ReceiptController', 'saeaBorad');
 $route['*']['/saeaLoanAdd'] = array('ReceiptController', 'saeaLoanAdd');
@@ -410,7 +416,11 @@ $route['get']['/delInvoiceCompanyManage/:sidKey/:icidKey'] = array('AdminControl
 //普通
 $route['*']['/invoice'] = array('InvoiceController', 'invoice');
 $route['*']['/invoiceAdd'] = array('InvoiceController', 'invoiceAdd');
-$route['*']['/invoiceAdd'] = array('InvoiceController', 'invoiceAdd');
+//退票重新开票
+$route['*']['/invoiceUntreadAdd/:iidKey'] = array('InvoiceExtendController', 'invoiceUntreadAdd','extension'=>'.html');
+$route['*']['/invoiceUntreadAddDo'] = array('InvoiceExtendController', 'invoiceUntreadAddDo');
+
+
 $route['*']['/invoiceAdd/AUTOFILL'] = array('InvoiceController', 'invoiceAddFill');
 $route['*']['/invoiceAddDo'] = array('InvoiceController', 'invoiceAddDo');
 $route['post']['/invoiceDroppedDo'] = array('InvoiceController', 'invoiceDroppedDo');

+ 165 - 0
protected/controller/AdminController.php

@@ -1619,6 +1619,8 @@ class AdminController extends DooController {
 		
 	}
 	
+	
+	
 	/**
 	 * 添加办事处查看权限
 	 */
@@ -1726,6 +1728,169 @@ class AdminController extends DooController {
 				return '/adminInvoiceTrain';
 	}
 	
+	/**
+	 * 培训班结算营收权限设置
+	 */
+	function adminReceiptTrain(){
+	
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
+		Doo::loadModel ( "receiptTrainManage" );
+		$invoiceCompanyManage = new receiptTrainManage ();
+		Doo::loadModel ( 'L_category' );
+		$category = new L_category ();
+	
+		$categoryList = $category->getCategory ();
+		$managelist = $invoiceCompanyManage->find ( array (
+				'asArray' => true
+		) );
+		$staffList = $staff->getStaff ();
+	
+		$invoiceStaff = array ();
+		foreach ( $categoryList as $key => $value ) {
+			$invoiceStaff [$value ['cidKey']] = array ();
+			$categoryList [$key] ['html'] = '';
+			foreach ( $staffList as $k => $v ) {
+				$ul = array ();
+				if ($value ['cid'] == $v ['cid']) {
+					array_push ( $ul, $v ['sidKey'] );
+					array_push ( $ul, $v ['username'] );
+					array_push ( $invoiceStaff [$value ['cidKey']], $ul );
+				}
+			}
+	
+			foreach ( $managelist as $e => $a ) {
+				if ($value ['cid'] == $a ['cid']) {
+					$name = json_decode ( $a ['staff'] );
+					$staffString = "";
+					foreach ( $name as $y => $l ) {
+						$sidKey = $XDeode->encode ( $l [0] );
+						$icidKey = $XDeode->encode ( $a ['icid'] );
+						$staffString .= $l [1] . '<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delReceiptTrainManage/' . $sidKey . '/' . $icidKey . '\'"  role="button" title="删除" class="icon-">k</a>&nbsp;';
+					}
+					$categoryList [$key] ['html'] = $staffString;
+					break;
+				}
+			}
+		}
+	
+		$data ['categoryList'] = $categoryList;
+		$data ['invoiceStaff'] = json_encode ( $invoiceStaff );
+	
+		$data ['adminReceiptMenu'] = "adminReceiptTrain";
+		$data ['memu'] = "verify";
+		$data ['staff'] = $this->staff;
+		$this->render ( "/receipt/admin/adminReceiptTrain", $data );
+	
+	}
+	
+	/**
+	 * 添加培训班结算营收查看权限
+	 */
+	function addReceiptTrainManage() {
+		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
+		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
+	
+		if (! empty ( $cidKey ) && ! empty ( $sidKey )) {
+			Doo::loadModel ( "receiptTrainManage" );
+			$invoiceCompanyManage = new receiptTrainManage ();
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			Doo::loadModel ( 'staff' );
+			$staff = new staff ();
+	
+			$cid = $XDeode->decode ( $cidKey );
+			$sid = $XDeode->decode ( $sidKey );
+			if (! is_numeric ( $cid ) || ! is_numeric ( $sid ))
+				die ( 'illegal request' );
+					
+				$icm = $invoiceCompanyManage->getOne ( array (
+						'where' => 'cid =' . $cid,
+						'asArray' => true
+				) );
+				$staffDetail = $staff->getStaffBySid ( $sid );
+					
+				if (empty ( $icm )) {
+					$invoiceCompanyManage = new receiptTrainManage ();
+					$list = array ();
+	
+					$info = array (
+							$staffDetail ['sid'],
+							$staffDetail ['username']
+					);
+					array_push ( $list, $info );
+	
+					$invoiceCompanyManage->cid = $cid;
+					$invoiceCompanyManage->staff = json_encode ( $list );
+	
+					$invoiceCompanyManage->insert ();
+				} else {
+					$invoiceCompanyManage = new receiptTrainManage ();
+					$list = json_decode ( $icm ['staff'], true );
+	
+					$flag = true;
+					foreach ( $list as $key => $value ) {
+						if ($value [0] == $sid) {
+							$flag = false;
+							break;
+						}
+					}
+					if ($flag) {
+						$info = array (
+								$staffDetail ['sid'],
+								$staffDetail ['username']
+						);
+						array_push ( $list, $info );
+					}
+					$invoiceCompanyManage->staff = json_encode ( $list );
+					$invoiceCompanyManage->update ( array (
+							'where' => 'icid = ' . $icm ['icid']
+					) );
+				}
+				return '/adminReceiptTrain';
+		}
+		die ( 'illegal request' );
+	}
+	/**
+	 * 去除查看培训班结算营收
+	 */
+	function delReceiptTrainManage() {
+		$sidKey = isset ( $this->params ['sidKey'] ) ? $this->params ['sidKey'] : '';
+		$icidKey = isset ( $this->params ['icidKey'] ) ? $this->params ['icidKey'] : '';
+	
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+	
+		$icid = $XDeode->decode ( $icidKey );
+		$sid = $XDeode->decode ( $sidKey );
+		if (! is_numeric ( $icid ) || ! is_numeric ( $sid ))
+			die ( 'illegal request' );
+	
+			Doo::loadModel ( "receiptTrainManage" );
+			$invoiceCompanyManage = new receiptTrainManage ();
+	
+			$icmDetail = $invoiceCompanyManage->getInvoiceCMByIcid ( $icid );
+			if (empty ( $icmDetail ))
+				die ( 'illegal request' );
+	
+				$list = json_decode ( $icmDetail ['staff'], true );
+	
+				foreach ( $list as $k => $v ) {
+					if ($v [0] == $sid) {
+						unset ( $list [$k] );
+						break;
+					}
+				}
+				$invoiceCompanyManage = new receiptTrainManage ();
+				$invoiceCompanyManage->staff = json_encode ( $list );
+				$invoiceCompanyManage->update ( array (
+						'where' => 'icid = ' . $icmDetail ['icid']
+				) );
+	
+				return '/adminReceiptTrain';
+	}
 	
 	/**
 	 * 开票办事处权限设置

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 3 - 4
protected/controller/InvoiceController.php


+ 70 - 37
protected/controller/MainController.php

@@ -1818,6 +1818,20 @@ class MainController extends DooController {
 		
 		$clientname = trim ( $clientname );
 		
+		$token = $this->get_args ( 'token' ) ? $this->get_args ( 'token' ) : "";
+		if (empty ( $token )) {
+			die ( 'illegal request-token' );
+		} else {
+			session_start ();
+			if ($_SESSION ['token_' . $this->staff [0] ['sidKey']] != $token) {
+				header ( 'Content-Type:text/html;charset=utf-8' );
+				die ( '请勿重复填写客户资料' );
+			} else {
+				$_SESSION ['token_' . $this->staff [0] ['sidKey']] = '';
+			}
+		}
+		
+		
 		if (empty ( $this->staff [0] ['sid'] ))
 			return "/contacts";
 		
@@ -2422,7 +2436,6 @@ class MainController extends DooController {
 	}
 	function contacts() {
 		$data ['memu'] = "contacts";
-		
 		$data ['staff'] = $this->staff;
 		
 		$search = $this->get_args ( 'search' ) ? trim ( $this->get_args ( 'search' ) ) : "";
@@ -2522,17 +2535,6 @@ class MainController extends DooController {
 			$staffid = $data ['staff'] [0] ['sid'];
 		}
 		
-		// } else {
-		// $data ['district'] = $data ['district2'];
-		// if (! empty ( $search ))
-		// $sch = " and ( address like '%" . $search . "%' or clientname like '%" . $search . "%' or companyname like '%" . $search . "%' or qq like '%" . $search . "%' or telephone like '%" . $search . "%' or phone like '%" . $search . "%')";
-		// else {
-		// $sch = " ";
-		// $search = urldecode ( isset ( $this->params ['search'] ) ? $this->params ['search'] : "" );
-		// if (! empty ( $search ))
-		// $sch = " and ( address like '%" . $search . "%' or clientname like '%" . $search . "%' or companyname like '%" . $search . "%' or qq like '%" . $search . "%' or telephone like '%" . $search . "%' or phone like '%" . $search . "%')";
-		// }
-		// }
 		$data ['htmllv2'] = $data ['htmllv3'] = array ();
 		
 		if ($districtLv == 1) {
@@ -2656,8 +2658,6 @@ class MainController extends DooController {
 			$ClientTagList [$key] ['taginfo'] = $tag->getTagByTidL ( $value ['tag'] );
 		}
 		
-		// print_r($ClientTagList);die;
-		
 		foreach ( $data ['clientInfo'] as $key => $value ) {
 			if (! empty ( $value ['cid'] )) {
 				// $tinfo=$tagClient->getTagClientBySCid($value['cid'], $this->staff[0]['sid']);
@@ -3243,11 +3243,8 @@ class MainController extends DooController {
             $lid = $XDeode->decode ( $lidKey );
         }
 
-
-		
 		$data ['longleArray'] = $longle->getLongleByStatus ( $year, $cid, $staff, $status, $search, $productW );
 
-
         $longleDetail=$longle->getLongleByLid($lid);
         $longleLogDetail=$longle_log->getLongleByLid ( $lid );
 
@@ -3264,13 +3261,19 @@ class MainController extends DooController {
 		) );
 
         $data['lidKey']=$lidKey;
-		$data['longleDetail']=$longleDetail;
+        if (isset($longleDetail[0])){
+            $data['longleDetail']=$longleDetail[0];
+        }else{
+            $data['longleDetail']=array();
+        }
+
         $data ['longleLogHtml'] = $this->_getLongleLogHtml ( $longleLogDetail );
 		$data ['cid'] = $cid;
 		$data ['year'] = $year;
 		$data ['staff'] = $staff;
 		$data ['status'] = $status;
 		$data ['productName'] = $productW;
+        $data ['search'] =$search;
 		
 		Doo::loadModel ( 'L_category' );
 		Doo::loadModel ( 'staff' );
@@ -3891,7 +3894,19 @@ class MainController extends DooController {
 		echo json_encode ( $staffHtml );
 	}
 	function ajaxGetCompanyByAdd() {
-		$cid = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : "";
+		session_start ();
+		$cidKey = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : "";
+		
+		if (empty($cidKey)){
+			echo json_encode ( array (
+					"success" => false,
+					'data' => ''
+			) );
+		}
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		$cid = $XDeode->decode ( $cidKey );
 		
 		if (! empty ( $cid )) {
 			Doo::loadModel ( 'company' );
@@ -3901,9 +3916,6 @@ class MainController extends DooController {
 			$district = new district ();
 			$client = new client ();
 			
-			Doo::loadClass ( 'XDeode' );
-			$XDeode = new XDeode ( 5 );
-			
 			$districtInfo = $district->get_lv ( 1 );
 			
 // 			$companyInfo = $client->getClientByCompanyId ( $cid );
@@ -3918,7 +3930,6 @@ class MainController extends DooController {
 			
 // 			$companyInfo ['companyname'] = $cInfo ['companyname'];
 // 			$companyInfo ['address'] = $cInfo ['address'];
-			
 // 			$companyInfo ['ride'] = $cInfo ['ride'];
 // 			$companyInfo ['landmarks'] = $cInfo ['landmarks'];
 // 			$companyInfo ['stay'] = $cInfo ['stay'];
@@ -3951,6 +3962,11 @@ class MainController extends DooController {
 			$companyInfo ['natureAr'] = $this->nature;
 			$companyInfo ['natureArlenght'] = 12;
 			
+			$token = $this->set_token ();
+			
+			$_SESSION ['token_' . $this->staff [0] ['sidKey']] = $token;
+			$companyInfo ['token'] = $token;
+			
 			echo json_encode ( array (
 					"success" => true,
 					'data' => $companyInfo 
@@ -4148,7 +4164,19 @@ class MainController extends DooController {
 		die ();
 	}
 	function ajaxGetCompany() {
-		$companyname = $this->get_args ( 'companyId' ) ? $this->get_args ( 'companyId' ) : 0;
+		$companyIdKey = $this->get_args ( 'companyId' ) ? $this->get_args ( 'companyId' ) : 0;
+		
+		if (empty($companyIdKey)){
+			echo json_encode ( array (
+					"success" => false,
+					'html' => ''
+			) );
+		}
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$companyname = $XDeode->decode ( $companyIdKey );
 		
 		if (! empty ( $companyname )) {
 			
@@ -4192,7 +4220,8 @@ class MainController extends DooController {
 				$html = '<div class="header">
 				<h1 class="companyName"><div class="fR">
 						<a class="icon- add" node-syn="show" href="javascript:void(0)" title="同步地址信息">S</a>
-						<a href="javascript:void(0)"  title="编辑单位" class="icon- edit" onclick="editByCompany(' . $companyInfo ['cid'] . ')" >I</a> | <a title="在这个单位下添加客户"  href="javascript:void(0)"  class="icon- add" onclick="addClientByCompany(' . $companyInfo ['cid'] . ')" >H</a></div>' . $companyInfo ['companyname'] . '</h1>
+						<a href="javascript:void(0)"  title="编辑单位" class="icon- edit" onclick="editByCompany(' . $companyInfo ['cid'] . ')" >I</a> | 
+<a title="在这个单位下添加客户"  href="javascript:void(0)"  class="icon- add" onclick="addClientByCompany(\'' . $companyIdKey . '\')" >H</a></div>' . $companyInfo ['companyname'] . '</h1>
 
 				<div class="contactPanel">
 		  				<table>
@@ -4363,23 +4392,16 @@ class MainController extends DooController {
 				
 			}
 			
-		});				
-						
-						
-						
-						autoFlashHeight();
-						</script>";
+		});		
+		autoFlashHeight();
+		</script>";
 				echo json_encode ( array (
 						"success" => true,
 						'html' => $html 
 				) );
 				die ();
 			}
-		} else
-			echo json_encode ( array (
-					"success" => false,
-					'html' => '' 
-			) );
+		} 
 		die ();
 	}
 	function ajaxSetCompanyAddress() {
@@ -4706,7 +4728,7 @@ class MainController extends DooController {
 			$m = '<div class="contactPanel">
 		  		<table>
 		  			<tbody>
-		  			<tr><th>单位全称</th><td colspan="3"><a href="javascript:void(0)" onclick="getCompany(\'' . $companyInfo [0] ['cid'] . '\')">' . $companyInfo [0] ['companyname'] . '</a></td></tr>
+		  			<tr><th>单位全称</th><td colspan="3"><a href="javascript:void(0)" onclick="getCompany(\'' . $companyInfo [0] ['cidKey'] . '\')">' . $companyInfo [0] ['companyname'] . '</a></td></tr>
 		  			<tr><th>单位主页</th><td colspan="3">' . $clientInfo ['webservice'] . '</td></tr>
 		  			<tr><th>客户地区</th><td>' . $local [0] ['name'] . ',' . $local [1] ['name'] . ',' . $local [2] ['name'] . '</td><th>部门/职位</th><td>' . $clientInfo ['department'] . '/' . $clientInfo ['position'] . '</td></tr>
 		  			<tr><th>客户传真</th><td>' . $clientInfo ['fax'] . '</td><th>办公室</th><td>' . $clientInfo ['office'] . '</td></tr>
@@ -7766,6 +7788,17 @@ class MainController extends DooController {
 		
 		return $result ['count'];
 	}
+	
+	/**
+	 * 生成token
+	 * @return string
+	 */
+	function set_token() {
+		$str = md5 ( uniqid ( md5 ( microtime ( true ) ), true ) ); // 生成一个不会重复的字符串
+		$str = sha1 ( $str ); // 加密
+		return $str;
+	}
+	
 }
 
 ?>

+ 20 - 14
protected/controller/ReceiptController.php

@@ -317,13 +317,13 @@ class ReceiptController extends DooController {
 			// $receiptDetail=$receipt->getOne(array('where'=>'staff='.$this->staff[0]['sid'].' and status=4','asArray'=>true));
 			
 			$aItem = $accountItem->find ( array (
-					'where' => 'name like "办公费用" or name like "邮寄费" or name like "其他费用" or name like "公积金" or name like "社保"',
+					'where' => '(name like "办公费用" or name like "邮寄费" or name like "其他费用" or name like "公积金" or name like "社保") and category like "'.$this->AGENCY.'"',
 					'asArray' => true 
 			) );
 			$accountJson [$this->AGENCY] = $accountJson [$this->TRAVEL] = $accountJson [$this->TRAIN] = $accountJson [$this->OTHER] = array ();
 			$ag = $tr = $ta = $ot = 0;
 			$sum = $agencySum = $travelSum = $trainSum = $otherSum = 0;
-			
+			print_r($aItem);
 			foreach ( $aItem as $key => $value ) {
 				if ($value ['category'] == $this->AGENCY) {
 					if (isset ( $agency [$ag] )) {
@@ -346,7 +346,7 @@ class ReceiptController extends DooController {
 					'trainSum' => number_format ( $trainSum, 2, '.', '' ),
 					'otherSum' => number_format ( $otherSum, 2, '.', '' ) 
 			);
-			
+			//die;
 			// 报销单
 			$receipt->accountItem = json_encode ( $accountJson );
 			$receipt->staff = $this->staff [0] ['sid'];
@@ -545,9 +545,9 @@ class ReceiptController extends DooController {
 			) );
 			if (empty ( $receiptDetail ))
 				return "/saeaBorad";
-			
+				
 			$aItem = $accountItem->find ( array (
-					'where' => 'name like "办公费用" or name like "其他费用" or name like "公积金" or name like "社保"',
+					'where' => '(name like "办公费用" or name like "邮寄费" or name like "其他费用" or name like "公积金" or name like "社保") and category like "'.$this->AGENCY.'"',
 					'asArray' => true 
 			) );
 			$accountJson [$this->AGENCY] = $accountJson [$this->TRAVEL] = $accountJson [$this->TRAIN] = $accountJson [$this->OTHER] = array ();
@@ -957,8 +957,6 @@ class ReceiptController extends DooController {
 		
 		$veList = $verify->getVerifyBySubordinate('LOAN'); 
 		
-		
-		
 		$data ['category'] = $lCategory->find ( array (
 				'asArray' => true 
 		) );
@@ -2875,7 +2873,7 @@ class ReceiptController extends DooController {
 
             $rtDetail=$receiptTraining->getReceiptTrainingByRtid($rtid);
             $identifyingTotal=$rtDetail['identifyingTotal']+1;
-
+echo $rtDetail['identifyingTotal'];die;
 			$order = array (
 					"\r\n",
 					"\n",
@@ -4173,6 +4171,12 @@ class ReceiptController extends DooController {
 			
 			$receiptList [$key] ['button'] = $button;
 			$receiptList [$key] ['nowStaffArray'] = explode ( ',', $value ['nowStaff'] );
+			
+			//获得培训班结算RID 借款费用--已经锁定
+			if($value['status']==10){
+				$trainRD=$receipt->getReceiptByTrainLoanRid($value['rid']);
+				$receiptList [$key]['trainRidKey7']=$trainRD['ridKey7'];
+			}
 		}
 		
 		$reportList = array_unique ( $reportList );
@@ -14014,7 +14018,7 @@ class ReceiptController extends DooController {
 		if (! $nature){
 				$nature = isset ( $this->params ['nature'] ) ? $this->params ['nature'] : 'ONJOB';
 		}
-			
+
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
 		Doo::loadModel ( "receiptDetail" );
@@ -14061,11 +14065,12 @@ class ReceiptController extends DooController {
                 $subtotal[$key][$v['name']]=0;
             }
         }
-        $subtotal[$this->AGENCY]['AGENCY']=$subtotal[$this->TRAVEL]['TRAVEL']=$subtotal[$this->INTTRAIN]['INTTRAIN']=$subtotal[$this->TRAIN]['TRAIN']=$subtotal[$this->OTHER]['OTHER']=0;
+
 
 		foreach ( $categoryList as $vlu ) {
 			$s1 = 0;
 			$m1 = 0;
+            $subtotal[$this->AGENCY]['AGENCY']=$subtotal[$this->TRAVEL]['TRAVEL']=$subtotal[$this->INTTRAIN]['INTTRAIN']=$subtotal[$this->TRAIN]['TRAIN']=$subtotal[$this->OTHER]['OTHER']=0;
 			foreach ( $staffList as $value ) {
 				if ($vlu ['cid'] == $value ['cid']) {
 					// pastDate
@@ -14291,27 +14296,28 @@ class ReceiptController extends DooController {
             $receiptL [$this->AGENCY] ='<td class="colGreen taR">'.$subtotal[$this->AGENCY]['AGENCY'].'</td>';
             foreach ( $aiList[$this->AGENCY] as $va ) {
                 $receiptL [$this->AGENCY] .='<td class="taR">' . $subtotal[$this->AGENCY][$va['name']] . '</td>';
-
+                $subtotal[$this->AGENCY][$va['name']]=0;
             }
             $receiptL [$this->TRAVEL] ='<td class="colGreen taR">'.$subtotal[$this->TRAVEL]['TRAVEL'].'</td>';
             foreach ( $aiList[$this->TRAVEL] as $va ) {
                 $receiptL [$this->TRAVEL] .='<td class="taR">' . $subtotal[$this->TRAVEL][$va['name']] . '</td>';
+                $subtotal[$this->TRAVEL][$va['name']]=0;
 
             }
             $receiptL [$this->INTTRAIN] ='<td class="colGreen taR">'.$subtotal[$this->INTTRAIN]['INTTRAIN'].'</td>';
             foreach ( $aiList[$this->INTTRAIN] as $va ) {
                 $receiptL [$this->INTTRAIN] .='<td class="taR">' . $subtotal[$this->INTTRAIN][$va['name']] . '</td>';
-
+                $subtotal[$this->INTTRAIN][$va['name']]=0;
             }
             $receiptL [$this->TRAIN] ='<td class="colGreen taR">'.$subtotal[$this->TRAIN]['TRAIN'].'</td>';
             foreach ( $aiList[$this->TRAIN] as $va ) {
                 $receiptL [$this->TRAIN] .='<td class="taR">' . $subtotal[$this->TRAIN][$va['name']] . '</td>';
-
+                $subtotal[$this->TRAIN][$va['name']]=0;
             }
             $receiptL [$this->OTHER] ='<td class="colGreen taR">'.$subtotal[$this->OTHER]['OTHER'].'</td>';
             foreach ( $aiList[$this->OTHER] as $va ) {
                 $receiptL [$this->OTHER] .='<td class="taR">' . $subtotal[$this->OTHER][$va['name']] . '</td>';
-
+                $subtotal[$this->OTHER][$va['name']]=0;
             }
 
 			$receiptL ['报销金额调整'] = '<td class="taR colOrange">' . $s1 . '</td>';

+ 9 - 2
protected/model/accountItem.php

@@ -109,7 +109,13 @@ class accountItem extends DooModel {
 			foreach ($RILecturerList as $lecKey=>$lecValue){
 				if($v['name']=='讲课费'){
 					if($lecValue['ltype']=='INSIDE'){
-						$bValue=$lecValue['price']*$lecValue['schoolDay'];
+						if($lecValue['fees']=='0.00'){
+							$bValue=$lecValue['price']*$lecValue['schoolDay'];
+						}else{
+							$bValue=$lecValue['fees'];
+						}
+						
+						//echo $bValue."<br/>";
 						$aiList[$k]['insidePrice']+=$bValue;
 						$total+=$bValue;
 						$categoryActualExpenditure+=$bValue;
@@ -159,7 +165,8 @@ class accountItem extends DooModel {
 			
 			//$aiList[$k]['companyPrice']=number_format ($aiList[$k]['companyPrice'],2);
 			$aiList[$k]['outsideTaxPrice']=sprintf("%.2f",$aiList[$k]['outsideTaxPrice']);  
-			$aiList[$k]['outsideNoTaxPrice']=sprintf("%.2f",$aiList[$k]['outsideNoTaxPrice']);  
+			$aiList[$k]['outsideNoTaxPrice']=sprintf("%.2f",$aiList[$k]['outsideNoTaxPrice']); 
+			
 			$aiList[$k]['insidePrice']=sprintf("%.2f",$aiList[$k]['insidePrice']);  
 			
 			$aiList[$k]['companyPrice']=sprintf("%.2f",$aiList[$k]['companyPrice']);  

+ 7 - 2
protected/model/client_staff.php

@@ -24,7 +24,6 @@ class client_staff extends DooModel {
     }
     
 	function getClientByStaff($condition="",$limit,$staffid="",$sid,$search,$tooltip,$cateid,$tagSQL=''){
-    	
 		if (!empty($staffid)){
 			//$staffid="and a.sid= '".$staffid."'";
 			//a.cid,a.gender,a.clientname,a.keynum,a.companyid,a.companyname,a.updatetime,a.servicetime,a.department,a.position  left join CLD_tag_client as c on (b.cid=c.client) " . $this->_table . " as a ".$staffid."
@@ -48,9 +47,15 @@ class client_staff extends DooModel {
 		}
 		//	echo $sql;//die;
     	$query = Doo::db ()->query ( $sql );
-		
 		$result = $query->fetchAll ();
 		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		foreach ($result as $key=>$value){
+			$result[$key]['companyidKey'] = $XDeode->encode( $value['companyid'] );
+		}
+		
+		
 		return $result;
     	
     }

+ 20 - 5
protected/model/company.php

@@ -28,7 +28,13 @@ class company extends DooModel {
 	public $_fields = array ('cid', 'companyname','staffid', 'district' ,'nature' ,'local', 'fax', 'webservice','department'  , 'position', 'office', 'address', 'ride','landmarks','stay' );
 	
 	public function getCompanyByCid($cid){
-		return $this->find ( array ('where' => "cid= '".$cid."'", 'asArray' => TRUE ) );
+		 $list=$this->find ( array ('where' => "cid= '".$cid."'", 'asArray' => TRUE ) );
+		 Doo::loadClass ( 'XDeode' );
+		 $XDeode = new XDeode ( 5 );
+		foreach ($list as $key=>$value){
+			$list[$key]['cidKey'] = $XDeode->encode( $value['cid'] );
+		}
+		return $list;
 	}
 	
 	public function getCompanyByStaff($sid){
@@ -45,11 +51,20 @@ class company extends DooModel {
 		    	
 				$query = Doo::db ()->query ( $sql );
 				$result = $query->fetchAll ();
-				return $result;	
+				
 			}else
-				return $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where'=>$district,'limit'=>$page.','.$size, 'asArray' => TRUE ) );
-		}else//"staffid= '".$sid."' and ".
-			return $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where' => $district, 'limit'=>$page.','.$size, 'asArray' => TRUE ) );
+				$result= $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where'=>$district,'limit'=>$page.','.$size, 'asArray' => TRUE ) );
+		}else{//"staffid= '".$sid."' and ".
+			$result= $this->find ( array ('select'=>'companyname,cid,local,district,staffid,nature','where' => $district, 'limit'=>$page.','.$size, 'asArray' => TRUE ) );
+		}
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		foreach ($result as $key=>$value){
+			$result[$key]['cidKey'] = $XDeode->encode( $value['cid'] );
+		}
+		
+		return $result;
 	}
 	
 	public function getCompanyByCompanyname($name){

+ 28 - 16
protected/model/invoice.php

@@ -195,9 +195,9 @@ class invoice extends DooModel {
 	public $postTime;
 	public $settlementType;
 	public $accountingTime;
-	
-	
-	
+	public $parentUntreadIid;
+	public $inheritIid;
+
 	public $_table = 'CLD_invoice';
 	public $_primarykey = 'iid';
 	public $_fields = array (
@@ -258,7 +258,9 @@ class invoice extends DooModel {
 			'postTime',
 			'bindTime',
 			'settlementType',
-			'accountingTime'
+			'accountingTime',
+        'parentUntreadIid',
+        'inheritIid'
 	);
 
     /**
@@ -272,7 +274,7 @@ class invoice extends DooModel {
         }
         $sum = $this->getOne ( array (
             'select' => 'sum(invoicePrice) as price',
-            'where' => " iid in (" .$iids.")",
+            'where' => " trainId in (" .$iids.")",
             'asArray' => TRUE
         ) );
         return $sum['price'];
@@ -501,8 +503,12 @@ class invoice extends DooModel {
 	 * 统计培训班开票
 	 */
 	function sumOfinvoiceTrain($itidSql) {
-		$sql = 'select sum(b.invoicePrice) as invoicePrice ,b.trainId as trainId
-				from CLD_invoiceStore as a left join  ' . $this->_table . '  as b on (a.iid=b.iid)
+//		$sql = 'select sum(b.invoicePrice) as invoicePrice ,b.trainId as trainId
+//				from CLD_invoiceStore as a left join  ' . $this->_table . '  as b on (a.iid=b.iid)
+//				where b.trainId in (' . $itidSql . ') and b.status=2 and b.printStatus=1 and (b.untreadStatus =0 or b.untreadStatus=3) and b.isDelete=0
+//				GROUP BY b.trainId';
+        $sql = 'select sum(b.invoicePrice) as invoicePrice ,b.trainId as trainId
+				from  ' . $this->_table . '  as b 
 				where b.trainId in (' . $itidSql . ') and b.status=2 and b.printStatus=1 and (b.untreadStatus =0 or b.untreadStatus=3) and b.isDelete=0
 				GROUP BY b.trainId';
 		
@@ -955,21 +961,27 @@ class invoice extends DooModel {
 		
 		return $list;
 	}
-	function getInvoiceByUntreadStatusPage($limit = 0, $con = "", $desc = 'desc', $olStatus = "desc",$descField="bindTime") {
-		if (empty ( $limit ) || empty ( $con ))
+	function getInvoiceByUntreadStatusPage($limit = "0,20", $con = "", $desc = 'desc', $olStatus = "desc",$descField="bindTime") {
+		if ( empty ( $con ))
 			return array ();
 		
 		$listCount = $this->count ( array (
 				'where' => $con,
 				'asArray' => TRUE 
 		) );
-		
-		$list = $this->find ( array (
-				'where' => $con,
-				'limit' => $limit,
-				$desc => $descField,
-				'asArray' => TRUE 
-		) ); // echo $con;
+
+        $sqlArr=array (
+            'where' => $con,
+            $desc => $descField,
+            'asArray' => TRUE
+        );
+		if ($limit!==false){
+            $sqlArr+=array (
+                'limit' => $limit
+            );
+        }
+
+		$list = $this->find ( $sqlArr ); // echo $con;
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'invoiceReceivables' );

+ 144 - 10
protected/model/receipt.php

@@ -38,6 +38,7 @@ class receipt extends DooModel {
 	public $trainLoanRid;
 	public $invoiceTrainId;
 	public $paidStatus;
+	public $statusTrain;
 
 	public $_table = 'CLD_receipt';
 	public $_primarykey = 'rid';
@@ -78,16 +79,21 @@ class receipt extends DooModel {
 			'trainId',
 			'trainLoanRid',
 			'invoiceTrainId' ,
-            'paidStatus'
+            'paidStatus',
+			'statusTrain'
 	);
 
     /**
      * 获得培训班结算未收款
      */
-	function getReceiptTrainByPaid($un=0,$limit=5){
+	function getReceiptTrainByPaid($un=0,$limit=5,$cid=''){
+	    if (empty($cid)){
+	        return array();
+        }
+
         $sql = "select b.* ,a.invoiceTrainId,a.rid,a.executeDate
                 from " . $this->_table . " as a left JOIN CLD_receiptTraining as b on (a.trainId=b.rtid) 
-                where a.status not in (3,4,5) and a.Rtype=3 and a.trainId!=0 and invoiceTrainId!=0 and paidStatus=".$un."  limit ".$limit;
+                where a.status not in (3,4,5) and a.Rtype=3 and a.trainId!=0 and invoiceTrainId!=0 and a.cid in (".$cid.") and paidStatus=".$un."  limit ".$limit;
 
        $query = Doo::db ()->query ( $sql );
        $result = $query->fetchAll ();
@@ -122,7 +128,7 @@ class receipt extends DooModel {
     /**
      * 获得所有培训班结算
      */
-    function getReceiptTrainByPaidAll($un='',$cid='',$dateSql='',$limit='0,18'){
+    function getReceiptTrainByPaidAll($un='',$cid='',$dateSql='',$limit='0,18',$cidString="",$where=""){
         $psSql='';
         if(!empty($un)){
             $psSql=" and paidStatus=".$un." ";
@@ -130,11 +136,15 @@ class receipt extends DooModel {
         $cidSql="";
         if(!empty($cid)){
             $cidSql=" and a.cid=".$cid." ";
+        }elseif(!empty($cidString)){
+            $cidSql=" and a.cid in (".$cidString.") ";
+        }else{
+            return array();
         }
 
         $sql = "select b.* ,a.invoiceTrainId,a.rid
                 from " . $this->_table . " as a left JOIN CLD_receiptTraining as b on (a.trainId=b.rtid) 
-                where a.status not in (3,4,5) and a.Rtype=3 and a.trainId!=0 and invoiceTrainId!=0 ".$psSql.$cidSql.$dateSql." limit ".$limit;
+                 ".$where.$psSql.$cidSql.$dateSql." limit ".$limit;
 
         $query = Doo::db ()->query ( $sql );
         $result = $query->fetchAll ();
@@ -157,6 +167,7 @@ class receipt extends DooModel {
             $result[$key]['iTrain']['receivablesAmount']=sprintf ( "%.2f",$result[$key]['iTrain']['invoiceTotalAmount']-$result[$key]['iTrain']['invoiceArriveAmount']);
             $RItemList = $RItem->getRItemByRid ( $value ['rid'] );
             $RILecturerList = $RILecturer->getRILecturerByRid ( $value ['rid'] );
+
             // 支出项金额详情
             $expendList= $accountItem->getTrainingDetail ( $RItemList, $RILecturerList );
             $result[$key]['iTrain']['expendAmount']=sprintf ( "%.2f",$expendList['total']);
@@ -170,18 +181,108 @@ class receipt extends DooModel {
     }
 
     /**
+     * 获得培训班结算的合计金额
+     * @param string $itid 发票培训班ID
+     */
+    function getReceiptTrainSumByItid($sql=""){
+        Doo::loadModel ( 'invoice' );
+        $invoice = new invoice ();
+
+        $query = Doo::db ()->query ( $sql );
+        $result = $query->fetchAll ();
+        //组合发票培训班ID
+        $itidList = array ();$ridList=array();
+        foreach ($result as $key=>$value){
+            array_push ( $itidList, $value ['invoiceTrainId'] );
+            array_push ( $ridList, $value ['rid'] );
+        }
+        $itidList = array_unique($itidList);
+        $itidString=implode ( ',', $itidList );
+        $ridList = array_unique($ridList);
+        $ridString=implode ( ',', $ridList );
+
+        //发票培训班ID-整合出开票金额合计-入账金额合计
+        $invoiceList = $invoice->sumOfinvoiceTrain ( $itidString );//开票合计-开票收入
+        $invoiceRecelvablesList = $invoice->sumOfInvoiceRecelvablesTrain ( $itidString );//入账合计-实际收入
+        $invoiceTotalAmount=0;//开票金额合计
+        $receivablesTotalAmount=0;//入账金额合计
+        foreach ( $invoiceList as $k => $v ) {
+            $invoiceTotalAmount+=$v ['invoicePrice'];
+        }
+        foreach ( $invoiceRecelvablesList as $i => $o ) {
+            $receivablesTotalAmount+=$o ['receivablesPrice'];
+        }
+        //未收款
+        $unReceivablesTotalAmount=sprintf ( "%.2f",$invoiceTotalAmount-$receivablesTotalAmount);
+        //获得支出金额合计
+        Doo::loadModel ( 'RItem' );
+        $RItem = new RItem ();
+        Doo::loadModel ( 'RILecturer' );
+        $RILecturer = new RILecturer ();
+        $RItemPrice=$RItem->getRItemPriceByRids($ridString);
+        $RILecturerPrice=$RILecturer->getRILecturerPriceByRids($ridString);
+        $payPrice=$RItemPrice+$RILecturerPrice;//支出金额合计
+        $profit=$invoiceTotalAmount-$payPrice;
+
+        return array('invoiceTotalAmount'=>sprintf ( "%.2f",$invoiceTotalAmount),
+            'payPrice'=>sprintf ( "%.2f",$payPrice),
+            'profit'=>sprintf ( "%.2f",$profit),
+            'unReceivablesTotalAmount'=>$unReceivablesTotalAmount,
+            );
+
+    }
+
+    /**
+     * @param string $sql
+     */
+    function initReceiptTrainRevenue($sql=""){
+        Doo::loadModel ( 'invoice' );
+        $invoice = new invoice ();
+
+        $query = Doo::db ()->query ( $sql );
+        $result = $query->fetchAll ();
+
+        foreach ($result as $key=>$value){
+
+            $invoiceList = $invoice->sumOfinvoiceTrain ( $value['invoiceTrainId'] );//开票合计-开票收入
+            $invoiceRecelvablesList = $invoice->sumOfInvoiceRecelvablesTrain ( $value['invoiceTrainId'] );//入账合计-实际收入
+            $invoiceTotalAmount=0;//开票金额合计
+            $receivablesTotalAmount=0;//入账金额合计
+            foreach ( $invoiceList as $k => $v ) {
+                $invoiceTotalAmount+=$v ['invoicePrice'];
+            }
+            foreach ( $invoiceRecelvablesList as $i => $o ) {
+                $receivablesTotalAmount+=$o ['receivablesPrice'];
+            }
+//echo $invoiceTotalAmount.'-'.$receivablesTotalAmount.'</br>';
+            if ($invoiceTotalAmount<=$receivablesTotalAmount){
+                $itemData = array (
+                    'rid' => $value['rid'],
+                    'paidStatus' => 1,
+                );
+                $this->setReceiptByCondition($itemData);
+            }
+        }
+
+    }
+
+    /**
      * 获得培训班 年营收图表
      */
-    function getReceiptTrainByYearChart($year=''){
+    function getReceiptTrainByYearChart($cid='',$year=''){
+        if (empty($cid)){
+            return array();
+        }
         if(empty($year)){
             $year=date("Y");
         }
 
         $sql = "select GROUP_CONCAT(rid) as rid,GROUP_CONCAT(invoiceTrainId) as invoiceTrainId,date_format(date,\"%m\") as month
                 from " . $this->_table . " 
-                where status not in (3,4,5) and Rtype=3 and trainId!=0 and invoiceTrainId!=0 and paidStatus=1 and Year(date) =".$year."
+                where status not in (3,4,5) and Rtype=3 and trainId!=0 and invoiceTrainId!=0 and cid in (".$cid.") and paidStatus=1 and Year(date) =".$year."
                 GROUP BY Month(date)";
 //
+
         $query = Doo::db ()->query ( $sql );
         $result = $query->fetchAll ();
 
@@ -189,15 +290,16 @@ class receipt extends DooModel {
         $RItem = new RItem ();
         Doo::loadModel ( 'RILecturer' );
         $RILecturer = new RILecturer ();
-        Doo::loadModel ( 'accountItem' );
-        $accountItem = new accountItem ();
         Doo::loadModel ( 'invoice' );
         $invoice = new invoice ();
 
         $MonthPriceList=array();
         foreach ($result as $key=>$value){
             //获得支出金额总和
-            $RIprice=$RItem->getRItemPriceByRids($value['rid']);
+            $RItemPrice=$RItem->getRItemPriceByRids($value['rid']);
+        	$RILecturerPrice=$RILecturer->getRILecturerPriceByRids($value['rid']);
+        	$RIprice=$RItemPrice+$RILecturerPrice;//支出金额合计
+        	
             //收款金额总和
             $ITprice=$invoice->getInvoicePriceByIids($value['invoiceTrainId']);
 
@@ -267,6 +369,38 @@ class receipt extends DooModel {
 		
 		return $rinfo;
 	}
+	
+	function getReceiptByTrainLoanRid($rid = '') {
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+	
+// 		Doo::loadModel ( 'L_category' );
+// 		$Lcategory = new L_category ();
+// 		Doo::loadModel ( 'staff' );
+// 		$staff = new staff ();
+	
+		if (! is_numeric ( $rid ))
+			$rid = $XDeode->decode ( $rid );
+	
+			$rinfo = $this->getOne ( array (
+					'where' => 'trainLoanRid=' . $rid,
+					'asArray' => true
+			) );
+			
+			
+			$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['sum']=number_format ($rinfo['sum'],2);
+	
+			return $rinfo;
+	}
+	
 	function getReceiptByinvoiceTrainId($invoiceTrainId = 0) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );

+ 0 - 1
protected/model/staff.php

@@ -578,7 +578,6 @@ class staff extends DooModel {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		if (!is_numeric($sid)&&!empty($sid)){
-			
 			$sid = $XDeode->decode ( $sid );
 		}
 		

+ 17 - 0
protected/plugin/TemplateTag.php

@@ -27,6 +27,7 @@ Doo::conf ()->TEMPLATE_GLOBAL_TAGS = array (
 		'isShowMenu',
 		'isStaffCompleteMsg',
 		'isInvoiceCategoryShow',
+		'isReceiptTrainShow',
 		'isPaymentsShow'
 );
 
@@ -270,6 +271,22 @@ function isInvoiceCategoryShow($sid){
 }
 
 /**
+ * 是否有查看培训班结算营收的权限
+ * @param unknown $sid
+ */
+function isReceiptTrainShow($sid){
+	Doo::loadModel ( "receiptTrainManage" );
+	$invoiceCategoryManage = new receiptTrainManage ();
+
+	$icm=$invoiceCategoryManage->getInvoiceCMByStaff($sid);
+	if (!empty($icm))
+		return true;
+		else
+			return false;
+}
+
+
+/**
  * 是否有查看日常收支的权限
  */
 function isPaymentsShow($sid){

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

@@ -76,6 +76,8 @@
 	</div>
 <!--弹出(锁信息)-->
 <div class="modal hide fade" id="change">
+	<div class="modal-dialog">
+		<div class="modal-content">
     <div class="modal-header">
     <h3>更换审批人</h3>
     </div>
@@ -101,6 +103,8 @@
 	    <input type="submit" value="确定更换" class="button">
 	</div>
 	</form>
+		</div>
+	</div>
 </div>
 <!--弹出-->	
 <script type="text/javascript">autoFlashHeight();</script>	

+ 4 - 3
protected/view/admin/approvalExpenses.html

@@ -21,9 +21,7 @@
 			<div class="adminContent autoHeight" style="height: 821px;">
 				
 				<legend><div class="fR"></div>
-				
 				您有{{receiptApprovalCount}}份报销单需要审批
-				
 				</legend>
 				
 				<div class="demandCate">
@@ -115,9 +113,12 @@
 	  							<td><div class="avtra"><img src="{{receiptList' value.staffDetail.avatar}}_2.jpg" width="32"><br>{{receiptList' value.staffDetail.username}}</div></td>
 	  							<td><!-- if {{receiptDetail' value.Rtype}}==1 --> 
 	  							借款
+	  							<!-- if {{receiptDetail' value.status}}==10 --> 
+	  							<br/><a href="/receiptTrain/info/{{receiptDetail' value.trainRidKey7}}.html" >培训班</a>
+	  							<!-- endif -->
 	  							<!-- elseif {{receiptDetail' value.Rtype}}==2 --> 
 	  							对公汇款
-	  							<!-- elseif {{receiptDetail' value.Rtype}}==3 --> 
+	  							<!-- elseif {{receiptDetail' value.Rtype}}==3 -->
 	  							培训班结算
 	  							<!-- elseif {{receiptDetail' value.Rtype}}==0 --> 
 	  							 报销单 

+ 10 - 6
protected/view/admin/expensesCollect.html

@@ -76,14 +76,18 @@
 	  						<tr><th class="taR">合计</th><td class="colGreen taR">¥{{receiptDetail' value.accountItem.cSum.travelSum}}</td></tr>
 
 
+							<!-- if isset({{receiptList' value.accountItem.内部培训费用}}) -->
+							<tr><th colspan="2" class="taC">内部培训费用</th></tr>
+							<!-- loop receiptDetail' value.accountItem.内部培训费用 -->
+							<tr><th>{{receiptDetail' value' value.name}}</th><td  width="200" class="taR">
+								¥{{receiptDetail' value' value.price}}
+							</td>
+							</tr>
+							<!-- endloop -->
+							<tr><th class="taR">合计</th><td class="colGreen taR" id="inttrainResult">¥{{receiptDetail' value.accountItem.cSum.inttrainSum}}</td></tr>
+							<!-- endif -->
 
 
-							<tr><th colspan="2" class="taC">培训班费用</th></tr>
-	  						<!-- loop receiptDetail' value.accountItem.培训班费用 -->
-	  						<tr><th>{{receiptDetail' value' value.name}}</th><td  width="140" class="taR">¥{{receiptDetail' value' value.price}}</td></tr>
-	  						<!-- endloop -->
-	  						<tr><th class="taR">合计</th><td class="colGreen taR">¥{{receiptDetail' value.accountItem.cSum.trainSum}}</td></tr>
-
 
 
 

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

@@ -15,6 +15,7 @@
 <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>
@@ -31,5 +32,6 @@
 <option value="软件服务费">软件服务费</option>
 <option value="报表定制费">报表定制费</option>
 <option value="软件升级费">软件升级费</option>
+<option value="技术服务费">技术服务费</option>
 
 <!-- endif -->

+ 12 - 1
protected/view/admin/invoiceUntreadIsAchieve.html

@@ -51,11 +51,22 @@
 				<div class="saeaList">
 					<table class="table table-hover">
 						<tbody>
-						<tr class="thead"><th>开票流水号</th><th>开票金额</th><th>开票单位(抬头)</th><th>发票号</th><th>开票内容</th><th>收款流水号</th><th>收款金额</th><th>入账时间</th><th>申请退票</th></tr>
+						<tr class="thead">
+							<th>开票流水号</th>
+							<th>结算方式</th>
+							<th>开票金额</th>
+							<th>开票单位(抬头)</th><th>发票号</th><th>开票内容</th><th>收款流水号</th><th>收款金额</th><th>入账时间</th><th>申请退票</th></tr>
 						<!-- loop list -->
 						<tr>
 							<td><a href="#invdetail" node-invoice='INFO' data-isKey="{{pendingInvoice' value.iidKeyK}}"  data-toggle="modal">{{list' value.invoiceSerial}}</a></td>
 							<td>
+								<!-- if {{list' value.settlementType}}==0 -->
+								软件销售
+								<!-- else -->
+								<a href="/invoiceTrainingDetail/{{list' value.trainIdKey}}.html">培训班</a>
+								<!-- endif -->
+							</td>
+							<td>
 							<!-- if !empty({{list' value.invoiceType}}) -->
 	                        <b>¥{{list' value.invoicePrice}}</b><sup>专</sup>
 	                          <!-- else -->

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

@@ -24,10 +24,16 @@
 	<li><a <!-- if {{receiptMemu}}=="remittanceHky" --> class="selected" <!-- endif --> href="/remittanceHky">费用汇款</a></li>			
 
 	<!-- endif -->
+
+	<!-- if isReceiptTrainShow({{staff.0.sid}}) -->
+	<li><a href="/receiptTrainRevenue" <!-- if {{receiptMemu}}=="receiptTrainRevenue" --> class="selected" <!-- endif --> >培训班营收</a></li>
+	<!-- endif -->
+
 	<!-- if isReceiptAuthorityShow({{staff.0.sid}}) -->
-	<li><a href="/receiptTrainRevenue" <!-- if {{receiptMemu}}=="receiptTrainRevenue" --> class="selected" <!-- endif --> >培训班结算</a></li>
 	<li><a href="/companyCategoryCollect" <!-- if {{receiptMemu}}=="companyCategoryCollect" --> class="selected" <!-- endif --> >公司汇总</a></li>			
 	<!-- endif -->
+
+
 	
 	<!-- if isPaymentsShow({{staff.0.sid}}) -->	
 	<li><a href="/paymentsCollect" <!-- if {{receiptMemu}}=="paymentsCollect" --> class="selected" <!-- endif --> >日常收支汇总</a></li>

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

@@ -4,10 +4,6 @@
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
  <script src="<?= WEB_SITE_GLOBAL ?>js/receipt.js"></script>
 
-
- 
- 
- 
 <body>
 	<div class="mainLayout">
 		<div class="mainMenu">

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

@@ -42,7 +42,7 @@
 	  						
 	  						<!-- loop acItem -->
 		  						<!-- if {{acItem' value.category}} =="日常相关费用" -->
-			  						<!-- if {{acItem' value.name}}=="办公费用" || {{acItem' value.name}}=="其他费用" || {{acItem' value.name}}=="公积金" || {{acItem' value.name}}=="社保" -->
+			  						<!-- if {{acItem' value.name}}=="办公费用" || {{acItem' value.name}}=="其他费用" || {{acItem' value.name}}=="公积金" || {{acItem' value.name}}=="社保" || {{acItem' value.name}}=="邮寄费" -->
 			  						<tr>
 			  						<th>{{acItem' value.name}}</th>
 			  						<td  width="200" class="taR">¥<input type="number" id="agency_{{acItem' value.aid}}" name="agency[]" <!-- 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">

+ 28 - 78
protected/view/admin/saeaLoanAddReceipt.html

@@ -4,80 +4,29 @@
 <script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/zh-CN.js"></script>
  <script src="<?= WEB_SITE_GLOBAL ?>js/receipt.js"></script>
 
-<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.js"></script>
-<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.queue.js"></script>
-<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/fileprogress.js"></script>
-<script type="text/javascript" src="<?= WEB_SITE_GLOBAL ?>js/swfuplad2/handlers.js"></script>
-
-<script type="text/javascript">
-
-	$(function() {
-	$("input[id^='inttrain_']").change(function() {
-console.log('sss');
-		$i=0;
-		$("input[id^='inttrain_']").each(function(i){
-			$i+=parseFloat(this.value);
-
-		});
-		$("#inttrainResult").html("¥"+$i.toFixed(2));
-		$("#inttrainR").val($i.toFixed(2));
-
-		var agencyR=$("#agencyR").val();
-		var otherR=parseFloat($("#otherR").val());
-		var travelR=parseFloat($("#travelR").val());
-		var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
-
-		$("#RS").html("¥"+RS.toFixed(2));
-	});
-	})
-		var swfu;
-
-		window.onload = function() {
-			var settings = {
-				flash_url : "<?= WEB_SITE_GLOBAL ?>js/swfuplad2/swfupload.swf",
-				upload_url: "/swfupload",	// Relative to the SWF file
-				
-				file_size_limit : "8 MB",
-				file_types : "*.jpg;*.png;*.doc;*.docx;*.els;*.elsx;",
-				file_types_description : "*.jpg;*.png;*.doc;*.docx;*.els;*.elsx",
-				file_upload_limit : 8,
-				file_queue_limit : 2,
-				custom_settings : {
-					progressTarget : "fsUploadProgress",
-					cancelButtonId : "btnCancel"
-				},
-				debug: true,
-
-				// Button settings
-				button_image_url: "<?= WEB_SITE_GLOBAL ?>js/swfuplad2/TestImageNoText_65x29.png",	// Relative to the Flash file
-				button_width: "65",
-				button_height: "29",
-				button_placeholder_id: "spanButtonPlaceHolder",
-				button_text: '<span class="theFont">浏览</span>',
-				button_text_style: ".theFont { font-size: 16; }",
-				button_text_left_padding: 12,
-				button_text_top_padding: 3,
-
-				// The event handler functions are defined in handlers.js
-				file_queued_handler : fileQueued,
-				file_queue_error_handler : fileQueueError,
-				file_dialog_complete_handler : fileDialogComplete,
-				upload_start_handler : uploadStart,
-				upload_progress_handler : uploadProgress,
-				upload_error_handler : uploadError,
-				upload_success_handler : uploadSuccess,
-				upload_complete_handler : uploadComplete,
-				queue_complete_handler : queueComplete	// Queue plugin event
-			};
-
-			swfu = new SWFUpload(settings);
-	     };
-
-
-
-	</script>
- 
+<script >
+ $(function() {
  
+	 $("input[id^='inttrain_']").change(function() {
+			
+			$i=0;
+			$("input[id^='inttrain_']").each(function(i){
+				$i+=parseFloat(this.value);
+				
+			 });
+			$("#inttrainResult").html("¥"+$i.toFixed(2));
+			$("#inttrainR").val($i.toFixed(2));
+			
+			var agencyR=$("#agencyR").val();
+			var otherR=parseFloat($("#otherR").val());
+			var travelR=parseFloat($("#travelR").val());
+			var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
+			
+			$("#RS").html("¥"+RS.toFixed(2));
+		});
+	 
+ })
+ </script>
  
 <body>
 	<div class="mainLayout">
@@ -317,11 +266,12 @@ console.log('sss');
 	  								<thead>
 	  								<tr>
 	  								<th>
-	  									<span id="spanButtonPlaceHolder"></span>
-										<span>支持jpg、png、doc、docx、els、elsx;最大8M文件。</span>
-										<input id="btnCancel" type="button" value="取消所有上传" style="display:none"  onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
-									
-										<input type="hidden" id="enclosurName" name="enclosurName" value="">
+	  								
+	  								<input enclosurFile type="file" 
+	  								accept="image/png,image/gif,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document
+	  								,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" name="file" />
+	  								
+									<input type="hidden" id="enclosurName" name="enclosurName" value="">
 	  								
 	  								</th>
 	  								<th colspan="2">

+ 14 - 8
protected/view/contacts_client.html

@@ -6,7 +6,10 @@
 <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>
+//need to init
 
+</script>
 
 
 <body>
@@ -47,7 +50,7 @@
 					
 			</div>
 		
-			<div class="contactDatabase fL">
+	<div class="contactDatabase fL">
 				<form action="/contacts" id="up" method="post">
 				<input type="hidden" name="search" id="search" value="{{search}}"/>
 				<div class="contactCate">
@@ -158,16 +161,19 @@
 				</div>
 				</form>
 				
-				
 				<form action="/DoAddTag" method="post">
 				<div class="contactList autoHeightL2">
 				
-				<table class="contactTable">
-				<tbody>
-						<!-- loop clientInfo -->
-	  					<tr>
-	  						<td width="80" class="female"><a href="javascript:void(0)" id="getClientInfo" data="{{clientInfo' value.cid}}" ><b <!-- if {{clientInfo' value.gender}}=="女" -->class="name female"<!-- else -->class="name"<!-- endif --> >{{clientInfo' value.clientname}}</b></a></td>
-	  						<td width="300"><a href="javascript:void(0)" onclick="getCompany('{{clientInfo' value.companyid}}')" class="cname">{{clientInfo' value.companyname}}</a></td>
+<table class="contactTable">
+	<tbody>
+	<!-- loop clientInfo -->
+	  	<tr>
+	  		<td width="80" class="female">
+	  		<a href="javascript:void(0)" id="getClientInfo" data="{{clientInfo' value.cid}}" ><b <!-- if {{clientInfo' value.gender}}=="女" -->class="name female"<!-- else -->class="name"<!-- endif --> >{{clientInfo' value.clientname}}</b></a>
+	  		</td>
+	  		<td width="300">
+	  		<a href="javascript:void(0)" onclick="getCompany('{{clientInfo' value.companyidKey}}')" class="cname">{{clientInfo' value.companyname}}</a>
+	  		</td>
 	  						<td width="90" ><span class="lim">{{clientInfo' value.department}}</span><span class="lim">{{clientInfo' value.position}}<i class="icon- sport ">{{clientInfo' value.priority}}<i></i></i></span></td>
 	  						<td width="70" >
 	  						<!-- loop clientInfo' value.taginfo -->

+ 1 - 1
protected/view/contacts_company.html

@@ -139,7 +139,7 @@ function deleteTagCompany(tid,cid,obj){
 	  						<tbody id="client">
 	  						<!-- loop company -->
 	  						<tr data="{{company' value.district}}" nature="{{company' vlaue.nature}}">
-	  							<td width="330"><a href="javascript:void(0)" onclick="getCompany('{{company' value.cid}}')">{{company' value.companyname}}</a></td>
+	  							<td width="330"><a href="javascript:void(0)" onclick="getCompany('{{company' value.cidKey}}')">{{company' value.companyname}}</a></td>
 	  							<td width="100">
 		  							<!-- loop clientInfo' value.taginfo -->
 		  							<i class="contactsTag tagCol-0{{clientInfo' value' value.colorid}}" onclick="deleteTagCompany({{clientInfo' value' value.tid}},{{clientInfo' value.cid}},this)">x</i>

+ 34 - 5
protected/view/lock_look.html

@@ -19,7 +19,16 @@
 
 <script>
 	$(function() {
+		<!-- if  isset({{longleDetail.status}})&&{{longleDetail.status}}>=3 -->
+		$("#longleStatus_5").attr('disabled',false);
+		$("#longleStatus_6").attr('disabled',false);
+		$("#longleStatus_8").attr('disabled',false);
+		<!-- endif -->
 
+		<!-- if  isset({{longleDetail.status}})&&{{longleDetail.status}}<=2 -->
+		$("#longleStatus_5").attr('disabled',true);
+		$("#longleStatus_6").attr('disabled',true);
+		<!-- endif -->
 	})
 </script>
 
@@ -40,7 +49,11 @@
 				<a  href="/statistics">使用统计</a>
 				<form class="" action="/searchlongle" method="post">
 				
-				<div class="searchItem"><input type="text" name="search" placeholder="输入锁号进行搜索"><input type="submit" value="搜索" class="subBtn"><input value="新锁" class="subBtn add" type="button" onclick="javascrtpt:window.location.href='/adminlock'"></div>
+				<div class="searchItem">
+					<input type="text" name="search" value="{{search}}" placeholder="输入锁号进行搜索">
+					<input type="submit" value="搜索" class="subBtn">
+					<input value="新锁" class="subBtn add" type="button" onclick="javascrtpt:window.location.href='/adminlock'">
+				</div>
 				
 				</form>
 			</div>	
@@ -102,8 +115,24 @@
 					<div class="contactInfo" style="display:none;" id="staffInfo"></div>
 	  			<div id="longleLog" <!-- if empty({{lidKey}}) --> style="display:none;" <!-- endif --> >
 					<div  class="header" style="">
-	  				<h1 id="longleTitle"></h1>
-	  				<h2><span id="longleResponsible"></span> <span id="longleStatus">收回 / 专业版+河南养护</span></h2>
+	  				<h1 id="longleTitle">{{longleDetail.key_num}}</h1>
+	  				<h2>
+						<span id="longleResponsible">
+							<a href="javascript:void(0)" onclick="getStaffInfo('{{longleDetail.responsible}}')" >{{longleDetail.responsible}}</a>
+						</span>
+						<span id="longleStatus">
+							{{longleDetail.statusT}}/{{longleDetail.product}}
+							<!-- if !empty({{longleDetail.version}}) -->
+							/({{longleDetail.version}})
+							<!-- endif -->
+							<!-- if !empty({{longleDetail.alloted_time}}) -->
+							期限:{{longleDetail.alloted_time}}
+							<!-- endif -->
+							<!-- if !empty({{longleDetail.licences}}) -->
+							节点:{{longleDetail.licences}}
+							<!-- endif -->
+							</span>
+					</h2>
 	  				</div>
 	  			<div  class="lockRecord autoHeightR2" >
 	  				<!--添加记录按钮-->
@@ -141,7 +170,7 @@
 							    	<input type="radio" name="longleStatus" id="longleStatus_7"   value="7">收回
 							    </label>
 
-								<label class="radio inline" style="display:none" id="alloted" >
+								<label class="radio inline" <!-- if empty({{longleDetail.alloted_time}}) --> style="display:none" <!-- endif --> id="alloted" >
 									<input type="radio" name="longleStatus" id="longleStatus_10"  value="10">延期
 								</label>
 
@@ -234,7 +263,7 @@
 						  <div class="control-group">
 						    <label class="control-label" for="inputPassword">备注</label>
 						    <div class="controls">
-						      <textarea id="marks" style="width:95%" rows="5" name="mark" >123</textarea>
+						      <textarea id="marks" style="width:95%" rows="5" name="mark" ></textarea>
 						    </div>
 						  </div>
 					</div>

+ 1 - 1
protected/view/receipt/receiptTrainRevenue.html

@@ -115,7 +115,7 @@
 	        },
 	        dataZoom: {
 	            show: true,
-	            start: 50,
+	            start: 0,
 	            end: 100
 	        },
 	        xAxis: [{

+ 8 - 5
protected/view/receipt/receiptTrainRevenueAchieve.html

@@ -45,9 +45,9 @@
 
 					<ul class="cateList">
 						<li>
-							<a <!-- if {{paid}}=='ALL' --> class="now" <!-- endif --> href="/receiptTrainRevenueAchieve/{{onpage}}/ALL">所有</a>
-							<a <!-- if {{paid}}=='UNPAID' --> class="now" <!-- endif --> href="/receiptTrainRevenueAchieve/{{onpage}}/UNPAID" title="未完成收款">未完成收款</a>
-							<a <!-- if {{paid}}=='PAID' --> class="now" <!-- endif --> href="/receiptTrainRevenueAchieve/{{onpage}}/PAID" title="收款完成">收款完成</a>
+							<a <!-- if {{paid}}=='ALL' --> class="now" <!-- endif --> href="/receiptTrainRevenueAchieve/1/ALL">所有</a>
+							<a <!-- if {{paid}}=='UNPAID' --> class="now" <!-- endif --> href="/receiptTrainRevenueAchieve/1/UNPAID" title="未完成收款">未完成收款</a>
+							<a <!-- if {{paid}}=='PAID' --> class="now" <!-- endif --> href="/receiptTrainRevenueAchieve/1/PAID" title="收款完成">收款完成</a>
 						</li>
 						<!--收入-->
 						<li>
@@ -67,8 +67,11 @@
 									<button class="btn btn-small" type="submit">查询</button>
 								</div>
 							</div></li>
-							<li>收入合计:¥123387.00&nbsp;<span class="colBlue">支出合计:¥123387.00</span>&nbsp;利润合计:¥123387.00</li>
-							<li class="colRed">未收款:¥12387.00</li>
+							<li>收入合计:¥{{receiptTrainPriceList.invoiceTotalAmount}}&nbsp;
+								<span class="colBlue">支出合计:¥{{receiptTrainPriceList.payPrice}}</span>&nbsp;
+								利润合计:¥{{receiptTrainPriceList.profit}}
+							</li>
+							<li class="colRed">未收款:¥{{receiptTrainPriceList.unReceivablesTotalAmount}}</li>
 					</ul>
 
 					</form>