Browse Source

電梯拆台計算MI:修改價審及規調功能

gary
jrbin 1 year ago
parent
commit
05218e934f
  1. 2
      wms/mkt/mkt/pricereview_renovate-check.php
  2. 48
      wms/mkt/pricereview-check.php
  3. 124
      wms/mkt/pricereview-create.php
  4. 131
      wms/mkt/pricereview-edit.php
  5. 28
      wms/mkt/pricereview-record-submit.php
  6. 44
      wms/mkt/pricereview-record-update.php
  7. 221
      wms/mkt/pricereview_mi-api.php
  8. 52
      wms/mkt/pricereview_renovate-check.php
  9. 117
      wms/mkt/pricereview_renovate-create.php
  10. 130
      wms/mkt/pricereview_renovate-edit.php
  11. 22
      wms/mkt/pricereview_renovate-record-submit.php
  12. 46
      wms/mkt/pricereview_renovate-record-update.php
  13. 67
      wms/mkt/specsurvey-create.php
  14. 32
      wms/mkt/specsurvey-edit.php
  15. 21
      wms/mkt/specsurvey-record-submit.php
  16. 72
      wms/mkt/specsurvey-view.php
  17. 67
      wms/mkt/specsurvey_renovate-create.php
  18. 32
      wms/mkt/specsurvey_renovate-edit.php
  19. 21
      wms/mkt/specsurvey_renovate-record-submit.php
  20. 4
      wms/mkt/specsurvey_renovate-view.php
  21. 6
      wms/mkt/specsurvey_version-api.php

2
wms/mkt/mkt/pricereview_renovate-check.php

@ -303,7 +303,7 @@ $(function () {
var pa = ''; var pa = '';
pa = '<?php echo $id; ?>'+','; pa = '<?php echo $id; ?>'+',';
pa += $(this).closest('td').prev().find('input[name=item_no]').val(); pa += $(this).closest('td').prev().find('input[name=item_no]').val();
var plink = '<iframe src="specsurvey-view.php?pa='+pa+'&noheader=1&<?php echo $token_link;?>" width="100%" height="500" frameborder="0" title=""></iframe>'; var plink = '<iframe src="specsurvey_renovate-view.php?pa='+pa+'&noheader=1&<?php echo $token_link;?>" width="100%" height="500" frameborder="0" title=""></iframe>';
$('.modal-footer').find('button').prop('disabled',false); $('.modal-footer').find('button').prop('disabled',false);
//$('.navbar').hide(); //$('.navbar').hide();
$("#specModal .modal-body").html(plink); $("#specModal .modal-body").html(plink);

48
wms/mkt/pricereview-check.php

@ -206,6 +206,7 @@ foreach ($res as $data) {
$mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp'];
$mn_arr[$row['item_no']]['note'] = $row['note']; $mn_arr[$row['item_no']]['note'] = $row['note'];
$mn_arr[$row['item_no']]['memo'] = $row['memo']; $mn_arr[$row['item_no']]['memo'] = $row['memo'];
$mn_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec'];
} elseif ($row['item_group'] == "E") { } elseif ($row['item_group'] == "E") {
$ex_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $ex_arr[$row['item_no']]['item_spec'] = $row['item_spec'];
$ex_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $ex_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price'];
@ -284,6 +285,12 @@ function getMI(id) {
Object.keys(data.content[k][14]).forEach(function(m){ Object.keys(data.content[k][14]).forEach(function(m){
mihtml += "<li>"+data.content[k][14][m][0]+":"+commafy(data.content[k][14][m][1])+"</li>"; mihtml += "<li>"+data.content[k][14][m][0]+":"+commafy(data.content[k][14][m][1])+"</li>";
}); });
Object.keys(data.content[k][16]).forEach(function(m){
mihtml += "<li>"+data.content[k][16][m][0]+":"+commafy(data.content[k][16][m][1])+"</li>";
});
Object.keys(data.content[k][18]).forEach(function(m){
mihtml += "<li>"+data.content[k][18][m][0]+":"+commafy(data.content[k][18][m][1])+"</li>";
});
mihtml += "以上合計:"+commafy(data.content[k][13])+"<br>"; mihtml += "以上合計:"+commafy(data.content[k][13])+"<br>";
$("#tb1").find("tr[name=facil_templ2]").eq(k).find('td').eq(1).html(mihtml); $("#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); //$("#tb1").find("input[name=mi_fix]").eq(k).closest('td').append(mihtml);
@ -295,7 +302,9 @@ function getMI(id) {
} }
$(function () { $(function () {
<?php if ($viewmi) { ?>
getMI('<?php echo $id; ?>'); getMI('<?php echo $id; ?>');
<?php } ?>
$(":input").prop("disabled", true); $(":input").prop("disabled", true);
$("#checker").prop("disabled", false); $("#checker").prop("disabled", false);
$("#status_n").prop("disabled", false); $("#status_n").prop("disabled", false);
@ -444,31 +453,41 @@ hr {
$idx = 1; $idx = 1;
foreach ($item_arr as $item_no => $val) { foreach ($item_arr as $item_no => $val) {
$item_amt_A_all += $val["item_price_bp"]; $item_amt_A_all += $val["item_price_bp"];
?> if ($viewmi) {
for ($i=0; $i<$val["item_qty"]; $i++) {
?>
<tr name="facil_templ"> <tr name="facil_templ">
<td><?php echo $idx; ?><input type="hidden" name="item_no" value="<?php echo $item_no; ?>"></td> <td><?php echo $idx; ?><input type="hidden" name="item_no" value="<?php echo $item_no; ?>"></td>
<td nowrap><a href="" data-toggle="modal"><?=$val["item_spec"];?> [規調]</a></td> <td nowrap><a href="" data-toggle="modal"><?=$val["item_spec"];?> [規調]</a></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td>
<td><input type="text" name="item_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" value="1"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_bp"]);?>"></td> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?=number_format($val["item_unit_price"]);?>"></td>
<?php if ($viewmi) { ?>
<td><input type="text" name="mi_fix" class="form-control dollar-right" size="9" value="<?php echo ($val["mi_fix"]) ? number_format($val["mi_fix"]) : ""; ?>"></td> <td><input type="text" name="mi_fix" class="form-control dollar-right" size="9" value="<?php echo ($val["mi_fix"]) ? number_format($val["mi_fix"]) : ""; ?>"></td>
<td><input type="text" name="item_price_ct" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_ct"]);?>"></td> <td><input type="text" name="item_price_ct" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_ct"]/$val["item_qty"]);?>"></td>
<!--<td><input type="text" name="item_price" class="form-control dollar-right" size="8" value="<?php echo ($val["item_price"]) ? number_format($val["item_price"]) : ""; ?>"></td> <!--<td><input type="text" name="item_price" class="form-control dollar-right" size="8" value="<?php echo ($val["item_price"]) ? number_format($val["item_price"]) : ""; ?>"></td>
<td><input type="text" name="pv_rate" class="form-control" size="1" value="<?=$val["pv_rate"];?>"></td> <td><input type="text" name="pv_rate" class="form-control" size="1" value="<?=$val["pv_rate"];?>"></td>
<td><input type="text" name="allocate" class="form-control" size="6" value="<?=$val["allocate"];?>"></td>--> <td><input type="text" name="allocate" class="form-control" size="6" value="<?=$val["allocate"];?>"></td>-->
<td><input type="text" name="gross_profit" class="form-control dollar-right" size="9" value="<?=number_format($val["gross_profit"]);?>"></td> <td><input type="text" name="gross_profit" class="form-control dollar-right" size="9" value="<?=number_format($val["gross_profit"]);?>"></td>
<td><input type="text" name="gross_profit_rate" class="form-control" size="6" value="<?=number_format($val["gross_profit_rate"], 1);?>"></td> <td><input type="text" name="gross_profit_rate" class="form-control" size="6" value="<?=number_format($val["gross_profit_rate"], 1);?>"></td>
<!--<td><input type="text" name="note" class="form-control" size="17" value="<?=$val["note"];?>"></td>--> <!--<td><input type="text" name="note" class="form-control" size="17" value="<?=$val["note"];?>"></td>-->
<?php } ?>
</tr> </tr>
<?php if ($viewmi) { ?>
<tr name="facil_templ2"> <tr name="facil_templ2">
<td colspan="5"></td> <td colspan="5"></td>
<td colspan="4"></td> <td colspan="4"></td>
</tr> </tr>
<?php } ?>
<?php <?php
} #item_qty end.
} else {
?>
<tr name="facil_templ">
<td><?php echo $idx; ?><input type="hidden" name="item_no" value="<?php echo $item_no; ?>"></td>
<td nowrap><a href="" data-toggle="modal"><?=$val["item_spec"];?> [規調]</a></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td>
<td><input type="text" name="item_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_bp"]);?>"></td>
</tr>
<?php
}
$idx++; $idx++;
} }
?> ?>
@ -495,7 +514,7 @@ hr {
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th>所屬電梯</th> <th>所屬電梯項次</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -512,7 +531,7 @@ hr {
<td><input type="text" name="option_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td> <td><input type="text" name="option_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td>
<td><input type="text" name="option_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td> <td><input type="text" name="option_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td>
<td><input type="text" name="option_memo" class="form-control" size="20" value="<?=$val["memo"];?>"></td> <td><input type="text" name="option_memo" class="form-control" size="20" value="<?=$val["memo"];?>"></td>
<td><?php echo str_replace(",", "<br>", $val["option_relate_spec"]); ?></td> <td><?php echo $val["option_relate_spec"]; ?></td>
</tr> </tr>
<?php <?php
$idx++; $idx++;
@ -576,7 +595,7 @@ hr {
<table id="tb3" class="table table-bordered"> <table id="tb3" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9">保固延長</th> <th colspan="10">保固延長</th>
</tr> </tr>
<tr> <tr>
<th nowrap>項次</th> <th nowrap>項次</th>
@ -588,6 +607,7 @@ hr {
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th>所屬電梯項次</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -608,7 +628,8 @@ hr {
<td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td> <td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td>
<td><input type="text" name="mn_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td> <td><input type="text" name="mn_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td>
<td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td> <td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td>
<td><input type="text" name="mn_memo" class="form-control" size="30" value="<?=$val["memo"];?>"></td> <td><input type="text" name="mn_memo" class="form-control" size="20" value="<?=$val["memo"];?>"></td>
<td><?php echo $val["option_relate_spec"]; ?></td>
</tr> </tr>
<?php <?php
$idx++; $idx++;
@ -616,7 +637,8 @@ hr {
?> ?>
<tr> <tr>
<td colspan="7">小計</td> <td colspan="7">小計</td>
<td colspan="2"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" value="<?=number_format($item_amt_D_all);?>"></td> <td><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" value="<?=number_format($item_amt_D_all);?>"></td>
<td colspan="2"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

124
wms/mkt/pricereview-create.php

@ -403,7 +403,7 @@ function selFacil(o) {
fp.find('input[name=item_spec]').val(data.model); fp.find('input[name=item_spec]').val(data.model);
fp.find('input[name=item_weight]').val(data.weight); fp.find('input[name=item_weight]').val(data.weight);
fp.find('input[name=item_group]').val(data.group); fp.find('input[name=item_group]').val(data.group);
fp.find('input[name=item_price]').val(data.iamt.substr(1)*fp.find('input[name=item_qty]').val()); //fp.find('input[name=item_price]').val(data.iamt.substr(1)*fp.find('input[name=item_qty]').val());
//fp.find('input[name=gross_profit]').val(($('#price_total').val().replace(/[,]+/g,"")-data.iamt.substr(1))*fp.find('input[name=item_qty]').val()); //fp.find('input[name=gross_profit]').val(($('#price_total').val().replace(/[,]+/g,"")-data.iamt.substr(1))*fp.find('input[name=item_qty]').val());
fp.find('input[name=gross_profit]').val(fp.find('input[name=item_price]').val()); fp.find('input[name=gross_profit]').val(fp.find('input[name=item_price]').val());
dataFormat(); dataFormat();
@ -566,7 +566,7 @@ $(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
dataFormat(); dataFormat();
}); });
$('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price]', function(){ $('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price], input[name=item_price_ct]', function(){
//$("input[name='item_price']").keyup(function(){ //$("input[name='item_price']").keyup(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
//}); //});
@ -636,6 +636,7 @@ $(function(){
}); });
$('#btnadd4').click(function(){ $('#btnadd4').click(function(){
$('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end()); $('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end());
$('#tb4 tr:last').prev().find('td[name=mn_relate_facil]').html('');
//$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length);
//$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length);
}); });
@ -699,15 +700,17 @@ $(function(){
$('#tb2').on('click', 'a[name=btnfaci]', function(){ $('#tb2').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') { if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') {
var k=1;
$("input[name=item_spec]").each(function(){ $("input[name=item_spec]").each(function(){
if ($(this).val() == '') return; if ($(this).val() == '') return;
var objInput = document.createElement("input"); var objInput = document.createElement("input");
objInput.setAttribute("type", "checkbox"); objInput.setAttribute("type", "checkbox");
objInput.setAttribute("name", "sub_faci"); objInput.setAttribute("name", "sub_faci");
objInput.setAttribute("value", $(this).val()); objInput.setAttribute("value", k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append(objInput); $("#optionFaciModal .modal-body").append(objInput);
$("#optionFaciModal .modal-body").append($(this).val()); $("#optionFaciModal .modal-body").append(k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append("<br>"); $("#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-body").append("<p><button type='button' name='btnpost' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>確定</span></button></p>");
$("#optionFaciModal").modal('show'); $("#optionFaciModal").modal('show');
@ -721,7 +724,40 @@ $(function(){
jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str); jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str);
}); });
} else { } else {
alert("請先新增OPTION。"); alert("請先新增OPTION");
return false;
}
});
$('#tb4').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') {
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", $(this).val()+"#"+$(this).closest('td').parent().find('input[name=item_qty]').val());
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=mn_relate_facil]').html(str);
});
} else {
alert("請先在左測下拉欲保固延長的電梯");
jobj.closest('td').parent().find('select[name=mn_kind]').eq(0).focus();
return false; return false;
} }
}); });
@ -899,6 +935,9 @@ $(function(){
var mnMemoArr = []; var mnMemoArr = [];
$("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); }) $("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); })
$('#mn_memo_all').val(mnMemoArr); $('#mn_memo_all').val(mnMemoArr);
var mnRelateFacilArr = [];
$("td[name='mn_relate_facil']").each(function(){ mnRelateFacilArr.push($(this).html()); })
$('#mn_relate_facil_all').val(mnRelateFacilArr);
var exNoteArr = []; var exNoteArr = [];
$("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); }) $("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); })
$('#except_note_all').val(exNoteArr); $('#except_note_all').val(exNoteArr);
@ -919,13 +958,25 @@ $(function(){
var rv = true; var rv = true;
$("td[name='option_relate_facil']").each(function(){ $("td[name='option_relate_facil']").each(function(){
if ($(this).html() == "") { if ($(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。"); if (!confirm("【所屬電梯】資料空白!\n確認要送出?")) {
location.href = '#btnadd2'; //alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。");
return rv = false; location.href = '#btnadd2';
return rv = false;
}
} }
}); });
if ((rv === false)) return rv; if ((rv === false)) return rv;
var rv2 = true;
$("td[name='mn_relate_facil']").each(function(){
if ($(this).closest('td').parent().find('select[name=mn_kind').val() != '' && $(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至 保固延長區 點選紅色按鈕「電梯」並勾選項目。");
location.href = '#btnadd4';
return rv2 = false;
}
});
if ((rv2 === false)) return rv2;
if ($("#pay_all_amount").val() != $("#price_total").val()) { if ($("#pay_all_amount").val() != $("#price_total").val()) {
alert("【付款辦法】金額合計有誤!"); alert("【付款辦法】金額合計有誤!");
$("input[name=pay_scale]").eq(0).trigger( "focus" ); $("input[name=pay_scale]").eq(0).trigger( "focus" );
@ -1040,7 +1091,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<table id="tb1" class="table table-bordered"> <table id="tb1" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th> <th colspan="10">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<!--<th nowrap>項次</th>--> <!--<th nowrap>項次</th>-->
@ -1049,10 +1100,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<th>停數</th> <th>停數</th>
<th>速度</th> <th>速度</th>
<th>開門方式</th> <th>開門方式</th>
<th>規格</th> <th class="star">規格</th>
<th>單價</th> <th>單價</th>
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>售價</th>
<!-- <!--
<th style="width:11%">金額(含稅)</th> <th style="width:11%">金額(含稅)</th>
<th>價審%</th> <th>價審%</th>
@ -1244,7 +1296,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option> <option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option>
<option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option> <option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option>
<option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option> <option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option>
@ -1255,10 +1307,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="item_spec" class="form-control" value="<?php echo $v["item_spec"]; ?>" readonly></td> <td><input type="text" name="item_spec" class="form-control" value="<?php echo $v["item_spec"]; ?>" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%;" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>" required>
<input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"> <input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id">
<input type="hidden" name="item_price"><input type="hidden" name="gross_profit"> <input type="hidden" name="gross_profit">
<input type="hidden" name="item_price_ct" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>"> <input type="hidden" name="item_price">
<input type="hidden" name="item_weight"> <input type="hidden" name="item_weight">
<a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1449,7 +1502,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO"<?php if ($v["op"]=="CO") echo " selected"; ?>>CO</option> <option value="CO"<?php if ($v["op"]=="CO") echo " selected"; ?>>CO</option>
<option value="2S"<?php if ($v["op"]=="2S") echo " selected"; ?>>2S</option> <option value="2S"<?php if ($v["op"]=="2S") echo " selected"; ?>>2S</option>
<option value="2U"<?php if ($v["op"]=="2U") echo " selected"; ?>>2U</option> <option value="2U"<?php if ($v["op"]=="2U") echo " selected"; ?>>2U</option>
@ -1460,10 +1513,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="item_spec" class="form-control" readonly></td> <td><input type="text" name="item_spec" class="form-control" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo $v["spec_price"]; ?>" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo $v["spec_price"]; ?>" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["spec_num"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["spec_num"]; ?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["spec_num"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["spec_num"]; ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%;" value="<?php echo number_format($v["spec_price"]*$v["spec_num"]); ?>" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" value="<?php echo number_format($v["spec_price"]*$v["spec_num"]); ?>" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>" required>
<input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"> <input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id">
<input type="hidden" name="item_price"><input type="hidden" name="gross_profit"> <input type="hidden" name="gross_profit">
<input type="hidden" name="item_price_ct" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>"> <input type="hidden" name="item_price">
<input type="hidden" name="item_weight"> <input type="hidden" name="item_weight">
<a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1554,7 +1608,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO">CO</option> <option value="CO">CO</option>
<option value="2S">2S</option> <option value="2S">2S</option>
<option value="2U">2U</option> <option value="2U">2U</option>
@ -1565,10 +1619,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="item_spec" class="form-control" readonly></td> <td><input type="text" name="item_spec" class="form-control" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%;" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" required>
<input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"> <input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id">
<input type="hidden" name="item_price"><input type="hidden" name="gross_profit"> <input type="hidden" name="gross_profit">
<input type="hidden" name="item_price_ct" value="<?php if (isset($v["spec_price"]) && isset($v["spec_num"])) echo $v["spec_price"]*$v["spec_num"]; else echo '0'; ?>"> <input type="hidden" name="item_price">
<input type="hidden" name="item_weight"> <input type="hidden" name="item_weight">
<a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1579,7 +1634,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?> ?>
<tr> <tr>
<td colspan="8">小計</td> <td colspan="8">小計</td>
<td><input type="text" name="amt" id="amt" class="form-control dollar-right" style="width:80%;" readonly></td> <td colspan="2"><input type="text" name="amt" id="amt" class="form-control dollar-right" size="12" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1597,7 +1652,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯規格">所屬電梯 <th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" /> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
@ -1698,7 +1753,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td> <td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td>
<td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>" readonly></td> <td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>" readonly></td>
<td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td> <td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td>
<td><input type="text" name="except_qty" class="form-control" size="2" maxlength="2" 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="btndel3" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a>
@ -1712,7 +1767,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="except_note" class="form-control"></td> <td><input type="text" name="except_note" class="form-control"></td>
<td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td> <td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td>
<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="2" maxlength="2"></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="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>
@ -1732,7 +1787,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<table id="tb4" class="table table-bordered"> <table id="tb4" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="8">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th> <th colspan="10">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<th>電梯</th> <th>電梯</th>
@ -1743,6 +1798,8 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star">所屬電梯</div></th>
<th>功能</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -1757,6 +1814,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option> <option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option>
<option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option> <option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option>
<option value="MAH100"<?php if ($v['item_spec']=="MAH100") echo " selected"; ?>>MAH100小電梯</option>
<option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option> <option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option>
<option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option> <option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option>
<option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option> <option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option>
@ -1802,7 +1860,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly> <td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly>
<input type="hidden" name="mn_id"> <input type="hidden" name="mn_id">
</td> </td>
<td><input type="text" name="mn_memo" class="form-control" size="30"> <td><input type="text" name="mn_memo" class="form-control" size="20"></td>
<td name="mn_relate_facil" nowrap></td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1816,6 +1876,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option> <option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option> <option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option> <option value="MAF100">MAF100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強驅梯</option> <option value="MAQ100">MAQ100強驅梯</option>
<option value="MAP100">MAP100平台梯</option> <option value="MAP100">MAP100平台梯</option>
@ -1857,7 +1918,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" readonly></td> <td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" readonly></td>
<td><input type="text" name="mn_qty" class="form-control" size="2" maxlength="2"></td> <td><input type="text" name="mn_qty" class="form-control" size="2" maxlength="2"></td>
<td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" readonly><input type="hidden" name="mn_id"></td> <td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" readonly><input type="hidden" name="mn_id"></td>
<td><input type="text" name="mn_memo" class="form-control" size="30"> <td><input type="text" name="mn_memo" class="form-control" size="20"></td>
<td name="mn_relate_facil" nowrap></td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1866,7 +1929,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
?> ?>
<tr> <tr>
<td colspan="6">小計</td> <td colspan="6">小計</td>
<td colspan="2"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td> <td colspan="4"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -2149,6 +2212,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<input type="hidden" name="mn_qty_all" id="mn_qty_all"> <input type="hidden" name="mn_qty_all" id="mn_qty_all">
<input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all"> <input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all">
<input type="hidden" name="mn_memo_all" id="mn_memo_all"> <input type="hidden" name="mn_memo_all" id="mn_memo_all">
<input type="hidden" name="mn_relate_facil_all" id="mn_relate_facil_all">
<input type="hidden" name="except_note_all" id="except_note_all"> <input type="hidden" name="except_note_all" id="except_note_all">
<input type="hidden" name="except_spec_all" id="except_spec_all"> <input type="hidden" name="except_spec_all" id="except_spec_all">
<input type="hidden" name="except_unit_price_all" id="except_unit_price_all"> <input type="hidden" name="except_unit_price_all" id="except_unit_price_all">

131
wms/mkt/pricereview-edit.php

@ -55,6 +55,7 @@ foreach ($res as $data) {
$mn_arr[$row['item_no']]['id'] = $row['id']; $mn_arr[$row['item_no']]['id'] = $row['id'];
$mn_arr[$row['item_no']]['mn_id'] = $row['price_id']; $mn_arr[$row['item_no']]['mn_id'] = $row['price_id'];
$mn_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $mn_arr[$row['item_no']]['item_spec'] = $row['item_spec'];
$mn_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec'];
$mn_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $mn_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price'];
$mn_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $mn_arr[$row['item_no']]['item_qty'] = $row['item_qty'];
$mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp'];
@ -542,7 +543,7 @@ $(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
dataFormat(); dataFormat();
}); });
$('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price]', function(){ $('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price], input[name=item_price_ct]', function(){
//$("input[name='item_price']").keyup(function(){ //$("input[name='item_price']").keyup(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
//}); //});
@ -617,6 +618,7 @@ $(function(){
}); });
$('#btnadd4').click(function(){ $('#btnadd4').click(function(){
$('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end()); $('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end());
$('#tb4 tr:last').prev().find('td[name=mn_relate_facil]').html('');
$("tr[name='maintain_templ']").last().find('input[name=mn_act]').val('I'); $("tr[name='maintain_templ']").last().find('input[name=mn_act]').val('I');
//$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length);
//$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length);
@ -663,15 +665,18 @@ $(function(){
$('#tb2').on('click', 'a[name=btnfaci]', function(){ $('#tb2').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') { if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') {
var k=1;
$("input[name=item_spec]").each(function(){ $("input[name=item_spec]").each(function(){
if ($(this).val() == '') return; if ($(this).val() == '') return;
var objInput = document.createElement("input"); var objInput = document.createElement("input");
objInput.setAttribute("type", "checkbox"); objInput.setAttribute("type", "checkbox");
objInput.setAttribute("name", "sub_faci"); objInput.setAttribute("name", "sub_faci");
objInput.setAttribute("value", $(this).val()); //objInput.setAttribute("value", $(this).val()+"#"+$(this).closest('td').parent().find('input[name=item_qty]').val());
objInput.setAttribute("value", k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append(objInput); $("#optionFaciModal .modal-body").append(objInput);
$("#optionFaciModal .modal-body").append($(this).val()); $("#optionFaciModal .modal-body").append(k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append("<br>"); $("#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-body").append("<p><button type='button' name='btnpost' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>確定</span></button></p>");
$("#optionFaciModal").modal('show'); $("#optionFaciModal").modal('show');
@ -685,7 +690,40 @@ $(function(){
jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str); jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str);
}); });
} else { } else {
alert("請先新增OPTION。"); alert("請先新增OPTION");
return false;
}
});
$('#tb4').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') {
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", $(this).val()+"#"+$(this).closest('td').parent().find('input[name=item_qty]').val());
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=mn_relate_facil]').html(str);
});
} else {
alert("請先在左測下拉欲保固延長的電梯");
jobj.closest('td').parent().find('select[name=mn_kind]').eq(0).focus();
return false; return false;
} }
}); });
@ -729,7 +767,7 @@ $(function(){
} }
}; };
$('#tb4').on('click', 'a[name=btndel4]', function(){ $('#tb4').on('click', 'a[name=btndel4]', function(){
var oriID = $(this).parent().prev().find('input[name=mn_item]').val(); // 被刪除的ID var oriID = $(this).parent().parent().find('input[name=mn_item]').val(); // 被刪除的ID
if ($('tr[name=maintain_templ]').length > 1) $(this).closest('tr').remove(); if ($('tr[name=maintain_templ]').length > 1) $(this).closest('tr').remove();
if ($('tr[name=maintain_templ]').length == 1) $(this).closest('tr').find('input,select').val('').end(); if ($('tr[name=maintain_templ]').length == 1) $(this).closest('tr').find('input,select').val('').end();
$('#mn_del').val($('#mn_del').val()+oriID+','); $('#mn_del').val($('#mn_del').val()+oriID+',');
@ -841,7 +879,7 @@ $(function(){
$("input[name='option_memo']").each(function(){ optionMemoArr.push($(this).val()+"@@"); }) $("input[name='option_memo']").each(function(){ optionMemoArr.push($(this).val()+"@@"); })
$('#option_memo_all').val(optionMemoArr); $('#option_memo_all').val(optionMemoArr);
var optionRelateFacilArr = []; var optionRelateFacilArr = [];
$("td[name='option_relate_facil']").each(function(){ optionRelateFacilArr.push($(this).html()); }) $("td[name='option_relate_facil']").each(function(){ optionRelateFacilArr.push($(this).html().trim()); })
$('#option_relate_facil_all').val(optionRelateFacilArr); $('#option_relate_facil_all').val(optionRelateFacilArr);
var mnIdArr = []; var mnIdArr = [];
$("input[name='mn_id']").each(function(){ mnIdArr.push($(this).val()); }) $("input[name='mn_id']").each(function(){ mnIdArr.push($(this).val()); })
@ -870,6 +908,9 @@ $(function(){
var mnMemoArr = []; var mnMemoArr = [];
$("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); }) $("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); })
$('#mn_memo_all').val(mnMemoArr); $('#mn_memo_all').val(mnMemoArr);
var mnRelateFacilArr = [];
$("td[name='mn_relate_facil']").each(function(){ mnRelateFacilArr.push($(this).html()); })
$('#mn_relate_facil_all').val(mnRelateFacilArr);
var exNoteArr = []; var exNoteArr = [];
$("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); }) $("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); })
$('#except_note_all').val(exNoteArr); $('#except_note_all').val(exNoteArr);
@ -914,13 +955,25 @@ $(function(){
var rv = true; var rv = true;
$("td[name='option_relate_facil']").each(function(){ $("td[name='option_relate_facil']").each(function(){
if ($(this).html() == "") { if ($(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。"); if (!confirm("【所屬電梯】資料空白!\n確認要送出?")) {
location.href = '#btnadd2'; //alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。");
return rv = false; location.href = '#btnadd2';
return rv = false;
}
} }
}); });
if ((rv === false)) return rv; if ((rv === false)) return rv;
var rv2 = true;
$("td[name='mn_relate_facil']").each(function(){
if ($(this).closest('td').parent().find('select[name=mn_kind').val() != '' && $(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至 保固延長區 點選紅色按鈕「電梯」並勾選項目。");
location.href = '#btnadd4';
return rv2 = false;
}
});
if ((rv2 === false)) return rv2;
if ($("#pay_all_amount").val() != $("#price_total").val()) { if ($("#pay_all_amount").val() != $("#price_total").val()) {
alert("【付款辦法】金額合計有誤!"); alert("【付款辦法】金額合計有誤!");
$("input[name=pay_scale]").eq(0).trigger( "focus" ); $("input[name=pay_scale]").eq(0).trigger( "focus" );
@ -999,7 +1052,7 @@ $(function(){
<table id="tb1" class="table table-bordered"> <table id="tb1" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th> <th colspan="10">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<th>電梯</th> <th>電梯</th>
@ -1007,10 +1060,11 @@ $(function(){
<th>停數</th> <th>停數</th>
<th>速度</th> <th>速度</th>
<th>開門方式</th> <th>開門方式</th>
<th>規格</th> <th class="star">規格</th>
<th>單價</th> <th>單價</th>
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>售價</th>
<!-- <!--
<th style="width:11%">金額(含稅)</th> <th style="width:11%">金額(含稅)</th>
<th>價審%</th> <th>價審%</th>
@ -1103,7 +1157,7 @@ $(function(){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option> <option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option>
<option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option> <option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option>
<option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option> <option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option>
@ -1114,12 +1168,12 @@ $(function(){
<td><input type="text" name="item_spec" class="form-control" value="<?php echo $v['item_spec']; ?>" readonly></td> <td><input type="text" name="item_spec" class="form-control" value="<?php echo $v['item_spec']; ?>" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v['item_unit_price']); ?>" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v['item_unit_price']); ?>" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v['item_qty']; ?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v['item_qty']; ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%" value="<?php echo number_format($v['item_price_bp']); ?>" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" value="<?php echo number_format($v["item_price_ct"]); ?>" required>
<input type="hidden" name="item_group" value="A"> <input type="hidden" name="item_group" value="A">
<input type="hidden" name="fp_id" value="<?php echo $v['fp_id']; ?>"> <input type="hidden" name="fp_id" value="<?php echo $v['fp_id']; ?>">
<input type="hidden" name="item_price" value="<?php echo $v['item_price']; ?>"> <input type="hidden" name="item_price" value="<?php echo $v['item_price']; ?>">
<input type="hidden" name="gross_profit" value="<?php echo $v['gross_profit']; ?>"> <input type="hidden" name="gross_profit" value="<?php echo $v['gross_profit']; ?>">
<input type="hidden" name="item_price_ct" value="<?php echo $v['item_price_ct']; ?>">
<input type="hidden" name="fp_item" value="<?php echo $v['id']; ?>"> <input type="hidden" name="fp_item" value="<?php echo $v['id']; ?>">
<input type="hidden" name="fp_act" value="U"> <input type="hidden" name="fp_act" value="U">
<input type="hidden" name="item_weight" value="<?php echo $v['item_weight']; ?>"> <input type="hidden" name="item_weight" value="<?php echo $v['item_weight']; ?>">
@ -1132,7 +1186,7 @@ $(function(){
?> ?>
<tr> <tr>
<td colspan="8">小計</td> <td colspan="8">小計</td>
<td><input type="text" name="amt" id="amt" class="form-control dollar-right" style="width:80%" readonly></td> <td colspan="2"><input type="text" name="amt" id="amt" class="form-control dollar-right" size="12" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1150,7 +1204,7 @@ $(function(){
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯規格">所屬電梯 <th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" /> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
@ -1177,7 +1231,18 @@ $(function(){
<input type="hidden" name="op_act" value="U"> <input type="hidden" name="op_act" value="U">
</td> </td>
<td><input type="text" name="option_memo" class="form-control" size="20" value="<?php echo $v['memo']; ?>"></td> <td><input type="text" name="option_memo" class="form-control" size="20" value="<?php echo $v['memo']; ?>"></td>
<td name="option_relate_facil"><?php echo str_replace(",", "<br>", $v['option_relate_spec']); ?></td> <td name="option_relate_facil">
<?php
if (!empty($v['option_relate_spec'])) {
$tmp_arr = explode(",", $v['option_relate_spec']);
foreach ($tmp_arr as $val) {
if (!empty($item_arr[$val]['item_spec'])) {
echo $val.".".$item_arr[$val]['item_spec']."<br>";
}
}
}
?>
</td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a> <td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel2" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel2" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1238,7 +1303,7 @@ $(function(){
<td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td> <td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td>
<td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>"></td> <td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>"></td>
<td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>"></td> <td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>"></td>
<td><input type="text" name="except_qty" class="form-control" size="2" maxlength="2" 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">
<input type="hidden" name="except_item" value="<?php echo $v['id']; ?>"> <input type="hidden" name="except_item" value="<?php echo $v['id']; ?>">
@ -1254,7 +1319,7 @@ $(function(){
<td><input type="text" name="except_note" class="form-control"></td> <td><input type="text" name="except_note" class="form-control"></td>
<td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td> <td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td>
<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="2" maxlength="2"></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>
<input type="hidden" name="except_item"> <input type="hidden" name="except_item">
<input type="hidden" name="except_act" value="I"> <input type="hidden" name="except_act" value="I">
@ -1276,7 +1341,7 @@ $(function(){
<table id="tb4" class="table table-bordered"> <table id="tb4" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="8">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th> <th colspan="10">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<th>電梯</th> <th>電梯</th>
@ -1287,6 +1352,8 @@ $(function(){
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star">所屬電梯</div></th>
<th>功能</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -1302,6 +1369,7 @@ $(function(){
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option> <option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option>
<option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option> <option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option>
<option value="MAH100"<?php if ($v['item_spec']=="MAH100") echo " selected"; ?>>MAH100小電梯</option>
<option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option> <option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option>
<option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option> <option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option>
<option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option> <option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option>
@ -1348,7 +1416,20 @@ $(function(){
<input type="hidden" name="mn_item" value="<?php echo $v['id']; ?>"> <input type="hidden" name="mn_item" value="<?php echo $v['id']; ?>">
<input type="hidden" name="mn_act" value="U"> <input type="hidden" name="mn_act" value="U">
</td> </td>
<td><input type="text" name="mn_memo" class="form-control" size="30" value="<?php echo $v['memo']; ?>"> <td><input type="text" name="mn_memo" class="form-control" size="20" value="<?php echo $v['memo']; ?>"></td>
<td name="mn_relate_facil" nowrap>
<?php
if (!empty($v['option_relate_spec'])) {
$tmp_arr = explode(",", $v['option_relate_spec']);
foreach ($tmp_arr as $val) {
if (!empty($item_arr[$val]['item_spec'])) {
echo $val.".".$item_arr[$val]['item_spec']."<br>";
}
}
}
?>
</td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1362,6 +1443,7 @@ $(function(){
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option> <option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option> <option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option> <option value="MAF100">MAF100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強驅梯</option> <option value="MAQ100">MAQ100強驅梯</option>
<option value="MAP100">MAP100平台梯</option> <option value="MAP100">MAP100平台梯</option>
@ -1405,7 +1487,9 @@ $(function(){
<input type="hidden" name="mn_item"> <input type="hidden" name="mn_item">
<input type="hidden" name="mn_act" value="I"> <input type="hidden" name="mn_act" value="I">
</td> </td>
<td><input type="text" name="mn_memo" class="form-control" size="30"> <td><input type="text" name="mn_memo" class="form-control" size="20"></td>
<td name="mn_relate_facil" nowrap></td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1414,7 +1498,7 @@ $(function(){
?> ?>
<tr> <tr>
<td colspan="6">小計</td> <td colspan="6">小計</td>
<td colspan="2"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td> <td colspan="4"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1716,6 +1800,7 @@ $(function(){
<input type="hidden" name="mn_qty_all" id="mn_qty_all"> <input type="hidden" name="mn_qty_all" id="mn_qty_all">
<input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all"> <input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all">
<input type="hidden" name="mn_memo_all" id="mn_memo_all"> <input type="hidden" name="mn_memo_all" id="mn_memo_all">
<input type="hidden" name="mn_relate_facil_all" id="mn_relate_facil_all">
<input type="hidden" name="except_note_all" id="except_note_all"> <input type="hidden" name="except_note_all" id="except_note_all">
<input type="hidden" name="except_spec_all" id="except_spec_all"> <input type="hidden" name="except_spec_all" id="except_spec_all">
<input type="hidden" name="except_unit_price_all" id="except_unit_price_all"> <input type="hidden" name="except_unit_price_all" id="except_unit_price_all">

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

@ -127,6 +127,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$item_price_arr = $gross_profit_arr = []; // 先reset, 等審核才產出 $item_price_arr = $gross_profit_arr = []; // 先reset, 等審核才產出
// 如果售價變動或電梯數量異動,售價則平均分攤到每台 // 如果售價變動或電梯數量異動,售價則平均分攤到每台
/*
$avg_fg = 0; $avg_fg = 0;
foreach ($item_price_bp_arr as $k => $v) { foreach ($item_price_bp_arr as $k => $v) {
if ($v && !isset($item_price_ct_arr[$k])) { if ($v && !isset($item_price_ct_arr[$k])) {
@ -152,6 +153,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$item_price_ct2_arr[count($item_qty_arr)-1] = $price_total - $price_total_item; $item_price_ct2_arr[count($item_qty_arr)-1] = $price_total - $price_total_item;
$item_price_ct_arr = $item_price_ct2_arr; $item_price_ct_arr = $item_price_ct2_arr;
} }
*/
$item_no = 1; $item_no = 1;
for ($i=0; $i<count($item_spec_arr); $i++) { for ($i=0; $i<count($item_spec_arr); $i++) {
@ -192,11 +194,20 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$option_unit_price_arr[$i] = str_replace(",", "", $option_unit_price_arr[$i]); $option_unit_price_arr[$i] = str_replace(",", "", $option_unit_price_arr[$i]);
$option_qty_arr[$i] = str_replace(",", "", $option_qty_arr[$i]); $option_qty_arr[$i] = str_replace(",", "", $option_qty_arr[$i]);
$option_price_bp_arr[$i] = str_replace(",", "", $option_price_bp_arr[$i]); $option_price_bp_arr[$i] = str_replace(",", "", $option_price_bp_arr[$i]);
$option_relate_facil_tmp_arr = explode("<br>", $option_relate_facil_arr[$i]); $option_relate_spec = "";
$intersect_arr = array_intersect($option_relate_facil_tmp_arr, $item_spec_arr); $tmp_arr = explode("<br>", $option_relate_facil_arr[$i]);
foreach ($tmp_arr as $val) {
$option_relate_spec .= substr($val, 0, strpos($val, ".")).",";
}
$option_relate_spec = rtrim($option_relate_spec, ",");
/*
$intersect_str = "";
$intersect_arr = array_intersect($option_relate_facil_arr, $item_spec_arr);
$intersect_str = implode(",", $intersect_arr); $intersect_str = implode(",", $intersect_arr);
*/
$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, memo) values ("; $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, memo) values (";
$db_query .= "'$mid', '$op_id_arr[$i]', '$item_no', 'B', '$spec', '$intersect_str', '$option_unit_price_arr[$i]', '$option_qty_arr[$i]', '$option_price_bp_arr[$i]', '$option_memo_arr[$i]')"; $db_query .= "'$mid', '$op_id_arr[$i]', '$item_no', 'B', '$spec', '$option_relate_spec', '$option_unit_price_arr[$i]', '$option_qty_arr[$i]', '$option_price_bp_arr[$i]', '$option_memo_arr[$i]')";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$item_no++; $item_no++;
} }
@ -213,6 +224,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$mn_qty_arr = explode(",", $mn_qty_all); $mn_qty_arr = explode(",", $mn_qty_all);
$mn_price_bp_arr = explode(",", $mn_price_bp_all); $mn_price_bp_arr = explode(",", $mn_price_bp_all);
$mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@")); $mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@"));
$mn_relate_facil_arr = explode(",", htmlspecialchars_decode($mn_relate_facil_all));
$item_no = 1; $item_no = 1;
for ($i=0; $i<count($mn_seat_arr); $i++) { for ($i=0; $i<count($mn_seat_arr); $i++) {
if (empty($mn_kind_arr[$i])) continue; if (empty($mn_kind_arr[$i])) continue;
@ -220,8 +232,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$mn_qty_arr[$i] = str_replace(",", "", $mn_qty_arr[$i]); $mn_qty_arr[$i] = str_replace(",", "", $mn_qty_arr[$i]);
$mn_price_bp_arr[$i] = str_replace(",", "", $mn_price_bp_arr[$i]); $mn_price_bp_arr[$i] = str_replace(",", "", $mn_price_bp_arr[$i]);
$note = $mn_seat_arr[$i].",".$mn_numberofstop_arr[$i].",".$mn_speed_arr[$i]; $note = $mn_seat_arr[$i].",".$mn_numberofstop_arr[$i].",".$mn_speed_arr[$i];
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_group, item_spec, item_unit_price, item_qty, item_price_bp, note, memo) values ("; $option_relate_spec = "";
$db_query .= "'$mid', '$mn_id_arr[$i]', '$item_no', 'D', '$mn_kind_arr[$i]', '$mn_unit_price_arr[$i]', '$mn_qty_arr[$i]', '$mn_price_bp_arr[$i]', '$note', '$mn_memo_arr[$i]')"; $tmp_arr = explode("<br>", $mn_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, 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); $result = mysqli_query($link, $db_query);
$item_no++; $item_no++;
} }

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

@ -131,6 +131,7 @@ if(isset($_POST['pmstatus'])) {
$item_price_arr = $gross_profit_arr = []; // 先reset, 等審核才產出 $item_price_arr = $gross_profit_arr = []; // 先reset, 等審核才產出
// 如果售價變動或電梯數量異動,售價則平均分攤到每台 // 如果售價變動或電梯數量異動,售價則平均分攤到每台
/*
$avg_fg = 0; $avg_fg = 0;
foreach ($item_price_bp_arr as $k => $v) { foreach ($item_price_bp_arr as $k => $v) {
if ($v && !isset($item_price_ct_arr[$k])) { if ($v && !isset($item_price_ct_arr[$k])) {
@ -156,6 +157,7 @@ if(isset($_POST['pmstatus'])) {
$item_price_ct2_arr[count($item_qty_arr)-1] = $price_total - $price_total_item; $item_price_ct2_arr[count($item_qty_arr)-1] = $price_total - $price_total_item;
$item_price_ct_arr = $item_price_ct2_arr; $item_price_ct_arr = $item_price_ct2_arr;
} }
*/
$to_ins_arr = []; // 準備要新增的項目 $to_ins_arr = []; // 準備要新增的項目
if (count($fp_item_arr) > 0) { if (count($fp_item_arr) > 0) {
@ -218,11 +220,14 @@ if(isset($_POST['pmstatus'])) {
if (empty($iid) && $op_act_arr[$k] == "I") { if (empty($iid) && $op_act_arr[$k] == "I") {
$to_ins_arr[] = $k; $to_ins_arr[] = $k;
} else { } else {
$option_relate_facil_tmp_arr = explode("<br>", $option_relate_facil_arr[$k]); $option_relate_spec = "";
$intersect_arr = array_intersect($option_relate_facil_tmp_arr, $item_spec_arr); $tmp_arr = explode("<br>", $option_relate_facil_arr[$k]);
$intersect_str = implode(",", $intersect_arr); foreach ($tmp_arr as $val) {
$option_relate_spec .= substr($val, 0, strpos($val, ".")).",";
}
$option_relate_spec = rtrim($option_relate_spec, ",");
$db_query = "update pricereview_item set item_unit_price = '$option_unit_price_arr[$k]', item_qty = '$option_qty_arr[$k]', "; $db_query = "update pricereview_item set item_unit_price = '$option_unit_price_arr[$k]', item_qty = '$option_qty_arr[$k]', ";
$db_query .= "item_price_bp = '$option_price_bp_arr[$k]', memo = '$option_memo_arr[$k]', option_relate_spec = '$intersect_str' "; $db_query .= "item_price_bp = '$option_price_bp_arr[$k]', memo = '$option_memo_arr[$k]', option_relate_spec = '$option_relate_spec' ";
$db_query .= "where id = '$iid'"; $db_query .= "where id = '$iid'";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
} }
@ -243,11 +248,14 @@ if(isset($_POST['pmstatus'])) {
foreach ($to_ins_arr as $v) { foreach ($to_ins_arr as $v) {
if (!$op_id_arr[$v]) $op_id_arr[$v] = 0; if (!$op_id_arr[$v]) $op_id_arr[$v] = 0;
$spec = trim($option_seat_arr[$v]); $spec = trim($option_seat_arr[$v]);
$option_relate_facil_tmp_arr = explode("<br>", $option_relate_facil_arr[$v]); $option_relate_spec = "";
$intersect_arr = array_intersect($option_relate_facil_tmp_arr, $item_spec_arr); $tmp_arr = explode("<br>", $option_relate_facil_arr[$k]);
$intersect_str = implode(",", $intersect_arr); 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, price_id, item_no, item_spec, option_relate_spec, item_group, item_unit_price, item_qty, item_price_bp, memo) values ("; $db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, option_relate_spec, item_group, item_unit_price, item_qty, item_price_bp, memo) values (";
$db_query .= "'$id', '$op_id_arr[$v]', '$nextno', '$spec', '$intersect_str', 'B', '$option_unit_price_arr[$v]', '$option_qty_arr[$v]', '$option_price_bp_arr[$v]', '$option_memo_arr[$v]')"; $db_query .= "'$id', '$op_id_arr[$v]', '$nextno', '$spec', '$option_relate_spec', 'B', '$option_unit_price_arr[$v]', '$option_qty_arr[$v]', '$option_price_bp_arr[$v]', '$option_memo_arr[$v]')";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$nextno++; $nextno++;
} }
@ -266,6 +274,7 @@ if(isset($_POST['pmstatus'])) {
$mn_qty_arr = explode(",", $mn_qty_all); $mn_qty_arr = explode(",", $mn_qty_all);
$mn_price_bp_arr = explode(",", $mn_price_bp_all); $mn_price_bp_arr = explode(",", $mn_price_bp_all);
$mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@")); $mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@"));
$mn_relate_facil_arr = explode(",", htmlspecialchars_decode($mn_relate_facil_all));
$to_ins_arr = []; // 準備要新增的項目 $to_ins_arr = []; // 準備要新增的項目
if (count($mn_item_arr) > 0) { if (count($mn_item_arr) > 0) {
foreach ($mn_item_arr as $k => $iid) { foreach ($mn_item_arr as $k => $iid) {
@ -276,8 +285,15 @@ if(isset($_POST['pmstatus'])) {
$mn_numberofstop_arr[$k] = (isset($mn_numberofstop_arr[$k])) ? $mn_numberofstop_arr[$k] : ""; $mn_numberofstop_arr[$k] = (isset($mn_numberofstop_arr[$k])) ? $mn_numberofstop_arr[$k] : "";
$mn_speed_arr[$k] = (isset($mn_speed_arr[$k])) ? $mn_speed_arr[$k] : ""; $mn_speed_arr[$k] = (isset($mn_speed_arr[$k])) ? $mn_speed_arr[$k] : "";
$note = $mn_seat_arr[$k].",".$mn_numberofstop_arr[$k].",".$mn_speed_arr[$k]; $note = $mn_seat_arr[$k].",".$mn_numberofstop_arr[$k].",".$mn_speed_arr[$k];
$option_relate_spec = "";
$tmp_arr = explode("<br>", $mn_relate_facil_arr[$k]);
foreach ($tmp_arr as $val) {
$option_relate_spec .= substr($val, 0, strpos($val, ".")).",";
}
$option_relate_spec = rtrim($option_relate_spec, ",");
$db_query = "update pricereview_item set item_unit_price = '$mn_unit_price_arr[$k]', item_qty = '$mn_qty_arr[$k]', "; $db_query = "update pricereview_item set item_unit_price = '$mn_unit_price_arr[$k]', item_qty = '$mn_qty_arr[$k]', ";
$db_query .= "item_price_bp = '$mn_price_bp_arr[$k]', note = '$note', memo = '$mn_memo_arr[$k]' "; $db_query .= "item_price_bp = '$mn_price_bp_arr[$k]', note = '$note', memo = '$mn_memo_arr[$k]', ";
$db_query .= "option_relate_spec = '$option_relate_spec' ";
$db_query .= "where id = '$iid'"; $db_query .= "where id = '$iid'";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
} }
@ -298,8 +314,14 @@ if(isset($_POST['pmstatus'])) {
foreach ($to_ins_arr as $v) { foreach ($to_ins_arr as $v) {
if (!$mn_id_arr[$v]) $mn_id_arr[$v] = 0; if (!$mn_id_arr[$v]) $mn_id_arr[$v] = 0;
$note = $mn_seat_arr[$v].",".$mn_numberofstop_arr[$v].",".$mn_speed_arr[$v]; $note = $mn_seat_arr[$v].",".$mn_numberofstop_arr[$v].",".$mn_speed_arr[$v];
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, item_group, item_unit_price, item_qty, item_price_bp, note, memo) values ("; $option_relate_spec = "";
$db_query .= "'$id', '$mn_id_arr[$v]', '$nextno', '$mn_kind_arr[$v]', 'D', '$mn_unit_price_arr[$v]', '$mn_qty_arr[$v]', '$mn_price_bp_arr[$v]', '$note', '$mn_memo_arr[$v]')"; $tmp_arr = explode("<br>", $mn_relate_facil_arr[$v]);
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, price_id, item_no, item_spec, option_relate_spec, item_group, item_unit_price, item_qty, item_price_bp, note, memo) values (";
$db_query .= "'$id', '$mn_id_arr[$v]', '$nextno', '$mn_kind_arr[$v]', '$option_relate_spec', 'D', '$mn_unit_price_arr[$v]', '$mn_qty_arr[$v]', '$mn_price_bp_arr[$v]', '$note', '$mn_memo_arr[$v]')";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$nextno++; $nextno++;
} }

221
wms/mkt/pricereview_mi-api.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* MI計算 * by單台計算MI
* @url /wms/mkt/pricereview_mi-api.php * @url /wms/mkt/pricereview_mi-api.php
* @method POST * @method POST
* @return JSON * @return JSON
@ -45,28 +45,117 @@ try {
"20" => "1350", "20" => "1350",
"24" => "1600"]; "24" => "1600"];
$mi_arr = []; $elev_arr = $elev_opt_arr = $pv_arr = $opt_elev_arr = $mi_arr = [];
$i = $weight = 0; $i = $weight = $elev_qty_all = 0;
$sql = "select note, item_qty, item_weight, item_op, item_spec from pricereview_item where mid = '$id' and item_group = 'A' order by item_no";
// 電梯項目
$sql = "select note, item_qty, item_weight, item_op, item_spec, item_no from pricereview_item where mid = '$id' and item_group = 'A' order by item_no";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) { while ($row = mysqli_fetch_row($res)) {
list($etype, $persons, $floors, $speed) = explode(",", $row[0]); if (!empty($row[0])) list($etype, $persons, $floors, $speed) = explode(",", $row[0]);
else $etype = $persons = $floors = $speed = '';
/*
$item_qty = $row[1]; // 數量 $item_qty = $row[1]; // 數量
$item_weight = $row[2]; // 載重 $item_weight = $row[2]; // 載重
$item_op = $row[3]; // 開門方式 $item_op = $row[3]; // 開門方式
$item_spec = $row[4]; // 電梯規格 $item_spec = $row[4]; // 電梯規格
$item_no = $row[5];
*/
$elev_arr[$row[5]]["item_qty"] = $row[1];
$elev_arr[$row[5]]["item_weight"] = $row[2];
$elev_arr[$row[5]]["item_op"] = $row[3];
$elev_arr[$row[5]]["item_qty"] = $row[1];
$elev_arr[$row[5]]["item_spec"] = $row[4];
$elev_arr[$row[5]]["etype"] = $etype;
$elev_arr[$row[5]]["persons"] = $persons;
$elev_arr[$row[5]]["floors"] = $floors;
$elev_arr[$row[5]]["speed"] = $speed;
$elev_arr[$row[5]]["option"] = [];
$elev_qty_all += $row[1];
}
mysqli_free_result($res);
// 電梯所屬OPTION
$opt_sel_id_arr = [];
$sql = "select id, price_id, item_spec, item_qty, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'B'";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
$opt_elev_arr[$row[0]]["price_id"] = $row[1];
$opt_elev_arr[$row[0]]["item_spec"] = $row[2];
$opt_elev_arr[$row[0]]["item_qty"] = $row[3];
$tmp_arr = explode(",", $row[4]);
$opt_elev_arr[$row[0]]["elev_no"] = $tmp_arr;
if (!empty($opt_elev_arr[$row[0]]["elev_no"][0])) {
foreach ($tmp_arr as $v) {
$elev_arr[$v]["option"][] = $row[0];
$opt_sel_id_arr[] = $row[0];
}
}
/*
$pv_arr["price_id"] = $row[1];
$pv_arr["item_spec"] = $row[2];
$pv_arr["item_qty"] = $row[3];
$pv_arr["elev_item_no"] = explode(",", $row[4]);
$tmp_arr = explode(",", $row[4]);
foreach ($tmp_arr as $v) {
$elev_opt_arr[$v][] = $pv_arr;
}
*/
}
mysqli_free_result($res);
$opt_nosel_id_arr = array_diff(array_keys($opt_elev_arr), $opt_sel_id_arr);
// 保固延長<->電梯項次
$mn_arr = [];
$sql = "select id, item_spec, item_qty, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'D'";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
$mn_arr[$row[0]]["item_spec"] = $row[1];
$mn_arr[$row[0]]["item_qty"] = $row[2];
$tmp_arr = explode(",", $row[3]);
$mn_arr[$row[0]]["elev_no"] = $tmp_arr;
foreach ($tmp_arr as $v) {
$elev_arr[$v]["mn"][] = $row[0];
}
}
mysqli_free_result($res);
// 除外項目平均分到每台電梯
$exarr = [];
$ex_fee = $j = 0;
$sql = "select id, item_spec, item_price_bp from pricereview_item where mid = '$id' and item_group = 'E'";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
$exarr[$j][0] = $row[1];
$exarr[$j][1] = round($row[2]/$elev_qty_all, 0);
$ex_fee += $exarr[$j][1];
$j++;
}
mysqli_free_result($res);
//print_r($elev_arr);
//print_r($opt_elev_arr);
//print_r($opt_nosel_id_arr);
//print_r($mn_arr);
//print_r($ex_arr);exit;
foreach ($elev_arr as $item_no => $v) {
// 電梯MI
$sql2 = "select o.*, r.* from elevator_mi_option o, elevator_quotation_rule r "; $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 = '$etype' "; $sql2 .= "where o.quotation_no = r.quotation_no and o.elevator_type = '".$v['etype']."' ";
$sql2 .= "and ($item_weight between o.min_weight and o.max_weight) "; $sql2 .= "and ($v[item_weight] between o.min_weight and o.max_weight) ";
$sql2 .= "and ($floors between o.min_floors and o.max_floors) "; $sql2 .= "and ($v[floors] between o.min_floors and o.max_floors) ";
$sql2 .= "and ($speed between o.min_speed and o.max_speed) "; $sql2 .= "and ($v[speed] between o.min_speed and o.max_speed) ";
if ($etype == "MAQ100" || $etype == "MAP100") { if ($v["etype"] == "MAQ100" || $v["etype"] == "MAP100") {
$sql2 .= "and (o.model_no = '$persons') "; $sql2 .= "and (o.model_no = '".$v["persons"]."') ";
} }
$res_e = mysqli_query($link, $sql2); $res_e = mysqli_query($link, $sql2);
if ($row_e = mysqli_fetch_assoc($res_e)) { if ($row_e = mysqli_fetch_assoc($res_e)) {
// 基准采购成本+±1停材料费+设计费+出口费用 // 基准采购成本+±1停材料费+设计费+出口费用
$part1 = $row_e["purchase_cost"]+($floors-$row_e["base_floor"])*$row_e["material_plus"]+$row_e["design"]*$row_e["design_hour"]+$row_e["export_fee"]; $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"];
// 利潤 // 利潤
$profit = round($part1*$row_e["profit"]+$row_e["equip_profit"], 0); $profit = round($part1*$row_e["profit"]+$row_e["equip_profit"], 0);
// 設備 // 設備
@ -76,7 +165,7 @@ try {
// 安裝基價 // 安裝基價
$install_base = $row_e["install_price"]+$row_e["trial_price"]+$row_e["install_coef"]*$row_e["install_plus"]+$row_e["trial_coef"]*$row_e["trial_plus"]; $install_base = $row_e["install_price"]+$row_e["trial_price"]+$row_e["install_coef"]*$row_e["install_plus"]+$row_e["trial_coef"]*$row_e["trial_plus"];
// 安裝成本 // 安裝成本
$install_price = round($install_base+($row_e["install_plus"]+$row_e["trial_plus"])*($floors-$row_e["base_floor"]), 0); $install_price = round($install_base+($row_e["install_plus"]+$row_e["trial_plus"])*($v["floors"]-$row_e["base_floor"]), 0);
// 起吊+木箱+耗材 // 起吊+木箱+耗材
$woods = $row_e["crane"]+$row_e["wooden_box"]+$row_e["consume"]+$row_e["consumables"]; $woods = $row_e["crane"]+$row_e["wooden_box"]+$row_e["consume"]+$row_e["consumables"];
// MI // MI
@ -127,8 +216,55 @@ try {
// Option價格 // Option價格
$oparr = []; $oparr = [];
$option_fee = $j = 0; $option_fee = $j = 0;
$todo_opt_arr = $v["option"];
if (empty($todo_opt_arr)) $todo_opt_arr = $opt_nosel_id_arr;
if (!empty($todo_opt_arr)) {
foreach ($todo_opt_arr as $val) {
$sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment from option_mi o, elevator_quotation_rule r ";
$sql4 .= "where o.quotation_no = r.quotation_no and o.option_price_id = ".$opt_elev_arr[$val]["price_id"]." ";
$sql4 .= "and ($v[item_weight] between o.min_weight and o.max_weight) and o.open_kind = '".$v["item_op"]."'";
$res_om = mysqli_query($link, $sql4);
if ($row_om = mysqli_fetch_assoc($res_om)) {
$plus = ($v["floors"] > $row_om["base_floor"]) ? ($v["floors"] - $row_om["base_floor"])*$row_om["base_floor_plus"] : 0;
// 特例
if ($opt_elev_arr[$val]["price_id"] == "256" && ($v["floors"] < $row_om["base_floor"])) $row_om["price"] = 9815;
if ($opt_elev_arr[$val]["price_id"] == "266" && $v["floors"] >= 20) $plus += 44.8; // 15层,14.6元/层(19层内,跳20层再追加44.8元)
// 含此option的電梯總台數
$myelev_qty = 0;
foreach ($opt_elev_arr[$val]["elev_no"] as $pval) {
$myelev_qty += $elev_arr[$pval]["item_qty"];
}
// 分配:OPTION數量除以電梯總台數
$option_amt = round(0+($row_om["price"]+$plus)*($opt_elev_arr[$val]["item_qty"]/$myelev_qty)*$row_om["equipment"], 0);
$option_fee += $option_amt; // option總金額
$oparr[$j][1] = $option_amt;
} else {
$oparr[$j][1] = 0;
}
$oparr[$j][0] = $opt_elev_arr[$val]["item_spec"];
$j++;
}
}
// 保固延長
$mnarr = [];
$mn_fee = $j = 0;
if (!empty($v["mn"][0])) {
foreach ($v["mn"] as $val) {
$mn_amt = 0;
$mnarr[$j][0] = $mn_arr[$val]["item_spec"]."保養費";
$mnarr[$j][1] = $mn_amt;
$mn_fee += $mn_amt;
$j++;
}
}
/*
$sql3 = "select id, price_id, item_spec, item_qty from pricereview_item "; $sql3 = "select id, price_id, item_spec, item_qty from pricereview_item ";
$sql3 .= "where mid = '$id' and item_group = 'B' and option_relate_spec like '%".$item_spec."%' order by item_no"; $sql3 .= "where mid = '$id' and item_group = 'B' and option_relate_spec like '".$item_no.",%' order by item_no";
//echo $sql3;exit;
$res_b = mysqli_query($link, $sql3); $res_b = mysqli_query($link, $sql3);
while ($row_b = mysqli_fetch_assoc($res_b)) { while ($row_b = mysqli_fetch_assoc($res_b)) {
$sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment from option_mi o, elevator_quotation_rule r "; $sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment from option_mi o, elevator_quotation_rule r ";
@ -150,35 +286,42 @@ try {
mysqli_free_result($res_om); mysqli_free_result($res_om);
} }
mysqli_free_result($res_b); mysqli_free_result($res_b);
$mi_arr[$i][0] = $mi*$item_qty + $dismantle_fee + $polishing_fee + $option_fee;
/*
$mi_arr[$i][1] = $row_e["purchase_cost"];
$mi_arr[$i][2] = $row_e["material_plus"];
$mi_arr[$i][3] = $design_fee;
$mi_arr[$i][4] = $row_e["export_fee"];
$mi_arr[$i][5] = $profit_amt;
$mi_arr[$i][6] = $quotation;
*/ */
$mi_arr[$i][1] = 0+$equipment_ntd;
$mi_arr[$i][2] = 0+$customs; // 拆台數
$mi_arr[$i][3] = 0+$row_e["unloading"]; for ($n = 0; $n<$v["item_qty"]; $n++) {
$mi_arr[$i][4] = 0+$row_e["transport_site"]; $mi_arr[$i][0] = $mi + $dismantle_fee + $polishing_fee + $option_fee + $ex_fee + $mn_fee;
$mi_arr[$i][5] = 0+$install_price; /*
$mi_arr[$i][6] = 0+$row_e["free1y"]; $mi_arr[$i][1] = $row_e["purchase_cost"];
$mi_arr[$i][7] = 0+$woods; $mi_arr[$i][2] = $row_e["material_plus"];
$mi_arr[$i][8] = $row_e["equipment"]; $mi_arr[$i][3] = $design_fee;
$mi_arr[$i][9] = 0+$row_e["option_price"]; $mi_arr[$i][4] = $row_e["export_fee"];
$mi_arr[$i][10] = 0+$dismantle_fee; $mi_arr[$i][5] = $profit_amt;
$mi_arr[$i][11] = 0+$polishing_fee; $mi_arr[$i][6] = $quotation;
$mi_arr[$i][12] = $mi_arr[$i][1]+$mi_arr[$i][2]+$mi_arr[$i][3]+$mi_arr[$i][4]+$mi_arr[$i][5]+$mi_arr[$i][6]+$mi_arr[$i][7]+$mi_arr[$i][9]+$mi_arr[$i][10]+$mi_arr[$i][11]; */
$mi_arr[$i][13] = $option_fee; $mi_arr[$i][1] = 0+$equipment_ntd;
$mi_arr[$i][14] = $oparr; $mi_arr[$i][2] = 0+$customs;
$i++; $mi_arr[$i][3] = 0+$row_e["unloading"];
$mi_arr[$i][4] = 0+$row_e["transport_site"];
$mi_arr[$i][5] = 0+$install_price;
$mi_arr[$i][6] = 0+$row_e["free1y"];
$mi_arr[$i][7] = 0+$woods;
$mi_arr[$i][8] = $row_e["equipment"];
$mi_arr[$i][9] = 0+$row_e["option_price"];
$mi_arr[$i][10] = 0+$dismantle_fee;
$mi_arr[$i][11] = 0+$polishing_fee;
$mi_arr[$i][12] = $mi_arr[$i][1]+$mi_arr[$i][2]+$mi_arr[$i][3]+$mi_arr[$i][4]+$mi_arr[$i][5]+$mi_arr[$i][6]+$mi_arr[$i][7]+$mi_arr[$i][9]+$mi_arr[$i][10]+$mi_arr[$i][11];
$mi_arr[$i][13] = $option_fee+$ex_fee+$mn_fee;
$mi_arr[$i][14] = $oparr;
$mi_arr[$i][15] = 0+$ex_fee;
$mi_arr[$i][16] = $exarr;
$mi_arr[$i][17] = 0+$mn_fee;
$mi_arr[$i][18] = $mnarr;
$i++;
}
} }
mysqli_free_result($res_e); mysqli_free_result($res_e);
} }
mysqli_free_result($res);
$rarr["content"] = $mi_arr; $rarr["content"] = $mi_arr;
}catch(\Exception $e) { }catch(\Exception $e) {

52
wms/mkt/pricereview_renovate-check.php

@ -188,6 +188,7 @@ foreach ($res as $data) {
$mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp'];
$mn_arr[$row['item_no']]['note'] = $row['note']; $mn_arr[$row['item_no']]['note'] = $row['note'];
$mn_arr[$row['item_no']]['memo'] = $row['memo']; $mn_arr[$row['item_no']]['memo'] = $row['memo'];
$mn_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec'];
} elseif ($row['item_group'] == "E") { } elseif ($row['item_group'] == "E") {
$ex_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $ex_arr[$row['item_no']]['item_spec'] = $row['item_spec'];
$ex_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $ex_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price'];
@ -268,6 +269,12 @@ function getMI(id) {
Object.keys(data.content[k][14]).forEach(function(m){ Object.keys(data.content[k][14]).forEach(function(m){
mihtml += "<li>"+data.content[k][14][m][0]+":"+commafy(data.content[k][14][m][1])+"</li>"; mihtml += "<li>"+data.content[k][14][m][0]+":"+commafy(data.content[k][14][m][1])+"</li>";
}); });
Object.keys(data.content[k][16]).forEach(function(m){
mihtml += "<li>"+data.content[k][16][m][0]+":"+commafy(data.content[k][16][m][1])+"</li>";
});
Object.keys(data.content[k][18]).forEach(function(m){
mihtml += "<li>"+data.content[k][18][m][0]+":"+commafy(data.content[k][18][m][1])+"</li>";
});
mihtml += "以上合計:"+commafy(data.content[k][13])+"<br>"; mihtml += "以上合計:"+commafy(data.content[k][13])+"<br>";
$("#tb1").find("tr[name=facil_templ2]").eq(k).find('td').eq(1).html(mihtml); $("#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); //$("#tb1").find("input[name=mi_fix]").eq(k).closest('td').append(mihtml);
@ -279,7 +286,9 @@ function getMI(id) {
} }
$(function () { $(function () {
<?php if ($viewmi) { ?>
getMI('<?php echo $id; ?>'); getMI('<?php echo $id; ?>');
<?php } ?>
$(":input").prop("disabled", true); $(":input").prop("disabled", true);
$("#checker").prop("disabled", false); $("#checker").prop("disabled", false);
$("#status_n").prop("disabled", false); $("#status_n").prop("disabled", false);
@ -303,7 +312,7 @@ $(function () {
var pa = ''; var pa = '';
pa = '<?php echo $id; ?>'+','; pa = '<?php echo $id; ?>'+',';
pa += $(this).closest('td').prev().find('input[name=item_no]').val(); pa += $(this).closest('td').prev().find('input[name=item_no]').val();
var plink = '<iframe src="specsurvey-view.php?pa='+pa+'&noheader=1&<?php echo $token_link;?>" width="100%" height="500" frameborder="0" title=""></iframe>'; var plink = '<iframe src="specsurvey_renovate-view.php?pa='+pa+'&noheader=1&<?php echo $token_link;?>" width="100%" height="500" frameborder="0" title=""></iframe>';
$('.modal-footer').find('button').prop('disabled',false); $('.modal-footer').find('button').prop('disabled',false);
//$('.navbar').hide(); //$('.navbar').hide();
$("#specModal .modal-body").html(plink); $("#specModal .modal-body").html(plink);
@ -429,31 +438,43 @@ hr {
$idx = 1; $idx = 1;
foreach ($item_arr as $item_no => $val) { foreach ($item_arr as $item_no => $val) {
$item_amt_A_all += $val["item_price_bp"]; $item_amt_A_all += $val["item_price_bp"];
?> if ($viewmi) {
for ($i=0; $i<$val["item_qty"]; $i++) {
?>
<tr name="facil_templ"> <tr name="facil_templ">
<td><?php echo $idx; ?><input type="hidden" name="item_no" value="<?php echo $item_no; ?>"></td> <td><?php echo $idx; ?><input type="hidden" name="item_no" value="<?php echo $item_no; ?>"></td>
<td nowrap><a href="" data-toggle="modal"><?=$val["item_spec"];?> [規調]</a></td> <td nowrap><a href="" data-toggle="modal"><?=$val["item_spec"];?> [規調]</a></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td>
<td><input type="text" name="item_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" value="1"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_bp"]);?>"></td> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?=number_format($val["item_unit_price"]);?>"></td>
<?php if ($viewmi) { ?>
<td><input type="text" name="mi_fix" class="form-control dollar-right" size="9" value="<?php echo ($val["mi_fix"]) ? number_format($val["mi_fix"]) : ""; ?>"></td> <td><input type="text" name="mi_fix" class="form-control dollar-right" size="9" value="<?php echo ($val["mi_fix"]) ? number_format($val["mi_fix"]) : ""; ?>"></td>
<td><input type="text" name="item_price_ct" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_ct"]);?>"></td> <td><input type="text" name="item_price_ct" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_ct"]/$val["item_qty"]);?>"></td>
<!--<td><input type="text" name="item_price" class="form-control dollar-right" size="8" value="<?php echo ($val["item_price"]) ? number_format($val["item_price"]) : ""; ?>"></td> <!--<td><input type="text" name="item_price" class="form-control dollar-right" size="8" value="<?php echo ($val["item_price"]) ? number_format($val["item_price"]) : ""; ?>"></td>
<td><input type="text" name="pv_rate" class="form-control" size="1" value="<?=$val["pv_rate"];?>"></td> <td><input type="text" name="pv_rate" class="form-control" size="1" value="<?=$val["pv_rate"];?>"></td>
<td><input type="text" name="allocate" class="form-control" size="6" value="<?=$val["allocate"];?>"></td>--> <td><input type="text" name="allocate" class="form-control" size="6" value="<?=$val["allocate"];?>"></td>-->
<td><input type="text" name="gross_profit" class="form-control dollar-right" size="9" value="<?=number_format($val["gross_profit"]);?>"></td> <td><input type="text" name="gross_profit" class="form-control dollar-right" size="9" value="<?=number_format($val["gross_profit"]);?>"></td>
<td><input type="text" name="gross_profit_rate" class="form-control" size="6" value="<?=number_format($val["gross_profit_rate"], 1);?>"></td> <td><input type="text" name="gross_profit_rate" class="form-control" size="6" value="<?=number_format($val["gross_profit_rate"], 1);?>"></td>
<!--<td><input type="text" name="note" class="form-control" size="17" value="<?=$val["note"];?>"></td>--> <!--<td><input type="text" name="note" class="form-control" size="17" value="<?=$val["note"];?>"></td>-->
<?php } ?>
</tr> </tr>
<?php if ($viewmi) { ?>
<tr name="facil_templ2"> <tr name="facil_templ2">
<td colspan="5"></td> <td colspan="5"></td>
<td colspan="4"></td> <td colspan="4"></td>
</tr> </tr>
<?php } ?>
<?php <?php
} #item_qty end.
} else {
?>
<tr name="facil_templ">
<td><?php echo $idx; ?><input type="hidden" name="item_no" value="<?php echo $item_no; ?>"></td>
<td nowrap><a href="" data-toggle="modal"><?=$val["item_spec"];?> [規調]</a></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td>
<td><input type="text" name="item_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?=number_format($val["item_price_bp"]);?>"></td>
</tr>
<?php
}
$idx++; $idx++;
} }
?> ?>
@ -480,7 +501,7 @@ hr {
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th>所屬電梯</th> <th>所屬電梯項次</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -497,7 +518,7 @@ hr {
<td><input type="text" name="option_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td> <td><input type="text" name="option_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td>
<td><input type="text" name="option_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td> <td><input type="text" name="option_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td>
<td><input type="text" name="option_memo" class="form-control" size="20" value="<?=$val["memo"];?>"></td> <td><input type="text" name="option_memo" class="form-control" size="20" value="<?=$val["memo"];?>"></td>
<td><?php echo str_replace(",", "<br>", $val["option_relate_spec"]); ?></td> <td><?php echo $val["option_relate_spec"]; ?></td>
</tr> </tr>
<?php <?php
$idx++; $idx++;
@ -561,7 +582,7 @@ hr {
<table id="tb3" class="table table-bordered"> <table id="tb3" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9">保固延長</th> <th colspan="10">保固延長</th>
</tr> </tr>
<tr> <tr>
<th nowrap>項次</th> <th nowrap>項次</th>
@ -573,6 +594,7 @@ hr {
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th>所屬電梯項次</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -593,7 +615,8 @@ hr {
<td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td> <td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" value="<?=number_format($val["item_unit_price"]);?>"></td>
<td><input type="text" name="mn_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td> <td><input type="text" name="mn_qty" class="form-control" size="2" value="<?=number_format($val["item_qty"]);?>"></td>
<td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td> <td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?=number_format($val["item_price_bp"]);?>"></td>
<td><input type="text" name="mn_memo" class="form-control" size="30" value="<?=$val["memo"];?>"></td> <td><input type="text" name="mn_memo" class="form-control" size="20" value="<?=$val["memo"];?>"></td>
<td><?php echo $val["option_relate_spec"]; ?></td>
</tr> </tr>
<?php <?php
$idx++; $idx++;
@ -601,7 +624,8 @@ hr {
?> ?>
<tr> <tr>
<td colspan="7">小計</td> <td colspan="7">小計</td>
<td colspan="2"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" value="<?=number_format($item_amt_D_all);?>"></td> <td><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" value="<?=number_format($item_amt_D_all);?>"></td>
<td colspan="2"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

117
wms/mkt/pricereview_renovate-create.php

@ -410,7 +410,7 @@ function selFacil(o) {
fp.find('input[name=item_spec]').val(data.model); fp.find('input[name=item_spec]').val(data.model);
fp.find('input[name=item_weight]').val(data.weight); fp.find('input[name=item_weight]').val(data.weight);
fp.find('input[name=item_group]').val(data.group); fp.find('input[name=item_group]').val(data.group);
fp.find('input[name=item_price]').val(data.iamt.substr(1)*fp.find('input[name=item_qty]').val()); //fp.find('input[name=item_price]').val(data.iamt.substr(1)*fp.find('input[name=item_qty]').val());
//fp.find('input[name=gross_profit]').val(($('#price_total').val().replace(/[,]+/g,"")-data.iamt.substr(1))*fp.find('input[name=item_qty]').val()); //fp.find('input[name=gross_profit]').val(($('#price_total').val().replace(/[,]+/g,"")-data.iamt.substr(1))*fp.find('input[name=item_qty]').val());
fp.find('input[name=gross_profit]').val(fp.find('input[name=item_price]').val()); fp.find('input[name=gross_profit]').val(fp.find('input[name=item_price]').val());
dataFormat(); dataFormat();
@ -603,7 +603,7 @@ $(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
dataFormat(); dataFormat();
}); });
$('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price]', function(){ $('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price], input[name=item_price_ct]', function(){
//$("input[name='item_price']").keyup(function(){ //$("input[name='item_price']").keyup(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
//}); //});
@ -673,6 +673,7 @@ $(function(){
}); });
$('#btnadd4').click(function(){ $('#btnadd4').click(function(){
$('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end()); $('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end());
$('#tb4 tr:last').prev().find('td[name=mn_relate_facil]').html('');
//$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length);
//$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length);
}); });
@ -741,15 +742,17 @@ $(function(){
$('#tb2').on('click', 'a[name=btnfaci]', function(){ $('#tb2').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') { if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') {
var k=1;
$("input[name=item_spec]").each(function(){ $("input[name=item_spec]").each(function(){
if ($(this).val() == '') return; if ($(this).val() == '') return;
var objInput = document.createElement("input"); var objInput = document.createElement("input");
objInput.setAttribute("type", "checkbox"); objInput.setAttribute("type", "checkbox");
objInput.setAttribute("name", "sub_faci"); objInput.setAttribute("name", "sub_faci");
objInput.setAttribute("value", $(this).val()); objInput.setAttribute("value", k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append(objInput); $("#optionFaciModal .modal-body").append(objInput);
$("#optionFaciModal .modal-body").append($(this).val()); $("#optionFaciModal .modal-body").append(k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append("<br>"); $("#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-body").append("<p><button type='button' name='btnpost' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>確定</span></button></p>");
$("#optionFaciModal").modal('show'); $("#optionFaciModal").modal('show');
@ -763,11 +766,44 @@ $(function(){
jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str); jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str);
}); });
} else { } else {
alert("請先新增OPTION"); alert("請先新增OPTION");
return false; return false;
} }
$("input[name=pay_scale]").keyup(function(){
}); });
$('#tb4').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') {
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", $(this).val()+"#"+$(this).closest('td').parent().find('input[name=item_qty]').val());
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=mn_relate_facil]').html(str);
});
} else {
alert("請先在左測下拉欲保固延長的電梯");
jobj.closest('td').parent().find('select[name=mn_kind]').eq(0).focus();
return false;
}
});
$("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[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g,"")/100*$(this).val()).toFixed(0)));
var payAllScale = 0; var payAllScale = 0;
var payAllAmt = 0; var payAllAmt = 0;
@ -970,6 +1006,9 @@ $(function(){
var mnMemoArr = []; var mnMemoArr = [];
$("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); }) $("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); })
$('#mn_memo_all').val(mnMemoArr); $('#mn_memo_all').val(mnMemoArr);
var mnRelateFacilArr = [];
$("td[name='mn_relate_facil']").each(function(){ mnRelateFacilArr.push($(this).html()); })
$('#mn_relate_facil_all').val(mnRelateFacilArr);
var exNoteArr = []; var exNoteArr = [];
$("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); }) $("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); })
$('#except_note_all').val(exNoteArr); $('#except_note_all').val(exNoteArr);
@ -1008,13 +1047,25 @@ $(function(){
var rv = true; var rv = true;
$("td[name='option_relate_facil']").each(function(){ $("td[name='option_relate_facil']").each(function(){
if ($(this).html() == "") { if ($(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。"); if (!confirm("【所屬電梯】資料空白!\n確認要送出?")) {
location.href = '#btnadd2'; //alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。");
return rv = false; location.href = '#btnadd2';
return rv = false;
}
} }
}); });
if ((rv === false)) return rv; if ((rv === false)) return rv;
var rv2 = true;
$("td[name='mn_relate_facil']").each(function(){
if ($(this).closest('td').parent().find('select[name=mn_kind').val() != '' && $(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至 保固延長區 點選紅色按鈕「電梯」並勾選項目。");
location.href = '#btnadd4';
return rv2 = false;
}
});
if ((rv2 === false)) return rv2;
if ($("#pay_all_amount").val() != $("#price_total").val()) { if ($("#pay_all_amount").val() != $("#price_total").val()) {
alert("【付款辦法】金額合計有誤!"); alert("【付款辦法】金額合計有誤!");
$("input[name=pay_scale]").eq(0).trigger( "focus" ); $("input[name=pay_scale]").eq(0).trigger( "focus" );
@ -1128,7 +1179,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<table id="tb1" class="table table-bordered"> <table id="tb1" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th> <th colspan="10">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<!--<th nowrap>項次</th>--> <!--<th nowrap>項次</th>-->
@ -1137,10 +1188,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<th>停數</th> <th>停數</th>
<th>速度</th> <th>速度</th>
<th>開門方式</th> <th>開門方式</th>
<th>規格</th> <th class="star">規格</th>
<th>單價</th> <th>單價</th>
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>售價</th>
<!-- <!--
<th style="width:11%">金額(含稅)</th> <th style="width:11%">金額(含稅)</th>
<th>價審%</th> <th>價審%</th>
@ -1341,7 +1393,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option> <option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option>
<option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option> <option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option>
<option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option> <option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option>
@ -1352,10 +1404,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="item_spec" class="form-control" value="<?php echo $v["item_spec"]; ?>" readonly></td> <td><input type="text" name="item_spec" class="form-control" value="<?php echo $v["item_spec"]; ?>" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%;" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>" required>
<input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"> <input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id">
<input type="hidden" name="item_price"><input type="hidden" name="gross_profit"> <input type="hidden" name="item_price"><input type="hidden" name="gross_profit">
<input type="hidden" name="item_price_ct" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>">
<input type="hidden" name="item_weight"> <input type="hidden" name="item_weight">
<a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1555,7 +1607,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO"<?php if ($v["op"]=="CO") echo " selected"; ?>>CO</option> <option value="CO"<?php if ($v["op"]=="CO") echo " selected"; ?>>CO</option>
<option value="2S"<?php if ($v["op"]=="2S") echo " selected"; ?>>2S</option> <option value="2S"<?php if ($v["op"]=="2S") echo " selected"; ?>>2S</option>
<option value="2U"<?php if ($v["op"]=="2U") echo " selected"; ?>>2U</option> <option value="2U"<?php if ($v["op"]=="2U") echo " selected"; ?>>2U</option>
@ -1566,10 +1618,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="item_spec" class="form-control" readonly></td> <td><input type="text" name="item_spec" class="form-control" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo $v["spec_price"]; ?>" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo $v["spec_price"]; ?>" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["spec_num"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["spec_num"]; ?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["spec_num"]; ?>"><input type="hidden" name="item_qty_ori" value="<?php echo $v["spec_num"]; ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%;" value="<?php echo number_format($v["spec_price"]*$v["spec_num"]); ?>" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" value="<?php echo number_format($v["spec_price"]*$v["spec_num"]); ?>" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>" required>
<input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"> <input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id">
<input type="hidden" name="item_price"><input type="hidden" name="gross_profit"> <input type="hidden" name="item_price"><input type="hidden" name="gross_profit">
<input type="hidden" name="item_price_ct" value="<?php echo $v["spec_price"]*$v["spec_num"]; ?>">
<input type="hidden" name="item_weight"> <input type="hidden" name="item_weight">
<a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1663,7 +1715,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO">CO</option> <option value="CO">CO</option>
<option value="2S">2S</option> <option value="2S">2S</option>
<option value="2U">2U</option> <option value="2U">2U</option>
@ -1674,10 +1726,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<td><input type="text" name="item_spec" class="form-control" readonly></td> <td><input type="text" name="item_spec" class="form-control" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%;" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" required>
<input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"> <input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id">
<input type="hidden" name="item_price"><input type="hidden" name="gross_profit"> <input type="hidden" name="item_price"><input type="hidden" name="gross_profit">
<input type="hidden" name="item_price_ct" value="<?php if (isset($v["spec_price"]) && isset($v["spec_num"])) echo $v["spec_price"]*$v["spec_num"]; else echo '0'; ?>">
<input type="hidden" name="item_weight"> <input type="hidden" name="item_weight">
<a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1688,7 +1740,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?> ?>
<tr> <tr>
<td colspan="8">小計</td> <td colspan="8">小計</td>
<td><input type="text" name="amt" id="amt" class="form-control dollar-right" style="width:80%;" readonly></td> <td colspan="2"><input type="text" name="amt" id="amt" class="form-control dollar-right" size="12" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1706,7 +1758,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯規格">所屬電梯 <th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" /> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
@ -1807,7 +1859,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td> <td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td>
<td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>" readonly></td> <td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>" readonly></td>
<td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td> <td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td>
<td><input type="text" name="except_qty" class="form-control" size="2" maxlength="2" 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="btndel3" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a>
@ -1821,7 +1873,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="except_note" class="form-control"></td> <td><input type="text" name="except_note" class="form-control"></td>
<td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td> <td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td>
<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="2" maxlength="2"></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="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>
@ -1841,7 +1893,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<table id="tb4" class="table table-bordered"> <table id="tb4" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="8">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th> <th colspan="10">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<th>電梯</th> <th>電梯</th>
@ -1852,6 +1904,8 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star">所屬電梯</div></th>
<th>功能</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -1865,6 +1919,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<select name="mn_kind" class="form-control"> <select name="mn_kind" class="form-control">
<option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option> <option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option>
<option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option> <option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option>
<option value="MAH100"<?php if ($v['item_spec']=="MAH100") echo " selected"; ?>>MAH100小電梯</option>
<option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option> <option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option>
<option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option> <option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option>
<option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option> <option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option>
@ -1910,7 +1965,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly> <td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly>
<input type="hidden" name="mn_id"> <input type="hidden" name="mn_id">
</td> </td>
<td><input type="text" name="mn_memo" class="form-control" size="30"> <td><input type="text" name="mn_memo" class="form-control" size="20"></td>
<td name="mn_relate_facil" nowrap></td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1924,6 +1981,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option> <option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option> <option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option> <option value="MAF100">MAF100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強驅梯</option> <option value="MAQ100">MAQ100強驅梯</option>
<option value="MAP100">MAP100平台梯</option> <option value="MAP100">MAP100平台梯</option>
@ -1965,7 +2023,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" readonly></td> <td><input type="text" name="mn_unit_price" class="form-control dollar-right" size="8" readonly></td>
<td><input type="text" name="mn_qty" class="form-control" size="2" maxlength="2"></td> <td><input type="text" name="mn_qty" class="form-control" size="2" maxlength="2"></td>
<td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" readonly><input type="hidden" name="mn_id"></td> <td><input type="text" name="mn_price_bp" class="form-control dollar-right" size="8" readonly><input type="hidden" name="mn_id"></td>
<td><input type="text" name="mn_memo" class="form-control" size="30"> <td><input type="text" name="mn_memo" class="form-control" size="20"></td>
<td name="mn_relate_facil" nowrap></td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1974,7 +2034,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
?> ?>
<tr> <tr>
<td colspan="6">小計</td> <td colspan="6">小計</td>
<td colspan="2"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td> <td colspan="4"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -2354,6 +2414,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<input type="hidden" name="mn_qty_all" id="mn_qty_all"> <input type="hidden" name="mn_qty_all" id="mn_qty_all">
<input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all"> <input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all">
<input type="hidden" name="mn_memo_all" id="mn_memo_all"> <input type="hidden" name="mn_memo_all" id="mn_memo_all">
<input type="hidden" name="mn_relate_facil_all" id="mn_relate_facil_all">
<input type="hidden" name="except_note_all" id="except_note_all"> <input type="hidden" name="except_note_all" id="except_note_all">
<input type="hidden" name="except_spec_all" id="except_spec_all"> <input type="hidden" name="except_spec_all" id="except_spec_all">
<input type="hidden" name="except_unit_price_all" id="except_unit_price_all"> <input type="hidden" name="except_unit_price_all" id="except_unit_price_all">

130
wms/mkt/pricereview_renovate-edit.php

@ -55,6 +55,7 @@ foreach ($res as $data) {
$mn_arr[$row['item_no']]['id'] = $row['id']; $mn_arr[$row['item_no']]['id'] = $row['id'];
$mn_arr[$row['item_no']]['mn_id'] = $row['price_id']; $mn_arr[$row['item_no']]['mn_id'] = $row['price_id'];
$mn_arr[$row['item_no']]['item_spec'] = $row['item_spec']; $mn_arr[$row['item_no']]['item_spec'] = $row['item_spec'];
$mn_arr[$row['item_no']]['option_relate_spec'] = $row['option_relate_spec'];
$mn_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price']; $mn_arr[$row['item_no']]['item_unit_price'] = $row['item_unit_price'];
$mn_arr[$row['item_no']]['item_qty'] = $row['item_qty']; $mn_arr[$row['item_no']]['item_qty'] = $row['item_qty'];
$mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp']; $mn_arr[$row['item_no']]['item_price_bp'] = $row['item_price_bp'];
@ -583,7 +584,7 @@ $(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
dataFormat(); dataFormat();
}); });
$('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price]', function(){ $('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price], input[name=item_price_ct]', function(){
//$("input[name='item_price']").keyup(function(){ //$("input[name='item_price']").keyup(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
//}); //});
@ -658,6 +659,7 @@ $(function(){
}); });
$('#btnadd4').click(function(){ $('#btnadd4').click(function(){
$('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end()); $('#tb4 tr:last').prev().after($("tr[name='maintain_templ']").last().clone().find('input,select').val('').end());
$('#tb4 tr:last').prev().find('td[name=mn_relate_facil]').html('');
$("tr[name='maintain_templ']").last().find('input[name=mn_act]').val('I'); $("tr[name='maintain_templ']").last().find('input[name=mn_act]').val('I');
//$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').first().html($("tr[name='maintain_templ']").length);
//$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length); //$('#tb4 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='maintain_templ']").length);
@ -710,15 +712,17 @@ $(function(){
$('#tb2').on('click', 'a[name=btnfaci]', function(){ $('#tb2').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') { if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') {
var k=1;
$("input[name=item_spec]").each(function(){ $("input[name=item_spec]").each(function(){
if ($(this).val() == '') return; if ($(this).val() == '') return;
var objInput = document.createElement("input"); var objInput = document.createElement("input");
objInput.setAttribute("type", "checkbox"); objInput.setAttribute("type", "checkbox");
objInput.setAttribute("name", "sub_faci"); objInput.setAttribute("name", "sub_faci");
objInput.setAttribute("value", $(this).val()); objInput.setAttribute("value", k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append(objInput); $("#optionFaciModal .modal-body").append(objInput);
$("#optionFaciModal .modal-body").append($(this).val()); $("#optionFaciModal .modal-body").append(k+'.'+$(this).val());
$("#optionFaciModal .modal-body").append("<br>"); $("#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-body").append("<p><button type='button' name='btnpost' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>確定</span></button></p>");
$("#optionFaciModal").modal('show'); $("#optionFaciModal").modal('show');
@ -732,7 +736,40 @@ $(function(){
jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str); jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str);
}); });
} else { } else {
alert("請先新增OPTION。"); alert("請先新增OPTION");
return false;
}
});
$('#tb4').on('click', 'a[name=btnfaci]', function(){
var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') {
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", $(this).val()+"#"+$(this).closest('td').parent().find('input[name=item_qty]').val());
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=mn_relate_facil]').html(str);
});
} else {
alert("請先在左測下拉欲保固延長的電梯");
jobj.closest('td').parent().find('select[name=mn_kind]').eq(0).focus();
return false; return false;
} }
}); });
@ -776,7 +813,7 @@ $(function(){
} }
}*/ }*/
$('#tb4').on('click', 'a[name=btndel4]', function(){ $('#tb4').on('click', 'a[name=btndel4]', function(){
var oriID = $(this).parent().prev().find('input[name=mn_item]').val(); // 被刪除的ID var oriID = $(this).parent().parent().find('input[name=mn_item]').val(); // 被刪除的ID
if ($('tr[name=maintain_templ]').length > 1) $(this).closest('tr').remove(); if ($('tr[name=maintain_templ]').length > 1) $(this).closest('tr').remove();
if ($('tr[name=maintain_templ]').length == 1) $(this).closest('tr').find('input,select').val('').end(); if ($('tr[name=maintain_templ]').length == 1) $(this).closest('tr').find('input,select').val('').end();
$('#mn_del').val($('#mn_del').val()+oriID+','); $('#mn_del').val($('#mn_del').val()+oriID+',');
@ -917,7 +954,7 @@ $(function(){
$("input[name='option_memo']").each(function(){ optionMemoArr.push($(this).val()+"@@"); }) $("input[name='option_memo']").each(function(){ optionMemoArr.push($(this).val()+"@@"); })
$('#option_memo_all').val(optionMemoArr); $('#option_memo_all').val(optionMemoArr);
var optionRelateFacilArr = []; var optionRelateFacilArr = [];
$("td[name='option_relate_facil']").each(function(){ optionRelateFacilArr.push($(this).html()); }) $("td[name='option_relate_facil']").each(function(){ optionRelateFacilArr.push($(this).html().trim()); })
$('#option_relate_facil_all').val(optionRelateFacilArr); $('#option_relate_facil_all').val(optionRelateFacilArr);
var mnIdArr = []; var mnIdArr = [];
$("input[name='mn_id']").each(function(){ mnIdArr.push($(this).val()); }) $("input[name='mn_id']").each(function(){ mnIdArr.push($(this).val()); })
@ -946,6 +983,9 @@ $(function(){
var mnMemoArr = []; var mnMemoArr = [];
$("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); }) $("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); })
$('#mn_memo_all').val(mnMemoArr); $('#mn_memo_all').val(mnMemoArr);
var mnRelateFacilArr = [];
$("td[name='mn_relate_facil']").each(function(){ mnRelateFacilArr.push($(this).html()); })
$('#mn_relate_facil_all').val(mnRelateFacilArr);
var exNoteArr = []; var exNoteArr = [];
$("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); }) $("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); })
$('#except_note_all').val(exNoteArr); $('#except_note_all').val(exNoteArr);
@ -1014,13 +1054,25 @@ $(function(){
var rv = true; var rv = true;
$("td[name='option_relate_facil']").each(function(){ $("td[name='option_relate_facil']").each(function(){
if ($(this).html() == "") { if ($(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。"); if (!confirm("【所屬電梯】資料空白!\n確認要送出?")) {
location.href = '#btnadd2'; //alert("【所屬電梯】資料空白!\n請至OPTION加價區塊點選紅色按鈕「電梯」並勾選項目。");
return rv = false; location.href = '#btnadd2';
return rv = false;
}
} }
}); });
if ((rv === false)) return rv; if ((rv === false)) return rv;
var rv2 = true;
$("td[name='mn_relate_facil']").each(function(){
if ($(this).closest('td').parent().find('select[name=mn_kind').val() != '' && $(this).html() == "") {
alert("【所屬電梯】資料空白!\n請至 保固延長區 點選紅色按鈕「電梯」並勾選項目。");
location.href = '#btnadd4';
return rv2 = false;
}
});
if ((rv2 === false)) return rv2;
if ($("#pay_all_amount").val() != $("#price_total").val()) { if ($("#pay_all_amount").val() != $("#price_total").val()) {
alert("【付款辦法】金額合計有誤!"); alert("【付款辦法】金額合計有誤!");
$("input[name=pay_scale]").eq(0).trigger( "focus" ); $("input[name=pay_scale]").eq(0).trigger( "focus" );
@ -1101,7 +1153,7 @@ $(function(){
<table id="tb1" class="table table-bordered"> <table id="tb1" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th> <th colspan="10">整機單價<a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<th>電梯</th> <th>電梯</th>
@ -1109,10 +1161,11 @@ $(function(){
<th>停數</th> <th>停數</th>
<th>速度</th> <th>速度</th>
<th>開門方式</th> <th>開門方式</th>
<th>規格</th> <th class="star">規格</th>
<th>單價</th> <th>單價</th>
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>售價</th>
<!-- <!--
<th style="width:11%">金額(含稅)</th> <th style="width:11%">金額(含稅)</th>
<th>價審%</th> <th>價審%</th>
@ -1208,7 +1261,7 @@ $(function(){
</select> </select>
</td> </td>
<td> <td>
<select name="item_op" class="form-control"> <select name="item_op" class="form-control" required>
<option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option> <option value="CO"<?php if ($v["item_op"]=="CO") echo " selected"; ?>>CO</option>
<option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option> <option value="2S"<?php if ($v["item_op"]=="2S") echo " selected"; ?>>2S</option>
<option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option> <option value="2U"<?php if ($v["item_op"]=="2U") echo " selected"; ?>>2U</option>
@ -1219,12 +1272,12 @@ $(function(){
<td><input type="text" name="item_spec" class="form-control" value="<?php echo $v['item_spec']; ?>" readonly></td> <td><input type="text" name="item_spec" class="form-control" value="<?php echo $v['item_spec']; ?>" readonly></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v['item_unit_price']); ?>" readonly></td> <td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v['item_unit_price']); ?>" readonly></td>
<td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v['item_qty']; ?>"></td> <td><input type="text" name="item_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v['item_qty']; ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" style="width:80%" value="<?php echo number_format($v['item_price_bp']); ?>" readonly> <td><input type="text" name="item_price_bp" class="form-control dollar-right" size="12" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly></td>
<td nowrap><input type="text" name="item_price_ct" class="form-control dollar-right" size="12" value="<?php echo number_format($v["item_price_ct"]); ?>" required>
<input type="hidden" name="item_group" value="A"> <input type="hidden" name="item_group" value="A">
<input type="hidden" name="fp_id" value="<?php echo $v['fp_id']; ?>"> <input type="hidden" name="fp_id" value="<?php echo $v['fp_id']; ?>">
<input type="hidden" name="item_price" value="<?php echo $v['item_price']; ?>"> <input type="hidden" name="item_price" value="<?php echo $v['item_price']; ?>">
<input type="hidden" name="gross_profit" value="<?php echo $v['gross_profit']; ?>"> <input type="hidden" name="gross_profit" value="<?php echo $v['gross_profit']; ?>">
<input type="hidden" name="item_price_ct" value="<?php echo $v['item_price_ct']; ?>">
<input type="hidden" name="fp_item" value="<?php echo $v['id']; ?>"> <input type="hidden" name="fp_item" value="<?php echo $v['id']; ?>">
<input type="hidden" name="fp_act" value="U"> <input type="hidden" name="fp_act" value="U">
<input type="hidden" name="item_weight" value="<?php echo $v['item_weight']; ?>"> <input type="hidden" name="item_weight" value="<?php echo $v['item_weight']; ?>">
@ -1237,7 +1290,7 @@ $(function(){
?> ?>
<tr> <tr>
<td colspan="8">小計</td> <td colspan="8">小計</td>
<td><input type="text" name="amt" id="amt" class="form-control dollar-right" style="width:80%" readonly></td> <td colspan="2"><input type="text" name="amt" id="amt" class="form-control dollar-right" size="12" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1255,7 +1308,7 @@ $(function(){
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯規格">所屬電梯 <th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" /> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
@ -1282,7 +1335,18 @@ $(function(){
<input type="hidden" name="op_act" value="U"> <input type="hidden" name="op_act" value="U">
</td> </td>
<td><input type="text" name="option_memo" class="form-control" size="20" value="<?php echo $v['memo']; ?>"></td> <td><input type="text" name="option_memo" class="form-control" size="20" value="<?php echo $v['memo']; ?>"></td>
<td name="option_relate_facil"><?php echo str_replace(",", "<br>", $v['option_relate_spec']); ?></td> <td name="option_relate_facil">
<?php
if (!empty($v['option_relate_spec'])) {
$tmp_arr = explode(",", $v['option_relate_spec']);
foreach ($tmp_arr as $val) {
if (!empty($item_arr[$val]['item_spec'])) {
echo $val.".".$item_arr[$val]['item_spec']."<br>";
}
}
}
?>
</td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a> <td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel2" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel2" class="btn btn-danger btn-sm">X</a>
</td> </td>
@ -1343,7 +1407,7 @@ $(function(){
<td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td> <td><input type="text" name="except_note" class="form-control" value="<?php echo $v["note"]; ?>"></td>
<td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>"></td> <td><input type="text" name="except_spec" class="form-control" size="width:30em;" value="<?php echo $v["item_spec"]; ?>"></td>
<td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>"></td> <td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>"></td>
<td><input type="text" name="except_qty" class="form-control" size="2" maxlength="2" 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">
<input type="hidden" name="except_item" value="<?php echo $v['id']; ?>"> <input type="hidden" name="except_item" value="<?php echo $v['id']; ?>">
@ -1359,7 +1423,7 @@ $(function(){
<td><input type="text" name="except_note" class="form-control"></td> <td><input type="text" name="except_note" class="form-control"></td>
<td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td> <td><input type="text" name="except_spec" style="width:30em;" class="form-control"></td>
<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="2" maxlength="2"></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>
<input type="hidden" name="except_item"> <input type="hidden" name="except_item">
<input type="hidden" name="except_act" value="I"> <input type="hidden" name="except_act" value="I">
@ -1381,7 +1445,7 @@ $(function(){
<table id="tb4" class="table table-bordered"> <table id="tb4" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="8">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th> <th colspan="10">保固延長<a href="javascript:void(0);" id="btnadd4" class="btn btn-primary btn-sm"></a></th>
</tr> </tr>
<tr> <tr>
<th>電梯</th> <th>電梯</th>
@ -1392,6 +1456,8 @@ $(function(){
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star">所屬電梯</div></th>
<th>功能</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -1407,6 +1473,7 @@ $(function(){
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option> <option value="MAE100"<?php if ($v['item_spec']=="MAE100") echo " selected"; ?>>MAE100有機房</option>
<option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option> <option value="MAM200"<?php if ($v['item_spec']=="MAM200") echo " selected"; ?>>MAM200無機房</option>
<option value="MAH100"<?php if ($v['item_spec']=="MAH100") echo " selected"; ?>>MAH100小電梯</option>
<option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option> <option value="MAF100"<?php if ($v['item_spec']=="MAF100") echo " selected"; ?>>MAF100貨梯(有機房)</option>
<option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option> <option value="MAQ100"<?php if ($v['item_spec']=="MAQ100") echo " selected"; ?>>MAQ100強驅梯</option>
<option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option> <option value="MAP100"<?php if ($v['item_spec']=="MAP100") echo " selected"; ?>>MAP100平台梯</option>
@ -1456,7 +1523,20 @@ $(function(){
<input type="hidden" name="mn_item" value="<?php echo $v['id']; ?>"> <input type="hidden" name="mn_item" value="<?php echo $v['id']; ?>">
<input type="hidden" name="mn_act" value="U"> <input type="hidden" name="mn_act" value="U">
</td> </td>
<td><input type="text" name="mn_memo" class="form-control" size="30" value="<?php echo $v['memo']; ?>"> <td><input type="text" name="mn_memo" class="form-control" size="20" value="<?php echo $v['memo']; ?>"></td>
<td name="mn_relate_facil" nowrap>
<?php
if (!empty($v['option_relate_spec'])) {
$tmp_arr = explode(",", $v['option_relate_spec']);
foreach ($tmp_arr as $val) {
if (!empty($item_arr[$val]['item_spec'])) {
echo $val.".".$item_arr[$val]['item_spec']."<br>";
}
}
}
?>
</td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1470,6 +1550,7 @@ $(function(){
<option value="">請選擇</option> <option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option> <option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option> <option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option> <option value="MAF100">MAF100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強驅梯</option> <option value="MAQ100">MAQ100強驅梯</option>
<option value="MAP100">MAP100平台梯</option> <option value="MAP100">MAP100平台梯</option>
@ -1513,7 +1594,9 @@ $(function(){
<input type="hidden" name="mn_item"> <input type="hidden" name="mn_item">
<input type="hidden" name="mn_act" value="I"> <input type="hidden" name="mn_act" value="I">
</td> </td>
<td><input type="text" name="mn_memo" class="form-control" size="30"> <td><input type="text" name="mn_memo" class="form-control" size="20"></td>
<td name="mn_relate_facil" nowrap></td>
<td nowrap><a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel4" class="btn btn-danger btn-sm">X</a>
</td> </td>
</tr> </tr>
@ -1522,7 +1605,7 @@ $(function(){
?> ?>
<tr> <tr>
<td colspan="6">小計</td> <td colspan="6">小計</td>
<td colspan="2"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td> <td colspan="4"><input type="text" name="mn_amt" id="mn_amt" class="form-control dollar-right" size="8" readonly></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1920,6 +2003,7 @@ $(function(){
<input type="hidden" name="mn_qty_all" id="mn_qty_all"> <input type="hidden" name="mn_qty_all" id="mn_qty_all">
<input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all"> <input type="hidden" name="mn_price_bp_all" id="mn_price_bp_all">
<input type="hidden" name="mn_memo_all" id="mn_memo_all"> <input type="hidden" name="mn_memo_all" id="mn_memo_all">
<input type="hidden" name="mn_relate_facil_all" id="mn_relate_facil_all">
<input type="hidden" name="except_note_all" id="except_note_all"> <input type="hidden" name="except_note_all" id="except_note_all">
<input type="hidden" name="except_spec_all" id="except_spec_all"> <input type="hidden" name="except_spec_all" id="except_spec_all">
<input type="hidden" name="except_unit_price_all" id="except_unit_price_all"> <input type="hidden" name="except_unit_price_all" id="except_unit_price_all">

22
wms/mkt/pricereview_renovate-record-submit.php

@ -198,11 +198,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$option_unit_price_arr[$i] = str_replace(",", "", $option_unit_price_arr[$i]); $option_unit_price_arr[$i] = str_replace(",", "", $option_unit_price_arr[$i]);
$option_qty_arr[$i] = str_replace(",", "", $option_qty_arr[$i]); $option_qty_arr[$i] = str_replace(",", "", $option_qty_arr[$i]);
$option_price_bp_arr[$i] = str_replace(",", "", $option_price_bp_arr[$i]); $option_price_bp_arr[$i] = str_replace(",", "", $option_price_bp_arr[$i]);
$option_relate_facil_tmp_arr = explode("<br>", $option_relate_facil_arr[$i]); $option_relate_spec = "";
$intersect_arr = array_intersect($option_relate_facil_tmp_arr, $item_spec_arr); $tmp_arr = explode("<br>", $option_relate_facil_arr[$i]);
$intersect_str = implode(",", $intersect_arr); 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, price_id, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp, memo) values ("; $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, memo) values (";
$db_query .= "'$mid', '$op_id_arr[$i]', '$item_no', 'B', '$spec', '$intersect_str', '$option_unit_price_arr[$i]', '$option_qty_arr[$i]', '$option_price_bp_arr[$i]', '$option_memo_arr[$i]')"; $db_query .= "'$mid', '$op_id_arr[$i]', '$item_no', 'B', '$spec', '$option_relate_spec', '$option_unit_price_arr[$i]', '$option_qty_arr[$i]', '$option_price_bp_arr[$i]', '$option_memo_arr[$i]')";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$item_no++; $item_no++;
} }
@ -241,6 +244,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$mn_qty_arr = explode(",", $mn_qty_all); $mn_qty_arr = explode(",", $mn_qty_all);
$mn_price_bp_arr = explode(",", $mn_price_bp_all); $mn_price_bp_arr = explode(",", $mn_price_bp_all);
$mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@")); $mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@"));
$mn_relate_facil_arr = explode(",", htmlspecialchars_decode($mn_relate_facil_all));
$item_no = 1; $item_no = 1;
for ($i=0; $i<count($mn_seat_arr); $i++) { for ($i=0; $i<count($mn_seat_arr); $i++) {
if (empty($mn_kind_arr[$i])) continue; if (empty($mn_kind_arr[$i])) continue;
@ -248,8 +252,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$mn_qty_arr[$i] = str_replace(",", "", $mn_qty_arr[$i]); $mn_qty_arr[$i] = str_replace(",", "", $mn_qty_arr[$i]);
$mn_price_bp_arr[$i] = str_replace(",", "", $mn_price_bp_arr[$i]); $mn_price_bp_arr[$i] = str_replace(",", "", $mn_price_bp_arr[$i]);
$note = $mn_seat_arr[$i].",".$mn_numberofstop_arr[$i].",".$mn_speed_arr[$i]; $note = $mn_seat_arr[$i].",".$mn_numberofstop_arr[$i].",".$mn_speed_arr[$i];
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_group, item_spec, item_unit_price, item_qty, item_price_bp, note, memo) values ("; $option_relate_spec = "";
$db_query .= "'$mid', '$mn_id_arr[$i]', '$item_no', 'D', '$mn_kind_arr[$i]', '$mn_unit_price_arr[$i]', '$mn_qty_arr[$i]', '$mn_price_bp_arr[$i]', '$note', '$mn_memo_arr[$i]')"; $tmp_arr = explode("<br>", $mn_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, 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); $result = mysqli_query($link, $db_query);
$item_no++; $item_no++;
} }

46
wms/mkt/pricereview_renovate-record-update.php

@ -131,6 +131,7 @@ if(isset($_POST['pmstatus'])) {
$item_price_arr = $gross_profit_arr = []; // 先reset, 等審核才產出 $item_price_arr = $gross_profit_arr = []; // 先reset, 等審核才產出
// 如果售價變動或電梯數量異動,售價則平均分攤到每台 // 如果售價變動或電梯數量異動,售價則平均分攤到每台
/*
$avg_fg = 0; $avg_fg = 0;
foreach ($item_price_bp_arr as $k => $v) { foreach ($item_price_bp_arr as $k => $v) {
if ($v && !isset($item_price_ct_arr[$k])) { if ($v && !isset($item_price_ct_arr[$k])) {
@ -156,6 +157,7 @@ if(isset($_POST['pmstatus'])) {
$item_price_ct2_arr[count($item_qty_arr)-1] = $price_total - $price_total_item; $item_price_ct2_arr[count($item_qty_arr)-1] = $price_total - $price_total_item;
$item_price_ct_arr = $item_price_ct2_arr; $item_price_ct_arr = $item_price_ct2_arr;
} }
*/
$to_ins_arr = []; // 準備要新增的項目 $to_ins_arr = []; // 準備要新增的項目
if (count($fp_item_arr) > 0) { if (count($fp_item_arr) > 0) {
@ -218,11 +220,13 @@ if(isset($_POST['pmstatus'])) {
if (empty($iid) && $op_act_arr[$k] == "I") { if (empty($iid) && $op_act_arr[$k] == "I") {
$to_ins_arr[] = $k; $to_ins_arr[] = $k;
} else { } else {
$option_relate_facil_tmp_arr = explode("<br>", $option_relate_facil_arr[$k]); $tmp_arr = explode("<br>", $option_relate_facil_arr[$k]);
$intersect_arr = array_intersect($option_relate_facil_tmp_arr, $item_spec_arr); foreach ($tmp_arr as $val) {
$intersect_str = implode(",", $intersect_arr); $option_relate_spec .= substr($val, 0, strpos($val, ".")).",";
}
$option_relate_spec = rtrim($option_relate_spec, ",");
$db_query = "update pricereview_item set item_unit_price = '$option_unit_price_arr[$k]', item_qty = '$option_qty_arr[$k]', "; $db_query = "update pricereview_item set item_unit_price = '$option_unit_price_arr[$k]', item_qty = '$option_qty_arr[$k]', ";
$db_query .= "item_price_bp = '$option_price_bp_arr[$k]', memo = '$option_memo_arr[$k]', option_relate_spec = '$intersect_str' "; $db_query .= "item_price_bp = '$option_price_bp_arr[$k]', memo = '$option_memo_arr[$k]', option_relate_spec = '$option_relate_spec' ";
$db_query .= "where id = '$iid'"; $db_query .= "where id = '$iid'";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
} }
@ -243,12 +247,14 @@ if(isset($_POST['pmstatus'])) {
foreach ($to_ins_arr as $v) { foreach ($to_ins_arr as $v) {
if (!$op_id_arr[$v]) $op_id_arr[$v] = 0; if (!$op_id_arr[$v]) $op_id_arr[$v] = 0;
$spec = trim($option_seat_arr[$v]); $spec = trim($option_seat_arr[$v]);
$option_relate_spec = "";
$option_relate_facil_tmp_arr = explode("<br>", $option_relate_facil_arr[$v]); $tmp_arr = explode("<br>", $option_relate_facil_arr[$k]);
$intersect_arr = array_intersect($option_relate_facil_tmp_arr, $item_spec_arr); foreach ($tmp_arr as $val) {
$intersect_str = implode(",", $intersect_arr); $option_relate_spec .= substr($val, 0, strpos($val, ".")).",";
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, item_group, item_unit_price, item_qty, item_price_bp, memo) values ("; }
$db_query .= "'$id', '$op_id_arr[$v]', '$nextno', '$spec', 'B', '$option_unit_price_arr[$v]', '$option_qty_arr[$v]', '$option_price_bp_arr[$v]', '$option_memo_arr[$v]')"; $option_relate_spec = rtrim($option_relate_spec, ",");
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, item_group, option_relate_spec, item_unit_price, item_qty, item_price_bp, memo) values (";
$db_query .= "'$id', '$op_id_arr[$v]', '$nextno', '$spec', 'B', '$option_relate_spec', '$option_unit_price_arr[$v]', '$option_qty_arr[$v]', '$option_price_bp_arr[$v]', '$option_memo_arr[$v]')";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$nextno++; $nextno++;
} }
@ -267,6 +273,7 @@ if(isset($_POST['pmstatus'])) {
$mn_qty_arr = explode(",", $mn_qty_all); $mn_qty_arr = explode(",", $mn_qty_all);
$mn_price_bp_arr = explode(",", $mn_price_bp_all); $mn_price_bp_arr = explode(",", $mn_price_bp_all);
$mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@")); $mn_memo_arr = explode("@@,", rtrim($mn_memo_all, "@@"));
$mn_relate_facil_arr = explode(",", htmlspecialchars_decode($mn_relate_facil_all));
$to_ins_arr = []; // 準備要新增的項目 $to_ins_arr = []; // 準備要新增的項目
if (count($mn_item_arr) > 0) { if (count($mn_item_arr) > 0) {
foreach ($mn_item_arr as $k => $iid) { foreach ($mn_item_arr as $k => $iid) {
@ -277,8 +284,15 @@ if(isset($_POST['pmstatus'])) {
$mn_numberofstop_arr[$k] = (isset($mn_numberofstop_arr[$k])) ? $mn_numberofstop_arr[$k] : ""; $mn_numberofstop_arr[$k] = (isset($mn_numberofstop_arr[$k])) ? $mn_numberofstop_arr[$k] : "";
$mn_speed_arr[$k] = (isset($mn_speed_arr[$k])) ? $mn_speed_arr[$k] : ""; $mn_speed_arr[$k] = (isset($mn_speed_arr[$k])) ? $mn_speed_arr[$k] : "";
$note = $mn_seat_arr[$k].",".$mn_numberofstop_arr[$k].",".$mn_speed_arr[$k]; $note = $mn_seat_arr[$k].",".$mn_numberofstop_arr[$k].",".$mn_speed_arr[$k];
$option_relate_spec = "";
$tmp_arr = explode("<br>", $mn_relate_facil_arr[$k]);
foreach ($tmp_arr as $val) {
$option_relate_spec .= substr($val, 0, strpos($val, ".")).",";
}
$option_relate_spec = rtrim($option_relate_spec, ",");
$db_query = "update pricereview_item set item_unit_price = '$mn_unit_price_arr[$k]', item_qty = '$mn_qty_arr[$k]', "; $db_query = "update pricereview_item set item_unit_price = '$mn_unit_price_arr[$k]', item_qty = '$mn_qty_arr[$k]', ";
$db_query .= "item_price_bp = '$mn_price_bp_arr[$k]', note = '$note', memo = '$mn_memo_arr[$k]' "; $db_query .= "item_price_bp = '$mn_price_bp_arr[$k]', note = '$note', memo = '$mn_memo_arr[$k]', ";
$db_query .= "option_relate_spec = '$option_relate_spec' ";
$db_query .= "where id = '$iid'"; $db_query .= "where id = '$iid'";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
} }
@ -299,8 +313,14 @@ if(isset($_POST['pmstatus'])) {
foreach ($to_ins_arr as $v) { foreach ($to_ins_arr as $v) {
if (!$mn_id_arr[$v]) $mn_id_arr[$v] = 0; if (!$mn_id_arr[$v]) $mn_id_arr[$v] = 0;
$note = $mn_seat_arr[$v].",".$mn_numberofstop_arr[$v].",".$mn_speed_arr[$v]; $note = $mn_seat_arr[$v].",".$mn_numberofstop_arr[$v].",".$mn_speed_arr[$v];
$db_query = "insert into pricereview_item (mid, price_id, item_no, item_spec, item_group, item_unit_price, item_qty, item_price_bp, note, memo) values ("; $option_relate_spec = "";
$db_query .= "'$id', '$mn_id_arr[$v]', '$nextno', '$mn_kind_arr[$v]', 'D', '$mn_unit_price_arr[$v]', '$mn_qty_arr[$v]', '$mn_price_bp_arr[$v]', '$note', '$mn_memo_arr[$v]')"; $tmp_arr = explode("<br>", $mn_relate_facil_arr[$v]);
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, price_id, item_no, item_spec, option_relate_spec, item_group, item_unit_price, item_qty, item_price_bp, note, memo) values (";
$db_query .= "'$id', '$mn_id_arr[$v]', '$nextno', '$mn_kind_arr[$v]', '$option_relate_spec', 'D', '$mn_unit_price_arr[$v]', '$mn_qty_arr[$v]', '$mn_price_bp_arr[$v]', '$note', '$mn_memo_arr[$v]')";
$result = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$nextno++; $nextno++;
} }

67
wms/mkt/specsurvey-create.php

@ -13,7 +13,8 @@ mysqli_free_result($res);
// 電梯項次 // 電梯項次
$item_arr = []; $item_arr = [];
$sql = "select p.id, p.item_spec, p.item_qty, p.item_no, f.kind, f.seat, f.numberofstop, f.speed from pricereview_item p, facility_price f "; $sql = "select p.id, p.item_spec, p.item_qty, p.item_no, f.kind, f.seat, f.numberofstop, f.speed ";
$sql .= "from pricereview_item p, facility_price f ";
$sql .= "where p.price_id = f.id and p.mid = '$mid' and p.item_group = 'A' order by p.item_no"; $sql .= "where p.price_id = f.id and p.mid = '$mid' and p.item_group = 'A' order by p.item_no";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) { while ($row = mysqli_fetch_assoc($res)) {
@ -26,6 +27,17 @@ while ($row = mysqli_fetch_assoc($res)) {
$item_arr[$row["id"]]["item_no"] = $row["item_no"]; $item_arr[$row["id"]]["item_no"] = $row["item_no"];
} }
mysqli_free_result($res); mysqli_free_result($res);
// 已填寫的規調表
$sub_id2serial_arr = [];
$sql = "select sub_item_id, serial from specsurvey_main where (sub_item_id, id) in ";
$sql .= "(select sub_item_id, max(id) from specsurvey_main where mid = '$mid' group by sub_item_id)";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$sub_id2serial_arr[$row["sub_item_id"]] = $row["serial"];
}
mysqli_free_result($res);
/* /*
$db_query = "select max(buildno5) as maxb5 from specsurvey_main"; $db_query = "select max(buildno5) as maxb5 from specsurvey_main";
if ($res = mysqli_query($link, $db_query)) { if ($res = mysqli_query($link, $db_query)) {
@ -59,16 +71,13 @@ $(function () {
$('#numberofstop').val(2); $('#numberofstop').val(2);
$('#numberofdoor').val(2); $('#numberofdoor').val(2);
$('#speed').val(30); $('#speed').val(30);
$('#serial_no').val('');
//$('#tai_count').val(1); //$('#tai_count').val(1);
var serialObj = $("#address").parents().closest('div').find('label[for=serial]').parent();
for (var s=1; s<serialObj.length; s++) {
serialObj.eq(s).remove();
}
return; return;
} else { } else {
var pArr = $(this).val().split(','); var pArr = $(this).val().split(',');
var formdata = new FormData(); var formdata = new FormData();
formdata.append('pa', '<?php echo $mid; ?>,'+pArr[6]); formdata.append('pa', '<?php echo $mid; ?>,'+pArr[6]+','+pArr[7]);
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){ if(this.readyState == 4 && this.status == 200){
@ -78,7 +87,7 @@ $(function () {
return false; return false;
} }
if (data.pver) { if (data.pver) {
location.href = 'specsurvey-edit.php?pa=<?php echo $mid; ?>,'+pArr[0]+','+data.pver+','+data.ver+'&function=specsurvey&<?php echo $token_link; ?>' location.href = 'specsurvey-edit.php?pa=<?php echo $mid; ?>,'+pArr[0]+','+pArr[7]+','+data.pver+','+data.ver+'&function=specsurvey&<?php echo $token_link; ?>'
} else { } else {
$('#version').val(data.ver); $('#version').val(data.ver);
$('#rtype').val(pArr[1]); $('#rtype').val(pArr[1]);
@ -86,14 +95,8 @@ $(function () {
$('#numberofstop').val(pArr[3]); $('#numberofstop').val(pArr[3]);
$('#numberofdoor').val(pArr[3]); $('#numberofdoor').val(pArr[3]);
$('#speed').val(pArr[4]); $('#speed').val(pArr[4]);
$('#serial_no').val(pArr[7]);
var optStr = '<option value=""></option>'; $('#sub_item_id').val(pArr[7]);
for (var os=1; os<36; os++) {
optStr += '<option value="NO.'+os+'">NO.'+os+'</option>';
}
for (var m=0; m<(pArr[5]-1); m++) {
$("#address").parent().after('<div><label for="serial">號機</label><select name="serial">'+optStr+'</select></div>');
}
//$('#tai_count').val(pArr[5]); //$('#tai_count').val(pArr[5]);
} }
} }
@ -146,12 +149,6 @@ $(function () {
$('#door_r_floor').prop('readonly', false); $('#door_r_floor').prop('readonly', false);
} }
}); });
$('#submit').click(function(){
var serialArr = [];
$("select[name='serial']").each(function(){ serialArr.push($(this).val()); })
$('#serial_all').val(serialArr);
});
}); });
</script> </script>
<style> <style>
@ -210,8 +207,13 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<select name="pritem" id="pritem" required> <select name="pritem" id="pritem" required>
<option value="">請選擇</option> <option value="">請選擇</option>
<?php <?php
$serial_no = 1;
foreach ($item_arr as $k => $v) { foreach ($item_arr as $k => $v) {
echo "<option value=\"".$v["item_no"].",".$v["kind"].",".$v["seat"].",".$v["numberofstop"].",".$v["speed"].",".$v["item_qty"].",".$v["item_no"]."\">".$v["item_spec"]."</option>"; for ($i=0; $i<$v["item_qty"]; $i++) {
$new_serial_no = ($sub_id2serial_arr[$serial_no]) ? $sub_id2serial_arr[$serial_no] : $serial_no;
echo "<option value=\"".$v["item_no"].",".$v["kind"].",".$v["seat"].",".$v["numberofstop"].",".$v["speed"].",".$v["item_qty"].",".$v["item_no"].",".$serial_no."\">".$v["item_spec"]."-".$new_serial_no."</option>";
$serial_no++;
}
} }
?> ?>
</select> </select>
@ -244,7 +246,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="address">安裝詳細地址</label> <label for="address">安裝詳細地址</label>
<input type="text" name="address" id="address" size="30" value="<?=$address;?>"> <input type="text" name="address" id="address" size="50" value="<?=$address;?>">
</div> </div>
<!--<div> <!--<div>
<label for="tai_count">台數</label> <label for="tai_count">台數</label>
@ -257,22 +259,15 @@ C:當天第3版,依次類推……" readonly>
</select> </select>
</div>--> </div>-->
<div> <div>
<label for="serial">號機</label> <label for="serial_no">號機</label>
<select name="serial"> <input type="text" name="serial_no" id="serial_no" size="2">
<option value=""></option>
<?php
for ($i=1;$i<36;$i++) {
echo '<option value="NO.'.$i.'">NO.'.$i.'</option>';
}
?>
</select>
</div> </div>
<br> <br>
<div class="spectitle"><h4>基本規格</h4></div> <div class="spectitle"><h4>基本規格</h4></div>
<div> <div>
<label for="rtype">機種</label> <label for="rtype">機種</label>
<select name="rtype" id="rtype"> <select name="rtype" id="rtype" required>
<option value="MAE100">MAE100有機房</option> <option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option> <option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option> <option value="MAH100">MAH100小電梯</option>
@ -284,7 +279,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="weight">載重</label> <label for="weight">載重</label>
<select name="weight" id="weight"> <select name="weight" id="weight" required>
<option value="450">450kg</option> <option value="450">450kg</option>
<option value="550">550kg</option> <option value="550">550kg</option>
<option value="600">600kg</option> <option value="600">600kg</option>
@ -311,7 +306,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="speed">速度</label> <label for="speed">速度</label>
<select name="speed" id="speed"> <select name="speed" id="speed" required>
<option value="30">30m/min</option> <option value="30">30m/min</option>
<option value="45">45m/min</option> <option value="45">45m/min</option>
<option value="60">60m/min</option> <option value="60">60m/min</option>
@ -2005,7 +2000,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="mid" value="<?php echo $mid; ?>"> <input type="hidden" name="mid" value="<?php echo $mid; ?>">
<input type="hidden" name="serial_all" id="serial_all"> <input type="hidden" name="sub_item_id" id="sub_item_id">
</form> </form>
</div> </div>
<?php include "../footer.php"; ?> <?php include "../footer.php"; ?>

32
wms/mkt/specsurvey-edit.php

@ -1,11 +1,12 @@
<?php <?php
include "../header.php"; include "../header.php";
// 價審單序號,電梯項次,上一版號,下一版號 // 價審單序號,電梯項次,子項次編號,上一版號,下一版號
list($prid, $item_no, $prev_version, $next_version) = explode(",", $_REQUEST["pa"]); list($prid, $item_no, $sub_item_id, $prev_version, $next_version) = explode(",", $_REQUEST["pa"]);
$data = array(); $data = array();
$db_query = "select * from specsurvey_main where (mid, pr_item_id, version) in (select mid, pr_item_id, version from specsurvey_main where mid = '$prid' and pr_item_id = '$item_no' and version = '$prev_version')"; $db_query = "select * from specsurvey_main where (id, mid, pr_item_id, version) in ";
$db_query .= "(select max(id), mid, pr_item_id, version from specsurvey_main where mid = '$prid' and pr_item_id = '$item_no' and sub_item_id = '$sub_item_id' and version = '$prev_version' group by mid,pr_item_id,sub_item_id)";
$res = mysqli_query($link, $db_query); $res = mysqli_query($link, $db_query);
if (0 == $res->num_rows) { if (0 == $res->num_rows) {
//echo '<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title">Modal title</h4></div><div class="modal-body">'; //echo '<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title">Modal title</h4></div><div class="modal-body">';
@ -95,8 +96,8 @@ $(function () {
} }
}); });
$('#submit').click(function(){ $('#btnselno').click(function(){
$('#serial_all').val($('#serial').val()); location.href = 'specsurvey-create.php?mid=<?php echo $prid; ?>&function_name=specsurvey&token=<?php echo $token; ?>';
}); });
}); });
</script> </script>
@ -128,6 +129,10 @@ input:read-only {
input[type="radio"] { input[type="radio"] {
vertical-align: baseline; vertical-align: baseline;
} }
#btnselno {
margin-top: 30px;
margin-left:10px;
}
</style> </style>
<div class="container"> <div class="container">
<?php <?php
@ -167,17 +172,20 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="address">安裝詳細地址</label> <label for="address">安裝詳細地址</label>
<input type="text" name="address" id="address" value="<?=$data['address'];?>" size="30"> <input type="text" name="address" id="address" value="<?=$data['address'];?>" size="50">
</div>
<div>
<label for="serial_no">號機</label>
<input type="text" name="serial_no" id="serial_no" value="<?=$data['serial'];?>" size="2">
</div> </div>
<div> <div>
<label for="serial">號機</label> <a href="javascript:void(0);" id="btnselno" class="btn btn-primary btn-sm">重選號機</a>
<input type="text" name="serial" id="serial" value="<?=$data['serial'];?>" size="50">
</div> </div>
<br> <br>
<div class="spectitle"><h4>基本規格</h4></div> <div class="spectitle"><h4>基本規格</h4></div>
<div> <div>
<label for="rtype">機種</label> <label for="rtype">機種</label>
<select name="rtype" id="rtype"> <select name="rtype" id="rtype" required>
<option value="MAE100"<?php if ($data['rtype']=='MAE100') echo " selected"; ?>>MAE100有機房</option> <option value="MAE100"<?php if ($data['rtype']=='MAE100') echo " selected"; ?>>MAE100有機房</option>
<option value="MAM200"<?php if ($data['rtype']=='MAM200') echo " selected"; ?>>MAM200無機房</option> <option value="MAM200"<?php if ($data['rtype']=='MAM200') echo " selected"; ?>>MAM200無機房</option>
<option value="MAH100"<?php if ($data['rtype']=='MAH100') echo " selected"; ?>>MAH100小電梯</option> <option value="MAH100"<?php if ($data['rtype']=='MAH100') echo " selected"; ?>>MAH100小電梯</option>
@ -188,7 +196,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="weight">載重</label> <label for="weight">載重</label>
<select name="weight" id="weight"> <select name="weight" id="weight" required>
<option value="450"<?php if ($data['weight']=='450') echo " selected"; ?>>450kg</option> <option value="450"<?php if ($data['weight']=='450') echo " selected"; ?>>450kg</option>
<option value="550"<?php if ($data['weight']=='550') echo " selected"; ?>>550kg</option> <option value="550"<?php if ($data['weight']=='550') echo " selected"; ?>>550kg</option>
<option value="600"<?php if ($data['weight']=='600') echo " selected"; ?>>600kg</option> <option value="600"<?php if ($data['weight']=='600') echo " selected"; ?>>600kg</option>
@ -214,7 +222,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="speed">速度</label> <label for="speed">速度</label>
<select name="speed" id="speed"> <select name="speed" id="speed" required>
<option value="30"<?php if ($data['speed']==30) echo " selected"; ?>>30m/min</option> <option value="30"<?php if ($data['speed']==30) echo " selected"; ?>>30m/min</option>
<option value="45"<?php if ($data['speed']==45) echo " selected"; ?>>45m/min</option> <option value="45"<?php if ($data['speed']==45) echo " selected"; ?>>45m/min</option>
<option value="60"<?php if ($data['speed']==60) echo " selected"; ?>>60m/min</option> <option value="60"<?php if ($data['speed']==60) echo " selected"; ?>>60m/min</option>
@ -1880,7 +1888,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="mid" value="<?php echo $prid; ?>"> <input type="hidden" name="mid" value="<?php echo $prid; ?>">
<input type="hidden" name="serial_all" id="serial_all"> <input type="hidden" name="sub_item_id" id="sub_item_id">
</form> </form>
</div> </div>
<?php <?php

21
wms/mkt/specsurvey-record-submit.php

@ -8,7 +8,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
$pr_item_id = explode(",", $pritem)[0]; $pr_item_id = explode(",", $pritem)[0];
$pr_item_id = (!$pr_item_id) ? 0 : $pr_item_id; $pr_item_id = (!$pr_item_id) ? 0 : $pr_item_id;
$serial = $serial_all;
$top_height = (!$top_height) ? 0 : $top_height; $top_height = (!$top_height) ? 0 : $top_height;
$bottom_height = (!$bottom_height) ? 0 : $bottom_height; $bottom_height = (!$bottom_height) ? 0 : $bottom_height;
$vdist = (!$vdist) ? 0 : $vdist; $vdist = (!$vdist) ? 0 : $vdist;
@ -18,6 +17,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$car_width = (!$car_width) ? 0 : $car_width; $car_width = (!$car_width) ? 0 : $car_width;
$car_depth = (!$car_depth) ? 0 : $car_depth; $car_depth = (!$car_depth) ? 0 : $car_depth;
$car_height = (!$car_height) ? 0 : $car_height; $car_height = (!$car_height) ? 0 : $car_height;
$dooropen_width = (!$dooropen_width) ? 0 : $dooropen_width;
$dooropen_height = (!$dooropen_height) ? 0 : $dooropen_height;
$top_height = str_replace(",", "", $top_height); $top_height = str_replace(",", "", $top_height);
$bottom_height = str_replace(",", "", $bottom_height); $bottom_height = str_replace(",", "", $bottom_height);
$vdist = str_replace(",", "", $vdist); $vdist = str_replace(",", "", $vdist);
@ -63,7 +64,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$equip_info_bfram = json_encode($equip_info_bfram, JSON_UNESCAPED_UNICODE); $equip_info_bfram = json_encode($equip_info_bfram, JSON_UNESCAPED_UNICODE);
$auto_back = ($auto_back) ? "Y" : "N"; $auto_back = ($auto_back) ? "Y" : "N";
$design = ($design == "on") ? "Y" : "N"; $design = (isset($design) && $design == "on") ? "Y" : "N";
$ib = json_encode([$ib_y, $ib1, $ib2], JSON_UNESCAPED_UNICODE); $ib = json_encode([$ib_y, $ib1, $ib2], JSON_UNESCAPED_UNICODE);
$kanban = json_encode([$kanban_y, $kanban], JSON_UNESCAPED_UNICODE); $kanban = json_encode([$kanban_y, $kanban], JSON_UNESCAPED_UNICODE);
@ -76,12 +77,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$painting = json_encode([$painting_y, $painting], JSON_UNESCAPED_UNICODE); $painting = json_encode([$painting_y, $painting], JSON_UNESCAPED_UNICODE);
// 基本規格 specsurvey_main // 基本規格 specsurvey_main
$db_query = "insert into specsurvey_main(mid, pr_item_id, version, contractno, company, facilitok_date, serial, rtype, "; $db_query = "insert into specsurvey_main(mid, pr_item_id, sub_item_id, version, contractno, company, facilitok_date, serial, rtype, ";
$db_query .= "weight, speed, numberoffloor, numberofstop, numberofdoor, floor_name, door_type, usefor, class, oper_method, "; $db_query .= "weight, speed, numberoffloor, numberofstop, numberofdoor, floor_name, door_type, usefor, class, oper_method, ";
$db_query .= "serial_duplex_group, area, address, use_situ, mpower, lpower, top_height, bottom_height, vdist, "; $db_query .= "serial_duplex_group, area, address, use_situ, mpower, lpower, top_height, bottom_height, vdist, ";
$db_query .= "tunnel_width, tunnel_depth, theight, tunnel, car_width, car_depth, car_height, "; $db_query .= "tunnel_width, tunnel_depth, theight, tunnel, car_width, car_depth, car_height, ";
$db_query .= "dooropen_type, dooropen_width, dooropen_height, creater, create_at) values ("; $db_query .= "dooropen_type, dooropen_width, dooropen_height, creater, create_at) values (";
$db_query .= "'$mid', '$pr_item_id', '$version', '$contractno', '$company', '$facilitok_date', '$serial', '$rtype', "; $db_query .= "'$mid', '$pr_item_id', '$sub_item_id', '$version', '$contractno', '$company', '$facilitok_date', '$serial_no', '$rtype', ";
$db_query .= "'$weight', '$speed', '$numberoffloor', '$numberofstop', '$numberofdoor', '$floor_name', '$door_type', '$usefor', '$class', '$oper_method', "; $db_query .= "'$weight', '$speed', '$numberoffloor', '$numberofstop', '$numberofdoor', '$floor_name', '$door_type', '$usefor', '$class', '$oper_method', ";
$db_query .= "'$serial_duplex_group', '$area', '$address', '$use_situ', '$mpower', '$lpower', '$top_height', '$bottom_height', '$vdist', "; $db_query .= "'$serial_duplex_group', '$area', '$address', '$use_situ', '$mpower', '$lpower', '$top_height', '$bottom_height', '$vdist', ";
$db_query .= "'$tunnel_width', '$tunnel_depth', '$theight', '$tunnel', '$car_width', '$car_depth', '$car_height', "; $db_query .= "'$tunnel_width', '$tunnel_depth', '$theight', '$tunnel', '$car_width', '$car_depth', '$car_height', ";
@ -130,25 +131,29 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[F]');"; echo "alert('新增失敗,請重新操作[F]');";
echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';";
echo "</script>"; echo "</script>";
} }
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[D]');"; echo "alert('新增失敗,請重新操作[D]');";
echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';";
echo "</script>"; echo "</script>";
} }
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[C]');"; echo "alert('新增失敗,請重新操作[C]');";
echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';";
echo "</script>"; echo "</script>";
} }
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[M]');"; echo "alert('新增失敗,請重新操作[M]');";
echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey-index.php?function_name=specsurvey&".$token_link."';";
echo "</script>"; echo "</script>";
} }

72
wms/mkt/specsurvey-view.php

@ -25,7 +25,40 @@ if (0 == $res->num_rows) {
//echo '</div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button><button type="button" class="btn btn-primary">Save changes</button></div>'; //echo '</div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button><button type="button" class="btn btn-primary">Save changes</button></div>';
exit; exit;
} }
?>
<style>
.spectitle {
width:100%;
background-color:#46A3FF;
color:#fff;
border-radius:10px;
text-align:center;
}
.red-sm {
color:red;
font-size:13px;
}
.sel-lm {
margin: 10px 0;
}
.nextline {
width: 100%;
height: 0;
}
.container img {
border-radius: 0;
}
</style>
<script>
$(function () {
$(":input").prop("disabled", true);
$('button').prop("disabled", false);
$('button').click(function(){
window.location.href = 'specsurvey-index.php?function=specsurvey&<?php echo $token_link; ?>';
});
});
</script>
<?php
foreach ($res as $data) { foreach ($res as $data) {
$mid = $data["id"]; $mid = $data["id"];
$db_query = "select * from specsurvey_car where mid = '$mid'"; $db_query = "select * from specsurvey_car where mid = '$mid'";
@ -83,38 +116,6 @@ foreach ($res as $data) {
mysqli_free_result($mdata); mysqli_free_result($mdata);
*/ */
?> ?>
<style>
.spectitle {
width:100%;
background-color:#46A3FF;
color:#fff;
border-radius:10px;
text-align:center;
}
.red-sm {
color:red;
font-size:13px;
}
.sel-lm {
margin: 10px 0;
}
.nextline {
width: 100%;
height: 0;
}
.container img {
border-radius: 0;
}
</style>
<script>
$(function () {
$(":input").prop("disabled", true);
$('button').prop("disabled", false);
$('button').click(function(){
window.location.href = 'specsurvey-index.php?function=specsurvey&<?php echo $token_link; ?>';
});
});
</script>
<div class="container"> <div class="container">
<form class="form-inline" method="post" action=""> <form class="form-inline" method="post" action="">
<div> <div>
@ -161,11 +162,11 @@ C:當天第3版,依次類推……">
</div> </div>
<div> <div>
<label for="address">安裝詳細地址</label> <label for="address">安裝詳細地址</label>
<input type="text" name="address" id="address" value="<?=$data['address'];?>" size="30"> <input type="text" name="address" id="address" value="<?=$data['address'];?>" size="50">
</div> </div>
<div> <div>
<label for="serial">號機</label> <label for="serial">號機</label>
<input type="text" name="serial" id="serial" value="<?=$data['serial'];?>" size="50"> <input type="text" name="serial" id="serial" value="<?=$data['serial'];?>">
</div> </div>
<br> <br>
<div class="spectitle"><h4>基本規格</h4></div> <div class="spectitle"><h4>基本規格</h4></div>
@ -1865,6 +1866,7 @@ C:當天第3版,依次類推……">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>
</div> </div>
<hr style="border: 2px solid gray;">
<?php <?php
} }
mysqli_free_result($res); mysqli_free_result($res);

67
wms/mkt/specsurvey_renovate-create.php

@ -13,7 +13,8 @@ mysqli_free_result($res);
// 電梯項次 // 電梯項次
$item_arr = []; $item_arr = [];
$sql = "select p.id, p.item_spec, p.item_qty, p.item_no, f.kind, f.seat, f.numberofstop, f.speed from pricereview_item p, facility_price f "; $sql = "select p.id, p.item_spec, p.item_qty, p.item_no, f.kind, f.seat, f.numberofstop, f.speed ";
$sql .= "from pricereview_item p, facility_price f ";
$sql .= "where p.price_id = f.id and p.mid = '$mid' and p.item_group = 'A' order by p.item_no"; $sql .= "where p.price_id = f.id and p.mid = '$mid' and p.item_group = 'A' order by p.item_no";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) { while ($row = mysqli_fetch_assoc($res)) {
@ -26,6 +27,17 @@ while ($row = mysqli_fetch_assoc($res)) {
$item_arr[$row["id"]]["item_no"] = $row["item_no"]; $item_arr[$row["id"]]["item_no"] = $row["item_no"];
} }
mysqli_free_result($res); mysqli_free_result($res);
// 已填寫的規調表
$sub_id2serial_arr = [];
$sql = "select sub_item_id, serial from specsurvey_main where (sub_item_id, id) in ";
$sql .= "(select sub_item_id, max(id) from specsurvey_main where mid = '$mid' group by sub_item_id)";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$sub_id2serial_arr[$row["sub_item_id"]] = $row["serial"];
}
mysqli_free_result($res);
/* /*
$db_query = "select max(buildno5) as maxb5 from specsurvey_main"; $db_query = "select max(buildno5) as maxb5 from specsurvey_main";
if ($res = mysqli_query($link, $db_query)) { if ($res = mysqli_query($link, $db_query)) {
@ -59,16 +71,13 @@ $(function () {
$('#numberofstop').val(2); $('#numberofstop').val(2);
$('#numberofdoor').val(2); $('#numberofdoor').val(2);
$('#speed').val(30); $('#speed').val(30);
$('#serial_no').val('');
//$('#tai_count').val(1); //$('#tai_count').val(1);
var serialObj = $("#address").parents().closest('div').find('label[for=serial]').parent();
for (var s=1; s<serialObj.length; s++) {
serialObj.eq(s).remove();
}
return; return;
} else { } else {
var pArr = $(this).val().split(','); var pArr = $(this).val().split(',');
var formdata = new FormData(); var formdata = new FormData();
formdata.append('pa', '<?php echo $mid; ?>,'+pArr[6]); formdata.append('pa', '<?php echo $mid; ?>,'+pArr[6]+','+pArr[7]);
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){ if(this.readyState == 4 && this.status == 200){
@ -78,7 +87,7 @@ $(function () {
return false; return false;
} }
if (data.pver) { if (data.pver) {
location.href = 'specsurvey_renovate-edit.php?pa=<?php echo $mid; ?>,'+pArr[0]+','+data.pver+','+data.ver+'&function=specsurvey_renovate&<?php echo $token_link; ?>' location.href = 'specsurvey_renovate-edit.php?pa=<?php echo $mid; ?>,'+pArr[0]+','+pArr[7]+','+data.pver+','+data.ver+'&function=specsurvey_renovate&<?php echo $token_link; ?>'
} else { } else {
$('#version').val(data.ver); $('#version').val(data.ver);
$('#rtype').val(pArr[1]); $('#rtype').val(pArr[1]);
@ -86,14 +95,8 @@ $(function () {
$('#numberofstop').val(pArr[3]); $('#numberofstop').val(pArr[3]);
$('#numberofdoor').val(pArr[3]); $('#numberofdoor').val(pArr[3]);
$('#speed').val(pArr[4]); $('#speed').val(pArr[4]);
$('#serial_no').val(pArr[7]);
var optStr = '<option value=""></option>'; $('#sub_item_id').val(pArr[7]);
for (var os=1; os<36; os++) {
optStr += '<option value="NO.'+os+'">NO.'+os+'</option>';
}
for (var m=0; m<(pArr[5]-1); m++) {
$("#address").parent().after('<div><label for="serial">號機</label><select name="serial">'+optStr+'</select></div>');
}
//$('#tai_count').val(pArr[5]); //$('#tai_count').val(pArr[5]);
} }
} }
@ -146,12 +149,6 @@ $(function () {
$('#door_r_floor').prop('readonly', false); $('#door_r_floor').prop('readonly', false);
} }
}); });
$('#submit').click(function(){
var serialArr = [];
$("select[name='serial']").each(function(){ serialArr.push($(this).val()); })
$('#serial_all').val(serialArr);
});
}); });
</script> </script>
<style> <style>
@ -210,8 +207,13 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<select name="pritem" id="pritem" required> <select name="pritem" id="pritem" required>
<option value="">請選擇</option> <option value="">請選擇</option>
<?php <?php
$serial_no = 1;
foreach ($item_arr as $k => $v) { foreach ($item_arr as $k => $v) {
echo "<option value=\"".$v["item_no"].",".$v["kind"].",".$v["seat"].",".$v["numberofstop"].",".$v["speed"].",".$v["item_qty"].",".$v["item_no"]."\">".$v["item_spec"]."</option>"; for ($i=0; $i<$v["item_qty"]; $i++) {
$new_serial_no = ($sub_id2serial_arr[$serial_no]) ? $sub_id2serial_arr[$serial_no] : $serial_no;
echo "<option value=\"".$v["item_no"].",".$v["kind"].",".$v["seat"].",".$v["numberofstop"].",".$v["speed"].",".$v["item_qty"].",".$v["item_no"].",".$serial_no."\">".$v["item_spec"]."-".$new_serial_no."</option>";
$serial_no++;
}
} }
?> ?>
</select> </select>
@ -244,7 +246,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="address">安裝詳細地址</label> <label for="address">安裝詳細地址</label>
<input type="text" name="address" id="address" size="30" value="<?=$address;?>"> <input type="text" name="address" id="address" size="50" value="<?=$address;?>">
</div> </div>
<!--<div> <!--<div>
<label for="tai_count">台數</label> <label for="tai_count">台數</label>
@ -257,22 +259,15 @@ C:當天第3版,依次類推……" readonly>
</select> </select>
</div>--> </div>-->
<div> <div>
<label for="serial">號機</label> <label for="serial_no">號機</label>
<select name="serial"> <input type="text" name="serial_no" id="serial_no" size="2">
<option value=""></option>
<?php
for ($i=1;$i<36;$i++) {
echo '<option value="NO.'.$i.'">NO.'.$i.'</option>';
}
?>
</select>
</div> </div>
<br> <br>
<div class="spectitle"><h4>基本規格</h4></div> <div class="spectitle"><h4>基本規格</h4></div>
<div> <div>
<label for="rtype">機種</label> <label for="rtype">機種</label>
<select name="rtype" id="rtype"> <select name="rtype" id="rtype" required>
<option value="MAE100">MAE100有機房</option> <option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option> <option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option> <option value="MAH100">MAH100小電梯</option>
@ -284,7 +279,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="weight">載重</label> <label for="weight">載重</label>
<select name="weight" id="weight"> <select name="weight" id="weight" required>
<option value="450">450kg</option> <option value="450">450kg</option>
<option value="550">550kg</option> <option value="550">550kg</option>
<option value="600">600kg</option> <option value="600">600kg</option>
@ -311,7 +306,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="speed">速度</label> <label for="speed">速度</label>
<select name="speed" id="speed"> <select name="speed" id="speed" required>
<option value="30">30m/min</option> <option value="30">30m/min</option>
<option value="45">45m/min</option> <option value="45">45m/min</option>
<option value="60">60m/min</option> <option value="60">60m/min</option>
@ -2005,7 +2000,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="mid" value="<?php echo $mid; ?>"> <input type="hidden" name="mid" value="<?php echo $mid; ?>">
<input type="hidden" name="serial_all" id="serial_all"> <input type="hidden" name="sub_item_id" id="sub_item_id">
</form> </form>
</div> </div>
<?php include "../footer.php"; ?> <?php include "../footer.php"; ?>

32
wms/mkt/specsurvey_renovate-edit.php

@ -1,11 +1,12 @@
<?php <?php
include "../header.php"; include "../header.php";
// 價審單序號,電梯項次,上一版號,下一版號 // 價審單序號,電梯項次,子項次編號,上一版號,下一版號
list($prid, $item_no, $prev_version, $next_version) = explode(",", $_REQUEST["pa"]); list($prid, $item_no, $sub_item_id, $prev_version, $next_version) = explode(",", $_REQUEST["pa"]);
$data = array(); $data = array();
$db_query = "select * from specsurvey_main where (mid, pr_item_id, version) in (select mid, pr_item_id, version from specsurvey_main where mid = '$prid' and pr_item_id = '$item_no' and version = '$prev_version')"; $db_query = "select * from specsurvey_main where (id, mid, pr_item_id, version) in ";
$db_query .= "(select max(id), mid, pr_item_id, version from specsurvey_main where mid = '$prid' and pr_item_id = '$item_no' and sub_item_id = '$sub_item_id' and version = '$prev_version' group by mid,pr_item_id,sub_item_id)";
$res = mysqli_query($link, $db_query); $res = mysqli_query($link, $db_query);
if (0 == $res->num_rows) { if (0 == $res->num_rows) {
//echo '<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title">Modal title</h4></div><div class="modal-body">'; //echo '<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title">Modal title</h4></div><div class="modal-body">';
@ -95,8 +96,8 @@ $(function () {
} }
}); });
$('#submit').click(function(){ $('#btnselno').click(function(){
$('#serial_all').val($('#serial').val()); location.href = 'specsurvey_renovate-create.php?mid=<?php echo $prid; ?>&function_name=specsurvey_renovate&token=<?php echo $token; ?>';
}); });
}); });
</script> </script>
@ -128,6 +129,10 @@ input:read-only {
input[type="radio"] { input[type="radio"] {
vertical-align: baseline; vertical-align: baseline;
} }
#btnselno {
margin-top: 30px;
margin-left:10px;
}
</style> </style>
<div class="container"> <div class="container">
<?php <?php
@ -167,17 +172,20 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="address">安裝詳細地址</label> <label for="address">安裝詳細地址</label>
<input type="text" name="address" id="address" value="<?=$data['address'];?>" size="30"> <input type="text" name="address" id="address" value="<?=$data['address'];?>" size="50">
</div>
<div>
<label for="serial_no">號機</label>
<input type="text" name="serial_no" id="serial_no" value="<?=$data['serial'];?>" size="2">
</div> </div>
<div> <div>
<label for="serial">號機</label> <a href="javascript:void(0);" id="btnselno" class="btn btn-primary btn-sm">重選號機</a>
<input type="text" name="serial" id="serial" value="<?=$data['serial'];?>" size="50">
</div> </div>
<br> <br>
<div class="spectitle"><h4>基本規格</h4></div> <div class="spectitle"><h4>基本規格</h4></div>
<div> <div>
<label for="rtype">機種</label> <label for="rtype">機種</label>
<select name="rtype" id="rtype"> <select name="rtype" id="rtype" required>
<option value="MAE100"<?php if ($data['rtype']=='MAE100') echo " selected"; ?>>MAE100有機房</option> <option value="MAE100"<?php if ($data['rtype']=='MAE100') echo " selected"; ?>>MAE100有機房</option>
<option value="MAM200"<?php if ($data['rtype']=='MAM200') echo " selected"; ?>>MAM200無機房</option> <option value="MAM200"<?php if ($data['rtype']=='MAM200') echo " selected"; ?>>MAM200無機房</option>
<option value="MAH100"<?php if ($data['rtype']=='MAH100') echo " selected"; ?>>MAH100小電梯</option> <option value="MAH100"<?php if ($data['rtype']=='MAH100') echo " selected"; ?>>MAH100小電梯</option>
@ -188,7 +196,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="weight">載重</label> <label for="weight">載重</label>
<select name="weight" id="weight"> <select name="weight" id="weight" required>
<option value="450"<?php if ($data['weight']=='450') echo " selected"; ?>>450kg</option> <option value="450"<?php if ($data['weight']=='450') echo " selected"; ?>>450kg</option>
<option value="550"<?php if ($data['weight']=='550') echo " selected"; ?>>550kg</option> <option value="550"<?php if ($data['weight']=='550') echo " selected"; ?>>550kg</option>
<option value="600"<?php if ($data['weight']=='600') echo " selected"; ?>>600kg</option> <option value="600"<?php if ($data['weight']=='600') echo " selected"; ?>>600kg</option>
@ -214,7 +222,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<div> <div>
<label for="speed">速度</label> <label for="speed">速度</label>
<select name="speed" id="speed"> <select name="speed" id="speed" required>
<option value="30"<?php if ($data['speed']==30) echo " selected"; ?>>30m/min</option> <option value="30"<?php if ($data['speed']==30) echo " selected"; ?>>30m/min</option>
<option value="45"<?php if ($data['speed']==45) echo " selected"; ?>>45m/min</option> <option value="45"<?php if ($data['speed']==45) echo " selected"; ?>>45m/min</option>
<option value="60"<?php if ($data['speed']==60) echo " selected"; ?>>60m/min</option> <option value="60"<?php if ($data['speed']==60) echo " selected"; ?>>60m/min</option>
@ -1880,7 +1888,7 @@ C:當天第3版,依次類推……" readonly>
</div> </div>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="mid" value="<?php echo $prid; ?>"> <input type="hidden" name="mid" value="<?php echo $prid; ?>">
<input type="hidden" name="serial_all" id="serial_all"> <input type="hidden" name="sub_item_id" id="sub_item_id">
</form> </form>
</div> </div>
<?php <?php

21
wms/mkt/specsurvey_renovate-record-submit.php

@ -8,7 +8,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
$pr_item_id = explode(",", $pritem)[0]; $pr_item_id = explode(",", $pritem)[0];
$pr_item_id = (!$pr_item_id) ? 0 : $pr_item_id; $pr_item_id = (!$pr_item_id) ? 0 : $pr_item_id;
$serial = $serial_all;
$top_height = (!$top_height) ? 0 : $top_height; $top_height = (!$top_height) ? 0 : $top_height;
$bottom_height = (!$bottom_height) ? 0 : $bottom_height; $bottom_height = (!$bottom_height) ? 0 : $bottom_height;
$vdist = (!$vdist) ? 0 : $vdist; $vdist = (!$vdist) ? 0 : $vdist;
@ -27,6 +26,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$car_width = str_replace(",", "", $car_width); $car_width = str_replace(",", "", $car_width);
$car_depth = str_replace(",", "", $car_depth); $car_depth = str_replace(",", "", $car_depth);
$car_height = str_replace(",", "", $car_height); $car_height = str_replace(",", "", $car_height);
$dooropen_width = (!$dooropen_width) ? 0 : $dooropen_width;
$dooropen_height = (!$dooropen_height) ? 0 : $dooropen_height;
$pre_weight = str_replace(",", "", $pre_weight); $pre_weight = str_replace(",", "", $pre_weight);
$pre_weight = (!$pre_weight) ? 0 : $pre_weight; $pre_weight = (!$pre_weight) ? 0 : $pre_weight;
@ -63,7 +64,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$equip_info_bfram = json_encode($equip_info_bfram, JSON_UNESCAPED_UNICODE); $equip_info_bfram = json_encode($equip_info_bfram, JSON_UNESCAPED_UNICODE);
$auto_back = ($auto_back) ? "Y" : "N"; $auto_back = ($auto_back) ? "Y" : "N";
$design = ($design == "on") ? "Y" : "N"; $design = (isset($design) && $design == "on") ? "Y" : "N";
$ib = json_encode([$ib_y, $ib1, $ib2], JSON_UNESCAPED_UNICODE); $ib = json_encode([$ib_y, $ib1, $ib2], JSON_UNESCAPED_UNICODE);
$kanban = json_encode([$kanban_y, $kanban], JSON_UNESCAPED_UNICODE); $kanban = json_encode([$kanban_y, $kanban], JSON_UNESCAPED_UNICODE);
@ -76,12 +77,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$painting = json_encode([$painting_y, $painting], JSON_UNESCAPED_UNICODE); $painting = json_encode([$painting_y, $painting], JSON_UNESCAPED_UNICODE);
// 基本規格 specsurvey_main // 基本規格 specsurvey_main
$db_query = "insert into specsurvey_main(mid, pr_item_id, version, contractno, company, facilitok_date, serial, rtype, "; $db_query = "insert into specsurvey_main(mid, pr_item_id, sub_item_id, version, contractno, company, facilitok_date, serial, rtype, ";
$db_query .= "weight, speed, numberoffloor, numberofstop, numberofdoor, floor_name, door_type, usefor, class, oper_method, "; $db_query .= "weight, speed, numberoffloor, numberofstop, numberofdoor, floor_name, door_type, usefor, class, oper_method, ";
$db_query .= "serial_duplex_group, area, address, use_situ, mpower, lpower, top_height, bottom_height, vdist, "; $db_query .= "serial_duplex_group, area, address, use_situ, mpower, lpower, top_height, bottom_height, vdist, ";
$db_query .= "tunnel_width, tunnel_depth, theight, tunnel, car_width, car_depth, car_height, "; $db_query .= "tunnel_width, tunnel_depth, theight, tunnel, car_width, car_depth, car_height, ";
$db_query .= "dooropen_type, dooropen_width, dooropen_height, creater, create_at) values ("; $db_query .= "dooropen_type, dooropen_width, dooropen_height, creater, create_at) values (";
$db_query .= "'$mid', '$pr_item_id', '$version', '$contractno', '$company', '$facilitok_date', '$serial', '$rtype', "; $db_query .= "'$mid', '$pr_item_id', '$sub_item_id', '$version', '$contractno', '$company', '$facilitok_date', '$serial_no', '$rtype', ";
$db_query .= "'$weight', '$speed', '$numberoffloor', '$numberofstop', '$numberofdoor', '$floor_name', '$door_type', '$usefor', '$class', '$oper_method', "; $db_query .= "'$weight', '$speed', '$numberoffloor', '$numberofstop', '$numberofdoor', '$floor_name', '$door_type', '$usefor', '$class', '$oper_method', ";
$db_query .= "'$serial_duplex_group', '$area', '$address', '$use_situ', '$mpower', '$lpower', '$top_height', '$bottom_height', '$vdist', "; $db_query .= "'$serial_duplex_group', '$area', '$address', '$use_situ', '$mpower', '$lpower', '$top_height', '$bottom_height', '$vdist', ";
$db_query .= "'$tunnel_width', '$tunnel_depth', '$theight', '$tunnel', '$car_width', '$car_depth', '$car_height', "; $db_query .= "'$tunnel_width', '$tunnel_depth', '$theight', '$tunnel', '$car_width', '$car_depth', '$car_height', ";
@ -130,25 +131,29 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[F]');"; echo "alert('新增失敗,請重新操作[F]');";
echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';";
echo "</script>"; echo "</script>";
} }
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[D]');"; echo "alert('新增失敗,請重新操作[D]');";
echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';";
echo "</script>"; echo "</script>";
} }
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[C]');"; echo "alert('新增失敗,請重新操作[C]');";
echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';";
echo "</script>"; echo "</script>";
} }
} else { } else {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('新增失敗,請重新操作[M]');"; echo "alert('新增失敗,請重新操作[M]');";
echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';"; echo "history.go(-1);";
//echo "location.href = 'specsurvey_renovate-index.php?function_name=specsurvey_renovate&".$token_link."';";
echo "</script>"; echo "</script>";
} }

4
wms/mkt/specsurvey_renovate-view.php

@ -161,11 +161,11 @@ C:當天第3版,依次類推……">
</div> </div>
<div> <div>
<label for="address">安裝詳細地址</label> <label for="address">安裝詳細地址</label>
<input type="text" name="address" id="address" value="<?=$data['address'];?>" size="30"> <input type="text" name="address" id="address" value="<?=$data['address'];?>" size="50">
</div> </div>
<div> <div>
<label for="serial">號機</label> <label for="serial">號機</label>
<input type="text" name="serial" id="serial" value="<?=$data['serial'];?>" size="50"> <input type="text" name="serial" id="serial" value="<?=$data['serial'];?>">
</div> </div>
<br> <br>
<div class="spectitle"><h4>基本規格</h4></div> <div class="spectitle"><h4>基本規格</h4></div>

6
wms/mkt/specsurvey_version-api.php

@ -9,7 +9,7 @@
* { * {
* "pa" * "pa"
* } * }
* pa : 價審單序號,電梯項次 * pa : 價審單序號,電梯項次,子項目編號
* respons json * respons json
* { * {
* "st" : "ok", * "st" : "ok",
@ -28,12 +28,12 @@ try {
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));
} }
list($mid, $pr_item_id) = explode(",", $pa); list($mid, $pr_item_id, $sub_item_id) = explode(",", $pa);
if (!$mid || !$pr_item_id) throw new \Exception("parameter empty[2]"); if (!$mid || !$pr_item_id) throw new \Exception("parameter empty[2]");
$prev_version = $version = ""; $prev_version = $version = "";
$tds = date("Y-m-d"); $tds = date("Y-m-d");
$sql = "select max(version)from specsurvey_main where mid = '$mid' and pr_item_id = '$pr_item_id'";// and version like '".$version."%'"; $sql = "select max(version)from specsurvey_main where mid = '$mid' and pr_item_id = '$pr_item_id' and sub_item_id = '$sub_item_id'";// and version like '".$version."%'";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res); $row = mysqli_fetch_row($res);
if ($row[0]) { if ($row[0]) {

Loading…
Cancel
Save