caipin 5 年之前
父节点
当前提交
34208a9914
共有 1 个文件被更改,包括 14 次插入16 次删除
  1. 14 16
      protected/class/receipt.func.php

+ 14 - 16
protected/class/receipt.func.php

@@ -1827,14 +1827,11 @@ function excelRCData($summaryData,$aiAllList,$cglist,$year){
 	
 	
 	foreach ($aiAllList as $aiak=>$aiav){
-		$sectionStart=++$sectionCount[$aiak]['0'];
-		echo $sectionStart.'</br>';
-		echo $sectionCount[$aiak]['0'];
-		die;
-		$sectionStart=$sectionCount[$aiak]['0']+1;
-		$sectionCount[$aiak]['0']++;
-		$obj-> getActiveSheet() -> getStyle($col.$onRow) -> getFont()->getColor()->setRGB('f70000');
-		$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionCount[$aiak]['0'].$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
+		$sectionStart=$sectionCount[$aiak]['0'];
+		$sectionStart++;
+		
+		$obj->getActiveSheet() -> getStyle($col.$onRow) -> getFont()->getColor()->setRGB('f70000');
+		$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionStart.$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
 		$col++;
 		foreach ($aiav as $k=>$v){//项目细则
 			$formula=array();
@@ -1854,9 +1851,10 @@ function excelRCData($summaryData,$aiAllList,$cglist,$year){
 		$obj->getactivesheet()->setCellValue ( 'A'.$onRow,$value['title'].'年合计' );
 		$col='H';
 		foreach ($aiAllList as $aiak=>$aiav){
-			$sectionCount[$aiak]['0']++;
+			$sectionStart=$sectionCount[$aiak]['0'];
+			$sectionStart++;
 			$obj-> getActiveSheet() -> getStyle($col.$onRow) -> getFont()->getColor()->setRGB('f70000');
-			$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionCount[$aiak]['0'].$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
+			$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionStart.$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
 			$col++;
 			foreach ($aiav as $k=>$v){//项目细则
 				
@@ -1873,10 +1871,11 @@ function excelRCData($summaryData,$aiAllList,$cglist,$year){
 		$obj->getactivesheet()->setCellValue ( 'A'.$onRow,$value['title'].'费用占比' );
 		$col='H';
 		foreach ($aiAllList as $aiak=>$aiav){
-			$sectionCount[$aiak]['0']++;
+			$sectionStart=$sectionCount[$aiak]['0'];
+			$sectionStart++;
 			$obj->getActiveSheet()->getStyle($col.$onRow)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);//设置百分比
 			$obj-> getActiveSheet() -> getStyle($col.$onRow) -> getFont()->getColor()->setRGB('f70000');
-			$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionCount[$aiak]['0'].$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
+			$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionStart.$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
 			$col++;
 			foreach ($aiav as $k=>$v){//项目细则
 				
@@ -1891,11 +1890,10 @@ function excelRCData($summaryData,$aiAllList,$cglist,$year){
 			$col='H';
 			if(isset($summaryData[$value['cid']])){
 				foreach ($aiAllList as $aiak=>$aiav){//总项目
-					
-					//$sectionCount[$aiak]['1'].$onRow
-					$sectionCount[$aiak]['0']++;
+					$sectionStart=$sectionCount[$aiak]['0'];
+					$sectionStart++;
 					$obj-> getActiveSheet() -> getStyle($col.$onRow) -> getFont()->getColor()->setRGB('f70000');
-					$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionCount[$aiak]['0'].$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );//公式
+					$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionStart.$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );//公式
 					$col++;
 					foreach ($aiav as $k=>$v){//项目细则
 						foreach ($summaryData[$value['cid']][$month][$aiak] as $dsk=>$dsv){//数据实体