[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: return of BigFloat errors
- Subject: Re: return of BigFloat errors
- From: Michael Richardson <..hidden..>
- Date: Mon, 31 Dec 2012 14:24:52 -0500
I have traced things.
In bin/aa.pl, in create_links, there is code which iterates for
$form->{rowcount} times which in this case is 15.
Yet, I have only 8 valid rows.
I can share /tmp/form1 is someone wants.
I find it weird looking at /tmp/form1, because amount_1..8 are actually:
'amount_1' => bless( {
'_e' => bless( do{\(my $o = undef)}, 'Math::BigInt::GMP' ),
'_es' => '-',
'_m' => bless( do{\(my $o = undef)}, 'Math::BigInt::GMP' ),
'sign' => '+'
}, 'Math::BigFloat' ),
which seem to be an empty (==0?) BigFloat.
I'd have thought to see my actual expense amount. In fact, I can't find
the expense amounts anywhere, although I see stuff like:
'AP_amount' => [
{
'source' => undef,
'memo' => 'IRVING GAS',
'accno' => '5785',
'description' => 'travel costs',
'transdate' => '2011-01-27',
'entry_id' => 16885,
'projectnumber' => 'novavision',
'amount' => bless( {
'_m' => bless( do{\(my $o = undef)}, 'Math::BigInt::GMP' ),
'_es' => '-',
'_e' => bless( do{\(my $o = undef)}, 'Math::BigInt::GMP' ),
'sign' => '-'
}, 'Math::BigFloat' ),
'exchangerate' => bless( {
'_es' => '+',
'_m' => bless( do{\(my $o = undef)}, 'Math::BigInt::GMP' ),
'_e' => bless( do{\(my $o = undef)}, 'Math::BigInt::GMP' ),
'sign' => '+'
}, 'Math::BigFloat' ),
'project_id' => 79253,
'cleared' => 0
},
I don't see the amount 16.03 anywhere in the form.
if ( $form->{taxincluded} ) {
$diff = 0;
# add tax to individual amounts
# XXX needs alteration for conditional taxes
# added by mcr:
open(OUT1, ">>/tmp/form1");
$Data::Dumper::Sortkeys = 1;
print OUT1 "FORM[$i] ".Dumper($form)."\n";
close(OUT1);
for $i ( 1 .. $form->{rowcount} ) {
if ($netamount) {
# $form->{"amount_9"} does not exist
# $form->{rowcount} = 15.
$amount = $form->{"amount_$i"} * ( 1 + $tax / $netamount );
$form->{"amount_$i"} = $form->round_amount( $amount, 2 );
}
}
}
I am hacking the code as follows:
- if ($netamount) {
+ if ($netamount && defined($form->{"amount_$i"})) {
--
] He who is tired of Weird Al is tired of life! | firewalls [
] Michael Richardson, Sandelman Software Works, Ottawa, ON |net architect[
] ..hidden.. http://www.sandelman.ottawa.on.ca/ |device driver[
Kyoto Plus: watch the video <http://www.youtube.com/watch?v=kzx1ycLXQSE>
then sign the petition.