changes for bbnepal data

This commit is contained in:
Roshan 2024-10-07 13:59:13 +05:45
parent 967642f2be
commit 318998d272

View File

@ -98,10 +98,13 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td class="text-right "><b>13% VAT</b></td> <td class="text-right"><b><input type="checkbox" name="vat_checkbox" id="vat_checkbox"
>13% VAT</b></td>
<td class="text-right"> <td class="text-right">
<input type="text" class="form-control" id="tax"> <input type="text" class="form-control" id="tax">
<td></td> <td></td>
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
</tr> </tr>
<tr> <tr>
<td class="text-right "><b>Grand Total Amount</b></td> <td class="text-right "><b>Grand Total Amount</b></td>
@ -161,7 +164,10 @@
calculateLineTotal($(this).closest("tr")); calculateLineTotal($(this).closest("tr"));
calculateTotals('amount'); calculateTotals('amount');
}); });
$(document).on("change", "input[name=vat_checkbox]", function() {
calculateLineTotal($(this).closest("tr"));
calculateTotals('vat');
});
function updateSerialNumbers() { function updateSerialNumbers() {
$('.purchase-detail').each(function(index) { $('.purchase-detail').each(function(index) {
$(this).find('.bbsn').text(index + 1); $(this).find('.bbsn').text(index + 1);
@ -239,18 +245,30 @@
}); });
var discountamount = 0; var discountamount = 0;
var discountpercent = 0; var discountpercent = 0;
var tax_percentage =0;
if (type == 'amount') { if (type == 'amount') {
discountamount = parseFloat($("input[name='discount']").val()); discountamount = parseFloat($("input[name='discount']").val());
discountpercent = (discountamount * 100) / subtotal; discountpercent = (discountamount * 100) / subtotal;
$("#discountpercentage").val(discountpercent.toFixed(2)); $("#discountpercentage").val(discountpercent.toFixed(2));
} else if(type == 'vat'){
checkBox = $("input[name='vat_checkbox_value']").val();
if(checkBox == "0"){
// if(checkBox){
tax_percentage= 0.13;
$("input[name='vat_checkbox_value']").val('13');
}else{ }else{
tax_percentage =0;
$("input[name='vat_checkbox_value']").val('0');
}
// }
}
else {
discountpercent = parseFloat($("input[name='discountpercentage']").val()); discountpercent = parseFloat($("input[name='discountpercentage']").val());
discountamount = subtotal * (discountpercent / 100); discountamount = subtotal * (discountpercent / 100);
$("#discount").val(discountamount.toFixed(2)); $("#discount").val(discountamount.toFixed(2));
} }
var taxable = subtotal - discountamount; var taxable = subtotal - discountamount;
var tax = taxable * 0.13; var tax = taxable * tax_percentage;
var grandTotal = taxable + tax; var grandTotal = taxable + tax;
$('#subtotal').val(subtotal.toFixed(2)); $('#subtotal').val(subtotal.toFixed(2));
@ -258,6 +276,7 @@
$('#tax').val(tax.toFixed(2)); $('#tax').val(tax.toFixed(2));
$('#grandtotal').val(grandTotal.toFixed(2)); $('#grandtotal').val(grandTotal.toFixed(2));
} }
</script> </script>
<?php function footerFunctions() <?php function footerFunctions()