TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

round my brutto price

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: openend
Date: 2013-07-31
Time: 09:58

round my brutto price

Hi,

I have some articles stored in my db.
The 'netto' price for example is 15.08 Euro (my_blk.price) but the brutto must be '17,95 €' <-- price * 0.19 + netto price

I figured it out to handle the percent math with this line (ope):
<li class="price">[my_blk.price;ope=mul:0.19,add:[my_blk.price]]</li>

Result: 17.9452
but it has to be: 17,95

How can I round the value?
By: openend
Date: 2013-07-31
Time: 10:08

Re: round my brutto price

<li class="price">[item_pagination.price;ope=mul:0.19,add:[item_pagination.price];frm='0.00']</li>

frm='0.00' is my friend ;-)
By: Skrol29
Date: 2013-07-31
Time: 11:35

Re: round my brutto price

Yes,

But since your VAT (19%) may change one day, it is better to manage this at the PHP side.
Your VAT should be in a varibale or in a SQL table, and you data should have both price with and without VAT.
By: openend
Date: 2013-07-31
Time: 11:53

Re: round my brutto price

That's true Skrol29.
My backend is not finished yet...
so much to do today. But TBS helps me to make it stronger and faster ;-)