Verkaufsrechnungen: Suche nach Artikelnummer/-beschreibung in Positionen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 25 Apr 2016 12:58:39 +0000 (14:58 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 25 Apr 2016 13:07:17 +0000 (15:07 +0200)
SL/AR.pm
bin/mozilla/ar.pl
templates/webpages/ar/search.html

index d37b7fc..67a43d0 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -584,6 +584,33 @@ sub ar_transactions {
     }
   };
 
+  if ($form->{parts_partnumber}) {
+    $where .= <<SQL;
+      AND EXISTS (
+        SELECT invoice.trans_id
+        FROM invoice
+        LEFT JOIN parts ON (invoice.parts_id = parts.id)
+        WHERE (invoice.trans_id = a.id)
+          AND (parts.partnumber ILIKE ?)
+        LIMIT 1
+      )
+SQL
+    push @values, like($form->{parts_partnumber});
+  }
+
+  if ($form->{parts_description}) {
+    $where .= <<SQL;
+      AND EXISTS (
+        SELECT invoice.trans_id
+        FROM invoice
+        WHERE (invoice.trans_id = a.id)
+          AND (invoice.description ILIKE ?)
+        LIMIT 1
+      )
+SQL
+    push @values, like($form->{parts_description});
+  }
+
   my ($cvar_where, @cvar_values) = CVar->build_filter_query('module'         => 'CT',
                                                             'trans_id_field' => 'c.id',
                                                             'filter'         => $form,
index e051b17..444f7f9 100644 (file)
@@ -943,7 +943,8 @@ sub ar_transactions {
   push @columns, map { "cvar_$_->{name}" } @ct_includeable_custom_variables;
 
   my @hidden_variables = map { "l_${_}" } @columns;
-  push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber cusordnumber transaction_description notes project_id transdatefrom transdateto duedatefrom duedateto employee_id salesman_id business_id);
+  push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber cusordnumber transaction_description notes project_id transdatefrom transdateto duedatefrom duedateto
+                                           employee_id salesman_id business_id parts_partnumber parts_description);
   push @hidden_variables, map { "cvar_$_->{name}" } @ct_searchable_custom_variables;
 
   $href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
@@ -1039,6 +1040,12 @@ sub ar_transactions {
   if ($form->{transaction_description}) {
     push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
   }
+  if ($form->{parts_partnumber}) {
+    push @options, $locale->text('Part Number') . " : $form->{parts_partnumber}";
+  }
+  if ($form->{parts_description}) {
+    push @options, $locale->text('Part Description') . " : $form->{parts_description}";
+  }
   if ($form->{transdatefrom}) {
     push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
   }
index 7d3158e..5caec9f 100644 (file)
      </tr>
      <tr>
       <th align=right nowrap>[% 'Transaction description' | $T8 %]</th>
-      <td colspan=3><input name=transaction_description id=transaction_description size=40></td>
+      <td><input name=transaction_description id=transaction_description size=20></td>
+      <th align="right">[% 'Part Description' | $T8 %]</th>
+      <td><input name="parts_description" size="20"></td>
      </tr>
      <tr>
       <th align=right nowrap>[% 'Notes' | $T8 %]</th>
-      <td colspan=3><input name=notes id=notes size=40></td>
+      <td><input name=notes id=notes size=20></td>
+      <th align="right">[% 'Part Number' | $T8 %]</th>
+      <td><input name="parts_partnumber" size="20"></td>
      </tr>
      <tr>
       <th align="right">[% 'Project Number' | $T8 %]</th>