From 6a8ffe182eba41f25add7a130095cd57ae9c7fbc Mon Sep 17 00:00:00 2001 From: Cheng Date: Thu, 15 Feb 2024 17:56:34 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E7=8D=8E=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/bonus/api/postStatus.php | 60 ++++ wms/bonus/bonus.php | 477 +++++++++++++++----------- wms/bonus/bonus_detail.php | 21 +- wms/contract-repair/js/alpine.js | 47 ++- wms/contract-repair/styles/style.css | 423 +++++++++++++++-------- wms/contract-repair/styles/style.scss | 2 +- wms/contract/contract-new-apply.php | 10 +- 7 files changed, 679 insertions(+), 361 deletions(-) create mode 100644 wms/bonus/api/postStatus.php diff --git a/wms/bonus/api/postStatus.php b/wms/bonus/api/postStatus.php new file mode 100644 index 00000000..a7abb7b8 --- /dev/null +++ b/wms/bonus/api/postStatus.php @@ -0,0 +1,60 @@ +prepare($sql); + $stmt->execute(); + + echo 'Success'; +} +// 獎金確認發放,並更新獎金 OR 實際發放時間 +if (!empty($_POST['postType']) && $_POST['postType'] == 'b') { + + $id = empty($_POST['id']) ? '' : $_POST['id']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; + $note = empty($_POST['note']) ? '' : $_POST['note']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $review_at = date("Y-m-d"); + try { + $sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + } catch (PDOException $e) { + header("HTTP/1.1 500 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} + +// 獎金暫不發放 +if (!empty($_POST['postType']) && $_POST['postType'] == 'c') { + // echo 'cccccc'; + $id = empty($_POST['id']) ? '' : $_POST['id']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $note = empty($_POST['note']) ? '' : $_POST['note']; + try { + $sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + } catch (PDOException $e) { + header("HTTP/1.1 500 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} + +if (!empty($_POST['postType']) && $_POST['postType'] == 'd') { + $id = empty($_POST['id']) ? '' : $_POST['id']; + print_r($id); + // echo 'ddddd'; +} diff --git a/wms/bonus/bonus.php b/wms/bonus/bonus.php index eb1959a2..4e5b3f8d 100644 --- a/wms/bonus/bonus.php +++ b/wms/bonus/bonus.php @@ -15,10 +15,22 @@ $bonus_type = [ '2' => '區經理獎金', '3' => '專任契約經理獎金' ]; + +$bonus_status = [ + '1' => '未確認', + '2' => '應發已確認', + '3' => '應發未確認', + '4' => '暫不發放', + '5' => '人事審核確認' +]; $clause = ''; +if ($user_id != 'M0225') { + $clause .= "AND receiver == '$user_id'"; +} if (!empty($_GET['check'])) { - if ($_GET['check'] == 1) { - $clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; + // 人事發放作業,應為一個月內 + if ($_GET['check'] == 4) { + $clause .= "AND pay_day_due > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; } else if ($_GET['check'] == 2) { $clause .= "AND status = 1"; } else if ($_GET['check'] == 3) { @@ -35,6 +47,14 @@ $datas = $stmt->fetchAll(PDO::FETCH_ASSOC); $now = new DateTime(); $oneMonthAgo = $now->modify('+1 month'); +$id = []; +foreach ($datas as $data) { + $id[] = $data['id']; +} +$id_str = implode(',', $id); +echo "
";
+print_r($id_str);
+echo '
'; // 查看 T8 是否有收款明細 // require("./api/get.php"); function isPay($contract_no, $connT8) @@ -98,204 +118,257 @@ function isPay($contract_no, $connT8) -
- - -
- - - - btn-sm categoryBtn"> 所有獎金 - btn-sm categoryBtn"> 應發獎金 - btn-sm categoryBtn"> 未發獎金 - btn-sm categoryBtn"> 已發獎金 - - - - - - - - - - - - - - - - - - - - - - - $data) : - - $contract_no = $data['contract_no']; - $json = json_decode($data['bonus_json']); - - $total = empty($json->total) ? 0 : $json->total; - $fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; - $commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; - $isPay = isPay($data['contract_no'], $connT8); - - ?> - - - - - - - - - - - - - - - - - - - - -
項次合約類別合約號作番號獎金類別獎金版本作番總價牌價服務費應發人員預計發放時間獎金水庫狀態檢視/發放
- - - - - 發放獎金 - - 查看詳情 - -
+
+
+
+ + + + btn-sm categoryBtn"> 所有獎金 + + btn-sm categoryBtn"> 未發獎金 + btn-sm categoryBtn"> 已發獎金 + btn-sm categoryBtn"> 人事發放作業 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $data) : + + $contract_no = $data['contract_no']; + $json = json_decode($data['bonus_json']); + + $total = empty($json->total) ? 0 : $json->total; + $fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; + $commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; + // $isPay = isPay($data['contract_no'], $connT8); + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次合約類別合約號作番號獎金類別獎金版本作番總價牌價服務費應發人員預計發放時間獎金水庫狀態實際發放時間發放 / 詳情
+ + + -- + + + + 查看詳情 + +
+
-
- - - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/wms/bonus/bonus_detail.php b/wms/bonus/bonus_detail.php index 93762ac3..0ca70c7b 100644 --- a/wms/bonus/bonus_detail.php +++ b/wms/bonus/bonus_detail.php @@ -111,7 +111,7 @@ $maintain_type = [ 應發獎金 - + @@ -133,6 +133,17 @@ $maintain_type = [ + + 實發獎金 + + + + 實發時間 + + + 備註 + + @@ -145,6 +156,14 @@ $maintain_type = [
+ + 分期方式 + + +

未填寫

@@ -184,21 +196,13 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);

未填寫

- 分期方式 + 附件 - -

未填寫

+ - + + + - - +
+ + + + + + + + + + + + + + + + + + + + + +
項次電梯人乘/
載重
停數速度(m/min)保養月數保養次數(月)保養方式公司發布價(月)數量公司發布價(總價)售價(月)售價(總價)
+
+ + + + + \ No newline at end of file From 8d4230eed8bd0767ba88715e6c5aa4f71cab6b04 Mon Sep 17 00:00:00 2001 From: Cheng Date: Thu, 15 Feb 2024 17:56:34 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E7=8D=8E=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/bonus/api/postStatus.php | 60 ++++ wms/bonus/bonus.php | 477 +++++++++++++++----------- wms/bonus/bonus_detail.php | 21 +- wms/contract-repair/js/alpine.js | 47 ++- wms/contract-repair/styles/style.css | 423 +++++++++++++++-------- wms/contract-repair/styles/style.scss | 2 +- wms/contract/contract-new-apply.php | 10 +- 7 files changed, 679 insertions(+), 361 deletions(-) create mode 100644 wms/bonus/api/postStatus.php diff --git a/wms/bonus/api/postStatus.php b/wms/bonus/api/postStatus.php new file mode 100644 index 00000000..a7abb7b8 --- /dev/null +++ b/wms/bonus/api/postStatus.php @@ -0,0 +1,60 @@ +prepare($sql); + $stmt->execute(); + + echo 'Success'; +} +// 獎金確認發放,並更新獎金 OR 實際發放時間 +if (!empty($_POST['postType']) && $_POST['postType'] == 'b') { + + $id = empty($_POST['id']) ? '' : $_POST['id']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; + $note = empty($_POST['note']) ? '' : $_POST['note']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $review_at = date("Y-m-d"); + try { + $sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + } catch (PDOException $e) { + header("HTTP/1.1 500 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} + +// 獎金暫不發放 +if (!empty($_POST['postType']) && $_POST['postType'] == 'c') { + // echo 'cccccc'; + $id = empty($_POST['id']) ? '' : $_POST['id']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $note = empty($_POST['note']) ? '' : $_POST['note']; + try { + $sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + } catch (PDOException $e) { + header("HTTP/1.1 500 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} + +if (!empty($_POST['postType']) && $_POST['postType'] == 'd') { + $id = empty($_POST['id']) ? '' : $_POST['id']; + print_r($id); + // echo 'ddddd'; +} diff --git a/wms/bonus/bonus.php b/wms/bonus/bonus.php index eb1959a2..4e5b3f8d 100644 --- a/wms/bonus/bonus.php +++ b/wms/bonus/bonus.php @@ -15,10 +15,22 @@ $bonus_type = [ '2' => '區經理獎金', '3' => '專任契約經理獎金' ]; + +$bonus_status = [ + '1' => '未確認', + '2' => '應發已確認', + '3' => '應發未確認', + '4' => '暫不發放', + '5' => '人事審核確認' +]; $clause = ''; +if ($user_id != 'M0225') { + $clause .= "AND receiver == '$user_id'"; +} if (!empty($_GET['check'])) { - if ($_GET['check'] == 1) { - $clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; + // 人事發放作業,應為一個月內 + if ($_GET['check'] == 4) { + $clause .= "AND pay_day_due > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; } else if ($_GET['check'] == 2) { $clause .= "AND status = 1"; } else if ($_GET['check'] == 3) { @@ -35,6 +47,14 @@ $datas = $stmt->fetchAll(PDO::FETCH_ASSOC); $now = new DateTime(); $oneMonthAgo = $now->modify('+1 month'); +$id = []; +foreach ($datas as $data) { + $id[] = $data['id']; +} +$id_str = implode(',', $id); +echo "
";
+print_r($id_str);
+echo '
'; // 查看 T8 是否有收款明細 // require("./api/get.php"); function isPay($contract_no, $connT8) @@ -98,204 +118,257 @@ function isPay($contract_no, $connT8) -
- - -
- - - - btn-sm categoryBtn"> 所有獎金 - btn-sm categoryBtn"> 應發獎金 - btn-sm categoryBtn"> 未發獎金 - btn-sm categoryBtn"> 已發獎金 - - - - - - - - - - - - - - - - - - - - - - - $data) : - - $contract_no = $data['contract_no']; - $json = json_decode($data['bonus_json']); - - $total = empty($json->total) ? 0 : $json->total; - $fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; - $commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; - $isPay = isPay($data['contract_no'], $connT8); - - ?> - - - - - - - - - - - - - - - - - - - - -
項次合約類別合約號作番號獎金類別獎金版本作番總價牌價服務費應發人員預計發放時間獎金水庫狀態檢視/發放
- - - - - 發放獎金 - - 查看詳情 - -
+
+
+
+ + + + btn-sm categoryBtn"> 所有獎金 + + btn-sm categoryBtn"> 未發獎金 + btn-sm categoryBtn"> 已發獎金 + btn-sm categoryBtn"> 人事發放作業 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $data) : + + $contract_no = $data['contract_no']; + $json = json_decode($data['bonus_json']); + + $total = empty($json->total) ? 0 : $json->total; + $fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; + $commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; + // $isPay = isPay($data['contract_no'], $connT8); + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次合約類別合約號作番號獎金類別獎金版本作番總價牌價服務費應發人員預計發放時間獎金水庫狀態實際發放時間發放 / 詳情
+ + + -- + + + + 查看詳情 + +
+
-
- - - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/wms/bonus/bonus_detail.php b/wms/bonus/bonus_detail.php index 93762ac3..0ca70c7b 100644 --- a/wms/bonus/bonus_detail.php +++ b/wms/bonus/bonus_detail.php @@ -111,7 +111,7 @@ $maintain_type = [ 應發獎金 - + @@ -133,6 +133,17 @@ $maintain_type = [ + + 實發獎金 + + + + 實發時間 + + + 備註 + + @@ -145,6 +156,14 @@ $maintain_type = [
+ + 分期方式 + + +

未填寫

@@ -184,21 +196,13 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);

未填寫

- 分期方式 + 附件 - -

未填寫

+ - + + + - - +
+ + + + + + + + + + + + + + + + + + + + + +
項次電梯人乘/
載重
停數速度(m/min)保養月數保養次數(月)保養方式公司發布價(月)數量公司發布價(總價)售價(月)售價(總價)
+
+ + + + + \ No newline at end of file From 56768aa586115b01d6be496e98d4ec75e951bd78 Mon Sep 17 00:00:00 2001 From: Cheng Date: Tue, 20 Feb 2024 18:00:16 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=BF=9D=E9=A4=8A=E7=B0=BD=E5=9B=9E?= =?UTF-8?q?=E8=88=87=E7=8D=8E=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/T8_Authorization_from_bpm.php | 12 +- wms/bonus/api/postStatus.php | 117 +- wms/bonus/bonus.php | 70 +- wms/bonus/bonus_check.php | 199 +++ wms/bonus/bonus_detail.php | 13 +- .../other/maintenance_contract_bonus_v2_1.php | 14 +- wms/contract-repair/js/alpine.js | 12 +- wms/contract/api/T8salIncomeApply.php | 11 +- wms/contract/api/postContractData.php | 229 ++- wms/contract/api/testT8API.php | 45 +- wms/contract/contract-input.php | 2 +- wms/contract/js/alpine.js | 32 +- wms/mkt/assets/js/pricereviewAlpine.js | 1585 ++++++++--------- 13 files changed, 1355 insertions(+), 986 deletions(-) create mode 100644 wms/bonus/bonus_check.php diff --git a/wms/T8_Authorization_from_bpm.php b/wms/T8_Authorization_from_bpm.php index 7c206023..b862a81d 100644 --- a/wms/T8_Authorization_from_bpm.php +++ b/wms/T8_Authorization_from_bpm.php @@ -3,10 +3,7 @@ // $user_id = "M0000"; // $user_password = "M012290493119"; -$user_id = "M0117"; -$user_password = "90493119"; - -echo $validation = get_Auth($user_id, $user_password); +// echo $validation = get_Auth($user_id, $user_password); function get_Auth($user_id = "M0000", $user_password = "M012290493119") { @@ -16,8 +13,9 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") // $now = gmdate("YmdHis"); $now = gmdate("YmdHis", strtotime("-2 minutes")); $data = "$user_id." . $now; - $sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); + $sign = hash_hmac('SHA256', $data, 'A21181F1EE4966D3', false); + // echo $sign; // $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth'; $apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; @@ -30,7 +28,7 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") "Pwd: $user_password", "TimestampUTC: $now", "Sign: $sign", - "GroupId: TEST" + "GroupId:TEST" ]; $ch = curl_init(); @@ -53,4 +51,4 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") curl_close($ch); } // $data = []; -get_Auth(); +// get_Auth(); diff --git a/wms/bonus/api/postStatus.php b/wms/bonus/api/postStatus.php index a7abb7b8..86f9f88d 100644 --- a/wms/bonus/api/postStatus.php +++ b/wms/bonus/api/postStatus.php @@ -2,32 +2,44 @@ require_once("../../contract/conn.php"); if (!empty($_POST['id']) && !empty($_POST['postType']) && $_POST['postType'] == 'a') { - $id = empty($_POST['id']) ? '' : $_POST['id']; - $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; - $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; - $review_at = date("Y-m-d"); - $sql = "UPDATE bonus SET status = 2 ,review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day' WHERE id = $id"; - $stmt = $conn->prepare($sql); - $stmt->execute(); - - echo 'Success'; -} -// 獎金確認發放,並更新獎金 OR 實際發放時間 -if (!empty($_POST['postType']) && $_POST['postType'] == 'b') { - - $id = empty($_POST['id']) ? '' : $_POST['id']; - $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; - $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; - $note = empty($_POST['note']) ? '' : $_POST['note']; - $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; - $review_at = date("Y-m-d"); try { - $sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; + $id = empty($_POST['id']) ? '' : $_POST['id']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $amount = empty($_POST['amount']) ? '' : $_POST['amount']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $review_at = date("Y-m-d H:i:s"); + $sql = "UPDATE bonus SET status = 2 ,bonus_actual='$amount',review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day',update_id='$user_id',update_at='$review_at' WHERE id = $id"; $stmt = $conn->prepare($sql); $stmt->execute(); + header("HTTP/1.1 200 success!"); + echo 'Success'; } catch (PDOException $e) { - header("HTTP/1.1 500 failed!"); + header("HTTP/1.1 404 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} +// 獎金確認發放,並更新獎金 OR 實際發放時間 +if (!empty($_POST['postType']) && $_POST['postType'] == 'b') { + try { + $id = empty($_POST['id']) ? '' : $_POST['id']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $bonus_actual = empty($_POST['bonus_actual']) ? '' : $_POST['bonus_actual']; + $note = empty($_POST['note']) ? '' : $_POST['note']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $review_at = date("Y-m-d H:i:s"); + if ($pay_day != '' && $bonus_actual != '') { + $sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',bonus_actual='$bonus_actual',pay_day='$pay_day',note='$note' WHERE id = $id"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + } else { + header("HTTP/1.1 400"); + echo '請填寫發放時間和實發獎金'; + } + } catch (PDOException $e) { + header("HTTP/1.1 404 failed!"); echo $e->getMessage(); die('Error!:' . $e->getMessage()); } @@ -36,25 +48,64 @@ if (!empty($_POST['postType']) && $_POST['postType'] == 'b') { // 獎金暫不發放 if (!empty($_POST['postType']) && $_POST['postType'] == 'c') { // echo 'cccccc'; - $id = empty($_POST['id']) ? '' : $_POST['id']; - $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; - $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; - $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; - $note = empty($_POST['note']) ? '' : $_POST['note']; try { - $sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; - $stmt = $conn->prepare($sql); - $stmt->execute(); - header("HTTP/1.1 200 success!"); + $id = empty($_POST['id']) ? '' : $_POST['id']; + $pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day']; + $bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue']; + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + $note = empty($_POST['note']) ? '' : $_POST['note']; + $review_at = date("Y-m-d H:i:s"); + + if ($note != '') { + $sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id"; + echo $sql; + $stmt = $conn->prepare($sql); + $stmt->execute(); + header("HTTP/1.1 200 success!"); + } else { + echo '請填寫備註!!'; + header("HTTP/1.1 400!"); + } } catch (PDOException $e) { - header("HTTP/1.1 500 failed!"); + header("HTTP/1.1 404 failed!"); echo $e->getMessage(); die('Error!:' . $e->getMessage()); } } if (!empty($_POST['postType']) && $_POST['postType'] == 'd') { - $id = empty($_POST['id']) ? '' : $_POST['id']; - print_r($id); + try { + $id = empty($_POST['id']) ? '' : $_POST['id']; + $review_at = date("Y-m-d H:i:s"); + $user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; + + $sql = "SELECT * FROM bonus WHERE id IN ($id)"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + $results = $stmt->fetchAll(PDO::FETCH_ASSOC); + + $conn->beginTransaction(); + foreach ($results as $result) { + // echo '
';
+            // print_r($result);
+            // echo '
'; + // exit(); + $amount = $result['amount']; + $id = $result['id']; + $pay_day = $result['pay_day_due']; + + $sql = "UPDATE bonus SET status = 5 ,bonus_actual='$amount',review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day' WHERE id = $id"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + } + + $conn->commit(); + header("HTTP/1.1 200 success!"); + } catch (PDOException $e) { + $conn->rollBack(); + header("HTTP/1.1 404 failed!"); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } // echo 'ddddd'; } diff --git a/wms/bonus/bonus.php b/wms/bonus/bonus.php index 4e5b3f8d..f7462641 100644 --- a/wms/bonus/bonus.php +++ b/wms/bonus/bonus.php @@ -2,7 +2,7 @@ include_once("../header.php"); // require_once('./connT8.php'); require("../contract/conn.php"); - +$now = date("Y-m-d"); $contract_type = [ '1' => '新梯', @@ -30,15 +30,16 @@ if ($user_id != 'M0225') { if (!empty($_GET['check'])) { // 人事發放作業,應為一個月內 if ($_GET['check'] == 4) { - $clause .= "AND pay_day_due > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; + $oneMonthAgo = date("Y-m-d", strtotime("$now +1 months")); + $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo'"; } else if ($_GET['check'] == 2) { $clause .= "AND status = 1"; } else if ($_GET['check'] == 3) { - $clause .= "AND status = 2"; + $clause .= "AND status IN (2,5)"; } } -$sql = "SELECT * FROM bonus WHERE 1=1 $clause LIMIT 50"; +$sql = "SELECT * FROM bonus WHERE 1=1 $clause"; $stmt = $conn->prepare($sql); $stmt->execute(); $datas = $stmt->fetchAll(PDO::FETCH_ASSOC); @@ -47,14 +48,13 @@ $datas = $stmt->fetchAll(PDO::FETCH_ASSOC); $now = new DateTime(); $oneMonthAgo = $now->modify('+1 month'); + $id = []; foreach ($datas as $data) { $id[] = $data['id']; } $id_str = implode(',', $id); -echo "
";
-print_r($id_str);
-echo '
'; + // 查看 T8 是否有收款明細 // require("./api/get.php"); function isPay($contract_no, $connT8) @@ -121,9 +121,9 @@ function isPay($contract_no, $connT8)
- + btn-sm categoryBtn"> 所有獎金 btn-sm categoryBtn"> 未發獎金 @@ -132,8 +132,9 @@ function isPay($contract_no, $connT8) - - + + + @@ -142,12 +143,13 @@ function isPay($contract_no, $connT8) - + - + + 實際發放時間 - + + + @@ -164,7 +169,6 @@ function isPay($contract_no, $connT8) $contract_no = $data['contract_no']; $json = json_decode($data['bonus_json']); - $total = empty($json->total) ? 0 : $json->total; $fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; $commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; @@ -178,12 +182,13 @@ function isPay($contract_no, $connT8) - + + - + - + + + const datas = ; - function issue(id, user_id, pay_day) { + function issue(id, user_id, pay_day, amount) { // console.log(id); const form = new FormData(); form.append('id', id) form.append('user_id', user_id); form.append('pay_day', pay_day) + form.append('amount', amount); + form.append('postType', 'a'); axios.post('./api/postStatus.php', form).then((res) => { if (res.data == 'Success') { alert('更新成功'); @@ -334,15 +341,20 @@ function isPay($contract_no, $connT8) function All(data) { let arr = data.split(","); - console.log(arr); const form = new FormData(); form.append('id', arr); + form.append('user_id', '') form.append('postType', 'd'); - axios.post('./api/postStatus.php', form).then((res) => { - console.log(res); - }).catch((err) => { - - }); + if (confirm('是否發放全部獎金')) { + axios.post('./api/postStatus.php', form).then((res) => { + if (res.status == 200) { + alert('更新成功'); + location.reload(); + } + }).catch((err) => { + + }); + } } // $(function() { // $("button[name=issuePay]").click(function() { diff --git a/wms/bonus/bonus_check.php b/wms/bonus/bonus_check.php new file mode 100644 index 00000000..82eb1ea9 --- /dev/null +++ b/wms/bonus/bonus_check.php @@ -0,0 +1,199 @@ +prepare($sql); +$stmt->bindParam(':id', $_GET['id']); +$stmt->execute(); +$result = $stmt->fetch(PDO::FETCH_ASSOC); +// echo '
';
+// print_r($result['bonus_json']);
+// echo '
'; +$bonus_json = json_decode($result['bonus_json']); + +$paykind = [ + 'monthly' => '月繳', + 'bimonthly' => '雙月繳', + 'quarterly' => '季繳', + 'semiannually' => '半年繳', + 'annually' => '年繳' +]; + +$maintain_type = [ + 'new' => '新簽約', + 'free_to_charge' => '免保轉有費', + 'renew_priceissue' => '續簽約' +]; +?> + + + + + + + + + + +
+
+ +
+
項次作番號 獎金類別 獎金版本作番總價作番金額(月) 牌價 服務費 應發人員 預計發放時間獎金水庫應發獎金水庫實發金額 狀態 發放 / 詳情詳情
@@ -193,11 +198,9 @@ function isPay($contract_no, $connT8) -- - + 查看詳情查看詳情
+ + + + + + + +
+

獎金計算

+
+ + + +
+
+
+ + \ No newline at end of file diff --git a/wms/bonus/bonus_detail.php b/wms/bonus/bonus_detail.php index 0ca70c7b..93dafa31 100644 --- a/wms/bonus/bonus_detail.php +++ b/wms/bonus/bonus_detail.php @@ -48,17 +48,6 @@ $maintain_type = [ - - - - --> - - - 安裝 - 5、安裝完畢款 - - - - - - - - - - - - 6、驗收款 - - - - - - - - - - - - 7、其他 - - - - - - - - - - + + + + + + + 6、驗收款 + + + + + + + + + + + + 7、其他 + + + + + + + + + + - - 合計 - - - - - - - - - - - - + + 合計 + + + + + + + + + + + + - - + + - + - + - + + - \ No newline at end of file diff --git a/wms/contract/api/getContractData.php b/wms/contract/api/getContractData.php index f1c1a3fc..253e8d54 100644 --- a/wms/contract/api/getContractData.php +++ b/wms/contract/api/getContractData.php @@ -46,15 +46,52 @@ if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['cont if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') { try { $contractno = $_GET['contractno']; - $sql_str = "SELECT a.*,b.lm_tel,b.uscc,b.manager FROM pricereview_main AS a + $sql_str = "SELECT a.*,b.lm_tel,b.uscc,b.manager,b.linkman FROM pricereview_main AS a LEFT JOIN hope_elevator_customer AS b ON a.contractno = b.vol_no - WHERE a.contractno = :contractno AND a.status = 'YS' "; + WHERE a.contractno = :contractno AND a.status != 'YN' "; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':contractno', $contractno); $stmt->execute(); $contract = $stmt->fetch(PDO::FETCH_ASSOC); - $contractResponse = json_encode($contract); + $salesman = $contract['person']; + $sql = "SELECT * FROM account WHERE accountid = :accountid "; + $stmt = $conn->prepare($sql); + $stmt->bindParam(':accountid', $salesman); + $stmt->execute(); + $account_detail = $stmt->fetch(PDO::FETCH_ASSOC); + $contract['manager'] = $account_detail['manager']; + $contract['salesman_departno'] = $account_detail['department_id']; + + + $mid = $contract['id']; + $sql = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A' "; + $stmt = $conn->prepare($sql); + $stmt->bindParam(':mid', $mid); + $stmt->execute(); + $results = $stmt->fetchAll(PDO::FETCH_ASSOC); + $elevators_detail_arr = []; + foreach ($results as $keys => $result) { + $note = explode(',', $result['note']); + $result['spec'] = $note[0]; //型號 + $result['person'] = $note[1]; // 人承 + $result['floor'] = $note[2]; // 樓層 + $result['speed'] = $note[3]; // 速度 + for ($i = 0; $i < $result['item_qty']; $i++) { + $result['item_no'] = $i + 1; + array_push($elevators_detail_arr, $result); + } + } + $count = COUNT($elevators_detail_arr); + + $contract['elevators'] = $results; + $contract['elevators_detail_arr'] = $elevators_detail_arr; + $contract['nums'] = $count; + // echo '
';
+        // print_r($contract);
+        // echo '
'; + // exit; + $contractResponse = json_encode($contract); // 設定回應標頭為 JSON header('Content-Type: application/json'); diff --git a/wms/contract/api/postNewContractData.php b/wms/contract/api/postNewContractData.php index 0ee6964e..08735fdc 100644 --- a/wms/contract/api/postNewContractData.php +++ b/wms/contract/api/postNewContractData.php @@ -24,6 +24,14 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $salesman = $_POST["salesman"]; $qc = $_POST["qc"]; $contracttype = $_POST["contracttype"]; + $elevators_nums = $_POST['nums']; + $elevators = json_decode($_POST['elevators'], true); + $elevators_detail_arr = json_decode($_POST['elevators_detail_arr'], true); + BounsCount($_POST, $conn); + // echo '
';
+    // print_r($elevators);
+    // echo '
'; + // exit; $files = !empty($_FILES['files']) ? $_FILES['files'] : null; $files_id = null; @@ -43,8 +51,27 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c echo json_encode($fail_arr); exit(); } - - + //create facility table + $createFacilityNo = new CreateFacilityNo(); + $dailyNecessities = [ + 'MAE100' => 'X', + 'MAM200' => 'W', + 'MAH100' => 'H', + 'MAQ100' => 'Z', + 'MAF100' => 'F', + 'MAZ100' => 'B', + ]; + $arr = []; + // 建立作番號 + foreach ($elevators_detail_arr as $elevator) { + // $spec = explode('-', $elevator['item_spec']); + $arr[] = $dailyNecessities[$elevator['spec']]; + } + $facilityno = $createFacilityNo->makeMFacilityNo('M', $arr, intval($elevators_nums)); + echo '
';
+    print_r($facilityno);
+    echo '
'; + exit(); $conn->beginTransaction(); $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC"; @@ -151,6 +178,7 @@ function T8Insert($data) $user_id = $data['user_id']; $salesman = $data['salesman']; $createAt = date("Y-m-dH-i-s"); + $elevators[] = $data['elevators']; $createTime = str_replace('-', '', $createAt); @@ -252,3 +280,45 @@ function T8Insert($data) $stmt->execute(); } } + + +function BounsCount($data, $conn) +{ + // echo '
';
+  // print_r($data);
+  // echo '
'; + // exit; + require_once("../../bonus/elevator_new/elevator_new_deal_bonus.php"); + $signing_date = $data['signing_date']; + $bonus_v1_0_date = '2024-01-02'; + $bonus_v2_0_date = '2024-01-03'; + $contractType = [ + '1' => 'strategy_customer', + '2' => 'general_customer' + ]; + $contract_type = $data['contract_type']; + + $type = $contractType[$contract_type]; //戰略客戶 or 一般客戶 + $elevator_knockdown_price = $data['price_total']; //受價總額 + + $salesman = $data['salesman']; + $manager = $data['manager']; + + $result_bonus = []; + if ($signing_date <= $bonus_v1_0_date) { + $ver = '1.0'; + $result_bonus = elevator_new_deal_bonus_v1_0($ver, $type, $elevator_knockdown_price, $salesman, $manager); + } else if ($signing_date >= $bonus_v2_0_date) { + $ver = '2.0'; + } + + echo '
';
+  print_r($result_bonus);
+  echo '
'; + exit(); + try { + } catch (PDOException $e) { + header("HTTP/1.1 500 Internal Server Error"); + die('Error!:' . $e->getMessage()); + } +} diff --git a/wms/contract/api/testT8API.php b/wms/contract/api/testT8API.php index 41870a4c..9512cbc8 100644 --- a/wms/contract/api/testT8API.php +++ b/wms/contract/api/testT8API.php @@ -1,13 +1,36 @@ -$ADdate = implode('-', $click); -echo '
';
-print_r($date);
-echo '
'; + + 地址轉經緯度 + + -echo '
';
-print_r($ADdate);
-echo '
'; + +

輸入地址以獲取經緯度

+
+ + +
+
+ + + \ No newline at end of file diff --git a/wms/contract/contract-newelevator-input.php b/wms/contract/contract-newelevator-input.php index 219ced48..75992ffc 100644 --- a/wms/contract/contract-newelevator-input.php +++ b/wms/contract/contract-newelevator-input.php @@ -1,17 +1,17 @@ -prepare($sql_str); $stmt->bindParam(":accounttype", $accounttype); -$stmt -> execute(); +$stmt->execute(); $persons = $stmt->fetchAll(PDO::FETCH_ASSOC); -$persons = array_map(function($person){ +$persons = array_map(function ($person) { return [ - 'view'=>$person['accountid'] .'-'. $person['name'], - 'value'=>$person['accountid'], - 'name'=>$person['name'] + 'view' => $person['name'] . '-' . $person['accountid'], + 'value' => $person['accountid'], + 'name' => $person['name'] ]; }, $persons); ?> @@ -21,7 +21,7 @@ $persons = array_map(function($person){
-
+
@@ -31,106 +31,233 @@ $persons = array_map(function($person){

合約入力(新梯)

- + + + + +
- -