diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..9dc6b4df --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,48 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003 + }, + { + "name": "Launch currently open script", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "port": 0, + "runtimeArgs": [ + "-dxdebug.start_with_request=yes" + ], + "env": { + "XDEBUG_MODE": "debug,develop", + "XDEBUG_CONFIG": "client_port=${port}" + } + }, + { + "name": "Launch Built-in web server", + "type": "php", + "request": "launch", + "runtimeArgs": [ + "-dxdebug.mode=debug", + "-dxdebug.start_with_request=yes", + "-S", + "localhost:0" + ], + "program": "", + "cwd": "${workspaceRoot}", + "port": 9003, + "serverReadyAction": { + "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started", + "uriFormat": "http://localhost:%s", + "action": "openExternally" + } + } + ] +} \ No newline at end of file diff --git a/app/app-wipinstallation-log.php b/app/app-wipinstallation-log.php index f1a2d1b7..c55f7f15 100644 --- a/app/app-wipinstallation-log.php +++ b/app/app-wipinstallation-log.php @@ -24,6 +24,150 @@ if ($user_id == 'A000000001') { $sql = "SELECT * FROM wipinstallation where (facilityno = '$facilityno') order by id desc"; # sql語法存在變數中 } else { $sql = " + SELECT + '0' AS id, + facilityno, + SUBSTR(real_contract_arrival_date,1,10) AS issue_time, + '分配安裝人員' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND real_contract_arrival_date != '' + AND real_contract_arrival_date IS NOT NULL + + UNION + + SELECT + '1' AS id, + facilityno, + SUBSTR(real_arrival_date,1,10) AS issue_time, + '已出貨' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND real_arrival_date != '' + AND real_arrival_date IS NOT NULL + + UNION + + SELECT + '2' AS id, + facilityno, + SUBSTR(estimate_install_start_date,1,10) AS issue_time, + '預計安裝日期' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND estimate_install_start_date != '' + AND estimate_install_start_date IS NOT NULL + + UNION + + SELECT + '3' AS id, + facilityno, + SUBSTR(install_start_date,1,10) AS issue_time, + '已開工' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND install_start_date != '' + AND install_start_date IS NOT NULL + + UNION + + SELECT + '4' AS id, + facilityno, + SUBSTR(estimate_tryrun_start_date,1,10) AS issue_time, + '預計試車日期' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND estimate_tryrun_start_date != '' + AND estimate_tryrun_start_date IS NOT NULL + + UNION + + SELECT + '5' AS id, + facilityno, + SUBSTR(tryrun_start_date,1,10) AS issue_time, + '開始試車' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND tryrun_start_date != '' + AND tryrun_start_date IS NOT NULL + + UNION + + SELECT + '6' AS id, + facilityno, + SUBSTR(end_qc_date,1,10) AS issue_time, + '完成QC' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND end_qc_date != '' + AND end_qc_date IS NOT NULL + + UNION + + SELECT + '7' AS id, + facilityno, + SUBSTR(official_check_date,1,10) AS issue_time, + '完成官檢' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND official_check_date != '' + AND official_check_date IS NOT NULL + + UNION + + SELECT + '8' AS id, + facilityno, + SUBSTR(delivery_date,1,10) AS issue_time, + '完成移交' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE (facilityno = '$facilityno') + AND delivery_date != '' + AND delivery_date IS NOT NULL + + + /* SELECT '0' AS id, facilityno, @@ -107,6 +251,8 @@ if ($user_id == 'A000000001') { create_at FROM wipwholestatus WHERE (facilityno = '$facilityno') +*/ + ORDER BY id DESC "; } diff --git a/app/app-wipproduction-log.php b/app/app-wipproduction-log.php index ead78b90..6f95a3d4 100644 --- a/app/app-wipproduction-log.php +++ b/app/app-wipproduction-log.php @@ -27,6 +27,101 @@ if ($user_id == 'A000000001') { SELECT '0' AS id, facilityno, + '' AS issue_time, + '生產中' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE facilityno = '$facilityno' + + UNION + + SELECT + '1' AS id, + facilityno, + SUBSTR(estimated_shipping_date,1,10) AS issue_time, + '生產完成' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE facilityno = '$facilityno' + AND estimated_shipping_date != '' + AND estimated_shipping_date IS NOT NULL + + UNION + + SELECT + '2' AS id, + facilityno, + SUBSTR(estimated_shipping_schedule_date,1,10) AS issue_time, + '預計攬收' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE facilityno = '$facilityno' + AND estimated_shipping_schedule_date != '' + AND estimated_shipping_schedule_date IS NOT NULL + + UNION + + SELECT + '3' AS id, + facilityno, + SUBSTR(actual_tofactory_date,1,10) AS issue_time, + '攬收成功(桃園)' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE facilityno = '$facilityno' + AND actual_tofactory_date != '' + AND actual_tofactory_date IS NOT NULL + + UNION + + SELECT + '4' AS id, + facilityno, + SUBSTR(real_contract_arrival_date,1,10) AS issue_time, + '預計出貨日' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE facilityno = '$facilityno' + AND real_contract_arrival_date != '' + AND real_contract_arrival_date IS NOT NULL + + UNION + + SELECT + '5' AS id, + facilityno, + SUBSTR(real_arrival_date,1,10) AS issue_time, + '出貨' AS 'process', + 'bg-success' AS 'light_color', + '' AS memo, + creater, + create_at + FROM wipwholestatus + WHERE facilityno = '$facilityno' + AND real_arrival_date != '' + AND real_arrival_date IS NOT NULL + + +/* + UNION + SELECT + '1' AS id, + facilityno, SUBSTR(prattford_order_date,1,10) AS issue_time, CASE prattford_order_date_verify WHEN 0 THEN '生產完成' @@ -47,7 +142,7 @@ if ($user_id == 'A000000001') { WHERE (facilityno = '$facilityno') UNION SELECT - '1' AS id, + '2' AS id, facilityno, SUBSTR(goods_type_date,1,10) AS issue_time, CASE goods_type @@ -71,7 +166,7 @@ if ($user_id == 'A000000001') { WHERE (facilityno = '$facilityno') UNION SELECT - '2' AS id, + '3' AS id, facilityno, SUBSTR(actual_tofactory_date,1,10) AS issue_time, CASE arrival_date_verify @@ -97,7 +192,7 @@ if ($user_id == 'A000000001') { WHERE (facilityno = '$facilityno') UNION SELECT - '3' AS id, + '4' AS id, facilityno, SUBSTR(real_arrival_date,1,10) AS issue_time, IF(real_arrival_date IS NOT NULL || real_arrival_date != '','已出貨','未出貨') AS 'process', @@ -107,6 +202,8 @@ if ($user_id == 'A000000001') { create_at FROM wipwholestatus WHERE (facilityno = '$facilityno') +*/ + ORDER BY id DESC "; } diff --git a/phb/DB.php b/phb/DB.php index a3af3704..70b44478 100644 --- a/phb/DB.php +++ b/phb/DB.php @@ -15,7 +15,7 @@ class DB //私有的构造方法 function __construct($config = array()) { - $this->host = isset($config['host']) ? $config['host'] : 'db-104.coowo.com'; + $this->host = isset($config['host']) ? $config['host'] : 'localhost'; $this->port = isset($config['port']) ? $config['port'] : '3306'; $this->user = isset($config['user']) ? $config['user'] : 'masadaroot'; $this->pass = isset($config['pass']) ? $config['pass'] : 'x6h5E5p#u8y'; diff --git a/phb/map/tw.html b/phb/map/tw.html index d029e751..e7991d8e 100644 --- a/phb/map/tw.html +++ b/phb/map/tw.html @@ -1,596 +1,637 @@ + 電梯地圖 - - + + -
- - - - - - - - - + + + + + + + } - + + + - + + \ No newline at end of file diff --git a/phb/map/tw_fake.html b/phb/map/tw_fake.html new file mode 100644 index 00000000..ecfdae00 --- /dev/null +++ b/phb/map/tw_fake.html @@ -0,0 +1,637 @@ + + + + + + + + + 電梯地圖 + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/phb/map/worksite.php b/phb/map/worksite.php index 4af0a8a3..a07d33e1 100644 --- a/phb/map/worksite.php +++ b/phb/map/worksite.php @@ -5,16 +5,35 @@ try { $conn = new DB(); if ($conn) { - $sql = "SELECT distinct(latitude),longitude,facilitynum,facilityno,address,buildcompany,marchintotime,estimatedcompletiontime,process,status,create_at from worksite ORDER BY create_at desc"; + $sql = "SELECT + DISTINCT + latitude, + longitude, + facilitynum, + facilityno, + address, + buildcompany, + marchintotime, + estimatedcompletiontime, + process, + status, + create_at + FROM worksite + WHERE (maintainance_facility_no IS NULL + OR maintainance_facility_no = '') + ORDER BY create_at DESC "; $result = $conn->getAll($sql); - //print_r($result); - for($i=0;$igetAll($installsql); - $result[$i]['installschedule']= $installinffo; + for ($i = 0; $i < sizeof($result); $i++) { + $facilityno = $result[$i]["facilityno"]; + $installsql = " SELECT * + FROM wipinstallation + WHERE facilityno = '$facilityno' + ORDER BY id DESC "; + $installinffo = $conn->getAll($installsql); + $result[$i]['installschedule'] = $installinffo; } echo json_encode($result); } } catch (Exception $e) { die($e->getMessage()); -} \ No newline at end of file +} diff --git a/wms/T8_APItest_from_bpm.php b/wms/T8_APItest_from_bpm.php new file mode 100644 index 00000000..db6d10a5 --- /dev/null +++ b/wms/T8_APItest_from_bpm.php @@ -0,0 +1,99 @@ + "stkAssyMast", + "rows" => [ + [ + "BillNo" => "TEST06", + "OrgId" => "1000", + "TypeId" => "CA", + "MaterialId" => "3MH00302", + "PersonId" => "M0122", + "CompId" => "1001", + "DeptId" => "220", + "SQuantity" => 1, + "SUnitId" => "SET", + "CurrentState" => 2, + "CreatorId" => "M0122" + ] + ] + ], + [ + "name" => "stkAssySubMatInfo", + "rows" => [ + [ + "BillNo" => "TEST06", + "MaterialId" => "3MH00302P", + "ComponentBaseQty" => 1, + "UnitQty" => 1, + "SUnitId" => "SET", + "MarkerNo" => "3MH00302", + "CU_MaterialId" => "3MH00302" + ], + [ + "BillNo" => "TEST06", + "MaterialId" => "MX00000001", + "ComponentBaseQty" => 1, + "UnitQty" => 3, + "SUnitId" => "PCS", + "MarkerNo" => "3MH00302", + "CU_MaterialId" => "3MH00302" + ] + ] + ] + ]; + + $json = json_encode($body); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $apiurl); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headerParam); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $json); + + $response = curl_exec($ch); + + if ($response === false) { + echo 'Curl error: ' . curl_error($ch); + } else { + $result = json_decode($response, true); + echo $result['Status'] . "\n"; + echo $result['ErrorMsg'] . "\n"; + print_r($result['Data']); + } + + curl_close($ch); +} diff --git a/wms/T8_Authorization_from_bpm.php b/wms/T8_Authorization_from_bpm.php new file mode 100644 index 00000000..125ee65e --- /dev/null +++ b/wms/T8_Authorization_from_bpm.php @@ -0,0 +1,43 @@ + 0) { +// foreach ($pay_received as $received) { +// $had_received_amount += intval($received['received_amount']); +// $had_invoice_amount += intval($received['invoice_amount']); +// if(in_array(intval($received['status']),array(0,4,5,99))){ +// $tem_status = intval(0); +// }else{ +// $tem_status = intval($received['status']); +// } +// if($status_summary < $tem_status){ +// $status_summary = $tem_status; +// } +// } +// } + +// $unreceived_amount = intval($Bill[12]) - intval($had_received_amount); +// $uninvoice_amount = intval($Bill[12]) - intval($had_invoice_amount); +// $Bill[19] =$had_invoice_amount; +// $Bill[20] =$had_received_amount; +// $Bill[21] =$uninvoice_amount; +// $Bill[22] =$unreceived_amount; +// $Bill[23] =$status_summary; +$data = json_encode($Bill); +?> + +
+ +
+ + + +
+ +
+
+
+

+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + +
目前應收
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
簽約款二次款貨抵工地款安裝款試車款官檢款交車款尾款
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
發票日期發票金額發票號碼收款日期收款金額備註狀態功能
+ 進行中"; + break; + case 1: + echo "催收"; + break; + case 2: + echo "法務件 (發函)"; + break; + case 3: + echo "法務件 (訴訟)"; + break; + case 4: + echo "折讓"; + break; + case 5: + echo "壞帳"; + break; + case 99: + echo "完成"; + break; + } + ?> + + + +
+
+ \ No newline at end of file diff --git a/wms/account-receivable-excel.php b/wms/account-receivable-excel.php new file mode 100644 index 00000000..2d362c31 --- /dev/null +++ b/wms/account-receivable-excel.php @@ -0,0 +1,51 @@ +$value){ + // for ($i = 0; $i < 17; $i++) { + // $value[$i] = (isset($value[$i])) ? $value[$i] : 0; + // } + $array_data[$key][0] = $key; + $array_data[$key][1] = $value[1]; + $array_data[$key][2] = $value[2]; + $array_data[$key][3] = $value[4]; + $array_data[$key][4] = $value[5]; + $array_data[$key][5] = $value[7]; + $array_data[$key][6] = $value[8]; + $array_data[$key][7] = $value[6]; + $array_data[$key][8] = $value['sign'][1]; + $array_data[$key][9] = $value['second'][1]; + $array_data[$key][10] = $value['arrive'][1]; + $array_data[$key][11] = $value['install'][1]; + $array_data[$key][12] = $value['tryrun'][1]; + $array_data[$key][13] = $value['check'][1]; + $array_data[$key][14] = $value['delivery'][1]; + $array_data[$key][15] = $value['final'][1]; + $array_data[$key][16] = $value['receivable_budget']; + $array_data[$key][17] = str_replace('
','; ',$value['facilities']); +} +$spreadsheet = new Spreadsheet(); +$sheet = $spreadsheet->getActiveSheet(); +$colomnHeader = ['合約號','部門','經理','營業員','客戶名稱','統一編號','聯絡地址','抬頭','簽約款', +'二次款','貨抵工地款','安裝款','試車款','官檢款','交車款','尾款','目前應收','作番狀態']; +$sheet->fromArray($colomnHeader,NULL,'A1'); +$rowIndex = 2; +foreach($array_data as $key => $value){ + $sheet->fromArray([$value], NULL, 'A' . $rowIndex); + $sheet->getStyle('R' . $rowIndex)->getAlignment()->setWrapText(true); + $rowIndex++; +} +$writer = new Xlsx($spreadsheet); +$excelFileName = 'account-receivable.xlsx'; +$writer->save($excelFileName); + +?> + \ No newline at end of file diff --git a/wms/account-receivable-index.php b/wms/account-receivable-index.php index b6d56bcf..4ac2afa7 100644 --- a/wms/account-receivable-index.php +++ b/wms/account-receivable-index.php @@ -1,33 +1,62 @@ "; - -// $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC); - -// $sql_depid = "SELECT department_id, name from department"; -// $dept_query = mysqli_query($link, $sql_depid); -// $deptype = mysqli_fetch_all($dept_query, MYSQLI_ASSOC); - +$sql_received = "SELECT * FROM arWriteOffBillDetail WHERE (DATALENGTH(OrderBillNo) >0)"; -$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName FROM salOrderStagePay AS a +$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, +c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo -LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId -WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; +LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId +WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; +if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { + $sql_contract .= "AND (s.PersonId = '$user_id'"; + $sql_received .= " AND (PersonId = '$user_id'"; + if (count($follower) > 0) { + $column_str = "('$user_id'" . ",'"; + $column_str .= implode("','", $follower); + $column_str .= "')"; + $sql_contract .= " OR s.PersonId IN $column_str)"; + $sql_received .= " OR PersonId IN $column_str)"; + } else { + $sql_contract .= ")"; + $sql_received .= ")"; + }; +} +$sign60 = array('簽訂後60天', '簽約60日', '簽約後60天', '簽訂後60日內', '訂金支付後60天'); +$sign90 = array('簽約後90天', '簽約後90日', '簽訂後90天'); +$sign120 = array('簽約後120天', '簽約後120日', '簽訂後120天'); $contract = $conn->query($sql_contract); +$received_array = $conn->query($sql_received); + +// 取收款資料 account_received +// $received_data = mysqli_query($link, $sql_received); +// foreach ($received_data as $received) { +// if ($received['BillNo'] == 'SO20230801001') { +// $BillNo = 'M230947'; +// } elseif ($received['BillNo'] == 'SO20230801002') { +// $BillNo = 'M231067'; +// } else { +// $BillNo = $received['BillNo']; +// }; +// if (isset($received_array[$BillNo])) { +// $received_array[$BillNo][0] += $received['invoice_amount']; +// $received_array[$BillNo][1] += $received['received_amount']; +// $received['status'] = (intval($received['status']) < 4) ? intval($received['status']) : 0; +// if ($received_array[$BillNo][2] < intval($received['status'])) { +// $received_array[$BillNo][2] = intval($received['status']); +// } +// } else { +// $received_array[$BillNo][0] = $received['invoice_amount']; +// $received_array[$BillNo][1] = $received['received_amount']; +// $received_array[$BillNo][2] = (intval($received['status']) < 4) ? intval($received['status']) : 0; +// } +// } + +// 將T8合約收款階段資料依據款別分類放進arraData裡 foreach ($contract as $cont) { - // print_r($cont); - // echo "
"; if ($cont['BillNo'] == 'SO20230801001') { $BillNo = 'M230947'; } elseif ($cont['BillNo'] == 'SO20230801002') { @@ -36,52 +65,84 @@ foreach ($contract as $cont) { $BillNo = $cont['BillNo']; }; $PayStage = $cont['PayStage']; + $PlanPayDate = $cont['PlanPayDate']; $PayAmount = $cont['PlanPayAmt']; $partnerName = $cont['BizPartnerName']; - //4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 - if (isset($arrayData[$BillNo])) { - if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { - $arrayData[$BillNo][5] = $PayAmount; - } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { - $arrayData[$BillNo][4] = $PayAmount; - } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { - $arrayData[$BillNo][6] = $PayAmount; - } elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { - $arrayData[$BillNo][8] = $PayAmount; - } elseif (stristr($PayStage, '安裝')) { - $arrayData[$BillNo][7] = $PayAmount; - } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { - $arrayData[$BillNo][10] = $PayAmount; - } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { - $arrayData[$BillNo][9] = $PayAmount; - } else { - $arrayData[$BillNo][12] = $PayAmount; + $EnterpriseName = $cont['EnterpriseName']; + $TaxNo = $cont['TaxNo']; + $ContactAddress = $cont['ContactAddress']; + //['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 + //['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 + if (!(isset($arrayData[$BillNo]))) { + // 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 + $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + $arrayData[$BillNo][5] = $partnerName; + $arrayData[$BillNo][6] = $EnterpriseName; + $arrayData[$BillNo][7] = $TaxNo; + $arrayData[$BillNo][8] = $ContactAddress; + $arrayData[$BillNo]['received']= array(); + $arrayData[$BillNo]['sign'][1] = $arrayData[$BillNo]['second'][1] = $arrayData[$BillNo]['arrive'][1] = $arrayData[$BillNo]['install'][1] = $arrayData[$BillNo]['tryrun'][1] = $arrayData[$BillNo]['check'][1] = $arrayData[$BillNo]['delivery'][1] = $arrayData[$BillNo]['final'][1] = 0; + $arrayData[$BillNo]['facilities'] = ""; + $arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; + } + if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { + $arrayData[$BillNo]['second'][0] = $PayStage; + $arrayData[$BillNo]['second'][1] = $PayAmount; + $arrayData[$BillNo]['second'][2] = $PlanPayDate; + if (isset($arrayData[$BillNo]['sign'][2]) && !is_null($arrayData[$BillNo]['sign'][2])) { + $signtime = strtotime(strval($arrayData[$BillNo]['sign'][2])); + if (in_array($PayStage, $sign60)) { + $secondtime = $signtime + (60 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = intval($secondtime); + } elseif (in_array($PayStage, $sign90)) { + $secondtime = $signtime + (90 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = intval($secondtime); + } elseif (in_array($PayStage, $sign120)) { + $secondtime = $signtime + (120 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = intval($secondtime); + } elseif (stristr($PayStage, '簽訂後30天')) { + $secondtime = $signtime + (30 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = intval($secondtime); + } } + } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工')) { + $arrayData[$BillNo]['sign'][0] = $PayStage; + $arrayData[$BillNo]['sign'][1] = $PayAmount; + $arrayData[$BillNo]['sign'][2] = $PlanPayDate; + } elseif (stristr($PayStage, '試車')) { + $arrayData[$BillNo]['tryrun'][0] = $PayStage; + $arrayData[$BillNo]['tryrun'][1] = $PayAmount; + $arrayData[$BillNo]['tryrun'][2] = $PlanPayDate; + } elseif (stristr($PayStage, '安裝') || stristr($PayStage, '貨抵工地且完工')) { + $arrayData[$BillNo]['install'][0] = $PayStage; + $arrayData[$BillNo]['install'][1] = $PayAmount; + $arrayData[$BillNo]['install'][2] = $PlanPayDate; + } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { + $arrayData[$BillNo]['arrive'][0] = $PayStage; + $arrayData[$BillNo]['arrive'][1] = $PayAmount; + $arrayData[$BillNo]['arrive'][2] = $PlanPayDate; + } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { + $arrayData[$BillNo]['delivery'][0] = $PayStage; + $arrayData[$BillNo]['delivery'][1] = $PayAmount; + $arrayData[$BillNo]['delivery'][2] = $PlanPayDate; + } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { + $arrayData[$BillNo]['check'][0] = $PayStage; + $arrayData[$BillNo]['check'][1] = $PayAmount; + $arrayData[$BillNo]['check'][2] = $PlanPayDate; + } elseif (stristr($PayStage, '驗收完成')) { + $arrayData[$BillNo]['final'][0] = $PayStage; + $arrayData[$BillNo]['final'][1] = $PayAmount; + $arrayData[$BillNo]['final'][2] = $PlanPayDate; } else { - $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - $arrayData[$BillNo][3] = $partnerName; - if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { - $arrayData[$BillNo][5] = $PayAmount; - } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { - $arrayData[$BillNo][4] = $PayAmount; - } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { - $arrayData[$BillNo][6] = $PayAmount; - } elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { - $arrayData[$BillNo][8] = $PayAmount; - } elseif (stristr($PayStage, '安裝')) { - $arrayData[$BillNo][7] = $PayAmount; - } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { - $arrayData[$BillNo][10] = $PayAmount; - } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { - $arrayData[$BillNo][9] = $PayAmount; - } else { - $arrayData[$BillNo][12] = $PayAmount; - } + $arrayData[$BillNo]['other'][1] = $PayAmount; + $arrayData[$BillNo]['other'][2] = $PlanPayDate; } } - -foreach ($arrayData as $key => $value) { - $sql = "SELECT +$sql = "SELECT tmp2.*, d.name AS depart_name FROM( @@ -105,8 +166,7 @@ left join account AS a ON w.salesid = a.accountid left join account AS a2 ON a2.accountid = a.manager -where w.status = '1' AND w.contractno='" . $key . "'" . " - +where w.status = '1' AND w.contract_type='A' )AS tmp2 left join ( SELECT DISTINCT @@ -116,108 +176,194 @@ FROM department ) AS d ON d.department_id = tmp2.department_id"; - $facitities = ""; - $total_facility_num = 0; - $arrive_num = 0; - $tryrun_num = 0; - $delivery_num = 0; - $official_num = 0; - $wipwhole_array = mysqli_query($link, $sql); - foreach ($wipwhole_array as $wip) { - - - $value[0] = $wip['depart_name']; - $value[1] = $wip['manager_name']; - $value[2] = $wip['name']; +$wipwhole_array = mysqli_query($link, $sql); +foreach ($wipwhole_array as $wip) { + if (isset($arrayData[$wip['contractno']])) { + $arrayData[$wip['contractno']][0] = $wip['department_id'];; + $arrayData[$wip['contractno']][1] = $wip['depart_name']; + $arrayData[$wip['contractno']][2] = $wip['manager_name']; + $arrayData[$wip['contractno']][3] = $wip['salesid']; + $arrayData[$wip['contractno']][4] = $wip['name']; + $arrayData[$wip['contractno']][10] = $wip['contractno']; + if (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前30天')) { + $estimate_delivery_time = strtotime($wip['estimated_shipping_date']); + $secondtime = $estimate_delivery_time - (30 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = intval($secondtime); + } elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前90天')) { + $estimate_delivery_time = strtotime($wip['estimated_shipping_date']); + $secondtime = $estimate_delivery_time - (90 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = intval($secondtime); + } if ($wip['delivery_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) , \n"; - $total_facility_num += 1; - $arrive_num += 1; - $tryrun_num += 1; - $official_num += 1; - $delivery_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['delivery_num'] += 1; + $arrayData[$wip['contractno']]['check_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; } elseif ($wip['official_check_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) , \n"; - $total_facility_num += 1; - $arrive_num += 1; - $tryrun_num += 1; - $official_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['check_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; } elseif ($wip['tryrun_end_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) , \n"; - $total_facility_num += 1; - $arrive_num += 1; - $tryrun_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; } elseif ($wip['install_end_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) , \n"; - $total_facility_num += 1; - $arrive_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; } elseif ($wip['real_arrival_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) , \n"; - $total_facility_num += 1; - $arrive_num += 1; - } elseif ($wip['actual_tofactory_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) , \n"; - $total_facility_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + } elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { + if ($wip['estimated_shipping_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出貨日)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + } elseif ($wip['actual_tofactory_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + } else { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + } } elseif ($wip['estimated_shipping_date'] != NULL) { - $facitities .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) , \n"; - $total_facility_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; } else { - $facitities .= $wip['facilityno'] . " (預計到港日待確認) , \n"; - $total_facility_num += 1; + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計到港日待確認)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; } } - //這是錢 4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 - //這是數量 arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 - if ($total_facility_num > 0) { - $receivable_budget = $value[4] + ($value[5] + $value[6]) * ($arrive_num / $total_facility_num) + - ($value[7] + $value[8]) * ($tryrun_num / $total_facility_num) + ($value[9]) * ($official_num / $total_facility_num) - + ($value[10]) * ($delivery_num / $total_facility_num); +} + + +foreach ($arrayData as &$value) { + if ($value['total_facility_num'] > 0) { + $value['receivable_budget'] = $value['sign'][1] + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + + ($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) + + ($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) + + (($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num'])); } - array_push($receivable_array, [$key, $value[0], $value[1], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], $value[9], $value[10], $receivable_budget, $facitities]); - // echo $key . ";" . $value[0] . ";" . $value[1] . ";" . $value[2] . ";" . $value[3] . ";" . $value[4] . ";" . $value[5] . ";" . $value[6] . ";" . $value[7] . ";" . $value[8] . ";" . $value[9].";" . $value[10] . ";" . $receivable_budget . ";" . $total_facility_num . ";" . $arrive_num . ";". $tryrun_num . ";" .$official_num.";". $delivery_num . ";" . $facitities . "
"; +} +// array_push($arrayData[$wip['contractno']]['received'], ['assaaa',123124,'sdrfrqa']); + +foreach($received_array as $received){ + + if(isset($arrayData[$received['OrderBillNo']])){ + array_push($arrayData[$received['OrderBillNo']]['received'], [$received['BillNo'],$received['WriteOffBizPartnerId'],$received['OrderBillNo'],]); + +} } -// echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;官檢款;交車款;目前應收;總作番數;貨抵;安裝試車;官檢;移交數;狀態
"; +$data = json_encode($arrayData); + ?> -
- + + + +
+
- - - - + + + + - - - - - - - - - + + + + + + $value) { ?> - - - - - - - - - - - - - - + + + + + + + + + +
合約號部門經理營業員合約號部門經理營業員 客戶名稱簽約款二次款貨抵工地款安裝款試車款官檢款交車款目前應收狀態目前應收作番狀態操作
+
+ \ No newline at end of file diff --git a/wms/account-receivable-received-create.php b/wms/account-receivable-received-create.php new file mode 100644 index 00000000..31537102 --- /dev/null +++ b/wms/account-receivable-received-create.php @@ -0,0 +1,124 @@ + +
+ +
+ +
+
+
+
+

+

新增收款資訊

+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + + + + + +
+
+
+
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/wms/account-receivable-received-edit.php b/wms/account-receivable-received-edit.php new file mode 100644 index 00000000..e6100ea2 --- /dev/null +++ b/wms/account-receivable-received-edit.php @@ -0,0 +1,142 @@ +"; +// print_r($BillData); +$sql_pay = "SELECT * from account_received where pay_id = '$pay_id'"; +$pay = mysqli_query($link, $sql_pay); +$pay = mysqli_fetch_assoc($pay); + +?> +
+ +
+ +
+
+ + +
+
+

+

編輯收款資訊

+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + + + +
+
+
+
+
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/wms/account-receivable-received-submit.php b/wms/account-receivable-received-submit.php new file mode 100644 index 00000000..b9b18f0f --- /dev/null +++ b/wms/account-receivable-received-submit.php @@ -0,0 +1,96 @@ + + \ No newline at end of file diff --git a/wms/account-receivable.xlsx b/wms/account-receivable.xlsx new file mode 100644 index 00000000..8edcb4bd Binary files /dev/null and b/wms/account-receivable.xlsx differ diff --git a/wms/board-create.php b/wms/board-create.php index e4bd345a..48f07efe 100644 --- a/wms/board-create.php +++ b/wms/board-create.php @@ -1,14 +1,13 @@
-Please fill up the required field!

"; @@ -17,35 +16,65 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ } } */ -?> + ?> -
" enctype="multipart/form-data"> -
- - -
- -
- -
- + " enctype="multipart/form-data"> +
+
+
+ + +
+
+ +
+ +
+
+
+
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+ +
+
+
+
+
+ + +
-
-
-
- -
-
- -
-
+ \ No newline at end of file diff --git a/wms/board-record-submit.php b/wms/board-record-submit.php index d3adb28b..bfae3908 100644 --- a/wms/board-record-submit.php +++ b/wms/board-record-submit.php @@ -3,7 +3,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { //print_r($_POST); //print_r($_FILES);exit; foreach ($_POST as $k => $v) { - $$k = htmlspecialchars(stripslashes(trim($v))); + // $$k = htmlspecialchars(stripslashes(trim($v))); + $$k = trim($v); } function get_basename($filename) { diff --git a/wms/css/view/wipwhole-index.php b/wms/css/view/wipwhole-index.php index c24af508..e1f5e17e 100644 --- a/wms/css/view/wipwhole-index.php +++ b/wms/css/view/wipwhole-index.php @@ -126,51 +126,61 @@ /* 旋转动画 */ } -/* The Modal (background) */ -.modal { - display: none; /* Hidden by default */ - position: fixed; /* Stay in place */ - z-index: 1; /* Sit on top */ - padding-top: 100px; /* Location of the box */ - left: 0; - top: 0; - width: 100%; /* Full width */ - height: 100%; /* Full height */ - overflow: auto; /* Enable scroll if needed */ - -} -.modal .back{ - position: absolute; - top: 0; - left:0; - width: 100%; - height: 100%; - background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ -} -/* Modal Content */ -.modal-content { - z-index: 9; - background-color: #fefefe; - margin: auto; - padding: 20px; - border: 1px solid #888; - width: 80%; -} - -/* The Close Button */ -.close { - color: #aaaaaa; - float: right; - font-size: 28px; - font-weight: bold; -} - -.close:hover, -.close:focus { - color: #000; - text-decoration: none; - cursor: pointer; -} + /* The Modal (background) */ + .modal { + display: none; + /* Hidden by default */ + position: fixed; + /* Stay in place */ + z-index: 1; + /* Sit on top */ + padding-top: 100px; + /* Location of the box */ + left: 0; + top: 0; + width: 100%; + /* Full width */ + height: 100%; + /* Full height */ + overflow: auto; + /* Enable scroll if needed */ + + } + + .modal .back { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + /* Black w/ opacity */ + } + + /* Modal Content */ + .modal-content { + z-index: 9; + background-color: #fefefe; + margin: auto; + padding: 20px; + border: 1px solid #888; + width: 80%; + } + + /* The Close Button */ + .close { + color: #aaaaaa; + float: right; + font-size: 28px; + font-weight: bold; + } + + .close:hover, + .close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + } @keyframes spin { diff --git a/wms/css/view/wipwhole-renovate-index.php b/wms/css/view/wipwhole-renovate-index.php index 9bd7eef9..70b3576f 100644 --- a/wms/css/view/wipwhole-renovate-index.php +++ b/wms/css/view/wipwhole-renovate-index.php @@ -126,6 +126,62 @@ /* 旋转动画 */ } + /* The Modal (background) */ + .modal { + display: none; + /* Hidden by default */ + position: fixed; + /* Stay in place */ + z-index: 1; + /* Sit on top */ + padding-top: 100px; + /* Location of the box */ + left: 0; + top: 0; + width: 100%; + /* Full width */ + height: 100%; + /* Full height */ + overflow: auto; + /* Enable scroll if needed */ + + } + + .modal .back { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + /* Black w/ opacity */ + } + + /* Modal Content */ + .modal-content { + z-index: 9; + background-color: #fefefe; + margin: auto; + padding: 20px; + border: 1px solid #888; + width: 80%; + } + + /* The Close Button */ + .close { + color: #aaaaaa; + float: right; + font-size: 28px; + font-weight: bold; + } + + .close:hover, + .close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + } + @media screen and (max-width: 600px) { table { diff --git a/wms/frame/api_getdata.php b/wms/frame/api_getdata.php index 7da622b0..c99767a6 100644 --- a/wms/frame/api_getdata.php +++ b/wms/frame/api_getdata.php @@ -1,4 +1,5 @@ "ok","err"=>"","errCode"=>""); +$json = array("st" => "ok", "err" => "", "errCode" => ""); /** * 表單列表 */ -function get_forms() { +function get_forms() +{ global $link; $i = 1; @@ -45,7 +47,8 @@ function get_forms() { /** * 公告欄列表 */ -function get_board() { +function get_board() +{ global $link; $i = 1; @@ -70,16 +73,17 @@ function get_board() { /** * 系統通知列表 */ -function get_notice($token) { +function get_notice($token) +{ global $link; if (!$token) throw new \Exception("token empty", 802); list($user_id) = explode(".", $token); $i = 1; $data = []; $sql = "select id, kind, related_id, title from notice "; - $sql .= "where (permission like '%".$user_id."%' or permission = 'ALL' or creater = '$user_id') "; - $sql .= "and haveread != '1' "; - $sql .= "order by create_at desc limit 0, 6"; + $sql .= "where (permission like '%" . $user_id . "%' or permission = 'ALL' or creater = '$user_id') "; + $sql .= "and (haveread != '1' or haveread is null) "; + $sql .= "order by id desc limit 0, 6"; $res = mysqli_query($link, $sql); while ($row = mysqli_fetch_assoc($res)) { $data[$i]["id"] = $row["id"]; @@ -95,24 +99,64 @@ function get_notice($token) { /** * 待我簽核 */ -function get_pending($token) { +function get_pending($token) +{ global $link; if (!$token) throw new \Exception("token empty", 802); list($user_id) = explode(".", $token); $i = 1; $data = []; + $sql = " + SELECT + t.system_id, + t.system_name, + t.flow_id, + t.flow_name, + COUNT(*) + FROM ( + SELECT s.form_key, + m.system_id, + y.system_name, + m.flow_id, + m.flow_name, + m.path + FROM subflow s, + flow f, + flow_main m, + system_main y + WHERE EXISTS ( + SELECT form_key, + MAX(seq) + FROM subflow + GROUP BY form_key + HAVING SUBSTRING(s.form_key, 1, 10) = form_key + AND s.seq = max(seq) + ) + AND SUBSTRING(s.form_key, 1, 10) = f.form_key + AND f.flow_id = m.flow_id + AND f.system_id = y.system_id + AND s.current_assigner = '$user_id' + AND f.flow_code != 'Z' + ) t + GROUP BY t.system_id, + t.flow_id, + t.system_name, + t.flow_name + LIMIT 0, 6 + "; + + // $sql = "select t.system_id, t.system_name, t.flow_id, t.flow_name, count(*) from ("; + // $sql .= "select s.form_key, m.system_id, y.system_name, m.flow_id, m.flow_name, m.path from subflow s, flow f, flow_main m, system_main y "; + // $sql .= "where "; + // $sql .= "EXISTS ( + // select form_key, max(seq) from subflow + // group by form_key + // having SUBSTRING(s.form_key,1,10) = form_key and s.seq = max(seq) + // ) "; + // $sql .= "and SUBSTRING(s.form_key,1,10) = f.form_key and f.flow_id = m.flow_id and f.system_id = y.system_id and s.current_assigner = '$user_id'"; + // $sql .= ") t group by t.system_id, t.flow_id, t.system_name, t.flow_name "; + // $sql .= "limit 0, 6"; - $sql = "select t.system_id, t.system_name, t.flow_id, t.flow_name, count(*) from ("; - $sql .= "select s.form_key, m.system_id, y.system_name, m.flow_id, m.flow_name, m.path from subflow s, flow f, flow_main m, system_main y "; - $sql .= "where "; - $sql .= "EXISTS ( - select form_key, max(seq) from subflow - group by form_key - having SUBSTRING(s.form_key,1,10) = form_key and s.seq = max(seq) - ) "; - $sql .= "and SUBSTRING(s.form_key,1,10) = f.form_key and f.flow_id = m.flow_id and f.system_id = y.system_id and s.current_assigner = '$user_id'"; - $sql .= ") t group by t.system_id, t.flow_id, t.system_name, t.flow_name "; - $sql .= "limit 0, 6"; $res = mysqli_query($link, $sql); while ($row = mysqli_fetch_row($res)) { $data[$i]["sid"] = $row[0]; @@ -139,7 +183,7 @@ function get_pending($token) { return $data; } -try{ +try { if (empty($_REQUEST)) throw new \Exception("post empty", 801); if (empty($_REQUEST["p"])) throw new \Exception("post p empty", 801); @@ -161,13 +205,10 @@ try{ default: echo "error"; } - - -}catch(\Exception $ex){ - $json["st"] = "err"; - $json["err"] = $ex->getMessage(); - $json["errCode"] = (!empty($ex->getCode()))?$ex->getCode():701; +} catch (\Exception $ex) { + $json["st"] = "err"; + $json["err"] = $ex->getMessage(); + $json["errCode"] = (!empty($ex->getCode())) ? $ex->getCode() : 701; } -echo json_encode($json,JSON_UNESCAPED_UNICODE); -?> \ No newline at end of file +echo json_encode($json, JSON_UNESCAPED_UNICODE); diff --git a/wms/fun_global.php b/wms/fun_global.php index aacd5577..5e735cd9 100644 --- a/wms/fun_global.php +++ b/wms/fun_global.php @@ -1,4 +1,5 @@ M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人) @@ -108,7 +113,8 @@ function pricereview_class($rate, $user_id, &$ret=[]) { * @return array * */ -function pricereview_renovate_class($rate, $user_id, $renovate_flag) { +function pricereview_renovate_class($rate, $user_id, $renovate_flag) +{ global $link; $sql = "select manager from account where accountid = '$user_id'"; @@ -142,11 +148,20 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag) { * @param string $token * @return string */ -function check_user_permission($user_id, $token) { +function check_user_permission($user_id, $token) +{ global $link; // 不檢查清單 - $ignore_url_arr = ['/wms/index.php', '/wms/notice-index.php', '/wms/notice-edit.php', '/wms/change-password.php', '/wms/wipwhole-change-contractdate.php', '/wms/wipwhole-change-planning-customer-name.php','/wms/test.php', '/wms/mkt/pricereview_mi-api.php']; + $ignore_url_arr = [ + '/wms/index.php', + '/wms/notice-index.php', + '/wms/notice-edit.php', + '/wms/change-password.php', + '/wms/wipwhole-change-contractdate.php', + '/wms/wipwhole-change-planning-customer-name.php', + '/wms/test.php', + ]; if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return; $do = ""; @@ -169,9 +184,12 @@ function check_user_permission($user_id, $token) { mysqli_free_result($res); if (!$do) { - // echo "無權限操作,請洽管理員。"; - // exit; - echo ""; + // 判斷是否從藍凌過來 + if (!empty($_GET['employee_no'])) { + echo "無權限操作,請洽管理員。"; + exit; + } + echo ""; } else return $do; } @@ -179,7 +197,8 @@ function check_user_permission($user_id, $token) { * 員工編號對應姓名表 * @return array */ -function accountid2name() { +function accountid2name() +{ global $link; $arr = []; @@ -198,7 +217,8 @@ function accountid2name() { * @param array $uid 員工編號 * @return array */ -function accountid2email($uid) { +function accountid2email($uid) +{ global $link; if (is_array($uid)) $accountid = implode("','", $uid); @@ -224,7 +244,8 @@ function accountid2email($uid) { * @param string|array $user_id:下位簽核者 * @param string $seq:順序 */ -function do_assign($flow_id, $id, $content, $user_id, $seq=0) { +function do_assign($flow_id, $id, $content, $user_id, $seq = 0) +{ global $link; $tds = date("Y-m-d H:i:s"); @@ -279,7 +300,8 @@ function do_assign($flow_id, $id, $content, $user_id, $seq=0) { * @param string $id:價審單序號 * @param string $content:卷號 */ -function end_flow($system_id, $flow_id, $id, $content) { +function end_flow($system_id, $flow_id, $id, $content) +{ global $link; $tds = date("Y-m-d H:i:s"); @@ -297,7 +319,7 @@ function end_flow($system_id, $flow_id, $id, $content) { $sql = "select ekind, person from pricereview_main where id = '$id'"; $res = mysqli_query($link, $sql); if ($row = mysqli_fetch_row($res)) { - $content = $row[0]."價格審查結案通知 > ".$content; + $content = $row[0] . "價格審查結案通知 > " . $content; $kind = ($row[0] == "新梯") ? 3 : 4; $sql2 = "insert into notice (kind, related_id, title, permission, creater, create_at) values ("; $sql2 .= "'$kind', '$id', '$content', '$row[1]', 'system', '$tds')"; @@ -388,7 +410,7 @@ function postCheck($post_val, $default_val = null) */ function do_wws2_assign($user_id, $form_id, $flow_code) { - + global $link; $tds = date("Y-m-d H:i:s"); $sql = "select appwms.nextval('form_key') form_key"; @@ -493,47 +515,50 @@ function accountidToRoleName($accountid) * @param array $arr:[電梯種類,人乘/載重,停數,開門方式,速度] * @return string 規格名,載重 */ -function facility_spec($arr) { +function facility_spec($arr) +{ if (empty($arr)) return; list($kind, $seat, $stop, $op, $speed) = $arr; if (strlen($speed) == 1) $speed = str_pad($speed, 2, "0", STR_PAD_LEFT); - $seat2weight_arr = ["A3" => 320, "A8" => 320, "G10" => 320, "G20" => 320, "G5" => 320, "G6" => 320, - "280-1-A" => 280, "280-1-L" => 280, "280-2-A" => 280, "280-2-L" => 280, - "320-1-A" => 320, "320-1-L" => 320, "320-2-A" => 320, "320-2-L" => 320, - "6" => 450, "8" => 550, "9" => 600, "10" => 700, "11" => 750, "12" => 800, - "13" => 900, "15" => 1000, "17" => 1150, "20" => 1350, "24" => 1600]; + $seat2weight_arr = [ + "A3" => 320, "A8" => 320, "G10" => 320, "G20" => 320, "G5" => 320, "G6" => 320, + "280-1-A" => 280, "280-1-L" => 280, "280-2-A" => 280, "280-2-L" => 280, + "320-1-A" => 320, "320-1-L" => 320, "320-2-A" => 320, "320-2-L" => 320, + "6" => 450, "8" => 550, "9" => 600, "10" => 700, "11" => 750, "12" => 800, + "13" => 900, "15" => 1000, "17" => 1150, "20" => 1350, "24" => 1600 + ]; switch ($kind) { case "MAQ100": $weight = $seat2weight_arr[$seat]; - $ret = $kind."-".$weight."-".$stop."-".$op.$speed; + $ret = $kind . "-" . $weight . "-" . $stop . "-" . $op . $speed; break; case "MAP100": $weight = $seat2weight_arr[$seat]; - $ret = $kind."-".$weight."*".$stop."-".$op.$speed; + $ret = $kind . "-" . $weight . "*" . $stop . "-" . $op . $speed; break; case "MAM200": case "MAH100": $weight = $seat2weight_arr[$seat]; - $ret = $kind."-".$seat."*".$stop."-".$op.$speed; + $ret = $kind . "-" . $seat . "*" . $stop . "-" . $op . $speed; break; case "MAF100": $weight = $seat; - $ret = $kind."-".$seat."*".$stop."-".$op.$speed; + $ret = $kind . "-" . $seat . "*" . $stop . "-" . $op . $speed; break; case "MAE100": $weight = $seat2weight_arr[$seat]; - $ret = $kind."-".$seat."*".$stop."-".$op.$speed; + $ret = $kind . "-" . $seat . "*" . $stop . "-" . $op . $speed; break; case "M1+M4(2:1)": case "M1+M4(1:1)": case "M1": $weight = $seat2weight_arr[$seat]; - $ret = "P".$seat."-".$seat2weight_arr[$seat]."-".$op."-".$speed."-".$stop; + $ret = "P" . $seat . "-" . $seat2weight_arr[$seat] . "-" . $op . "-" . $speed . "-" . $stop; break; default: $weight = $ret = ""; } - return $ret.",".$weight; + return $ret . "," . $weight; } /** @@ -541,7 +566,8 @@ function facility_spec($arr) { * @param array $arr:[簽核人1,簽核人2,簽核人3,簽核人4] * @return array 進度,下位審批人 */ -function sign_status($arr) { +function sign_status($arr) +{ $ret = []; foreach ($arr as $k => $sign) { $sign_nos = 0; @@ -554,7 +580,7 @@ function sign_status($arr) { } } if (count($sign_arr) == $sign_nos) { - $ret["sign_st"] = $k+1; + $ret["sign_st"] = $k + 1; $ret["sign_nt"] = $sign_nt_arr; return $ret; } @@ -566,9 +592,10 @@ function sign_status($arr) { return $ret; } -function getAccounttype($link,$user_id){ - $sql = "SELECT * FROM account where accountid = '$user_id'"; - $data = mysqli_query($link, $sql); +function getAccounttype($link, $user_id) +{ + $sql = "SELECT * FROM account where accountid = '$user_id'"; + $data = mysqli_query($link, $sql); $row = mysqli_fetch_array($data, MYSQLI_ASSOC); return $row['accounttype']; -} \ No newline at end of file +} diff --git a/wms/gary.php b/wms/gary.php index d18ed12d..9521d352 100644 --- a/wms/gary.php +++ b/wms/gary.php @@ -1,6 +1,67 @@ "; + date_default_timezone_set('Asia/Taipei'); + $currentTimestamp = time(); + $hashReferer = ""; + for ($i = -3; $i <= 3; $i++) { + $modifiedTimestamp = strtotime("$i seconds", $currentTimestamp); + $formattedTime = date("Y-m-d H:i:s", $modifiedTimestamp); + $hashReferer .= md5("https://bpm.masada.com.twMasada@2023".$formattedTime); + } + echo $hashReferer; + if (strpos($hashReferer, $referer)) { + echo "login"; + } +} else { + echo "沒有 HTTP_REFERER 資訊可用"; +} +echo "
"; +if(isset($_SERVER['HTTP_REFERER'])) { + $referrer = $_SERVER['HTTP_REFERER']; + echo "來自於: $referrer"; +} else { + echo "沒有 referrer 資訊可用"; +} +echo "
"; +if (isset($_SERVER['REMOTE_ADDR'])) { + $visitor_ip = $_SERVER['REMOTE_ADDR']; + echo "訪問者的 IP 地址是: $visitor_ip"; +} else { + echo "REMOTE_ADDR : 無法獲取訪問者的 IP 地址"; +} +echo "
"; +if (isset($_SERVER['HTTP_CLIENT_IP'])) { + $visitor_ip = $_SERVER['HTTP_CLIENT_IP']; + echo "訪問者的 IP 地址是: $visitor_ip"; +} else { + echo "HTTP_CLIENT_IP : 無法獲取訪問者的 IP 地址"; +} +echo "
"; + +if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $visitor_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + echo "訪問者的 IP 地址是: $visitor_ip"; +} else { + echo "HTTP_X_FORWARDED_FOR : 法獲取訪問者的 IP 地址"; +} +echo "
"; + + +?> + +displayPage(); -function CreateToken($user_id, $user_name) { - date_default_timezone_set("Asia/Taipei"); - $start_time = date("Y-m-d H:i:s"); - $end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时 - $info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天 - $encryption_code = "MASADA!^***"; - //根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量) - $signature = hash_hmac('md5', $info, $encryption_code); - //最后将这两部分拼接起来,得到最终的Token字符串 - return $token = $info . '.' . $signature; +function CreateToken($user_id, $user_name) +{ + date_default_timezone_set("Asia/Taipei"); + $start_time = date("Y-m-d H:i:s"); + $end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时 + $info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天 + $encryption_code = "MASADA!^***"; + //根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量) + $signature = hash_hmac('md5', $info, $encryption_code); + //最后将这两部分拼接起来,得到最终的Token字符串 + return $token = $info . '.' . $signature; } require_once dirname(__FILE__) . "/../mkt/database.php"; include "fun_global.php"; if (isset($_REQUEST["function_name"])) { - $function_name = $_REQUEST["function_name"]; - $function_flag = True; + $function_name = $_REQUEST["function_name"]; + $function_flag = True; } else { - $function_name = ""; - $function_flag = False; + $function_name = ""; + $function_flag = False; } /** * 連線T8 MSSQL */ -// try { -// $conn = new PDO("sqlsrv:Server=10.10.145.2;Database=T8MASADA", "masada", "@m222222"); -// if ($conn) { -// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -// } -// } catch (PDOException $e) { -// //echo "fail"; -// //echo $e->getMessage(); -// } +try { + $conn = new PDO("sqlsrv:Server=erp.masada.com.tw;Database=T8MASADA", "masada", "ztPmPP!HRoV6SL3E"); + if ($conn) { + $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } +} catch (PDOException $e) { + //echo "fail"; + //echo $e->getMessage(); +} @@ -53,34 +54,49 @@ if (isset($_REQUEST["function_name"])) { * $login_dt 登入時間 * $user_auth 使用權限:1,2,3 *****************************/ -$token = $_REQUEST["token"]; +$token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : ""; if (count(explode(".", $token)) > 1) { - $token_link = "token=" . $_REQUEST["token"]; - list($user_id, $enc_user_name, $login_dt) = explode(".", $token); - $user_name = urldecode(base64_decode($enc_user_name)); + $token_link = "token=" . $_REQUEST["token"]; + list($user_id, $enc_user_name, $login_dt) = explode(".", $token); + $user_name = urldecode(base64_decode($enc_user_name)); } else { - $user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id; - $login_dt = !empty($_GET["timestamp"]) ? substr($_GET["timestamp"], 0, 10) : $login_dt; - $login_dt = date('Y-m-d H:i:s', $login_dt); - $user_name = accountid2name()[$user_id]; - $token = CreateToken($user_id,$user_name); - $token_link = "token=" . $token; + $referrer = isset($_GET['referer']) ? $_GET['referer'] : ""; + date_default_timezone_set('Asia/Taipei'); + $currentTimestamp = time(); + $hashReferer = ""; + for ($i = -3; $i <= 3; $i++) { + $modifiedTimestamp = strtotime("$i seconds", $currentTimestamp); + $formattedTime = date("Y-m-d H:i:s", $modifiedTimestamp); + $hashReferer .= md5("https://bpm.masada.com.twMasada@2023" . $formattedTime); + } + if (strpos($hashReferer, $referrer)) { + $user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id; + $login_dt = !empty($_GET["timestamp"]) ? substr($_GET["timestamp"], 0, 10) : $login_dt; + $login_dt = date('Y-m-d H:i:s', $login_dt); + // 藍凌超連結過來 token 設置永久 + $login_dt = (date("Y") + 100) . "-12-31 23:59:59"; + $user_name = accountid2name()[$user_id]; + $token = CreateToken($user_id, $user_name); + $token_link = "token=" . $token; + } else { + echo "非法訪問!"; + echo ""; + } } - include 'IncludeCommon.php'; $includecommon = new IncludeCommon(); $accounttype = getAccounttype($link, $user_id); $login_json = null; if (strlen($accounttype) != 0) { - $jsonres['menu'] = $includecommon->menu_v3($user_id, $accounttype); - $login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE); + $jsonres['menu'] = $includecommon->menu_v3($user_id, $accounttype); + $login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE); } ?> - - - - Masada後臺系統 - - - - - - - - - + + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/wms/loginapi.php b/wms/loginapi.php index 63a1cbb2..38ccc299 100644 --- a/wms/loginapi.php +++ b/wms/loginapi.php @@ -18,7 +18,7 @@ if(!empty($_REQUEST["account"])&& !empty($_REQUEST["password"])) { $accounttype = $row['accounttype']; $user_name = $row['name']; // 修正小寫登入 token 會帶入小寫的bug //M0117修改于 2023/07/31 13:45 - $accountid = $row['accountid']; + $accountid = strtoupper($row['accountid']); if (strlen($accounttype) != 0) { // B=保養員 M=永佳捷員工 E=管理員 if ($accounttype == "B" || $accounttype == "M" || $accounttype == "E" || $accounttype == "W"){ diff --git a/wms/rib01-check.php b/wms/rib01-check.php index ebbda72e..2aad50ad 100644 --- a/wms/rib01-check.php +++ b/wms/rib01-check.php @@ -107,7 +107,7 @@ elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) :

diff --git a/wms/rib01-create.php b/wms/rib01-create.php index 7c42f97a..09ea8c1f 100644 --- a/wms/rib01-create.php +++ b/wms/rib01-create.php @@ -127,8 +127,8 @@ if ($MaxBillNo < 10) { echo "selected"; } ?>> --> + echo "selected"; + } ?>> @@ -142,18 +142,15 @@ if ($MaxBillNo < 10) {
- $value) { foreach ($member as $key => $value) { ?> - - + +
@@ -180,7 +177,12 @@ if ($MaxBillNo < 10) {
+ + +
diff --git a/wms/wipwhole-renovate-rec-invoice-edit-submit.php b/wms/wipwhole-renovate-rec-invoice-edit-submit.php index 13cdc600..02afee7e 100644 --- a/wms/wipwhole-renovate-rec-invoice-edit-submit.php +++ b/wms/wipwhole-renovate-rec-invoice-edit-submit.php @@ -236,28 +236,56 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $qc_official_type = $_POST['qc_official_type'] ?: $row['qc_official_type']; $creater = $_POST['creater']; - $create_at = $_POST['create_at']; + $create_at = date("Y-m-fd H:i:s"); // 上傳附件 include "wipwhole-rec-invoice-edit-fileupload.php"; // 工勘變更通知繪圖人員 - if ($official_check_date !== $old_official_check_date) { - $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 + $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"; - $sql = " + $sql = " + INSERT INTO notice( + kind, + related_id, + title, + content, + haveread, + permission, + creater, + create_at + )VALUES( + '1', + '$id', + '$title', + '$content', + null, + '$permission', + '$creater', + '" . date("Y-m-d H:i:s") . "' + ); + "; + mysqli_query($link, $sql); + } + } + } + + if (!empty($desin_documents_verify_file)) { + $sql = " INSERT INTO notice( kind, related_id, @@ -270,16 +298,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { )VALUES( '1', '$id', - '$title', - '$content', + '合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件', + '合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件', null, - '$permission', + 'M0168', '$creater', - '" . date("Y-m-d H:i:s") . "' + '$create_at' ); "; - mysqli_query($link, $sql); - } + mysqli_query($link, $sql); } $updatesql = "update wipwholestatus set "; @@ -1064,8 +1091,8 @@ function checkWwsAssianStatus($link, $user_id) $data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)]; $data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)]; $data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)]; - $data['shengguanokname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)]; - $data['shengguanokmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)]; + $data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)]; + $data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)]; // 確認工務階段 進入營業階段 if (checkNowFormStatus($link) == 'A' && checkGongWuok($link, $id) == '0') { @@ -1119,7 +1146,7 @@ function checkWwsAssianStatus($link, $user_id) } } - // 確認營業主管階段 進入設計人員(新梯:郭承瑋 M0023)階段 + // 確認營業主管階段 進入設計人員(汰改:林昭翰 M0173)階段 if (checkNowFormStatus($link) == 'F' && checkYingYeok($link, $id) == '0') { if (checkUseridIsManager($user_id)) { write_note($link, $id, $user_id, "營業經理提交至設計階段"); diff --git a/wms/wipwhole-renovate-rec-invoice-edit.php b/wms/wipwhole-renovate-rec-invoice-edit.php index 2fde966b..f4163384 100644 --- a/wms/wipwhole-renovate-rec-invoice-edit.php +++ b/wms/wipwhole-renovate-rec-invoice-edit.php @@ -690,7 +690,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; 移交日
- > + > @@ -1157,19 +1157,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; - + diff --git a/wms/wipwhole-wipinstallstatus-index.php b/wms/wipwhole-wipinstallstatus-index.php index bf793f6d..a7756b7f 100644 --- a/wms/wipwhole-wipinstallstatus-index.php +++ b/wms/wipwhole-wipinstallstatus-index.php @@ -504,6 +504,9 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) { M1 (int)$radeY . $radeM) { MA (int)$radeY . $radeM) { 合計 合約地址 地工地址 警示 - 預計出貨日 + 實際到廠日(觀音廠) + 預計出貨日(到工地) 發包廠商(工勘) 發包日期(工勘) 預計開工日(工勘) @@ -56,7 +57,18 @@ - + + + + + + $val) { // if ((string)$data['site_survey_contact_verify'] == (string)$key) { @@ -88,9 +100,9 @@ echo "
" . date("Y/m/d", strtotime($data['tryrun_outsourcer_date'])); } else { if (!empty($data['install_outsourcer_date'])) - echo date("Y/m/d", strtotime($data['install_outsourcer_date'])). "
 "; + echo date("Y/m/d", strtotime($data['install_outsourcer_date'])) . "
 "; if (!empty($data['tryrun_outsourcer_date'])) - echo " 
" .date("Y/m/d", strtotime($data['tryrun_outsourcer_date'])); + echo " 
" . date("Y/m/d", strtotime($data['tryrun_outsourcer_date'])); } ?> @@ -114,9 +126,9 @@ echo "
" . date("Y/m/d", strtotime($data['tryrun_start_date'])); } else { if (!empty($data['install_start_date'])) - echo date("Y/m/d", strtotime($data['install_start_date'])). "
 "; + echo date("Y/m/d", strtotime($data['install_start_date'])) . "
 "; if (!empty($data['tryrun_start_date'])) - echo " 
" .date("Y/m/d", strtotime($data['tryrun_start_date'])); + echo " 
" . date("Y/m/d", strtotime($data['tryrun_start_date'])); } ?> @@ -127,9 +139,9 @@ echo "
" . date("Y/m/d", strtotime($data['estimate_tryrun_end_date'])); } else { if (!empty($data['estimate_install_end_date'])) - echo date("Y/m/d", strtotime($data['estimate_install_end_date'])). "
 "; + echo date("Y/m/d", strtotime($data['estimate_install_end_date'])) . "
 "; if (!empty($data['estimate_tryrun_end_date'])) - echo " 
" .date("Y/m/d", strtotime($data['estimate_tryrun_end_date'])); + echo " 
" . date("Y/m/d", strtotime($data['estimate_tryrun_end_date'])); } ?> @@ -140,9 +152,9 @@ echo "
" . date("Y/m/d", strtotime($data['tryrun_end_date'])); } else { if (!empty($data['install_end_date'])) - echo date("Y/m/d", strtotime($data['install_end_date'])). "
 "; + echo date("Y/m/d", strtotime($data['install_end_date'])) . "
 "; if (!empty($data['tryrun_end_date'])) - echo " 
" .date("Y/m/d", strtotime($data['tryrun_end_date'])); + echo " 
" . date("Y/m/d", strtotime($data['tryrun_end_date'])); } ?> diff --git a/wms/wipwholeinstall-renovate-index-table-html.php b/wms/wipwholeinstall-renovate-index-table-html.php index 7846457c..2f3dc8f4 100644 --- a/wms/wipwholeinstall-renovate-index-table-html.php +++ b/wms/wipwholeinstall-renovate-index-table-html.php @@ -7,7 +7,8 @@ 合約地址 地工地址 警示 - 預計出貨日 + 實際到廠日(觀音廠) + 預計出貨日(到工地) 發包廠商(工勘) 發包日期(工勘) 預計開工日(工勘) @@ -39,7 +40,18 @@ - + + + + + + $val) { // if ((string)$data['site_survey_contact_verify'] == (string)$key) { @@ -181,7 +193,6 @@