Browse Source

待簽查詢 datatable update asc 改為 desc ,

main
10994015 1 year ago
parent
commit
862c0aedbb
  1. 1
      wms/cont/api/getElevatorPrice.php
  2. 761
      wms/cont/api/maintaenance_contract_bonus.php
  3. 14
      wms/cont/api/postElevatorPricereview.php
  4. 154
      wms/cont/js/pricereviewAlpine.js
  5. 21
      wms/cont/pricereviewCheck.php
  6. 57
      wms/cont/pricereviewCreate.php
  7. 8
      wms/cont/window-modal/modalElevaotr.php
  8. 2
      wms/cont/window-modal/otherOptionModal.php
  9. 11
      wms/mkt/api/postNewElevatorPricereview.php
  10. 2
      wms/mkt/assets/js/pricereviewAlpine0311.js
  11. 15
      wms/sign/list.php

1
wms/cont/api/getElevatorPrice.php

@ -14,6 +14,7 @@ try{
"MAF100" => "B", "MAF100" => "B",
"MAM200" => "D", "MAM200" => "D",
"MAH100" => "E", "MAH100" => "E",
""=>""
]; ];
// $elevator_type = match($spec){ // $elevator_type = match($spec){
// "MAE100" => "A", // "MAE100" => "A",

761
wms/cont/api/maintaenance_contract_bonus.php

@ -0,0 +1,761 @@
<?php
## 3/31 前套用 2.0 版本
$ver = isset($_GET['ver']) ? $_GET['ver'] : null;
$contract_type = isset($_GET['contract_type']) ? trim($_GET['contract_type']) : null; // 请注意删除可能的尾随空格
$contract_years = isset($_GET['contract_years']) ? $_GET['contract_years'] : null;
$discount = isset($_GET['discount']) ? $_GET['discount'] : null;
$fee_per_st = isset($_GET['fee_per_st']) ? $_GET['fee_per_st'] : null;
$receivable_date_due = isset($_GET['receivable_date_due']) ? $_GET['receivable_date_due'] : null;
$sales_id = isset($_GET['sales_id']) ? $_GET['sales_id'] : null;
$region_manager_id = isset($_GET['region_manager_id']) ? $_GET['region_manager_id'] : null;
$regular_contract_manager_id = isset($_GET['regular_contract_manager_id']) ? $_GET['regular_contract_manager_id'] : null;
$bonus = maintenance_contract_bonus_v2_0($ver, $contract_type, $contract_years, $discount, $fee_per_st, $receivable_date_due, $sales_id, $region_manager_id, $regular_contract_manager_id);
echo json_encode($bonus);
function maintenance_contract_bonus_v2_0($ver, $contract_type, $contract_years, $discount, $fee_per_st, $receivable_date_due, $sales_id, $region_manger_id, $regular_contract_manger_id = '')
{
$bonus_array = [];
if ($ver == "2.0") {
#契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue)
switch ($contract_type) {
case "new":
#契約員獎金($sales_bonus)
switch ($fee_per_st) {
case ($fee_per_st <= 3000):
$sales_bonus = ($fee_per_st) * 0.6;
break;
case ($fee_per_st >= 3001 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.7;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.8;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.9;
break;
};
#地區經理經理獎金($region_manager_bonus)
$region_manager_bonus = 170;
#專任契約經理獎金($regular_contract_manger_bonus)
if (($regular_contract_manger_id) != '') {
$regular_contract_manger_bonus = 100;
}
break;
case "free_to_charge":
switch ($fee_per_st) {
case ($fee_per_st <= 3000):
$sales_bonus = ($fee_per_st) * 0.3;
break;
case ($fee_per_st >= 3001 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.35;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.4;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.5;
break;
};
#地區經理經理獎金($region_manager_bonus)
$region_manager_bonus = 100;
#專任契約經理獎金($regular_contract_manger_bonus)
if (($regular_contract_manger_id) != '') {
$regular_contract_manger_bonus = 100;
}
break;
case "renew_priceissue":
switch ($fee_per_st) {
case ($fee_per_st <= 3000):
$sales_bonus = ($fee_per_st) * 0.25;
break;
case ($fee_per_st >= 3001 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.3;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.35;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.4;
break;
};
#地區經理經理獎金($region_manager_bonus)
$region_manager_bonus = 100;
#專任契約經理獎金($regular_contract_manger_bonus)
if (($regular_contract_manger_id) != '') {
$regular_contract_manger_bonus = 100;
}
break;
};
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59)
switch ($discount) {
case ($discount < 0.6):
$sales_bonus = $sales_bonus * 0.7;
break;
case ($discount >= 0.6 and $discount < 0.8):
$sales_bonus = $sales_bonus * 0.8;
break;
case ($discount >= 0.8):
$sales_bonus = $sales_bonus * 1.0;
break;
};
#簽約年數($contract_years):1年(1),超過1年(above)
switch ($contract_years) {
case $contract_years == "one":
#契約員獎金
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
#地區經理經理獎金
array_push($bonus_array, [
"bonus_type" => "2", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
#專任契約經理獎金
if (($regular_contract_manger_id) != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
}
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
break;
case $contract_years == "above_two":
/*** 以下第1年獎金 ***/
#契約員獎金
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
#地區經理經理獎金
array_push($bonus_array, [
"bonus_type" => "2", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
#專任契約經理獎金
if (($regular_contract_manger_id) != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
}
/*** 以上第1年獎金 ***/
/*** 以下第2年獎金 ***/
#第2年契約員獎金
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +13 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
#第2年地區經理經理獎金
array_push($bonus_array, [
"bonus_type" => "2", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +13 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
#第2年專任契約經理獎金
if (($regular_contract_manger_id) != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +13 months")), #預計發放時間
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定
]);
}
/*** 以上第2年獎金 ***/
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
break;
}
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"pay_day_due" => "9999-1-1", #預計發放時間
"bonus_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
}
return $result_array;
};
## 4/1 後套用 2.1 版本
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id = '')
{
// $fee_per_st = round($fee_per_st);
$bonus_array = [];
if ($ver == "2.1") {
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2);
// $discount = ($fee_per_st - $commission_fee) / $elevator_list_price;
#契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue)
switch ($contract_type) {
case "new":
#契約員獎金($sales_bonus)
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59)
switch ($discount) {
case ($discount >= 0.8):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.6;
break;
case ($fee_per_st >= 3000 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.7;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.8;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.9;
break;
};
break;
case ($discount >= 0.6 and $discount < 0.8):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.48;
break;
case ($fee_per_st >= 3000 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.56;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.64;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.72;
break;
};
break;
case ($discount < 0.6):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.42;
break;
case ($fee_per_st >= 3000 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.49;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.56;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.63;
break;
};
break;
};
#地區處長獎金($region_director_bonus)
$region_director_bonus = 170;
#專任契約經理獎金($regular_contract_manger_bonus)
$regular_contract_manger_bonus = 300;
break;
case "free_to_charge":
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.3;
break;
case ($fee_per_st >= 3000 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.35;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.4;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.45;
break;
};
#地區處長獎金($region_director_bonus)
$region_director_bonus = 170;
#專任契約經理獎金($regular_contract_manger_bonus)
$regular_contract_manger_bonus = 300;
break;
case "renew_priceissue":
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.25;
break;
case ($fee_per_st >= 3000 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st) * 0.3;
break;
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st) * 0.35;
break;
case ($fee_per_st >= 4000):
$sales_bonus = ($fee_per_st) * 0.4;
break;
};
#地區處長獎金($region_director_bonus)
$region_director_bonus = 170;
#專任契約經理獎金($regular_contract_manger_bonus)
$regular_contract_manger_bonus = 300;
break;
};
#地區處長獎金
array_push($bonus_array, [
"bonus_type" => "2", #獎金名稱
"bonus_receiver" => $region_director_id, #發放人員
"bonus_amount" => round($region_director_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "第1次款項收回後,次月發放" #發放規定
]);
#專任契約經理獎金
if ($regular_contract_manger_id != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "第1次款項收回後,次月發放" #發放規定
]);
}
#契約員獎金
switch ($payment_period) {
#年付
case "annually":
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
break;
#半年付
case "semiannually":
$payment_ratio_due_array = array(0.5, 0.5);
$payday_due_array = array(1, 7);
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
#季付
case "quarterly":
$payment_ratio_due_array = array(0.25, 0.25, 0.25, 0.25);
$payday_due_array = array(1, 4, 7, 10);
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
#2月1次
case "bimonthly":
$payment_ratio_due_array = array();
for ($i = 0; $i < 6; $i++) {
array_push($payment_ratio_due_array, 1 / 6);
}
$payday_due_array = array(1, 3, 5, 7, 9, 11);
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
#月付
case "monthly":
$payment_ratio_due_array = array();
// $payment_ratio_due_array = array();
for ($i = 0; $i < 12; $i++) {
array_push($payment_ratio_due_array, 1 / 12);
}
$payday_due_array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
}
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"pay_day_due" => "9999-1-1", #預計發放時間
"bonus_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
}
return $result_array;
};
## 五年以上長約
function maintenance_longterm_contract_m1_free_charge_bonus_v2_1($ver, $contract_type, $payment_period, $payment_period_amount, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id = '')
{
$bonus_array = [];
if ($ver == "2.1") {
$discount = ($fee_per_st - $commission_fee) / $elevator_list_price;
#契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge)
switch ($contract_type) {
case "longcontract_m1_free_charge":
#契約員獎金($sales_bonus)
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59)
switch ($discount) {
case ($discount >= 0.8):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.6;
break;
case ($fee_per_st >= 3000 and $fee_per_st < 4000):
$sales_bonus = ($fee_per_st) * 0.7;
break;
case ($fee_per_st >= 4000 and $fee_per_st < 5000):
$sales_bonus = ($fee_per_st) * 0.8;
break;
case ($fee_per_st >= 5000 and $fee_per_st < 6000):
$sales_bonus = ($fee_per_st) * 0.9;
break;
case ($fee_per_st >= 6000):
$sales_bonus = ($fee_per_st) * 1.0;
break;
};
break;
case ($discount >= 0.6 and $discount < 0.8):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.42;
break;
case ($fee_per_st >= 3000 and $fee_per_st <= 4000):
$sales_bonus = ($fee_per_st) * 0.49;
break;
case ($fee_per_st >= 4000 and $fee_per_st < 5000):
$sales_bonus = ($fee_per_st) * 0.56;
break;
case ($fee_per_st >= 5000 and $fee_per_st < 6000):
$sales_bonus = ($fee_per_st) * 0.63;
break;
case ($fee_per_st >= 6000):
$sales_bonus = ($fee_per_st) * 0.7;
break;
};
break;
case ($discount < 0.6):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
$sales_bonus = ($fee_per_st) * 0.3;
break;
case ($fee_per_st >= 3000 and $fee_per_st < 4000):
$sales_bonus = ($fee_per_st) * 0.35;
break;
case ($fee_per_st >= 4000 and $fee_per_st < 5000):
$sales_bonus = ($fee_per_st) * 0.4;
break;
case ($fee_per_st >= 5000 and $fee_per_st < 6000):
$sales_bonus = ($fee_per_st) * 0.45;
break;
case ($fee_per_st >= 6000):
$sales_bonus = ($fee_per_st) * 0.5;
break;
};
break;
};
#地區處長獎金($region_director_bonus)
$region_director_bonus = 170;
#專任契約經理獎金($regular_contract_manger_bonus)
$regular_contract_manger_bonus = 300;
break;
};
#付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually)
array_push($bonus_array, [
"bonus_type" => "2", #獎金名稱
"bonus_receiver" => $region_director_id, #發放人員
"bonus_amount" => round($region_director_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +12 months")), #預計發放時間
"bonus_regulation" => "訂金收回後次月發放" #發放規定
]);
#專任契約經理獎金
if ($regular_contract_manger_id != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +12 months")), #預計發放時間
"bonus_regulation" => "訂金收回後次月發放" #發放規定
]);
}
#地區處長獎金、專任契約經理、契約員獎金
switch ($payment_period) {
#簽長約免費贈送控制系統,因屬於公司特殊政策,所以無汰改獎金,合約期內每月領取契約獎金
#總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期,
#年繳
case 'annually':
$payment_ratio_due_array = array();
$a = $payment_period_amount / 12;
for ($i = 0; $i < $a; $i++) {
array_push($payment_ratio_due_array, 1 / $a);
}
$payday_due_array = array();
for ($i = 0; $i < $a; $i++) {
array_push($payday_due_array, $i + 1);
}
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] year")), #預計發放時間
"bonus_regulation" => "每次收款後,按收款比率次月發放" #發放規定
]);
}
break;
#半年繳
case 'semiannually':
$payment_ratio_due_array = array();
$a = $payment_period_amount / 6;
for ($i = 0; $i < $a; $i++) {
array_push($payment_ratio_due_array, 1 / $a);
}
$payday_due_array = array();
for ($i = 0; $i < $a; $i++) {
array_push($payday_due_array, ($i + 1) * 6);
}
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每次收款後,按收款比率次月發放" #發放規定
]);
}
break;
#季繳
case 'quarterly':
$a = $payment_period_amount / 3;
$payment_ratio_due_array = array();
for ($i = 0; $i < $a; $i++) {
array_push($payment_ratio_due_array, 1 / $a);
}
$payday_due_array = array();
for ($i = 0; $i < $a; $i++) {
array_push($payday_due_array, ($i + 1) * 4);
}
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
#雙月繳
case 'bimonthly':
$a = $payment_period_amount / 2;
$payment_ratio_due_array = array();
for ($i = 0; $i < $a; $i++) {
array_push($payment_ratio_due_array, 1 / $a);
}
$payday_due_array = array();
for ($i = 0; $i < $a; $i++) {
array_push($payday_due_array, ($i + 1) * 2);
}
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
break;
#月繳
case 'monthly':
#產生契約員每個月的獎金應發比例
$payment_ratio_due_array = array();
for ($i = 0; $i < $payment_period_amount; $i++) {
array_push($payment_ratio_due_array, 1 / $payment_period_amount);
}
$payday_due_array = array();
for ($i = 0; $i < $payment_period_amount; $i++) {
array_push($payday_due_array, $i + 1);
}
for ($i = 0; $i < count($payment_ratio_due_array); $i++) {
if ($i < count($payment_ratio_due_array) - 1) {
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額
} else {
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額
};
array_push($bonus_array, [
"bonus_type" => "1", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
}
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"pay_day_due" => "9999-1-1", #預計發放時間
"bonus_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
}
return $result_array;
};

14
wms/cont/api/postElevatorPricereview.php

@ -26,7 +26,7 @@ $status = $_POST['status'];
$elevators = json_decode($_POST['elevators'], true); $elevators = json_decode($_POST['elevators'], true);
$otherOptions = json_decode($_POST['otherOptions'], true); $otherOptions = json_decode($_POST['otherOptions'], true);
$payment_kind = $_POST['pay_method']; $payment_kind = $_POST['pay_method'];
$current_date = date("Y-M-d H:i:s"); $current_date = date("Y-m-d H:i:s");
$total_price = $_POST['total_price']; $total_price = $_POST['total_price'];
$total_sale_price = $_POST['total_sale_price']; $total_sale_price = $_POST['total_sale_price'];
@ -161,8 +161,8 @@ try{
$stmt->bindParam(':create_at', $current_date); $stmt->bindParam(':create_at', $current_date);
$stmt->execute(); $stmt->execute();
$sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, item_no, 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) $sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, item_no, 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, inspection_fee, cmstatus, updated_at, creater, created_at)
VALUES (:apply_key, :item_no, :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, :item_no, :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, :inspection_fee, :cmstatus, :updated_at, :creater, :created_at) ";
foreach($elevators as $elevator){ foreach($elevators as $elevator){
$register_code = (empty($elevator['permitNumber'])) ? "A" : $elevator['permitNumber']; $register_code = (empty($elevator['permitNumber'])) ? "A" : $elevator['permitNumber'];
@ -207,6 +207,7 @@ try{
$stmt->bindParam(':management_expense', $elevator['management_expense']); $stmt->bindParam(':management_expense', $elevator['management_expense']);
$stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']); $stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']);
$stmt->bindParam(':service_expense', $elevator['service_expense']); $stmt->bindParam(':service_expense', $elevator['service_expense']);
$stmt->bindParam(':inspection_fee', $elevator['inspectionFee']);
$stmt->bindParam(':cmstatus', $cmstatus); $stmt->bindParam(':cmstatus', $cmstatus);
$stmt->bindParam(':updated_at', $updated_at); $stmt->bindParam(':updated_at', $updated_at);
$stmt->bindParam(':creater', $creater); $stmt->bindParam(':creater', $creater);
@ -306,8 +307,8 @@ try{
$stmt->execute(); $stmt->execute();
} }
foreach($onlyInNewIds as $newidx){ foreach($onlyInNewIds as $newidx){
$sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, item_no, 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) $sql_str = "INSERT INTO con_maintance_examine_clear (apply_key, item_no, 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, inspection_fee, cmstatus, updated_at, creater, created_at)
VALUES (:apply_key, :item_no, :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, :item_no, :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, :inspection_fee, :cmstatus, :updated_at, :creater, :created_at) ";
$elevator = array_values(array_filter($elevators, fn($el)=> $el['id'] == $newidx))[0]; $elevator = array_values(array_filter($elevators, fn($el)=> $el['id'] == $newidx))[0];
$register_code = empty($elevator['permitNumber']) ? "A" : $elevator['permitNumber']; $register_code = empty($elevator['permitNumber']) ? "A" : $elevator['permitNumber'];
if($elevator['spec'] == "MAE100") $elevator_kind = "A"; if($elevator['spec'] == "MAE100") $elevator_kind = "A";
@ -350,6 +351,7 @@ try{
$stmt->bindParam(':management_expense', $elevator['management_expense']); $stmt->bindParam(':management_expense', $elevator['management_expense']);
$stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']); $stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']);
$stmt->bindParam(':service_expense', $elevator['service_expense']); $stmt->bindParam(':service_expense', $elevator['service_expense']);
$stmt->bindParam(':inspection_fee', $elevator['inspectionFee']);
$stmt->bindParam(':cmstatus', $cmstatus); $stmt->bindParam(':cmstatus', $cmstatus);
$stmt->bindParam(':updated_at', $updated_at); $stmt->bindParam(':updated_at', $updated_at);
$stmt->bindParam(':creater', $creater); $stmt->bindParam(':creater', $creater);
@ -383,6 +385,7 @@ try{
management_expense=:management_expense, management_expense=:management_expense,
annual_survey_expense=:annual_survey_expense, annual_survey_expense=:annual_survey_expense,
service_expense=:service_expense, service_expense=:service_expense,
inspection_fee=:inspection_fee,
cmstatus=:cmstatus, cmstatus=:cmstatus,
updated_at=:updated_at updated_at=:updated_at
WHERE (apply_key, item_no) = (:apply_key, :item_no)"; WHERE (apply_key, item_no) = (:apply_key, :item_no)";
@ -429,6 +432,7 @@ try{
$stmt->bindParam(':management_expense', $elevator['management_expense']); $stmt->bindParam(':management_expense', $elevator['management_expense']);
$stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']); $stmt->bindParam(':annual_survey_expense', $elevator['yearCheckFee']);
$stmt->bindParam(':service_expense', $elevator['service_expense']); $stmt->bindParam(':service_expense', $elevator['service_expense']);
$stmt->bindParam(':inspection_fee', $elevator['inspectionFee']);
$stmt->bindParam(':cmstatus', $cmstatus); $stmt->bindParam(':cmstatus', $cmstatus);
$stmt->bindParam(':updated_at', $updated_at); $stmt->bindParam(':updated_at', $updated_at);

154
wms/cont/js/pricereviewAlpine.js

@ -38,10 +38,11 @@ const pricereviewCreate = ()=>{
method:'', //保養方式 method:'', //保養方式
checkYear:'', //竣工檢查年度 checkYear:'', //竣工檢查年度
lastDate:'', // 上次年檢日期 lastDate:'', // 上次年檢日期
yearCheckFee:'', //年檢費用 yearCheckFee:1260, //年檢費用
price:'', //公司發布價(月) price:'', //公司發布價(月)
qty:1, //電梯數量 qty:1, //電梯數量
sale_price:'', //契約報價 sale_price:'', //契約報價
inspectionFee:0, //檢驗費
}, },
otherOptions: otherOptions, otherOptions: otherOptions,
modalOtherOptionInfo:{ modalOtherOptionInfo:{
@ -63,6 +64,7 @@ const pricereviewCreate = ()=>{
warranty_rate: warranty_rate, warranty_rate: warranty_rate,
attatch1:'', attatch1:'',
attatch2:'', attatch2:'',
error:[],
openCreateElevatorModal(){ openCreateElevatorModal(){
this.modalShow.elevator = true; this.modalShow.elevator = true;
body.style.overflow = 'hidden'; body.style.overflow = 'hidden';
@ -84,10 +86,11 @@ const pricereviewCreate = ()=>{
method:'', //保養方式 method:'', //保養方式
checkYear:'', //竣工檢查年度 checkYear:'', //竣工檢查年度
lastDate:'', // 上次年檢日期 lastDate:'', // 上次年檢日期
yearCheckFee:'', //年檢費用 yearCheckFee:1260, //年檢費用
price:'', //公司發布價(月) price:'', //公司發布價(月)
qty:1, //電梯數量 qty:1, //電梯數量
sale_price:'', //契約報價 sale_price:'', //契約報價
inspectionFee:0,
}; };
}, },
createElevatorFn(){ createElevatorFn(){
@ -98,6 +101,7 @@ const pricereviewCreate = ()=>{
// if(this.modalElevatorInfo.speed == '') return alert("請選擇速度"); // if(this.modalElevatorInfo.speed == '') return alert("請選擇速度");
// if(this.modalElevatorInfo.brand == '') return alert("請選擇品牌"); // if(this.modalElevatorInfo.brand == '') return alert("請選擇品牌");
// if(this.modalElevatorInfo.months == '') return alert("請輸入保養月數"); // if(this.modalElevatorInfo.months == '') return alert("請輸入保養月數");
if(this.modalElevatorInfo.m1 == 'Y' && this.modalElevatorInfo.months < 60) return alert('贈送M1保養月數不得小於60!')
// if(this.modalElevatorInfo.method == '') return alert("請選擇保養方式"); // if(this.modalElevatorInfo.method == '') return alert("請選擇保養方式");
// if(this.modalElevatorInfo.cycle == '') return alert("請選擇保養週期"); // if(this.modalElevatorInfo.cycle == '') return alert("請選擇保養週期");
// if(this.modalElevatorInfo.checkYear == '') return alert("請輸入竣工檢查年度"); // if(this.modalElevatorInfo.checkYear == '') return alert("請輸入竣工檢查年度");
@ -122,7 +126,8 @@ const pricereviewCreate = ()=>{
yearCheckFee: this.modalElevatorInfo.yearCheckFee, yearCheckFee: this.modalElevatorInfo.yearCheckFee,
price: this.modalElevatorInfo.price, price: this.modalElevatorInfo.price,
qty: this.modalElevatorInfo.qty, qty: this.modalElevatorInfo.qty,
sale_price: this.modalElevatorInfo.sale_price sale_price: this.modalElevatorInfo.sale_price,
inspectionFee: this.modalElevatorInfo.inspectionFee
}) })
this.hideCreateElevatorModal(); this.hideCreateElevatorModal();
}, },
@ -143,6 +148,7 @@ const pricereviewCreate = ()=>{
const price = this.elevators[idx].price; const price = this.elevators[idx].price;
const qty = this.elevators[idx].qty; const qty = this.elevators[idx].qty;
const sale_price = this.elevators[idx].sale_price; const sale_price = this.elevators[idx].sale_price;
const inspectionFee = this.elevators[idx].inspectionFee;
this.total_spec ++; this.total_spec ++;
this.elevators.push({ this.elevators.push({
id: this.total_spec, id: this.total_spec,
@ -162,7 +168,8 @@ const pricereviewCreate = ()=>{
yearCheckFee: yearCheckFee, yearCheckFee: yearCheckFee,
price: price, price: price,
qty: qty, qty: qty,
sale_price: sale_price sale_price: sale_price,
inspectionFee: inspectionFee
}) })
}, },
removeElevator(id){ removeElevator(id){
@ -270,6 +277,25 @@ const pricereviewCreate = ()=>{
removeOtherOption(id){ removeOtherOption(id){
this.otherOptions = this.otherOptions.filter(option=> option.id != id) this.otherOptions = this.otherOptions.filter(option=> option.id != id)
}, },
checkMonths(idx=null){
if(this.elevators[idx].months < 60 && this.elevators[idx].m1 == 'Y'){
alert('贈送M1保養月數不得小於60!')
this.elevators[idx].months = 60
}
},
changeMonths(idx=null){
if(idx===null){
if(this.modalElevatorInfo.m1 == 'N') return;
if(this.modalElevatorInfo.months < 60){
this.modalElevatorInfo.months = 60
}
return;
}
if(this.elevators[idx].m1 == 'N') return;
if(this.elevators[idx].months < 60){
this.elevators[idx].months = 60
}
},
get totalPrice(){ get totalPrice(){
let total_price = this.elevators.reduce((accumulator, el) => accumulator + Number(el.price*el.months), 0); let total_price = this.elevators.reduce((accumulator, el) => accumulator + Number(el.price*el.months), 0);
let total_other_price = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.price*option.num), 0); let total_other_price = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.price*option.num), 0);
@ -277,7 +303,7 @@ const pricereviewCreate = ()=>{
}, },
get totalSalePrice(){ get totalSalePrice(){
let total_sale_price = this.elevators.reduce((accumulator, el) => accumulator + Number(el.sale_price*el.months), 0); let total_sale_price = this.elevators.reduce((accumulator, el) => accumulator + Number(el.sale_price*el.months), 0);
return total_sale_price + Number(this.serviceFee); return total_sale_price;
}, },
get totalElevatorsNum(){ get totalElevatorsNum(){
let total_num = this.elevators.reduce((accumulator, el) => accumulator + Number(el.qty), 0); let total_num = this.elevators.reduce((accumulator, el) => accumulator + Number(el.qty), 0);
@ -291,6 +317,9 @@ const pricereviewCreate = ()=>{
let total_other_price = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.price*option.num), 0); let total_other_price = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.price*option.num), 0);
return total_other_price; return total_other_price;
}, },
get discountRate(){
return Math.round((Number(this.totalSalePrice) - Number(this.serviceFee)) / Number(this.totalPrice) * 1000) / 1000
},
async getModalElevatorPrice(){ async getModalElevatorPrice(){
const spec = this.modalElevatorInfo.spec const spec = this.modalElevatorInfo.spec
const person = this.modalElevatorInfo.person const person = this.modalElevatorInfo.person
@ -366,7 +395,53 @@ const pricereviewCreate = ()=>{
} }
}) })
}, },
validation(){
this.error = [];
if(this.totalElevatorsNum == 0) this.error.push("請至少輸入一種電梯");
for(let i=0;i<this.elevators.length;i++){
if(this.elevators[i].spec =='') this.error.push("整機單價:規格不能為空");
if(this.elevators[i].person =='') this.error.push("整機單價:人數不能為空");
if(this.elevators[i].stop =='' || this.elevators[i].stop <= 0 || !Number.isInteger(Number(this.elevators[i].stop))) this.error.push("整機單價:停數需為正整數");
if(this.elevators[i].speed =='') this.error.push("整機單價:速度不能為空");
if(this.elevators[i].price =='') this.error.push("整機單價:公司發布價無此規格");
if(this.elevators[i].sale_price == '' || this.elevators[i].spec_price <= 0) this.error.push("整機單價:售價需大於0");
if(this.elevators[i].brand == '') this.error.push("整機單價:請選擇電梯品牌");
if(this.elevators[i].cycle == '') this.error.push("整機單價:請選擇保養週期");
if(this.elevators[i].checkYear == '') this.error.push("整機單價:請輸入竣檢年度");
if(this.elevators[i].yearCheckFee == '') this.error.push("整機單價:請輸入年檢日期");
if(this.elevators[i].lastDate == '' || this.elevators[i].lastDate == '0000-00-00') this.error.push("整機單價:請輸入最後年檢日期");
if(this.elevators[i].months == '' || this.elevators[i].months <= 0) this.error.push("整機單價:保養月數需大於0");
if(this.elevators[i].qty <= 0) this.error.push("整機單價:電梯數量需大於0");
if(this.elevators[i].weight ==='' || this.elevators[i].weight <= 0) this.error.push("整機單價:電梯載重需大於0");
if(this.elevators[i].inspectionFee ==='' || this.elevators[i].inspectionFee < 0) this.error.push("整機單價:檢測費用需大於0");
}
for(let i=0;i<this.otherOptions.length;i++){
if(this.otherOptions[i].name == '' ) this.error.push("附加項目:名稱不得為空");
if(this.otherOptions[i].price === '' ) this.error.push("附加項目:價錢需大於0");
if(this.otherOptions[i].num == '' ) this.error.push("附加項目:數量需大於0");
if(this.otherOptions[i].toElevator.length <= 0) this.error.push("附加項目:需配對至電梯")
}
if(this.contract_status == '') this.error.push("請選擇契約性質");
if(this.pay_method == '') this.error.push("請選擇付款方式");
if(this.case_name == '') this.error.push("請輸入案件名稱");
if(this.startDate == '' || this.startDate == '0000-00-00') this.error.push("請輸入合約開始日期");
if(this.endDate == '' ||this.endDate == '0000-00-00') this.error.push("請輸入合約結束日期");
if(this.error.length > 0){
let errortext = '';
this.error.forEach(err=>{
errortext += err+'\n';
})
alert(errortext)
console.log(this.error);
}
return this.error.length > 0 ? false : true
},
submit(){ submit(){
const validation = this.validation();
if(!validation) return
const form = new FormData(); const form = new FormData();
form.append('vol_no', this.vol_no); form.append('vol_no', this.vol_no);
form.append('apply_key', this.apply_key); form.append('apply_key', this.apply_key);
@ -420,7 +495,59 @@ const pricereviewCreate = ()=>{
if(attatch == 2){ if(attatch == 2){
this.attatch2 = e.target.files[0] this.attatch2 = e.target.files[0]
} }
},
async getBonus(idx){
let contract_type = '';
if(this.contract_status == 1){
contract_type = 'new'
}else if(this.contract_status == 2){
contract_type = 'free_to_charge'
}else if(this.contract_status == 3){
contract_type = 'renew_priceissue'
} }
const contract_years = this.isDifferenceMoreThanAYear(this.startDate, this.endDate);
const receivable_date_due = this.getNext25thDate(this.startDate);
const res = await axios.get('./api/maintaenance_contract_bonus.php', {params:
{
'contract_type':contract_type,
'contract_years': contract_years,
'discount': this.discountRate,
'fee_per_st': this.elevators[idx].sale_price,
'receivable_date_due':receivable_date_due,
'sales_id': user_id,
'region_manger_id': 'M0174',
'regular_contract_manger_id': 'M0174',
}})
console.log(res.data);
},
isDifferenceMoreThanAYear(startDate, endDate) {
const oneYear = 1000 * 60 * 60 * 24 * 365; // 毫秒數
const difference = Math.abs(endDate - startDate);
return difference > oneYear ? 'above_two' : 'one';
},
getNext25thDate(dateString) {
// 將傳入的日期字串轉換為 Date 物件
let date = new Date(dateString);
// 如果日期大於 25,則將月份加一
if (date.getDate() > 25) {
// 增加一個月
date.setMonth(date.getMonth() + 1);
}
// 設定日期為 25 號
date.setDate(25);
// 將 Date 物件格式化為 YYYY-MM-DD 字串
let year = date.getFullYear();
let month = date.getMonth() + 1; // 月份是從 0 開始的,所以加 1
month = month < 10 ? '0' + month : month; // 確保月份是兩位數
return `${year}-${month}-25`;
}
} }
} }
@ -436,6 +563,22 @@ const pricereviewCheck = ()=>{
}) })
this.elevators.forEach((elevator, idx)=>{ this.elevators.forEach((elevator, idx)=>{
if(elevator.maintain_method == 'A'){
elevator.maintain_method = '全包'
}else if(elevator.maintain_method == 'B'){
elevator.maintain_method = '半包'
}else if(elevator.maintain_method == 'C'){
elevator.maintain_method = '清包'
}
if(elevator.maintain_period == 1){
elevator.maintain_period = '月保'
}else if(elevator.maintain_period == 2){
elevator.maintain_period = '月保兩次'
}else if(elevator.maintain_period == 3){
elevator.maintain_period = '雙月保'
}else if(elevator.maintain_period == 4){
elevator.maintain_period = '季保'
}
this.elevators_total_price += elevator.stand_price*elevator.maintain_months this.elevators_total_price += elevator.stand_price*elevator.maintain_months
this.otherOptions.forEach(option=>{ this.otherOptions.forEach(option=>{
if(option.option_relate_spec == elevator.item_no){ if(option.option_relate_spec == elevator.item_no){
@ -450,6 +593,7 @@ const pricereviewCheck = ()=>{
} }
}) })
}) })
console.log(this.elevators);
if(payment_kind == "A40006"){ if(payment_kind == "A40006"){
this.payment_kind = "年繳"; this.payment_kind = "年繳";
}else if(payment_kind == "A40007"){ }else if(payment_kind == "A40007"){

21
wms/cont/pricereviewCheck.php

@ -318,14 +318,31 @@ function getSignerName($signer){
</tr> </tr>
<?php if($permissions): ?> <?php if($permissions): ?>
<tr> <tr>
<td colspan=5></td> <td colspan=5>
<div class="mi-info">
<span>電梯資訊</span>
<ul>
<li x-html="'電梯許可證號:<b>' + elevator.register_code + '</b>'"></li>
<li x-html="'電梯廠牌<b>:' + elevator.elevator_brand + '</b>'"></li>
<li x-html="'停數<b>:' + elevator.stop + '</b>'"></li>
<li x-html="'人乘<b>:' + elevator.persons + '</b>'"></li>
<li x-html="'速度<b>:' + elevator.speed + '</b>'"></li>
<li x-html="'載重<b>:' + elevator.weight + '</b>'"></li>
<li x-html="'保養方式<b>:' + elevator.maintain_method + '</b>'"></li>
<li x-html="'保養週期<b>:' + elevator.maintain_period + '</b>'"></li>
<li x-html="elevator.is_m1_bundle=='Y' ? '贈送M1::<b>是</b>' : '贈送M1::<b>否</b>'"></li>
<li x-html="'年檢費用<b>:' + elevator.annual_survey_expense.toLocaleString() + '</b>'"></li>
<li x-html="'檢測費用<b>:' + elevator.inspection_fee.toLocaleString() + '</b>'"></li>
</ul>
</div>
</td>
<td colspan=4 style="max-width:400px"> <td colspan=4 style="max-width:400px">
<div class="mi-info"> <div class="mi-info">
<span>電梯規格</span> <span>電梯規格</span>
<ul> <ul>
<li x-html="elevator.spec + '*'+elevator.maintain_months+':<b>' + (elevator.stand_price*elevator.maintain_months).toLocaleString() + '</b>'"></li> <li x-html="elevator.spec + '*'+elevator.maintain_months+':<b>' + (elevator.stand_price*elevator.maintain_months).toLocaleString() + '</b>'"></li>
</ul> </ul>
<span>除外項目</span> <span>附加項目</span>
<ul> <ul>
<template x-for="option in elevator.otherOptions"> <template x-for="option in elevator.otherOptions">
<li x-html="option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li> <li x-html="option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li>

57
wms/cont/pricereviewCreate.php

@ -19,13 +19,13 @@ $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $vol_no); $stmt->bindParam(':vol_no', $vol_no);
$stmt->execute(); $stmt->execute();
$apply = $stmt->fetch(PDO::FETCH_ASSOC); $apply = $stmt->fetch(PDO::FETCH_ASSOC);
if($apply['status'] == 'D'){ if($apply && $apply['status'] == 'D'){
echo "<script>alert('非法訪問');window.history.go(-1);</script>"; echo "<script>alert('非法訪問');window.history.go(-1);</script>";
} }
if($apply['status'] == 'YS'){ if($apply &&$apply['status'] == 'YS'){
echo "<script>alert('此單正在審核中!');window.history.go(-1);</script>"; echo "<script>alert('此單正在審核中!');window.history.go(-1);</script>";
} }
if($apply['status'] == 'YY'){ if($apply &&$apply['status'] == 'YY'){
echo "<script>alert('此單已申請過!');window.history.go(-1);</script>"; echo "<script>alert('此單已申請過!');window.history.go(-1);</script>";
} }
@ -262,12 +262,13 @@ function getApplyKey($p_yyyymm, $seq_name){
<th colspan=1>項次</th> <th colspan=1>項次</th>
<th colspan=7 style="text-align: left; padding-left: 15px;" x-text="elevator.id"></th> <th colspan=7 style="text-align: left; padding-left: 15px;" x-text="elevator.id"></th>
<th colspan="2" > <th colspan="2" >
<button class="btn btn-primary" @click="getBonus(idx)">獎金</button>
<button class="copyBtn btn btn-secondary" @click="copyElevator(idx)">複製</button> <button class="copyBtn btn btn-secondary" @click="copyElevator(idx)">複製</button>
<button class="btn btn-danger" @click="removeElevator(elevator.id)">刪除</button> <button class="btn btn-danger" @click="removeElevator(elevator.id)">刪除</button>
</th> </th>
</tr> </tr>
<tr> <tr>
<th >電梯</th> <th>電梯</th>
<td> <td>
<select class="form-control" x-model="elevator.spec" @change="getElevatorPrice(idx)"> <select class="form-control" x-model="elevator.spec" @change="getElevatorPrice(idx)">
<option value="">請選擇</option> <option value="">請選擇</option>
@ -276,15 +277,20 @@ function getApplyKey($p_yyyymm, $seq_name){
<option value="MAH100">MAH100小電梯</option> <option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option> <option value="MAF100">MAF100貨梯(有機房)</option>
</select> </select>
<span class="errortext" x-show="elevator.spec==''" x-cloak date-type="errortext">請選擇電梯機型</span>
</td> </td>
<th>載重(KG)</th> <th>載重(KG)</th>
<td> <td>
<input type="number" class="form-control" x-model="elevator.weight" @change="getElevatorPrice(idx)" @keyup="getElevatorPrice(idx)" /> <input type="number" class="form-control" x-model="elevator.weight" @change="getElevatorPrice(idx)" @keyup="getElevatorPrice(idx)" />
<span class="errortext" x-show="elevator.weight==''" x-cloak date-type="errortext">請輸入電梯載重</span>
<span class="errortext" x-show="elevator.weight!=='' && elevator.weight<=0" x-cloak date-type="errortext">載重需大於0</span>
</td> </td>
<th>停數</th> <th>停數</th>
<td> <td>
<input type="number" class="form-control" x-model="elevator.stop" @keyup="getElevatorPrice(idx)" /> <input type="number" class="form-control" x-model="elevator.stop" @keyup="getElevatorPrice(idx)" />
<span class="errortext" x-show="elevator.stop===''" x-cloak date-type="errortext">請輸入電梯停數</span>
<span class="errortext" x-show="elevator.stop!=='' && elevator.stop<2" x-cloak date-type="errortext">停數不得小於2</span>
</td> </td>
<th>速度(m/min)</th> <th>速度(m/min)</th>
<td> <td>
@ -300,6 +306,7 @@ function getApplyKey($p_yyyymm, $seq_name){
<option value="120">120</option> <option value="120">120</option>
<option value="150">150</option> <option value="150">150</option>
</select> </select>
<span class="errortext" x-show="elevator.speed===''" x-cloak date-type="errortext">請選擇電梯速度</span>
</td> </td>
<th>人乘</th> <th>人乘</th>
<td> <td>
@ -317,13 +324,20 @@ function getApplyKey($p_yyyymm, $seq_name){
<option value="20">20</option> <option value="20">20</option>
<option value="24">24</option> <option value="24">24</option>
</select> </select>
<span class="errortext" x-show="elevator.person==''" x-cloak date-type="errortext">請選擇電梯人乘</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>電梯許可證號碼</th> <th>電梯許可證號碼</th>
<td colspan=3> <td>
<input type="text" class="form-control" x-model="elevator.permitNumber" /> <input type="text" class="form-control" x-model="elevator.permitNumber" />
</td> </td>
<th>檢測費用</th>
<td>
<input type="text" class="form-control" x-model="elevator.inspectionFee" />
<span class="errortext" x-show="elevator.inspectionFee===''" x-cloak date-type="errortext">請輸入檢測費用</span>
<span class="errortext" x-show="elevator.inspectionFee!=='' && elevator.inspectionFee<0" x-cloak date-type="errortext">檢測費用不得小於0</span>
</td>
<th>品牌</th> <th>品牌</th>
<td> <td>
<select class="form-control" x-model="elevator.brand"> <select class="form-control" x-model="elevator.brand">
@ -352,20 +366,25 @@ function getApplyKey($p_yyyymm, $seq_name){
<option value='永勝'>永勝</option> <option value='永勝'>永勝</option>
<option value='其他'>其他</option> <option value='其他'>其他</option>
</select> </select>
<span class="errortext" x-show="elevator.brand==''" x-cloak date-type="errortext">請選擇電梯品牌</span>
</td> </td>
<th>竣工檢查年度(民國)</th> <th>竣工檢查年度(民國)</th>
<td> <td>
<input type="number" class="form-control" x-model="elevator.checkYear" /> <input type="number" class="form-control" x-model="elevator.checkYear" />
<span class="errortext" x-show="elevator.checkYear==''" x-cloak date-type="errortext">請輸入竣檢年度</span>
</td> </td>
<th>上次年檢日期</th> <th>上次年檢日期</th>
<td> <td>
<input type="date" class="form-control" x-model="elevator.lastDate" /> <input type="date" class="form-control" x-model="elevator.lastDate" />
<span class="errortext" x-show="elevator.lastDate=='' || elevator.lastDate=='0000-00-00'" x-cloak date-type="errortext">請輸入年檢日期</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>年檢費用(元)</th> <th>年檢費用(元)</th>
<td> <td>
<input type="number" class="form-control" x-model="elevator.yearCheckFee" /> <input type="number" class="form-control" x-model="elevator.yearCheckFee" />
<span class="errortext" x-show="elevator.yearCheckFee===''" x-cloak date-type="errortext">請輸入年檢費用</span>
<span class="errortext" x-show="elevator.yearCheckFee!=='' && elevator.yearCheckFee<0" x-cloak date-type="errortext">年檢費用不得小於0</span>
</td> </td>
<th>電梯數量</th> <th>電梯數量</th>
<td> <td>
@ -381,6 +400,7 @@ function getApplyKey($p_yyyymm, $seq_name){
<option value="3">雙月保</option> <option value="3">雙月保</option>
<option value="4">季保</option> <option value="4">季保</option>
</select> </select>
<span class="errortext" x-show="elevator.cycle==''" x-cloak date-type="errortext">請輸入保養週期</span>
</td> </td>
<th>保養方式</th> <th>保養方式</th>
<td> <td>
@ -390,10 +410,11 @@ function getApplyKey($p_yyyymm, $seq_name){
<option value="B">半包</option> <option value="B">半包</option>
<option value="C">清包</option> <option value="C">清包</option>
</select> </select>
<span class="errortext" x-show="elevator.method==''" x-cloak date-type="errortext">請輸入保養方式</span>
</td> </td>
<th>贈送M1</th> <th>贈送M1</th>
<td> <td>
<select class="form-control" x-model="elevator.m1" @change="getElevatorPrice(idx)"> <select class="form-control" x-model="elevator.m1" @change="getElevatorPrice(idx);changeMonths(idx)">
<option value="N"></option> <option value="N"></option>
<option value="Y"></option> <option value="Y"></option>
</select> </select>
@ -403,11 +424,13 @@ function getApplyKey($p_yyyymm, $seq_name){
<th>公司發布價(月)</th> <th>公司發布價(月)</th>
<td> <td>
<input type="text" class="form-control" disabled x-model="elevator.price.toLocaleString()" /> <input type="text" class="form-control" disabled x-model="elevator.price.toLocaleString()" />
<span class="errortext" x-show="elevator.price <= 0">公司無提供此規格牌價</span> <span class="errortext" x-show="elevator.spec!='' && elevator.stop!='' && elevator.speed!='' && elevator.person!='' && elevator.price <= 0">公司無提供此規格牌價</span>
</td> </td>
<th>保養月數</th> <th>保養月數</th>
<td> <td>
<input type="number" class="form-control" x-model="elevator.months" /> <input type="number" class="form-control" x-model="elevator.months" @blur="checkMonths(idx)" />
<span class="errortext" x-show="elevator.months ===''">請輸入保養月數</span>
<span class="errortext" x-show="elevator.months!=='' && elevator.months!='' && elevator.months < 1">保養月數不得低於1</span>
</td> </td>
<th>公司發布價(總價)</th> <th>公司發布價(總價)</th>
<td> <td>
@ -416,6 +439,8 @@ function getApplyKey($p_yyyymm, $seq_name){
<th>契約報價(月)</th> <th>契約報價(月)</th>
<td> <td>
<input type="number" class="form-control" x-model="elevator.sale_price" /> <input type="number" class="form-control" x-model="elevator.sale_price" />
<span class="errortext" x-show="elevator.sale_price ===''">請輸入契約報價</span>
<span class="errortext" x-show="elevator.sale_price!=='' && elevator.sale_price < 0">契約報價不得小於0</span>
</td> </td>
<th>契約報價(總價)</th> <th>契約報價(總價)</th>
<td> <td>
@ -428,7 +453,7 @@ function getApplyKey($p_yyyymm, $seq_name){
</div> </div>
<div class="divitem"> <div class="divitem">
<div class="title"> <div class="title">
<h4>除外項目</h4> <h4>附加項目</h4>
<button class="addbtn btn" @click="openCreateOtherOptionFn()" >+</button> <button class="addbtn btn" @click="openCreateOtherOptionFn()" >+</button>
</div> </div>
<table class="table" border=1> <table class="table" border=1>
@ -499,7 +524,7 @@ function getApplyKey($p_yyyymm, $seq_name){
<td><input type="text" class="form-control" x-model="totalSalePrice.toLocaleString()" disabled style="width:180px" /></td> <td><input type="text" class="form-control" x-model="totalSalePrice.toLocaleString()" disabled style="width:180px" /></td>
<td><input type="text" class="form-control" x-model="(totalSalePrice - totalPrice).toLocaleString()" disabled style="width:180px" /></td> <td><input type="text" class="form-control" x-model="(totalSalePrice - totalPrice).toLocaleString()" disabled style="width:180px" /></td>
<td> <td>
<input type="text" class="form-control" x-show="totalPrice!=0" x-model="Math.round(totalSalePrice / totalPrice * 100* 10) /10 + '%'" disabled /> <input type="text" class="form-control" x-show="totalPrice!=0" x-model="discountRate.toFixed(3)*100 + '%'" disabled />
<input type="text" class="form-control" x-show="totalPrice==0" value="0" disabled /> <input type="text" class="form-control" x-show="totalPrice==0" value="0" disabled />
</td> </td>
<td><input type="text" class="form-control" x-model="totalElevatorsNum" disabled /></td> <td><input type="text" class="form-control" x-model="totalElevatorsNum" disabled /></td>
@ -574,7 +599,7 @@ function getApplyKey($p_yyyymm, $seq_name){
const user_name = '<?php echo $user_name ?>'; const user_name = '<?php echo $user_name ?>';
const progress_remark = `<?php echo nl2br($hope_customer['progress_status']); ?>`; const progress_remark = `<?php echo nl2br($hope_customer['progress_status']); ?>`;
const memo = `<?php echo nl2br($apply['memo']); ?>`; const memo = `<?php echo $apply ? nl2br($apply['memo']) : ''; ?>`;
const contract_kind = '<?php echo $apply ? $apply['contract_kind'] : '' ?>'; const contract_kind = '<?php echo $apply ? $apply['contract_kind'] : '' ?>';
const payment_kind = '<?php echo $apply ? $apply['payment_kind'] : '' ?>'; const payment_kind = '<?php echo $apply ? $apply['payment_kind'] : '' ?>';
@ -588,10 +613,10 @@ function getApplyKey($p_yyyymm, $seq_name){
const otherOptions = [...<?php echo json_encode($otherOptions); ?>]; const otherOptions = [...<?php echo json_encode($otherOptions); ?>];
const token = '<?php echo $para = "function_name=pricereview&" . $token_link;; ?>'; const token = '<?php echo $para = "function_name=pricereview&" . $token_link;; ?>';
const penalty = '<?php echo $apply['penalty']; ?>'; const penalty = '<?php echo $apply ? $apply['penalty'] : ''; ?>';
const deposit_rate = '<?php echo $apply['deposit_rate']; ?>'; const deposit_rate = '<?php echo $apply ? $apply['deposit_rate'] : 0; ?>';
const keep_rate = '<?php echo $apply['keep_rate']; ?>'; const keep_rate = '<?php echo $apply ? $apply['keep_rate'] : 0; ?>';
const warranty_rate = '<?php echo $apply['warranty_rate']; ?>'; const warranty_rate = '<?php echo $apply ? $apply['warranty_rate'] : 0; ?>';
const service_fee = '<?php echo $apply['service_fee']; ?>'; const service_fee = '<?php echo $apply ? $apply['service_fee'] : 0; ?>';
</script> </script>

8
wms/cont/window-modal/modalElevaotr.php

@ -99,7 +99,7 @@
</select> </select>
</td> </td>
<td> <td>
<select class="form-control" x-model="modalElevatorInfo.m1" @change="getModalElevatorPrice()"> <select class="form-control" x-model="modalElevatorInfo.m1" @change="getModalElevatorPrice();changeMonths()">
<option value="N"></option> <option value="N"></option>
<option value="Y"></option> <option value="Y"></option>
</select> </select>
@ -107,11 +107,13 @@
</tr> </tr>
<tr class="table-active"> <tr class="table-active">
<th colspan=2>電梯許可證號</th> <th colspan=2>電梯許可證號</th>
<th colspan=2>保養方式</th> <th>檢測費</th>
<th>保養方式</th>
</tr> </tr>
<tr class="table-active"> <tr class="table-active">
<td colspan=2><input type="text" class="form-control" x-model="modalElevatorInfo.permitNumber" /></td> <td colspan=2><input type="text" class="form-control" x-model="modalElevatorInfo.permitNumber" /></td>
<td colspan=2> <td><input type="number" class="form-control" x-model="modalElevatorInfo.inspectionFee" /></td>
<td>
<select class="form-control" x-model="modalElevatorInfo.method" @change="getModalElevatorPrice()"> <select class="form-control" x-model="modalElevatorInfo.method" @change="getModalElevatorPrice()">
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="A">全包</option> <option value="A">全包</option>

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

@ -1,7 +1,7 @@
<div class="window-modal" x-cloak data-type="window-modal" x-show="modalShow.other" x-ref="createOtherOptionModal" id="createOtherOptionModal"> <div class="window-modal" x-cloak data-type="window-modal" x-show="modalShow.other" x-ref="createOtherOptionModal" id="createOtherOptionModal">
<div class="window-modal-content modal-xl"> <div class="window-modal-content modal-xl">
<div class="window-modal-header"> <div class="window-modal-header">
<h4>新增除外項目</h4> <h4>新增附加項目</h4>
<button class="btn btn-close" @click="hideCreateOtherOptionModal()">X</button> <button class="btn btn-close" @click="hideCreateOtherOptionModal()">X</button>
</div> </div>
<div class="window-modal-body"> <div class="window-modal-body">

11
wms/mkt/api/postNewElevatorPricereview.php

@ -695,6 +695,7 @@ try{
$sign3, $sign3,
]; ];
$sign_total = count(array_filter($signArr, fn($item)=> $item != NULL)); $sign_total = count(array_filter($signArr, fn($item)=> $item != NULL));
if($ekind == "新梯"){
//是否呈核至總經理(M0006) ,暫時不送至總經理,所以加入false //是否呈核至總經理(M0006) ,暫時不送至總經理,所以加入false
if((false && $price_rate < 80 || $special_fee > 0)){ if((false && $price_rate < 80 || $special_fee > 0)){
$sign4 = "M0006,,"; $sign4 = "M0006,,";
@ -702,6 +703,16 @@ try{
}else{ }else{
$sign4 = NULL; $sign4 = NULL;
} }
}
if($ekind == "汰改"){{
if(($price_rate < 75 || $special_fee > 0)){
$sign4 = "M0006,,";
$sign_total += 1;
}else{
$sign4 = NULL;
}
}
$sql_str = "INSERT INTO pricereview_sign (mid, sign1, sign2, sign3, sign4, sign_total) $sql_str = "INSERT INTO pricereview_sign (mid, sign1, sign2, sign3, sign4, sign_total)
VALUES (:mid, :sign1, :sign2, :sign3, :sign4, :sign_total)"; VALUES (:mid, :sign1, :sign2, :sign3, :sign4, :sign_total)";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);

2
wms/mkt/assets/js/pricereviewAlpine0311.js

@ -819,6 +819,7 @@ const pricereviewCreate = ()=>{
error: [], error: [],
validation(){ validation(){
this.error = [] this.error = []
if(this.totalElevatorsNum() == 0) this.error.push("請至少輸入一種電梯");
for(let i=0;i<this.elevators.length;i++){ for(let i=0;i<this.elevators.length;i++){
if(this.elevators[i].specifications =='') this.error.push("整機單價:規格不能為空"); if(this.elevators[i].specifications =='') this.error.push("整機單價:規格不能為空");
if(this.elevators[i].person =='') this.error.push("整機單價:人數不能為空"); if(this.elevators[i].person =='') this.error.push("整機單價:人數不能為空");
@ -862,7 +863,6 @@ const pricereviewCreate = ()=>{
return this.error.length > 0 ? false : true return this.error.length > 0 ? false : true
}, },
submit(){ submit(){
console.log(this.is_renovation);
const validation = this.validation(); const validation = this.validation();
if(!validation) return if(!validation) return
const form = new FormData(); const form = new FormData();

15
wms/sign/list.php

@ -114,8 +114,7 @@ JOIN
subflow subflow
GROUP BY GROUP BY
form_key form_key
) AS sf ON d.form_key = sf.form_key
ORDER BY update_date DESC) AS sf ON d.form_key = sf.form_key
JOIN JOIN
subflow c ON c.form_key = sf.form_key AND c.seq = sf.max_seq subflow c ON c.form_key = sf.form_key AND c.seq = sf.max_seq
WHERE WHERE
@ -123,6 +122,7 @@ WHERE
AND b.flow_id NOT IN ('wws04') AND b.flow_id NOT IN ('wws04')
$where_system_id $where_system_id
$where_flow_id $where_flow_id
ORDER BY c.update_date DESC, c.form_key DESC
"; ";
// echo '<pre>'; // echo '<pre>';
// print_r($sql_get); // print_r($sql_get);
@ -196,6 +196,7 @@ function getPricereviewDataByFormkey($form_key){
text-align: right; text-align: right;
} }
</style> </style>
<form method='post' action='#'> <form method='post' action='#'>
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'> <table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'>
<thead> <thead>
@ -240,7 +241,7 @@ function getPricereviewDataByFormkey($form_key){
</tfoot> </tfoot>
</table> </table>
<div style="overflow-x:auto;width:92%;margin:0 auto"> <div style="overflow-x:auto;width:92%;margin:0 auto">
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact"> <table id="table_index2" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact">
<thead> <thead>
<tr> <tr>
<th style="width:400px;">序號</th> <th style="width:400px;">序號</th>
@ -313,6 +314,13 @@ function getPricereviewDataByFormkey($form_key){
</table> </table>
</div> </div>
</form> </form>
<script>
$(document).ready(function() {
$('#table_index2').DataTable( {
order: [[ 3, 'desc' ]]
} );
} );
</script>
<?php <?php
#代錶結束連線 #代錶結束連線
mysqli_close($link); mysqli_close($link);
@ -320,3 +328,4 @@ require_once "../footer.php";
?> ?>

Loading…
Cancel
Save