@ -326,6 +326,11 @@ foreach ($res as $data) {
if (this.readyState == 4 & & this.status == 200) {
if (this.readyState == 4 & & this.status == 200) {
data = JSON.parse(this.responseText);
data = JSON.parse(this.responseText);
console.log(data);
console.log(data);
if(data.err == "notfoundmi"){
for(let i=0;i< document.getElementsByClassName ( ' total_mi_fix ' ) . length ; i + + ) {
document.getElementsByClassName('total_mi_fix')[i].value = "找不到此MI"
}
}
//console.log(data);return false;
//console.log(data);return false;
if (data.st == 'err') {
if (data.st == 'err') {
//alert(data.err);
//alert(data.err);
@ -334,7 +339,7 @@ foreach ($res as $data) {
// console.log(data.content);
// console.log(data.content);
Object.keys(data.content).forEach(function(k) {
Object.keys(data.content).forEach(function(k) {
console.log('k=>', k);
console.log('k=>', k);
// console.log(data.content);
console.log(data.content);
//console.log(data.content[k][0]);
//console.log(data.content[k][0]);
// 有值表示先前已寫入MI
// 有值表示先前已寫入MI
if ($("#tb1").find("input[name=mi_fix]").eq(k).val() == "") {
if ($("#tb1").find("input[name=mi_fix]").eq(k).val() == "") {
@ -356,7 +361,7 @@ foreach ($res as $data) {
mihtml += "< li > 一年免保:" + commafy(data.content[k][6]) + "< / li > ";
mihtml += "< li > 一年免保:" + commafy(data.content[k][6]) + "< / li > ";
mihtml += "< li > 起吊+木箱+耗材:" + commafy(data.content[k][7]) + "< / li > ";
mihtml += "< li > 起吊+木箱+耗材:" + commafy(data.content[k][7]) + "< / li > ";
//mihtml += "< li > 加價:"+commafy(data.content[k][9])+"< / li > ";
//mihtml += "< li > 加價:"+commafy(data.content[k][9])+"< / li > ";
mihtml += "以上合計:" + commafy(data.content[k][12]) + "/台";
mihtml += "以上合計:" + commafy(data.content[k][12]) + "/台" ;
mihtml += "< hr > ";
mihtml += "< hr > ";
mihtml += "< h5 > OPTION< / h5 > ";
mihtml += "< h5 > OPTION< / h5 > ";
total_mi = total_mi + data.content[k][12];
total_mi = total_mi + data.content[k][12];
@ -385,6 +390,7 @@ foreach ($res as $data) {
}
}
$("#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);
console.log(document.getElementsByClassName('total_mi_fix')[k]);
document.getElementsByClassName('total_mi_fix')[k].value = commafy(total_mi)
document.getElementsByClassName('total_mi_fix')[k].value = commafy(total_mi)
// document.getElementsByClassName('item_price_ct')[k].value =commafy(total_mi)
// document.getElementsByClassName('item_price_ct')[k].value =commafy(total_mi)
@ -392,8 +398,6 @@ foreach ($res as $data) {
document.getElementsByClassName('gross_profit_rate')[k].value = Math.round((Number(document.getElementsByClassName('gross_profit')[k].value.replace(/[,]+/g, "")) / Number(document.getElementsByClassName('item_price_ct')[k].value.replace(/[,]+/g, "")) * 100) * 10) / 10
document.getElementsByClassName('gross_profit_rate')[k].value = Math.round((Number(document.getElementsByClassName('gross_profit')[k].value.replace(/[,]+/g, "")) / Number(document.getElementsByClassName('item_price_ct')[k].value.replace(/[,]+/g, "")) * 100) * 10) / 10
});
});
}
}
}
}
xhr.open('POST', 'pricereview_mi-api.php', true);
xhr.open('POST', 'pricereview_mi-api.php', true);
xhr.send(formdata);
xhr.send(formdata);
@ -588,7 +592,7 @@ foreach ($res as $data) {
< 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 = "1" > < / 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_unit_price" ]); ?> " ></ td >
< td >< input type = "text" name = "item_price_bp" class = "form-control dollar-right" size = "9" value = " <? = number_format ( 1 * $val [ 'item_unit_price' ]); ?> " ></ td >
< td >< input type = "text" name = "mi_fix" class = "form-control dollar-right total_mi_fix" size = "9" value = " <?php echo ( $val [ "mi_fix" ]) ? number_format ( $val [ "mi_fix" ]) : "" ; ?> " disabled ></ td >
< td >< input type = "text" name = "mi_fix" class = "form-control dollar-right total_mi_fix" size = "9" value = " <?php echo ( $val [ "mi_fix" ]) ? number_format ( $val [ "mi_fix" ]) : "" ; ?> " disabled ></ td >
< td >< input type = "text" name = "item_price_ct" class = "form-control dollar-right item_price_ct" size = "9" value = " <? = number_format ( $val [ "item_price_ct" ] / $val [ "item_qty" ]); ?> " ></ td >
< td >< input type = "text" name = "item_price_ct" class = "form-control dollar-right item_price_ct" 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>