Arithmetic operation with decimal

why the division doesn’t work?

<L00>Benvenuti!
<L00>Ricevuta N.
<L00>del {TICKET DATE}
<DB>
<F>
{ENTITIES}

<F>-

{ORDERS}

[ORDERS]
<J10>- {QUANTITY} {NAME}|{TOTAL AMOUNT}


[LAYOUT]

<F>-

<J21> |Imponibile: [=TN('{TICKET TOTAL}')/(1.1)]
<J21> |% IVA: 10
<J21> |Totale: {TICKET TOTAL}

[ENTITIES:Cliente]
-- Customer entity format
<L00>{ENTITY NAME:Cliente}
<L00>{ENTITY DATA:Indirizzo}
<L00>{ENTITY DATA:Città} ({ENTITY DATA:Prov.})
<L00>{ENTITY DATA:CAP}
<L00>P.IVA: {ENTITY DATA:P. IVA}

I assume you are referring to this part: [=TN('{TICKET TOTAL}')/(1.1)] ?

I tested it, it works fine for me.

I added this to my existing template just to test:

Preview:

You probably also want to use other formatting tags to round the result to the decimal places you need, e.g. :

[=F(TN('{TICKET TOTAL}')/(1.1),'#0.00')]

Read more here

1 Like

I just tested it on v4.1.82 and it worked just fine for me as well.


I google translated that, it means taxable in English. Actually this is not how you should show the pre tax total in SambaPOS. It would appear you have not setup SambaPOS with your tax settings and are just using this single calculation to show the pre-tax total. It’s a guess but it looks like that.

You need to setup SambaPOS to handle your taxes. There is a guide here for V3, it is still relevant for V4 and V5 (I can’t find anything as good for V4 / V5) - https://sambapos.org/wiki/doku.php/en/how_to_configure_multiple_taxes.

You can use {TAX RATE}, {TAXABLE AMOUNT} and {TAX AMOUNT} tags in your receipt.

2 Likes

Unbelievable, if I do /(1.1)], it doesn’t work, but if I do /(0.1)] it works!!!
I have this simple fax model so my intention was to use this simple formula.

As you see in my screenshots it does work. Maybe the result is not what you expected?

Your tax model will just be like any other basic tax model out there. And even though you might feel it is easier to add just a simple calculation like this in your receipt template, it actually means you are not storing any of your business accounting data in SambaPOS correctly to handle tax. When comes the time you need to provide this information to your accountant or tax department, you won’t easily have this data ready. That is why it is very important to use the tax features built into SambaPOS so you store this information correctly. For example, possibly some items you sell or some services might not be taxable? And even if not, it is far better from an accounting point of view to store this information correctly in your POS software.

2 Likes