diff --git a/wms/T8_APItest.php b/wms/T8_APItest.php index e174719a..a6febca7 100644 --- a/wms/T8_APItest.php +++ b/wms/T8_APItest.php @@ -40,12 +40,12 @@ echo "ii"; "name": "salIncomeApplyDetail", "rows": [{ "BillNo": "B23100061", - "IncomeId": "A40003", + "IncomeId": "A40004", "TaxId": "ST005", "RowCode": 1, "ItemType": "1", "SPrice": 10000, - "SQuantity": 2, + "SQuantity": 0, "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); diff --git a/wms/fun_global.php b/wms/fun_global.php index c57b3a3d..f1ec14de 100644 --- a/wms/fun_global.php +++ b/wms/fun_global.php @@ -132,11 +132,11 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag) $ret[2] = 'M0012'; if ($renovate_flag == "REN") { // $ret[2] = 'M0012'; - if ($rate < 1000) $ret[3] = "M0008"; // 詹總 + if ($rate <= 100) $ret[3] = "M0008"; // 詹總 if ($rate < 75) $ret[4] = "M0006"; // 總經理 } else { // 全汰改 - if ($rate < 1000) $ret[3] = "M0008"; // 詹總 + if ($rate <= 100) $ret[3] = "M0008"; // 詹總 if ($rate < 75) $ret[4] = "M0006"; // 總經理 } diff --git a/wms/mkt/assets/js/alpine.js b/wms/mkt/assets/js/alpine.js index fec7d4de..26da6b25 100644 --- a/wms/mkt/assets/js/alpine.js +++ b/wms/mkt/assets/js/alpine.js @@ -190,4 +190,105 @@ const priceOptionSelect = ()=>{ this.renderPagination() } } +} + +const pricereviewOptionSelect = ()=>{ + return { + init(){ + console.log(options); + this.optionCategory = 0 + this.initButtons(); + }, + options: options, + orioptions: options, + optionalArr: { + 1:'標配', + 2:'選配', + 3:'加價', + }, + searchtext:'', + 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'}, + ] + }else if(kind == 'F'){ + this.buttons = [ + {name: '汰改', type: 'F1'}, + ] + }else if(kind == 0){ + this.buttons = [] + } + }, + optionSubCategory:1, + changeCategory(category, subcategory=0){ + this.kind = (category=='sub') ? this.kind : category; + + if(subcategory != 0) { + this.subkind = subcategory + }else{ + this.subkind = 0 + } + + if(category == 0){ + this.kind = 0; + this.subkind = 0; + } + this.initButtons(category) + this.reloadOptions(); + }, + reloadOptions(){ + if(this.kind == 0){ + this.options = this.orioptions + return; + } + if(this.subkind == 0){ + this.options = this.orioptions.filter(option=> option.kind == this.kind) + return; + } + this.options = this.orioptions.filter(option=> option.kind == this.kind && option.subkind == this.subkind) + }, + searchOptions(e){ + this.reloadOptions(); + let val = e.target.value.toLowerCase() + this.options = (this.options).filter(option=>{ + if(option.group_name == null) option.group_name = '' + if(option.spec == null) option.spec = '' + if(option.memo == null) option.memo = '' + if(option.price == null) option.price = 0 + if(option.unit == null) option.unit = '' + return option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val) + }) + } + + } } \ No newline at end of file diff --git a/wms/mkt/pricereview-create.php b/wms/mkt/pricereview-create.php index 8fd63f2e..a1d86d4f 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); + +?>
-prepare($sql_str); -$stmt->execute(); -$options = $stmt->fetchAll(PDO::FETCH_ASSOC); -?> -