
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Tax caluculation problem
Quoting murahashi (murahashi@ayayu.com):
> I did more tests about tax caluculation round off.
>
> TAXArea JP
> TAXField JP
> TAX Rate JP=5.0
>
> (CASE-A)
> frac_digits = 0
> Checkout.html showed below.
> Order-A1: Subtotal 190Yen ; Tax 10Yen (Correct)
> Order-A1: Subtotal 170Yen ; Tax 8Yen (This should be 9Yen)
> Order-A1: Subtotal 30Yen ; Tax 2Yen (Correct)
> Order-A1: Subtotal 10Yen ; Tax 0Yen (This should be 1Yen)
>
> In Japan, we have no decimal for calculated tax value.
> It seems IC rounded off in case of even, but not rounded off in case of odd.
> Is that right? Am I worng?
>
> Of course, when frac_digits = 2 , all of calclation are right . See below.
>
> (CASE-B)
> frac_digits = 2
> Checkout.html showed below.
> Order-A1: Subtotal 190.00Yen ; Tax 9.50Yen
> Order-A1: Subtotal 170.00Yen ; Tax 8.50Yen
> Order-A1: Subtotal 30.00Yen ; Tax 1.50Yen
> Order-A1: Subtotal 10.00Yen ; Tax 0.50Yen
I think this may be a problem in the round_to_frac_digits
routine -- it doesn't operate when the number is zero.
Try this patch to Util.pm:
Index: Util.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Util.pm,v
retrieving revision 2.7
diff -u -r2.7 Util.pm
--- Util.pm 2001/10/31 22:22:35 2.7
+++ Util.pm 2001/11/15 07:16:55
@@ -203,7 +203,8 @@
# use what we were given
}
elsif ( $Vend::Cfg->{Locale} ) {
- $digits = $Vend::Cfg->{Locale}{frac_digits} || 2;
+ $digits = $Vend::Cfg->{Locale}{frac_digits};
+ $digits = 2 if ! defined $digits;
}
else {
$digits = 2;
If it works for you, I will then put it in the distribution.
Thank you very much for the investigation.
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Fast, reliable, cheap. Pick two and we'll talk. -- unknown
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users