In den Benutzereinstellungen klarer machen, dass das XUL-MenĂ¼ nur mit Firefox funktio...
[kivitendo-erp.git] / SL / OE.pm
index 10b52e5..5c6cec6 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -201,10 +201,13 @@ sub transactions_for_todo_list {
 
   $query       =
     qq|SELECT oe.id, oe.transdate, oe.reqdate, oe.quonumber, oe.transaction_description, oe.amount,
+         CASE WHEN (COALESCE(0, oe.customer_id) = 0) THEN 'vendor' ELSE 'customer' END AS vc,
          c.name AS customer,
+         v.name AS vendor,
          e.name AS employee
        FROM oe
        LEFT JOIN customer c ON (oe.customer_id = c.id)
+       LEFT JOIN vendor v   ON (oe.vendor_id   = v.id)
        LEFT JOIN employee e ON (oe.employee_id = e.id)
        WHERE (COALESCE(quotation, FALSE) = TRUE)
          AND (COALESCE(closed,    FALSE) = FALSE)
@@ -945,6 +948,8 @@ sub order_details {
 
   $form->{"globalprojectnumber"} = $projectnumbers{$form->{"globalproject_id"}};
 
+  $form->{discount} = [];
+
   my @arrays =
     qw(runningnumber number description longdescription qty ship unit bin
        partnotes serialnumber reqdate sellprice listprice netprice
@@ -1005,8 +1010,9 @@ sub order_details {
       my ($dec)         = ($sellprice =~ /\.(\d+)/);
       my $decimalplaces = max 2, length($dec);
 
-      my $discount             = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100 / $price_factor->{factor}, $decimalplaces);
-      my $linetotal            = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100 / $price_factor->{factor}, 2);
+      my $parsed_discount      = $form->parse_amount($myconfig, $form->{"discount_$i"});
+      my $discount             = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor}, $decimalplaces);
+      my $linetotal            = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}, 2);
       my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2);
       $form->{"netprice_$i"}   = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2);
 
@@ -1014,7 +1020,7 @@ sub order_details {
 
       $linetotal = ($linetotal != 0) ? $linetotal : '';
 
-      push @{ $form->{discount} },  ($discount  != 0) ? $form->format_amount($myconfig, $discount * -1, $decimalplaces) : '';
+      push @{ $form->{discount} },  ($discount  != 0) ? $form->format_amount($myconfig, $discount * -1, 2) : '';
       push @{ $form->{p_discount} }, $form->{"discount_$i"};
 
       $form->{ordtotal}         += $linetotal;