|
@ -5,291 +5,313 @@ include "header.php"; |
|
|
$data = array(); |
|
|
$data = array(); |
|
|
?> |
|
|
?> |
|
|
<script> |
|
|
<script> |
|
|
function commafy(num) { |
|
|
function commafy(num) { |
|
|
num = num + ""; |
|
|
num = num + ""; |
|
|
var re = /(-?\d+)(\d{3})/ |
|
|
var re = /(-?\d+)(\d{3})/ |
|
|
while (re.test(num)) { |
|
|
while (re.test(num)) { |
|
|
num = num.replace(re, "$1,$2") |
|
|
num = num.replace(re, "$1,$2") |
|
|
} |
|
|
|
|
|
return num; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function dataFormat() { |
|
|
|
|
|
var amtAll = 0; |
|
|
|
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
|
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#amt').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_total_broken').val(commafy($('#price_total').val().replace(/[,]+/g,"")-$('#price_lowest').val().replace(/[,]+/g,""))); |
|
|
|
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (qt) { |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/qt).toFixed(2))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#price_rate').val((($('#price_total').val().replace(/[,]+/g,"")/$('#price_lowest').val().replace(/[,]+/g,""))*100).toFixed(2)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function selFacil(o) { |
|
|
|
|
|
var fp = o.parent().parent(); |
|
|
|
|
|
var f1 = fp.find('select[name=fp_kind]').val(); |
|
|
|
|
|
var f2 = fp.find('select[name=fp_seat]').val(); |
|
|
|
|
|
var f3 = fp.find('input[name=fp_numberofstop]').val(); |
|
|
|
|
|
var f4 = fp.find('select[name=fp_speed]').val(); |
|
|
|
|
|
var f5 = fp.find('input[name=item_qty]').val(); |
|
|
|
|
|
if (f1 !== '' && f2 !== '' && f3 !== '' && f4 !== '' && f5 !== '') { |
|
|
|
|
|
let fAry = [f1, f2, f3, f4, f5]; |
|
|
|
|
|
//console.log(fAry); |
|
|
|
|
|
var formdata = new FormData(); |
|
|
|
|
|
formdata.append('fval', fAry); |
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
|
|
xhr.onreadystatechange = function(){ |
|
|
|
|
|
if(this.readyState == 4 && this.status == 200){ |
|
|
|
|
|
data = JSON.parse(this.responseText); |
|
|
|
|
|
if (data.st == 'err') { |
|
|
|
|
|
alert(data.err); |
|
|
|
|
|
fp.find('input[name=item_price_bp]').val(0); |
|
|
|
|
|
dataFormat(); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
fp.find('input[name=item_price_bp]').val(commafy(data.amt)); |
|
|
|
|
|
fp.find('input[name=fp_id]').val(data.id); |
|
|
|
|
|
fp.find('input[name=item_spec]').val(data.model); |
|
|
|
|
|
fp.find('input[name=item_group]').val(data.group); |
|
|
|
|
|
|
|
|
|
|
|
var cntAll = 0; |
|
|
|
|
|
$("input[name='item_qty']").each(function(){ |
|
|
|
|
|
cntAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#cnt').val(commafy(cntAll)); |
|
|
|
|
|
$('#qty_total').val(commafy(cntAll)); |
|
|
|
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (pl) { |
|
|
|
|
|
$('#price_rate').val(commafy((($('#price_total').val().replace(/[,]+/g,"")/pl)*100).toFixed(2))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/$('#qty_total').val()).toFixed(2))); |
|
|
|
|
|
|
|
|
|
|
|
dataFormat(); |
|
|
|
|
|
/* |
|
|
|
|
|
var amtAll = 0; |
|
|
|
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
|
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#amt').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_total_broken').val(commafy($('#price_total').val().replace(/[,]+/g,"")-$('#price_lowest').val().replace(/[,]+/g,""))); |
|
|
|
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (qt) { |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/qt).toFixed(2))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#price_rate').val((($('#price_total').val().replace(/[,]+/g,"")/$('#price_lowest').val().replace(/[,]+/g,""))*100).toFixed(2)); |
|
|
|
|
|
*/ |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
xhr.open('POST','/mkt/pricereview-facility.php',true); |
|
|
return num; |
|
|
xhr.send(formdata); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function tt(){ |
|
|
function dataFormat() { |
|
|
$("input[name='item_price_bp']").keyup(function(){ |
|
|
|
|
|
dataFormat(); |
|
|
|
|
|
/* |
|
|
|
|
|
var amtAll = 0; |
|
|
var amtAll = 0; |
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
$("input[name='item_price_bp']").each(function() { |
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
amtAll += Number($(this).val().replace(/[,]+/g, "")); |
|
|
}); |
|
|
}); |
|
|
$('#amt').val(commafy(amtAll)); |
|
|
$('#amt').val(commafy(amtAll)); |
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
$('#price_total_broken').val(commafy($('#price_total').val().replace(/[,]+/g,"")-$('#price_lowest').val().replace(/[,]+/g,""))); |
|
|
$('#price_total_broken').val(commafy($('#price_total').val().replace(/[,]+/g, "") - $('#price_lowest').val().replace(/[,]+/g, ""))); |
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g,"")) || 0; |
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g, "")) || 0; |
|
|
if (qt) { |
|
|
if (qt) { |
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/qt).toFixed(2))); |
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g, "") / qt).toFixed(2))); |
|
|
} |
|
|
} |
|
|
$('#price_rate').val((($('#price_total').val().replace(/[,]+/g,"")/$('#price_lowest').val().replace(/[,]+/g,""))*100).toFixed(2)); |
|
|
$('#price_rate').val((($('#price_total').val().replace(/[,]+/g, "") / $('#price_lowest').val().replace(/[,]+/g, "")) * 100).toFixed(2)); |
|
|
*/ |
|
|
} |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$(function(){ |
|
|
function selFacil(o) { |
|
|
$('#tb1').on('click', 'input[name=fp_numberofstop], input[name=item_qty]', function(){ |
|
|
var fp = o.parent().parent(); |
|
|
//$("input[name=item_qty]").unbind().keyup(function(){ |
|
|
var f1 = fp.find('select[name=fp_kind]').val(); |
|
|
$(this).unbind().keyup(function(){ |
|
|
var f2 = fp.find('select[name=fp_seat]').val(); |
|
|
selFacil($(this)); |
|
|
var f3 = fp.find('input[name=fp_numberofstop]').val(); |
|
|
/* |
|
|
var f4 = fp.find('select[name=fp_speed]').val(); |
|
|
var fp = $(this).parent().parent(); |
|
|
var f5 = fp.find('input[name=item_qty]').val(); |
|
|
var f1 = fp.find('select[name=fp_kind]').val(); |
|
|
if (f1 !== '' && f2 !== '' && f3 !== '' && f4 !== '' && f5 !== '') { |
|
|
var f2 = fp.find('select[name=fp_seat]').val(); |
|
|
let fAry = [f1, f2, f3, f4, f5]; |
|
|
var f3 = fp.find('input[name=fp_numberofstop]').val(); |
|
|
//console.log(fAry); |
|
|
var f4 = fp.find('select[name=fp_speed]').val(); |
|
|
var formdata = new FormData(); |
|
|
var f5 = fp.find('input[name=item_qty]').val(); |
|
|
formdata.append('fval', fAry); |
|
|
if (f1 !== '' && f2 !== '' && f3 !== '' && f4 !== '' && f5 !== '') { |
|
|
var xhr = new XMLHttpRequest(); |
|
|
let fAry = [f1, f2, f3, f4, f5]; |
|
|
xhr.onreadystatechange = function() { |
|
|
var formdata = new FormData(); |
|
|
if (this.readyState == 4 && this.status == 200) { |
|
|
formdata.append('fval', fAry); |
|
|
data = JSON.parse(this.responseText); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
if (data.st == 'err') { |
|
|
xhr.onreadystatechange = function(){ |
|
|
alert(data.err); |
|
|
if(this.readyState == 4 && this.status == 200){ |
|
|
fp.find('input[name=item_price_bp]').val(0); |
|
|
data = JSON.parse(this.responseText); |
|
|
dataFormat(); |
|
|
if (data.st == 'err') { |
|
|
return false; |
|
|
alert(data.err); |
|
|
} |
|
|
return false; |
|
|
fp.find('input[name=item_price_bp]').val(commafy(data.amt)); |
|
|
} |
|
|
fp.find('input[name=fp_id]').val(data.id); |
|
|
fp.find('input[name=item_price_bp]').val(commafy(data.amt)); |
|
|
fp.find('input[name=item_spec]').val(data.model); |
|
|
fp.find('input[name=fp_id]').val(data.id); |
|
|
fp.find('input[name=item_group]').val(data.group); |
|
|
fp.find('input[name=item_spec]').val(data.model); |
|
|
|
|
|
fp.find('input[name=item_group]').val(data.group); |
|
|
|
|
|
|
|
|
|
|
|
var cntAll = 0; |
|
|
var cntAll = 0; |
|
|
$("input[name='item_qty']").each(function(){ |
|
|
$("input[name='item_qty']").each(function() { |
|
|
cntAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
cntAll += Number($(this).val().replace(/[,]+/g, "")); |
|
|
}); |
|
|
}); |
|
|
$('#cnt').val(commafy(cntAll)); |
|
|
$('#cnt').val(commafy(cntAll)); |
|
|
$('#qty_total').val(commafy(cntAll)); |
|
|
$('#qty_total').val(commafy(cntAll)); |
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g,"")) || 0; |
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g, "")) || 0; |
|
|
if (pl) { |
|
|
if (pl) { |
|
|
$('#price_rate').val(commafy((($('#price_total').val().replace(/[,]+/g,"")/pl)*100).toFixed(2))); |
|
|
$('#price_rate').val(commafy((($('#price_total').val().replace(/[,]+/g, "") / pl) * 100).toFixed(2))); |
|
|
} |
|
|
} |
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/$('#qty_total').val()).toFixed(2))); |
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g, "") / $('#qty_total').val()).toFixed(2))); |
|
|
|
|
|
|
|
|
dataFormat(); |
|
|
dataFormat(); |
|
|
|
|
|
/* |
|
|
|
|
|
var amtAll = 0; |
|
|
|
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
|
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#amt').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_total_broken').val(commafy($('#price_total').val().replace(/[,]+/g,"")-$('#price_lowest').val().replace(/[,]+/g,""))); |
|
|
|
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (qt) { |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/qt).toFixed(2))); |
|
|
} |
|
|
} |
|
|
|
|
|
$('#price_rate').val((($('#price_total').val().replace(/[,]+/g,"")/$('#price_lowest').val().replace(/[,]+/g,""))*100).toFixed(2)); |
|
|
|
|
|
*/ |
|
|
} |
|
|
} |
|
|
xhr.open('POST','/mkt/pricereview-facility.php',true); |
|
|
|
|
|
xhr.send(formdata); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
xhr.open('POST', '/mkt/pricereview-facility.php', true); |
|
|
|
|
|
xhr.send(formdata); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function tt() { |
|
|
|
|
|
$("input[name='item_price_bp']").keyup(function() { |
|
|
|
|
|
dataFormat(); |
|
|
|
|
|
/* |
|
|
|
|
|
var amtAll = 0; |
|
|
|
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
|
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#amt').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_total_broken').val(commafy($('#price_total').val().replace(/[,]+/g,"")-$('#price_lowest').val().replace(/[,]+/g,""))); |
|
|
|
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (qt) { |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/qt).toFixed(2))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#price_rate').val((($('#price_total').val().replace(/[,]+/g,"")/$('#price_lowest').val().replace(/[,]+/g,""))*100).toFixed(2)); |
|
|
*/ |
|
|
*/ |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
$('#tb1').on('click', 'input[name=fp_numberofstop], input[name=item_qty]', function() { |
|
|
|
|
|
//$("input[name=item_qty]").unbind().keyup(function(){ |
|
|
|
|
|
$(this).unbind().keyup(function() { |
|
|
|
|
|
selFacil($(this)); |
|
|
|
|
|
/* |
|
|
|
|
|
var fp = $(this).parent().parent(); |
|
|
|
|
|
var f1 = fp.find('select[name=fp_kind]').val(); |
|
|
|
|
|
var f2 = fp.find('select[name=fp_seat]').val(); |
|
|
|
|
|
var f3 = fp.find('input[name=fp_numberofstop]').val(); |
|
|
|
|
|
var f4 = fp.find('select[name=fp_speed]').val(); |
|
|
|
|
|
var f5 = fp.find('input[name=item_qty]').val(); |
|
|
|
|
|
if (f1 !== '' && f2 !== '' && f3 !== '' && f4 !== '' && f5 !== '') { |
|
|
|
|
|
let fAry = [f1, f2, f3, f4, f5]; |
|
|
|
|
|
var formdata = new FormData(); |
|
|
|
|
|
formdata.append('fval', fAry); |
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
|
|
xhr.onreadystatechange = function(){ |
|
|
|
|
|
if(this.readyState == 4 && this.status == 200){ |
|
|
|
|
|
data = JSON.parse(this.responseText); |
|
|
|
|
|
if (data.st == 'err') { |
|
|
|
|
|
alert(data.err); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
fp.find('input[name=item_price_bp]').val(commafy(data.amt)); |
|
|
|
|
|
fp.find('input[name=fp_id]').val(data.id); |
|
|
|
|
|
fp.find('input[name=item_spec]').val(data.model); |
|
|
|
|
|
fp.find('input[name=item_group]').val(data.group); |
|
|
|
|
|
|
|
|
|
|
|
var cntAll = 0; |
|
|
|
|
|
$("input[name='item_qty']").each(function(){ |
|
|
|
|
|
cntAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#cnt').val(commafy(cntAll)); |
|
|
|
|
|
$('#qty_total').val(commafy(cntAll)); |
|
|
|
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (pl) { |
|
|
|
|
|
$('#price_rate').val(commafy((($('#price_total').val().replace(/[,]+/g,"")/pl)*100).toFixed(2))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/$('#qty_total').val()).toFixed(2))); |
|
|
|
|
|
|
|
|
$('#tb1').on('click', 'select[name=fp_kind], select[name=fp_seat], select[name=fp_speed]', function(){ |
|
|
dataFormat(); |
|
|
$(this).unbind().change(function(){ |
|
|
} |
|
|
selFacil($(this)); |
|
|
} |
|
|
|
|
|
xhr.open('POST','/mkt/pricereview-facility.php',true); |
|
|
|
|
|
xhr.send(formdata); |
|
|
|
|
|
} |
|
|
|
|
|
*/ |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#deposit_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); |
|
|
$('#tb1').on('click', 'select[name=fp_kind], select[name=fp_seat], select[name=fp_speed]', function() { |
|
|
$('#keep_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); |
|
|
$(this).unbind().change(function() { |
|
|
$('#warranty_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); |
|
|
selFacil($(this)); |
|
|
/* |
|
|
|
|
|
// for 動態表格的作法:event delegation |
|
|
|
|
|
$('#tb1').on('click', $("input[name='item_qty']"), function(){ |
|
|
|
|
|
$("input[name='item_qty']").keyup(function(){ |
|
|
|
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
|
|
|
var cntAll = 0; |
|
|
|
|
|
//$(this).parent().next().find('input').val(commafy($(this).val()*Number($(this).parent().next().find('input').val().replace(/[,]+/g,"")))); |
|
|
|
|
|
$("input[name='item_qty']").each(function(){ |
|
|
|
|
|
cntAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
}); |
|
|
$('#cnt').val(commafy(cntAll)); |
|
|
}); |
|
|
$('#qty_total').val(commafy(cntAll)); |
|
|
|
|
|
|
|
|
|
|
|
// $(this).parent().next().find('input[name=item_price_bp]').val($(this).parent().parent().find('input[name=item_price_bp_base').val()*$(this).val()); |
|
|
$('#deposit_rate').keyup(function() { |
|
|
var amtAll = 0; |
|
|
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); |
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
}); |
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
$('#keep_rate').keyup(function() { |
|
|
|
|
|
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#warranty_rate').keyup(function() { |
|
|
|
|
|
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); |
|
|
|
|
|
}); |
|
|
|
|
|
/* |
|
|
|
|
|
// for 動態表格的作法:event delegation |
|
|
|
|
|
$('#tb1').on('click', $("input[name='item_qty']"), function(){ |
|
|
|
|
|
$("input[name='item_qty']").keyup(function(){ |
|
|
|
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
|
|
|
var cntAll = 0; |
|
|
|
|
|
//$(this).parent().next().find('input').val(commafy($(this).val()*Number($(this).parent().next().find('input').val().replace(/[,]+/g,"")))); |
|
|
|
|
|
$("input[name='item_qty']").each(function(){ |
|
|
|
|
|
cntAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#cnt').val(commafy(cntAll)); |
|
|
|
|
|
$('#qty_total').val(commafy(cntAll)); |
|
|
|
|
|
|
|
|
|
|
|
// $(this).parent().next().find('input[name=item_price_bp]').val($(this).parent().parent().find('input[name=item_price_bp_base').val()*$(this).val()); |
|
|
|
|
|
var amtAll = 0; |
|
|
|
|
|
$("input[name='item_price_bp']").each(function(){ |
|
|
|
|
|
amtAll += Number($(this).val().replace(/[,]+/g,"")); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#amt').val(commafy(amtAll)); |
|
|
|
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
|
|
|
|
|
|
|
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g,"")) || 0; |
|
|
|
|
|
if (pl) { |
|
|
|
|
|
$('#price_rate').val(commafy((($('#price_total').val().replace(/[,]+/g,"")/pl)*100).toFixed(2))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/$('#qty_total').val()).toFixed(2))); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
$('#amt').val(commafy(amtAll)); |
|
|
*/ |
|
|
$('#price_lowest').val(commafy(amtAll)); |
|
|
|
|
|
|
|
|
|
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g,"")) || 0; |
|
|
// $('#tb1').on('click', tt); |
|
|
|
|
|
$('#tb1').on('keyup', 'input[name=item_price_bp]', function() { |
|
|
|
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
|
|
|
dataFormat(); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price]', function() { |
|
|
|
|
|
//$("input[name='item_price']").keyup(function(){ |
|
|
|
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
|
|
|
//}); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#tb1').on('keyup', 'input[name=pv_rate]', function() { |
|
|
|
|
|
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); |
|
|
|
|
|
}); |
|
|
|
|
|
$("#price_total").on("input", function() { |
|
|
|
|
|
var pt = parseInt($(this).val().replace(/[,]+/g, "")) || 0; |
|
|
|
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
|
|
|
//var pl = ('NaN'==$('#price_lowest').val() || ''==$('#price_lowest').val().trim())?0:parseInt($('#price_lowest').val()); |
|
|
|
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g, "")) || 0; |
|
|
|
|
|
$('#price_total_broken').val(commafy(pt - pl)); |
|
|
if (pl) { |
|
|
if (pl) { |
|
|
$('#price_rate').val(commafy((($('#price_total').val().replace(/[,]+/g,"")/pl)*100).toFixed(2))); |
|
|
$('#price_rate').val(((pt / pl) * 100).toFixed(2)); |
|
|
} |
|
|
} |
|
|
$('#price_broken').val(commafy(($('#price_total_broken').val().replace(/[,]+/g,"")/$('#qty_total').val()).toFixed(2))); |
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g, "")) || 0; |
|
|
|
|
|
if (qt) { |
|
|
|
|
|
$('#price_broken').val(commafy((parseInt($('#price_total_broken').val().replace(/[,]+/g, "")) / qt).toFixed(0))); |
|
|
|
|
|
} |
|
|
|
|
|
$('#pay1').html(commafy((pt * 0.2).toFixed(0))); |
|
|
|
|
|
$('#pay2').html(commafy((pt * 0.4).toFixed(0))); |
|
|
|
|
|
$('#pay3').html(commafy((pt * 0.2).toFixed(0))); |
|
|
|
|
|
$('#pay4').html(commafy((pt * 0.1).toFixed(0))); |
|
|
|
|
|
$('#pay5').html(commafy((pt * 0.1).toFixed(0))); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
$('#btnadd').click(function() { |
|
|
*/ |
|
|
/* |
|
|
|
|
|
var facilTemp = ''; |
|
|
|
|
|
facilTemp+= '<tr name="facil_templ">'; |
|
|
|
|
|
facilTemp+= '<td>'+($('tr[name=facil_templ]').length+1)+'</td>'; |
|
|
|
|
|
facilTemp+= '<td>'; |
|
|
|
|
|
facilTemp+= '<?php include_once "facility_price.php"; ?>'; |
|
|
|
|
|
facilTemp+= '</td>'; |
|
|
|
|
|
facilTemp+= '<td><input type="text" name="item_spec"></td>'; |
|
|
|
|
|
facilTemp+= '<td><input type="text" name="item_qty"></td>'; |
|
|
|
|
|
facilTemp+= '<td><input type="text" name="item_price_bp"></td>'; |
|
|
|
|
|
facilTemp+= '<td><input type="text" name="item_price"></td>'; |
|
|
|
|
|
facilTemp+= '<td><input type="text" name="pv_rate"></td>'; |
|
|
|
|
|
facilTemp+= '<td colspan="2"><input type="text" name="note"><input type="hidden" name="item_group" value="A"><input type="hidden" name="item_price_bp_base"></td>'; |
|
|
|
|
|
facilTemp+= '</tr>'; |
|
|
|
|
|
$('#tb1 tr:last').prev().after(facilTemp); |
|
|
|
|
|
*/ |
|
|
|
|
|
$('#tb1 tr:last').prev().after($("tr[name='facil_templ']").eq(0).clone().find('input').val('').end()); |
|
|
|
|
|
$('#tb1 tr:last').prev().find('td').first().html($("tr[name='facil_templ']").length); |
|
|
|
|
|
//$("tr[name=facil_templ]").eq($("tr[name=facil_templ]").length-1).find('td').eq(0).html($("tr[name=facil_templ]").length); |
|
|
|
|
|
|
|
|
// $('#tb1').on('click', tt); |
|
|
//$('#facil_templ').clone(true).insertAfter($('#tb1 tr:last').prev()); |
|
|
$('#tb1').on('keyup', 'input[name=item_price_bp]', function(){ |
|
|
}); |
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
$('#submit').click(function() { |
|
|
dataFormat(); |
|
|
var itemFpidArr = []; |
|
|
}); |
|
|
$("input[name='fp_id']").each(function() { |
|
|
$('#tb1').on('keyup', 'input[name=fp_numberofstop], input[name=item_qty], input[name=item_price]', function(){ |
|
|
itemFpidArr.push($(this).val()); |
|
|
//$("input[name='item_price']").keyup(function(){ |
|
|
}) |
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
$('#fp_id_all').val(itemFpidArr); |
|
|
//}); |
|
|
var itemSpecArr = []; |
|
|
}); |
|
|
$("input[name='item_spec']").each(function() { |
|
|
$('#tb1').on('keyup', 'input[name=pv_rate]', function(){ |
|
|
itemSpecArr.push($(this).val()); |
|
|
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); |
|
|
}) |
|
|
}); |
|
|
$('#item_spec_all').val(itemSpecArr); |
|
|
$("#price_total").on("input", function(){ |
|
|
var itemGroupArr = []; |
|
|
var pt = parseInt($(this).val().replace(/[,]+/g,"")) || 0; |
|
|
$("input[name='item_group']").each(function() { |
|
|
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); |
|
|
itemGroupArr.push($(this).val()); |
|
|
//var pl = ('NaN'==$('#price_lowest').val() || ''==$('#price_lowest').val().trim())?0:parseInt($('#price_lowest').val()); |
|
|
}) |
|
|
var pl = parseInt($('#price_lowest').val().replace(/[,]+/g,"")) || 0; |
|
|
$('#item_group_all').val(itemGroupArr); |
|
|
$('#price_total_broken').val(commafy(pt-pl)); |
|
|
var itemQtyArr = []; |
|
|
if (pl) { |
|
|
$("input[name='item_qty']").each(function() { |
|
|
$('#price_rate').val(((pt/pl)*100).toFixed(2)); |
|
|
itemQtyArr.push($(this).val().replace(/[,]+/g, "")); |
|
|
} |
|
|
}) |
|
|
var qt = parseInt($('#qty_total').val().replace(/[,]+/g,"")) || 0; |
|
|
$('#item_qty_all').val(itemQtyArr); |
|
|
if (qt) { |
|
|
var itemPriceBpArr = []; |
|
|
$('#price_broken').val(commafy((parseInt($('#price_total_broken').val().replace(/[,]+/g,""))/qt).toFixed(0))); |
|
|
$("input[name='item_price_bp']").each(function() { |
|
|
} |
|
|
itemPriceBpArr.push($(this).val().replace(/[,]+/g, "")); |
|
|
$('#pay1').html(commafy((pt*0.2).toFixed(0))); |
|
|
}) |
|
|
$('#pay2').html(commafy((pt*0.4).toFixed(0))); |
|
|
$('#item_price_bp_all').val(itemPriceBpArr); |
|
|
$('#pay3').html(commafy((pt*0.2).toFixed(0))); |
|
|
var itemPriceArr = []; |
|
|
$('#pay4').html(commafy((pt*0.1).toFixed(0))); |
|
|
$("input[name='item_price']").each(function() { |
|
|
$('#pay5').html(commafy((pt*0.1).toFixed(0))); |
|
|
itemPriceArr.push($(this).val().replace(/[,]+/g, "")); |
|
|
}); |
|
|
}) |
|
|
$('#btnadd').click(function(){ |
|
|
$('#item_price_all').val(itemPriceArr); |
|
|
/* |
|
|
var pvRateArr = []; |
|
|
var facilTemp = ''; |
|
|
$("input[name='pv_rate']").each(function() { |
|
|
facilTemp+= '<tr name="facil_templ">'; |
|
|
pvRateArr.push($(this).val()); |
|
|
facilTemp+= '<td>'+($('tr[name=facil_templ]').length+1)+'</td>'; |
|
|
}) |
|
|
facilTemp+= '<td>'; |
|
|
$('#pv_rate_all').val(pvRateArr); |
|
|
facilTemp+= '<?php include_once "facility_price.php"; ?>'; |
|
|
var noteArr = []; |
|
|
facilTemp+= '</td>'; |
|
|
$("input[name='note']").each(function() { |
|
|
facilTemp+= '<td><input type="text" name="item_spec"></td>'; |
|
|
noteArr.push($(this).val()); |
|
|
facilTemp+= '<td><input type="text" name="item_qty"></td>'; |
|
|
}) |
|
|
facilTemp+= '<td><input type="text" name="item_price_bp"></td>'; |
|
|
$('#note_all').val(noteArr); |
|
|
facilTemp+= '<td><input type="text" name="item_price"></td>'; |
|
|
//console.log(itemNameArr); |
|
|
facilTemp+= '<td><input type="text" name="pv_rate"></td>'; |
|
|
//return false; |
|
|
facilTemp+= '<td colspan="2"><input type="text" name="note"><input type="hidden" name="item_group" value="A"><input type="hidden" name="item_price_bp_base"></td>'; |
|
|
}); |
|
|
facilTemp+= '</tr>'; |
|
|
|
|
|
$('#tb1 tr:last').prev().after(facilTemp); |
|
|
|
|
|
*/ |
|
|
|
|
|
$('#tb1 tr:last').prev().after($("tr[name='facil_templ']").eq(0).clone().find('input').val('').end()); |
|
|
|
|
|
$('#tb1 tr:last').prev().find('td').first().html($("tr[name='facil_templ']").length); |
|
|
|
|
|
//$("tr[name=facil_templ]").eq($("tr[name=facil_templ]").length-1).find('td').eq(0).html($("tr[name=facil_templ]").length); |
|
|
|
|
|
|
|
|
|
|
|
//$('#facil_templ').clone(true).insertAfter($('#tb1 tr:last').prev()); |
|
|
|
|
|
}); |
|
|
|
|
|
$('#submit').click(function(){ |
|
|
|
|
|
var itemFpidArr = []; |
|
|
|
|
|
$("input[name='fp_id']").each(function(){ itemFpidArr.push($(this).val()); }) |
|
|
|
|
|
$('#fp_id_all').val(itemFpidArr); |
|
|
|
|
|
var itemSpecArr = []; |
|
|
|
|
|
$("input[name='item_spec']").each(function(){ itemSpecArr.push($(this).val()); }) |
|
|
|
|
|
$('#item_spec_all').val(itemSpecArr); |
|
|
|
|
|
var itemGroupArr = []; |
|
|
|
|
|
$("input[name='item_group']").each(function(){ itemGroupArr.push($(this).val()); }) |
|
|
|
|
|
$('#item_group_all').val(itemGroupArr); |
|
|
|
|
|
var itemQtyArr = []; |
|
|
|
|
|
$("input[name='item_qty']").each(function(){ itemQtyArr.push($(this).val().replace(/[,]+/g,"")); }) |
|
|
|
|
|
$('#item_qty_all').val(itemQtyArr); |
|
|
|
|
|
var itemPriceBpArr = []; |
|
|
|
|
|
$("input[name='item_price_bp']").each(function(){ itemPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) |
|
|
|
|
|
$('#item_price_bp_all').val(itemPriceBpArr); |
|
|
|
|
|
var itemPriceArr = []; |
|
|
|
|
|
$("input[name='item_price']").each(function(){ itemPriceArr.push($(this).val().replace(/[,]+/g,"")); }) |
|
|
|
|
|
$('#item_price_all').val(itemPriceArr); |
|
|
|
|
|
var pvRateArr = []; |
|
|
|
|
|
$("input[name='pv_rate']").each(function(){ pvRateArr.push($(this).val()); }) |
|
|
|
|
|
$('#pv_rate_all').val(pvRateArr); |
|
|
|
|
|
var noteArr = []; |
|
|
|
|
|
$("input[name='note']").each(function(){ noteArr.push($(this).val()); }) |
|
|
|
|
|
$('#note_all').val(noteArr); |
|
|
|
|
|
//console.log(itemNameArr); |
|
|
|
|
|
//return false; |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
<?php |
|
|
<?php |
|
|
include "pricereview-record-submit.php"; |
|
|
include "pricereview-record-submit.php"; |
|
|
/* |
|
|
/* |
|
|
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|
|
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|
|
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|
|
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|
|
echo "<p class='error'>Please fill up the required field!</p>"; |
|
|
echo "<p class='error'>Please fill up the required field!</p>"; |
|
@ -298,11 +320,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
*/ |
|
|
*/ |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|
|
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> |
|
|
<div> |
|
|
<div> |
|
|
<label for="contractno">卷號</label> |
|
|
<label for="contractno">卷號</label> |
|
|
<input type="text" name="contractno" id="contractno" maxlength="7" required> |
|
|
<input type="text" name="contractno" id="contractno" maxlength="7" required> |
|
@ -461,7 +483,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|
|
<td style="padding-top:0px;"><input type="text" name="item_price_bp"></td> |
|
|
<td style="padding-top:0px;"><input type="text" name="item_price_bp"></td> |
|
|
<td style="padding-top:0px;"><input type="text" name="item_price"></td> |
|
|
<td style="padding-top:0px;"><input type="text" name="item_price"></td> |
|
|
<td style="padding-top:0px;"><input type="text" name="pv_rate"></td> |
|
|
<td style="padding-top:0px;"><input type="text" name="pv_rate"></td> |
|
|
<td style="padding-top:0px;" colspan="2"><input type="text" name="note"><input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"><input type="hidden" name="item_spec"></td> |
|
|
<td style="padding-top:0px;" colspan="2"><input type="text" name="note"><input type="hidden" name="item_group" value="A"><input type="hidden" name="fp_id"><input type="hidden" name="item_spec"></td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td></td> |
|
|
<td></td> |
|
|