bbnepal new changes
This commit is contained in:
@ -143,6 +143,7 @@
|
||||
<th class="text-right">Qty</th>
|
||||
<th class="text-right">Units</th>
|
||||
<th class="text-right">Rate</th>
|
||||
<th class="text-right" width=13%>VAT<span class="text-danger">*</span></th>
|
||||
<th class="text-right">Amount</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -154,6 +155,8 @@
|
||||
<td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td>
|
||||
<td width=5%><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
|
||||
<td width=15%><input type="text" class="form-control" name="rate[]"></td>
|
||||
<td><input type="number" name="vat[]" class="form-control vat" required></td>
|
||||
|
||||
<td width=15%><input type="text" class="form-control" name="total[]"></td>
|
||||
<td width="5%">
|
||||
<button type="button" class="btn btn-primary btn-xs addPurchaseDetail" id="addPurchaseDetail">
|
||||
@ -174,9 +177,9 @@
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<label for="vatToggle">VAT</label>
|
||||
<input type="checkbox" id="vatToggle" checked>
|
||||
<input type="hidden" id="vatToggleValue" name="vatToggleValue" value="1">
|
||||
<label for="vatToggle" class="d-none">VAT</label>
|
||||
<input class="d-none" type="checkbox" id="vatToggle" checked>
|
||||
<input type="hidden" class="d-none" id="vatToggleValue" name="vatToggleValue" value="1">
|
||||
</td>
|
||||
<td class="text-right "><b>Total Amount</b></td>
|
||||
<td class="text-right">
|
||||
@ -198,11 +201,13 @@
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td class="text-right "><b>13% VAT</b></td>
|
||||
<td class="text-right">
|
||||
<td class="text-right d-none "><b>13% VAT</b></td>
|
||||
<td class="text-right d-none">
|
||||
<input type="text" class="form-control" name="tax" id="tax" />
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right "><b>Grand Total Amount</b></td>
|
||||
@ -404,7 +409,7 @@
|
||||
calculateTotals();
|
||||
});
|
||||
// Calculate totals on change of rate or quantity
|
||||
$(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate']", function() {
|
||||
$(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate'],.purchase-detail input[name^='vat']", function() {
|
||||
calculateRowTotal($(this).closest(".purchase-detail"));
|
||||
calculateTotals();
|
||||
});
|
||||
@ -419,6 +424,9 @@
|
||||
calculateTotals('amount');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function updateSerialNumbers(){
|
||||
$('.purchase-detail').each(function(index){
|
||||
$(this).find('.bbsn').text(index + 1);
|
||||
@ -429,7 +437,15 @@
|
||||
function calculateRowTotal(row) {
|
||||
var quantity = parseFloat(row.find("input[name^='quantity']").val()) || 0;
|
||||
var rate = parseFloat(row.find("input[name^='rate']").val()) || 0;
|
||||
var total = quantity * rate;
|
||||
var vat = parseFloat(row.find('input[name^="vat"]').val()) || 0;
|
||||
|
||||
//
|
||||
var lineTotal = quantity * rate;
|
||||
var vat_amt =(vat/100)*lineTotal;
|
||||
var total =lineTotal + vat_amt ;
|
||||
|
||||
//
|
||||
// var total = quantity * rate;
|
||||
row.find("input[name^='total']").val(total.toFixed(2));
|
||||
}
|
||||
// Calculate totals
|
||||
@ -453,18 +469,19 @@
|
||||
// var discountamount = subtotal * (discountpercent/100);
|
||||
var taxable = subtotal - discountamount;
|
||||
var tax = 0;
|
||||
if ($('#vatToggle').is(':checked')) {
|
||||
tax = taxable * 0.13; // Include 13% VAT if checkbox is checked
|
||||
}
|
||||
var grandTotal = taxable + tax;
|
||||
// if ($('#vatToggle').is(':checked')) {
|
||||
// tax = taxable * 0.13; // Include 13% VAT if checkbox is checked
|
||||
// }
|
||||
// var grandTotal = taxable + tax;
|
||||
var grandTotal = taxable;
|
||||
|
||||
|
||||
$("#subtotal").val(subtotal.toFixed(2));
|
||||
// $("#discount").val(discountamount.toFixed(2));
|
||||
$("#taxable").val(taxable.toFixed(2));
|
||||
$("#tax").val(tax.toFixed(2));
|
||||
$("#grand_total").val(grandTotal.toFixed(2));
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<?php function footerFunctions()
|
||||
|
Reference in New Issue
Block a user