[ic] Easiest way to display price inc VAT/TAX??

interchange at tvcables.co.uk interchange at tvcables.co.uk
Sun Sep 5 11:02:14 EDT 2004


Quoting Jonathan Clark <jonc at webmaint.com>:

> > > > All prices are stored in the database ex VAT, what is the
> > easiest way to
> > > > DISPLAY prices inc VAT? I found a thread referring to this which
> > > > mentions "$price /= 1.175" (assumes 17.5%), how do I use that???
> > >
> > > For retail type catalogs where you tend to display prices inc
> > VAT, we tend
> > > to set the price in the products table including VAT and display the VAT
> > > content on the checkout/receipts.
> > >
> > > The reason for this is that using a two decimal ex vat price it
> > is not to
> > > get some inc vat prices to display due to rounding.
> > >
> > > Alternatively, here is Jamie Neil's solution:
> > >
> > >
> > http://www.icdevgroup.org/pipermail/interchange-users/2003-May/033058.html
> > >
> > > Jonathan
> >
> > Thanks Jonathan,
> >
> > Having read your post after modding the whole site I now have the problem
> > across the whole site, typical example:-
> >
> > Item in database ex VAT price =3.40
> >
> > With 17.5% VAT the price becomes 3.995 so the single price will
> > either show
> > £3.99 or £4.00, IC rounds up showing £4.00. Of course if you try buying a
> > quantity the whole calculation goes wrong because £4.00 x Qty 4 = £16.00
> > whereas the subtotal function of IC actually caclulates it
> > correctly at 3.995
> > * 4 * 1.175 = £15.98
> >
> > Having now modded the whole site to display an inc VAT price
> > calculated from
> > the database ex VAT price (which is what I need), what is the
> > best solution?
> 
> If you _need_ ex vat prices stored, then how about a custom usertag for the
> pricing which works out the price including the vat, rounds it down so it
> looks the way you want (eg. 4.997 becomes 4.99) and then back-calculates the
> ex vat price which it then returns (to a greater number of decimals). Of
> course this is a cludge. A better idea would be to store your ex vat prices
> to four decimals.
> 
> 
> Jonathan.

I've fixed it now, I have changed the database price field to (12,4) so 4 
decimal places are stored for the ex VAT price. This works very well.

Andy.





More information about the interchange-users mailing list