$lxdebug->enter_sub();
my $numrows = shift;
+ my $is_sales =
+ (substr($form->{type}, 0, 6) eq "sales_")
+ || (($form->{type} eq "invoice") && ($form->{script} eq "is.pl"))
+ || ($form->{type} eq 'credit_note');
+
if ($lizenzen && $form->{vc} eq "customer") {
if ($form->{type} =~ /sales_order/) {
@column_index = (runningnumber, partnumber, description, ship, qty);
$form->{"marge_percent_$i"} = 0;
}
- $form->{"marge_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"};
+ my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
+ $form->{"marge_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"} * $marge_adjust_credit_note;
$form->{"marge_total"} += $form->{"marge_absolut_$i"};
$form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"};
$form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"};
<b>|.$locale->text('Subtotal').qq|</b> <input type="checkbox" name="subtotal_$i" value="1" "$subtotalchecked">
|;
+ if ($form->{"id_$i"} && $is_sales) {
+ print qq|
+ ${marge_font_start}<b>| . $locale->text('Ertrag') . qq|</b> $form->{"marge_absolut_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}
+ <b>| . $locale->text('LP') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq|
+ <b>| . $locale->text('EK') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2);
+ }
+
print qq|
- ${marge_font_start}<b>|.$locale->text('Ertrag').qq|</b> $form->{"marge_absolut_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}
- <b>|.$locale->text('LP').qq|</b> |.$form->format_amount(\%myconfig,$form->{"listprice_$i"},2).qq|
- <b>|.$locale->text('EK').qq|</b> |.$form->format_amount(\%myconfig,$form->{"lastcost_$i"},2).qq|
</td>
</tr>
|;
$form->redo_rows(\@flds, \@a, $count, $form->{makemodel_rows});
$form->{makemodel_rows} = $count;
+ } elsif ($form->{item} eq 'service') {
+ map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost);
+
} else {
# this section applies to invoices and orders