@@ -453,11 +448,11 @@ if (!empty($_GET['apply_key'])) {
const totalInstallPrice = ;
const totalBuyPrice = ;
// const secondPayDeadline = ;
- // const buyfill1 = ;
+ const buyfill1 = ;
// const installfill1 = "";
// const installfill2 = "";
- // const buyArr = [...];
- // const installArr = [...];
+ const buyArr = [...];
+ const installArr = [...];
let install_pay_text = '付款方式:
';
let buy_pay_text = ''
const chineseArr = ['零', '一', '二', '三', '四', '五', '六', '七']
diff --git a/wms/contract-repair/js/alpine.js b/wms/contract-repair/js/alpine.js
index 06d5dc7b..8ab51dfd 100644
--- a/wms/contract-repair/js/alpine.js
+++ b/wms/contract-repair/js/alpine.js
@@ -6,6 +6,8 @@ const contractDownload = () => {
this.buystandarData = this.deepClone(this.buydata);
this.buyonstandardViewData = this.deepClone(this.buydata);
},
+ buyfill1: buyfill1,
+
css: `table { background - color: #fff; border: none; margin - top: 30px; font - family: '標楷體'; width: 600px; } table tr: nth - child(even), table tr: nth - child(odd) { background - color: #fff; } table tr { font - size: 12pt; width: 100 %; } table tr h2 { font - size: 18pt; } table tr td { width: 100 %; height: 100 %; line - height: 2; display: flex; } table tr td.center { display: flex; justify - content: center; align - items: center; } table tr td.list { width: 100 %; height: 100 %; white - space: nowrap; display: flex; } table tr td.list span { width: 60px; min - height: 100 %; display: block; } table tr td.list > p { display: block; text - align: justify; } table tr td.list div { max - width: calc(100 % - 60px); white - space: normal; } table tr td.list div.text - justify { display: flex; width: 100 %; justify - content: space - between; } table tr.date td > div { width: 100 %; text - align: right; } table tr.date td > div.text - justify { display: flex; justify - content: space - between; } table td, table th { padding: 8px; }`,
data: {
illustrate: {
@@ -45,6 +47,22 @@ const contractDownload = () => {
]
}
},
+ deepClone: function (obj) {
+ let clone = Array.isArray(obj) ? [] : {};
+ for (let key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
+ clone[key] = this.deepClone(obj[key]);
+ if (clone[key].text != undefined) {
+
+ } else {
+ clone[key] = obj[key];
+ }
+ }
+ }
+ }
+ return clone;
+ },
buydata: {
},
@@ -129,7 +147,22 @@ const contractDownload = () => {
return;
}
- }
+ },
+ isBuyShow: true,
+ sendBuyInputFn() {
+ if (this.buyfilt1 == '') {
+ alert('請輸入交貨期限');
+ return;
+ }
+ if (this.buyfilt1 < 1) {
+ alert('交貨日期不得低於1日');
+ return;
+ }
+ if (buyArr[1].installment == 2) {
+
+ }
+ },
+ isBuyInputIng: true,
}
};
diff --git a/wms/contract/api/getFacilityNo.php b/wms/contract/api/getFacilityNo.php
index fcf0b76f..55df3c57 100644
--- a/wms/contract/api/getFacilityNo.php
+++ b/wms/contract/api/getFacilityNo.php
@@ -1,518 +1,518 @@
- 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:保養
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
- * @param int $num : 號機
- * @return array $new_facility_arr
- */
- function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1)
- {
- $this->checkYearAndResetAllSeq();
- $Y = substr(date("Y"), 3, 1);
-
- switch ($facility_type) {
- case "M":
- $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1;
- $new_facility_arr = [];
- for ($start_num = 1; $start_num <= $num; $start_num++) {
- $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1]
- . str_pad($next_seq, 5, "0", STR_PAD_LEFT);
- array_push($new_facility_arr, $facility_no_tmp);
- $next_seq++;
- }
- return $new_facility_arr;
- case "T":
- $next_seq = $this->getNextFacilitySeq("tf_vol_no");
- $new_facility_arr = [];
- for ($start_num = 1; $start_num <= $num; $start_num++) {
- $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1]
- . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
- . str_pad($start_num, 2, "0", STR_PAD_LEFT);
- array_push($new_facility_arr, $facility_no_tmp);
- }
- return $new_facility_arr;
- case "B":
- $next_seq = $this->getNextFacilitySeq("bf_vol_no");
- $new_facility_arr = [];
- for ($start_num = 1; $start_num <= $num; $start_num++) {
- $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1]
- . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
- . str_pad($start_num, 2, "0", STR_PAD_LEFT);
- array_push($new_facility_arr, $facility_no_tmp);
- }
- return $new_facility_arr;
- default:
- return "不存在的作番類型";
- }
- }
-
- /**
- * 建立新的作番
- * @param string $facility_type : M:新梯 T:汰改 B:保養
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
- * @param string $num : 號機 (非必填)
- * @return string $new_facility_no
- */
- function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null)
- {
-
- $this->checkYearAndResetAllSeq();
-
- $faclikity_details = array(
- 'facility_type' => $facility_type,
- 'sale_type' => $sale_type,
- 'make_type' => $make_type,
- 'num' => $num
- );
-
- switch ($facility_type) {
- case "M":
- return $this->makeNewMFacilityNo($faclikity_details);
- break;
- case "T":
- return $this->makeNewTFacilityNo($faclikity_details);
- break;
- case "B":
- return $this->makeNewBFacilityNo($faclikity_details);
- break;
- default:
- return "不存在的作番類型";
- }
- }
-
- /**
- * 建立作番 -- 新梯
- */
- function makeNewMFacilityNo($faclikity_details)
- {
- $Y = substr(date("Y"), 3, 1);
- $sale_type = $faclikity_details['sale_type'];
- $make_type = $faclikity_details['make_type'];
- $num = $faclikity_details['num'];
- $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1;
- $new_facility_no_arr = [];
-
- for ($i = 1; $i <= $num; $i++) {
- $new_facility_no = $Y . $sale_type . $make_type[$i - 1]
- . str_pad($next_seq, 5, "0", STR_PAD_LEFT);
- array_push($new_facility_no_arr, $new_facility_no);
- $next_seq++;
- }
-
- foreach ($new_facility_no_arr as $new_facility_no) {
- if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") {
- return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
- }
- // seq +1
- $this->facilitySeqAddOne("M");
- }
- return $new_facility_no_arr;
- }
-
- /**
- * 建立作番 -- 汰改
- */
- function makeNewTFacilityNo($faclikity_details)
- {
-
- $Y = substr(date("Y"), 3, 1);
- $sale_type = $faclikity_details['sale_type'];
- $make_type = $faclikity_details['make_type'];
- $num = $faclikity_details['num'];
- $next_seq = $this->getNextFacilitySeq("tf_vol_no");
- $new_facility_no_arr = [];
-
- for ($i = 1; $i <= $num; $i++) {
- $new_facility_no = $Y . $sale_type . $make_type[$i - 1]
- . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
- . str_pad($i, 2, "0", STR_PAD_LEFT);
- array_push($new_facility_no_arr, $new_facility_no);
- }
-
- foreach ($new_facility_no_arr as $new_facility_no) {
- if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") {
- return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
- }
- // seq +1
- $this->facilitySeqAddOne("T");
- return $new_facility_no_arr;
- }
- }
-
- /**
- * 建立作番 -- 保養
- */
- function makeNewBFacilityNo($faclikity_details)
- {
-
- $Y = substr(date("Y"), 3, 1);
- $sale_type = $faclikity_details['sale_type'];
- $make_type = $faclikity_details['make_type'];
- $num = $faclikity_details['num'];
- $next_seq = $this->getNextFacilitySeq("bf_vol_no");
- $new_facility_no_arr = [];
-
- for ($i = 1; $i <= $num; $i++) {
- $new_facility_no = $Y . $sale_type . $make_type[$i - 1]
- . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
- . str_pad($i, 2, "0", STR_PAD_LEFT);
- array_push($new_facility_no_arr, $new_facility_no);
- }
-
- foreach ($new_facility_no_arr as $new_facility_no) {
- if ($this->getMakeNewBFacilityNoStatus($faclikity_details) !== "1") {
- return $new_facility_no . ":" . $this->getMakeNewBFacilityNoStatus($faclikity_details);
- }
- // seq +1
- $this->facilitySeqAddOne("B");
- return $new_facility_no_arr;
- }
- }
-
- /**
- * 檢查作番編列狀態 - 新梯
- * @param array $faclikity_details
- * @return string $status : 1:正確 else:error message
- */
- function getMakeNewMFacilityNoStatus($faclikity_details)
- {
- $sale_type = $faclikity_details['sale_type'];
- $make_type = $faclikity_details['make_type'];
-
- if ($this->checkSaleTypeStatus($sale_type) == false)
- return "銷售代號錯誤";
- if ($this->checkMakeTypeStatus($make_type) == false)
- return "製造編號類型錯誤";
- return "1";
- }
-
- /**
- * 檢查作番編列狀態 - 汰改
- * @param array $faclikity_details
- * @return string $status : 1:正確 else:error message
- */
- function getMakeNewTFacilityNoStatus($faclikity_details)
- {
- $sale_type = $faclikity_details['sale_type'];
- $make_type = $faclikity_details['make_type'];
-
- if ($this->checkSaleTypeStatus($sale_type) == false)
- return "銷售代號錯誤";
- if ($this->checkMakeTypeStatus($make_type) == false)
- return "製造編號類型錯誤";
- return "1";
- }
-
- /**
- * 檢查作番編列狀態 - 保養
- * @param array $faclikity_details
- * @return string $status : 1:正確 else:error message
- */
- function getMakeNewBFacilityNoStatus($faclikity_details)
- {
- $sale_type = $faclikity_details['sale_type'];
- $make_type = $faclikity_details['make_type'];
-
- if ($this->checkSaleTypeStatus($sale_type) == false)
- return "銷售代號錯誤";
- if ($this->checkMakeTypeStatus($make_type) == false)
- return "製造編號類型錯誤";
- return "1";
- }
-
- /**
- * seq 取號
- * @param string $type M:新梯 T:汰改 B:保養
- */
- function facilitySeqAddOne($type)
- {
- $type_arr = array(
- "M" => "mf_vol_no",
- "T" => "tf_vol_no",
- "B" => "bf_vol_no",
- );
- if (!empty($type_arr[$type])) {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?');
- $sth->bindValue(1, $type_arr[$type]);
- $sth->execute();
- }
- }
-
- /**
- * 修正 seq 取號
- * @param string $type M:新梯 T:汰改 B:保養
- */
- function facilityFixSeq($type)
- {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $type_arr = array(
- "M" => "mf_vol_no",
- "T" => "tf_vol_no",
- "B" => "bf_vol_no",
- );
- $after_fix_seq = $this->getMaxSeq($type);
- $sql = "
- UPDATE sequence
- SET current_val = ?
- WHERE seq_name = ?
- ";
- $sth = $pdo->prepare($sql);
- $sth->bindValue(1, $after_fix_seq);
- $sth->bindValue(2, $type_arr[$type]);
- $sth->execute();
- }
-
- function getMaxSeq($type)
- {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $Y = substr(date("Y"), 3, 1);
- $seq_num = $type == 'M' ? 5 : 3;
- $sql = "
- SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq
- FROM facility AS f
- WHERE 1=1
- AND SUBSTR(f.facilityno,1,1) = ?
- AND f.define = ?
- ORDER BY SUBSTR(f.facilityno,4,3) ASC
- ";
- $sth = $pdo->prepare($sql);
- $sth->bindValue(1, $seq_num);
- $sth->bindValue(2, $Y);
- $sth->bindValue(3, $type);
- $sth->execute();
- $result = $sth->fetch();
- return $result['seq'];
- }
-
- /**
- * 檢查年月後 新梯及汰改seq歸零
- */
- function checkYearAndResetAllSeq()
- {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?');
- $sth->bindValue(1, 'mf_vol_no');
- $sth->execute();
- $result = $sth->fetch();
- $yyyymm = $result['yyyymm'];
- $dataY = substr($yyyymm, 0, 4);
- $today_Y = date("Y");
- $today_Ym = date("Ym");
- if ($dataY != $today_Y) {
- $sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?');
- $sth->bindValue(1, '0');
- $sth->bindValue(2, $today_Ym);
- $sth->bindValue(3, 'mf_vol_no');
- $sth->execute();
- }
- }
-
- /**
- * 檢查作番在 facility table 中是否重複
- * @param string|array $facility_no
- * @return boolean $status : true:沒重複 false:重複
- */
- function checkFacilityRepeatStatus($facility_no)
- {
- if (gettype($facility_no) == "string") {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?');
- $sth->bindValue(1, $facility_no);
- $sth->execute();
- if ($sth->rowCount() == 0)
- return true;
- return false;
- }
- if (gettype($facility_no) == "array") {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $status = true;
- foreach ($facility_no as $row) {
- $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?');
- $sth->bindValue(1, $row);
- $sth->execute();
- if ($sth->rowCount() !== 0)
- $status = false;
- }
- return $status;
- }
- }
-
- /**
- * 檢查 $sale_type 是否有存在規則之中
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @return boolean $status : true:合法代碼 false:非法代碼
- */
- function checkSaleTypeStatus($sale_type)
- {
-
- if (!in_array($sale_type, ['M', 'E', 'T', 'J', 'X']))
- return false;
- return true;
- }
-
- /**
- * 檢查 $sale_type 是否有存在規則之中
- * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
- * @return boolean $status : true:合法代碼 false:非法代碼
- */
- function checkMakeTypeStatus($make_type)
- {
- foreach ($make_type as $row)
- if (!in_array($row, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y']))
- return false;
- return true;
- }
-
- /**
- * 檢查 取得下個作番的 seq
- * @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no
- * @return int $seq : 作番流水號
- */
- function getNextFacilitySeq($seq_name)
- {
- $pdo = $this->connectionDB();
- $pdo->exec('SET CHARACTER SET utf8mb4');
- $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?');
- $sth->bindValue(1, $seq_name);
- $sth->execute();
- $result = $sth->fetch();
- return $result['current_val'];
- }
-
- /**
- * 建立新的新梯作番
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
- * @param int $seq_name : 幾個案場 0-99
- * @return array $new_facilityno : 作番號
- */
- function makeMFacilityNo($sale_type, $make_type, $num)
- {
- if (count($make_type) !== $num)
- return "陣列數量不一致!";
- $new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num);
- if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
- // 如果作番號重複 使用此函數修正
- $this->facilityFixSeq("M");
- }
- return $this->makeFacilityNo("M", $sale_type, $make_type, $num);
- }
-
- /**
- * 建立新的汰改作番
- * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
- * @param int $seq_name : 幾個案場 0-99
- * @return array $new_facilityno : 作番號
- */
- function makeTFacilityNo($sale_type, $make_type, $num)
- {
- if (count($make_type) !== $num)
- return "陣列數量不一致!";
- $new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num);
- if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
- // 如果作番號重複 使用此函數修正
- $this->facilityFixSeq("T");
- }
- return $this->makeFacilityNo("T", $sale_type, $make_type, $num);
- }
-
- /**
- * 建立新的保養作番
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
- * @param int $seq_name : 幾個案場 0-99
- * @return array $new_facilityno : 作番號
- */
- function makeBFacilityNo($sale_type, $make_type, $num = 1)
- {
- if (count($make_type) !== $num)
- return "陣列數量不一致!";
- $new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num);
- if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
- // 如果作番號重複 使用此函數修正
- $this->facilityFixSeq("B");
- }
- return $this->makeFacilityNo("B", $sale_type, $make_type, $num);
- }
-}
-
-
-// $cfn = new CreateFacilityNo;
-// // 建立作番號 - 新梯
-// print_r($cfn->makeMFacilityNo("M", ["X", "W"], 2));
-// echo "
";
-// // 建立作番號 - 汰改
-// print_r($cfn->makeTFacilityNo("M", ["X", "W"], 2));
-// echo "
";
-// // 建立作番號 - 保養
-// print_r($cfn->makeBFacilityNo("M", ["X", "W"], 2));
-// echo "
";
+ 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:保養
+ * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param int $num : 號機
+ * @return array $new_facility_arr
+ */
+ function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1)
+ {
+ $this->checkYearAndResetAllSeq();
+ $Y = substr(date("Y"), 3, 1);
+
+ switch ($facility_type) {
+ case "M":
+ $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1;
+ $new_facility_arr = [];
+ for ($start_num = 1; $start_num <= $num; $start_num++) {
+ $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1]
+ . str_pad($next_seq, 5, "0", STR_PAD_LEFT);
+ array_push($new_facility_arr, $facility_no_tmp);
+ $next_seq++;
+ }
+ return $new_facility_arr;
+ case "T":
+ $next_seq = $this->getNextFacilitySeq("tf_vol_no");
+ $new_facility_arr = [];
+ for ($start_num = 1; $start_num <= $num; $start_num++) {
+ $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1]
+ . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
+ . str_pad($start_num, 2, "0", STR_PAD_LEFT);
+ array_push($new_facility_arr, $facility_no_tmp);
+ }
+ return $new_facility_arr;
+ case "B":
+ $next_seq = $this->getNextFacilitySeq("bf_vol_no");
+ $new_facility_arr = [];
+ for ($start_num = 1; $start_num <= $num; $start_num++) {
+ $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1]
+ . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
+ . str_pad($start_num, 2, "0", STR_PAD_LEFT);
+ array_push($new_facility_arr, $facility_no_tmp);
+ }
+ return $new_facility_arr;
+ default:
+ return "不存在的作番類型";
+ }
+ }
+
+ /**
+ * 建立新的作番
+ * @param string $facility_type : M:新梯 T:汰改 B:保養
+ * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param string $num : 號機 (非必填)
+ * @return string $new_facility_no
+ */
+ function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null)
+ {
+
+ $this->checkYearAndResetAllSeq();
+
+ $faclikity_details = array(
+ 'facility_type' => $facility_type,
+ 'sale_type' => $sale_type,
+ 'make_type' => $make_type,
+ 'num' => $num
+ );
+
+ switch ($facility_type) {
+ case "M":
+ return $this->makeNewMFacilityNo($faclikity_details);
+ break;
+ case "T":
+ return $this->makeNewTFacilityNo($faclikity_details);
+ break;
+ case "B":
+ return $this->makeNewBFacilityNo($faclikity_details);
+ break;
+ default:
+ return "不存在的作番類型";
+ }
+ }
+
+ /**
+ * 建立作番 -- 新梯
+ */
+ function makeNewMFacilityNo($faclikity_details)
+ {
+ $Y = substr(date("Y"), 3, 1);
+ $sale_type = $faclikity_details['sale_type'];
+ $make_type = $faclikity_details['make_type'];
+ $num = $faclikity_details['num'];
+ $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1;
+ $new_facility_no_arr = [];
+
+ for ($i = 1; $i <= $num; $i++) {
+ $new_facility_no = $Y . $sale_type . $make_type[$i - 1]
+ . str_pad($next_seq, 5, "0", STR_PAD_LEFT);
+ array_push($new_facility_no_arr, $new_facility_no);
+ $next_seq++;
+ }
+
+ foreach ($new_facility_no_arr as $new_facility_no) {
+ if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") {
+ return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
+ }
+ // seq +1
+ $this->facilitySeqAddOne("M");
+ }
+ return $new_facility_no_arr;
+ }
+
+ /**
+ * 建立作番 -- 汰改
+ */
+ function makeNewTFacilityNo($faclikity_details)
+ {
+
+ $Y = substr(date("Y"), 3, 1);
+ $sale_type = $faclikity_details['sale_type'];
+ $make_type = $faclikity_details['make_type'];
+ $num = $faclikity_details['num'];
+ $next_seq = $this->getNextFacilitySeq("tf_vol_no");
+ $new_facility_no_arr = [];
+
+ for ($i = 1; $i <= $num; $i++) {
+ $new_facility_no = $Y . $sale_type . $make_type[$i - 1]
+ . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
+ . str_pad($i, 2, "0", STR_PAD_LEFT);
+ array_push($new_facility_no_arr, $new_facility_no);
+ }
+
+ foreach ($new_facility_no_arr as $new_facility_no) {
+ if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") {
+ return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
+ }
+ // seq +1
+ $this->facilitySeqAddOne("T");
+ return $new_facility_no_arr;
+ }
+ }
+
+ /**
+ * 建立作番 -- 保養
+ */
+ function makeNewBFacilityNo($faclikity_details)
+ {
+
+ $Y = substr(date("Y"), 3, 1);
+ $sale_type = $faclikity_details['sale_type'];
+ $make_type = $faclikity_details['make_type'];
+ $num = $faclikity_details['num'];
+ $next_seq = $this->getNextFacilitySeq("bf_vol_no");
+ $new_facility_no_arr = [];
+
+ for ($i = 1; $i <= $num; $i++) {
+ $new_facility_no = $Y . $sale_type . $make_type[$i - 1]
+ . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
+ . str_pad($i, 2, "0", STR_PAD_LEFT);
+ array_push($new_facility_no_arr, $new_facility_no);
+ }
+
+ foreach ($new_facility_no_arr as $new_facility_no) {
+ if ($this->getMakeNewBFacilityNoStatus($faclikity_details) !== "1") {
+ return $new_facility_no . ":" . $this->getMakeNewBFacilityNoStatus($faclikity_details);
+ }
+ // seq +1
+ $this->facilitySeqAddOne("B");
+ return $new_facility_no_arr;
+ }
+ }
+
+ /**
+ * 檢查作番編列狀態 - 新梯
+ * @param array $faclikity_details
+ * @return string $status : 1:正確 else:error message
+ */
+ function getMakeNewMFacilityNoStatus($faclikity_details)
+ {
+ $sale_type = $faclikity_details['sale_type'];
+ $make_type = $faclikity_details['make_type'];
+
+ if ($this->checkSaleTypeStatus($sale_type) == false)
+ return "銷售代號錯誤";
+ if ($this->checkMakeTypeStatus($make_type) == false)
+ return "製造編號類型錯誤";
+ return "1";
+ }
+
+ /**
+ * 檢查作番編列狀態 - 汰改
+ * @param array $faclikity_details
+ * @return string $status : 1:正確 else:error message
+ */
+ function getMakeNewTFacilityNoStatus($faclikity_details)
+ {
+ $sale_type = $faclikity_details['sale_type'];
+ $make_type = $faclikity_details['make_type'];
+
+ if ($this->checkSaleTypeStatus($sale_type) == false)
+ return "銷售代號錯誤";
+ if ($this->checkMakeTypeStatus($make_type) == false)
+ return "製造編號類型錯誤";
+ return "1";
+ }
+
+ /**
+ * 檢查作番編列狀態 - 保養
+ * @param array $faclikity_details
+ * @return string $status : 1:正確 else:error message
+ */
+ function getMakeNewBFacilityNoStatus($faclikity_details)
+ {
+ $sale_type = $faclikity_details['sale_type'];
+ $make_type = $faclikity_details['make_type'];
+
+ if ($this->checkSaleTypeStatus($sale_type) == false)
+ return "銷售代號錯誤";
+ if ($this->checkMakeTypeStatus($make_type) == false)
+ return "製造編號類型錯誤";
+ return "1";
+ }
+
+ /**
+ * seq 取號
+ * @param string $type M:新梯 T:汰改 B:保養
+ */
+ function facilitySeqAddOne($type)
+ {
+ $type_arr = array(
+ "M" => "mf_vol_no",
+ "T" => "tf_vol_no",
+ "B" => "bf_vol_no",
+ );
+ if (!empty($type_arr[$type])) {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?');
+ $sth->bindValue(1, $type_arr[$type]);
+ $sth->execute();
+ }
+ }
+
+ /**
+ * 修正 seq 取號
+ * @param string $type M:新梯 T:汰改 B:保養
+ */
+ function facilityFixSeq($type)
+ {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $type_arr = array(
+ "M" => "mf_vol_no",
+ "T" => "tf_vol_no",
+ "B" => "bf_vol_no",
+ );
+ $after_fix_seq = $this->getMaxSeq($type);
+ $sql = "
+ UPDATE sequence
+ SET current_val = ?
+ WHERE seq_name = ?
+ ";
+ $sth = $pdo->prepare($sql);
+ $sth->bindValue(1, $after_fix_seq);
+ $sth->bindValue(2, $type_arr[$type]);
+ $sth->execute();
+ }
+
+ function getMaxSeq($type)
+ {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $Y = substr(date("Y"), 3, 1);
+ $seq_num = $type == 'M' ? 5 : 3;
+ $sql = "
+ SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq
+ FROM facility AS f
+ WHERE 1=1
+ AND SUBSTR(f.facilityno,1,1) = ?
+ AND f.define = ?
+ ORDER BY SUBSTR(f.facilityno,4,3) ASC
+ ";
+ $sth = $pdo->prepare($sql);
+ $sth->bindValue(1, $seq_num);
+ $sth->bindValue(2, $Y);
+ $sth->bindValue(3, $type);
+ $sth->execute();
+ $result = $sth->fetch();
+ return $result['seq'];
+ }
+
+ /**
+ * 檢查年月後 新梯及汰改seq歸零
+ */
+ function checkYearAndResetAllSeq()
+ {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?');
+ $sth->bindValue(1, 'mf_vol_no');
+ $sth->execute();
+ $result = $sth->fetch();
+ $yyyymm = $result['yyyymm'];
+ $dataY = substr($yyyymm, 0, 4);
+ $today_Y = date("Y");
+ $today_Ym = date("Ym");
+ if ($dataY != $today_Y) {
+ $sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?');
+ $sth->bindValue(1, '0');
+ $sth->bindValue(2, $today_Ym);
+ $sth->bindValue(3, 'mf_vol_no');
+ $sth->execute();
+ }
+ }
+
+ /**
+ * 檢查作番在 facility table 中是否重複
+ * @param string|array $facility_no
+ * @return boolean $status : true:沒重複 false:重複
+ */
+ function checkFacilityRepeatStatus($facility_no)
+ {
+ if (gettype($facility_no) == "string") {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?');
+ $sth->bindValue(1, $facility_no);
+ $sth->execute();
+ if ($sth->rowCount() == 0)
+ return true;
+ return false;
+ }
+ if (gettype($facility_no) == "array") {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $status = true;
+ foreach ($facility_no as $row) {
+ $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?');
+ $sth->bindValue(1, $row);
+ $sth->execute();
+ if ($sth->rowCount() !== 0)
+ $status = false;
+ }
+ return $status;
+ }
+ }
+
+ /**
+ * 檢查 $sale_type 是否有存在規則之中
+ * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @return boolean $status : true:合法代碼 false:非法代碼
+ */
+ function checkSaleTypeStatus($sale_type)
+ {
+
+ if (!in_array($sale_type, ['M', 'E', 'T', 'J', 'X']))
+ return false;
+ return true;
+ }
+
+ /**
+ * 檢查 $sale_type 是否有存在規則之中
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @return boolean $status : true:合法代碼 false:非法代碼
+ */
+ function checkMakeTypeStatus($make_type)
+ {
+ foreach ($make_type as $row)
+ if (!in_array($row, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y']))
+ return false;
+ return true;
+ }
+
+ /**
+ * 檢查 取得下個作番的 seq
+ * @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no
+ * @return int $seq : 作番流水號
+ */
+ function getNextFacilitySeq($seq_name)
+ {
+ $pdo = $this->connectionDB();
+ $pdo->exec('SET CHARACTER SET utf8mb4');
+ $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?');
+ $sth->bindValue(1, $seq_name);
+ $sth->execute();
+ $result = $sth->fetch();
+ return $result['current_val'];
+ }
+
+ /**
+ * 建立新的新梯作番
+ * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param int $seq_name : 幾個案場 0-99
+ * @return array $new_facilityno : 作番號
+ */
+ function makeMFacilityNo($sale_type, $make_type, $num)
+ {
+ if (count($make_type) !== $num)
+ return "陣列數量不一致!";
+ $new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num);
+ if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
+ // 如果作番號重複 使用此函數修正
+ $this->facilityFixSeq("M");
+ }
+ return $this->makeFacilityNo("M", $sale_type, $make_type, $num);
+ }
+
+ /**
+ * 建立新的汰改作番
+ * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param int $seq_name : 幾個案場 0-99
+ * @return array $new_facilityno : 作番號
+ */
+ function makeTFacilityNo($sale_type, $make_type, $num)
+ {
+ if (count($make_type) !== $num)
+ return "陣列數量不一致!";
+ $new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num);
+ if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
+ // 如果作番號重複 使用此函數修正
+ $this->facilityFixSeq("T");
+ }
+ return $this->makeFacilityNo("T", $sale_type, $make_type, $num);
+ }
+
+ /**
+ * 建立新的保養作番
+ * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param int $seq_name : 幾個案場 0-99
+ * @return array $new_facilityno : 作番號
+ */
+ function makeBFacilityNo($sale_type, $make_type, $num = 1)
+ {
+ if (count($make_type) !== $num)
+ return "陣列數量不一致!";
+ $new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num);
+ if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
+ // 如果作番號重複 使用此函數修正
+ $this->facilityFixSeq("B");
+ }
+ return $this->makeFacilityNo("B", $sale_type, $make_type, $num);
+ }
+}
+
+
+// $cfn = new CreateFacilityNo;
+// // 建立作番號 - 新梯
+// print_r($cfn->makeMFacilityNo("M", ["X", "W"], 2));
+// echo "
";
+// // 建立作番號 - 汰改
+// print_r($cfn->makeTFacilityNo("M", ["X", "W"], 2));
+// echo "
";
+// // 建立作番號 - 保養
+// print_r($cfn->makeBFacilityNo("M", ["X", "W"], 2));
+// echo "
";
diff --git a/wms/contract/api/postContractData.php b/wms/contract/api/postContractData.php
index 349557ee..16feeaf0 100644
--- a/wms/contract/api/postContractData.php
+++ b/wms/contract/api/postContractData.php
@@ -1,8 +1,10 @@
makeBFacilityNo("T", $facility_arr, (int)$num);
+ // if ($user_id == 'M0225') {
+ // echo '
';
+ // print_r($facilityno);
+ // echo '
';
+ // exit();
+ // }
echo json_encode($facilityno);
echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
@@ -304,6 +313,19 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->execute();
+ // $date = date('Y-m-sH-s-i');
+ // $createTime = str_replace("-", '', $date);
+ // $sql = "INSERT INTO comCustomer(BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)VALUES(:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
+ // $stmt = $connT8->prepare($sql);
+ // $stmt->bindParam(':BizPartnerId', $contractno);
+ // $stmt->bindParam(':PersonId', $salesman);
+ // $stmt->bindParam(':CreatorId', $user_id);
+ // $stmt->bindParam(':InvoiceAddress', $address);
+ // $stmt->bindParam(':CreateTime', $createTime);
+
+ // $stmt->execute();
+ T8insert($_POST, $facilityno);
+
header('Content-Type: application/json');
$jsonData = json_encode($files);
@@ -314,4 +336,177 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
+};
+
+function T8insert($data, $facilityno)
+{
+ require_once("../connt8.php");
+ $contractno = !empty($data['contractno']) ? $data['contractno'] : null; // 合約號
+ $address = !empty($data['address']) ? $data['address'] : null; // 客戶地址
+ $customer = !empty($data['customer']) ? $data['customer'] : null; //企業名稱
+ $phone = !empty($data['phone']) ? $data['phone'] : null; //客戶電話
+ $vat = !empty($data['vat']) ? $data['vat'] : null; //統編
+ $email = !empty($data['email']) ? $data['email'] : null;
+ $salesman = !empty($data['salesman']) ? $data['salesman'] : null; // 銷售人員
+ $partyA = !empty($data['partyA']) ? $data['partyA'] : null; //客戶名稱 / 業務聯絡人
+ $partyAaddress = !empty($data['partyAaddress']) ? $data['partyAaddress'] : null; // 業務聯絡人地址
+ $contract_begin_date = !empty($data['contract_begin_date']) ? $data['contract_begin_date'] : null;
+ $contract_end_date = !empty($data['contract_end_date']) ? $data['contract_end_date'] : null;
+ $num = !empty($data['num']) ? $data['num'] : null; // 電梯數量
+ $elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯
+ $area = !empty($_POST['area']) ? $_POST['area'] : null; //縣市 Ex. A->台北 , B-> ..。
+
+ $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
+
+
+ $connT8->beginTransaction();
+
+ $sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId";
+ $stmt = $conn->prepare($sql);
+ $stmt->bindParam(':BizPartnerId', $contractno);
+ $stmt->execute();
+ $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ $date = date('Y-m-sH-s-i');
+ $createTime = str_replace("-", '', $date);
+ $beginDate = str_replace("-", '', $contract_begin_date);
+ $endDate = str_replace("-", '', $contract_end_date);
+ if (empty($result)) {
+ // 若 客戶資料為空,新增一筆到 comCustomer
+ // 新增客戶資料
+ $sql = "INSERT INTO comBusinessPartner
+ (BizPartnerId,BizPartnerName,BusinessAttr,CountryId,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId)
+ VALUES(:BizPartnerId,:BizPartnerName,1,'TW',:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':BizPartnerId', $contractno);
+ $stmt->bindParam(':BizPartnerName', $partyA);
+ $stmt->bindParam(':WorkTelNo', $phone);
+ $stmt->bindParam(':TaxNo', $vat);
+ $stmt->bindParam(':EnterpriseName', $customer); //企業名稱
+ $stmt->bindParam(':ContactAddress', $partyAaddress);
+ $stmt->bindParam(':EMail', $email);
+ $stmt->bindParam(':CreatorId', $user_id);
+ $stmt->bindParam(':CreateTime', $createTime);
+
+ $stmt->execute();
+
+ $sql = "INSERT INTO comCustomer(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)
+ VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
+ $stmt = $connT8->prepare($sql);
+
+ $stmt->bindParam(':BizPartnerId', $contractno);
+ $stmt->bindParam(':PersonId', $salesman);
+ $stmt->bindParam(':CreatorId', $user_id);
+ $stmt->bindParam(':InvoiceAddress', $address);
+ $stmt->bindParam(':CreateTime', $createTime);
+
+ $stmt->execute();
+ } else {
+ // // 若客戶資料不為空,更新該客戶資訊。
+ $sql = "UPDATE comCustomer SET
+ PersonId=:PersonId,
+ InvoiceAddress=:InvoiceAddress,
+ LastOperatorId=:LastOperatorId,
+ LastOperateTime=:LastOperateTime
+ WHERE BizPartnerId=:BizPartnerId
+ ";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':PersonId', $salesman);
+ $stmt->bindParam(':InvoiceAddress', $address);
+ $stmt->bindParam(':LastOperatorId', $user_id);
+ $stmt->bindParam(':LastOperateTime', $createTime);
+ $stmt->bindParam(':BizPartnerId', $contractno);
+ $stmt->execute();
+
+
+ $sql = "UPDATE comBusinessPartner SET
+ BizPartnerName=:BizPartnerName,
+ WorkTelNo=:WorkTelNo,
+ TaxNo=:TaxNo,
+ EnterpriseName=:EnterpriseName,
+ ContactAddress=:ContactAddress,
+ EMail=:EMail,
+ LastOperatorId=:LastOperatorId,
+ LastOperateTime=:LastOperateTime
+ WHERE BizPartnerId = :BizPartnerId
+ ";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':BizPartnerName', $partyA);
+ $stmt->bindParam(':WorkTelNo', $phone);
+ $stmt->bindParam(':TaxNo', $vat);
+ $stmt->bindParam(':EnterpriseName', $customer);
+ $stmt->bindParam(':ContactAddress', $partyAaddress);
+ $stmt->bindParam(':EMail', $email);
+ $stmt->bindParam(':LastOperatorId', $user_id);
+ $stmt->bindParam(':LastOperateTime', $createTime);
+ $stmt->bindParam(':BizPartnerId', $contractno);
+ $stmt->execute();
+ }
+ // echo '
';
+ // print_r($elevators['maintainance']);
+ // echo '
';
+ foreach ($elevators as $index => $elevator) {
+ $type[] = $elevator['maintainance'];
+ if ($type[$index] == 'A') {
+ $type = 'C3';
+ } else if ($type[$index] == 'B') {
+ $type = 'C4';
+ } else if ($type[$index] == 'C') {
+ $type = 'C5';
+ }
+ }
+ // echo '
';
+ // print_r($type);
+ // echo '
';
+
+ // //新增於 comProject。合約 table
+ $sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,ValidityFromDate,ValidityToDate,CreateTime,CreatorId,IsInUsed)
+ VALUES(:ProjectId,:ProjectName,:TypeId,:ValidityFromDate,:ValidityToDate,:CreateTime,:CreatorId,1)";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':ProjectId', $contractno);
+ $stmt->bindParam(':ProjectName', $customer);
+ $stmt->bindParam(':TypeId', $type);
+ $stmt->bindParam(':ValidityFromDate', $beginDate);
+ $stmt->bindParam(':ValidityToDate', $endDate);
+ $stmt->bindParam(':CreateTime', $createTime);
+ $stmt->bindParam(':CreatorId', $user_id);
+ $stmt->execute();
+
+
+ // // 新增電梯數
+ foreach ($elevators as $index => $elevator) {
+ echo '
';
+ print_r($elevator);
+ echo '
';
+
+ $sql = "INSERT INTO comMaterial
+ (MaterialId,MaterialCategoryId,CreatorId,CreateTime)
+ VALUES (:MaterialId,'E',:CreatorId,:CreateTime)";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':MaterialId', $facilityno[$index]);
+ $stmt->bindParam(':CreatorId', $user_id);
+ $stmt->bindParam(':CreateTime', $createTime);
+ $stmt->execute();
+ /// 還沒修完
+
+ $sql = "INSERT INTO comMaterialGroup
+ (MaterialTypeId,MaterialId,MaterialName,MaterialCategoryId,UnitId,CreatorId,CreateTime)
+ VALUES ('10',:MaterialId,:MaterialName,'E','SET',:CreatorId,:CreateTime)";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':MaterialId', $facilityno[$index]);
+ $stmt->bindParam(':MaterialName', $customer);
+ $stmt->bindParam(':CreatorId', $user_id);
+ $stmt->bindParam(':CreateTime', $createTime);
+ $stmt->execute();
+ /// 還沒修完
+
+ $sql = "INSERT INTO comMaterialPurchases
+ (MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime)
+ VALUES (:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)";
+ $stmt = $connT8->prepare($sql);
+ $stmt->bindParam(':MaterialId', $facilityno[$index]);
+ $stmt->bindParam(':CreatorId', $user_id);
+ $stmt->bindParam(':CreateTime', $createTime);
+ $stmt->execute();
+ }
+ $connT8->commit();
}
diff --git a/wms/contract/api/testT8API.php b/wms/contract/api/testT8API.php
new file mode 100644
index 00000000..e5a32c6c
--- /dev/null
+++ b/wms/contract/api/testT8API.php
@@ -0,0 +1,38 @@
+prepare($sql);
+ // $stmt->execute();
+
+ $sql = "UPDATE comBusinessPartner SET WorkTelNo = '' WHERE BizPartnerId= 'M0225202301'";
+ $stmt = $connT8->prepare($sql);
+ $stmt->execute();
+
+ echo 'Success';
+} catch (PDOException $e) {
+ echo '';
+}
+// $sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId";
+// $stmt = $conn->prepare($sql);
+// $stmt->bindParam(':BizPartnerId', $contractno);
+// $stmt->execute();
+// $result = $stmt->fetch(PDO::FETCH_NUM);
+// $arr = array();
+// if (!empty($result)) {
+// foreach ($result as $key => $value) {
+// $arr[$key] = $value;
+// }
+// }
+// $count = empty($result) == '' ? 0 : COUNT($result);
+// echo '
';
+// print_r($result);
+// echo '
';
+// echo '
';
+
+// $createTime = Date('Y-m-sH-i-s');
+
+// echo str_replace('-', '', $createTime);
diff --git a/wms/contract/conn.php b/wms/contract/conn.php
index b92e67e5..78007657 100644
--- a/wms/contract/conn.php
+++ b/wms/contract/conn.php
@@ -1,43 +1,42 @@
-errorInfo()的形式獲取錯誤資訊
- //PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯
- //PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。
- //設定主動以警告的形式報錯
- $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
- //如果連接錯誤,將抛出一個PDOException異常對象
-}
-catch ( PDOException $e ){
- //如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作
- die("ERROR!!!: ". $e->getMessage());
-}
-
-//$conn = null; //關閉資料庫的連線
\ No newline at end of file
+errorInfo()的形式獲取錯誤資訊
+ //PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯
+ //PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。
+ //設定主動以警告的形式報錯
+ $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ //如果連接錯誤,將抛出一個PDOException異常對象
+} catch (PDOException $e) {
+ //如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作
+ die("ERROR!!!: " . $e->getMessage());
+}
+
+//$conn = null; //關閉資料庫的連線
diff --git a/wms/contract/connt8.php b/wms/contract/connt8.php
new file mode 100644
index 00000000..59f2b247
--- /dev/null
+++ b/wms/contract/connt8.php
@@ -0,0 +1,15 @@
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ }
+} catch (PDOException $e) {
+ // echo "fail";
+ // echo $e->getMessage();
+ die("ERROR!!!: " . $e->getMessage());
+}
diff --git a/wms/facility-price.xlsx b/wms/facility-price.xlsx
deleted file mode 100644
index 4a2fb783..00000000
Binary files a/wms/facility-price.xlsx and /dev/null differ
diff --git a/wms/header.php b/wms/header.php
index 3347bb17..83c6bfa3 100644
--- a/wms/header.php
+++ b/wms/header.php
@@ -34,7 +34,7 @@ if (isset($_REQUEST["function_name"])) {
* 連線T8 MSSQL
*/
try {
- $conn = new PDO("sqlsrv:Server=220.130.203.251;Database=T8MASADA", "masada", "ztPmPP!HRoV6SL3E");
+ $conn = new PDO("sqlsrv:Server=220.130.203.251;Database=T8MASADA", "M0225", "IFFBU1E=");
if ($conn) {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
diff --git a/wms/mkt/price_normal-index.php b/wms/mkt/price_normal-index.php
index 2cd73546..daa4ef37 100644
--- a/wms/mkt/price_normal-index.php
+++ b/wms/mkt/price_normal-index.php
@@ -1,832 +1,821 @@
-
-
-
-
-
-
-
電梯標準價查詢
-
-
-
-
-
-
-
-
-
-
- |
- 小機房 |
- MAE100 |
- 單位:萬元 |
-
-
- 規 格 |
- 標準價 |
- (±1S) |
- 1、1.0最低到5停;5停以下以5停計。
- 2、1.5及1.75最低到8停;8停以下以8停計。
- 3、1.5變為1.75---》+5.4萬/台;加減1停同1.5。
- 4、經理權限為發佈價之80%、業務部協理權限為75%。 |
-
-
- MAE100-6*7-CO60 |
- 89.0 |
- 4.0 |
-
-
- MAE100-8*7-CO60 |
- 89.1 |
- 4.0 |
-
-
- MAE100-9*7-CO60 |
- 89.7 |
- 4.0 |
-
-
- MAE100-10*7-CO60 |
- 90.4 |
- 4.0 |
-
-
- MAE100-11*7-CO60 |
- 92.0 |
- 4.0 |
-
-
- MAE100-12*7-CO60 |
- 95.6 |
- 4.0 |
-
-
- MAE100-13*7-CO60 |
- 98.0 |
- 4.1 |
-
-
- MAE100-15*7-CO60 |
- 98.5 |
- 4.1 |
-
-
- MAE100-17*7-CO60 |
- 133.6 |
- 5.1 |
-
-
- MAE100-20*7-CO60 |
- 153.2 |
- 5.4 |
-
-
- MAE100-24*7-CO60 |
- 158.4 |
- 5.4 |
-
-
- |
-
-
- 規 格 |
- 標準價 |
- (±1S) |
- 規格 |
- 標準價 |
-
-
- MAE100-8*10-CO90 |
- 101.5 |
- 4.0 |
- MAE100-8*10-CO105 |
- 106.3 |
-
-
- MAE100-9*10-CO90 |
- 102.1 |
- 4.0 |
- MAE100-9*10-CO105 |
- 107.4 |
-
-
- MAE100-10*10-CO90 |
- 103.0 |
- 4.0 |
- MAE100-10*10-CO105 |
- 108.6 |
-
-
- MAE100-11*10-CO90 |
- 108.4 |
- 4.0 |
- MAE100-11*10-CO105 |
- 114.0 |
-
-
- MAE100-12*10-CO90 |
- 110.0 |
- 4.0 |
- MAE100-12*10-CO105 |
- 115.5 |
-
-
- MAE100-13*10-CO90 |
- 112.2 |
- 4.1 |
- MAE100-13*10-CO105 |
- 117.8 |
-
-
- MAE100-15*10-CO90 |
- 113.4 |
- 4.1 |
- MAE100-15*10-CO105 |
- 119.0 |
-
-
- MAE100-17*10-CO90 |
- 151.1 |
- 5.1 |
- MAE100-17*10-CO105 |
- 156.7 |
-
-
- MAE100-20*10-CO90 |
- 173.0 |
- 5.4 |
- MAE100-20*10-CO105 |
- 178.6 |
-
-
- MAE100-24*10-CO90 |
- 192.0 |
- 5.4 |
- MAE100-24*10-CO105 |
- 198.0 |
-
-
-
- |
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
- |
- 無機房 |
- MAM200 |
- 單位:萬元 |
-
-
- 規 格 |
- 標準價 |
- (±1S) |
- 1、1.0最低到5停;5停以下以5停計。
- 2、1.5及1.75最低到8停;8停以下以8停計。
- 3、1.5變為1.75---》+5.4萬/台;加減1停同1.5。
- 4、營業員權限為發佈價之73% |
-
-
- MAM200-8*7-CO60 |
- 117.5 |
- 4.5 |
-
-
- MAM200-9*7-CO60 |
- 118.7 |
- 4.5 |
-
-
- MAM200-10*7-CO60 |
- 120.1 |
- 4.5 |
-
-
- MAM200-11*7-CO60 |
- 121.2 |
- 4.5 |
-
-
- MAM200-12*7-CO60 |
- 122.5 |
- 4.5 |
-
-
- MAM200-13*7-CO60 |
- 123.8 |
- 4.5 |
-
-
- MAM200-15*7-CO60 |
- 124.9 |
- 4.5 |
-
-
- MAM200-17*7-CO60 |
- 187.4 |
- 6.4 |
-
-
- MAM200-20*7-CO60 |
- 204.8 |
- 6.4 |
-
-
- MAM200-24*7-CO60 |
- 208.5 |
- 6.4 |
-
-
- MAM200-8*10-CO90 |
- 133.4 |
- 4.9 |
- MAM200-8*10-CO105 |
- 139.1 |
-
-
- MAM200-9*10-CO90 |
- 134.5 |
- 4.9 |
- MAM200-9*10-CO105 |
- 140.2 |
-
-
- MAM200-10*10-CO90 |
- 135.8 |
- 4.9 |
- MAM200-10*10-CO105 |
- 141.5 |
-
-
- MAM200-11*10-CO90 |
- 137.1 |
- 4.9 |
- MAM200-11*10-CO105 |
- 142.8 |
-
-
- MAM200-12*10-CO90 |
- 138.2 |
- 4.9 |
- MAM200-12*10-CO105 |
- 143.9 |
-
-
- MAM200-13*10-CO90 |
- 140.0 |
- 4.9 |
- MAM200-13*10-CO105 |
- 145.7 |
-
-
- MAM200-15*10-CO90 |
- 141.2 |
- 4.9 |
- MAM200-15*10-CO105 |
- 146.9 |
-
-
- MAM200-17*10-CO90 |
- 202.8 |
- 6.5 |
- MAM200-17*10-CO105 |
- 208.5 |
-
-
- MAM200-20*10-CO90 |
- 220.2 |
- 6.5 |
- MAM200-20*10-CO105 |
- 225.9 |
-
-
- MAM200-24*10-CO90 |
- 223.9 |
- 6.5 |
- MAM200-24*10-CO105 |
- 229.6 |
-
-
-
- |
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
- 小電梯 |
- MAH100 |
- 單位:萬元 |
-
-
- 規 格 |
- 標準價 |
- (±1S) |
-
-
- MAH100-6*5-2S45 |
- 73.2 |
- 2.5 |
-
-
- MAH100-8*5-2S45 |
- 83.2 |
- 2.5 |
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
- 註:
- 1、最低到3停;2停以3停計。
- 2、經理權限為發佈價之80%、業務部協理權限為75%。 |
- |
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
- |
- 高速梯 |
- 單位:萬元 |
-
-
- 規 格 |
- 標準價 |
- (±1S) |
-
-
- MAE100-12*20-CO120 |
- 180.0 |
- 5.0 |
-
-
- MAE100-13*20-CO120 |
- 181.3 |
- 5.0 |
-
-
- MAE100-15*20-CO120 |
- 182.7 |
- 5.0 |
-
-
- MAE100-17*20-CO120 |
- 217.1 |
- 6.3 |
-
-
- MAE100-20*20-CO120 |
- 225.6 |
- 6.4 |
-
-
- MAE100-24*20-CO120 |
- 240.2 |
- 6.5 |
-
-
- MAE100-12*20-CO150 |
- 223.0 |
- 6.1 |
-
-
- MAE100-13*20-CO150 |
- 224.1 |
- 6.1 |
-
-
- MAE100-15*20-CO150 |
- 225.4 |
- 6.1 |
-
-
- MAE100-17*20-CO150 |
- 239.9 |
- 6.5 |
-
-
- MAE100-20*20-CO150 |
- 244.3 |
- 6.5 |
-
-
- MAE100-24*20-CO150 |
- 253.3 |
- 6.5 |
-
-
- 註: 1、2.0及2.5最低到15停;15停以下以15停計。 |
- |
-
-
- 2、P-12(含)以下以P-13計。 |
- |
-
-
- 3、經理權限為發佈價之80%、業務部協理權限為75%。 |
- |
-
-
- |
- |
- |
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
- |
- 小機房貨梯 |
- 單位:萬元 |
-
-
- 規 格 |
- 標準價 |
- (±1S) |
-
-
- MAF100-750*3-2S45 |
- 114.3 |
- 5.8 |
-
-
- MAF100-750*3-2S60 |
- 115.5 |
- 5.8 |
-
-
- MAF100-1000*3-2S45 |
- 136.4 |
- 8.7 |
-
-
- MAF100-1000*3-2S60 |
- 138.5 |
- 8.7 |
-
-
- MAF100-1500*3-2S45 |
- 171.4 |
- 9.7 |
-
-
- MAF100-1500*3-2S60 |
- 175.5 |
- 9.7 |
-
-
- MAF100-2000*3-2S45 |
- 195.3 |
- 10.0 |
-
-
- MAF100-2000*3-2S60 |
- 198.5 |
- 10.0 |
-
-
- MAF100-2500*3-2S45 |
- 286.3 |
- 15.1 |
-
-
- MAF100-2500*3-2S60 |
- 288.3 |
- 15.1 |
-
-
- MAF100-3000*3-2S45 |
- 307.7 |
- 16.3 |
-
-
- MAF100-3000*3-2S60 |
- 309.5 |
- 16.3 |
-
-
- MAF100-3500*3-2S45 |
- 365.5 |
- 18.2 |
-
-
- MAF100-3500*3-2S60 |
- 368.5 |
- 18.2 |
-
-
- MAF100-4000*3-2S45 |
- 407.5 |
- 20.5 |
-
-
- MAF100-4000*3-2S60 |
- 409.5 |
- 20.5 |
-
-
- MAF100-5000*3-2S45 |
- 520.5 |
- 25.5 |
-
-
- MAF100-5000*3-2S60 |
- 525.8 |
- 25.5 |
-
-
- 註: 1、最低為2停 |
- |
- |
-
-
- 2、經理權限為發佈價之80%、業務部協理權限為75%。 |
- |
-
-
-
- |
- |
- |
-
-
-
-
-
-
-
- |
- 平台梯 |
- |
- 單位:萬元 |
-
-
- 規 格 |
- 標準價 |
- 提升高度標準 |
- 備註 |
-
-
- MAP100-280*2-CO09 |
- 78.5 |
- 3.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-280*3-CO09 |
- 86.5 |
- 6.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-280*4-CO09 |
- 94.5 |
- 9.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-280*5-CO09 |
- 102.5 |
- 12.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-280*2-CO09 |
- 80.2 |
- 3.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-280*3-CO09 |
- 88.5 |
- 6.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-280*4-CO09 |
- 96.5 |
- 9.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-280*5-CO09 |
- 104.5 |
- 12.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-320*2-CO09 |
- 82.0 |
- 3.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-320*3-CO09 |
- 90.0 |
- 6.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-320*4-CO09 |
- 98.0 |
- 9.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-320*5-CO09 |
- 106.0 |
- 12.0 |
- 岩板;L型開門另加3萬元/台 |
-
-
- MAP100-320*2-CO09 |
- 84.0 |
- 3.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-320*3-CO09 |
- 92.0 |
- 6.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-320*4-CO09 |
- 100.0 |
- 9.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- MAP100-320*5-CO09 |
- 108.0 |
- 12.0 |
- 人造皮革;L型開門另加3萬元/台 |
-
-
- |
- |
- |
- |
-
-
- |
- |
- |
- |
-
-
- 註: 1、最低為2停。 |
- |
- |
- |
-
-
- 2、標準價格為自動門。 |
- |
- |
- |
-
-
- 3、經理權限為發佈價之80%、業務部協理權限為75%。 |
- |
- |
-
-
- |
- |
- |
- |
-
-
-
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
+