From 839f08e140da1dd63a115eb42d7dad32d8510474 Mon Sep 17 00:00:00 2001 From: 10994015 Date: Wed, 3 Jan 2024 13:15:50 +0800 Subject: [PATCH 1/5] rollback --- wms/mkt/pricereview-create.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/wms/mkt/pricereview-create.php b/wms/mkt/pricereview-create.php index 8fd63f2e..9523d306 100644 --- a/wms/mkt/pricereview-create.php +++ b/wms/mkt/pricereview-create.php @@ -1197,12 +1197,22 @@ $options = $stmt->fetchAll(PDO::FETCH_ASSOC); - 1 - 2 - 3 - 4 - 5 - 6 + + + + + + $ From a4627cd9f7b8b86f750eb1a1ff54868bbd484a66 Mon Sep 17 00:00:00 2001 From: Cheng Date: Wed, 3 Jan 2024 17:48:09 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=9D=E9=A4=8A=E5=90=88=E7=B4=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/T8_APItest.php | 4 +- wms/contract-repair/api/putContractData.php | 12 +- wms/contract/api/postContractData.php | 12 +- wms/contract/contract-input.php | 723 ++++++++++---------- wms/contract/js/alpine.js | 40 +- 5 files changed, 417 insertions(+), 374 deletions(-) diff --git a/wms/T8_APItest.php b/wms/T8_APItest.php index e174719a..2d0ccf76 100644 --- a/wms/T8_APItest.php +++ b/wms/T8_APItest.php @@ -42,10 +42,10 @@ echo "ii"; "BillNo": "B23100061", "IncomeId": "A40003", "TaxId": "ST005", - "RowCode": 1, + "RowCode": 12, "ItemType": "1", "SPrice": 10000, - "SQuantity": 2, + "SQuantity": 1, "FromSourceTag": 0, "FromBillNo": "" }] diff --git a/wms/contract-repair/api/putContractData.php b/wms/contract-repair/api/putContractData.php index 70f080ab..1b960e02 100644 --- a/wms/contract-repair/api/putContractData.php +++ b/wms/contract-repair/api/putContractData.php @@ -67,7 +67,6 @@ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_PO } } - function t8Insert($data) { require_once('../../contract/connt8.php'); @@ -99,7 +98,18 @@ function t8Insert($data) $stmt->bindParam(':CreateTime', $create); $stmt->execute(); + $sql = "INSERT INTO comCustomer + (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime) + VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)"; + $stmt = $connT8->prepare($sql); + $stmt->bindParam(':BizPartnerId', $repair_no); + $stmt->bindParam(':PersonId', $salesman); + $stmt->bindParam(':CreatorId', $user_id); + $stmt->bindParam(':InvoiceAddress', $address); + $stmt->bindParam(':CreateTime', $create); + $stmt->execute(); + $sql = "INSERT INTO "; $connT8->commit(); } diff --git a/wms/contract/api/postContractData.php b/wms/contract/api/postContractData.php index 85b38f89..15443309 100644 --- a/wms/contract/api/postContractData.php +++ b/wms/contract/api/postContractData.php @@ -34,6 +34,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $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; // validate $fail_arr = []; if ($contractno === '') return $fail_arr[] = '合約號為必填'; @@ -56,6 +57,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填'; if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填'; if ($num == '') $fail_arr[] = '電梯數量為必填'; + if ($payType == '') $fail_arr[] = '付款方式為必填'; if (count($fail_arr) > 0) { header("HTTP/1.1 422 Unprocessable Entity"); echo json_encode($fail_arr); @@ -283,8 +285,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c } 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, customer_phone, customer_email, repairman, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by) - VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)"; + $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, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by) + VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(":contract_no", $contractno); $stmt->bindParam(":contract_type", $contract_type); @@ -310,6 +312,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $stmt->bindParam(":max_bonus", $max_bonus); $stmt->bindParam(":created_at", $created_at); $stmt->bindParam(":created_by", $user_id); + $stmt->bindParam(':payType', $payType); $stmt->execute(); @@ -324,7 +327,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c // $stmt->bindParam(':CreateTime', $createTime); // $stmt->execute(); - T8insert($_POST, $facilityno); + // T8insert($_POST, $facilityno); header('Content-Type: application/json'); $jsonData = json_encode($files); @@ -395,7 +398,8 @@ function T8insert($data, $facilityno) $stmt->execute(); - $sql = "INSERT INTO comCustomer(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime) + $sql = "INSERT INTO comCustomer + (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime) VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)"; $stmt = $connT8->prepare($sql); diff --git a/wms/contract/contract-input.php b/wms/contract/contract-input.php index 24840398..d3fdeacd 100644 --- a/wms/contract/contract-input.php +++ b/wms/contract/contract-input.php @@ -1,351 +1,374 @@ -prepare($sql_str); -$stmt->bindParam(':accounttype',$accounttype); -$stmt->execute(); -$workers = $stmt->fetchAll(PDO::FETCH_ASSOC); -$accounttype = "M"; -$sql_str = "SELECT id,accountid, name FROM account WHERE accounttype = :accounttype"; -$stmt = $conn->prepare($sql_str); -$stmt->bindParam(':accounttype',$accounttype); -$stmt->execute(); -$contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC); -?> - - - - - - -
-
- -
- - - - - - - - - -
-

合約入力(保養)

-
- - - - - -
-
- -
- - - - + + +
+
+ +
+ + + + + + + + + +
+

合約入力(保養)

+
+ + + + + +
+
+ +
+ + + + \ No newline at end of file diff --git a/wms/contract/js/alpine.js b/wms/contract/js/alpine.js index 5204d504..2f526c2f 100644 --- a/wms/contract/js/alpine.js +++ b/wms/contract/js/alpine.js @@ -964,6 +964,7 @@ const contractInput = () => { num: '', //電梯數量 disabled: false, //資料庫是否有電梯數量資料 elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期 + payType: '' }, customize: false, step: 1, @@ -1020,8 +1021,11 @@ const contractInput = () => { return } if (!this.customize) { - console.log(res.data); - this.data.total_price = res.data.sold_price + for (let i = 0; i < res.data.elevators.length; i++) { + this.data.total_price = Number(res.data.elevators[i].sold_price) + Number(this.data.total_price); + console.log(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.contract_begin_date = res.data.contract_begin_date this.data.contract_end_date = res.data.contract_end_date @@ -1035,7 +1039,7 @@ const contractInput = () => { let cityIndex = this.data.address.indexOf('市'); console.log(cityIndex); if (cityIndex == -1) { - cityIndex = this.data.address.indexOf('縣'); + // cityIndex = this.data.address.indexOf('縣'); } if (cityIndex > 1) { // 獲取''市''前面的兩個字 @@ -1111,13 +1115,14 @@ const contractInput = () => { form.append('num', this.data.num); form.append('elevators', JSON.stringify(this.data.elevators)); form.append('contracttype', 'b'); + form.append('payType', this.data.payType) // 如果有附件檔案,可以逐一加入 for (var i = 0; i < this.data.files.length; i++) { form.append('files[]', this.data.files[i]); } axios.post('./api/postContractData.php', form).then(res => { - console.log(res.status); + console.log(res); if (res.status === 200) { alert('儲存成功'); this.step = 1 @@ -1144,6 +1149,7 @@ const contractInput = () => { this.data.zip = '' this.data.partyAphone = '' this.data.partyAemail = '' + this.data.payType = '' } this.isLoading = false }).catch(error => { @@ -1217,7 +1223,7 @@ const contractNewApply = () => { originfiles: originfiles, description: description, }, - status:contractstatus, + status: contractstatus, progress: progress, pays: { 1: { @@ -1271,7 +1277,7 @@ const contractNewApply = () => { alert('試車時間不能低於10天') return; } - + this.isLoading = true const form = new FormData(); form.append('mid', this.data.mid); @@ -1332,10 +1338,10 @@ const contractNewApply = () => { return; } if (this.data.workdeadline_a < 30) { - while(this.data.workdeadline_note=='') { + while (this.data.workdeadline_note == '') { this.data.workdeadline_note = prompt('安裝時間需低於30天,請說明原因') - } - + } + } this.isLoading = true const form = new FormData(); @@ -1387,20 +1393,20 @@ const contractNewApply = () => { agree() { if (!confirm("確定同意嗎?")) return; this.isLoading = true - - let newprogress = 0; - let newstatus = 0; - - if(this.progress <= 1){ + + let newprogress = 0; + let newstatus = 0; + + if (this.progress <= 1) { newprogress = 2; - }else if(this.progress == 2){ + } else if (this.progress == 2) { newprogress = 3; } - if(this.status == 1 && this.progress == 2){ + if (this.status == 1 && this.progress == 2) { newstatus = 3 - }else{ + } else { newstatus = 1 } console.log(newstatus); From a67a20930f712d66510f0826190f47b1ba5ed3bb Mon Sep 17 00:00:00 2001 From: 10994015 Date: Thu, 4 Jan 2024 11:11:39 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=81=B8=E5=8F=96option=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=86=E9=A1=9E=E3=80=81=E6=90=9C=E5=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/mkt/assets/js/alpine.js | 59 ++++++++++++ wms/mkt/pricereview-create.php | 165 ++++++++++++++++++--------------- 2 files changed, 151 insertions(+), 73 deletions(-) diff --git a/wms/mkt/assets/js/alpine.js b/wms/mkt/assets/js/alpine.js index fec7d4de..cb4ea010 100644 --- a/wms/mkt/assets/js/alpine.js +++ b/wms/mkt/assets/js/alpine.js @@ -190,4 +190,63 @@ const priceOptionSelect = ()=>{ this.renderPagination() } } +} + +const pricereviewOptionSelect = ()=>{ + return { + init(){ + console.log(options); + this.optionCategory = 0 + this.initButtons(); + }, + options: options, + optionalArr: { + 1:'標配', + 2:'選配', + 3:'加價', + }, + kind:0, + subkind:0, + buttons:[], + initButtons(kind){ + if(kind == 'A'){ + this.buttons = [ + {name: '車廂意匠', type: 'A1'} + ] + }else if(kind == 'B'){ + this.buttons = [ + {name: '天井', type: 'B1'}, + {name: '地板', type: 'B2'}, + {name: '操縱盤', type: 'B3'}, + {name: '扶手', type: 'B4'}, + {name: '車廂門與層門(轎門/層門)', type: 'B5'}, + {name: '轎壁(車廂側板)', type: 'B6'}, + {name: '其他車廂內裝配件', type: 'B7'}, + ] + }else if(kind == 'C'){ + this.buttons = [ + {name: '框', type: 'C1'}, + {name: '乘場指示器', type: 'C2'}, + {name: '燈', type: 'C3'}, + {name: '方式與門', type: 'C4'}, + ] + }else if(kind == 'D'){ + this.buttons = [ + {name: '功能與配置', type: 'D1'}, + {name: 'OH與樓高', type: 'D2'}, + ] + }else if(kind == 'E'){ + this.buttons = [ + {name: '平台梯', type: 'E1'}, + ] + } + }, + kind:0, + optionSubCategory:1, + changeCategory(category){ + this.kind = category + this.initButtons(category) + }, + + } } \ No newline at end of file diff --git a/wms/mkt/pricereview-create.php b/wms/mkt/pricereview-create.php index 9523d306..f9d11c0a 100644 --- a/wms/mkt/pricereview-create.php +++ b/wms/mkt/pricereview-create.php @@ -1,6 +1,6 @@ '; +$option_str = ''; $option_str .= ' @@ -195,6 +195,8 @@ foreach ($opt_data_arr as $k => $v) { */ } $option_str .= "
名稱
"; + + ?> + +prepare($sql_str); +$stmt->execute(); +$options = $stmt->fetchAll(PDO::FETCH_ASSOC); + +?>
  • 「保存」:儲存價審單內容
  • @@ -1167,59 +1179,60 @@ $option_str .= "";
-prepare($sql_str); -$stmt->execute(); -$options = $stmt->fetchAll(PDO::FETCH_ASSOC); -?> -