caipin 5 lat temu
rodzic
commit
f1e9e10897

+ 6 - 3
global/js/receipt.js

@@ -179,19 +179,22 @@ $(function() {
 			data: {
 				rid:rid
 			},
-			global: true,
+			
 			success: function(data){
 				if(data.status==0){
 					alert('参数错误');
 				}
-				var count=data.receipt.length;
-				if(count!=0){
+				
+				if(data.receipt.hasOwnProperty("rid")){
+					
 					if(data.receipt.Rtype==1){
 						window.location.href="/expensesEdi/"+data.receipt.rid; 
 					}else if(data.receipt.Rtype==0){
 						window.location.href="/receiptburEdi/"+data.receipt.rid; 
 					}else if(data.receipt.Rtype==2){
 						window.location.href="/remitApproval/"+data.receipt.rid; 
+					}else if(data.receipt.Rtype==3){
+						window.location.href="/receiptTrain/approval/"+data.receipt.ridKey+".html"; 
 					}
 				}else
 					alert('没有需要审批的费用');

+ 138 - 102
protected/class/receipt.func.php

@@ -1808,7 +1808,11 @@ function makeItemData($obj,$itemList){
 	
 	$obj->getactivesheet()->setCellValue ( 'B'.$i,'合计' );
 	$obj->getactivesheet()->setCellValue ( 'C'.$i,$sumPrice );
-	$max=max($maxArray)-10;$fontlenght=25;
+	$ma=0;
+	if (!empty($maxArray)){
+		$ma=max($maxArray);
+	}
+	$max=$ma-10;$fontlenght=25;
 	
 	if($max>25){
 		$fontlenght=$max;
@@ -1862,15 +1866,18 @@ function makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail){
 	$obj->getactivesheet()->setCellValue ( 'H1','公司已收款' );
 	$obj->getactivesheet()->setCellValue ( 'I1','办事处已收款' );
 	
-	$obj->getactivesheet()->setCellValue ( 'A2',$invoiceTrainingDetail['trainName'] );
-	$obj->getactivesheet()->setCellValue ( 'B2',$invoiceTrainingDetail['category'][0]['title'] );
-	$obj->getactivesheet()->setCellValue ( 'C2',$invoiceTrainingDetail['staff']['username'] );
-	$obj->getactivesheet()->setCellValue ( 'D2',$invoiceTrainingDetail['trainDate'] );
-	$obj->getactivesheet()->setCellValue ( 'E2',$invoiceTrainingDetail['invoiceTotal'] );
-	$obj->getactivesheet()->setCellValue ( 'F2',$invoiceTrainingDetail['invoiceTotalAmount'] );
-	$obj->getactivesheet()->setCellValue ( 'G2',$invoiceTrainingDetail['invoiceArriveAmount'] );
-	$obj->getactivesheet()->setCellValue ( 'H2',$invoiceTrainingDetail['invoiceCompanyAmount'] );
-	$obj->getactivesheet()->setCellValue ( 'I2',$invoiceTrainingDetail['RIAmount'] );
+	if(!empty($invoiceTrainingDetail)){
+		$obj->getactivesheet()->setCellValue ( 'A2',$invoiceTrainingDetail['trainName'] );
+		$obj->getactivesheet()->setCellValue ( 'B2',$invoiceTrainingDetail['category'][0]['title'] );
+		$obj->getactivesheet()->setCellValue ( 'C2',$invoiceTrainingDetail['staff']['username'] );
+		$obj->getactivesheet()->setCellValue ( 'D2',$invoiceTrainingDetail['trainDate'] );
+		$obj->getactivesheet()->setCellValue ( 'E2',$invoiceTrainingDetail['invoiceTotal'] );
+		$obj->getactivesheet()->setCellValue ( 'F2',$invoiceTrainingDetail['invoiceTotalAmount'] );
+		$obj->getactivesheet()->setCellValue ( 'G2',$invoiceTrainingDetail['invoiceArriveAmount'] );
+		$obj->getactivesheet()->setCellValue ( 'H2',$invoiceTrainingDetail['invoiceCompanyAmount'] );
+		$obj->getactivesheet()->setCellValue ( 'I2',$invoiceTrainingDetail['RIAmount'] );
+	}
+	
 	
 	//边框
 	$styleThinBlackBorderOutline = array(
@@ -1955,8 +1962,11 @@ function makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail){
 		
 		$i++;
 	}
-	
-	$max=max($maxArray)-10;$fontlenght=25;
+	$ma=0;
+	if (!empty($maxArray)){
+		$ma=max($maxArray);
+	}
+	$max=$ma-10;$fontlenght=25;
 	if($max>25){
 		$fontlenght=$max;
 	}
@@ -1966,104 +1976,130 @@ function makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail){
 	$obj->getActiveSheet ()->setTitle ( '收入' );
 }
 
-function makeReceiptLoanData($obj,$receiptLoanDetail){
-	if (empty($receiptLoanDetail)){
+function makeReceiptLoanData($obj,$receiptLoanList){
+	if (empty($receiptLoanList)){
 		$obj->getActiveSheet ()->setTitle ( '借款' );
 		return ;
 	}
 	
-	$receiptLoanDetail ['loanItem'] = json_decode ( $receiptLoanDetail ['loanItem'], true );
-	$receiptLoanDetail ['sumCN'] = num_to_rmb ( $receiptLoanDetail ['sum'] );
-	$receiptLoanDetail ['loanSumCN'] = num_to_rmb ( $receiptLoanDetail ['loanSum'] );
-	$receiptLoanDetail ['amountCN'] = num_to_rmb ( $receiptLoanDetail ['amount'] );
-	//整体字体位置
-	for($i=1;$i<=34;$i++){
-		$obj->getActiveSheet()->getStyle('A'.$i.':B'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
-		$obj->getActiveSheet()->getStyle('A'.$i.':B'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
-		$obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
-	}
-	//整体边框大小
+	$base=$lnBase=0;$lnKey=1;$lnBase=14;
+	//定义行倍数
+	$lnKey2=2;$lnKey3=3;$lnKey4=4;$lnKey5=5;
+	$lnKey6=6;$lnKey7=7;$lnKey8=8;$lnKey9=9;
+	$lnKey10=10;$lnKey11=11;$lnKey12=12;$lnKey13=13;
+	$lnKey14=14;
+	
 	$obj->getActiveSheet()->getColumnDimension('A')->setWidth(35);
 	$obj->getActiveSheet()->getColumnDimension('B')->setWidth(35);
-	//$obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
-	
-	//边框
-	$styleThinBlackBorderOutline = array(
-			'borders' => array(
-					'allborders' => array( //设置全部边框
-							'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
-					),
-			),);
-	$obj->getActiveSheet()->getStyle( 'A1:B14')->applyFromArray($styleThinBlackBorderOutline);
-	//绘制颜色
-	cellColor('A1', 'ddebf7',$obj);cellColor('A3', 'ddebf7',$obj);
-	cellColor('A2', 'ddebf7',$obj);cellColor('A6', 'ddebf7',$obj);
-	cellColor('A7', 'ddebf7',$obj);cellColor('A8', 'ddebf7',$obj);
-	cellColor('A8', 'ddebf7',$obj);cellColor('A9', 'ddebf7',$obj);
-	cellColor('A10', 'ddebf7',$obj);
-	cellColor('A5', 'ddebf7',$obj);cellColor('A11', 'ddebf7',$obj);
-	
-	$obj->getActiveSheet()->mergeCells('A1:B1');
-	$obj->getactivesheet()->setCellValue ( 'A1','借款费用' );
-	$obj->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-	$obj->getActiveSheet()->mergeCells('A3:B3');
-	$obj->getactivesheet()->setCellValue ( 'A3','产生费用所在办事处' );
-	$obj->getActiveSheet()->getStyle('A3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-	$obj->getActiveSheet()->mergeCells('A5:B5');
-	$obj->getactivesheet()->setCellValue ( 'A5','汇款信息' );
-	$obj->getActiveSheet()->getStyle('A5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-	$obj->getActiveSheet()->mergeCells('A11:B11');
-	$obj->getactivesheet()->setCellValue ( 'A11','费用说明' );
-	$obj->getActiveSheet()->getStyle('A11')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-	
-	$obj->getactivesheet()->setCellValue ( 'A2','借款费用' );
-	$obj->getactivesheet()->setCellValue ( 'B2',$receiptLoanDetail ['loanItem'] ['借款费用'] [0] ['price'] );
-	
-	$obj->getActiveSheet()->mergeCells('A4:B4');
-	$obj->getactivesheet()->setCellValue ( 'A4',$receiptLoanDetail ['category'] [0] ['title'] );
-	
-	$obj->getactivesheet()->setCellValue ( 'A6','汇款人户名' );
-	$obj->getactivesheet()->setCellValue ( 'A7','汇款银行' );
-	$obj->getactivesheet()->setCellValue ( 'A8','汇款开户银行名称' );
-	$obj->getactivesheet()->setCellValue ( 'A9','汇款帐号' );
-	$obj->getactivesheet()->setCellValue ( 'A10','联行号' );
-	
-	$obj->getactivesheet()->setCellValue ( 'B6',$receiptLoanDetail ['remittanceName'] );
-	if ($receiptLoanDetail ['remittanceBankType'] == 0){
-		$obj->getactivesheet()->setCellValue ( 'B7','广发银行' );
-	}elseif ($receiptLoanDetail ['remittanceBankType'] == 1){
-		$obj->getactivesheet()->setCellValue ( 'B7','其他' );
-	}
-	
-	
-	autoCellsWidth($obj,'B',$receiptLoanDetail ['bankName']);
-	
-	$obj->getactivesheet()->setCellValue ( 'B8',$receiptLoanDetail ['bankName'] );
-	$obj->getActiveSheet()->setCellValueExplicit('B9',$receiptLoanDetail ['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
-	//$obj->getactivesheet()->setCellValue ( 'B9',$receiptLoanDetail ['bankNumber'] );
-	if ($receiptLoanDetail ['remittanceBankType'] == 1){
-		$obj->getactivesheet()->setCellValue ( 'B10',$receiptLoanDetail ['coupletNumber'] );
-	}else{
-		$obj->getactivesheet()->setCellValue ( 'B10','' );
+	foreach ($receiptLoanList as $key=>$receiptLoanDetail){
+		$lineNumber=1;
+		$lineNumber=$lineNumber+$base;
+		$maxBase=$base+16;
+		//echo $maxBase.'<br/>';
+		for (;$lineNumber<=$maxBase;$lineNumber++){
+			$lineNumberDynamic = 'ln'.$lineNumber;
+			$$lineNumberDynamic=$lineNumber;
+			
+			$obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+			$obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
+			$obj->getActiveSheet()->getRowDimension($lineNumber)->setRowHeight(18);
+		}
+		
+		//正文
+		$receiptLoanDetail ['loanItem'] = json_decode ( $receiptLoanDetail ['loanItem'], true );
+		$receiptLoanDetail ['sumCN'] = num_to_rmb ( $receiptLoanDetail ['sum'] );
+		$receiptLoanDetail ['loanSumCN'] = num_to_rmb ( $receiptLoanDetail ['loanSum'] );
+		$receiptLoanDetail ['amountCN'] = num_to_rmb ( $receiptLoanDetail ['amount'] );
+		//echo $receiptLoanDetail ['sumCN'].'<br/>';
+		//边框
+		$styleThinBlackBorderOutline = array(
+				'borders' => array(
+						'allborders' => array( //设置全部边框
+								'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
+						),
+				),);
+		$obj->getActiveSheet()->getStyle( 'A'.${'ln'.$lnKey}.':B'.${'ln'.$lnBase})->applyFromArray($styleThinBlackBorderOutline);
+		
+		
+		//绘制颜色
+		cellColor('A'.${'ln'.$lnKey}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey3}, 'ddebf7',$obj);
+		cellColor('A'.${'ln'.$lnKey2}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey6}, 'ddebf7',$obj);
+		cellColor('A'.${'ln'.$lnKey7}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey8}, 'ddebf7',$obj);
+		cellColor('A'.${'ln'.$lnKey9}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey10}, 'ddebf7',$obj);
+		cellColor('A'.${'ln'.$lnKey5}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey11}, 'ddebf7',$obj);
+		
+		//正文内容
+		$obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey}.':B'.${'ln'.$lnKey});
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey},'借款费用' );
+		$obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+		$obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey3}.':B'.${'ln'.$lnKey3});
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey3},'产生费用所在办事处' );
+		$obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey3})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+		$obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey5}.':B'.${'ln'.$lnKey5});
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey5},'汇款信息' );
+		$obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey5})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+		$obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey11}.':B'.${'ln'.$lnKey11});
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey11},'费用说明' );
+		$obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey11})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+		
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey2},'借款费用' );
+		$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey2},$receiptLoanDetail ['loanItem'] ['借款费用'] [0] ['price'] );
+		
+		$obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey4}.':B'.${'ln'.$lnKey4});
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey4},$receiptLoanDetail ['category'] [0] ['title'] );
+		
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey6},'汇款人户名' );
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey7},'汇款银行' );
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey8},'汇款开户银行名称' );
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey9},'汇款帐号' );
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey10},'联行号' );
+		
+		$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey6},$receiptLoanDetail ['remittanceName'] );
+		if ($receiptLoanDetail ['remittanceBankType'] == 0){
+			$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'广发银行' );
+		}elseif ($receiptLoanDetail ['remittanceBankType'] == 1){
+			$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'其他' );
+		}
+		
+		autoCellsWidth($obj,'B',$receiptLoanDetail ['bankName']);
+		
+		$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey8},$receiptLoanDetail ['bankName'] );
+		$obj->getActiveSheet()->setCellValueExplicit('B'.${'ln'.$lnKey9},$receiptLoanDetail ['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
+		//$obj->getactivesheet()->setCellValue ( 'B9',$receiptLoanDetail ['bankNumber'] );
+		if ($receiptLoanDetail ['remittanceBankType'] == 1){
+			$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},$receiptLoanDetail ['coupletNumber'] );
+		}else{
+			$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},'' );
+		}
+		
+		$obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey12}.':B'.${'ln'.$lnKey12});
+		$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey12},$receiptLoanDetail ['explanation'] );
+		
+		$obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey13}.':B'.${'ln'.$lnKey13})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+		$obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey14}.':B'.${'ln'.$lnKey14})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey13},'(' . $receiptLoanDetail ['receiptOrder'] . ')本次费用合计' );
+		$obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey13})->getAlignment()->setWrapText(true);
+		$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey13},"¥" . $receiptLoanDetail ['sum'] . "\r\n" . $receiptLoanDetail ['sumCN']  );
+		$obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey13})->setRowHeight(36);
+		
+		$obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey14},'汇款金额');
+		$obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey14})->getAlignment()->setWrapText(true);
+		$obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey14},"¥" . $receiptLoanDetail ['amount'] . "\r\n" . $receiptLoanDetail ['amountCN']  );
+		$obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey14})->setRowHeight(36);
+		
+		//绘制计算
+		$lnKey=$lnBase+2;$lnKey2=$lnBase+3;$lnKey3=$lnBase+4;$lnKey4=$lnBase+5;
+		$lnKey5=$lnBase+6;$lnKey6=$lnBase+7;$lnKey8=$lnBase+9;$lnKey9=$lnBase+10;
+		$lnKey10=$lnBase+11;$lnKey11=$lnBase+12;$lnKey12=$lnBase+13;$lnKey14=$lnBase+15;
+		$lnKey7=$lnBase+8;$lnKey13=$lnBase+14;
+		$lnBase=$lnKey+14;
+		
+		
+		$base+=15;
 	}
-	
-	$obj->getActiveSheet()->mergeCells('A12:B12');
-	$obj->getactivesheet()->setCellValue ( 'B12',$receiptLoanDetail ['explanation'] );
-	
-	
-	$obj->getActiveSheet()->getStyle('A13:B13')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
-	$obj->getActiveSheet()->getStyle('A14:B14')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
-	$obj->getactivesheet()->setCellValue ( 'A13','(' . $receiptLoanDetail ['receiptOrder'] . ')本次费用合计' );
-	$obj->getActiveSheet()->getStyle('B13')->getAlignment()->setWrapText(true);
-	$obj->getactivesheet()->setCellValue ( 'B13',"¥" . $receiptLoanDetail ['sum'] . "\r\n" . $receiptLoanDetail ['sumCN']  );
-	$obj->getActiveSheet()->getRowDimension(13)->setRowHeight(36);
-	
-	$obj->getactivesheet()->setCellValue ( 'A14','汇款金额');
-	$obj->getActiveSheet()->getStyle('B14')->getAlignment()->setWrapText(true);
-	$obj->getactivesheet()->setCellValue ( 'B14',"¥" . $receiptLoanDetail ['amount'] . "\r\n" . $receiptLoanDetail ['amountCN']  );
-	$obj->getActiveSheet()->getRowDimension(14)->setRowHeight(36);
-	
+	//die;
 	$obj->getActiveSheet ()->setTitle ( '借款' );
+	
 }
 
 

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

@@ -392,6 +392,7 @@ $acl ['RECEIPTS'] ['allow'] = array (
 				'saeaLoanReceiptEdi',
 				'implementDo',
 				'ajaxExamineExe',
+				'ajaxExamine',
 				'remitAdd',
 				'remitAddDo',
 				'remitEdit',

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

@@ -3,7 +3,7 @@
 define ( "index", WEB_SITE_GLOBAL.'js/index.js?1.08' );
 define ( "receiptExtend", WEB_SITE_GLOBAL.'js/receiptExtend.js?1.03' );
 
-define ( "receipt", WEB_SITE_GLOBAL.'js/receipt.js?1.09' );
+define ( "receipt", WEB_SITE_GLOBAL.'js/receipt.js?1.10' );
 define ( "invoice", WEB_SITE_GLOBAL.'js/invoice.js?1.02' );
 define ( "payments", WEB_SITE_GLOBAL.'js/payments.js?1.02' );
 define ( "invoiceValidator", WEB_SITE_GLOBAL.'js/invoice.validator.js?1.01' );

+ 5 - 0
protected/controller/HumanResourceController.php

@@ -93,7 +93,12 @@ class HumanResourceController extends DooController {
 		$staffList = $staff->getStaffByApplied ( $this->staff ['sid'] );
 		$staffNew = $staff->getStaffByApprovals ();
 		
+		$staffProcessing = $staff->getStaffByProcessing ($this->staff ['sid'] );
+		
+		
+		
 		// print_r($staffList);
+		$this->data ['staffProcessing'] = $staffProcessing;
 		$this->data ['staffList'] = $staffList;
 		$this->data ['staffNew'] = $staffNew;
 		

+ 10 - 6
protected/controller/InvoiceController.php

@@ -6441,6 +6441,9 @@ class InvoiceController extends DooController {
 		$month = $this->get_args ( 'month' ) ? $this->get_args ( 'month' ) : "";
 		$invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
 		
+		$titleORno = $this->get_args ( 'titleORno' ) ? $this->get_args ( 'titleORno' ) : "";
+		
+		
 		Doo::loadClass ( 'XDeode' );
 		$XDeode = new XDeode ( 5 );
 		Doo::loadModel ( 'invoice' );
@@ -6479,7 +6482,7 @@ class InvoiceController extends DooController {
 		else
 			$staffList = $staff->getStaffByCidAll ( $cid ); //
 		
-		$MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : "";
+		//$MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : "";
 		
 		$page_size = 25;
 		$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
@@ -6517,10 +6520,11 @@ class InvoiceController extends DooController {
 			$con .= ' and invoiceElement="' . $invoiceElement . '"';
 		}
 		
-		$get = "/" . $status . "?cidKey=" . $cidKey . "&sidKey=" . $sidKey . "&year=" . $year . "&month=" . $month . "&invoiceElement=" . $invoiceElement;
+		$get = "/" . $status . "?cidKey=" . $cidKey . "&sidKey=" . $sidKey . "&year=" . $year . "&month=" . $month 
+		. "&invoiceElement=" . $invoiceElement."&titleORno=".urlencode ( $titleORno );
 		
-		if (! empty ( $MebSea )) {
-			$con .= ' and ( invoiceTitle like "%' . $MebSea . '%"  or invoiceCompany like "%' . $MebSea . '%" )';
+		if (! empty ( $titleORno )) {
+			$con .= ' and ( invoiceTitle like "%' . $titleORno . '%"  or invoiceCompany like "%' . $titleORno . '%" or invoiceNo like "%'.$titleORno.'%" )';
 		}
 		
 		$pageinfo ['page'] = array (
@@ -6551,8 +6555,8 @@ class InvoiceController extends DooController {
 		$this->data ['sid'] = $sid;
 		$this->data ['staffDetail'] = $staffDetail;
 		$this->data ['staffList'] = $staffList;
-		$this->data ['MebSeaEn'] = $MebSea;
-		$this->data ['MebSea'] = urlencode ( $MebSea );
+		$this->data ['titleORnoEn'] = $titleORno;
+		$this->data ['titleORno'] = urlencode ( $titleORno );
 		
 		$this->data ['invoiceDetail'] = array (
 				'invoiceElement' => $invoiceElement 

+ 21 - 7
protected/controller/ReceiptController.php

@@ -146,7 +146,7 @@ class ReceiptController extends DooController {
 				$eidList = array_filter ( explode ( ",", $eidList ) );
 				
 				$this->executeId = array_merge ( $list2, $eidList );
-				
+				//print_r($this->executeId);
 				$this->verifyId = $list;
 				$this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );
 				
@@ -4152,7 +4152,7 @@ class ReceiptController extends DooController {
 		$XDeode = new XDeode ( 7 );
 		
 		$Locate = 0;
-		
+		//
 		$reportList = $reportCateList = array ();
 		foreach ( $receiptList as $key => $value ) {
 			
@@ -7207,11 +7207,25 @@ class ReceiptController extends DooController {
 					'where' => 'status=2 and (nowStaff like "%,' . $this->staff [0] ['sid'] . '%" or nowStaff like "%' . $this->staff [0] ['sid'] . ',%" or nowStaff=' . $this->staff [0] ['sid'] . ' ) and rid!=' . $rid,
 					'asArray' => true 
 			) );
-			echo json_encode ( array (
-					'status' => 1,
-					'receipt' => $rLRes [0] 
-			) );
-			die ();
+			if(!empty($rLRes)){
+				
+				Doo::loadClass ( 'XDeode' );
+				$XDeode = new XDeode ( 7 );
+				$rLRes [0]['ridKey'] = $XDeode->encode( $rLRes [0]['rid'] );
+				
+				echo json_encode ( array (
+						'status' => 1,
+						'receipt' => $rLRes [0]
+				) );
+				die ();
+			}else{
+				echo json_encode ( array (
+						'status' => 1,
+						'receipt' => array ()
+				) );
+				die ();
+			}
+			
 		}
 		echo json_encode ( array (
 				'status' => 0,

+ 51 - 2
protected/controller/ReceiptExtendController.php

@@ -128,6 +128,7 @@ class ReceiptExtendController extends DooController {
 				
 				// 判断执行人的审批权限
 				$executeList = $execute->find ( array (
+						'where'=>'mold !="日常收支"',
 						'select' => 'staff',
 						'asArray' => true 
 				) );
@@ -139,7 +140,7 @@ class ReceiptExtendController extends DooController {
 						array_push ( $list2, $v [0] );
 					}
 				}
-				
+				//print_r($executeList);
 				$eidList = file_get_contents ( "protected/config/execute/execute.ini" );
 				$eidList = array_filter ( explode ( ",", $eidList ) );
 				
@@ -2540,6 +2541,8 @@ class ReceiptExtendController extends DooController {
         $data ['memu'] = "receipt";
         $data ['staff'] = $this->staff;
 
+        //var_dump( $this->executeId) ;
+        //die;
         $data ['receiptMemu'] = 'receiptTrainRevenue';
         $data ['verifyId'] = $this->verifyId;
         $data ['executeId'] = $this->executeId;
@@ -2658,6 +2661,51 @@ class ReceiptExtendController extends DooController {
      */
     function receiptSummaryStatisticsByAgency(){
     	
+    	$cidIn = $this->get_args ( 'cidIn' ) ? $this->get_args ( 'cidIn' ) : '12,10,9';
+    	$year=2019; //= $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : date('Y');
+    	
+    	if(!empty($cidIn)){
+    		
+    		Doo::loadModel ( 'receiptDetail' );
+    		$receiptDetail = new receiptDetail ();
+    		Doo::loadModel ( 'accountItem' );
+    		$accountItem = new accountItem ();
+    		Doo::loadModel ( 'L_category' );
+    		$category = new L_category ();
+    		
+    		$aiList=$accountItem->getCategory();
+    		$aiAllList=$accountItem->getAccountItem();
+    		$list=$receiptDetail->getReceiptDetailByYear($cidIn,$year);
+    		
+    		$cidArray=explode(',', $cidIn);
+    		$data=array();
+    		foreach ($cidArray as $cak=>$cav){
+    			$data[$cav]=array();
+    			for($month=1;$month<=12;$month++){
+    				foreach ($aiList as $aik=>$aiv){
+    					$data[$cav][$month][$aiv['category']]=array();
+    				}
+    				$data[$cav][$month]['报销金额调整']=array();
+    			}
+    		}
+    		foreach ($list as $key=>$value){
+    			array_push($data[$value['cid']][$value['month']][$value['itemCategory']], $value);
+    		}
+    		
+    		$cglist=$category->getCategoryInCid($cidIn);
+    		//展示html
+    		//print_r($aiAllList);
+    		foreach ($cglist as $cgk=>$value){
+    			for($month=1;$month<=12;$month++){
+    				foreach ($aiAllList as $aiak=>$aiav){
+    					
+    				}
+    			}
+    		}
+    		
+    		//print_r($data);
+    	}
+    	
     	
     	
     	
@@ -2700,9 +2748,10 @@ class ReceiptExtendController extends DooController {
 		
 		$summary=json_decode(urldecode($summaryJson), true);
 		$aiList=json_decode(urldecode($aiListJson), true);
+		//借款相关
 		$receiptLoanDetail=array();
 		if (! empty ( $receiptDetail ['trainLoanRid'] )) {
-			$receiptLoanDetail = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
+			$receiptLoanDetail = $receipt->getReceiptInRid ( $receiptDetail ['trainLoanRid'] );
 		}
 		
 		//收入

+ 11 - 0
protected/model/accountItem.php

@@ -12,6 +12,17 @@ class accountItem extends DooModel {
 			'name' 
 	);
 	
+	
+	function getCategory(){
+		$sql = 'select category
+				from ' . $this->_table . '
+						 GROUP BY category ORDER BY  aid ASC  ';
+		$query = Doo::db ()->query ( $sql );
+		$itemCategory = $query->fetchAll ();
+		
+		return $itemCategory;
+	}
+	
 	/**
 	 * 
 	 */

+ 4 - 0
protected/model/invoice.php

@@ -991,6 +991,8 @@ class invoice extends DooModel {
         Doo::loadModel ( 'receipt' );
         $receipt = new receipt ();
 		
+        
+        
 		foreach ( $list as $key => $value ) {
 		    //培训班结算是否完成
             $receiptDetail=$receipt->getReceiptByinvoiceTrainId($value['trainId']);
@@ -1046,6 +1048,8 @@ class invoice extends DooModel {
 			$list [$key] ['lossShow'] = false;
 			if ($lossDate < $nowDate)
 				$list [$key] ['lossShow'] = true;
+		
+				
 		}
 		
 		return $list;

+ 10 - 4
protected/model/invoiceTraining.php

@@ -332,9 +332,11 @@ class invoiceTraining extends DooModel {
 					'asArray' => TRUE 
 			) );
 		}
-		$detail ['trainingKey'] = '';
-		$detail ['RIAmount']=$detail ['invoiceArriveAmount']=$detail ['invoiceTotalAmount']=0;
+		
 		if (! empty ( $detail )) {
+			$detail ['trainingKey'] = '';
+			$detail ['invoiceArriveAmount']=$detail ['invoiceCompanyAmount']=$detail ['RIAmount']=$detail ['invoiceArriveAmount']=$detail ['invoiceTotalAmount']=0;
+			
 			Doo::loadModel ( 'L_category' );
 			$lCategory = new L_category ();
 			Doo::loadModel ( 'staff' );
@@ -402,9 +404,13 @@ class invoiceTraining extends DooModel {
 					break;
 				}
 			}
+			
+			$detail ['invoiceCompanyAmountM']=sprintf ( "%.2f", $detail ['invoiceCompanyAmount'] );
+			$detail ['invoiceArriveAmountM']=sprintf ( "%.2f", $detail ['invoiceArriveAmount'] );
+			
 		}
-		$detail ['invoiceCompanyAmountM']=sprintf ( "%.2f", $detail ['invoiceCompanyAmount'] );
-		$detail ['invoiceArriveAmountM']=sprintf ( "%.2f", $detail ['invoiceArriveAmount'] );
+		
+		
 		//echo var_dump($detail ['invoiceTotalAmount'] ) ;
 		//print_r($detail);
 		return $detail;

+ 30 - 9
protected/model/receipt.php

@@ -410,19 +410,40 @@ class receipt extends DooModel {
 // 		$Lcategory = new L_category ();
 // 		Doo::loadModel ( 'staff' );
 // 		$staff = new staff ();
-	
-		if (! is_numeric ( $rid ))
+		
+		if (! is_numeric ( $rid )){
 			$rid = $XDeode->decode ( $rid );
-	
+		}
+		$rinfo = $this->getOne ( array (
+				'where' => 'trainLoanRid=' . $rid,
+				'asArray' => true
+		) );
+			
+		if(empty($rinfo)){
 			$rinfo = $this->getOne ( array (
-					'where' => 'trainLoanRid=' . $rid,
+					'where' => 'trainLoanRid like "' . $rid.',%"',
 					'asArray' => true
 			) );
-			
-			
+		}
+		if(empty($rinfo)){
+			$rinfo = $this->getOne ( array (
+					'where' => 'trainLoanRid like "%,' . $rid.'"',
+					'asArray' => true
+			) );
+		}
+		if(empty($rinfo)){
+			$rinfo = $this->getOne ( array (
+					'where' => 'trainLoanRid like "%,' . $rid.',%"',
+					'asArray' => true
+			) );
+		}
+		
+		$rinfo ['ridKey7']='';
+		if (!empty($rinfo ['rid'])){
 			$XDeode = new XDeode ( 7 );
 			$rinfo ['ridKey7'] = $XDeode->encode ( $rinfo ['rid'] );
-			
+		}
+		
  			
 // 			$rinfo ['ridKey7'] = $XDeode->encode ( $rinfo ['rid'] );
 	
@@ -430,7 +451,7 @@ class receipt extends DooModel {
 // 			$rinfo ['staffDetail'] = $staff->getStaffBySid ( $rinfo ['staff'] );
 			// $rinfo['sum']=number_format ($rinfo['sum'],2);
 	
-			return $rinfo;
+		return $rinfo;
 	}
 	
 	function getReceiptByinvoiceTrainId($invoiceTrainId = 0) {
@@ -455,7 +476,7 @@ class receipt extends DooModel {
 		}
 		
 		$rinfo ['ridKey'] = $XDeode->encode ( $rinfo ['rid'] );
-		$rinfo ['trainLoanRidKey'] = $XDeode->encode ( $rinfo ['trainLoanRid'] );
+		$rinfo ['trainLoanRidKey'] = '';//$XDeode->encode ( $rinfo ['trainLoanRid'] );
 		$XDeode = new XDeode ( 7 );
 		$rinfo ['ridKey7'] = $XDeode->encode ( $rinfo ['rid'] );
 		

+ 15 - 0
protected/model/receiptDetail.php

@@ -23,6 +23,21 @@ class receiptDetail extends DooModel {
     
     public $_fields = array('rdid', 'item', 'staff', 'itemCategory', 'price', 'date','pastDate', 'cid', 'rid', 'status');
 
+    function getReceiptDetailByYear($cidIn,$year){
+    	if(empty($cidIn)||(!is_numeric($year))){
+    		return array();
+    	}
+    	
+    	$list=$this->find ( array (
+    			'select' => 'item,sum(price) as price,itemCategory,item,Month(pastDate) as month,cid',
+    			'where' => " status=1 and Year(pastDate)=" . $year ." and cid in (".$cidIn.")" ,
+    			'groupby' => 'item,Month(pastDate),item',
+    			'asArray' => true
+    	) );
+    	return $list;
+    	
+    }
+    
     /**
      * 按人员年月合计报销单项目金额
      * @param string $sid

+ 40 - 2
protected/model/staff.php

@@ -408,10 +408,16 @@ class staff extends DooModel {
 	 * 获得审批中员工
 	 */
 	public function getStaffByApplied($sid=0){
+		
+		$where="(pendStatus= '2' or pendStatus='3' or pendStatus='5' or pendStatus='6' or pendStatus='7') ";
+		if(!empty($sid)){
+			$where.=" and (pendingApprovals ='" . $sid . "' or pendingApprovalsLeave='" . $sid . "')";
+		}
+		
+		
 		$list = $this->find ( array (
 				'asc' => 'sid',
-			
-				'where' => "(pendStatus= '2' or pendStatus='3' or pendStatus='5' or pendStatus='6' or pendStatus='7') and (pendingApprovals ='" . $sid . "' or pendingApprovalsLeave='" . $sid . "')",
+				'where' => $where,
 				'asArray' => TRUE
 		) );
 		Doo::loadClass ( 'XDeode' );
@@ -432,6 +438,38 @@ class staff extends DooModel {
 	}
 	
 	/**
+	 * 进行中
+	 * @param number $sid
+	 */
+	public function getStaffByProcessing($sid=0){
+		$where="(pendStatus= '2' or pendStatus='3' or pendStatus='5' or pendStatus='6' or pendStatus='7') ";
+		if(!empty($sid)){
+			$where.=" and (pendingApprovals !='" . $sid . "' or pendingApprovalsLeave !='" . $sid . "')";
+		}
+		
+		$list = $this->find ( array (
+				'asc' => 'sid',
+				'where' => $where,
+				'asArray' => TRUE
+		) );
+		Doo::loadClass ( 'XDeode' );
+		$XDeode = new XDeode ( 5 );
+		Doo::loadModel ( 'position' );
+		$position = new position ();
+		foreach ( $list as $key => $value ) {
+			$list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
+				
+			$list [$key] ['position'] ='';
+			$pdetail=$position->getPositionByPid($value['positionId']);
+			if (!empty($pdetail))
+				$list [$key] ['position'] =$pdetail['positionName'];
+					
+		}
+		
+		return $list;
+	}
+	
+	/**
 	 * 获得最近审批通过的员工
 	 * @return string
 	 */

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

@@ -71,6 +71,15 @@
 						</select>
 						</li>
 						
+						<li>
+							<div class="search">
+								<div class="input-append">
+									<input class="span3" placeholder="发票号或抬头搜索" type="text" name="titleORno" value="{{titleORnoEn}}" >
+									<input type="submit" class="btn btn-small" value="搜索">
+								</div>
+							</div>
+						</li>
+						
 						<li>开票数量:<b>{{page.total_data}}</b> 张</li>
 						<li>开票总计:¥{{ics.invoicePrice}}</li>
 						<li>应收款总计:<span class="colGreen">¥{{ics.diffPrice}}</span></li>

+ 35 - 0
protected/view/humanResource/hr.html

@@ -71,6 +71,41 @@
 									</tbody>
 								</table>
 							</div>
+							
+							
+							<div class="clearfix">
+								<legend><div class="fR"></div>进行中</legend>
+								<table class="table table-bordered table-condensed">
+									<tbody>
+									<tr><th class="taC" width="140">员工名称</th><th class="taC">办事处/部门</th><th class="taC">岗位</th><th class="taC">状态</th><th class="taC" width="120">时间</th></tr>
+									<!-- loop staffProcessing -->
+									<tr>
+									<td><a href="#employeeInfo" node-employeeInfo node-sidKey="{{staffList' value.sidKey}}" data-toggle="modal">{{staffList' value.username}}</a></td>
+									<td>{{staffList' value.category}}</td>
+									<td>{{staffList' value.position}}</td>
+									<td>
+										<!-- if {{staffList' value.pendStatus}}==2 -->
+									待入职
+									<!-- elseif {{staffList' value.pendStatus}}==3 -->
+									待离职
+									<!-- elseif {{staffList' value.pendStatus}}==5 -->
+									待转正
+									<!-- elseif {{staffList' value.pendStatus}}==6 -->
+									待晋升
+									<!-- elseif {{staffList' value.pendStatus}}==7 -->
+									待再入职
+									<!-- endif -->
+									</td>
+									<td width="120">2018-06-07</td>
+									</tr>
+									<!-- endloop -->
+									
+									
+									</tbody>
+								</table>
+							</div>
+							
+							
 							<div class="clearfix">
 								<legend><div class="fR"></div>最近变动</legend>
 								<table class="table table-bordered table-condensed">

+ 1 - 1
protected/view/menu.html

@@ -24,7 +24,7 @@
 <!-- endif -->
 
 <!-- if isShowMenu('RECEIPTS') -->
-<li  data-placement="right" data-toggle="ctooltip" class="topLine <!-- if   getGlobals('NEW') != 0 || getGlobals('NEW2') != 0  --> news <!-- endif -->" data-original-title="费用管理"  >
+<li  data-placement="right" data-toggle="ctooltip" class="topLine <!-- if   getGlobals('NEW') != 0 || getGlobals('NEW2') != 0 || isGHNews($_COOKIE ['staffGH'])!=0  --> news <!-- endif -->" data-original-title="费用管理"  >
 <a href="/saeaBorad" class="icon- <!-- if {{memu}}=="receipt" --> selected <!-- endif -->" >U</a>
 </li>  
 <!-- endif -->