Browse Source

保養價審

main
10994015 1 year ago
parent
commit
4839ea89cc
  1. 15
      wms/cont/api/getUsername.php
  2. 411
      wms/cont/api/postElevatorPricereview.php
  3. 10
      wms/cont/js/pricereviewAlpine.js
  4. 10
      wms/cont/pricereviewCreate.php
  5. 4
      wms/cont/window-modal/otherOptionModal.php
  6. 2
      wms/contract/js/alpine.js
  7. 21
      wms/mkt/assets/js/pricereviewAlpine.js
  8. 14
      wms/mkt/pricereviewCheck.php
  9. 3
      wms/sign/list.php

15
wms/cont/api/getUsername.php

@ -0,0 +1,15 @@
<?php
require_once('../../mkt/conn.php');
$accountid = $_GET['user_id'];
if($accountid == "---"){
echo "---";
exit;
}
$sql_str = "SELECT name FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accountid', $accountid);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_ASSOC);
echo $user['name'];

411
wms/cont/api/postElevatorPricereview.php

@ -0,0 +1,411 @@
<?php
require_once "../../mkt/conn.php";
date_default_timezone_set('Asia/Taipei');
$vol_no = $_POST['vol_no'];
$apply_key = $_POST['apply_key'];
$customer = $_POST['customer'];
$address = $_POST['address'];
$case_name = $_POST['case_name'];
$brand = $_POST['brand'];
$num = $_POST['num'];
$salesman = $_POST['salesman'];
$contract_begin_date = $_POST['contract_begin_date'];
$contract_end_date = $_POST['contract_end_date'];
$contract_kind = $_POST['contract_kind'];
$progress_remark = $_POST['progress_status'];
$serviceFee = $_POST['serviceFee'];
$penalty = $_POST['penalty'];
$deposit_rate = $_POST['deposit_rate'];
$keep_rate = $_POST['keep_rate'];
$warranty_rate = $_POST['warranty_rate'];
$remark = $_POST['remark'];
$creater = $_POST['creater'];
$pay_method = $_POST['pay_method'];
$status = $_POST['status'];
$elevators = json_decode($_POST['elevators'], true);
$otherOptions = json_decode($_POST['otherOptions'], true);
$current_date = date("Y-M-d H:i:s");
$sql_str = "SELECT status FROM con_maintance_examine_apply WHERE vol_no = :vol_no AND apply_key = :apply_key";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $vol_no);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
if(!$contract){
$sql_str = "INSERT INTO con_maintance_examine_apply (apply_key, vol_no, customer, address, case_name ,brand, num, salesman, maintain_kind, contract_begin_date, contract_end_date, contract_kind, payment_kind, progress_remark, service_fee, total_price, total_sale_price, penalty, deposit_rate, keep_rate, warranty_rate, memo, status, creater, create_at)
VALUES (:apply_key, :vol_no, :customer, :address, :case_name ,:brand, :num, :salesman, :maintain_kind, :contract_begin_date, :contract_end_date, :contract_kind, :payment_kind, :progress_remark, :service_fee, :total_price, :total_sale_price, :penalty, :deposit_rate, :keep_rate, :warranty_rate, :memo, :status, :creater, :create_at)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':vol_no', $vol_no);
$stmt->bindParam(':customer', $customer);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':case_name', $case_name);
$stmt->bindParam(':brand', $brand);
$stmt->bindParam(':num', $num);
$stmt->bindParam(':salesman', $salesman);
$stmt->bindParam(':maintain_kind', $maintain_kind);
$stmt->bindParam(':contract_begin_date', $contract_begin_date);
$stmt->bindParam(':contract_end_date', $contract_end_date);
$stmt->bindParam(':contract_kind', $contract_kind);
$stmt->bindParam(':payment_kind', $payment_kind);
$stmt->bindParam(':progress_remark', $progress_remark);
$stmt->bindParam(':service_fee', $serviceFee);
$stmt->bindParam(':total_price', $total_price);
$stmt->bindParam(':total_sale_price', $total_sale_price);
$stmt->bindParam(':penalty', $penalty);
$stmt->bindParam(':deposit_rate', $deposit_rate);
$stmt->bindParam(':keep_rate', $keep_rate);
$stmt->bindParam(':warranty_rate', $warranty_rate);
$stmt->bindParam(':memo', $remark);
$stmt->bindParam(':status', $status);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $current_date);
$stmt->execute();
$sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, register_code, elevator_brand, elevator_kind, spec, weight, speed, stop, floors, persons, elevator_num, useful_years, last_check_date, speed_governors_check_expense, maintain_times, is_m1_bundle, maintain__months, maintain_period, maintain_method, stand_price, contract_price, sold_price, commission_expense, management_expense, annual_survey_expense, service_expense, cmstatus, updated_at, creater, created_at)
VALUES (:apply_key, :register_code, :elevator_brand, :elevator_kind, :spec, :weight, :speed, :stop, :floors, :persons, :elevator_num, :useful_years, :last_check_date, :speed_governors_check_expense, :maintain_times, :is_m1_bundle, :maintain__months, :maintain_period, :maintain_method, :stand_price, :contract_price, :sold_price, :commission_expense, :management_expense, :annual_survey_expense, :service_expense, :cmstatus, :updated_at, :creater, :created_at) ";
foreach($elevators as $elevator){
if(empty($elevator['permitNumber'])) $register_code = "A";
if($elevator['spec'] == "MAE100") $elevator_kind = "A";
if($elevator['spec'] == "MAF100") $elevator_kind = "B";
if($elevator['spec'] == "MAM200") $elevator_kind = "D";
if($elevator['spec'] == "MAH100") $elevator_kind = "E";
$speed_governors_check_expense = null;
$maintain_times = 1;
$commission_expense = null;
$management_expense = null;
$service_expense = ($elevator['sale_price'] / $total_sale_price) * $serviceFee;
$cmstatus = "Y";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':item_no', $elevator['id']);
$stmt->bindParam(':register_code', $register_code);
$stmt->bindParam(':elevator_brand', $elevator['brand']);
$stmt->bindParam(':elevator_kind', $elevator_kind);
$stmt->bindParam(':spec', $elevator['spec']);
$stmt->bindParam(':weight', $elevator['weight']);
$stmt->bindParam(':speed', $elevator['speed']);
$stmt->bindParam(':stop', $elevator['stop']);
$stmt->bindParam(':floors', $elevator['stop']);
$stmt->bindParam(':persons', $elevator['person']);
$stmt->bindParam(':elevator_num', $elevator['qty']);
$stmt->bindParam(':useful_years', $elevator['checkYear']);
$stmt->bindParam(':last_check_date', $elevator['lastDate']);
$stmt->bindParam(':speed_governors_check_expense', $speed_governors_check_expense);
$stmt->bindParam(':maintain_times', $maintain_times);
$stmt->bindParam(':is_m1_bundle', $elevator['m1']);
$stmt->bindParam(':maintain__months', $elevator['months']);
$stmt->bindParam(':maintain_period', $elevator['cycle']);
$stmt->bindParam(':maintain_method', $elevator['method']);
$stmt->bindParam(':stand_price', $elevator['price']);
$stmt->bindParam(':contract_price', $elevator['sale_price']);
$stmt->bindParam(':sold_price', $elevator['sale_price']);
$stmt->bindParam(':commission_expense', $elevator['commission_expense']);
$stmt->bindParam(':management_expense', $elevator['management_expense']);
$stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']);
$stmt->bindParam(':service_expense', $elevator['service_expense']);
$stmt->bindParam(':cmstatus', $cmstatus);
$stmt->bindParam(':updated_at', $updated_at);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':created_at', $created_at);
$stmt->execute();
}
$sql_str = "INSERT INTO pricereview_maintain_item (mid, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp, memo)
VALUES (:mid, :item_no, :item_group, :item_spec, :option_relate_spec, :item_unit_price, :item_qty, :item_price_bp, :memo)";
foreach($otherOptions as $option){
$item_price_bp = $option['price']*$option['num'];
$option_relate_spec = $option['toElevator'][0]['id'];
$item_group = "E";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $apply_key);
$stmt->bindParam(':item_no', $option['pr_no']);
$stmt->bindParam(':item_group', $item_group);
$stmt->bindParam(':item_spec', $option['name']);
$stmt->bindParam(':option_relate_spec', $option_relate_spec);
$stmt->bindParam(':item_unit_price', $option['price']);
$stmt->bindParam(':item_qty', $option['num']);
$stmt->bindParam(':item_price_bp', $item_price_bp);
$stmt->bindParam(':memo', $option['memo']);
$stmt->execute();
}
}else{
$sql_str = "UPDATE con_maintance_examine_apply SET
case_name=:case_name,
num=:num,
maintain_kind=:maintain_kind,
contract_kind=:contract_kind,
payment_kind=:payment_kind,
contract_begin_date=:contract_begin_date,
contract_end_date=:contract_end_date,
service_fee=:service_fee,
total_price=:total_price,
total_sale_price=:total_sale_price,
penalty=:penalty,
deposit_rate=:deposit_rate,
keep_rate=:keep_rate,
warranty_rate=:warranty_rate,
remark=:remark,
status=:status,
updated_at=:updated_at
progress_remark=:progress_remark
WHERE apply_key=:apply_key AND vol_no=:vol_no";
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':vol_no', $vol_no);
$stmt->bindParam(':case_name', $case_name);
$stmt->bindParam(':num', $num);
$stmt->bindParam(':maintain_kind', $maintain_kind);
$stmt->bindParam(':contract_begin_date', $contract_begin_date);
$stmt->bindParam(':contract_end_date', $contract_end_date);
$stmt->bindParam(':contract_kind', $contract_kind);
$stmt->bindParam(':payment_kind', $payment_kind);
$stmt->bindParam(':progress_remark', $progress_remark);
$stmt->bindParam(':service_fee', $serviceFee);
$stmt->bindParam(':total_price', $total_price);
$stmt->bindParam(':total_sale_price', $total_sale_price);
$stmt->bindParam(':penalty', $penalty);
$stmt->bindParam(':deposit_rate', $deposit_rate);
$stmt->bindParam(':keep_rate', $keep_rate);
$stmt->bindParam(':warranty_rate', $warranty_rate);
$stmt->bindParam(':memo', $remark);
$stmt->bindParam(':status', $status);
$stmt->bindParam(':updated_at', $current_date);
$stmt->execute();
//整機單價
$sql_str = "SELECT * FROM con_maintance_examine_clear WHERE apply_key=:apply_key AND vol_no=:vol_no";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':vol_no', $vol_no);
$stmt->execute();
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
$oldItemsNo = (array)array_column($oldElevators, 'item_no');
$newItemsNo = (array)array_column($elevators, 'id');
$onlyInOldIds = array_values(array_diff($oldItemsNo, $newItemsNo)); // 只有舊的有,新傳入的沒有,所以刪除(delete)
$onlyInNewIds = array_values(array_diff($newItemsNo, $oldItemsNo)); //只有新傳入的有,舊的沒有,所以新增(insert)
$inBothIds = array_values(array_intersect($oldItemsNo, $newItemsNo)); //舊的跟新的都有,所以要更新(update)
foreach($onlyInOldIds as $oldIdx){
$sql_str = "DELETE FROM con_maintance_examine_clear WHERE apply_key = :apply_key AND item_no = :item_no AND vol_no=:vol_no";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':item_no', $oldidx);
$stmt->bindParam(':vol_no', $vol_no);
$stmt->execute();
}
foreach($onlyInNewIds as $newidx){
$sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, register_code, elevator_brand, elevator_kind, spec, weight, speed, stop, floors, persons, elevator_num, useful_years, last_check_date, speed_governors_check_expense, maintain_times, is_m1_bundle, maintain__months, maintain_period, maintain_method, stand_price, contract_price, sold_price, commission_expense, management_expense, annual_survey_expense, service_expense, cmstatus, updated_at, creater, created_at)
VALUES (:apply_key, :register_code, :elevator_brand, :elevator_kind, :spec, :weight, :speed, :stop, :floors, :persons, :elevator_num, :useful_years, :last_check_date, :speed_governors_check_expense, :maintain_times, :is_m1_bundle, :maintain__months, :maintain_period, :maintain_method, :stand_price, :contract_price, :sold_price, :commission_expense, :management_expense, :annual_survey_expense, :service_expense, :cmstatus, :updated_at, :creater, :created_at) ";
$elevator = array_values(array_filter($elevators, fn($el)=> $el['id'] == $newidx))[0];
$register_code = empty($elevator['permitNumber']) ? "A" : $elevator['permitNumber'];
if($elevator['spec'] == "MAE100") $elevator_kind = "A";
if($elevator['spec'] == "MAF100") $elevator_kind = "B";
if($elevator['spec'] == "MAM200") $elevator_kind = "D";
if($elevator['spec'] == "MAH100") $elevator_kind = "E";
$speed_governors_check_expense = null;
$maintain_times = 1;
$commission_expense = null;
$management_expense = null;
$service_expense = ($elevator['sale_price'] / $total_sale_price) * $serviceFee;
$cmstatus = "Y";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':item_no', $elevator['id']);
$stmt->bindParam(':register_code', $register_code);
$stmt->bindParam(':elevator_brand', $elevator['brand']);
$stmt->bindParam(':elevator_kind', $elevator_kind);
$stmt->bindParam(':spec', $elevator['spec']);
$stmt->bindParam(':weight', $elevator['weight']);
$stmt->bindParam(':speed', $elevator['speed']);
$stmt->bindParam(':stop', $elevator['stop']);
$stmt->bindParam(':floors', $elevator['stop']);
$stmt->bindParam(':persons', $elevator['person']);
$stmt->bindParam(':elevator_num', $elevator['qty']);
$stmt->bindParam(':useful_years', $elevator['checkYear']);
$stmt->bindParam(':last_check_date', $elevator['lastDate']);
$stmt->bindParam(':speed_governors_check_expense', $speed_governors_check_expense);
$stmt->bindParam(':maintain_times', $maintain_times);
$stmt->bindParam(':is_m1_bundle', $elevator['m1']);
$stmt->bindParam(':maintain__months', $elevator['months']);
$stmt->bindParam(':maintain_period', $elevator['cycle']);
$stmt->bindParam(':maintain_method', $elevator['method']);
$stmt->bindParam(':stand_price', $elevator['price']);
$stmt->bindParam(':contract_price', $elevator['sale_price']);
$stmt->bindParam(':sold_price', $elevator['sale_price']);
$stmt->bindParam(':commission_expense', $elevator['commission_expense']);
$stmt->bindParam(':management_expense', $elevator['management_expense']);
$stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']);
$stmt->bindParam(':service_expense', $elevator['service_expense']);
$stmt->bindParam(':cmstatus', $cmstatus);
$stmt->bindParam(':updated_at', $updated_at);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':created_at', $created_at);
$stmt->execute();
}
foreach($inBothIds as $bothidx){
$sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, register_code, elevator_brand, elevator_kind, spec, weight, speed, stop, floors, persons, elevator_num, useful_years, last_check_date, speed_governors_check_expense, maintain_times, is_m1_bundle, maintain__months, maintain_period, maintain_method, stand_price, contract_price, sold_price, commission_expense, management_expense, annual_survey_expense, service_expense, cmstatus, updated_at, creater, creater, created_at)
VALUES (:apply_key, :register_code, :elevator_brand, :elevator_kind, :spec, :weight, :speed, :stop, :floors, :persons, :elevator_num, :useful_years, :last_check_date, :speed_governors_check_expense, :maintain_times, :is_m1_bundle, :maintain__months, :maintain_period, :maintain_method, :stand_price, :contract_price, :sold_price, :commission_expense, :management_expense, :annual_survey_expense, :service_expense, :cmstatus, :updated_at, :creater, :creater, :created_at) ";
$sql_str = "UPDATE con_maintance_examine_clear SET
register_code=:register_code,
elevator_brand=:elevator_brand,
elevator_kind=:elevator_kind,
spec=:spec,
weight=:weight,
speed=:speed,
stop=:stop,
floors=:floors,
persons=:persons,
elevator_num=:elevator_num,
useful_years=:useful_years,
last_check_date=:last_check_date,
speed_governors_check_expense=:speed_governors_check_expense,
maintain_times=:maintain_times,
is_m1_bundle=:is_m1_bundle,
maintain__months=:maintain__months,
maintain_period=:maintain_period,
maintain_method=:maintain_method,
stand_price=:stand_price,
contract_price=:contract_price,
sold_price=:sold_price,
commission_expense=:commission_expense,
management_expense=:management_expense,
annual_survey_expense=:annual_survey_expense,
service_expense=:service_expense,
cmstatus=:cmstatus,
updated_at=:updated_at
WHERE apply_key=:apply_key AND item_no=:item_no";
$elevator = array_values(array_filter($elevators, fn($el)=> $el['id'] == $bothidx))[0];
$register_code = empty($elevator['permitNumber']) ? "A" : $elevator['permitNumber'];
if($elevator['spec'] == "MAE100") $elevator_kind = "A";
if($elevator['spec'] == "MAF100") $elevator_kind = "B";
if($elevator['spec'] == "MAM200") $elevator_kind = "D";
if($elevator['spec'] == "MAH100") $elevator_kind = "E";
$speed_governors_check_expense = null;
$maintain_times = 1;
$commission_expense = null;
$management_expense = null;
$service_expense = ($elevator['sale_price'] / $total_sale_price) * $serviceFee;
$cmstatus = "Y";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->bindParam(':register_code', $register_code);
$stmt->bindParam(':elevator_brand', $elevator['brand']);
$stmt->bindParam(':elevator_kind', $elevator_kind);
$stmt->bindParam(':spec', $elevator['spec']);
$stmt->bindParam(':weight', $elevator['weight']);
$stmt->bindParam(':speed', $elevator['speed']);
$stmt->bindParam(':stop', $elevator['stop']);
$stmt->bindParam(':floors', $elevator['stop']);
$stmt->bindParam(':persons', $elevator['person']);
$stmt->bindParam(':elevator_num', $elevator['qty']);
$stmt->bindParam(':useful_years', $elevator['checkYear']);
$stmt->bindParam(':last_check_date', $elevator['lastDate']);
$stmt->bindParam(':speed_governors_check_expense', $speed_governors_check_expense);
$stmt->bindParam(':maintain_times', $maintain_times);
$stmt->bindParam(':is_m1_bundle', $elevator['m1']);
$stmt->bindParam(':maintain__months', $elevator['months']);
$stmt->bindParam(':maintain_period', $elevator['cycle']);
$stmt->bindParam(':maintain_method', $elevator['method']);
$stmt->bindParam(':stand_price', $elevator['price']);
$stmt->bindParam(':contract_price', $elevator['sale_price']);
$stmt->bindParam(':sold_price', $elevator['sale_price']);
$stmt->bindParam(':commission_expense', $elevator['commission_expense']);
$stmt->bindParam(':management_expense', $elevator['management_expense']);
$stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']);
$stmt->bindParam(':service_expense', $elevator['service_expense']);
$stmt->bindParam(':cmstatus', $cmstatus);
$stmt->bindParam(':updated_at', $updated_at);
$stmt->bindParam(':item_no', $bothidx);
$stmt->execute();
}
//除外項目
$sql_str = "SELECT * FROM pricereview_maintain_item WHERE mid = :apply_key AND item_group = 'E'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $apply_key);
$stmt->execute();
$item_other_options = $stmt->fetchAll(PDO::FETCH_ASSOC);
$oldOtherOptionsNo = (array)array_column($item_other_options, 'item_no');
$newOtherOptioinNo = (array)array_column($otherOptions, 'id');
$nlyInOtherOptionOldIds = array_values(array_diff($oldOtherOptionsNo, $newOtherOptioinNo));
$onlyInOtherOptionNewIds = array_values(array_diff($newOtherOptioinNo, $oldOtherOptionsNo));
$inBothOtherOptionIds = array_values(array_intersect($oldOtherOptionsNo, $newOtherOptioinNo));
foreach($onlyInOtherOptionOldIds as $oldotheroptionidx){
$sql_str = "DELETE FROM pricereview_maintain_item WHERE mid = :apply_key AND item_no = :item_no AND item_group = 'E'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $apply_key);
$stmt->bindParam(':item_no', $oldotheroptionidx);
$stmt->execute();
}
foreach($onlyInOtherOptionNewIds as $newotheroptionidx){
$option = array_values(array_filter($otherOptions, fn($el)=> $el['id'] == $newotheroptionidx))[0];
$sql_str = "INSERT INTO pricereview_maintain_item (mid, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp, memo)
VALUES (:mid, :item_no, :item_group, :item_spec, :option_relate_spec, :item_unit_price, :item_qty, :item_price_bp, :memo)";
$item_price_bp = $option['price']*$option['num'];
$option_relate_spec = $option['toElevator'][0]['id'];
$item_group = "E";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $apply_key);
$stmt->bindParam(':item_no', $option['pr_no']);
$stmt->bindParam(':item_group', $item_group);
$stmt->bindParam(':item_spec', $option['name']);
$stmt->bindParam(':option_relate_spec', $option_relate_spec);
$stmt->bindParam(':item_unit_price', $option['price']);
$stmt->bindParam(':item_qty', $option['num']);
$stmt->bindParam(':item_price_bp', $item_price_bp);
$stmt->bindParam(':memo', $option['memo']);
$stmt->execute();
}
foreach($inBothOtherOptionIds as $bothotheroptionidx){
$option = array_values(array_filter($otherOptions, fn($el)=> $el['id'] == $bothotheroptionidx))[0];
$sql_str = "UPDATE pricereview_maintain_item SET item_spec=:item_spec, option_relate_spec=:option_relate_spec, item_unit_price = :item_unit_price, item_qty = :item_qty, item_price_bp = :item_price_bp, memo = :memo
WHERE mid = :apply_key AND item_no = :item_no AND item_group = 'E'";
$item_group = "E";
$item_price_bp = $option['price']*$option['num'];
$option_relate_spec = $option['toElevator'][0]['id'];
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $apply_key);
$stmt->bindParam(':item_no', $option['pr_no']);
$stmt->bindParam(':item_group', $item_group);
$stmt->bindParam(':item_spec', $option['name']);
$stmt->bindParam(':option_relate_spec', $option_relate_spec);
$stmt->bindParam(':item_unit_price', $option['price']);
$stmt->bindParam(':item_qty', $option['num']);
$stmt->bindParam(':item_price_bp', $item_price_bp);
$stmt->bindParam(':memo', $option['memo']);
$stmt->execute();
}
}
if($status == "YS"){
}
echo "success";

10
wms/cont/js/pricereviewAlpine.js

@ -49,6 +49,7 @@ const pricereviewCreate = ()=>{
name:"",
price: 0,
num:"",
memo:"",
},
otherOptionKey:0,
currentOtherOptionKey:'',
@ -179,6 +180,7 @@ const pricereviewCreate = ()=>{
name: this.modalOtherOptionInfo.name,
price: this.modalOtherOptionInfo.price,
num: this.modalOtherOptionInfo.num,
memo: this.modalOtherOptionInfo.memo,
toElevator:[],
})
this.modalOtherOptionInfo = {
@ -186,6 +188,7 @@ const pricereviewCreate = ()=>{
name: '',
price: 0,
num: '',
memo: '',
}
this.hideCreateOtherOptionModal();
},
@ -327,12 +330,17 @@ const pricereviewCreate = ()=>{
console.log(res.data);
if(res.data == 'success'){
alert("保存成功!");
window.location.reload();
// window.location.reload();
}
})
},
submit(){
},
async getUsername(user_id){
if(user_id == '') return '---'
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}})
return res.data ;
},
}
}

10
wms/cont/pricereviewCreate.php

@ -82,7 +82,7 @@ function getApplyKey($p_yyyymm, $seq_name){
<th>電梯數量</th>
<td><input class="form-control" type="number" disabled value="<?php echo $hope_customer['num']; ?>" /></td>
<th>營業員</th>
<td><input class="form-control" type="text" disabled value="<?php echo $hope_customer['salesman_name']; ?>" /></td>
<td><input class="form-control" type="text" disabled :value="getUsername('<?php echo $hope_customer['salesman']; ?>')" /></td>
<th>當前契約期限結束</th>
<td><input class="form-control" type="date" disabled value="" /></td>
@ -350,6 +350,7 @@ function getApplyKey($p_yyyymm, $seq_name){
<td>單價</td>
<td>數量</td>
<td>複價</td>
<td>備註</td>
<td style="width:160px">所屬電梯</td>
<td style="width:220px">功能</td>
</tr>
@ -364,10 +365,11 @@ function getApplyKey($p_yyyymm, $seq_name){
</td>
<td><input type="text" class="form-control" x-model="option.price"></td>
<td>
<input type="number" class="form-control" x-model="option.num">
<input type="number" class="form-control" x-model="option.num" style="width:100px">
<span x-show="!option.num || option.num <= 0 || !Number.isInteger(Number(option.num))" class="errortext" x-cloak data-type="errortext">請輸入正整數</span>
</td>
<td><input type="text" class="form-control" x-model="(option.price * option.num).toLocaleString()" disabled></td>
<td><input type="text" class="form-control" x-model="option.memo" style="min-width:220px" /></td>
<td>
<template x-for="el in option.toElevator">
<p x-html="'<b>' + el.id + '</b>、' + el.model"></p>
@ -385,7 +387,7 @@ function getApplyKey($p_yyyymm, $seq_name){
</template>
<tr x-show="otherOptions.length > 0">
<td colspan=3>小計</td>
<td colspan=1 ><input type="number" class="form-control" disabled :value="totalOtherOptionsNum.toLocaleString()" ></td>
<td colspan=1 ><input type="number" class="form-control" disabled :value="totalOtherOptionsNum.toLocaleString()" style="width:100px" /></td>
<td colspan=1 ><input type="text" class="form-control" disabled :value="totalOtherOptionsPrice.toLocaleString()" ></td>
<td colspan=3 ></td>
</tr>
@ -481,5 +483,5 @@ function getApplyKey($p_yyyymm, $seq_name){
const progress_status = '<?php echo $hope_customer['progress_status']; ?>';
const user_id = '<?php echo $user_id ?>';
const user_name = '<?php echo $user_name ?>';
const progress_remark = `<?php echo nl2br($hope_customer['progress_status']); ?>`;
</script>

4
wms/cont/window-modal/otherOptionModal.php

@ -13,13 +13,15 @@
<th>單價</th>
<th>數量</th>
<th>複價</th>
<th>備註</th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="modalOtherOptionInfo.pr_no"></td>
<td><input type="text" class="form-control" x-model="modalOtherOptionInfo.name"></td>
<td><input type="number" class="form-control" x-model="modalOtherOptionInfo.price"></td>
<td><input type="number" class="form-control" x-model="modalOtherOptionInfo.num"></td>
<td><input type="number" style="width:80px;" class="form-control" x-model="modalOtherOptionInfo.num"></td>
<td><input type="text" disabled class="form-control" x-model="(modalOtherOptionInfo.price * modalOtherOptionInfo.num).toLocaleString()"></td>
<td><input type="text" class="form-control" x-model="modalOtherOptionInfo.memo"></td>
</tr>
</table>
</div>

2
wms/contract/js/alpine.js

@ -246,7 +246,7 @@ const contractDownload = () => {
{
editshow: false,
origin: true,
text: '交貨期限及甲方配合事項:<br>乙方應於接獲甲方圖色確認第180日(應於合約簽訂日起兩年內),將本工程所需之全部設備、器材 運抵工地,甲方應提供適當的場所供乙方貯放設備、器材。',
text: '交貨期限及甲方配合事項:<br>乙方應於接獲甲方圖色確認第180日(應於合約簽訂日起兩年內),將本工程所需之全部設備、器材運抵工地,甲方應提供適當的場所供乙方貯放設備、器材。於指定出貨日期,且乙方備妥材料後,如甲方向後延展出貨日期,如延展日期逾三個月,乙方得酌收額外增生之倉儲保管費用。',
type: 'title',
deleted: false,
id: 5,

21
wms/mkt/assets/js/pricereviewAlpine.js

@ -988,8 +988,6 @@ const pricereviewCheck = ()=>{
this.demolishOptions = items.filter(item=> item.item_group =='C');
this.maintainOptions = items.filter(item=> item.item_group =='D');
this.otherOptions = items.filter(item=> item.item_group =='E');
console.log("optionnnn=>", this.options);
console.log(this.elevators);
this.elevators.forEach((elevator, idx)=>{
this.options.forEach(option=>{
if(option.option_relate_spec == elevator.item_no){
@ -1071,10 +1069,7 @@ const pricereviewCheck = ()=>{
}
}
}
this.getElevatorMi(idx, spec, person, stop, open, speed, elevator.item_weight)
});
this.sign1 = this.getUsername(sign1)
this.sign2 = this.getUsername(sign2)
@ -1170,38 +1165,38 @@ const pricereviewCheck = ()=>{
mid: mid,
user_id: user_id,
reviewcomment:'',
optionsTotalPrice(){
get optionsTotalPrice(){
return this.options.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
otherOptionsTotalPrice(){
get otherOptionsTotalPrice(){
return this.otherOptions.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
maintainOptionsTotalPrice(){
get maintainOptionsTotalPrice(){
return this.maintainOptions.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
demolishOptionsTotalPrice(){
get demolishOptionsTotalPrice(){
return this.demolishOptions.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
totalScale(){
get totalScale(){
return this.pays.reduce((total, option) => {
return total + Number(option.pay_scale );
}, 0);
},
totalElevatorsPrice(){
get totalElevatorsPrice(){
return this.elevators.reduce((total, elevator) => {
return total + (elevator.item_qty * elevator.price);
}, 0);
},
totalStandardPrice(){
return this.totalElevatorsPrice() + this.otherOptionsTotalPrice() + this.optionsTotalPrice() + this.maintainOptionsTotalPrice() + this.demolishOptionsTotalPrice();
get totalStandardPrice(){
return this.totalElevatorsPrice + this.otherOptionsTotalPrice + this.optionsTotalPrice + this.maintainOptionsTotalPrice + this.demolishOptionsTotalPrice;
},
check(sign, status, user_id = this.user_id ){
console.log(sign);

14
wms/mkt/pricereviewCheck.php

@ -409,7 +409,7 @@ function getSignerName($signer){
<tr>
<td colspan=5>小計</td>
<td >
<input type="text" x-model="optionsTotalPrice().toLocaleString()" disabled class="form-control">
<input type="text" x-model="optionsTotalPrice.toLocaleString()" disabled class="form-control">
</td>
<td colspan=3></td>
</tr>
@ -449,7 +449,7 @@ function getSignerName($signer){
<tr>
<td colspan=5>小計</td>
<td >
<input type="text" x-model="otherOptionsTotalPrice().toLocaleString()" disabled class="form-control">
<input type="text" x-model="otherOptionsTotalPrice.toLocaleString()" disabled class="form-control">
</td>
<td colspan=3></td>
</tr>
@ -489,7 +489,7 @@ function getSignerName($signer){
<tr>
<td colspan=4>小計</td>
<td >
<input type="text" x-model="maintainOptionsTotalPrice().toLocaleString()" disabled class="form-control">
<input type="text" x-model="maintainOptionsTotalPrice.toLocaleString()" disabled class="form-control">
</td>
<td colspan=2></td>
</tr>
@ -529,7 +529,7 @@ function getSignerName($signer){
<tr>
<td colspan=4>小計</td>
<td >
<input type="text" x-model="demolishOptionsTotalPrice().toLocaleString()" disabled class="form-control">
<input type="text" x-model="demolishOptionsTotalPrice.toLocaleString()" disabled class="form-control">
</td>
<td colspan=2></td>
</tr>
@ -671,7 +671,7 @@ function getSignerName($signer){
</tr>
<tr>
<td colspan="2">合計</td>
<td><input type="text" class="form-control" x-model="totalScale()" disabled /></td>
<td><input type="text" class="form-control" x-model="totalScale" disabled /></td>
<td><input type="text" class="form-control" :value="Number(price_total).toLocaleString()" disabled /></td>
<td></td>
</tr>
@ -707,12 +707,12 @@ function getSignerName($signer){
<th>價率%(B/A)</th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="Number(totalStandardPrice()).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(totalStandardPrice).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Number(price_total).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="(price_total - price_lowest).toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="qty" disabled /></td>
<td><input type="text" class="form-control" x-model="special_fee.toLocaleString()" disabled /></td>
<td><input type="text" class="form-control" x-model="Math.round(price_total/totalStandardPrice() * 1000)/10" disabled /></td>
<td><input type="text" class="form-control" x-model="Math.round(price_total/totalStandardPrice * 1000)/10" disabled /></td>
</tr>
<tr>
<th>預定成交日</th>

3
wms/sign/list.php

@ -113,7 +113,8 @@ JOIN
FROM
subflow
GROUP BY
form_key) AS sf ON d.form_key = sf.form_key
form_key
) AS sf ON d.form_key = sf.form_key
JOIN
subflow c ON c.form_key = sf.form_key AND c.seq = sf.max_seq
WHERE

Loading…
Cancel
Save