SQL-Ledger Homepage

SQL-Ledger User Forum

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Incorrect selling price sometimes shown on pdf parts report (General)

posted by Dieter Simader(R), 04.02.2015, 11:36

Using Version 3.0.6

When the number format preference is set to '1,000.00', selling prices on
the pdf version of a parts report are shown incorrectly in cases when they
are >= 1,000.00. Specifically, digits after the first ',' are lost. For
example, 1,234.56 becomes 1.00 on the report.

The problem is a result of attempting to apply SL::Form::format_amount()
twice in succession to an amount.

The following patch removes one of the calls to format_amount() (the other
call is in gentex()) and is thought to fix the problem (watch out for
possibly incorrect line wrapping below):

--- sql-ledger.orig/bin/mozilla/ic.pl 2015-02-01 18:55:58.000000000
-0500
+++ sql-ledger/bin/mozilla/ic.pl 2015-02-01 18:53:24.000000000
-0500
@@ -2047,9 +2047,6 @@
}
$ref->{ship} = $ref->{onhand};

- for (qw(sell sellprice listprice lastcost avgcost)) { $ref->{$_} =
$form->format_amount(\%myconfig, $ref->{$_}, $form->{precision}) }
- for (qw(qty rop)) { $ref->{$_} = $form->format_amount(\%myconfig,
$ref->{$_}) }
-
# build arrays
for (@columns) {
push @{ $form->{$_} }, $ref->{$_};
--- sql-ledger.orig/bin/lynx/ic.pl 2015-02-01 18:55:58.000000000
-0500
+++ sql-ledger/bin/lynx/ic.pl 2015-02-01 18:54:11.000000000 -0500
@@ -2047,9 +2047,6 @@
}
$ref->{ship} = $ref->{onhand};

- for (qw(sell sellprice listprice lastcost avgcost)) { $ref->{$_} =
$form->format_amount(\%myconfig, $ref->{$_}, $form->{precision}) }
- for (qw(qty rop)) { $ref->{$_} = $form->format_amount(\%myconfig,
$ref->{$_}) }
-
# build arrays
for (@columns) {
push @{ $form->{$_} }, $ref->{$_};


Not a lot of testing has been done, but it's presumed that other number
formats are affected as well (except for '1000.00'), and that other amounts
on the report are affected (list price, last cost, avg cost).

The only change required is in sub gentex, line 1311

if ($self->{temp} && $hdr->{$_}{type} ne 'n') {
$self->format_string(temp) unless $hdr->{$_}{image};
}

amounts are formatted in the frontend otherwise the html report won't work. For some reason number formatting also slipped into the gentex function which is not correct.

 

Complete thread:

Back to the forum
Board view  Mix view
976 Postings in 320 Threads, 326 registered users, 110 users online (0 registered, 110 guests)
SQL-Ledger User Forum | Admin contact
RSS-Feed
powered by my little forum