Verkauf->Berichte: Auftrag und Angebot Suche nach Salesman implementiert.
authorUdo Spallek <info@wissensvermittlung.com>
Thu, 20 Sep 2007 17:17:41 +0000 (17:17 +0000)
committerUdo Spallek <info@wissensvermittlung.com>
Thu, 20 Sep 2007 17:17:41 +0000 (17:17 +0000)
SL/OE.pm
bin/mozilla/oe.pl

index 5a1db0c..b0fa272 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -72,10 +72,11 @@ sub transactions {
     qq|  o.marge_total, o.marge_percent, | .
     qq|  ex.$rate AS exchangerate, | .
     qq|  pr.projectnumber AS globalprojectnumber, | .
-    qq|  e.name AS employee | .
+    qq|  e.name AS employee, s.name AS salesman | .
     qq|FROM oe o | .
     qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
     qq|LEFT JOIN employee e ON (o.employee_id = e.id) | .
+    qq|LEFT JOIN employee s ON (o.salesman_id = s.id) | .
     qq|LEFT JOIN exchangerate ex ON (ex.curr = o.curr | .
     qq|  AND ex.transdate = o.transdate) | .
     qq|LEFT JOIN project pr ON (o.globalproject_id = pr.id) | .
@@ -109,6 +110,11 @@ sub transactions {
     $query .= " AND o.employee_id = ?";
     push @values, conv_i($form->{employee_id});
   }
+  
+  if ($form->{salesman_id}) {
+    $query .= " AND o.salesman_id = ?";
+    push @values, conv_i($form->{salesman_id});
+  }
 
   if (!$form->{open} && !$form->{closed}) {
     $query .= " AND o.id = 0";
@@ -151,6 +157,7 @@ sub transactions {
      "quonumber" => "o.quonumber",
      "name" => "ct.name",
      "employee" => "e.name",
+     "salesman" => "e.name",
      "shipvia" => "o.shipvia",
      "transaction_description" => "o.transaction_description");
   if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) {
index c0d826b..f095c5f 100644 (file)
@@ -1307,10 +1307,12 @@ sub search {
 
   my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
 
-  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
-                                   "all" => 1 },
+  $form->get_lists("projects"  => { "key" => "ALL_PROJECTS",
+                                    "all" => 1 },
                    "employees" => "ALL_EMPLOYEES",
-                   $vc => "ALL_" . uc($vc));
+                   "salesmen"  => "ALL_SALESMEN",
+                   $vc         => "ALL_" . uc($vc)
+                  );
 
   my %labels = ();
   my @values = ("");
@@ -1329,6 +1331,14 @@ sub search {
     push(@values, $item->{"id"});
     $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
   }
+  
+  #salesmen
+  my %labels_salesmen = ();
+  my @values_salesmen = ('');
+  foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
+    push(@values_salesmen, $item->{"id"});
+    $labels_salesmen{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
+  }
 
   my $employee_block = qq|
     <tr>
@@ -1338,6 +1348,14 @@ sub search {
                              '-values' => \@values,
                              '-labels' => \%labels)) . qq|
       </td>
+    </tr>
+    <tr>
+      <th align="right">| . $locale->text('Salesman') . qq|</th>
+      <td>| .
+        NTI($cgi->popup_menu('-name'   => 'salesman_id',
+                             '-values' => \@values_salesmen,
+                             '-labels' => \%labels_salesmen)) . qq|
+      </td>
     </tr>|;
 
   %labels = ();
@@ -1420,6 +1438,7 @@ sub search {
              <tr>
                <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
                <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
+               
                <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
     . $locale->text('Ship via') . qq|</td>
              </tr>
@@ -1446,6 +1465,8 @@ sub search {
              <tr>
                <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
     . $locale->text('Subtotal') . qq|</td>
+                <td><input name="l_salesman" class="checkbox" type="checkbox" value="Y"> |
+    . $locale->text('Salesman') . qq|</td>
              </tr>
            </table>
           </td>
@@ -1513,6 +1534,7 @@ sub orders {
     "name",                    "netamount",
     "tax",                     "amount",
     "curr",                    "employee",
+    "salesman",
     "shipvia",                 "globalprojectnumber",
     "transaction_description", "open",
     "delivered", "marge_total", "marge_percent"
@@ -1551,7 +1573,7 @@ sub orders {
 
   my @hidden_variables = map { "l_${_}" } @columns;
   push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber
-                                                        transaction_description transdatefrom transdateto type vc employee_id);
+                                                        transaction_description transdatefrom transdateto type vc employee_id salesman_id);
 
   my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
 
@@ -1567,7 +1589,8 @@ sub orders {
     'tax'                     => { 'text' => $locale->text('Tax'), },
     'amount'                  => { 'text' => $locale->text('Total'), },
     'curr'                    => { 'text' => $locale->text('Curr'), },
-    'employee'                => { 'text' => $locale->text('Salesperson'), },
+    'employee'                => { 'text' => $locale->text('Employee'), },
+    'salesman'                => { 'text' => $locale->text('Salesman'), },
     'shipvia'                 => { 'text' => $locale->text('Ship via'), },
     'globalprojectnumber'     => { 'text' => $locale->text('Project Number'), },
     'transaction_description' => { 'text' => $locale->text('Transaction description'), },
@@ -1577,7 +1600,7 @@ sub orders {
     'marge_percent'           => { 'text' => $locale->text('Ertrag prozentual'), }
   );
 
-  foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee shipvia)) {
+  foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia)) {
     $column_defs{$name}->{link} = $href . "&sort=$name";
   }