]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Einheiten im Verkauf
authorNiclas Zimmermann <niclas@lx-office-hosting.de>
Tue, 4 Sep 2012 13:24:18 +0000 (15:24 +0200)
committerNiclas Zimmermann <niclas@lx-office-hosting.de>
Tue, 4 Sep 2012 15:09:56 +0000 (17:09 +0200)
In dem Verkaufsbericht gab es noch Probleme mit der Einheit in Bezug
auf den EK Preis. Dies hatte sich auch auf die Marge ausgewirkt. Beides
wird jetzt richtig berechnet.

In der Verkaufsrechnung gab es ähnliche Probleme. Hier wurde der
VK Preis nach Wechsel der Einheit umgerechnet, der EK Preis nicht.
Jetzt wird auch der EK Preis an die Einheit angepasst. Die Berechnung
war dadurch auch fehlerhaft durch unterschiedliche Einheiten
und wurde auch korrigiert.

Weiterhin wurde ein Problem mit dem Preisfaktor behoben. Wenn
ein Artikel in der Datenbank mit Preisfaktor hinterlegt war,
wurde der Preisfaktor bisher doppelt berechnet, jetzt nur
noch einmal.

bin/mozilla/io.pl
bin/mozilla/vk.pl

index 7e1970bbee5c49a13f2f3e0717a53a5254a1e64c..1aa0248d0be8e17371acea54b77d2b158fa7b35d 100644 (file)
@@ -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"};
@@ -358,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;
 
index a89fa0242459b2c49b8c92eff329641cea383116..fe28838f873a5bbdcb3fa338babc882fc4c173e8 100644 (file)
@@ -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)