1 (edited by ricardo777 01/13/2013 04:05:15 pm)

Topic: Tax calculated wrong

Hello,

We have a big issue with TAX calculation.

I are using version Mercurial Build 3131

We have setup frontaccounting with Import TAX from the wiki.

But when we enter amount with the import tax with feature Quick Entry, the amounts are correctly showing.

But when I go to Banking and General Ledger > Tax Inquiry it shows not the same amount (29.30) but it shows 29.29 missing 1 cent.


Have found a temp fix, settings the Page Preferences > Decimal Places > Prices/Amounts: from 2 to 4 and do the same procedure adding a new invoice of amount 29.3000 now with more Decimals the amount is correct in Tax Inquiry.

So we have a problem with the tax calculation or rounding.

Hope someone have a good fix that we don't have to use the 4 decimals.

Thanks

Re: Tax calculated wrong

This happens when not rounding off as would occur in integer division. The only place in gl/includes/db/gl_db_trans.inc where such a calculation occurs is at line 360:

$net_amount = $amount/$tax['rate']*100;

What needs to be done is how the $dec is being used from the Page Preferences > Decimal Places > Prices/Amounts.

3 (edited by ricardo777 01/14/2013 12:01:25 pm)

Re: Tax calculated wrong

Thanks for the reply and help.

But sorry I don't see the solution, I am not really familiar with php.

Re: Tax calculated wrong

What version of MySQL / PHP are you using - is it possible that it is a quirk of some computation rounding off errors in some versions? What are the numbers involved - Tax Rate, Amount given, Amount expected?

5 (edited by ricardo777 01/14/2013 03:49:08 pm)

Re: Tax calculated wrong

From Directadmin:

Apache 2.4.3    Running
MySQL 5.5.27    Running
Php 5.4.10    Installed

But it is running php v5.3(5.4 is dual php version)

Also if I remember good I also have tried php v 5.4

TAX rate is 21%

I am adding the amount of €29.90 and using the function Import tax so with quick entry adding the tax to GL item.

In the invoice payment and bank it shows 29.90 and the right TAX, but when I go to General Ledger > Tax Inquiry it shows the right TAX amount but the invoice is now 29.29. So missing 1 cent.

If you need I can provide access to frontaccounting or other information.

Have tried different versions of frontaccounting but I can replicate the problem.

Thanks

Re: Tax calculated wrong

Sorry the amount of €29.90 is wrong it is €29.30 so missing 1 cent.

Re: Tax calculated wrong

Please state the exact numbers involved in the division / multiplication like base amount and / or final amount, taxrate(21%), erroneous amount (29.29, 29.30) name, etc.
Also one navigation is given as General Ledger > Tax Inquiry and what is the other navigation for invoice?

8 (edited by ricardo777 01/16/2013 04:41:19 pm)

Re: Tax calculated wrong

Thanks for the reply.

The base amount of the purchase is 29.30

then the tax is 21.000% calculated via Import tax found on:

frontaccounting.com/fawiki/index.php?n=Main.TaxSystem

then the amounts are after using the import tax quick entry

Sub-total:    29.30
(%)    -6.15
(%)    6.15
Invoice Total:    29.30

Then I save the page.

Then I go to Tax report and it shows this:

Supplier Invoice 21 13/01/2013 - 29.29 21.00 6.15 BTW IC
Supplier Invoice 21 13/01/2013 -- 29.29 21.00 -6.15 BTW hoog

But the amount given was 29.30 not 29.29

Tax inquiry shows the same

Type    Description    Amount    Outputs/Inputs
BTW hoog 21%    Charged on sales (Output Tax):    11.87    56.53
BTW hoog 21%    Paid on purchases (Input Tax):    -6.15    -29.29
BTW hoog 21%    Net payable or collectible:    5.72   
BTW IC 21%    Charged on sales (Output Tax):    0.00    0.00
BTW IC 21%    Paid on purchases (Input Tax):    6.15    29.29
BTW IC 21%    Net payable or collectible:    6.15   
Total payable or refund:    11.87

When I watch Reports and Analysis > Balance Sheet

Account Account Name Open Balance Period Close Balance
Assets
HUIDIGE ACTIVA
1200 Debiteuren 0.00 68.40 68.40
Total HUIDIGE ACTIVA 0.00 68.40 68.40
Total Assets 0.00 68.40 68.40
Liabilities
HUIDIGE PASSIVA
2100 Crediteuren 0.00 29.30 29.30
2310 BTW hoog 0.00 5.72 5.72
2312 BTW IC 0.00 6.15 6.15
Total HUIDIGE PASSIVA 0.00 41.17 41.17
Total Liabilities 0.00 41.17 41.17
Calculated Return 0.00 27.23 27.23
Total Liabilities and Equities 0.00 68.40 68.40

Re: Tax calculated wrong

Still no help?

10 (edited by apmuthu 01/27/2013 12:43:32 pm)

Re: Tax calculated wrong

29.30 * 0.21 = 6.153 (Stored as 6.15)

29.30 - 6.153 = 23.147

23.147 may have been stored as 23.14 in the table
23.14 + 6.15 = 29.29 -> one possibility.

Now when preparing the report (dividing factor = 1.00 - 0.21):
23.14 / 0.79 = 29.2911 rounded off to 29.29 -> second possibility.

That is how the error comes in.

The fix should be in storing the properly rounded value in the table and in small value divisions these errors make it to the hundredths position and show up.

Anyone working in a bank that uses FA type accounting system can take all the less than 1 cent values into their account and make millions on billions of transactions!