10994015 1 year ago
parent
commit
5d4f43c27f
  1. 1
      wms/excel-upload.php
  2. 34
      wms/mkt/assets/js/alpine.js
  3. 6
      wms/mkt/price_normal-index.php
  4. 30
      wms/mkt/pricereview-create.php
  5. 1
      wms/mkt/pricereview_facility-api.php

1
wms/excel-upload.php

@ -3,6 +3,7 @@
include "header.php";
require_once 'PHPExcel/PHPExcel.php';
require_once 'PHPExcel/IOFactory.php';
$file_name = $_FILES["fileToUpload"]["name"];
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"];
$target_dir = "excel-uploads/";

34
wms/mkt/assets/js/alpine.js

@ -199,6 +199,7 @@ const pricereviewOptionSelect = () => {
init() {
this.optionCategory = 0
this.initButtons();
this.renderTbody();
console.log(this.options)
},
options: options,
@ -253,35 +254,40 @@ const pricereviewOptionSelect = () => {
},
optionSubCategory: 1,
changeCategory(category, subcategory = 0) {
console.log(this.$refs.selectModalBody);
this.initButtons(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.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();
return;
}
this.options = this.orioptions.filter(option => option.kind == this.kind && option.subkind == this.subkind)
this.renderTbody();
},
searchOptions(e) {
e = null;
this.reloadOptions();
let val = e.target.value.toLowerCase()
let val = (e== null) ? this.searchtext : e.target.value.toLowerCase()
this.options = (this.options).filter(option=>{
if(option.group_name == null) option.group_name = ''
if(option.spec == null) option.spec = ''
@ -290,6 +296,26 @@ const pricereviewOptionSelect = () => {
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)
})
},
renderTbody() {
return
console.log(this.options);
this.$refs.selectModalBody;
let html = "";
for (let i = 0; i < this.options.length; i++) {
html += "<tr style='cursor:pointer'>"
html += "<td>" + this.options[i].id + "</td>"
html += "<td>" + this.options[i].group_name + "</td>"
html += "<td>" + this.options[i].spec + "</td>"
html += "<td>" + this.options[i].memo + "</td>"
html += "<td>" + this.options[i].optional + "</td>"
html += "<td>" + this.options[i].unit + "</td>"
html += "<td>" + this.options[i].price + "</td>"
html += "</tr>";
}
this.$refs.selectModalBody.innerHTML = html;
}
}

6
wms/mkt/price_normal-index.php

@ -39,6 +39,7 @@ include "../header.php";
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="1a">
<a href="./files/MAE100小機房.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(小機房)</a>
<table border=0 cellpadding=0 cellspacing=0 width=1012 style='border-collapse:
collapse;table-layout:fixed;width:760pt'>
<col class=xl71 width=285 style='mso-width-source:userset;mso-width-alt:9130;
@ -215,6 +216,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="2a">
<a href="./files/MAM200.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(無機房)</a>
<table border=0 cellpadding=0 cellspacing=0 width=1021 style='border-collapse:
collapse;table-layout:fixed;width:767pt'>
<col width=285 style='mso-width-source:userset;mso-width-alt:9130;width:214pt'>
@ -369,6 +371,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="3a">
<a href="./files/MAH100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(小電梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=854 style='border-collapse:
collapse;table-layout:fixed;width:641pt'>
<col class=xl65 width=261 style='mso-width-source:userset;mso-width-alt:8362;
@ -433,6 +436,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="4a">
<a href="./files/MAE100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(高速梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=783 style='border-collapse:
collapse;table-layout:fixed;width:588pt'>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
@ -532,6 +536,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="5a">
<a href="./files/MAF100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(小機房貨梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=783 style='border-collapse:
collapse;table-layout:fixed;width:588pt'>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
@ -653,6 +658,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="6a">
<a href="./files/MAP100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(平台梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=1052>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl123 width=261 style='height:38.0pt;width:196pt'></td>

30
wms/mkt/pricereview-create.php

@ -753,17 +753,9 @@ $option_str .= "</tbody></table>";
$("#optionModal").modal('show');
var jobj = $(this); // 父視窗
$("#optionModal .modal-body td").unbind().click(function() {
$("#optionModal .modal-body td").off().click(function(){
var pobj = $(this).closest('td').parent();
// console.log(pobj.find('input[name=optionID]').val());
// console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()));
console.log(pobj.find('td').eq(0).html());
jobj.html(pobj.find('td').eq(1).html() + " " + pobj.find('td').eq(2).html() + '<br />(' + pobj.find('td').eq(3).html() + ')');
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(6).html());
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(6).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, "")));
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('td').eq(0).html());
$("#optionModal").modal('hide');
selectOptionFn(pobj, jobj)
});
});
$("#optionFaciModal").on("hidden.bs.modal", function() {
@ -1281,8 +1273,8 @@ $options = $stmt->fetchAll(PDO::FETCH_ASSOC);
<th scope="col" nowrap>定價</th>
</tr>
</thead>
<tbody>
<template x-for="option in options">
<tbody id="selectModalBody" x-ref="selectModalBody">
<template x-for="option in options" :key="option.id">
<tr style="cursor:pointer">
<td x-text='option.id' name="optionID"></td>
<td x-text="option.group_name"> </td>
@ -2534,4 +2526,18 @@ include "../footer.php";
<script>
const options = [...<?php echo json_encode($options); ?>];
function selectOptionFn(pobj, jobj){
// var pobj = $(this).closest('td').parent();
console.log(pobj);
// console.log(pobj.find('input[name=optionID]').val());
// console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()));
console.log(pobj.find('td').eq(0).html());
jobj.html(pobj.find('td').eq(1).html() + " " + pobj.find('td').eq(2).html() + '<br />(' + pobj.find('td').eq(3).html() + ')');
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(6).html());
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(6).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, "")));
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('td').eq(0).html());
$("#optionModal").modal('hide');
}
</script>

1
wms/mkt/pricereview_facility-api.php

@ -27,7 +27,6 @@ try {
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v)));
}
echo $fval;
list($source, $kind, $seat, $numberofstop, $speed, $op) = explode(",", $fval);
if (!$source || !$kind || !$seat) throw new \Exception("parameter empty[2]");

Loading…
Cancel
Save