Browse Source

價審option 新增分類、搜尋

main
10994015 1 year ago
committed by Cheng
parent
commit
3d2a4b590c
  1. 4
      wms/fun_global.php
  2. 48
      wms/mkt/assets/js/alpine.js
  3. 56
      wms/mkt/pricereview-create.php
  4. 2
      wms/mkt/pricereview-record-submit.php
  5. 2
      wms/mkt/pricereview-record-update.php
  6. 4
      wms/schedule-index.php

4
wms/fun_global.php

@ -148,11 +148,11 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
$ret[2] = 'M0012'; $ret[2] = 'M0012';
if ($renovate_flag == "REN") { if ($renovate_flag == "REN") {
// $ret[2] = 'M0012'; // $ret[2] = 'M0012';
if ($rate < 1000) $ret[3] = "M0008"; // 詹總 if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理 if ($rate < 75) $ret[4] = "M0006"; // 總經理
} else { } else {
// 全汰改 // 全汰改
if ($rate < 1000) $ret[3] = "M0008"; // 詹總 if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理 if ($rate < 75) $ret[4] = "M0006"; // 總經理
} }

48
wms/mkt/assets/js/alpine.js

@ -200,11 +200,13 @@ const pricereviewOptionSelect = ()=>{
this.initButtons(); this.initButtons();
}, },
options: options, options: options,
orioptions: options,
optionalArr: { optionalArr: {
1:'標配', 1:'標配',
2:'選配', 2:'選配',
3:'加價', 3:'加價',
}, },
searchtext:'',
kind:0, kind:0,
subkind:0, subkind:0,
buttons:[], buttons:[],
@ -239,14 +241,54 @@ const pricereviewOptionSelect = ()=>{
this.buttons = [ this.buttons = [
{name: '平台梯', type: 'E1'}, {name: '平台梯', type: 'E1'},
] ]
}else if(kind == 'F'){
this.buttons = [
{name: '汰改', type: 'F1'},
]
}else if(kind == 0){
this.buttons = []
} }
}, },
kind:0,
optionSubCategory:1, optionSubCategory:1,
changeCategory(category){ changeCategory(category, subcategory=0){
this.kind = category 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.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)
})
}
} }
} }

56
wms/mkt/pricereview-create.php

@ -244,7 +244,7 @@ $option_str .= "</tbody></table>";
} }
.modal-content { .modal-content {
height: 710px; height: 760px;
} }
#optionModal .modal-body { #optionModal .modal-body {
@ -796,6 +796,37 @@ $option_str .= "</tbody></table>";
return false; return false;
} }
}); });
$('#tb3').on('click', 'a[name=btnfaci]', function() {
var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') {
var k = 1;
$("input[name=item_spec]").each(function() {
if ($(this).val() == '') return;
var objInput = document.createElement("input");
objInput.setAttribute("type", "checkbox");
objInput.setAttribute("name", "sub_faci");
objInput.setAttribute("value", k + '.' + $(this).val());
$("#optionFaciModal .modal-body").append(objInput);
$("#optionFaciModal .modal-body").append(k + '.' + $(this).val());
$("#optionFaciModal .modal-body").append("<br>");
k++;
});
$("#optionFaciModal .modal-body").append("<p><button type='button' name='btnpost' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>確定</span></button></p>");
$("#optionFaciModal").modal('show');
var str = "";
$("button[name=btnpost]").click(function() {
$('input[name=sub_faci]').each(function() {
if ($(this).prop('checked')) {
str += $(this).val() + "<br>";
}
});
jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str);
});
} else {
alert("請先新增OPTION");
return false;
}
});
$('#tb4').on('click', 'a[name=btnfaci]', function() { $('#tb4').on('click', 'a[name=btnfaci]', function() {
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') { if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') {
@ -1188,19 +1219,19 @@ $options = $stmt->fetchAll(PDO::FETCH_ASSOC);
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<label for="" > <label for="" >
<input type="text" class="form-control" style="float:left" placeholder="搜尋..." /> <input type="text" class="form-control" style="float:left" placeholder="搜尋..." x-model="searchtext" @keyup="searchOptions($event)" />
</label> </label>
<div class="categories"> <div class="categories">
<button :class="['btn', (kind==0) ? 'btn-primary' : 'btn-secondary text-light']" @click="">顯示全部</button> <button :class="['btn', (kind==0) ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory(0)">顯示全部</button>
<button :class="['btn', (kind=='A') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('A')">A-1 車廂意匠</button> <button :class="['btn', (kind=='A') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('A')">A-1 車廂意匠</button>
<button :class="['btn', (kind=='B') ? 'btn-primary' : 'btn-secondary text-light']">A-2 車廂內裝</button> <button :class="['btn', (kind=='B') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('B')">A-2 車廂內裝</button>
<button :class="['btn', (kind=='C') ? 'btn-primary' : 'btn-secondary text-light']">A-3 車廂外部</button> <button :class="['btn', (kind=='C') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('C')">A-3 車廂外部</button>
<button :class="['btn', (kind=='D') ? 'btn-primary' : 'btn-secondary text-light']">A-4 控制與其他</button> <button :class="['btn', (kind=='D') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('D')">A-4 控制與其他</button>
<button :class="['btn', (kind=='E') ? 'btn-primary' : 'btn-secondary text-light']">B-1 平台梯</button> <button :class="['btn', (kind=='E') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('E')">B-1 平台梯</button>
<button :class="['btn', (kind=='F') ? 'btn-primary' : 'btn-secondary text-light']">C-1 汰改</button> <button :class="['btn', (kind=='F') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('F')">C-1 汰改</button>
<br /><br /> <br /><br />
<template x-for="button in buttons" > <template x-for="button in buttons" >
<button :class="['btn', (kind==button) ? 'btn-primary' : 'btn-secondary text-light']" @click="kind=button"> <button style="margin-right:3px" :class="['btn', (button.type == subkind) ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('sub', button.type)" x-text="button.name"></button>
</template> </template>
</div> </div>
@ -1870,7 +1901,6 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<?php <?php
if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) { if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
foreach ($last_pritem_arr["B"] as $k => $v) { foreach ($last_pritem_arr["B"] as $k => $v) {
print_r($last_pritem_arr);
?> ?>
<tr name="option_templ"> <tr name="option_templ">
<td name="option_seat"> <td name="option_seat">
@ -1914,7 +1944,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?> ?>
<tr name="option_templ"> <tr name="option_templ">
<td name="option_seat"> <td name="option_seat">
<a href="" name="option_href" data-toggle="modal">點選</a> <a href="" name="option_href" data-toggle="modal" @click="searchtext = ''">點選</a>
</td> </td>
<td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo (isset($v["option_price"])) ? number_format($v["option_price"]) : 0; ?>" readonly></td> <td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo (isset($v["option_price"])) ? number_format($v["option_price"]) : 0; ?>" readonly></td>
<td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo (isset($v["option_num"])) ? $v["option_num"] : 0; ?>"></td> <td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo (isset($v["option_num"])) ? $v["option_num"] : 0; ?>"></td>
@ -1962,8 +1992,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="except_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td> <td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="except_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td>
<td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly> <td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly>
<input type="hidden" name="item_group" value="E"> <input type="hidden" name="item_group" value="E">
<a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a>
</td> </td>
<td name="mn_relate_facil" nowrap></td>
</tr> </tr>
<?php <?php
} }
@ -1975,8 +2007,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8"></td> <td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8"></td>
<td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4"></td> <td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4"></td>
<td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" readonly> <td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" readonly>
<a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a>
</td> </td>
<td name="mn_relate_facil" nowrap></td>
</tr> </tr>
<?php <?php
} }

2
wms/mkt/pricereview-record-submit.php

@ -280,7 +280,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
// 價審簽核流程 // 價審簽核流程
// <75%以下呈至總經理審核. ($price_rate) // 小於80%呈至總經理審核. ($price_rate)
// 上級主管 > 伃廷 > MAX > 總經理 // 上級主管 > 伃廷 > MAX > 總經理
if ($status == "YS") { if ($status == "YS") {
$ret = []; $ret = [];

2
wms/mkt/pricereview-record-update.php

@ -384,7 +384,7 @@ if(isset($_POST['pmstatus'])) {
} }
// 價審簽核流程 // 價審簽核流程
// <75%以下呈至總經理審核. ($price_rate) // 小於80%呈至總經理審核. ($price_rate)
// 上級主管 > 伃廷 > MAX > 總經理 // 上級主管 > 伃廷 > MAX > 總經理
if ($status == "YS") { if ($status == "YS") {
$manager_arr = pricereview_class($price_rate, $user_id); $manager_arr = pricereview_class($price_rate, $user_id);

4
wms/schedule-index.php

@ -24,7 +24,7 @@ $data = array();
// sql語法存在變數中 // sql語法存在變數中
$page_close = 0; $page_close = 0;
$sql_cmd2 = ""; $sql_cmd2 = "";
$sql_cmd = sql_myself($user_id); $sql_cmd = sql_myself($user_id, "repairerid");
if ($user_department_id == "501" || $user_department_id == "322" || $user_id == "M0012" || $user_id == "M0105") $sql_cmd = ""; if ($user_department_id == "501" || $user_department_id == "322" || $user_id == "M0012" || $user_id == "M0105") $sql_cmd = "";
if (in_array($user_department_id.$user_role_id, $dr_arr)) $sql_cmd = ""; if (in_array($user_department_id.$user_role_id, $dr_arr)) $sql_cmd = "";
//if (empty($sql_cmd)) $sql_cmd = "where "; //if (empty($sql_cmd)) $sql_cmd = "where ";
@ -38,7 +38,7 @@ if (!empty($sql_cmd2)) {
} }
//$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id"; //$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id";
$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id asc"; $sql = "SELECT * FROM schedule $sql_cmd ORDER BY id desc";
if (!$page_close) $sql .= " limit $page_from, $page_each"; if (!$page_close) $sql .= " limit $page_from, $page_each";
//echo $sql; //echo $sql;

Loading…
Cancel
Save