10994015 1 year ago
parent
commit
531c94b2a1
  1. 1
      .gitignore
  2. 4
      .vscode/launch.json
  3. 42
      wms/T8_Authorization_curl_ver.php
  4. BIN
      wms/account-receivable-contract.xlsx
  5. 25
      wms/account-receivable-excel.php
  6. 371
      wms/account-receivable-new-index.php
  7. 42
      wms/account-receivable-renovate-index.php
  8. BIN
      wms/account-receivable-renovate.xlsx
  9. 44
      wms/account-receivable-repair-index.php
  10. BIN
      wms/account-receivable-repair.xlsx
  11. 2
      wms/account-receivable.txt
  12. 62
      wms/class/Cmail.php
  13. 109
      wms/class/Cnotice.php
  14. 31
      wms/contract_b-index-model.php
  15. 1
      wms/contract_b-index.php
  16. 311
      wms/contract_m-index.php
  17. 5
      wms/css/view/wipwhole-index.php
  18. 269
      wms/day_off/ship_run_chart.php
  19. 585
      wms/delivery_kpi.php
  20. 311
      wms/fix_contract_payment_status.php
  21. 328
      wms/fnh/faultreview-index.php
  22. 3
      wms/fun_global.php
  23. 26
      wms/gary.php
  24. BIN
      wms/img/mail001.jpg
  25. 49
      wms/maintainance_contract_payment_status.php
  26. 181
      wms/maintainance_contract_payment_status2.php
  27. 325
      wms/maintainance_contract_payment_status_modal.php
  28. 1
      wms/schedule_star-index.php
  29. 357
      wms/ship_run_chart-model.php
  30. 157
      wms/ship_run_chart-model_BK.php
  31. 435
      wms/ship_run_chart.php
  32. 391
      wms/ship_run_chart_BK.php
  33. 2
      wms/wipwhole-change-contractdate-function.php
  34. 46
      wms/wipwhole-change-contractdate-submit.php
  35. 13
      wms/wipwhole-change-contractdate.php
  36. 8
      wms/wipwhole-index-export-excel.php
  37. 27
      wms/wipwhole-index-function.php
  38. 17
      wms/wipwhole-rec-invoice-edit-fileupload.php
  39. 743
      wms/wipwhole-rec-invoice-edit-submit.php
  40. 71
      wms/wipwhole-rec-invoice-edit.php
  41. 8
      wms/wipwhole-renovate-index-export-excel.php
  42. 27
      wms/wipwhole-renovate-index-function.php
  43. 722
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  44. 68
      wms/wipwhole-renovate-rec-invoice-edit.php
  45. 9
      wms/wipwhole-renovate-rec-invoice.php
  46. 13
      wms/wipwholeinstall-index-export-excel.php
  47. 41
      wms/wipwholeinstall-index-function.php
  48. 4
      wms/wipwholeinstall-index-table-html.php
  49. 12
      wms/wipwholeinstall-renovate-index-export-excel.php
  50. 39
      wms/wipwholeinstall-renovate-index-function.php
  51. 4
      wms/wipwholeinstall-renovate-index-table-html.php

1
.gitignore

@ -27,3 +27,4 @@ wms/test.php
app/account_log/ app/account_log/
wms/gary2.php wms/gary2.php
wms/chinese.php wms/chinese.php
phpinfo.php

4
.vscode/launch.json

@ -8,7 +8,7 @@
"name": "Listen for Xdebug", "name": "Listen for Xdebug",
"type": "php", "type": "php",
"request": "launch", "request": "launch",
"port": 9003 "port": 9004
}, },
{ {
"name": "Launch currently open script", "name": "Launch currently open script",
@ -37,7 +37,7 @@
], ],
"program": "", "program": "",
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"port": 9003, "port": 9004,
"serverReadyAction": { "serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started", "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s", "uriFormat": "http://localhost:%s",

42
wms/T8_Authorization_curl_ver.php

@ -1,21 +1,50 @@
<?php <?php
// 202711
// $user_id = "M0000"; // $user_id = "M0000";
// $user_password = "M012290493119"; // $user_password = "M012290493119";
// 測試空間
$user_id = "M0117"; $user_id = "M0117";
$user_password = "90493119"; $user_password = "90493119";
$validation = get_Auth($user_id, $user_password); $api_key = "A21181F1EE4966D3";
$GroupId = "TEST";
$apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
// 正式空間
// $user_id = "M0117";
// $user_password = "90493119";
// $api_key = "A21181F1EE4966D3";
// $GroupId = "MASADA";
// $apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
function get_Auth($user_id = "M0000", $user_password = "M012290493119") $data = array(
'user_id' => $user_id,
'user_password' => $user_password,
'api_key' => $api_key,
'GroupId' => $GroupId,
'apiurl' => $apiurl
);
echo $validation = get_Auth($data);
function get_Auth($data)
{ {
$user_id = $data['user_id'];
$user_password = $data['user_password'];
$api_key = $data['api_key'];
$GroupId = $data['GroupId'];
$apiurl = $data['apiurl'];
// 伺服器時間扣兩分鐘會比較穩定
// $now = gmdate("YmdHis"); // $now = gmdate("YmdHis");
$now = gmdate("YmdHis", strtotime("-2 minutes")); $now = gmdate("YmdHis", strtotime("-2 minutes"));
$data = "$user_id." . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
$data = "$user_id." . $now;
$sign = hash_hmac('SHA256', $data, $api_key, false);
// 各種API連線網址
// $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth'; // $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth';
$apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; $apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
// $apiurl = 'http://10.10.145.2:880//twWebAPI/GetAuth'; // $apiurl = 'http://10.10.145.2:880//twWebAPI/GetAuth';
@ -25,7 +54,8 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
"UserId: $user_id", "UserId: $user_id",
"Pwd: $user_password", "Pwd: $user_password",
"TimestampUTC: $now", "TimestampUTC: $now",
"Sign: $sign" "Sign: $sign",
"GroupId: $GroupId"
]; ];
$ch = curl_init(); $ch = curl_init();
@ -42,6 +72,8 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
return $result['Data']['CHI_Authorization']; return $result['Data']['CHI_Authorization'];
if ($result['Status'] == 'Error') if ($result['Status'] == 'Error')
return $result['ErrorMsg']; return $result['ErrorMsg'];
print_r($result);
} }
curl_close($ch); curl_close($ch);

BIN
wms/account-receivable-contract.xlsx

Binary file not shown.

25
wms/account-receivable-excel.php

@ -14,7 +14,6 @@ $spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
if ($type == 'newContract') { if ($type == 'newContract') {
$excel_array = array();
$colomnHeader = [ $colomnHeader = [
'合約號', '客戶名稱', '營業員', '合約金額', '台數', '作番狀態', '催收金額', '催收次數', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數', '合約號', '客戶名稱', '營業員', '合約金額', '台數', '作番狀態', '催收金額', '催收次數', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數',
'貨抵工地款催收金額', '貨抵工地款催收次數', '貨抵工地款催收金額', '貨抵工地款催收次數',
@ -24,32 +23,24 @@ if ($type == 'newContract') {
'交車款催收金額', '交車款催收次數', '交車款催收金額', '交車款催收次數',
'尾款催收金額', '尾款催收次數' '尾款催收金額', '尾款催收次數'
]; ];
foreach ($Bill as $key => $value) {
$excel_array[$key] = [
$value[0], $value[3], $value[8], $value[11], $value[19], $value[20], $value[17], $value[18], $value[26], $value[27], $value[33], $value[34],
$value[40], $value[41],
$value[47], $value[48],
$value[54], $value[55],
$value[61], $value[62],
$value[68], $value[69],
$value[75], $value[76]
];
}
file_put_contents('account-receivable.txt', json_encode($excel_array, JSON_UNESCAPED_UNICODE)); file_put_contents('account-receivable.txt', json_encode($Bill, JSON_UNESCAPED_UNICODE));
$sheet->fromArray($colomnHeader, NULL, 'A1'); $sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2; $rowIndex = 2;
foreach ($excel_array as $item) { foreach ($Bill as $key => $value) {
$sheet->fromArray($item, NULL, 'A' . $rowIndex);
$sheet->fromArray($value, NULL, 'A' . $rowIndex);
$column = [ $column = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X' 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y'
]; ];
foreach ($column as $col) { foreach ($column as $col) {
if ($col == 'F') { if ($col == 'F') {
$sheet->getColumnDimension('F')->setWidth(35); $sheet->getColumnDimension('F')->setWidth(35);
$sheet->getStyle('F')->getAlignment()->setWrapText(true); $sheet->getStyle('F')->getAlignment()->setWrapText(true);
} else { } else {
$sheet->getColumnDimension($col)->setAutoSize(true); // $sheet->getColumnDimension($col)->setAutoSize(true);
$sheet->getColumnDimension($col)->setWidth(10);
$sheet->getStyle($col)->getAlignment()->setWrapText(true);
} }
} }
$rowIndex++; $rowIndex++;

371
wms/account-receivable-new-index.php

@ -613,7 +613,7 @@ foreach ($query_invoice as $invoice) {
//未在T8的收款資料 //未在T8的收款資料
$sql_wms = "SELECT * FROM account_received WHERE type='M' AND BillNo IN $str_numbers"; $sql_wms = "SELECT * FROM account_received WHERE type='M' AND BillNo IN $str_numbers";
$query_wms = mysqli_query($link, $sql_wms); $query_wms = mysqli_query($link, $sql_wms);
foreach($query_wms as $wms){ foreach ($query_wms as $wms) {
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) { if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) {
$arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget']; $arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget'];
} }
@ -756,6 +756,7 @@ $average_contract_facility = $sum_facility / $sum_contract;
// 21 訂金名稱; 22 訂金金額; 23 應收金額; 24 已開發票金額; 25 已收金額; 26 催收金額; 27 催收次數; // 21 訂金名稱; 22 訂金金額; 23 應收金額; 24 已開發票金額; 25 已收金額; 26 催收金額; 27 催收次數;
// 28 二次款名稱; 29 二次款金額; 30 應收金額; 31 已開發票金額; 32 已收金額; 33 催收金額; 34 催收次數; // 28 二次款名稱; 29 二次款金額; 30 應收金額; 31 已開發票金額; 32 已收金額; 33 催收金額; 34 催收次數;
$excel_contract_array = array(); $excel_contract_array = array();
$excel_contract_all_array = array();
$excel_contract_boga_array = array(); $excel_contract_boga_array = array();
$excel_contract_noboga_array = array(); $excel_contract_noboga_array = array();
@ -786,59 +787,38 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--'; $excel_contract_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--';
$excel_contract_array[$key][14] = number_format(round($excel_contract_array[$key][14])); $excel_contract_array[$key][14] = number_format(round($excel_contract_array[$key][14]));
$excel_contract_array[$key][16] = number_format(round($excel_contract_array[$key][16])); $excel_contract_array[$key][16] = number_format(round($excel_contract_array[$key][16]));
if (isset($value['PayStage']) && is_iterable($value['PayStage'])) { if ($excel_contract_array[$key][17] > 1 && isset($value['PayStage']) && is_iterable($value['PayStage'])) {
$excel_contract_all_array[$key] = array_fill(0, 24, 0);
$excel_contract_all_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_all_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_all_array[$key][2] = $excel_contract_array[$key][8];
$excel_contract_all_array[$key][3] = $excel_contract_array[$key][11];
$excel_contract_all_array[$key][4] = $excel_contract_array[$key][19];
$excel_contract_all_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_all_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_all_array[$key][7] = $excel_contract_array[$key][18];
$isBoga = 0; $isBoga = 0;
if (stristr($value['PayStage'][1]['PayStage'], '寶佳')) { if (stristr($value['PayStage'][1]['PayStage'], '寶佳')) {
$isBoga = 1; $isBoga = 1;
$excel_contract_boga_array[$key] = array_fill(0, 76, ''); $excel_contract_boga_array[$key] = array_fill(0, 24, '');
$excel_contract_boga_array[$key][0] = (isset($value['BillNo']) && !is_null($value['BillNo'])) ? $value['BillNo'] : ''; $excel_contract_boga_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_boga_array[$key][1] = (isset($value['BillDate']) && !is_null($value['BillDate'])) ? $value['BillDate'] : ''; $excel_contract_boga_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_boga_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : ''; $excel_contract_boga_array[$key][2] = $excel_contract_array[$key][8];
$excel_contract_boga_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : ''; $excel_contract_boga_array[$key][3] = $excel_contract_array[$key][11];
$excel_contract_boga_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : ''; $excel_contract_boga_array[$key][4] = $excel_contract_array[$key][19];
$excel_contract_boga_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : ''; $excel_contract_boga_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_boga_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : ''; $excel_contract_boga_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_boga_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : ''; $excel_contract_boga_array[$key][7] = $excel_contract_array[$key][18];
$excel_contract_boga_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : '';
$excel_contract_boga_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : '';
$excel_contract_boga_array[$key][10] = (isset($value['ManagerName']) && !is_null($value['ManagerName'])) ? $value['ManagerName'] : '';
$excel_contract_boga_array[$key][11] = (isset($value['OAmountWithTax']) && !is_null($value['OAmountWithTax'])) ? number_format(round($value['OAmountWithTax'])) : '0';
$excel_contract_boga_array[$key][12] = (isset($value['A40001']) && !is_null($value['A40001'])) ? number_format(round($value['A40001'])) : '0';
$excel_contract_boga_array[$key][13] = (isset($value['A40008']) && !is_null($value['A40008'])) ? number_format(round($value['A40008'])) : '0';
$excel_contract_boga_array[$key][14] = (isset($value['receivable_budget']) && !is_null($value['receivable_budget'])) ? $value['receivable_budget'] : 0;
$excel_contract_boga_array[$key][15] = (isset($value['invoice_budget']) && !is_null($value['invoice_budget'])) ? number_format(round($value['invoice_budget'])) : '0';
$excel_contract_boga_array[$key][16] = (isset($value['received_budget']) && !is_null($value['received_budget'])) ? $value['received_budget'] : 0;
$excel_contract_boga_array[$key][17] = number_format(round($excel_contract_boga_array[$key][14] - $excel_contract_boga_array[$key][16]));
$excel_contract_boga_array[$key][18] = (isset($value['collect_month']) && !is_null($value['collect_month'])) ? number_format(round($value['collect_month'])) : '0';
$excel_contract_boga_array[$key][19] = (isset($value['facility_num']) && !is_null($value['facility_num'])) ? number_format(round($value['facility_num'])) : '0';
$excel_contract_boga_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--';
$excel_contract_boga_array[$key][14] = number_format(round($excel_contract_boga_array[$key][14]));
$excel_contract_boga_array[$key][16] = number_format(round($excel_contract_boga_array[$key][16]));
} else { } else {
$excel_contract_noboga_array[$key] = array_fill(0, 76, ''); $excel_contract_noboga_array[$key] = array_fill(0, 24, '');
$excel_contract_noboga_array[$key][0] = (isset($value['BillNo']) && !is_null($value['BillNo'])) ? $value['BillNo'] : ''; $excel_contract_noboga_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_noboga_array[$key][1] = (isset($value['BillDate']) && !is_null($value['BillDate'])) ? $value['BillDate'] : ''; $excel_contract_noboga_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_noboga_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : ''; $excel_contract_noboga_array[$key][2] = $excel_contract_array[$key][8];
$excel_contract_noboga_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : ''; $excel_contract_noboga_array[$key][3] = $excel_contract_array[$key][11];
$excel_contract_noboga_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : ''; $excel_contract_noboga_array[$key][4] = $excel_contract_array[$key][19];
$excel_contract_noboga_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : ''; $excel_contract_noboga_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_noboga_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : ''; $excel_contract_noboga_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_noboga_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : ''; $excel_contract_noboga_array[$key][7] = $excel_contract_array[$key][18];
$excel_contract_noboga_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : '';
$excel_contract_noboga_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : '';
$excel_contract_noboga_array[$key][10] = (isset($value['ManagerName']) && !is_null($value['ManagerName'])) ? $value['ManagerName'] : '';
$excel_contract_noboga_array[$key][11] = (isset($value['OAmountWithTax']) && !is_null($value['OAmountWithTax'])) ? number_format(round($value['OAmountWithTax'])) : '0';
$excel_contract_noboga_array[$key][12] = (isset($value['A40001']) && !is_null($value['A40001'])) ? number_format(round($value['A40001'])) : '0';
$excel_contract_noboga_array[$key][13] = (isset($value['A40008']) && !is_null($value['A40008'])) ? number_format(round($value['A40008'])) : '0';
$excel_contract_noboga_array[$key][14] = (isset($value['receivable_budget']) && !is_null($value['receivable_budget'])) ? $value['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][15] = (isset($value['invoice_budget']) && !is_null($value['invoice_budget'])) ? number_format(round($value['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][16] = (isset($value['received_budget']) && !is_null($value['received_budget'])) ? $value['received_budget'] : 0;
$excel_contract_noboga_array[$key][17] = number_format(round($excel_contract_noboga_array[$key][14] - $excel_contract_noboga_array[$key][16]));
$excel_contract_noboga_array[$key][18] = (isset($value['collect_month']) && !is_null($value['collect_month'])) ? number_format(round($value['collect_month'])) : '0';
$excel_contract_noboga_array[$key][19] = (isset($value['facility_num']) && !is_null($value['facility_num'])) ? number_format(round($value['facility_num'])) : '0';
$excel_contract_noboga_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--';
$excel_contract_noboga_array[$key][14] = number_format(round($excel_contract_noboga_array[$key][14]));
$excel_contract_noboga_array[$key][16] = number_format(round($excel_contract_noboga_array[$key][16]));
} }
foreach ($value['PayStage'] as $paykey => $payvalue) { foreach ($value['PayStage'] as $paykey => $payvalue) {
switch ($payvalue['stage']) { switch ($payvalue['stage']) {
@ -850,29 +830,21 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][26] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25])); $excel_contract_array[$key][26] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25]));
$excel_contract_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][8] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25]));
$excel_contract_all_array[$key][9] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][8] = $excel_contract_all_array[$key][8];
$excel_contract_boga_array[$key][9] = $excel_contract_all_array[$key][9];
} else {
$excel_contract_noboga_array[$key][8] = $excel_contract_all_array[$key][8];
$excel_contract_noboga_array[$key][9] = $excel_contract_all_array[$key][9];
}
}
$excel_contract_array[$key][23] = number_format(round($excel_contract_array[$key][23])); $excel_contract_array[$key][23] = number_format(round($excel_contract_array[$key][23]));
$excel_contract_array[$key][25] = number_format(round($excel_contract_array[$key][25])); $excel_contract_array[$key][25] = number_format(round($excel_contract_array[$key][25]));
if ($isBoga == 1) {
$excel_contract_boga_array[$key][21] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_boga_array[$key][22] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_boga_array[$key][23] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_boga_array[$key][24] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_boga_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_boga_array[$key][26] = number_format(round($excel_contract_boga_array[$key][23] - $excel_contract_boga_array[$key][25]));
$excel_contract_boga_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_boga_array[$key][23] = number_format(round($excel_contract_boga_array[$key][23]));
$excel_contract_boga_array[$key][25] = number_format(round($excel_contract_boga_array[$key][25]));
} else {
$excel_contract_noboga_array[$key][21] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][22] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][23] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][24] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][26] = number_format(round($excel_contract_noboga_array[$key][23] - $excel_contract_noboga_array[$key][25]));
$excel_contract_noboga_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][23] = number_format(round($excel_contract_noboga_array[$key][23]));
$excel_contract_noboga_array[$key][25] = number_format(round($excel_contract_noboga_array[$key][25]));
}
break; break;
case "二次款": case "二次款":
$excel_contract_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -882,30 +854,22 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][33] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32])); $excel_contract_array[$key][33] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32]));
$excel_contract_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][10] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32]));
$excel_contract_all_array[$key][11] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][10] = $excel_contract_all_array[$key][10];
$excel_contract_boga_array[$key][11] = $excel_contract_all_array[$key][11];
} else {
$excel_contract_noboga_array[$key][10] = $excel_contract_all_array[$key][10];
$excel_contract_noboga_array[$key][11] = $excel_contract_all_array[$key][11];
}
}
$excel_contract_array[$key][30] = number_format(round($excel_contract_array[$key][30])); $excel_contract_array[$key][30] = number_format(round($excel_contract_array[$key][30]));
$excel_contract_array[$key][32] = number_format(round($excel_contract_array[$key][32])); $excel_contract_array[$key][32] = number_format(round($excel_contract_array[$key][32]));
if ($isBoga == 1) {
$excel_contract_boga_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_boga_array[$key][29] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_boga_array[$key][30] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_boga_array[$key][31] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_boga_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_boga_array[$key][33] = number_format(round($excel_contract_boga_array[$key][30] - $excel_contract_boga_array[$key][32]));
$excel_contract_boga_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_boga_array[$key][30] = number_format(round($excel_contract_boga_array[$key][30]));
$excel_contract_boga_array[$key][32] = number_format(round($excel_contract_boga_array[$key][32]));
} else {
$excel_contract_noboga_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][29] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][30] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][31] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][33] = number_format(round($excel_contract_noboga_array[$key][30] - $excel_contract_noboga_array[$key][32]));
$excel_contract_noboga_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][30] = number_format(round($excel_contract_noboga_array[$key][30]));
$excel_contract_noboga_array[$key][32] = number_format(round($excel_contract_noboga_array[$key][32]));
}
break; break;
case "貨抵工地款": case "貨抵工地款":
$excel_contract_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -915,29 +879,20 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][40] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39])); $excel_contract_array[$key][40] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39]));
$excel_contract_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][12] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39]));
$excel_contract_all_array[$key][13] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][12] = $excel_contract_all_array[$key][12];
$excel_contract_boga_array[$key][13] = $excel_contract_all_array[$key][13];
} else {
$excel_contract_noboga_array[$key][12] = $excel_contract_all_array[$key][12];
$excel_contract_noboga_array[$key][13] = $excel_contract_all_array[$key][13];
}
}
$excel_contract_array[$key][37] = number_format(round($excel_contract_array[$key][37])); $excel_contract_array[$key][37] = number_format(round($excel_contract_array[$key][37]));
$excel_contract_array[$key][39] = number_format(round($excel_contract_array[$key][39])); $excel_contract_array[$key][39] = number_format(round($excel_contract_array[$key][39]));
if ($isBoga == 1) {
$excel_contract_boga_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_boga_array[$key][36] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_boga_array[$key][37] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_boga_array[$key][38] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_boga_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_boga_array[$key][40] = number_format(round($excel_contract_boga_array[$key][37] - $excel_contract_boga_array[$key][39]));
$excel_contract_boga_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_boga_array[$key][37] = number_format(round($excel_contract_boga_array[$key][37]));
$excel_contract_boga_array[$key][39] = number_format(round($excel_contract_boga_array[$key][39]));
} else {
$excel_contract_noboga_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][36] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][37] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][38] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][40] = number_format(round($excel_contract_noboga_array[$key][37] - $excel_contract_noboga_array[$key][39]));
$excel_contract_noboga_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][37] = number_format(round($excel_contract_noboga_array[$key][37]));
$excel_contract_noboga_array[$key][39] = number_format(round($excel_contract_noboga_array[$key][39]));
}
break; break;
case "安裝款": case "安裝款":
$excel_contract_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -947,18 +902,14 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][47] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46])); $excel_contract_array[$key][47] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46]));
$excel_contract_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][14] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46]));
$excel_contract_all_array[$key][15] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][14] = $excel_contract_all_array[$key][14];
$excel_contract_noboga_array[$key][15] = $excel_contract_all_array[$key][15];
}
$excel_contract_array[$key][44] = number_format(round($excel_contract_array[$key][44])); $excel_contract_array[$key][44] = number_format(round($excel_contract_array[$key][44]));
$excel_contract_array[$key][46] = number_format(round($excel_contract_array[$key][46])); $excel_contract_array[$key][46] = number_format(round($excel_contract_array[$key][46]));
$excel_contract_noboga_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][43] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][44] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][45] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][47] = number_format(round($excel_contract_noboga_array[$key][44] - $excel_contract_noboga_array[$key][46]));
$excel_contract_noboga_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][44] = number_format(round($excel_contract_noboga_array[$key][44]));
$excel_contract_noboga_array[$key][46] = number_format(round($excel_contract_noboga_array[$key][46]));
break; break;
case "試車款": case "試車款":
$excel_contract_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -968,29 +919,20 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][54] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53])); $excel_contract_array[$key][54] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53]));
$excel_contract_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][16] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53]));
$excel_contract_all_array[$key][17] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][16] = $excel_contract_all_array[$key][16];
$excel_contract_boga_array[$key][17] = $excel_contract_all_array[$key][17];
} else {
$excel_contract_noboga_array[$key][16] = $excel_contract_all_array[$key][16];
$excel_contract_noboga_array[$key][17] = $excel_contract_all_array[$key][17];
}
}
$excel_contract_array[$key][51] = number_format(round($excel_contract_array[$key][51])); $excel_contract_array[$key][51] = number_format(round($excel_contract_array[$key][51]));
$excel_contract_array[$key][53] = number_format(round($excel_contract_array[$key][53])); $excel_contract_array[$key][53] = number_format(round($excel_contract_array[$key][53]));
if ($isBoga == 1) {
$excel_contract_boga_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_boga_array[$key][50] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_boga_array[$key][51] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_boga_array[$key][52] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_boga_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_boga_array[$key][54] = number_format(round($excel_contract_boga_array[$key][51] - $excel_contract_boga_array[$key][53]));
$excel_contract_boga_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_boga_array[$key][51] = number_format(round($excel_contract_boga_array[$key][51]));
$excel_contract_boga_array[$key][53] = number_format(round($excel_contract_boga_array[$key][53]));
} else {
$excel_contract_noboga_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][50] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][51] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][52] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][54] = number_format(round($excel_contract_noboga_array[$key][51] - $excel_contract_noboga_array[$key][53]));
$excel_contract_noboga_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][51] = number_format(round($excel_contract_noboga_array[$key][51]));
$excel_contract_noboga_array[$key][53] = number_format(round($excel_contract_noboga_array[$key][53]));
}
break; break;
case "官檢驗收款": case "官檢驗收款":
$excel_contract_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -1000,18 +942,16 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][61] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60])); $excel_contract_array[$key][61] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60]));
$excel_contract_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][18] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60]));
$excel_contract_all_array[$key][19] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][18] = $excel_contract_all_array[$key][18];
$excel_contract_noboga_array[$key][19] = $excel_contract_all_array[$key][19];
}
$excel_contract_array[$key][58] = number_format(round($excel_contract_array[$key][58])); $excel_contract_array[$key][58] = number_format(round($excel_contract_array[$key][58]));
$excel_contract_array[$key][60] = number_format(round($excel_contract_array[$key][60])); $excel_contract_array[$key][60] = number_format(round($excel_contract_array[$key][60]));
$excel_contract_noboga_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][57] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][58] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][59] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][61] = number_format(round($excel_contract_noboga_array[$key][58] - $excel_contract_noboga_array[$key][60]));
$excel_contract_noboga_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][58] = number_format(round($excel_contract_noboga_array[$key][58]));
$excel_contract_noboga_array[$key][60] = number_format(round($excel_contract_noboga_array[$key][60]));
break; break;
case "交車款": case "交車款":
$excel_contract_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -1021,18 +961,15 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][68] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67])); $excel_contract_array[$key][68] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67]));
$excel_contract_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][20] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67]));
$excel_contract_all_array[$key][21] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][20] = $excel_contract_all_array[$key][20];
$excel_contract_noboga_array[$key][21] = $excel_contract_all_array[$key][21];
}
$excel_contract_array[$key][65] = number_format(round($excel_contract_array[$key][65])); $excel_contract_array[$key][65] = number_format(round($excel_contract_array[$key][65]));
$excel_contract_array[$key][67] = number_format(round($excel_contract_array[$key][67])); $excel_contract_array[$key][67] = number_format(round($excel_contract_array[$key][67]));
$excel_contract_noboga_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][64] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][65] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][66] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][68] = number_format(round($excel_contract_noboga_array[$key][65] - $excel_contract_noboga_array[$key][67]));
$excel_contract_noboga_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][65] = number_format(round($excel_contract_noboga_array[$key][65]));
$excel_contract_noboga_array[$key][67] = number_format(round($excel_contract_noboga_array[$key][67]));
break; break;
case "尾款": case "尾款":
$excel_contract_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
@ -1042,29 +979,20 @@ foreach ($arrayData as $key => $value) {
$excel_contract_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][75] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74])); $excel_contract_array[$key][75] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74]));
$excel_contract_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][22] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74]));
$excel_contract_all_array[$key][23] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][22] = $excel_contract_all_array[$key][22];
$excel_contract_boga_array[$key][23] = $excel_contract_all_array[$key][23];
} else {
$excel_contract_noboga_array[$key][22] = $excel_contract_all_array[$key][22];
$excel_contract_noboga_array[$key][23] = $excel_contract_all_array[$key][23];
}
}
$excel_contract_array[$key][72] = number_format(round($excel_contract_array[$key][72])); $excel_contract_array[$key][72] = number_format(round($excel_contract_array[$key][72]));
$excel_contract_array[$key][74] = number_format(round($excel_contract_array[$key][74])); $excel_contract_array[$key][74] = number_format(round($excel_contract_array[$key][74]));
if ($isBoga == 1) {
$excel_contract_boga_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_boga_array[$key][71] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_boga_array[$key][72] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_boga_array[$key][73] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_boga_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_boga_array[$key][75] = number_format(round($excel_contract_boga_array[$key][72] - $excel_contract_boga_array[$key][74]));
$excel_contract_boga_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_boga_array[$key][72] = number_format(round($excel_contract_boga_array[$key][72]));
$excel_contract_boga_array[$key][74] = number_format(round($excel_contract_boga_array[$key][74]));
} else {
$excel_contract_noboga_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_noboga_array[$key][71] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_noboga_array[$key][72] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_noboga_array[$key][73] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_noboga_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_noboga_array[$key][75] = number_format(round($excel_contract_noboga_array[$key][72] - $excel_contract_noboga_array[$key][74]));
$excel_contract_noboga_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][72] = number_format(round($excel_contract_noboga_array[$key][72]));
$excel_contract_noboga_array[$key][74] = number_format(round($excel_contract_noboga_array[$key][74]));
}
break; break;
} }
} }
@ -1085,36 +1013,8 @@ foreach ($arrayData as $key => $value) {
} }
} }
} }
// $excel_contract_noboga_array[$key] = array_fill(0, 76, '');
// $excel_contract_noboga_array[$key][0] = (isset($value['BillNo']) && !is_null($value['BillNo'])) ? $value['BillNo'] : '';
// $excel_contract_noboga_array[$key][1] = (isset($value['BillDate']) && !is_null($value['BillDate'])) ? $value['BillDate'] : '';
// $excel_contract_noboga_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : '';
// $excel_contract_noboga_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : '';
// $excel_contract_noboga_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : '';
// $excel_contract_noboga_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : '';
// $excel_contract_noboga_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : '';
// $excel_contract_noboga_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : '';
// $excel_contract_noboga_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : '';
// $excel_contract_noboga_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : '';
// $excel_contract_noboga_array[$key][10] = (isset($value['ManagerName']) && !is
// foreach ($arrayData as $key => $value) {
// echo $key . "<br>";
// foreach ($value as $k => $v) {
// if ($k == 'facility') {
// foreach ($v as $fkey => $fvalue) {
// echo $fkey . "<br>";
// print_r($fvalue);
// echo "<br><br>";
// }
// }
// // echo $k . "<br>";
// // print_r($v);
// // echo "<br><br>";
// }
// exit();
// }
$total_data = json_encode($excel_contract_array); $total_data = json_encode($excel_contract_all_array);
$boga_data = json_encode($excel_contract_boga_array); $boga_data = json_encode($excel_contract_boga_array);
$noboga_data = json_encode($excel_contract_noboga_array); $noboga_data = json_encode($excel_contract_noboga_array);
?> ?>
@ -1210,6 +1110,31 @@ $noboga_data = json_encode($excel_contract_noboga_array);
</div> </div>
</div> </div>
</form> </form>
<form class="form-horizontal" id='myForm' method='post' action='account-receivable-new-index.php?<?= $token_link ?>'>
<table class="table table-striped table-bordered" style='width:98%;text-align:center;margin:0 auto'>
<tbody>
<tr>
<th class="text-center" style="vertical-align: middle;">合約日期</th>
<td colspan="2">
<input type="date" class='form-control' id='date_start' name='date_start' style='width:40%;display:inline;'>
<input type="date" class='form-control' id='date_end' name='date_end' style='width:40%;display:inline;'>
<button type="submit" class="btn btn-primary btn-sm">搜尋</button>
</td>
</tr>
<tr>
<th class="text-center" style="vertical-align: middle;">合約催收次數</th>
<td colspan="2">
<input type="text" class='form-control' id='collect_time_start' name='collect_time_start' style='width:10%;display:inline;' oninput="searchFront('collect_time_start')">
≤ 催收次數 ≤
<input type="text" class='form-control' id='collect_time_end' name='collect_time_end' style='width:10%;display:inline;'>
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> -->
</td>
</tr>
</tbody>
</table>
</form>
</div> </div>
<?php <?php
@ -1223,7 +1148,7 @@ include "./footer.php";
<tr> <tr>
<th style="width: 120px;">合約號</th> <th style="width: 120px;">合約號</th>
<th style="width: 120px;">部門</th> <th style="width: 120px;">部門</th>
<th style="width: 120px;">經理</th> <th style="width: 120px;">主管</th>
<th style="width: 120px;">營業員</th> <th style="width: 120px;">營業員</th>
<th style="width: 180px;">客戶</th> <th style="width: 180px;">客戶</th>
@ -1235,8 +1160,8 @@ include "./footer.php";
<th style="width: 150px;">已開發票金額</th> <th style="width: 150px;">已開發票金額</th>
<th style="width: 150px;">已收金額金額</th> <th style="width: 150px;">已收金額金額</th>
<th style="width: 150px;">催收金額金額</th> <th style="width: 150px;">催收金額金額</th>
<th style="width: 150px;">催收次數</th> <th style="width: 100px;">催收次數</th>
<th style="width: 150px;">作番數量</th> <th style="width: 100px;">作番數量</th>
<th style="width: 120px;">訂金 <br>名稱</th> <th style="width: 120px;">訂金 <br>名稱</th>
<th style="width: 120px;">訂金<br>合約金額</th> <th style="width: 120px;">訂金<br>合約金額</th>
@ -1244,7 +1169,7 @@ include "./footer.php";
<th style="width: 120px;">訂金<br>已開金額</th> <th style="width: 120px;">訂金<br>已開金額</th>
<th style="width: 120px;">訂金<br>已收金額</th> <th style="width: 120px;">訂金<br>已收金額</th>
<th style="width: 120px;">訂金<br>催收金額</th> <th style="width: 120px;">訂金<br>催收金額</th>
<th style="width: 120px;">訂金<br>催收次數</th> <th style="width: 100px;">訂金<br>催收次數</th>
<th style="width: 120px;">二次款 <br>名稱</th> <th style="width: 120px;">二次款 <br>名稱</th>
<th style="width: 120px;">二次款<br>合約金額</th> <th style="width: 120px;">二次款<br>合約金額</th>
@ -1252,7 +1177,7 @@ include "./footer.php";
<th style="width: 120px;">二次款<br>已開金額</th> <th style="width: 120px;">二次款<br>已開金額</th>
<th style="width: 120px;">二次款<br>已收金額</th> <th style="width: 120px;">二次款<br>已收金額</th>
<th style="width: 120px;">二次款<br>催收金額</th> <th style="width: 120px;">二次款<br>催收金額</th>
<th style="width: 120px;">二次款<br>催收次數</th> <th style="width: 100px;">二次款<br>催收次數</th>
<th style="width: 120px;">貨抵工地款 <br>名稱</th> <th style="width: 120px;">貨抵工地款 <br>名稱</th>
<th style="width: 120px;">貨抵工地款<br>合約金額</th> <th style="width: 120px;">貨抵工地款<br>合約金額</th>
@ -1260,7 +1185,7 @@ include "./footer.php";
<th style="width: 120px;">貨抵工地款<br>已開金額</th> <th style="width: 120px;">貨抵工地款<br>已開金額</th>
<th style="width: 120px;">貨抵工地款<br>已收金額</th> <th style="width: 120px;">貨抵工地款<br>已收金額</th>
<th style="width: 120px;">貨抵工地款<br>催收金額</th> <th style="width: 120px;">貨抵工地款<br>催收金額</th>
<th style="width: 120px;">貨抵工地款<br>催收次數</th> <th style="width: 100px;">貨抵工地款<br>催收次數</th>
<th style="width: 120px;">安裝款 <br>名稱</th> <th style="width: 120px;">安裝款 <br>名稱</th>
<th style="width: 120px;">安裝款<br>合約金額</th> <th style="width: 120px;">安裝款<br>合約金額</th>
@ -1268,7 +1193,7 @@ include "./footer.php";
<th style="width: 120px;">安裝款<br>已開金額</th> <th style="width: 120px;">安裝款<br>已開金額</th>
<th style="width: 120px;">安裝款<br>已收金額</th> <th style="width: 120px;">安裝款<br>已收金額</th>
<th style="width: 120px;">安裝款<br>催收金額</th> <th style="width: 120px;">安裝款<br>催收金額</th>
<th style="width: 120px;">安裝款<br>催收次數</th> <th style="width: 100px;">安裝款<br>催收次數</th>
<th style="width: 120px;">試車款 <br>名稱</th> <th style="width: 120px;">試車款 <br>名稱</th>
<th style="width: 120px;">試車款<br>合約金額</th> <th style="width: 120px;">試車款<br>合約金額</th>
@ -1276,7 +1201,7 @@ include "./footer.php";
<th style="width: 120px;">試車款<br>已開金額</th> <th style="width: 120px;">試車款<br>已開金額</th>
<th style="width: 120px;">試車款<br>已收金額</th> <th style="width: 120px;">試車款<br>已收金額</th>
<th style="width: 120px;">試車款<br>催收金額</th> <th style="width: 120px;">試車款<br>催收金額</th>
<th style="width: 120px;">試車款<br>催收次數</th> <th style="width: 100px;">試車款<br>催收次數</th>
<th style="width: 120px;">官檢驗收款 <br>名稱</th> <th style="width: 120px;">官檢驗收款 <br>名稱</th>
<th style="width: 120px;">官檢驗收款<br>合約金額</th> <th style="width: 120px;">官檢驗收款<br>合約金額</th>
@ -1284,7 +1209,7 @@ include "./footer.php";
<th style="width: 120px;">官檢驗收款<br>已開金額</th> <th style="width: 120px;">官檢驗收款<br>已開金額</th>
<th style="width: 120px;">官檢驗收款<br>已收金額</th> <th style="width: 120px;">官檢驗收款<br>已收金額</th>
<th style="width: 120px;">官檢驗收款<br>催收金額</th> <th style="width: 120px;">官檢驗收款<br>催收金額</th>
<th style="width: 120px;">官檢驗收款<br>催收次數</th> <th style="width: 100px;">官檢驗收款<br>催收次數</th>
<th style="width: 120px;">交車款 <br>名稱</th> <th style="width: 120px;">交車款 <br>名稱</th>
<th style="width: 120px;">交車款<br>合約金額</th> <th style="width: 120px;">交車款<br>合約金額</th>
@ -1292,7 +1217,7 @@ include "./footer.php";
<th style="width: 120px;">交車款<br>已開金額</th> <th style="width: 120px;">交車款<br>已開金額</th>
<th style="width: 120px;">交車款<br>已收金額</th> <th style="width: 120px;">交車款<br>已收金額</th>
<th style="width: 120px;">交車款<br>催收金額</th> <th style="width: 120px;">交車款<br>催收金額</th>
<th style="width: 120px;">交車款<br>催收次數</th> <th style="width: 100px;">交車款<br>催收次數</th>
<th style="width: 120px;">尾款 <br>名稱</th> <th style="width: 120px;">尾款 <br>名稱</th>
<th style="width: 120px;">尾款<br>合約金額</th> <th style="width: 120px;">尾款<br>合約金額</th>
@ -1300,7 +1225,7 @@ include "./footer.php";
<th style="width: 120px;">尾款<br>已開金額</th> <th style="width: 120px;">尾款<br>已開金額</th>
<th style="width: 120px;">尾款<br>已收金額</th> <th style="width: 120px;">尾款<br>已收金額</th>
<th style="width: 120px;">尾款<br>催收金額</th> <th style="width: 120px;">尾款<br>催收金額</th>
<th style="width: 120px;">尾款<br>催收次數</th> <th style="width: 100px;">尾款<br>催收次數</th>

42
wms/account-receivable-renovate-index.php

@ -119,11 +119,6 @@ FROM arWriteOffBillDetail
WHERE CheckDetail.ModeId = 'T'"; WHERE CheckDetail.ModeId = 'T'";
// 期初收款資訊
$sql_opening = "
SELECT * FROM account_received ";
$contractNumbers = array(); $contractNumbers = array();
$query_contract_number = $conn->query($sql_contractNumber); $query_contract_number = $conn->query($sql_contractNumber);
foreach ($query_contract_number as $contract_numbers) { foreach ($query_contract_number as $contract_numbers) {
@ -261,7 +256,7 @@ foreach ($contract as $cont) {
$arrayData[$BillNo]['invoice'] = array(); $arrayData[$BillNo]['invoice'] = array();
$arrayData[$BillNo]['received_budget'] = 0; $arrayData[$BillNo]['received_budget'] = 0;
$arrayData[$BillNo]['invoice_budget'] = 0; $arrayData[$BillNo]['invoice_budget'] = 0;
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] =$arrayData[$BillNo]['A40019'] = 0; $arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = $arrayData[$BillNo]['A40019'] = 0;
$arrayData[$BillNo]['total_facility_num'] = 0; $arrayData[$BillNo]['total_facility_num'] = 0;
} }
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0; $arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0;
@ -283,7 +278,6 @@ foreach ($contract as $cont) {
} }
} }
$received_array = $conn->query($sql_received); $received_array = $conn->query($sql_received);
$opening_data = mysqli_query($link, $sql_opening);
$invoice_data = $conn->query($sql_invoice); $invoice_data = $conn->query($sql_invoice);
$contract_budget_data = $conn->query($sql_contract_budget); $contract_budget_data = $conn->query($sql_contract_budget);
@ -596,11 +590,23 @@ foreach ($received_array as $received) {
$BillNo = $received['OrderBillNo']; $BillNo = $received['OrderBillNo'];
if (isset($arrayData[$BillNo])) { if (isset($arrayData[$BillNo])) {
// if (isset($received['InvoiceNo']) && isset($arrayData[$BillNo]['invoice'][$received['InvoiceNo']])) { // if (isset($received['InvoiceNo']) && isset($arrayData[$BillNo]['invoice'][$received['InvoiceNo']])) {
$arrayData[$BillNo]['received_budget'] += $received['CurrStandOffOAmount']; $arrayData[$BillNo]['received_budget'] += $received['CurrStandOffOAmount'];
// array_push($arrayData[$BillNo]['invoice'][$received['InvoiceNo']], date($received['ReceivedDate']), $received['PayWriteOffOAmount'], $received['Fee'], $received['BillNo']); // array_push($arrayData[$BillNo]['invoice'][$received['InvoiceNo']], date($received['ReceivedDate']), $received['PayWriteOffOAmount'], $received['Fee'], $received['BillNo']);
// } // }
} }
} }
//未在T8的收款資料
$sql_wms = "SELECT * FROM account_received WHERE type='T' ";
$query_wms = mysqli_query($link, $sql_wms);
foreach ($query_wms as $wms) {
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) {
$arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget'];
$arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']] = [date("Y-m-d", strtotime($wms['invoice_date'])), $wms['invoice_budget'], 1];
}
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['received_budget'])) {
$arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget'];
}
}
// $final_paystage ['type'] ['PlanPayDate'] ['PayAmount'] ['facilityno'] ['sequenceNumber'] ['name'] ['InvoiceAmount'] ['receivedAmount'] // $final_paystage ['type'] ['PlanPayDate'] ['PayAmount'] ['facilityno'] ['sequenceNumber'] ['name'] ['InvoiceAmount'] ['receivedAmount']
foreach ($final_paystage as $key => &$payStage) { foreach ($final_paystage as $key => &$payStage) {
if (isset($arrayData[$key]['invoice_budget']) && isset($arrayData[$key]['received_budget'])) { if (isset($arrayData[$key]['invoice_budget']) && isset($arrayData[$key]['received_budget'])) {
@ -640,6 +646,7 @@ foreach ($final_paystage as $key => &$payStage) {
// 0 合約號 1 作番號 2 部門id 3 部門名稱 4 經理名稱 5 營業員id 6 營業員名稱 7 客戶名稱 8 抬頭 9 統編 10 通訊地址 // 0 合約號 1 作番號 2 部門id 3 部門名稱 4 經理名稱 5 營業員id 6 營業員名稱 7 客戶名稱 8 抬頭 9 統編 10 通訊地址
// 11 收款階段名稱 12 應收日期 13 收款金額 14 已開金額 15 已收金額 16 催收次數 // 11 收款階段名稱 12 應收日期 13 收款金額 14 已開金額 15 已收金額 16 催收次數
$excel_aray = array(); $excel_aray = array();
$print_array = array();
$today = strtotime(date('Ymt')); $today = strtotime(date('Ymt'));
foreach ($arrayData as $key => $value) { foreach ($arrayData as $key => $value) {
if (isset($final_paystage[$key])) { if (isset($final_paystage[$key])) {
@ -664,6 +671,17 @@ foreach ($arrayData as $key => $value) {
$unReceivedAmount = 0; $unReceivedAmount = 0;
break; break;
} }
if ($havetopay == "V" && $unReceivedAmount > 1) {
$print_array[$keyname] = [
$value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8],
$thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay,
number_format(round($final_paystage[$key][$sequence]['PayAmount'])),
number_format(round($final_paystage[$key][$sequence]['InvoiceAmount'])), number_format(round($unInvoiceAmount)),
number_format(round($final_paystage[$key][$sequence]['receivedAmount'])), number_format(round($unReceivedAmount)),
number_format(round($final_paystage[$key][$sequence]['collect_month']))
];
}
$excel_aray[$keyname] = [ $excel_aray[$keyname] = [
$value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], $value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8],
$thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay, $thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay,
@ -676,7 +694,7 @@ foreach ($arrayData as $key => $value) {
} }
} }
} }
$total_data = json_encode($excel_aray); $total_data = json_encode($print_array);
?> ?>
<style> <style>
@ -777,7 +795,11 @@ include "./footer.php";
<td><?= $row[13]; ?></td> <td><?= $row[13]; ?></td>
<td><?= $row[14]; ?></td> <td><?= $row[14]; ?></td>
<td><?= $row[15]; ?></td> <td><?= $row[15]; ?></td>
<td><?php if($row[14] == 'V' && $row[19]>0){echo $row[15];}else{echo '0';} ?></td> <td><?php if ($row[14] == 'V' && $row[19] > 0) {
echo $row[15];
} else {
echo '0';
} ?></td>
<td><?= $row[16]; ?></td> <td><?= $row[16]; ?></td>
<td><?= $row[17]; ?></td> <td><?= $row[17]; ?></td>
<td><?= $row[18]; ?></td> <td><?= $row[18]; ?></td>

BIN
wms/account-receivable-renovate.xlsx

Binary file not shown.

44
wms/account-receivable-repair-index.php

@ -203,6 +203,21 @@ foreach ($received_array as $received) {
$arrayData[$received['OrderBillNo']]['received_budget'] += $received['CurrStandOffOAmount']; $arrayData[$received['OrderBillNo']]['received_budget'] += $received['CurrStandOffOAmount'];
} }
} }
//未在T8的收款資料
$sql_wms = "SELECT * FROM account_received WHERE type='Z' ";
$query_wms = mysqli_query($link, $sql_wms);
foreach ($query_wms as $wms) {
if (isset($arrayData[$wms['BillNo']]) && isset($wms['invoice_budget']) && isset($wms['invoice_no']) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) {
$arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget'];
if (isset($arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']])) {
$arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']] += $wms['invoice_budget'];
}
}
if (isset($arrayData[$wms['BillNo']]) && isset($wms['received_budget']) && isset($arrayData[$wms['BillNo']]['received_budget'])) {
$arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget'];
}
}
foreach ($arrayData as $key => &$value) { foreach ($arrayData as $key => &$value) {
@ -239,10 +254,12 @@ foreach ($arrayData as $key => &$value) {
} }
$excel_aray = array(); $excel_aray = array();
$print_array = array();
foreach ($arrayData as $key => $value) { foreach ($arrayData as $key => $value) {
$uninvoice_budget = $value['OAmountWithTax'] - $value['invoice_budget']; $uninvoice_budget = $value['OAmountWithTax'] - $value['invoice_budget'];
$unreceive_budget = $value['receivable_budget'] - $value['received_budget']; $unreceive_budget = $value['receivable_budget'] - $value['received_budget'];
$collect_month = $value['month']==0? '0':$value['month'];
$excel_aray[$key] = [ $excel_aray[$key] = [
$value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'], $value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'],
@ -250,11 +267,22 @@ foreach ($arrayData as $key => $value) {
$value['ManagerId'], $value['ManagerName'], $value['ManagerId'], $value['ManagerName'],
number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])), number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])),
number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)), number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)),
number_format(round($value['received_budget'])), $unreceive_budget, $value['month'] number_format(round($value['received_budget'])), $unreceive_budget, $collect_month
]; ];
if ($excel_aray[$key][14] > 1) {
$print_array[$key] = [
$value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'],
$value['DeptName'], $value['PersonId'], $value['PersonName'],
$value['ManagerId'], $value['ManagerName'],
number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])),
number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)),
number_format(round($value['received_budget'])), $unreceive_budget, $collect_month
];
}
} }
$total_data = json_encode($excel_aray); $total_data = json_encode($print_array);
?> ?>
<style> <style>
@ -385,11 +413,12 @@ include "./footer.php";
<tr> <tr>
<th style='text-align:center;vertical-align: middle;width:140px'>合約號</th> <th style='text-align:center;vertical-align: middle;width:140px'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:100px'>合約日期</th> <th style='text-align:center;vertical-align: middle;width:100px'>合約日期</th>
<th style='text-align:center;vertical-align: middle;'>客戶編號</th>
<th style='text-align:center;vertical-align: middle;width:140px'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th> <th style='text-align:center;vertical-align: middle;width:110px'>部門</th>
<th style='text-align:center;vertical-align: middle;'>主管</th> <th style='text-align:center;vertical-align: middle;'>主管</th>
<th style='text-align:center;vertical-align: middle;'>契約員</th> <th style='text-align:center;vertical-align: middle;'>保養員</th>
<th style='text-align:center;vertical-align: middle;'>客戶編號</th>
<th style='text-align:center;vertical-align: middle;width:140px'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;'>合約總金額</th> <th style='text-align:center;vertical-align: middle;'>合約總金額</th>
<th style='text-align:center;vertical-align: middle;'>應收金額</th> <th style='text-align:center;vertical-align: middle;'>應收金額</th>
<th style='text-align:center;vertical-align: middle;'>已開金額</th> <th style='text-align:center;vertical-align: middle;'>已開金額</th>
@ -405,11 +434,12 @@ include "./footer.php";
<tr class="data-row" style="display: '';" id="<?= $key; ?>"> <tr class="data-row" style="display: '';" id="<?= $key; ?>">
<td style='text-align:center;vertical-align: middle;' class="contract"><?= $row[0]; ?></td> <td style='text-align:center;vertical-align: middle;' class="contract"><?= $row[0]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="contractdate"><?= $row[1]; ?></td> <td style='text-align:center;vertical-align: middle;' class="contractdate"><?= $row[1]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="customerid"><?= $row[2] ?></td>
<td style='text-align:center;vertical-align: middle;' class="customername"><?= $row[3] ?></td>
<td style='text-align:center;vertical-align: middle;' class="department"><?= $row[4] ?></td> <td style='text-align:center;vertical-align: middle;' class="department"><?= $row[4] ?></td>
<td style='text-align:center;vertical-align: middle;' class="manager"><?= $row[7] . "<br>" . $row[8]; ?></td> <td style='text-align:center;vertical-align: middle;' class="manager"><?= $row[7] . "<br>" . $row[8]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="personId"><?= $row[5] . "<br>" . $row[6]; ?></td> <td style='text-align:center;vertical-align: middle;' class="personId"><?= $row[5] . "<br>" . $row[6]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="customerid"><?= $row[2] ?></td>
<td style='text-align:center;vertical-align: middle;' class="customername"><?= $row[3] ?></td>
<td style='text-align:end;vertical-align: middle;' class="total_budget"><?= $row[9]; ?></td> <td style='text-align:end;vertical-align: middle;' class="total_budget"><?= $row[9]; ?></td>
<td style='text-align:end;vertical-align: middle;' class="receivable_budget"><?= $row[10]; ?></td> <td style='text-align:end;vertical-align: middle;' class="receivable_budget"><?= $row[10]; ?></td>
<td style='text-align:end;vertical-align: middle;' class="invoice_budget"><?= $row[11]; ?></td> <td style='text-align:end;vertical-align: middle;' class="invoice_budget"><?= $row[11]; ?></td>

BIN
wms/account-receivable-repair.xlsx

Binary file not shown.

2
wms/account-receivable.txt

File diff suppressed because one or more lines are too long

62
wms/class/Cmail.php

@ -0,0 +1,62 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
class Cmail
{
public $charset = "";
public $host = "";
public $port = "";
public $smtp_user = "";
public $smtp_pwd = "";
function __construct($charset='', $fromemail='')
{
include dirname(__DIR__)."/PHPMailer/Exception.php";
include dirname(__DIR__)."/PHPMailer/PHPMailer.php";
include dirname(__DIR__)."/PHPMailer/SMTP.php";
$this->charset = "UTF-8";
$this->host = "mail.masada.com.tw";
$this->port = 25;
$this->smtp_user = "notice"; // 這裡填寫SMTP登入帳號, 例如 your.gmail.name@gmail.com 則填寫your.gmail.name
$this->smtp_pwd = "90493119"; // 這裡填寫SMTP登入密碼
}
function sendx($subject="", $em_body="", $sendlist=array(), $from="永佳捷科技", $bcc="", $files=array())
{
if (!$sendlist) return;
$em_body = nl2br($em_body);
$em_body .= "<p>※此信件為系統發出信件,請勿直接回覆。</p>";
$mail = new PHPMailer(true);
$mail->IsHTML(true); //設定是否使用HTML格式
$mail->CharSet = $this->charset;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = $this->host;
$mail->Port = $this->port;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //使用SSL, 如果是TLS 請改為 PHPMailer::ENCRYPTION_STARTTLS
$mail->Username = $this->smtp_user;
$mail->Password = $this->smtp_pwd;
$mail->SMTPSecure = "";
$mail->From = "notice@masada.com.tw";
$mail->FromName = $from;
$mail->Subject = $subject;
$mail->Body = $em_body;
foreach ($sendlist as $v) { // $sendlist[0]=['M0044', 'jrbin@masada.com.tw']
list($name, $email) = $v;
if ($email) $mail->addAddress($email, $name);
}
//$mail->addCC("personC@gmail.com", "person C");
//$mail->addBCC("personD@gmail.com", "person D");
//$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg
//print_r($mail);exit;
if (!$mail->Send()){
// echo "Mailer error: " . $mail->ErrorInfo;
} else {
//echo "Email sent";
}
}
}

109
wms/class/Cnotice.php

@ -0,0 +1,109 @@
<?php
//ini_set('display_errors', 'on');
class Cnotice
{
function __construct()
{
}
function connectionDB()
{
$envFile = __DIR__ . '/../../.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");
}
}
}
date_default_timezone_set("Asia/Taipei");
$host = getenv('DB_HOST');
$dbport = getenv('DB_PORT');
$dbuser = getenv('DB_USERNAME');
$dbpassword = getenv('DB_PASSWORD');
$dbname = getenv('DB_DATABASE');
try {
$options = [
PDO::ATTR_PERSISTENT => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
];
$pdo = new PDO('mysql:host=' . $host . ';port=' . $dbport . ';dbname=' . $dbname . '', $dbuser, $dbpassword, $options);
$pdo->exec('SET CHARACTER SET utf8mb4');
return $pdo;
} catch (PDOException $e) {
die("Something wrong: {$e->getMessage()}");
}
}
/**
* 結束資料庫連線
*/
function endConnectionDB($pdo)
{
unset($pdo);
}
/**
* 提交消息 notice
* @param string $kind : 類別 1=系統 2=會議
* @param int $related_id : 關聯序號
* @param string $title : 標題
* @param string $title : 內容
* @param string $permission : 瀏覽權限 員編/ALL=全體
* @param string $creater : 建立者
* @param string $create_at : 建立時間
*/
function sendx($data)
{
$kind = $data['kind'];
$related_id = $data['related_id'];
$title = $data['title'];
$content = $data['content'];
$permission = $data['permission'];
$creater = $data['creater'];
$create_at = $data['create_at'];
$pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4');
$str = "
INSERT INTO `notice` (`kind`, `related_id`, `title`, `content`, `permission`, `creater`, `create_at`)
VALUES (?,?,?,?,?,?,?)
";
$sth = $pdo->prepare($str);
$sth->bindValue(1, $kind);
$sth->bindValue(2, $related_id);
$sth->bindValue(3, $title);
$sth->bindValue(4, $content);
$sth->bindValue(5, $permission);
$sth->bindValue(6, $creater);
$sth->bindValue(7, $create_at);
$sth->execute();
$this->endConnectionDB($pdo);
}
}
// $cn = new Cnotice();
// $data = array(
// 'kind' => 1,
// 'related_id' => 1,
// 'title' => "標題",
// 'content' => "內容",
// 'permission' => "M0117",
// 'creater' => "M0117",
// 'create_at' => date("Y-m-d H:i:s")
// );
// $cn->sendx($data);

31
wms/contract_b-index-model.php

@ -0,0 +1,31 @@
<?php
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
// AJAX 顯示合約明細
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'showDetail') {
$billno = $_POST['billno'];
$sql = "
SELECT
siad.IncomeId,
cft.FeeTypeName,
FLOOR(siad.SQuantity) AS SQuantity,
FLOOR(siad.SPrice) AS SPrice,
FLOOR(siad.OAmount) AS OAmount,
FLOOR(siad.OTax) AS OTax,
FLOOR(siad.OAmountWithTax) AS OAmountWithTax,
siad.ProjectId,
siad.CU_MaterialId,
siad.CU_EstPayDate
FROM salIncomeApplyDetail AS siad
LEFT JOIN comFeeType AS cft
ON siad.IncomeId = cft.FeeTypeId
WHERE BillNo = '$billno'
ORDER BY siad.CU_EstPayDate ASC
";
$result = $conn->query($sql);
$data = $result->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($data, JSON_UNESCAPED_UNICODE);
}
}

1
wms/contract_b-index.php

@ -306,4 +306,5 @@ endif;
mysqli_close($link); mysqli_close($link);
include "footer.php"; include "footer.php";
?> ?>

311
wms/contract_m-index.php

@ -0,0 +1,311 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$department_id = accountidToDepartId($user_id);
// $contractno = getContractnoDetails($link, $user_id, $department_id, $contractno);
$sql = "
SELECT TOP 1000
sso_tmp.BillNo,
sso_tmp.BillDate,
sso_tmp.PersonId, --負責業務人
sso_tmp.SumOAmountWithTax,
cgp.PersonName,
cd.DeptName,
sso_tmp.BizPartnerId,
sso_tmp.fsso_status, -- 發票狀態
CASE
WHEN awob_tmp.status IS NOT NULL THEN 'true'
ELSE 'false'
END AS awob_status, -- 收款狀態
sso_tmp.BizPartnerName
FROM (
SELECT
sso.BillNo,
sso.BillDate,
sso.PersonId, --負責業務人
ssod.SumOAmountWithTax,
sso.BizPartnerId,
'true' AS fsso_status,
cbp.BizPartnerName
FROM salSalesOrder AS sso
LEFT JOIN (
SELECT
BillNo,
SUM(OAmountWithTax) SumOAmountWithTax
FROM salSalesOrderDetail
GROUP BY BillNo
)AS ssod ON sso.BillNo = ssod.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON sso.BizPartnerId = cbp.BizPartnerId
WHERE sso.BillNo IN
(
SELECT FromSalSalesOrder
FROM arCheckBillDetail
)
AND sso.TypeId = 'SP'
UNION
SELECT
sso.BillNo,
sso.BillDate,
sso.PersonId, --負責業務人,
ssod.SumOAmountWithTax,
sso.BizPartnerId,
'false' AS fsso_status,
cbp.BizPartnerName
FROM salSalesOrder AS sso
LEFT JOIN (
SELECT
BillNo,
SUM(OAmountWithTax) SumOAmountWithTax
FROM salSalesOrderDetail
GROUP BY BillNo
)AS ssod ON sso.BillNo = ssod.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON sso.BizPartnerId = cbp.BizPartnerId
WHERE sso.BillNo NOT IN
(
SELECT FromSalSalesOrder
FROM arCheckBillDetail
)
AND sso.TypeId = 'SP'
)AS sso_tmp
LEFT JOIN (
SELECT DISTINCT
c.OrderBillNo,
'1' AS status
FROM arWriteOffBill AS a
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo
LEFT JOIN
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c
ON a.BillNo=c.BillNo
WHERE DATALENGTH(c.OrderBillNo) >0
)AS awob_tmp
ON sso_tmp.BillNo = awob_tmp.OrderBillNo
LEFT JOIN comPerson AS cp -- 員工主檔
ON sso_tmp.PersonId = cp.PersonId
LEFT JOIN comGroupPerson AS cgp
ON cp. PersonId = cgp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
WHERE 1=1
";
$sql .= !empty($contractno) ? " AND sso_tmp.BillNo = '$contractno' " : "";
// echo "<pre>";
// echo $sql;
// echo "</pre>";
// exit;
// $sql .= !empty($contractno) ? " AND sso_tmp.BillNo IN ($contractno)" : "";
$data = $conn->query($sql);
function checkCollectMonth($row)
{
$BillDate = $row['BillDate'];
if (collect_month(strtotime($BillDate)) >= 3) {
return "<span class='text-danger'>" . collect_month(strtotime($BillDate)) . "</span>";
} else {
return "<span class=''>" . collect_month(strtotime($BillDate)) . "</span>";
}
}
function getFixDetails($conn, $row)
{
$BillNo = $row['BillNo'];
$sql = "
SELECT
ssod.MaterialId,
cmg.MaterialName,
ssod.OAmountWithTax
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON sso.BillNo = ssod.BillNo
LEFT JOIN comMaterialGroup AS cmg
ON ssod.MaterialId = cmg.MaterialId
WHERE sso.BillNo = '$BillNo'
";
$data = $conn->query($sql);
$str = "";
foreach ($data as $row) {
$str .= $row['MaterialId'] . "_";
$str .= $row['MaterialName'] . ":";
$str .= number_format(intval($row['OAmountWithTax'])) . "<br/>";
}
return $str;
}
?>
<?php if ($user_auth & 2) { ?>
<!-- <p>
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p> -->
<?php
}
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='fix_contract_payment_status.php?<?= $token_link ?>'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="5">
<h3 style='text-align:center'>新梯合約管理</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<a href="contract-repair/contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;width:120px;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>部門</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>單據號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>單據日期</th>
<!-- <th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th> -->
<th style='text-align:center;vertical-align: middle;width:120px;'>金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票狀態</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>收款狀態</th>
<th style='text-align:center;vertical-align: middle;width:250px;'>修理明細</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo $row['PersonId'];
echo "<br/>";
echo $row['PersonName'];
?>
</td>
<td>
<?php echo $row['DeptName']; ?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['BizPartnerName']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['BillDate'])); ?>
</td>
<!-- <td>
<?php echo $row['awob_status'] == 'true' ? '0' : checkCollectMonth($row); ?>
</td> -->
<td>
<?php echo number_format(intval($row['SumOAmountWithTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['fsso_status'] == 'true'
? '<span class="text-primary">已開發票</span>'
: '<span class="text-danger">未開發票</span>'; ?>
</td>
<td>
<?php echo $row['awob_status'] == 'true'
? '<span class="text-primary">已收款</span>'
: '<span class="text-danger">未收款</span>'; ?>
</td>
<td style='text-align:left;'>
<?php
echo getFixDetails($conn, $row);
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
$(function() {
document.getElementById('loadingOverlay').classList.add('hidden');
})
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

5
wms/css/view/wipwhole-index.php

@ -148,7 +148,8 @@
} }
.modal .back { .modal .back {
position: absolute; position: fixed;
z-index: 99998;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
@ -159,7 +160,7 @@
/* Modal Content */ /* Modal Content */
.modal-content { .modal-content {
z-index: 9; z-index: 99999;
background-color: #fefefe; background-color: #fefefe;
margin: auto; margin: auto;
padding: 20px; padding: 20px;

269
wms/day_off/ship_run_chart.php

@ -0,0 +1,269 @@
<?php
// ini_set('display_errors', 'on');
include "header.php";
// 出貨台數
function getShipping($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 在裝台數
function getInstalling($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND (
install_end_date IS NULL
OR install_end_date = ''
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 完工台數
function getInstalling2($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND install_end_date IS NOT NULL
AND install_end_date != ''
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// QC台數
function getQCing($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND end_qc_date IS NOT NULL
AND end_qc_date != ''
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 移交台數
function getDeliverying($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND delivery_date IS NOT NULL
AND delivery_date != ''
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
$contract_type = [
'' => '新梯 + 汰改',
'A' => '新梯',
'B' => '汰改'
];
foreach ($contract_type as $c_val => $c_key) {
?>
<table class="table table-striped table-bordered" style="width:98.5%;overflow-x:auto">
<thead>
<tr>
<th style='text-align:center;vertical-align:middle;' colspan='15'>
<h4>出貨完工推移表(<?php echo $c_key; ?>)</h4>
</th>
</tr>
<tr>
<th style='text-align:center;width:150px;vertical-align:middle;' rowspan='2'>階段台數</th>
<th style='text-align:center;width:150px;vertical-align:middle;' rowspan='2'>年度</th>
<th style='text-align:center;vertical-align:middle;' colspan='12'>月份</th>
<th style='text-align:center;vertical-align:middle;' rowspan='2'>合計</th>
</tr>
<tr>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td style='text-align:center;'>" . $i . "月</td>";
}
?>
</tr>
</thead>
<tbody>
<?php
$type_arr = [
'A' => '出貨台數',
'B' => '在裝台數',
'C' => '完工台數',
'D' => 'QC台數',
'E' => '移交台數'
];
foreach ($type_arr as $val => $key) {
?>
<tr>
<td style='text-align:center;vertical-align:middle;' rowspan='2'>
<?php
echo $key;
echo "<br/>";
if ($val == 'A')
echo "<span style='font-size:12px;'>有出貨日</span>";
if ($val == 'B')
echo "<span style='font-size:12px;'>有安裝開工日,沒安裝完工日</span> ";
if ($val == 'C')
echo "<span style='font-size:12px;'>有安裝完工日</span> ";
if ($val == 'D')
echo "<span style='font-size:12px;'>有QC完工日</span> ";
if ($val == 'E')
echo "<span style='font-size:12px;'>移交日</span> ";
?>
</td>
<td>前一年度(<?php echo (date("Y") - 1); ?>)</td>
<?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
$d_count = 0;
$e_count = 0;
for ($i = 1; $i <= 12; $i++) {
if ($val == 'A') {
$a = getShipping($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
echo '<td style="text-align:center;">' . $a . '</td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
echo '<td style="text-align:center;">' . $b . '</td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
echo '<td style="text-align:center;">' . $c . '</td>';
}
if ($val == 'D') {
$d = getQCing($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
echo '<td style="text-align:center;">' . $d . '</td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
echo '<td style="text-align:center;">' . $e . '</td>';
}
}
if ($val == 'A')
echo '<td style="text-align:center;">' . $a_count . '</td>';
if ($val == 'B')
echo '<td style="text-align:center;">' . $b_count . '</td>';
if ($val == 'C')
echo '<td style="text-align:center;">' . $c_count . '</td>';
if ($val == 'D')
echo '<td style="text-align:center;">' . $d_count . '</td>';
if ($val == 'E')
echo '<td style="text-align:center;">' . $e_count . '</td>';
?>
</tr>
<tr>
<td>本年度(<?php echo date("Y"); ?>)</td>
<?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
$d_count = 0;
$e_count = 0;
for ($i = 1; $i <= 12; $i++) {
if ($val == 'A') {
$a = getShipping($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
echo '<td style="text-align:center;">' . $a . '</td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
echo '<td style="text-align:center;">' . $b . '</td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
echo '<td style="text-align:center;">' . $c . '</td>';
}
if ($val == 'D') {
$d = getQCing($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
echo '<td style="text-align:center;">' . $d . '</td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
echo '<td style="text-align:center;">' . $e . '</td>';
}
}
if ($val == 'A')
echo '<td style="text-align:center;">' . $a_count . '</td>';
if ($val == 'B')
echo '<td style="text-align:center;">' . $b_count . '</td>';
if ($val == 'C')
echo '<td style="text-align:center;">' . $c_count . '</td>';
if ($val == 'D')
echo '<td style="text-align:center;">' . $d_count . '</td>';
if ($val == 'E')
echo '<td style="text-align:center;">' . $e_count . '</td>';
?>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>

585
wms/delivery_kpi.php

@ -0,0 +1,585 @@
<?php
include("header.php");
$this_year = 2024;
$expected_a['2024'] = [
1 => 10,
2 => 20,
3 => 10,
4 => 26,
5 => 13,
6 => 26,
7 => 13,
8 => 26,
9 => 13,
10 => 26,
11 => 13,
12 => 14
];
$real_a['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_b['2024'] = [
1 => 15,
2 => 30,
3 => 15,
4 => 40,
5 => 20,
6 => 40,
7 => 20,
8 => 40,
9 => 20,
10 => 40,
11 => 20,
12 => 30
];
$real_b['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_c['2024'] = [
1 => 18,
2 => 18,
3 => 19,
4 => 20,
5 => 20,
6 => 20,
7 => 20,
8 => 20,
9 => 20,
10 => 20,
11 => 20,
12 => 20
];
$real_c['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_d['2024'] = [
1 => 12650,
2 => 12650,
3 => 12650,
4 => 18150,
5 => 18150,
6 => 19800,
7 => 23650,
8 => 23650,
9 => 23650,
10 => 26400,
11 => 26400,
12 => 26400
];
$real_d['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_e['2024'] = [
1 => 192,
2 => 192,
3 => 192,
4 => 272,
5 => 272,
6 => 272,
7 => 272,
8 => 272,
9 => 272,
10 => 272,
11 => 272,
12 => 272
];
$real_e['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_f['2024'] = [
1 => 822,
2 => 957,
3 => 1092,
4 => 1227,
5 => 1362,
6 => 1497,
7 => 2162,
8 => 2297,
9 => 2432,
10 => 2567,
11 => 2702,
12 => 2838,
];
$real_f['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
function getMAdetails($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
$sql = "
-- 全機汰改
SELECT
count(*)
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON ssod.BillNo = sso.BillNo
WHERE ssod.MaterialId = 'A40010'
AND SUBSTRING(CONVERT(VARCHAR, sso.BillDate, 112), 1, 6) = '$date'
-- AND SUBSTR(sso.CustomerOrderDate, 1, 6) = '$date',
";
$result = $conn->query($sql);
foreach ($result as $row) {
return $row[0];
}
}
function getM1details($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
$sql = "
-- M1汰改
SELECT
count(*)
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON ssod.BillNo = sso.BillNo
where ssod.MaterialId = 'A40002'
AND SUBSTRING(CONVERT(VARCHAR, sso.BillDate, 112), 1, 6) = '$date'
-- AND SUBSTR(sso.CustomerOrderDate, 1, 6) = '$date',
";
$result = $conn->query($sql);
foreach ($result as $row) {
return $row[0];
}
}
function getM1Freedetails($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
$sql = "
-- M1汰改送免費一年保養
SELECT
count(*)
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON ssod.BillNo = sso.BillNo
where ssod.PresentSQty >0
AND SUBSTRING(CONVERT(VARCHAR, sso.BillDate, 112), 1, 6) = '$date'
-- AND SUBSTR(sso.CustomerOrderDate, 1, 6) = '$date',
";
$result = $conn->query($sql);
foreach ($result as $row) {
return $row[0];
}
}
function getMContractAllAmount($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
$sql = "
SELECT
SUM(T.OAmountWithTax) AS OAmountWithTax
FROM(
-- 全機汰改
SELECT
SUM(ssod.OAmountWithTax) AS OAmountWithTax
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON ssod.BillNo = sso.BillNo
WHERE ssod.MaterialId = 'A40010'
AND SUBSTRING(CONVERT(VARCHAR, sso.BillDate, 112), 1, 6) = '$date'
-- AND SUBSTR(sso.CustomerOrderDate, 1, 6) = '$date',
UNION ALL
-- M1汰改
SELECT
SUM(ssod.OAmountWithTax) AS OAmountWithTax
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON ssod.BillNo = sso.BillNo
where ssod.MaterialId = 'A40002'
AND SUBSTRING(CONVERT(VARCHAR, sso.BillDate, 112), 1, 6) = '$date'
-- AND SUBSTR(sso.CustomerOrderDate, 1, 6) = '$date',
UNION ALL
-- M1汰改送免費一年保養
SELECT
SUM(ssod.OAmountWithTax) AS OAmountWithTax
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON ssod.BillNo = sso.BillNo
where ssod.PresentSQty >0
AND SUBSTRING(CONVERT(VARCHAR, sso.BillDate, 112), 1, 6) = '$date'
-- AND SUBSTR(sso.CustomerOrderDate, 1, 6) = '$date',
) AS T
";
// echo "<pre>$sql</pre>";
$result = $conn->query($sql);
foreach ($result as $row) {
return $row[0];
}
}
function getMataincedetails($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
$sql = "
-- 保養合約
SELECT
COUNT(sia_tmp.CU_MaterialId)
FROM(
SELECT
MIN(siam.BillDate) AS BillDate,
siad.CU_MaterialId
FROM salIncomeApplyMaster AS siam
LEFT JOIN salIncomeApplyDetail AS siad
ON siam.BillNo = siad.BillNo
GROUP BY siad.CU_MaterialId
)AS sia_tmp
WHERE 1=1
AND SUBSTRING(CONVERT(VARCHAR, sia_tmp.BillDate, 112), 1, 6) = '$date'
";
$result = $conn->query($sql);
foreach ($result as $row) {
return $row[0];
}
}
function getFixdetails($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
$sql = "
SELECT
SUM(sia_tmp.OAmountWithTax) AS OAmountWithTax
FROM(
SELECT
sdlm.BillDate AS BillDate,
sdld.OAmountWithTax
FROM salDispatchListMaster AS sdlm
LEFT JOIN salDispatchListDetail AS sdld
ON sdlm.BillNo = sdld.BillNo
)AS sia_tmp
WHERE 1=1
AND SUBSTRING(CONVERT(VARCHAR, sia_tmp.BillDate, 112), 1, 6) = '$date'
";
// echo $sql;
$result = $conn->query($sql);
foreach ($result as $row) {
return $row[0];
}
}
?>
<table class="table table-striped table-bordered" style="width:98.5%;overflow-x:auto">
<thead>
<tr>
<th style='text-align:center;vertical-align:middle;' colspan='17'>
<h4><?php echo date("Y"); ?>年指標與實績</h4>
</th>
</tr>
<tr>
<th style='text-align:center;width:150px;vertical-align:middle;' colspan='2'>項目</th>
<th style='text-align:center;width:100px;vertical-align:middle;'><?php echo (date("Y") - 1); ?></th>
<th style='text-align:center;vertical-align:middle;'>月份</th>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td style='text-align:center;'>" . $i . "月</td>";
}
?>
<th style='text-align:center;vertical-align:middle;' rowspan='2'>累計</th>
</tr>
<tr>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">1</td>
<td rowspan="3">舊梯全汰改(合約台數)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_a_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_a_count += $expected_a[$this_year][$i];
echo "<td>" . $expected_a[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_a_count; ?></td>
</tr>
<tr>
<td>實際</td>
<?php
$real_a_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_a[$this_year][$i] = getMAdetails($conn, $this_year, $i);
$real_a_count += $real_a[$this_year][$i];
echo "<td>" . $real_a[$this_year][$i] . "</td>";
}
?>
<td><?php echo $real_a_count; ?></td>
</tr>
<tr>
<td>達成率</td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td>" . round(($real_a[$this_year][$i] / $expected_a[$this_year][$i]) * 100, 2) . "%" . "</td>";
}
?>
<td><?php echo round(($real_a_count / $expected_a_count) * 100, 2) . "%"; ?></td>
</tr>
<tr>
<td rowspan="6">2</td>
<td rowspan="3">舊梯M1改(合約台數)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_b_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_b_count += $expected_b[$this_year][$i];
echo "<td>" . $expected_b[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_b_count; ?></td>
</tr>
<tr>
<td>實際</td>
<?php
$real_b_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_b[$this_year][$i] = getM1details($conn, $this_year, $i);
$real_b_count += $real_b[$this_year][$i];
echo "<td>" . $real_b[$this_year][$i] . "</td>";
}
?>
<td><?php echo $real_b_count; ?></td>
</tr>
<tr>
<td>達成率</td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td>" . round(($real_b[$this_year][$i] / $expected_b[$this_year][$i]) * 100, 2) . "%" . "</td>";
}
?>
<td><?php echo round(($real_b_count / $expected_b_count) * 100, 2) . "%"; ?></td>
</tr>
<tr>
<td rowspan="3">保養簽長約,免費M1(合約台數)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_c_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_c_count += $expected_c[$this_year][$i];
echo "<td>" . $expected_c[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_c_count; ?></td>
</tr>
<tr>
<td>實際</td>
<?php
$real_c_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_c[$this_year][$i] = getM1Freedetails($conn, $this_year, $i);
$real_c_count += $real_c[$this_year][$i];
echo "<td>" . $real_c[$this_year][$i] . "</td>";
}
?>
<td><?php echo $real_c_count; ?></td>
</tr>
<tr>
<td>達成率</td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td>" . round(($real_c[$this_year][$i] / $expected_c[$this_year][$i]) * 100, 2) . "%" . "</td>";
}
?>
<td><?php echo round(($real_c_count / $expected_c_count) * 100, 2) . "%"; ?></td>
</tr>
<tr>
<td rowspan="3">3</td>
<td rowspan="3">汰改合計金額(千元)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_d_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_d_count += $expected_d[$this_year][$i];
echo "<td>" . $expected_d[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_d_count; ?></td>
</tr>
<tr>
<td>實際</td>
<?php
$real_d_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_d[$this_year][$i] = round(getMContractAllAmount($conn, $this_year, $i) / 1000, 0);
$real_d_count += $real_d[$this_year][$i];
echo "<td>" . $real_d[$this_year][$i] . "</td>";
}
?>
<td><?php echo $real_d_count; ?></td>
</tr>
<tr>
<td>達成率</td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td>" . round(($real_d[$this_year][$i] / $expected_d[$this_year][$i]) * 100, 2) . "%" . "</td>";
}
?>
<td><?php echo round(($real_d_count / $expected_d_count) * 100, 2) . "%"; ?></td>
</tr>
<tr>
<td rowspan="3">4</td>
<td rowspan="3">保養契約台數(合約台數)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_e_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_e_count += $expected_e[$this_year][$i];
echo "<td>" . $expected_e[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_e_count; ?></td>
</tr>
<tr>
<td>實際</td>
<?php
$real_e_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_e[$this_year][$i] = getMataincedetails($conn, $this_year, $i, $real_e[$this_year]);
$real_e_count += $real_e[$this_year][$i];
echo "<td>" . $real_e[$this_year][$i] . "</td>";
}
?>
<td><?php echo $real_e_count; ?></td>
</tr>
<tr>
<td>達成率</td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td>" . round(($real_e[$this_year][$i] / $expected_e[$this_year][$i]) * 100, 2) . "%" . "</td>";
}
?>
<td><?php echo round(($real_e_count / $expected_e_count) * 100, 2) . "%"; ?></td>
</tr>
<tr>
<td rowspan="3">5</td>
<td rowspan="3">修理金額(千元)/台.年</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_f_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_f_count += $expected_f[$this_year][$i];
echo "<td>" . $expected_f[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_f_count; ?></td>
</tr>
<tr>
<td>實際</td>
<?php
$real_f_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_f[$this_year][$i] = round(getFixdetails($conn, $this_year, $i) / 1000, 0);
$real_f_count += $real_f[$this_year][$i];
echo "<td>" . $real_f[$this_year][$i] . "</td>";
}
?>
<td><?php echo $real_f_count; ?></td>
</tr>
<tr>
<td>達成率</td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td>" . round(($real_f[$this_year][$i] / $expected_f[$this_year][$i]) * 100, 2) . "%" . "</td>";
}
?>
<td><?php echo round(($real_f_count / $expected_f_count) * 100, 2) . "%"; ?></td>
</tr>
</tbody>
</table>
<?php
include("footer.php");
?>

311
wms/fix_contract_payment_status.php

@ -0,0 +1,311 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$department_id = accountidToDepartId($user_id);
// $contractno = getContractnoDetails($link, $user_id, $department_id, $contractno);
$sql = "
SELECT TOP 1000
sso_tmp.BillNo,
sso_tmp.BillDate,
sso_tmp.PersonId, --負責業務人
sso_tmp.SumOAmountWithTax,
cgp.PersonName,
cd.DeptName,
sso_tmp.BizPartnerId,
sso_tmp.fsso_status, -- 發票狀態
CASE
WHEN awob_tmp.status IS NOT NULL THEN 'true'
ELSE 'false'
END AS awob_status, -- 收款狀態
sso_tmp.BizPartnerName
FROM (
SELECT
sso.BillNo,
sso.BillDate,
sso.PersonId, --負責業務人
ssod.SumOAmountWithTax,
sso.BizPartnerId,
'true' AS fsso_status,
cbp.BizPartnerName
FROM salSalesOrder AS sso
LEFT JOIN (
SELECT
BillNo,
SUM(OAmountWithTax) SumOAmountWithTax
FROM salSalesOrderDetail
GROUP BY BillNo
)AS ssod ON sso.BillNo = ssod.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON sso.BizPartnerId = cbp.BizPartnerId
WHERE sso.BillNo IN
(
SELECT FromSalSalesOrder
FROM arCheckBillDetail
)
AND sso.TypeId = 'SP'
UNION
SELECT
sso.BillNo,
sso.BillDate,
sso.PersonId, --負責業務人,
ssod.SumOAmountWithTax,
sso.BizPartnerId,
'false' AS fsso_status,
cbp.BizPartnerName
FROM salSalesOrder AS sso
LEFT JOIN (
SELECT
BillNo,
SUM(OAmountWithTax) SumOAmountWithTax
FROM salSalesOrderDetail
GROUP BY BillNo
)AS ssod ON sso.BillNo = ssod.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON sso.BizPartnerId = cbp.BizPartnerId
WHERE sso.BillNo NOT IN
(
SELECT FromSalSalesOrder
FROM arCheckBillDetail
)
AND sso.TypeId = 'SP'
)AS sso_tmp
LEFT JOIN (
SELECT DISTINCT
c.OrderBillNo,
'1' AS status
FROM arWriteOffBill AS a
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo
LEFT JOIN
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c
ON a.BillNo=c.BillNo
WHERE DATALENGTH(c.OrderBillNo) >0
)AS awob_tmp
ON sso_tmp.BillNo = awob_tmp.OrderBillNo
LEFT JOIN comPerson AS cp -- 員工主檔
ON sso_tmp.PersonId = cp.PersonId
LEFT JOIN comGroupPerson AS cgp
ON cp. PersonId = cgp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
WHERE 1=1
";
$sql .= !empty($contractno) ? " AND sso_tmp.BillNo = '$contractno' " : "";
// echo "<pre>";
// echo $sql;
// echo "</pre>";
// exit;
// $sql .= !empty($contractno) ? " AND sso_tmp.BillNo IN ($contractno)" : "";
$data = $conn->query($sql);
function checkCollectMonth($row)
{
$BillDate = $row['BillDate'];
if (collect_month(strtotime($BillDate)) >= 3) {
return "<span class='text-danger'>" . collect_month(strtotime($BillDate)) . "</span>";
} else {
return "<span class=''>" . collect_month(strtotime($BillDate)) . "</span>";
}
}
function getFixDetails($conn, $row)
{
$BillNo = $row['BillNo'];
$sql = "
SELECT
ssod.MaterialId,
cmg.MaterialName,
ssod.OAmountWithTax
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON sso.BillNo = ssod.BillNo
LEFT JOIN comMaterialGroup AS cmg
ON ssod.MaterialId = cmg.MaterialId
WHERE sso.BillNo = '$BillNo'
";
$data = $conn->query($sql);
$str = "";
foreach ($data as $row) {
$str .= $row['MaterialId'] . "_";
$str .= $row['MaterialName'] . ":";
$str .= number_format(intval($row['OAmountWithTax'])) . "<br/>";
}
return $str;
}
?>
<?php if ($user_auth & 2) { ?>
<!-- <p>
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p> -->
<?php
}
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='fix_contract_payment_status.php?<?= $token_link ?>'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="5">
<h3 style='text-align:center'>修理履歷</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>單據號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<a href="contract-repair/contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;width:120px;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>部門</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>單據號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>單據日期</th>
<!-- <th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th> -->
<th style='text-align:center;vertical-align: middle;width:120px;'>金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票狀態</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>收款狀態</th>
<th style='text-align:center;vertical-align: middle;width:250px;'>修理明細</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo $row['PersonId'];
echo "<br/>";
echo $row['PersonName'];
?>
</td>
<td>
<?php echo $row['DeptName']; ?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['BizPartnerName']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['BillDate'])); ?>
</td>
<!-- <td>
<?php echo $row['awob_status'] == 'true' ? '0' : checkCollectMonth($row); ?>
</td> -->
<td>
<?php echo number_format(intval($row['SumOAmountWithTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['fsso_status'] == 'true'
? '<span class="text-primary">已開發票</span>'
: '<span class="text-danger">未開發票</span>'; ?>
</td>
<td>
<?php echo $row['awob_status'] == 'true'
? '<span class="text-primary">已收款</span>'
: '<span class="text-danger">未收款</span>'; ?>
</td>
<td style='text-align:left;'>
<?php
echo getFixDetails($conn, $row);
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
$(function() {
document.getElementById('loadingOverlay').classList.add('hidden');
})
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

328
wms/fnh/faultreview-index.php

@ -2,162 +2,202 @@
include "../header.php"; include "../header.php";
$data = array(); $data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "handlestaff"); function getAllFacilitynos($link, $user_id)
// 張珈瑄、莊雅涵、賴定國、何維光可瀏覽近兩個月資料 {
if ($user_id == "M0061" || $user_id == "M0112" || $user_id == "C0004" || $user_id == "M0154") { $sql_cmd = sql_myself($user_id, "repairerid");
$last2mon = date("Y/m/d 00:00:00", strtotime("-2 month")); $sql = "
$sql_cmd = "where calltime >= '$last2mon'"; SELECT facilityno
FROM facility
$sql_cmd
";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return "'" . implode("','", array_column($data, 'facilityno')) . "'";
}
if (getAccounttype($link, $user_id) == "B") {
$facilitynos = getAllFacilitynos($link, $user_id);
} else if (in_array(accountidToDepartId($user_id), ['912', '220'])) {
$facilitynos = '';
} else if (in_array($user_id, ['M0061', 'M0112', 'C0004', 'M0154'])) {
$facilitynos = '';
} else {
$facilitynos = "'NA'";
} }
$sql = "select * from fault_notification_job_handling $sql_cmd order by id desc";
$data = mysqli_query($link,$sql); $last2mon = date("Y/m/d 00:00:00", strtotime("-2 month"));
/* $sql = "
$permissionsql = "select * from account_permission where permissiontype='B' and accountid='$user_id'"; SELECT
$permissiondata = mysqli_query($link,$permissionsql); *
$row = mysqli_fetch_array($permissiondata, MYSQLI_ASSOC); FROM fault_notification_job_handling
$permission = $row['permission']; WHERE 1 = 1
*/ AND calltime >= '$last2mon'
if ($user_auth&2) { ";
$sql .= !empty($facilitynos) ? " AND facilityno IN ($facilitynos)" : "";
$sql .= "
ORDER BY id DESC
";
$data = mysqli_query($link, $sql);
if ($user_auth & 2) {
?> ?>
<p><a href="fault-create.php?function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p> <p><a href="fault-create.php?function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p>
<?php <?php
} }
if ($data): if ($data) :
?> ?>
<style> <style>
table { table {
table-layout:fixed; table-layout: fixed;
width: 100%; width: 100%;
} }
td { td {
word-wrap:break-word; word-wrap: break-word;
} }
img { img {
width:125px; width: 125px;
} }
.width_style_1 { .width_style_1 {
width:125px; width: 125px;
} }
table{ table {
width:100%; width: 100%;
} }
#table_index_filter{
float:right;
}
#table_index_paginate{
float:right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
} #table_index_filter {
float: right;
}
@media screen and (max-width: 600px) { #table_index_paginate {
float: right;
table { }
border: 0;
} label {
display: inline-flex;
table thead { margin-bottom: .5rem;
display: none; margin-top: .5rem;
}
}
table tr {
margin-bottom: 10px; @media screen and (max-width: 600px) {
display: block;
border-bottom: 2px solid #ddd; table {
} border: 0;
}
table td {
display: block; table thead {
text-align: right; display: none;
font-size: 14px; }
border-bottom: 1px dotted #ccc;
} table tr {
margin-bottom: 10px;
table td:last-child { display: block;
border-bottom: 0; border-bottom: 2px solid #ddd;
} }
table td:before { table td {
content: attr(data-label); display: block;
float: left; text-align: right;
text-transform: uppercase; font-size: 14px;
font-weight: bold; border-bottom: 1px dotted #ccc;
} }
}
</style> table td:last-child {
<div style="overflow-x:auto;"> border-bottom: 0;
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> }
<thead>
<tr> table td:before {
<th>編號</th> content: attr(data-label);
<th>電梯編號</th> float: left;
<th>名稱</th> text-transform: uppercase;
<th>故障狀態</th> font-weight: bold;
<th>來電者</th> }
<th>地址</th> }
<!-- <th>棟別</th>--> </style>
<!-- <th>號機</th>--> <div style="overflow-x:auto;">
<!-- <th>廠牌</th>--> <table id="table_index" class="table table-striped table-bordered" style="width:100%">
<th>來電時間</th> <thead>
<th>處理人員</th> <tr>
<th>備註欄</th> <th>編號</th>
<?php //if($permission==0) {?> <th>電梯編號</th>
<?php if ($user_auth&2) { ?> <th>名稱</th>
<th>修改</th> <th>故障狀態</th>
<!-- <th>刪除</th>--> <th>來電者</th>
<?php }?> <th>地址</th>
</tr> <!-- <th>棟別</th>-->
</thead> <!-- <th>號機</th>-->
<tbody> <!-- <th>廠牌</th>-->
<?php <th>來電時間</th>
foreach($data as $key=>$data) : <th>處理人員</th>
?> <th>備註欄</th>
<tr> <?php //if($permission==0) {
<td><?php echo $key+1; ?></td> ?>
<td><?php echo $data['facilityno']; ?></td> <?php if ($user_auth & 2) { ?>
<td><a href="fault-detail.php?account=<?php echo $user_id;?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>"><?php echo $data['sitename']; ?></a></td> <th>修改</th>
<td><?php echo $data['faultstate']; ?></td> <!-- <th>刪除</th>-->
<td><?php echo $data['caller']; ?></td> <?php } ?>
<td><?php echo $data['address']; ?></td> </tr>
<!-- <td>--><?php //echo $data['buildingnumber']; ?><!--</td>--> </thead>
<!-- <td>--><?php //echo $data['positionnumber']; ?><!--</td>--> <tbody>
<!-- <td>--><?php //echo $data['brandmodel']; ?><!--</td>--> <?php
<td><?php echo $data['calltime']; ?></td> foreach ($data as $key => $data) :
<td><?php echo $data['handlestaff']; ?></td> ?>
<td><?php echo $data['remarks']; ?></td> <tr>
<?php //if($permission==0) {?> <td><?php echo $key + 1; ?></td>
<?php if ($user_auth&2) { ?> <td><?php echo $data['facilityno']; ?></td>
<td> <td><a href="fault-detail.php?account=<?php echo $user_id; ?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>"><?php echo $data['sitename']; ?></a></td>
<p> <td><?php echo $data['faultstate']; ?></td>
<a href="faultreview-edit.php?account=<?php echo $user_id;?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> <td><?php echo $data['caller']; ?></td>
<span class="glyphicon glyphicon-pencil"></span> <td><?php echo $data['address']; ?></td>
</a> <!-- <td>--><?php //echo $data['buildingnumber'];
</p> ?><!--</td>-->
</td> <!-- <td>--><?php //echo $data['positionnumber'];
<!-- <td>--> ?><!--</td>-->
<!-- <p>--> <!-- <td>--><?php //echo $data['brandmodel'];
<!-- <a href="faultreview-delete.php?account=--><?php //echo $user_id;?><!--&id=--><?php //echo $data['id']; ?><!--" class="btn btn-info btn-sm" onClick="return confirm('確定刪除?')">--> ?><!--</td>-->
<!-- <span class="glyphicon glyphicon-remove"></span>--> <td><?php echo $data['calltime']; ?></td>
<!-- </a>--> <td><?php echo $data['handlestaff']; ?></td>
<!-- </p>--> <td><?php echo $data['remarks']; ?></td>
<!----> <?php //if($permission==0) {
<!-- </td>--> ?>
<?php }?> <?php if ($user_auth & 2) { ?>
</tr> <td>
<?php endforeach; ?> <?php
</tbody> if (!in_array($data['caller'], ['system', 'system/Monarch', 'system/aijiati'])) {
</table> ?>
</div> <p>
<a href="faultreview-edit.php?account=<?php echo $user_id; ?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</p>
<?php
}
?>
</td>
<!-- <td>-->
<!-- <p>-->
<!-- <a href="faultreview-delete.php?account=--><?php //echo $user_id;
?><!--&id=--><?php //echo $data['id'];
?><!--" class="btn btn-info btn-sm" onClick="return confirm('確定刪除?')">-->
<!-- <span class="glyphicon glyphicon-remove"></span>-->
<!-- </a>-->
<!-- </p>-->
<!---->
<!-- </td>-->
<?php } ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php <?php
else: else :
echo "<h2>There is no record!</h2>"; echo "<h2>There is no record!</h2>";
endif; endif;

3
wms/fun_global.php

@ -199,6 +199,9 @@ function check_user_permission($user_id, $token)
'/wms/wipwhole-change-contractdate.php', '/wms/wipwhole-change-contractdate.php',
'/wms/wipwhole-change-planning-customer-name.php', '/wms/wipwhole-change-planning-customer-name.php',
'/wms/test.php', '/wms/test.php',
'/wms/delivery_kpi.php',
'/wms/contract_m-index.php',
'/wms/contract_b-index.php'
]; ];
if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return; if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return;

26
wms/gary.php

@ -1,8 +1,32 @@
<?php <?php
function getUserIP() {
$ip = $_SERVER['REMOTE_ADDR'];
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
// 检查客户端 IP 地址
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// 检查代理服务器传递的 IP 地址
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return $ip;
}
// 获取用户的 IP 地址
$user_ip = getUserIP();
echo $test = "123";
// 输出用户的 IP 地址
echo "用户的 IP 地址是:$user_ip";
exit;
$encodedString = urlencode("expression-index.php?function_name=expression&id=83"); $encodedString = urlencode("expression-index.php?function_name=expression&id=83");
?> ?>
<a href='/wms/login.php?redirect=<?php echo $encodedString;?>' target='_blank'>永佳捷外事系統</a> <a href='/wms/login.php?redirect=<?php echo $encodedString; ?>' target='_blank'>永佳捷外事系統</a>
<?php <?php
exit; exit;
// 接收 referer 參數 // 接收 referer 參數

BIN
wms/img/mail001.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

49
wms/maintainance_contract_payment_status.php

@ -5,10 +5,15 @@ include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料 // 設置一個空陣列來放資料
$data = array(); $data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; $contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$contractno = getContractnoDetails($link, $user_id, $contractno); $department_id = accountidToDepartId($user_id);
$contractno = getContractnoDetails($link, $user_id, $department_id, $contractno);
$sql = " $sql = "
SELECT SELECT
TOP 100
siam.PersonId,
cd.DeptName,
cbp.BizPartnerName,
siamd.RowNo, siamd.RowNo,
siamd.RowCode, siamd.RowCode,
siam.BillNo, siam.BillNo,
@ -25,6 +30,10 @@ $sql = "
FROM salIncomeApplyMaster AS siam -- 收入申請單 FROM salIncomeApplyMaster AS siam -- 收入申請單
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細 LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細
ON siam.BillNo = siamd.BillNo ON siam.BillNo = siamd.BillNo
LEFT JOIN comPerson AS cp -- 員工主檔
ON siam.PersonId = cp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
acbd.FromRowCode, acbd.FromRowCode,
@ -47,12 +56,14 @@ $sql .= "
AND asim.RowCode = acb_tmp.RowCode2 AND asim.RowCode = acb_tmp.RowCode2
LEFT JOIN arSellInvoice AS asi LEFT JOIN arSellInvoice AS asi
ON asim.BillNo = asi.BillNo ON asim.BillNo = asi.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON siam.BizPartnerId = cbp.BizPartnerId
WHERE 1 = 1 WHERE 1 = 1
"; ";
$sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : ""; $sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : "";
$data = $conn->query($sql); $data = $conn->query($sql);
function getContractnoDetails($link, $user_id, $contractno = null) function getContractnoDetails($link, $user_id, $department_id, $contractno = null)
{ {
$sql = " $sql = "
SELECT SELECT
@ -61,8 +72,13 @@ function getContractnoDetails($link, $user_id, $contractno = null)
LEFT JOIN con_maintance_examine_apply AS cmea LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no ON c.contractno = cmea.vol_no
WHERE 1 = 1 WHERE 1 = 1
AND cmea.salesman IN (" . getAccountids($link, $user_id) . ")
"; ";
if (!in_array($department_id, ['210', '220', '240'])) {
$sql .= " AND cmea.salesman IN (" . getAccountids($link, $user_id) . ")";
}
if (!empty($contractno)) { if (!empty($contractno)) {
$sql .= " $sql .= "
AND c.contractno = '$contractno' AND c.contractno = '$contractno'
@ -171,6 +187,16 @@ function arSellInvoiceMaterial($row)
} }
} }
function checkCollectMonth($row)
{
$CU_EstPayDate = $row['CU_EstPayDate'];
if (collect_month(strtotime($CU_EstPayDate)) >= 3) {
return "<span class='text-danger'>" . collect_month(strtotime($CU_EstPayDate)) . "</span>";
} else {
return "<span class=''>" . collect_month(strtotime($CU_EstPayDate)) . "</span>";
}
}
function checkArWriteOffBill($conn, $row) function checkArWriteOffBill($conn, $row)
{ {
$BillNo = $row['BillNo2']; $BillNo = $row['BillNo2'];
@ -295,9 +321,11 @@ if ($data) :
<thead> <thead>
<tr> <tr>
<th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th> <th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;'>部門</th>
<th style='text-align:center;vertical-align: middle;'>合約號</th> <th style='text-align:center;vertical-align: middle;'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th> <th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th>
<th style='text-align:center;vertical-align: middle;'>電梯編號</th> <th style='text-align:center;vertical-align: middle;'>電梯編號</th>
<th style='text-align:center;vertical-align: middle;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;'>預計請款日</th> <th style='text-align:center;vertical-align: middle;'>預計請款日</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th> <th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th> <th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th>
@ -311,9 +339,6 @@ if ($data) :
<th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th> <th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th> <th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th>
<th style='text-align:center;vertical-align: middle;'>核銷</th> <th style='text-align:center;vertical-align: middle;'>核銷</th>
<!-- <th style='text-align:center;vertical-align: middle;'>核銷日期</th>
<th style='text-align:center;vertical-align: middle;'>未核銷金額</th>
<th style='text-align:center;vertical-align: middle;'>已核銷金額</th> -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -321,11 +346,14 @@ if ($data) :
<tr> <tr>
<td> <td>
<?php <?php
echo getSalesmanNo($link, $row['BillNo']); echo $row['PersonId'];
echo "<br/>"; echo "<br/>";
echo getSalesmanName($link, $row['BillNo']); echo accountidToName($row['PersonId']);
?> ?>
</td> </td>
<td>
<?php echo $row['DeptName']; ?>
</td>
<td> <td>
<?php echo $row['BillNo']; ?> <?php echo $row['BillNo']; ?>
</td> </td>
@ -335,11 +363,14 @@ if ($data) :
<td> <td>
<?php echo $row['CU_MaterialId']; ?> <?php echo $row['CU_MaterialId']; ?>
</td> </td>
<td>
<?php echo $row['BizPartnerName']; ?>
</td>
<td> <td>
<?php echo date('Y/m/d', strtotime($row['CU_EstPayDate'])); ?> <?php echo date('Y/m/d', strtotime($row['CU_EstPayDate'])); ?>
</td> </td>
<td> <td>
<?php echo collect_month(strtotime($row['CU_EstPayDate'])); ?> <?php echo checkCollectMonth($row); ?>
</td> </td>
<td> <td>
<?php echo checkArCheckBillStatus($row); ?> <?php echo checkArCheckBillStatus($row); ?>

181
wms/maintainance_contract_payment_status2.php

@ -0,0 +1,181 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='maintainance_contract_payment_status.php?<?= $token_link ?>'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="5">
<h3 style='text-align:center'>保養合約-應收款項明細</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="button" id='serch_btn' onclick='drawDatatable()' style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;'>部門</th>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th>
<th style='text-align:center;vertical-align: middle;'>電梯編號</th>
<th style='text-align:center;vertical-align: middle;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;'>預計請款日</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th>
<th style='text-align:center;vertical-align: middle;'>請款金額(未轉應收)</th>
<th style='text-align:center;vertical-align: middle;'>請款金額(已轉應收)</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單號</th>
<th style='text-align:center;vertical-align: middle;'>發票狀態</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>發票單標示號</th>
<th style='text-align:center;vertical-align: middle;'>發票單號</th>
<th style='text-align:center;vertical-align: middle;'>發票明細</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th>
<th style='text-align:center;vertical-align: middle;'>核銷</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<?php
include "footer.php";
?>
<script>
function drawDatatable() {
$('#table_index2').DataTable().destroy();
$('#table_index2').DataTable({
"serverSide": true,
"ajax": {
"url": "maintainance_contract_payment_status_modal.php",
"type": "POST",
"dataType": "json",
"data": {
"user_id": "<?php echo $user_id; ?>",
"contractno": $("#contractno").val(),
},
},
"columns": [{
"data": "PersonId"
},
{
"data": "DeptName"
},
{
"data": "BillNo"
},
{
"data": "RowNo"
},
{
"data": "CU_MaterialId"
},
{
"data": "BizPartnerName"
},
{
"data": "CU_EstPayDate"
},
{
"data": "checkCollectMonth"
},
{
"data": "checkArCheckBillStatus"
},
{
"data": "UnTransCheckBLAmtWTax"
},
{
"data": "HadTransCheckBLAmtWTax"
},
{
"data": "BillNo2"
},
{
"data": "arSellInvoiceMaterial"
},
{
"data": "RowCode2"
},
{
"data": "BillNo3"
},
{
"data": "InvoiceName"
},
{
"data": "OAmountWithTax"
},
{
"data": "InvoiceNo"
},
{
"data": "checkArWriteOffBill"
}
]
});
}
$(document).ready(function() {
drawDatatable();
});
</script>

325
wms/maintainance_contract_payment_status_modal.php

@ -0,0 +1,325 @@
<?php
include "database.php";
include "fun_global.php";
function getContractnoDetails($link, $user_id, $department_id, $contractno = null)
{
$sql = "
SELECT
c.contractno
FROM contract AS c
LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no
WHERE 1 = 1
";
if (!in_array($department_id, ['210', '220', '240'])) {
$sql .= " AND cmea.salesman IN (" . getAccountids($link, $user_id) . ")";
}
if (!empty($contractno)) {
$sql .= "
AND c.contractno = '$contractno'
";
}
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row) {
array_push($data, $row['contractno']);
}
return "'" . implode("','", $data) . "'";
}
function getSalesmanNo($link, $contractno)
{
$sql = "
SELECT
cmea.salesman
FROM contract AS c
LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no
WHERE 1 = 1
AND c.contractno IN ('$contractno')
";
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row)
return $row['salesman'];
return "";
}
function getSalesmanName($link, $contractno)
{
$sql = "
SELECT
a.name
FROM contract AS c
LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no
LEFT JOIN account AS a
ON cmea.salesman = a.accountid
WHERE 1 = 1
AND c.contractno IN ('$contractno')
";
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row)
return $row['name'];
return "";
}
function getAccountids($link, $user_id)
{
$sql = "
SELECT
accountid
FROM account
WHERE 1 = 1
AND (accountid = '$user_id'
OR accountid IN (
SELECT
accountid
FROM account
WHERE 1 = 1
AND manager = '$user_id'
AND accounttype IN ('B','E','M','W')
)
)
";
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row) {
array_push($data, $row['accountid']);
}
return "'" . implode("','", $data) . "'";
}
function checkArCheckBillStatus($row)
{
$CU_EstPayDate = $row['CU_EstPayDate'];
$BillNo2 = $row['BillNo2'];
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) {
if (empty($BillNo2)) {
return "<span class='text-danger'>未轉應收確認單</span>";
} else {
return "<span class='text-primary'>已轉應收確認單</span>";
}
} else {
return "時間未到";
}
}
function arSellInvoiceMaterial($row)
{
$CU_EstPayDate = $row['CU_EstPayDate'];
$InvoiceName = $row['InvoiceName'];
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) {
if (empty($InvoiceName)) {
return "<span class='text-danger'>未開發票</span>";
} else {
return "<span class='text-primary'>已開發票</span>";
}
} else {
return "時間未到";
}
}
function checkCollectMonth($row)
{
$CU_EstPayDate = $row['CU_EstPayDate'];
if (collect_month(strtotime($CU_EstPayDate)) >= 3) {
return "<span class='text-danger'>" . collect_month(strtotime($CU_EstPayDate)) . "</span>";
} else {
return "<span class=''>" . collect_month(strtotime($CU_EstPayDate)) . "</span>";
}
}
function checkArWriteOffBill($conn, $row)
{
$BillNo = $row['BillNo2'];
$sql = "
SELECT
*
FROM arWriteOffBill AS a
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo
LEFT JOIN
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c
ON a.BillNo=c.BillNo
WHERE c.checkBillNo = '$BillNo'
";
$del = $conn->query($sql);
$i = 0;
foreach ($del as $row)
$i++;
if (empty($i)) {
return "<span class='text-danger'>未收款</span>";
} else {
return "<span class='text-primary'>已收款</span>";
}
}
function getAllCount($conn, $sql)
{
$result = $conn->query($sql);
$count = 0;
foreach ($result as $row) {
$count++;
}
return $count;
}
// 設置一個空陣列來放資料
$data = array();
$columns = array(
'PersonId',
'DeptName',
'BillNo',
'RowNo',
'CU_MaterialId',
'BizPartnerName',
'CU_EstPayDate',
// 'checkCollectMonth',
// 'checkArCheckBillStatus',
'UnTransCheckBLAmtWTax',
'HadTransCheckBLAmtWTax',
'BillNo2',
'arSellInvoiceMaterial',
'RowCode2',
'BillNo3',
'InvoiceName',
'OAmountWithTax',
'InvoiceNo',
'checkArWriteOffBill'
);
$user_id = empty($_POST['user_id']) ? null : $_POST['user_id'];
$department_id = accountidToDepartId($user_id);
$contractno = empty($_POST['contractno']) ? '' : getContractnoDetails($link, $user_id, $department_id, $_POST['contractno']);
$draw = $_POST['draw'];
$start = $_POST['start'];
$length = $_POST['length'];
$order_column = $_POST['order'][0]['column'];
$order_dir = $_POST['order'][0]['dir'];
$sql = "
SELECT
siam.PersonId,
cd.DeptName,
cbp.BizPartnerName,
siamd.RowNo,
siamd.RowCode,
siam.BillNo,
siamd.CU_EstPayDate,
siamd.UnTransCheckBLAmtWTax ,
siamd.HadTransCheckBLAmtWTax,
siamd.CU_MaterialId,
acb_tmp.BillNo2,
acb_tmp.RowCode2,
asim.BillNo AS BillNo3,
asim.InvoiceName,
asim.OAmountWithTax,
asi.InvoiceNo
FROM salIncomeApplyMaster AS siam -- 收入申請單
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細
ON siam.BillNo = siamd.BillNo
LEFT JOIN comPerson AS cp -- 員工主檔
ON siam.PersonId = cp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
LEFT JOIN (
SELECT
acbd.FromRowCode,
acb.FromBillNo,
acbd.BillNo AS BillNo2,
acbd.RowCode AS RowCode2
FROM arCheckBill AS acb -- 應收確認單
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細
ON acb.BillNo = acbd.BillNo
WHERE 1 = 1
AND acb.TypeId = 'RVS'
";
$sql .= !empty($contractno) ? " AND acb.FromBillNo IN ($contractno) " : "";
$sql .= "
) AS acb_tmp
ON siamd.RowNo = acb_tmp.FromRowCode
AND siamd.BillNo = acb_tmp.FromBillNo
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細
ON asim.FromBillNo = acb_tmp.BillNo2
AND asim.RowCode = acb_tmp.RowCode2
LEFT JOIN arSellInvoice AS asi
ON asim.BillNo = asi.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON siam.BizPartnerId = cbp.BizPartnerId
WHERE 1 = 1
";
$sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : "";
if (!empty($_POST['search']['value'])) {
$sql .= "
AND (
siam.PersonId LIKE '%" . $_POST['search']['value'] . "%'
OR cd.DeptName LIKE '%" . $_POST['search']['value'] . "%'
OR cbp.BizPartnerName LIKE '%" . $_POST['search']['value'] . "%'
OR siam.BillNo LIKE '%" . $_POST['search']['value'] . "%'
OR siamd.CU_MaterialId LIKE '%" . $_POST['search']['value'] . "%'
OR asi.InvoiceNo LIKE '%" . $_POST['search']['value'] . "%'
OR asim.InvoiceName LIKE '%" . $_POST['search']['value'] . "%'
OR siamd.CU_EstPayDate LIKE '%" . $_POST['search']['value'] . "%'
OR siamd.UnTransCheckBLAmtWTax LIKE '%" . $_POST['search']['value'] . "%'
OR siamd.HadTransCheckBLAmtWTax LIKE '%" . $_POST['search']['value'] . "%'
OR acb_tmp.BillNo2 LIKE '%" . $_POST['search']['value'] . "%'
OR asim.OAmountWithTax LIKE '%" . $_POST['search']['value'] . "%'
OR siamd.RowNo LIKE '%" . $_POST['search']['value'] . "%'
OR siamd.RowCode LIKE '%" . $_POST['search']['value'] . "%'
OR acb_tmp.RowCode2 LIKE '%" . $_POST['search']['value'] . "%'
)
";
}
$count = getAllCount($conn, $sql);
$sql .= " ORDER BY " . $columns[$order_column] . " " . $order_dir;
$sql .= " OFFSET $start ROWS FETCH NEXT $length ROWS ONLY ";
$result = $conn->query($sql);
$data = [];
foreach ($result as $row) {
$tmp = [];
$tmp['PersonId'] = $row['PersonId'] . "<br/>" . accountidToName($row['PersonId']);
$tmp['DeptName'] = $row['DeptName'];
$tmp['BillNo'] = $row['BillNo'];
$tmp['RowNo'] = $row['RowNo'];
$tmp['CU_MaterialId'] = $row['CU_MaterialId'];
$tmp['BizPartnerName'] = $row['BizPartnerName'];
$tmp['CU_EstPayDate'] = date('Y/m/d', strtotime($row['CU_EstPayDate']));
$tmp['checkCollectMonth'] = checkCollectMonth($row);
$tmp['checkArCheckBillStatus'] = checkArCheckBillStatus($row);
$tmp['UnTransCheckBLAmtWTax'] = number_format(intval($row['UnTransCheckBLAmtWTax']), 0, '', ',');
$tmp['HadTransCheckBLAmtWTax'] = number_format(intval($row['HadTransCheckBLAmtWTax']), 0, '', ',');
$tmp['BillNo2'] = $row['BillNo2'];
$tmp['arSellInvoiceMaterial'] = arSellInvoiceMaterial($row);
$tmp['RowCode2'] = $row['RowCode2'];
$tmp['BillNo3'] = $row['BillNo3'];
$tmp['InvoiceName'] = $row['InvoiceName'];
$tmp['OAmountWithTax'] = number_format(intval($row['OAmountWithTax']), 0, '', ',');
$tmp['InvoiceNo'] = $row['InvoiceNo'];
$tmp['checkArWriteOffBill'] = checkArWriteOffBill($conn, $row);
array_push($data, $tmp);
}
echo json_encode(array(
"draw" => intval($draw),
"recordsTotal" => $count,
"recordsFiltered" => $count,
"data" => $data
), JSON_UNESCAPED_UNICODE);

1
wms/schedule_star-index.php

@ -1,4 +1,5 @@
<?php <?php
error_reporting(0);
include "header.php"; include "header.php";
// 設置一個空陣列來放資料 // 設置一個空陣列來放資料

357
wms/ship_run_chart-model.php

@ -0,0 +1,357 @@
<?php
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
require dirname(__DIR__) . '/common/composer/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Style\Fill;
// AJAX 顯示合約明細
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$form_name = $_POST['form_name'];
$type = $_POST['type'];
$mtype = $_POST['mtype'];
$year = $_POST['year'];
$month = $_POST['month'];
if (in_array($type, ['M1', 'MA']))
$type = null;
if ($form_name == 'getShipping')
echo getShipping($type, $mtype, $year, $month);
if ($form_name == 'getInstalling')
echo getInstalling($type, $mtype, $year, $month);
if ($form_name == 'getInstalling2')
echo getInstalling2($type, $mtype, $year, $month);
if ($form_name == 'getQCing')
echo getQCing($type, $mtype, $year, $month);
if ($form_name == 'getDeliverying')
echo getDeliverying($type, $mtype, $year, $month);
if ($form_name == 'getShipping_makeExcel') {
$data = getShipping_makeExcel($type, $mtype, $year, $month);
downloadExcel($data);
}
if ($form_name == 'getInstalling_makeExcel') {
$data = getInstalling_makeExcel($type, $mtype, $year, $month);
downloadExcel($data);
}
if ($form_name == 'getInstalling2_makeExcel') {
$data = getInstalling2_makeExcel($type, $mtype, $year, $month);
downloadExcel($data);
}
if ($form_name == 'getQCing_makeExcel') {
$data = getQCing_makeExcel($type, $mtype, $year, $month);
downloadExcel($data);
}
if ($form_name == 'getDeliverying_makeExcel') {
$data = getDeliverying_makeExcel($type, $mtype, $year, $month);
downloadExcel($data);
}
}
function fixDataNull($data)
{
foreach ($data as $key => $row) {
foreach ($row as $field => $value) {
if ($value === null) {
$data[$key][$field] = '';
}
}
}
return $data;
}
// 出貨台數
function getShipping($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
";
if (!empty($month)) {
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode(fixDataNull($data), JSON_UNESCAPED_UNICODE);
}
// 在裝台數
function getInstalling($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
tryrun_end_date = ''
OR tryrun_end_date IS NULL
)
";
if (!empty($month)) {
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode(fixDataNull($data), JSON_UNESCAPED_UNICODE);
}
// 完工台數
function getInstalling2($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
";
if (!empty($month)) {
$sql .= " AND tryrun_end_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND tryrun_end_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode(fixDataNull($data), JSON_UNESCAPED_UNICODE);
}
// QC台數
function getQCing($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
";
if (!empty($month)) {
$sql .= " AND end_qc_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND end_qc_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode(fixDataNull($data), JSON_UNESCAPED_UNICODE);
}
// 移交台數
function getDeliverying($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
";
if (!empty($month)) {
$sql .= " AND delivery_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND delivery_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode(fixDataNull($data), JSON_UNESCAPED_UNICODE);
}
// 出貨台數 產生excel
function getShipping_makeExcel($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
";
if (!empty($month)) {
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
// 在裝台數 產生excel
function getInstalling_makeExcel($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
tryrun_end_date = ''
OR tryrun_end_date IS NULL
)
";
if (!empty($month)) {
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
// 完工台數 產生excel
function getInstalling2_makeExcel($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
";
if (!empty($month)) {
$sql .= " AND tryrun_end_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND tryrun_end_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
// QC台數 產生excel
function getQCing_makeExcel($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
";
if (!empty($month)) {
$sql .= " AND end_qc_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND end_qc_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
// 移交台數 產生excel
function getDeliverying_makeExcel($type, $mtype, $year, $month)
{
global $link;
// 建立一個新的 Spreadsheet 物件
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
";
if (!empty($month)) {
$sql .= " AND delivery_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
} else {
$sql .= " AND delivery_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
function downloadExcel($data)
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$colArr = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
];
$colTitleArr = [
'合約號',
'作番號',
'客戶名稱',
'預計出貨日',
'試車完工日',
'QC合格日',
'官檢日',
'移交日',
];
$sheet->setTitle('出貨完工推移表');
for ($i = 0; $i < count($colArr); $i++)
$sheet->setCellValue($colArr[$i] . '1', $colTitleArr[$i]);
$i = 2;
foreach ($data as $row) {
$colContentArr = [
$row['contractno'],
$row['facilityno'],
$row['custom'],
$row['real_arrival_date'],
$row['tryrun_end_date'],
$row['end_qc_date'],
$row['official_check_date'],
$row['delivery_date']
];
for ($j = 0; $j < count($colContentArr); $j++)
$sheet->setCellValue($colArr[$j] . $i, $colContentArr[$j]);
$i++;
}
// 調整欄位大小
foreach ($sheet->getColumnIterator() as $column) {
$sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
}
$writer = new Xlsx($spreadsheet);
$file_path = dirname(__DIR__) . '/wms/excel/' . 'gary_test.xlsx';
try {
$writer->save($file_path);
// 回傳檔案路徑給 JavaScript
echo $file_path;
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
exit();
}

157
wms/ship_run_chart-model_BK.php

@ -0,0 +1,157 @@
<?php
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
// AJAX 顯示合約明細
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$form_name = $_POST['form_name'];
$type = $_POST['type'];
$mtype = $_POST['mtype'];
$year = $_POST['year'];
$month = $_POST['month'];
if ($form_name == 'getShipping') {
echo getShipping($type, $mtype, $year, $month);
}
if ($form_name == 'getInstalling') {
echo getInstalling($type, $mtype, $year, $month);
}
if ($form_name == 'getInstalling2') {
echo getInstalling2($type, $mtype, $year, $month);
}
if ($form_name == 'getQCing') {
echo getQCing($type, $mtype, $year, $month);
}
if ($form_name == 'getDeliverying') {
echo getDeliverying($type, $mtype, $year, $month);
}
}
// 出貨台數
function getShipping($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 在裝台數
function getInstalling($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
install_start_date IS NOT NULL
OR install_start_date != ''
)
AND (
install_end_date IS NULL
OR install_end_date = ''
)
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 完工台數
function getInstalling2($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND install_start_date IS NOT NULL
AND install_start_date != ''
AND install_end_date IS NOT NULL
AND install_end_date != ''
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// QC台數
function getQCing($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND end_qc_date IS NOT NULL
AND end_qc_date != ''
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 移交台數
function getDeliverying($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND delivery_date IS NOT NULL
AND delivery_date != ''
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}

435
wms/ship_run_chart.php

@ -0,0 +1,435 @@
<?php
// ini_set('display_errors', 'on');
include "header.php";
include "css/view/wipwhole-index.php";
// 出貨台數
function getShipping($type, $mtype, $year, $month)
{
global $link;
if (in_array($type, ['M1', 'MA']))
$type = null;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 在裝台數
function getInstalling($type, $mtype, $year, $month)
{
global $link;
if (in_array($type, ['M1', 'MA']))
$type = null;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND (
tryrun_end_date = ''
OR tryrun_end_date IS NULL
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 完工台數
function getInstalling2($type, $mtype, $year, $month)
{
global $link;
if (in_array($type, ['M1', 'MA']))
$type = null;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND tryrun_end_date BETWEEN '$year-$month-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// QC台數
function getQCing($type, $mtype, $year, $month)
{
global $link;
if (in_array($type, ['M1', 'MA']))
$type = null;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND end_qc_date BETWEEN '$year-$month-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 移交台數
function getDeliverying($type, $mtype, $year, $month)
{
global $link;
if (in_array($type, ['M1', 'MA']))
$type = null;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND delivery_date BETWEEN '$year-$month-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
$contract_type = [
'' => '新梯+汰改',
'A' => '新梯',
'B' => '汰改 M1+MA',
'M1' => '汰改 M1',
'MA' => '汰改 MA'
];
foreach ($contract_type as $c_val => $c_key) {
$mtype = null;
if ($c_val == "M1")
$mtype = "M1";
if ($c_val == "MA")
$mtype = "MA";
?>
<div id="myModal" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'>
<div class='row'>
<div class='col-12' style="text-align:left !important;">
<button type="button" class="btn btn-primary" id="btn_download">下載excel</button>
</div>
</div>
<div class='row'>
<div class='col-12'>
<table id="table_detail" class="table table-bordered" style="width:100%; margin:0 auto;">
<thead>
<tr>
<th>合約號</th>
<th>作番號</th>
<th>客戶名稱</th>
<th>預計出貨日</th>
<th>試車完工日</th>
<th>QC合格日</th>
<th>官檢日</th>
<th>移交日</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<table class="table table-striped table-bordered" style="width:98.5%;overflow-x:auto">
<thead>
<tr>
<th style='text-align:center;vertical-align:middle;' colspan='15'>
<h4>出貨完工推移表(<?php echo $c_key; ?>)</h4>
</th>
</tr>
<tr>
<th style='text-align:center;width:150px;vertical-align:middle;' rowspan='2'>階段台數</th>
<th style='text-align:center;width:150px;vertical-align:middle;' rowspan='2'>年度</th>
<th style='text-align:center;vertical-align:middle;' colspan='12'>月份</th>
<th style='text-align:center;vertical-align:middle;' rowspan='2'>合計</th>
</tr>
<tr>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td style='text-align:center;'>" . $i . "月</td>";
}
?>
</tr>
</thead>
<tbody>
<?php
$type_arr = [
'A' => '出貨台數',
'B' => '在裝台數',
'C' => '完工台數',
'D' => 'QC台數',
'E' => '移交台數'
];
foreach ($type_arr as $val => $key) {
?>
<tr>
<td style='text-align:center;vertical-align:middle;' rowspan='2'>
<?php
echo $key;
echo "<br/>";
if ($val == 'A')
echo "<span style='font-size:12px;'>有出貨日</span>";
if ($val == 'B')
echo "<span style='font-size:12px;'>沒有實際試車完工日</span> ";
if ($val == 'C')
echo "<span style='font-size:12px;'>有實際試車完工日</span> ";
if ($val == 'D')
echo "<span style='font-size:12px;'>有QC合格日</span> ";
if ($val == 'E')
echo "<span style='font-size:12px;'>移交日</span> ";
?>
</td>
<td>前一年度(<?php echo (date("Y") - 1); ?>)</td>
<?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
$d_count = 0;
$e_count = 0;
for ($i = 1; $i <= 12; $i++) {
if ($val == 'A') {
$a = getShipping($c_val, $mtype, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
$onclick = "showDetail('getShipping', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a . '</a></td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, $mtype, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
$onclick = "showDetail('getInstalling', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b . '</a></td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, $mtype, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
$onclick = "showDetail('getInstalling2', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c . '</a></td>';
}
if ($val == 'D') {
$d = getQCing($c_val, $mtype, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
$onclick = "showDetail('getQCing', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d . '</a></td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, $mtype, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
$onclick = "showDetail('getDeliverying', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e . '</a></td>';
}
}
if ($val == 'A') {
$onclick = "showDetail('getShipping', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a_count . '</a></td>';
}
if ($val == 'B') {
$onclick = "showDetail('getInstalling', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b_count . '</a></td>';
}
if ($val == 'C') {
$onclick = "showDetail('getInstalling2', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c_count . '</a></td>';
}
if ($val == 'D') {
$onclick = "showDetail('getQCing', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d_count . '</a></td>';
}
if ($val == 'E') {
$onclick = "showDetail('getDeliverying', '$c_val', '$mtype', '" . (date("Y") - 1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e_count . '</a></td>';
}
?>
</tr>
<tr>
<td>本年度(<?php echo date("Y"); ?>)</td>
<?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
$d_count = 0;
$e_count = 0;
for ($i = 1; $i <= 12; $i++) {
if ($val == 'A') {
$a = getShipping($c_val, $mtype, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
$onclick = "showDetail('getShipping', '$c_val', '$mtype', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a . '</a></td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, $mtype, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
$onclick = "showDetail('getInstalling', '$c_val', '$mtype', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b . '</a></td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, $mtype, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
$onclick = "showDetail('getInstalling2', '$c_val', '$mtype', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c . '</a></td>';
}
if ($val == 'D') {
$d = getQCing($c_val, $mtype, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
$onclick = "showDetail('getQCing', '$c_val', '$mtype', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d . '</a></td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, $mtype, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
$onclick = "showDetail('getDeliverying', '$c_val', '$mtype', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e . '</a></td>';
}
}
if ($val == 'A') {
$onclick = "showDetail('getShipping', '$c_val', '$mtype', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $a_count . ' </a></td>';
}
if ($val == 'B') {
$onclick = "showDetail('getInstalling', '$c_val', '$mtype', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $b_count . ' </a></td>';
}
if ($val == 'C') {
$onclick = "showDetail('getInstalling2', '$c_val', '$mtype', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $c_count . ' </a></td>';
}
if ($val == 'D') {
$onclick = "showDetail('getQCing', '$c_val', '$mtype', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $d_count . ' </a></td>';
}
if ($val == 'E') {
$onclick = "showDetail('getDeliverying', '$c_val', '$mtype', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $e_count . ' </a></td>';
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
var modal = document.getElementById("myModal");
$(".myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
$("#myModal").hide();
});
$(".back").click(function(e) {
$("#myModal").hide();
});
function showDetail(form_name, type, mtype, year, month) {
$("#btn_download").attr("onclick", "generateButton('" + form_name + "', '" + type + "', '" + mtype + "', '" + year + "', '" + month + "')");
$.ajax({
type: "POST",
dataType: "json",
url: "ship_run_chart-model.php",
data: {
form_name: form_name,
type: type,
mtype: mtype,
year: year,
month: month
},
complete: function(data) {
var data = data.responseJSON
var str = "";
for (var i = 0; i < data.length; i++) {
str += "<tr>";
str += "<td>" + data[i]['contractno'] + "</td>";
str += "<td>" + data[i]['facilityno'] + "</td>";
str += "<td>" + data[i]['custom'] + "</td>";
str += "<td>" + data[i]['real_arrival_date'] + "</td>";
str += "<td>" + data[i]['tryrun_end_date'] + "</td>";
str += "<td>" + data[i]['end_qc_date'] + "</td>";
str += "<td>" + data[i]['official_check_date'] + "</td>";
str += "<td>" + data[i]['delivery_date'] + "</td>";
str += "</tr>";
}
if ($('#table_detail').hasClass('dataTable')) {
dttable = $('#table_detail').dataTable();
dttable.fnClearTable();
dttable.fnDestroy();
}
$("#table_detail").find("tbody").html(str);
$('#table_detail').dataTable({
displayLength: 100,
});
}
})
}
// 使用 JavaScript 監聽按鈕點擊事件
function generateButton(form_name, type, mtype, year, month) {
const formData = new FormData();
formData.append("form_name", form_name + "_makeExcel");
formData.append("type", type);
formData.append("mtype", mtype);
formData.append("year", year);
formData.append("month", month);
// 使用 XMLHttpRequest 來呼叫 PHP 檔案,生成 Excel
var xhr = new XMLHttpRequest();
xhr.open('POST', window.location.origin + "/wms/ship_run_chart-model.php", true);
xhr.responseType = 'text';
xhr.onload = function() {
if (xhr.status === 200) {
// 取得 PHP 回傳的檔案路徑
var response = xhr.responseText;
console.log(xhr.responseText);
var file_path = xhr.responseText;
// 創建下載連結
var link = document.createElement('a');
link.setAttribute('href', window.location.origin + "/wms/excel/gary_test.xlsx");
// 設定下載的檔案名稱
link.setAttribute('download', '出貨完工推移表.xlsx');
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
};
xhr.send(formData);
}
</script>
<?php
}
include("footer.php");
?>

391
wms/ship_run_chart_BK.php

@ -0,0 +1,391 @@
<?php
// ini_set('display_errors', 'on');
include "header.php";
include "css/view/wipwhole-index.php";
// 出貨台數
function getShipping($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 在裝台數
function getInstalling($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND (
install_start_date IS NOT NULL
OR install_start_date != ''
)
AND (
install_end_date IS NULL
OR install_end_date = ''
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 完工台數
function getInstalling2($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND install_start_date IS NOT NULL
AND install_start_date != ''
AND install_end_date IS NOT NULL
AND install_end_date != ''
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// QC台數
function getQCing($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND end_qc_date IS NOT NULL
AND end_qc_date != ''
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
// 移交台數
function getDeliverying($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
count(*) AS all_count
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'
AND delivery_date IS NOT NULL
AND delivery_date != ''
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
}
$contract_type = [
'' => '新梯+汰改',
'A' => '新梯',
'B' => '汰改'
];
foreach ($contract_type as $c_val => $c_key) {
?>
<div id="myModal" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'>
<div class='row'>
<div class='col-12'>
<table id="table_detail" class="table table-bordered" style="width:100%; margin:0 auto;">
<thead>
<tr>
<th>合約號</th>
<th>作番號</th>
<th>客戶名稱</th>
<th>預計出貨日</th>
<th>試車完工日</th>
<th>QC合格日</th>
<th>官檢日</th>
<th>移交日</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<table class="table table-striped table-bordered" style="width:98.5%;overflow-x:auto">
<thead>
<tr>
<th style='text-align:center;vertical-align:middle;' colspan='15'>
<h4>出貨完工推移表(<?php echo $c_key; ?>)</h4>
</th>
</tr>
<tr>
<th style='text-align:center;width:150px;vertical-align:middle;' rowspan='2'>階段台數</th>
<th style='text-align:center;width:150px;vertical-align:middle;' rowspan='2'>年度</th>
<th style='text-align:center;vertical-align:middle;' colspan='12'>月份</th>
<th style='text-align:center;vertical-align:middle;' rowspan='2'>合計</th>
</tr>
<tr>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td style='text-align:center;'>" . $i . "月</td>";
}
?>
</tr>
</thead>
<tbody>
<?php
$type_arr = [
'A' => '出貨台數',
'B' => '在裝台數',
'C' => '完工台數',
'D' => 'QC台數',
'E' => '移交台數'
];
foreach ($type_arr as $val => $key) {
?>
<tr>
<td style='text-align:center;vertical-align:middle;' rowspan='2'>
<?php
echo $key;
echo "<br/>";
if ($val == 'A')
echo "<span style='font-size:12px;'>有出貨日</span>";
if ($val == 'B')
echo "<span style='font-size:12px;'>有安裝開工日,沒安裝完工日</span> ";
if ($val == 'C')
echo "<span style='font-size:12px;'>有安裝完工日</span> ";
if ($val == 'D')
echo "<span style='font-size:12px;'>有QC完工日</span> ";
if ($val == 'E')
echo "<span style='font-size:12px;'>移交日</span> ";
?>
</td>
<td>前一年度(<?php echo (date("Y") - 1); ?>)</td>
<?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
$d_count = 0;
$e_count = 0;
for ($i = 1; $i <= 12; $i++) {
if ($val == 'A') {
$a = getShipping($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a . '</a></td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b . '</a></td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c . '</a></td>';
}
if ($val == 'D') {
$d = getQCing($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d . '</a></td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e . '</a></td>';
}
}
if ($val == 'A') {
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a_count . '</a></td>';
}
if ($val == 'B') {
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b_count . '</a></td>';
}
if ($val == 'C') {
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c_count . '</a></td>';
}
if ($val == 'D') {
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d_count . '</a></td>';
}
if ($val == 'E') {
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e_count . '</a></td>';
}
?>
</tr>
<tr>
<td>本年度(<?php echo date("Y"); ?>)</td>
<?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
$d_count = 0;
$e_count = 0;
for ($i = 1; $i <= 12; $i++) {
if ($val == 'A') {
$a = getShipping($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a . '</a></td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b . '</a></td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c . '</a></td>';
}
if ($val == 'D') {
$d = getQCing($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d . '</a></td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e . '</a></td>';
}
}
if ($val == 'A') {
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $a_count . ' </a></td>';
}
if ($val == 'B') {
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $b_count . ' </a></td>';
}
if ($val == 'C') {
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $c_count . ' </a></td>';
}
if ($val == 'D') {
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $d_count . ' </a></td>';
}
if ($val == 'E') {
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $e_count . ' </a></td>';
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
var modal = document.getElementById("myModal");
$(".myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
$("#myModal").hide();
});
$(".back").click(function(e) {
$("#myModal").hide();
});
function showDetail(form_name, type, mtype, year, month) {
$.ajax({
type: "POST",
dataType: "json",
url: "ship_run_chart-model.php",
data: {
form_name: form_name,
type: type,
mtype: mtype,
year: year,
month: month
},
complete: function(data) {
console.log(data);
var data = data.responseJSON
var str = "";
for (var i = 0; i < data.length; i++) {
str += "<tr>";
str += "<td>" + data[i]['contractno'] + "</td>";
str += "<td>" + data[i]['facilityno'] + "</td>";
str += "<td>" + data[i]['custom'] + "</td>";
str += "<td>" + data[i]['real_arrival_date'] + "</td>";
str += "<td>" + data[i]['tryrun_end_date'] + "</td>";
str += "<td>" + data[i]['end_qc_date'] + "</td>";
str += "<td>" + data[i]['official_check_date'] + "</td>";
str += "<td>" + data[i]['delivery_date'] + "</td>";
str += "</tr>";
}
if ($('#table_detail').hasClass('dataTable')) {
dttable = $('#table_detail').dataTable();
dttable.fnClearTable();
dttable.fnDestroy();
}
$("#table_detail").find("tbody").html(str);
$('#table_detail').dataTable();
}
})
}
</script>
<?php
}
include("footer.php");
?>

2
wms/wipwhole-change-contractdate-function.php

@ -596,6 +596,8 @@ function getAssignStatusSelect($link, $user_id, $nowFormStatus)
if (empty($nowFormStatus)) { if (empty($nowFormStatus)) {
if (in_array(getDepartmentId($link, $user_id), ['521', '531', '541', '542', '543', '544', '545'])) { if (in_array(getDepartmentId($link, $user_id), ['521', '531', '541', '542', '543', '544', '545'])) {
$options_str .= "<option value='A'>提出申請</option>"; $options_str .= "<option value='A'>提出申請</option>";
} else if (in_array(getDepartmentId($link, $user_id), ['250'])) {
$options_str .= "<option value='Z'>提出申請</option>";
} else { } else {
$options_str .= "<option value='B'>提出申請</option>"; $options_str .= "<option value='B'>提出申請</option>";
} }

46
wms/wipwhole-change-contractdate-submit.php

@ -212,11 +212,55 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$contract_arrival_date_tmp = empty($contract_arrival_date) ? $real_contract_arrival_date : $contract_arrival_date; $contract_arrival_date_tmp = empty($contract_arrival_date) ? $real_contract_arrival_date : $contract_arrival_date;
$real_address_tmp = empty($real_address) ? $old_real_address : $real_address; $real_address_tmp = empty($real_address) ? $old_real_address : $real_address;
$shengguanok_insert_status = empty($_POST['shengguanok_insert_status']) ? null : $_POST['shengguanok_insert_status'];
if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) { if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) {
$tds = date("Y-m-d H:i:s"); $tds = date("Y-m-d H:i:s");
$next_users = $_POST['next_users']; $next_users = $_POST['next_users'];
$seq = $_POST['seq'] + 1; $seq = 1;
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $cid);
if (!empty($shengguanok_insert_status)) {
echo $form_key = getFomkeySeq($link);
$all_contractno_change = empty($_POST['all_contractno_change']) ? null : $_POST['all_contractno_change'];
$real_contract_arrival_date = $_POST['real_contract_arrival_date'];
$contract_arrival_date = $_POST['contract_arrival_date'];
$city = $_POST['city'];
if (!empty($_POST['real_address'])) {
$real_address = $city . $_POST['real_address'];
} else {
$real_address = $_POST['real_address'];
}
$old_real_address = $_POST['old_real_address'];
$estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date'];
$contractno = $_POST['contractno'];
$next_users = $_POST['next_users'];
$tds = date("Y-m-d H:i:s");
$data_arr = array(
'id' => $id,
'all_contractno_change' => $all_contractno_change,
'real_contract_arrival_date' => $real_contract_arrival_date,
'contract_arrival_date' => $contract_arrival_date,
'real_address' => $real_address,
'old_real_address' => $old_real_address,
'contractno' => $contractno,
'tds' => $tds,
'form_key' => $form_key,
'user_id' => $user_id,
'change_status' => $_POST['assign_status']
);
addWipwholeChangeContractdateDetails($link, $data_arr);
// 寫入待簽
$data_arr['last_id'] = $link->insert_id;
addFlow($link, $data_arr);
$data_arr['seq'] = '0';
$data_arr['current_assigner'] = $user_id;
addSubflow($link, $data_arr);
$data_arr['seq'] = '1';
$data_arr['current_assigner'] = $next_users;
addSubflow($link, $data_arr);
$seq = '2';
$next_users = '00000';
}
$sql = " $sql = "
UPDATE wipwhole_change_contractdate_details UPDATE wipwhole_change_contractdate_details
SET change_status = 'Z' SET change_status = 'Z'

13
wms/wipwhole-change-contractdate.php

@ -323,6 +323,11 @@ if (!empty(checkNowFormStatus($link)))
<th class="td_title"> 下位簽核者</th> <th class="td_title"> 下位簽核者</th>
<td colspan="2"> <td colspan="2">
<?php <?php
if (empty(checkNowFormStatus($link))) {
if (in_array(getDepartmentId($link, $user_id), ['250'])) {
echo "<input type='hidden' name='shengguanok_insert_status' value='1' />";
}
}
if (empty(checkNowFormStatus($link))) { if (empty(checkNowFormStatus($link))) {
if (in_array(getDepartmentId($link, $user_id), ['521', '531', '541', '542', '543', '544', '545'])) { if (in_array(getDepartmentId($link, $user_id), ['521', '531', '541', '542', '543', '544', '545'])) {
echo "<select name='next_users' id='next_users'>"; echo "<select name='next_users' id='next_users'>";
@ -332,6 +337,14 @@ if (!empty(checkNowFormStatus($link)))
"; ";
endforeach; endforeach;
echo "</select>"; echo "</select>";
} else if (in_array(getDepartmentId($link, $user_id), ['250'])) {
echo "<select name='next_users' id='next_users'>";
foreach ($shengguanok_options as $shengguanok_option) :
echo "
<option value='" . $shengguanok_option['val'] . "'>" . $shengguanok_option['val'] . $shengguanok_option['label'] . "</option>
";
endforeach;
echo "</select>";
} else { } else {
echo " echo "
<select name='next_users' id='next_users'> <select name='next_users' id='next_users'>

8
wms/wipwhole-index-export-excel.php

@ -124,7 +124,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
'台灣自理項目(發貨類別)', '台灣自理項目(發貨類別)',
'台灣自理項目(發貨類別)日期', '台灣自理項目(發貨類別)日期',
'實際到貨日(到觀音廠日)', '實際到貨日(到觀音廠日)',
'實際到貨日(到觀音廠日)日期' '實際到貨日(到觀音廠日)日期',
'安裝圖上傳狀態',
'完工驗收單上傳狀態',
'移交日附件(核准函)上傳狀態'
]; ];
$sheet->setTitle('作番大日程(新梯)'); $sheet->setTitle('作番大日程(新梯)');
for ($i = 0; $i < count($colArr); $i++) for ($i = 0; $i < count($colArr); $i++)
@ -349,6 +352,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
substr($row['taiwan_goods_type_date'], 0, 10), substr($row['taiwan_goods_type_date'], 0, 10),
$arrival_date_verify_status, $arrival_date_verify_status,
substr($row['actual_tofactory_date'], 0, 10), substr($row['actual_tofactory_date'], 0, 10),
empty($row['plan_diagram_file']) ? "無" : "已上傳",
empty($row['completion_acceptance_file']) ? "無" : "已上傳",
empty($row['delivery_date_file']) ? "無" : "已上傳"
]; ];
for ($j = 0; $j < count($colContentArr); $j++) for ($j = 0; $j < count($colContentArr); $j++)
$sheet->setCellValue($colArr[$j] . $i, $colContentArr[$j]); $sheet->setCellValue($colArr[$j] . $i, $colContentArr[$j]);

27
wms/wipwhole-index-function.php

@ -48,7 +48,8 @@ function getWipwholeSearchSql()
$area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']); $area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']);
$sql = ""; $sql = "";
$sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") "; $sql .= empty($area_no) ? "" : " AND area_no = '$area_no' ";
// $sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") ";
$sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' "; $sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' ";
$sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' "; $sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' ";
$sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' "; $sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' ";
@ -284,7 +285,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -297,7 +299,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -310,7 +313,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -323,7 +327,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -564,7 +569,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -585,7 +591,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -606,7 +613,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -627,7 +635,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;

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

@ -2,16 +2,16 @@
function fileIUpload($post_name) function fileIUpload($post_name)
{ {
if ($_FILES[$post_name]["error"] == 0) { if (empty($_FILES[$post_name]["error"])) {
$datetime = date("YmdHis"); $datetime = date("YmdHis");
$file_name = str_replace("#", "", $_FILES[$post_name]["name"]); $file_name = empty($_FILES[$post_name]["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)) { if (!empty($file_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);
return strtolower($target_dir . basename($datetime . $file_name)); return strtolower($target_dir . basename($datetime . $file_name));
} else { } else {
return ""; return "";
@ -69,5 +69,6 @@ $delivery_date_file = fileIUpload("delivery_date_file");
$shengguanok_status_file = fileIUpload("shengguanok_status_file"); $shengguanok_status_file = fileIUpload("shengguanok_status_file");
// 工務助理 // 工務助理
$outsourcer_contract_file = fileIUploads("outsourcer_contract_file"); $outsourcer_contract_file = fileIUploads("outsourcer_contract_file");
$delivery_date_file2 = fileIUpload("delivery_date_file2");
// 品證 // 品證
$official_check_file = fileIUpload("official_check_file"); $official_check_file = fileIUpload("official_check_file");

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

@ -12,346 +12,149 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
$datetime = date("Y-m-d H:i:s"); $datetime = date("Y-m-d H:i:s");
$contractno = $_POST['contractno']; $create_at = date("Y-m-d H:i:s");
$facility_temp_no = $_POST['facility_temp_no']; $contractno = isset($_POST['contractno']) ? $_POST['contractno'] : $row['contractno'];
$facilityno = $_POST['facilityno']; $facility_temp_no = isset($_POST['facility_temp_no']) ? $_POST['facility_temp_no'] : $row['facility_temp_no'];
$custom = $_POST['custom']; $facilityno = isset($_POST['facilityno']) ? $_POST['facilityno'] : $row['facilityno'];
$site_manager = $_POST['site_manager']; $custom = isset($_POST['custom']) ? $_POST['custom'] : $row['custom'];
$latitude = $_POST['latitude']; $site_manager = isset($_POST['site_manager']) ? $_POST['site_manager'] : $row['site_manager'];
$longitude = $_POST['longitude']; $latitude = isset($_POST['latitude']) ? $_POST['latitude'] : $row['latitude'];
$weight = $_POST['weight']; $longitude = isset($_POST['longitude']) ? $_POST['longitude'] : $row['longitude'];
$numberofpassenger = $_POST['numberofpassenger']; $weight = isset($_POST['weight']) ? $_POST['weight'] : $row['weight'];
$numberofstop = $_POST['numberofstop']; $numberofpassenger = isset($_POST['numberofpassenger']) ? $_POST['numberofpassenger'] : $row['numberofpassenger'];
$numberoffloor = $_POST['numberoffloor']; $numberofstop = isset($_POST['numberofstop']) ? $_POST['numberofstop'] : $row['numberofstop'];
$opentype = $_POST['opentype']; $numberoffloor = isset($_POST['numberoffloor']) ? $_POST['numberoffloor'] : $row['numberoffloor'];
$speed = $_POST['speed']; $opentype = isset($_POST['opentype']) ? $_POST['opentype'] : $row['opentype'];
$facility_kind = $_POST['facility_kind']; $speed = isset($_POST['speed']) ? $_POST['speed'] : $row['speed'];
$address = $_POST['address']; $facility_kind = isset($_POST['facility_kind']) ? $_POST['facility_kind'] : $row['facility_kind'];
$real_address = $_POST['real_address']; $address = isset($_POST['address']) ? $_POST['address'] : $row['address'];
$contract_arrival_date = $_POST['contract_arrival_date']; $real_address = isset($_POST['real_address']) ? $_POST['real_address'] : $row['real_address'];
$real_contract_arrival_date = $_POST['real_contract_arrival_date']; $contract_arrival_date = isset($_POST['contract_arrival_date']) ? $_POST['contract_arrival_date'] : $row['contract_arrival_date'];
$sales_spec_verify = $_POST['sales_spec_verify']; $real_contract_arrival_date = isset($_POST['real_contract_arrival_date']) ? $_POST['real_contract_arrival_date'] : $row['real_contract_arrival_date'];
$sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at']; $sales_spec_verify = isset($_POST['sales_spec_verify']) ? $_POST['sales_spec_verify'] : $row['sales_spec_verify'];
$sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner']; $sales_spec_verify_at = isset($_POST['sales_spec_verify_at']) ? $_POST['sales_spec_verify_at'] : $row['sales_spec_verify_at'];
$real_custom_name = $_POST['real_custom_name'] ?: $row['real_custom_name']; $sales_spec_verify_owner = isset($_POST['sales_spec_verify_owner']) ? $_POST['sales_spec_verify_owner'] : $row['sales_spec_verify_owner'];
$customer_planning_verify = $_POST['customer_planning_verify']; $real_custom_name = isset($_POST['real_custom_name']) ? $_POST['real_custom_name'] : $row['real_custom_name'];
$customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at']; $customer_planning_verify = isset($_POST['customer_planning_verify']) ? $_POST['customer_planning_verify'] : $row['customer_planning_verify'];
$customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner']; $customer_planning_verify_at = isset($_POST['customer_planning_verify_at']) ? $_POST['customer_planning_verify_at'] : $row['customer_planning_verify_at'];
$customer_color_verify = $_POST['customer_color_verify']; $customer_planning_verify_owner = isset($_POST['customer_planning_verify_owner']) ? $_POST['customer_planning_verify_owner'] : $row['customer_planning_verify_owner'];
$customer_color_verify_at = $_POST['customer_color_verify_at'] ?: $row['customer_color_verify_at']; $customer_color_verify = isset($_POST['customer_color_verify']) ? $_POST['customer_color_verify'] : $row['customer_color_verify'];
$customer_color_verify_owner = $_POST['customer_color_verify_owner'] ?: $row['customer_color_verify_owner']; $customer_color_verify_at = isset($_POST['customer_color_verify_at']) ? $_POST['customer_color_verify_at'] : $row['customer_color_verify_at'];
$customer_style_verify = $_POST['customer_style_verify']; $customer_color_verify_owner = isset($_POST['customer_color_verify_owner']) ? $_POST['customer_color_verify_owner'] : $row['customer_color_verify_owner'];
$customer_style_verify_at = $_POST['customer_style_verify_at'] ?: $row['customer_style_verify_at']; $customer_style_verify = isset($_POST['customer_style_verify']) ? $_POST['customer_style_verify'] : $row['customer_style_verify'];
$customer_style_verify_owner = $_POST['customer_style_verify_owner'] ?: $row['customer_style_verify_owner']; $customer_style_verify_at = isset($_POST['customer_style_verify_at']) ? $_POST['customer_style_verify_at'] : $row['customer_style_verify_at'];
$site_survey_contact_form_verify = $_POST['site_survey_contact_form_verify']; $customer_style_verify_owner = isset($_POST['customer_style_verify_owner']) ? $_POST['customer_style_verify_owner'] : $row['customer_style_verify_owner'];
$site_survey_contact_form_verify_at = $_POST['site_survey_contact_form_verify_at'] ?: $row['site_survey_contact_form_verify_at']; $site_survey_contact_form_verify = isset($_POST['site_survey_contact_form_verify']) ? $_POST['site_survey_contact_form_verify'] : $row['site_survey_contact_form_verify'];
$site_survey_contact_form_verify_owner = $_POST['site_survey_contact_form_verify_owner'] ?: $row['site_survey_contact_form_verify_owner']; $site_survey_contact_form_verify_at = isset($_POST['site_survey_contact_form_verify_at']) ? $_POST['site_survey_contact_form_verify_at'] : $row['site_survey_contact_form_verify_at'];
$desin_spec_verify = $_POST['desin_spec_verify']; $site_survey_contact_form_verify_owner = isset($_POST['site_survey_contact_form_verify_owner']) ? $_POST['site_survey_contact_form_verify_owner'] : $row['site_survey_contact_form_verify_owner'];
$desin_spec_verify_at = $_POST['desin_spec_verify_at'] ?: $row['desin_spec_verify_at']; $desin_spec_verify = isset($_POST['desin_spec_verify']) ? $_POST['desin_spec_verify'] : $row['desin_spec_verify'];
$desin_spec_verify_owner = $_POST['desin_spec_verify_owner'] ?: $row['desin_spec_verify_owner']; $desin_spec_verify_at = isset($_POST['desin_spec_verify_at']) ? $_POST['desin_spec_verify_at'] : $row['desin_spec_verify_at'];
$desin_planning_verify = $_POST['desin_planning_verify']; $desin_spec_verify_owner = isset($_POST['desin_spec_verify_owner']) ? $_POST['desin_spec_verify_owner'] : $row['desin_spec_verify_owner'];
$desin_planning_verify_at = $_POST['desin_planning_verify_at'] ?: $row['desin_planning_verify_at']; $desin_planning_verify = isset($_POST['desin_planning_verify']) ? $_POST['desin_planning_verify'] : $row['desin_planning_verify'];
$desin_planning_verify_owner = $_POST['desin_planning_verify_owner'] ?: $row['desin_planning_verify_owner']; $desin_planning_verify_at = isset($_POST['desin_planning_verify_at']) ? $_POST['desin_planning_verify_at'] : $row['desin_planning_verify_at'];
$desin_color_verify = $_POST['desin_color_verify']; $desin_planning_verify_owner = isset($_POST['desin_planning_verify_owner']) ? $_POST['desin_planning_verify_owner'] : $row['desin_planning_verify_owner'];
$desin_color_verify_at = $_POST['desin_color_verify_at'] ?: $row['desin_color_verify_at']; $desin_color_verify = isset($_POST['desin_color_verify']) ? $_POST['desin_color_verify'] : $row['desin_color_verify'];
$desin_color_verify_owner = $_POST['desin_color_verify_owner'] ?: $row['desin_color_verify_owner']; $desin_color_verify_at = isset($_POST['desin_color_verify_at']) ? $_POST['desin_color_verify_at'] : $row['desin_color_verify_at'];
$desin_style_verify = $_POST['desin_style_verify']; $desin_color_verify_owner = isset($_POST['desin_color_verify_owner']) ? $_POST['desin_color_verify_owner'] : $row['desin_color_verify_owner'];
$desin_style_verify_at = $_POST['desin_style_verify_at'] ?: $row['desin_style_verify_at']; $desin_style_verify = isset($_POST['desin_style_verify']) ? $_POST['desin_style_verify'] : $row['desin_style_verify'];
$desin_style_verify_owner = $_POST['desin_style_verify_owner'] ?: $row['desin_style_verify_owner']; $desin_style_verify_at = isset($_POST['desin_style_verify_at']) ? $_POST['desin_style_verify_at'] : $row['desin_style_verify_at'];
$desin_leader_verify = $_POST['desin_leader_verify']; $desin_style_verify_owner = isset($_POST['desin_style_verify_owner']) ? $_POST['desin_style_verify_owner'] : $row['desin_style_verify_owner'];
$desin_leader_verify_at = $_POST['desin_leader_verify_at'] ?: $row['desin_leader_verify_at']; $desin_leader_verify = isset($_POST['desin_leader_verify']) ? $_POST['desin_leader_verify'] : $row['desin_leader_verify'];
$desin_leader_verify_owner = $_POST['desin_leader_verify_owner'] ?: $row['desin_leader_verify_owner']; $desin_leader_verify_at = isset($_POST['desin_leader_verify_at']) ? $_POST['desin_leader_verify_at'] : $row['desin_leader_verify_at'];
$building_heigh_verify = $_POST['building_heigh_verify']; $desin_leader_verify_owner = isset($_POST['desin_leader_verify_owner']) ? $_POST['desin_leader_verify_owner'] : $row['desin_leader_verify_owner'];
$building_heigh_verify_at = $_POST['building_heigh_verify_at'] ?: $row['building_heigh_verify_at']; $building_heigh_verify = isset($_POST['building_heigh_verify']) ? $_POST['building_heigh_verify'] : $row['building_heigh_verify'];
$building_heigh_verify_owner = $_POST['building_heigh_verify_owner'] ?: $row['building_heigh_verify_owner']; $building_heigh_verify_at = isset($_POST['building_heigh_verify_at']) ? $_POST['building_heigh_verify_at'] : $row['building_heigh_verify_at'];
$site_survey_contact_verify = $_POST['site_survey_contact_verify']; $building_heigh_verify_owner = isset($_POST['building_heigh_verify_owner']) ? $_POST['building_heigh_verify_owner'] : $row['building_heigh_verify_owner'];
$site_survey_contact_verify_at = $_POST['site_survey_contact_verify_at'] ?: $row['site_survey_contact_verify_at']; $site_survey_contact_verify = isset($_POST['site_survey_contact_verify']) ? $_POST['site_survey_contact_verify'] : $row['site_survey_contact_verify'];
$site_survey_contact_verify_owner = $_POST['site_survey_contact_verify_owner'] ?: $row['site_survey_contact_verify_owner']; $site_survey_contact_verify_at = isset($_POST['site_survey_contact_verify_at']) ? $_POST['site_survey_contact_verify_at'] : $row['site_survey_contact_verify_at'];
$old_site_survey_contact_verify = $_POST['old_site_survey_contact_verify']; $site_survey_contact_verify_owner = isset($_POST['site_survey_contact_verify_owner']) ? $_POST['site_survey_contact_verify_owner'] : $row['site_survey_contact_verify_owner'];
$shengguanok_status = $_POST['shengguanok_status']; $old_site_survey_contact_verify = isset($_POST['old_site_survey_contact_verify']) ? $_POST['old_site_survey_contact_verify'] : $row['site_survey_contact_verify'];
$shengguanok_status_at = $_POST['shengguanok_status_at']; $shengguanok_status = isset($_POST['shengguanok_status']) ? $_POST['shengguanok_status'] : $row['shengguanok_status'];
$shengguanok_status_owner = $_POST['shengguanok_status_owner'] ?: $row['shengguanok_status_owner']; $shengguanok_status_at = isset($_POST['shengguanok_status_at']) ? $_POST['shengguanok_status_at'] : $row['shengguanok_status_at'];
$prattford_order_date_verify = $_POST['prattford_order_date_verify']; $shengguanok_status_owner = isset($_POST['shengguanok_status_owner']) ? $_POST['shengguanok_status_owner'] : $row['shengguanok_status_owner'];
$prattford_order_date = $_POST['prattford_order_date']; $prattford_order_date_verify = isset($_POST['prattford_order_date_verify']) ? $_POST['prattford_order_date_verify'] : $row['prattford_order_date_verify'];
$prattford_order_date_owner = $_POST['prattford_order_date_owner'] ?: $row['prattford_order_date_owner']; $prattford_order_date = isset($_POST['prattford_order_date']) ? $_POST['prattford_order_date'] : $row['prattford_order_date'];
$estimated_shipping_date_verify = $_POST['estimated_shipping_date_verify']; $prattford_order_date_owner = isset($_POST['prattford_order_date_owner']) ? $_POST['prattford_order_date_owner'] : $row['prattford_order_date_owner'];
$estimated_shipping_date = $_POST['estimated_shipping_date']; $estimated_shipping_date_verify = isset($_POST['estimated_shipping_date_verify']) ? $_POST['estimated_shipping_date_verify'] : $row['estimated_shipping_date_verify'];
$estimated_shipping_date_owner = $_POST['estimated_shipping_date_owner'] ?: $row['estimated_shipping_date_owner']; $estimated_shipping_date = isset($_POST['estimated_shipping_date']) ? $_POST['estimated_shipping_date'] : $row['estimated_shipping_date'];
$estimated_shipping_schedule_date_verify = $_POST['estimated_shipping_schedule_date_verify']; $estimated_shipping_date_owner = isset($_POST['estimated_shipping_date_owner']) ? $_POST['estimated_shipping_date_owner'] : $row['estimated_shipping_date_owner'];
$estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date']; $estimated_shipping_schedule_date_verify = isset($_POST['estimated_shipping_schedule_date_verify']) ? $_POST['estimated_shipping_schedule_date_verify'] : $row['estimated_shipping_schedule_date_verify'];
$estimated_shipping_schedule_date_owner = $_POST['estimated_shipping_schedule_date_owner'] ?: $row['estimated_shipping_schedule_date_owner']; $estimated_shipping_schedule_date = isset($_POST['estimated_shipping_schedule_date']) ? $_POST['estimated_shipping_schedule_date'] : $row['estimated_shipping_schedule_date'];
$goods_type = $_POST['goods_type'] ?: $row['goods_type']; $estimated_shipping_schedule_date_owner = isset($_POST['estimated_shipping_schedule_date_owner']) ? $_POST['estimated_shipping_schedule_date_owner'] : $row['estimated_shipping_schedule_date_owner'];
$goods_type_date = $_POST['goods_type_date'] ?: $row['goods_type_date']; $goods_type = isset($_POST['goods_type']) ? $_POST['goods_type'] : $row['goods_type'];
$goods_type_owner = $_POST['goods_type_owner'] ?: $row['goods_type_owner']; $goods_type_date = isset($_POST['goods_type_date']) ? $_POST['goods_type_date'] : $row['goods_type_date'];
$taiwan_goods_type = $_POST['taiwan_goods_type'] ?: $row['taiwan_goods_type']; $goods_type_owner = isset($_POST['goods_type_owner']) ? $_POST['goods_type_owner'] : $row['goods_type_owner'];
$taiwan_goods_type_date = $_POST['taiwan_goods_type_date']; $taiwan_goods_type = isset($_POST['taiwan_goods_type']) ? $_POST['taiwan_goods_type'] : $row['taiwan_goods_type'];
$taiwan_goods_type_owner = $_POST['taiwan_goods_type_owner'] ?: $row['taiwan_goods_type_owner']; $taiwan_goods_type_date = isset($_POST['taiwan_goods_type_date']) ? $_POST['taiwan_goods_type_date'] : $row['taiwan_goods_type_date'];
$arrival_date_verify = $_POST['arrival_date_verify'] ?: $row['arrival_date_verify']; $taiwan_goods_type_owner = isset($_POST['taiwan_goods_type_owner']) ? $_POST['taiwan_goods_type_owner'] : $row['taiwan_goods_type_owner'];
$actual_tofactory_date = $_POST['actual_tofactory_date']; $arrival_date_verify = isset($_POST['arrival_date_verify']) ? $_POST['arrival_date_verify'] : $row['arrival_date_verify'];
$arrival_date_owner = $_POST['arrival_date_owner'] ?: $row['arrival_da $actual_tofactory_date = isset($_POST['actual_tofactory_date']) ? $_POST['actual_tofactory_date'] : $row['actual_tofactory_date'];
te_owner']; $arrival_date_owner = isset($_POST['arrival_date_owner']) ? $_POST['arrival_date_owner'] : $row['arrival_date_owner'];
$marketing_remark = $_POST['marketing_remark'] ?: $row['marketing_remark']; $marketing_remark = isset($_POST['marketing_remark']) ? $_POST['marketing_remark'] : $row['marketing_remark'];
$desin_remark = $_POST['desin_remark'] ?: $row['desin_remark']; $desin_remark = isset($_POST['desin_remark']) ? $_POST['desin_remark'] : $row['desin_remark'];
$desin_leader_remark = $_POST['desin_leader_remark'] ?: $row['desin_leader_remark']; $desin_leader_remark = isset($_POST['desin_leader_remark']) ? $_POST['desin_leader_remark'] : $row['desin_leader_remark'];
$warehouse_remark = $_POST['warehouse_remark'] ?: $row['warehouse_remark']; $warehouse_remark = isset($_POST['warehouse_remark']) ? $_POST['warehouse_remark'] : $row['warehouse_remark'];
$yewu_remark = $_POST['yewu_remark'] ?: $row['yewu_remark']; $yewu_remark = isset($_POST['yewu_remark']) ? $_POST['yewu_remark'] : $row['yewu_remark'];
$shengguan_remark = $_POST['shengguan_remark'] ?: $row['shengguan_remark']; $shengguan_remark = isset($_POST['shengguan_remark']) ? $_POST['shengguan_remark'] : $row['shengguan_remark'];
$desin_taiwan_items_no = json_encode($_POST['desin_taiwan_items_no'], JSON_UNESCAPED_UNICODE); $qc_date = isset($_POST['qc_date']) ? $_POST['qc_date'] : $row['qc_date'];
$desin_taiwan_items_name = json_encode($_POST['desin_taiwan_items_name'], JSON_UNESCAPED_UNICODE); $qc_date_owner = isset($_POST['qc_date_owner']) ? $_POST['qc_date_owner'] : $row['qc_date_owner'];
$end_qc_date = isset($_POST['end_qc_date']) ? $_POST['end_qc_date'] : $row['end_qc_date'];
$end_qc_date_owner = isset($_POST['end_qc_date_owner']) ? $_POST['end_qc_date_owner'] : $row['end_qc_date_owner'];
$official_check_date = isset($_POST['official_check_date']) ? $_POST['official_check_date'] : $row['official_check_date'];
$old_official_check_date = isset($_POST['old_official_check_date']) ? $_POST['old_official_check_date'] : $row['official_check_date'];
$official_check_date_owner = isset($_POST['official_check_date_owner']) ? $_POST['official_check_date_owner'] : $row['official_check_date_owner'];
$delivery_date = isset($_POST['delivery_date']) ? $_POST['delivery_date'] : $row['delivery_date'];
$old_delivery_date = isset($_POST['old_delivery_date']) ? $_POST['old_delivery_date'] : $row['delivery_date'];
$delivery_date_owner = isset($_POST['delivery_date_owner']) ? $_POST['delivery_date_owner'] : $row['delivery_date_owner'];
$qc_official_type = isset($_POST['qc_official_type']) ? $_POST['qc_official_type'] : $row['qc_official_type'];
$outsourcer_type = isset($_POST['outsourcer_type']) ? $_POST['outsourcer_type'] : $row['outsourcer_type'];
$install_outsourcer = isset($_POST['install_outsourcer']) ? $_POST['install_outsourcer'] : $row['install_outsourcer'];
$install_outsourcer_owner = isset($_POST['install_outsourcer_owner']) ? $_POST['install_outsourcer_owner'] : $row['install_outsourcer_owner'];
$install_outsourcer_date = isset($_POST['install_outsourcer_date']) ? $_POST['install_outsourcer_date'] : $row['install_outsourcer_date'];
$install_outsourcer_date_owner = isset($_POST['install_outsourcer_date_owner']) ? $_POST['install_outsourcer_date_owner'] : $row['install_outsourcer_date_owner'];
$estimate_install_start_date = isset($_POST['estimate_install_start_date']) ? $_POST['estimate_install_start_date'] : $row['estimate_install_start_date'];
$estimate_install_start_date_owner = isset($_POST['estimate_install_start_date_owner']) ? $_POST['estimate_install_start_date_owner'] : $row['estimate_install_start_date_owner'];
$estimate_install_end_date = isset($_POST['estimate_install_end_date']) ? $_POST['estimate_install_end_date'] : $row['estimate_install_end_date'];
$estimate_install_end_date_owner = isset($_POST['estimate_install_end_date_owner']) ? $_POST['estimate_install_end_date_owner'] : $row['estimate_install_end_date_owner'];
$tryrun_outsourcer = isset($_POST['tryrun_outsourcer']) ? $_POST['tryrun_outsourcer'] : $row['tryrun_outsourcer'];
$tryrun_outsourcer_owner = isset($_POST['tryrun_outsourcer_owner']) ? $_POST['tryrun_outsourcer_owner'] : $row['tryrun_outsourcer_owner'];
$tryrun_outsourcer_date = isset($_POST['tryrun_outsourcer_date']) ? $_POST['tryrun_outsourcer_date'] : $row['tryrun_outsourcer_date'];
$tryrun_outsourcer_date_owner = isset($_POST['tryrun_outsourcer_date_owner']) ? $_POST['tryrun_outsourcer_date_owner'] : $row['tryrun_outsourcer_date_owner'];
$estimate_tryrun_start_date = isset($_POST['estimate_tryrun_start_date']) ? $_POST['estimate_tryrun_start_date'] : $row['estimate_tryrun_start_date'];
$estimate_tryrun_start_date_owner = isset($_POST['estimate_tryrun_start_date_owner']) ? $_POST['estimate_tryrun_start_date_owner'] : $row['estimate_tryrun_start_date_owner'];
$estimate_tryrun_end_date = isset($_POST['estimate_tryrun_end_date']) ? $_POST['estimate_tryrun_end_date'] : $row['estimate_tryrun_end_date'];
$estimate_tryrun_end_date_owner = isset($_POST['estimate_tryrun_end_date_owner']) ? $_POST['estimate_tryrun_end_date_owner'] : $row['estimate_tryrun_end_date_owner'];
$warehouse_assistant_remark = isset($_POST['warehouse_assistant_remark']) ? $_POST['warehouse_assistant_remark'] : $row['warehouse_assistant_remark'];
$warehouseid = isset($_POST['warehouseid']) ? $_POST['warehouseid'] : $row['warehouseid'];
$old_warehouseid = isset($_POST['old_warehouseid']) ? $_POST['old_warehouseid'] : $row['warehouseid'];
$salesid = isset($_POST['salesid']) ? $_POST['salesid'] : $row['salesid'];
$install_start_date = isset($_POST['install_start_date']) ? $_POST['install_start_date'] : $row['install_start_date'];
$install_start_date_owner = isset($_POST['install_start_date_owner']) ? $_POST['install_start_date_owner'] : $row['install_start_date_owner'];
$install_end_date = isset($_POST['install_end_date']) ? $_POST['install_end_date'] : $row['install_end_date'];
$install_end_date_owner = isset($_POST['install_end_date_owner']) ? $_POST['install_end_date_owner'] : $row['install_end_date_owner'];
$tryrun_start_date = isset($_POST['tryrun_start_date']) ? $_POST['tryrun_start_date'] : $row['tryrun_start_date'];
$tryrun_start_date_owner = isset($_POST['tryrun_start_date_owner']) ? $_POST['tryrun_start_date_owner'] : $row['tryrun_start_date_owner'];
$tryrun_end_date = isset($_POST['tryrun_end_date']) ? $_POST['tryrun_end_date'] : $row['tryrun_end_date'];
$old_tryrun_end_date = isset($_POST['old_tryrun_end_date']) ? $_POST['old_tryrun_end_date'] : $row['tryrun_end_date'];
$tryrun_end_date_owner = isset($_POST['tryrun_end_date_owner']) ? $_POST['tryrun_end_date_owner'] : $row['tryrun_end_date_owner'];
$association_check_type = isset($_POST['association_check_type']) ? $_POST['association_check_type'] : $row['association_check_type'];
$old_delivery_date_file = isset($_POST['old_delivery_date_file']) ? $_POST['old_delivery_date_file'] : $row['delivery_date_file'];
$desin_taiwan_items_no = isset($_POST['desin_taiwan_items_no']) ? $_POST['desin_taiwan_items_no'] : "";
$desin_taiwan_items_name = isset($_POST['desin_taiwan_items_name']) ? $_POST['desin_taiwan_items_name'] : "";
$desin_taiwan_items_no = json_encode($desin_taiwan_items_no, JSON_UNESCAPED_UNICODE);
$desin_taiwan_items_name = json_encode($desin_taiwan_items_name, JSON_UNESCAPED_UNICODE);
$desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no; $desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no;
$desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name; $desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name;
$qc_date = $_POST['qc_date'] ?: $row['qc_date'];
$qc_date_owner = $_POST['qc_date_owner'] ?: $row['qc_date_owner'];
$end_qc_date = $_POST['end_qc_date'] ?: $row['end_qc_date'];
$end_qc_date_owner = $_POST['end_qc_date_owner'] ?: $row['end_qc_date_owner'];
$official_check_date = $_POST['official_check_date'] ?: $row['official_check_date'];
$old_official_check_date = $_POST['old_official_check_date'] ?: $row['old_official_check_date'];
$official_check_date_owner = $_POST['official_check_date_owner'] ?: $row['official_check_date_owner'];
$delivery_date = $_POST['delivery_date'] ?: $row['delivery_date'];
$old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date'];
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
$qc_official_type = $_POST['qc_official_type'] ?: $row['qc_official_type'];
$outsourcer_type = $_POST['outsourcer_type'];
$install_outsourcer = $_POST['install_outsourcer'];
$install_outsourcer_owner = $_POST['install_outsourcer_owner'];
$install_outsourcer_date = $_POST['install_outsourcer_date'];
$install_outsourcer_date_owner = $_POST['install_outsourcer_date_owner'];
$estimate_install_start_date = $_POST['estimate_install_start_date'];
$estimate_install_start_date_owner = $_POST['estimate_install_start_date_owner'];
$estimate_install_end_date = $_POST['estimate_install_end_date'];
$estimate_install_end_date_owner = $_POST['estimate_install_end_date_owner'];
$tryrun_outsourcer = $_POST['tryrun_outsourcer'];
$tryrun_outsourcer_owner = $_POST['tryrun_outsourcer_owner'];
$tryrun_outsourcer_date = $_POST['tryrun_outsourcer_date'];
$tryrun_outsourcer_date_owner = $_POST['tryrun_outsourcer_date_owner'];
$estimate_tryrun_start_date = $_POST['estimate_tryrun_start_date'];
$estimate_tryrun_start_date_owner = $_POST['estimate_tryrun_start_date_owner'];
$estimate_tryrun_end_date = $_POST['estimate_tryrun_end_date'];
$estimate_tryrun_end_date_owner = $_POST['estimate_tryrun_end_date_owner'];
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
$warehouseid = $_POST['warehouseid'] ?: $row['warehouseid'];
$old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid'];
$salesid = $_POST['salesid'] ?: $row['salesid'];
$install_start_date = $_POST['install_start_date'];
$install_start_date_owner = $_POST['install_start_date_owner'];
$install_end_date = $_POST['install_end_date'];
$install_end_date_owner = $_POST['install_end_date_owner'];
$tryrun_start_date = $_POST['tryrun_start_date'];
$tryrun_start_date_owner = $_POST['tryrun_start_date_owner'];
$tryrun_end_date = $_POST['tryrun_end_date'];
$tryrun_end_date_owner = $_POST['tryrun_end_date_owner'];
$association_check_type = $_POST['association_check_type'];
$salesname = accountid2name($salesid)[$salesid]; $salesname = accountid2name($salesid)[$salesid];
$salesmail = accountid2email([$salesid])[$salesid]; $salesmail = accountid2email([$salesid])[$salesid];
// $creater = $_POST['creater'];
$creater = $user_id; $creater = $user_id;
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
// 上傳附件 // 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php"; include "wipwhole-rec-invoice-edit-fileupload.php";
// 指派工勘人員
if ($warehouseid !== $old_warehouseid) {
if (checkNowFormGStatus($link) == 'G') {
$sql = "SELECT form_key FROM flow
WHERE form_id = '$id'
AND flow_id = 'wws01'
AND flow_code = 'G'
";
$result = mysqli_query($link, $sql);
$form_key = $result->fetch_row()[0];
if (!empty($form_key)) {
$sql = "UPDATE wipwholestatus
SET warehouseid = '$warehouseid'
WHERE id = '$id';
";
mysqli_query($link, $sql);
$sql = "UPDATE subflow
SET current_assigner = '$warehouseid'
WHERE 1 = 1
AND seq = '1'
AND form_key = '$form_key';
";
mysqli_query($link, $sql);
}
}
}
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
FROM account
WHERE department_id = '250'
AND role_id IN ('1','2','3','4');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
// 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array(
"1" => "請選擇",
"0" => "已確認",
"2" => "無工勘需求",
"A" => "未動工",
"B" => "地下室施工",
"C" => "打樁",
"D" => "地基",
"E" => "挖土",
"G" => "機房",
"H" => "機械式淨高",
"M" => "樓中樓",
"OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)",
"R" => "R 樓",
"S" => "停工",
"T" => "TOP",
"TC" => "頂部間隙",
"TS" => "行程",
"TH" => "全高",
"Y" => "已搭、已出",
"YB" => "退購結案",
"YF" => "既有建物",
"YN" => "已搭、未出"
);
$sql = "
SELECT accountid
FROM account
WHERE department_id = '321'
AND role_id IN ('2','3','5');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
$content = "客戶:$custom
作番:$facilityno
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($desin_documents_verify_file)) {
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => "M0168",
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
// 官檢日及移交日通知生管人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$permission = "M0168";
$title = "官檢日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($delivery_date)) {
if ($delivery_date !== $old_delivery_date) {
$permission_arr = ['M0168', 'M0012'];
foreach ($permission_arr as $permission) {
$title = "移交日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
移交日 $old_delivery_date => $delivery_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
if (!empty($delivery_date)) {
if ($old_delivery_date !== $delivery_date) {
if (empty($change_all_contractno)) {
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "-移交日變更通知";
$mail_content = "作番大日程(新梯)
合約號:" . $contractno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
} else {
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "作番號:" . $facilityno . "-移交日變更通知";
$mail_content = "作番大日程(新梯)
合約號:" . $contractno
. "
作番號:" . $facilityno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
}
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail]
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
$updatesql = " $updatesql = "
UPDATE wipwholestatus UPDATE wipwholestatus
SET SET
@ -397,6 +200,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updatesql .= "customer_style_verify_file = '$customer_style_verify_file', "; $updatesql .= "customer_style_verify_file = '$customer_style_verify_file', ";
if (!empty($site_survey_contact_form_verify_file)) if (!empty($site_survey_contact_form_verify_file))
$updatesql .= "site_survey_contact_form_verify_file = '$site_survey_contact_form_verify_file', "; $updatesql .= "site_survey_contact_form_verify_file = '$site_survey_contact_form_verify_file', ";
if (!empty($official_check_file))
$updatesql .= "official_check_file = '$official_check_file', ";
if (!empty($delivery_date_file))
$updatesql .= "delivery_date_file = '$delivery_date_file', ";
} else if ($user_department_id == 911) { } else if ($user_department_id == 911) {
// 設計主管 // 設計主管
if ($role_id == 1) { if ($role_id == 1) {
@ -547,10 +354,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$qc_official_type = isset($_POST['qc_official_type2']) ? $_POST['qc_official_type2'] : $qc_official_type; $qc_official_type = isset($_POST['qc_official_type2']) ? $_POST['qc_official_type2'] : $qc_official_type;
$qc_date = isset($_POST['qc_date2']) ? $_POST['qc_date2'] : $qc_date; $qc_date = isset($_POST['qc_date2']) ? $_POST['qc_date2'] : $qc_date;
$qc_date_owner = isset($_POST['qc_date2_owner']) ? $_POST['qc_date2_owner'] : $qc_date_owner; $qc_date_owner = isset($_POST['qc_date2_owner']) ? $_POST['qc_date2_owner'] : $qc_date_owner;
$end_qc_date = isset($_POST['end_qc_date2']) ? $_POST['end_qc_date2'] : $row['end_qc_date']; $end_qc_date = isset($_POST['end_qc_date2']) ? $_POST['end_qc_date2'] : $end_qc_date;
$end_qc_date_owner = isset($_POST['end_qc_date2_owner']) ? $_POST['end_qc_date2_owner'] : $end_qc_date_owner; $end_qc_date_owner = isset($_POST['end_qc_date2_owner']) ? $_POST['end_qc_date2_owner'] : $end_qc_date_owner;
$official_check_date = isset($_POST['official_check_date2']) ? $_POST['official_check_date2'] : $official_check_date; $official_check_date = isset($_POST['official_check_date2']) ? $_POST['official_check_date2'] : $official_check_date;
$old_official_check_date = isset($_POST['old_official_check_date2']) ? $_POST['old_official_check_date2'] : $old_official_check_date; $old_official_check_date = isset($_POST['old_official_check_date2']) ? $_POST['official_check_date'] : $old_official_check_date;
$official_check_date_owner = isset($_POST['official_check_date2_owner']) ? $_POST['official_check_date2_owner'] : $official_check_date_owner; $official_check_date_owner = isset($_POST['official_check_date2_owner']) ? $_POST['official_check_date2_owner'] : $official_check_date_owner;
$delivery_date = isset($_POST['delivery_date2']) ? $_POST['delivery_date2'] : $delivery_date; $delivery_date = isset($_POST['delivery_date2']) ? $_POST['delivery_date2'] : $delivery_date;
@ -643,8 +450,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updatesql .= "building_heigh_verify_file = '$building_heigh_verify_file', "; $updatesql .= "building_heigh_verify_file = '$building_heigh_verify_file', ";
if (!empty($site_survey_contact_verify_file)) if (!empty($site_survey_contact_verify_file))
$updatesql .= "site_survey_contact_verify_file = '$site_survey_contact_verify_file', "; $updatesql .= "site_survey_contact_verify_file = '$site_survey_contact_verify_file', ";
if (!empty($delivery_date_file)) if (!empty($delivery_date_file2))
$updatesql .= "delivery_date_file = '$delivery_date_file', "; $updatesql .= "delivery_date_file = '$delivery_date_file2', ";
} }
// 許協更新業務確認項目權限 // 許協更新業務確認項目權限
@ -689,6 +496,267 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// echo $updatesql; // echo $updatesql;
// exit; // exit;
mysqli_query($link, $updatesql); mysqli_query($link, $updatesql);
// 指派工勘人員
if ($warehouseid !== $old_warehouseid) {
if (checkNowFormGStatus($link) == 'G') {
$sql = "SELECT form_key FROM flow
WHERE form_id = '$id'
AND flow_id = 'wws01'
AND flow_code = 'G'
";
$result = mysqli_query($link, $sql);
$form_key = $result->fetch_row()[0];
if (!empty($form_key)) {
$sql = "UPDATE wipwholestatus
SET warehouseid = '$warehouseid'
WHERE id = '$id';
";
mysqli_query($link, $sql);
$sql = "UPDATE subflow
SET current_assigner = '$warehouseid'
WHERE 1 = 1
AND seq = '1'
AND form_key = '$form_key';
";
mysqli_query($link, $sql);
}
}
}
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
FROM account
WHERE department_id = '250'
AND role_id IN ('1','2','3','4');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
// 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array(
"1" => "請選擇",
"0" => "已確認",
"2" => "無工勘需求",
"A" => "未動工",
"B" => "地下室施工",
"C" => "打樁",
"D" => "地基",
"E" => "挖土",
"G" => "機房",
"H" => "機械式淨高",
"M" => "樓中樓",
"OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)",
"R" => "R 樓",
"S" => "停工",
"T" => "TOP",
"TC" => "頂部間隙",
"TS" => "行程",
"TH" => "全高",
"Y" => "已搭、已出",
"YB" => "退購結案",
"YF" => "既有建物",
"YN" => "已搭、未出"
);
$sql = "
SELECT accountid
FROM account
WHERE department_id = '321'
AND role_id IN ('2','3','5');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
$content = "客戶:$custom
作番:$facilityno
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($desin_documents_verify_file)) {
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => "M0168",
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
// 官檢日及移交日通知生管人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$permission = "M0168";
$title = "官檢日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($delivery_date)) {
if ($delivery_date !== $old_delivery_date) {
$permission_arr = ['M0168', 'M0012'];
foreach ($permission_arr as $permission) {
$title = "移交日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
移交日 $old_delivery_date => $delivery_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
if (!empty($delivery_date)) {
if ($old_delivery_date !== $delivery_date) {
if (empty($change_all_contractno)) {
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "-移交日變更通知";
$mail_content = "作番大日程(新梯)
合約號:" . $contractno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
} else {
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "作番號:" . $facilityno . "-移交日變更通知";
$mail_content = "作番大日程(新梯)
合約號:" . $contractno
. "
作番號:" . $facilityno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
}
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail]
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
// 當試車完工日更改時 發出通知
if (!empty($tryrun_end_date)) {
if ($tryrun_end_date !== $old_tryrun_end_date) {
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "作番號:" . $facilityno . "客戶名稱:" . $custom . "-試車已完成通知";
$mail_content = "作番大日程(新梯)
合約號:" . $contractno . "
作番號:" . $facilityno . "
客戶名稱:" . $custom . "
已完成試車, 請注意後續交車時間, 如需要官檢, 請提供如下資料
<img style='width: 500px' src='https://masada.com.tw/wms/img/mail001.jpg' />
";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail],
[
accountid2name(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)],
accountid2email(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)]
],
['張崇傑', 'jaychang@masada.com.tw'],
['賴定國', 'guo@masada.com.tw']
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
// 當移交日附件更改時 發出通知
if (!empty($delivery_date_file) || !empty($delivery_date_file2)) {
if ($delivery_date_file !== $old_delivery_date_file || $delivery_date_file2 !== $old_delivery_date_file) {
$delivery_date_file_tmp = $delivery_date_file !== $old_delivery_date_file ? $delivery_date_file : $delivery_date_file2;
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "-交車完成通知";
$mail_content = "作番大日程(新梯)
合約號:" . $contractno . "
作番號:" . $facilityno . "
客戶名稱:" . $custom . "
已完成交車並已上傳交車單或竣工單, 請至OA系統中填寫移交日, 並準備後續請款事宜!
";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail],
[
accountid2name(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)],
accountid2email(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)]
],
['葉俊麟', 'darren@masada.com.tw'],
['蘇淑娥 ', 'supe1218@masada.com.tw']
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
echo " echo "
<script type ='text/JavaScript'> <script type ='text/JavaScript'>
alert('資料更新成功'); alert('資料更新成功');
@ -764,6 +832,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'update_contract_date_form') { if ($_POST['form_name'] == 'update_contract_date_form') {
include "class/Cnotice.php";
include "./class/Cmail.php";
$cmail = new Cmail();
$cn = new Cnotice();
foreach ($_POST as $k => $v) foreach ($_POST as $k => $v)
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));
@ -846,7 +918,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'update_date_form') { if ($_POST['form_name'] == 'update_date_form') {
include "class/Cnotice.php";
include "./class/Cmail.php";
$cmail = new Cmail();
$cn = new Cnotice();
$creater = $user_id; $creater = $user_id;
foreach ($_POST as $k => $v) foreach ($_POST as $k => $v)

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

@ -112,14 +112,15 @@ include "wipwhole-rec-invoice-edit-submit.php";
SELECT SELECT
mid, mid,
pr_item_id, pr_item_id,
version version,
sub_item_id
FROM specsurvey_main FROM specsurvey_main
WHERE contractno = '" . $row["contractno"] . "' WHERE contractno = '" . $row["contractno"] . "'
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row2 = mysqli_fetch_array($result); $row2 = mysqli_fetch_array($result);
if (!empty($row2['mid'])) { if (!empty($row2['mid'])) {
echo "<a target='_blank' href='/wms/mkt/specsurvey_renovate-view.php?pa=" . $row2['mid'] . "," . $row2['pr_item_id'] . "," . $row2['version'] . "&$token_link'>規調:" . $row["contractno"] . "</a>"; echo "<a target='_blank' href='/wms/mkt/specsurvey-view.php?pa=" . $row2['mid'] . "," . $row2['pr_item_id'] . "," . $row2['version'] . "," . $row2['sub_item_id'] . "&$token_link'>規調:" . $row["contractno"] . "</a>";
} }
} }
?> ?>
@ -315,9 +316,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr> <tr>
<td style="vertical-align: middle">官檢類型</td> <td style="vertical-align: middle">官檢類型</td>
<td colspan="3"> <td colspan="3">
<input type='radio' id="association_check_type_1" name='association_check_type' value='1' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '1' ? "checked disabled" : ""; ?> /> <input type='radio' class="disabled_select" id="association_check_type_1" name='association_check_type' value='1' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '1' ? "checked disabled" : ""; ?> />
<label for='association_check_type_1'>需要</label> <label for='association_check_type_1'>需要</label>
<input type='radio' id="association_check_type_2" name='association_check_type' value='2' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '2' ? "checked disabled" : ""; ?> /> <input type='radio' class="disabled_select" id="association_check_type_2" name='association_check_type' value='2' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '2' ? "checked disabled" : ""; ?> />
<label for='association_check_type_2'>不需要</label> <label for='association_check_type_2'>不需要</label>
</td> </td>
</tr> </tr>
@ -506,15 +507,16 @@ include "wipwhole-rec-invoice-edit-submit.php";
<textarea class="form-control disabled_select" 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> </td>
</tr> </tr>
<!-- <tr> <tr>
<td style="vertical-align: middle">移交日</td> <td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control disabled_select" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>> <input class="form-control disabled_select" type="date" min="<?php echo date("Y-m-01"); ?>" max="<?php echo date("Y-m-t"); ?>" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>>
<input type="hidden" id="old_delivery_date" name="old_delivery_date" value="<?= $row['delivery_date']; ?>">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button>
</span> </span>
<input type="hidden" id="old_delivery_date" name="old_delivery_date" value="<?= $row['delivery_date']; ?>"> <input type="hidden" id="old_delivery_date_tmp" value="<?= $row['delivery_date']; ?>">
</div> </div>
</td> </td>
<td style="vertical-align: middle">確認人</td> <td style="vertical-align: middle">確認人</td>
@ -525,7 +527,18 @@ include "wipwhole-rec-invoice-edit-submit.php";
</select> </select>
</td> </td>
<td colspan='4'> <td colspan='4'>
<span class="text-danger">有官檢日或QC合格日後才可填寫</span> <p class="text-danger">1.有官檢日或QC合格日後才可填寫。</p>
<p class="text-danger">2.注意填寫後不可更改!</p>
<p class="text-danger">3.只能維護當前月份。</p>
</td>
</tr>
<!-- <tr>
<td style="vertical-align: middle;">移交日附件(核准函)</td>
<td colspan='3' style="vertical-align: middle;">
<input style="width:70%;display:inline;" type="file" id="delivery_date_file" name="delivery_date_file" <?= $marketing2; ?>>
<?php
echo !empty($row['delivery_date_file']) ? "<a id='delivery_date_a' style='color:#00F;' href='" . $row['delivery_date_file'] . "' target='_blank'>下載附件</a>" : "";
?>
</td> </td>
</tr> --> </tr> -->
<tr> <tr>
@ -554,6 +567,10 @@ include "wipwhole-rec-invoice-edit-submit.php";
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button> <button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span> <span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span>
<?php <?php
} else {
?>
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<?php
} }
?> ?>
</td> </td>
@ -1052,6 +1069,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">實際試車完工日</td> <td style="vertical-align: middle">實際試車完工日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input type="hidden" name="old_tryrun_end_date" value="<?= $row['tryrun_end_date']; ?>">
<input class="form-control" type="date" id="tryrun_end_date" name="tryrun_end_date" value="<?= $row['tryrun_end_date']; ?>" <?= $warehouse2; ?>> <input class="form-control" type="date" id="tryrun_end_date" name="tryrun_end_date" value="<?= $row['tryrun_end_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#tryrun_end_date").val("");' <?= $warehouse2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#tryrun_end_date").val("");' <?= $warehouse2; ?>>清除</button>
@ -1066,7 +1084,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
</select> </select>
</td> </td>
</tr> </tr>
<tr> <!-- <tr>
<td style="vertical-align: middle">移交日</td> <td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
@ -1101,21 +1119,16 @@ include "wipwhole-rec-invoice-edit-submit.php";
<p class="text-danger">2.注意填寫後不可更改!</p> <p class="text-danger">2.注意填寫後不可更改!</p>
<p class="text-danger">3.只能維護當前月份。</p> <p class="text-danger">3.只能維護當前月份。</p>
</td> </td>
</tr> </tr> -->
<tr> <tr>
<td colspan="4"> <td colspan="4">
<?php <?php
if (saveInstallData($user_department_id, $role_id)) { if (saveInstallData($user_department_id, $role_id)) {
echo "<button type='button' onclick='savedata()' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>提交</button>"; echo "<button type='button' onclick='savedata()' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>提交</button>";
// echo "<button onclick='saveInstallData()' type='button' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>存檔</button>";
// echo "<label class='pull-right' for='change_all_contractno_tmp'> 變更此合約全部日期</label>";
// echo "<input class='pull-right' type='checkbox' id='change_all_contractno_tmp' value='1' />";
} }
?> ?>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -1476,9 +1489,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">QC合格日</td> <td style="vertical-align: middle">QC合格日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="end_qc_date" name="end_qc_date" value="<?= $row['end_qc_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>> <input class="form-control disabled_select" type="date" id="end_qc_date" name="end_qc_date" value="<?= $row['end_qc_date']; ?>" <?= $pinzheng; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#end_qc_date").val("");' <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#end_qc_date").val("");' <?= $pinzheng; ?>>清除</button>
</span> </span>
</div> </div>
</td> </td>
@ -1494,10 +1507,10 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">官檢日</td> <td style="vertical-align: middle">官檢日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>> <input class="form-control disabled_select" type="date" id="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?php in_array($user_id, ['M0054']) ? "" : $pinzheng; ?> <?php echo in_array($row['association_check_type'], ['2', '0']) ? "disabled" : ""; ?>>
<input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>> <input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?php echo in_array($row['association_check_type'], ['2', '0']) ? "disabled" : ""; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?php in_array($user_id, ['M0054']) ? "" : $pinzheng; ?><?php echo in_array($row['association_check_type'], ['2', '0']) ? "disabled" : ""; ?>>清除</button>
</span> </span>
</div> </div>
</td> </td>
@ -1512,7 +1525,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr> <tr>
<td style='width:180px;'>官檢附件</td> <td style='width:180px;'>官檢附件</td>
<td> <td>
<input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>> <input style="width:70%;display:inline;" class="disabled_select" type="file" id="official_check_file" name="official_check_file" <?php in_array($user_id, ['M0054']) ? "" : $pinzheng; ?> <?php echo in_array($row['association_check_type'], ['2', '0']) ? "disabled" : ""; ?>>
<?php <?php
echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : ""; echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : "";
?> ?>
@ -1522,7 +1535,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr> <tr>
<td colspan="8"> <td colspan="8">
<?php <?php
if (in_array($user_department_id, [220, 912]) || $user_id == 'M0164') { if (in_array($user_department_id, [220, 912]) || in_array($user_id, ['M0054', 'M0164'])) {
echo "<button onclick='savedata()' type='button' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>存檔</button>"; echo "<button onclick='savedata()' type='button' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>存檔</button>";
} }
?> ?>
@ -1576,7 +1589,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">QC合格日</td> <td style="vertical-align: middle">QC合格日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="end_qc_date2" name="end_qc_date2" value="<?= $row['end_qc_date']; ?>" <?= $warehouse2; ?>> <input class="form-control disabled_select" type="date" id="end_qc_date2" name="end_qc_date2" value="<?= $row['end_qc_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#end_qc_date2").val("");' <?= $warehouse2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#end_qc_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span> </span>
@ -1594,7 +1607,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">官檢日</td> <td style="vertical-align: middle">官檢日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="official_check_date2" name="official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>> <input class="form-control disabled_select" type="date" id="official_check_date2" name="official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>>
<input type="hidden" id="old_official_check_date2" name="old_official_check_date2" value="<?= $row['official_check_date']; ?>"> <input type="hidden" id="old_official_check_date2" name="old_official_check_date2" value="<?= $row['official_check_date']; ?>">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date2").val("");' <?= $warehouse2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#official_check_date2").val("");' <?= $warehouse2; ?>>清除</button>
@ -1905,6 +1918,16 @@ include "wipwhole-rec-invoice-edit-submit.php";
?> ?>
</td> </td>
</tr> </tr>
<tr>
<td style="vertical-align: middle;">移交日附件(核准函)</td>
<td colspan='3' style="vertical-align: middle;">
<input type="hidden" name="old_delivery_date_file" value="<?php echo $row['delivery_date_file']; ?>">
<input style="width:70%;display:inline;" type="file" id="delivery_date_file2" name="delivery_date_file2" <?= $warehouse2; ?>>
<?php
echo !empty($row['delivery_date_file']) ? "<a id='delivery_date_a' style='color:#00F;' href='" . $row['delivery_date_file'] . "' target='_blank'>下載附件</a>" : "";
?>
</td>
</tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<?php <?php

8
wms/wipwhole-renovate-index-export-excel.php

@ -123,7 +123,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
'台灣自理項目(發貨類別)', '台灣自理項目(發貨類別)',
'台灣自理項目(發貨類別)日期', '台灣自理項目(發貨類別)日期',
'實際到貨日(到觀音廠日)', '實際到貨日(到觀音廠日)',
'實際到貨日(到觀音廠日)日期' '實際到貨日(到觀音廠日)日期',
'安裝圖上傳狀態',
'完工驗收單上傳狀態',
'移交日附件(核准函)上傳狀態'
]; ];
$sheet->setTitle('作番大日程(汰改)'); $sheet->setTitle('作番大日程(汰改)');
for ($i = 0; $i < count($colArr); $i++) { for ($i = 0; $i < count($colArr); $i++) {
@ -348,6 +351,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
substr($row['taiwan_goods_type_date'], 0, 10), substr($row['taiwan_goods_type_date'], 0, 10),
$arrival_date_verify_status, $arrival_date_verify_status,
substr($row['actual_tofactory_date'], 0, 10), substr($row['actual_tofactory_date'], 0, 10),
empty($row['plan_diagram_file']) ? "無" : "已上傳",
empty($row['completion_acceptance_file']) ? "無" : "已上傳",
empty($row['delivery_date_file']) ? "無" : "已上傳"
]; ];
for ($j = 0; $j < count($colContentArr); $j++) for ($j = 0; $j < count($colContentArr); $j++)
$sheet->setCellValue($colArr[$j] . $i, $colContentArr[$j]); $sheet->setCellValue($colArr[$j] . $i, $colContentArr[$j]);

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

@ -298,7 +298,8 @@ function getWipwholeSearchSql()
$area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']); $area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']);
$sql = ""; $sql = "";
$sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") "; $sql .= empty($area_no) ? "" : " AND area_no = '$area_no' ";
// $sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") ";
$sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' "; $sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' ";
$sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' "; $sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' ";
$sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' "; $sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' ";
@ -544,7 +545,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -557,7 +559,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -570,7 +573,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -583,7 +587,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -822,7 +827,8 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
AND flow_code IN ('$flow_code') AND flow_code IN ('$flow_code')
) )
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -843,7 +849,8 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
AND flow_code IN ('$flow_code') AND flow_code IN ('$flow_code')
) )
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -864,7 +871,8 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
AND flow_code IN ('$flow_code') AND flow_code IN ('$flow_code')
) )
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -885,7 +893,8 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
AND flow_code IN ('$flow_code') AND flow_code IN ('$flow_code')
) )
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;

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

@ -13,125 +13,136 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$datetime = date("Y-m-d H:i:s"); $datetime = date("Y-m-d H:i:s");
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
$contractno = $_POST['contractno']; $contractno = isset($_POST['contractno']) ? $_POST['contractno'] : $row['contractno'];
$facility_temp_no = $_POST['facility_temp_no']; $facility_temp_no = isset($_POST['facility_temp_no']) ? $_POST['facility_temp_no'] : $row['facility_temp_no'];
$facilityno = isset($_POST['facilityno']) ? $_POST['facilityno'] : $row['facilityno'];
$custom = isset($_POST['custom']) ? $_POST['custom'] : $row['custom'];
$site_manager = isset($_POST['site_manager']) ? $_POST['site_manager'] : $row['site_manager'];
$latitude = isset($_POST['latitude']) ? $_POST['latitude'] : $row['latitude'];
$longitude = isset($_POST['longitude']) ? $_POST['longitude'] : $row['longitude'];
$weight = isset($_POST['weight']) ? $_POST['weight'] : $row['weight'];
$numberofpassenger = isset($_POST['numberofpassenger']) ? $_POST['numberofpassenger'] : $row['numberofpassenger'];
$numberofstop = isset($_POST['numberofstop']) ? $_POST['numberofstop'] : $row['numberofstop'];
$numberoffloor = isset($_POST['numberoffloor']) ? $_POST['numberoffloor'] : $row['numberoffloor'];
$opentype = isset($_POST['opentype']) ? $_POST['opentype'] : $row['opentype'];
$speed = isset($_POST['speed']) ? $_POST['speed'] : $row['speed'];
$facility_kind = isset($_POST['facility_kind']) ? $_POST['facility_kind'] : $row['facility_kind'];
$address = isset($_POST['address']) ? $_POST['address'] : $row['address'];
$real_address = isset($_POST['real_address']) ? $_POST['real_address'] : $row['real_address'];
$contract_arrival_date = isset($_POST['contract_arrival_date']) ? $_POST['contract_arrival_date'] : $row['contract_arrival_date'];;
$real_contract_arrival_date = isset($_POST['real_contract_arrival_date']) ? $_POST['real_contract_arrival_date'] : $row['real_contract_arrival_date'];
$sales_spec_verify = isset($_POST['sales_spec_verify']) ? $_POST['sales_spec_verify'] : $row['sales_spec_verify'];
$sales_spec_verify_at = isset($_POST['sales_spec_verify_at']) ? $_POST['sales_spec_verify_at'] : $row['sales_spec_verify_at'];
$sales_spec_verify_owner = isset($_POST['sales_spec_verify_owner']) ? $_POST['sales_spec_verify_owner'] : $row['sales_spec_verify_owner'];
$customer_color_verify = isset($_POST['customer_color_verify']) ? $_POST['customer_color_verify'] : $row['customer_color_verify'];
$customer_color_verify_at = isset($_POST['customer_color_verify_at']) ? $_POST['customer_color_verify_at'] : $row['customer_color_verify_at'];
$customer_color_verify_owner = isset($_POST['customer_color_verify_owner']) ? $_POST['customer_color_verify_owner'] : $row['customer_color_verify_owner'];
$customer_style_verify = isset($_POST['customer_style_verify']) ? $_POST['customer_style_verify'] : $row['customer_style_verify'];
$customer_style_verify_at = isset($_POST['customer_style_verify_at']) ? $_POST['customer_style_verify_at'] : $row['customer_style_verify_at'];
$customer_style_verify_owner = isset($_POST['customer_style_verify_owner']) ? $_POST['customer_style_verify_owner'] : $row['customer_style_verify_owner'];
$site_survey_contact_form_verify = isset($_POST['site_survey_contact_form_verify']) ? $_POST['site_survey_contact_form_verify'] : $row['site_survey_contact_form_verify'];
$site_survey_contact_form_verify_at = isset($_POST['site_survey_contact_form_verify_at']) ? $_POST['site_survey_contact_form_verify_at'] : $row['site_survey_contact_form_verify_at'];
$site_survey_contact_form_verify_owner = isset($_POST['site_survey_contact_form_verify_owner']) ? $_POST['site_survey_contact_form_verify_owner'] : $row['site_survey_contact_form_verify_owner'];
$desin_spec_verify = isset($_POST['desin_spec_verify']) ? $_POST['desin_spec_verify'] : $row['desin_spec_verify'];
$desin_spec_verify_at = isset($_POST['desin_spec_verify_at']) ? $_POST['desin_spec_verify_at'] : $row['desin_spec_verify_at'];
$desin_spec_verify_owner = isset($_POST['desin_spec_verify_owner']) ? $_POST['desin_spec_verify_owner'] : $row['desin_spec_verify_owner'];
$desin_planning_verify = isset($_POST['desin_planning_verify']) ? $_POST['desin_planning_verify'] : $row['desin_planning_verify'];
$desin_planning_verify_at = isset($_POST['desin_planning_verify_at']) ? $_POST['desin_planning_verify_at'] : $row['desin_planning_verify_at'];
$desin_planning_verify_owner = isset($_POST['desin_planning_verify_owner']) ? $_POST['desin_planning_verify_owner'] : $row['desin_planning_verify_owner'];
$desin_color_verify = isset($_POST['desin_color_verify']) ? $_POST['desin_color_verify'] : $row['desin_color_verify'];
$desin_color_verify_at = isset($_POST['desin_color_verify_at']) ? $_POST['desin_color_verify_at'] : $row['desin_color_verify_at'];
$desin_color_verify_owner = isset($_POST['desin_color_verify_owner']) ? $_POST['desin_color_verify_owner'] : $row['desin_color_verify_owner'];
$desin_style_verify = isset($_POST['desin_style_verify']) ? $_POST['desin_style_verify'] : $row['desin_style_verify'];
$desin_style_verify_at = isset($_POST['desin_style_verify_at']) ? $_POST['desin_style_verify_at'] : $row['desin_style_verify_at'];
$desin_style_verify_owner = isset($_POST['desin_style_verify_owner']) ? $_POST['desin_style_verify_owner'] : $row['desin_style_verify_owner'];
$desin_leader_verify = isset($_POST['desin_leader_verify']) ? $_POST['desin_leader_verify'] : $row['desin_leader_verify'];
$desin_leader_verify_at = isset($_POST['desin_leader_verify_at']) ? $_POST['desin_leader_verify_at'] : $row['desin_leader_verify_at'];
$desin_leader_verify_owner = isset($_POST['desin_leader_verify_owner']) ? $_POST['desin_leader_verify_owner'] : $row['desin_leader_verify_owner'];
$building_heigh_verify = isset($_POST['building_heigh_verify']) ? $_POST['building_heigh_verify'] : $row['building_heigh_verify'];
$building_heigh_verify_at = isset($_POST['building_heigh_verify_at']) ? $_POST['building_heigh_verify_at'] : $row['building_heigh_verify_at'];
$building_heigh_verify_owner = isset($_POST['building_heigh_verify_owner']) ? $_POST['building_heigh_verify_owner'] : $row['building_heigh_verify_owner'];
$customer_planning_verify = isset($_POST['customer_planning_verify']) ? $_POST['customer_planning_verify'] : $row['customer_planning_verify'];
$customer_planning_verify_at = isset($_POST['customer_planning_verify_at']) ? $_POST['customer_planning_verify_at'] : $row['customer_planning_verify_at'];
$customer_planning_verify_owner = isset($_POST['customer_planning_verify_owner']) ? $_POST['customer_planning_verify_owner'] : $row['customer_planning_verify_owner'];
$site_survey_contact_verify = isset($_POST['site_survey_contact_verify']) ? $_POST['site_survey_contact_verify'] : $row['site_survey_contact_verify'];
$site_survey_contact_verify_at = isset($_POST['site_survey_contact_verify_at']) ? $_POST['site_survey_contact_verify_at'] : $row['site_survey_contact_verify_at'];
$site_survey_contact_verify_owner = isset($_POST['site_survey_contact_verify_owner']) ? $_POST['site_survey_contact_verify_owner'] : $row['site_survey_contact_verify_owner'];
$old_site_survey_contact_verify = isset($_POST['old_site_survey_contact_verify']) ? $_POST['old_site_survey_contact_verify'] : $row['site_survey_contact_verify_owner'];
$outsourcer_type = isset($_POST['outsourcer_type']) ? $_POST['outsourcer_type'] : $row['outsourcer_type'];
$install_outsourcer = isset($_POST['install_outsourcer']) ? $_POST['install_outsourcer'] : $row['install_outsourcer'];
$install_outsourcer_owner = isset($_POST['install_outsourcer_owner']) ? $_POST['install_outsourcer_owner'] : $row['install_outsourcer_owner'];
$install_outsourcer_date = isset($_POST['install_outsourcer_date']) ? $_POST['install_outsourcer_date'] : $row['install_outsourcer_date'];
$install_outsourcer_date_owner = isset($_POST['install_outsourcer_date_owner']) ? $_POST['install_outsourcer_date_owner'] : $row['install_outsourcer_date_owner'];
$estimate_install_start_date = isset($_POST['estimate_install_start_date']) ? $_POST['estimate_install_start_date'] : $row['estimate_install_start_date'];
$estimate_install_start_date_owner = isset($_POST['estimate_install_start_date_owner']) ? $_POST['estimate_install_start_date_owner'] : $row['estimate_install_start_date_owner'];
$estimate_install_end_date = isset($_POST['estimate_install_end_date']) ? $_POST['estimate_install_end_date'] : $row['estimate_install_end_date'];
$estimate_install_end_date_owner = isset($_POST['estimate_install_end_date_owner']) ? $_POST['estimate_install_end_date_owner'] : $row['estimate_install_end_date_owner'];
$tryrun_outsourcer = isset($_POST['tryrun_outsourcer']) ? $_POST['tryrun_outsourcer'] : $row['tryrun_outsourcer'];
$tryrun_outsourcer_owner = isset($_POST['tryrun_outsourcer_owner']) ? $_POST['tryrun_outsourcer_owner'] : $row['tryrun_outsourcer_owner'];
$tryrun_outsourcer_date = isset($_POST['tryrun_outsourcer_date']) ? $_POST['tryrun_outsourcer_date'] : $row['tryrun_outsourcer_date'];
$tryrun_outsourcer_date_owner = isset($_POST['tryrun_outsourcer_date_owner']) ? $_POST['tryrun_outsourcer_date_owner'] : $row['tryrun_outsourcer_date_owner'];
$estimate_tryrun_start_date = isset($_POST['estimate_tryrun_start_date']) ? $_POST['estimate_tryrun_start_date'] : $row['estimate_tryrun_start_date'];
$estimate_tryrun_start_date_owner = isset($_POST['estimate_tryrun_start_date_owner']) ? $_POST['estimate_tryrun_start_date_owner'] : $row['estimate_tryrun_start_date_owner'];
$estimate_tryrun_end_date = isset($_POST['estimate_tryrun_end_date']) ? $_POST['estimate_tryrun_end_date'] : $row['estimate_tryrun_end_date'];
$estimate_tryrun_end_date_owner = isset($_POST['estimate_tryrun_end_date_owner']) ? $_POST['estimate_tryrun_end_date_owner'] : $row['estimate_tryrun_end_date_owner'];
$warehouse_assistant_remark = isset($_POST['warehouse_assistant_remark']) ? $_POST['warehouse_assistant_remark'] : $row['warehouse_assistant_remark'];
$shengguanok_status = isset($_POST['shengguanok_status']) ? $_POST['shengguanok_status'] : $row['shengguanok_status'];
$shengguanok_status_at = isset($_POST['shengguanok_status_at']) ? $_POST['shengguanok_status_at'] : $row['shengguanok_status_at'];
$shengguanok_status_owner = isset($_POST['shengguanok_status_owner']) ? $_POST['shengguanok_status_owner'] : $row['shengguanok_status_owner'];
$prattford_order_date_verify = isset($_POST['prattford_order_date_verify']) ? $_POST['prattford_order_date_verify'] : $row['prattford_order_date_verify'];
$prattford_order_date = isset($_POST['prattford_order_date']) ? $_POST['prattford_order_date'] : $row['prattford_order_date'];
$prattford_order_date_owner = isset($_POST['prattford_order_date_owner']) ? $_POST['prattford_order_date_owner'] : $row['prattford_order_date_owner'];
$estimated_shipping_date_verify = isset($_POST['estimated_shipping_date_verify']) ? $_POST['estimated_shipping_date_verify'] : $row['estimated_shipping_date_verify'];
$estimated_shipping_date = isset($_POST['estimated_shipping_date']) ? $_POST['estimated_shipping_date'] : $row['estimated_shipping_date'];
$estimated_shipping_date_owner = isset($_POST['estimated_shipping_date_owner']) ? $_POST['estimated_shipping_date_owner'] : $row['estimated_shipping_date_owner'];
$estimated_shipping_schedule_date_verify = isset($_POST['estimated_shipping_schedule_date_verify']) ? $_POST['estimated_shipping_schedule_date_verify'] : $row['estimated_shipping_schedule_date_verify'];
$estimated_shipping_schedule_date = isset($_POST['estimated_shipping_schedule_date']) ? $_POST['estimated_shipping_schedule_date'] : $row['estimated_shipping_schedule_date'];
$estimated_shipping_schedule_date_owner = isset($_POST['estimated_shipping_schedule_date_owner']) ? $_POST['estimated_shipping_schedule_date_owner'] : $row['estimated_shipping_schedule_date_owner'];
$goods_type = isset($_POST['goods_type']) ? $_POST['goods_type'] : $row['goods_type'];
$goods_type_date = isset($_POST['goods_type_date']) ? $_POST['goods_type_date'] : $row['goods_type_date'];
$goods_type_owner = isset($_POST['goods_type_owner']) ? $_POST['goods_type_owner'] : $row['goods_type_owner'];
$taiwan_goods_type = isset($_POST['taiwan_goods_type']) ? $_POST['taiwan_goods_type'] : $row['taiwan_goods_type'];
$taiwan_goods_type_date = isset($_POST['taiwan_goods_type_date']) ? $_POST['taiwan_goods_type_date'] : $row['taiwan_goods_type_date'];
$taiwan_goods_type_owner = isset($_POST['taiwan_goods_type_owner']) ? $_POST['taiwan_goods_type_owner'] : $row['taiwan_goods_type_owner'];
$arrival_date_verify = isset($_POST['arrival_date_verify']) ? $_POST['arrival_date_verify'] : $row['arrival_date_verify'];
$actual_tofactory_date = isset($_POST['actual_tofactory_date']) ? $_POST['actual_tofactory_date'] : $row['actual_tofactory_date'];
$arrival_date_owner = isset($_POST['arrival_date_owner']) ? $_POST['arrival_date_owner'] : $row['arrival_date_owner'];
$marketing_remark = isset($_POST['marketing_remark']) ? $_POST['marketing_remark'] : $row['marketing_remark'];
$desin_remark = isset($_POST['desin_remark']) ? $_POST['desin_remark'] : $row['desin_remark'];
$desin_leader_remark = isset($_POST['desin_leader_remark']) ? $_POST['desin_leader_remark'] : $row['desin_leader_remark'];
$warehouse_remark = isset($_POST['warehouse_remark']) ? $_POST['warehouse_remark'] : $row['warehouse_remark'];
$yewu_remark = isset($_POST['yewu_remark']) ? $_POST['yewu_remark'] : $row['yewu_remark'];
$shengguan_remark = isset($_POST['shengguan_remark']) ? $_POST['shengguan_remark'] : $row['shengguan_remark'];
$qc_date = isset($_POST['qc_date']) ? $_POST['qc_date'] : $row['qc_date'];
$qc_date_owner = isset($_POST['qc_date_owner']) ? $_POST['qc_date_owner'] : $row['qc_date_owner'];
$end_qc_date = isset($_POST['end_qc_date']) ? $_POST['end_qc_date'] : $row['end_qc_date'];
$end_qc_date_owner = isset($_POST['end_qc_date_owner']) ? $_POST['end_qc_date_owner'] : $row['end_qc_date_owner'];
$official_check_date = isset($_POST['official_check_date']) ? $_POST['official_check_date'] : $row['official_check_date'];
$old_official_check_date = isset($_POST['old_official_check_date']) ? $_POST['old_official_check_date'] : $row['official_check_date'];
$official_check_date_owner = isset($_POST['official_check_date_owner']) ? $_POST['official_check_date_owner'] : $row['official_check_date_owner'];
$delivery_date = isset($_POST['delivery_date']) ? $_POST['delivery_date'] : $row['delivery_date'];
$old_delivery_date = isset($_POST['old_delivery_date']) ? $_POST['old_delivery_date'] : $row['delivery_date'];
$delivery_date_owner = isset($_POST['delivery_date_owner']) ? $_POST['delivery_date_owner'] : $row['delivery_date_owner'];
$salesid = isset($_POST['salesid']) ? $_POST['salesid'] : $row['salesid'];
$warehouseid = isset($_POST['warehouseid']) ? $_POST['warehouseid'] : $row['warehouseid'];
$old_warehouseid = isset($_POST['old_warehouseid']) ? $_POST['old_warehouseid'] : $row['warehouseid'];
$association_check_type = isset($_POST['association_check_type']) ? $_POST['association_check_type'] : $row['association_check_type'];
$install_start_date = isset($_POST['install_start_date']) ? $_POST['install_start_date'] : $row['install_start_date'];
$install_start_date_owner = isset($_POST['install_start_date_owner']) ? $_POST['install_start_date_owner'] : $row['install_start_date_owner'];
$install_end_date = isset($_POST['install_end_date']) ? $_POST['install_end_date'] : $row['install_end_date'];
$install_end_date_owner = isset($_POST['install_end_date_owner']) ? $_POST['install_end_date_owner'] : $row['install_end_date_owner'];
$tryrun_start_date = isset($_POST['tryrun_start_date']) ? $_POST['tryrun_start_date'] : $row['tryrun_start_date'];
$tryrun_start_date_owner = isset($_POST['tryrun_start_date_owner']) ? $_POST['tryrun_start_date_owner'] : $row['tryrun_start_date_owner'];
$tryrun_end_date = isset($_POST['tryrun_end_date']) ? $_POST['tryrun_end_date'] : $row['tryrun_end_date'];
$old_tryrun_end_date = isset($_POST['old_tryrun_end_date']) ? $_POST['old_tryrun_end_date'] : $row['tryrun_end_date'];
$tryrun_end_date_owner = isset($_POST['tryrun_end_date_owner']) ? $_POST['tryrun_end_date_owner'] : $row['tryrun_end_date_owner'];
$old_delivery_date_file = isset($_POST['old_delivery_date_file']) ? $_POST['old_delivery_date_file'] : $row['delivery_date_file'];
$renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE); $renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE);
$facilityno = $_POST['facilityno'];
$custom = $_POST['custom'];
$site_manager = $_POST['site_manager'];
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];
$weight = $_POST['weight'];
$numberofpassenger = $_POST['numberofpassenger'];
$numberofstop = $_POST['numberofstop'];
$numberoffloor = $_POST['numberoffloor'];
$opentype = $_POST['opentype'];
$speed = $_POST['speed'];
$facility_kind = $_POST['facility_kind'];
$address = $_POST['address'];
$real_address = $_POST['real_address'];
$contract_arrival_date = $_POST['contract_arrival_date'];
$real_contract_arrival_date = $_POST['real_contract_arrival_date'];
$sales_spec_verify = $_POST['sales_spec_verify'];
$sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at'];
$sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner'];
$customer_color_verify = $_POST['customer_color_verify'];
$customer_color_verify_at = $_POST['customer_color_verify_at'] ?: $row['customer_color_verify_at'];
$customer_color_verify_owner = $_POST['customer_color_verify_owner'] ?: $row['customer_color_verify_owner'];
$customer_style_verify = $_POST['customer_style_verify'];
$customer_style_verify_at = $_POST['customer_style_verify_at'] ?: $row['customer_style_verify_at'];
$customer_style_verify_owner = $_POST['customer_style_verify_owner'] ?: $row['customer_style_verify_owner'];
$site_survey_contact_form_verify = $_POST['site_survey_contact_form_verify'];
$site_survey_contact_form_verify_at = $_POST['site_survey_contact_form_verify_at'] ?: $row['site_survey_contact_form_verify_at'];
$site_survey_contact_form_verify_owner = $_POST['site_survey_contact_form_verify_owner'] ?: $row['site_survey_contact_form_verify_owner'];
$desin_spec_verify = $_POST['desin_spec_verify'];
$desin_spec_verify_at = $_POST['desin_spec_verify_at'] ?: $row['desin_spec_verify_at'];
$desin_spec_verify_owner = $_POST['desin_spec_verify_owner'] ?: $row['desin_spec_verify_owner'];
$desin_planning_verify = $_POST['desin_planning_verify'];
$desin_planning_verify_at = $_POST['desin_planning_verify_at'] ?: $row['desin_planning_verify_at'];
$desin_planning_verify_owner = $_POST['desin_planning_verify_owner'] ?: $row['desin_planning_verify_owner'];
$desin_color_verify = $_POST['desin_color_verify'];
$desin_color_verify_at = $_POST['desin_color_verify_at'] ?: $row['desin_color_verify_at'];
$desin_color_verify_owner = $_POST['desin_color_verify_owner'] ?: $row['desin_color_verify_owner'];
$desin_style_verify = $_POST['desin_style_verify'];
$desin_style_verify_at = $_POST['desin_style_verify_at'] ?: $row['desin_style_verify_at'];
$desin_style_verify_owner = $_POST['desin_style_verify_owner'] ?: $row['desin_style_verify_owner'];
$desin_leader_verify = $_POST['desin_leader_verify'];
$desin_leader_verify_at = $_POST['desin_leader_verify_at'] ?: $row['desin_leader_verify_at'];
$desin_leader_verify_owner = $_POST['desin_leader_verify_owner'] ?: $row['desin_leader_verify_owner'];
$building_heigh_verify = $_POST['building_heigh_verify'];
$building_heigh_verify_at = $_POST['building_heigh_verify_at'] ?: $row['building_heigh_verify_at'];
$building_heigh_verify_owner = $_POST['building_heigh_verify_owner'] ?: $row['building_heigh_verify_owner'];
$customer_planning_verify = $_POST['customer_planning_verify'];
$customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at'];
$customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner'];
$site_survey_contact_verify = $_POST['site_survey_contact_verify'];
$site_survey_contact_verify_at = $_POST['site_survey_contact_verify_at'] ?: $row['site_survey_contact_verify_at'];
$site_survey_contact_verify_owner = $_POST['site_survey_contact_verify_owner'] ?: $row['site_survey_contact_verify_owner'];
$old_site_survey_contact_verify = $_POST['old_site_survey_contact_verify'];
$outsourcer_type = $_POST['outsourcer_type'];
$install_outsourcer = $_POST['install_outsourcer'];
$install_outsourcer_owner = $_POST['install_outsourcer_owner'];
$install_outsourcer_date = $_POST['install_outsourcer_date'];
$install_outsourcer_date_owner = $_POST['install_outsourcer_date_owner'];
$estimate_install_start_date = $_POST['estimate_install_start_date'];
$estimate_install_start_date_owner = $_POST['estimate_install_start_date_owner'];
$estimate_install_end_date = $_POST['estimate_install_end_date'];
$estimate_install_end_date_owner = $_POST['estimate_install_end_date_owner'];
$tryrun_outsourcer = $_POST['tryrun_outsourcer'];
$tryrun_outsourcer_owner = $_POST['tryrun_outsourcer_owner'];
$tryrun_outsourcer_date = $_POST['tryrun_outsourcer_date'];
$tryrun_outsourcer_date_owner = $_POST['tryrun_outsourcer_date_owner'];
$estimate_tryrun_start_date = $_POST['estimate_tryrun_start_date'];
$estimate_tryrun_start_date_owner = $_POST['estimate_tryrun_start_date_owner'];
$estimate_tryrun_end_date = $_POST['estimate_tryrun_end_date'];
$estimate_tryrun_end_date_owner = $_POST['estimate_tryrun_end_date_owner'];
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
$shengguanok_status = $_POST['shengguanok_status'];
$shengguanok_status_at = $_POST['shengguanok_status_at'];
$shengguanok_status_owner = $_POST['shengguanok_status_owner'] ?: $row['shengguanok_status_owner'];
$prattford_order_date_verify = $_POST['prattford_order_date_verify'];
$prattford_order_date = $_POST['prattford_order_date'];
$prattford_order_date_owner = $_POST['prattford_order_date_owner'] ?: $row['prattford_order_date_owner'];
$estimated_shipping_date_verify = $_POST['estimated_shipping_date_verify'];
$estimated_shipping_date = $_POST['estimated_shipping_date'];
$estimated_shipping_date_owner = $_POST['estimated_shipping_date_owner'] ?: $row['estimated_shipping_date_owner'];
$estimated_shipping_schedule_date_verify = $_POST['estimated_shipping_schedule_date_verify'];
$estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date'];
$estimated_shipping_schedule_date_owner = $_POST['estimated_shipping_schedule_date_owner'] ?: $row['estimated_shipping_schedule_date_owner'];
$goods_type = $_POST['goods_type'] ?: $row['goods_type'];
$goods_type_date = $_POST['goods_type_date'];
$goods_type_owner = $_POST['goods_type_owner'] ?: $row['goods_type_owner'];
$taiwan_goods_type = $_POST['taiwan_goods_type'] ?: $row['taiwan_goods_type'];
$taiwan_goods_type_date = $_POST['taiwan_goods_type_date'];
$taiwan_goods_type_owner = $_POST['taiwan_goods_type_owner'] ?: $row['taiwan_goods_type_owner'];
$arrival_date_verify = $_POST['arrival_date_verify'] ?: $row['arrival_date_verify'];
$actual_tofactory_date = $_POST['actual_tofactory_date'];
$arrival_date_owner = $_POST['arrival_date_owner'] ?: $row['arrival_date_owner'];
$marketing_remark = $_POST['marketing_remark'] ?: $row['marketing_remark'];
$desin_remark = $_POST['desin_remark'] ?: $row['desin_remark'];
$desin_leader_remark = $_POST['desin_leader_remark'] ?: $row['desin_leader_remark'];
$warehouse_remark = $_POST['warehouse_remark'] ?: $row['warehouse_remark'];
$yewu_remark = $_POST['yewu_remark'] ?: $row['yewu_remark'];
$shengguan_remark = $_POST['shengguan_remark'] ?: $row['shengguan_remark'];
$desin_taiwan_items_no = json_encode($_POST['desin_taiwan_items_no'], JSON_UNESCAPED_UNICODE); $desin_taiwan_items_no = json_encode($_POST['desin_taiwan_items_no'], JSON_UNESCAPED_UNICODE);
$desin_taiwan_items_name = json_encode($_POST['desin_taiwan_items_name'], JSON_UNESCAPED_UNICODE); $desin_taiwan_items_name = json_encode($_POST['desin_taiwan_items_name'], JSON_UNESCAPED_UNICODE);
$desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no; $desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no;
$desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name; $desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name;
$qc_date = $_POST['qc_date'] ?: $row['qc_date'];
$qc_date_owner = $_POST['qc_date_owner'] ?: $row['qc_date_owner'];
$end_qc_date = $_POST['end_qc_date'] ?: $row['end_qc_date'];
$end_qc_date_owner = $_POST['end_qc_date_owner'] ?: $row['end_qc_date_owner'];
$official_check_date = $_POST['official_check_date'] ?: $row['official_check_date'];
$old_official_check_date = $_POST['old_official_check_date'] ?: $row['old_official_check_date'];
$official_check_date_owner = $_POST['official_check_date_owner'] ?: $row['official_check_date_owner'];
$delivery_date = $_POST['delivery_date'] ?: $row['delivery_date'];
$old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date'];
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
$salesid = $_POST['salesid'] ?: $row['salesid'];
$warehouseid = $_POST['warehouseid'] ?: $row['warehouseid'];
$old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid'];
$association_check_type = $_POST['association_check_type'] ?: $row['association_check_type'];
$salesname = accountid2name($salesid)[$salesid]; $salesname = accountid2name($salesid)[$salesid];
$salesmail = accountid2email([$salesid])[$salesid]; $salesmail = accountid2email([$salesid])[$salesid];
@ -141,209 +152,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 上傳附件 // 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php"; include "wipwhole-rec-invoice-edit-fileupload.php";
// 指派工勘人員
if ($warehouseid !== $old_warehouseid) {
if (checkNowFormStatus($link) == 'A') {
$sql = "SELECT form_key FROM flow
WHERE form_id = '$id'
AND flow_id = 'wws02'
AND flow_code = 'A'
";
$result = mysqli_query($link, $sql);
$form_key = $result->fetch_row()[0];
if (!empty($form_key)) {
$sql = "UPDATE wipwholestatus
SET warehouseid = '$warehouseid'
WHERE id = '$id';
";
mysqli_query($link, $sql);
$sql = "UPDATE subflow
SET current_assigner = '$warehouseid'
WHERE 1 = 1
AND seq = '1'
AND form_key = '$form_key';
";
mysqli_query($link, $sql);
}
}
}
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
FROM account
WHERE department_id = '250'
AND role_id IN ('1','2','3','4');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
// 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array(
"1" => "請選擇",
"0" => "已確認",
"2" => "無工勘需求",
"A" => "未動工",
"B" => "地下室施工",
"C" => "打樁",
"D" => "地基",
"E" => "挖土",
"G" => "機房",
"H" => "機械式淨高",
"M" => "樓中樓",
"OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)",
"R" => "R 樓",
"S" => "停工",
"T" => "TOP",
"TC" => "頂部間隙",
"TS" => "行程",
"TH" => "全高",
"Y" => "已搭、已出",
"YB" => "退購結案",
"YF" => "既有建物",
"YN" => "已搭、未出"
);
$sql = "
SELECT accountid
FROM account
WHERE department_id = '321'
AND role_id IN ('2','3','5');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
$content = "客戶:$custom
作番:$facilityno
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($desin_documents_verify_file)) {
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => "M0168",
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
// 官檢日及移交日通知生管人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$permission = "M0168";
$title = "官檢日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($delivery_date)) {
if ($delivery_date !== $old_delivery_date) {
$permission_arr = ['M0168', 'M0012'];
foreach ($permission_arr as $permission) {
// $permission = "M0168";
$title = "移交日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
移交日 $old_delivery_date => $delivery_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
if (!empty($delivery_date)) {
if ($old_delivery_date !== $delivery_date) {
if (empty($change_all_contractno)) {
$mail_title = "作番大日程(汰改)合約號:" . $contractno . "-移交日變更通知";
$mail_content = "作番大日程(汰改)
合約號:" . $contractno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
} else {
$mail_title = "作番大日程(汰改)合約號:" . $contractno . "作番號:" . $facilityno . "-移交日變更通知";
$mail_content = "作番大日程(汰改)
合約號:" . $contractno
. "
作番號:" . $facilityno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
}
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail],
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
$updatesql = "update wipwholestatus set "; $updatesql = "update wipwholestatus set ";
@ -400,6 +208,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updatesql .= empty($customer_color_verify_file) ? "" : "customer_color_verify_file = '$customer_color_verify_file',"; $updatesql .= empty($customer_color_verify_file) ? "" : "customer_color_verify_file = '$customer_color_verify_file',";
$updatesql .= empty($customer_style_verify_file) ? "" : "customer_style_verify_file = '$customer_style_verify_file',"; $updatesql .= empty($customer_style_verify_file) ? "" : "customer_style_verify_file = '$customer_style_verify_file',";
$updatesql .= empty($site_survey_contact_form_verify_file) ? "" : "site_survey_contact_form_verify_file = '$site_survey_contact_form_verify_file',"; $updatesql .= empty($site_survey_contact_form_verify_file) ? "" : "site_survey_contact_form_verify_file = '$site_survey_contact_form_verify_file',";
if (!empty($official_check_file))
$updatesql .= "official_check_file = '$official_check_file', ";
if (!empty($delivery_date_file))
$updatesql .= "delivery_date_file = '$delivery_date_file', ";
} else if ($user_department_id == 911) { } else if ($user_department_id == 911) {
// 設計主管 // 設計主管
if ($role_id == 1) { if ($role_id == 1) {
@ -567,7 +379,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$qc_official_type = isset($_POST['qc_official_type2']) ? $_POST['qc_official_type2'] : $qc_official_type; $qc_official_type = isset($_POST['qc_official_type2']) ? $_POST['qc_official_type2'] : $qc_official_type;
$qc_date = isset($_POST['qc_date2']) ? $_POST['qc_date2'] : $qc_date; $qc_date = isset($_POST['qc_date2']) ? $_POST['qc_date2'] : $qc_date;
$qc_date_owner = isset($_POST['qc_date2_owner']) ? $_POST['qc_date2_owner'] : $qc_date_owner; $qc_date_owner = isset($_POST['qc_date2_owner']) ? $_POST['qc_date2_owner'] : $qc_date_owner;
$end_qc_date = isset($_POST['end_qc_date2']) ? $_POST['end_qc_date2'] : $row['end_qc_date']; $end_qc_date = isset($_POST['end_qc_date2']) ? $_POST['end_qc_date2'] : $end_qc_date;
$end_qc_date_owner = isset($_POST['end_qc_date2_owner']) ? $_POST['end_qc_date2_owner'] : $end_qc_date_owner; $end_qc_date_owner = isset($_POST['end_qc_date2_owner']) ? $_POST['end_qc_date2_owner'] : $end_qc_date_owner;
$official_check_date = isset($_POST['official_check_date2']) ? $_POST['official_check_date2'] : $official_check_date; $official_check_date = isset($_POST['official_check_date2']) ? $_POST['official_check_date2'] : $official_check_date;
$old_official_check_date = isset($_POST['old_official_check_date2']) ? $_POST['old_official_check_date2'] : $old_official_check_date; $old_official_check_date = isset($_POST['old_official_check_date2']) ? $_POST['old_official_check_date2'] : $old_official_check_date;
@ -662,8 +474,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updatesql .= "building_heigh_verify_file = '$building_heigh_verify_file', "; $updatesql .= "building_heigh_verify_file = '$building_heigh_verify_file', ";
if (!empty($site_survey_contact_verify_file)) if (!empty($site_survey_contact_verify_file))
$updatesql .= "site_survey_contact_verify_file = '$site_survey_contact_verify_file', "; $updatesql .= "site_survey_contact_verify_file = '$site_survey_contact_verify_file', ";
if (!empty($delivery_date_file)) if (!empty($delivery_date_file2))
$updatesql .= "delivery_date_file = '$delivery_date_file', "; $updatesql .= "delivery_date_file = '$delivery_date_file2', ";
} }
// 許協更新業務確認項目權限 // 許協更新業務確認項目權限
@ -709,6 +521,272 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// echo $updatesql; // echo $updatesql;
// exit; // exit;
mysqli_query($link, $updatesql); mysqli_query($link, $updatesql);
// 指派工勘人員
if ($warehouseid !== $old_warehouseid) {
if (checkNowFormStatus($link) == 'A') {
$sql = "SELECT form_key FROM flow
WHERE form_id = '$id'
AND flow_id = 'wws02'
AND flow_code = 'A'
";
$result = mysqli_query($link, $sql);
$form_key = $result->fetch_row()[0];
if (!empty($form_key)) {
$sql = "UPDATE wipwholestatus
SET warehouseid = '$warehouseid'
WHERE id = '$id';
";
mysqli_query($link, $sql);
$sql = "UPDATE subflow
SET current_assigner = '$warehouseid'
WHERE 1 = 1
AND seq = '1'
AND form_key = '$form_key';
";
mysqli_query($link, $sql);
}
}
}
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
FROM account
WHERE department_id = '250'
AND role_id IN ('1','2','3','4');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
// 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array(
"1" => "請選擇",
"0" => "已確認",
"2" => "無工勘需求",
"A" => "未動工",
"B" => "地下室施工",
"C" => "打樁",
"D" => "地基",
"E" => "挖土",
"G" => "機房",
"H" => "機械式淨高",
"M" => "樓中樓",
"OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)",
"R" => "R 樓",
"S" => "停工",
"T" => "TOP",
"TC" => "頂部間隙",
"TS" => "行程",
"TH" => "全高",
"Y" => "已搭、已出",
"YB" => "退購結案",
"YF" => "既有建物",
"YN" => "已搭、未出"
);
$sql = "
SELECT accountid
FROM account
WHERE department_id = '321'
AND role_id IN ('2','3','5');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
$content = "客戶:$custom
作番:$facilityno
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($desin_documents_verify_file)) {
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => "M0168",
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
// 官檢日及移交日通知生管人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$permission = "M0168";
$title = "官檢日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($delivery_date)) {
if ($delivery_date !== $old_delivery_date) {
$permission_arr = ['M0168', 'M0012'];
foreach ($permission_arr as $permission) {
// $permission = "M0168";
$title = "移交日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
移交日 $old_delivery_date => $delivery_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
if (!empty($delivery_date)) {
if ($old_delivery_date !== $delivery_date) {
if (empty($change_all_contractno)) {
$mail_title = "作番大日程(汰改)合約號:" . $contractno . "-移交日變更通知";
$mail_content = "作番大日程(汰改)
合約號:" . $contractno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
} else {
$mail_title = "作番大日程(汰改)合約號:" . $contractno . "作番號:" . $facilityno . "-移交日變更通知";
$mail_content = "作番大日程(汰改)
合約號:" . $contractno
. "
作番號:" . $facilityno
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
}
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail],
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
// 當試車完工日更改時 發出通知
if (!empty($tryrun_end_date) || !empty($tryrun_end_date2)) {
if ($tryrun_end_date !== $old_tryrun_end_date || $tryrun_end_date2 !== $old_tryrun_end_date) {
$tryrun_end_date_tmp = $tryrun_end_date !== $old_tryrun_end_date ? $tryrun_end_date : $tryrun_end_date2;
$mail_title = "作番大日程(汰改)合約號:" . $contractno . "作番號:" . $facilityno . "客戶名稱:" . $custom . "-試車已完成通知";
$mail_content = "作番大日程(汰改)
合約號:" . $contractno . "
作番號:" . $facilityno . "
客戶名稱:" . $custom . "
已完成試車, 請注意後續交車時間, 如需要官檢, 請提供如下資料
<img style='width: 500px' src='https://masada.com.tw/wms/img/mail001.jpg' />
";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail],
[
accountid2name(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)],
accountid2email(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)]
],
['張崇傑', 'jaychang@masada.com.tw'],
['賴定國', 'guo@masada.com.tw']
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
// 當移交日附件更改時 發出通知
if (!empty($delivery_date_file) || !empty($delivery_date_file2)) {
if ($delivery_date_file !== $old_delivery_date_file || $delivery_date_file2 !== $old_delivery_date_file) {
$delivery_date_file_tmp = $delivery_date_file !== $old_delivery_date_file ? $delivery_date_file : $delivery_date_file2;
$mail_title = "作番大日程(汰改)合約號:" . $contractno . "-交車完成通知";
$mail_content = "作番大日程(汰改)
合約號:" . $contractno . "
作番號:" . $facilityno . "
客戶名稱:" . $custom . "
已完成交車並已上傳交車單或竣工單, 請至OA系統中填寫移交日, 並準備後續請款事宜!
";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail],
[
accountid2name(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)],
accountid2email(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)]
],
['葉俊麟', 'darren@masada.com.tw'],
['蘇淑娥 ', 'supe1218@masada.com.tw']
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
);
}
}
echo " echo "
<script type ='text/JavaScript'> <script type ='text/JavaScript'>
alert('資料更新成功'); alert('資料更新成功');
@ -777,6 +855,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'update_contract_date_form') { if ($_POST['form_name'] == 'update_contract_date_form') {
include "class/Cnotice.php";
include "./class/Cmail.php";
$cmail = new Cmail();
$cn = new Cnotice();
foreach ($_POST as $k => $v) foreach ($_POST as $k => $v)
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));

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

@ -107,14 +107,15 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
SELECT SELECT
mid, mid,
pr_item_id, pr_item_id,
version version,
sub_item_id
FROM specsurvey_main FROM specsurvey_main
WHERE contractno = '" . $row["contractno"] . "' WHERE contractno = '" . $row["contractno"] . "'
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row2 = mysqli_fetch_array($result); $row2 = mysqli_fetch_array($result);
if (!empty($row2['mid'])) { if (!empty($row2['mid'])) {
echo "<a target='_blank' href='/wms/mkt/specsurvey_renovate-view.php?pa=" . $row2['mid'] . "," . $row2['pr_item_id'] . "," . $row2['version'] . "&$token_link'>規調:" . $row["contractno"] . "</a>"; echo "<a target='_blank' href='/wms/mkt/specsurvey_renovate-view.php?pa=" . $row2['mid'] . "," . $row2['pr_item_id'] . "," . $row2['version'] . "," . $row2['sub_item_id'] . "&$token_link'>規調:" . $row["contractno"] . "</a>";
} }
} }
?> ?>
@ -536,6 +537,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">實際試車完工日</td> <td style="vertical-align: middle">實際試車完工日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input type="hidden" name="old_tryrun_end_date" value="<?= $row['tryrun_end_date']; ?>">
<input class="form-control" type="date" id="tryrun_end_date" name="tryrun_end_date" value="<?= $row['tryrun_end_date']; ?>" <?= $warehouse2; ?>> <input class="form-control" type="date" id="tryrun_end_date" name="tryrun_end_date" value="<?= $row['tryrun_end_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#tryrun_end_date").val("");' <?= $warehouse2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#tryrun_end_date").val("");' <?= $warehouse2; ?>>清除</button>
@ -550,7 +552,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
</select> </select>
</td> </td>
</tr> </tr>
<tr> <!-- <tr>
<td style="vertical-align: middle">移交日</td> <td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
@ -585,7 +587,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<p class="text-danger">2.注意填寫後不可更改!</p> <p class="text-danger">2.注意填寫後不可更改!</p>
<p class="text-danger">3.只能維護當前月份。</p> <p class="text-danger">3.只能維護當前月份。</p>
</td> </td>
</tr> </tr> -->
<tr> <tr>
<td colspan="4"> <td colspan="4">
<?php <?php
@ -622,9 +624,9 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr> <tr>
<td style="vertical-align: middle">官檢類型</td> <td style="vertical-align: middle">官檢類型</td>
<td colspan="3"> <td colspan="3">
<input type='radio' id="association_check_type_1" name='association_check_type' value='1' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '1' ? "checked disabled" : ""; ?> /> <input type='radio' class='disabled_select' id="association_check_type_1" name='association_check_type' value='1' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '1' ? "checked disabled" : ""; ?> />
<label for='association_check_type_1'>需要</label> <label for='association_check_type_1'>需要</label>
<input type='radio' id="association_check_type_2" name='association_check_type' value='2' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '2' ? "checked disabled" : ""; ?> /> <input type='radio' class='disabled_select' id="association_check_type_2" name='association_check_type' value='2' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '2' ? "checked disabled" : ""; ?> />
<label for='association_check_type_2'>不需要</label> <label for='association_check_type_2'>不需要</label>
</td> </td>
</tr> </tr>
@ -824,15 +826,16 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td colspan="7"> <td colspan="7">
<textarea class="form-control " name="marketing_remark" <?= $marketing; ?>><?php echo $row['marketing_remark']; ?></textarea> <textarea class="form-control " name="marketing_remark" <?= $marketing; ?>><?php echo $row['marketing_remark']; ?></textarea>
</tr> </tr>
<!-- <tr> <tr>
<td style="vertical-align: middle">移交日</td> <td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control disabled_select" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>> <input class="form-control disabled_select" type="date" min="<?php echo date("Y-m-01"); ?>" max="<?php echo date("Y-m-t"); ?>" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>>
<input type="hidden" id="old_delivery_date" name="old_delivery_date" value="<?= $row['delivery_date']; ?>">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button>
</span> </span>
<input type="hidden" id="old_delivery_date" name="old_delivery_date" value="<?= $row['delivery_date']; ?>"> <input type="hidden" id="old_delivery_date_tmp" value="<?= $row['delivery_date']; ?>">
</div> </div>
</td> </td>
<td style="vertical-align: middle">確認人</td> <td style="vertical-align: middle">確認人</td>
@ -843,7 +846,18 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
</select> </select>
</td> </td>
<td colspan='4'> <td colspan='4'>
<span class="text-danger">有官檢日或QC合格日後才可填寫</span> <p class="text-danger">1.有官檢日或QC合格日後才可填寫。</p>
<p class="text-danger">2.注意填寫後不可更改!</p>
<p class="text-danger">3.只能維護當前月份。</p>
</td>
</tr>
<!-- <tr>
<td style="vertical-align: middle;">移交日附件(核准函)</td>
<td colspan='3' style="vertical-align: middle;">
<input style="width:70%;display:inline;" type="file" id="delivery_date_file" name="delivery_date_file" <?= $marketing2; ?>>
<?php
echo !empty($row['delivery_date_file']) ? "<a id='delivery_date_a' style='color:#00F;' href='" . $row['delivery_date_file'] . "' target='_blank'>下載附件</a>" : "";
?>
</td> </td>
</tr> --> </tr> -->
<tr> <tr>
@ -871,6 +885,10 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button> <button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span> <span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span>
<?php <?php
} else {
?>
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<?php
} }
?> ?>
</td> </td>
@ -1470,7 +1488,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">QC合格日</td> <td style="vertical-align: middle">QC合格日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="end_qc_date" name="end_qc_date" value="<?= $row['end_qc_date']; ?>" <?= $pinzheng; ?>> <input class="form-control disabled_select" type="date" id="end_qc_date" name="end_qc_date" value="<?= $row['end_qc_date']; ?>" <?= $pinzheng; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#end_qc_date").val("");' <?= $pinzheng; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#end_qc_date").val("");' <?= $pinzheng; ?>>清除</button>
</span> </span>
@ -1488,10 +1506,10 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">官檢日</td> <td style="vertical-align: middle">官檢日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>> <input class="form-control disabled_select" type="date" id="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?php in_array($user_id, ["M0054"]) ? "" : $pinzheng; ?> <?php echo in_array($row['association_check_type'], ['0', '2']) ? "disabled" : ""; ?>>
<input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>> <input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?php in_array($user_id, ["M0054"]) ? "" : $pinzheng; ?> <?php echo in_array($row['association_check_type'], ['0', '2']) ? "disabled" : ""; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?php in_array($user_id, ["M0054"]) ? "" : $pinzheng; ?> <?php echo in_array($row['association_check_type'], ['0', '2']) ? "disabled" : ""; ?>>清除</button>
</span> </span>
</div> </div>
</td> </td>
@ -1506,7 +1524,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr> <tr>
<td style='width:180px;'>官檢附件</td> <td style='width:180px;'>官檢附件</td>
<td> <td>
<input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>> <input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?php in_array($user_id, ["M0054"]) ? "" : $pinzheng; ?> <?php echo in_array($row['association_check_type'], ['0', '2']) ? "disabled" : ""; ?>>
<?php <?php
echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : ""; echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : "";
?> ?>
@ -1516,7 +1534,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr> <tr>
<td colspan="8"> <td colspan="8">
<?php <?php
if (in_array($user_department_id, [220, 912]) || in_array($user_id, ['M0164', 'M0165', 'M0127'])) { if (in_array($user_department_id, [220, 912]) || in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0054'])) {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button>
<?php <?php
@ -1572,7 +1590,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">QC合格日</td> <td style="vertical-align: middle">QC合格日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="end_qc_date2" name="end_qc_date2" value="<?= $row['end_qc_date']; ?>" <?= $warehouse2; ?>> <input class="form-control disabled_select" type="date" id="end_qc_date2" name="end_qc_date2" value="<?= $row['end_qc_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#end_qc_date2").val("");' <?= $warehouse2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#end_qc_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span> </span>
@ -1590,7 +1608,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">官檢日</td> <td style="vertical-align: middle">官檢日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="official_check_date2" name="official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>> <input class="form-control disabled_select" type="date" id="official_check_date2" name="official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>>
<input type="hidden" id="old_official_check_date2" name="old_official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>> <input type="hidden" id="old_official_check_date2" name="old_official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date2").val("");' <?= $warehouse2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#official_check_date2").val("");' <?= $warehouse2; ?>>清除</button>
@ -1901,6 +1919,16 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
?> ?>
</td> </td>
</tr> </tr>
<tr>
<td style="vertical-align: middle;">移交日附件(核准函)</td>
<td colspan='3' style="vertical-align: middle;">
<input type="hidden" name="old_delivery_date_file" value="<?php echo $row['delivery_date_file']; ?>">
<input style="width:70%;display:inline;" type="file" id="delivery_date_file2" name="delivery_date_file2" <?= $warehouse2; ?>>
<?php
echo !empty($row['delivery_date_file']) ? "<a id='delivery_date_a' style='color:#00F;' href='" . $row['delivery_date_file'] . "' target='_blank'>下載附件</a>" : "";
?>
</td>
</tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<?php <?php
@ -2189,6 +2217,8 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
return 3; return 3;
if ($("#site_survey_contact_form_verify").val() == '0' && !$('#site_survey_contact_form_verify_file_a').length) if ($("#site_survey_contact_form_verify").val() == '0' && !$('#site_survey_contact_form_verify_file_a').length)
return 3; return 3;
if ($("#customer_planning_verify").val() == '0' && !$('#customer_planning_verify_file_a').length)
return 3;
return 1; return 1;
} }
@ -2252,8 +2282,6 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
return 3; return 3;
if ($("#site_survey_contact_verify").val() == '0' && !$('#site_survey_contact_verify_file_a').length) if ($("#site_survey_contact_verify").val() == '0' && !$('#site_survey_contact_verify_file_a').length)
return 3; return 3;
if ($("#customer_planning_verify").val() == '0' && !$('#customer_planning_verify_file_a').length)
return 3;
return true; return true;
} }

9
wms/wipwhole-renovate-rec-invoice.php

@ -442,7 +442,14 @@ if ($department_id == "321" || $department_id == "220") {
name AS label name AS label
FROM account FROM account
WHERE department_id IN ('311','312','313','314','315','511','512','513','514') WHERE department_id IN ('311','312','313','314','315','511','512','513','514')
ORDER BY label ASC UNION
SELECT
accountid AS val ,
name AS label
FROM account
WHERE 1=1
AND accountid IN ('M0050')
ORDER BY val ASC
"; ";
$sales_options = mysqli_query($link, $sql); $sales_options = mysqli_query($link, $sql);

13
wms/wipwholeinstall-index-export-excel.php

@ -63,8 +63,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 取得當前使用者所屬職位 // 取得當前使用者所屬職位
$role_id = getRoleId($link, $user_id); $role_id = getRoleId($link, $user_id);
$sql = getDataSql($department_id, $user_id, "A"); $sql = getDataSql($department_id, $role_id, $user_id);
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
if ($result) { if ($result) {
$data = array(); $data = array();
@ -110,7 +109,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
'QC合格日', 'QC合格日',
'官檢日', '官檢日',
'移交日', '移交日',
'營業人員' '營業人員',
'安裝圖上傳狀態',
'完工驗收單上傳狀態',
'移交日附件(核准函)上傳狀態'
]; ];
$sheet->setTitle('新梯出貨預定表'); $sheet->setTitle('新梯出貨預定表');
for ($i = 0; $i < count($colTitleArr); $i++) for ($i = 0; $i < count($colTitleArr); $i++)
@ -177,7 +179,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
substr($row['end_qc_date'], 0, 10), substr($row['end_qc_date'], 0, 10),
$row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10), $row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10),
substr($row['delivery_date'], 0, 10), substr($row['delivery_date'], 0, 10),
accountidToName($row['salesid']) accountidToName($row['salesid']),
empty($row['plan_diagram_file']) ? "無" : "已上傳",
empty($row['completion_acceptance_file']) ? "無" : "已上傳",
empty($row['delivery_date_file']) ? "無" : "已上傳"
]; ];
// $colContentArr2 = [ // $colContentArr2 = [
// !empty($row['tryrun_outsourcer']) ? "試車:" . $row['tryrun_outsourcer'] : "", // !empty($row['tryrun_outsourcer']) ? "試車:" . $row['tryrun_outsourcer'] : "",

41
wms/wipwholeinstall-index-function.php

@ -31,7 +31,8 @@ function getWipwholeSearchSql()
$area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']); $area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']);
$sql = ""; $sql = "";
$sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") "; $sql .= empty($area_no) ? "" : " AND area_no = '$area_no' ";
// $sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") ";
$sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' "; $sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' ";
$sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' "; $sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' ";
$sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' "; $sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' ";
@ -191,7 +192,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -204,7 +206,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -217,20 +220,22 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
} }
// 宜花東營銷部 工務助理 // 宜花東營銷部 工務助理
if ($department_id == '314' && $role_id == '4') { if ($department_id == '315' && $role_id == '4') {
$sql = " $sql = "
SELECT * FROM wipwholestatus SELECT * FROM wipwholestatus
WHERE 1=1 WHERE 1=1
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台東','宜蘭','花蓮') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('台東','宜蘭','花蓮')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -255,7 +260,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭','花蓮','台東') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭','花蓮','台東')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -362,7 +368,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -375,7 +382,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -388,7 +396,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -401,7 +410,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -522,7 +532,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -543,7 +554,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -564,7 +576,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;

4
wms/wipwholeinstall-index-table-html.php

@ -199,13 +199,13 @@
<p> <p>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> <a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<?php <?php
echo getGunwuName($data['address']); echo accountidToName($data['warehouseid']);
?> ?>
</a> </a>
</p> </p>
<?php <?php
} else { } else {
echo getGunwuName($data['address']); echo accountidToName($data['warehouseid']);
} }
?> ?>
</td> </td>

12
wms/wipwholeinstall-renovate-index-export-excel.php

@ -63,7 +63,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 取得當前使用者所屬職位 // 取得當前使用者所屬職位
$role_id = getRoleId($link, $user_id); $role_id = getRoleId($link, $user_id);
$sql = getDataSql($department_id, $user_id, "A"); $sql = getDataSql($department_id, $role_id, $user_id);
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
if ($result) { if ($result) {
@ -110,7 +110,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
'QC合格日', 'QC合格日',
'官檢日', '官檢日',
'移交日', '移交日',
'營業人員' '營業人員',
'安裝圖上傳狀態',
'完工驗收單上傳狀態',
'移交日附件(核准函)上傳狀態'
]; ];
$sheet->setTitle('汰改出貨預定表'); $sheet->setTitle('汰改出貨預定表');
@ -179,7 +182,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
substr($row['end_qc_date'], 0, 10), substr($row['end_qc_date'], 0, 10),
$row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10), $row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10),
substr($row['delivery_date'], 0, 10), substr($row['delivery_date'], 0, 10),
accountidToName($row['salesid']) accountidToName($row['salesid']),
empty($row['plan_diagram_file']) ? "無" : "已上傳",
empty($row['completion_acceptance_file']) ? "無" : "已上傳",
empty($row['delivery_date_file']) ? "無" : "已上傳"
]; ];
for ($j = 0; $j < count($colContentArr); $j++) { for ($j = 0; $j < count($colContentArr); $j++) {
$sheet->setCellValue(num2alpha($j) . $i, $colContentArr[$j]); $sheet->setCellValue(num2alpha($j) . $i, $colContentArr[$j]);

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

@ -31,7 +31,8 @@ function getWipwholeSearchSql()
$area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']); $area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']);
$sql = ""; $sql = "";
$sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") "; $sql .= empty($area_no) ? "" : " AND area_no = '$area_no' ";
// $sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") ";
$sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' "; $sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' ";
$sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' "; $sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' ";
$sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' "; $sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' ";
@ -191,7 +192,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -204,7 +206,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -217,7 +220,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -230,7 +234,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭','花蓮','台東','臺東') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭','花蓮','台東','臺東')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -255,7 +260,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭','花蓮','台東') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭','花蓮','台東')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -362,7 +368,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('宜蘭') AND area_no = 'Y'
-- AND SUBSTR(address,1,2) in ('宜蘭')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -375,7 +382,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -388,7 +396,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -401,7 +410,8 @@ function getDataSql($department_id, $role_id, $user_id)
AND status = '1' AND status = '1'
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -517,7 +527,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹') AND area_no IN ('N','T')
-- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -538,7 +549,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗') AND area_no = 'C'
-- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;
@ -559,7 +571,8 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
) )
AND contract_type = '$contract_type' AND contract_type = '$contract_type'
" . getWipwholeSearchSql() . " " . getWipwholeSearchSql() . "
AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄') AND area_no = 'K'
-- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
ORDER BY real_contract_arrival_date DESC ORDER BY real_contract_arrival_date DESC
"; ";
return $sql; return $sql;

4
wms/wipwholeinstall-renovate-index-table-html.php

@ -182,13 +182,13 @@
<p> <p>
<a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> <a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<?php <?php
echo getGunwuName($data['address']); echo accountidToName($data['warehouseid']);
?> ?>
</a> </a>
</p> </p>
<?php <?php
} else { } else {
echo getGunwuName($data['address']); echo accountidToName($data['warehouseid']);
} }
?> ?>
</td> </td>

Loading…
Cancel
Save