Browse Source

Merge branch 'cheng'

main
Cheng 1 year ago
parent
commit
4858704d5e
  1. 22
      wms/mkt/pricereview-check.php
  2. 18
      wms/mkt/pricereview-index.php

22
wms/mkt/pricereview-check.php

@ -303,7 +303,7 @@ foreach ($res as $data) {
}
}
}
// getMI($id);
getMI($id);
?>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
@ -319,28 +319,24 @@ foreach ($res as $data) {
function getMI(id) {
var formdata = new FormData();
formdata.append('pa', id);
// formdata.append('user_id', <?= $user_id ?>);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
data = JSON.parse(this.responseText);
//console.log(data);return false;
if (data.st == 'err') {
//alert(data.err);
return false;
}
console.log(data.content);
Object.keys(data.content).forEach(function(k) {
console.log(data.content);
//console.log(data.content[k][0]);
// console.log(data.content[k][0]);
// 有值表示先前已寫入MI
if ($("#tb1").find("input[name=mi_fix]").eq(k).val() == "") {
// $("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(data.content[k][0]));
// console.log($("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(data.content[k][0])));
let a = data.content[k][0] + data.content[k][19][1];
$("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(a));
}
let a = data.content[k][0] + data.content[k][19][1];
$("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(a));
$("#tb1").find("input[name=mi_fix]").eq(k).keyup();
var mihtml = "";
mihtml += "<h5>電梯設備</h5>";
mihtml += "<li>設備" + data.content[k][8] + ":" + commafy(data.content[k][1]) + "</li>";
@ -369,8 +365,11 @@ foreach ($res as $data) {
mihtml += "<li>" + data.content[k][18][m][0] + ":" + commafy(data.content[k][18][m][1]) + "</li>";
});
mihtml += "<li>" + data.content[k][19][0] + ":" + commafy(data.content[k][19][1]) + "</li>";
mihtml += "以上合計:" + commafy(data.content[k][13]) +
// 總價 + 服務費
let total = data.content[k][13];
mihtml += "以上合計:" + commafy(total) +
"<br>";
// console.log(data.content[k][13] + data.content[k][19][1])
$("#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);
});
@ -419,10 +418,11 @@ foreach ($res as $data) {
});
$('#tb1').on('keyup', 'input[name=mi_fix]', function() {
// console.log($(this).val);
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
var mf = $(this).val().replace(/[,]+/g, "");
var ct = $(this).closest('td').parent().find('input[name=item_price_ct]').val().replace(/[,]+/g, "");
console.log(ct - mf);
$(this).closest('td').parent().find('input[name=gross_profit]').val(commafy(ct - mf));
if (ct == 0) $(this).closest('td').parent().find('input[name=gross_profit_rate]').val(0.0);
else $(this).closest('td').parent().find('input[name=gross_profit_rate]').val((((ct - mf) / ct) * 100).toFixed(1));
@ -556,7 +556,7 @@ foreach ($res as $data) {
<?php
$item_amt_A_all = 0;
$idx = 1;
print_r($item_arr);
// print_r($item_arr);
foreach ($item_arr as $item_no => $val) {
$item_amt_A_all += $val["item_price_bp"];
if ($viewmi) {

18
wms/mkt/pricereview-index.php

@ -195,7 +195,7 @@ if ($data) :
?>
<link rel="stylesheet" href="common.css">
<div style="overflow-x:auto; white-space:nowrap;">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>項次</th>
@ -324,7 +324,7 @@ if ($data) :
}
}
?>
<a href="pricereview-check.php?id=<?php echo $data['id'] . "&" . $para; ?>" class="btn btn-warning btn-sm">檢視</a>
<a href="pricereview-check.php?id=<?php echo $data['id'] . "&" . $para; ?>" target="_blank" class="btn btn-warning btn-sm">檢視</a>
<?php
if ($user_id == "M0023") {
?>
@ -346,7 +346,7 @@ if ($data) :
if ($ss_arr["sign_st"] == 1 && in_array($user_id, $ss_arr["sign_nt"]) && $data["status"] == "YS" || $user_id == 'TEST04') {
$str = "<span class=\"glyphicon glyphicon-user\"></span>";
$str = "待簽核";
$str = "<a href=\"pricereview-check.php?st=1&id=" . $data["id"] . "&" . $para . "\" class=\"btn btn-primary btn-sm\">" . $str . "</a>";
$str = "<a href=\"pricereview-check.php?st=1&id=" . $data["id"] . "&" . $para . "\" target=\"_blank\" class=\"btn btn-primary btn-sm\">" . $str . "</a>";
} else $str = "--";
}
echo $str;
@ -403,7 +403,7 @@ if ($data) :
if (($data["status"] == "YS") && ($ss_arr["sign_st"] == 2) && (in_array($user_id, $ss_arr["sign_nt"])) || $user_id == 'TEST02') {
$str = "<span class=\"glyphicon glyphicon-user\"></span>";
$str = "待簽核";
$str = "<a href=\"pricereview-check.php?st=2&id=" . $data["id"] . "&" . $para . "\" class=\"btn btn-primary btn-sm\">" . $str . "</a>";
$str = "<a href=\"pricereview-check.php?st=2&id=" . $data["id"] . "&" . $para . "\" target=\"_blank\" class=\"btn btn-primary btn-sm\">" . $str . "</a>";
} else $str = "--";
}
echo $str;
@ -538,7 +538,7 @@ if ($data) :
<?php if (($user_id === "M0107" || $user_id === "M0060") && $data['applystatus'] < 3) : ?>
<span style="font-size:13px;font-weight:600">待申請</span>
<?php elseif ($data['applystatus'] < 3) : ?>
<a class="applybtn" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">
<a class="applybtn" target="_blank" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">
<?php if ($data['applystatus'] < 1) {
echo "申請";
} else {
@ -557,12 +557,12 @@ if ($data) :
<span style="font-size:13px;font-weight:600">--</span>
<?php endif; ?>
<!-- 工號M0107、M0174有所有權限 -->
<?php if (false &&($data['status'] === 'YY' && $data['applystatus'] == 3 && ($user_id == "M0107" || $user_id == "M0060" || $user_id == "M0175" || $user_id === "TEST02")) || $user_id == "M0174" || $user_id == 'M0225') : ?>
<?php if (false && ($data['status'] === 'YY' && $data['applystatus'] == 3 && ($user_id == "M0107" || $user_id == "M0060" || $user_id == "M0175" || $user_id === "TEST02")) || $user_id == "M0174" || $user_id == 'M0225') : ?>
<a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載</a>
<?php endif; ?>
<?php if($data['status'] === 'YY'): ?>
<a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載草稿</a>
<?php endif ;?>
<?php if ($data['status'] === 'YY') : ?>
<a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載草稿</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>

Loading…
Cancel
Save