From 13d66e606c1538e24f5284eb2b1650ff8e5297ac Mon Sep 17 00:00:00 2001 From: Cheng Date: Wed, 10 Jan 2024 09:53:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=8D=E5=A4=96=E9=A0=85=E7=9B=AE=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E9=9B=BB=E6=A2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/mkt/pricereview-check.php | 3 +++ wms/mkt/pricereview-create.php | 8 ++++---- wms/mkt/pricereview-record-submit.php | 20 ++++++++++++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/wms/mkt/pricereview-check.php b/wms/mkt/pricereview-check.php index 45080ac3..631cb3b8 100644 --- a/wms/mkt/pricereview-check.php +++ b/wms/mkt/pricereview-check.php @@ -224,6 +224,7 @@ foreach ($res as $data) { $ex_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $ex_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $ex_arr[$row['item_no']]['note'] = $row['note']; + $ex_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec']; } } mysqli_free_result($res_i); @@ -605,6 +606,7 @@ foreach ($res as $data) { 單價 數量 複價 + 所屬電梯項次 @@ -621,6 +623,7 @@ foreach ($res as $data) { "> "> "> + "; }); }); - $('button[name=submit],button[name=save').click(function() { + $('button[name=submit],button[name=save]').click(function() { var itemFpidArr = []; $("input[name='fp_id']").each(function() { if ($(this).val() != '') itemFpidArr.push($(this).val()); @@ -1124,12 +1124,12 @@ $option_str .= ""; exNoteArr.push($(this).val()); }) $('#except_note_all').val(exNoteArr); - var exSpecArr = []; + var exRelateFacilArr = []; $("td[name='Exclusions']").each(function() { - exNoteArr.push($(this).html()); + exRelateFacilArr.push($(this).html()); }) - $('#Exclusions_all').val(exNoteArr); + $('#Exclusions_all').val(exRelateFacilArr); var exSpecArr = []; diff --git a/wms/mkt/pricereview-record-submit.php b/wms/mkt/pricereview-record-submit.php index b23660b7..68623736 100644 --- a/wms/mkt/pricereview-record-submit.php +++ b/wms/mkt/pricereview-record-submit.php @@ -1,7 +1,7 @@ $v) { $$k = htmlspecialchars(stripslashes(trim($v))); } @@ -188,6 +188,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $option_price_bp_arr = explode(",", $option_price_bp_all); $option_memo_arr = explode("@@,", rtrim($option_memo_all, "@@")); $option_relate_facil_arr = explode(",", htmlspecialchars_decode($option_relate_facil_all)); + echo '
';
+        print_r($option_relate_facil_arr);
+        echo '
'; + // exit; $item_no = 1; for ($i = 0; $i < count($option_seat_arr); $i++) { $spec = trim($option_seat_arr[$i]); @@ -239,6 +243,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $option_relate_spec .= substr($val, 0, strpos($val, ".")) . ","; } $option_relate_spec = rtrim($option_relate_spec, ","); + $db_query = "insert into pricereview_item (mid, price_id, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp, note, memo) values ("; $db_query .= "'$mid', '$mn_id_arr[$i]', '$item_no', 'D', '$mn_kind_arr[$i]', '$option_relate_spec', '$mn_unit_price_arr[$i]', '$mn_qty_arr[$i]', '$mn_price_bp_arr[$i]', '$note', '$mn_memo_arr[$i]')"; $result = mysqli_query($link, $db_query); @@ -255,6 +260,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $except_price_bp_arr = explode(",", $except_price_bp_all); // 除外費用對應電梯 $except_relate_facil_arr = explode(",", htmlspecialchars_decode($Exclusions_all)); + $item_no = 1; for ($i = 0; $i < count($except_spec_arr); $i++) { $spec = trim($except_spec_arr[$i]); @@ -262,9 +268,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $except_unit_price_arr[$i] = str_replace(",", "", $except_unit_price_arr[$i]); $except_qty_arr[$i] = str_replace(",", "", $except_qty_arr[$i]); $except_price_bp_arr[$i] = str_replace(",", "", $except_price_bp_arr[$i]); - $tmp_arr = explode("
", $except_price_bp_arr[$i]); + $option_relate_spec = ""; + $tmp_arr = explode("
", $except_relate_facil_arr[$i]); + foreach ($tmp_arr as $val) { + $option_relate_spec .= substr($val, 0, strpos($val, ".")) . ","; + } + $option_relate_spec = rtrim($option_relate_spec, ","); + $db_query = "insert into pricereview_item (mid, item_no, item_group, option_relate_spec,item_spec, item_unit_price, item_qty, item_price_bp, note) values ("; - $db_query .= "'$mid', '$item_no', 'E','$tmp_arr' , '$spec', '$except_unit_price_arr[$i]', '$except_qty_arr[$i]', '$except_price_bp_arr[$i]', '$except_note_arr[$i]')"; + $db_query .= "'$mid', '$item_no', 'E','$option_relate_spec' , '$spec', '$except_unit_price_arr[$i]', '$except_qty_arr[$i]', '$except_price_bp_arr[$i]', '$except_note_arr[$i]')"; $result = mysqli_query($link, $db_query); $item_no++; }