diff --git a/.gitignore b/.gitignore
index 3faa3b7a..31786233 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,4 @@ wms/mkt/WriteOffRepair.xlsx
wms/contract/images/contracts
wms/test.php
app/account_log/
+wms/gary2.php
diff --git a/wms/api/bpm/addContract.ini b/wms/api/bpm/addContract.ini
new file mode 100644
index 00000000..bf0fa880
--- /dev/null
+++ b/wms/api/bpm/addContract.ini
@@ -0,0 +1,246 @@
+[1702986324]
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:D23070085"
+fd_3c7af41f068350 = "劉世華"
+fd_3c7b8fdee03432 = "Fri Dec 15 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0074"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號"
+fd_3c7bd36b993eac = "204000"
+fd_3c7bd7adce7f3e = "Thu Dec 21 00:00:00 CST 2023"
+fd_3c7b96c1b5523c = ""
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0018"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "桃園市"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "1703433600100"
+fd_3c7bd7aac30e4c = "Tue Dec 19 00:00:00 CST 2023"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = "需要 QC + 官檢"
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0960-625735"
+fd_3c7b9892c08350 = "A079-大地國際開發-大園10戶313住宅"
+fd_3c7b8ffee177ae = "2"
+fd_3c7c7ca07fa8ea = "3"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "桃園市"
+fd_3c7af41b3bc014 = "吳嬖如"
+fd_3c7d2bac66cb4a = "MAH100-6*5-2S45;轎廂 MA019;扶手 MC002;操縱盤 ME017"
+fd_3c7b96cbd9a332 = ""
+fdNumber = "20231219002"
+fd_3c7af4170a31b4 = "D23070085"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "510001"
+fd_3c7c931495463e = "1020002"
+fd_3c7c7e4d52426a = "QO"
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219002"
+fd_3c7bd7aecd1bf2 = "Sat Dec 23 00:00:00 CST 2023"
+fd_3c7bd3704d1772 = "204001"
+fd_3c7c7daa12b3a6_text = "月保養"
+fd_3c7af41d5f0c0e = "13010305 "
+docStatus = "20"
+docCreateTime = "2023-12-19 19:44:00.0"
+fdId = "18c81e3e6fbfd27dc603c3948d6af18e"
+fd_3c7d207688e4c0 = "2"
+fd_3c7af41a3391d8 = "永融營造工程有限公司"
+fd_3c7b9787f379c4_text = "M0018_范育偉"
+fd_3c7bd7ae2619e2 = "Fri Dec 22 00:00:00 CST 2023"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7bd7af873bb8 = "Mon Dec 25 00:00:00 CST 2023"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7bd7af250b76 = "Sun Dec 24 00:00:00 CST 2023"
+fd_3c7c7ca07fa8ea_text = "全包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "永融營造工程有限公司"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7bd7ac5bca84 = "Wed Dec 20 00:00:00 CST 2023"
+fd_3c7af6af1c2232_text = "章又仁"
+fd_3c7bd37147ce12 = "102000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "hm"
+
+[1702987657]
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:D23070085"
+fd_3c7af41f068350 = "劉世華"
+fd_3c7b8fdee03432 = "Fri Dec 15 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0074"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號123"
+fd_3c7bd36b993eac = "204000"
+fd_3c7bd7adce7f3e = "Tue Dec 19 00:00:00 CST 2023"
+fd_3c7b96c1b5523c = ""
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0045"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "桃園市"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "1703260800100"
+fd_3c7bd7aac30e4c = "Sun Dec 17 00:00:00 CST 2023"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = ""
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0960-625735"
+fd_3c7b9892c08350 = "A079-大地國際開發-大園10戶313住宅"
+fd_3c7b8ffee177ae = "2"
+fd_3c7c7ca07fa8ea = "2"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "桃園市"
+fd_3c7af41b3bc014 = "吳嬖如"
+fd_3c7d2bac66cb4a = "MAH100-6*5-2S45;轎廂 MA019;扶手 MC002;操縱盤 ME017"
+fd_3c7b96cbd9a332 = ""
+fdNumber = "20231219003"
+fd_3c7af4170a31b4 = "D23070085"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "510001"
+fd_3c7c931495463e = "1020002"
+fd_3c7c7e4d52426a = ""
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219003"
+fd_3c7bd7aecd1bf2 = "Thu Dec 21 00:00:00 CST 2023"
+fd_3c7bd3704d1772 = "204001"
+fd_3c7c7daa12b3a6_text = "雙週保養"
+fd_3c7af41d5f0c0e = "13010305 "
+docStatus = "20"
+docCreateTime = "2023-12-19 20:05:00.0"
+fdId = "18c81f7e09080da42588ce5471faea8d"
+fd_3c7d207688e4c0 = "2"
+fd_3c7af41a3391d8 = "永融營造工程有限公司"
+fd_3c7b9787f379c4_text = "M0045_徐振淞"
+fd_3c7bd7ae2619e2 = "Wed Dec 20 00:00:00 CST 2023"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7bd7af873bb8 = "Sat Dec 23 00:00:00 CST 2023"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7bd7af250b76 = "Fri Dec 22 00:00:00 CST 2023"
+fd_3c7c7ca07fa8ea_text = "半包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "永融營造工程有限公司"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7bd7ac5bca84 = "Mon Dec 18 00:00:00 CST 2023"
+fd_3c7af6af1c2232_text = "章又仁"
+fd_3c7bd37147ce12 = "102000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "bw"
+
+[1702988835]
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:D23070085"
+fd_3c7af41f068350 = "劉世華"
+fd_3c7b8fdee03432 = "Sun Dec 31 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0074"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號"
+fd_3c7bd36b993eac = "204000"
+fd_3c7b96c1b5523c = ""
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0059"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "嘉義縣"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "100"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = "只需官檢"
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0960-625735"
+fd_3c7b9892c08350 = "A079-大地國際開發-大園10戶313住宅"
+fd_3c7b8ffee177ae = "2"
+fd_3c7c7ca07fa8ea = "2"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "嘉義縣"
+fd_3c7af41b3bc014 = "吳嬖如"
+fd_3c7d2bac66cb4a = "MAH100-6*5-2S45;轎廂 MA019;扶手 MC002;操縱盤 ME017"
+fd_3c7b96cbd9a332 = "328桃園市觀音區崙坪村8鄰140號"
+fdNumber = "20231219004"
+fd_3c7af4170a31b4 = "D23070085"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "510001"
+fd_3c7c931495463e = "1020002"
+fd_3c7c7e4d52426a = "O"
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219004"
+fd_3c7bd3704d1772 = "204001"
+fd_3c7c7daa12b3a6_text = "雙週保養"
+fd_3c7af41d5f0c0e = "13010305 "
+docStatus = "20"
+docCreateTime = "2023-12-19 20:26:00.0"
+fdId = "18c820a7decaf6dfbcf4b2d4da199d27"
+fd_3c7d207688e4c0 = "2"
+fd_3c7af41a3391d8 = "永融營造工程有限公司"
+fd_3c7b9787f379c4_text = "M0059_林永鴻"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7c7ca07fa8ea_text = "半包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "永融營造工程有限公司"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7af6af1c2232_text = "章又仁"
+fd_3c7bd37147ce12 = "102000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "bw"
+
+[1702989437]
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:M230609"
+fd_3c7af41f068350 = "曾永霖"
+fd_3c7b8fdee03432 = "Sun Nov 26 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0035"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號"
+fd_3c7bd36b993eac = "636000"
+fd_3c7b96c1b5523c = "0930005720"
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0089"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "南投縣"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "100"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = ""
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0930005720"
+fd_3c7b9892c08350 = "祥發開發(青砂街)"
+fd_3c7b8ffee177ae = "6"
+fd_3c7c7ca07fa8ea = "2"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "南投縣"
+fd_3c7af41b3bc014 = "楊雅惠"
+fd_3c7d2bac66cb4a = "MAH100-6*4-2S45;轎廂 MA018;扶手 MC005;清安費用;其他配合費用"
+fd_3c7b96cbd9a332 = "328桃園市觀音區崙坪村8鄰140號"
+fdNumber = "20231219005"
+fd_3c7af4170a31b4 = "M230609"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "1590000"
+fd_3c7c931495463e = "3180000"
+fd_3c7c7e4d52426a = ""
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219005"
+fd_3c7bd3704d1772 = "636000"
+fd_3c7c7daa12b3a6_text = "雙週保養"
+fd_3c7af41d5f0c0e = ""
+docStatus = "20"
+docCreateTime = "2023-12-19 20:33:00.0"
+fdId = "18c82117c73aafc593e492142d28b88b"
+fd_3c7d207688e4c0 = "6"
+fd_3c7af41a3391d8 = "祥發開發(青砂街)"
+fd_3c7b9787f379c4_text = "M0089_郭玠德"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7c7ca07fa8ea_text = "半包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "祥發開發(青砂街)"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7af6af1c2232_text = "林易增"
+fd_3c7bd37147ce12 = "318000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "bw"
+
diff --git a/wms/api/bpm/addContract.php b/wms/api/bpm/addContract.php
new file mode 100644
index 00000000..cb183be5
--- /dev/null
+++ b/wms/api/bpm/addContract.php
@@ -0,0 +1,169 @@
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+
+ $pdo->beginTransaction();
+
+ $sth = $pdo->prepare("INSERT INTO account (accounttype , accountid) VALUES (?, ?)");
+ $sth->bindValue(1, 'mf_vol_no');
+ $sth->execute();
+
+
+ $pdo->commit();
+
+ showSuccessMessage();
+ } catch (PDOException $e) {
+ $pdo->rollBack();
+ echo "Transaction failed: " . $e->getMessage();
+ }
+}
+
+function showSuccessMessage()
+{
+ $response = array('status' => 'success', 'message' => 'Data received and stored successfully');
+ header('Content-Type: application/json');
+ echo json_encode($response);
+}
+
+function showErrorMessage()
+{
+ $response = array('status' => 'error', 'message' => 'Data received and stored error');
+ header('Content-Type: application/json');
+ echo json_encode($response);
+}
+
+function show400Error()
+{
+ http_response_code(400);
+ echo 'Invalid request data';
+}
+
+function show405Error()
+{
+ http_response_code(405);
+ echo 'Method Not Allowed';
+}
+
+function writePostIni($request_data)
+{
+ // 讀取現有 ini 檔案的資料
+ $ini_file = 'addContract.ini';
+ $existing_data = parse_ini_file($ini_file, true);
+
+ // 將接收到的資料加入現有資料
+ $timestamp = time();
+ $existing_data[$timestamp] = $request_data;
+
+ // 將資料寫入 ini 檔
+ $ini_content = '';
+ foreach ($existing_data as $key => $value) {
+ $ini_content .= "[$key]\n";
+ foreach ($value as $k => $v) {
+ $ini_content .= "$k = \"$v\"\n";
+ }
+ $ini_content .= "\n";
+ }
+
+ file_put_contents($ini_file, $ini_content);
+}
+
+
+function writePostIniJson($request_data)
+{
+ $txt_file = 'addContract.txt';
+ $txt = "";
+ $file = fopen($txt_file, 'a');
+ foreach($request_data as $k => $v){
+ $txt .= "$k = \"$v\"\n";
+ }
+ fwrite($file, $txt . PHP_EOL);
+ fclose($file);
+}
diff --git a/wms/api/bpm/addContract.txt b/wms/api/bpm/addContract.txt
new file mode 100644
index 00000000..7b372976
--- /dev/null
+++ b/wms/api/bpm/addContract.txt
@@ -0,0 +1,242 @@
+Array
+{
+"統一編號/身分證":"13010305 ",
+"客戶電話":"",
+"主旨":"合約入力(新梯)_合約號:D23070085",
+"QC和官檢(顯示值)":"",
+"保養期限":0.0,
+"保養員":"",
+"合計":1020002.0,
+"營業員":"M0074",
+"是否歸檔":false,
+"負責人":"吳嬖如",
+"启用电子签章":false,
+"是否允許傳閱":false,
+"區域":"南投縣",
+"QC和官檢":"",
+"維修型態":"",
+"地址":"328桃園市觀音區崙坪村8鄰140號",
+"ID":"18c6ca8d4a5fafcece62472441cb1fe5",
+"創建時間":"2023-12-15 16:47:00.0",
+"規格":"MAH100-6*5-2S45;
+轎廂 MA019;
+扶手 MC002;
+操縱盤 ME017",
+"立約人":"永融營造工程有限公司",
+"2、二次款":0.0,
+"7、其它":0.0,
+"合約號碼":"D23070085",
+"3占百分比":50.0,
+"1、訂金":204000.0,
+"保養頻率":"",
+"電梯台數":2.0,
+"3、貨到工地款":510001.0,
+"2占百分比":0.0,
+"營業員(顯示值)":"章又仁",
+"保養員(顯示值)":"",
+"5、安裝完畢款":204001.0,
+"業務聯繫人電話":"0960-625735",
+"客戶名稱":"永融營造工程有限公司",
+"1占百分比":20.0,
+"6占百分比":10.0,
+"保養別":"",
+"合約簽訂時間":"Fri Dec 15 00:00:00 CST 2023",
+"明細表總台數":2.0,
+"保養頻率(顯示值)":"",
+"表單號":"20231215018",
+"7占百分比":0.0,
+"申請單編號":"20231215018",
+"加總趴數":100.0,
+"email":"",
+"案件名稱":"A079-大地國際開發-大園10戶313住宅",
+"4占百分比":0.0,
+"業務聯繫人地址":"",
+"業務聯繫人":"劉世華",
+"6、驗收款":102000.0,
+"保養別(顯示值)":"",
+"5占百分比":20.0,
+"區域(顯示值)":"南投縣",
+"4、其他":0.0,
+"文檔狀態":"20",
+"業務聯繫人Email":""
+}
+Array
+Array
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:D23070085"
+fd_3c7af41f068350 = "劉世華"
+fd_3c7b8fdee03432 = "Fri Dec 15 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0074"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號123"
+fd_3c7bd36b993eac = "204000"
+fd_3c7bd7adce7f3e = "Tue Dec 19 00:00:00 CST 2023"
+fd_3c7b96c1b5523c = ""
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0045"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "桃園市"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "1703260800100"
+fd_3c7bd7aac30e4c = "Sun Dec 17 00:00:00 CST 2023"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = ""
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0960-625735"
+fd_3c7b9892c08350 = "A079-大地國際開發-大園10戶313住宅"
+fd_3c7b8ffee177ae = "2"
+fd_3c7c7ca07fa8ea = "2"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "桃園市"
+fd_3c7af41b3bc014 = "吳嬖如"
+fd_3c7d2bac66cb4a = "MAH100-6*5-2S45;轎廂 MA019;扶手 MC002;操縱盤 ME017"
+fd_3c7b96cbd9a332 = ""
+fdNumber = "20231219003"
+fd_3c7af4170a31b4 = "D23070085"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "510001"
+fd_3c7c931495463e = "1020002"
+fd_3c7c7e4d52426a = ""
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219003"
+fd_3c7bd7aecd1bf2 = "Thu Dec 21 00:00:00 CST 2023"
+fd_3c7bd3704d1772 = "204001"
+fd_3c7c7daa12b3a6_text = "雙週保養"
+fd_3c7af41d5f0c0e = "13010305 "
+docStatus = "20"
+docCreateTime = "2023-12-19 20:05:00.0"
+fdId = "18c81f7e09080da42588ce5471faea8d"
+fd_3c7d207688e4c0 = "2"
+fd_3c7af41a3391d8 = "永融營造工程有限公司"
+fd_3c7b9787f379c4_text = "M0045_徐振淞"
+fd_3c7bd7ae2619e2 = "Wed Dec 20 00:00:00 CST 2023"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7bd7af873bb8 = "Sat Dec 23 00:00:00 CST 2023"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7bd7af250b76 = "Fri Dec 22 00:00:00 CST 2023"
+fd_3c7c7ca07fa8ea_text = "半包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "永融營造工程有限公司"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7bd7ac5bca84 = "Mon Dec 18 00:00:00 CST 2023"
+fd_3c7af6af1c2232_text = "章又仁"
+fd_3c7bd37147ce12 = "102000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "bw"
+
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:D23070085"
+fd_3c7af41f068350 = "劉世華"
+fd_3c7b8fdee03432 = "Sun Dec 31 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0074"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號"
+fd_3c7bd36b993eac = "204000"
+fd_3c7b96c1b5523c = ""
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0059"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "嘉義縣"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "100"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = "只需官檢"
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0960-625735"
+fd_3c7b9892c08350 = "A079-大地國際開發-大園10戶313住宅"
+fd_3c7b8ffee177ae = "2"
+fd_3c7c7ca07fa8ea = "2"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "嘉義縣"
+fd_3c7af41b3bc014 = "吳嬖如"
+fd_3c7d2bac66cb4a = "MAH100-6*5-2S45;轎廂 MA019;扶手 MC002;操縱盤 ME017"
+fd_3c7b96cbd9a332 = "328桃園市觀音區崙坪村8鄰140號"
+fdNumber = "20231219004"
+fd_3c7af4170a31b4 = "D23070085"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "510001"
+fd_3c7c931495463e = "1020002"
+fd_3c7c7e4d52426a = "O"
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219004"
+fd_3c7bd3704d1772 = "204001"
+fd_3c7c7daa12b3a6_text = "雙週保養"
+fd_3c7af41d5f0c0e = "13010305 "
+docStatus = "20"
+docCreateTime = "2023-12-19 20:26:00.0"
+fdId = "18c820a7decaf6dfbcf4b2d4da199d27"
+fd_3c7d207688e4c0 = "2"
+fd_3c7af41a3391d8 = "永融營造工程有限公司"
+fd_3c7b9787f379c4_text = "M0059_林永鴻"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7c7ca07fa8ea_text = "半包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "永融營造工程有限公司"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7af6af1c2232_text = "章又仁"
+fd_3c7bd37147ce12 = "102000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "bw"
+
+fdSignEnable = ""
+fd_3c7b956a747f5e = ""
+docSubject = "合約入力(新梯)_合約號:M230609"
+fd_3c7af41f068350 = "曾永霖"
+fd_3c7b8fdee03432 = "Sun Nov 26 00:00:00 CST 2023"
+fd_3c7af6af1c2232 = "M0035"
+fd_3c7af42a237960 = "328桃園市觀音區崙坪村8鄰140號"
+fd_3c7bd36b993eac = "636000"
+fd_3c7b96c1b5523c = "0930005720"
+fd_3c7b96b95bb932 = "test@gmail.com"
+fd_3c7b9787f379c4 = "M0089"
+fd_3c7bb84b1e63c4 = "12"
+fd_3c7d1ee50bc354_text = "南投縣"
+fd_3c7bd6cac53216 = "0"
+fd_3c7c93e2e39832 = "100"
+fdCanCircularize = ""
+fd_3c7c7e4d52426a_text = ""
+fd_3c7bd6cc6292b6 = "20"
+fd_3c7af41fffd500 = "0930005720"
+fd_3c7b9892c08350 = "祥發開發(青砂街)"
+fd_3c7b8ffee177ae = "6"
+fd_3c7c7ca07fa8ea = "2"
+fd_3c7bd36cc1ac98 = "0"
+fd_3c7d1ee50bc354 = "南投縣"
+fd_3c7af41b3bc014 = "楊雅惠"
+fd_3c7d2bac66cb4a = "MAH100-6*4-2S45;轎廂 MA018;扶手 MC005;清安費用;其他配合費用"
+fd_3c7b96cbd9a332 = "328桃園市觀音區崙坪村8鄰140號"
+fdNumber = "20231219005"
+fd_3c7af4170a31b4 = "M230609"
+fd_3c7bd6cb481c76 = "50"
+fd_3c7bd36dbd6424 = "1590000"
+fd_3c7c931495463e = "3180000"
+fd_3c7c7e4d52426a = ""
+fd_3c7bd6ccccad9e = "10"
+fd_3c7c88160cf576 = "20231219005"
+fd_3c7bd3704d1772 = "636000"
+fd_3c7c7daa12b3a6_text = "雙週保養"
+fd_3c7af41d5f0c0e = ""
+docStatus = "20"
+docCreateTime = "2023-12-19 20:33:00.0"
+fdId = "18c82117c73aafc593e492142d28b88b"
+fd_3c7d207688e4c0 = "6"
+fd_3c7af41a3391d8 = "祥發開發(青砂街)"
+fd_3c7b9787f379c4_text = "M0089_郭玠德"
+fd_3c7bd69fa6ac52 = "20"
+fd_3c7bd36f203800 = "0"
+fd_3c7b96ec571486 = "定期保養"
+fd_3c7c7ca07fa8ea_text = "半包"
+fd_3c7bd6cc026d8e = "0"
+fd_3c7b8fbca98fbc = "祥發開發(青砂街)"
+fdIsFiling = ""
+fd_3c7bd372804cae = "0"
+fd_3c7af6af1c2232_text = "林易增"
+fd_3c7bd37147ce12 = "318000"
+fd_3c7bd6cd30113a = "0"
+fd_3c7c7daa12b3a6 = "bw"
+
diff --git a/wms/api/bpm/addContract_form.php b/wms/api/bpm/addContract_form.php
new file mode 100644
index 00000000..2b388561
--- /dev/null
+++ b/wms/api/bpm/addContract_form.php
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/wms/api/bpm/download.php b/wms/api/bpm/download.php
new file mode 100644
index 00000000..73723357
--- /dev/null
+++ b/wms/api/bpm/download.php
@@ -0,0 +1,108 @@
+ 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);
+ }
+
+ // /**
+ // * 取得下一個新的作番
+ // * @param string $facility_type : M:新梯 T:汰改 B:保養
+ // * @return array $new_facility_arr
+ // */
+ function downloadBPMFilesByFormNo($tablename, $form_column_name, $form_no)
+ {
+ $fd_id = $this->getFd_id($tablename, $form_column_name, $form_no);
+
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $sql = "
+ SELECT * FROM sys_att_main AS b
+ LEFT JOIN sys_att_file AS c
+ ON b.fd_file_id = c.fd_id
+ WHERE b.fd_model_id = :fd_id
+ ";
+ $sth = $pdo->prepare($sql);
+ $sth->bindParam(':fd_id', $fd_id);
+ $sth->execute();
+ $result = $sth->fetchAll();
+
+ foreach ($result as $row) {
+ $fd_file_name = $row['fd_file_name'];
+ $fd_file_path = "/public/bpm/" . $row['fd_file_path'];
+ // $filePath = $_SERVER['DOCUMENT_ROOT'] . $fd_file_path;
+ $str = "";
+ $str .= '' . $fd_file_name . '';
+ $str .= "
";
+ echo $str;
+ }
+ return $result;
+ }
+
+ function getFd_id($tablename, $form_column_name, $form_no)
+ {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $sth = $pdo->prepare('SELECT fd_id FROM ' . $tablename . ' WHERE ' . $form_column_name . ' = ? ');
+ $sth->bindValue(1, $form_no);
+ $sth->execute();
+ $result = $sth->fetch();
+ return $result['fd_id'];
+ }
+}
+
+
+$bdf = new Bpm_Download_files;
+// 映射的 table name
+$tablename = "ekp_test";
+// 映射的 表單表單編號欄位名稱
+$form_column_name = "fd_shen1";
+// 映射的 表單編號
+$form_no = "20231221001";
+$bdf->downloadBPMFilesByFormNo($tablename, $form_column_name, $form_no);
diff --git a/wms/api/bpm/requests.ini b/wms/api/bpm/requests.ini
new file mode 100644
index 00000000..a13cfab4
--- /dev/null
+++ b/wms/api/bpm/requests.ini
@@ -0,0 +1,6 @@
+[1702622618]
+id = "123"
+
+[1702622646]
+id = "123"
+
diff --git a/wms/class/Cnotice.php b/wms/class/Cnotice.php
index dd9958f6..970bf81c 100644
--- a/wms/class/Cnotice.php
+++ b/wms/class/Cnotice.php
@@ -96,14 +96,14 @@ class Cnotice
}
}
-$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);
+// $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);
diff --git a/wms/estimated_shipping_date_report.php b/wms/estimated_shipping_date_report.php
index 3b0db952..606b06b7 100644
--- a/wms/estimated_shipping_date_report.php
+++ b/wms/estimated_shipping_date_report.php
@@ -1,1339 +1,1474 @@
-= '$start_y-$start_m-1'
- AND real_contract_arrival_date <= '$end_y-$end_m-31'
- ) AS this_order
- WHERE 1 = 1
- GROUP BY this_order.contract_type,
- this_order.sub_address,
- this_order.date_year,
- this_order.date_month
-";
-$result = mysqli_query($link, $sql);
-$data = [];
-while ($row = $result->fetch_assoc()) {
- $data[] = $row;
-}
-
-function findData($data, $searchData)
-{
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['sub_address'] == $searchData['sub_address']
- && $item['date_year'] == $searchData['date_year']
- && $item['date_month'] == $searchData['date_month']
- ) {
- return $item['facility_count'];
- }
- }
- return 0;
-}
-
-function findDataByCity($data, $searchData)
-{
- $count = 0;
- $start_y = $searchData['start_y'];
- $start_m = $searchData['start_m'];
- $end_y = $searchData['end_y'];
- $end_m = $searchData['end_m'];
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['sub_address'] == $searchData['sub_address']
- && $item['date_year'] == $i
- && $item['date_month'] == str_pad($j, 2, '0', STR_PAD_LEFT)
- ) {
- $count += $item['facility_count'];
- }
- }
- }
- }
- return $count;
-}
-
-function findDataByYearMonth($data, $searchData)
-{
- $count = 0;
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['date_year'] == $searchData['date_year']
- && $item['date_month'] == $searchData['date_month']
- ) {
- $count += $item['facility_count'];
- }
- }
- return $count;
-}
-
-function findAllDataByYearMonth($data, $searchData)
-{
- $count = 0;
- $start_y = $searchData['start_y'];
- $start_m = $searchData['start_m'];
- $end_y = $searchData['end_y'];
- $end_m = $searchData['end_m'];
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- foreach ($data as $item) {
- if (
- $item['contract_type'] == $searchData['contract_type']
- && $item['date_year'] == $i
- && $item['date_month'] == str_pad($j, 2, '0', STR_PAD_LEFT)
- ) {
- $count += $item['facility_count'];
- }
- }
- }
- }
- return $count;
-}
-
-$sql = "
- SELECT
- new_order.facility_kind,
- COUNT(new_order.facility_kind) AS facility_count
- FROM(
- SELECT
- w.facility_kind
- FROM wipwholestatus AS w
- WHERE 1=1
- AND status = '1'
- AND contract_type = 'A'
- AND real_contract_arrival_date >= '$start_y-$start_m-1'
- AND real_contract_arrival_date <= '$end_y-$end_m-31'
- ) AS new_order
- WHERE 1 = 1
- GROUP BY new_order.facility_kind
-";
-$result = mysqli_query($link, $sql);
-$data2 = [];
-while ($row = $result->fetch_assoc()) {
- $data2[] = $row;
-}
-
-function findFacilityTypeAllCount($data2)
-{
- $count = 0;
- foreach ($data2 as $row) {
- $count += $row['facility_count'];
- }
- return $count;
-}
-
-function getFacilityNamebyType($facility_kind)
-{
- $arr = array(
- 'MAE100' => '小機房',
- 'MAM200' => '無機房',
- 'MAH100' => '小電梯',
- 'MAQ100' => '強驅梯',
- 'MAF100' => '貨梯',
- 'MAP100' => '平台梯',
- '' => '未分類'
- );
- return isset($arr[$facility_kind]) ? $arr[$facility_kind] : "";
-}
-
-$sql = "
- SELECT
- w.renovate_type
- FROM wipwholestatus AS w
- WHERE 1=1
- AND status = '1'
- AND real_contract_arrival_date >= '$start_y-$start_m-1'
- AND real_contract_arrival_date <= '$end_y-$end_m-31'
- AND contract_type = 'B'
-";
-$result = mysqli_query($link, $sql);
-$data3 = [];
-while ($row = $result->fetch_assoc()) {
- $data3[] = $row;
-}
-
-// 分開計算
-
-// $M1 = 0;
-// $M2 = 0;
-// $M3 = 0;
-// $M4 = 0;
-// $MA = 0;
-// $M_count = 0;
-// foreach ($data3 as $row) {
-// $renovate_type_arr = json_decode($row['renovate_type']);
-// foreach ($renovate_type_arr as $row2) {
-// if ($row2 == 'M1')
-// $M1++;
-// if ($row2 == 'M2')
-// $M2++;
-// if ($row2 == 'M3')
-// $M3++;
-// if ($row2 == 'M4')
-// $M4++;
-// if ($row2 == 'MA')
-// $MA++;
-// }
-// }
-// $M_count = $M1 + $M2 + $M3 + $M4 + $MA;
-
-$M_count = count($data3);
-$m_type_arr = [];
-$m_type_arr[''] = 0;
-foreach ($data3 as $row) {
- $m_type_arr[implode("+", json_decode($row['renovate_type']))] = 0;
-}
-foreach ($data3 as $row) {
- $m_type_arr[implode("+", json_decode($row['renovate_type']))]++;
-}
-
-
-//數字轉英文(0=>A、1=>B、26=>AA...以此類推)
-function num2alpha($n)
-{
- for ($r = ""; $n >= 0; $n = intval($n / 26) - 1)
- $r = chr($n % 26 + 0x41) . $r;
- return $r;
-}
-
-//英文轉數字(A=>0、B=>1、AA=>26...以此類推)
-function alpha2num($a)
-{
- $l = strlen($a);
- $n = 0;
- for ($i = 0; $i < $l; $i++)
- $n = $n * 26 + ord($a[$i]) - 0x40;
- return $n - 1;
-}
-if($_SERVER["REQUEST_METHOD"] == 'POST'){
- if ($_POST['excel_output'] == 'excel_output') {
- $spreadsheet = new Spreadsheet();
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setTitle('出貨總表');
-
- $title_col_num = 3;
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- $title_col_num += 2;
- if ($i == $end_y && $j == ($end_m + 1)) {
- break;
- }
- }
- }
- $sheet->mergeCells('A1:' . num2alpha($title_col_num) . '1');
- $sheet->setCellValue('A1', '出貨地區預定明細');
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '');
- $title_col_num++;
-
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1))
- break;
- $sheet->mergeCells(num2alpha($title_col_num) . '2:' . num2alpha($title_col_num + 1) . '2');
- $sheet->setCellValue(num2alpha($title_col_num) . '2', $i . '年' . $j . '月');
- $title_col_num += 2;
- }
- }
-
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '2', '累計台數');
- $title_col_num++;
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '區域');
- $title_col_num = 2;
-
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1)) {
- break;
- }
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
- $title_col_num++;
- }
- }
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '新梯');
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '3', '汰改');
- $title_col_num++;
-
- $area_arr = [
- [4, 6, '台北'],
- [7, 9, '桃竹苗'],
- [10, 13, '中部'],
- [14, 17, '南部'],
- [18, 20, '宜花東'],
- [21, 21, '未分類']
- ];
- foreach ($area_arr as $row) {
- $title_col_num = 0;
- $sheet->mergeCells(num2alpha($title_col_num) . $row[0] . ':' . num2alpha($title_col_num) . $row[1]);
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[2]);
- }
-
- $area_arr = [
- [4, '台北'],
- [5, '新北'],
- [6, '基隆'],
- [7, '桃園'],
- [8, '新竹'],
- [9, '苗栗'],
- [10, '台中'],
- [11, '南投'],
- [12, '彰化'],
- [13, '雲林'],
- [14, '嘉義'],
- [15, '台南'],
- [16, '高雄'],
- [17, '屏東'],
- [18, '宜蘭'],
- [19, '花蓮'],
- [20, '台東'],
- [21, '']
- ];
- foreach ($area_arr as $row) {
- $title_col_num = 0;
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], $row[1]);
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1)) {
- break;
- }
- $tmp_arr = array(
- 'date_year' => $i,
- 'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
- 'sub_address' => $row[1],
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findData($data, $tmp_arr));
- }
- }
- $tmp_arr = array(
- 'start_y' => $start_y,
- 'end_y' => $end_y,
- 'start_m' => $start_m,
- 'end_m' => $end_m,
- 'sub_address' => $row[1],
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . $row[0], findDataByCity($data, $tmp_arr));
- }
-
-
- $title_col_num = 0;
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', "合計");
- for ($i = $start_y; $i <= $end_y; $i++) {
- $this_start_m = $i == $start_y ? $start_m : 1;
- $this_end_m = $i == $start_y ? 12 : $end_m;
- for ($j = $this_start_m; $j <= $this_end_m; $j++) {
- if ($i == $end_y && $j == ($end_m + 1))
- break;
- $tmp_arr = array(
- 'date_year' => $i,
- 'date_month' => str_pad($j, 2, '0', STR_PAD_LEFT),
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findDataByYearMonth($data, $tmp_arr));
- }
- }
- $tmp_arr = array(
- 'start_y' => $start_y,
- 'end_y' => $end_y,
- 'start_m' => $start_m,
- 'end_m' => $end_m,
- 'contract_type' => 'A',
- );
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
- $tmp_arr['contract_type'] = 'B';
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '22', findAllDataByYearMonth($data, $tmp_arr));
-
-
-
-
- $sheet->mergeCells('A25:I25');
- $sheet->setCellValue('A25', '受定規格分析');
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '26', "代碼");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '26', $row['facility_kind']);
- }
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '27', "機種");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '27', getFacilityNamebyType($row['facility_kind']));
- }
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '27', "合計");
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '28', "數量");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '28', $row['facility_count']);
- }
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '28', findFacilityTypeAllCount($data2));
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num) . '29', "百分比");
- foreach ($data2 as $row) {
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '29', (round($row['facility_count'] / findFacilityTypeAllCount($data2), 4) * 100) . "%");
- }
- $title_col_num++;
- $sheet->setCellValue(num2alpha($title_col_num) . '29', "100%");
-
-
- $sheet->mergeCells('A32:G32');
- $sheet->setCellValue('G25', '舊改受訂規格分析');
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num++) . '33', "類型");
- foreach ($m_type_arr as $key => $val) {
- $title_tmp = empty($key) ? '未分類' : $key;
- $sheet->setCellValue(num2alpha($title_col_num++) . '33', $title_tmp);
- }
- $sheet->setCellValue(num2alpha($title_col_num++) . '33', "合計");
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num++) . '34', "數量");
- foreach ($m_type_arr as $key => $val) {
- $sheet->setCellValue(num2alpha($title_col_num++) . '34', $val);
- }
- $sheet->setCellValue(num2alpha($title_col_num++) . '34', $M_count);
-
- $title_col_num = 0;
- $sheet->setCellValue(num2alpha($title_col_num++) . '35', "百分比");
- foreach ($m_type_arr as $key => $val) {
- $sheet->setCellValue(num2alpha($title_col_num++) . '35', (round($val / $M_count, 4) * 100) . "%");
- }
- $sheet->setCellValue(num2alpha($title_col_num++) . '35', "100%");
-
-
- $writer = new Xlsx($spreadsheet);
- $file_path = dirname(__DIR__) . '/wms/excel/' . 'estimated_shipping_date_report.xlsx';
- try {
- $writer->save($file_path);
- // 回傳檔案路徑給 JavaScript
- echo $file_path;
- } catch (Exception $e) {
- echo 'Error: ' . $e->getMessage();
- }
- exit();
- }
-}
-
-?>
-
-出貨地區預定明細
-
-
-
-
-
-
-
-
-
-
-
-
- 受定規格分析 |
-
-
-
-
- 代碼 |
- " . $row['facility_kind'] . "";
- }
- ?>
- |
-
-
- 機種 |
- " . getFacilityNamebyType($row['facility_kind']) . "";
- }
- ?>
- 合計 |
-
-
- 數量 |
- " . $row['facility_count'] . "";
- }
- ?>
- |
-
-
- 百分比 |
- " . (round($row['facility_count'] / findFacilityTypeAllCount($data2), 4) * 100) . "%" . "";
- }
- ?>
- |
-
-
-
-
-
-
-
-
-
-
-
- 舊改受訂規格分析 |
-
-
-
-
- 類型 |
- $val) {
- $title_tmp = empty($key) ? '未分類' : $key;
- echo "" . $title_tmp . " | ";
- }
- ?>
- 合計 |
-
-
- 數量 |
- $val) {
- echo "" . $val . " | ";
- }
- ?>
- |
-
-
- 百分比 |
- $val) {
- echo "" . round($val / $M_count, 4) * 100 . "%" . " | ";
- }
- ?>
- 100% |
-
-
-
-
-
\ No newline at end of file
diff --git a/wms/frame/api_getdata.php b/wms/frame/api_getdata.php
index c99767a6..3c0c1af6 100644
--- a/wms/frame/api_getdata.php
+++ b/wms/frame/api_getdata.php
@@ -124,7 +124,9 @@ function get_pending($token)
flow f,
flow_main m,
system_main y
- WHERE EXISTS (
+ WHERE 1=1
+ AND m.flow_id NOT IN ('wws04')
+ AND EXISTS (
SELECT form_key,
MAX(seq)
FROM subflow
diff --git a/wms/gary_psd.php b/wms/gary_psd.php
new file mode 100644
index 00000000..af9dd0cd
--- /dev/null
+++ b/wms/gary_psd.php
@@ -0,0 +1,60 @@
+";
+ } elseif (isset($_POST['decrypt'])) {
+ $decrypted_data = decrypt($data, $key);
+ echo "解密後的資料:" . $decrypted_data . "
";
+ }
+ } else {
+ echo "請輸入資料和金鑰。";
+ }
+}
+?>
+
+
+
+
+
+ 加密解密表單
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wms/wipwhole-change-contractdate-function.php b/wms/wipwhole-change-contractdate-function.php
index 7f3ac394..142e0909 100644
--- a/wms/wipwhole-change-contractdate-function.php
+++ b/wms/wipwhole-change-contractdate-function.php
@@ -674,3 +674,23 @@ function checkStatus($link, $cid, $user_id)
$res = mysqli_query($link, $sql);
return $res->num_rows > 0 ? false : true;
}
+
+/**
+ * 取台灣縣市select
+ * @param object $link:資料庫連線
+ * @return object 回傳 mysqli_fetch_all
+ */
+function getCity($link)
+{
+ $sql = "
+ SELECT
+ content,
+ code_name
+ FROM code
+ WHERE field_name = 'taiwan_city'
+ ";
+ $result = mysqli_query($link, $sql);
+ $data = mysqli_fetch_all($result, MYSQLI_ASSOC);
+ mysqli_free_result($result);
+ return $data;
+}
diff --git a/wms/wipwhole-change-contractdate-submit.php b/wms/wipwhole-change-contractdate-submit.php
index 862e8d47..0467e57d 100644
--- a/wms/wipwhole-change-contractdate-submit.php
+++ b/wms/wipwhole-change-contractdate-submit.php
@@ -1,303 +1,308 @@
- $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' => getFomkeySeq($link),
- 'user_id' => $user_id,
- 'change_status' => $_POST['assign_status']
- );
- // 寫入表單主檔
- addWipwholeChangeContractdateDetails($link, $data_arr);
- // 取得寫入後表單seq
- $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);
- }
-
- // 批次申請
- if (($_POST['assign_status'] == 'A' || $_POST['assign_status'] == 'B') && !empty($all_contractno_change)) {
- $wipwholestatus_id_arr = getWipwholestatusIdByConstractNo($link, $contractno);
- $assign_status = $_POST['assign_status'];
- foreach ($wipwholestatus_id_arr as $wipwholestatus_id) {
- $data_arr = array(
- 'id' => $wipwholestatus_id[0],
- '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' => getFomkeySeq($link),
- 'user_id' => $user_id,
- 'change_status' => $assign_status
- );
- // 寫入表單主檔
- addWipwholeChangeContractdateDetails($link, $data_arr);
- // 取得寫入後表單seq
- $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);
- }
- }
- }
- }
-
- // 單次申請 營業
- if ($_POST['assign_status'] == 'D') {
- $tds = date("Y-m-d H:i:s");
- $next_users = $_POST['next_users'];
- $seq = $_POST['seq'];
- $sql = "
- UPDATE wipwhole_change_contractdate_details
- SET change_status = 'D'
- WHERE id = '$cid'
- ";
- mysqli_query($link, $sql);
- $sql = "
- UPDATE flow
- SET flow_code = 'D'
- WHERE form_key = '$form_key'
- ";
- mysqli_query($link, $sql);
- $sql = "
- INSERT into subflow (
- form_key,
- seq,
- current_assigner,
- create_date
- ) VALUES (
- '$form_key',
- '2',
- '$next_users',
- '$tds'
- )
- ";
- mysqli_query($link, $sql);
- }
- // 取消
- if ($_POST['assign_status'] == 'C') {
- $tds = date("Y-m-d H:i:s");
- $next_users = "00000";
- if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) {
- if (getChangeStatus($link, $cid) == 'D' || getChangeStatus($link, $cid) == 'A') {
- $seq = $_POST['seq'];
- }
- $sql = "
- INSERT into subflow (
- form_key,
- seq,
- current_assigner,
- create_date
- ) VALUES (
- '$form_key',
- '$seq',
- '$next_users',
- '$tds'
- )
- ";
- mysqli_query($link, $sql);
- } else if (accountidToDepartId($user_id) == "521" || accountidToDepartId($user_id) == "531") {
- if (getChangeStatus($link, $cid) == 'D') {
- $sql = "
- UPDATE subflow
- SET current_assigner = '$next_users',
- create_date = '$tds'
- WHERE form_key = '$form_key'
- AND seq = '$seq'
- ";
- mysqli_query($link, $sql);
- } else if (getChangeStatus($link, $cid) == 'A') {
- $seq = $_POST['seq'];
- $sql = "
- UPDATE subflow
- SET current_assigner = '$next_users',
- create_date = '$tds'
- WHERE form_key = '$form_key'
- AND seq = '$seq'
- ";
- mysqli_query($link, $sql);
- } else {
- $seq = $_POST['seq'];
- $sql = "
- INSERT into subflow (
- form_key,
- seq,
- current_assigner,
- create_date
- ) VALUES (
- '$form_key',
- '$seq',
- '$next_users',
- '$tds'
- )
- ";
- mysqli_query($link, $sql);
- }
- } else {
- $seq = $_POST['seq'];
- $sql = "
- UPDATE subflow
- SET current_assigner = '$next_users',
- create_date = '$tds'
- WHERE form_key = '$form_key'
- AND seq = '$seq'
- ";
- mysqli_query($link, $sql);
- }
- $sql = "
- UPDATE wipwhole_change_contractdate_details
- SET change_status = 'C'
- WHERE id = '$cid'
- ";
- mysqli_query($link, $sql);
- $sql = "
- UPDATE flow
- SET flow_code = 'Z'
- WHERE form_key = '$form_key'
- ";
- mysqli_query($link, $sql);
- }
-
- // 通過
- if ($_POST['assign_status'] == 'Z') {
-
- $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;
-
- if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) {
- $tds = date("Y-m-d H:i:s");
- $next_users = $_POST['next_users'];
- $seq = $_POST['seq'] + 1;
- $sql = "
- UPDATE wipwhole_change_contractdate_details
- SET change_status = 'Z'
- WHERE id = '$cid'
- ";
- mysqli_query($link, $sql);
- $sql = "
- UPDATE flow
- SET flow_code = 'Z'
- WHERE form_key = '$form_key'
- ";
- mysqli_query($link, $sql);
- $sql = "
- INSERT into subflow (
- form_key,
- seq,
- current_assigner,
- create_date
- ) VALUES (
- '$form_key',
- '$seq',
- '$next_users',
- '$tds'
- )
- ";
- mysqli_query($link, $sql);
- $sql = "
- UPDATE wipwholestatus
- SET real_contract_arrival_date = '$contract_arrival_date_tmp',
- real_address = '$real_address_tmp'
- WHERE id = '$id'
- ";
- mysqli_query($link, $sql);
-
- // 發送系統通知
- $contractno = $_POST['contractno'];
- $facilityno = $_POST['facilityno'];
- $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
- $salesid = $_POST['salesid'];
- $gongWuokid = $_POST['gongWuokid'];
- $old_real_address = $_POST['old_real_address'];
- $real_address = $_POST['real_address'];
- $content = "合約號 : $contractno
-作番號 : $facilityno
-出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
-工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
-
- // 大日程出貨日調整 通知營業人員
- $noticeData = array(
- 'related_id' => $cid,
- 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
- 'content' => $content,
- 'permission' => $salesid,
- );
- addNotice($link, $noticeData);
- // 大日程出貨日調整 通知工務人員
- $noticeData = array(
- 'related_id' => $cid,
- 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
- 'content' => $content,
- 'permission' => $gongWuokid,
- );
- addNotice($link, $noticeData);
-
- $shengguano_arr = getShengguanokOptions($link);
- foreach ($shengguano_arr as $row) :
- $contractno = $_POST['contractno'];
- $facilityno = $_POST['facilityno'];
- $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
- $gongWuokid = $_POST['gongWuokid'];
- $old_real_address = $_POST['old_real_address'];
- $real_address = $_POST['real_address'];
- $content = "合約號 : $contractno
-作番號 : $facilityno
-出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
-工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
-
- // 大日程出貨日調整 通知營業人員
- $noticeData = array(
- 'related_id' => $cid,
- 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
- 'content' => $content,
- 'permission' => $row['val'],
- );
- addNotice($link, $noticeData);
- endforeach;
- }
- }
-}
+ $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' => getFomkeySeq($link),
+ 'user_id' => $user_id,
+ 'change_status' => $_POST['assign_status']
+ );
+ // 寫入表單主檔
+ addWipwholeChangeContractdateDetails($link, $data_arr);
+ // 取得寫入後表單seq
+ $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);
+ }
+
+ // 批次申請
+ if (($_POST['assign_status'] == 'A' || $_POST['assign_status'] == 'B') && !empty($all_contractno_change)) {
+ $wipwholestatus_id_arr = getWipwholestatusIdByConstractNo($link, $contractno);
+ $assign_status = $_POST['assign_status'];
+ foreach ($wipwholestatus_id_arr as $wipwholestatus_id) {
+ $data_arr = array(
+ 'id' => $wipwholestatus_id[0],
+ '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' => getFomkeySeq($link),
+ 'user_id' => $user_id,
+ 'change_status' => $assign_status
+ );
+ // 寫入表單主檔
+ addWipwholeChangeContractdateDetails($link, $data_arr);
+ // 取得寫入後表單seq
+ $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);
+ }
+ }
+ }
+ }
+
+ // 單次申請 營業
+ if ($_POST['assign_status'] == 'D') {
+ $tds = date("Y-m-d H:i:s");
+ $next_users = $_POST['next_users'];
+ $seq = $_POST['seq'];
+ $sql = "
+ UPDATE wipwhole_change_contractdate_details
+ SET change_status = 'D'
+ WHERE id = '$cid'
+ ";
+ mysqli_query($link, $sql);
+ $sql = "
+ UPDATE flow
+ SET flow_code = 'D'
+ WHERE form_key = '$form_key'
+ ";
+ mysqli_query($link, $sql);
+ $sql = "
+ INSERT into subflow (
+ form_key,
+ seq,
+ current_assigner,
+ create_date
+ ) VALUES (
+ '$form_key',
+ '2',
+ '$next_users',
+ '$tds'
+ )
+ ";
+ mysqli_query($link, $sql);
+ }
+ // 取消
+ if ($_POST['assign_status'] == 'C') {
+ $tds = date("Y-m-d H:i:s");
+ $next_users = "00000";
+ if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) {
+ if (getChangeStatus($link, $cid) == 'D' || getChangeStatus($link, $cid) == 'A') {
+ $seq = $_POST['seq'];
+ }
+ $sql = "
+ INSERT into subflow (
+ form_key,
+ seq,
+ current_assigner,
+ create_date
+ ) VALUES (
+ '$form_key',
+ '$seq',
+ '$next_users',
+ '$tds'
+ )
+ ";
+ mysqli_query($link, $sql);
+ } else if (accountidToDepartId($user_id) == "521" || accountidToDepartId($user_id) == "531") {
+ if (getChangeStatus($link, $cid) == 'D') {
+ $sql = "
+ UPDATE subflow
+ SET current_assigner = '$next_users',
+ create_date = '$tds'
+ WHERE form_key = '$form_key'
+ AND seq = '$seq'
+ ";
+ mysqli_query($link, $sql);
+ } else if (getChangeStatus($link, $cid) == 'A') {
+ $seq = $_POST['seq'];
+ $sql = "
+ UPDATE subflow
+ SET current_assigner = '$next_users',
+ create_date = '$tds'
+ WHERE form_key = '$form_key'
+ AND seq = '$seq'
+ ";
+ mysqli_query($link, $sql);
+ } else {
+ $seq = $_POST['seq'];
+ $sql = "
+ INSERT into subflow (
+ form_key,
+ seq,
+ current_assigner,
+ create_date
+ ) VALUES (
+ '$form_key',
+ '$seq',
+ '$next_users',
+ '$tds'
+ )
+ ";
+ mysqli_query($link, $sql);
+ }
+ } else {
+ $seq = $_POST['seq'];
+ $sql = "
+ UPDATE subflow
+ SET current_assigner = '$next_users',
+ create_date = '$tds'
+ WHERE form_key = '$form_key'
+ AND seq = '$seq'
+ ";
+ mysqli_query($link, $sql);
+ }
+ $sql = "
+ UPDATE wipwhole_change_contractdate_details
+ SET change_status = 'C'
+ WHERE id = '$cid'
+ ";
+ mysqli_query($link, $sql);
+ $sql = "
+ UPDATE flow
+ SET flow_code = 'Z'
+ WHERE form_key = '$form_key'
+ ";
+ mysqli_query($link, $sql);
+ }
+
+ // 通過
+ if ($_POST['assign_status'] == 'Z') {
+
+ $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;
+
+ if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) {
+ $tds = date("Y-m-d H:i:s");
+ $next_users = $_POST['next_users'];
+ $seq = $_POST['seq'] + 1;
+ $sql = "
+ UPDATE wipwhole_change_contractdate_details
+ SET change_status = 'Z'
+ WHERE id = '$cid'
+ ";
+ mysqli_query($link, $sql);
+ $sql = "
+ UPDATE flow
+ SET flow_code = 'Z'
+ WHERE form_key = '$form_key'
+ ";
+ mysqli_query($link, $sql);
+ $sql = "
+ INSERT into subflow (
+ form_key,
+ seq,
+ current_assigner,
+ create_date
+ ) VALUES (
+ '$form_key',
+ '$seq',
+ '$next_users',
+ '$tds'
+ )
+ ";
+ mysqli_query($link, $sql);
+ $sql = "
+ UPDATE wipwholestatus
+ SET real_contract_arrival_date = '$contract_arrival_date_tmp',
+ real_address = '$real_address_tmp'
+ WHERE id = '$id'
+ ";
+ mysqli_query($link, $sql);
+
+ // 發送系統通知
+ $contractno = $_POST['contractno'];
+ $facilityno = $_POST['facilityno'];
+ $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
+ $salesid = $_POST['salesid'];
+ $gongWuokid = $_POST['gongWuokid'];
+ $old_real_address = $_POST['old_real_address'];
+ $real_address = $_POST['real_address'];
+ $content = "合約號 : $contractno
+作番號 : $facilityno
+出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
+工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
+
+ // 大日程出貨日調整 通知營業人員
+ $noticeData = array(
+ 'related_id' => $cid,
+ 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
+ 'content' => $content,
+ 'permission' => $salesid,
+ );
+ addNotice($link, $noticeData);
+ // 大日程出貨日調整 通知工務人員
+ $noticeData = array(
+ 'related_id' => $cid,
+ 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
+ 'content' => $content,
+ 'permission' => $gongWuokid,
+ );
+ addNotice($link, $noticeData);
+
+ $shengguano_arr = getShengguanokOptions($link);
+ foreach ($shengguano_arr as $row) :
+ $contractno = $_POST['contractno'];
+ $facilityno = $_POST['facilityno'];
+ $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
+ $gongWuokid = $_POST['gongWuokid'];
+ $old_real_address = $_POST['old_real_address'];
+ $real_address = $_POST['real_address'];
+ $content = "合約號 : $contractno
+作番號 : $facilityno
+出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . "
+工地地址微調: " . $old_real_address . " => " . $real_address_tmp;
+
+ // 大日程出貨日調整 通知營業人員
+ $noticeData = array(
+ 'related_id' => $cid,
+ 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno,
+ 'content' => $content,
+ 'permission' => $row['val'],
+ );
+ addNotice($link, $noticeData);
+ endforeach;
+ }
+ }
+}
diff --git a/wms/wipwhole-change-contractdate.php b/wms/wipwhole-change-contractdate.php
index 8ee911c0..5b658f7c 100644
--- a/wms/wipwhole-change-contractdate.php
+++ b/wms/wipwhole-change-contractdate.php
@@ -283,7 +283,13 @@ if (!empty(checkNowFormStatus($link)))
";
+ echo "";
+ echo "";
} else {
echo $row2["real_address"];
echo "";
diff --git a/wms/wipwhole-index-function.php b/wms/wipwhole-index-function.php
index 20f14a5a..66117b58 100644
--- a/wms/wipwhole-index-function.php
+++ b/wms/wipwhole-index-function.php
@@ -9,8 +9,8 @@
function getWipwholestatusDetail($link, $id)
{
$db_query = "
- SELECT * FROM
- wipwholestatus WHERE id = '$id'
+ SELECT * FROM wipwholestatus
+ WHERE id = '$id'
AND status = '1'
";
$receivabledata = mysqli_query($link, $db_query);
@@ -117,8 +117,11 @@ function getEditFlag($department_id, $role_id, $user_id)
if ($user_id == 'M0113' || $user_id == 'M0158')
return 4;
// 南區工務組長
- if ($user_id == 'M0039' || $user_id == 'M0078')
+ if ($user_id == 'M0078')
return 4;
+ if ($user_id == 'M0188') {
+ return 4;
+ }
// 工務部門
if (in_array($department_id, [521, 531, 541, 542, 543, 544, 545]))
return 4;
@@ -147,10 +150,25 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
+ // 補丁 許馨文 權限 = 李烘銘
+ if (in_array($user_id, ['M0115'])) {
+ $user_id = 'M0086';
+ }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
+ // 補丁 林修賢 = 鄭存邑
+ if (in_array($user_id, ['M0188'])) {
+ $user_id = 'M0102';
+ $department_id = '545';
+ $role_id = '6';
+ }
+
+ // 補丁 林靜雯 權限 = 劉永德 新梯 北區+桃竹
+ if (in_array($user_id, ['M0189'])) {
+ $user_id = 'M0137';
+ }
$sql_cmd = sql_myself($user_id, "salesid");
$sql = "
@@ -164,10 +182,23 @@ function getDataSql($department_id, $role_id, $user_id)
// 北區營銷部 營銷專案經理 311 1
// 新梯營銷經理 311 3
// 桃竹營銷部 銷售專案經理 312 1
+ // 桃竹契約部 經理 512 3
// 中區營銷部 新梯營銷經理 313 1
// 南區營銷部 銷售專案經理 314 2
// 花東區營銷部 銷售專案經理 315 1
+ if ($department_id == '512' && (in_array($role_id, ['3']))) {
+ $sql = "
+ SELECT * FROM wipwholestatus
+ WHERE 1=1
+ AND status = '1'
+ AND contract_type = '$contract_type'
+ " . getWipwholeSearchSql() . "
+ ORDER BY real_contract_arrival_date ASC
+ ";
+ return $sql;
+ }
+
if ($department_id == '311' && (in_array($role_id, ['1', '3']))) {
$sql = "
SELECT * FROM wipwholestatus
@@ -285,7 +316,7 @@ function getDataSql($department_id, $role_id, $user_id)
return $sql;
}
// 南區工務組長
- if ($user_id == 'M0039' || $user_id == 'M0078') {
+ if ($user_id == 'M0078') {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
@@ -319,30 +350,73 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
+ // 補丁 許馨文 權限 = 李烘銘
+ if (in_array($user_id, ['M0115'])) {
+ $user_id = 'M0086';
+ }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
+ // 補丁 林靜雯 權限 = 劉永德 新梯 北區+桃竹
+ if (in_array($user_id, ['M0189'])) {
+ $user_id = 'M0137';
+ }
+ // 補丁 林修賢 = 鄭存邑
+ if (in_array($user_id, ['M0188'])) {
+ $user_id = 'M0102';
+ $department_id = '545';
+ $role_id = '6';
+ }
+
$flow_code_tmp = explode(',', $flow_code);
$flow_code = implode("','", $flow_code_tmp);
// 合約類型
$contract_type = 'A';
// 營業員主管或營業員
- $department_arr = ['310', '311', '312', '313', '314', '315'];
+ $department_arr = ['310', '311', '312', '313', '314', '315', '512'];
if (in_array($department_id, $department_arr)) {
// 北區營銷部 營銷專案經理 311 1
// 新梯營銷經理 311 3
// 桃竹營銷部 銷售專案經理 312 1
+ // 桃竹契約部 經理 512 3
// 中區營銷部 新梯營銷經理 313 1
// 南區營銷部 銷售專案經理 314 2
// 花東區營銷部 銷售專案經理 315 1
+ if ($department_id == '512' && (in_array($role_id, ['3']))) {
+ $sql = "
+ SELECT * FROM wipwholestatus
+ WHERE 1=1
+ AND status = '1'
+ AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws01'
+ AND flow_code IN ('$flow_code')
+ )
+ " . getWipwholeSearchSql() . "
+ ORDER BY real_contract_arrival_date ASC
+ ";
+ return $sql;
+ }
if ($department_id == '311' && (in_array($role_id, ['1', '3']))) {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws01'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -354,6 +428,14 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws01'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -365,6 +447,14 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws01'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -376,6 +466,14 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws01'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -387,6 +485,14 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws01'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -845,8 +951,8 @@ function getYewuStatus($link, $user_department_id, $role_id)
// 取得工務的欄位權限
function getWarehouseStatus($link, $user_department_id, $role_id, $status)
{
- // if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
- if (getSaveEstimateInstallData($user_department_id, $role_id)) {
+ if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
+ // if (getSaveEstimateInstallData($user_department_id, $role_id)) {
if ($status == 1) {
return checkNowFormGStatus($link) == 'G' ? "" : "disabled";
} else {
@@ -1221,3 +1327,24 @@ function getAllCustomerPlanningVerify($link, $id)
";
return mysqli_query($link, $sql);
}
+
+// 各區營銷(契約)經理判斷程式
+function checkUseridIsManager($user_id)
+{
+ // 北區 劉永德
+ if (in_array($user_id, ['M0137']))
+ return true;
+ // 中區 李烘銘
+ if (in_array($user_id, ['M0086']))
+ return true;
+ // 桃竹 張莉凱
+ if (in_array($user_id, ['M0026']))
+ return true;
+ // 宜花東 陳志文
+ if (in_array($user_id, ['M0054']))
+ return true;
+ // 南區 吳育宗
+ if (in_array($user_id, ['M0033']))
+ return true;
+ return false;
+}
\ No newline at end of file
diff --git a/wms/wipwhole-index.php b/wms/wipwhole-index.php
index ff37bb22..29de7c05 100644
--- a/wms/wipwhole-index.php
+++ b/wms/wipwhole-index.php
@@ -67,7 +67,8 @@ $tableArr = array(
"B" => "B",
"G" => "G",
"CH" => "C,H",
- "Z" => "Z"
+ "Z" => "Z",
+ "I" => "I",
);
if (empty($sheetNum) || $sheetNum == "All") {
@@ -212,6 +213,9 @@ $data = mysqli_query($link, $sql);
營業確認中
+
+ 營業主管確認中
+
設計確認中
@@ -433,14 +437,20 @@ mysqli_close($link);
window.location.href = "" + "&sheetNum=" + sheetNum;
}
+ function showITable() {
+ sheetNum = "I";
+ window.location.href = "" + "&sheetNum=" + sheetNum;
+ }
+
function showTable(code) {
var tmp_arr = {
"All": "1",
"A": "2",
- "B": "3",
- "G": "4",
- "CH": "5",
- "Z": "6",
+ "I": "3",
+ "B": "4",
+ "G": "5",
+ "CH": "6",
+ "Z": "7",
}
$("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
diff --git a/wms/wipwhole-rec-invoice-edit-submit.php b/wms/wipwhole-rec-invoice-edit-submit.php
index 04674f6e..7fa7d17b 100644
--- a/wms/wipwhole-rec-invoice-edit-submit.php
+++ b/wms/wipwhole-rec-invoice-edit-submit.php
@@ -1,149 +1,104 @@
$v) {
if ($k !== 'desin_taiwan_items_no' && $k !== 'desin_taiwan_items_name')
$$k = htmlspecialchars(stripslashes(trim($v)));
}
- // 時間戳記
$datetime = date("Y-m-d H:i:s");
-
- // 合約號
$contractno = $_POST['contractno'];
- // 號機
$facility_temp_no = $_POST['facility_temp_no'];
- // 作番號
$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'];
- //客户计划图确认
$real_custom_name = $_POST['real_custom_name'] ?: $row['real_custom_name'];
$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'];
- //客户颜色确认
$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'];
- //工勘
$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'];
-
- //是否齊備
$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'] ?: $row['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_da
te_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_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_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'];
@@ -154,8 +109,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$delivery_date = $_POST['delivery_date'] ?: $row['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'];
@@ -175,8 +128,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$estimate_tryrun_end_date_owner = $_POST['estimate_tryrun_end_date_owner'];
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
- $creater = $_POST['creater'];
- $create_at = date("Y-m-fd H:i:s");
+ // $creater = $_POST['creater'];
+ $creater = $user_id;
+ $create_at = date("Y-m-d H:i:s");
// 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php";
@@ -197,29 +151,16 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
-
- $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);
+ $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);
}
}
}
@@ -265,62 +206,44 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
作番:$facilityno
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
- $sql = "
- INSERT INTO notice(
- kind,
- related_id,
- title,
- content,
- haveread,
- permission,
- creater,
- create_at
- )VALUES(
- '1',
- '$id',
- '$title',
- '$content',
- null,
- '$permission',
- '$creater',
- '$create_at'
- );
- ";
- mysqli_query($link, $sql);
+ $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)) {
- echo $sql = "
- INSERT INTO notice(
- kind,
- related_id,
- title,
- content,
- haveread,
- permission,
- creater,
- create_at
- )VALUES(
- '1',
- '$id',
- '合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
- '合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
- null,
- 'M0168',
- '$creater',
- '$create_at'
- );
- ";
- mysqli_query($link, $sql);
+ $title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
+ $content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
+ $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);
}
$updatesql = "
UPDATE wipwholestatus
SET
";
- if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])) {
- // 工務更新;
+
+ if (
+ in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117', 'M0054'])
+ || in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])
+ ) {
+ // 工務助理 工務更新
$updatesql .= "
building_heigh_verify = '$building_heigh_verify',
building_heigh_verify_at = '$building_heigh_verify_at',
@@ -339,7 +262,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updatesql .= "building_heigh_verify_file = '$building_heigh_verify_file', ";
if (!empty($site_survey_contact_verify_file))
$updatesql .= "site_survey_contact_verify_file = '$site_survey_contact_verify_file', ";
- } else if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) {
+ } else if (in_array($user_department_id, [311, 312, 313, 314, 315])) {
// 營業更新;
$updatesql .= "
sales_spec_verify = '$sales_spec_verify',
@@ -430,26 +353,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updatesql .= "desin_documents_verify_file = '$desin_documents_verify_file', ";
}
} else if ($user_department_id == 321) {
- // 共用更新
- // $updatesql .= "
- // contractno = '$contractno',
- // facility_temp_no = '$facility_temp_no',
- // facilityno = '$facilityno',
- // custom='$custom' ,
- // latitude = '$latitude',
- // longitude = '$longitude',
- // weight = '$weight',
- // numberofpassenger = '$numberofpassenger',
- // numberofstop = '$numberofstop',
- // numberoffloor = '$numberoffloor',
- // opentype = '$opentype',
- // speed = '$speed',
- // site_manager = '$site_manager',
- // address = '$address',
- // real_address = '$real_address',
- // contract_arrival_date = '$contract_arrival_date',
- // facility_kind = '$facility_kind',
- // ";
// 業務更新
$updatesql .= "
prattford_order_date_verify = '$prattford_order_date_verify' ,
@@ -540,9 +443,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 工務助理
if (
- in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117'])
+ in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117', 'M0054'])
|| in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])
- || $user_id == 'M0054'
) {
$qc_official_type = $_POST['qc_official_type2'] ?: $row['qc_official_type'];
@@ -566,9 +468,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$tryrun_end_date_owner = $_POST['tryrun_end_date2_owner'] ?: $row['tryrun_end_date_owner'];
$updatesql .= "
-
qc_official_type = '$qc_official_type',
-
install_start_date = '$install_start_date',
install_start_date_owner = '$install_start_date_owner',
install_end_date = '$install_end_date',
@@ -577,7 +477,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
tryrun_start_date_owner = '$tryrun_start_date_owner',
tryrun_end_date = '$tryrun_end_date',
tryrun_end_date_owner = '$tryrun_end_date_owner',
-
delivery_date = '$delivery_date',
delivery_date_owner = '$delivery_date_owner',
qc_date = '$qc_date',
@@ -586,7 +485,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
end_qc_date_owner = '$end_qc_date_owner',
official_check_date = '$official_check_date',
official_check_date_owner = '$official_check_date_owner',
-
outsourcer_type = '$outsourcer_type',
install_outsourcer = '$install_outsourcer',
install_outsourcer_owner = '$install_outsourcer_owner',
@@ -739,6 +637,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
if ($_POST['form_name'] == 'update_contract_date_form') {
foreach ($_POST as $k => $v)
$$k = htmlspecialchars(stripslashes(trim($v)));
@@ -746,8 +645,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$contractno = $_POST['contractno'];
$facilityno = $_POST['facilityno'];
$custom = $_POST['custom'];
- $creater = $_POST['creater'];
- $create_at = $_POST['create_at'];
+ // $creater = $_POST['creater'];
+ $creater = $user_id;
+ // $create_at = $_POST['create_at'];
+ $create_at = date("Y-m-d H:i:s");
$old_real_contract_arrival_date = $_POST['old_real_contract_arrival_date'];
$real_contract_arrival_date = $_POST['real_contract_arrival_date'];
$salesid = $_POST['salesid'];
@@ -762,54 +663,33 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
";
mysqli_query($link, $updatesql);
+ $title = "作番大日程(新梯)出貨日調整通知 > " . $facilityno;
$content = "合約號 : $contractno
作番號 : $facilityno
出貨日期微調: " . substr($old_real_contract_arrival_date, 0, 10) . " => " . substr($real_contract_arrival_date, 0, 10);
- $sql = "
- INSERT INTO notice (
- kind,
- related_id,
- title,
- content,
- haveread,
- permission,
- creater,
- create_at
- ) VALUES(
- '1',
- '$id',
- '作番大日程(新梯)出貨日調整通知 > " . $facilityno . "',
- '$content',
- NULL,
- '$salesid',
- 'system',
- '" . date("Y-m-d H:i:s") . "'
- )
- ";
- mysqli_query($link, $sql);
- $sql = "
- INSERT INTO notice (
- kind,
- related_id,
- title,
- content,
- haveread,
- permission,
- creater,
- create_at
- ) VALUES(
- '1',
- '$id',
- '作番大日程(新梯)出貨日調整通知 > " . $facilityno . "',
- '$content',
- NULL,
- '$gongWuokid',
- 'system',
- '" . date("Y-m-d H:i:s") . "'
- )
- ";
- mysqli_query($link, $sql);
+
+ $data = array(
+ 'kind' => 1,
+ 'related_id' => $id,
+ 'title' => $title,
+ 'content' => $content,
+ 'permission' => $salesid,
+ 'creater' => 'system',
+ 'create_at' => date("Y-m-d H:i:s")
+ );
+ $cn->sendx($data);
+
+ $data = array(
+ 'kind' => 1,
+ 'related_id' => $id,
+ 'title' => $title,
+ 'content' => $content,
+ 'permission' => $gongWuokid,
+ 'creater' => 'system',
+ 'create_at' => date("Y-m-d H:i:s")
+ );
+ $cn->sendx($data);
$sql = "
INSERT INTO wipwhole_change_contractdate_details (
@@ -839,6 +719,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
if ($_POST['form_name'] == 'update_date_form') {
$creater = $user_id;
@@ -874,28 +755,16 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
作番:$facilityno
實際出貨日(到工地):$real_arrival_date";
- $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);
+ $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);
}
echo "
- ";
- } else {
- mysqli_query($link, $insertsql);
- $last_form_id = mysqli_insert_id($link);
- // 寫入待簽程狀態 A (營業)
- do_wws_assign($salesid, $last_form_id, 'A');
- // 寫入待簽程狀態 G (工務)
- do_wws_assign($warehouseid, $last_form_id, 'G');
- echo "
-
- ";
- }
- }
-
- // 開門方式 select => options
- $sql = "
- SELECT
- code_name AS val ,
- content AS label
- FROM code F
- WHERE field_name='open_kind'
- ORDER BY label ASC
- ";
- $opendoor_options = mysqli_query($link, $sql);
-
- // 所有營業員 select => options
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM account
- WHERE department_id IN ('311','312','313','314','315')
- ORDER BY label ASC
- ";
- $sales_options = mysqli_query($link, $sql);
-
- // 所有工務人員 select => options
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM account
- WHERE department_id IN ('521','531','541','542','543','544','545')
- ORDER BY label ASC
- ";
- $warehouse_options = mysqli_query($link, $sql);
-
-?>
-
-
-
- 0 ? true : false;
+ }
+
+ // 預設新梯代碼 A
+ $contract_type = '';
+ // 合約號
+ $contractno = '';
+ // 營業員ID
+ $salesid = '';
+ // 工務人員ID
+ $warehouseid = '';
+ // 客戶姓名
+ $custom = '';
+ // 工地負責人
+ $site_manager = '';
+ // 客戶id
+ $accountid = '';
+ // 作番號
+ $facilityno = '';
+ // 號機
+ $facility_temp_no = '';
+ // 緯度
+ $latitude = '';
+ // 經度
+ $longitude = '';
+ // 載重
+ $weight = '';
+ // 人乘
+ $numberofpassenger = '';
+ // 樓停
+ $numberofstop = '';
+ // 樓層
+ $numberoffloor = '';
+ // 開門方式
+ $opentype = '';
+ // 速度
+ $speed = '';
+ // 機型
+ $facility_kind = '';
+ // 地址
+ $address = '';
+ // 合約到貨日
+ $contract_arrival_date = '';
+ // 實際到貨日
+ $real_contract_arrival_date = '';
+
+ // 營業規格確認
+ $sales_spec_verify = '';
+ // 營業規格附件
+ $sales_spec_verify_file = '';
+ // 營業規格確認時間
+ $sales_spec_verify_at = '';
+ // 營業規格確認人
+ $sales_spec_verify_owner = '';
+
+ // 客戶計劃圖確認
+ $customer_planning_verify = '';
+ // 客戶計劃圖附件
+ $customer_planning_verify_file = '';
+ // 客戶計劃圖確認時間
+ $customer_planning_verify_at = '';
+ // 客戶計劃圖確認人
+ $customer_planning_verify_owner = '';
+
+ // 客戶顏色確認
+ $customer_color_verify = '';
+ // 客戶顏色附件
+ $customer_color_verify_file = '';
+ // 客戶顏色確認時間
+ $customer_color_verify_at = '';
+ // 客戶顏色確認人
+ $customer_color_verify_owner = '';
+
+ // 工勘聯絡表
+ $site_survey_contact_form_verify = '';
+ // 工勘聯絡表附件
+ $site_survey_contact_form_verify_file = '';
+ // 工勘聯絡表確認時間
+ $site_survey_contact_form_verify_at = '';
+ // 工勘聯絡表確認人
+ $site_survey_contact_form_verify_owner = '';
+
+ // 設計規格確認
+ $desin_spec_verify = '';
+ // 設計規格確認附件
+ $desin_spec_verify_file = '';
+ // 設計規格確認時間
+ $desin_spec_verify_at = '';
+ // 設計規格確認確認人
+ $desin_spec_verify_owner = '';
+
+ // 設計計劃圖確認
+ $desin_planning_verify = '';
+ // 設計計劃圖確認附件
+ $desin_planning_verify_file = '';
+ // 設計計劃圖確認時間
+ $desin_planning_verify_at = '';
+ // 設計計劃圖確認人
+ $desin_planning_verify_owner = '';
+
+ // 設計顏色確認
+ $desin_color_verify = '';
+ // 設計顏色確認附件
+ $desin_color_verify_file = '';
+ // 設計顏色確認時間
+ $desin_color_verify_at = '';
+ // 設計顏色確認人
+ $desin_color_verify_owner = '';
+
+ // 設計仕樣確認
+ $desin_style_verify = '';
+ // 設計仕樣確認附件
+ $desin_style_verify_file = '';
+ // 設計仕樣確認時間
+ $desin_style_verify_at = '';
+ // 設計仕樣確認人
+ $desin_style_verify_owner = '';
+
+ // 設計主管確認
+ $desin_leader_verify = '';
+ // 設計主管確認附件
+ $desin_leader_verify_file = '';
+ // 設計主管確認時間
+ $desin_leader_verify_at = '';
+ // 設計主管確認人
+ $desin_leader_verify_owner = '';
+
+ // 樓高通報
+ $building_heigh_verify = '';
+ // 樓高通報附件
+ $building_heigh_verify_file = '';
+ // 樓高通報時間
+ $building_heigh_verify_at = '';
+ // 樓高通報確認人
+ $building_heigh_verify_owner = '';
+
+ // 電氣發貨明細
+ $electrical_design_publish = '';
+ // 電氣資料發行時間
+ $electrical_design_publish_at = '';
+ // 電氣資料發行人
+ $electrical_design_publish_owner = '';
+
+ // 機械資料發行
+ $mechanical_design_publish = '';
+ // 機械資料發行時間
+ $mechanical_design_publish_at = '';
+ // 機械資料發行人
+ $mechanical_design_publish_owner = '';
+
+ // 電氣發貨明細
+ $electrical_shipping_date_publish = '';
+ // 電氣發貨明細時間
+ $electrical_shipping_date_publish_at = '';
+ // 電氣發貨明細發行人
+ $electrical_shipping_date_publish_owner = '';
+
+ // 機械發貨明細
+ $mechanical_shipping_date_publish = '';
+ // 機械發貨明細時間
+ $mechanical_shipping_date_publish_at = '';
+ // 機械發貨明細發行人
+ $mechanical_shipping_date_publish_owner = '';
+
+ // 下單日(普來特富)
+ $prattford_order_date = '';
+ // 預計發貨日(到港日)
+ $estimated_shipping_date = '';
+ // 發貨類別(A.全級發貨、G.欠件發貨)
+ $goods_type = '';
+ // 實際到貨日(到觀音廠日)
+ $actual_tofactory_date = '';
+ // 發貨確認人
+ $shipping_date_owner = '';
+ // 預計船期
+ $estimated_shipping_schedule_date = '';
+ // 實際到貨日(到港日)
+ $actual_arrival_date = '';
+ // 到貨確認人
+ $arrival_date_owner = '';
+
+ // 是否齊備
+ $shengguanok_status = '';
+ // 生管確認附件
+ $shengguanok_status_file = '';
+ // 已備齊時間
+ $shengguanok_status_at = '';
+ // 已備齊檢查人
+ $shengguanok_status_owner = '';
+
+ // 建立人
+ $creater = '';
+ // 建立時間
+ $create_at = '';
+
+
+ if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
+ // 預設新梯代碼 A
+ $contract_type = postCheck('contract_type', 'A');
+ // 合約號
+ $contractno = postCheck('contractno');
+ // 營業員ID
+ $salesid = postCheck('salesid');
+ // 工務人員ID
+ $warehouseid = postCheck('warehouseid');
+ // 客戶姓名
+ $custom = postCheck('custom');
+ // 工地負責人
+ $site_manager = postCheck('site_manager');
+ // 客戶id
+ $accountid = postCheck('accountid');
+ // 作番號
+ $facilityno = postCheck('facilityno');
+ // 作番號
+ $facility_temp_no = postCheck('facility_temp_no');
+ // 緯度
+ $latitude = postCheck('latitude');
+ // 經度
+ $longitude = postCheck('longitude');
+ // 載重
+ $weight = postCheck('weight');
+ // 人乘
+ $numberofpassenger = postCheck('numberofpassenger');
+ // 樓停
+ $numberofstop = postCheck('numberofstop');
+ // 樓層
+ $numberoffloor = postCheck('numberoffloor');
+ // 開門方式
+ $opentype = postCheck('opentype');
+ // 速度
+ $speed = postCheck('speed');
+ // 機型
+ $facility_kind = postCheck('facility_kind');
+ // 地址
+ $address = postCheck('address');
+ // 合約到貨日
+ $contract_arrival_date = postCheck('contract_arrival_date');
+ // 實際到貨日
+ $real_contract_arrival_date = postCheck('real_contract_arrival_date');
+
+ // 營業規格確認
+ $sales_spec_verify = postCheck('sales_spec_verify');
+ // 營業規格附件
+ $sales_spec_verify_file = postCheck('sales_spec_verify_file');
+ // 營業規格確認時間
+ $sales_spec_verify_at = postCheck('sales_spec_verify_at');
+ // 營業規格確認人
+ $sales_spec_verify_owner = postCheck('sales_spec_verify_owner');
+
+ // 客戶計劃圖確認
+ $customer_planning_verify = postCheck('customer_planning_verify');
+ // 客戶計劃圖附件
+ $customer_planning_verify_file = postCheck('customer_planning_verify_file');
+ // 客戶計劃圖確認時間
+ $customer_planning_verify_at = postCheck('customer_planning_verify_at');
+ // 客戶計劃圖確認人
+ $customer_planning_verify_owner = postCheck('customer_planning_verify_owner');
+
+ // 客戶顏色確認
+ $customer_color_verify = postCheck('customer_color_verify');
+ // 客戶顏色附件
+ $customer_color_verify_file = postCheck('customer_color_verify_file');
+ // 客戶顏色確認時間
+ $customer_color_verify_at = postCheck('customer_color_verify_at');
+ // 客戶顏色確認人
+ $customer_color_verify_owner = postCheck('customer_color_verify_owner');
+
+ // 工勘聯絡表
+ $site_survey_contact_form_verify = postCheck('site_survey_contact_form_verify');
+ // 工勘聯絡表附件
+ $site_survey_contact_form_verify_file = postCheck('site_survey_contact_form_verify_file');
+ // 工勘聯絡表確認時間
+ $site_survey_contact_form_verify_at = postCheck('site_survey_contact_form_verify_at');
+ // 工勘聯絡表確認人
+ $site_survey_contact_form_verify_owner = postCheck('site_survey_contact_form_verify_owner');
+
+ // 設計規格確認
+ $desin_spec_verify = postCheck('desin_spec_verify');
+ // 設計規格確認附件
+ $desin_spec_verify_file = postCheck('desin_spec_verify_file');
+ // 設計規格確認時間
+ $desin_spec_verify_at = postCheck('desin_spec_verify_at');
+ // 設計規格確認確認人
+ $desin_spec_verify_owner = postCheck('desin_spec_verify_owner');
+
+ // 設計計劃圖確認
+ $desin_planning_verify = postCheck('desin_planning_verify');
+ // 設計計劃圖確認附件
+ $desin_planning_verify_file = postCheck('desin_planning_verify_file');
+ // 設計計劃圖確認時間
+ $desin_planning_verify_at = postCheck('desin_planning_verify_at');
+ // 設計計劃圖確認人
+ $desin_planning_verify_owner = postCheck('desin_planning_verify_owner');
+
+ // 設計顏色確認
+ $desin_color_verify = postCheck('desin_color_verify');
+ // 設計顏色確認附件
+ $desin_color_verify_file = postCheck('desin_color_verify_file');
+ // 設計顏色確認時間
+ $desin_color_verify_at = postCheck('desin_color_verify_at');
+ // 設計顏色確認人
+ $desin_color_verify_owner = postCheck('desin_color_verify_owner');
+
+ // 設計仕樣確認
+ $desin_style_verify = postCheck('desin_style_verify');
+ // 設計仕樣確認附件
+ $desin_style_verify_file = postCheck('desin_style_verify_file');
+ // 設計仕樣確認時間
+ $desin_style_verify_at = postCheck('desin_style_verify_at');
+ // 設計仕樣確認人
+ $desin_style_verify_owner = postCheck('desin_style_verify_owner');
+
+ // 設計主管確認
+ $desin_leader_verify = postCheck('desin_leader_verify');
+ // 設計主管確認附件
+ $desin_leader_verify_file = postCheck('desin_leader_verify_file');
+ // 設計主管確認時間
+ $desin_leader_verify_at = postCheck('desin_leader_verify_at');
+ // 設計主管確認人
+ $desin_leader_verify_owner = postCheck('desin_leader_verify_owner');
+
+ // 樓高通報
+ $building_heigh_verify = postCheck('building_heigh_verify');
+ // 樓高通報附件
+ $building_heigh_verify_file = postCheck('building_heigh_verify_file');
+ // 樓高通報時間
+ $building_heigh_verify_at = postCheck('building_heigh_verify_at');
+ // 樓高通報確認人
+ $building_heigh_verify_owner = postCheck('building_heigh_verify_owner');
+
+ // 電氣發貨明細
+ $electrical_design_publish = postCheck('electrical_design_publish');
+ // 電氣資料發行時間
+ $electrical_design_publish_at = postCheck('electrical_design_publish_at');
+ // 電氣資料發行人
+ $electrical_design_publish_owner = postCheck('electrical_design_publish_owner');
+
+ // 機械資料發行
+ $mechanical_design_publish = postCheck('mechanical_design_publish');
+ // 機械資料發行時間
+ $mechanical_design_publish_at = postCheck('mechanical_design_publish_at');
+ // 機械資料發行人
+ $mechanical_design_publish_owner = postCheck('mechanical_design_publish_owner');
+
+ // 電氣發貨明細
+ $electrical_shipping_date_publish = postCheck('electrical_shipping_date_publish');
+ // 電氣發貨明細時間
+ $electrical_shipping_date_publish_at = postCheck('electrical_shipping_date_publish_at');
+ // 電氣發貨明細發行人
+ $electrical_shipping_date_publish_owner = postCheck('electrical_shipping_date_publish_owner');
+
+ // 機械發貨明細
+ $mechanical_shipping_date_publish = postCheck('mechanical_shipping_date_publish');
+ // 機械發貨明細時間
+ $mechanical_shipping_date_publish_at = postCheck('mechanical_shipping_date_publish_at');
+ // 機械發貨明細發行人
+ $mechanical_shipping_date_publish_owner = postCheck('mechanical_shipping_date_publish_owner');
+
+ // 普來特富(下單日)
+ $prattford_order_date = postCheck('prattford_order_date');
+ // 預計發貨日(到港日)
+ $estimated_shipping_date = postCheck('estimated_shipping_date');
+ // 發貨類別(A.全級發貨、G.欠件發貨)
+ $goods_type = postCheck('goods_type');
+ // 實際到貨日(到觀音廠日)
+ $actual_tofactory_date = postCheck('actual_tofactory_date');
+ // 發貨確認人
+ $shipping_date_owner = postCheck('shipping_date_owner');
+ // 預計船期
+ $estimated_shipping_schedule_date = postCheck('estimated_shipping_schedule_date');
+ // 實際到貨日(到港日)
+ $actual_arrival_date = postCheck('actual_arrival_date');
+ // 到貨確認人
+ $arrival_date_owner = postCheck('arrival_date_owner');
+
+ // 是否齊備
+ $shengguanok_status = postCheck('shengguanok_status');
+ // 生管確認附件
+ $shengguanok_status_file = postCheck('shengguanok_status_file');
+ // 已備齊時間
+ $shengguanok_status_at = postCheck('shengguanok_status_at');
+ // 已備齊檢查人
+ $shengguanok_status_owner = postCheck('shengguanok_status_owner');
+
+ // QC與官檢種類
+ $qc_official_type = postCheck('qc_official_type');
+
+ // 建立人
+ $creater = postCheck('creater');
+ // 建立時間
+ $create_at = date('Y-m-d H:i:s');
+
+
+ //插入數據庫數據 gary_version
+ $insertsql = "
+ INSERT INTO wipwholestatus (
+ contract_type,
+ contractno,
+ salesid,
+ custom,
+ site_manager,
+ accountid,
+ facilityno,
+ facility_temp_no,
+ latitude,
+ longitude,
+ weight,
+ numberofpassenger,
+ numberofstop,
+ numberoffloor,
+ opentype,
+ speed,
+ facility_kind,
+ address,
+ contract_arrival_date,
+ real_contract_arrival_date,
+ sales_spec_verify,
+ sales_spec_verify_file,
+ sales_spec_verify_at,
+ sales_spec_verify_owner,
+ customer_planning_verify,
+ customer_planning_verify_file,
+ customer_planning_verify_at,
+ customer_planning_verify_owner,
+ customer_color_verify,
+ customer_color_verify_file,
+ customer_color_verify_at,
+ customer_color_verify_owner,
+ site_survey_contact_form_verify,
+ site_survey_contact_form_verify_file,
+ site_survey_contact_form_verify_at,
+ site_survey_contact_form_verify_owner,
+ desin_spec_verify,
+ desin_spec_verify_file,
+ desin_spec_verify_at,
+ desin_spec_verify_owner,
+ desin_planning_verify,
+ desin_planning_verify_file,
+ desin_planning_verify_at,
+ desin_planning_verify_owner,
+ desin_color_verify,
+ desin_color_verify_file,
+ desin_color_verify_at,
+ desin_color_verify_owner,
+ desin_style_verify,
+ desin_style_verify_file,
+ desin_style_verify_at,
+ desin_style_verify_owner,
+ desin_leader_verify,
+ desin_leader_verify_file,
+ desin_leader_verify_at,
+ desin_leader_verify_owner,
+ building_heigh_verify,
+ building_heigh_verify_file,
+ building_heigh_verify_at,
+ building_heigh_verify_owner,
+ electrical_design_publish,
+ electrical_design_publish_at,
+ electrical_design_publish_owner,
+ mechanical_design_publish,
+ mechanical_design_publish_at,
+ mechanical_design_publish_owner,
+ electrical_shipping_date_publish,
+ electrical_shipping_date_publish_at,
+ electrical_shipping_date_publish_owner,
+ mechanical_shipping_date_publish,
+ mechanical_shipping_date_publish_at,
+ mechanical_shipping_date_publish_owner,
+ prattford_order_date,
+ estimated_shipping_date,
+ goods_type,
+ actual_tofactory_date,
+ shipping_date_owner,
+ estimated_shipping_schedule_date,
+ actual_arrival_date,
+ arrival_date_owner,
+ shengguanok_status,
+ shengguanok_status_file,
+ shengguanok_status_at,
+ shengguanok_status_owner,
+ qc_official_type,
+ creater,
+ create_at
+ ) VALUES (
+ '$contract_type',
+ '$contractno',
+ '$salesid',
+ '$custom',
+ '$site_manager',
+ '$accountid',
+ '$facilityno',
+ '$facility_temp_no',
+ '$latitude',
+ '$longitude',
+ '$weight',
+ '$numberofpassenger',
+ '$numberofstop',
+ '$numberoffloor',
+ '$opentype',
+ '$speed',
+ '$facility_kind',
+ '$address',
+ '$contract_arrival_date',
+ '$contract_arrival_date',
+ '$sales_spec_verify',
+ '$sales_spec_verify_file',
+ '$sales_spec_verify_at',
+ '$sales_spec_verify_owner',
+ '$customer_planning_verify',
+ '$customer_planning_verify_file',
+ '$customer_planning_verify_at',
+ '$customer_planning_verify_owner',
+ '$customer_color_verify',
+ '$customer_color_verify_file',
+ '$customer_color_verify_at',
+ '$customer_color_verify_owner',
+ '$site_survey_contact_form_verify',
+ '$site_survey_contact_form_verify_file',
+ '$site_survey_contact_form_verify_at',
+ '$site_survey_contact_form_verify_owner',
+ '$desin_spec_verify',
+ '$desin_spec_verify_file',
+ '$desin_spec_verify_at',
+ '$desin_spec_verify_owner',
+ '$desin_planning_verify',
+ '$desin_planning_verify_file',
+ '$desin_planning_verify_at',
+ '$desin_planning_verify_owner',
+ '$desin_color_verify',
+ '$desin_color_verify_file',
+ '$desin_color_verify_at',
+ '$desin_color_verify_owner',
+ '$desin_style_verify',
+ '$desin_style_verify_file',
+ '$desin_style_verify_at',
+ '$desin_style_verify_owner',
+ '$desin_leader_verify',
+ '$desin_leader_verify_file',
+ '$desin_leader_verify_at',
+ '$desin_leader_verify_owner',
+ '$building_heigh_verify',
+ '$building_heigh_verify_file',
+ '$building_heigh_verify_at',
+ '$building_heigh_verify_owner',
+ '$electrical_design_publish',
+ '$electrical_design_publish_at',
+ '$electrical_design_publish_owner',
+ '$mechanical_design_publish',
+ '$mechanical_design_publish_at',
+ '$mechanical_design_publish_owner',
+ '$electrical_shipping_date_publish',
+ '$electrical_shipping_date_publish_at',
+ '$electrical_shipping_date_publish_owner',
+ '$mechanical_shipping_date_publish',
+ '$mechanical_shipping_date_publish_at',
+ '$mechanical_shipping_date_publish_owner',
+ '$prattford_order_date',
+ '$estimated_shipping_date',
+ '$goods_type',
+ '$actual_tofactory_date',
+ '$shipping_date_owner',
+ '$estimated_shipping_schedule_date',
+ '$actual_arrival_date',
+ '$arrival_date_owner',
+ '$shengguanok_status',
+ '$shengguanok_status_file',
+ '$shengguanok_status_at',
+ '$shengguanok_status_owner',
+ '$qc_official_type',
+ '$creater',
+ '$create_at'
+ )
+ ";
+
+ // 檢查作番號是否重複
+ if (checkFacilitynoRepeat($link, $facilityno)) {
+ echo "
+
+ ";
+ } else {
+ mysqli_query($link, $insertsql);
+ $last_form_id = mysqli_insert_id($link);
+ // 寫入待簽程狀態 A (營業)
+ do_wws_assign($salesid, $last_form_id, 'A');
+ // 寫入待簽程狀態 G (工務)
+ do_wws_assign($warehouseid, $last_form_id, 'G');
+ echo "
+
+ ";
+ }
+ }
+
+ // 開門方式 select => options
+ $sql = "
+ SELECT
+ code_name AS val ,
+ content AS label
+ FROM code F
+ WHERE field_name='open_kind'
+ ORDER BY label ASC
+ ";
+ $opendoor_options = mysqli_query($link, $sql);
+
+ // 所有營業員 select => options
+ $sql = "
+ SELECT
+ accountid AS val ,
+ name AS label
+ FROM account
+ WHERE department_id IN ('311','312','313','314','315')
+ ORDER BY label ASC
+ ";
+ $sales_options = mysqli_query($link, $sql);
+
+ // 所有工務人員 select => options
+ $sql = "
+ SELECT
+ accountid AS val ,
+ name AS label
+ FROM account
+ WHERE department_id IN ('521','531','541','542','543','544','545')
+ ORDER BY label ASC
+ ";
+ $warehouse_options = mysqli_query($link, $sql);
+
+?>
+
+
+
+
\ No newline at end of file
diff --git a/wms/wipwhole-renovate-index-function.php b/wms/wipwhole-renovate-index-function.php
index 1b76799a..18eebc0d 100644
--- a/wms/wipwhole-renovate-index-function.php
+++ b/wms/wipwhole-renovate-index-function.php
@@ -9,8 +9,9 @@
function getWipwholestatusDetail($link, $id)
{
$db_query = "
- SELECT * FROM
- wipwholestatus WHERE id = '$id'
+ SELECT * FROM wipwholestatus
+ WHERE id = '$id'
+ AND status = '1'
";
$receivabledata = mysqli_query($link, $db_query);
return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC);
@@ -369,6 +370,9 @@ function getEditFlag($department_id, $role_id, $user_id)
return 4;
if ($user_id == 'M0039' || $user_id == 'M0078')
return 4;
+ if ($user_id == 'M0188') {
+ return 4;
+ }
// 品証部門
if ($department_id == '912')
return 4;
@@ -387,11 +391,25 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
+
+ // 補丁 許馨文 權限 = 李烘銘
+ if (in_array($user_id, ['M0115'])) {
+ $user_id = 'M0086';
+ }
+
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
+ // 補丁 林修賢 = 鄭存邑
+ if (in_array($user_id, ['M0188'])) {
+ $user_id = 'M0102';
+ $department_id = '545';
+ $role_id = '6';
+ }
+
+
$contract_type = 'B';
// 營業員主管或營業員
$department_arr = [
@@ -407,15 +425,28 @@ function getDataSql($department_id, $role_id, $user_id)
$sql .= getWipwholeSearchSql();
$sql .= "ORDER BY real_contract_arrival_date DESC ";
+ // 補丁 林靜雯 權限 = 劉永德 新梯 桃竹
+ if ($user_id == 'M0189') {
+ $sql_cmd = sql_myself("M0137", "salesid");
+ $sql = "
+ SELECT * FROM wipwholestatus $sql_cmd
+ ";
+ $sql .= empty($sql_cmd) ? " WHERE 1=1 AND status = '1' AND contract_type = '$contract_type' " : " AND status = '1' AND contract_type = '$contract_type'";
+ $sql .= getWipwholeSearchSql();
+ $sql .= "ORDER BY real_contract_arrival_date DESC ";
+ return $sql;
+ }
+
if (in_array($department_id, $department_arr)) {
// 北區營銷部 營銷專案經理 311 1
// 新梯營銷經理 311 3
// 桃竹營銷部 銷售專案經理 312 1
+ // 桃竹契約部 經理 512 3
// 中區營銷部 新梯營銷經理 313 1
// 南區營銷部 銷售專案經理 314 2
// 花東區營銷部 營銷專案經理 315 1
- if ($department_id == '311' && (in_array($role_id, ['1', '3'])) || $user_id = "M0013") {
+ if ($department_id == '512' && (in_array($role_id, ['3']))) {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
@@ -426,6 +457,19 @@ function getDataSql($department_id, $role_id, $user_id)
";
return $sql;
}
+
+ if (($department_id == '311' && in_array($role_id, ['1', '3'])) || $user_id == "M0013") {
+ $sql = "
+ SELECT * FROM wipwholestatus
+ WHERE 1=1
+ AND status = '1'
+ AND contract_type = '$contract_type'
+ " . getWipwholeSearchSql() . "
+ ORDER BY real_contract_arrival_date ASC
+ ";
+ return $sql;
+ }
+
if ($department_id == '312' && (in_array($role_id, ['1']))) {
$sql = "
SELECT * FROM wipwholestatus
@@ -556,6 +600,7 @@ function getDataSql($department_id, $role_id, $user_id)
";
return $sql;
}
+
return $sql;
}
@@ -566,11 +611,24 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
+
+ // 補丁 許馨文 權限 = 李烘銘
+ if (in_array($user_id, ['M0115'])) {
+ $user_id = 'M0086';
+ }
+
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
+ // 補丁 林修賢 = 鄭存邑
+ if (in_array($user_id, ['M0188'])) {
+ $user_id = 'M0102';
+ $department_id = '545';
+ $role_id = '6';
+ }
+
$contract_type = 'B';
// 營業員主管或營業員
$department_arr = ['501', '511', '512', '513', '514'];
@@ -598,15 +656,43 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
// 北區營銷部 營銷專案經理 311 1
// 新梯營銷經理 311 3
// 桃竹營銷部 銷售專案經理 312 1
+ // 桃竹契約部 經理 512 3
// 中區營銷部 新梯營銷經理 313 1
// 南區營銷部 銷售專案經理 314 2
// 花東區營銷部 銷售專案經理 314 1
+ if ($department_id == '512' && (in_array($role_id, ['3']))) {
+ $sql = "
+ SELECT * FROM wipwholestatus
+ WHERE 1=1
+ AND status = '1'
+ AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws02'
+ AND flow_code IN ('$flow_code')
+ )
+ " . getWipwholeSearchSql() . "
+ ORDER BY real_contract_arrival_date ASC
+ ";
+ return $sql;
+ }
if ($department_id == '311' && (in_array($role_id, ['1', '3']))) {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws02'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -618,6 +704,14 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws02'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -629,6 +723,14 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws02'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -640,6 +742,14 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws02'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -651,6 +761,14 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
WHERE 1=1
AND status = '1'
AND contract_type = '$contract_type'
+ AND id IN (
+ SELECT
+ form_id AS id
+ FROM flow
+ WHERE system_id = 'wws'
+ AND flow_id = 'wws02'
+ AND flow_code IN ('$flow_code')
+ )
" . getWipwholeSearchSql() . "
ORDER BY real_contract_arrival_date ASC
";
@@ -834,8 +952,8 @@ function getWarehouseStatus($link, $user_department_id, $role_id, $status)
{
if ($user_department_id == 220)
return "";
- // if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
- if(getSaveEstimateInstallData($user_department_id, $role_id)){
+ if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
+ // if (getSaveEstimateInstallData($user_department_id, $role_id)) {
if ($status == 1) {
return checkNowFormStatus($link) == 'A' ? "" : "disabled";
} else {
@@ -1151,1146 +1269,3 @@ function getAllCustomerPlanningVerify($link, $id)
";
return mysqli_query($link, $sql);
}
-
- "M0087",
- "北" => "M0040",
- "台北" => "M0040",
- "基隆" => "M0040",
- "新北" => "M0040",
- "新竹" => "M0040",
- "桃園" => "M0040",
- "苗栗" => "M0113",
- "中" => "M0113",
- "南投" => "M0113",
- "台中" => "M0113",
- "彰化" => "M0113",
- "雲林" => "M0113",
- "南" => "M0102",
- "台南" => "M0102",
- "嘉義" => "M0102",
- "屏東" => "M0102",
- "高雄" => "M0102"
- );
- return empty($arr[$row[0]]) ? "" : $arr[$row[0]];
-}
-
-// 取得生管部主管編號
-function getShengGuanokLeaderNo($link)
-{
- $sql = "
- SELECT accountid
- FROM `account`
- WHERE `department_id` = '321'
- AND `role_id` = '1';
- ";
- $result = mysqli_query($link, $sql);
- $row = mysqli_fetch_array($result);
- return $row[0];
-}
-
-// 確認目前狀態
-function checkNowFormStatus($link)
-{
- if (isset($_GET['id']) || isset($_GET['form_key'])) {
- $id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
- $form_key = getForm_key($link, $id);
- }
- $sql = "
- SELECT
- flow_code
- FROM flow
- WHERE form_id = '$id'
- AND form_key = '$form_key'
- AND system_id = 'wws'
- AND flow_id = 'wws02'
- ";
- $result = mysqli_query($link, $sql);
- $row = mysqli_fetch_array($result);
- return $row['0'];
-}
-
-function getWipwholeSearchSql()
-{
-
- $area = [
- 'Y' => " '宜蘭','花蓮','台東' ",
- 'N' => " '臺北', '台北', '基隆', '新北' ",
- 'T' => " '桃園', '新竹' ",
- 'C' => " '南投', '臺中', '台中', '彰化', '雲林', '苗栗' ",
- 'K' => " '台南', '臺南', '嘉義', '屏東', '高雄' "
- ];
-
- $contractno = empty($_REQUEST['contractno']) ? null : trim($_REQUEST['contractno']);
- $facilityno = empty($_REQUEST['facilityno']) ? null : trim($_REQUEST['facilityno']);
- $custom = empty($_REQUEST['custom']) ? null : trim($_REQUEST['custom']);
- $site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ? null : trim($_REQUEST['site_survey_contact_verify']);
- $real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : trim($_REQUEST['real_contract_arrival_date_start']);
- $real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : trim($_REQUEST['real_contract_arrival_date_end']);
- $area_no = empty($_REQUEST['area_no']) ? null : trim($_REQUEST['area_no']);
-
- $sql = "";
- $sql .= empty($area_no) ? "" : " AND SUBSTR(address,1,2) IN (" . $area[$area_no] . ") ";
- $sql .= empty($contractno) ? "" : " AND contractno LIKE '%$contractno%' ";
- $sql .= empty($facilityno) ? "" : " AND facilityno LIKE '%$facilityno%' ";
- $sql .= empty($custom) ? "" : " AND custom LIKE '%$custom%' ";
- $sql .= $site_survey_contact_verify == "" ? "" : " AND site_survey_contact_verify = '" . $site_survey_contact_verify . "' ";
- $sql .= empty($real_contract_arrival_date_start) ? "" : " AND DATE_FORMAT(real_contract_arrival_date, '%Y-%m-%d') >= '$real_contract_arrival_date_start' ";
- $sql .= empty($real_contract_arrival_date_end) ? "" : " AND DATE_FORMAT(real_contract_arrival_date, '%Y-%m-%d') <= '$real_contract_arrival_date_end' ";
- return $sql;
-}
-
-function getDepartmentId($link, $user_id)
-{
- $sql = "
- SELECT
- department_id
- FROM account
- WHERE accountid = '$user_id'
- ";
- $res = mysqli_query($link, $sql);
- $row = mysqli_fetch_row($res);
- mysqli_free_result($res);
- return $row[0];
-}
-
-function getRoleId($link, $user_id)
-{
- $sql = "
- SELECT
- role_id
- FROM account
- WHERE accountid = '$user_id'
- ";
- $res = mysqli_query($link, $sql);
- $row = mysqli_fetch_row($res);
- mysqli_free_result($res);
- return $row[0];
-}
-
-function getEditFlag($department_id, $role_id, $user_id)
-{
- // 業務部門
- // 鍾哥(生管) 部門代碼:250 職位大小:1 4
- // 許協理 部門代碼:320 職位大小:1
- // 詹總 部門代碼:50 職位大小:1
- // 許總 部門代碼:20 職位大小:1
- // 設計 部門代碼:911
- // 宜蘭工務 user_id:M0087
- // 北區工務組長 user_id:M0040
- // 中區工務組長 user_id:M0113 M0158
- // 南區工務組長 user_id:M0039 M0078
- // 工務部門 部門代碼:521 531 541 542 543 544 545
-
- if ($department_id == "321")
- return 8;
- if ($department_id == "250")
- return 8;
- if ($department_id == "320" && $role_id == "1")
- return 8;
- if ($department_id == "50" && $role_id == "1")
- return 8;
- if ($department_id == "20" && $role_id == "1")
- return 8;
- if ($department_id == "911")
- return 2;
- if ($user_id == 'M0087')
- return 4;
- if ($user_id == 'M0040' || $user_id == 'M0176')
- return 4;
- if ($user_id == 'M0113' || $user_id == 'M0158')
- return 4;
- if ($user_id == 'M0039' || $user_id == 'M0078')
- return 4;
- // 品証部門
- if ($department_id == '912')
- return 4;
- if (in_array($department_id, [521, 531, 541, 542, 543, 544, 545]))
- return 4;
- $sql_cmd = sql_myself($user_id, "salesid");
- if (!empty($sql_cmd))
- return 1;
- return 15;
-}
-
-function getDataSql($department_id, $role_id, $user_id)
-{
-
- // 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
- if (in_array($user_id, ['M0166', 'M0091'])) {
- $user_id = 'M0086';
- }
-
- $contract_type = 'B';
- // 營業員主管或營業員
- $department_arr = [
- '310', '311', '312', '313', '314', '315',
- '511', '512', '513', '514'
- ];
-
- $sql_cmd = sql_myself($user_id, "salesid");
- $sql = "
- SELECT * FROM wipwholestatus $sql_cmd
- ";
- $sql .= empty($sql_cmd) ? " WHERE 1=1 AND status = '1' AND contract_type = '$contract_type' " : " AND status = '1' AND contract_type = '$contract_type'";
- $sql .= getWipwholeSearchSql();
- $sql .= "ORDER BY real_contract_arrival_date DESC ";
-
- if (in_array($department_id, $department_arr)) {
- // 北區營銷部 營銷專案經理 311 1
- // 新梯營銷經理 311 3
- // 桃竹營銷部 銷售專案經理 312 1
- // 中區營銷部 新梯營銷經理 313 1
- // 南區營銷部 銷售專案經理 314 2
- // 花東區營銷部 營銷專案經理 315 1
-
- if ($department_id == '311' && (in_array($role_id, ['1', '3'])) || $user_id = "M0013") {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '312' && (in_array($role_id, ['1']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '313' && (in_array($role_id, ['1']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '314' && (in_array($role_id, ['2']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '315' && (in_array($role_id, ['1']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- }
- // 鍾哥 部門代碼:250 職位大小:1 4
- // 許協理 部門代碼:320 職位大小:1
- // 張主任 部門代碼:322 職位大小:1
- // 詹總 部門代碼:50 職位大小:1
- // 許總 部門代碼:20 職位大小:1
- // 業務部門 部門代碼:321
- // 資訊部門 部門代碼:220
- // 服務支援部門 部門代碼:501
- // 財會部門 部門代碼:210
- $department_arr = ['911', '250', '320', '50', '20', '321', '220', '322', '501', '210', '912'];
- if (in_array($department_id, $department_arr)) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- // (宜蘭)工務組長
- if ($user_id == 'M0087') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('宜蘭')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 北區工務組長
- if ($user_id == 'M0040' || $user_id == 'M0176') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 中區工務組長
- if ($user_id == 'M0113' || $user_id == 'M0158') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 南區工務組長
- if ($user_id == 'M0039' || $user_id == 'M0078') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 工務
- if (in_array($department_id, [521, 531, 541, 542, 543, 544, 545])) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- return $sql;
-}
-
-function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
-{
-
- // 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
- if (in_array($user_id, ['M0166', 'M0091'])) {
- $user_id = 'M0086';
- }
-
- $contract_type = 'B';
- // 營業員主管或營業員
- $department_arr = ['501', '511', '512', '513', '514'];
-
- $sql_cmd = sql_myself($user_id, "salesid");
- $sql = "
- SELECT * FROM wipwholestatus $sql_cmd
- ";
- $sql .= empty($sql_cmd) ? " WHERE 1=1 AND contract_type = '$contract_type' " : " AND contract_type = '$contract_type'";
- $sql .= "
- AND status = '1'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- ";
- $sql .= getWipwholeSearchSql();
- $sql .= "ORDER BY real_contract_arrival_date DESC ";
-
- if (in_array($department_id, $department_arr)) {
- // 北區營銷部 營銷專案經理 311 1
- // 新梯營銷經理 311 3
- // 桃竹營銷部 銷售專案經理 312 1
- // 中區營銷部 新梯營銷經理 313 1
- // 南區營銷部 銷售專案經理 314 2
- // 花東區營銷部 銷售專案經理 314 1
- if ($department_id == '311' && (in_array($role_id, ['1', '3']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '312' && (in_array($role_id, ['1']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '313' && (in_array($role_id, ['1']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '314' && (in_array($role_id, ['2']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- if ($department_id == '315' && (in_array($role_id, ['1']))) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
- }
-
- // 鍾哥 部門代碼:250 職位大小:1 4
- // 許協理 部門代碼:320 職位大小:1
- // 張主任 部門代碼:322 職位大小:1
- // 詹總 部門代碼:50 職位大小:1
- // 許總 部門代碼:20 職位大小:1
- // 業務部門 部門代碼:321
- // 資訊部門 部門代碼:220
- // 服務支援部 部門代碼:501
- // 財會部門 部門代碼:210
- $department_arr = ['911', '250', '320', '50', '20', '321', '220', '322', '501', '210', '912'];
- if (in_array($department_id, $department_arr)) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date ASC
- ";
- return $sql;
- }
-
- // (宜蘭)工務組長
- if ($user_id == 'M0087') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('宜蘭')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 北區工務組長
- if ($user_id == 'M0040' || $user_id == 'M0176') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('臺北','台北','基隆','新北','桃園','新竹')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 中區工務組長
- if ($user_id == 'M0113' || $user_id == 'M0158') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('南投','臺中','台中','彰化','雲林','苗栗')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 南區工務組長
- if ($user_id == 'M0039' || $user_id == 'M0078') {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- " . getWipwholeSearchSql() . "
- AND SUBSTR(address,1,2) in ('台南','臺南','嘉義','屏東','高雄')
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- // 工務
- if (in_array($department_id, [521, 531, 541, 542, 543, 544, 545])) {
- $sql = "
- SELECT * FROM wipwholestatus
- WHERE 1=1
- AND status = '1'
- AND contract_type = '$contract_type'
- AND id IN (
- SELECT
- form_id AS id
- FROM flow
- WHERE system_id = 'wws'
- AND flow_id = 'wws02'
- AND flow_code IN ('$flow_code')
- )
- " . getWipwholeSearchSql() . "
- ORDER BY real_contract_arrival_date DESC
- ";
- return $sql;
- }
- return $sql;
-}
-
-function getGunwuName($address)
-{
- $north_arr = array('台北', '基隆', '新北', '桃園', '新竹', '台東');
- $north_arr2 = array('宜蘭');
- $center_arr = array('南投', '彰化', '雲林', '台中', '苗栗');
- $south_arr = array('台南', '嘉義', '屏東', '高雄');
- foreach ($north_arr as $key => $value)
- if (mb_strpos($address, $value, 0, "UTF-8") !== false)
- return "吳宗紘";
- foreach ($north_arr2 as $key => $value)
- if (mb_strpos($address, $value, 0, "UTF-8") !== false)
- return "高培軒";
- foreach ($center_arr as $key => $value)
- if (mb_strpos($address, $value, 0, "UTF-8") !== false)
- return "林瑋隆";
- foreach ($south_arr as $key => $value)
- if (mb_strpos($address, $value, 0, "UTF-8") !== false)
- return "鄭存邑";
- return "";
-}
-
-function getInformationStatus($link, $user_department_id, $role_id)
-{
- if ($user_department_id == 220)
- return "";
- return "disabled";
-}
-function getYewuStatus($link, $user_department_id, $role_id)
-{
- if ($user_department_id == 220)
- return "";
- if ($user_department_id == 321)
- return "";
- return "disabled";
-}
-function getWarehouseStatus($link, $user_department_id, $role_id, $status)
-{
- if ($user_department_id == 220)
- return "";
- if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
- if ($status == 1) {
- return checkNowFormStatus($link) == 'A' ? "" : "disabled";
- } else {
- return "";
- }
- }
- return "disabled";
-}
-function getMarketingStatus($link, $user_department_id, $role_id, $status)
-{
- if ($user_department_id == 220)
- return "";
- if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) {
- if ($status == 1) {
- return checkNowFormStatus($link) == 'B' ? "" : "disabled";
- } else {
- return "";
- }
- }
- if ($user_department_id == 501 || $user_department_id == 511 || $user_department_id == 512 || $user_department_id == 513 || $user_department_id == 514) {
- if ($status == 1) {
- return checkNowFormStatus($link) == 'B' ? "" : "disabled";
- } else {
- return "";
- }
- }
- return "disabled";
-}
-function getDesinStatus($link, $user_department_id, $role_id)
-{
- if ($user_department_id == 220)
- return "";
- if ($user_department_id == 911)
- return checkNowFormStatus($link) == 'C' ? "" : "disabled";
- return "disabled";
-}
-function getDesinLeaderStatus($link, $user_department_id, $role_id)
-{
- if ($user_department_id == 220)
- return "";
- if ($user_department_id == 911)
- return checkNowFormStatus($link) == 'D' && $role_id == 1 ? "" : "disabled";
- return "disabled";
-}
-function getShengguanStatus($link, $user_department_id, $role_id, $status)
-{
- if ($user_department_id == 220)
- return "";
- if ($status == '1') {
- if ($user_department_id == 250 && in_array($role_id, [1, 4]))
- return "";
- } else {
- if ($user_department_id == 250)
- return "";
- }
- return "disabled";
-}
-function getPinzhengStatus($link, $user_department_id, $role_id)
-{
- if ($user_department_id == 220)
- return "";
- if ($user_department_id == 912)
- return "";
- return "disabled";
-}
-
-function getTabNo($user_department_id)
-{
- if ($user_department_id == 220)
- return 0;
- if (in_array($user_department_id, [311, 312, 313, 314, 315]))
- return 1;
- if (in_array($user_department_id, [501, 511, 512, 513]))
- return 1;
- if ($user_department_id == 911)
- return 2;
- if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545]))
- return 0;
- if ($user_department_id == 321 || $user_department_id == 250)
- return 3;
- if ($user_department_id == 912)
- return 4;
- return 0;
-}
-
-function getOpendoorOptions($link)
-{
- $sql = "
- SELECT
- code_name AS val ,
- content AS label
- FROM code
- WHERE field_name='open_kind'
- ORDER BY label ASC
- ";
- return mysqli_query($link, $sql);
-}
-
-function getYingyeokOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('311','312','313','314','315','511','512','513','514')
- ORDER BY accountid ASC
- ";
- return mysqli_query($link, $sql);
-}
-
-function getShejiokOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('911')
- AND `role_id` NOT IN ('1')
- ORDER BY accountid ASC
- ";
- return mysqli_query($link, $sql);
-}
-
-function getShejiokLeaderOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('911')
- AND `role_id` IN ('1')
- ORDER BY accountid ASC
- ";
- return mysqli_query($link, $sql);
-}
-
-function getGongwuokOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('521','531','501','541','542','543','544','545')
- ORDER BY accountid ASC
- ";
- return mysqli_query($link, $sql);
-}
-
-function getYewuOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('321')
- ";
- return mysqli_query($link, $sql);
-}
-
-function getShengguanokOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('250')
- ";
- return mysqli_query($link, $sql);
-}
-
-function getPinzhengOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `department_id` IN ('912')
- ";
- return mysqli_query($link, $sql);
-}
-
-function getAllUsersOptions($link)
-{
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM `account`
- WHERE `accounttype` NOT IN ('A','X')
- ";
- return mysqli_query($link, $sql);
-}
-
-function getSelectOptionHtml($options, $selected_val)
-{
- $str = "";
- foreach ($options as $option) :
- if ($option['val'] == $selected_val) {
- $str .= "";
- } else {
- $str .= "";
- }
- endforeach;
- return $str;
-}
-
-function getWipwholeChangeButtonStatus($user_department_id)
-{
- if (in_array($user_department_id, [311, 312, 313, 314, 315]))
- return true;
- if (in_array($user_department_id, [501, 511, 512, 513, 514]))
- return true;
- if (in_array($user_department_id, [521, 531, 220, 250]))
- return true;
- if (in_array($user_department_id, [541, 542, 543, 544, 545]))
- return true;
- return false;
-}
-
-
-function getSaveEstimateInstallData($user_department_id, $role_id)
-{
- if (in_array($user_department_id, ['50', '501']) && $role_id == '2')
- return true;
- if ($user_department_id == '311' && $role_id == '4')
- return true;
- if ($user_department_id == '312' && $role_id == '3')
- return true;
- if ($user_department_id == '313' && $role_id == '3')
- return true;
- if ($user_department_id == '314' && $role_id == '4')
- return true;
- if ($user_department_id == '315' && in_array($role_id, ['1', '2']))
- return true;
- if (in_array($user_department_id, [220, 531]))
- return true;
- if ($user_department_id == '521' && in_array($role_id, ['11', '9', '12']))
- return true;
- if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
- return true;
- if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
- return true;
- if ($user_department_id == '543' && $role_id == '2')
- return true;
- if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
- return true;
- return false;
-}
-
-function getSaveInstallDataButtonStatus($user_department_id, $role_id)
-{
- if ($user_department_id == '315' && $role_id == '1')
- return true;
- if ($user_department_id == '521' && $role_id == '9')
- return true;
- if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
- return true;
- if ($user_department_id == '543' && $role_id == '2')
- return true;
- if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
- return true;
- if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
- return true;
- if ($user_department_id == '220')
- return true;
- return false;
-}
-
-function getWipwholeChangePlanningCustomerDetailsStatus($link, $id)
-{
- $sql = "
- SELECT
- custom_name,
- create_at,
- change_status
- FROM wipwhole_change_planning_customer_details
- WHERE 1=1
- AND wipwholestatus_id = '$id'
- ORDER BY create_at DESC
- LIMIT 1
- ";
- return mysqli_query($link, $sql);
-}
-
-function getAllCustomerPlanningVerify($link, $id)
-{
- $sql = "
- SELECT
- real_custom_name AS custom_name,
- customer_planning_verify_file,
- date_format(customer_planning_verify_at, '%Y-%m-%d %H:%i:%s') AS create_at
- FROM wipwholestatus
- WHERE id = $id
- AND customer_planning_verify_file != ''
- AND customer_planning_verify_file IS NOT NULL
- UNION
- SELECT
- custom_name,
- customer_planning_verify_file,
- create_at
- FROM wipwhole_change_planning_customer_details
- WHERE wipwholestatus_id = $id
- AND customer_planning_verify_file != ''
- AND customer_planning_verify_file IS NOT NULL
- ";
- return mysqli_query($link, $sql);
-}
\ No newline at end of file
diff --git a/wms/wipwhole-renovate-index.php b/wms/wipwhole-renovate-index.php
index 6f22b60d..acc8c186 100644
--- a/wms/wipwhole-renovate-index.php
+++ b/wms/wipwhole-renovate-index.php
@@ -65,7 +65,8 @@ $tableArr = array(
"B" => "B",
"C" => "C",
"D" => "D",
- "Z" => "Z"
+ "Z" => "Z",
+ "F" => "F",
);
if (empty($sheetNum) || $sheetNum == "All") {
@@ -210,6 +211,9 @@ $data = mysqli_query($link, $sql);
營業確認中
+
+ 營業主管確認中
+
設計確認中
@@ -296,9 +300,9 @@ $data = mysqli_query($link, $sql);
";
- include "wipwhole-renovate-index-table-html.php";
- echo "";
+echo " ";
+include "wipwhole-renovate-index-table-html.php";
+echo " ";
#結束連線
@@ -444,6 +448,11 @@ mysqli_close($link);
window.location.href = "" + "&sheetNum=" + sheetNum;
}
+ function showFTable() {
+ sheetNum = "F";
+ window.location.href = "" + "&sheetNum=" + sheetNum;
+ }
+
function showBTable() {
sheetNum = "B";
window.location.href = "" + "&sheetNum=" + sheetNum;
@@ -469,9 +478,10 @@ mysqli_close($link);
"All": "1",
"A": "2",
"B": "3",
- "C": "4",
- "D": "5",
- "Z": "6",
+ "F": "4",
+ "C": "5",
+ "D": "6",
+ "Z": "7",
}
$("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
diff --git a/wms/wipwhole-renovate-rec-invoice-edit-submit.php b/wms/wipwhole-renovate-rec-invoice-edit-submit.php
index bc7a1617..d1d792cd 100644
--- a/wms/wipwhole-renovate-rec-invoice-edit-submit.php
+++ b/wms/wipwhole-renovate-rec-invoice-edit-submit.php
@@ -1,4 +1,5 @@
工務提交至營業階段");
@@ -944,10 +963,58 @@ function checkWwsAssianStatus($link, $user_id)
// 確認營業階段 進入設計人員(汰改:林坤翰 M0052 改 林昭翰 M0173)階段
if (checkNowFormStatus($link) == 'B' && checkYingYeok($link, $id) == '0') {
- write_note($link, $id, $user_id, "營業提交至設計階段");
- do_wws_next_assign("M0173", $form_key, 'C');
- return;
+ if (checkUseridIsManager($user_id)) {
+ write_note($link, $id, $user_id, "營業提交至設計階段");
+ $mail_title = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至設計階段";
+ $mail_content = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至設計階段";
+ $cmail->sendx(
+ $mail_title,
+ $mail_content,
+ [
+ [$data['salesname'], $data['salesmail']],
+ [$data['designname'], $data['designmail']]
+ ],
+ "永佳捷科技"
+ );
+ do_wws_next_assign("M0173", $form_key, 'C');
+ return;
+ } else {
+ write_note($link, $id, $user_id, "營業提交至營業經理階段");
+ $mail_title = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至營業經理階段";
+ $mail_content = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至營業經理階段";
+ $cmail->sendx(
+ $mail_title,
+ $mail_content,
+ [
+ [$data['salesname'], $data['salesmail']],
+ [$data['salesmanagername'], $data['salesmanagermail']]
+ ],
+ "永佳捷科技"
+ );
+ do_wws_next_assign(manage_class($data['salesid'])[0], $form_key, 'F');
+ }
}
+
+ // 確認營業主管階段 進入設計人員(汰改:林昭翰 M0173)階段
+ if (checkNowFormStatus($link) == 'F' && checkYingYeok($link, $id) == '0') {
+ if (checkUseridIsManager($user_id)) {
+ write_note($link, $id, $user_id, "營業經理提交至設計階段");
+ $mail_title = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
+ $mail_content = "作番大日程(汰改)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
+ $cmail->sendx(
+ $mail_title,
+ $mail_content,
+ [
+ [$data['salesname'], $data['salesmail']],
+ [$data['designname'], $data['designmail']]
+ ],
+ "永佳捷科技"
+ );
+ do_wws_next_assign("M0173", $form_YD_key, 'C');
+ return true;
+ }
+ }
+
// 確認設計人員(汰改:林坤翰 M0052 改 林昭翰 M0173)階段 進入設計主管階段
if (checkNowFormStatus($link) == 'C' && checkSheJiok($link, $id) == '0') {
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 e2d12b3e..ddf9f81a 100644
--- a/wms/wipwhole-renovate-rec-invoice-edit.php
+++ b/wms/wipwhole-renovate-rec-invoice-edit.php
@@ -153,8 +153,9 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
| 預計交期(到工地)
出貨日調整";
+ if ($user_id !== 'M0115')
+ if (getWipwholeChangeButtonStatus($user_department_id))
+ echo "出貨日調整";
?>
|
@@ -176,8 +177,9 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
|
工地地址
工地地址調整";
+ if ($user_id !== 'M0115')
+ if (getWipwholeChangeButtonStatus($user_department_id))
+ echo "工地地址調整";
?>
|
@@ -458,12 +460,12 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
|
" readonly>
-
-
-
+
存檔";
+ if (checkNowFormStatus($link) == 'A')
+ echo "";
}
?>
|
@@ -711,14 +713,28 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
">
-
-
+
+
+
+
+
+
+
+ 若無工勘資料請勿移交至設計階段!
-
@@ -1146,12 +1162,12 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
if (checkNowFormStatus($link) == 'Z' && ($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5'))) {
?>
-
-
+ ?>
+
-
-
- 0 ? true : false;
- }
-
- // 預設汰改代碼 A
- $contract_type = 'B';
- // 汰改方案
- $renovate_type = '';
- // 合約號
- $contractno = '';
- // 營業員ID
- $salesid = '';
- // 工務人員ID
- $warehouseid = '';
- // 客戶姓名
- $custom = '';
- // 工地負責人
- $site_manager = '';
- // 客戶id
- $accountid = '';
- // 作番號
- $facilityno = '';
- // 號機
- $facility_temp_no = '';
- // 緯度
- $latitude = '';
- // 經度
- $longitude = '';
- // 載重
- $weight = '';
- // 人乘
- $numberofpassenger = '';
- // 樓停
- $numberofstop = '';
- // 樓層
- $numberoffloor = '';
- // 開門方式
- $opentype = '';
- // 速度
- $speed = '';
- // 機型
- $facility_kind = '';
- // 地址
- $address = '';
- // 合約到貨日
- $contract_arrival_date = '';
- // 實際到貨日
- $real_contract_arrival_date = '';
-
- // 營業規格確認
- $sales_spec_verify = '';
- // 營業規格附件
- $sales_spec_verify_file = '';
- // 營業規格確認時間
- $sales_spec_verify_at = '';
- // 營業規格確認人
- $sales_spec_verify_owner = '';
-
- // 客戶計劃圖確認
- $customer_planning_verify = '';
- // 客戶計劃圖附件
- $customer_planning_verify_file = '';
- // 客戶計劃圖確認時間
- $customer_planning_verify_at = '';
- // 客戶計劃圖確認人
- $customer_planning_verify_owner = '';
-
- // 客戶顏色確認
- $customer_color_verify = '';
- // 客戶顏色附件
- $customer_color_verify_file = '';
- // 客戶顏色確認時間
- $customer_color_verify_at = '';
- // 客戶顏色確認人
- $customer_color_verify_owner = '';
-
- // 工勘聯絡表
- $site_survey_contact_form_verify = '';
- // 工勘聯絡表附件
- $site_survey_contact_form_verify_file = '';
- // 工勘聯絡表確認時間
- $site_survey_contact_form_verify_at = '';
- // 工勘聯絡表確認人
- $site_survey_contact_form_verify_owner = '';
-
- // 設計規格確認
- $desin_spec_verify = '';
- // 設計規格確認附件
- $desin_spec_verify_file = '';
- // 設計規格確認時間
- $desin_spec_verify_at = '';
- // 設計規格確認確認人
- $desin_spec_verify_owner = '';
-
- // 設計計劃圖確認
- $desin_planning_verify = '';
- // 設計計劃圖確認附件
- $desin_planning_verify_file = '';
- // 設計計劃圖確認時間
- $desin_planning_verify_at = '';
- // 設計計劃圖確認人
- $desin_planning_verify_owner = '';
-
- // 設計顏色確認
- $desin_color_verify = '';
- // 設計顏色確認附件
- $desin_color_verify_file = '';
- // 設計顏色確認時間
- $desin_color_verify_at = '';
- // 設計顏色確認人
- $desin_color_verify_owner = '';
-
- // 設計仕樣確認
- $desin_style_verify = '';
- // 設計仕樣確認附件
- $desin_style_verify_file = '';
- // 設計仕樣確認時間
- $desin_style_verify_at = '';
- // 設計仕樣確認人
- $desin_style_verify_owner = '';
-
- // 設計主管確認
- $desin_leader_verify = '';
- // 設計主管確認附件
- $desin_leader_verify_file = '';
- // 設計主管確認時間
- $desin_leader_verify_at = '';
- // 設計主管確認人
- $desin_leader_verify_owner = '';
-
- // 樓高通報
- $building_heigh_verify = '';
- // 樓高通報附件
- $building_heigh_verify_file = '';
- // 樓高通報時間
- $building_heigh_verify_at = '';
- // 樓高通報確認人
- $building_heigh_verify_owner = '';
-
- // 電氣發貨明細
- $electrical_design_publish = '';
- // 電氣資料發行時間
- $electrical_design_publish_at = '';
- // 電氣資料發行人
- $electrical_design_publish_owner = '';
-
- // 機械資料發行
- $mechanical_design_publish = '';
- // 機械資料發行時間
- $mechanical_design_publish_at = '';
- // 機械資料發行人
- $mechanical_design_publish_owner = '';
-
- // 電氣發貨明細
- $electrical_shipping_date_publish = '';
- // 電氣發貨明細時間
- $electrical_shipping_date_publish_at = '';
- // 電氣發貨明細發行人
- $electrical_shipping_date_publish_owner = '';
-
- // 機械發貨明細
- $mechanical_shipping_date_publish = '';
- // 機械發貨明細時間
- $mechanical_shipping_date_publish_at = '';
- // 機械發貨明細發行人
- $mechanical_shipping_date_publish_owner = '';
-
- // 下單日(普來特富)
- $prattford_order_date = '';
- // 預計發貨日(到港日)
- $estimated_shipping_date = '';
- // 發貨類別(A.全級發貨、G.欠件發貨)
- $goods_type = '';
- // 實際到貨日(到觀音廠日)
- $actual_tofactory_date = '';
- // 發貨確認人
- $shipping_date_owner = '';
- // 預計船期
- $estimated_shipping_schedule_date = '';
- // 實際到貨日(到港日)
- $actual_arrival_date = '';
- // 到貨確認人
- $arrival_date_owner = '';
-
- // 是否齊備
- $shengguanok_status = '';
- // 生管確認附件
- $shengguanok_status_file = '';
- // 已備齊時間
- $shengguanok_status_at = '';
- // 已備齊檢查人
- $shengguanok_status_owner = '';
-
- // 建立人
- $creater = '';
- // 建立時間
- $create_at = '';
-
-
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
-
- // 預設新梯代碼 A
- $contract_type = postCheck('contract_type', 'B');
- // 汰改方案 B
- $renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE);
- // 合約號
- $contractno = postCheck('contractno');
- // 營業員ID
- $salesid = postCheck('salesid');
- // 工務人員ID
- $warehouseid = postCheck('warehouseid');
- // 客戶姓名
- $custom = postCheck('custom');
- // 工地負責人
- $site_manager = postCheck('site_manager');
- // 客戶id
- $accountid = postCheck('accountid');
- // 作番號
- $facilityno = postCheck('facilityno');
- // 作番號
- $facility_temp_no = postCheck('facility_temp_no');
- // 緯度
- $latitude = postCheck('latitude');
- // 經度
- $longitude = postCheck('longitude');
- // 載重
- $weight = postCheck('weight');
- // 人乘
- $numberofpassenger = postCheck('numberofpassenger');
- // 樓停
- $numberofstop = postCheck('numberofstop');
- // 樓層
- $numberoffloor = postCheck('numberoffloor');
- // 開門方式
- $opentype = postCheck('opentype');
- // 速度
- $speed = postCheck('speed');
- // 機型
- $facility_kind = postCheck('facility_kind');
- // 地址
- $address = postCheck('address');
- // 合約到貨日
- $contract_arrival_date = postCheck('contract_arrival_date');
- // 實際到貨日
- $real_contract_arrival_date = postCheck('real_contract_arrival_date');
-
- // 營業規格確認
- $sales_spec_verify = postCheck('sales_spec_verify');
- // 營業規格附件
- $sales_spec_verify_file = postCheck('sales_spec_verify_file');
- // 營業規格確認時間
- $sales_spec_verify_at = postCheck('sales_spec_verify_at');
- // 營業規格確認人
- $sales_spec_verify_owner = postCheck('sales_spec_verify_owner');
-
- // 客戶計劃圖確認
- $customer_planning_verify = postCheck('customer_planning_verify');
- // 客戶計劃圖附件
- $customer_planning_verify_file = postCheck('customer_planning_verify_file');
- // 客戶計劃圖確認時間
- $customer_planning_verify_at = postCheck('customer_planning_verify_at');
- // 客戶計劃圖確認人
- $customer_planning_verify_owner = postCheck('customer_planning_verify_owner');
-
- // 客戶顏色確認
- $customer_color_verify = postCheck('customer_color_verify');
- // 客戶顏色附件
- $customer_color_verify_file = postCheck('customer_color_verify_file');
- // 客戶顏色確認時間
- $customer_color_verify_at = postCheck('customer_color_verify_at');
- // 客戶顏色確認人
- $customer_color_verify_owner = postCheck('customer_color_verify_owner');
-
- // 工勘聯絡表
- $site_survey_contact_form_verify = postCheck('site_survey_contact_form_verify');
- // 工勘聯絡表附件
- $site_survey_contact_form_verify_file = postCheck('site_survey_contact_form_verify_file');
- // 工勘聯絡表確認時間
- $site_survey_contact_form_verify_at = postCheck('site_survey_contact_form_verify_at');
- // 工勘聯絡表確認人
- $site_survey_contact_form_verify_owner = postCheck('site_survey_contact_form_verify_owner');
-
- // 設計規格確認
- $desin_spec_verify = postCheck('desin_spec_verify');
- // 設計規格確認附件
- $desin_spec_verify_file = postCheck('desin_spec_verify_file');
- // 設計規格確認時間
- $desin_spec_verify_at = postCheck('desin_spec_verify_at');
- // 設計規格確認確認人
- $desin_spec_verify_owner = postCheck('desin_spec_verify_owner');
-
- // 設計計劃圖確認
- $desin_planning_verify = postCheck('desin_planning_verify');
- // 設計計劃圖確認附件
- $desin_planning_verify_file = postCheck('desin_planning_verify_file');
- // 設計計劃圖確認時間
- $desin_planning_verify_at = postCheck('desin_planning_verify_at');
- // 設計計劃圖確認人
- $desin_planning_verify_owner = postCheck('desin_planning_verify_owner');
-
- // 設計顏色確認
- $desin_color_verify = postCheck('desin_color_verify');
- // 設計顏色確認附件
- $desin_color_verify_file = postCheck('desin_color_verify_file');
- // 設計顏色確認時間
- $desin_color_verify_at = postCheck('desin_color_verify_at');
- // 設計顏色確認人
- $desin_color_verify_owner = postCheck('desin_color_verify_owner');
-
- // 設計仕樣確認
- $desin_style_verify = postCheck('desin_style_verify');
- // 設計仕樣確認附件
- $desin_style_verify_file = postCheck('desin_style_verify_file');
- // 設計仕樣確認時間
- $desin_style_verify_at = postCheck('desin_style_verify_at');
- // 設計仕樣確認人
- $desin_style_verify_owner = postCheck('desin_style_verify_owner');
-
- // 設計主管確認
- $desin_leader_verify = postCheck('desin_leader_verify');
- // 設計主管確認附件
- $desin_leader_verify_file = postCheck('desin_leader_verify_file');
- // 設計主管確認時間
- $desin_leader_verify_at = postCheck('desin_leader_verify_at');
- // 設計主管確認人
- $desin_leader_verify_owner = postCheck('desin_leader_verify_owner');
-
- // 樓高通報
- $building_heigh_verify = postCheck('building_heigh_verify');
- // 樓高通報附件
- $building_heigh_verify_file = postCheck('building_heigh_verify_file');
- // 樓高通報時間
- $building_heigh_verify_at = postCheck('building_heigh_verify_at');
- // 樓高通報確認人
- $building_heigh_verify_owner = postCheck('building_heigh_verify_owner');
-
- // 電氣發貨明細
- $electrical_design_publish = postCheck('electrical_design_publish');
- // 電氣資料發行時間
- $electrical_design_publish_at = postCheck('electrical_design_publish_at');
- // 電氣資料發行人
- $electrical_design_publish_owner = postCheck('electrical_design_publish_owner');
-
- // 機械資料發行
- $mechanical_design_publish = postCheck('mechanical_design_publish');
- // 機械資料發行時間
- $mechanical_design_publish_at = postCheck('mechanical_design_publish_at');
- // 機械資料發行人
- $mechanical_design_publish_owner = postCheck('mechanical_design_publish_owner');
-
- // 電氣發貨明細
- $electrical_shipping_date_publish = postCheck('electrical_shipping_date_publish');
- // 電氣發貨明細時間
- $electrical_shipping_date_publish_at = postCheck('electrical_shipping_date_publish_at');
- // 電氣發貨明細發行人
- $electrical_shipping_date_publish_owner = postCheck('electrical_shipping_date_publish_owner');
-
- // 機械發貨明細
- $mechanical_shipping_date_publish = postCheck('mechanical_shipping_date_publish');
- // 機械發貨明細時間
- $mechanical_shipping_date_publish_at = postCheck('mechanical_shipping_date_publish_at');
- // 機械發貨明細發行人
- $mechanical_shipping_date_publish_owner = postCheck('mechanical_shipping_date_publish_owner');
-
- // 普來特富(下單日)
- $prattford_order_date = postCheck('prattford_order_date');
- // 預計發貨日(到港日)
- $estimated_shipping_date = postCheck('estimated_shipping_date');
- // 發貨類別(A.全級發貨、G.欠件發貨)
- $goods_type = postCheck('goods_type');
- // 實際到貨日(到觀音廠日)
- $actual_tofactory_date = postCheck('actual_tofactory_date');
- // 發貨確認人
- $shipping_date_owner = postCheck('shipping_date_owner');
- // 預計船期
- $estimated_shipping_schedule_date = postCheck('estimated_shipping_schedule_date');
- // 實際到貨日(到港日)
- $actual_arrival_date = postCheck('actual_arrival_date');
- // 到貨確認人
- $arrival_date_owner = postCheck('arrival_date_owner');
-
- // 是否齊備
- $shengguanok_status = postCheck('shengguanok_status');
- // 生管確認附件
- $shengguanok_status_file = postCheck('shengguanok_status_file');
- // 已備齊時間
- $shengguanok_status_at = postCheck('shengguanok_status_at');
- // 已備齊檢查人
- $shengguanok_status_owner = postCheck('shengguanok_status_owner');
-
- // QC與官檢種類
- $qc_official_type = postCheck('qc_official_type');
-
- // 建立人
- $creater = postCheck('creater');
- // 建立時間
- $create_at = postCheck('create_at');
-
- //插入數據庫數據 gary_version
- $insertsql = "
- INSERT INTO wipwholestatus (
- contract_type,
- renovate_type,
- contractno,
- salesid,
- custom,
- site_manager,
- accountid,
- facilityno,
- facility_temp_no,
- latitude,
- longitude,
- weight,
- numberofpassenger,
- numberofstop,
- numberoffloor,
- opentype,
- speed,
- facility_kind,
- address,
- contract_arrival_date,
- real_contract_arrival_date,
- sales_spec_verify,
- sales_spec_verify_file,
- sales_spec_verify_at,
- sales_spec_verify_owner,
- customer_planning_verify,
- customer_planning_verify_file,
- customer_planning_verify_at,
- customer_planning_verify_owner,
- customer_color_verify,
- customer_color_verify_file,
- customer_color_verify_at,
- customer_color_verify_owner,
- site_survey_contact_form_verify,
- site_survey_contact_form_verify_file,
- site_survey_contact_form_verify_at,
- site_survey_contact_form_verify_owner,
- desin_spec_verify,
- desin_spec_verify_file,
- desin_spec_verify_at,
- desin_spec_verify_owner,
- desin_planning_verify,
- desin_planning_verify_file,
- desin_planning_verify_at,
- desin_planning_verify_owner,
- desin_color_verify,
- desin_color_verify_file,
- desin_color_verify_at,
- desin_color_verify_owner,
- desin_style_verify,
- desin_style_verify_file,
- desin_style_verify_at,
- desin_style_verify_owner,
- desin_leader_verify,
- desin_leader_verify_file,
- desin_leader_verify_at,
- desin_leader_verify_owner,
- building_heigh_verify,
- building_heigh_verify_file,
- building_heigh_verify_at,
- building_heigh_verify_owner,
- electrical_design_publish,
- electrical_design_publish_at,
- electrical_design_publish_owner,
- mechanical_design_publish,
- mechanical_design_publish_at,
- mechanical_design_publish_owner,
- electrical_shipping_date_publish,
- electrical_shipping_date_publish_at,
- electrical_shipping_date_publish_owner,
- mechanical_shipping_date_publish,
- mechanical_shipping_date_publish_at,
- mechanical_shipping_date_publish_owner,
- prattford_order_date,
- estimated_shipping_date,
- goods_type,
- actual_tofactory_date,
- shipping_date_owner,
- estimated_shipping_schedule_date,
- actual_arrival_date,
- arrival_date_owner,
- shengguanok_status,
- shengguanok_status_file,
- shengguanok_status_at,
- shengguanok_status_owner,
- qc_official_type,
- creater,
- create_at
- ) VALUES (
- '$contract_type',
- '$renovate_type',
- '$contractno',
- '$salesid',
- '$custom',
- '$site_manager',
- '$accountid',
- '$facilityno',
- '$facility_temp_no',
- '$latitude',
- '$longitude',
- '$weight',
- '$numberofpassenger',
- '$numberofstop',
- '$numberoffloor',
- '$opentype',
- '$speed',
- '$facility_kind',
- '$address',
- '$contract_arrival_date',
- '$real_contract_arrival_date',
- '$sales_spec_verify',
- '$sales_spec_verify_file',
- '$sales_spec_verify_at',
- '$sales_spec_verify_owner',
- '$customer_planning_verify',
- '$customer_planning_verify_file',
- '$customer_planning_verify_at',
- '$customer_planning_verify_owner',
- '$customer_color_verify',
- '$customer_color_verify_file',
- '$customer_color_verify_at',
- '$customer_color_verify_owner',
- '$site_survey_contact_form_verify',
- '$site_survey_contact_form_verify_file',
- '$site_survey_contact_form_verify_at',
- '$site_survey_contact_form_verify_owner',
- '$desin_spec_verify',
- '$desin_spec_verify_file',
- '$desin_spec_verify_at',
- '$desin_spec_verify_owner',
- '$desin_planning_verify',
- '$desin_planning_verify_file',
- '$desin_planning_verify_at',
- '$desin_planning_verify_owner',
- '$desin_color_verify',
- '$desin_color_verify_file',
- '$desin_color_verify_at',
- '$desin_color_verify_owner',
- '$desin_style_verify',
- '$desin_style_verify_file',
- '$desin_style_verify_at',
- '$desin_style_verify_owner',
- '$desin_leader_verify',
- '$desin_leader_verify_file',
- '$desin_leader_verify_at',
- '$desin_leader_verify_owner',
- '$building_heigh_verify',
- '$building_heigh_verify_file',
- '$building_heigh_verify_at',
- '$building_heigh_verify_owner',
- '$electrical_design_publish',
- '$electrical_design_publish_at',
- '$electrical_design_publish_owner',
- '$mechanical_design_publish',
- '$mechanical_design_publish_at',
- '$mechanical_design_publish_owner',
- '$electrical_shipping_date_publish',
- '$electrical_shipping_date_publish_at',
- '$electrical_shipping_date_publish_owner',
- '$mechanical_shipping_date_publish',
- '$mechanical_shipping_date_publish_at',
- '$mechanical_shipping_date_publish_owner',
- '$prattford_order_date',
- '$estimated_shipping_date',
- '$goods_type',
- '$actual_tofactory_date',
- '$shipping_date_owner',
- '$estimated_shipping_schedule_date',
- '$actual_arrival_date',
- '$arrival_date_owner',
- '$shengguanok_status',
- '$shengguanok_status_file',
- '$shengguanok_status_at',
- '$shengguanok_status_owner',
- '$qc_official_type',
- '$creater',
- '$create_at'
- )
- ";
- // 檢查作番號是否重複
- if (checkFacilitynoRepeat($link, $facilityno)) {
- echo "
-
- ";
- } else {
- mysqli_query($link, $insertsql);
- $last_form_id = mysqli_insert_id($link);
- // 寫入待簽程狀態 A (工務)
- do_wws2_assign($warehouseid, $last_form_id, 'A');
- echo "
-
- ";
- }
- }
-
- // 開門方式 select => options
- $sql = "
- SELECT
- code_name AS val ,
- content AS label
- FROM code F
- WHERE field_name='open_kind'
- ORDER BY label ASC
- ";
- $opendoor_options = mysqli_query($link, $sql);
-
- // 所有營業員 select => options
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM account
- WHERE department_id IN ('311','312','313','314','315','511','512','513','514')
- ORDER BY label ASC
- ";
- $sales_options = mysqli_query($link, $sql);
-
- // 所有工務人員 select => options
- $sql = "
- SELECT
- accountid AS val ,
- name AS label
- FROM account
- WHERE department_id IN ('521')
- AND role_id IN ('3','4','5')
- UNION
- SELECT
- accountid AS val ,
- name AS label
- FROM account
- WHERE department_id IN ('531')
- AND role_id IN ('1')
- UNION
- SELECT
- accountid AS val ,
- name AS label
- FROM account
- WHERE department_id IN ('521','531','541','542','543','544','545')
- ORDER BY label ASC
- ";
- $warehouse_options = mysqli_query($link, $sql);
-
-?>
-
-
-
-
+
+
+ 0 ? true : false;
+ }
+
+ // 預設汰改代碼 A
+ $contract_type = 'B';
+ // 汰改方案
+ $renovate_type = '';
+ // 合約號
+ $contractno = '';
+ // 營業員ID
+ $salesid = '';
+ // 工務人員ID
+ $warehouseid = '';
+ // 客戶姓名
+ $custom = '';
+ // 工地負責人
+ $site_manager = '';
+ // 客戶id
+ $accountid = '';
+ // 作番號
+ $facilityno = '';
+ // 號機
+ $facility_temp_no = '';
+ // 緯度
+ $latitude = '';
+ // 經度
+ $longitude = '';
+ // 載重
+ $weight = '';
+ // 人乘
+ $numberofpassenger = '';
+ // 樓停
+ $numberofstop = '';
+ // 樓層
+ $numberoffloor = '';
+ // 開門方式
+ $opentype = '';
+ // 速度
+ $speed = '';
+ // 機型
+ $facility_kind = '';
+ // 地址
+ $address = '';
+ // 合約到貨日
+ $contract_arrival_date = '';
+ // 實際到貨日
+ $real_contract_arrival_date = '';
+
+ // 營業規格確認
+ $sales_spec_verify = '';
+ // 營業規格附件
+ $sales_spec_verify_file = '';
+ // 營業規格確認時間
+ $sales_spec_verify_at = '';
+ // 營業規格確認人
+ $sales_spec_verify_owner = '';
+
+ // 客戶計劃圖確認
+ $customer_planning_verify = '';
+ // 客戶計劃圖附件
+ $customer_planning_verify_file = '';
+ // 客戶計劃圖確認時間
+ $customer_planning_verify_at = '';
+ // 客戶計劃圖確認人
+ $customer_planning_verify_owner = '';
+
+ // 客戶顏色確認
+ $customer_color_verify = '';
+ // 客戶顏色附件
+ $customer_color_verify_file = '';
+ // 客戶顏色確認時間
+ $customer_color_verify_at = '';
+ // 客戶顏色確認人
+ $customer_color_verify_owner = '';
+
+ // 工勘聯絡表
+ $site_survey_contact_form_verify = '';
+ // 工勘聯絡表附件
+ $site_survey_contact_form_verify_file = '';
+ // 工勘聯絡表確認時間
+ $site_survey_contact_form_verify_at = '';
+ // 工勘聯絡表確認人
+ $site_survey_contact_form_verify_owner = '';
+
+ // 設計規格確認
+ $desin_spec_verify = '';
+ // 設計規格確認附件
+ $desin_spec_verify_file = '';
+ // 設計規格確認時間
+ $desin_spec_verify_at = '';
+ // 設計規格確認確認人
+ $desin_spec_verify_owner = '';
+
+ // 設計計劃圖確認
+ $desin_planning_verify = '';
+ // 設計計劃圖確認附件
+ $desin_planning_verify_file = '';
+ // 設計計劃圖確認時間
+ $desin_planning_verify_at = '';
+ // 設計計劃圖確認人
+ $desin_planning_verify_owner = '';
+
+ // 設計顏色確認
+ $desin_color_verify = '';
+ // 設計顏色確認附件
+ $desin_color_verify_file = '';
+ // 設計顏色確認時間
+ $desin_color_verify_at = '';
+ // 設計顏色確認人
+ $desin_color_verify_owner = '';
+
+ // 設計仕樣確認
+ $desin_style_verify = '';
+ // 設計仕樣確認附件
+ $desin_style_verify_file = '';
+ // 設計仕樣確認時間
+ $desin_style_verify_at = '';
+ // 設計仕樣確認人
+ $desin_style_verify_owner = '';
+
+ // 設計主管確認
+ $desin_leader_verify = '';
+ // 設計主管確認附件
+ $desin_leader_verify_file = '';
+ // 設計主管確認時間
+ $desin_leader_verify_at = '';
+ // 設計主管確認人
+ $desin_leader_verify_owner = '';
+
+ // 樓高通報
+ $building_heigh_verify = '';
+ // 樓高通報附件
+ $building_heigh_verify_file = '';
+ // 樓高通報時間
+ $building_heigh_verify_at = '';
+ // 樓高通報確認人
+ $building_heigh_verify_owner = '';
+
+ // 電氣發貨明細
+ $electrical_design_publish = '';
+ // 電氣資料發行時間
+ $electrical_design_publish_at = '';
+ // 電氣資料發行人
+ $electrical_design_publish_owner = '';
+
+ // 機械資料發行
+ $mechanical_design_publish = '';
+ // 機械資料發行時間
+ $mechanical_design_publish_at = '';
+ // 機械資料發行人
+ $mechanical_design_publish_owner = '';
+
+ // 電氣發貨明細
+ $electrical_shipping_date_publish = '';
+ // 電氣發貨明細時間
+ $electrical_shipping_date_publish_at = '';
+ // 電氣發貨明細發行人
+ $electrical_shipping_date_publish_owner = '';
+
+ // 機械發貨明細
+ $mechanical_shipping_date_publish = '';
+ // 機械發貨明細時間
+ $mechanical_shipping_date_publish_at = '';
+ // 機械發貨明細發行人
+ $mechanical_shipping_date_publish_owner = '';
+
+ // 下單日(普來特富)
+ $prattford_order_date = '';
+ // 預計發貨日(到港日)
+ $estimated_shipping_date = '';
+ // 發貨類別(A.全級發貨、G.欠件發貨)
+ $goods_type = '';
+ // 實際到貨日(到觀音廠日)
+ $actual_tofactory_date = '';
+ // 發貨確認人
+ $shipping_date_owner = '';
+ // 預計船期
+ $estimated_shipping_schedule_date = '';
+ // 實際到貨日(到港日)
+ $actual_arrival_date = '';
+ // 到貨確認人
+ $arrival_date_owner = '';
+
+ // 是否齊備
+ $shengguanok_status = '';
+ // 生管確認附件
+ $shengguanok_status_file = '';
+ // 已備齊時間
+ $shengguanok_status_at = '';
+ // 已備齊檢查人
+ $shengguanok_status_owner = '';
+
+ // 建立人
+ $creater = '';
+ // 建立時間
+ $create_at = '';
+
+
+ if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
+ // 預設新梯代碼 A
+ $contract_type = postCheck('contract_type', 'B');
+ // 汰改方案 B
+ $renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE);
+ // 合約號
+ $contractno = postCheck('contractno');
+ // 營業員ID
+ $salesid = postCheck('salesid');
+ // 工務人員ID
+ $warehouseid = postCheck('warehouseid');
+ // 客戶姓名
+ $custom = postCheck('custom');
+ // 工地負責人
+ $site_manager = postCheck('site_manager');
+ // 客戶id
+ $accountid = postCheck('accountid');
+ // 作番號
+ $facilityno = postCheck('facilityno');
+ // 作番號
+ $facility_temp_no = postCheck('facility_temp_no');
+ // 緯度
+ $latitude = postCheck('latitude');
+ // 經度
+ $longitude = postCheck('longitude');
+ // 載重
+ $weight = postCheck('weight');
+ // 人乘
+ $numberofpassenger = postCheck('numberofpassenger');
+ // 樓停
+ $numberofstop = postCheck('numberofstop');
+ // 樓層
+ $numberoffloor = postCheck('numberoffloor');
+ // 開門方式
+ $opentype = postCheck('opentype');
+ // 速度
+ $speed = postCheck('speed');
+ // 機型
+ $facility_kind = postCheck('facility_kind');
+ // 地址
+ $address = postCheck('address');
+ // 合約到貨日
+ $contract_arrival_date = postCheck('contract_arrival_date');
+ // 實際到貨日
+ $real_contract_arrival_date = postCheck('real_contract_arrival_date');
+
+ // 營業規格確認
+ $sales_spec_verify = postCheck('sales_spec_verify');
+ // 營業規格附件
+ $sales_spec_verify_file = postCheck('sales_spec_verify_file');
+ // 營業規格確認時間
+ $sales_spec_verify_at = postCheck('sales_spec_verify_at');
+ // 營業規格確認人
+ $sales_spec_verify_owner = postCheck('sales_spec_verify_owner');
+
+ // 客戶計劃圖確認
+ $customer_planning_verify = postCheck('customer_planning_verify');
+ // 客戶計劃圖附件
+ $customer_planning_verify_file = postCheck('customer_planning_verify_file');
+ // 客戶計劃圖確認時間
+ $customer_planning_verify_at = postCheck('customer_planning_verify_at');
+ // 客戶計劃圖確認人
+ $customer_planning_verify_owner = postCheck('customer_planning_verify_owner');
+
+ // 客戶顏色確認
+ $customer_color_verify = postCheck('customer_color_verify');
+ // 客戶顏色附件
+ $customer_color_verify_file = postCheck('customer_color_verify_file');
+ // 客戶顏色確認時間
+ $customer_color_verify_at = postCheck('customer_color_verify_at');
+ // 客戶顏色確認人
+ $customer_color_verify_owner = postCheck('customer_color_verify_owner');
+
+ // 工勘聯絡表
+ $site_survey_contact_form_verify = postCheck('site_survey_contact_form_verify');
+ // 工勘聯絡表附件
+ $site_survey_contact_form_verify_file = postCheck('site_survey_contact_form_verify_file');
+ // 工勘聯絡表確認時間
+ $site_survey_contact_form_verify_at = postCheck('site_survey_contact_form_verify_at');
+ // 工勘聯絡表確認人
+ $site_survey_contact_form_verify_owner = postCheck('site_survey_contact_form_verify_owner');
+
+ // 設計規格確認
+ $desin_spec_verify = postCheck('desin_spec_verify');
+ // 設計規格確認附件
+ $desin_spec_verify_file = postCheck('desin_spec_verify_file');
+ // 設計規格確認時間
+ $desin_spec_verify_at = postCheck('desin_spec_verify_at');
+ // 設計規格確認確認人
+ $desin_spec_verify_owner = postCheck('desin_spec_verify_owner');
+
+ // 設計計劃圖確認
+ $desin_planning_verify = postCheck('desin_planning_verify');
+ // 設計計劃圖確認附件
+ $desin_planning_verify_file = postCheck('desin_planning_verify_file');
+ // 設計計劃圖確認時間
+ $desin_planning_verify_at = postCheck('desin_planning_verify_at');
+ // 設計計劃圖確認人
+ $desin_planning_verify_owner = postCheck('desin_planning_verify_owner');
+
+ // 設計顏色確認
+ $desin_color_verify = postCheck('desin_color_verify');
+ // 設計顏色確認附件
+ $desin_color_verify_file = postCheck('desin_color_verify_file');
+ // 設計顏色確認時間
+ $desin_color_verify_at = postCheck('desin_color_verify_at');
+ // 設計顏色確認人
+ $desin_color_verify_owner = postCheck('desin_color_verify_owner');
+
+ // 設計仕樣確認
+ $desin_style_verify = postCheck('desin_style_verify');
+ // 設計仕樣確認附件
+ $desin_style_verify_file = postCheck('desin_style_verify_file');
+ // 設計仕樣確認時間
+ $desin_style_verify_at = postCheck('desin_style_verify_at');
+ // 設計仕樣確認人
+ $desin_style_verify_owner = postCheck('desin_style_verify_owner');
+
+ // 設計主管確認
+ $desin_leader_verify = postCheck('desin_leader_verify');
+ // 設計主管確認附件
+ $desin_leader_verify_file = postCheck('desin_leader_verify_file');
+ // 設計主管確認時間
+ $desin_leader_verify_at = postCheck('desin_leader_verify_at');
+ // 設計主管確認人
+ $desin_leader_verify_owner = postCheck('desin_leader_verify_owner');
+
+ // 樓高通報
+ $building_heigh_verify = postCheck('building_heigh_verify');
+ // 樓高通報附件
+ $building_heigh_verify_file = postCheck('building_heigh_verify_file');
+ // 樓高通報時間
+ $building_heigh_verify_at = postCheck('building_heigh_verify_at');
+ // 樓高通報確認人
+ $building_heigh_verify_owner = postCheck('building_heigh_verify_owner');
+
+ // 電氣發貨明細
+ $electrical_design_publish = postCheck('electrical_design_publish');
+ // 電氣資料發行時間
+ $electrical_design_publish_at = postCheck('electrical_design_publish_at');
+ // 電氣資料發行人
+ $electrical_design_publish_owner = postCheck('electrical_design_publish_owner');
+
+ // 機械資料發行
+ $mechanical_design_publish = postCheck('mechanical_design_publish');
+ // 機械資料發行時間
+ $mechanical_design_publish_at = postCheck('mechanical_design_publish_at');
+ // 機械資料發行人
+ $mechanical_design_publish_owner = postCheck('mechanical_design_publish_owner');
+
+ // 電氣發貨明細
+ $electrical_shipping_date_publish = postCheck('electrical_shipping_date_publish');
+ // 電氣發貨明細時間
+ $electrical_shipping_date_publish_at = postCheck('electrical_shipping_date_publish_at');
+ // 電氣發貨明細發行人
+ $electrical_shipping_date_publish_owner = postCheck('electrical_shipping_date_publish_owner');
+
+ // 機械發貨明細
+ $mechanical_shipping_date_publish = postCheck('mechanical_shipping_date_publish');
+ // 機械發貨明細時間
+ $mechanical_shipping_date_publish_at = postCheck('mechanical_shipping_date_publish_at');
+ // 機械發貨明細發行人
+ $mechanical_shipping_date_publish_owner = postCheck('mechanical_shipping_date_publish_owner');
+
+ // 普來特富(下單日)
+ $prattford_order_date = postCheck('prattford_order_date');
+ // 預計發貨日(到港日)
+ $estimated_shipping_date = postCheck('estimated_shipping_date');
+ // 發貨類別(A.全級發貨、G.欠件發貨)
+ $goods_type = postCheck('goods_type');
+ // 實際到貨日(到觀音廠日)
+ $actual_tofactory_date = postCheck('actual_tofactory_date');
+ // 發貨確認人
+ $shipping_date_owner = postCheck('shipping_date_owner');
+ // 預計船期
+ $estimated_shipping_schedule_date = postCheck('estimated_shipping_schedule_date');
+ // 實際到貨日(到港日)
+ $actual_arrival_date = postCheck('actual_arrival_date');
+ // 到貨確認人
+ $arrival_date_owner = postCheck('arrival_date_owner');
+
+ // 是否齊備
+ $shengguanok_status = postCheck('shengguanok_status');
+ // 生管確認附件
+ $shengguanok_status_file = postCheck('shengguanok_status_file');
+ // 已備齊時間
+ $shengguanok_status_at = postCheck('shengguanok_status_at');
+ // 已備齊檢查人
+ $shengguanok_status_owner = postCheck('shengguanok_status_owner');
+
+ // QC與官檢種類
+ $qc_official_type = postCheck('qc_official_type');
+
+ // 建立人
+ $creater = postCheck('creater');
+ // 建立時間
+ $create_at = date("Y-m-d H:i:s");
+
+ //插入數據庫數據 gary_version
+ $insertsql = "
+ INSERT INTO wipwholestatus (
+ contract_type,
+ renovate_type,
+ contractno,
+ salesid,
+ custom,
+ site_manager,
+ accountid,
+ facilityno,
+ facility_temp_no,
+ latitude,
+ longitude,
+ weight,
+ numberofpassenger,
+ numberofstop,
+ numberoffloor,
+ opentype,
+ speed,
+ facility_kind,
+ address,
+ contract_arrival_date,
+ real_contract_arrival_date,
+ sales_spec_verify,
+ sales_spec_verify_file,
+ sales_spec_verify_at,
+ sales_spec_verify_owner,
+ customer_planning_verify,
+ customer_planning_verify_file,
+ customer_planning_verify_at,
+ customer_planning_verify_owner,
+ customer_color_verify,
+ customer_color_verify_file,
+ customer_color_verify_at,
+ customer_color_verify_owner,
+ site_survey_contact_form_verify,
+ site_survey_contact_form_verify_file,
+ site_survey_contact_form_verify_at,
+ site_survey_contact_form_verify_owner,
+ desin_spec_verify,
+ desin_spec_verify_file,
+ desin_spec_verify_at,
+ desin_spec_verify_owner,
+ desin_planning_verify,
+ desin_planning_verify_file,
+ desin_planning_verify_at,
+ desin_planning_verify_owner,
+ desin_color_verify,
+ desin_color_verify_file,
+ desin_color_verify_at,
+ desin_color_verify_owner,
+ desin_style_verify,
+ desin_style_verify_file,
+ desin_style_verify_at,
+ desin_style_verify_owner,
+ desin_leader_verify,
+ desin_leader_verify_file,
+ desin_leader_verify_at,
+ desin_leader_verify_owner,
+ building_heigh_verify,
+ building_heigh_verify_file,
+ building_heigh_verify_at,
+ building_heigh_verify_owner,
+ electrical_design_publish,
+ electrical_design_publish_at,
+ electrical_design_publish_owner,
+ mechanical_design_publish,
+ mechanical_design_publish_at,
+ mechanical_design_publish_owner,
+ electrical_shipping_date_publish,
+ electrical_shipping_date_publish_at,
+ electrical_shipping_date_publish_owner,
+ mechanical_shipping_date_publish,
+ mechanical_shipping_date_publish_at,
+ mechanical_shipping_date_publish_owner,
+ prattford_order_date,
+ estimated_shipping_date,
+ goods_type,
+ actual_tofactory_date,
+ shipping_date_owner,
+ estimated_shipping_schedule_date,
+ actual_arrival_date,
+ arrival_date_owner,
+ shengguanok_status,
+ shengguanok_status_file,
+ shengguanok_status_at,
+ shengguanok_status_owner,
+ qc_official_type,
+ creater,
+ create_at
+ ) VALUES (
+ '$contract_type',
+ '$renovate_type',
+ '$contractno',
+ '$salesid',
+ '$custom',
+ '$site_manager',
+ '$accountid',
+ '$facilityno',
+ '$facility_temp_no',
+ '$latitude',
+ '$longitude',
+ '$weight',
+ '$numberofpassenger',
+ '$numberofstop',
+ '$numberoffloor',
+ '$opentype',
+ '$speed',
+ '$facility_kind',
+ '$address',
+ '$contract_arrival_date',
+ '$real_contract_arrival_date',
+ '$sales_spec_verify',
+ '$sales_spec_verify_file',
+ '$sales_spec_verify_at',
+ '$sales_spec_verify_owner',
+ '$customer_planning_verify',
+ '$customer_planning_verify_file',
+ '$customer_planning_verify_at',
+ '$customer_planning_verify_owner',
+ '$customer_color_verify',
+ '$customer_color_verify_file',
+ '$customer_color_verify_at',
+ '$customer_color_verify_owner',
+ '$site_survey_contact_form_verify',
+ '$site_survey_contact_form_verify_file',
+ '$site_survey_contact_form_verify_at',
+ '$site_survey_contact_form_verify_owner',
+ '$desin_spec_verify',
+ '$desin_spec_verify_file',
+ '$desin_spec_verify_at',
+ '$desin_spec_verify_owner',
+ '$desin_planning_verify',
+ '$desin_planning_verify_file',
+ '$desin_planning_verify_at',
+ '$desin_planning_verify_owner',
+ '$desin_color_verify',
+ '$desin_color_verify_file',
+ '$desin_color_verify_at',
+ '$desin_color_verify_owner',
+ '$desin_style_verify',
+ '$desin_style_verify_file',
+ '$desin_style_verify_at',
+ '$desin_style_verify_owner',
+ '$desin_leader_verify',
+ '$desin_leader_verify_file',
+ '$desin_leader_verify_at',
+ '$desin_leader_verify_owner',
+ '$building_heigh_verify',
+ '$building_heigh_verify_file',
+ '$building_heigh_verify_at',
+ '$building_heigh_verify_owner',
+ '$electrical_design_publish',
+ '$electrical_design_publish_at',
+ '$electrical_design_publish_owner',
+ '$mechanical_design_publish',
+ '$mechanical_design_publish_at',
+ '$mechanical_design_publish_owner',
+ '$electrical_shipping_date_publish',
+ '$electrical_shipping_date_publish_at',
+ '$electrical_shipping_date_publish_owner',
+ '$mechanical_shipping_date_publish',
+ '$mechanical_shipping_date_publish_at',
+ '$mechanical_shipping_date_publish_owner',
+ '$prattford_order_date',
+ '$estimated_shipping_date',
+ '$goods_type',
+ '$actual_tofactory_date',
+ '$shipping_date_owner',
+ '$estimated_shipping_schedule_date',
+ '$actual_arrival_date',
+ '$arrival_date_owner',
+ '$shengguanok_status',
+ '$shengguanok_status_file',
+ '$shengguanok_status_at',
+ '$shengguanok_status_owner',
+ '$qc_official_type',
+ '$creater',
+ '$create_at'
+ )
+ ";
+ // 檢查作番號是否重複
+ if (checkFacilitynoRepeat($link, $facilityno)) {
+ echo "
+
+ ";
+ } else {
+ mysqli_query($link, $insertsql);
+ $last_form_id = mysqli_insert_id($link);
+ // 寫入待簽程狀態 A (工務)
+ do_wws2_assign($warehouseid, $last_form_id, 'A');
+ echo "
+
+ ";
+ }
+ }
+
+ // 開門方式 select => options
+ $sql = "
+ SELECT
+ code_name AS val ,
+ content AS label
+ FROM code F
+ WHERE field_name='open_kind'
+ ORDER BY label ASC
+ ";
+ $opendoor_options = mysqli_query($link, $sql);
+
+ // 所有營業員 select => options
+ $sql = "
+ SELECT
+ accountid AS val ,
+ name AS label
+ FROM account
+ WHERE department_id IN ('311','312','313','314','315','511','512','513','514')
+ ORDER BY label ASC
+ ";
+ $sales_options = mysqli_query($link, $sql);
+
+ // 所有工務人員 select => options
+ $sql = "
+ SELECT
+ accountid AS val ,
+ name AS label
+ FROM account
+ WHERE department_id IN ('521')
+ AND role_id IN ('3','4','5')
+ UNION
+ SELECT
+ accountid AS val ,
+ name AS label
+ FROM account
+ WHERE department_id IN ('531')
+ AND role_id IN ('1')
+ UNION
+ SELECT
+ accountid AS val ,
+ name AS label
+ FROM account
+ WHERE department_id IN ('521','531','541','542','543','544','545')
+ ORDER BY label ASC
+ ";
+ $warehouse_options = mysqli_query($link, $sql);
+
+?>
+
+
+
+
\ No newline at end of file
diff --git a/wms/wipwhole-wipinstallstatus-index.php b/wms/wipwhole-wipinstallstatus-index.php
index a7756b7f..7f39cad1 100644
--- a/wms/wipwhole-wipinstallstatus-index.php
+++ b/wms/wipwhole-wipinstallstatus-index.php
@@ -1,22 +1,6 @@
num_rows;
-$Adata = $result->fetch_all(MYSQLI_ASSOC);
-
-// 新梯-在裝台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'A'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND (
- delivery_date IS NULL
- OR delivery_date = ''
- )AND (
- official_check_date IS NULL
- OR official_check_date = ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$Adata2 = $result->fetch_all(MYSQLI_ASSOC);
-
-// 新梯-工收台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'A'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND ((
- delivery_date IS NOT NULL
- AND delivery_date != ''
- )OR (
- official_check_date IS NOT NULL
- AND official_check_date != ''
- ))
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$Adata3 = $result->fetch_all(MYSQLI_ASSOC);
-
-
-// M1-出貨台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'B'
- AND renovate_type like '%M1%'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$M1data = $result->fetch_all(MYSQLI_ASSOC);
-
-// M1-在裝台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'B'
- AND renovate_type like '%M1%'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND (
- delivery_date IS NULL
- OR delivery_date = ''
- )AND (
- official_check_date IS NULL
- OR official_check_date = ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$M1data2 = $result->fetch_all(MYSQLI_ASSOC);
-
-// M1-工收台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'B'
- AND renovate_type like '%M1%'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND ((
- delivery_date IS NOT NULL
- AND delivery_date != ''
- )OR (
- official_check_date IS NOT NULL
- AND official_check_date != ''
- ))
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$M1data3 = $result->fetch_all(MYSQLI_ASSOC);
-
-
-// MA-出貨台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'B'
- AND renovate_type like '%MA%'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$Madata = $result->fetch_all(MYSQLI_ASSOC);
-
-// MA-在裝台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'B'
- AND renovate_type like '%MA%'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND (
- delivery_date IS NULL
- OR delivery_date = ''
- )AND (
- official_check_date IS NULL
- OR official_check_date = ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$Madata2 = $result->fetch_all(MYSQLI_ASSOC);
-
-// MA-工收台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND contract_type = 'B'
- AND renovate_type like '%MA%'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND ((
- delivery_date IS NOT NULL
- AND delivery_date != ''
- )OR (
- official_check_date IS NOT NULL
- AND official_check_date != ''
- ))
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$Madata3 = $result->fetch_all(MYSQLI_ASSOC);
-
-
-// 合計-出貨台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$data = $result->fetch_all(MYSQLI_ASSOC);
-
-// 合計-在裝台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND (
- delivery_date IS NULL
- OR delivery_date = ''
- )AND (
- official_check_date IS NULL
- OR official_check_date = ''
- )
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$data2 = $result->fetch_all(MYSQLI_ASSOC);
-
-// 合計-工收台數
-$sql = "
- SELECT
- SUBSTR(real_arrival_date,1,4) AS year,
- SUBSTR(real_arrival_date,6,2) AS month,
- COUNT(real_arrival_date) AS all_count
- FROM wipwholestatus
- WHERE status = '1'
- AND (
- real_arrival_date IS NOT NULL
- AND real_arrival_date != ''
- )AND ((
- delivery_date IS NOT NULL
- AND delivery_date != ''
- )OR (
- official_check_date IS NOT NULL
- AND official_check_date != ''
- ))
- GROUP BY year, month
-";
-$result = mysqli_query($link, $sql);
-$data_count = $result->num_rows;
-$data3 = $result->fetch_all(MYSQLI_ASSOC);
+// 出貨台數
+function getShipping($type, $mtype, $radsY, $radsM, $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 '$radsY-$radsM-01' AND '$year-$month-31'
+ ";
+ $sql .= !empty($type) ? " AND contract_type = '$type'" : "";
+ $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
+ // echo $sql . "
";
+ $result = mysqli_query($link, $sql);
+ $data = mysqli_fetch_array($result, MYSQLI_ASSOC);
+ return $data['all_count'];
+}
+
+// 試車完台數
+function getInstalling($type, $mtype, $radsY, $radsM, $year, $month)
+{
+ global $link;
+ $sql = "
+ SELECT
+ count(*) AS all_count
+ -- real_arrival_date,
+ -- tryrun_end_date
+ FROM wipwholestatus
+ WHERE status = '1'
+ AND (
+ real_arrival_date IS NOT NULL
+ AND real_arrival_date != ''
+ )
+ AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
+ AND tryrun_end_date <= '$year-$month-31'
+ AND tryrun_end_date != ''
+ AND tryrun_end_date IS NOT NULL
+ ";
+ $sql .= !empty($type) ? " AND contract_type = '$type'" : "";
+ $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
+ // echo $sql."
";
+ $result = mysqli_query($link, $sql);
+ $data = mysqli_fetch_array($result, MYSQLI_ASSOC);
+ return $data['all_count'];
+}
+
+
+// 工收台數
+function getEnding($type, $mtype, $radsY, $radsM, $year, $month)
+{
+ global $link;
+ $sql = "
+ SELECT
+ count(
+ *
+ ) AS all_count
+ -- real_arrival_date,
+ -- delivery_date,
+ -- official_check_date
+ FROM wipwholestatus
+ WHERE status = '1'
+ AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
+ AND (delivery_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
+ OR
+ official_check_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
+ )
+ ";
+ $sql .= !empty($type) ? " AND contract_type = '$type'" : "";
+ $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
+ // echo $sql . "
";
+ $result = mysqli_query($link, $sql);
+ $data = mysqli_fetch_array($result, MYSQLI_ASSOC);
+ return $data['all_count'];
+}
+
+// 在裝中台數
+function getInstalling2($type, $mtype, $radsY, $radsM, $year, $month)
+{
+ global $link;
+ $sql = "
+ SELECT
+ count(*) AS all_count
+ -- delivery_date,
+ -- official_check_date
+ FROM wipwholestatus
+ WHERE status = '1'
+ AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
+ AND (
+ delivery_date IS NULL
+ OR delivery_date = ''
+ OR delivery_date >= '$year-$month-31'
+ )
+ AND(
+ official_check_date IS NULL
+ OR official_check_date = ''
+ OR official_check_date >= '$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'];
+}
+
+
?>