|
@@ -1720,10 +1720,14 @@ function cellColor($cells,$color,$obj){
|
|
/**
|
|
/**
|
|
* 导出办事处全年汇中明细execl
|
|
* 导出办事处全年汇中明细execl
|
|
*/
|
|
*/
|
|
-function excelRCData($summaryData,$aiAllList,$year){
|
|
|
|
|
|
+function excelRCData($summaryData,$aiAllList,$cglist,$year){
|
|
Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
|
|
Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
|
|
$obj = new PHPExcel ();
|
|
$obj = new PHPExcel ();
|
|
|
|
|
|
|
|
+ //总行数计算
|
|
|
|
+ $onRow=4;
|
|
|
|
+ $maxRow=(count($cglist)*14)+1+$onRow;
|
|
|
|
+
|
|
//表头计算
|
|
//表头计算
|
|
$cellCount=0;$sectionCount=array();$last=8;
|
|
$cellCount=0;$sectionCount=array();$last=8;
|
|
foreach ($aiAllList as $key=>$value){
|
|
foreach ($aiAllList as $key=>$value){
|
|
@@ -1733,7 +1737,7 @@ function excelRCData($summaryData,$aiAllList,$year){
|
|
$sectionCount[$key]=array($last,count($value)+1+$last-1);
|
|
$sectionCount[$key]=array($last,count($value)+1+$last-1);
|
|
$last=count($value)+1+$last;
|
|
$last=count($value)+1+$last;
|
|
}
|
|
}
|
|
- $cellCount=$cellCount+7+count($aiAllList);
|
|
|
|
|
|
+ $cellCount=$cellCount+7;
|
|
//print_r($sectionCount);
|
|
//print_r($sectionCount);
|
|
//设置宽高
|
|
//设置宽高
|
|
$colNum=1;$maxCol='ZZ';
|
|
$colNum=1;$maxCol='ZZ';
|
|
@@ -1772,14 +1776,13 @@ function excelRCData($summaryData,$aiAllList,$year){
|
|
'allborders' => array( //设置全部边框
|
|
'allborders' => array( //设置全部边框
|
|
'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
|
|
'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
|
|
),),);
|
|
),),);
|
|
- $obj->getActiveSheet()->getStyle( 'A1:'.$maxCol.'3')->applyFromArray($styleThinBlackBorderOutline);
|
|
|
|
|
|
+ $obj->getActiveSheet()->getStyle( 'A1:'.$maxCol.$maxRow)->applyFromArray($styleThinBlackBorderOutline);
|
|
|
|
|
|
//设置合并单元格
|
|
//设置合并单元格
|
|
$obj->getActiveSheet()->mergeCells('A1:A3');
|
|
$obj->getActiveSheet()->mergeCells('A1:A3');
|
|
$obj->getActiveSheet()->mergeCells('B1:G2');
|
|
$obj->getActiveSheet()->mergeCells('B1:G2');
|
|
$obj->getActiveSheet()->mergeCells('H1:'.$maxCol.'1');
|
|
$obj->getActiveSheet()->mergeCells('H1:'.$maxCol.'1');
|
|
|
|
|
|
-
|
|
|
|
//表头内容
|
|
//表头内容
|
|
$obj->getactivesheet()->setCellValue ( 'A1','费用项' );
|
|
$obj->getactivesheet()->setCellValue ( 'A1','费用项' );
|
|
$obj->getactivesheet()->setCellValue ( 'B1','收入' );
|
|
$obj->getactivesheet()->setCellValue ( 'B1','收入' );
|
|
@@ -1809,6 +1812,60 @@ function excelRCData($summaryData,$aiAllList,$year){
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //数据填充
|
|
|
|
+ foreach ($cglist as $cgk=>$value){
|
|
|
|
+ for($month=1;$month<=12;$month++){
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'A'.$onRow,$value['title'].$month.'月合计' );
|
|
|
|
+ $col='H';
|
|
|
|
+ if(isset($dataSummary[$value['cid']])){
|
|
|
|
+ foreach ($aiAllList as $aiak=>$aiav){//总项目
|
|
|
|
+
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'A'.$onRow,$value['title'].$month.'月合计' );
|
|
|
|
+
|
|
|
|
+ //$sectionCount[$aiak]['1'].$onRow
|
|
|
|
+
|
|
|
|
+ $obj->getactivesheet()->setCellValue( $col.$onRow, '=SUM('.$sectionCount[$aiak]['0'].$onRow.':'.$sectionCount[$aiak]['0'].$onRow.')' );//公式
|
|
|
|
+ $col++;
|
|
|
|
+ foreach ($aiav as $k=>$v){//项目细则
|
|
|
|
+ foreach ($summaryData[$value['cid']][$month][$aiak] as $dsk=>$dsv){//数据实体
|
|
|
|
+ if($dsv['item']==$v['name']){
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( $col.$onRow,$dsv['price']);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $col++;
|
|
|
|
+ }
|
|
|
|
+// $col++;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// $yearPriceArray[$value['cid']][$aiak]+=$tempPrice;
|
|
|
|
+
|
|
|
|
+// $itemHtml.='<td class="taR colRed">'.$tempPrice.'</td>';//每个月份 项目金额合计
|
|
|
|
+// $itemHtml.=$tempHtml;//每个月份项目细则金额
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $onRow++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* foreach ($aiAllList as $key=>$value){
|
|
|
|
+ //栏目细则个数
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'A1','费用项' );
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'B1','收入' );
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'B3','利润' );
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'C3','利润占比' );
|
|
|
|
+ $obj->getactivesheet()->setCellValue ( 'D3','收入合计' );
|
|
|
|
+ } */
|
|
|
|
+
|
|
|
|
+
|
|
// echo (int)($cellCount/26).'</br>';
|
|
// echo (int)($cellCount/26).'</br>';
|
|
// echo ($cellCount%26).'</br>';
|
|
// echo ($cellCount%26).'</br>';
|
|
|
|
|