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|