Verkäufer-/Bearbeiter-Drop-Downs in mehreren Masken sortiert anzeigen
[kivitendo-erp.git] / bin / mozilla / vk.pl
index 148fec0..9206e7e 100644 (file)
@@ -61,7 +61,6 @@ sub search_invoice {
   $form->all_vc(\%myconfig, "customer", "AR");
 
   $form->{title}    = $locale->text('Sales Report');
-  $form->{jsscript} = 1;
 
   $form->get_lists("projects"        => { "key" => "ALL_PROJECTS", "all" => 1 },
                    "departments"     => "ALL_DEPARTMENTS",
@@ -105,6 +104,11 @@ sub invoice_transactions {
   # can't currently be configured from report, empty line between main sortings
   my $addemptylines = 1;
 
+  # don't add empty lines between mainsort subtotals when only subtotal_mainsort is selected
+  if ($form->{l_subtotal_mainsort} eq "Y" and not defined $form->{l_headers_mainsort} and not defined $form->{l_headers_subsort} and not defined $form->{l_subtotal_subsort} ) {
+    $addemptylines = 0
+  };
+
   if ( $form->{customer} =~ /--/ ) {
     # Felddaten kommen aus Dropdownbox
     ($form->{customername}, $form->{customer_id}) = split(/--/, $form->{customer});
@@ -119,12 +123,12 @@ sub invoice_transactions {
 
     &check_name('customer', no_select => 1);
 
-    # $form->{customer_id} wurde schon von check_name gesetzt
+    # $form->{customer_id} was already set by check_name
     $form->{customername} = $form->{customer};
   };
-  # ist $form->{customer} leer passiert hier nichts weiter
+  # if $form->{customer} is empty nothing further happens here
 
-  # decimalplaces überprüfen oder auf Default 2 setzen
+  # test for decimalplaces or set to default of 2
   $form->{decimalplaces} = 2 unless $form->{decimalplaces} > 0 && $form->{decimalplaces} < 6;
 
   my $cvar_configs_ct = CVar->get_configs('module' => 'CT');
@@ -281,9 +285,9 @@ sub invoice_transactions {
   $callback = $form->escape($href);
 
   my @subtotal_columns = qw(qty weight sellprice sellprice_total lastcost lastcost_total marge_total marge_percent discount);
-  # Gesamtsumme:
-  # Summe von sellprice_total, lastcost_total und marge_total
-  # Durchschnitt von marge_percent
+  # Total sum:
+  # sum of sellprice_total, lastcost_total and marge_total
+  # average of marge_percent
   my @total_columns = qw(sellprice_total lastcost_total marge_total marge_percent );
 
   my %totals     = map { $_ => 0 } @total_columns;
@@ -304,8 +308,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} = $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);
+    $ar->{sellprice_total} = $form->round_amount( $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) / $ar->{price_factor}, $form->{"decimalplaces"});
+    $ar->{lastcost_total}  = $form->round_amount( $ar->{qty} * $ar->{lastcost} * $basefactor, $form->{"decimalplaces"});
     # 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 +393,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 sellprice_total lastcost_total);
+    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_percent qty);
     map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 3) } qw(weight);
-    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice);
+    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice sellprice_total lastcost_total marge_total);
 
     # Einzelzeilen nur zeigen wenn l_parts gesetzt ist, nützlich, wenn man nur
     # Subtotals und Totals sehen möchte
@@ -402,6 +406,9 @@ sub invoice_transactions {
 
       $row{invnumber}->{link} = build_std_url("script=is.pl", 'action=edit') . "&id=" . E($ar->{id}) . "&callback=${callback}";
 
+      # use partdescription according to invoice in article mode
+      $row{description}->{data} = $ar->{invoice_description};
+
       $report->add_data(\%row);
     }