10994015 1 year ago
parent
commit
a68ca31623
  1. 4
      .gitignore
  2. 2
      wms/cont/sign_form.php
  3. 4
      wms/crm/crmm01-index.php
  4. 2
      wms/crm/crmm02-index.php
  5. 488
      wms/estimated_shipping_date_report.php
  6. 2
      wms/excel-upload.php
  7. BIN
      wms/excel/estimated_shipping_date_report.xlsx
  8. BIN
      wms/excel/gary_test.xlsx
  9. BIN
      wms/excel/wipwholeintall.xlsx
  10. 32
      wms/frame/calendar/crud/connect.php
  11. 4
      wms/header.php
  12. 24
      wms/sign/list.php
  13. 26
      wms/wipwhole-change-planning-customer-name-function.php
  14. 102
      wms/wipwhole-change-planning-customer-name-submit.php
  15. 29
      wms/wipwhole-change-planning-customer-name.php
  16. 31
      wms/wipwhole-index-export-excel.php
  17. 37
      wms/wipwhole-index-function.php
  18. 7
      wms/wipwhole-index-table-html.php
  19. 6
      wms/wipwhole-rec-invoice-edit-fileupload.php
  20. 35
      wms/wipwhole-rec-invoice-edit-submit.php
  21. 120
      wms/wipwhole-rec-invoice-edit.php
  22. 29
      wms/wipwhole-renovate-index-export-excel.php
  23. 36
      wms/wipwhole-renovate-index-function.php
  24. 7
      wms/wipwhole-renovate-index-table-html.php
  25. 39
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  26. 49
      wms/wipwhole-renovate-rec-invoice-edit.php
  27. 17
      wms/wipwholeinstall-index-export-excel.php
  28. 16
      wms/wipwholeinstall-index-function.php
  29. 17
      wms/wipwholeinstall-renovate-index-export-excel.php
  30. 19
      wms/wipwholeinstall-renovate-index-function.php

4
.gitignore

@ -17,3 +17,7 @@ wms/database.php
workflow/log/
wms/header.php
wms/loginapi.php
wms/excel/gary_test.xlsx
wms/excel/wipwholeintall.xlsx
wms/excel/estimated_shipping_date_report.xlsx
*.docx

2
wms/cont/sign_form.php

@ -475,7 +475,7 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
</div>
<div class="col-3 form_field_title ">
<button type="submit" class="btn btn-primary btn-sm" style='float:left'>提交</button>
<button type="submit" name="btn_save" class="btn btn-primary btn-sm" value="tosign" style='float:left'>提交</button>
</div>
</div>

4
wms/crm/crmm01-index.php

@ -41,8 +41,8 @@ $salesman = empty($_GET['salesman']) ? "%" : $_GET['salesman'];
$where .= " and salesman_name like '$salesman'";
$sql_cmd = sql_myself($user_id, "salesman");
// max,許紓晴,林慧珊
if (in_array($user_department_id, $depart_arr) || $user_id == "M0060" || $user_id == "M0107" || $user_id == "M0193") $sql_cmd = "";
// max,許紓晴,林慧珊,鄭伊岑
if (in_array($user_department_id, $depart_arr) || $user_id == "M0060" || $user_id == "M0107" || $user_id == "M0193" || $user_id == "M0149") $sql_cmd = "";
if (!empty($sql_cmd)) $where .= " and ".str_replace("where", "", $sql_cmd);
/*
$checkAll = ['p0044', 'M0007'];

2
wms/crm/crmm02-index.php

@ -42,7 +42,7 @@ $where .= " and salesman like '$salesman'";
$lm_name = empty($_GET['linkman']) ? "%" : $_GET['linkman'];
$where .= " and linkman like '$lm_name'";
$sql_cmd = sql_myself($user_id, "salesman");
if (in_array($user_department_id, $depart_arr) || $user_id == "M0060") $sql_cmd = ""; // M0060:Max
if (in_array($user_department_id, $depart_arr) || $user_id == "M0060" || $user_id == "M0149") $sql_cmd = ""; // M0060:Max,鄭伊岑
if (!empty($sql_cmd)) $where .= " and ".str_replace("where", "", $sql_cmd);
$sql = "SELECT vol_no,customer,manager,f_return_content('customer_source',source ) source,

488
wms/estimated_shipping_date_report.php

@ -29,6 +29,8 @@ $sql = "
w.contract_type
FROM wipwholestatus AS w
WHERE status = '1'
AND real_contract_arrival_date >= '$start_y-$start_m-1'
AND real_contract_arrival_date <= '$end_y-$end_m-31'
) AS this_order
WHERE 1 = 1
GROUP BY this_order.contract_type,
@ -41,7 +43,7 @@ $data = [];
while ($row = $result->fetch_assoc()) {
$data[] = $row;
}
// print_r($data);
function findData($data, $searchData)
{
foreach ($data as $item) {
@ -115,7 +117,6 @@ function findAllDataByYearMonth($data, $searchData)
&& $item['date_year'] == $i
&& $item['date_month'] == str_pad($j, 2, '0', STR_PAD_LEFT)
) {
// echo $item['facility_count']." ";
$count += $item['facility_count'];
}
}
@ -134,8 +135,9 @@ $sql = "
FROM wipwholestatus AS w
WHERE 1=1
AND status = '1'
AND real_contract_arrival_date >= '$start_y-$start_m-0'
AND real_contract_arrival_date <= '$end_y-$end_m-0'
AND contract_type = 'A'
AND real_contract_arrival_date >= '$start_y-$start_m-1'
AND real_contract_arrival_date <= '$end_y-$end_m-31'
) AS new_order
WHERE 1 = 1
GROUP BY new_order.facility_kind
@ -175,8 +177,8 @@ $sql = "
FROM wipwholestatus AS w
WHERE 1=1
AND status = '1'
AND real_contract_arrival_date >= '$start_y-$start_m-0'
AND real_contract_arrival_date <= '$end_y-$end_m-0'
AND real_contract_arrival_date >= '$start_y-$start_m-1'
AND real_contract_arrival_date <= '$end_y-$end_m-31'
AND contract_type = 'B'
";
$result = mysqli_query($link, $sql);
@ -184,28 +186,42 @@ $data3 = [];
while ($row = $result->fetch_assoc()) {
$data3[] = $row;
}
$M1 = 0;
$M2 = 0;
$M3 = 0;
$M4 = 0;
$MA = 0;
$M_count = 0;
// 分開計算
// $M1 = 0;
// $M2 = 0;
// $M3 = 0;
// $M4 = 0;
// $MA = 0;
// $M_count = 0;
// foreach ($data3 as $row) {
// $renovate_type_arr = json_decode($row['renovate_type']);
// foreach ($renovate_type_arr as $row2) {
// if ($row2 == 'M1')
// $M1++;
// if ($row2 == 'M2')
// $M2++;
// if ($row2 == 'M3')
// $M3++;
// if ($row2 == 'M4')
// $M4++;
// if ($row2 == 'MA')
// $MA++;
// }
// }
// $M_count = $M1 + $M2 + $M3 + $M4 + $MA;
$M_count = count($data3);
$m_type_arr = [];
$m_type_arr[''] = 0;
foreach ($data3 as $row) {
$m_type_arr[implode("+", json_decode($row['renovate_type']))] = 0;
}
foreach ($data3 as $row) {
$renovate_type_arr = json_decode($row['renovate_type']);
foreach ($renovate_type_arr as $row2) {
if ($row2 == 'M1')
$M1++;
if ($row2 == 'M2')
$M2++;
if ($row2 == 'M3')
$M3++;
if ($row2 == 'M4')
$M4++;
if ($row2 == 'MA')
$MA++;
}
$m_type_arr[implode("+", json_decode($row['renovate_type']))]++;
}
$M_count = $M1 + $M2 + $M3 + $M4 + $MA;
//數字轉英文(0=>A、1=>B、26=>AA...以此類推)
function num2alpha($n)
@ -224,264 +240,259 @@ function alpha2num($a)
$n = $n * 26 + ord($a[$i]) - 0x40;
return $n - 1;
}
if($_SERVER["REQUEST_METHOD"] == 'POST'){
if ($_POST['excel_output'] == 'excel_output') {
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('出貨總表');
if ($_POST['excel_output'] == 'excel_output') {
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('出貨總表');
$title_col_num = 3;
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
$title_col_num += 2;
if ($i == $end_y && $j == ($end_m + 1)) {
break;
$title_col_num = 3;
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
$title_col_num += 2;
if ($i == $end_y && $j == ($end_m + 1)) {
break;
}
}
}
}
$sheet->mergeCells('A1:' . num2alpha($title_col_num) . '1');
$sheet->setCellValue('A1', '出貨地區預定明細');
$sheet->mergeCells('A1:' . num2alpha($title_col_num) . '1');
$sheet->setCellValue('A1', '出貨地區預定明細');
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '');
$title_col_num++;
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '');
$title_col_num++;
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1))
break;
$sheet->mergeCells(num2alpha($title_col_num) . '2:' . num2alpha($title_col_num + 1) . '2');
$sheet->setCellValue(num2alpha($title_col_num) . '2', $i . '年' . $j . '月');
$title_col_num += 2;
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1))
break;
$sheet->mergeCells(num2alpha($title_col_num) . '2:' . num2alpha($title_col_num + 1) . '2');
$sheet->setCellValue(num2alpha($title_col_num) . '2', $i . '年' . $j . '月');
$title_col_num += 2;
}
}
}
$sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
$title_col_num++;
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '3', '區域');
$title_col_num = 2;
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '3', '區域');
$title_col_num = 2;
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1)) {
break;
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1)) {
break;
}
$sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
$title_col_num++;
}
$sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
}
$sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
$title_col_num++;
$area_arr = [
[4, 6, '台北'],
[7, 9, '桃竹苗'],
[10, 13, '中部'],
[14, 17, '南部'],
[18, 20, '宜花東'],
[21, 21, '未分類']
];
foreach ($area_arr as $row) {
$title_col_num = 0;
$sheet->mergeCells(num2alpha($title_col_num) . $row[0] . ':' . num2alpha($title_col_num) . $row[1]);
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[2]);
}
$area_arr = [
[4, '台北'],
[5, '新北'],
[6, '基隆'],
[7, '桃園'],
[8, '新竹'],
[9, '苗栗'],
[10, '台中'],
[11, '南投'],
[12, '彰化'],
[13, '雲林'],
[14, '嘉義'],
[15, '台南'],
[16, '高雄'],
[17, '屏東'],
[18, '宜蘭'],
[19, '花蓮'],
[20, '台東'],
[21, '']
];
foreach ($area_arr as $row) {
$title_col_num = 0;
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[1]);
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1)) {
break;
}
$tmp_arr = array(
'date_year' => $i,
'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
'sub_address' => $row[1],
'contract_type' => 'A',
);
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
$tmp_arr['contract_type'] = 'B';
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
}
}
$tmp_arr = array(
'start_y' => $start_y,
'end_y' => $end_y,
'start_m' => $start_m,
'end_m' => $end_m,
'sub_address' => $row[1],
'contract_type' => 'A',
);
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
$tmp_arr['contract_type'] = 'B';
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
}
}
$sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
$title_col_num++;
$area_arr = [
[4, 6, '台北'],
[7, 9, '桃竹苗'],
[10, 13, '中部'],
[14, 17, '南部'],
[18, 20, '宜花東'],
[21, 21, '未分類']
];
foreach ($area_arr as $row) {
$title_col_num = 0;
$sheet->mergeCells(num2alpha($title_col_num) . $row[0] . ':' . num2alpha($title_col_num) . $row[1]);
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[2]);
}
$area_arr = [
[4, '台北'],
[5, '新北'],
[6, '基隆'],
[7, '桃園'],
[8, '新竹'],
[9, '苗栗'],
[10, '台中'],
[11, '南投'],
[12, '彰化'],
[13, '雲林'],
[14, '嘉義'],
[15, '台南'],
[16, '高雄'],
[17, '屏東'],
[18, '宜蘭'],
[19, '花蓮'],
[20, '台東'],
[21, '']
];
foreach ($area_arr as $row) {
$title_col_num = 0;
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[1]);
$sheet->setCellValue(num2alpha($title_col_num) . '22', "合計");
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1)) {
if ($i == $end_y && $j == ($end_m + 1))
break;
}
$tmp_arr = array(
'date_year' => $i,
'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
'sub_address' => $row[1],
'contract_type' => 'A',
);
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
$sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
$tmp_arr['contract_type'] = 'B';
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
$sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
}
}
$tmp_arr = array(
'start_y' => $start_y,
'end_y' => $end_y,
'start_m' => $start_m,
'end_y' => $end_y,
'start_m' => $start_m,
'end_m' => $end_m,
'sub_address' => $row[1],
'contract_type' => 'A',
);
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
$sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
$tmp_arr['contract_type'] = 'B';
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
}
$title_col_num = 0;
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '22', "合計");
for ($i = $start_y; $i <= $end_y; $i++) {
$this_start_m = $i == $start_y ? $start_m : 1;
$this_end_m = $i == $start_y ? 12 : $end_m;
for ($j = $this_start_m; $j <= $this_end_m; $j++) {
if ($i == $end_y && $j == ($end_m + 1))
break;
$tmp_arr = array(
'date_year' => $i,
'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
'contract_type' => 'A',
);
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
$tmp_arr['contract_type'] = 'B';
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
}
}
$tmp_arr = array(
'start_y' => $start_y,
'end_y' => $end_y,
'start_m' => $start_m,
'end_m' => $end_m,
'contract_type' => 'A',
);
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
$tmp_arr['contract_type'] = 'B';
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
$sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
$sheet->mergeCells('A25:I25');
$sheet->setCellValue('A25', '受定規格分析');
$sheet->mergeCells('A25:I25');
$sheet->setCellValue('A25', '受定規格分析');
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '26', "代碼");
foreach ($data2 as $row) {
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '26', $row['facility_kind']);
}
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '26', "代碼");
foreach ($data2 as $row) {
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '26', $row['facility_kind']);
}
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '27', "機種");
foreach ($data2 as $row) {
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '27', "機種");
foreach ($data2 as $row) {
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '27', getFacilityNamebyType($row['facility_kind']));
}
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '27', getFacilityNamebyType($row['facility_kind']));
}
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '27', "合計");
$sheet->setCellValue(num2alpha($title_col_num) . '27', "合計");
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '28', "數量");
foreach ($data2 as $row) {
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '28', "數量");
foreach ($data2 as $row) {
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '28', $row['facility_count']);
}
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '28', $row['facility_count']);
}
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '28', findFacilityTypeAllCount($data2));
$sheet->setCellValue(num2alpha($title_col_num) . '28', findFacilityTypeAllCount($data2));
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '29', "百分比");
foreach ($data2 as $row) {
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num) . '29', "百分比");
foreach ($data2 as $row) {
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '29', (round($row['facility_count'] / findFacilityTypeAllCount($data2), 4) * 100) . "%");
}
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '29', (round($row['facility_count'] / findFacilityTypeAllCount($data2), 4) * 100) . "%");
}
$title_col_num++;
$sheet->setCellValue(num2alpha($title_col_num) . '29', "100%");
$sheet->setCellValue(num2alpha($title_col_num) . '29', "100%");
$sheet->mergeCells('A32:G32');
$sheet->setCellValue('G25', '舊改受訂規格分析');
$sheet->mergeCells('A32:G32');
$sheet->setCellValue('G25', '舊改受訂規格分析');
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "類型");
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "M1");
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "M2");
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "M3");
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "M4");
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "MA");
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "合計");
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "類型");
foreach ($m_type_arr as $key => $val) {
$title_tmp = empty($key) ? '未分類' : $key;
$sheet->setCellValue(num2alpha($title_col_num++) . '33', $title_tmp);
}
$sheet->setCellValue(num2alpha($title_col_num++) . '33', "合計");
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num++) . '34', "數量");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $M1);
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $M2);
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $M3);
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $M4);
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $MA);
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $M_count);
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num++) . '34', "數量");
foreach ($m_type_arr as $key => $val) {
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $val);
}
$sheet->setCellValue(num2alpha($title_col_num++) . '34', $M_count);
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num++) . '34', "百分比");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', (round($M1 / $M_count, 4) * 100) . "%");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', (round($M2 / $M_count, 4) * 100) . "%");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', (round($M3 / $M_count, 4) * 100) . "%");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', (round($M4 / $M_count, 4) * 100) . "%");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', (round($MA / $M_count, 4) * 100) . "%");
$sheet->setCellValue(num2alpha($title_col_num++) . '34', "100%");
$title_col_num = 0;
$sheet->setCellValue(num2alpha($title_col_num++) . '35', "百分比");
foreach ($m_type_arr as $key => $val) {
$sheet->setCellValue(num2alpha($title_col_num++) . '35', (round($val / $M_count, 4) * 100) . "%");
}
$sheet->setCellValue(num2alpha($title_col_num++) . '35', "100%");
$writer = new Xlsx($spreadsheet);
$file_path = dirname(__DIR__) . '/wms/excel/' . 'estimated_shipping_date_report.xlsx';
try {
$writer->save($file_path);
// 回傳檔案路徑給 JavaScript
echo $file_path;
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
$writer = new Xlsx($spreadsheet);
$file_path = dirname(__DIR__) . '/wms/excel/' . 'estimated_shipping_date_report.xlsx';
try {
$writer->save($file_path);
// 回傳檔案路徑給 JavaScript
echo $file_path;
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
exit();
}
exit();
}
?>
<style>
@ -1234,29 +1245,30 @@ if ($_POST['excel_output'] == 'excel_output') {
<tbody>
<tr>
<th>類型</th>
<th>M1</th>
<th>M2</th>
<th>M3</th>
<th>M4</th>
<th>MA</th>
<?php
foreach ($m_type_arr as $key => $val) {
$title_tmp = empty($key) ? '未分類' : $key;
echo "<th>" . $title_tmp . "</th>";
}
?>
<th>合計</th>
</tr>
<tr>
<th>數量</th>
<th><?php echo $M1; ?></th>
<th><?php echo $M2; ?></th>
<th><?php echo $M3; ?></th>
<th><?php echo $M4; ?></th>
<th><?php echo $MA; ?></th>
<?php
foreach ($m_type_arr as $key => $val) {
echo "<th>" . $val . "</th>";
}
?>
<th><?php echo $M_count; ?></th>
</tr>
<tr>
<th>百分比</th>
<th><?php echo (round($M1 / $M_count, 4) * 100) . "%"; ?></th>
<th><?php echo (round($M2 / $M_count, 4) * 100) . "%"; ?></th>
<th><?php echo (round($M3 / $M_count, 4) * 100) . "%"; ?></th>
<th><?php echo (round($M4 / $M_count, 4) * 100) . "%"; ?></th>
<th><?php echo (round($MA / $M_count, 4) * 100) . "%"; ?></th>
<?php
foreach ($m_type_arr as $key => $val) {
echo "<th>" . round($val / $M_count, 4) * 100 . "%" . "</th>";
}
?>
<th>100%</th>
</tr>
</tbody>

2
wms/excel-upload.php

@ -151,7 +151,7 @@ if (move_uploaded_file($temp_file_name, $target_file)) {
default:
$facility_kind = "";
}
$facilitsql = "SELECT * FROM facility where facilityno='$facilityno'";
$facilitsql = "SELECT * FROM facility where facilityno='$facilityno' and contractno='$contractno'";
$facilit_nums_rows=mysqli_num_rows(mysqli_query($link,$facilitsql));
if($facilit_nums_rows==0){
$weight= "450";//重量

BIN
wms/excel/estimated_shipping_date_report.xlsx

Binary file not shown.

BIN
wms/excel/gary_test.xlsx

Binary file not shown.

BIN
wms/excel/wipwholeintall.xlsx

Binary file not shown.

32
wms/frame/calendar/crud/connect.php

@ -1,8 +1,28 @@
<?php
try {
$dbh = new PDO("mysql:host=db-104.coowo.com:3306;dbname=appwms", 'masadaroot', 'x6h5E5p#u8y');
$dbh->exec("set names utf8");
$envFile = __DIR__ . '/../.env'; // .env 文件的路徑
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines !== false) {
foreach ($lines as $line) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
// 设置环境变量
putenv("$key=$value");
}
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
date_default_timezone_set("Asia/Taipei");
$host = getenv('DB_HOST');
$dbuser = getenv('DB_USERNAME');
$dbpassword = getenv('DB_PASSWORD');
$dbname = getenv('DB_DATABASE');
try {
$dbh = new PDO("mysql:host=$host:3306;dbname=$dbname", $dbuser, $dbpassword);
$dbh->exec("set names utf8");
} catch (PDOException $e) {
echo $e->getMessage();
}

4
wms/header.php

@ -18,8 +18,8 @@ try {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
} catch (PDOException $e) {
echo "fail";
echo $e->getMessage();
//echo "fail";
//echo $e->getMessage();
}

24
wms/sign/list.php

@ -145,19 +145,23 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
<?php
$rowspan = 1;
foreach ($res_get as $key => $data) :
//嘗試將已結案隱藏起來 : 測試使用者體驗
if ($data['flow_code'] !== 'Z') {
?>
<tr>
<td><a href="<?=$data['path'] ."?form_key=".$data['form_key']."&token=$token" ?>" ><?= $data['form_key']; ?></a></td>
<td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['update_date']; ?></td>
<td><?php echo $data['current_assigner_name']; ?></td>
<td><?php echo $data['flow_code'] == 'Z' ? "結案" : ""; ?></td>
<tr>
<td><a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>"><?= $data['form_key']; ?></a></td>
<td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['update_date']; ?></td>
<td><?php echo $data['current_assigner_name']; ?></td>
<td><?php echo $data['flow_code'] == 'Z' ? "結案" : ""; ?></td>
</tr>
</tr>
<?php endforeach; ?>
<?php
}
endforeach;
?>
</tbody>
</table>
</div>

26
wms/wipwhole-change-planning-customer-name-function.php

@ -1,5 +1,26 @@
<?php
function fileIUpload($post_name)
{
if ($_FILES[$post_name]["error"] == 0) {
$datetime = date("YmdHis");
$file_name = str_replace("#", "", $_FILES[$post_name]["name"]);
$temp_file_name = $_FILES[$post_name]["tmp_name"];
$target_dir = empty($file_name) ? "" : "public-wipwhole/";
$sales_spec_verify_file = strtolower($target_dir . basename($datetime . $file_name));
if (file_exists($sales_spec_verify_file))
unlink($sales_spec_verify_file);
move_uploaded_file($temp_file_name, $sales_spec_verify_file);
if (!empty($file_name)) {
return strtolower($target_dir . basename($datetime . $file_name));
} else {
return "";
}
} else {
return "";
}
}
function isLeader($link, $user_id)
{
if (getDepartmentId($link, $user_id) == '314' && getRoleId($link, $user_id) == '1')
@ -57,23 +78,28 @@ function checkPageUserStatus($user_id)
*/
function addWipwholeChangeContractdateDetails($link, $data)
{
$customer_planning_verify_file = $data['user_id'];
$user_id = $data['user_id'];
$tds = $data['tds'];
$id = $data['id'];
$custom_name = $data['custom_name'];
$change_status = $data['change_status'];
$customer_planning_verify_file = $data['customer_planning_verify_file'];
$sql2 = "
INSERT INTO `wipwhole_change_planning_customer_details` (
`creater`,
`create_at`,
`wipwholestatus_id`,
`custom_name`,
`customer_planning_verify_file`,
`change_status`
) VALUES (
'$user_id',
'$tds',
'$id',
'$custom_name',
'$customer_planning_verify_file',
'$change_status'
)
";

102
wms/wipwhole-change-planning-customer-name-submit.php

@ -5,6 +5,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST['custom_name'])) {
if ($checkStatus) {
$customer_planning_verify_file = fileIUpload("customer_planning_verify_file");
$all_contractno_change = empty($_POST['all_contractno_change']) ? null : $_POST['all_contractno_change'];
$custom_name = $_POST['custom_name'];
$contractno = $_POST['contractno'];
@ -21,6 +22,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
'tds' => $tds,
'form_key' => getFomkeySeq($link),
'user_id' => $user_id,
'customer_planning_verify_file' => $customer_planning_verify_file,
'change_status' => $_POST['assign_status']
);
// 寫入表單主檔
@ -40,6 +42,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 批次申請
if (($_POST['assign_status'] == 'A' || $_POST['assign_status'] == 'B') && !empty($all_contractno_change)) {
$wipwholestatus_id_arr = getWipwholestatusIdByConstractNo($link, $contractno);
$customer_planning_verify_file = fileIUpload("customer_planning_verify_file");
foreach ($wipwholestatus_id_arr as $wipwholestatus_id) {
$data_arr = array(
'id' => $wipwholestatus_id[0],
@ -48,6 +51,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
'contractno' => $contractno,
'tds' => $tds,
'form_key' => getFomkeySeq($link),
'customer_planning_verify_file' => $customer_planning_verify_file,
'user_id' => $user_id
);
// 寫入表單主檔
@ -216,58 +220,58 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
";
mysqli_query($link, $sql);
// // 發送系統通知
// $contractno = $_POST['contractno'];
// $facilityno = $_POST['facilityno'];
// $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
// $salesid = $_POST['salesid'];
// $gongWuokid = $_POST['gongWuokid'];
// $old_real_address = $_POST['old_real_address'];
// $real_address = $_POST['real_address'];
// $content = "合約號 : $contractno
// 作番號 : $facilityno
// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
// // 發送系統通知
// $contractno = $_POST['contractno'];
// $facilityno = $_POST['facilityno'];
// $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
// $salesid = $_POST['salesid'];
// $gongWuokid = $_POST['gongWuokid'];
// $old_real_address = $_POST['old_real_address'];
// $real_address = $_POST['real_address'];
// $content = "合約號 : $contractno
// 作番號 : $facilityno
// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
// // 大日程出貨日調整 通知營業人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $salesid,
// );
// addNotice($link, $noticeData);
// // 大日程出貨日調整 通知工務人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $gongWuokid,
// );
// addNotice($link, $noticeData);
// // 大日程出貨日調整 通知營業人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $salesid,
// );
// addNotice($link, $noticeData);
// // 大日程出貨日調整 通知工務人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $gongWuokid,
// );
// addNotice($link, $noticeData);
// $shengguano_arr = getShengguanokOptions($link);
// foreach ($shengguano_arr as $row) :
// $contractno = $_POST['contractno'];
// $facilityno = $_POST['facilityno'];
// $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
// $gongWuokid = $_POST['gongWuokid'];
// $old_real_address = $_POST['old_real_address'];
// $real_address = $_POST['real_address'];
// $content = "合約號 : $contractno
// 作番號 : $facilityno
// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
// $shengguano_arr = getShengguanokOptions($link);
// foreach ($shengguano_arr as $row) :
// $contractno = $_POST['contractno'];
// $facilityno = $_POST['facilityno'];
// $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
// $gongWuokid = $_POST['gongWuokid'];
// $old_real_address = $_POST['old_real_address'];
// $real_address = $_POST['real_address'];
// $content = "合約號 : $contractno
// 作番號 : $facilityno
// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
// // 大日程出貨日調整 通知營業人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $row['val'],
// );
// addNotice($link, $noticeData);
// endforeach;
// // 大日程出貨日調整 通知營業人員
// $noticeData = array(
// 'related_id' => $cid,
// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
// 'content' => $content,
// 'permission' => $row['val'],
// );
// addNotice($link, $noticeData);
// endforeach;
}
}
}

29
wms/wipwhole-change-planning-customer-name.php

@ -1,9 +1,10 @@
<?php
// ini_set('display_errors', 'on');
function getAccounttype($link,$user_id){
$sql = "SELECT * FROM account where accountid = '$user_id'";
$data = mysqli_query($link, $sql);
function getAccounttype($link, $user_id)
{
$sql = "SELECT * FROM account where accountid = '$user_id'";
$data = mysqli_query($link, $sql);
$row = mysqli_fetch_array($data, MYSQLI_ASSOC);
return $row['accounttype'];
}
@ -16,19 +17,19 @@ $token = empty($token) ? $_REQUEST["token"] : $token;
$token_link = "token=" . $token;
list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
$user_name = urldecode(base64_decode($enc_user_name));
$accounttype = getAccounttype($link,$user_id);
$accounttype = getAccounttype($link, $user_id);
$data = array();
$data = array();
$login_json = null;
if (strlen($accounttype) != 0) {
$jsonres['menu']=$includecommon->menu_v3($user_id, $accounttype);
$jsonres['menu'] = $includecommon->menu_v3($user_id, $accounttype);
$login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE);
}
?>
<script>
res=eval("("+JSON.stringify(<?php echo $login_json; ?>)+")");
window.localStorage.setItem("menu_<?php echo $user_id; ?>",res.menu);
res = eval("(" + JSON.stringify(<?php echo $login_json; ?>) + ")");
window.localStorage.setItem("menu_<?php echo $user_id; ?>", res.menu);
</script>
<?php
/*
@ -74,7 +75,7 @@ if (!empty(checkNowFormStatus($link)))
?>
<div style="overflow-x:auto;">
<form method="post">
<form method="post" enctype="multipart/form-data">
<div class="tab-pane active" class="assign_content" role="mainpanel" id="tabassign">
<!-- hidden域 -->
<input type="hidden" name="form_key" value='' />
@ -268,7 +269,7 @@ if (!empty(checkNowFormStatus($link)))
<?php echo $row["address"]; ?>
</td>
<th>填寫客戶姓名</th>
<td colspan="2">
<td >
<?php
if (empty(checkNowFormStatus($link))) {
echo "<input type='text' name='custom_name' />";
@ -277,7 +278,13 @@ if (!empty(checkNowFormStatus($link)))
echo "<input type='hidden' name='custom_name' value='" . $row2["custom_name"] . "' />";
}
?>
</td>
<th>上傳計劃圖</th>
<td colspan="3">
<input type='file' name='customer_planning_verify_file' id='customer_planning_verify_file' style='width:190px;'/>
<?php
echo !empty($row2['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row2['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
?>
</td>
</tr>
</tbody>

31
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');

37
wms/wipwhole-index-function.php

@ -127,7 +127,7 @@ function getDataSql($department_id, $role_id, $user_id)
];
// 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
if(in_array($user_id,['M0166','M0091'])){
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
@ -295,7 +295,7 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
{
// 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
if(in_array($user_id,['M0166','M0091'])){
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
@ -909,7 +909,7 @@ function getTabNo($user_department_id)
// 由地址取得工務負責人
function getGunwuName($address)
{
$north_arr = array('台北', '基隆', '新北', '桃園', '新竹');
$north_arr = array('台北', '基隆', '新北', '桃園', '新竹', '台東', '花蓮');
$north_arr2 = array('宜蘭');
$center_arr = array('南投', '彰化', '雲林', '台中', '苗栗');
$south_arr = array('台南', '嘉義', '屏東', '高雄');
@ -1076,11 +1076,11 @@ function getSaveEstimateInstallData($user_department_id, $role_id)
return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6']))
return true;
if ($user_department_id == '544' && $role_id == '3')
if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
return true;
if ($user_department_id == '543' && $role_id == '2')
return true;
if ($user_department_id == '545' && $role_id == '6')
if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true;
return false;
}
@ -1095,9 +1095,9 @@ function saveInstallData($user_department_id, $role_id)
return true;
if ($user_department_id == '543' && $role_id == '2')
return true;
if ($user_department_id == '544' && $role_id == '3')
if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
return true;
if ($user_department_id == '545' && $role_id == '6')
if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true;
if ($user_department_id == '220')
return true;
@ -1120,3 +1120,26 @@ function getWipwholeChangePlanningCustomerDetailsStatus($link, $id)
";
return mysqli_query($link, $sql);
}
function getAllCustomerPlanningVerify($link, $id)
{
$sql = "
SELECT
customer_planning_verify_file,
create_at
FROM wipwholestatus
WHERE id = $id
AND customer_planning_verify_file != ''
AND customer_planning_verify_file IS NOT NULL
UNION
SELECT
customer_planning_verify_file,
create_at
FROM wipwhole_change_planning_customer_details
WHERE wipwholestatus_id = $id
AND customer_planning_verify_file != ''
AND customer_planning_verify_file IS NOT NULL
";
return mysqli_query($link, $sql);
}

7
wms/wipwhole-index-table-html.php

@ -27,6 +27,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
<th style="text-align:center;width:150px;">規格</th>
<th style="text-align:center;width:150px;">地址</th>
<th style="text-align:center;width:80px;">工勘狀態</th>
<th style="text-align:center;width:100px;">合約交期(到工地)</th>
<th style="text-align:center;width:100px;">下單日(普來特富)</th>
<th style="text-align:center;width:100px;">預計到廠日(觀音廠)</th>
<th style="text-align:center;width:100px;">實際到廠日(觀音廠)</th>
@ -150,6 +151,12 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
}
}
?>
<td>
<?php
if (!empty($data['contract_arrival_date']))
echo date("Y/m/d", strtotime($data['contract_arrival_date']));
?>
</td>
<td>
<?php
if (!empty($data['prattford_order_date']))

6
wms/wipwhole-rec-invoice-edit-fileupload.php

@ -11,7 +11,11 @@ function fileIUpload($post_name)
if (file_exists($sales_spec_verify_file))
unlink($sales_spec_verify_file);
move_uploaded_file($temp_file_name, $sales_spec_verify_file);
return strtolower($target_dir . basename($datetime . $file_name));
if (!empty($file_name)) {
return strtolower($target_dir . basename($datetime . $file_name));
} else {
return "";
}
} else {
return "";
}

35
wms/wipwhole-rec-invoice-edit-submit.php

@ -286,7 +286,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
}
$updatesql = "
UPDATE wipwholestatus
SET
@ -483,13 +483,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
";
if (!empty($official_check_file))
$updatesql .= "official_check_file = '$official_check_file', ";
} else {
echo "暫無權限";
exit();
}
// 暫時可編輯及刪除權限
if (in_array($user_id, ['M0175', 'M0079'])) {
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
$updatesql .= "
contractno = '$contractno',
facility_temp_no = '$facility_temp_no',
@ -537,6 +534,32 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>上傳了安裝圖附件<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
";
}
// 許協更新業務確認項目權限
if ($user_id == 'M0060') {
$updatesql .= "
prattford_order_date_verify = '$prattford_order_date_verify' ,
prattford_order_date = '$prattford_order_date',
prattford_order_date_owner = '$prattford_order_date_owner',
estimated_shipping_date_verify = '$estimated_shipping_date_verify',
estimated_shipping_date = '$estimated_shipping_date',
estimated_shipping_date_owner = '$estimated_shipping_date_owner',
estimated_shipping_schedule_date_verify = '$estimated_shipping_schedule_date_verify',
estimated_shipping_schedule_date = '$estimated_shipping_schedule_date',
estimated_shipping_schedule_date_owner = '$estimated_shipping_schedule_date_owner',
goods_type = '$goods_type',
goods_type_date = '$goods_type_date',
goods_type_owner = '$goods_type_owner',
taiwan_goods_type = '$taiwan_goods_type',
taiwan_goods_type_date = '$taiwan_goods_type_date',
taiwan_goods_type_owner = '$taiwan_goods_type_owner',
shengguanok_status = '$shengguanok_status',
shengguanok_status_at = '$shengguanok_status_at',
shengguanok_status_owner = '$shengguanok_status_owner',
yewu_remark = '',
";
}
$updatesql .= "
creater = '$creater',
create_at = '$create_at'

120
wms/wipwhole-rec-invoice-edit.php

@ -52,17 +52,22 @@ $pinzheng = getPinzhengStatus($link, $user_department_id, $role_id);
$tab = getTabNo($user_department_id);
// 工務助理
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193'])) {
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188'])) {
$warehouse2 = "";
$tab = 5;
}
// 暫時可編輯及刪除權限
$update_delete_status = "disabled";
if (in_array($user_id, ['M0175', 'M0079'])) {
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
$update_delete_status = "";
}
// 許協業務項編輯權限
if (in_array($user_id, ['M0060'])) {
$yewu = "";
}
// select => options 開門方式
$opendoor_options = getOpendoorOptions($link);
// select => options 確認人
@ -260,6 +265,17 @@ include "wipwhole-rec-invoice-edit-submit.php";
</div>
</td>
</tr>
<?php
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
?>
<tr>
<td colspan="8">
<button onclick="savedata()" type="button" class="btn btn-primary pull-right" style="margin-left:3px;" <?php echo $update_delete_status; ?>>存檔</button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
@ -279,7 +295,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle;width:auto;">營業/契約確認規格</td>
<td style="width:150px;">
<select name="sales_spec_verify" id="sales_spec_verify" <?= $marketing; ?>>
<select class="disabled_select" name="sales_spec_verify" id="sales_spec_verify" <?= $marketing; ?>>
<option <?php if ($row["sales_spec_verify"] == "1") echo " selected"; ?> value="1">請選擇</option>
<option <?php if ($row["sales_spec_verify"] == "0") echo " selected"; ?> value="0">已完成</option>
<option <?php if ($row["sales_spec_verify"] == "1") echo " selected"; ?> value="1">進行中</option>
@ -295,7 +311,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
</td>
<td style="vertical-align: middle">確認時間</td>
<td>
<input class="form-control " type="datetime-local" id="sales_spec_verify_at" name="sales_spec_verify_at" value="<?= $row['sales_spec_verify_at']; ?>" readonly>
<input class="form-control disabled_select" type="datetime-local" id="sales_spec_verify_at" name="sales_spec_verify_at" value="<?= $row['sales_spec_verify_at']; ?>" readonly>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
@ -339,7 +355,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
?>
</td>
<td>
<select name="customer_planning_verify" id="customer_planning_verify" <?= $marketing; ?>>
<select class="disabled_select" name="customer_planning_verify" id="customer_planning_verify" <?= $marketing; ?>>
<option <?php if ($row["customer_planning_verify"] == "1") echo " selected"; ?> value="1">請選擇</option>
<option <?php if ($row["customer_planning_verify"] == "0") echo " selected"; ?> value="0">已完成</option>
<option <?php if ($row["customer_planning_verify"] == "1") echo " selected"; ?> value="1">進行中</option>
@ -348,19 +364,26 @@ include "wipwhole-rec-invoice-edit-submit.php";
</td>
<td style="vertical-align: middle;">附件</td>
<td style="vertical-align: middle;">
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" <?php
if (isset($row2['change_status'])) {
echo $row2['change_status'] === 'Z' ? "" : "disabled";
} else {
echo "disabled";
}
?>>
<!-- <input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" <?php
if (isset($row2['change_status'])) {
echo $row2['change_status'] === 'Z' ? "" : "disabled";
} else {
echo "disabled";
}
?>>
<?php
echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
?> -->
<?php
$customer_planning_verify_files = getAllCustomerPlanningVerify($link, $id);
foreach ($customer_planning_verify_files as $row2) :
echo "<a id='customer_planning_verify_file_a' style='color:#00F;'
href='" . $row2['customer_planning_verify_file'] . "' target='_blank'>下載附件_" . $row2['create_at'] . "</a><br/>";
endforeach;
?>
</td>
<td style="vertical-align: middle">確認時間</td>
<td><input class="form-control " type="datetime-local" id="customer_planning_verify_at" name="customer_planning_verify_at" value="<?= $row['customer_planning_verify_at']; ?>" readonly></td>
<td><input class="form-control disabled_select" type="datetime-local" id="customer_planning_verify_at" name="customer_planning_verify_at" value="<?= $row['customer_planning_verify_at']; ?>" readonly></td>
<td style="vertical-align: middle">確認人</td>
<td>
<select name="customer_planning_verify_owner" class="disabled_select" id="customer_planning_verify_owner" disabled>
@ -373,7 +396,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">客戶顏色</td>
<td>
<select name="customer_color_verify" id="customer_color_verify" <?= $marketing; ?>>
<select class="disabled_select" name="customer_color_verify" id="customer_color_verify" <?= $marketing; ?>>
<option <?php if ($row["customer_color_verify"] == "1") echo " selected"; ?> value="1">請選擇</option>
<option <?php if ($row["customer_color_verify"] == "0") echo " selected"; ?> value="0">已完成</option>
<option <?php if ($row["customer_color_verify"] == "1") echo " selected"; ?> value="1">進行中</option>
@ -388,7 +411,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
?>
</td>
<td style="vertical-align: middle">確認時間</td>
<td><input class="form-control " type="datetime-local" id="customer_color_verify_at" name="customer_color_verify_at" value="<?= $row['customer_color_verify_at']; ?>" readonly></td>
<td><input class="form-control disabled_select" type="datetime-local" id="customer_color_verify_at" name="customer_color_verify_at" value="<?= $row['customer_color_verify_at']; ?>" readonly></td>
<td style="vertical-align: middle">確認人</td>
<td>
<select name="customer_color_verify_owner" class="disabled_select" id="customer_color_verify_owner" disabled>
@ -400,7 +423,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">客戶樣式</td>
<td>
<select name="customer_style_verify" id="customer_style_verify" <?= $marketing; ?>>
<select class="disabled_select" name="customer_style_verify" id="customer_style_verify" <?= $marketing; ?>>
<option <?php if ($row["customer_style_verify"] == "1") echo " selected"; ?> value="1">請選擇</option>
<option <?php if ($row["customer_style_verify"] == "0") echo " selected"; ?> value="0">已完成</option>
<option <?php if ($row["customer_style_verify"] == "1") echo " selected"; ?> value="1">進行中</option>
@ -415,7 +438,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
?>
</td>
<td style="vertical-align: middle">確認時間</td>
<td><input class="form-control " type="datetime-local" id="customer_style_verify_at" name="customer_style_verify_at" value="<?= $row['customer_style_verify_at']; ?>" readonly></td>
<td><input class="form-control disabled_select" type="datetime-local" id="customer_style_verify_at" name="customer_style_verify_at" value="<?= $row['customer_style_verify_at']; ?>" readonly></td>
<td style="vertical-align: middle">確認人</td>
<td>
<select name="customer_style_verify_owner" class="disabled_select" id="customer_style_verify_owner" disabled>
@ -427,7 +450,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">工勘聯絡表</td>
<td>
<select name="site_survey_contact_form_verify" id="site_survey_contact_form_verify" <?= $marketing; ?>>
<select class="disabled_select" name="site_survey_contact_form_verify" id="site_survey_contact_form_verify" <?= $marketing; ?>>
<option <?php if ($row["site_survey_contact_form_verify"] == "1") echo " selected"; ?> value="1">請選擇</option>
<option <?php if ($row["site_survey_contact_form_verify"] == "0") echo " selected"; ?> value="0">已完成</option>
<option <?php if ($row["site_survey_contact_form_verify"] == "1") echo " selected"; ?> value="1">進行中</option>
@ -442,7 +465,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
?>
</td>
<td style="vertical-align: middle">確認時間</td>
<td style="vertical-align: middle"><input class="form-control " type="datetime-local" id="site_survey_contact_form_verify_at" name="site_survey_contact_form_verify_at" value="<?= $row['site_survey_contact_form_verify_at']; ?>" readonly></td>
<td style="vertical-align: middle"><input class="form-control disabled_select" type="datetime-local" id="site_survey_contact_form_verify_at" name="site_survey_contact_form_verify_at" value="<?= $row['site_survey_contact_form_verify_at']; ?>" readonly></td>
<td style="vertical-align: middle">確認人</td>
<td>
<select name="site_survey_contact_form_verify_owner" class="disabled_select" id="site_survey_contact_form_verify_owner" disabled>
@ -454,14 +477,14 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td>備註</td>
<td colspan="7">
<textarea class="form-control " name="marketing_remark" <?= $marketing; ?>><?php echo $row['marketing_remark']; ?></textarea>
<textarea class="form-control disabled_select" name="marketing_remark" <?= $marketing; ?>><?php echo $row['marketing_remark']; ?></textarea>
</td>
</tr>
<tr>
<td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing; ?>>
<input class="form-control disabled_select" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing; ?>>清除</button>
</span>
@ -501,7 +524,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">設計規格</td>
<td>
<select name="desin_spec_verify" id="desin_spec_verify" <?= $desin; ?>>
<select class="disabled_select" name="desin_spec_verify" id="desin_spec_verify" <?= $desin; ?>>
<option <?php if ($row["desin_spec_verify"] == "1") echo " selected"; ?> value="1">請選擇</option>
<option <?php if ($row["desin_spec_verify"] == "0") echo " selected"; ?> value="0">已完成</option>
<option <?php if ($row["desin_spec_verify"] == "1") echo " selected"; ?> value="1">進行中</option>
@ -537,7 +560,11 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle;">附件</td>
<td style="vertical-align: middle;">
<?php
echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
// echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
foreach ($customer_planning_verify_files as $row2) :
echo "<a id='customer_planning_verify_file_a' style='color:#00F;'
href='" . $row2['customer_planning_verify_file'] . "' target='_blank'>下載附件_" . $row2['create_at'] . "</a><br/>";
endforeach;
?>
</td>
<td style="vertical-align: middle"> 確認時間</td>
@ -1114,7 +1141,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button>
<?php
} else {
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5'))) {
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0060')) {
?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button>
<?php
@ -1202,7 +1229,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">實際出貨日(到工地)</td>
<td>
<input class="form-control" type="date" id="real_arrival_date_tmp" value="<?= SUBSTR($row['real_arrival_date'],0,10); ?>" <?php echo $shengguan; ?>>
<input class="form-control" type="date" id="real_arrival_date_tmp" value="<?= SUBSTR($row['real_arrival_date'], 0, 10); ?>" <?php echo $shengguan; ?>>
</td>
<td colspan="4">
<button onclick="updateRealArrivalDate()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?php echo $shengguan2; ?>>出貨日調整</button>
@ -1300,6 +1327,24 @@ include "wipwhole-rec-invoice-edit-submit.php";
(工務助理項目)
</td>
</tr>
<!-- <tr>
<td style="vertical-align: middle">發包類型</td>
<td>
<input type='radio' name='outsourcer_type' id='outsourcer_type_I' value='I' />
<label for='outsourcer_type_I'>安裝</label>
<input type='radio' name='outsourcer_type' id='outsourcer_type_T' value='T' />
<label for='outsourcer_type_T'>試車</label>
<input type='radio' name='outsourcer_type' id='outsourcer_type_IT' value='IT' />
<label for='outsourcer_type_IT'>安裝+試車</label>
<?php
if (getSaveEstimateInstallData($user_department_id, $role_id)) {
?>
<button type='button' class='btn btn-default' onclick='setOutSourcerDate();'>帶入日期</button>
<?php
}
?>
</td>
</tr> -->
<tr>
<td style="vertical-align: middle">安裝發包廠商</td>
<td>
@ -1855,4 +1900,29 @@ include "wipwhole-rec-invoice-edit-submit.php";
$('#update_install_date_form').submit();
}
}
// function setOutSourcerDate() {
// // 發包類型
// let outsourcer_type = $("input[name^='outsourcer_type']").val();
// // 預計出貨日(到工地)
// let real_contract_arrival_date = $("#real_contract_arrival_date").val();
// // 樓停
// let numberofstop = $("#numberofstop").val();
// if (outsourcer_type === 'I') {
// // 預計安裝開工日
// Date.prototype.addDays = function(days) {
// this.setDate(this.getDate() + days);
// return this;
// }
// }
// if (outsourcer_type === 'T') {
// }
// if (outsourcer_type === 'IT') {
// }
// }
</script>

29
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');

36
wms/wipwhole-renovate-index-function.php

@ -367,7 +367,7 @@ function getDataSql($department_id, $role_id, $user_id)
{
// 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
if(in_array($user_id,['M0166','M0091'])){
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
@ -542,7 +542,7 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
{
// 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
if(in_array($user_id,['M0166','M0091'])){
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
@ -772,7 +772,7 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
function getGunwuName($address)
{
$north_arr = array('台北', '基隆', '新北', '桃園', '新竹');
$north_arr = array('台北', '基隆', '新北', '桃園', '新竹', '台東');
$north_arr2 = array('宜蘭');
$center_arr = array('南投', '彰化', '雲林', '台中', '苗栗');
$south_arr = array('台南', '嘉義', '屏東', '高雄');
@ -1057,11 +1057,11 @@ function getSaveEstimateInstallData($user_department_id, $role_id)
return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6']))
return true;
if ($user_department_id == '544' && $role_id == '3')
if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
return true;
if ($user_department_id == '543' && $role_id == '2')
return true;
if ($user_department_id == '545' && $role_id == '6')
if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true;
return false;
}
@ -1076,9 +1076,9 @@ function getSaveInstallDataButtonStatus($user_department_id, $role_id)
return true;
if ($user_department_id == '543' && $role_id == '2')
return true;
if ($user_department_id == '544' && $role_id == '3')
if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
return true;
if ($user_department_id == '545' && $role_id == '6')
if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true;
if ($user_department_id == '220')
return true;
@ -1100,3 +1100,25 @@ function getWipwholeChangePlanningCustomerDetailsStatus($link, $id)
";
return mysqli_query($link, $sql);
}
function getAllCustomerPlanningVerify($link, $id)
{
$sql = "
SELECT
customer_planning_verify_file,
create_at
FROM wipwholestatus
WHERE id = $id
AND customer_planning_verify_file != ''
AND customer_planning_verify_file IS NOT NULL
UNION
SELECT
customer_planning_verify_file,
create_at
FROM wipwhole_change_planning_customer_details
WHERE wipwholestatus_id = $id
AND customer_planning_verify_file != ''
AND customer_planning_verify_file IS NOT NULL
";
return mysqli_query($link, $sql);
}

7
wms/wipwhole-renovate-index-table-html.php

@ -28,6 +28,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
<th style="text-align:center;width:150px;">規格</th>
<th style="text-align:center;width:150px;">地址</th>
<th style="text-align:center;width:100px;">工勘狀態</th>
<th style="text-align:center;width:100px;">合約交期(到工地)</th>
<th style="text-align:center;width:100px;">下單日(普來特富)</th>
<th style="text-align:center;width:100px;">預計到廠日(觀音廠)</th>
<th style="text-align:center;width:100px;">實際到廠日(觀音廠)</th>
@ -157,6 +158,12 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
}
}
?>
<td>
<?php
if (!empty($data['contract_arrival_date']))
echo date("Y/m/d", strtotime($data['contract_arrival_date']));
?>
</td>
<td>
<?php
if (!empty($data['prattford_order_date']))

39
wms/wipwhole-renovate-rec-invoice-edit-submit.php

@ -463,14 +463,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
";
if (!empty($official_check_file))
$updatesql .= "official_check_file = '$official_check_file', ";
} else {
echo "暫無權限";
exit();
}
// 暫時可編輯及刪除權限
if (in_array($user_id, ['M0175', 'M0079'])) {
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
// 暫時可編輯及刪除權限
$updatesql .= "
contractno = '$contractno',
facility_temp_no = '$facility_temp_no',
@ -492,7 +488,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
";
}
// 工務助理
$updatesql .= "
install_outsourcer = '$install_outsourcer',
@ -513,12 +508,38 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
estimate_tryrun_end_date_owner = '$estimate_tryrun_end_date_owner',
warehouse_assistant_remark = '$warehouse_assistant_remark',
";
if (!empty($plan_diagram_file)){
if (!empty($plan_diagram_file)) {
$updatesql .= "plan_diagram_file = '$plan_diagram_file', ";
$updatesql .= "
all_remark = CONCAT('" . $user_id . accountidToName($user_id) . "_" . $datetime . "<br/>上傳了安裝圖附件<br/><br/>',IF(all_remark IS NULL,'',all_remark)),
";
}
// 許協更新業務確認項目權限
if ($user_id == 'M0060') {
$updatesql .= "
prattford_order_date_verify = '$prattford_order_date_verify' ,
prattford_order_date = '$prattford_order_date',
prattford_order_date_owner = '$prattford_order_date_owner',
estimated_shipping_date_verify = '$estimated_shipping_date_verify',
estimated_shipping_date = '$estimated_shipping_date',
estimated_shipping_date_owner = '$estimated_shipping_date_owner',
estimated_shipping_schedule_date_verify = '$estimated_shipping_schedule_date_verify',
estimated_shipping_schedule_date = '$estimated_shipping_schedule_date',
estimated_shipping_schedule_date_owner = '$estimated_shipping_schedule_date_owner',
goods_type = '$goods_type',
goods_type_date = '$goods_type_date',
goods_type_owner = '$goods_type_owner',
taiwan_goods_type = '$taiwan_goods_type',
taiwan_goods_type_date = '$taiwan_goods_type_date',
taiwan_goods_type_owner = '$taiwan_goods_type_owner',
shengguanok_status = '$shengguanok_status',
shengguanok_status_at = '$shengguanok_status_at',
shengguanok_status_owner = '$shengguanok_status_owner',
yewu_remark = '',
";
}
$updatesql .= "
creater = '$creater',
create_at = '$create_at'

49
wms/wipwhole-renovate-rec-invoice-edit.php

@ -50,17 +50,22 @@ $pinzheng = getPinzhengStatus($link, $user_department_id, $role_id);
$tab = getTabNo($user_department_id);
// 工務助理
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193'])) {
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188'])) {
$warehouse2 = "";
$tab = 5;
}
// 暫時可編輯及刪除權限
$update_delete_status = "disabled";
if (in_array($user_id, ['M0175', 'M0079'])) {
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
$update_delete_status = "";
}
// 許協業務項編輯權限
if (in_array($user_id, ['M0060'])) {
$yewu = "";
}
// select => options 開門方式
$opendoor_options = getOpendoorOptions($link);
@ -249,6 +254,17 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
</div>
</td>
</tr>
<?php
if (in_array($user_id, ['M0175', 'M0079', 'M0060'])) {
?>
<tr>
<td colspan="8">
<button onclick="savedata()" type="button" class="btn btn-primary pull-right" style="margin-left:3px;" <?php echo $update_delete_status; ?>>存檔</button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
@ -398,15 +414,22 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
</td>
<td style="vertical-align: middle;">附件</td>
<td style="vertical-align: middle;">
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" <?php
if (isset($row2['change_status'])) {
echo $row2['change_status'] === 'Z' ? "" : "disabled";
} else {
echo "disabled";
}
?>>
<!-- <input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" <?php
if (isset($row2['change_status'])) {
echo $row2['change_status'] === 'Z' ? "" : "disabled";
} else {
echo "disabled";
}
?>>
<?php
echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
?> -->
<?php
$customer_planning_verify_files = getAllCustomerPlanningVerify($link, $id);
foreach ($customer_planning_verify_files as $row2) :
echo "<a id='customer_planning_verify_file_a' style='color:#00F;'
href='" . $row2['customer_planning_verify_file'] . "' target='_blank'>下載附件_" . $row2['create_at'] . "</a>";
endforeach;
?>
</td>
<td style="vertical-align: middle">確認時間</td>
@ -742,7 +765,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle;">附件</td>
<td style="vertical-align: middle;">
<?php
echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
// echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
foreach ($customer_planning_verify_files as $row2) :
echo "<a id='customer_planning_verify_file_a' style='color:#00F;'
href='" . $row2['customer_planning_verify_file'] . "' target='_blank'>下載附件_" . $row2['create_at'] . "</a>";
endforeach;
?>
</td>
<td style="vertical-align: middle"> 確認時間</td>
@ -1117,7 +1144,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button>
<?php
} else {
if (($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5'))) {
if (($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5') || $user_id == 'M0060')) {
?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button>
<button onclick="doShengguanAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">結案</button>

17
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'],

16
wms/wipwholeinstall-index-function.php

@ -120,6 +120,9 @@ function getEditFlag($department_id, $role_id, $user_id)
// 南區營銷部 工務助理
if ($department_id == '314' && $role_id == '4')
return 4;
// 宜花東營銷部 工務助理
if ($department_id == '315' && $role_id == '2')
return 4;
// 安裝開發支援部 工務助理
if ($department_id == '521' && $role_id == '11')
return 4;
@ -219,6 +222,19 @@ function getDataSql($department_id, $role_id, $user_id)
";
return $sql;
}
// 宜花東營銷部 工務助理
if ($department_id == '314' && $role_id == '4') {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台東','宜蘭','花蓮')
ORDER BY real_contract_arrival_date DESC
";
return $sql;
}
// 安裝開發支援部 工務助理
if ($department_id == '521' && $role_id == '11') {
$sql = "

17
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'])),

19
wms/wipwholeinstall-renovate-index-function.php

@ -123,6 +123,9 @@ function getEditFlag($department_id, $role_id, $user_id)
// 南區營銷部 工務助理
if ($department_id == '314' && $role_id == '4')
return 4;
// 宜花東營銷部 工務助理
if ($department_id == '315' && $role_id == '2')
return 4;
// 安裝開發支援部 工務助理
if ($department_id == '521' && $role_id == '11')
return 4;
@ -219,6 +222,19 @@ function getDataSql($department_id, $role_id, $user_id)
";
return $sql;
}
// 宜花東營銷部 工務助理
if ($department_id == '315' && $role_id == '2') {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC
";
return $sql;
}
// 安裝開發支援部 工務助理
if ($department_id == '521' && $role_id == '11') {
$sql = "
@ -881,6 +897,9 @@ function getWarehouseStatus($link, $user_department_id, $role_id)
// 南區營銷部 工務助理
if ($user_department_id == '314' && $role_id == '4')
return "";
// 宜花東營銷部 工務助理
if ($user_department_id == '315' && $role_id == '2')
return "";
// 安裝開發支援部 工務助理
if ($user_department_id == '521' && $role_id == '11')
return "";

Loading…
Cancel
Save