diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php
index b118bc8..f9b659a 100644
--- a/app/Views/job_card_form.php
+++ b/app/Views/job_card_form.php
@@ -1276,8 +1276,9 @@ $(document).ready(function() {
$(row).find('.item-tax').val(tax.toFixed(0));
finrate = Number(product.unit_price) * quantity;
$(row).find('.item-rate').val(finrate);
- rate = Number(product.unit_price);
- var amount = (rate + (rate * tax / 100)) * quantity;
+ // rate = Number(product.unit_price);
+ rate = Number(product.total_amount);
+ var amount = rate * quantity;
total_tax_amt = amount - finrate;
$(row).find('.total-tax-amount').val(total_tax_amt.toFixed(2));
$(row).find('.item-amount').val(amount.toFixed(2));
@@ -1291,13 +1292,14 @@ $(document).ready(function() {
var $targetField = $previousRow.find('.item-rate1');
finrate = Number($targetField.val()) * quantity;
+ // rate = $targetField.val();
rate = $targetField.val();
$(row).find('.item-rate').val(finrate);
var amount = (Number(rate) + (Number(rate) * tax / 100)) *quantity;
total_tax_amt = amount - finrate;
$(row).find('.total-tax-amount').val(total_tax_amt.toFixed(2));
- $(row).find('.item-amount').val(amount.toFixed(2));
+ $(row).find('.item-amount').val(Math.round(amount.toFixed(2)).toFixed(2));
}
else if(type.includes("complaint")) {
if(action == 'parent') var $previousRow = row;
@@ -1486,7 +1488,7 @@ $(document).ready(function() {
$('#subtotal').val(sb_tot.toFixed(2));
$('#invoicetax').val(calculateTax().toFixed(2));
- $('#grandtotal').val(tot.toFixed(2));
+ $('#grandtotal').val(Math.round(tot.toFixed(2)));
});
// Function to calculate total
@@ -1520,7 +1522,7 @@ $(document).ready(function() {
tot = sb_tot + calculateTax();
$('#subtotal').val(sb_tot.toFixed(2));
$('#invoicetax').val(calculateTax().toFixed(2));
- $('#grandtotal').val(tot.toFixed(2));
+ $('#grandtotal').val(Math.round(tot.toFixed(2)));
$('#dt_amount').attr('readonly', true);
$('#dt_amount').val(tot.toFixed(2));
@@ -1530,7 +1532,7 @@ $(document).ready(function() {
{
$('#subtotal').val(calculateSubtotal().toFixed(2));
$('#invoicetax').val(calculateTax().toFixed(2));
- $('#grandtotal').val(calculateTotal().toFixed(2));
+ $('#grandtotal').val(Math.round(calculateTotal().toFixed(2)));
$('#dt_amount').attr('readonly', true);
$('#dt_amount').val(calculateTotal().toFixed(2));
diff --git a/app/Views/sales_order_form.php b/app/Views/sales_order_form.php
index 156c7ac..80396fb 100644
--- a/app/Views/sales_order_form.php
+++ b/app/Views/sales_order_form.php
@@ -215,7 +215,7 @@
$tax_amount=0 ;
}
?>
-
+