From: Moritz Bunkus Date: Wed, 5 Sep 2012 15:44:25 +0000 (+0200) Subject: Merge branch 'master' of vc.linet-services.de:public/lx-office-erp X-Git-Tag: release-3.0.0beta1~249^2~5 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/d08c706c8c3790ff09c5c9c97541c7936e74e6c9?hp=e3d226231a8cec1c598cf7fbef6710672cd2b6bf Merge branch 'master' of vc.linet-services.de:public/lx-office-erp --- diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index fd9961413..c5ac88abb 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -83,6 +83,15 @@ sub html_tag { return "<${tag}${attributes}>${content}"; } +sub img_tag { + my ($self, @slurp) = @_; + my %options = _hashify(@slurp); + + $options{alt} ||= ''; + + return $self->html_tag('img', undef, %options); +} + sub select_tag { my $self = shift; my $name = shift; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index e25f963a8..1aa0248d0 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -226,6 +226,7 @@ sub display_row { # adjust prices by unit, ignore if pricegroup changed if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) { $form->{"sellprice_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1; + $form->{"lastcost_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1; $form->{"unit_old_$i"} = $form->{"selected_unit_$i"}; } my $this_unit = $form->{"unit_$i"}; @@ -248,7 +249,10 @@ 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 +#count the max of decimalplaces of sellprice and lastcost, so the same number of decimalplaces +#is shown for lastcost and sellprice. my $decimalplaces = ($form->{"sellprice_$i"} =~ /\.(\d+)/) ? max 2, length $1 : 2; + $decimalplaces = ($form->{"lastcost_$i"} =~ /\.(\d+)/) ? max $decimalplaces, length $1 : $decimalplaces; 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); @@ -355,7 +359,7 @@ sub display_row { } else { $real_sellprice = $linetotal; }; - my $real_lastcost = $form->{"lastcost_$i"} * $form->{"qty_$i"} / ( $form->{"marge_price_factor_$i"} || 1 ); + my $real_lastcost = $form->round_amount($form->{"lastcost_$i"} * $form->{"qty_$i"} / $price_factor, 2); my $marge_percent_warn = $myconfig{marge_percent_warn} * 1 || 15; my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1; @@ -377,7 +381,7 @@ sub display_row {  %s |, $marge_color, $locale->text('Ertrag'),$form->{"marge_absolut_$i"}, $form->{"marge_percent_$i"}, $locale->text('LP'), $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2), - $locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) } + $locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces) } if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ || $form->{type} =~ /invoice/ || $form->{type} =~ /^credit_note$/ ) && !$is_delivery_order; $form->{"listprice_$i"} = $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index a89fa0242..fe28838f8 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -334,8 +334,8 @@ sub invoice_transactions { $ar->{price_factor} = 1 unless $ar->{price_factor}; # calculate individual sellprice # discount was already accounted for in db sellprice - $ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor} / $basefactor; - $ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor}; + $ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor} / $basefactor; + $ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor} / $basefactor; $ar->{sellprice_total} = $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) / $ar->{price_factor}; $ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost} * $basefactor; # marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug)