-
+ })
+}
+
-
\ No newline at end of file
diff --git a/wms/mkt/assets/js/alpine.js b/wms/mkt/assets/js/alpine.js
index 1f8a2f52..d28a3f3f 100644
--- a/wms/mkt/assets/js/alpine.js
+++ b/wms/mkt/assets/js/alpine.js
@@ -199,8 +199,6 @@ const pricereviewOptionSelect = () => {
init() {
this.optionCategory = 0
this.initButtons();
- this.renderTbody();
- console.log(this.options)
},
options: options,
orioptions: options,
@@ -254,7 +252,7 @@ const pricereviewOptionSelect = () => {
},
optionSubCategory: 1,
changeCategory(category, subcategory = 0) {
- console.log(this.$refs.selectModalBody);
+ // console.log(this.$refs.selectModalBody);
this.initButtons(category)
this.kind = (category == 'sub') ? this.kind : category;
if (subcategory != 0) {
@@ -269,54 +267,48 @@ const pricereviewOptionSelect = () => {
this.searchtext = ""
this.reloadOptions();
+
},
reloadOptions() {
if (this.kind == 0) {
this.options = this.orioptions
- this.renderTbody();
return;
}
if (this.subkind == 0) {
- this.options = this.orioptions.filter(option => option.kind == this.kind)
- this.renderTbody();
+ this.options.forEach(option =>{
+ if (option.kind == this.kind) {
+ option.status = "Y"
+ }else{
+ option.status = "H"
+ }
+ })
return;
}
- this.options = this.orioptions.filter(option => option.kind == this.kind && option.subkind == this.subkind)
- this.renderTbody();
+ this.options.forEach(option => {
+ if(option.kind == this.kind && option.subkind == this.subkind){
+ option.status = "Y"
+ }else{
+ option.status = "H"
+ }
+ })
},
searchOptions(e) {
e = null;
+ this.options = this.orioptions
this.reloadOptions();
- let val = (e== null) ? this.searchtext : e.target.value.toLowerCase()
- this.options = (this.options).filter(option=>{
+ let val = (e== null) ? this.searchtext.toLowerCase() : e.target.value.toLowerCase()
+ this.options.forEach(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)
+ if(option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val)){
+ option.status = "Y"
+ }else{
+ option.status = "N"
+ }
})
},
- renderTbody() {
- return
- console.log(this.options);
- this.$refs.selectModalBody;
- let html = "";
- for (let i = 0; i < this.options.length; i++) {
- html += "
"
- html += "" + this.options[i].id + " | "
- html += "" + this.options[i].group_name + " | "
- html += "" + this.options[i].spec + " | "
- html += "" + this.options[i].memo + " | "
- html += "" + this.options[i].optional + " | "
- html += "" + this.options[i].unit + " | "
- html += "" + this.options[i].price + " | "
- html += "
";
- }
-
- this.$refs.selectModalBody.innerHTML = html;
-
- }
-
}
}
\ No newline at end of file
diff --git a/wms/mkt/pricereview-check.php b/wms/mkt/pricereview-check.php
index f5667028..e7f745e4 100644
--- a/wms/mkt/pricereview-check.php
+++ b/wms/mkt/pricereview-check.php
@@ -325,12 +325,9 @@ foreach ($res as $data) {
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
data = JSON.parse(this.responseText);
- console.log('123');
-
+ console.log(data);
//console.log(data);return false;
if (data.st == 'err') {
- console.log('123');
-
//alert(data.err);
return false;
}
@@ -346,8 +343,6 @@ foreach ($res as $data) {
let a = data.content[k][0] + data.content[k][19][1];
$("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(a));
}
- console.log('123');
-
let a = data.content[k][0] + data.content[k][19][1];
$("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(a));
var mihtml = "";
@@ -368,7 +363,7 @@ foreach ($res as $data) {
console.log(data.content[k][12]);
Object.keys(data.content[k][14]).forEach(function(m) {
if (data.content[k][14][m][0] != '') {
- mihtml += "
" + data.content[k][14][m][0] + ":" + commafy(data.content[k][14][m][1]) + "";
+ mihtml += "
" + data.content[k][14][m][0].replace("<br>", "").replace("&", "").replace("amp;", "").replace("()", "").replace(/\s+/g, '') + ":" + commafy(data.content[k][14][m][1]) + "";
}
});
Object.keys(data.content[k][16]).forEach(function(m) {
@@ -382,9 +377,16 @@ foreach ($res as $data) {
mihtml += "
" + data.content[k][19][0] + ":" + commafy(data.content[k][19][1]) + "";
mihtml += "以上合計:" + commafy(data.content[k][13]) +
"
";
+ total_mi += data.content[k][13];
+
+
+ if(total_mi == ""){
+ console.log("undefided!!!");
+ }
$("#tb1").find("tr[name=facil_templ2]").eq(k).find('td').eq(1).html(mihtml);
//$("#tb1").find("input[name=mi_fix]").eq(k).closest('td').append(mihtml);
document.getElementsByClassName('total_mi_fix')[k].value = commafy(total_mi)
+
// document.getElementsByClassName('item_price_ct')[k].value =commafy(total_mi)
document.getElementsByClassName('gross_profit')[k].value = commafy(Number(document.getElementsByClassName('item_price_ct')[k].value.replace(/[,]+/g, "")) - total_mi)
document.getElementsByClassName('gross_profit_rate')[k].value = Math.round((Number(document.getElementsByClassName('gross_profit')[k].value.replace(/[,]+/g, "")) / Number(document.getElementsByClassName('item_price_ct')[k].value.replace(/[,]+/g, "")) * 100) * 10) / 10
@@ -587,8 +589,8 @@ foreach ($res as $data) {
"> |
|
"> |
-
" disabled> |
-
"> |
+
" disabled> |
+
"> |
diff --git a/wms/mkt/pricereview-create.php b/wms/mkt/pricereview-create.php
index 8853257f..44711793 100644
--- a/wms/mkt/pricereview-create.php
+++ b/wms/mkt/pricereview-create.php
@@ -146,7 +146,7 @@ if ($last_pr_arr) {
// Option Data
$opt_data_arr = [];
$opt_kind_arr = ["A" => "小電梯型錄選配加價報價", "B" => "客梯型錄選配加價報價", "C" => "550-1600kg選配業務報價", "D" => "其它"];
-$sql = "select * from option_price where status = 'Y' order by kind, id";
+$sql = "select * from option_price where status = 'Y' order by id";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"];
@@ -753,10 +753,12 @@ $option_str .= "";
$("#optionModal").modal('show');
var jobj = $(this); // 父視窗
- $("#optionModal .modal-body td").off().click(function(){
+ $("#optionModal .modal-body td").unbind().click(function(){
var pobj = $(this).closest('td').parent();
selectOptionFn(pobj, jobj)
});
+
+ $('#tb2').unbind('focus', 'tr[name=option_templ] a[name=option_href]');
});
$("#optionFaciModal").on("hidden.bs.modal", function() {
$("#optionFaciModal .modal-body").html('');
@@ -868,7 +870,7 @@ $option_str .= "";
});
$("input[name=pay_scale]").keyup(function() {
- $(this).closest('td').next('td').find('input[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
+ $(this).closest('td').next('td').find('input[nam e=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
var payAllScale = 0;
var payAllAmt = 0;
$("input[name=pay_scale]").each(function() {
@@ -1275,7 +1277,7 @@ $options = $stmt->fetchAll(PDO::FETCH_ASSOC);
-
+
|
|
|
diff --git a/wms/mkt/pricereview_mi-api.php b/wms/mkt/pricereview_mi-api.php
index 3aeb95c3..00dd5edb 100644
--- a/wms/mkt/pricereview_mi-api.php
+++ b/wms/mkt/pricereview_mi-api.php
@@ -229,6 +229,7 @@ try {
$stmt->bindParam(':quotation_no', $quotation_no);
$stmt->execute();
$row_e = $stmt->fetch(PDO::FETCH_ASSOC);
+
// $sql2 = "select o.*, r.* from elevator_mi_option o, elevator_quotation_rule r ";
// $sql2 .= "where o.quotation_no = r.quotation_no and o.elevator_type = '" . $v['etype'] . "' ";
// $sql2 .= "and ($v[item_weight] between o.min_weight and o.max_weight) ";
@@ -240,9 +241,12 @@ try {
// // echo $sql2;
// $res_e = mysqli_query($link, $sql2);
//$row_e = mysqli_fetch_assoc($res_e)
- if ($row_e || true) {
+ if ($row_e) {
// 加價:先不納入
$row_e["option_price"] = 0;
+ if(!isset($row_e["purchase_cost"])){
+
+ }
// 基准采购成本+±1停材料费+设计费+出口费用
$part1 = $row_e["purchase_cost"] + ($v["floors"] - $row_e["base_floor"]) * $row_e["material_plus"] + $row_e["design"] * $row_e["design_hour"] + $row_e["export_fee"];
// 利潤
@@ -424,6 +428,8 @@ try {
$mi_arr[$i][19] = $specarr;
$i++;
}
+ }else{
+ $rarr['err'] = "notfoundmi";
}
// mysqli_free_result($res_e);
}