diff --git a/wms/contract/contract-download.php b/wms/contract/contract-download.php
index f5851ed5..3693ab7d 100644
--- a/wms/contract/contract-download.php
+++ b/wms/contract/contract-download.php
@@ -427,11 +427,11 @@ if (isset($_GET['id']) && $_GET['id'] != "") {
const partyAcompany = ;
const partyAcontractno = ;
const partyAaddress = ;
- const totalPrice = ;
+ const totalPrice = ;
const totalInstallPrice = ;
const totalBuyPrice = ;
- const secondPayDeadline = ;
- const buyfill1 = ;
+ const secondPayDeadline = "";
+ const buyfill1 = '';
const installfill1 = "";
const installfill2 = "";
const buyArr = [...];
@@ -440,7 +440,7 @@ if (isset($_GET['id']) && $_GET['id'] != "") {
let buy_pay_text = ''
const chineseArr = ['零', '一', '二', '三', '四', '五', '六', '七']
const bigChineseArr = ['零', '壹', '貳', '參', '肆', '伍', '陸', '柒', '捌', '玖', '拾'];
- const num = ;
+ const num = ;
const people = ;
const floor = ;
const speed = ;
diff --git a/wms/contract/insertMi.php b/wms/contract/insertMi.php
new file mode 100644
index 00000000..10166533
--- /dev/null
+++ b/wms/contract/insertMi.php
@@ -0,0 +1,204 @@
+getMessage());
+}
+
+// 獲取活動工作表
+$sheet = $spreadsheet->getActiveSheet();
+
+$create_at = date('Y-m-d H:i:s');
+
+$sql_str = "INSERT INTO elevator_mi_option (elevator_type, model_no, min_weight, max_weight, min_speed, max_speed, min_floors, max_floors, base_floor, purchase_cost, material_plus, design_hour, export_fee, equip_profit, customs_shipping, unloading, transport_site, install_price, install_plus, install_coef, trial_price, trial_plus, trial_coef, free1y, crane, wooden_box, consume, consumables, quotation_no, create_at)
+VALUES (:elevator_type, :model_no, :min_weight, :max_weight, :min_speed, :max_speed, :min_floors, :max_floors, :base_floor, :purchase_cost, :material_plus, :design_hour, :export_fee, :equip_profit, :customs_shipping, :unloading, :transport_site, :install_price, :install_plus, :install_coef, :trial_price, :trial_plus, :trial_coef, :free1y, :crane, :wooden_box, :consume, :consumables, :quotation_no, :create_at)";
+
+foreach ($sheet->getRowIterator() as $key => $row) {
+ // 獲得單元格迭代器
+ $cellIterator = $row->getCellIterator();
+ $cellIterator->setIterateOnlyExistingCells(false); // This loops through all cells,
+ // even if a cell value is not set.
+ // By default, only cells that have a value set will be iterated.
+ foreach ($cellIterator as $idx => $cell) {
+ if ($cell !== null) {
+ // 打印單元格數據
+ // echo $cell->getValue() . '///';
+ }
+ if($idx == "A"){
+ $elevator_type = $cell->getValue();
+ echo $elevator_type;
+ //電梯機種
+ }
+ elseif ($idx == 'B') {
+ $model_no = $cell->getValue();
+ echo $model_no;
+ //產品型號
+ } elseif ($idx == 'C') {
+ $min_weight = $cell->getValue();
+ echo $min_weight;
+ //最低載重
+ } elseif ($idx == 'D') {
+ $max_weight = $cell->getValue();
+ $max_weight = $min_weight;
+ echo $max_weight;
+ //最高載重
+ } elseif ($idx == 'E') {
+ $min_speed = $cell->getValue();
+ echo $min_speed;
+ //最低速度
+ } elseif ($idx == 'F') {
+ $max_speed = $cell->getValue();
+ $max_speed = $min_speed;
+ echo $max_speed;
+ //最高速度
+ } elseif ($idx == 'G') {
+ $min_floors = '2';
+ echo $min_floors;
+ //樓層開始
+ } elseif ($idx == 'H') {
+ $max_floors = $cell->getValue();
+ $max_floors = (int)$min_speed / 3;
+ echo $max_floors;
+ //樓層結束
+ }elseif ($idx == 'I') {
+ $base_floor = $cell->getValue();
+ echo $base_floor;
+ //基準層
+ }elseif ($idx == 'J') {
+ $purchase_cost = $cell->getValue();
+ echo $purchase_cost;
+ //基準採購成本
+ }elseif ($idx == 'K') {
+ $material_plus = $cell->getValue();
+ echo $material_plus;
+ //+1停材料費
+ }elseif ($idx == 'L') {
+ $design_hour = $cell->getValue();
+ echo $design_hour;
+ //設計人工(小時)
+ }elseif ($idx == 'M') {
+ $export_fee = $cell->getValue();
+ echo $export_fee;
+ //出口費用
+ }elseif ($idx == 'N') {
+ $equip_profit = $cell->getValue();
+ echo $equip_profit;
+ //利潤
+ }elseif ($idx == 'O') {
+ $customs_shipping = $cell->getValue();
+ echo $customs_shipping;
+ //報關+運輸
+ }elseif ($idx == 'P') {
+ $unloading = $cell->getValue();
+ echo $unloading;
+ //工廠卸貨
+ }elseif ($idx == 'Q') {
+ $transport_site = $cell->getValue();
+ echo $transport_site;
+ //運輸至工地
+ }elseif ($idx == 'R') {
+ $install_price = $cell->getValue();
+ echo $install_price;
+ //安裝基價
+ }elseif ($idx == 'S') {
+ $install_plus = $cell->getValue();
+ echo $install_plus;
+ //+1停安裝費
+ }elseif ($idx == 'T') {
+ $install_coef = $cell->getValue();
+ echo $install_coef;
+ //+1停安裝係數
+ }elseif ($idx == 'U') {
+ $trial_price = $cell->getValue();
+ echo $trial_price;
+ //試車費用
+ }elseif ($idx == 'V') {
+ $trial_plus = $cell->getValue();
+ echo $trial_plus;
+ //+1停試車價
+ }elseif ($idx == 'W') {
+ $trial_coef = $cell->getValue();
+ echo $trial_coef;
+ //+1停試車係數
+ }elseif ($idx == 'X') {
+ $free1y = $cell->getValue();
+ echo $free1y;
+ //一年免保費
+ }elseif ($idx == 'Y') {
+ $crane = $cell->getValue();
+ echo $crane;
+ //卸貨起吊費
+ }elseif ($idx == 'Z') {
+ $wooden_box = $cell->getValue();
+ echo $wooden_box;
+ //木箱清運
+ }elseif ($idx == 'AA') {
+ $consume = $cell->getValue();
+ echo $consume;
+ //工具消耗
+ }elseif ($idx == 'AB') {
+ $consumables = $cell->getValue();
+ echo $consumables;
+ //耗材
+ }
+ }
+ echo "
"; // 換行,以分隔不同的行
+
+ $status = "Y";
+
+ if (isset($_GET['miid'])) {
+ try {
+ $quotation_no = 'Q2401002';
+ //VALUES (:elevator_type, :model_no, :min_weight, :max_weight, :min_speed, :max_speed, :min_floors, :max_floors, :base_floor, :purchase_cost, :material_plus, :design_hour, :export_fee, :equip_profit, :customs_shipping, :unloading, :transport_site, :install_price, :install_plus, :install_coef, :trial_price, :trial_plus, :trial_coef, :free1y, :crane, :wooden_box, :consume, :consumables, :option_price, :quotation_no, :create_at)";
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(':elevator_type', $elevator_type);
+ $stmt->bindParam(':model_no', $model_no);
+ $stmt->bindParam(':min_weight', $min_weight);
+ $stmt->bindParam(':max_weight', $max_weight);
+ $stmt->bindParam(':min_speed', $min_speed);
+ $stmt->bindParam(':max_speed', $max_speed);
+ $stmt->bindParam(':min_floors', $min_floors);
+ $stmt->bindParam(':max_floors', $max_floors);
+ $stmt->bindParam(':base_floor', $base_floor);
+ $stmt->bindParam(':purchase_cost', $purchase_cost);
+ $stmt->bindParam(':material_plus', $material_plus);
+ $stmt->bindParam(':design_hour', $design_hour);
+ $stmt->bindParam(':export_fee', $export_fee);
+ $stmt->bindParam(':equip_profit', $equip_profit);
+ $stmt->bindParam(':customs_shipping', $customs_shipping);
+ $stmt->bindParam(':unloading', $unloading);
+ $stmt->bindParam(':transport_site', $transport_site);
+ $stmt->bindParam(':install_price', $install_price);
+ $stmt->bindParam(':install_plus', $install_plus);
+ $stmt->bindParam(':install_coef', $install_coef);
+ $stmt->bindParam(':trial_price', $trial_price);
+ $stmt->bindParam(':trial_plus', $trial_plus);
+ $stmt->bindParam(':trial_coef', $trial_coef);
+ $stmt->bindParam(':free1y', $free1y);
+ $stmt->bindParam(':crane', $crane);
+ $stmt->bindParam(':wooden_box', $wooden_box);
+ $stmt->bindParam(':consume', $consume);
+ $stmt->bindParam(':consumables', $consumables);
+ $stmt->bindParam(':quotation_no', $quotation_no);
+ $stmt->bindParam(':create_at', $create_at);
+ // 遍歷當前行的每一個單元格
+ $stmt->execute();
+
+ } catch (PDOException $e) {
+ echo $e->getMessage();
+ die('Error!:' . $e->getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/wms/contract/js/alpine.js b/wms/contract/js/alpine.js
index 9837868d..c93e56a0 100644
--- a/wms/contract/js/alpine.js
+++ b/wms/contract/js/alpine.js
@@ -734,13 +734,18 @@ const contractDownload = () => {
this.standardData.list.plaintext[10].text = '電梯保養:
一、乙方完工交車後,期後 ' + this.installfill2 + ' 個月內應負責免費定期保養,及履行免費保固,於免費保養期間屆至後,雙方再協商嗣後保養事宜。
二、如因可歸責乙方因素致安裝產品有所瑕疵時,乙方應負責修復或修繕,惟非因乙方因素致有修復產品需要時,乙方仍負責修復或修繕,惟得向甲方酌收基本材料與人工費用。
三、另依法令規定,非經竣工檢查合格後取得使用許可證之電梯,依法不得使用。'
this.onstandardViewData.list.plaintext[10].text = '電梯保養:
一、乙方完工交車後,期後 ' + this.installfill2 + ' 個月內應負責免費定期保養,及履行免費保固,於免費保養期間屆至後,雙方再協商嗣後保養事宜。
二、如因可歸責乙方因素致安裝產品有所瑕疵時,乙方應負責修復或修繕,惟非因乙方因素致有修復產品需要時,乙方仍負責修復或修繕,惟得向甲方酌收基本材料與人工費用。
三、另依法令規定,非經竣工檢查合格後取得使用許可證之電梯,依法不得使用。'
},
+ errorFn(){
+ alert("資料有誤,請先填完整資料進行保存")
+ },
sendBuyInputFn() {
if (this.buyfill1 == '') {
- alert('請輸入交貨期限');
+ // alert('請輸入交貨期限');
+ this.errorFn();
return;
}
if (this.buyfill1 < 1) {
- alert('交貨期限不得低於1日');
+ // alert('交貨期限不得低於1日');
+ this.errorFn();
return;
}
if (buyArr[1].installment == 2) {
@@ -766,11 +771,13 @@ const contractDownload = () => {
sendBuyInputKeyupFn(e) {
if (e.keyCode !== 13) return
if (this.buyfill1 == '') {
- alert('請輸入交貨期限');
+ // alert('請輸入交貨期限');
+ this.errorFn();
return;
}
if (this.buyfill1 < 1) {
- alert('交貨期限不得低於1日');
+ // alert('交貨期限不得低於1日');
+ this.errorFn()
return;
}
if (buyArr[1].installment == 2) {
diff --git a/wms/crm/crmm03-edit.php b/wms/crm/crmm03-edit.php
index cc5b2a98..0c151755 100644
--- a/wms/crm/crmm03-edit.php
+++ b/wms/crm/crmm03-edit.php
@@ -18,7 +18,7 @@ $customer_source_opt = DB::result($sql);
$sql = "select code_name value ,content label from code where field_name='elevator_kind'";
$elevator_kind_opt = DB::result($sql);
#4.營業員
-$sql = "select employee_no value ,name label from employee where depart_no in ('320','311','312','313','314','511','512','513','514','322','515')";
+$sql = "select employee_no value ,name label from employee where depart_no in ('320','311','312','313','314','315','511','512','513','514','322','515')";
$salesman_opt = DB::result($sql);
#5.有望客戶狀態
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'";
diff --git a/wms/crm/crmm04-edit.php b/wms/crm/crmm04-edit.php
index 188bce36..13e20ab7 100644
--- a/wms/crm/crmm04-edit.php
+++ b/wms/crm/crmm04-edit.php
@@ -18,7 +18,7 @@ $customer_source_opt = DB::result($sql);
$sql = "select code_name value ,content label from code where field_name='elevator_kind'";
$elevator_kind_opt = DB::result($sql);
#4.營業員
-$sql = "select employee_no value ,name label from employee where depart_no in ('320','311','312','313','314','511','512','513','514')";
+$sql = "select employee_no value ,name label from employee where depart_no in ('320','311','312','313','314','315','511','512','513','514','515')";
$salesman_opt = DB::result($sql);
#5.有望客戶狀態
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'";
diff --git a/wms/mkt/assets/js/alpine.js b/wms/mkt/assets/js/alpine.js
index 4ad7a63f..da0bdaf1 100644
--- a/wms/mkt/assets/js/alpine.js
+++ b/wms/mkt/assets/js/alpine.js
@@ -13,7 +13,7 @@ const priceOptionIndex = ()=>{
options_arr: {
1:'標配',
2:'選配',
- 3:'加價'
+ 3:'選配'
},
btntype:1,
buttons:[],
@@ -134,7 +134,7 @@ const priceOptionSelect = ()=>{
options_arr: {
1:'標配',
2:'選配',
- 3:'加價'
+ 3:'選配'
},
btntype:1,
buttons:[],
@@ -206,7 +206,7 @@ const pricereviewOptionSelect = ()=>{
optionalArr: {
1:'標配',
2:'選配',
- 3:'加價',
+ 3:'選配',
},
searchtext:'',
kind:0,
@@ -281,14 +281,15 @@ const pricereviewOptionSelect = ()=>{
},
searchOptions(e){
this.reloadOptions();
- let val = e.target.value.toLowerCase()
+ // let val = e.target.value.toLowerCase()
+ let val = this.searchtext.toLowerCase()
this.options = (this.options).filter(option=>{
if(option.group_name == null) option.group_name = ''
if(option.spec == null) option.spec = ''
if(option.memo == null) option.memo = ''
if(option.price == null) option.price = 0
if(option.unit == null) option.unit = ''
- return option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val)
+ return option.group_name.toLowerCase().includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val)
})
}
diff --git a/wms/mkt/pricereview-check.php b/wms/mkt/pricereview-check.php
index 631cb3b8..214f8984 100644
--- a/wms/mkt/pricereview-check.php
+++ b/wms/mkt/pricereview-check.php
@@ -244,6 +244,67 @@ foreach ($res as $data) {
$pay_all_amount += $row_p["pay_amount"];
}
mysqli_free_result($res_p);
+
+
+ function getMI($id){
+ $specarr = [];
+ $elno = [];
+ require_once("./conn.php");
+ $sql_str = "SELECT * FROM pricereview_item WHERE mid = :id";
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(':id', $id);
+ $stmt->execute();
+ $price_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach($price_items as $item){
+ if($item['item_group'] == "A"){
+ $openfn = trim(explode("-", $item['item_spec'])[2]);
+ $openname = "";
+ $speed = "";
+ if(str_contains($openfn, "2U")){
+ $speed = str_replace("2U", "", $openfn);
+ $openname = "2U";
+ }elseif(str_contains($openfn, "4PCO")){
+ $speed = str_replace("4PCO","", $openfn);
+ $openname = "4PCO";
+ }elseif(str_contains($openfn, "6PCO")){
+ $speed = str_replace("6PCO","", $openfn);
+ $openname = "6PCO";
+ }elseif(str_contains($openfn, "2S")){
+ $speed = str_replace("2S","", $openfn);
+ $openname = "2S";
+ }elseif(str_contains($openfn, "CO")){
+ $speed = str_replace("CO","", $openfn);
+ $openname = "CO";
+ }else{
+
+ }
+
+ // specarr[] = [trim(explode("-", $item['item_spec'])[0]), explode("*", explode("-", $item['item_spec'])[1])[1]];
+ $specarr[] = [trim(explode("-", $item['item_spec'])[0]), explode("*", trim(explode("-", $item['item_spec'])[1]))[0], explode("*", trim(explode("-", $item['item_spec'])[1]))[1], $openname, $speed, $item['item_weight']];
+
+ $elno[] = trim("'".explode("-", $item['item_spec'])[0]. "'");
+ }
+ }
+ $quotation_no = "Q2401002";
+ $jsonel = implode(",", $elno);
+ $sql_str = "SELECT * FROM elevator_mi_option WHERE elevator_type IN ($jsonel) AND quotation_no = :quotation_no";
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(':quotation_no', $quotation_no);
+ $stmt->execute();
+ $output_el_options = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ $el_options = [];
+
+ foreach($output_el_options as $el){
+ foreach($specarr as $spec){
+ if($el['min_weight'] == $spec['5'] && $el['min_speed'] == $spec['4']){
+ $el_options[] = $el;
+ }
+ }
+ }
+
+ }
+ getMI($id);
?>