X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=07db7eac6010f7706f806d86d22f7bc9e7d1a4a5;hb=45cc8d1e638a2f31529da78a49e00bf2e8937201;hp=6e18b5e2b8eafe479ce7f18dc17e4677cfbe1e65;hpb=9da3e39b72311b5a22fd79c3ca97b5fbe871092f;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 6e18b5e2b..07db7eac6 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -151,7 +151,7 @@ sub display_row { { 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, }, @@ -245,8 +245,7 @@ sub display_row { $column_data{"unit"} = AM->unit_select_html($all_units, "unit_$i", $this_unit, $form->{"id_$i"} ? $form->{"unit_$i"} : undef); # / unit ending - $form->{"sellprice_$i"} =~ /\.(\d+)/; - my $decimalplaces = max 2, length $1; + my $decimalplaces = ($form->{"sellprice_$i"} =~ /\.(\d+)/) ? max 2, length $1 : 2; my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1; my $discount = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100 / $price_factor, 2); @@ -260,8 +259,7 @@ sub display_row { : $cgi->textfield(-name => "description_$i", -size => 30, -value => $form->{"description_$i"})) . $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')"); - $form->{"qty_$i"} =~ /\.(\d+)/; - my $qty_dec = length $1; + my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2; $column_data{qty} = $cgi->textfield(-name => "qty_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)); $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)", -value => $locale->text('*/')) @@ -319,24 +317,24 @@ sub display_row { $locale->text('Subtotal'), $form->{"subtotal_$i"} ? 'checked' : '' }; # begin marge calculations - my $marge_color; - my $real_sellprice = ($form->{"sellprice_$i"} - $discount) / $price_factor; - my $marge_price_factor = $form->{"marge_price_factor_$i"} * 1 || 1; - - $form->{"lastcost_$i"} *= 1; + $form->{"lastcost_$i"} *= 1; $form->{"marge_percent_$i"} = 0; - if ($real_sellprice && ($form->{"qty_$i"} * 1)) { - $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * 100 / $real_sellprice; - $myconfig{marge_percent_warn} ||= 15; - $marge_color = 'color="#ff0000"' if $form->{"id_$i"} && ($form->{"marge_percent_$i"} < (1 * $myconfig{marge_percent_warn})); + my $marge_color; + my $real_sellprice = $linetotal; + my $real_lastcost = $form->{"lastcost_$i"} * $form->{"qty_$i"} / ( $form->{"marge_price_factor_$i"} || 1 ); + my $marge_percent_warn = $myconfig{marge_percent_warn} * 1 || 15; + my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1; + + if ($real_sellprice * 1 && ($form->{"qty_$i"} * 1)) { + $form->{"marge_percent_$i"} = ($real_sellprice - $real_lastcost) * 100 / $real_sellprice; + $marge_color = 'color="#ff0000"' if $form->{"id_$i"} && $form->{"marge_percent_$i"} < $marge_percent_warn; } - my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1; - $form->{"marge_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note; + $form->{"marge_absolut_$i"} = ($real_sellprice - $real_lastcost) * $marge_adjust_credit_note; $form->{"marge_total"} += $form->{"marge_absolut_$i"}; - $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"} / $marge_price_factor; - $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"}; + $form->{"lastcost_total"} += $real_lastcost; + $form->{"sellprice_total"} += $real_sellprice; map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent); @@ -752,7 +750,7 @@ sub check_form { #($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"}; # fuer assemblies auskommentiert. siehe oben - # $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"} / ($form->{"price_factor_$i"} || 1)); + # $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"} / ($form->{"price_factor_$i"} || 1)); $form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"} / ($form->{"price_factor_$i"} || 1)); $count++; } @@ -1193,17 +1191,24 @@ sub print_options { map { opthash($_->{id}, ($_->{id} eq $form->{printer_id} ? 'selected' : ''), $_->{printer_description}) } +{}, @{ $form->{printers} } if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } }); - { - no strict 'refs'; - @SELECTS = map { sname => lc $_, DATA => \@$_, show => !$options{"hide_" . lc($_)} && scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID); - } + @SELECTS = map { + sname => $_->[1], + DATA => $_->[0], + show => !$options{"hide_" . $_->[1]} && scalar @{ $_->[0] } + }, + [ \@FORMNAME, 'formname', ], + [ \@LANGUAGE_ID, 'language_id', ], + [ \@FORMAT, 'format', ], + [ \@SENDMODE, 'sendmode', ], + [ \@MEDIA, 'media', ], + [ \@PRINTER_ID, 'printer_id', ]; my %dont_display_groupitems = ( 'dunning' => 1, ); my %template_vars = ( - display_copies => scalar @{ $form->{printers} } && $main::latex_templates && $form->{media} ne 'email', + display_copies => scalar @{ $form->{printers} || [] } && $main::latex_templates && $form->{media} ne 'email', display_remove_draft => (!$form->{id} && $form->{draft_id}), display_groupitems => !$dont_display_groupitems{$form->{type}}, groupitems_checked => $form->{groupitems} ? "checked" : '', @@ -1416,10 +1421,10 @@ sub print_form { call_sub($display_form); # saving the history - if(!exists $form->{addition}) { + if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; - $form->{addition} = "PRINTED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "PRINTED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history exit; @@ -1636,16 +1641,16 @@ sub print_form { if(!exists $form->{addition}) { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; if($form->{media} =~ /printer/) { - $form->{addition} = "PRINTED"; + $form->{addition} = "PRINTED"; } elsif($form->{media} =~ /email/) { - $form->{addition} = "MAILED"; + $form->{addition} = "MAILED"; } elsif($form->{media} =~ /queue/) { - $form->{addition} = "QUEUED"; + $form->{addition} = "QUEUED"; } elsif($form->{media} =~ /screen/) { - $form->{addition} = "SCREENED"; + $form->{addition} = "SCREENED"; } $form->save_history($form->dbconnect(\%myconfig)); } @@ -1804,72 +1809,72 @@ sub ship_to { - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
| +
| . $locale->text('Billing Address') . qq|| + | . $locale->text('Shipping Address') . qq|
$number$form->{"$form->{vc}number"}
| . $locale->text('Company Name') . qq|$form->{name}
| . $locale->text('Department') . qq|$form->{department_1}
 $form->{department_2}
| . $locale->text('Street') . qq|$form->{street}
| . $locale->text('Zipcode') . qq|$form->{zipcode}
| . $locale->text('City') . qq|$form->{city}
| . $locale->text('Country') . qq|$form->{country}
| . $locale->text('Contact') . qq|$form->{contact}
| . $locale->text('Phone') . qq|$form->{phone}
| . $locale->text('Fax') . qq|$form->{fax}
| . $locale->text('E-mail') . qq|$form->{email}
$number$form->{"$form->{vc}number"}
| . $locale->text('Company Name') . qq|$form->{name}
| . $locale->text('Department') . qq|$form->{department_1}
 $form->{department_2}
| . $locale->text('Street') . qq|$form->{street}
| . $locale->text('Zipcode') . qq|$form->{zipcode}
| . $locale->text('City') . qq|$form->{city}
| . $locale->text('Country') . qq|$form->{country}
| . $locale->text('Contact') . qq|$form->{contact}
| . $locale->text('Phone') . qq|$form->{phone}
| . $locale->text('Fax') . qq|$form->{fax}
| . $locale->text('E-mail') . qq|$form->{email}
@@ -2072,7 +2077,7 @@ sub _update_custom_variables { } sub _render_custom_variables_inputs { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(2); my $form = $main::form; @@ -2109,5 +2114,5 @@ sub _render_custom_variables_inputs { }; } - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(2); }