bbnepal new changes

This commit is contained in:
2024-10-08 15:47:07 +05:45
parent ad3e5eb1ec
commit 4ac5a5e491
9 changed files with 79 additions and 34 deletions

View File

@ -49,6 +49,7 @@
<th width=50%>Items <span class="text-danger">*</span></th>
<th class="text-center" width=5%>Qty <span class="text-danger">*</span></th>
<th class="text-center" width=5%>Units</th>
<th class="text-center" width=13%>VAT<span class="text-danger">*</span></th>
<th class="text-center" width=13%>Rate <span class="text-danger">*</span></th>
<th class="text-right" width=20%>Amount</th>
<th width=5%></th>
@ -65,7 +66,9 @@
</select></td>
<td> <input type="text" class="form-control input-group-sm" name="qty[]" required></td>
<td><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
<td><input type="number" name="vat[]" class="form-control vat" required></td>
<td><input type="text" class="form-control" name="rate[]" required></td>
<span class="total-price"></span>
<td><input type="text" class="form-control" name="ltotal[]" required></td>
<td>
<button type="button" class="btn btn-primary btn-xs add-row">
@ -98,9 +101,9 @@
<td></td>
</tr>
<tr>
<td class="text-right"><b><input type="checkbox" name="vat_checkbox" id="vat_checkbox"
<td class="text-right d-none"><b><input type="checkbox" name="vat_checkbox" id="vat_checkbox"
>13% VAT</b></td>
<td class="text-right">
<td class="text-right d-none">
<input type="text" class="form-control" id="tax">
<td></td>
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
@ -150,7 +153,7 @@
}
});
$(document).on('input', '.sales-detail-duplicator input[name^="qty"], .sales-detail-duplicator input[name^="rate"]', function() {
$(document).on('input', '.sales-detail-duplicator input[name^="qty"],.sales-detail-duplicator input[name^="vat"], .sales-detail-duplicator input[name^="rate"]', function() {
calculateLineTotal($(this).closest('tr'));
calculateTotals();
});
@ -178,9 +181,13 @@
function calculateLineTotal(row) {
var quantity = parseFloat(row.find('input[name^="qty"]').val());
var rate = parseFloat(row.find('input[name^="rate"]').val());
if (!isNaN(quantity) && !isNaN(rate)) {
var vat = parseFloat(row.find('input[name^="vat"]').val());
if (!isNaN(quantity) && !isNaN(rate) && !isNaN(vat)) {
var lineTotal = quantity * rate;
row.find("input[name^='ltotal[]']").val(lineTotal.toFixed(2));
var vat_amt =(vat/100)*lineTotal;
var ltotal =lineTotal + vat_amt ;
console.log(lineTotal,vat_amt,ltotal);
row.find("input[name^='ltotal[]']").val(ltotal.toFixed(2));
}
@ -269,7 +276,8 @@
}
var taxable = subtotal - discountamount;
var tax = taxable * tax_percentage;
var grandTotal = taxable + tax;
// var grandTotal = taxable + tax;
var grandTotal = taxable;
$('#subtotal').val(subtotal.toFixed(2));
$("#taxable").val(taxable.toFixed(2));

View File

@ -29,6 +29,7 @@
<span class="col item_name"><?php echo myLang("Particulars") ?></span>
<span class="col item_qty"><?php echo myLang("Qty") ?></span>
<span class="col item_rate"><?php echo myLang("Rate") ?></span>
<span class="col item_vat"><?php echo myLang("VAT") ?></span>
<span class="col item_amount"><?php echo myLang("Amount") ?></span>
</div>
<?php $l = 0;
@ -36,8 +37,9 @@
<div class="row ml-2 mr-2">
<span class="col item_name"><?php echo $r->Item->title; ?></span>
<span class="col item_qty"><?php echo $r->qty; ?></span>
<span class="col item_rate text-right"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_amount text-right"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
<span class="col item_rate"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_vat"><?php echo myCurrency($r->vat, true); ?></span>
<span class="col item_amount"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
</div>
<?php endforeach; ?>
<div class="row ml-2 mr-2" style="border-top: 1px dotted;">

View File

@ -29,14 +29,14 @@
<td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td class="text-center"><?php echo ($TableRow->Details[$key]->Item->title) ?? ""; ?></td>
<td><?php echo $TableRow->sales_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?>
</td>
<td><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name)?? ""); ?>
</td>
<td><?php echo myCurrency($TableRow->totalsales); ?></td>
<td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
<?php showDeleteButton($TableRow->sales_id); ?>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<tbody>
</table>
<script>

View File

@ -23,7 +23,7 @@
<div class="col">
<p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p>
<p><strong>Date:</strong> <?php echo dbDate($Sales->sales_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name; ?></p>
<p><strong>Vendor:</strong> <?php echo (($this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name ?? "")); ?></p>
</div>
</div>
@ -40,6 +40,9 @@
<div class="col text-right">
<p><strong>Price</strong></p>
</div>
<div class="col text-right">
<p><strong>VAT</strong></p>
</div>
<div class="col text-right">
<p><strong>Total</strong></p>
</div>
@ -57,6 +60,9 @@
<div class="col">
<p><?php $rate=$SalesDetail->rate; echo myCurrency($rate); ?></p>
</div>
<div class="col">
<p><?php $vat=($SalesDetail->vat); echo myCurrency($vat); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div>
@ -80,9 +86,11 @@
<?php //print_r($Purchase->vatToggle);die; ?>
<!-- <?php //if($Sales->vatToggle != 1): ?> -->
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
<!-- <p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p> -->
<!-- <?php //endif; ?> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p>
<!-- <p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable),true); ?></p>
</div>
</div>