From 3aa59d03d51fae84c210a5e9d8c80e1f3afe330f Mon Sep 17 00:00:00 2001
From: Cheng 未填寫";
+ // print_r($pay_scale);
+ // echo "
";
+ switch ($elevator_pay_kind['pay_kind']) {
+
+ case '1':
+ array_push($bonus_array, [
+ "bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
+ "bonus_receiver" => $sales_id, #發放人員
+ "bonus_amount" => $sales_bonus, #金額
+ "payment_schedul_due" => "deposit", #訂金已收款20%
+ "payment_schedul_regulation" => "訂金已收款$pay_scale%,發放總獎金$pay_scale%" #發放規定
+ ]);
+
+ 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%" #發放規定
+ ]);
+ 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%" #發放規定
+ ]);
+
+ 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%" #發放規定
+ ]);
+ 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 = [
+ "ver" => $ver, #獎金版本
+ "result_status" => "success", #計算結果
+ "bonus_array" => $bonus_array #獎金水庫
+ ];
+ }
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
diff --git a/wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php b/wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php
index 97c47660..17a5899a 100644
--- a/wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php
+++ b/wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php
@@ -1,9 +1,15 @@
'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 = [
#錯誤版本
- ["2.0","strategy_customer",1000000,"M0001", "M0003"],
+ ["1.0", "strategy_customer", ($pay_kind_arr), "M0001", "M0003"],
#戰略客戶(strategy_customer)
- ["1.0","strategy_customer",1000000,"M0001", "M0003"], #戰略客戶
+ // ["1.0", "strategy_customer", 1000000, "M0001", "M0003"], #戰略客戶
- #一般客戶(general_customer)
- ["1.0","general_customer",1000000,"M0001", "M0003"] #一般客戶
+ // #一般客戶(general_customer)
+ ["1.0", "general_customer", $pay_kind_arr, "M0001", "M0003"] #一般客戶
];
-for($i = 0; $i
";
echo "計算結果:" . $result["result_status"] . "
";
- echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . "
";
- for($j = 0; $j
";
+ . $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " "
+ . $result["bonus_array"][$j]["payment_schedul_regulation"] . "
";
};
echo "-------------------------" . "
";
-
};
-
-
-?>
diff --git a/wms/class/T8API.php b/wms/class/T8API.php
new file mode 100644
index 00000000..e4a60d8e
--- /dev/null
+++ b/wms/class/T8API.php
@@ -0,0 +1,38 @@
+';
- print_r($validation);
- echo '';
- // exit;
+
$header = [
"CHI_Authorization :" . $validation,
"GroupId:TEST"
@@ -29,7 +25,7 @@ function T8salIncomeApply($data, $api_url)
$result = json_decode($response, true);
// 若 API 傳入失敗。
if ($result['Status'] == 'Erroe') {
- echo 'API傳入失敗,' . $result['ErrorMsg'];
+ // echo 'API傳入失敗,' . $result['ErrorMsg'];
return $result;
} else {
// print_r($result);
diff --git a/wms/contract/api/postContractData.php b/wms/contract/api/postContractData.php
index f1aad841..296d7144 100644
--- a/wms/contract/api/postContractData.php
+++ b/wms/contract/api/postContractData.php
@@ -1,4 +1,3 @@
-
prepare($sql);
- $stmt->execute();
- $accountData = $stmt->fetch(PDO::FETCH_ASSOC);
-
- $depId = $accountData['department_id'];
- // validate
- //create facility table
- $createFacilityNo = new CreateFacilityNo();
- $dailyNecessities = [
- 'MAE100' => 'X',
- 'MAM200' => 'W',
- 'MAH100' => 'H',
- 'MAQ100' => 'Z',
- 'MAF100' => 'F',
- 'MAZ100' => 'B',
- ];
+ try {
+ $mail = new Cmail();
+ $created_at = date('Y-m-d H:i:s');
+ $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
+ $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
+ $vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
+ $mtype = !empty($_POST['mtype']) ? $_POST['mtype'] : null;
+ $opendoor = !empty($_POST['opendoor']) ? $_POST['opendoor'] : null;
+ $phone = !empty($_POST['phone']) ? $_POST['phone'] : null;
+ $email = !empty($_POST['email']) ? $_POST['email'] : null;
+ $mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : '';
+ // $mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
+ $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
+ $contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null;
+ $contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null;
+ $address = !empty($_POST['address']) ? $_POST['address'] : null;
+ $area = !empty($_POST['area']) ? $_POST['area'] : null;
+ $customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
+ $partyA = !empty($_POST['partyA']) ? $_POST['partyA'] : null;
+ $partyAaddress = !empty($_POST['partyAaddress']) ? $_POST['partyAaddress'] : null;
+ $partyAphone = !empty($_POST['partyAphone']) ? $_POST['partyAphone'] : null;
+ $partyAemail = !empty($_POST['partyAemail']) ? $_POST['partyAemail'] : null;
+ $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
+ $user_name = !empty($_POST['user_name']) ? $_POST['user_name'] : null;
+ $num = !empty($_POST['num']) ? $_POST['num'] : null;
+ $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
+ $elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
+ $payType = !empty($_POST['payType']) ? $_POST['payType'] : null;
+ $contract_type = !empty($_POST['contract_type']) ? $_POST['contract_type'] : null;
+ $signing_date = !empty($_POST['signing_date']) ? $_POST['signing_date'] : null;
+ $token = !empty($_POST['token']) ? $_POST['token'] : '';
+ $maintance_manager = !empty($_POST['maintance_manager']) ? $_POST['maintance_manager'] : '';
+ $sql = "SELECT * FROM account WHERE accountid = '$salesman'";
+ $stmt = $conn->prepare($sql);
+ $stmt->execute();
+ $accountData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ $depId = $accountData['department_id'];
+ // validate
+ //create facility table
+ $createFacilityNo = new CreateFacilityNo();
+ $dailyNecessities = [
+ 'MAE100' => 'X',
+ 'MAM200' => 'W',
+ 'MAH100' => 'H',
+ 'MAQ100' => 'Z',
+ 'MAF100' => 'F',
+ 'MAZ100' => 'B',
+ ];
- $maintain_times = [
- '1' => 'em', //月保
- '2' => 'bw' // 雙周保
- ];
- $facility_arr = [];
- foreach ($elevators as $elevator) {
- $facility_arr[] = $dailyNecessities[$elevator['spec']];
- }
- // echo json_encode($facility_arr);
- // 電梯做番號
- $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
- // exit();
- // if ($user_id == 'M0225') {
- // echo '';
- // print_r($facilityno);
- // echo '
';
- // exit();
- // }
- $fail_arr = [];
- // if ($contractno === '') return $fail_arr[] = '合約號為必填';
- if ($total_price == '') $fail_arr[] = '合約總價為必填';
- if ($salesman == '') $fail_arr[] = '營業員為必填';
- if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
- if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
- if ($address == '') $fail_arr[] = '地址為必填';
- if ($area == '') $fail_arr[] = '區域為必填';
- if ($customer == '') $fail_arr[] = '客戶為必填';
- if ($num == '') $fail_arr[] = '電梯數量為必填';
- if ($payType == '') $fail_arr[] = '分期方式為必填';
- if ($contract_type == '') $fail_arr[] = '合約類別為必填';
-
- //-------------------
- // if ($partyA == '') $fail_arr[] = '業務聯繫人為必填';
- // if ($partyAaddress == '') $fail_arr[] = '業務聯繫人地址為必填';
- // if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填';
- // if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填';
- // if ($vat == '') $fail_arr[] = '統一編號為必填';
- // if ($mtype == '') $fail_arr[] = '維修型態為必填';
- // if ($phone == '') $fail_arr[] = '客戶電話為必填';
- // if ($email == '') $fail_arr[] = 'Email為必填';
- // if ($mworker == '') $fail_arr[] = '保養員為必填';
- // if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
- if (count($fail_arr) > 0) {
- header("HTTP/1.1 422 Unprocessable Entity");
- echo json_encode($fail_arr, JSON_UNESCAPED_UNICODE);
+ $maintain_times = [
+ '1' => 'em', //月保
+ '2' => 'bw' // 雙周保
+ ];
+ $facility_arr = [];
+ foreach ($elevators as $elevator) {
+ $facility_arr[] = $dailyNecessities[$elevator['spec']];
+ }
+ // echo json_encode($facility_arr);
+ // 電梯做番號
+ $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
+ // exit();
+ // if ($user_id == 'M0225') {
+ // echo '';
+ // print_r($facilityno);
+ // echo '
';
+ // exit();
+ // }
+ $fail_arr = [];
+ // if ($contractno === '') return $fail_arr[] = '合約號為必填';
+ if ($total_price == '') $fail_arr[] = '合約總價為必填';
+ if ($salesman == '') $fail_arr[] = '營業員為必填';
+ if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
+ if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
+ if ($address == '') $fail_arr[] = '地址為必填';
+ if ($area == '') $fail_arr[] = '區域為必填';
+ if ($customer == '') $fail_arr[] = '客戶為必填';
+ if ($num == '') $fail_arr[] = '電梯數量為必填';
+ if ($payType == '') $fail_arr[] = '分期方式為必填';
+ if ($contract_type == '') $fail_arr[] = '合約類別為必填';
+ if ($maintance_manager == '') $fail_arr[] = '保養經理為必填';
+
+ //-------------------
+ // if ($partyA == '') $fail_arr[] = '業務聯繫人為必填';
+ // if ($partyAaddress == '') $fail_arr[] = '業務聯繫人地址為必填';
+ // if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填';
+ // if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填';
+ // if ($vat == '') $fail_arr[] = '統一編號為必填';
+ // if ($mtype == '') $fail_arr[] = '維修型態為必填';
+ // if ($phone == '') $fail_arr[] = '客戶電話為必填';
+ // if ($email == '') $fail_arr[] = 'Email為必填';
+ // if ($mworker == '') $fail_arr[] = '保養員為必填';
+ // if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
+ if (count($fail_arr) > 0) {
+ header("HTTP/1.1 422 Unprocessable Entity");
+ echo json_encode($fail_arr, JSON_UNESCAPED_UNICODE);
+ exit();
+ }
exit();
- }
- // T8insert($_POST, $facilityno, $depId, $connT8);
-
- /// 獎金計算
- $aaa = bonusCreate($_POST, $facilityno, $conn);
- if (!empty($aaa) && $aaa['status'] == 2) {
- header("HTTP/1.1 422 Unprocessable Entity");
- echo $aaa['data'];
+ T8insert($_POST, $facilityno, $depId, $connT8);
exit();
- }
- // exit();
- //create account table
- $accounttype = "A";
- $accountid = $vat;
- $pwd = "123";
- $name = $partyA;
- $tel = $phone ?? '';
- $repairerid = $mworker;
- $creater = $user_id;
- $create_at = date('Y-m-d H:i:s');
-
- // exit();
+ /// 獎金計算
+ $aaa = bonusCreate($_POST, $facilityno, $conn);
+ if (!empty($aaa) && $aaa['status'] == 2) {
+ header("HTTP/1.1 422 Unprocessable Entity");
+ echo $aaa['data'];
+ exit();
+ }
+ // exit();
+ //create account table
+ $accounttype = "A";
+ $accountid = $vat;
+ $pwd = "123";
+ $name = $partyA;
+ $tel = $phone ?? '';
+ $repairerid = $mworker;
+ $creater = $user_id;
+ $create_at = date('Y-m-d H:i:s');
+ // exit();
- $conn->beginTransaction();
- $sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)";
- $stmt = $conn->prepare($sql_str);
- $stmt->bindParam(':accounttype', $accounttype);
- $stmt->bindParam(':accountid', $accountid);
- $stmt->bindParam(':pwd', $pwd);
- $stmt->bindParam(':name', $name);
- $stmt->bindParam(':tel', $tel);
- $stmt->bindParam(':address', $address);
- $stmt->bindParam(':email', $email);
- $stmt->bindParam(':repairerid', $repairerid);
- $stmt->bindParam(':creater', $creater);
- $stmt->bindParam(':create_at', $create_at);
- $stmt->execute();
+ $conn->beginTransaction();
- //create contract table
-
- $contracttype = $mtype;
- $company = $partyA;
- $taxid = $vat;
- $tel = $phone;
- $promiser = $partyA;
- $contractperson = $partyA;
-
- $contractaddress = $address;
- $contracttel = $phone;
- $contractemail = $email;
- $contract_employee = $salesman;
- $start_date = $contract_begin_date;
- $end_date = $contract_end_date;
-
- $sql_str = "INSERT INTO contract (contracttype, contractno, company, taxid, address, tel, promiser, contractperson, contractaddress, contracttel, contractemail, contract_employee, start_date, end_date, creater, create_at) VALUES (:contracttype, :contractno, :company, :taxid, :address, :tel, :promiser, :contractperson, :contractaddress, :contracttel, :contractemail, :contract_employee, :start_date, :end_date, :creater, :create_at)";
- $stmt = $conn->prepare($sql_str);
- $stmt->bindParam(':contracttype', $contracttype);
- $stmt->bindParam(':contractno', $contractno);
- $stmt->bindParam(':company', $company);
- $stmt->bindParam(':taxid', $taxid);
- $stmt->bindParam(':address', $address);
- $stmt->bindParam(':tel', $tel);
- $stmt->bindParam(':promiser', $promiser);
- $stmt->bindParam(':contractperson', $contractperson);
- $stmt->bindParam(':contractaddress', $contractaddress);
- $stmt->bindParam(':contracttel', $contracttel);
- $stmt->bindParam(':contractemail', $contractemail);
- $stmt->bindParam(':contract_employee', $contract_employee);
- $stmt->bindParam(':start_date', $start_date);
- $stmt->bindParam(':end_date', $end_date);
- $stmt->bindParam(':creater', $creater);
- $stmt->bindParam(':create_at', $create_at);
- $stmt->execute();
-
- //create facility table
- // $createFacilityNo = new CreateFacilityNo();
- // $dailyNecessities = [
- // 'MAE100' => 'X',
- // 'MAM200' => 'W',
- // 'MAH100' => 'H',
- // 'MAQ100' => 'Z',
- // 'MAF100' => 'F',
- // 'MAZ100' => 'B',
- // ];
-
- // $maintain_times = [
- // '1' => 'em', //月保
- // '2' => 'bw' // 雙周保
- // ];
- // $facility_arr = [];
- // foreach ($elevators as $elevator) {
- // $facility_arr[] = $dailyNecessities[$elevator['spec']];
- // }
- // echo json_encode($facility_arr);
- // // 電梯做番號
- // $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
- // // if ($user_id == 'M0225') {
- // // echo '';
- // // print_r($facilityno);
- // // echo '
';
- // // exit();
- // // }
- // echo json_encode($facilityno);
- // echo '-------';
- $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid AND accounttype IN ('B','E','M','W')";
- $stmt = $conn->prepare($sql_str);
- $stmt->bindParam(':accountid', $mworker);
- $stmt->execute();
- $worker = $stmt->fetch(PDO::FETCH_ASSOC);
- $customerid = $vat;
- $repairtype = $mtype;
- $repairerid = $mworker;
- $define = "B";
- $repairername = !empty($worker) ? $worker['name'] : '';
-
- foreach ($elevators as $idx => $elevator) {
- // 民國年轉換西元年
- $ROCuseful_date = $elevator['useful_date'];
- $click = explode("-", $ROCuseful_date);
- $click[0] = intval($click[0]) + 1911;
- $ADuseful_date = implode("-", $click);
-
- $sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
- VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
+ $sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)";
$stmt = $conn->prepare($sql_str);
- $stmt->bindParam(':contractno', $contractno);
- $stmt->bindParam(':define', $define);
- $stmt->bindParam(':facilityno', $facilityno[$idx]);
- $stmt->bindParam(':latitude', $elevator['latitude']);
- $stmt->bindParam(':longitude', $elevator['longitude']);
- $stmt->bindParam(':customerid', $customerid);
- $stmt->bindParam(':weight', $elevator['weight']);
- $stmt->bindParam(':numberofpassenger', $elevator['persons']);
- $stmt->bindParam(':numberofstop', $elevator['stop']);
- $stmt->bindParam(':numberoffloor', $elevator['floors']);
- $stmt->bindParam(':opentype', $elevator['opendoor']);
- $stmt->bindParam(':speed', $elevator['speed']);
- $stmt->bindParam(':repairtype', $repairtype);
- $stmt->bindParam(':maintainance', $elevator['maintainance']);
- $stmt->bindParam(':facility_kind', $elevator['spec']);
+ $stmt->bindParam(':accounttype', $accounttype);
+ $stmt->bindParam(':accountid', $accountid);
+ $stmt->bindParam(':pwd', $pwd);
+ $stmt->bindParam(':name', $name);
+ $stmt->bindParam(':tel', $tel);
$stmt->bindParam(':address', $address);
+ $stmt->bindParam(':email', $email);
$stmt->bindParam(':repairerid', $repairerid);
- $stmt->bindParam(':repairername', $repairername);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
- $stmt->bindParam(':area', $area);
- $stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']);
- $stmt->bindParam(':licensedate', $ADuseful_date);
- $result = $stmt->execute();
- }
- $sql = "SELECT * FROM account WHERE accountid = '$user_id' ";
- $stmt = $conn->prepare($sql);
- $stmt->execute();
- $user_detail = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt->execute();
+ //create contract table
- //create schedule table
- // $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
- // $comboArr = json_decode($comboNo->getComboNo(), true);
- foreach ($facilityno as $key => $no) {
- $comboNo = new CreateComboNo($maintain_times[$elevator['maintain_times']], $contract_begin_date, $contract_end_date);
- $comboArr = json_decode($comboNo->getComboNo(), true);
+ $contracttype = $mtype;
+ $company = $partyA;
+ $taxid = $vat;
+ $tel = $phone;
+ $promiser = $partyA;
+ $contractperson = $partyA;
- foreach ($comboArr as $combo) {
- $sql_str = 'INSERT INTO schedule
- (contractno, facilityno, combono, repairerid, repairername,customer_login_name, duedate, creater, create_at) VALUES
- (:contractno, :facilityno, :combono, :repairerid, :repairername, :customer_login_name,:duedate, :creater, :create_at)';
+ $contractaddress = $address;
+ $contracttel = $phone;
+ $contractemail = $email;
+ $contract_employee = $salesman;
+ $start_date = $contract_begin_date;
+ $end_date = $contract_end_date;
+
+ $sql_str = "INSERT INTO contract (contracttype, contractno, company, taxid, address, tel, promiser, contractperson, contractaddress, contracttel, contractemail, contract_employee, start_date, end_date, creater, create_at) VALUES (:contracttype, :contractno, :company, :taxid, :address, :tel, :promiser, :contractperson, :contractaddress, :contracttel, :contractemail, :contract_employee, :start_date, :end_date, :creater, :create_at)";
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(':contracttype', $contracttype);
+ $stmt->bindParam(':contractno', $contractno);
+ $stmt->bindParam(':company', $company);
+ $stmt->bindParam(':taxid', $taxid);
+ $stmt->bindParam(':address', $address);
+ $stmt->bindParam(':tel', $tel);
+ $stmt->bindParam(':promiser', $promiser);
+ $stmt->bindParam(':contractperson', $contractperson);
+ $stmt->bindParam(':contractaddress', $contractaddress);
+ $stmt->bindParam(':contracttel', $contracttel);
+ $stmt->bindParam(':contractemail', $contractemail);
+ $stmt->bindParam(':contract_employee', $contract_employee);
+ $stmt->bindParam(':start_date', $start_date);
+ $stmt->bindParam(':end_date', $end_date);
+ $stmt->bindParam(':creater', $creater);
+ $stmt->bindParam(':create_at', $create_at);
+ $stmt->execute();
+
+ //create facility table
+ // $createFacilityNo = new CreateFacilityNo();
+ // $dailyNecessities = [
+ // 'MAE100' => 'X',
+ // 'MAM200' => 'W',
+ // 'MAH100' => 'H',
+ // 'MAQ100' => 'Z',
+ // 'MAF100' => 'F',
+ // 'MAZ100' => 'B',
+ // ];
+
+ // $maintain_times = [
+ // '1' => 'em', //月保
+ // '2' => 'bw' // 雙周保
+ // ];
+ // $facility_arr = [];
+ // foreach ($elevators as $elevator) {
+ // $facility_arr[] = $dailyNecessities[$elevator['spec']];
+ // }
+ // echo json_encode($facility_arr);
+ // // 電梯做番號
+ // $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
+ // // if ($user_id == 'M0225') {
+ // // echo '';
+ // // print_r($facilityno);
+ // // echo '
';
+ // // exit();
+ // // }
+ // echo json_encode($facilityno);
+ // echo '-------';
+ $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid AND accounttype IN ('B','E','M','W')";
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(':accountid', $mworker);
+ $stmt->execute();
+ $worker = $stmt->fetch(PDO::FETCH_ASSOC);
+ $customerid = $vat;
+ $repairtype = $mtype;
+ $repairerid = $mworker;
+ $define = "B";
+ $repairername = !empty($worker) ? $worker['name'] : '';
+
+ foreach ($elevators as $idx => $elevator) {
+ // 民國年轉換西元年
+ $ROCuseful_date = $elevator['useful_date'];
+ $click = explode("-", $ROCuseful_date);
+ $click[0] = intval($click[0]) + 1911;
+ $ADuseful_date = implode("-", $click);
+
+ $sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
+ VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contractno', $contractno);
- $stmt->bindParam(':facilityno', $no);
- $stmt->bindParam(':combono', $combo[0]);
+ $stmt->bindParam(':define', $define);
+ $stmt->bindParam(':facilityno', $facilityno[$idx]);
+ $stmt->bindParam(':latitude', $elevator['latitude']);
+ $stmt->bindParam(':longitude', $elevator['longitude']);
+ $stmt->bindParam(':customerid', $customerid);
+ $stmt->bindParam(':weight', $elevator['weight']);
+ $stmt->bindParam(':numberofpassenger', $elevator['persons']);
+ $stmt->bindParam(':numberofstop', $elevator['stop']);
+ $stmt->bindParam(':numberoffloor', $elevator['floors']);
+ $stmt->bindParam(':opentype', $elevator['opendoor']);
+ $stmt->bindParam(':speed', $elevator['speed']);
+ $stmt->bindParam(':repairtype', $repairtype);
+ $stmt->bindParam(':maintainance', $elevator['maintainance']);
+ $stmt->bindParam(':facility_kind', $elevator['spec']);
+ $stmt->bindParam(':address', $address);
$stmt->bindParam(':repairerid', $repairerid);
$stmt->bindParam(':repairername', $repairername);
- $stmt->bindParam(':duedate', $combo[1]);
- $stmt->bindParam(':customer_login_name', $customer);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
+ $stmt->bindParam(':area', $area);
+ $stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']);
+ $stmt->bindParam(':licensedate', $ADuseful_date);
$result = $stmt->execute();
}
-
-
- // $regular_contract_manger_id = $elevators[$idx]['regular_contract_manger_id'];
- // $sql = "SELECT * FROM account WHERE accountid = '' ";
- $regular_contract_manger_id = !empty($elevators[$key]['regular_contract_manger_id']) ? $elevators[$key]['regular_contract_manger_id'] : '';
- // if ($regular_contract_manger_id != '') {
- $sql = "SELECT * FROM account WHERE accountid = '$regular_contract_manger_id' ";
+ $sql = "SELECT * FROM account WHERE accountid = '$user_id' ";
$stmt = $conn->prepare($sql);
$stmt->execute();
- $regular_contract_manger_mail = $stmt->fetch(PDO::FETCH_ASSOC);
+ $user_detail = $stmt->fetch(PDO::FETCH_ASSOC);
- $mail_title = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-營業經理提交至設計階段";
- $mail_content = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-營業經理提交至設計階段 點我";
- // exit();
- $mail->sendx(
- $mail_title,
- $mail_content,
- [
- // [$user_id, $user_detail['email']],
- // [$regular_contract_manger_id, $regular_contract_manger_mail['mail']],
- ['M0225', 'lkmd555@masada.com.tw']
- ],
- "永佳捷科技"
- );
- // echo 'send';
- // }
- }
- // create contract_b_signed_back table
- $contract_type = $mtype;
- $company = $customer;
- $customer_no = $vat;
- $salesperson = $salesman;
- $customer_phone = $phone;
- $customer_email = $email;
- $repairman = $mworker;
- // $cycle = $mcycle;
- $contact_person = $partyA;
- $contact_address = $partyAaddress;
- $contact_phone = $partyAphone;
- $contract_email = $partyAemail;
- $elevators_number = $num;
- $bonus = 1000;
- $max_bonus = 2000;
-
- if (!empty($files)) {
- $englisharr = range('a', 'z');
- $file = $_FILES['files'];
- $file_name = $file['name'];
- $file_type = $file['type'];
- $tmp_name = $file['tmp_name'];
- $file_size = $file['size'];
- $error = $file['error'];
- $newfiles = [];
- foreach ($files as $file) {
- $i = 0; //新陣列的索引編號
- foreach ($file as $key => $val) {
- $newfiles[$i]['name'] = $files['name'][$key];
- $newfiles[$i]['type'] = $files['type'][$key];
- $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
- $newfiles[$i]['error'] = $files['error'][$key];
- $newfiles[$i]['size'] = $files['size'][$key];
- $i++;
- } //foreach 第2層 end
- }
- $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
- $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
- $path = '../images/contracts/';
- if (!file_exists($path)) {
- mkdir($path);
- }
- $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
- $datetime = (string)date('YmdHis');
- $files_id = 'b' . $datetime; // 保養=>b + 日期時間
- foreach ($newfiles as $key => $file) {
- $randNum = rand(1000, 9999);
- $randEnglish = $englisharr[rand(0, 25)];
- $file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
- $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
- if ($msg == 1) {
- $msg = '檔案傳送成功!';
- $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
+ //create schedule table
+ // $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
+ // $comboArr = json_decode($comboNo->getComboNo(), true);
+ foreach ($facilityno as $key => $no) {
+ $comboNo = new CreateComboNo($maintain_times[$elevator['maintain_times']], $contract_begin_date, $contract_end_date);
+ $comboArr = json_decode($comboNo->getComboNo(), true);
+
+ foreach ($comboArr as $combo) {
+ $sql_str = 'INSERT INTO schedule
+ (contractno, facilityno, combono, repairerid, repairername,customer_login_name, duedate, creater, create_at) VALUES
+ (:contractno, :facilityno, :combono, :repairerid, :repairername, :customer_login_name,:duedate, :creater, :create_at)';
$stmt = $conn->prepare($sql_str);
- $stmt->bindParam(':files_id', $files_id);
- $stmt->bindParam(':file_name', $file_name);
- $stmt->bindParam(':file_mime', $file['type']);
- $stmt->bindParam(':file_size', $file['size']);
- $stmt->bindParam(':created_at', $created_at);
- $stmt->bindParam(':created_by', $user_id);
- $stmt->execute();
+ $stmt->bindParam(':contractno', $contractno);
+ $stmt->bindParam(':facilityno', $no);
+ $stmt->bindParam(':combono', $combo[0]);
+ $stmt->bindParam(':repairerid', $repairerid);
+ $stmt->bindParam(':repairername', $repairername);
+ $stmt->bindParam(':duedate', $combo[1]);
+ $stmt->bindParam(':customer_login_name', $customer);
+ $stmt->bindParam(':creater', $creater);
+ $stmt->bindParam(':create_at', $create_at);
+ $result = $stmt->execute();
+ }
+
+
+ // $regular_contract_manger_id = $elevators[$idx]['regular_contract_manger_id'];
+ // $sql = "SELECT * FROM account WHERE accountid = '' ";
+ $sql = "SELECT * FROM account WHERE accountid = '$maintance_manager' ";
+ $stmt = $conn->prepare($sql);
+ $stmt->execute();
+ $maintance_manager_detail = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // 寄郵件給 輸入合約助理,請他安排保養計畫
+ // 北北基 : M0090
+ // 保養組長 桃竹 : M0223
+ // 中部 : M0161
+ // 南部 : M0077
+ // 保養組長之後調整
+ $mail_title = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-請安排此作番的保養人員";
+ $mail_content = "保養計畫 : 合約號:" . $contractno . "作番號:" . $no . "-請安排此作番的保養人員 點我";
+ // exit();
+ $mail->sendx(
+ $mail_title,
+ $mail_content,
+ [
+ // [$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']],
+ ['M0225', 'lkmd555@masada.com.tw']
+ // ['M0012', 'Yingying@masada.com.tw']
+ ],
+ "永佳捷科技"
+ );
+
+ // echo 'send';
+ // }
+ }
+ // create contract_b_signed_back table
+ $contract_type = $mtype;
+ $company = $customer;
+ $customer_no = $vat;
+ $salesperson = $salesman;
+ $customer_phone = $phone;
+ $customer_email = $email;
+ $repairman = $mworker;
+ // $cycle = $mcycle;
+ $contact_person = $partyA;
+ $contact_address = $partyAaddress;
+ $contact_phone = $partyAphone;
+ $contract_email = $partyAemail;
+ $elevators_number = $num;
+ $bonus = 1000;
+ $max_bonus = 2000;
+
+ if (!empty($files)) {
+ $englisharr = range('a', 'z');
+ $file = $_FILES['files'];
+ $file_name = $file['name'];
+ $file_type = $file['type'];
+ $tmp_name = $file['tmp_name'];
+ $file_size = $file['size'];
+ $error = $file['error'];
+ $newfiles = [];
+ foreach ($files as $file) {
+ $i = 0; //新陣列的索引編號
+ foreach ($file as $key => $val) {
+ $newfiles[$i]['name'] = $files['name'][$key];
+ $newfiles[$i]['type'] = $files['type'][$key];
+ $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
+ $newfiles[$i]['error'] = $files['error'][$key];
+ $newfiles[$i]['size'] = $files['size'][$key];
+ $i++;
+ } //foreach 第2層 end
}
- $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '
';
- $src_name = $path . $file['name'];
- if (file_exists($src_name)) {
- //副檔名
- $extname = pathinfo($src_name, PATHINFO_EXTENSION);
- //主檔名
- $basename = basename($src_name, '.' . $extname);
+ $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
+ $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
+ $path = '../images/contracts/';
+ if (!file_exists($path)) {
+ mkdir($path);
}
+ $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
+ $datetime = (string)date('YmdHis');
+ $files_id = 'b' . $datetime; // 保養=>b + 日期時間
+ foreach ($newfiles as $key => $file) {
+ $randNum = rand(1000, 9999);
+ $randEnglish = $englisharr[rand(0, 25)];
+ $file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
+ $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
+ if ($msg == 1) {
+ $msg = '檔案傳送成功!';
+ $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(':files_id', $files_id);
+ $stmt->bindParam(':file_name', $file_name);
+ $stmt->bindParam(':file_mime', $file['type']);
+ $stmt->bindParam(':file_size', $file['size']);
+ $stmt->bindParam(':created_at', $created_at);
+ $stmt->bindParam(':created_by', $user_id);
+ $stmt->execute();
+ }
+ $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '
';
+ $src_name = $path . $file['name'];
+ if (file_exists($src_name)) {
+ //副檔名
+ $extname = pathinfo($src_name, PATHINFO_EXTENSION);
+ //主檔名
+ $basename = basename($src_name, '.' . $extname);
+ }
+ }
+ } else {
+ $files = null;
}
- } else {
- $files = null;
- }
- $sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by,signing_date)
+ $sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by,signing_date)
VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by,:signing_date)";
- $stmt = $conn->prepare($sql_str);
- $stmt->bindParam(":contract_no", $contractno);
- $stmt->bindParam(":contract_type", $contract_type);
- $stmt->bindParam(":company", $company);
- $stmt->bindParam(":customer_no", $customer_no);
- $stmt->bindParam(":salesperson", $salesperson);
- $stmt->bindParam(":contract_start_date", $contract_begin_date);
- $stmt->bindParam(":contract_end_date", $contract_end_date);
- $stmt->bindParam(":total_price", $total_price);
- $stmt->bindParam(":customer_phone", $customer_phone);
- $stmt->bindParam(":customer_email", $customer_email);
- $stmt->bindParam(":repairman", $repairman);
- // $stmt->bindParam(":cycle", $cycle); // 保養頻率在做番上,這邊不 insert。
- $stmt->bindParam(":contact_person", $contact_person);
- $stmt->bindParam(":contact_address", $contact_address);
- $stmt->bindParam(":contact_phone", $contact_phone);
- $stmt->bindParam(":contact_email", $contact_email);
- $stmt->bindParam(":elevators_number", $elevators_number);
- $stmt->bindParam(":area", $area);
- $stmt->bindParam(":address", $address);
- $stmt->bindParam(":files_id", $files_id);
- $stmt->bindParam(":bonus", $bonus);
- $stmt->bindParam(":max_bonus", $max_bonus);
- $stmt->bindParam(":created_at", $created_at);
- $stmt->bindParam(":created_by", $user_id);
- $stmt->bindParam(':payType', $payType);
- $stmt->bindParam(':signing_date', $signing_date);
+ $stmt = $conn->prepare($sql_str);
+ $stmt->bindParam(":contract_no", $contractno);
+ $stmt->bindParam(":contract_type", $contract_type);
+ $stmt->bindParam(":company", $company);
+ $stmt->bindParam(":customer_no", $customer_no);
+ $stmt->bindParam(":salesperson", $salesperson);
+ $stmt->bindParam(":contract_start_date", $contract_begin_date);
+ $stmt->bindParam(":contract_end_date", $contract_end_date);
+ $stmt->bindParam(":total_price", $total_price);
+ $stmt->bindParam(":customer_phone", $customer_phone);
+ $stmt->bindParam(":customer_email", $customer_email);
+ $stmt->bindParam(":repairman", $repairman);
+ // $stmt->bindParam(":cycle", $cycle); // 保養頻率在做番上,這邊不 insert。
+ $stmt->bindParam(":contact_person", $contact_person);
+ $stmt->bindParam(":contact_address", $contact_address);
+ $stmt->bindParam(":contact_phone", $contact_phone);
+ $stmt->bindParam(":contact_email", $contact_email);
+ $stmt->bindParam(":elevators_number", $elevators_number);
+ $stmt->bindParam(":area", $area);
+ $stmt->bindParam(":address", $address);
+ $stmt->bindParam(":files_id", $files_id);
+ $stmt->bindParam(":bonus", $bonus);
+ $stmt->bindParam(":max_bonus", $max_bonus);
+ $stmt->bindParam(":created_at", $created_at);
+ $stmt->bindParam(":created_by", $user_id);
+ $stmt->bindParam(':payType', $payType);
+ $stmt->bindParam(':signing_date', $signing_date);
- $stmt->execute();
+ $stmt->execute();
- // T8insert($_POST, $facilityno);
+ // T8insert($_POST, $facilityno);
- $conn->commit();
+ $conn->commit();
- header('Content-Type: application/json');
- $jsonData = json_encode($files);
+ header('Content-Type: application/json');
+ $jsonData = json_encode($files);
- // Cmail->sendx;
- // } catch (PDOException $e) {
- // $conn->rollback();
- // http_response_code(404);
- // echo $e->getMessage();
- // die('Error!:' . $e->getMessage());
- // }
+ // Cmail->sendx;
+ } catch (PDOException $e) {
+ $conn->rollback();
+ http_response_code(404);
+ echo $e->getMessage();
+ die('Error!:' . $e->getMessage());
+ }
};
function T8insert($data, $facilityno, $depId, $connT8)
@@ -630,7 +638,10 @@ function T8insert($data, $facilityno, $depId, $connT8)
];
// 幾年
// $SQuantityYear = $elevator['maintain_months'] / 12;
+ // 單台電梯契約報價
$price_of_month = intval($elevator['sold_price']);
+ print_r($price_of_month);
+ exit;
//分幾期 () => 總共保養月 / 分期月
$SQuantitya = $elevator['maintain_months'] / $IncomeId[$payType];
$SQuantity = $IncomeId[$payType];
@@ -710,14 +721,17 @@ function T8insert($data, $facilityno, $depId, $connT8)
$API_body[] = $salIncomeApplyMaster;
$API_body[] = $salIncomeApplyDetail;
// 呼叫 API
- // echo '';
- // print_r(json_encode($API_body));
- // echo '
';
+ echo '';
+ print_r(json_encode($API_body));
+ echo '
';
+ // exit();
// $api_url = 'http://10.10.145.2:880/twWebAPI/V1/SALINCOMEAPPLY/PostERPData'; //正式區
$api_url = "http://60.244.87.101:880/twWebAPI/V1/SALINCOMEAPPLY/PostERPData"; //測試區
$result = T8salIncomeApply($API_body, $api_url);
-
-
+ // echo '';
+ // print_r($result);
+ // echo '
';
+ // exit();
if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') {
http_response_code(404);
die('Error!:' . $result['ErrorMsg']);
diff --git a/wms/contract/api/test copy.json b/wms/contract/api/test copy.json
index d7250a17..7ef01c22 100644
--- a/wms/contract/api/test copy.json
+++ b/wms/contract/api/test copy.json
@@ -1,40 +1,43 @@
-{
- "apply_key": "MB24010007",
- "register_code": "036B017432",
- "elevator_brand": "1",
- "elevator_kind": "A",
- "spec": "MAE100",
- "weight": 550,
- "speed": 60,
- "stop": 12,
- "floors": 12,
- "persons": 8,
- "elevator_num": 0,
- "useful_years": 83,
- "last_check_date": 1121109,
- "speed_governors_check_expense": 0,
- "maintain_times": 1,
- "is_m1_bundle": "N",
- "maintainance": "A",
- "maintain_months": 12,
- "maintain_period": 1,
- "stand_price": 3140,
- "contract_price": 1666.67,
- "sold_price": 1667,
- "commission_expense": null,
- "management_expense": null,
- "annual_survey_expense": 0,
- "service_expense": 8,
- "cmstatus": "Y",
- "updated_at": null,
- "creater": null,
- "created_at": "2024-01-10 11:16:26",
- "discount": 53,
- "opendoor": "2S",
- "latitude": "112",
- "longitude": "11",
- "takecertificatedate": "112",
- "useful_date": "113-01-01",
- "bonus_verson": "2.0",
- "manager": "M0137"
-}
\ No newline at end of file
+[
+ {
+ "apply_key": "11111111",
+ "register_code": "B32510261185",
+ "elevator_brand": "1",
+ "elevator_kind": "E",
+ "spec": "MAH100",
+ "weight": "450",
+ "speed": "45.00",
+ "stop": "3",
+ "floors": "3",
+ "persons": "6",
+ "elevator_num": "0",
+ "useful_years": "106",
+ "last_check_date": "1",
+ "speed_governors_check_expense": "0",
+ "maintain_times": "1",
+ "is_m1_bundle": "N",
+ "maintainance": "B",
+ "maintain_months": "12",
+ "maintain_period": "1",
+ "stand_price": "1250.00",
+ "contract_price": "1250.00",
+ "sold_price": 1250,
+ "commission_expense": null,
+ "management_expense": null,
+ "annual_survey_expense": "0.00",
+ "service_expense": 0,
+ "cmstatus": "Y",
+ "updated_at": null,
+ "creater": null,
+ "created_at": "2024-02-26 15:24:23",
+ "discount": 100,
+ "latitude": "112",
+ "longitude": "11",
+ "takecertificatedate": "112",
+ "opendoor": "2PCO",
+ "useful_date": "113-01-01",
+ "bonus_verson": "2.0",
+ "manager": "M0029",
+ "regular_contract_manger_id": "M0054"
+ }
+]
\ No newline at end of file
diff --git a/wms/contract/api/testT8API.php b/wms/contract/api/testT8API.php
deleted file mode 100644
index 40b60024..00000000
--- a/wms/contract/api/testT8API.php
+++ /dev/null
@@ -1,17 +0,0 @@
-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 "";
-print_r($result['OAmountWithTax']);
-echo "
";
diff --git a/wms/contract/api/testocde.php b/wms/contract/api/testocde.php
new file mode 100644
index 00000000..b6bb6c8d
--- /dev/null
+++ b/wms/contract/api/testocde.php
@@ -0,0 +1,10 @@
+prepare($sql);
+$stmt->execute();
+$pay_kind = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+echo "";
+print_r($pay_kind);
+echo "
";
diff --git a/wms/contract/contract-input.php b/wms/contract/contract-input.php
index dcba75cd..48d61379 100644
--- a/wms/contract/contract-input.php
+++ b/wms/contract/contract-input.php
@@ -214,13 +214,23 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
保養員
+
+ 保養經理
-
diff --git a/wms/contract/js/alpine.js b/wms/contract/js/alpine.js
index 8b4e1ab7..e9d84276 100644
--- a/wms/contract/js/alpine.js
+++ b/wms/contract/js/alpine.js
@@ -1012,7 +1012,7 @@ const contractInput = () => {
},
cities: [],
data: {
- contractno: 'B24010030',
+ contractno: '',
total_price: '', //合約總價
vat: '', //統一編號
mtype: 'A', //維修型態
@@ -1038,7 +1038,8 @@ const contractInput = () => {
payType: '', //付款方式
contract_type: 'new',
signing_date: '',
- token: token
+ token: token,
+ maintance_manager: ''
// bonus_verson: 2.1,
// manager: '',
// regular_contract_manger_id: '',
@@ -1138,7 +1139,7 @@ const contractInput = () => {
if (!this.customize) {
this.data.elevators = res.data.elevators;
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));
// 服務費 (以單筆合約記,但計算獎金須傳入單月服務費)
@@ -1148,6 +1149,7 @@ const contractInput = () => {
this.data.elevators[i].sold_price = Math.round(res.data.elevators[i].sold_price);
}
console.log(this.data.elevators);
+ // 合約總價
this.data.total_price = Number(res.data.elevators[0].maintain_months) * this.data.total_price;
this.data.salesman = res.data.salesman
this.data.contract_begin_date = res.data.contract_begin_date
@@ -1245,6 +1247,7 @@ const contractInput = () => {
form.append('payType', this.data.payType);
form.append('contract_type', this.data.contract_type);
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++) {
diff --git a/wms/schedule-edit.php b/wms/schedule-edit.php
index 846f9605..68af998d 100644
--- a/wms/schedule-edit.php
+++ b/wms/schedule-edit.php
@@ -149,7 +149,7 @@ foreach ($data as $data) :
-
+
建檔時間
修改
- 刪除
+
+ 安排保養計畫人員
@@ -250,11 +255,16 @@ if ($data) :
+ + +
+ 安排 +
+