summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-07 06:02:01 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-07 06:02:01 +0000
commitf8f327d55e2c3bb14286ca4ac796917449f8cd3f (patch)
tree1228ded4a91f756e4dda6a69924bd0b2de16c0d2 /LedgerSMB
parent882f13b82286fc92d15efaa0a88919bb8febee1a (diff)
Applying patch to bugs 1699718 and 1713439
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1145 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/AA.pm8
-rwxr-xr-xLedgerSMB/AM.pm2
-rwxr-xr-xLedgerSMB/CP.pm4
-rwxr-xr-xLedgerSMB/Form.pm50
-rwxr-xr-xLedgerSMB/IR.pm9
-rwxr-xr-xLedgerSMB/IS.pm5
-rwxr-xr-xLedgerSMB/OE.pm27
-rw-r--r--LedgerSMB/PriceMatrix.pm2
-rwxr-xr-xLedgerSMB/RC.pm20
-rwxr-xr-xLedgerSMB/RP.pm13
10 files changed, 108 insertions, 32 deletions
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm
index be1ac8eb..055120fa 100755
--- a/LedgerSMB/AA.pm
+++ b/LedgerSMB/AA.pm
@@ -875,6 +875,7 @@ sub transactions {
$sth->execute(@paidargs) || $form->dberror($query);
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth => $sth, hashref => $ref);
$ref->{exchangerate} = 1 unless $ref->{exchangerate};
if ( $ref->{linetotal} <= 0 ) {
@@ -963,7 +964,7 @@ sub get_name {
$sth->execute(@queryargs) || $form->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
-
+ $form->db_parse_numeric(sth => $sth, hashref => $ref);
if ( $form->{id} ) {
for (qw(currency employee employee_id intnotes)) {
delete $ref->{$_};
@@ -1028,7 +1029,9 @@ sub get_name {
$sth = $dbh->prepare($query);
$sth->execute( $form->{"$form->{vc}_id"} ) || $form->dberror($query);
- while ( my ( $amount, $exch ) = $sth->fetchrow_array ) {
+ while ( my @ref = $sth->fetchrow_array ) {
+ $form->db_parse_numeric(sth => $sth, arrayref => \@ref);
+ my ($amount, $exch) = @ref;
$exch = 1 unless $exch;
$form->{creditremaining} -= $amount * $exch;
}
@@ -1099,6 +1102,7 @@ sub get_name {
my %a = ();
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth => $sth, hashref => $hashref);
if ( $tax{ $ref->{accno} } ) {
if ( not exists $a{ $ref->{accno} } ) {
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index adc2d74b..bc536bec 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -382,7 +382,7 @@ sub save_gifi {
}
$sth = $dbh->prepare($query);
- $sth->execute(@queryargs) || $form->dberror;
+ $sth->execute(@queryargs) || $form->dberror($query);
$sth->finish;
$dbh->commit;
diff --git a/LedgerSMB/CP.pm b/LedgerSMB/CP.pm
index 7d20ccc3..e7031353 100755
--- a/LedgerSMB/CP.pm
+++ b/LedgerSMB/CP.pm
@@ -499,7 +499,7 @@ sub post_payment {
$form->{"paid_$i"} =
$form->round_amount( $form->{"paid_$i"} * $exchangerate, 2 );
- $pth->execute( $form->{"id_$i"} ) || $form->dberror;
+ $pth->execute( $form->{"id_$i"} ) || $form->dberror($pth->statement);
($amount) = $pth->fetchrow_array;
$pth->finish;
@@ -774,7 +774,7 @@ sub post_payments {
$paid = $form->round_amount( $paid * $exchangerate, 2 );
- $pth->execute( $form->{"id_$i"} ) || $form->dberror;
+ $pth->execute( $form->{"id_$i"} ) || $form->dberror($pth->statement);
($amount) = $pth->fetchrow_array;
$pth->finish;
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 24504afc..d582399a 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -581,6 +581,25 @@ sub round_amount {
return $amount;
}
+sub db_parse_numeric {
+ my $self = shift;
+ my %args = @_;
+ my ($sth, $arrayref, $hashref) = ($args{sth}, $args{arrayref},
+ $args{hashref});
+ my @types = @{$sth->{TYPE}};
+ my @names = @{$sth->{NAME_lc}};
+ for (0 .. $#names){
+ if ($types[$_] == 3){
+ $arrayref[$_] = Math::BigFloat->new($arrayref[$_])
+ if defined $arrayref;
+ $hashref->{$names[$_]} = Math::BigFloat->new($hashref->{$names[$_]})
+ if defined $hashref;
+ }
+
+ }
+ return ($hashref || $arrayref);
+}
+
sub callproc {
my $procname = shift @_;
my $argstr = "";
@@ -1414,7 +1433,7 @@ sub add_date {
$mm--;
- @t = localtime( timelocal( 0, 0, 0, $dd, $mm, $yy ) + $diff );
+ @t = localtime( Time::Local::timelocal( 0, 0, 0, $dd, $mm, $yy ) + $diff );
$t[4]++;
$mm = substr( "0$t[4]", -2 );
@@ -1739,6 +1758,7 @@ sub get_exchangerate {
$sth->execute( $curr, $transdate );
($exchangerate) = $sth->fetchrow_array;
+ $exchangerate = Math::BigFloat->new($exchangerate);
}
$sth->finish;
@@ -2184,6 +2204,10 @@ sub create_links {
# get last customers or vendors
my ( $query, $sth );
+ if (!$self->{dbh}) {
+ $self->db_init($myconfig);
+ }
+
$dbh = $self->{dbh};
my %xkeyref = ();
@@ -2245,6 +2269,7 @@ sub create_links {
$sth->execute( $self->{id} ) || $self->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
+ $self->db_parse_numeric(sth=>$sth, hashref=>$ref);
foreach $key ( keys %$ref ) {
$self->{$key} = $ref->{$key};
@@ -2720,19 +2745,19 @@ sub save_recurring {
$query = qq|DELETE FROM recurring
WHERE id = ?|;
- $sth = $dbh->prepare($query);
+ $sth = $dbh->prepare($query) || $self->dberror($query);
$sth->execute( $self->{id} ) || $self->dberror($query);
$query = qq|DELETE FROM recurringemail
WHERE id = ?|;
- $sth = $dbh->prepare($query);
+ $sth = $dbh->prepare($query) || $self->dberror($query);
$sth->execute( $self->{id} ) || $self->dberror($query);
$query = qq|DELETE FROM recurringprint
WHERE id = ?|;
- $sth = $dbh->prepare($query);
+ $sth = $dbh->prepare($query) || $self->dberror($query);
$sth->execute( $self->{id} ) || $self->dberror($query);
if ( $self->{recurring} ) {
@@ -2763,10 +2788,10 @@ sub save_recurring {
# calculate nextdate
$query = qq|
- SELECT current_date - date ? AS a,
- date ? - current_date AS b|;
+ SELECT current_date - ?::date AS a,
+ ?::date - current_date AS b|;
- $sth = $dbh->prepare($query);
+ $sth = $dbh->prepare($query) || $self->dberror($query);
$sth->execute( $s{startdate}, $enddate );
my ( $a, $b ) = $sth->fetchrow_array;
@@ -2782,15 +2807,8 @@ sub save_recurring {
my $nextdate = $enddate;
if ( $advance > 0 ) {
if ( $advance < ( $s{repeat} * $s{howmany} ) ) {
- %interval = (
- 'Pg' =>
- "(date '$s{startdate}' + interval '$advance $s{unit}')",
- 'DB2' => qq|(date ('$s{startdate}') + "$advance $s{unit}")|,
- );
-
- $interval{Oracle} = $interval{PgPP} = $interval{Pg};
- $query = qq|SELECT $interval{$myconfig->{dbdriver}}|;
+ $query = qq|SELECT (date '$s{startdate}' + interval '$advance $s{unit}')|;
($nextdate) = $dbh->selectrow_array($query);
}
@@ -3269,7 +3287,7 @@ sub audittrail {
$sth->bind_param( $i++, $newtrail{$key}{$_} );
}
$sth->bind_param( $i++, $employee_id );
- $sth->execute || $self->dberror;
+ $sth->execute() || $self->dberror($query);
$sth->finish;
}
}
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index 8523b870..714acf61 100755
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -337,6 +337,7 @@ sub post_invoice {
my $totalqty = $form->{"qty_$i"};
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref => $ref);
my $qty = $ref->{qty} + $ref->{allocated};
@@ -1034,6 +1035,7 @@ sub retrieve_invoice {
$sth->execute( $form->{id} ) || $form->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
for ( keys %$ref ) {
$form->{$_} = $ref->{$_};
}
@@ -1093,6 +1095,7 @@ sub retrieve_invoice {
my $ptref;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
my ($dec) = ( $ref->{fxsellprice} =~ /\.(\d+)/ );
$dec = length $dec;
@@ -1103,6 +1106,7 @@ sub retrieve_invoice {
my $taxrate = 0;
while ( $ptref = $tth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth => $tth, hashref => $ptref);
$ref->{taxaccounts} .= "$ptref->{accno} ";
$taxrate += $form->{"$ptref->{accno}_rate"};
}
@@ -1215,6 +1219,7 @@ sub retrieve_item {
my $ptref;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
my ($dec) = ( $ref->{sellprice} =~ /\.(\d+)/ );
$dec = length $dec;
@@ -1277,7 +1282,9 @@ sub exchangerate_defaults {
# get exchange rates for transdate or max
foreach $var ( split /:/, substr( $form->{currencies}, 4 ) ) {
$eth1->execute( $var, $form->{transdate} );
- ( $form->{$var} ) = $eth1->fetchrow_array;
+ @array = $eth1->fetchrow_array;
+ $form->db_parse_numeric(sth=> $eth1, arrayref=>\@array);
+ $form->{$var} = shift @array;
if ( !$form->{$var} ) {
$eth2->execute($var);
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index 97f894e4..e04fb1cd 100755
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -1516,6 +1516,7 @@ sub cogs {
my $qty;
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
if ( ( $qty = ( ( $ref->{qty} * -1 ) - $ref->{allocated} ) ) >
$totalqty )
{
@@ -1751,6 +1752,7 @@ sub retrieve_invoice {
$sth->execute( $form->{id} ) || $form->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=> $sth, hashref=>$ref_);
for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
$sth->finish;
@@ -1808,7 +1810,7 @@ sub retrieve_invoice {
my $ptref;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
-
+ $form->db_parse_numeric(sth=>$sth, hashref => $ref);
my ($dec) = ( $ref->{fxsellprice} =~ /\.(\d+)/ );
$dec = length $dec;
my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
@@ -1935,6 +1937,7 @@ sub retrieve_item {
my $transdate = $form->datetonum( $myconfig, $form->{transdate} );
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth => $sth, hashref => $ref);
my ($dec) = ( $ref->{sellprice} =~ /\.(\d+)/ );
$dec = length $dec;
diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm
index 5c253f50..f6a1f6be 100755
--- a/LedgerSMB/OE.pm
+++ b/LedgerSMB/OE.pm
@@ -220,6 +220,7 @@ sub transactions {
my %oid = ();
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{exchangerate} = 1 unless $ref->{exchangerate};
if ( $ref->{id} != $oid{id}{ $ref->{id} } ) {
push @{ $form->{OE} }, $ref;
@@ -774,6 +775,7 @@ sub retrieve {
$sth->execute( $form->{id} ) || $form->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
$sth->finish;
@@ -848,6 +850,7 @@ sub retrieve {
my $listprice;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
($decimalplaces) = ( $ref->{sellprice} =~ /\.(\d+)/ );
$decimalplaces = length $decimalplaces;
@@ -941,11 +944,16 @@ sub exchangerate_defaults {
# get exchange rates for transdate or max
foreach $var ( split /:/, substr( $form->{currencies}, 4 ) ) {
$eth1->execute( $var, $form->{transdate} );
- ( $form->{$var} ) = $eth1->fetchrow_array;
+ my @exchangelist;
+ @exchangelist = $eth1->fetchrow_array;
+ $form->db_parse_numeric(sth=>$eth1, arrayref=>\@exchangelist);
+ $form->{$var} = shift @array;
if ( !$form->{$var} ) {
$eth2->execute($var);
+ @exchangelist = $eth2->fetchrow_array;
+ $form->db_parse_numeric(sth=>$eth2, arrayref=>\@exchangelist);
- ( $form->{$var} ) = $eth2->fetchrow_array;
+ ( $form->{$var} ) = @exchangelist;
( $null, $form->{$var} ) = split / /, $form->{$var};
$form->{$var} = 1 unless $form->{$var};
$eth2->finish;
@@ -1116,7 +1124,10 @@ sub order_details {
$sth->execute( $form->{"id_$i"}, $form->{warehouse_id} )
|| $form->dberror;
- ($qty) = $sth->fetchrow_array;
+ my @qtylist = $sth->fetchrow_array;
+ $form->db_parse_numeric(sth=>$sth, arrayref=>\@qtylist);
+
+ ($qty) = @qtylist; $sth->fetchrow_array;
$sth->finish;
$form->{"qty_$i"} = 0 if $qty == 0;
@@ -1604,6 +1615,7 @@ sub assembly_details {
$sth->execute($id) || $form->dberror($query);
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
for (qw(partnumber description partsgroup)) {
$form->{"a_$_"} = $ref->{$_};
@@ -1773,7 +1785,9 @@ sub save_inventory {
$wth->execute( $form->{"id_$i"}, $warehouse_id )
|| $form->dberror;
- ($qty) = $wth->fetchrow_array;
+ @qtylist = $wth->fetchrow_array;
+ $form->db_parse_numeric(sth=>$wth, arrayref=>\@qtylist);
+ ($qty) = @qtylist;
$wth->finish;
if ( $ship > $qty ) {
@@ -2065,6 +2079,7 @@ sub get_inventory {
$sth->execute || $form->dberror($query);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{qty} = $ref->{onhand} - $ref->{qty};
push @{ $form->{all_inventory} }, $ref if $ref->{qty} > 0;
}
@@ -2152,6 +2167,7 @@ sub get_soparts {
$sth->execute( $form->{"ndx_$i"} );
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
&add_items_required( "", $dbh, $form, $ref->{id},
$ref->{required}, $ref->{assembly} );
}
@@ -2187,6 +2203,7 @@ sub add_items_required {
$sth->execute || $form->dberror($query);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=> $sth, hashref=> $ref);
&add_items_required( "", $dbh, $form, $ref->{id},
$required * $ref->{qty},
$ref->{assembly} );
@@ -2203,6 +2220,7 @@ sub add_items_required {
$sth = $dbh->prepare($query);
$sth->execute($parts_id) || $form->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
for ( keys %$ref ) {
$form->{orderitems}{$parts_id}{$_} = $ref->{$_};
}
@@ -2291,6 +2309,7 @@ sub generate_orders {
$sth = $dbh->prepare($query);
$sth->execute($vendor_id) || $form->dberror($query);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=> $ref);
$curr = $ref->{curr};
$taxincluded = $ref->{taxincluded};
$tax{ $ref->{accno} } = $ref->{rate};
diff --git a/LedgerSMB/PriceMatrix.pm b/LedgerSMB/PriceMatrix.pm
index 68fa5b12..2c6cc332 100644
--- a/LedgerSMB/PriceMatrix.pm
+++ b/LedgerSMB/PriceMatrix.pm
@@ -122,6 +122,7 @@ sub price_matrix {
while ( $mref = $pmh->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$mref);
# check date
if ( $mref->{validfrom} ) {
next
@@ -193,6 +194,7 @@ sub price_matrix {
$pmh->execute( $ref->{id} );
$mref = $pmh->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=>$sth, hashref=>$mref);
if ( $mref->{partnumber} ne "" ) {
$ref->{partnumber} = $mref->{partnumber};
diff --git a/LedgerSMB/RC.pm b/LedgerSMB/RC.pm
index a7aa1d1f..6ffc16bf 100755
--- a/LedgerSMB/RC.pm
+++ b/LedgerSMB/RC.pm
@@ -53,6 +53,7 @@ sub getposlines {
my $sth = $dbh->prepare($query);
$sth->execute( $pos_config{till_accno} ) || $form->dberror($query);
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
push @{ $form->{TB} }, $ref;
}
$sth->finish;
@@ -64,6 +65,7 @@ sub getposlines {
my $sth = $dbh->prepare($query);
$sth->execute( $pos_config{till_accno} ) || $form->dberror($query);
my $ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$form->{sum} = $ref->{sum};
$sth->finish;
}
@@ -101,6 +103,7 @@ sub getbalance {
my $sth = $dbh->prepare($query);
$sth->execute( $form->{accno} ) || $form->dberror($query);
my $ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$form->{balance} = $ref->{balance};
}
@@ -162,7 +165,9 @@ sub payment_transactions {
WHERE ch.accno = ? $transdate $cleared |;
$sth = $dbh->prepare($query);
$sth->execute( $form->{accno} );
- ( $form->{beginningbalance} ) = $sth->fetchrow_array();
+ my @balancelist = $sth->fetchrow_array();
+ $form->db_parse_numeric(sth=>$sth, arraylist=>\@balancelist);
+ ( $form->{beginningbalance} ) = @balancelist;
$query = qq|
SELECT sum(ac.amount)
@@ -173,7 +178,9 @@ sub payment_transactions {
$sth = $dbh->prepare($query);
$sth->execute( $form->{accno} );
- ( $form->{fx_balance} ) = $sth->fetchrow_array();
+ @balancelist = $sth->fetchrow_array();
+ $form->db_parse_numeric(sth=>$sth, arraylist=>\@balancelist);
+ ( $form->{fx_balance} ) = @balancelist;
$transdate = "";
if ( $form->{todate} ) {
@@ -190,7 +197,9 @@ sub payment_transactions {
$sth = $dbh->prepare($query);
$sth->execute( $form->{accno} );
- ( $form->{endingbalance} ) = $sth->fetchrow_array();
+ @balancelist = $sth->fetchrow_array();
+ $form->db_parse_numeric(sth=>$sth, arraylist=>\@balancelist);
+ ( $form->{endingbalance} ) = @balancelist;
# fx balance
$query = qq|
@@ -201,7 +210,9 @@ sub payment_transactions {
$sth = $dbh->prepare($query);
$sth->execute( $form->{accno} );
- ( $form->{fx_endingbalance} ) = $sth->fetchrow_array();
+ @balancelist = $sth->fetchrow_array();
+ $form->db_parse_numeric(sth=>$sth, arraylist=>\@balancelist);
+ ( $form->{fx_endingbalance} ) = @balancelist;
$cleared = qq| AND ac.cleared = '0'| unless $form->{fromdate};
@@ -392,6 +403,7 @@ sub payment_transactions {
my $ref;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
if ( $form->{summary} ) {
diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm
index 9b6e450e..e4e13f7a 100755
--- a/LedgerSMB/RP.pm
+++ b/LedgerSMB/RP.pm
@@ -91,6 +91,7 @@ sub inventory_activity {
$sth->execute() || $form->dberror($query);
@cols = qw(description sold revenue partnumber received expense);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{net_income} = $ref->{revenue} - $ref->{expense};
map { $ref->{$_} =~ s/^\s*// } @cols;
map { $ref->{$_} =~ s/\s*$// } @cols;
@@ -1224,6 +1225,7 @@ sub get_accounts {
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
# get last heading account
@accno = grep { $_ le "$ref->{accno}" } @headingaccounts;
$accno = pop @accno;
@@ -1347,6 +1349,7 @@ sub trial_balance {
$sth->execute || $form->dberror($query);
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{amount} = $form->round_amount( $ref->{amount}, 2 );
$balance{ $ref->{accno} } = $ref->{amount};
@@ -1381,6 +1384,7 @@ sub trial_balance {
$sth->execute || $form->dberror($query);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$trb{ $ref->{accno} }{description} = $ref->{description};
$trb{ $ref->{accno} }{charttype} = 'H';
$trb{ $ref->{accno} }{category} = $ref->{category};
@@ -1472,6 +1476,7 @@ sub trial_balance {
# calculate debit and credit for the period
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$trb{ $ref->{accno} }{description} = $ref->{description};
$trb{ $ref->{accno} }{charttype} = 'A';
$trb{ $ref->{accno} }{category} = $ref->{category};
@@ -1511,7 +1516,9 @@ sub trial_balance {
|| $form->dberror($query);
( $debit, $credit ) = ( 0, 0 );
- while ( ( $debit, $credit ) = $drcr->fetchrow_array ) {
+ while ( my @drcrlist = $drcr->fetchrow_array ) {
+ $form->db_parse_numeric(sth=>$drcr, arrayref=>\@drcrlist);
+ ($debit, $credit) = @drcrlist;
$ref->{debit} += $debit;
$ref->{credit} += $credit;
}
@@ -1758,6 +1765,7 @@ sub aging {
$sth->execute(@var);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{module} =
( $ref->{invoice} )
? $invoice
@@ -1780,6 +1788,7 @@ sub aging {
$sth->execute || $form->dberror($query);
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
push @{ $form->{all_language} }, $ref;
}
$sth->finish;
@@ -2197,6 +2206,7 @@ sub tax_report {
$sth->execute || $form->dberror($query);
while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
$ref->{tax} = $form->round_amount( $ref->{tax}, 2 );
if ( $form->{report} =~ /nontaxable/ ) {
push @{ $form->{TR} }, $ref if $ref->{netamount};
@@ -2368,6 +2378,7 @@ sub payments {
$sth->execute || $form->dberror($query);
while ( my $pr = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
push @{ $form->{ $ref->{id} } }, $pr;
}
$sth->finish;