Bei Gutschriften muss der Ertrag negativ sein.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 4 Jul 2007 12:40:01 +0000 (12:40 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 4 Jul 2007 12:40:01 +0000 (12:40 +0000)
bin/mozilla/io.pl

index db50d4a..19f8113 100644 (file)
@@ -324,7 +324,8 @@ sub display_row {
       $form->{"marge_percent_$i"} = 0;
     }
 
-    $form->{"marge_absolut_$i"}  = ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"};
+    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"};