caipin 5 anni fa
parent
commit
1a0a636f86
1 ha cambiato i file con 10 aggiunte e 7 eliminazioni
  1. 10 7
      protected/class/receipt.func.php

+ 10 - 7
protected/class/receipt.func.php

@@ -1817,22 +1817,25 @@ function excelRCData($summaryData,$aiAllList,$cglist,$year){
 	$obj->getactivesheet()->setCellValue ( 'A'.$onRow,$year.'年合计' );
 	$obj->getactivesheet()->setCellValue ( 'A'.$onRow,$year.'年合计' );
 	$col='H';
 	$col='H';
 	//合计行数计算
 	//合计行数计算
-	$cgRow=array();
+	$cgRow=array();$LS=0;
 	foreach ($cglist as $cgk=>$value){
 	foreach ($cglist as $cgk=>$value){
-		$row=5;
+		$row=5+$LS;
+		array_push($cgRow, $row);
+		$LS+=14;
 	}
 	}
 	
 	
-	
 	foreach ($aiAllList as $aiak=>$aiav){
 	foreach ($aiAllList as $aiak=>$aiav){
 		$sectionCount[$aiak]['0']++;
 		$sectionCount[$aiak]['0']++;
 		$obj-> getActiveSheet() -> getStyle($col.$onRow) -> getFont()->getColor()->setRGB('f70000');
 		$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('.$sectionCount[$aiak]['0'].$onRow.':'.$sectionCount[$aiak]['1'].$onRow.')' );
 		$col++;
 		$col++;
 		foreach ($aiav as $k=>$v){//项目细则
 		foreach ($aiav as $k=>$v){//项目细则
-			
-			
-			
-			//$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$col.$sumRowStart.':'.$col.$sumRowEnd.')' );
+			$formula=array();
+			foreach ($cgRow as $cgrk=>$cgrv){
+				array_push($formula, $col.$cgrv);
+			}
+			$formula=implode(',', $formula);
+			$obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$formula.')' );
 			$col++;
 			$col++;
 		}
 		}
 	}
 	}