From 2029ab132ffd981df07fb82b348c5db19154be26 Mon Sep 17 00:00:00 2001 From: "gary_chen\\gary_chen" Date: Wed, 8 Nov 2023 09:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E6=97=A5=E7=A8=8B=E7=B3=BB=E7=B5=B1?= =?UTF-8?q?=E5=8C=AF=E5=87=BAexcel=20=E6=96=B0=E5=A2=9E=E4=BE=9D=E7=85=A7?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=88=A4=E6=96=B7=E5=8D=80=E5=9F=9F=E7=9A=84?= =?UTF-8?q?=E6=AC=84=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/wipwhole-index-export-excel.php | 31 ++++++++++++++----- wms/wipwhole-renovate-index-export-excel.php | 29 ++++++++++++----- wms/wipwholeinstall-index-export-excel.php | 17 +++++++++- ...oleinstall-renovate-index-export-excel.php | 17 +++++++++- 4 files changed, 77 insertions(+), 17 deletions(-) diff --git a/wms/wipwhole-index-export-excel.php b/wms/wipwhole-index-export-excel.php index 021a60d5..b583c4cf 100644 --- a/wms/wipwhole-index-export-excel.php +++ b/wms/wipwhole-index-export-excel.php @@ -15,7 +15,20 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Style\Fill; - +function getArea($address) +{ + $address = mb_substr($address, 0, 2); + if (in_array($address, ['宜蘭', '花蓮', '台東'])) + return '宜花東'; + if (in_array($address, ['臺北', '台北', '基隆', '新北'])) + return '北區'; + if (in_array($address, ['桃園', '新竹'])) + return '桃竹'; + if (in_array($address, ['南投', '臺中', '台中', '彰化', '雲林', '苗栗'])) + return '中區'; + if (in_array($address, ['台南', '臺南', '嘉義', '屏東', '高雄'])) + return '南區'; +} if ($_SERVER["REQUEST_METHOD"] == "POST") { $contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; @@ -54,9 +67,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', - 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN' + 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO' ]; $colTitleArr = [ + '區域', '合約號', '作番號', '客戶名稱', @@ -268,7 +282,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $dbuilding_heigh_verify_status = !empty($status_arr[$row['building_heigh_verify']]) ? $status_arr[$row['building_heigh_verify']] : ""; // 工務 工勘確認 $site_survey_contact_verify_status = !empty($site_survey_status[$row['site_survey_contact_verify']]) ? $site_survey_status[$row['site_survey_contact_verify']] : ""; - + // 生管 是否齊備確認 $shengguanok_status = !empty($status_arr[$row['shengguanok_status']]) ? $status_arr[$row['shengguanok_status']] : ""; $prattford_order_date_verify_status = !empty($status_arr[$row['prattford_order_date_verify']]) ? $status_arr[$row['prattford_order_date_verify']] : ""; @@ -279,6 +293,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $arrival_date_verify_status = !empty($status3_arr[$row['arrival_date_verify']]) ? $status3_arr[$row['arrival_date_verify']] : ""; $colContentArr = [ + getArea($row['address']), $row['contractno'], $row['facilityno'], $row['custom'], @@ -345,31 +360,31 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { } // 背景顏色為藍色 - $styleA1toC1 = $sheet->getStyle('A1:L1'); + $styleA1toC1 = $sheet->getStyle('A1:M1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('8EA9DB'); // 背景顏色為藍色 - $styleA1toC1 = $sheet->getStyle('M1:W1'); + $styleA1toC1 = $sheet->getStyle('N1:X1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('BBFFEE'); // 背景顏色為橘色 - $styleA1toC1 = $sheet->getStyle('X1:AH1'); + $styleA1toC1 = $sheet->getStyle('Y1:AI1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('FFBB66'); // 背景顏色為綠色 - $styleA1toC1 = $sheet->getStyle('AI1:AM1'); + $styleA1toC1 = $sheet->getStyle('AJ1:AN1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('DDFF77'); // 背景顏色為橘色 - $styleA1toC1 = $sheet->getStyle('AN1:BB1'); + $styleA1toC1 = $sheet->getStyle('AO1:BC1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('FFCCCC'); diff --git a/wms/wipwhole-renovate-index-export-excel.php b/wms/wipwhole-renovate-index-export-excel.php index bde16b28..fc06e8b6 100644 --- a/wms/wipwhole-renovate-index-export-excel.php +++ b/wms/wipwhole-renovate-index-export-excel.php @@ -14,7 +14,20 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Style\Fill; - +function getArea($address) +{ + $address = mb_substr($address, 0, 2); + if (in_array($address, ['宜蘭', '花蓮', '台東'])) + return '宜花東'; + if (in_array($address, ['臺北', '台北', '基隆', '新北'])) + return '北區'; + if (in_array($address, ['桃園', '新竹'])) + return '桃竹'; + if (in_array($address, ['南投', '臺中', '台中', '彰化', '雲林', '苗栗'])) + return '中區'; + if (in_array($address, ['台南', '臺南', '嘉義', '屏東', '高雄'])) + return '南區'; +} if ($_SERVER["REQUEST_METHOD"] == "POST") { $contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; @@ -52,9 +65,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', - 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN' + 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO' ]; $colTitleArr = [ + '區域', '合約號', '作番號', '汰改方案', @@ -277,6 +291,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $arrival_date_verify_status = !empty($status3_arr[$row['arrival_date_verify']]) ? $status3_arr[$row['arrival_date_verify']] : ""; $colContentArr = [ + getArea($row['address']), $row['contractno'], $row['facilityno'], implode("+", json_decode($row['renovate_type'])), @@ -343,31 +358,31 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true); // 背景顏色為藍色 - $styleA1toC1 = $sheet->getStyle('A1:M1'); + $styleA1toC1 = $sheet->getStyle('A1:N1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('8EA9DB'); // 背景顏色為橘色 - $styleA1toC1 = $sheet->getStyle('N1:T1'); + $styleA1toC1 = $sheet->getStyle('O1:U1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('FFBB66'); // 背景顏色為綠色 - $styleA1toC1 = $sheet->getStyle('U1:AC1'); + $styleA1toC1 = $sheet->getStyle('V1:AD1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('DDFF77'); // 背景顏色為藍色 - $styleA1toC1 = $sheet->getStyle('AD1:AN1'); + $styleA1toC1 = $sheet->getStyle('AE1:AO1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('BBFFEE'); // 背景顏色為橘色 - $styleA1toC1 = $sheet->getStyle('AO1:BD1'); + $styleA1toC1 = $sheet->getStyle('AP1:BE1'); $fillA1toC1 = $styleA1toC1->getFill(); $fillA1toC1->setFillType(Fill::FILL_SOLID) ->getStartColor()->setRGB('FFCCCC'); diff --git a/wms/wipwholeinstall-index-export-excel.php b/wms/wipwholeinstall-index-export-excel.php index 2edd5487..1b030313 100644 --- a/wms/wipwholeinstall-index-export-excel.php +++ b/wms/wipwholeinstall-index-export-excel.php @@ -34,7 +34,20 @@ function alpha2num($a) return $n - 1; } - +function getArea($address) +{ + $address = mb_substr($address, 0, 2); + if (in_array($address, ['宜蘭', '花蓮', '台東'])) + return '宜花東'; + if (in_array($address, ['臺北', '台北', '基隆', '新北'])) + return '北區'; + if (in_array($address, ['桃園', '新竹'])) + return '桃竹'; + if (in_array($address, ['南投', '臺中', '台中', '彰化', '雲林', '苗栗'])) + return '中區'; + if (in_array($address, ['台南', '臺南', '嘉義', '屏東', '高雄'])) + return '南區'; +} if ($_SERVER["REQUEST_METHOD"] == "POST") { $contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; @@ -68,6 +81,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $sheet = $spreadsheet->getActiveSheet(); $colTitleArr = [ + '區域', '合約號', '作番號', '客戶名稱', @@ -134,6 +148,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $gongwuok += 1; $colContentArr = [ + getArea($row['address']), $row['contractno'], $row['facilityno'], $row['custom'], diff --git a/wms/wipwholeinstall-renovate-index-export-excel.php b/wms/wipwholeinstall-renovate-index-export-excel.php index 9598cc80..702992f7 100644 --- a/wms/wipwholeinstall-renovate-index-export-excel.php +++ b/wms/wipwholeinstall-renovate-index-export-excel.php @@ -34,7 +34,20 @@ function alpha2num($a) return $n - 1; } - +function getArea($address) +{ + $address = mb_substr($address, 0, 2); + if (in_array($address, ['宜蘭', '花蓮', '台東'])) + return '宜花東'; + if (in_array($address, ['臺北', '台北', '基隆', '新北'])) + return '北區'; + if (in_array($address, ['桃園', '新竹'])) + return '桃竹'; + if (in_array($address, ['南投', '臺中', '台中', '彰化', '雲林', '苗栗'])) + return '中區'; + if (in_array($address, ['台南', '臺南', '嘉義', '屏東', '高雄'])) + return '南區'; +} if ($_SERVER["REQUEST_METHOD"] == "POST") { $contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; @@ -67,6 +80,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $colTitleArr = [ + '區域', '合約號', '作番號', '汰改方案', @@ -135,6 +149,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $gongwuok += 1; $colContentArr = [ + getArea($row['address']), $row['contractno'], $row['facilityno'], implode("+", json_decode($row['renovate_type'])),