caipin 5 年之前
父節點
當前提交
82f8acee61

+ 18 - 0
protected/class/receipt.func.php

@@ -1717,6 +1717,24 @@ function cellColor($cells,$color,$obj){
 	));
 }
 
+/**
+ * 导出办事处全年汇中明细execl
+ */
+function excelRCData($summaryData,$cellCount,$year){
+	Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
+	$obj = new PHPExcel ();
+	
+	$obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+	
+	$objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
+	header ( 'pragma:public' );
+	header ( "Content-Disposition:attachment;filename=".$year."办事处费用明细.xlsx" );
+	header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
+	$objWrite->save ( 'php://output' );
+	exit ();
+}
+
+
 /*
  * 处理Excel导出
  *  @param $datas array 

+ 20 - 2
protected/controller/ReceiptExtendController.php

@@ -2742,6 +2742,8 @@ class ReceiptExtendController extends DooController {
     	$data['sectionItemHtml']=$sectionItemHtml;
     	$data['summaryDateHtml']=$summaryDateHtml;
     	
+    	$data['year']=$year;
+    	
     	$data ['memu'] = "receipt";
     	$data ['staff'] = $this->staff;
     	
@@ -2762,13 +2764,29 @@ class ReceiptExtendController extends DooController {
     	return '/receiptSummaryStatisticsByAgency';
     }
     
-    //导出excel
+    //导出办事处全年费用汇总excel
     function exportReceiptSummaryExcel(){
     	$summaryData= $this->get_args ( 'summaryData' ) ? $this->get_args ( 'summaryData' ) : "";
+    	$year= $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : "";
     	
     	if(!empty($summaryData)){
+    		
+    		Doo::loadModel ( 'accountItem' );
+    		$accountItem = new accountItem ();
+    		
+    		$aiAllList=$accountItem->getAccountItem();
+    		$cellCount=0;
+    		foreach ($aiAllList as $key=>$value){
+    			//栏目细则个数
+    			$sectionCount=count($value)+1;
+    			$cellCount+=$sectionCount;
+    		}
+    		
+    		
     		$summaryData=json_decode(urldecode($summaryData), true);
-    		print_r($summaryData);
+    		Doo::loadClass ( 'receipt.func' );
+    		
+    		excelRCData($summaryData,$cellCount,$year);
     	}
     	
     	die ( 'illegal request--excel Data null' );

+ 1 - 0
protected/view/receipt/receiptSummaryStatisticsByAgency.html

@@ -48,6 +48,7 @@ function receiptYear(){
 	  					
 	  					<form action="/exportReceiptSummaryExcel"  method="post">
 	  					<input type="hidden" name="summaryData" value="{{summarData}}">
+	  					<input type="hidden" name="year" value="{{year}}">
 	  					<li>
 	  					<input type="submit" class="button" value="导出Excel">
 	  					</li>