[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Sales Tax Calculation
Ryan
Thanks for the sarcasm...
Further testing showed that any sales amount that ended with .25 or .75
always generated tax that was off by 1 cent. (Using a tax rate of 6%,
entered in salestax.asc as .06 or .060 made no difference.)
The error seems to stem from the sprintf used in calculating the tax. I
guess Perl is not "rounding" properly.
Actual Number Minivend Reports Should be
.02 .02 .02
.024 .02 .02
.025 .02 .03
.026 .03 .03
So this is what I did...
sub salestax
...
...
$r = $r + .000001;
$r = sprintf("%.${prec}f", $r);
return $r;
I added the "$r = $r + .000001;" as a workaround which made things work
out properly. (Kludgey I agree but it works)
John
-------------------------------------------------------------------------
NetRom Internet Services 973-208-1339 voice
john@netrom.com 973-208-0942 fax
http://www.netrom.com
-------------------------------------------------------------------------
On Tue, 14 Sep 1999, Ryan Hertz wrote:
> ****** message to minivend-users from Ryan Hertz <rhertz@gyb.baits.com> ******
>
> At 06:06 PM 9/14/1999 , John Vozza wrote:
> >****** message to minivend-users from John Vozza <john@netrom.com>
> ******
> >
> >Running Minivend 3.12 and there appears to be an issue with sales tax
> >rounding.
> >
> >Consider an order total of $24.25 with 6% tax. The correct tax should be
> >$1.46 vs the $1.45 that Minivend calculates. (24.25 * .06 = 1.455)
> >
> >Another example is an order of $113.25 with 6% tax. Correct tax is $6.80
> >vs Minivend's $6.79
> >
> >Out of several hundred orders the client has found only 4 such errors but
> >errors none the less. (Well they only reported 4 errors, might be more. I
> >did offer the client a 4 cent refund, they were not amused.)
>
> :-) I have not had any such problems -- all of my tax amounts have rounded
> correctly.
>
> >Could some one point me in the right direction in the src code so that I
> >can try and correct this issue?
>
> I would research the configuration of your store. All of my data in
> salestax.asc go back three places (%7.8 = .078) If you really want to muck
> around in the source code and can't find where the routines are at I would
> seriously re-consider.
>
>
>
> Ryan Hertz tel 800-645-BAIT
> Webmaster fax 520-645-2588
> Advertising Director http://www.insideline.net
> Gary Yamamoto Custom Baits, Inc. http://www.yamamoto.baits.com
> -
> To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list
>