X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=f783c19c00252e19cfe80296f3e4c1869ba294f2;hb=3f4a45a96efc9e44bc3cd58874128dc36cc667cf;hp=1a018a5cb01cf54ec1ec882371b13ead5e55acd4;hpb=4d8a65151cff0399654ea47c196ab38361a976e8;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 1a018a5cb..f783c19c0 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -33,6 +33,7 @@ # ####################################################################### +use SL::Common; use SL::CT; use SL::IC; use CGI::Ajax; @@ -91,6 +92,11 @@ sub display_row { $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); @@ -307,33 +313,30 @@ sub display_row { # marge calculations my ($marge_font_start, $marge_font_end); + $form->{"lastcost_$i"} *= 1; + if ($real_sellprice && ($form->{"qty_$i"} * 1)) { - $form->{"marge_percent_$i"} = - ($real_sellprice - $form->{"lastcost_$i"}) * 100 / $real_sellprice; + $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * 100 / $real_sellprice; + $myconfig{"marge_percent_warn"} = 15 unless (defined($myconfig{"marge_percent_warn"})); - $myconfig{"marge_percent_warn"} = 15 - unless (defined($myconfig{"marge_percent_warn"})); if ($form->{"id_$i"} && - ($form->{"marge_percent_$i"} < - (1 * $myconfig{"marge_percent_warn"}))) { + ($form->{"marge_percent_$i"} < (1 * $myconfig{"marge_percent_warn"}))) { $marge_font_start = ""; - $marge_font_end = ""; + $marge_font_end = ""; } + } else { $form->{"marge_percent_$i"} = 0; } - $form->{"marge_absolut_$i"} = - ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"}; - $form->{"marge_total"} += $form->{"marge_absolut_$i"}; - $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"}; - $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"}; - map { - $form->{"${_}_$i"} = - $form->format_amount(\%myconfig, $form->{"${_}_$i"}, - 2) - } qw(marge_absolut marge_percent); + 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"}; + + map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent); # convert " to " map { $form->{"${_}_$i"} =~ s/\"/"/g } @@ -365,9 +368,10 @@ sub display_row { qq||; if ($form->{"formel_$i"}) { - $column_data{qty} .= qq|| . - $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"}). qq||; + $column_data{qty} .= qq|| + . $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"}); } + $column_data{qty} .= qq||; $column_data{ship} = qq||.$locale->text('Subtotal').qq|  |; + if ($form->{"id_$i"} && $is_sales) { + print qq| + ${marge_font_start}| . $locale->text('Ertrag') . qq| $form->{"marge_absolut_$i"}  $form->{"marge_percent_$i"} % ${marge_font_end} +  | . $locale->text('LP') . qq| | . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq| +  | . $locale->text('EK') . qq| | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2); + } + print qq| - ${marge_font_start}|.$locale->text('Ertrag').qq| $form->{"marge_absolut_$i"}  $form->{"marge_percent_$i"} % ${marge_font_end} -  |.$locale->text('LP').qq| |.$form->format_amount(\%myconfig,$form->{"listprice_$i"},2).qq| -  |.$locale->text('EK').qq| |.$form->format_amount(\%myconfig,$form->{"lastcost_$i"},2).qq| |; @@ -1061,6 +1069,9 @@ sub check_form { $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 @@ -1310,8 +1321,7 @@ sub edit_e_mail { $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"; @@ -1345,6 +1355,8 @@ sub send_email { print_form("return"); + Common->save_email_status(\%myconfig, $form); + $form->{callback} = $callback; $form->redirect(); @@ -1529,7 +1541,7 @@ sub print_form { $inv = "ord"; $due = "req"; $form->{"${inv}date"} = $form->{transdate}; - $form->{label} = $locale->text('Sales Order'); + $form->{label} = $locale->text('Confirmation'); $numberfld = "sonumber"; $order = 1; } @@ -1611,7 +1623,7 @@ sub print_form { $inv = "quo"; $due = "req"; $form->{"${inv}date"} = $form->{transdate}; - $form->{label} = $locale->text('Quotation'); + $form->{label} = $locale->text('RFQ'); $numberfld = "rfqnumber"; $order = 1; }