#
#######################################################################
+use SL::Common;
use SL::CT;
use SL::IC;
use CGI::Ajax;
$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"};
qq|<td align="right"><input name="qty_$i" size="5" value="|
. $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec) .qq|">|;
if ($form->{"formel_$i"}) {
- $column_data{qty} .= qq|<button type="button" onclick="calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)">| . $locale->text('*/') . qq|</button>| .
- $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"}). qq|</td>|;
+ $column_data{qty} .= qq|<button type="button" onclick="calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)">| . $locale->text('*/') . qq|</button>|
+ . $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"});
}
+ $column_data{qty} .= qq|</td>|;
$column_data{ship} =
qq|<td align="right"><input name="ship_$i" size=5 value="|
. $form->format_amount(\%myconfig, $form->{"ship_$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
$form->{"email"} = $form->{"cp_email"};
}
- $form->{ $form->{vc} } =~ /--/;
- $title = $locale->text('E-mail') . " $`";
+ $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
$form->{oldmedia} = $form->{media};
$form->{media} = "email";
print_form("return");
+ Common->save_email_status(\%myconfig, $form);
+
$form->{callback} = $callback;
$form->redirect();
$inv = "ord";
$due = "req";
$form->{"${inv}date"} = $form->{transdate};
- $form->{label} = $locale->text('Sales Order');
+ $form->{label} = $locale->text('Confirmation');
$numberfld = "sonumber";
$order = 1;
}
$inv = "quo";
$due = "req";
$form->{"${inv}date"} = $form->{transdate};
- $form->{label} = $locale->text('Quotation');
+ $form->{label} = $locale->text('RFQ');
$numberfld = "rfqnumber";
$order = 1;
}