diff --git a/wms/account-receivable-facility.xlsx b/wms/account-receivable-facility.xlsx index 9c5fbaa6..24109745 100644 Binary files a/wms/account-receivable-facility.xlsx and b/wms/account-receivable-facility.xlsx differ diff --git a/wms/bonus/bonus.php b/wms/bonus/bonus.php index f7462641..4e0b84fd 100644 --- a/wms/bonus/bonus.php +++ b/wms/bonus/bonus.php @@ -31,7 +31,8 @@ if (!empty($_GET['check'])) { // 人事發放作業,應為一個月內 if ($_GET['check'] == 4) { $oneMonthAgo = date("Y-m-d", strtotime("$now +1 months")); - $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo'"; + // $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo' AND status IN (1,2,5)"; + $clause .= "AND status IN (1,2,5)"; } else if ($_GET['check'] == 2) { $clause .= "AND status = 1"; } else if ($_GET['check'] == 3) { @@ -133,7 +134,7 @@ function isPay($contract_no, $connT8) - + diff --git a/wms/bonus/bonus_check.php b/wms/bonus/bonus_check.php index 82eb1ea9..9a2e5640 100644 --- a/wms/bonus/bonus_check.php +++ b/wms/bonus/bonus_check.php @@ -100,7 +100,7 @@ $maintain_type = [ diff --git a/wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php b/wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php index 7573e199..d68bdb7d 100644 --- a/wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php +++ b/wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php @@ -48,7 +48,7 @@ require_once("maintenance_contract_bonus_v2_1.php"); #獎金測試 $examination_array = [ #錯誤版本 - ["1.0", "new", "one", 0.8, 4000, 333, "2014-07-01", "M0001", "M0002", "M0003"], + // ["1.0", "new", "one", 0.8, 4000, 333, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約 #月繳(monthly) ["2.1", "new", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", ''], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) @@ -258,9 +258,25 @@ $examination_array = [ ["2.1", "renew_priceissue", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) ]; - +// echo '1、契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue)
'; +// echo '6、付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually)
'; +// echo '2、作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上
'; +// echo '3、牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格
'; +// echo '4、該作番所佔的服務費金額($commission_fee)
'; +// echo '5、合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價
'; +// echo '7、第一筆保養款項應收回日($receivable_date_due, array)
'; +// echo '8、契約員員工號($sales_id)
'; +// echo '9、地區處長員工號($region_director_id)
'; +// echo '10、專任契約經理員工號($regular_contract_manger_id)
'; for ($i = 0; $i < count($examination_array); $i++) { + $fee_per_st = $examination_array[$i][3]; + $commission_fee = $examination_array[$i][5]; + $elevator_list_price = $examination_array[$i][4]; + $discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2); + + // echo "$fee_per_st - $commission_fee / $elevator_list_price "; + // $discount = round(($examination_array[$i][4] - $examination_array[$i][6]) / $examination_array[$i][5], 2); $examination_array[$i][9] = $examination_array[$i][9] == '' ? '' : $examination_array[$i][9]; $result = maintenance_contract_bonus_v2_1( $examination_array[$i][0], @@ -274,14 +290,38 @@ for ($i = 0; $i < count($examination_array); $i++) { $examination_array[$i][8], $examination_array[$i][9] ); + #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) + $contract_type = [ + 'new' => '新簽約', + 'free_to_charge' => '免保轉有費', + 'renew_priceissue' => '續簽約(原價或僅契約金額異動)' + + ]; + // 付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) + $pay_kind = [ + 'monthly' => '月繳', + 'bimonthly' => '雙月繳', + 'quarterly' => '季繳', + 'semiannually' => '半年繳', + 'annually' => '年繳' + ]; + + // + $bonus_type = [ + '1' => '契約員獎金', + '2' => '區經理獎金', + '3' => '契約經理獎金' + ]; echo "獎金版本:" . $result["ver"] . "
"; echo "計算結果:" . $result["result_status"] . "
"; + echo "傳入參數說明:" . $contract_type[$examination_array[$i][1]] . "、" . $pay_kind[$examination_array[$i][2]] . "、牌價" . $examination_array[$i][3] . "元、簽約價" . $examination_array[$i][4] . "元、服務費600元(折扣率" . $discount . ")、契約人員 : " . $examination_array[$i][7] . "、區經理 : " . $examination_array[$i][8] . " 、契約經理 : " . $examination_array[$i][9] . "
"; echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " . $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7] . " " . $examination_array[$i][8] . " " . $examination_array[$i][9] . "
"; + for ($j = 0; $j < count($result["bonus_array"]); $j++) { - echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " - . $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " " + echo "輸出結果:" . $bonus_type[$result["bonus_array"][$j]["bonus_type"]] . " ,發放人員 : " . $result["bonus_array"][$j]["bonus_receiver"] . " ,發放金額 : " + . $result["bonus_array"][$j]["bonus_amount"] . " ,預計發放時間 : " . $result["bonus_array"][$j]["pay_day_due"] . " ,說明 : " . $result["bonus_array"][$j]["bonus_regulation"] . "
"; }; echo "-------------------------" . "
"; diff --git a/wms/contract-repair/js/alpine.js b/wms/contract-repair/js/alpine.js index adf54931..3d21a269 100644 --- a/wms/contract-repair/js/alpine.js +++ b/wms/contract-repair/js/alpine.js @@ -904,9 +904,9 @@ const bonunsIndex = () => { bonus_actual: '', note: '', id: id, - bonus_actual: bonus_actual, - payDay: payDay, - note: note + // bonus_actual: bonus_actual, + // payDay: payDay, + // note: note }, step: 1, diff --git a/wms/contract/api/postContractData.php b/wms/contract/api/postContractData.php index d9f61baf..f2aa2fc1 100644 --- a/wms/contract/api/postContractData.php +++ b/wms/contract/api/postContractData.php @@ -35,6 +35,13 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $files = !empty($_FILES['files']) ? $_FILES['files'] : null; $elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : []; $payType = !empty($_POST['payType']) ? $_POST['payType'] : null; + + $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(); @@ -72,7 +79,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c if ($vat == '') $fail_arr[] = '統一編號為必填'; if ($mtype == '') $fail_arr[] = '維修型態為必填'; if ($phone == '') $fail_arr[] = '客戶電話為必填'; - if ($email == '') $fail_arr[] = 'Email為必填'; + // if ($email == '') $fail_arr[] = 'Email為必填'; if ($mworker == '') $fail_arr[] = '保養員為必填'; // if ($mcycle == '') $fail_arr[] = '保養頻率為必填'; if ($salesman == '') $fail_arr[] = '營業員為必填'; @@ -92,7 +99,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c echo json_encode($fail_arr); exit(); } - T8insert($_POST, $facilityno); + T8insert($_POST, $facilityno, $depId); bonusCreate($_POST, $facilityno, $conn); //create account table $accounttype = "A"; @@ -199,6 +206,12 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $repairerid = $mworker; $repairername = $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); @@ -224,7 +237,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $stmt->bindParam(':create_at', $create_at); $stmt->bindParam(':area', $area); $stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']); - $stmt->bindParam(':licensedate', $elevator['useful_date']); + $stmt->bindParam(':licensedate', $ADuseful_date); $result = $stmt->execute(); } @@ -357,7 +370,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c // T8insert($_POST, $facilityno); - header('Content-Type: application/json'); + // header('Content-Type: application/json'); $jsonData = json_encode($files); $conn->commit(); @@ -369,7 +382,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c } }; -function T8insert($data, $facilityno) +function T8insert($data, $facilityno, $depId) { require_once("../connt8.php"); // 引入 T8 API 連線 @@ -611,7 +624,9 @@ function T8insert($data, $facilityno) "TaxId" => "ST005", "CompId" => "1001", "CreatorId" => "$user_id", - "CreateTime" => intval($insertTime) + "CreateTime" => intval($insertTime), + "DeptId" => "$depId", + "IsPriceWithTax" => 1 ]; $salIncomeApplyMaster = [ @@ -673,7 +688,7 @@ function bonusCreate($data, $facilityno, $conn) $ver = $elevator['bonus_verson']; //獎金版本 $contract_type = $elevator['contract_type']; //合約類別 $payment_period = $payment[$payType]; //付款方式 - $elevator_list_price = $elevator['stand_price']; //牌價 + $elevator_list_price = intval($elevator['stand_price']); //牌價 $fee_per_st = $elevator['contract_price']; //作翻契約金額 $commission_fee = $elevator['service_expense']; //服務費(月) $receivable_date_due = $payDay; //第一筆保養款項收回日 diff --git a/wms/contract/api/testT8API.php b/wms/contract/api/testT8API.php index d2f2f4e4..41870a4c 100644 --- a/wms/contract/api/testT8API.php +++ b/wms/contract/api/testT8API.php @@ -1,28 +1,13 @@ 25) { - // 增加一個月 - $timestamp = strtotime('+1 month', $timestamp); - } - - // 設定日期為 25 號 - $targetDate = date('Y-m-25', $timestamp); - - return $targetDate; -} - -// 測試函數 -$dateString = '2024-05-1'; -$next25thDate = getNext25thDate($dateString); -echo "傳入日期的下個 25 號日期是:$next25thDate"; +$date = "113-01-01"; +$click = explode("-", $date); +$click[0] = intval($click[0]) + 1911; + +$ADdate = implode('-', $click); +echo '
';
+print_r($date);
+echo '
'; + +echo '
';
+print_r($ADdate);
+echo '
'; diff --git a/wms/contract/contract-input.php b/wms/contract/contract-input.php index 04a783f1..114cea2f 100644 --- a/wms/contract/contract-input.php +++ b/wms/contract/contract-input.php @@ -311,17 +311,17 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);

未填寫

- + - +
應發獎金 - +
竣檢日竣檢日(民國年分) - +

未填寫

許可證有效時間許可證有效日期
(民國年-月-日。Ex.113-01-01)
- +

未填寫

保養頻率