|
|
|
function ComputeAmountVat() รันแล้วเลขไม่คำนวนเลยค่ะไมทราบว่าผิดพลาดตรงไหนรบกวนช่วยดูหน่อย |
|
|
|
|
|
|
|
จากภาพนะคะถ้าเราใส่ตัวเลขในช่อง %จำคำนวณออกทันทีโดยเอาเลขว่ามีส่วนลดกี่บาท
ถ้าใส่เลขภาษี กี่ แล้ว+รวมกับ ชนิดของvat ด้วยแต่ตอนนี้รันไม่ออก ไม่ทราบติดตรงไหนช่วยหน่อยนะคะ
Code (PHP)
function ComputeAmountVat(){
var AmountVat = 0;
var SumTotalAmountVal = 0;
var TotalDiscount = 0;
//var TotalNetAmount = document.getElementById('TotalNetAmount');
//var PVat = document.getElementById('PVat');
//var PDisCount = document.getElementById('PDisCount');
var VatType = document.getElementById('VatType').value;
var TotalNetAmountVal = eval(TotalNetAmount.value);
if(TotalNetAmount.value == ""){
TotalNetAmountVal = 0;
}
var PVatVal = eval(PVat.value);
if(PVat.value == ""){
PVatVal = 0;
}
var PDisCountVal = eval(PDisCount.value);
if(PDisCount.value == ""){
PDisCountVal = 0;
}
TotalDiscount = TotalNetAmountVal * PDisCountVal/100;
TotalNetAmountVal = TotalNetAmountVal - TotalDiscount;
var selVatType = document.form1.VatType;
if(selVatType.options[selVatType.selectedIndex].value == "No Vat"){
AmountVat = 0;
TotalNetAmountVal = FormatNumber(TotalAmountVal.value , 2);
SumTotalAmountVal = FormatNumber(TotalAmountVal.value , 2);
//SumTotalAmountVal = TotalNetAmountVal ;
}
if(selVatType.options[selVatType.selectedIndex].value == "Include Vat"){
AmountVat = TotalNetAmountVal * PVatVal/107;
//AmountVat = 2+2;
AmountVat = FormatNumber(AmountVat , 2);
//SumTotalAmountVal = eval(TotalNetAmountVal) - eval(AmountVat);
TotalNetAmountVal = SumTotalAmountVal + parseFloat(AmountVat);
SumTotalAmountVal = parseFloat(TotalNetAmountVal);
//document.form1.TotalNetAmount.value = FormatNumber(TotalNetAmountVal , 2);
}
/*if(VatType == "Include Vat"){
AmountVat = TotalNetAmountVal * PVatVal/107;
AmountVat = FormatNumber(AmountVat , 2);
SumTotalAmountVal = eval(TotalNetAmountVal) - eval(AmountVat);
}*/
if(selVatType.options[selVatType.selectedIndex].value == "Exclude Vat"){
AmountVat = TotalNetAmountVal * PVatVal/100;
AmountVat = FormatNumber(AmountVat , 2);
TotalNetAmountVal = FormatNumber(TotalAmountVal.value , 2);
SumTotalAmountVal = parseFloat(TotalNetAmountVal) + parseFloat(AmountVat);
}
if(TotalDiscount == 0){
document.form1.TotalDiscount.value = "";
}else{
document.form1.TotalDiscount.value = FormatNumber(TotalDiscount , 2);
//document.form1.AmountVat.value = AmountVat;
}
if(AmountVat == 0){
document.form1.AmountVat.value = "";
}else{
document.form1.AmountVat.value = FormatNumber(AmountVat , 2);
//document.form1.AmountVat.value = AmountVat;
}
if(SumTotalAmountVal == 0){
document.form1.SumTotalAmount.value = "";
}else{
document.form1.SumTotalAmount.value = FormatNumber(SumTotalAmountVal , 2);
}
document.form1.Tp_TotalQtyStock.value = document.form1.TotalQtyStock.value;
document.form1.Tp_TotalQtySell.value = document.form1.TotalQtySell.value;
document.form1.Tp_TotalNetAmount.value = document.form1.TotalNetAmount.value;
//ComputeAmountVat();
}
Tag : PHP, MySQL, HTML, Web (ASP.NET), Laravel Framework, Apache
|
|
|
|
|
|
Date :
2017-12-19 15:21:01 |
By :
mewhappy |
View :
707 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บรรทัดที่ 6-8 คอมเม้นท์ไว้ทำไมหรอครับ เหมือนจะต้องใช้ด้วย
|
|
|
|
|
Date :
2017-12-19 16:37:33 |
By :
mangkunzo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|