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, 17:48

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
For some reason number formatting also slipped into the gentex function
which is not correct.

Evidently you are looking at a version other than 3.0.6 (the line numbers
don't match, and I find no prior definition/initialization of
$hdr->{$_}{image} anywhere).

I presume the equivalent 3.0.6 change would be:

 --- a/SL/Form.pm  2015-02-04 12:57:55.000000000 -0500
 +++ b/SL/Form.pm  2015-02-04 14:46:25.000000000 -0500
 @@ -1292,9 +1292,7 @@
 $line = "";
 for (@{$column}) {
 $self->{temp} = $self->{$_}[$i];
 -      if ($hdr->{$_}{type} eq 'n') {
 -       $self->{temp} = $self->format_amount($myconfig, $self->{temp},
 -      } else {
 +      if ($hdr->{$_}{type} ne 'n') {
 $line .= qq|$self->{temp} \& |;

The problem with this alternative change is that it results in certain
amounts never receiving any formatting. For example, a pdf of a parts
report which includes a "weight" column ends up with weights like "1234"
rather than "1,234". This was not a problem with the change as I
suggested. Also, I have yet to observe any problems with the html version
of the report. The sub generate_report in ic.pl makes its own calls to
format_amount() when generating the html. Those calls are separate from
the calls which I proposed for deletion.

If all formatting is to be done in the front end, then code must be added
to ic.pl so that all amounts are properly formatted before gentex is

gentex is called after the amounts are formatted. Anyway, I did not check if there is an image variable defined in this version, I took the line from another version where this error was corrected. It does not matter if $hdr->{$_}{image} is there because if it isn't defined the variable 'temp' will be formatted regardless (its an unless variable defined condition). Change the line in gentex to


if you like, it works either way.

as for the weight, add it in the foreach loop in ic.pl
while you are at it add ship and onhand too.

foreach $ref (@{ $form->{parts} }) {
$ref->{sku} = $ref->{partnumber};
$ref->{number} = $ref->{sku};
$ref->{sell} = $ref->{sellprice};

if ($form->{formname} eq 'barcode') {
$ref->{onhand} = 1 if $ref->{onhand} <= 0;
$ref->{ship} = $ref->{onhand};

for (qw(sell sellprice listprice lastcost avgcost)) { $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, $form->{precision}) }
for (qw(qty rop ship onhand weight)) { $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}) }


Complete thread:

Back to the forum
Board view  Mix view
1007 Postings in 335 Threads, 366 registered users, 106 users online (0 registered, 106 guests)
SQL-Ledger User Forum | Admin contact
powered by my little forum