Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorNiclas Zimmermann <niclas@kivitendo-premium.de>
Thu, 22 Nov 2012 10:14:30 +0000 (11:14 +0100)
committerNiclas Zimmermann <niclas@kivitendo-premium.de>
Thu, 22 Nov 2012 10:14:30 +0000 (11:14 +0100)
bin/mozilla/ap.pl
bin/mozilla/ar.pl
bin/mozilla/vk.pl

index ef40046..3bbe8dc 100644 (file)
@@ -564,7 +564,7 @@ $jsscript
       NTI($cgi->popup_menu('-name' => "project_id_$i",
                            '-values' => \@project_values,
                            '-labels' => \%project_labels,
-                           '-default' => $form->{"project_id_$i"} ));
+                           '-default' => ($i==$form->{rowcount})? $form->{globalproject_id} : $form->{"project_id_$i"} ));
 
     print qq|
         <tr>
index ad1407c..6466aa2 100644 (file)
@@ -333,7 +333,7 @@ sub form_header {
     my $transaction = {
       amount     => $form->{"amount_$i"},
       tax        => $form->{"tax_$i"},
-      project_id => $form->{"project_id_$i"},
+      project_id => ($i==$form->{rowcount}) ? $form->{globalproject_id} : $form->{"project_id_$i"},
     };
 
     my $selected_accno_full;
index 70c0482..148fec0 100644 (file)
@@ -304,8 +304,8 @@ sub invoice_transactions {
     # discount was already accounted for in db sellprice
     $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;
+    $ar->{sellprice_total} = $form->round_amount( $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) / $ar->{price_factor}, 2);
+    $ar->{lastcost_total}  = $form->round_amount( $ar->{qty} * $ar->{lastcost} * $basefactor, 2);
     # marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug)
     $ar->{marge_percent} = $ar->{sellprice_total} ? (($ar->{sellprice_total}-$ar->{lastcost_total}) / $ar->{sellprice_total} * 100) : 0;
     # marge_total neu berechnen
@@ -389,9 +389,9 @@ sub invoice_transactions {
     # wird laufend bei jeder Position neu berechnet
     $totals{marge_percent}    = $totals{sellprice_total}    ? ( ($totals{sellprice_total} - $totals{lastcost_total}) / $totals{sellprice_total}   ) * 100 : 0;
 
-    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty);
+    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty sellprice_total lastcost_total);
     map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 3) } qw(weight);
-    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice sellprice_total lastcost_total);
+    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice);
 
     # Einzelzeilen nur zeigen wenn l_parts gesetzt ist, nützlich, wenn man nur
     # Subtotals und Totals sehen möchte