Grand total is different from net total

The calculation of grand total (not the based currency) in Purchase Order and Sales Order seems to be different from the net total. The difference is usually a few cents from the net total. Is it due the the conversion rate calculation?

Hello,

Please check if you have added any taxes or other charges in the transactions.

Net Total + Taxes and Charges = Grand Total

Totals for both customer/Supplier and your base currency will be different. Check Totals section (after Taxes and Charges) for Totals in particular currency.

If this doesn’t help, please revert with screenshot indicating an error.

Hello,

Please check if you have added any taxes or other charges in the transactions.

Net Total + Taxes and Charges = Grand Total

Totals for both customer/Supplier and your base currency will be different. Check Totals section (after Taxes and Charges) for Totals in particular currency.

If this doesn’t help, please revert with screenshot indicating an error.

There is no tax. The based currency is Singapore dollar (SGD) and the Purchase Order is created in USD. We have a conversion rate at 1.270. I had a look at the code purchase_common.js and found that the grand_total_import is calculated by converting grand_total. Al the item prices are in USD. And the grand_total_import is not calculated directly from the sum of items in USD but it is converted from the grand_total ( sum of all items in home currency) to USD. And I think this causes the discrepancy of the few cents?

Can I propose to change the way of how grand_total_import (the grand total in the document currency) from

this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);

to

this.frm.doc.grand_total_import = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total / this.frm.doc.conversion_rate : this.frm.doc.net_total_import);

And the similar goes to selling_common.js?

This will calculate the grand_total_import directly from the net_total_import.

I am afraid it will have similar issue and there be some difference in term of cents when the conversion from the tax is added to it. The tax table is on keeping the total in home currency and we have to convert again.

Is is possible to calculate the tax based on the document currency and have extra fields in the tax table to keep them.

Or is there a better way to do conversion so that there is no discrepency in the conversion?

Thanks for the proposal :smile:

Fixed it via minor fix · frappe/erpnext@8a00319 · GitHub

@nabinhait, I think there is still an issue. Not in all cases but I got an purchase invoice that is still not calculating the correct grand total - currency all the same so not conversions.

My tax is inclusive so not sure if that needs to be factored into the calculations.

Awaiting your feedback.

regards
Hemant

Hi @gohyc, would you mind sharing your form ? I liked the design :smile:

@rmehta can we make some kind of repo for customized forms please? It would be good if from your side to let everyone contribute…

@hpema108 Can you please create a dummy purchase invoice in demo.erpnext.com replicating the issue and share the ID here? It will help a lot to solve the issue.

Hi @nabinhait

PINV-00093 is created and I see that the totals match - so then I looked at my versions and im still on erpnext v6.19.0. I do the bench update but its still remains on this version, im I doing something wrong cause demo is on v6.27.0?

How do I update to v27?

regards

@nabinhait

I tried all different types of options and the calculation is correct on demo and not on my instance.

I have also started from scratched and re-installed with the same version of erpnext as demo.

The only difference I see is that my base currency is ZAR and demo is USD, so I cannot replicate exactly the scenario I have, any other suggestions to figure this out?

regards
Hemant

@nabinhait, almost thought I was going crazy…but got it to replicate.

This is what I done to PINV-00093 on demo. I have on my instance a invoice with multiple lines of the same product. The reason for this is that im importing using the rest api all the serial numbers and purchases linked to those invoices and I am doing them in batches of 1000 or less so its why there are more then 1 line on invoice. Nevertheless I started to do the same on demo but without the receipt. When I get to entering the forth line the difference appears and remains till I finish all the lines. Have a look and tell me what you find.

Please if you have more questions let me know, but I have now created a supplier invoice that shows the grand total not balancing with the total on the invoice.

regards
Hemant