how calculate the total of an invoice with several units of the same product

when you calculate invoices with several amounts, the total calculated with an unique invoice of 100 units, must to be the same that if you create 100 invoices of 1 unit each one. if you multiply 100 units * 15.5 and after multiplicate by 13% of tax, the roundings provoque a wrong result 100*15.5 = 1550 >>> The total of the invoice is by this wrong method: 1550 +(1550 * 13%) = 1550+201.5=1751.5. The wrong total tax is 1550*13%=201.5. How to calculate the total tax amount. You have to calculate the tax per unit, and after that, multiply the tax by the amount of units of that product: 1 UNIT               price tax tax without rounding tax rounded   amount total tax   15,5 13% 2,015 2,02   1 2,02 Then, if 1 unit is 2,02(with tax) then 110 units have to be = 100 … Siga Leyendo