{ id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, },
{ id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, },
{ id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, },
- { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => ($form->{type} =~ /^sales_/) && !$is_delivery_order, },
+ { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => ($form->{type} =~ /^(sales_|invoice)/) && !$is_delivery_order, },
{ id => 'discount', width => 5, value => $locale->text('Discount'), display => !$is_delivery_order, },
{ id => 'linetotal', width => 10, value => $locale->text('Extended'), display => !$is_delivery_order, },
{ id => 'bin', width => 10, value => $locale->text('Bin'), display => 0, },
if ($form->{id}) {
-
- # # get pricegroups for parts
- # IS->get_pricegroups_for_parts(\%myconfig, \%$form);
-
my $i = 0;
foreach my $ref (@{ $form->{invoice_details} }) {
$i++;
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
- $form->{"discount_$i"} =
- $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
- my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec > 2) ? $dec : 2;
- $form->{"sellprice_$i"} =
- $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
- $decimalplaces);
+ $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ $dec = length $dec;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
- (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
- $dec_qty = length $dec_qty;
+ $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
+ (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+ $dec_qty = length $dec_qty;
- $form->{"qty_$i"} =
- $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
+ $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
- $form->{rowcount} = $i;
+ $form->{rowcount} = $i;
}
+
+ # get pricegroups for parts
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ set_pricegroup($_) for 1 .. $form->{rowcount};
}
$main::lxdebug->leave_sub();
}