Browse Source

契約簽回

main
Cheng 1 year ago
parent
commit
3aa59d03d5
  1. 4
      wms/bonus/api/postSchedule.php
  2. 162
      wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_1.php
  3. 68
      wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php
  4. 38
      wms/class/T8API.php
  5. 8
      wms/contract/api/T8api.php
  6. 62
      wms/contract/api/postContractData.php
  7. 59
      wms/contract/api/test copy.json
  8. 17
      wms/contract/api/testT8API.php
  9. 10
      wms/contract/api/testocde.php
  10. 22
      wms/contract/contract-input.php
  11. 9
      wms/contract/js/alpine.js
  12. 16
      wms/schedule-edit.php
  13. 20
      wms/schedule-index.php
  14. 66
      wms/schedule-setting-repaire-update.php
  15. 192
      wms/schedule-setting-repaire.php

4
wms/bonus/api/postSchedule.php

@ -1,4 +0,0 @@
<?php
include_once "./wms/contract/conn.php";
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : '';
$facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : '';

162
wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_1.php

@ -7,7 +7,9 @@
【1.輸入參數:】 【1.輸入參數:】
獎金版本($ver):1.0 獎金版本($ver):1.0
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) 合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
作番賣價($elevator_knockdown_price):電梯的合約最後成交價 1.0 作番賣價($elevator_knockdown_price):電梯的合約最後成交價
1.0_1 作番賣價($elevator_knockdown_price) : 電梯合約價格收款階段比例金額
營業員員工號($sales_id) 營業員員工號($sales_id)
區域經理員工號($region_manger_id) 區域經理員工號($region_manger_id)
@ -34,58 +36,59 @@ result_array[
*/ */
/* paykind_arr =[
[
pay_kind -- 1=訂金、2=二次款、3=貨到工地款、4=材料其他、5=安裝完畢、6=驗收款、7=其他安裝款
pay_scale -- 百分比
pay_amount -- 金額
],
[
]
]
*/
function elevator_new_deal_bonus_v1_0($ver, $contract_type, $elevator_knockdown_price, $elevator_pay_kind, $sales_id, $region_manger_id) function elevator_new_deal_bonus_v1_0($ver, $contract_type, $elevator_pay_kind, $sales_id, $region_manger_id)
{ {
// echo "<pre>";
// print_r($elevator_pay_kind);
// echo "</pre>";
// exit;
$bonus_array = []; $bonus_array = [];
if ($ver == "1.0") { if ($ver == "1.0") {
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) #合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
foreach ($elevator_pay_kind as $elevator_pay_kind) {
switch ($contract_type) { switch ($contract_type) {
case "strategy_customer": case "strategy_customer":
#契約員獎金($sales_bonus) #契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.007; $sales_bonus = $elevator_pay_kind['pay_amount'] * 0.007;
#地區經理經理獎金($region_manager_bonus) #地區經理經理獎金($region_manager_bonus)
$region_manager_bonus = 400; $region_manager_bonus = 400;
break; break;
case "general_customer": case "general_customer":
#契約員獎金($sales_bonus) #契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.015; $sales_bonus = $elevator_pay_kind['pay_amount'] * 0.015;
#區域經理獎金($region_manager_bonus) #區域經理獎金($region_manager_bonus)
$region_manager_bonus = 600; $region_manager_bonus = 600;
break; break;
}; };
$pay_scale = $elevator_pay_kind['pay_scale'];
// echo "<pre>";
// print_r($pay_scale);
// echo "</pre>";
switch ($elevator_pay_kind['pay_kind']) {
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20% case '1':
array_push($bonus_array, [ array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱 "bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員 "bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.2), #金額 "bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "deposit", #訂金已收款20% "payment_schedul_due" => "deposit", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定 "payment_schedul_regulation" => "訂金已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]); ]);
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.5), #金額
"payment_schedul_due" => "shipping", #訂金已收款20%
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定
]);
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.3), #金額
"payment_schedul_due" => "acceptance", #訂金已收款20%
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定
]);
#區域經理獎金水庫-----訂金已收款100%,發放總獎金50%
array_push($bonus_array, [ array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 "bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員 "bonus_receiver" => $region_manger_id, #發放人員
@ -93,8 +96,25 @@ function elevator_new_deal_bonus_v1_0($ver, $contract_type, $elevator_knockdown_
"payment_schedul_due" => "deposit", #訂金已收款100% "payment_schedul_due" => "deposit", #訂金已收款100%
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定 "payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定
]); ]);
break;
case '2':
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-二次段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "twice", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]);
break;
case '3':
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-貨到工地款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "shipping", #訂金已收款20%
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]);
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50%
array_push($bonus_array, [ array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱 "bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員 "bonus_receiver" => $region_manger_id, #發放人員
@ -102,12 +122,100 @@ function elevator_new_deal_bonus_v1_0($ver, $contract_type, $elevator_knockdown_
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100% "payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100%
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定 "payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定
]); ]);
break;
case '4':
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-材料其他段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "other", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]);
break;
case '5':
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-安裝完畢段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "installed", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]);
break;
case '6':
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "acceptance", #訂金已收款20%
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]);
break;
case '7':
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-安裝其他段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => $sales_bonus, #金額
"payment_schedul_due" => "installOther", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
]);
break;
}
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20%
// array_push($bonus_array, [
// "bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
// "bonus_receiver" => $sales_id, #發放人員
// "bonus_amount" => round($sales_bonus * 0.2), #金額
// "payment_schedul_due" => "deposit", #訂金已收款20%
// "payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定
// ]);
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%
// array_push($bonus_array, [
// "bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱
// "bonus_receiver" => $sales_id, #發放人員
// "bonus_amount" => round($sales_bonus * 0.5), #金額
// "payment_schedul_due" => "shipping", #訂金已收款20%
// "payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定
// ]);
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%
// array_push($bonus_array, [
// "bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
// "bonus_receiver" => $sales_id, #發放人員
// "bonus_amount" => round($sales_bonus * 0.3), #金額
// "payment_schedul_due" => "acceptance", #訂金已收款20%
// "payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定
// ]);
#區域經理獎金水庫-----訂金已收款100%,發放總獎金50%
// array_push($bonus_array, [
// "bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱
// "bonus_receiver" => $region_manger_id, #發放人員
// "bonus_amount" => round($region_manager_bonus * 0.5), #金額
// "payment_schedul_due" => "deposit", #訂金已收款100%
// "payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定
// ]);
// #區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50%
// array_push($bonus_array, [
// "bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱
// "bonus_receiver" => $region_manger_id, #發放人員
// "bonus_amount" => round($region_manager_bonus * 0.5), #金額
// "payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100%
// "payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定
// ]);
$result_array = [ $result_array = [
"ver" => $ver, #獎金版本 "ver" => $ver, #獎金版本
"result_status" => "success", #計算結果 "result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫 "bonus_array" => $bonus_array #獎金水庫
]; ];
}
} else { } else {
array_push($bonus_array, [ array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱 "bonus_type" => "error", #獎金名稱

68
wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php

@ -1,9 +1,15 @@
<?php <?php
/* 函數用法與參數 /*
獎金辦法 1.0_1 說明,需要查看合約收入的款項去發放該款項的獎金
函數用法與參數
【1.輸入參數:】 【1.輸入參數:】
獎金版本($ver):1.0 獎金版本($ver):1.0
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) 合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
作番賣價($elevator_knockdown_price):電梯的合約最後成交價 1.0 作番賣價($elevator_knockdown_price):電梯的合約最後成交價
1.0_1 作番賣價($elevator_knockdown_price) : 電梯合約價格收款階段比例金額
營業員員工號($sales_id) 營業員員工號($sales_id)
區域經理員工號($region_manger_id) 區域經理員工號($region_manger_id)
@ -30,25 +36,59 @@ result_array[
*/ */
/* paykind_arr =[
[
pay_kind -- 1=訂金、2=二次款、3=貨到工地款、4=材料其他、5=安裝完畢、6=驗收款、7=其他安裝款
pay_scale -- 百分比
pay_amount -- 金額
],
[
]
]
*/
require_once("elevator_new_deal_bonus_v1_0.php"); require_once("elevator_new_deal_bonus_v1_0_1.php");
#$ver, $contract_type, $elevator_knockdown_price, $sales_id, $region_manger_id #$ver, $contract_type, $elevator_knockdown_price, $sales_id, $region_manger_id
#獎金測試 #獎金測試
$pay_kind_arr = [
[
"pay_kind" => '1',
"pay_scale" => 20,
"pay_amount" => 318000
],
[
"pay_kind" => '3',
"pay_scale" => 50,
"pay_amount" => 795000
],
[
"pay_kind" => '5',
"pay_scale" => 20,
"pay_amount" => 318000
],
[
"pay_kind" => '6',
"pay_scale" => 10,
"pay_amount" => 159000
]
];
$examination_array = [ $examination_array = [
#錯誤版本 #錯誤版本
["2.0","strategy_customer",1000000,"M0001", "M0003"], ["1.0", "strategy_customer", ($pay_kind_arr), "M0001", "M0003"],
#戰略客戶(strategy_customer) #戰略客戶(strategy_customer)
["1.0","strategy_customer",1000000,"M0001", "M0003"], #戰略客戶 // ["1.0", "strategy_customer", 1000000, "M0001", "M0003"], #戰略客戶
#一般客戶(general_customer) // #一般客戶(general_customer)
["1.0","general_customer",1000000,"M0001", "M0003"] #一般客戶 ["1.0", "general_customer", $pay_kind_arr, "M0001", "M0003"] #一般客戶
]; ];
for($i = 0; $i<count($examination_array); $i++){ for ($i = 0; $i < count($examination_array); $i++) {
$result = elevator_new_deal_bonus_v1_0( $result = elevator_new_deal_bonus_v1_0(
$examination_array[$i][0], $examination_array[$i][0],
$examination_array[$i][1], $examination_array[$i][1],
@ -56,17 +96,17 @@ for($i = 0; $i<count($examination_array); $i++){
$examination_array[$i][3], $examination_array[$i][3],
$examination_array[$i][4] $examination_array[$i][4]
); );
// echo "<pre>";
// print_r($examination_array);
// echo "</pre>";
echo "獎金版本:" . $result["ver"] . "<br>"; echo "獎金版本:" . $result["ver"] . "<br>";
echo "計算結果:" . $result["result_status"] . "<br>"; echo "計算結果:" . $result["result_status"] . "<br>";
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . "<br>"; echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . "<br>";
for($j = 0; $j<count($result["bonus_array"]); $j++){ for ($j = 0; $j < count($result["bonus_array"]); $j++) {
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " "
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " " . $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " "
. $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>"; . $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>";
}; };
echo "-------------------------" . "<br>"; echo "-------------------------" . "<br>";
}; };
?>

38
wms/class/T8API.php

@ -0,0 +1,38 @@
<?php
require_once("../T8_Authorization_from_bpm.php");
function T8salIncomeApply($data, $api_url)
{
$validation = get_Auth();
$header = [
"CHI_Authorization :" . $validation,
"GroupId:TEST"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1); // 使用 POST
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
$response = curl_exec($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
$result = json_decode($response, true);
// 若 API 傳入失敗。
if ($result['Status'] == 'Erroe') {
echo 'API傳入失敗,' . $result['ErrorMsg'];
return $result;
} else {
// print_r($result);
return $result;
}
return $result;
}
curl_close($ch);
}

8
wms/contract/api/T8api.php

@ -4,12 +4,8 @@ require_once("../../T8_Authorization_from_bpm.php");
function T8salIncomeApply($data, $api_url) function T8salIncomeApply($data, $api_url)
{ {
// $api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData';
$validation = get_Auth(); $validation = get_Auth();
echo '<pre>';
print_r($validation);
echo '</pre>';
// exit;
$header = [ $header = [
"CHI_Authorization :" . $validation, "CHI_Authorization :" . $validation,
"GroupId:TEST" "GroupId:TEST"
@ -29,7 +25,7 @@ function T8salIncomeApply($data, $api_url)
$result = json_decode($response, true); $result = json_decode($response, true);
// 若 API 傳入失敗。 // 若 API 傳入失敗。
if ($result['Status'] == 'Erroe') { if ($result['Status'] == 'Erroe') {
echo 'API傳入失敗,' . $result['ErrorMsg']; // echo 'API傳入失敗,' . $result['ErrorMsg'];
return $result; return $result;
} else { } else {
// print_r($result); // print_r($result);

62
wms/contract/api/postContractData.php

@ -1,4 +1,3 @@
<?php <?php
header("Content-Type: text/html; charset=utf-8"); header("Content-Type: text/html; charset=utf-8");
require_once("../conn.php"); require_once("../conn.php");
@ -11,7 +10,7 @@ include_once("../../class/Cmail.php");
ini_set('date.timezone', 'Asia/Taipei'); ini_set('date.timezone', 'Asia/Taipei');
//保養簽回 //保養簽回
if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') { if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') {
// try { try {
$mail = new Cmail(); $mail = new Cmail();
$created_at = date('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s');
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null; $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
@ -42,7 +41,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$contract_type = !empty($_POST['contract_type']) ? $_POST['contract_type'] : null; $contract_type = !empty($_POST['contract_type']) ? $_POST['contract_type'] : null;
$signing_date = !empty($_POST['signing_date']) ? $_POST['signing_date'] : null; $signing_date = !empty($_POST['signing_date']) ? $_POST['signing_date'] : null;
$token = !empty($_POST['token']) ? $_POST['token'] : ''; $token = !empty($_POST['token']) ? $_POST['token'] : '';
$maintance_manager = !empty($_POST['maintance_manager']) ? $_POST['maintance_manager'] : '';
$sql = "SELECT * FROM account WHERE accountid = '$salesman'"; $sql = "SELECT * FROM account WHERE accountid = '$salesman'";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(); $stmt->execute();
@ -91,6 +90,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
if ($num == '') $fail_arr[] = '電梯數量為必填'; if ($num == '') $fail_arr[] = '電梯數量為必填';
if ($payType == '') $fail_arr[] = '分期方式為必填'; if ($payType == '') $fail_arr[] = '分期方式為必填';
if ($contract_type == '') $fail_arr[] = '合約類別為必填'; if ($contract_type == '') $fail_arr[] = '合約類別為必填';
if ($maintance_manager == '') $fail_arr[] = '保養經理為必填';
//------------------- //-------------------
// if ($partyA == '') $fail_arr[] = '業務聯繫人為必填'; // if ($partyA == '') $fail_arr[] = '業務聯繫人為必填';
@ -108,8 +108,9 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
echo json_encode($fail_arr, JSON_UNESCAPED_UNICODE); echo json_encode($fail_arr, JSON_UNESCAPED_UNICODE);
exit(); exit();
} }
// T8insert($_POST, $facilityno, $depId, $connT8); exit();
T8insert($_POST, $facilityno, $depId, $connT8);
exit();
/// 獎金計算 /// 獎金計算
$aaa = bonusCreate($_POST, $facilityno, $conn); $aaa = bonusCreate($_POST, $facilityno, $conn);
if (!empty($aaa) && $aaa['status'] == 2) { if (!empty($aaa) && $aaa['status'] == 2) {
@ -293,27 +294,34 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
// $regular_contract_manger_id = $elevators[$idx]['regular_contract_manger_id']; // $regular_contract_manger_id = $elevators[$idx]['regular_contract_manger_id'];
// $sql = "SELECT * FROM account WHERE accountid = '' "; // $sql = "SELECT * FROM account WHERE accountid = '' ";
$regular_contract_manger_id = !empty($elevators[$key]['regular_contract_manger_id']) ? $elevators[$key]['regular_contract_manger_id'] : ''; $sql = "SELECT * FROM account WHERE accountid = '$maintance_manager' ";
// if ($regular_contract_manger_id != '') {
$sql = "SELECT * FROM account WHERE accountid = '$regular_contract_manger_id' ";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(); $stmt->execute();
$regular_contract_manger_mail = $stmt->fetch(PDO::FETCH_ASSOC); $maintance_manager_detail = $stmt->fetch(PDO::FETCH_ASSOC);
// 寄郵件給 輸入合約助理,請他安排保養計畫
$mail_title = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-營業經理提交至設計階段"; // 北北基 : M0090
$mail_content = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-營業經理提交至設計階段 <a href='https://www.masada.com.tw/wms/schedule-index.php?contractno=$contractno&facilityno=$no&token=$token'>點我</a>"; // 保養組長 桃竹 : M0223
// 中部 : M0161
// 南部 : M0077
// 保養組長之後調整
$mail_title = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-請安排此作番的保養人員";
$mail_content = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-請安排此作番的保養人員 <a href='https://www.masada.com.tw/wms/schedule-index.php?contractno=$contractno&facilityno=$no&token=$token'>點我</a>";
// exit(); // exit();
$mail->sendx( $mail->sendx(
$mail_title, $mail_title,
$mail_content, $mail_content,
[ [
// [$user_id, $user_detail['email']], // [$user_id, $user_detail['email']],
// [$maintance_manager, $maintance_manager_detail['email']],
// ['M0012', 'Yingying@masada.com.tw']
// [$regular_contract_manger_id, $regular_contract_manger_mail['mail']], // [$regular_contract_manger_id, $regular_contract_manger_mail['mail']],
['M0225', 'lkmd555@masada.com.tw'] ['M0225', 'lkmd555@masada.com.tw']
// ['M0012', 'Yingying@masada.com.tw']
], ],
"永佳捷科技" "永佳捷科技"
); );
// echo 'send'; // echo 'send';
// } // }
} }
@ -433,12 +441,12 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
// Cmail->sendx; // Cmail->sendx;
// } catch (PDOException $e) { } catch (PDOException $e) {
// $conn->rollback(); $conn->rollback();
// http_response_code(404); http_response_code(404);
// echo $e->getMessage(); echo $e->getMessage();
// die('Error!:' . $e->getMessage()); die('Error!:' . $e->getMessage());
// } }
}; };
function T8insert($data, $facilityno, $depId, $connT8) function T8insert($data, $facilityno, $depId, $connT8)
@ -630,7 +638,10 @@ function T8insert($data, $facilityno, $depId, $connT8)
]; ];
// 幾年 // 幾年
// $SQuantityYear = $elevator['maintain_months'] / 12; // $SQuantityYear = $elevator['maintain_months'] / 12;
// 單台電梯契約報價
$price_of_month = intval($elevator['sold_price']); $price_of_month = intval($elevator['sold_price']);
print_r($price_of_month);
exit;
//分幾期 () => 總共保養月 / 分期月 //分幾期 () => 總共保養月 / 分期月
$SQuantitya = $elevator['maintain_months'] / $IncomeId[$payType]; $SQuantitya = $elevator['maintain_months'] / $IncomeId[$payType];
$SQuantity = $IncomeId[$payType]; $SQuantity = $IncomeId[$payType];
@ -710,14 +721,17 @@ function T8insert($data, $facilityno, $depId, $connT8)
$API_body[] = $salIncomeApplyMaster; $API_body[] = $salIncomeApplyMaster;
$API_body[] = $salIncomeApplyDetail; $API_body[] = $salIncomeApplyDetail;
// 呼叫 API // 呼叫 API
// echo '<pre>'; echo '<pre>';
// print_r(json_encode($API_body)); print_r(json_encode($API_body));
// echo '</pre>'; echo '</pre>';
// exit();
// $api_url = 'http://10.10.145.2:880/twWebAPI/V1/SALINCOMEAPPLY/PostERPData'; //正式區 // $api_url = 'http://10.10.145.2:880/twWebAPI/V1/SALINCOMEAPPLY/PostERPData'; //正式區
$api_url = "http://60.244.87.101:880/twWebAPI/V1/SALINCOMEAPPLY/PostERPData"; //測試區 $api_url = "http://60.244.87.101:880/twWebAPI/V1/SALINCOMEAPPLY/PostERPData"; //測試區
$result = T8salIncomeApply($API_body, $api_url); $result = T8salIncomeApply($API_body, $api_url);
// echo '<pre>';
// print_r($result);
// echo '</pre>';
// exit();
if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') { if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') {
http_response_code(404); http_response_code(404);
die('Error!:' . $result['ErrorMsg']); die('Error!:' . $result['ErrorMsg']);

59
wms/contract/api/test copy.json

@ -1,40 +1,43 @@
{ [
"apply_key": "MB24010007", {
"register_code": "036B017432", "apply_key": "11111111",
"register_code": "B32510261185",
"elevator_brand": "1", "elevator_brand": "1",
"elevator_kind": "A", "elevator_kind": "E",
"spec": "MAE100", "spec": "MAH100",
"weight": 550, "weight": "450",
"speed": 60, "speed": "45.00",
"stop": 12, "stop": "3",
"floors": 12, "floors": "3",
"persons": 8, "persons": "6",
"elevator_num": 0, "elevator_num": "0",
"useful_years": 83, "useful_years": "106",
"last_check_date": 1121109, "last_check_date": "1",
"speed_governors_check_expense": 0, "speed_governors_check_expense": "0",
"maintain_times": 1, "maintain_times": "1",
"is_m1_bundle": "N", "is_m1_bundle": "N",
"maintainance": "A", "maintainance": "B",
"maintain_months": 12, "maintain_months": "12",
"maintain_period": 1, "maintain_period": "1",
"stand_price": 3140, "stand_price": "1250.00",
"contract_price": 1666.67, "contract_price": "1250.00",
"sold_price": 1667, "sold_price": 1250,
"commission_expense": null, "commission_expense": null,
"management_expense": null, "management_expense": null,
"annual_survey_expense": 0, "annual_survey_expense": "0.00",
"service_expense": 8, "service_expense": 0,
"cmstatus": "Y", "cmstatus": "Y",
"updated_at": null, "updated_at": null,
"creater": null, "creater": null,
"created_at": "2024-01-10 11:16:26", "created_at": "2024-02-26 15:24:23",
"discount": 53, "discount": 100,
"opendoor": "2S",
"latitude": "112", "latitude": "112",
"longitude": "11", "longitude": "11",
"takecertificatedate": "112", "takecertificatedate": "112",
"opendoor": "2PCO",
"useful_date": "113-01-01", "useful_date": "113-01-01",
"bonus_verson": "2.0", "bonus_verson": "2.0",
"manager": "M0137" "manager": "M0029",
} "regular_contract_manger_id": "M0054"
}
]

17
wms/contract/api/testT8API.php

@ -1,17 +0,0 @@
<?php
include_once("../conn.php");
$sql = "SELECT * FROM salIncomeApplyDetail WHERE BillNo ='B24010032'";
$stmt = $connT8->prepare($sql);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$aaa = intval($result['OAmountWithTax']) - 24;
$sql = "UPDATE salIncomeApplyDetail SET OAmountWithTax = $aaa WHERE BillNo = 'B24010032' AND RowCode = '1'";
$stmt = $connT8->prepare($sql);
$stmt->execute();
echo "<pre>";
print_r($result['OAmountWithTax']);
echo "</pre>";

10
wms/contract/api/testocde.php

@ -0,0 +1,10 @@
<?php
include_once("../conn.php");
$sql = "SELECT * FROM pricereview_pay WHERE mid = '441'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$pay_kind = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<pre>";
print_r($pay_kind);
echo "</pre>";

22
wms/contract/contract-input.php

@ -214,13 +214,23 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<input type="text" x-model="data.address" /> <input type="text" x-model="data.address" />
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">保養員</td>
<td> <td style="vertical-align: middle">保養經理</td>
<select class="ui search dropdown" name="repairer_name" x-model="data.mworker"> <td>
<option value="">選擇保養員</option> <select class="ui search dropdown" name="repairer_name" x-model="data.maintance_manager">
<?php foreach ($workers as $worker) { ?> <option value="">選擇保養經理</option>
<option value="M0090">M0090--顏慶豪(北北基)</option>
<option value="M0223">M0223--鄭登元(桃竹)</option>
<option value="M0161">M0161--鄭永典(中區)</option>
<option value="M0077">M0077--鍾玉龍(南區)</option>
<!-- <?php foreach ($workers as $worker) {
// 北北基 : M0090
// 保養組長 桃竹 : M0223
// 中部 : M0161
// 南部 : M0077
?>
<option value="<?php echo $worker['accountid']; ?>"><?php echo $worker['name'] ?></option> <option value="<?php echo $worker['accountid']; ?>"><?php echo $worker['name'] ?></option>
<?php } ?> <?php } ?> -->
</select> </select>
<!-- <p class="alerttext" x-show="data.mworker==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> --> <!-- <p class="alerttext" x-show="data.mworker==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> -->
</td> </td>

9
wms/contract/js/alpine.js

@ -1012,7 +1012,7 @@ const contractInput = () => {
}, },
cities: [], cities: [],
data: { data: {
contractno: 'B24010030', contractno: '',
total_price: '', //合約總價 total_price: '', //合約總價
vat: '', //統一編號 vat: '', //統一編號
mtype: 'A', //維修型態 mtype: 'A', //維修型態
@ -1038,7 +1038,8 @@ const contractInput = () => {
payType: '', //付款方式 payType: '', //付款方式
contract_type: 'new', contract_type: 'new',
signing_date: '', signing_date: '',
token: token token: token,
maintance_manager: ''
// bonus_verson: 2.1, // bonus_verson: 2.1,
// manager: '', // manager: '',
// regular_contract_manger_id: '', // regular_contract_manger_id: '',
@ -1138,7 +1139,7 @@ const contractInput = () => {
if (!this.customize) { if (!this.customize) {
this.data.elevators = res.data.elevators; this.data.elevators = res.data.elevators;
for (let i = 0; i < res.data.elevators.length; i++) { for (let i = 0; i < res.data.elevators.length; i++) {
// 合約總價格。 // 合約總價格 (月)
this.data.total_price = Math.round(Number(res.data.elevators[i].sold_price) + Number(this.data.total_price)); this.data.total_price = Math.round(Number(res.data.elevators[i].sold_price) + Number(this.data.total_price));
// 服務費 (以單筆合約記,但計算獎金須傳入單月服務費) // 服務費 (以單筆合約記,但計算獎金須傳入單月服務費)
@ -1148,6 +1149,7 @@ const contractInput = () => {
this.data.elevators[i].sold_price = Math.round(res.data.elevators[i].sold_price); this.data.elevators[i].sold_price = Math.round(res.data.elevators[i].sold_price);
} }
console.log(this.data.elevators); console.log(this.data.elevators);
// 合約總價
this.data.total_price = Number(res.data.elevators[0].maintain_months) * this.data.total_price; this.data.total_price = Number(res.data.elevators[0].maintain_months) * this.data.total_price;
this.data.salesman = res.data.salesman this.data.salesman = res.data.salesman
this.data.contract_begin_date = res.data.contract_begin_date this.data.contract_begin_date = res.data.contract_begin_date
@ -1245,6 +1247,7 @@ const contractInput = () => {
form.append('payType', this.data.payType); form.append('payType', this.data.payType);
form.append('contract_type', this.data.contract_type); form.append('contract_type', this.data.contract_type);
form.append('signing_date', this.data.signing_date); form.append('signing_date', this.data.signing_date);
form.append('maintance_manager', this.data.maintance_manager);
// 如果有附件檔案,可以逐一加入 // 如果有附件檔案,可以逐一加入
for (var i = 0; i < this.data.files.length; i++) { for (var i = 0; i < this.data.files.length; i++) {

16
wms/schedule-edit.php

@ -149,7 +149,7 @@ foreach ($data as $data) :
<div> <div>
<br> <br>
<button type="submit" name="update">確認</button> <button type="submit" name="update">確認</button>
<button onclick="updateRepaire(<?= $data['contractno'] ?>,<?= $data['facilityno'] ?>)" style="text-align: right;">更新此作番保養人員</button> <!-- <button onclick="updateRepaire(<?= $data['contractno'] ?>,<?= $data['facilityno'] ?>)" style="text-align: right;">更新此作番保養人員</button> -->
</div> </div>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>
@ -160,22 +160,10 @@ foreach ($data as $data) :
endforeach; endforeach;
include "footer.php"; include "footer.php";
include_once "./bonus/api/postSchedule.php" // include_once "./bonus/api/postSchedule.php"
?> ?>
<script src="../contract-repair/js/axios/axios.min.js"></script> <script src="../contract-repair/js/axios/axios.min.js"></script>
<script> <script>
function updateRepaire(contractno, facilityno) {
const form = new FormData();
form.append("contractno", contractno);
form.append("facilityno", facilityno);
axios.post('./bonus/api/postSchedule.php', form).then((res) => {
if (res.data == 'Success') {
alert('更新成功');
location.reload();
}
}).catch((err) => {
})
}
</script> </script>

20
wms/schedule-index.php

@ -36,10 +36,14 @@ if (!empty($sql_cmd2)) {
else $sql_cmd .= $sql_cmd2; else $sql_cmd .= $sql_cmd2;
$page_close = 1; // 不分頁 $page_close = 1; // 不分頁
} }
$clause = "WHERE id IN (
SELECT MIN(id)
FROM schedule
GROUP BY contractno
)";
//$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id"; //$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id";
$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id desc"; $sql = "SELECT DISTINCT contractno, schedule.* FROM schedule $sql_cmd ORDER BY CASE WHEN repairerid IS NULL THEN 0 ELSE 1 END, id";
$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id desc"; // $sql = "SELECT * FROM schedule $sql_cmd ORDER BY id desc";
if (!$page_close) $sql .= " limit $page_from, $page_each"; if (!$page_close) $sql .= " limit $page_from, $page_each";
// echo $sql; // echo $sql;
@ -192,7 +196,8 @@ if ($data) :
<th>建檔時間</th> <th>建檔時間</th>
<?php if ($user_auth & 2) { ?> <?php if ($user_auth & 2) { ?>
<th>修改</th> <th>修改</th>
<th>刪除</th> <!-- <th>刪除</th> -->
<th>安排保養計畫人員</th>
<?php } ?> <?php } ?>
</tr> </tr>
</thead> </thead>
@ -250,11 +255,16 @@ if ($data) :
</p> </p>
</td> </td>
<td> <td>
<p> <!-- <p>
<a href="schedule-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> <a href="schedule-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')">
<span class="glyphicon glyphicon-remove"></span> <span class="glyphicon glyphicon-remove"></span>
</a> </a>
</p> -->
<?php if (empty($data['repairerid'])) { ?>
<p>
<a href="schedule-setting-repaire.php?id=<?= $data['id'] ?>&<?php echo $token_link; ?>"" class=" btn btn-info btn-sm">安排</a>
</p> </p>
<?php } ?>
</td> </td>
<?php } ?> <?php } ?>
</tr> </tr>

66
wms/schedule-setting-repaire-update.php

@ -0,0 +1,66 @@
<?php
include "header.php";
include_once "./contract/conn.php";
if (isset($_POST['update'])) {
function user_input($data)
{
$data1 = trim($data);
$data2 = stripslashes($data1);
$data3 = htmlspecialchars($data2);
return $data3;
}
$id = $_POST['id'];
$sql = "SELECT * FROM schedule WHERE id = '$id'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$checkRepaireIsit = $stmt->fetch(PDO::FETCH_ASSOC);
if (!empty($checkRepaireIsit)) {
echo "<script type ='text/JavaScript'>";
echo "alert('此單號已經有保養人員');";
echo "location.href='schedule-index.php?function_name=schedule&" . $token_link . "';";
echo "</script>";
}
$contractno = user_input($_POST["contractno"]);
$facilityno = user_input($_POST["facilityno"]);
$repairerid = user_input($_POST["repairerid"]);
$creater = user_input($_POST["creater"]);
$create_at = date('Y/m/d H:i:s');
$sql = "SELECT name FROM account WHERE accountid = '$repairerid'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$account = $stmt->fetch(PDO::FETCH_ASSOC);
$repairername = $account['name'];
$db_query = "UPDATE schedule set
repairerid = '$repairerid',
repairername = '$repairername',
updater = '$creater',
update_at = '$create_at' WHERE contractno='$contractno' AND facilityno='$facilityno'";
$stmt = $conn->prepare($db_query);
$stmt->execute();
$affected = $stmt->rowCount();
if ($affected > 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('update成功');";
echo "location.href='schedule-index.php?function_name=schedule&" . $token_link . "';";
echo "</script>";
} elseif ($affected == 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('無新增資料');";
echo "location.href='schedule-index.php?function_name=schedule&" . $token_link . "';";
echo "</script>";
} else {
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: ";
}
}

192
wms/schedule-setting-repaire.php

@ -0,0 +1,192 @@
<?php
include "header.php";
include_once "./contract/conn.php";
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
$data = array();
// sql語法存在變數中
$db_query = "SELECT * FROM schedule WHERE id=$id";
// 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link, $db_query);
$sql = "SELECT * FROM account WHERE accounttype = 'B' ";
$stmt = $conn->prepare($sql);
$stmt->execute();
$repaire = $stmt->fetchAll(PDO::FETCH_ASSOC);
/*
include "inc/record_update.php";
try {
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$db_query = "SELECT * FROM expert WHERE id=$id";
// 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link,$db_query);
}catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
*/
foreach ($data as $data) :
?>
<div class="container">
<form class="form-inline" method="post" action="schedule-setting-repaire-update.php" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<div>
<label for="contractno">合約號</label>
<input type="text" name="contractno" id="contractno" value="<?php echo $data['contractno']; ?>" disabled>
</div>
<div>
<label for="facilityno">作番號</label>
<input type="text" name="facilityno" id="facilityno" value="<?php echo $data['facilityno']; ?>" disabled>
</div>
<!--
<div>
<label for="combono">保養套餐編號</label>
<input type="text" name="combono" id="combono" value="<?php echo $data['combono']; ?>">
</div> -->
<div>
<label for="repairerid">保養人員工號</label>
<select name="repairerid" id="repairerid">
<option value=""></option>
<?php
foreach ($repaire as $repaire) {
?>
<option value="<?= $repaire['accountid'] ?>"><?php echo $repaire['accountid'] . '---' . $repaire['name'] ?></option>
<?php
}
?>
</select>
</div>
<!--
<div>
<label for="repairername">保養人員姓名</label>
<input type="text" name="repairername" id="repairername" value="<?php echo $data['repairername']; ?>">
</div> -->
<!--
<div>
<label for="duedate">應保養日期</label>
<input type="text" name="duedate" id="duedate" value="<?php echo $data['duedate']; ?>">
</div>
<div>
<label for="actualdate">實際保養日期</label>
<input type="text" name="actualdate" id="actualdate" data-date-format="yyyy-mm-dd" value="<?php echo $data['actualdate']; ?>">
</div>
<div>
<label for="item">保養項目編號</label>
<input type="text" name="item" id="item" value="<?php echo $data['item']; ?>">
</div>
<div>
<label for="item_detail">保養項目內容</label>
<input type="text" name="item_detail" id="item_detail" value="<?php echo $data['item_detail']; ?>">
</div> -->
<!-- <div>
<label for="result">保養結果</label>
<input type="text" name="result" id="result" value="<?php echo $data['result']; ?>">
</div> -->
<!--
<div>
<label for="evidences">上傳照片</label>
<input type="text" name="evidences" id="evidences" >
</div>
-->
<!-- <div>
<label for="descriptons">說明</label>
<input type="text" name="descriptons" id="descriptons" value="<?php echo $data['descriptons']; ?>">
</div>
<div>
<label for="customer_login_id">客戶評價登入帳號</label>
<input type="text" name="customer_login_id" id="customer_login_id" value="<?php echo $data['customer_login_id']; ?>">
</div>
<div>
<label for="customer_login_name">客戶姓名</label>
<input type="text" name="customer_login_name" id="customer_login_name" value="<?php echo $data['customer_login_name']; ?>">
</div>
<div>
<label for="stars">保養品質/評價等級(1-5星)</label>
<input type="text" name="stars" id="stars" onkeyup="if(value<0)value=0;if(value>5)value=5;value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" value="<?php echo $data['stars_c1']; ?>">
</div>
<div>
<label for="stars2">服務態度/評價等級(1-5星)</label>
<input type="text" name="stars2" id="stars2" onkeyup="if(value<0)value=0;if(value>5)value=5;value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" value="<?php echo $data['stars_c2']; ?>">
</div>
<div>
<label for="details">內容</label>
<input type="text" name="details" id="details" value="<?php echo $data['details']; ?>">
</div> -->
<!--
<div>
<label for="customer_signature">簽名檔</label>
<input type="text" name="customer_signature" id="customer_signature" value="<?php echo $data['customer_signature']; ?>">
</div>
-->
<div>
<label for="creater">建檔人</label>
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly>
</div>
<div>
<br>
<button type="submit" name="update">確認</button>
<!-- <button onclick="updateRepaire(<?= $data['contractno'] ?>,<?= $data['facilityno'] ?>,<?= $user_id ?>)" style="text-align: right;">更新此作番保養人員</button> -->
</div>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="reqaire" id="reqaire" value="">
</form>
</div>
<?php
endforeach;
include "footer.php";
// include_once "./bonus/api/postSchedule.php"
?>
<script src="./contract-repair/js/axios/axios.min.js"></script>
<script>
document.getElementById('repairerid').onchange = function() {
var repaireridValue = this.value;
// 根據選擇的值做相應的處理
document.getElementById('reqaire').value = repaireridValue;
console.log(repaireridValue);
};
// function updateRepaire(contractno, facilityno, user_id) {
// const form = new FormData();
// form.append("contractno", contractno);
// form.append("facilityno", facilityno);
// form.append("user_id", user_id)
// axios.post('./bonus/api/postSchedule.php', form).then((res) => {
// if (res.data == 'Success') {
// alert('更新成功');
// location.reload();
// }
// }).catch((err) => {
// })
// }
</script>
Loading…
Cancel
Save