Browse Source

编辑培训班结算

caipin 6 years atrás
parent
commit
a3e2f7f79a

+ 147 - 0
global/js/receipt.js

@@ -541,6 +541,33 @@ $(function() {
 	    }
 	});
 
+	//培训班结算-添加支出
+	$("form[name='receiptTrainItemAdd']").validator({
+		timely: 3,
+	    focusCleanup: true,
+	    theme:"yellow_right",
+	   
+	    fields: {
+	        'price': 'required; ',
+	        'date':'required; ',
+	        'inputer':'required; '
+	    }
+	});
+	
+	//培训班结算-添加讲师
+	$("form[name='receiptTrainLecturerAdd']").validator({
+		timely: 3,
+	    focusCleanup: true,
+	    theme:"yellow_right",
+	   
+	    fields: {
+	    	'ltype':'required; ',
+	    	'lecturerName':'required; ',
+	        'price': 'required; ',
+	        'schoolDay':'required; '
+	    }
+	});
+	
 	$("a[getReceiptLoan]").click(function() {
 		$.ajax({
 			url:"/ajaxGetReceiptTrainLoan",
@@ -562,8 +589,128 @@ $(function() {
 			});
 	});
 	
+	$("a[getReceiptInvoice]").click(function() {
+		$.ajax({
+			url:"/ajaxGetInvoiceTrainByEnd",
+			type: "post",
+			cache: false,
+			dataType: "json",
+			data: {
+				
+			},
+			global: true,
+			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>';
+				}
+				$("select[receiptInvoieSelect]").html(html);
+			},
+			error:function(err){}
+			});
+	});
+	
+	//h5文件上传
+	var numFilesUploaded=0;
+	$("input[enclosurFile]").change(function() {
+		
+		var form_data = new FormData();
+		var file_data = $(this).prop("files")[0];
+		
+		form_data.append("Filename", file_data.name);
+		form_data.append("Filedata", file_data);
+		
+		$.ajax({
+		    type: "POST",
+		    url: "/swfupload",
+		    dataType : "json",
+		    processData: false,  // 注意:让jQuery不要处理数据
+		    contentType: false,  // 注意:让jQuery不要设置contentType
+		    data: form_data
+		}).success(function(msg) {
+			var status = document.getElementById("divStatus");
+			numFilesUploaded+=1;
+			status.innerHTML = file_data.name+"上传成功 <br/>"+numFilesUploaded+" 个文件已上传.";
+			
+			var en=$('#enclosurName').val();
+			if (en!='')
+				$('#enclosurName').val(en+'-'+msg.filename);
+			else
+				$('#enclosurName').val(msg.filename);
+			
+			
+			//页面展示上传内容
+			var tr = document.createElement("tr");
+			tr.id=msg.id;
+			var td1 = document.createElement("td");
+			td1.innerHTML = '<a href="#" target="_blank">'+file_data.name+'</a>';
+			var td2 = document.createElement("td");
+			td2.innerHTML = toDecimal2(file_data.size/1024)+'kb';
+			var td3 = document.createElement("td");
+			td3.innerHTML = '<a href="javascript:void(0)" onclick="delEnclosurName(\''+msg.filename+'\',\''+msg.id+'\')" >删除</a>';
+			tr.appendChild(td1);
+			tr.appendChild(td2); 
+			tr.appendChild(td3); 
+			var kt=document.getElementById('KT');
+			
+			if(kt!=null)
+			kt.appendChild(tr);
+			
+		}).fail(function(msg) {
+		    //console.log(msg);
+		});
+	});	
 })
 
+function delEnclosurByKey(id){
+	
+	var url = "/ajaxRemEnclousur";
+	$.ajax({
+		url : url,
+		type : "post",
+		cache : false,
+		dataType : "json",
+		data : {
+			key : id
+		},
+		global : true,
+		success : function(data) {
+			
+			if (data.status == 1) {
+				$('#'+id).remove(); 
+			} 
+		},
+		error : function(err) {
+		}
+	});
+}
+
+function toDecimal2(x) {  
+    var f = parseFloat(x);  
+    if (isNaN(f)) {  
+        return false;  
+    }  
+    var f = Math.round(x*100)/100;  
+    var s = f.toString();  
+    var rs = s.indexOf('.');  
+    if (rs < 0) {  
+        rs = s.length;  
+        s += '.';  
+    }  
+    while (s.length <= rs + 2) {  
+        s += '0';  
+    }  
+    return s;  
+}
+
+function delEnclosurName(name,id){
+	var en=$('#enclosurName').val();
+	var newName=en.replace(name,'');
+	$('#enclosurName').val(newName);
+	 $('#'+id).remove();     
+	
+}
+
 function selectToolTipCl(name){
 	var e = is_ie ? event : selectToolTipCl.caller.arguments[0];
 	obj = is_ie ? e.srcElement : e.target;

+ 1 - 2
global/js/swfuplad2/swfupload.js

@@ -882,10 +882,9 @@ function delEnclosurByKey(id){
 		error : function(err) {
 		}
 	});
-	
-	
 }
 
+
 SWFUpload.prototype.uploadSuccess = function (file, serverData) {
 	file = this.unescapeFilePostParams(file);
 	

+ 12 - 1
protected/config/acl.conf.php

@@ -330,7 +330,8 @@ $acl ['LOCK'] ['allow'] = array (
 				'doLongleReceive',
 				'adminLock',
 				'ajaxGetLongleByName',
-				'getClientInfo'
+				'getClientInfo',
+				'searchLongle'
 		)
 );
 
@@ -440,6 +441,16 @@ $acl ['RECEIPTS'] ['allow'] = array (
 				'receiptTrainLoanEdiDo',
 				'receiptTrainLoanRemoveDo',
 				'receiptTrainInvoiceEdi',
+				'receiptTrainInvoiceEdiDo',
+				'receiptTrainReceivables',
+				'receiptTrainReceivablesDelDo',
+				'receiptTrainItemEdi',
+				'receiptTrainItemAddDo',
+				'receiptTrainLecturerEdi',
+				'receiptTrainLecturerAddDo',
+				'receiptTrainLecturerDelDo',
+				'h5Upload',
+				'receiptTrainApprovalDo',
 		)
 );
 $acl ['RECEIPTSAJAX'] ['allow'] = array (

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

@@ -104,6 +104,10 @@ $route['get']['/delReceiptAuthorityManage/:sidKey/:icidKey'] = array('AdminContr
 $route['*']['/delUserDistrictAuthor/:didKey/:sidKey'] = array('AdminController', 'delUserDistrictAuthor');
 
 $route['*']['/adminPaymentsAuthority'] = array('AdminController', 'adminPaymentsAuthority');
+$route['*']['/adminReceiptLecturer'] = array('AdminController', 'adminReceiptLecturer');
+$route['*']['/adminReceiptLecturerAddDo'] = array('AdminController', 'adminReceiptLecturerAddDo');
+$route['*']['/adminReceiptLecturerDelDo/:lidKey'] = array('AdminController', 'adminReceiptLecturerDelDo');
+
 
 
 $route['*']['/addRole'] = array('AdminController', 'addRole');
@@ -196,6 +200,8 @@ $route['*']['/ajaxGetReceiptOrder'] = array('ReceiptController', 'ajaxGetReceipt
 
 $route['*']['/swfupload'] = array('ReceiptController', 'swfupload');
 
+$route['*']['/h5Upload'] = array('ReceiptController', 'h5Upload');
+
 //报销单公司汇总
 $route['*']['/receiptStatisticsStaffDetail'] = array('ReceiptController', 'receiptStatisticsStaffDetail');
 
@@ -236,6 +242,19 @@ $route['*']['/receiptTrainLoanEdiDo'] = array('ReceiptController', 'receiptTrain
 $route['*']['/receiptTrainLoanRemoveDo/:ridKey/:ridLoanKey'] = array('ReceiptController', 'receiptTrainLoanRemoveDo','extension'=>'.html');
 
 $route['*']['/receiptTrainInvoiceEdi/:rid'] = array('ReceiptController', 'receiptTrainInvoiceEdi','extension'=>'.html');
+$route['*']['/ajaxGetInvoiceTrainByEnd'] = array('InvoiceAjaxController', 'ajaxGetInvoiceTrainByEnd');
+$route['*']['/receiptTrainInvoiceEdiDo'] = array('ReceiptController', 'receiptTrainInvoiceEdiDo');
+
+$route['*']['/receiptTrainReceivables/:doType'] = array('ReceiptController', 'receiptTrainReceivables');
+$route['*']['/receiptTrainReceivablesDelDo'] = array('ReceiptController', 'receiptTrainReceivablesDelDo');
+
+$route['*']['/receiptTrainItemEdi/:rid'] = array('ReceiptController', 'receiptTrainItemEdi','extension'=>'.html');
+$route['*']['/receiptTrainItemAddDo'] = array('ReceiptController', 'receiptTrainItemAddDo');
+
+$route['*']['/receiptTrainLecturerEdi/:rid'] = array('ReceiptController', 'receiptTrainLecturerEdi','extension'=>'.html');
+$route['*']['/receiptTrainLecturerAddDo'] = array('ReceiptController', 'receiptTrainLecturerAddDo');
+$route['*']['/receiptTrainLecturerDelDo'] = array('ReceiptController', 'receiptTrainLecturerDelDo');
+$route['*']['/receiptTrainApprovalDo'] = array('ReceiptController', 'receiptTrainApprovalDo');
 
 
 //邮件群发

+ 326 - 204
protected/controller/AdminController.php

@@ -205,29 +205,29 @@ class AdminController extends DooController {
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
 		$L_category = new L_category ();
-		Doo::loadModel('district');
-		$district=new district();
+		Doo::loadModel ( 'district' );
+		$district = new district ();
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		
-		$stafflist=$staff->getStaff ();
-		foreach ($stafflist as $key=>$value){
-			$info=$staff->getUserById ( $value['sid'] );
-			$didList=explode(',', $info[0]['did']);
-			$didList=array_filter($didList);
-			$list=array();
+		$stafflist = $staff->getStaff ();
+		foreach ( $stafflist as $key => $value ) {
+			$info = $staff->getUserById ( $value ['sid'] );
+			$didList = explode ( ',', $info [0] ['did'] );
+			$didList = array_filter ( $didList );
+			$list = array ();
 			
-			if (!empty($didList)){
-				foreach ($didList as $k=>$v){
-					array_push($list, $XDeode->decode ( $v )) ;
+			if (! empty ( $didList )) {
+				foreach ( $didList as $k => $v ) {
+					array_push ( $list, $XDeode->decode ( $v ) );
 				}
-				$stafflist[$key]['idDistrictList']=$district->getDistrictInId(implode(',', $list));
-			}else{
-				$stafflist[$key]['idDistrictList']=array();
+				$stafflist [$key] ['idDistrictList'] = $district->getDistrictInId ( implode ( ',', $list ) );
+			} else {
+				$stafflist [$key] ['idDistrictList'] = array ();
 			}
 		}
 		
-		$data['districtList']=$district->get_lv(1);
+		$data ['districtList'] = $district->get_lv ( 1 );
 		$data ['category'] = $L_category->getCategory ();
 		$data ['stafflist'] = $stafflist;
 		$data ['staff'] = $this->staff;
@@ -237,31 +237,30 @@ class AdminController extends DooController {
 	/**
 	 * 删除省份权限
 	 */
-	function delUserDistrictAuthor(){
+	function delUserDistrictAuthor() {
 		$didKey = isset ( $this->params ['didKey'] ) ? $this->params ['didKey'] : "";
 		$sidKey = isset ( $this->params ['sidKey'] ) ? $this->params ['sidKey'] : "";
-		if (! empty ( $sidKey ) && ! empty ( $didKey ) ) {
+		if (! empty ( $sidKey ) && ! empty ( $didKey )) {
 			Doo::loadClass ( 'XDeode' );
 			$XDeode = new XDeode ( 5 );
 			Doo::loadModel ( 'staff' );
 			$staff = new staff ();
-			$sid=$XDeode->decode($sidKey);
-			$sDetail=$staff->getStaffBySid($sid);
-			$sDidList=explode(',', $sDetail['did']);
+			$sid = $XDeode->decode ( $sidKey );
+			$sDetail = $staff->getStaffBySid ( $sid );
+			$sDidList = explode ( ',', $sDetail ['did'] );
 			
-			foreach ($sDidList as $key=>$value){
-				if ($value==$didKey)
-					unset($sDidList[$key]);
+			foreach ( $sDidList as $key => $value ) {
+				if ($value == $didKey)
+					unset ( $sDidList [$key] );
 			}
 			
-			$staff->did=implode(',', $sDidList);
+			$staff->did = implode ( ',', $sDidList );
 			$staff->sid = $sid;
 			$staff->update ();
-			return '/edi/user/'.$sid;
+			return '/edi/user/' . $sid;
 		}
 		die ( 'illegal request' );
 	}
-	
 	function adduser() {
 		$username = $this->get_args ( 'username' ) ? $this->get_args ( 'username' ) : "";
 		$password = $this->get_args ( 'password' ) ? $this->get_args ( 'password' ) : "";
@@ -269,7 +268,7 @@ class AdminController extends DooController {
 		$hiredate = $this->get_args ( 'hiredate' ) ? $this->get_args ( 'hiredate' ) : "";
 		$nature = is_numeric ( $this->get_args ( 'nature' ) ) ? $this->get_args ( 'nature' ) : 1;
 		
-		$didKey = $this->get_args ( 'didKey' ) ? $this->get_args ( 'didKey' ) : array();
+		$didKey = $this->get_args ( 'didKey' ) ? $this->get_args ( 'didKey' ) : array ();
 		
 		if (! empty ( $username ) && ! empty ( $password ) && ! empty ( $cid ) && ! empty ( $hiredate ) && ! empty ( $nature )) {
 			
@@ -296,7 +295,7 @@ class AdminController extends DooController {
 			$staff->hiredate = $hiredate;
 			$staff->nature = $nature;
 			
-			$staff->did=implode(',', $didKey);
+			$staff->did = implode ( ',', $didKey );
 			
 			$id = $staff->insert ();
 			
@@ -325,8 +324,8 @@ class AdminController extends DooController {
 		
 		if (! empty ( $sid )) {
 			
-			Doo::loadModel('district');
-			$district=new district();
+			Doo::loadModel ( 'district' );
+			$district = new district ();
 			
 			$data ['msg'] = urldecode ( $msg );
 			Doo::loadModel ( 'L_category' );
@@ -336,20 +335,20 @@ class AdminController extends DooController {
 			Doo::loadClass ( 'XDeode' );
 			$XDeode = new XDeode ( 5 );
 			
-			$info=$staff->getUserById ( $sid );
-			$didList=explode(',', $info[0]['did']);
-			$didList=array_filter($didList);
-			$list=array();
-			if (!empty($didList)){
-				foreach ($didList as $key=>$value){
-					array_push($list, $XDeode->decode ( $value )) ;
+			$info = $staff->getUserById ( $sid );
+			$didList = explode ( ',', $info [0] ['did'] );
+			$didList = array_filter ( $didList );
+			$list = array ();
+			if (! empty ( $didList )) {
+				foreach ( $didList as $key => $value ) {
+					array_push ( $list, $XDeode->decode ( $value ) );
 				}
-				$idDistrictList=$district->getDistrictInId(implode(',', $list));
-			}else{
-				$idDistrictList=array();
+				$idDistrictList = $district->getDistrictInId ( implode ( ',', $list ) );
+			} else {
+				$idDistrictList = array ();
 			}
-			$data['idDistrictList']=$idDistrictList;
-			$data['districtList']=$district->get_lv(1);
+			$data ['idDistrictList'] = $idDistrictList;
+			$data ['districtList'] = $district->get_lv ( 1 );
 			$data ['newPw'] = '';
 			$data ['staffInfo'] = $info;
 			$data ['category'] = $L_category->getCategory ();
@@ -624,6 +623,7 @@ class AdminController extends DooController {
 		$data ['roleList'] = $roleList;
 		$data ['verify'] = $list;
 		$data ['memu'] = "verify";
+		$data ['adminReceiptMenu'] ='adminverify';
 		$data ['staff'] = $this->staff;
 		
 		$this->render ( "/admin/admin_reportGroup", $data );
@@ -706,7 +706,7 @@ class AdminController extends DooController {
 		$data ['verify'] = $list;
 		$data ['memu'] = "verify";
 		$data ['staff'] = $this->staff;
-		
+		$data ['adminReceiptMenu'] ='adminRole';
 		$this->render ( "/admin/adminReportGroupRole", $data );
 	}
 	function addRole() {
@@ -771,7 +771,6 @@ class AdminController extends DooController {
 		}
 		return "/adminRole";
 	}
-	
 	function adminExecute() {
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
@@ -790,8 +789,8 @@ class AdminController extends DooController {
 				'借款执行人' => '',
 				'借款费用执行人' => '',
 				'报销单执行人' => '',
-				'对公汇款执行人' => '' ,
-				'培训班结算'=>''
+				'对公汇款执行人' => '',
+				'培训班结算' => '' 
 		);
 		foreach ( $list as $key => $value ) {
 			$name = json_decode ( $value ['staff'] );
@@ -811,11 +810,11 @@ class AdminController extends DooController {
 		// print_r($execute);die;
 		$data ['execute'] = $execute;
 		$data ['memu'] = "verify";
+		$data ['adminReceiptMenu'] ='adminExecute';
 		$data ['staff'] = $this->staff;
 		
 		$this->render ( "/admin/adminCarriedout", $data );
 	}
-	
 	function addExecute() {
 		$mold = $this->get_args ( 'mold' ) ? $this->get_args ( 'mold' ) : "";
 		$staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
@@ -863,7 +862,7 @@ class AdminController extends DooController {
 				) );
 			}
 		}
-		if($mold=='日常收支')
+		if ($mold == '日常收支')
 			return "/adminPaymentsAuthority";
 		else
 			return "/adminExecute";
@@ -900,36 +899,36 @@ class AdminController extends DooController {
 					'where' => 'eid = ' . $executeInfo ['eid'] 
 			) );
 		}
-		if($executeInfo['mold']=='日常收支')
+		if ($executeInfo ['mold'] == '日常收支')
 			return "/adminPaymentsAuthority";
 		else
 			return "/adminExecute";
 	}
 	
-	//日常收支权限
+	// 日常收支权限
 	function adminPaymentsAuthority() {
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
 		Doo::loadModel ( "execute" );
 		$execute = new execute ();
-	
+		
 		$data ['staffList'] = $staff->find ( array (
 				'select' => 'username,sid,avatar',
-				'asArray' => true
+				'asArray' => true 
 		) );
 		$list = $execute->find ( array (
-				'asArray' => true
+				'asArray' => true 
 		) );
-	
+		
 		$execute = array (
-				'日常收支' => ''
+				'日常收支' => '' 
 		);
 		foreach ( $list as $key => $value ) {
 			$name = json_decode ( $value ['staff'] );
 			$staffString = "";
 			if (! empty ( $name )) {
 				foreach ( $name as $k => $v ) {
-						
+					
 					$staffString .= " " . $v [1] . '<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delExecute/' . $v [0] . '/' . $value ['eid'] . '\'"  title="删除" class="icon-">k</a>';
 				}
 			}
@@ -942,12 +941,138 @@ class AdminController extends DooController {
 		// print_r($execute);die;
 		$data ['execute'] = $execute;
 		$data ['memu'] = "verify";
+		$data ['adminReceiptMenu'] ='adminPaymentsAuthority';
 		$data ['staff'] = $this->staff;
-	
+		
 		$this->render ( "/admin/adminPaymentsAuthority", $data );
 	}
 	
+	/**
+	 * 添加讲师
+	 */
+	function adminReceiptLecturer() {
+		Doo::loadModel ( 'staff' );
+		$staff = new staff ();
+		Doo::loadModel ( "lecturer" );
+		$lecturer = new lecturer ();
+		
+		Doo::loadModel ( 'L_category' );
+		$category = new L_category ();
+		$categoryList = $category->getCategory ();
+		
+		$data ['staffList'] = $staff->find ( array (
+				'select' => 'username,sid,avatar',
+				'asArray' => true 
+		) );
+		$list = $lecturer->getLecturerAll();
+		
+		$staffList = $staff->getStaff ();
+		
+		$lecturerList = array (
+				'外聘' => '',
+				'员工' => '' 
+		);
+		
+		foreach ( $lecturerList as $k => $v ) {
+			foreach ( $list as $key => $value ) {
+				if ($k == $value ['mold']) {
+					$staffString = " " . $value ['staff'] . '<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/adminReceiptLecturerDelDo/' . $value ['lidKey'] . '\'"  title="删除" class="icon-">k</a>';
+					$lecturerList [$k] .= $staffString;
+				}
+			}
+		}
+		
+		$invoiceStaff = array ();
+		foreach ( $categoryList as $key => $value ) {
+			$invoiceStaff [$value ['cidKey']] = array ();
+			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 );
+				}
+			}
+		}
+		
+		$data ['invoiceStaff'] = json_encode ( $invoiceStaff );
+		
+		// print_r($execute);die;
+		$data ['categoryList'] = $categoryList;
+		$data ['lecturerList'] = $lecturerList;
+		
+		$data ['adminReceiptMenu'] ='adminReceiptLecturer';
+		$data ['memu'] = "verify";
+		$data ['staff'] = $this->staff;
+		
+		$this->render ( "/admin/adminReceiptLecturer", $data );
+	}
+	
+	/**
+	 * 添加讲师
+	 */
+	function adminReceiptLecturerAddDo() {
+		$mold = $this->get_args ( 'mold' ) ? $this->get_args ( 'mold' ) : "";
+		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
+		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
+		
+		if (!empty($mold)) {
+			Doo::loadModel ( "lecturer" );
+			$lecturer = new lecturer ();
+			if ($mold=='员工'){
+				if (! empty ( $cidKey ) && ! empty ( $sidKey )){
+					Doo::loadClass ( 'XDeode' );
+					$XDeode = new XDeode ( 5 );
+					Doo::loadModel ( 'staff' );
+					$staff = new staff ();
+					Doo::loadModel ( 'L_category' );
+					$category = new L_category ();
+					
+					$cid = $XDeode->decode ( $cidKey );
+					$sid = $XDeode->decode ( $sidKey );
+					if (! is_numeric ( $cid ) || ! is_numeric ( $sid ))
+						die ( 'illegal request' );
+							
+					$detail=$staff->getStaffBySid($sid);
+					$cateDetail=$category->getCategoryById($cid);
+					
+					$lecturer->cid=$cid;
+					$lecturer->sid=$sid;
+					$lecturer->staff=$detail['username'];
+					$lecturer->mold='员工';
+					$lecturer->category=$cateDetail[0]['title'];
+					$lecturer->ltype='INSIDE';
+					$lecturer->insert ();
+				}
+			}elseif($mold=='外聘'){
+				$staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
+				
+				$lecturer->staff=$staff;
+				$lecturer->mold='外聘';
+				$lecturer->ltype='OUTSIDE';
+				$lecturer->insert ();
+			}
+			
+			return '/adminReceiptLecturer';
+		}
+		die ( 'illegal request' );
+	}
 	
+	/**
+	 * 删除讲师
+	 */
+	function adminReceiptLecturerDelDo(){
+		$lidKey = isset ( $this->params ['lidKey'] ) ? $this->params ['lidKey'] : '';
+		
+		if (! empty ( $lidKey )) {
+			Doo::loadModel ( "lecturer" );
+			$lecturer = new lecturer ();
+				
+			$lecturer->delLecturerByLid( $lidKey );
+		}
+		return "/adminReceiptLecturer";
+		
+	}
 	
 	function adminInvoice() {
 		Doo::loadModel ( 'staff' );
@@ -1104,9 +1229,9 @@ class AdminController extends DooController {
 	}
 	
 	/**
-	 * 报销单汇总权限配置 
+	 * 报销单汇总权限配置
 	 */
-	function adminReceiptAuthority(){
+	function adminReceiptAuthority() {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'staff' );
@@ -1118,7 +1243,7 @@ class AdminController extends DooController {
 		
 		$categoryList = $category->getCategory ();
 		$managelist = $receiptAuthorityManage->find ( array (
-				'asArray' => true
+				'asArray' => true 
 		) );
 		$staffList = $staff->getStaff ();
 		
@@ -1134,7 +1259,7 @@ class AdminController extends DooController {
 					array_push ( $invoiceStaff [$value ['cidKey']], $ul );
 				}
 			}
-				
+			
 			foreach ( $managelist as $e => $a ) {
 				if ($value ['cid'] == $a ['cid']) {
 					$name = json_decode ( $a ['staff'] );
@@ -1154,6 +1279,7 @@ class AdminController extends DooController {
 		$data ['invoiceStaff'] = json_encode ( $invoiceStaff );
 		
 		$data ['memu'] = "verify";
+		$data ['adminReceiptMenu'] = "adminReceiptAuthority";
 		$data ['staff'] = $this->staff;
 		$this->render ( "/admin/adminReceiptAuthority", $data );
 	}
@@ -1164,7 +1290,7 @@ class AdminController extends DooController {
 	function addReceiptAuthorityManage() {
 		$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 ( "receiptAuthorityManage" );
 			$receiptAuthorityManage = new receiptAuthorityManage ();
@@ -1172,103 +1298,99 @@ class AdminController extends DooController {
 			$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 = $receiptAuthorityManage->getOne ( array (
-						'where' => 'cid =' . $cid,
-						'asArray' => true
-				) );
-				$staffDetail = $staff->getStaffBySid ( $sid );
-					
-				if (empty ( $icm )) {
-					$receiptAuthorityManage = new receiptAuthorityManage ();
-					$list = array ();
-	
+			
+			$icm = $receiptAuthorityManage->getOne ( array (
+					'where' => 'cid =' . $cid,
+					'asArray' => true 
+			) );
+			$staffDetail = $staff->getStaffBySid ( $sid );
+			
+			if (empty ( $icm )) {
+				$receiptAuthorityManage = new receiptAuthorityManage ();
+				$list = array ();
+				
+				$info = array (
+						$staffDetail ['sid'],
+						$staffDetail ['username'] 
+				);
+				array_push ( $list, $info );
+				
+				$receiptAuthorityManage->cid = $cid;
+				$receiptAuthorityManage->staff = json_encode ( $list );
+				
+				$receiptAuthorityManage->insert ();
+			} else {
+				$invoiceCompanyManage = new receiptAuthorityManage ();
+				$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']
+							$staffDetail ['username'] 
 					);
 					array_push ( $list, $info );
-	
-					$receiptAuthorityManage->cid = $cid;
-					$receiptAuthorityManage->staff = json_encode ( $list );
-	
-					$receiptAuthorityManage->insert ();
-				} else {
-					$invoiceCompanyManage = new receiptAuthorityManage ();
-					$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 '/adminReceiptAuthority';
+				$invoiceCompanyManage->staff = json_encode ( $list );
+				$invoiceCompanyManage->update ( array (
+						'where' => 'icid = ' . $icm ['icid'] 
+				) );
+			}
+			return '/adminReceiptAuthority';
 		}
 		die ( 'illegal request' );
 	}
 	
-	
-	
 	/**
 	 * 去除查看办事处汇总人员
 	 */
 	function delReceiptAuthorityManage() {
 		$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 ( "receiptAuthorityManage" );
-			$receiptAuthorityManage = new receiptAuthorityManage ();
-	
-			$icmDetail = $receiptAuthorityManage->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 receiptAuthorityManage ();
-				$invoiceCompanyManage->staff = json_encode ( $list );
-				$invoiceCompanyManage->update ( array (
-						'where' => 'icid = ' . $icmDetail ['icid']
-				) );
-	
-				return '/adminReceiptAuthority';
+		
+		Doo::loadModel ( "receiptAuthorityManage" );
+		$receiptAuthorityManage = new receiptAuthorityManage ();
+		
+		$icmDetail = $receiptAuthorityManage->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 receiptAuthorityManage ();
+		$invoiceCompanyManage->staff = json_encode ( $list );
+		$invoiceCompanyManage->update ( array (
+				'where' => 'icid = ' . $icmDetail ['icid'] 
+		) );
+		
+		return '/adminReceiptAuthority';
 	}
 	
-	
-	
 	/**
 	 * 开票应收款权限设置
 	 */
@@ -1330,7 +1452,7 @@ class AdminController extends DooController {
 	function addInvoiceCompanyManage() {
 		$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 ( "invoiceCompanyManage" );
 			$invoiceCompanyManage = new invoiceCompanyManage ();
@@ -1338,56 +1460,56 @@ class AdminController extends DooController {
 			$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 invoiceCompanyManage ();
-					$list = array ();
-	
+			
+			$icm = $invoiceCompanyManage->getOne ( array (
+					'where' => 'cid =' . $cid,
+					'asArray' => true 
+			) );
+			$staffDetail = $staff->getStaffBySid ( $sid );
+			
+			if (empty ( $icm )) {
+				$invoiceCompanyManage = new invoiceCompanyManage ();
+				$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 invoiceCompanyManage ();
+				$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']
+							$staffDetail ['username'] 
 					);
 					array_push ( $list, $info );
-	
-					$invoiceCompanyManage->cid = $cid;
-					$invoiceCompanyManage->staff = json_encode ( $list );
-	
-					$invoiceCompanyManage->insert ();
-				} else {
-					$invoiceCompanyManage = new invoiceCompanyManage ();
-					$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 '/adminInvoiceCompany';
+				$invoiceCompanyManage->staff = json_encode ( $list );
+				$invoiceCompanyManage->update ( array (
+						'where' => 'icid = ' . $icm ['icid'] 
+				) );
+			}
+			return '/adminInvoiceCompany';
 		}
 		die ( 'illegal request' );
 	}
@@ -1398,37 +1520,37 @@ class AdminController extends DooController {
 	function delInvoiceCompanyManage() {
 		$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 ( "invoiceCompanyManage" );
-			$invoiceCompanyManage = new invoiceCompanyManage ();
-	
-			$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 invoiceCompanyManage ();
-				$invoiceCompanyManage->staff = json_encode ( $list );
-				$invoiceCompanyManage->update ( array (
-						'where' => 'icid = ' . $icmDetail ['icid']
-				) );
-	
-				return '/adminInvoiceCompany';
+		
+		Doo::loadModel ( "invoiceCompanyManage" );
+		$invoiceCompanyManage = new invoiceCompanyManage ();
+		
+		$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 invoiceCompanyManage ();
+		$invoiceCompanyManage->staff = json_encode ( $list );
+		$invoiceCompanyManage->update ( array (
+				'where' => 'icid = ' . $icmDetail ['icid'] 
+		) );
+		
+		return '/adminInvoiceCompany';
 	}
 	
 	/**
@@ -1623,19 +1745,19 @@ class AdminController extends DooController {
 		Doo::loadModel ( 'longle' );
 		$longle = new longle ();
 		$list = $longle->find ( array (
-				'where'=>'SerialNumber=""',
+				'where' => 'SerialNumber=""',
 				'select' => 'key_num',
 				'asArray' => TRUE 
 		) );
 		
-		$file = fopen ( DOO::conf ()->SITE_PATH . "upload/".$key.".csv", 'r' );
+		$file = fopen ( DOO::conf ()->SITE_PATH . "upload/" . $key . ".csv", 'r' );
 		
 		while ( $data = fgetcsv ( $file ) ) {
 			$goods_list [$data [0]] = $data [1];
 		}
 		fclose ( $file );
 		
-		//print_r($goods_list);
+		// print_r($goods_list);
 		
 		$sqlArray = array ();
 		$sql = 'UPDATE CLD_longle SET SerialNumber = CASE key_num ';
@@ -1652,9 +1774,9 @@ class AdminController extends DooController {
 			}
 		}
 		$sql .= 'END WHERE key_num IN (' . implode ( ',', $sqlArray ) . ')';
-		echo $sql ;//. '<br/>--------------------------------<br/>';
+		echo $sql; // . '<br/>--------------------------------<br/>';
 		foreach ( $goods_list as $key => $value ) {
-			//echo $key . ',' . $value . '<br/>';
+			// echo $key . ',' . $value . '<br/>';
 		}
 	}
 	private function getRandChar($length) {

+ 2 - 0
protected/controller/HumanResourceController.php

@@ -1261,6 +1261,8 @@ class HumanResourceController extends DooController {
 	 * 确认离职
 	 */
 	function employeeDismiss() {
+		
+		//include Doo::conf ()->BASE_PATH . 'diagnostic/debug.php';
 		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
 		$applyLeaveDate = $this->get_args ( 'applyLeaveDate' ) ? $this->get_args ( 'applyLeaveDate' ) : "";
 		

+ 15 - 5
protected/controller/InvoiceController.php

@@ -267,7 +267,7 @@ class InvoiceController extends DooController {
 		
 		Doo::loadModel ( 'invoiceTraining' );
 		$invoiceTraining = new invoiceTraining ();
-		$itList = $invoiceTraining->getInvoiceTrainingByUnfinished ($this->staff [0] ['cid']);
+		$itList = $invoiceTraining->getInvoiceTrainingByCid ($this->staff [0] ['cid']);
 		$this->data ['itList'] = $itList;
 		
 		$this->data ['memu'] = "invoice";
@@ -292,7 +292,7 @@ class InvoiceController extends DooController {
 	
 		Doo::loadModel ( 'invoiceTraining' );
 		$invoiceTraining = new invoiceTraining ();
-		$itList = $invoiceTraining->getInvoiceTrainingByUnfinished ($this->staff [0] ['cid']);
+		$itList = $invoiceTraining->getInvoiceTrainingByCid ($this->staff [0] ['cid']);
 		$this->data ['itList'] = $itList;
 	
 		Doo::loadModel ( 'invoice' );
@@ -1488,6 +1488,7 @@ class InvoiceController extends DooController {
 		
 		$item = array (
 				'iid' => $iid,
+				'isid'=>$isid,
 				'invoiceSerial' => "#F" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ),
 				'date' => date ( "Y-m-d H:i:s" ),
 				'status' => 1,
@@ -1610,7 +1611,6 @@ class InvoiceController extends DooController {
 			array_push ( $iida, $value ['iid'] );
 		}
 		$iidString = implode ( ',', $iida );
-		
 		$ids = implode ( ',', array_keys ( $sqlList ) );
 		$sql = "UPDATE CLD_invoiceStore SET iid = CASE isid ";
 		foreach ( $sqlList as $id => $ordinal ) {
@@ -1651,6 +1651,15 @@ class InvoiceController extends DooController {
 		);
 		$invoice = new invoice ();
 		$invoice->BatchInvoiceByCondition ( $item, $iidString );
+		//批量更新发票中仓库isid
+		$sql = "UPDATE CLD_invoiceStore SET isid = CASE iid ";
+		foreach ( $sqlList as $isid => $iid ) {
+			$sql .= sprintf ( "WHEN %d THEN %d ", $iid, $isid );
+		}
+		$sql .= "END WHERE iid IN ($iidString)";
+		$invoice = new invoice ();
+		$invoice->UpdateBatchInvoice($sql);
+		
 		// 批量更新发票序列号
 		$sqlList = array ();
 		foreach ( $iida as $value ) {
@@ -4515,6 +4524,7 @@ class InvoiceController extends DooController {
 		
 		$cid = $XDeode->decode ( $cidKey );
 		$month = date ( "m", strtotime ( "-1 month" ) );
+		$YearMonth = date ( "Y-m", strtotime ( "-1 month" ) );
 		$redis = new Redis ();
 		$redis->connect ( '127.0.0.1', '6379' );
 		
@@ -4528,7 +4538,7 @@ class InvoiceController extends DooController {
 			
 			// 获得办事处人员下的汇总
 			$slist = $staff->getStaffByCid ( $cid );
-			$ismsbMonth = $invoiceStatistics->getISMSByCategoryByMonth ( $cid, $month ); // 上一个月的汇总
+			$ismsbMonth = $invoiceStatistics->getISMSByCategoryByMonth ( $cid, $YearMonth ); // 上一个月的汇总
 			$ismsb = $invoiceStatistics->getISMSByCategory ( $cid ); // 当月汇总
 			$ISAS = $invoiceStatistics->getISASByCategory ( $cid ); // 全部汇总
 			$scheduleStaff = $invoice->getInvoiceScheduleByCidGroupSid ( $cid ); // 完成度
@@ -4964,7 +4974,7 @@ class InvoiceController extends DooController {
 		$pageinfo ['page'] = array (
 				'previous' => '' 
 		);
-		$sql = " bindStatus=1 and receivablesStaff like '" . $sid . "_%' " . $con;
+		$sql = " bindStatus=1 and receivablesStaff like '" . $sid . "-%' " . $con;
 		$pageinfo = $this->get_page ( "CLD_invoiceReceivables", $sql, $page, $page_size, "invoiceReceivablesAchieve", $get, "" );
 		
 		$limit = $pageinfo ['lower'] . ',' . $page_size;

+ 783 - 48
protected/controller/ReceiptController.php

@@ -2230,6 +2230,55 @@ class ReceiptController extends DooController {
 		
 		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
 		
+		// 汇总表合计
+		// 收入合计
+		Doo::loadModel ( 'invoiceTraining' );
+		$invoiceTraining = new invoiceTraining ();
+		$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
+		// print_r($invoiceTrainingDetail);
+		$data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
+		
+		// 支出项目
+		Doo::loadModel ( 'accountItem' );
+		$accountItem = new accountItem ();
+		
+		// 项目金额合计
+		Doo::loadModel ( 'RItem' );
+		$RItem = new RItem ();
+		// 讲师获得
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		$RItemList = $RItem->getRItemByRid ( $rid );
+		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+		// 支出项金额详情
+		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceTrainingDetail ['invoiceArriveAmount'] );
+		//print_r($aiData);
+		
+		// 利润
+		$data ['profit'] = $invoiceTrainingDetail ['invoiceArriveAmount'] - $aiData ['total'];
+		$data ['companyProfit'] = $data ['profit'] * 0.6;
+		$data ['categoryProfit'] = $data ['profit'] * 0.4;
+		// print_r($aiData['dataList']);
+		$data ['categoryActualExpenditure'] = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
+		// 备用金
+		$data ['receiptLoanDetail'] = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
+		$data ['payment'] = $data ['receiptLoanDetail'] ['sum'] + $invoiceTrainingDetail ['RIAmount'] - $data ['categoryActualExpenditure'];
+		
+		$data ['total'] = $aiData ['total'];
+		$data ['aiCount'] = count ( $aiData ['dataList'] ) + 5;
+		$data ['aiList'] = $aiData ['dataList'];
+		
+		// 占比计算
+		$data ['totalProportion'] = number_format ( $aiData ['total'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['profitProportion'] = number_format ( $data ['profit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['sumProportion'] = number_format ( $data ['receiptLoanDetail'] ['sum'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['invoiceTotalAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceTotalAmount'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['RIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['companyProfitProportion'] = number_format ( $data ['companyProfit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['categoryProportion'] = number_format ( $data ['categoryProfit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['categoryActualExpenditureProportion'] = number_format ( $data ['categoryActualExpenditure'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		$data ['paymentProportion'] = number_format ( $data ['payment'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
+		
 		// 审批组
 		Doo::loadModel ( 'verify' );
 		$verify = new verify ();
@@ -2281,15 +2330,17 @@ class ReceiptController extends DooController {
 			die ();
 		
 		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
-		
-		//借款详情HTML
-		//获得借款信息
-		$receiptLoanDetail = $receipt->getReceiptByRid ( $receiptDetail['trainLoanRid'] );
-		//获得某费用单审批信息
-		$verifylist=$verify->getVerifyByRid($receiptDetail['trainLoanRid']);
-		Doo::loadClass ( 'receipt.func' );
-		$extendHtml='<p><a class="button" href="javascript:if(window.confirm(\'确认移除?\'))window.location=\'/receiptTrainLoanRemoveDo/' . $receiptDetail ['ridKey'] . '/' . $receiptDetail['trainLoanRidKey'] . '.html\'" data-toggle="modal">移除借款</a></p>';
-		$receiptLoanHtml=_getReceiptLoanHtml($receiptLoanDetail,$verifylist,$extendHtml);
+		// 借款详情HTML
+		// 获得借款信息
+		$receiptLoanHtml = '';
+		if (! empty ( $receiptDetail ['trainLoanRid'] )) {
+			$receiptLoanDetail = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
+			// 获得某费用单审批信息
+			$verifylist = $verify->getVerifyByRid ( $receiptDetail ['trainLoanRid'] );
+			Doo::loadClass ( 'receipt.func' );
+			$extendHtml = '<p><a class="button" href="javascript:if(window.confirm(\'确认移除?\'))window.location=\'/receiptTrainLoanRemoveDo/' . $receiptDetail ['ridKey'] . '/' . $receiptDetail ['trainLoanRidKey'] . '.html\'" data-toggle="modal">移除借款</a></p>';
+			$receiptLoanHtml = _getReceiptLoanHtml ( $receiptLoanDetail, $verifylist, $extendHtml );
+		}
 		
 		$data ['receiptLoanHtml'] = $receiptLoanHtml;
 		$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
@@ -2383,76 +2434,106 @@ class ReceiptController extends DooController {
 	}
 	
 	/**
-	 * 编辑培训班结算借款
+	 * 编辑培训班结算---更新借款
 	 */
 	function receiptTrainLoanEdiDo() {
 		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
 		$ridLoanKey = $this->get_args ( 'ridLoanKey' ) ? $this->get_args ( 'ridLoanKey' ) : "";
-		if(!empty($ridKey)&&!empty($ridLoanKey)){
+		if (! empty ( $ridKey ) && ! empty ( $ridLoanKey )) {
 			Doo::loadModel ( 'receipt' );
 			$receipt = new receipt ();
 			Doo::loadClass ( 'XDeode' );
 			$XDeode = new XDeode ( 5 );
 			
-			$rid=$XDeode->decode ( $ridKey );
-			$ridLoan=$XDeode->decode ( $ridLoanKey );
-			if (!is_numeric($rid)||!is_numeric($ridLoan))
+			$rid = $XDeode->decode ( $ridKey );
+			$ridLoan = $XDeode->decode ( $ridLoanKey );
+			if (! is_numeric ( $rid ) || ! is_numeric ( $ridLoan ))
 				die ( 'illegal request-ridError' );
 			
-			$receiptDetail=$receipt->getReceiptByRid($rid);
-			$receiptLoanDetail=$receipt->getReceiptByRid($ridLoan);
-			//不合法的数据
-			if ($receiptDetail['status']!=3&&$receiptDetail['Rtype']!=3){
+			$receiptDetail = $receipt->getReceiptByRid ( $rid );
+			$receiptLoanDetail = $receipt->getReceiptByRid ( $ridLoan );
+			// 不合法的数据
+			if ($receiptDetail ['status'] != 5 || $receiptDetail ['Rtype'] != 3) {
 				die ( 'illegal request-receiptError' );
 			}
-			if ($receiptLoanDetail['status']!=8&&$receiptLoanDetail['Rtype']!=1){
+			if ($receiptLoanDetail ['status'] != 8 || $receiptLoanDetail ['Rtype'] != 1) {
 				die ( 'illegal request-receipLoantError' );
 			}
-			//培训班结算挂钩借款
+			// 培训班结算挂钩借款
 			$receipt = new receipt ();
-			$item=array(
-					'rid'=>$rid,
-					'trainLoanRid'=>$ridLoan,
+			$item = array (
+					'rid' => $rid,
+					'trainLoanRid' => $ridLoan 
 			);
-			$receipt->setReceiptByCondition($item);
-			//更新借款状态变成已挂钩
+			$receipt->setReceiptByCondition ( $item );
+			// 更新借款状态变成已挂钩
 			$receipt = new receipt ();
-			$item=array(
-					'rid'=>$ridLoan,
-					'status'=>10,
-					'statusTrain'=>1
+			$item = array (
+					'rid' => $ridLoan,
+					'status' => 10,
+					'statusTrain' => 1 
 			);
-			$receipt->setReceiptByCondition($item);
+			$receipt->setReceiptByCondition ( $item );
 			
 			$XDeode = new XDeode ( 7 );
 			return "/receiptTrainLoanEdi/" . $XDeode->encode ( $rid ) . ".html";
-		}else 
+		} else
 			die ( 'illegal request' );
 	}
 	
 	/**
-	 * 移除挂钩的费用借款
+	 * 编辑培训班结算--移除借款
 	 */
-	function receiptTrainLoanRemoveDo(){
+	function receiptTrainLoanRemoveDo() {
 		$ridKey = isset ( $this->params ['ridKey'] ) ? $this->params ['ridKey'] : 0;
 		$ridLoanKey = isset ( $this->params ['ridLoanKey'] ) ? $this->params ['ridLoanKey'] : 0;
 		
-		if (!empty($ridKey)||!empty($ridLoanKey)){
+		if (! empty ( $ridKey ) || ! empty ( $ridLoanKey )) {
+			Doo::loadModel ( 'receipt' );
+			$receipt = new receipt ();
 			Doo::loadClass ( 'XDeode' );
 			$XDeode = new XDeode ( 5 );
 			
-			$rid=$XDeode->decode ( $ridKey );
-			$ridLoan=$XDeode->decode ( $ridLoanKey );
-			echo $rid;
-			echo $ridLoan;
-		}
-		
+			$rid = $XDeode->decode ( $ridKey );
+			$ridLoan = $XDeode->decode ( $ridLoanKey );
+			
+			if (! is_numeric ( $rid ) || ! is_numeric ( $ridLoan ))
+				die ( 'illegal request-ridError' );
+			
+			$receiptDetail = $receipt->getReceiptByRid ( $rid );
+			$receiptLoanDetail = $receipt->getReceiptByRid ( $ridLoan );
+			// 不合法的数据
+			if ($receiptDetail ['status'] != 5 || $receiptDetail ['Rtype'] != 3) {
+				die ( 'illegal request-receiptError' );
+			}
+			if ($receiptLoanDetail ['status'] != 10 || $receiptLoanDetail ['Rtype'] != 1) {
+				die ( 'illegal request-receipLoantError' );
+			}
+			// 培训班结算挂钩借款
+			$receipt = new receipt ();
+			$item = array (
+					'rid' => $rid,
+					'trainLoanRid' => 0 
+			);
+			$receipt->setReceiptByCondition ( $item );
+			// 更新借款状态变成已挂钩
+			$receipt = new receipt ();
+			$item = array (
+					'rid' => $ridLoan,
+					'status' => 8,
+					'statusTrain' => 0 
+			);
+			$receipt->setReceiptByCondition ( $item );
+			$XDeode = new XDeode ( 7 );
+			return "/receiptTrainLoanEdi/" . $XDeode->encode ( $rid ) . ".html";
+		} else
+			die ( 'illegal request' );
 	}
 	
 	/**
-	 * 培训班结算挂钩发票
+	 * 编辑培训班结算 ---开
 	 */
-	function receiptTrainInvoiceEdi(){
+	function receiptTrainInvoiceEdi() {
 		$ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
 		
 		Doo::loadClass ( 'XDeode' );
@@ -2462,20 +2543,195 @@ class ReceiptController extends DooController {
 		if (! is_numeric ( $rid ))
 			die ( 'illegal request' );
 		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'receiptTraining' );
+		$receiptTraining = new receiptTraining ();
+		Doo::loadModel ( 'invoice' );
+		$invoice = new invoice ();
+		Doo::loadModel ( 'invoiceTraining' );
+		$invoiceTraining = new invoiceTraining ();
+		
+		$receiptDetail = $receipt->getReceiptByRid ( $rid );
+		if ($receiptDetail ['status'] != 5)
+			die ();
+		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
+		
+		$invoiceList = $invoiceTrainingDetail = array ();
+		if ($receiptDetail ['invoiceTrainId'] != 0) {
+			$invoiceList = $invoice->getInvoicePrintedByItid ( $receiptDetail ['invoiceTrainId'] );
+			$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
+		}
+		// print_r($invoiceList);
+		$data ['invoiceList'] = $invoiceList;
+		$data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
+		$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
+		$data ['receiptDetail'] = $receiptDetail;
+		$data ['trainEdiType'] = "INVOICE";
+		$data ['ridKey'] = $ridKey;
+		$data ['memu'] = "receipt";
+		$data ['staff'] = $this->staff;
+		
+		$data ['receiptMemu'] = 'saeaBorad';
+		$data ['verifyId'] = $this->verifyId;
+		$data ['executeId'] = $this->executeId;
+		
+		$this->render ( "/receipt/receiptTrainInvoiceEdi", $data );
+	}
+	
+	/**
+	 * 编辑培训班结算---更新开票
+	 */
+	function receiptTrainInvoiceEdiDo() {
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
+		$itidKey = $this->get_args ( 'itidKey' ) ? $this->get_args ( 'itidKey' ) : "";
+		if (! empty ( $ridKey ) && ! empty ( $itidKey )) {
 			Doo::loadModel ( 'receipt' );
 			$receipt = new receipt ();
-			Doo::loadModel ( 'receiptTraining' );
-			$receiptTraining = new receiptTraining ();
+			Doo::loadModel ( 'invoiceTraining' );
+			$invoiceTraining = new invoiceTraining ();
+			
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			
+			$rid = $XDeode->decode ( $ridKey );
+			$itid = $XDeode->decode ( $itidKey );
+			if (! is_numeric ( $rid ) || ! is_numeric ( $itid ))
+				die ( 'illegal request-idError' );
+			
+			$receiptDetail = $receipt->getReceiptByRid ( $rid );
+			$invoiceTrainDetail = $invoiceTraining->getInvoiceTrainingByItid ( $itid );
+			// 不合法的数据
+			if ($receiptDetail ['status'] != 5 || $receiptDetail ['Rtype'] != 3) {
+				die ( 'illegal request-receiptError' );
+			}
+			if (empty ( $invoiceTrainDetail )) {
+				die ( 'illegal request-receipLoantError' );
+			}
+			// 培训班结算挂钩借款
+			$receipt = new receipt ();
+			$item = array (
+					'rid' => $rid,
+					'invoiceTrainId' => $itid 
+			);
+			$receipt->setReceiptByCondition ( $item );
+			
+			$XDeode = new XDeode ( 7 );
+			return "/receiptTrainInvoiceEdi/" . $XDeode->encode ( $rid ) . ".html";
+		} else
+			die ( 'illegal request' );
+	}
+	
+	/**
+	 * 更新培训班结算 收款和取消收款
+	 */
+	function receiptTrainReceivables() {
+		$doType = isset ( $this->params ['doType'] ) ? $this->params ['doType'] : '';
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
+		$iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		$rid = $XDeode->decode ( $ridKey );
+		$iid = $XDeode->decode ( $iidKey );
+		if (! is_numeric ( $rid ) || ! is_numeric ( $iid ))
+			die ( 'illegal request-iid' );
+		
+		Doo::loadModel ( 'RIExtend' );
+		$RIExtend = new RIExtend ();
+		
+		if ($doType == 'CONFIRM') {
+			$RIExtend->rid = $rid;
+			$RIExtend->iid = $iid;
+			$RIExtend->RIstatus = 1;
+			$RIExtend->insert ();
 			
+			$XDeode = new XDeode ( 7 );
+			return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
+		} elseif ($doType == 'CANCEL') {
+			$RIExtend->delete ( array (
+					'where' => 'rid=' . $rid . ' and iid=' . $iid,
+					'limit' => 1 
+			) );
+			$XDeode = new XDeode ( 7 );
+			return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
+		} else {
+			die ( 'illegal request' );
+		}
+	}
+	
+	/**
+	 * 移除挂钩的培训班发票
+	 */
+	function receiptTrainReceivablesDelDo() {
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : ""; // 费用 培训班结算
+		$itidKey = $this->get_args ( 'itidKey' ) ? $this->get_args ( 'itidKey' ) : ""; // 发票培训班
 		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'RIExtend' );
+		$RIExtend = new RIExtend ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$rid = $XDeode->decode ( $ridKey );
+		$itid = $XDeode->decode ( $itidKey );
+		
+		if (is_numeric ( $rid ) && is_numeric ( $itid )) {
 			$receiptDetail = $receipt->getReceiptByRid ( $rid );
 			if ($receiptDetail ['status'] != 5)
-				die ();
+				die ( 'illegal request-status' );
+			
+			$receipt = new receipt ();
+			$receipt->rid = $rid;
+			$receipt->invoiceTrainId = 0;
+			$receipt->update ();
+			
+			$RIExtend->delete ( array (
+					'where' => 'rid=' . $rid 
+			) );
+			$XDeode = new XDeode ( 7 );
+			return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
+		} else
+			die ( 'illegal request-iid' );
+	}
+	
+	/**
+	 * 编辑培训班结算
+	 */
+	function receiptTrainItemEdi() {
+		$ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 7 );
+		$rid = $XDeode->decode ( $ridKey );
 		
-			$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
+		if (! is_numeric ( $rid ))
+			die ( 'illegal request' );
 		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'receiptTraining' );
+		$receiptTraining = new receiptTraining ();
+		Doo::loadModel ( 'RItem' );
+		$RItem = new RItem ();
+		Doo::loadModel ( 'accountItem' );
+		$accountItem = new accountItem ();
+		
+		$receiptDetail = $receipt->getReceiptByRid ( $rid );
+		if ($receiptDetail ['status'] != 5)
+			die ();
+		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
+		
+		$RItemList = $RItem->getRItemByRid ( $rid );
+		$aiList = $accountItem->getAccountBookByCategory ( '培训班费用' );
+		
+		// print_r($RItemList);
+		$data ['RItemList'] = $RItemList;
+		$data ['aiList'] = $aiList;
+		
+		$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
 		$data ['receiptDetail'] = $receiptDetail;
-		$data ['trainEdiType'] = "INVOICE";
+		$data ['trainEdiType'] = "ITEM";
 		$data ['ridKey'] = $ridKey;
 		$data ['memu'] = "receipt";
 		$data ['staff'] = $this->staff;
@@ -2484,9 +2740,435 @@ class ReceiptController extends DooController {
 		$data ['verifyId'] = $this->verifyId;
 		$data ['executeId'] = $this->executeId;
 		
-		$this->render ( "/receipt/receiptTrainInvoiceEdi", $data );
+		$this->render ( "/receipt/receiptTrainItemEdi", $data );
 	}
 	
+	/**
+	 * 添加支出项
+	 */
+	function receiptTrainItemAddDo() {
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
+		
+		// 支出项信息
+		$item = $this->get_args ( 'item' ) ? $this->get_args ( 'item' ) : "";
+		$price = $this->get_args ( 'price' ) ? $this->get_args ( 'price' ) : "";
+		$date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
+		$inputer = $this->get_args ( 'inputer' ) ? $this->get_args ( 'inputer' ) : "";
+		$describe = $this->get_args ( 'describe' ) ? $this->get_args ( 'describe' ) : "";
+		
+		if (! empty ( $ridKey ) && ! empty ( $item ) && ! empty ( $price ) && ! empty ( $date ) && ! empty ( $inputer )) {
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			Doo::loadModel ( 'RItem' );
+			$RItem = new RItem ();
+			
+			$rid = $XDeode->decode ( $ridKey );
+			if (! is_numeric ( $rid ))
+				die ( 'illegal request' );
+			
+			$RItem->rid = $rid;
+			$RItem->item = $item;
+			
+			$RItem->price = $price;
+			$RItem->date = $date;
+			$RItem->inputer = $inputer;
+			$RItem->describe = $describe;
+			
+			$RItem->insert ();
+			
+			// 添加公司汇总
+			// 报销详情
+			Doo::loadModel ( 'receiptDetail' );
+			$receiptDetail = new receiptDetail ();
+			Doo::loadModel ( 'receipt' );
+			$receipt = new receipt ();
+			
+			$rInfo = $receipt->getReceiptByRid ( $rid );
+			$rdInfo = $receiptDetail->getReceiptDetailByRIC ( $rid, $item, '培训班费用' );
+			if (empty ( $rdInfo )) {
+				$receiptDetail = new receiptDetail ();
+				$receiptDetail->staff = $this->staff [0] ['sid'];
+				$receiptDetail->item = $item;
+				$receiptDetail->itemCategory = '培训班费用';
+				$receiptDetail->price = number_format ( $price, 2, '.', '' );
+				$receiptDetail->date = date ( "Y-m-d" );
+				$receiptDetail->cid = $rInfo ['cid'];
+				$receiptDetail->rid = $rid;
+				$receiptDetail->status = 4;
+				$receiptDetail->insert ();
+			} else {
+				$receiptDetail = new receiptDetail ();
+				$rdInfo ['price'] += number_format ( $price, 2, '.', '' );
+				$receiptDetail->price = $rdInfo ['price'];
+				$receiptDetail->update ( array (
+						'where' => 'rid=' . $rid . ' and item like "' . $item . '" and itemCategory like "培训班费用"' 
+				) );
+			}
+			
+			$XDeode = new XDeode ( 7 );
+			return '/receiptTrainItemEdi/' . $XDeode->encode ( $rid ) . '.html';
+		} else
+			die ( 'illegal request' );
+	}
+	
+	/**
+	 * 培训班结算-讲师
+	 */
+	function receiptTrainLecturerEdi() {
+		$ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 7 );
+		$rid = $XDeode->decode ( $ridKey );
+		
+		if (! is_numeric ( $rid ))
+			die ( 'illegal request' );
+		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'receiptTraining' );
+		$receiptTraining = new receiptTraining ();
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		
+		Doo::loadModel ( 'lecturer' );
+		$lecturer = new lecturer ();
+		
+		$receiptDetail = $receipt->getReceiptByRid ( $rid );
+		if ($receiptDetail ['status'] != 5)
+			die ();
+		$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
+		
+		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+		
+		$lecturerList = $lecturer->getLecturerAll ();
+		$INSIDEhtml = $OUTSIDEhtml = '';
+		foreach ( $lecturerList as $key => $value ) {
+			if ($value ['ltype'] == 'INSIDE') {
+				$INSIDEhtml .= '<option value="' . $value ['category'] . '-' . $value ['staff'] . '">' . $value ['category'] . '-' . $value ['staff'] . '</option>';
+			} elseif ($value ['ltype'] == 'OUTSIDE') {
+				$OUTSIDEhtml .= '<option value="' . $value ['staff'] . '">' . $value ['staff'] . '</option>';
+			}
+		}
+		$data ['INSIDEhtml'] = $INSIDEhtml;
+		$data ['OUTSIDEhtml'] = $OUTSIDEhtml;
+		// print_r($RItemList);
+		$data ['RILecturerList'] = $RILecturerList;
+		
+		$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
+		$data ['receiptDetail'] = $receiptDetail;
+		$data ['trainEdiType'] = "LECTURER";
+		$data ['ridKey'] = $ridKey;
+		$data ['memu'] = "receipt";
+		$data ['staff'] = $this->staff;
+		
+		$data ['receiptMemu'] = 'saeaBorad';
+		$data ['verifyId'] = $this->verifyId;
+		$data ['executeId'] = $this->executeId;
+		
+		$this->render ( "/receipt/receiptTrainLecturerEdi", $data );
+	}
+	
+	/**
+	 * 添加讲师
+	 */
+	function receiptTrainLecturerAddDo() {
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
+		
+		// 支出项信息
+		$ltype = $this->get_args ( 'ltype' ) ? $this->get_args ( 'ltype' ) : "";
+		$lecturerName = $this->get_args ( 'lecturerName' ) ? $this->get_args ( 'lecturerName' ) : "";
+		$schoolDay = $this->get_args ( 'schoolDay' ) ? $this->get_args ( 'schoolDay' ) : "";
+		$price = $this->get_args ( 'price' ) ? $this->get_args ( 'price' ) : "";
+		$taxation = $this->get_args ( 'taxation' ) ? $this->get_args ( 'taxation' ) : "";
+		
+		if (! empty ( $ridKey ) && ! empty ( $ltype ) && ! empty ( $lecturerName ) && ! empty ( $schoolDay ) && ! empty ( $price )) {
+			Doo::loadClass ( 'XDeode' );
+			$XDeode = new XDeode ( 5 );
+			Doo::loadModel ( 'RILecturer' );
+			$RILecturer = new RILecturer ();
+			
+			$rid = $XDeode->decode ( $ridKey );
+			if (! is_numeric ( $rid ))
+				die ( 'illegal request' );
+			
+			if ($ltype == 'OUTSIDE' && empty ( $taxation ))
+				die ( 'illegal request-taxationError' );
+			
+			$RILecturer->rid = $rid;
+			$RILecturer->ltype = $ltype;
+			if ($ltype == 'OUTSIDE') {
+				if ($taxation == 'TAXATION') {
+					$RILecturer->taxation = 1;
+				} elseif ($taxation == 'NOTAXATION') {
+					$RILecturer->taxation = 0;
+				}
+			}
+			$RILecturer->lecturerName = $lecturerName;
+			$RILecturer->schoolDay = $schoolDay;
+			$RILecturer->price = $price;
+			$RILecturer->insert ();
+			
+			// 添加公司汇总
+			// 报销详情
+			Doo::loadModel ( 'receiptDetail' );
+			$receiptDetail = new receiptDetail ();
+			Doo::loadModel ( 'receipt' );
+			$receipt = new receipt ();
+			
+			// 金额总计
+			$price = $price * $schoolDay;
+			
+			$rInfo = $receipt->getReceiptByRid ( $rid );
+			$rdInfo = $receiptDetail->getReceiptDetailByRIC ( $rid, '讲课费', '培训班费用' );
+			if (empty ( $rdInfo )) {
+				$receiptDetail = new receiptDetail ();
+				$receiptDetail->staff = $this->staff [0] ['sid'];
+				$receiptDetail->item = '讲课费';
+				$receiptDetail->itemCategory = '培训班费用';
+				$receiptDetail->price = number_format ( $price, 2, '.', '' );
+				$receiptDetail->date = date ( "Y-m-d" );
+				$receiptDetail->cid = $rInfo ['cid'];
+				$receiptDetail->rid = $rid;
+				$receiptDetail->status = 4;
+				$receiptDetail->insert ();
+			} else {
+				$receiptDetail = new receiptDetail ();
+				$rdInfo ['price'] += number_format ( $price, 2, '.', '' );
+				$receiptDetail->price = $rdInfo ['price'];
+				$receiptDetail->update ( array (
+						'where' => 'rid=' . $rid . ' and item like "' . '讲课费' . '" and itemCategory like "培训班费用"' 
+				) );
+			}
+			
+			$XDeode = new XDeode ( 7 );
+			return '/receiptTrainLecturerEdi/' . $XDeode->encode ( $rid ) . '.html';
+		} else
+			die ( 'illegal request' );
+	}
+	
+	/**
+	 * 移除讲师
+	 */
+	function receiptTrainLecturerDelDo() {
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : ""; // 费用 培训班结算
+		$rlidKey = $this->get_args ( 'rlidKey' ) ? $this->get_args ( 'rlidKey' ) : ""; // 发票培训班
+		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		
+		$rid = $XDeode->decode ( $ridKey );
+		$rlid = $XDeode->decode ( $rlidKey );
+		
+		if (is_numeric ( $rid ) && is_numeric ( $rlid )) {
+			$receiptDetail = $receipt->getReceiptByRid ( $rid );
+			if ($receiptDetail ['status'] != 5)
+				die ( 'illegal request-status' );
+			
+			$RILecturer->delete ( array (
+					'where' => 'rid=' . $rid . ' and rlid=' . $rlid 
+			) );
+			$XDeode = new XDeode ( 7 );
+			return '/receiptTrainLecturerEdi/' . $XDeode->encode ( $rid ) . '.html';
+		} else
+			die ( 'illegal request-iid' );
+	}
+	
+	/**
+	 * 培训班提交审批
+	 */
+	function receiptTrainApprovalDo() {
+		$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";;
+		
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 7 );
+		$rid = $XDeode->decode ( $ridKey );
+		
+		Doo::loadModel ( 'receipt' );
+		$receipt = new receipt ();
+		Doo::loadModel ( 'receiptDetail' );
+		$receiptDetail = new receiptDetail ();
+		Doo::loadModel ( 'statistics' );
+		$statistics = new statistics ();
+		
+		
+		Doo::loadModel ( "verify" );
+		$verify = new verify ();
+		
+		// 审批状态的判定
+		$receiptDetailList = $receipt->getOne ( array (
+				'where' => 'staff=' . $this->staff [0] ['sid'] . ' and rid=' . $rid . ' and (status=4 or status=5 or status=7)',
+				'asArray' => true 
+		) );
+		if (empty ( $receiptDetailList ))
+			return "/saeaBorad";
+		
+		$verifyDetail = $verify->getOne ( array (
+				'where' => ' vid =' . $receiptDetailList ['verify'],
+				'asArray' => true 
+		) );
+		$verifyDetail = json_decode ( $verifyDetail ['staff'], true );
+		
+		if (empty ( $receiptDetailList ['nowStaff'] )) {
+			
+			$nowStaff = "";
+			$nowStaffList = array ();
+			if ($verifyDetail [0] [1] == 'ROLE') {
+				$vStaffString = json_decode ( $verifyDetail [0] [3] );
+				foreach ( $vStaffString as $key => $value ) {
+					$staffK = explode ( "_", $value );
+					array_push ( $nowStaffList, $staffK [0] );
+				}
+				$nowStaff = implode ( ',', $nowStaffList );
+			} else {
+				$nowStaff = $verifyDetail [0] [0];
+			}
+			$receipt->nowStaff = $nowStaff;
+		}
+		// echo $nowStaff;
+		// print_r($verifyDetail);die;
+		
+		$receipt->rid = $receiptDetailList ['rid'];
+		$receipt->date = date ( "Y-m-d" );
+		$receipt->status = 2;
+		$receipt->update ();
+		
+		$receiptDetail->status = 2;
+		$receiptDetail->update ( array (
+				'where' => 'rid=' . $receiptDetailList ['rid'] 
+		) );
+		
+		Doo::loadModel ( "receiptLog" );
+		$receiptLog = new receiptLog ();
+		Doo::loadModel ( "verify" );
+		$verify = new verify ();
+		
+		$vr = $verify->getOne ( array (
+				'where' => 'vid=' . $receiptDetailList ['verify'],
+				'asArray' => true 
+		) );
+		
+		$jd = json_decode ( $vr ['staff'] );
+		$roleId = 0;
+		
+		foreach ( $jd as $key => $value ) {
+			if ($value [1] == 'ROLE') {
+				$pos = strpos ( $value [3], $this->staff [0] ['sid'] );
+				if ($pos !== false) {
+					$roleId = $value [0];
+				}
+			}
+		}
+		
+		// 审批日志
+		// echo $roleId;die;
+		
+		if (! empty ( $roleId )) {
+			Doo::loadModel ( "role" );
+			$role = new role ();
+			$roleInfo = $role->getOne ( array (
+					'where' => 'rid=' . $roleId,
+					'asArray' => true 
+			) );
+			
+			// $receiptLog->rolename = $roleInfo ['name'];
+		}
+		
+		$receiptLog->username = $this->staff [0] ['username'];
+		$receiptLog->uid = $this->staff [0] ['sid'];
+		$receiptLog->date = date ( "Y-m-d" );
+		$receiptLog->opinion = '提交审批';
+		$receiptLog->img = $this->staff [0] ['avatar'];
+		$receiptLog->status = 2;
+		$receiptLog->rid = $rid;
+		$receiptLog->insert ();
+		
+		//写入列表项
+		Doo::loadModel ( 'accountItem' );
+		$accountItem = new accountItem ();
+		$aItem = $accountItem->getAccountBookByCategory ( '培训班费用' );
+		
+		// 项目金额合计
+		Doo::loadModel ( 'RItem' );
+		$RItem = new RItem ();
+		// 讲师获得
+		Doo::loadModel ( 'RILecturer' );
+		$RILecturer = new RILecturer ();
+		$RItemList = $RItem->getRItemByRid ( $rid );
+		$RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
+		// 支出项金额详情
+		$aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, 0 );
+		//print_r($aItem);
+		//print_r($aiData);
+
+		$accountJson [$this->AGENCY] = $accountJson [$this->TRAVEL] = $accountJson [$this->TRAIN] = $accountJson [$this->OTHER] = array ();
+		$ag = $tr = $ta = $ot = 0;
+		$sum = $agencySum = $travelSum = $trainSum = $otherSum = 0;
+			
+		foreach ( $aItem as $key => $value ) {
+			if ($value ['category'] == $this->TRAIN) {
+				
+				foreach ($aiData['dataList'] as $k=>$v){
+					if ($value ['name'] == $v['name']) {
+						array_push ( $accountJson [$this->TRAIN], array (
+								'aid' => $value ['aid'],
+								'name' => $value ['name'],
+								'price' => number_format ( $v['price'], 2, '.', '' )
+						) );
+						$sum += $v['price'];
+						$trainSum += $v['price'];
+						unset($aiData['dataList'][$k]);
+						break;
+					}
+				}
+				
+			}
+		}
+		$accountJson ['cSum'] = array (
+				'agencySum' => number_format ( $agencySum, 2, '.', '' ),
+				'travelSum' => number_format ( $travelSum, 2, '.', '' ),
+				'trainSum' => number_format ( $trainSum, 2, '.', '' ),
+				'otherSum' => number_format ( $otherSum, 2, '.', '' )
+		);
+			
+		// 报销单
+		$receipt = new receipt ();
+ 		$receipt->accountItem = json_encode ( $accountJson );
+ 		$receipt->sum = number_format ( $sum, 2, '.', '' );
+ 		$receipt->update ( array (
+					'where' => 'rid=' . $rid
+			) );
+		//print_r($accountJson);
+		// statistics item 统计写入
+		$dateArray = explode ( "-", $receiptDetailList ['date'] );
+		$dateCondition = " and Year(date) =" . $dateArray [0] . " and Month(date) = " . $dateArray [1];
+		
+		$accountItem =  $accountJson ;
+		
+		$stat = $statistics->getOne ( array (
+				'where' => 'staff=' . $this->staff [0] ['sid'] . $dateCondition,
+				'asArray' => true 
+		) );
+		if (empty ( $stat )) {
+			$statistics->date = date ( "Y-m-d" );
+			$statistics->cid = $this->staff [0] ['cid'];
+			$statistics->staff = $this->staff [0] ['sid'];
+			$statistics->agPrice = 0;
+			$statistics->rePrice = $accountItem ['cSum'] ['agencySum'] + $accountItem ['cSum'] ['travelSum'] + $accountItem ['cSum'] ['trainSum'] + $accountItem ['cSum'] ['otherSum'];
+			$statistics->insert ();
+		} else {
+			$statistics->rePrice = $stat ['rePrice'] + $accountItem ['cSum'] ['agencySum'] + $accountItem ['cSum'] ['travelSum'] + $accountItem ['cSum'] ['trainSum'] + $accountItem ['cSum'] ['otherSum'];
+			$statistics->update ( array (
+					'where' => 'sid=' . $stat ['sid'] 
+			) );
+		}
+		
+		return "/saeaBorad";
+	}
 	function confirmation() {
 		$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
 		
@@ -15087,6 +15769,59 @@ class ReceiptController extends DooController {
 		$mail->CharSet = "UTF-8";
 		return $mail->Send ();
 	}
+	function h5Upload() {
+		$POST_MAX_SIZE = ini_get ( 'post_max_size' );
+		$unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
+		$multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
+		
+		if (( int ) $_SERVER ['CONTENT_LENGTH'] > $multiplier * ( int ) $POST_MAX_SIZE && $POST_MAX_SIZE) {
+			header ( "HTTP/1.1 500 Internal Server Error" );
+			echo "POST exceeded maximum allowed size.";
+			exit ( 0 );
+		}
+		
+		// Settings
+		$save_path = DOO::conf ()->SITE_PATH . "upload/swfupload/"; // The path were we will save the file (getcwd() may not be reliable and should be tested in your environment)
+		$upload_name = "Filedata";
+		$max_file_size_in_bytes = 2147483647; // 2GB in bytes
+		$extension_whitelist = array (
+				"doc",
+				"txt",
+				"jpg",
+				"gif",
+				"png" 
+		); // Allowed file extensions
+		$valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a Regular Expression format)
+		                                                         
+		// Other variables
+		$MAX_FILENAME_LENGTH = 260;
+		$file_name = "";
+		$file_extension = "";
+		$uploadErrors = array (
+				0 => "文件上传成功",
+				1 => "上传的文件超过了 php.ini 文件中的 upload_max_filesize directive 里的设置",
+				2 => "上传的文件超过了 HTML form 文件中的 MAX_FILE_SIZE directive 里的设置",
+				3 => "上传的文件仅为部分文件",
+				4 => "没有文件上传",
+				6 => "缺少临时文件夹" 
+		);
+		
+		$nk = time ();
+		$file_name = $nk . '.' . $this->_GetFileEXT ( $_FILES [$upload_name] ['name'] ); // preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name']));
+		
+		if (! @move_uploaded_file ( $_FILES [$upload_name] ["tmp_name"], $save_path . $file_name )) {
+			echo "文件无法保存.";
+			exit ( 0 );
+		}
+		
+		// Return output to the browser (only supported by SWFUpload for Flash Player 9)
+		
+		echo json_encode ( array (
+				'filename' => $file_name,
+				'id' => $nk 
+		) );
+		exit ( 0 );
+	}
 	function swfupload() {
 		$POST_MAX_SIZE = ini_get ( 'post_max_size' );
 		$unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );

+ 124 - 0
protected/model/accountItem.php

@@ -38,6 +38,130 @@ class accountItem extends DooModel {
 		
 		return $acctionItem;
 	}
+	
+	/**
+	 * 根据项目获得ITEM
+	 */
+	function getAccountBookByCategory($category=''){
+		$list = $this->find ( array (
+				'where' => ' category like "%' . $category.'%"',
+				'asArray' => TRUE
+		) );
+		return $list;
+	}
+	
+	/**
+	 * 获得培训班金额详情
+	 * @param array $RItemList 支出项目
+	 * @param array $RILecturerList 讲师项目
+	 * @return number[]
+	 */
+	function getTrainingDetail($RItemList=array(),$RILecturerList=array(),$invoiceArriveAmount=0){
+		$aiList = $this->find ( array (
+				'where' => ' category like "%培训班费用%"',
+				'asArray' => TRUE
+		) );
+		
+		$total=0;$categoryActualExpenditure='';
+		foreach ($aiList as $k=>$v){
+			$aiList[$k]['price']=$aiList[$k]['companyPrice']=$aiList[$k]['categoryPrice']=0;
+			$aiList[$k]['insidePrice']=$aiList[$k]['outsideNoTaxPrice']=$aiList[$k]['outsideTaxPrice']=0;
+			foreach ($RItemList as $key=>$value){
+				if($v['name']=='讲课费'){
+				}elseif($v['name']=='办公费'&&$value['item']=='办公费'){
+					if($value['payType']==0){
+						$aiList[$k]['categoryPrice']+=$value['price'];
+						$total+=$value['price'];
+					}elseif($value['payType']==1){
+						$aiList[$k]['companyPrice']+=$value['price'];
+						$categoryActualExpenditure+=$value['price'];
+						$total+=$value['price'];
+					}
+					$aiList[$k]['price']+=$value['price'];
+					unset($RItemList[$key]);
+				}elseif($v['name']=='邮寄费'&&$value['item']=='邮寄费'){
+					if($value['payType']==0){
+						$aiList[$k]['categoryPrice']+=$value['price'];
+						$total+=$value['price'];
+					}elseif($value['payType']==1){
+						$aiList[$k]['companyPrice']+=$value['price'];
+						$categoryActualExpenditure+=$value['price'];
+						$total+=$value['price'];
+					}
+					$aiList[$k]['price']+=$value['price'];
+					unset($RItemList[$key]);
+				}else{
+					if ($v['name']==$value['item']){
+						$aiList[$k]['price']+=$value['price'];
+						$total+=$value['price'];
+						unset($RItemList[$key]);
+					}
+				}
+				if($value['item']=='研究中心经费'&&$v['name']=='研究中心经费'){
+					$categoryActualExpenditure+=$value['price'];
+				}
+				if($value['item']=='税款'&&$v['name']=='税款'){
+					$categoryActualExpenditure+=$value['price'];
+				}
+			}
+			//讲师项
+			foreach ($RILecturerList as $lecKey=>$lecValue){
+				if($v['name']=='讲课费'){
+					if($lecValue['ltype']=='INSIDE'){
+						$bValue=$lecValue['price']*$lecValue['schoolDay'];
+						$aiList[$k]['insidePrice']+=$bValue;
+						$total+=$bValue;
+						$categoryActualExpenditure+=$bValue;
+						$aiList[$k]['price']+=$bValue;
+						unset($RILecturerList[$lecKey]);
+					}elseif($lecValue['ltype']=='OUTSIDE'){
+						if($lecValue['taxation']==0){
+							$bValue=$lecValue['price']*$lecValue['schoolDay'];
+							$aiList[$k]['outsideNoTaxPrice']+=$bValue;
+							$total+=$bValue;
+							$aiList[$k]['price']+=$bValue;
+							unset($RILecturerList[$lecKey]);
+						}elseif($lecValue['taxation']==1){
+							$bValue=$lecValue['price']*$lecValue['schoolDay'];
+							$aiList[$k]['outsideTaxPrice']+=$bValue;
+							$total+=$bValue;
+							$aiList[$k]['price']+=$bValue;
+							unset($RILecturerList[$lecKey]);
+						}
+					}
+				}
+			}
+			
+			$aiList[$k]['categoryProportion']=$aiList[$k]['companyProportion']=$aiList[$k]['proportion']=0;
+			$aiList[$k]['insideProportion']=$aiList[$k]['outsideNoTaxProportion']=$aiList[$k]['outsideTaxProportion']=0;
+			 
+			if ($invoiceArriveAmount!=0){
+	 			if($v['name']=='办公费'||$v['name']=='邮寄费'){
+	 				$proportion=$aiList[$k]['categoryPrice']/$invoiceArriveAmount;
+	 				$aiList[$k]['categoryProportion']=number_format ( $proportion, 2, '.', '' )*100;
+	 				$proportion=$aiList[$k]['companyPrice']/$invoiceArriveAmount;
+	 				$aiList[$k]['companyProportion']=number_format ( $proportion, 2, '.', '' )*100;
+	 			}elseif($v['name']=='讲课费'){
+	 				$proportion=$aiList[$k]['insidePrice']/$invoiceArriveAmount;
+	 				$aiList[$k]['insideProportion']=number_format ( $proportion, 2, '.', '' )*100;
+	 				
+	 				$proportion=$aiList[$k]['outsideTaxPrice']/$invoiceArriveAmount;
+	 				$aiList[$k]['outsideTaxProportion']=number_format ( $proportion, 2, '.', '' )*100;
+	 				
+	 				$proportion=$aiList[$k]['outsideNoTaxPrice']/$invoiceArriveAmount;
+	 				$aiList[$k]['outsideNoTaxProportion']=number_format ( $proportion, 2, '.', '' )*100;
+	 			}else{
+	 				$proportion=$aiList[$k]['price']/$invoiceArriveAmount;
+	 				$aiList[$k]['proportion']=number_format ( $proportion, 2, '.', '' )*100;
+	 			}
+			}
+			
+ 			
+		}
+		
+		return array('dataList'=>$aiList,'total'=>$total,'categoryActualExpenditure'=>$categoryActualExpenditure);
+	}
+	
 }
 
 ?>

+ 61 - 7
protected/model/invoice.php

@@ -300,6 +300,46 @@ class invoice extends DooModel {
 		$Detail ['category'] = $lCategory->getCategory ();
 		return $Detail;
 	}
+	
+	/**
+	 * 根据培训班ID获得发票
+	 */
+	function getInvoicePrintedByItid($trainId = 0) {
+		
+		$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)';
+		$query = Doo::db ()->query ( $sql );
+		$result = $query->fetchAll ();
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'invoiceReceivables' );
+		$invoiceReceivables = new invoiceReceivables ();
+		foreach ($result as $key=>$value){
+			$result [$key] ['irDetail'] =$invoiceReceivables->getInvoiceReceivablesByIrid($value ['irid']);
+			$result [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
+		}
+		
+		return $result;
+		
+// 		$condition = array (
+// 				'where' => "trainId = " . $trainId . " and status=2 and printStatus=1 and (untreadStatus=0 or untreadStatus=3)",
+// 				'asArray' => TRUE 
+// 		);
+// 		$detail = $this->find ( $condition );
+		
+// 		return $detail;
+	}
+	
+	function sumOfInvoiceByItid($itidSql=0){
+		$sql = 'select sum(a.invoicePrice) as invoicePrice ,a.trainId as trainId,a.iid
+				from ' . $this->_table . ' as a left join  CLD_RIExtend  as b 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';
+		$query = Doo::db ()->query ( $sql );
+		return $result = $query->fetchAll ();
+	}
+	
 	/**
 	 * 根据多个iid获得多个发票
 	 * @param number $iid
@@ -435,17 +475,17 @@ class invoice extends DooModel {
 		return $result = $query->fetchAll ();
 	}
 	function sumOfInvoiceRecelvablesTrain($itidSql) {
-// 		$sql = 'select sum(b.receivablesPrice) as receivablesPrice ,a.trainId,count(*) as count
-// 				from ' . $this->_table . ' as a left join CLD_invoiceReceivables as b on find_in_set(a.irid,b.irid)
-// 				where a.trainId in (' . $itidSql . ') and a.status=2 and a.printStatus=1 and (a.untreadStatus =0 or a.untreadStatus=3) and a.irid!="" 
-// 				GROUP BY a.trainId';
-
-		$sql='select sum(b.receivablesPrice) as receivablesPrice ,a.trainId,count(*) as count
+		// $sql = 'select sum(b.receivablesPrice) as receivablesPrice ,a.trainId,count(*) as count
+		// from ' . $this->_table . ' as a left join CLD_invoiceReceivables as b on find_in_set(a.irid,b.irid)
+		// where a.trainId in (' . $itidSql . ') and a.status=2 and a.printStatus=1 and (a.untreadStatus =0 or a.untreadStatus=3) and a.irid!=""
+		// GROUP BY a.trainId';
+		$sql = 'select sum(b.receivablesPrice) as receivablesPrice ,a.trainId,count(*) as count
  				from ' . $this->_table . ' as a left join CLD_invoiceReceivables as b on (a.iid=b.iid)
  				where a.trainId in (' . $itidSql . ') and a.status=2 and a.printStatus=1 and (a.untreadStatus =0 or a.untreadStatus=3) and a.irid!="" 
  				GROUP BY a.trainId';
 		
 		$query = Doo::db ()->query ( $sql );
+		
 		return $result = $query->fetchAll ();
 	}
 	// 获得培训班发票
@@ -454,9 +494,11 @@ class invoice extends DooModel {
 			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!=2 and b.isDelete=0';
+		
+		//echo $sql;
 		$query = Doo::db ()->query ( $sql );
 		$result = $query->fetchAll ();
-		return $result[0] ['count'];
+		return $result [0] ['count'];
 		
 		// $detail = $this->count ( array (
 		// 'where' => "trainId= '" . $itid . "' and untreadStatus!=2 and isDelete=0", // and sid=".$sid,
@@ -566,6 +608,18 @@ class invoice extends DooModel {
 	}
 	
 	/**
+	 * 批量更新
+	 * @param string $isid
+	 * @return number
+	 */
+	function UpdateBatchInvoice($sql = "") {
+		if (empty ( $sql ))
+			return 0;
+	
+			$query = Doo::db ()->query ( $sql );
+	}
+	
+	/**
 	 * 根据管理组和发票当前状态获得打印发票数据;其中当iid为空时获取所有发票数据,反之获取1条数据
 	 * @param number $sid 管理组人员ID
 	 * @param number $status 状态 为0时获取可以打印数据,为1时获取已经完成打印数据

+ 10 - 3
protected/model/invoiceStatistics.php

@@ -285,10 +285,16 @@ class invoiceStatistics extends DooModel {
 		if (empty ( $cid ))
 			return array ();
 		
-		$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,staff,Month(date) as month
+		//date_format(column,'%Y-%m')=
+// 		$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,staff,Month(date) as month
+// 				from ' . $this->_table . '
+// 				where Month(date)=' . $month . ' and cid = ' . $cid . '
+// 					GROUP BY staff';
+			$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,staff,Month(date) as month
 				from ' . $this->_table . '
-				where Month(date)=' . $month . ' and cid = ' . $cid . '
+				where date_format(date,"%Y-%m")=' . $month . ' and cid = ' . $cid . '
 					GROUP BY staff';
+			//echo $sql;
 		$query = Doo::db ()->query ( $sql );
 		return $result = $query->fetchAll ();
 	}
@@ -301,10 +307,11 @@ class invoiceStatistics extends DooModel {
 		if (empty ( $cid ))
 			return array ();
 		$month = date ( "m" );
+		$year=date('Y');
 		
 		$sql = 'select sum(invoicePrice) as invoicePrice,sum(receivablesPrice) as receivablesPrice,sum(accountPrice) as accountPrice ,cid,staff,Month(date) as month
 				from ' . $this->_table . '
-				where Month(date)=' . $month . ' and cid = ' . $cid . '
+				where Month(date)=' . $month . ' and Year(date)='.$year.' and cid = ' . $cid . '
 					GROUP BY staff';
 		$query = Doo::db ()->query ( $sql );
 		//echo $sql;

+ 1 - 1
protected/model/invoiceStore.php

@@ -448,7 +448,7 @@ class invoiceStore extends DooModel {
 	function delInvoiceStoreByIsid($isid='') {
 		if (empty ( $isid ))
 			return '';
-		$sql = "DELETE FROM " . $this->_table . " WHERE `isid`=" . $isid;
+		$sql = "DELETE FROM " . $this->_table . " WHERE `isid`=" . $isid." limit 1";
 		$query = Doo::db ()->query ( $sql );
 	}
 	

+ 116 - 23
protected/model/invoiceTraining.php

@@ -21,6 +21,7 @@ class invoiceTraining extends DooModel {
 	public $invoiceArriveAmount;
 	public $arriveSchedule;
 	public $creatorDate;
+	public $settlementStatus;
 	public $_table = 'CLD_invoiceTraining';
 	public $_primarykey = 'itid';
 	public $_fields = array (
@@ -36,6 +37,7 @@ class invoiceTraining extends DooModel {
 			'invoiceTotalAmount',
 			'invoiceArriveAmount',
 			'arriveSchedule',
+			'settlementStatus',
 			'creatorDate' 
 	);
 	
@@ -102,6 +104,42 @@ class invoiceTraining extends DooModel {
 		}
 		return $detail;
 	}
+	
+	/**
+	 * 根据办事处获得结算完成培训班
+	 * @param number $SStatus
+	 * @return string
+	 */
+	function getInvoiceTrainBySettlementStatus($SStatus = 0, $cid = 0) {
+		$condition = array (
+				'where' => " settlementStatus=" . $SStatus . ' and cid=' . $cid,
+				'asArray' => TRUE 
+		);
+		$list = $this->find ( $condition );
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
+		}
+		return $list;
+	}
+	
+	/**
+	 * 获得办事处下的培训班
+	 */
+	function getInvoiceTrainingByCid($cid = 0) {
+		$condition = array (
+				'where' => " cid=" . $cid,
+				'asArray' => TRUE 
+		);
+		$list = $this->find ( $condition );
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
+		}
+		return $list;
+	}
 	function getInvoiceTrainingByTodo($select = "", $cid = 0, $sid = 0) {
 		Doo::loadModel ( 'staff' );
 		$staff = new staff ();
@@ -110,7 +148,7 @@ class invoiceTraining extends DooModel {
 		
 		$condition = array (
 				'where' => "(status= 0 or status=1) and ( cid=" . $cid . " or creator=" . $sid . " )",
-				//'limit' => 8,
+				// 'limit' => 8,
 				'asArray' => TRUE 
 		);
 		if (! empty ( $select ))
@@ -142,13 +180,13 @@ class invoiceTraining extends DooModel {
 			$invoiceList = $invoice->sumOfinvoiceTrain ( $itidSql );
 			$invoiceRecelvablesList = $invoice->sumOfInvoiceRecelvablesTrain ( $itidSql );
 		}
-		//print_r($invoiceRecelvablesList);
+		// print_r($invoiceRecelvablesList);
 		
 		foreach ( $list as $key => $value ) {
 			
-			$countInvoice=$invoice->getInvoiceByTrainingCount($value['itid']);
-			$value ['invoiceTotal']=$countInvoice;
-			$list [$key] ['invoiceTotal'] =$countInvoice;
+			$countInvoice = $invoice->getInvoiceByTrainingCount ( $value ['itid'] );
+			$value ['invoiceTotal'] = $countInvoice;
+			$list [$key] ['invoiceTotal'] = $countInvoice;
 			
 			foreach ( $invoiceList as $k => $v ) {
 				if ($value ['itid'] == $v ['trainId']) {
@@ -160,11 +198,10 @@ class invoiceTraining extends DooModel {
 				if ($value ['itid'] == $o ['trainId']) {
 					$list [$key] ['invoiceArriveAmount'] = $o ['receivablesPrice'];
 					$list [$key] ['arriveSchedule'] = "0";
-					if ($value ['invoiceTotal'] != 0){
+					if ($value ['invoiceTotal'] != 0) {
 						$list [$key] ['arriveSchedule'] = round ( $list [$key] ['invoiceArriveAmount'] / $list [$key] ['invoiceTotalAmount'] * 100, 2 );
-						//$list [$key] ['arriveSchedule'] = round ( $o ['count'] / $value ['invoiceTotal'] * 100, 2 );
+						// $list [$key] ['arriveSchedule'] = round ( $o ['count'] / $value ['invoiceTotal'] * 100, 2 );
 					}
-						
 					
 					break;
 				}
@@ -211,7 +248,7 @@ class invoiceTraining extends DooModel {
 		
 		$condition = array (
 				'where' => "status= '" . $status . "' and  (cid=" . $cid . " or creator=" . $sid . " )",
-				'limit' => 8,
+				// 'limit' => 8,
 				'asArray' => TRUE 
 		);
 		if (! empty ( $select ))
@@ -221,7 +258,7 @@ class invoiceTraining extends DooModel {
 		
 		$list = $this->find ( $condition );
 		
-	Doo::loadClass ( 'XDeode' );
+		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		$itid = array ();
 		foreach ( $list as $key => $value ) {
@@ -243,13 +280,13 @@ class invoiceTraining extends DooModel {
 			$invoiceList = $invoice->sumOfinvoiceTrain ( $itidSql );
 			$invoiceRecelvablesList = $invoice->sumOfInvoiceRecelvablesTrain ( $itidSql );
 		}
-		//print_r($invoiceRecelvablesList);
+		// print_r($invoiceRecelvablesList);
 		
 		foreach ( $list as $key => $value ) {
 			
-			$countInvoice=$invoice->getInvoiceByTrainingCount($value['itid']);
-			$value ['invoiceTotal']=$countInvoice;
-			$list [$key] ['invoiceTotal'] =$countInvoice;
+			$countInvoice = $invoice->getInvoiceByTrainingCount ( $value ['itid'] );
+			$value ['invoiceTotal'] = $countInvoice;
+			$list [$key] ['invoiceTotal'] = $countInvoice;
 			
 			foreach ( $invoiceList as $k => $v ) {
 				if ($value ['itid'] == $v ['trainId']) {
@@ -261,11 +298,11 @@ class invoiceTraining extends DooModel {
 				if ($value ['itid'] == $o ['trainId']) {
 					$list [$key] ['invoiceArriveAmount'] = $o ['receivablesPrice'];
 					$list [$key] ['arriveSchedule'] = "0";
-					if ($value ['invoiceTotal'] != 0){
+					if ($value ['invoiceTotal'] != 0) {
 						
 						$list [$key] ['arriveSchedule'] = round ( $list [$key] ['invoiceArriveAmount'] / $list [$key] ['invoiceTotalAmount'] * 100, 2 );
 						
-						//$list [$key] ['arriveSchedule'] = round ( $o ['count'] / $value ['invoiceTotal'] * 100, 2 );
+						// $list [$key] ['arriveSchedule'] = round ( $o ['count'] / $value ['invoiceTotal'] * 100, 2 );
 					}
 					
 					break;
@@ -283,7 +320,7 @@ class invoiceTraining extends DooModel {
 	function getInvoiceTrainingByItid($itid = 0) {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
-		if (!is_numeric($itid))
+		if (! is_numeric ( $itid ))
 			$itid = $XDeode->decode ( $itid );
 		
 		$detail = array ();
@@ -294,9 +331,65 @@ class invoiceTraining extends DooModel {
 			) );
 		}
 		$detail ['trainingKey'] = '';
-		if (! empty ( $detail ))
-			$detail ['trainingKey'] = $XDeode->encode ( $detail ['itid'] );
 		
+		if (! empty ( $detail )) {
+			Doo::loadModel ( 'L_category' );
+			$lCategory = new L_category ();
+			Doo::loadModel ( 'staff' );
+			$staff = new staff ();
+			
+			$cateList = $lCategory->getCategoryById ( $detail ['cid'] );
+			
+			$itid = $detail ['itid'];
+			$detail ['trainingKey'] = $XDeode->encode ( $detail ['itid'] );
+			$staffdetail = $staff->getStaffBySid ( $detail ['creator'] );
+			$detail ['staff'] = $staffdetail;
+			$catedetail = $lCategory->getCategoryById ( $detail ['cid'] );
+			$detail ['category'] = $catedetail;
+			
+			// 获得开票金额合计 入账金额合计 入账完成度
+			Doo::loadModel ( 'invoice' );
+			$invoice = new invoice ();
+			
+			$invoiceList = $invoiceRecelvablesList = array ();
+			if (! empty ( $itid )) {
+				$itidSql = $itid;
+				
+				$invoiceList = $invoice->sumOfinvoiceTrain ( $itidSql );
+				$invoiceRecelvablesList = $invoice->sumOfInvoiceRecelvablesTrain ( $itidSql );
+				//获得办事处已收款
+				$RIList=$invoice->sumOfInvoiceByItid($itid);
+			}
+			 //print_r($invoiceRecelvablesList);
+			
+			$countInvoice = $invoice->getInvoiceByTrainingCount ( $detail ['itid'] );
+			$detail ['invoiceTotal'] = $countInvoice;
+			
+			foreach ( $invoiceList as $k => $v ) {
+				if ($detail ['itid'] == $v ['trainId']) {
+					$detail ['invoiceTotalAmount'] = $v ['invoicePrice'];
+					break;
+				}
+			}
+			foreach ( $invoiceRecelvablesList as $i => $o ) {
+				if ($detail['itid'] == $o ['trainId']) {
+					$detail ['invoiceArriveAmount'] = $o ['receivablesPrice'];
+					$detail ['arriveSchedule'] = 0;
+					if ($detail ['invoiceTotal'] != 0) {
+						$detail ['arriveSchedule'] = round ( $detail ['invoiceArriveAmount'] / $detail ['invoiceTotalAmount'] * 100, 2 );
+					}
+					break;
+				}
+			}
+			//办事处已收款
+			foreach ($RIList as $key=>$value){
+				if ($detail ['itid'] == $value ['trainId']) {
+					$detail ['RIAmount'] = $value ['invoicePrice'];
+					break;
+				}
+			}
+		}
+		//print_r($detail);
 		return $detail;
 	}
 	
@@ -325,9 +418,9 @@ class invoiceTraining extends DooModel {
 	 * 获得某办事处未完成的培训班
 	 * @return string
 	 */
-	function getInvoiceTrainingByUnfinished($cid=0){
+	function getInvoiceTrainingByUnfinished($cid = 0) {
 		$condition = array (
-				'where' => "(status= 0 or status=1) and cid=".$cid,
+				'where' => "(status= 0 or status=1) and cid=" . $cid,
 				'asArray' => true 
 		);
 		
@@ -336,7 +429,7 @@ class invoiceTraining extends DooModel {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		foreach ( $list as $key => $value ) {
-			$list[$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
+			$list [$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
 		}
 		
 		return $list;
@@ -356,7 +449,7 @@ class invoiceTraining extends DooModel {
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		foreach ( $list as $key => $value ) {
-			$list[$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
+			$list [$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
 		}
 		
 		return $list;

+ 3 - 1
protected/model/receipt.php

@@ -36,6 +36,7 @@ class receipt extends DooModel {
 	public $remittanceBankType;
 	public $trainId;
 	public $trainLoanRid;
+	public $invoiceTrainId;
 	
 	
 	public $_table = 'CLD_receipt';
@@ -75,7 +76,8 @@ class receipt extends DooModel {
 			'coupletNumber',
 			'remittanceBankType',
 			'trainId',
-			'trainLoanRid'
+			'trainLoanRid',
+			'invoiceTrainId'
 	);
 	function receiptByYear($dateCondition, $sid) {
 		$sql = "select sum(sum) as sum from " . $this->_table . " where staff= '" . $sid . "' " . $dateCondition . " and status=2 ";

+ 21 - 0
protected/model/receiptDetail.php

@@ -60,6 +60,27 @@ class receiptDetail extends DooModel {
     	) );
     	return $list;
     }
+    
+    /**
+     * 根据RID 项目详情获得信息
+     * @param string $rid
+     * @param string $item
+     * @param string $itemCategory
+     * @return unknown
+     */
+    function getReceiptDetailByRIC($rid='',$item='',$itemCategory=''){
+    	if (!is_numeric($rid)||empty($item)||empty($itemCategory)){
+    		return array();
+    	}
+    	
+    	$rinfo = $this->getOne ( array (
+    			'where' => 'rid=' . $rid.' and item like "'.$item.'" and itemCategory like "'.$itemCategory.'"',
+    			'asArray' => true
+    	) );
+    	
+    	return $rinfo;
+    }
+    
 }
 
 ?>

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

@@ -20,13 +20,7 @@
 			</div>
 			<div class="adminContent autoHeight">
 				<div class="subNav">
-					<ul class="navTabs">
-						<li ><a href="/adminverify">审批组</a></li>
-						<li><a href="/adminRole">审批角色</a></li>
-						<li class="active" ><a href="/adminExecute">费用执行人</a></li>
-						<li ><a href="/adminReceiptAuthority">汇总权限</a></li>
-						<li><a href="/adminPaymentsAuthority">日常收支权限</a></li>
-					</ul>
+					<!-- include 'adminReceiptMenu' -->
 				</div>
 					<legend>编辑执行人</legend><form method="post" action="/addCategory" name="group">
 				<table class="table table-striped">

+ 2 - 9
protected/view/admin/adminReceiptAuthority.html

@@ -24,15 +24,7 @@
 			</div>
 			<div class="adminContent autoHeight">
 				<div class="subNav">
-					<ul class="navTabs">
-					
-						<li ><a href="/adminverify">审批组</a></li>
-						<li><a href="/adminRole">审批角色</a></li>
-						<li><a href="/adminExecute">费用执行人</a></li>
-					
-						<li class="active"><a href="/adminReceiptAuthority">汇总权限</a></li>
-						<li ><a href="/adminPaymentsAuthority">日常收支权限</a></li>
-					</ul>
+					<!-- include 'adminReceiptMenu' -->
 				</div>
 					<form>
 					<legend>添加汇总权限</legend>
@@ -75,6 +67,7 @@
     	<div class="control-group">
     		<div class="controls">
 			    <select  style="width:190px" node='category'>
+			    
 			    	<!-- loop categoryList -->
 			    	<option value="{{categoryList' value.cidKey}}">{{categoryList' value.title}}</option>
 			    	<!-- endloop -->

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

@@ -20,13 +20,7 @@
 			</div>
 			<div class="adminContent autoHeight">
 			<div class="subNav">
-					<ul class="navTabs">
-						<li ><a href="/adminverify">审批组</a></li>
-						<li class="active"><a href="/adminRole">审批角色</a></li>
-						<li><a href="/adminExecute">费用执行人</a></li>
-						<li ><a href="/adminReceiptAuthority">汇总权限</a></li>
-						<li><a href="/adminPaymentsAuthority">日常收支权限</a></li>
-					</ul>
+					<!-- include 'adminReceiptMenu' -->
 				</div>
 			
 					<form method="post" action="/addRole" name="group">

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

@@ -21,13 +21,7 @@
 			<div class="adminContent autoHeight">
 					
 				<div class="subNav">
-					<ul class="navTabs">
-						<li class="active"><a href="/adminverify">审批组</a></li>
-						<li><a href="/adminRole">审批角色</a></li>
-						<li><a href="/adminExecute">费用执行人</a></li>
-						<li ><a href="/adminReceiptAuthority">汇总权限</a></li>
-						<li><a href="/adminPaymentsAuthority">日常收支权限</a></li>
-					</ul>
+					<!-- include 'adminReceiptMenu' -->
 				</div>
 					
 					<form method="post" action="/addVerify" name="group">

+ 12 - 12
protected/view/admin/invoiceAdd.html

@@ -183,42 +183,42 @@
 									
 									
 									<div class="checkbox">
-									  <label>
+									  
 									    <input type="checkbox" name="softLock" value="1">
 									    软件锁 (个)<br><input type="number" name="softLockNum" class="span1" placeholder="数量" value="1">
-									  </label>
+									  
 									</div>
 									<div class="checkbox">
-									  <label>
+									  
 									    <input type="checkbox" checked disabled value="1">
 									    发票 (张)<br>1
-									  </label>
+									  
 									</div>
 									<div class="checkbox">
-									  <label>
+									  
 									    <input type="checkbox" name="contract" value="1">
 									    合同(份) <br><input type="number" name="contractNum" class="span1" placeholder="数量" value="1">
-									  </label>
+									  
 									</div>
 									<div class="checkbox">
-									  <label>
+									  
 									    <input type="checkbox" name="instructions" value="1">
 									    说明书 (本)<br><input type="number" name="instructionsNum" class="span1" placeholder="数量" value="1">
-									  </label>
+									 
 									</div>
 									<div class="checkbox">
-									  <label>
+									  
 									    <input type="checkbox" name="remittance" value="1">
 									    汇款账号单(张)
-									  </label>
+									  
 									</div>
 									<div class="checkbox">
-									  <label>
+									  
 									    <input type="checkbox" checked="" disabled="">
 									    备注<br>
 									    <textarea style="width:550px" name="mailItems" placeholder="备注信息或其他需要邮寄物品请填写在这,写明数量。"></textarea>
 									    
-									  </label>
+									  
 									</div>
 								</td>
 									

+ 2 - 1
protected/view/admin/invoiceReceivablesAchieve.html

@@ -30,8 +30,9 @@
 						<li>
 							<div class="search">
 								<div class="input-append">
-									<form action="/invoiceReceivablesAchieve/1/{{date}}" id="ira" method="get" >
+									<form action="/invoiceReceivablesAchieve/1/{{date}}" id="iaa" method="get" >
 									<input class="span3" type="text" data-irmMebSea value="{{MebSeaEn}}" placeholder="到款信息、收款金额">
+									
 									<button class="btn btn-small" node-iramMebSea type="button">搜索</button>
 									</form>
 								

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

@@ -4,55 +4,7 @@
 <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">
-		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;*.xls;*.xlsx;",
-				file_types_description : "*.jpg;*.png;*.doc;*.docx;*.xls;*.xlsx",
-				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>
  
  
  
@@ -177,10 +129,10 @@
 	  								<thead>
 	  								<tr>
 	  								<th>
-	  									<span id="spanButtonPlaceHolder"></span>
-										<span>支持jpg、png、doc、docx、xls、xlsx;最大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 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>

+ 4 - 53
protected/view/admin/remitEdit.html

@@ -4,56 +4,7 @@
 <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">
-		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: false,
-
-				// 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>
  
 <body>
 	<div class="mainLayout">
@@ -183,10 +134,10 @@
 	  								<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 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>

+ 6 - 54
protected/view/admin/saea_create.html

@@ -4,55 +4,6 @@
 <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">
-		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;*.xls;*.xlsx;",
-				file_types_description : "*.jpg;*.png;*.doc;*.docx;*.xls;*.xlsx",
-				file_upload_limit : 8,
-				file_queue_limit : 2,
-				custom_settings : {
-					progressTarget : "fsUploadProgress",
-					cancelButtonId : "btnCancel"
-				},
-				debug: false,
-
-				// 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>
- 
  
  
 <body>
@@ -199,11 +150,12 @@
 	  								<thead>
 	  								<tr>
 	  								<th>
-	  									<span id="spanButtonPlaceHolder"></span>
-										<span>支持jpg、png、doc、docx、xls、xlsx;最大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">

+ 4 - 52
protected/view/admin/saea_edit.html

@@ -4,55 +4,7 @@
 <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">
-		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: false,
-
-				// 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>
  
  
 <body>
@@ -199,10 +151,10 @@
 	  								<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 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>

+ 2 - 1
protected/view/mail_list.html

@@ -86,10 +86,11 @@
 								<!-- loop mailList' value.clientName -->
 								<li>{{mailList' value' value.clientname}}({{mailList' value' value.companyname}})<p>{{mailList' value' value.email}}</p></li>
 								<!-- endloop -->
-								
+								<li>发送2</li>
 								<!-- loop mailList' value.clientName2 -->
 								<li>{{mailList' value' value.clientname}}({{mailList' value' value.companyname}})<p>{{mailList' value' value.email}}</p></li>
 								<!-- endloop -->
+								<li>发送3</li>
 								<!-- loop mailList' value.clientName3 -->
 								<li>{{mailList' value' value.clientname}}({{mailList' value' value.companyname}})<p>{{mailList' value' value.email}}</p></li>
 								<!-- endloop -->