Open pramodhemmady opened 3 years ago
It is show only products value and quantity.doesn't calculate the sale bill and purchase bill amount.
Hi @pramodhemmady
Yes, the totals are not calculated and it’s like this on purpose. At the time of making the project, the requirement was to allow the user to enter the total manually after they do some tax-based calculations and add them up. This is why the tax fields and the total are editable so the user can manually enter the values and save them to database.
If you wanna calculate the total, add this js function to both the sale_bill.html
and purchase_bill.html
files.
window.onload = function total() {
var total = 0;
{% for item in items %}
total += {{ item.totalprice }}
{% endfor %}
console.log(total);
document.getElementById("total").value += total;
}
In the same files, replace the input field for 'Total' with this code
<input
id="total"
type="text"
name="total"
class="align-middle"
style="border: 0; overflow: hidden"
/>
This should calculate the total and display it on the input field every time you load the page. This is a temp fix and I cannot implement a permanent fix because that requires changing the database design and it can break existing databases. You can also remove other tax fields from the html file as those fields can be null and it won’t have any problems with the database.
Hope this helps
I have added the calculation of bill total (for initial bill). Users can still do some tax calculation and add the final bill total manually as well
In this project purchase bill and sale bills total are not calculating.