...
|
...
|
@@ -133,14 +133,20 @@ class AdminExcelDataController extends AdminBaseController |
|
|
$sheet->setCellValue('G7', $arr['inspect_status']);
|
|
|
|
|
|
//循环开始
|
|
|
|
|
|
$cols = 10;
|
|
|
$cells = ['C','E','G','I','K'];
|
|
|
foreach($arr['point'] as $value){
|
|
|
$cols += 0;
|
|
|
//巡检点名称
|
|
|
$sheet->setCellValue('B'.$cols, $value['point_name']);
|
|
|
$sheet->getStyle('B'.$cols)->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);//垂直居中
|
|
|
$array = [
|
|
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
|
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
|
|
'textRotation' => 0,
|
|
|
'wrapText' => TRUE
|
|
|
];
|
|
|
$sheet->mergeCells('A'.$cols.':B'.$cols);
|
|
|
$sheet->setCellValue('A'.$cols, $value['point_name']);
|
|
|
$sheet->getStyle('A'.$cols)->getAlignment()->applyFromArray($array);//垂直水平居中
|
|
|
//获取图片个数
|
|
|
$length = count($value['images']);
|
|
|
$col = ceil($length/5);
|
...
|
...
|
@@ -294,16 +300,41 @@ class AdminExcelDataController extends AdminBaseController |
|
|
|
|
|
$sheet->setTitle($xlsName.$name);
|
|
|
//合并单元格
|
|
|
|
|
|
//报表名称
|
|
|
$sheet->mergeCells('B1:J1');
|
|
|
|
|
|
//甲方logo,甲方公司名称
|
|
|
$sheet->mergeCells('B3:B4');
|
|
|
$sheet->mergeCells('B6:D6');
|
|
|
$sheet->mergeCells('B7:D7');
|
|
|
$sheet->mergeCells('C3:D3');
|
|
|
$sheet->mergeCells('C4:D4');
|
|
|
|
|
|
//乙方logo,乙方公司名称
|
|
|
$sheet->mergeCells('F3:F4');
|
|
|
$sheet->mergeCells('G3:I3');
|
|
|
$sheet->mergeCells('G4:I4');
|
|
|
|
|
|
//乙方发起人姓名
|
|
|
$sheet->mergeCells('B6:C6');
|
|
|
$sheet->mergeCells('B7:C7');
|
|
|
|
|
|
//乙方项目组
|
|
|
$sheet->mergeCells('F6:H6');
|
|
|
$sheet->mergeCells('F7:H7');
|
|
|
|
|
|
//月检状态
|
|
|
$sheet->mergeCells('I6:J6');
|
|
|
$sheet->mergeCells('I7:J7');
|
|
|
|
|
|
//甲方领导确认人
|
|
|
$sheet->mergeCells('B9:C9');
|
|
|
$sheet->mergeCells('B10:C10');
|
|
|
|
|
|
//乙方员工确认人
|
|
|
$sheet->mergeCells('D9:E9');
|
|
|
$sheet->mergeCells('D10:E10');
|
|
|
|
|
|
|
|
|
$spreadsheet->getDefaultStyle()->getFont()->setName('微软雅黑');//字体
|
|
|
|
|
|
//设置默认宽
|
...
|
...
|
@@ -313,8 +344,8 @@ class AdminExcelDataController extends AdminBaseController |
|
|
// $sheet->getRowDimension(2)->setRowHeight(55);
|
|
|
|
|
|
//***********************背景填充颜色*****************************
|
|
|
$sheet->getStyle( 'A1:M8')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
|
|
$sheet->getStyle( 'A1:M8')->getFill()->getStartColor()->setRGB('222B35');//背景颜色
|
|
|
$sheet->getStyle( 'A1:M11')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
|
|
$sheet->getStyle( 'A1:M11')->getFill()->getStartColor()->setRGB('222B35');//背景颜色
|
|
|
//***********************画出单元格边框结束*****************************
|
|
|
|
|
|
//标题
|
...
|
...
|
@@ -337,11 +368,13 @@ class AdminExcelDataController extends AdminBaseController |
|
|
$imageADrawing->setWorksheet($sheet);
|
|
|
}
|
|
|
|
|
|
$sheet->getStyle('B3:G7')->getFont()->setSize(8);//字体大小
|
|
|
$sheet->getStyle('B3:J10')->getFont()->setSize(8);//字体大小
|
|
|
$sheet->getStyle('C3:G3')->getFont()->getColor()->setRGB('949494');//设置颜色为灰色
|
|
|
$sheet->getStyle('B6:G6')->getFont()->getColor()->setRGB('949494');//设置颜色为灰色
|
|
|
$sheet->getStyle('B6:I6')->getFont()->getColor()->setRGB('949494');//设置颜色为灰色
|
|
|
$sheet->getStyle('B9:I9')->getFont()->getColor()->setRGB('949494');//设置颜色为灰色
|
|
|
$sheet->getStyle('C4:G4')->getFont()->getColor()->setRGB('FFFFFF');//设置颜色为白色
|
|
|
$sheet->getStyle('B7:G7')->getFont()->getColor()->setRGB('FFFFFF');//设置颜色为白色
|
|
|
$sheet->getStyle('B7:I7')->getFont()->getColor()->setRGB('FFFFFF');//设置颜色为白色
|
|
|
$sheet->getStyle('B10:I10')->getFont()->getColor()->setRGB('FFFFFF');//设置颜色为白色
|
|
|
|
|
|
//甲方公司
|
|
|
$sheet->setCellValue('C3', '甲方公司');
|
...
|
...
|
@@ -367,30 +400,101 @@ class AdminExcelDataController extends AdminBaseController |
|
|
//乙方公司名称
|
|
|
$sheet->setCellValue('G4', $arr['b_company']['company_name']);
|
|
|
|
|
|
//项目组
|
|
|
$sheet->setCellValue('B6', '项目组');
|
|
|
//项目组名称
|
|
|
$sheet->setCellValue('B7', $arr['group_name']);
|
|
|
//乙方发起人姓名
|
|
|
$sheet->setCellValue('B6', '乙方发起人');
|
|
|
$sheet->setCellValue('B7', '景龙');
|
|
|
|
|
|
//巡检日期
|
|
|
$sheet->setCellValue('E6', '巡检日期');
|
|
|
//巡检日期名称
|
|
|
$sheet->setCellValue('E7', $arr['create_time']);
|
|
|
//月检时间
|
|
|
$sheet->setCellValue('D6', '月检时间');
|
|
|
$sheet->setCellValue('D7', '2019/06/30');
|
|
|
|
|
|
//巡检状态
|
|
|
$sheet->setCellValue('G6', '巡检状态');
|
|
|
//巡检状态名称
|
|
|
$sheet->setCellValue('G7', $arr['inspect_status']);
|
|
|
//乙方项目组
|
|
|
$sheet->setCellValue('F6', '项目组');
|
|
|
$sheet->setCellValue('F7', '景龙、员工2、尚光泉');
|
|
|
|
|
|
//循环开始
|
|
|
//月检状态
|
|
|
$sheet->setCellValue('I6', '月检状态');
|
|
|
$sheet->setCellValue('I7', '待乙方员工完成');
|
|
|
|
|
|
$cols = 10;
|
|
|
//甲方领导确认人
|
|
|
$sheet->setCellValue('B9', '甲方领导确认人');
|
|
|
$sheet->setCellValue('B10', '景龙');
|
|
|
|
|
|
//乙方员工确认人
|
|
|
$sheet->setCellValue('D9', '乙方员工确认人');
|
|
|
$sheet->setCellValue('D10', '景龙');
|
|
|
|
|
|
//完成时间
|
|
|
$sheet->setCellValue('F9', '完成时间');
|
|
|
$sheet->setCellValue('F10', '2019/06/30');
|
|
|
|
|
|
//工期
|
|
|
$sheet->setCellValue('I9', '工期');
|
|
|
$sheet->setCellValue('I10', '15天');
|
|
|
|
|
|
|
|
|
//循环开始
|
|
|
$cols = 13;
|
|
|
$cells = ['C','E','G','I','K'];
|
|
|
|
|
|
$arr['point'] = [
|
|
|
[
|
|
|
'check_name'=>'月检图片',
|
|
|
'images'=>[
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
]
|
|
|
],
|
|
|
[
|
|
|
'check_name'=>'确认完成图片',
|
|
|
'images'=>[
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
['image_url'=>'upload/portal/20190525/659dbc14246df952abf4940e66dc89a0.jpg'],
|
|
|
]
|
|
|
]
|
|
|
];
|
|
|
|
|
|
foreach($arr['point'] as $value){
|
|
|
$cols += 0;
|
|
|
//巡检点名称
|
|
|
$sheet->setCellValue('B'.$cols, $value['point_name']);
|
|
|
$sheet->getStyle('B'.$cols)->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);//垂直居中
|
|
|
$array = [
|
|
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
|
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
|
|
'textRotation' => 0,
|
|
|
'wrapText' => TRUE
|
|
|
];
|
|
|
$sheet->mergeCells('A'.$cols.':B'.$cols);
|
|
|
$sheet->setCellValue('A'.$cols, $value['check_name']);
|
|
|
$sheet->getStyle('A'.$cols)->getAlignment()->applyFromArray($array);//垂直水平居中
|
|
|
//获取图片个数
|
|
|
$length = count($value['images']);
|
|
|
$col = ceil($length/5);
|
...
|
...
|
@@ -427,17 +531,16 @@ class AdminExcelDataController extends AdminBaseController |
|
|
|
|
|
$cols += $col+1;
|
|
|
}
|
|
|
$sheet->getStyle( 'A9:M'.$cols)->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
|
|
$sheet->getStyle( 'A9:M'.$cols)->getFill()->getStartColor()->setRGB('F3F3F4');//背景颜色浅灰色
|
|
|
|
|
|
$sheet->getStyle( 'A12:M'.$cols)->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
|
|
$sheet->getStyle( 'A12:M'.$cols)->getFill()->getStartColor()->setRGB('F3F3F4');//背景颜色浅灰色
|
|
|
|
|
|
$objWrite = IOFactory::createWriter($spreadsheet, 'Xls');
|
|
|
|
|
|
//直接从浏览器中输出star
|
|
|
// header('pragma:public');
|
|
|
// header("Content-Disposition:attachment;filename=出货装箱单.xls");
|
|
|
// $objWrite->save('php://output');
|
|
|
// exit;
|
|
|
header('pragma:public');
|
|
|
header("Content-Disposition:attachment;filename=出货装箱单.xls");
|
|
|
$objWrite->save('php://output');
|
|
|
exit;
|
|
|
//直接从浏览器中输出end
|
|
|
|
|
|
$file_name = $xlsName.'.xls';
|
...
|
...
|
|