Lieferscheine: Suche nach Artikelnummer/-beschreibung in Positionen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 25 Apr 2016 13:05:19 +0000 (15:05 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 25 Apr 2016 13:07:26 +0000 (15:07 +0200)
SL/DO.pm
bin/mozilla/do.pl
templates/webpages/do/search.html

index f73d0a3..f953b6b 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -180,6 +180,33 @@ sub transactions {
     push @values, conv_date($form->{insertdateto});
   }
 
+  if ($form->{parts_partnumber}) {
+    push @where, <<SQL;
+      EXISTS (
+        SELECT delivery_order_items.delivery_order_id
+        FROM delivery_order_items
+        LEFT JOIN parts ON (delivery_order_items.parts_id = parts.id)
+        WHERE (delivery_order_items.delivery_order_id = dord.id)
+          AND (parts.partnumber ILIKE ?)
+        LIMIT 1
+      )
+SQL
+    push @values, like($form->{parts_partnumber});
+  }
+
+  if ($form->{parts_description}) {
+    push @where, <<SQL;
+      EXISTS (
+        SELECT delivery_order_items.delivery_order_id
+        FROM delivery_order_items
+        WHERE (delivery_order_items.delivery_order_id = dord.id)
+          AND (delivery_order_items.description ILIKE ?)
+        LIMIT 1
+      )
+SQL
+    push @values, like($form->{parts_description});
+  }
+
   if (@where) {
     $query .= " WHERE " . join(" AND ", map { "($_)" } @where);
   }
index ee13203..b5015e7 100644 (file)
@@ -558,7 +558,7 @@ sub orders {
   my @hidden_variables = map { "l_${_}" } @columns;
   push @hidden_variables, $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered donumber ordnumber serialnumber cusordnumber
                                           transaction_description transdatefrom transdateto reqdatefrom reqdateto
-                                          type vc employee_id salesman_id project_id
+                                          type vc employee_id salesman_id project_id parts_partnumber parts_description
                                           insertdatefrom insertdateto business_id);
 
   my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
@@ -629,6 +629,12 @@ sub orders {
   if ($form->{transaction_description}) {
     push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
   }
+  if ($form->{parts_description}) {
+    push @options, $locale->text('Part Description') . " : $form->{parts_description}";
+  }
+  if ($form->{parts_partnumber}) {
+    push @options, $locale->text('Part Number') . " : $form->{parts_partnumber}";
+  }
   if ( $form->{transdatefrom} or $form->{transdateto} ) {
     push @options, $locale->text('Delivery Order Date');
     push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1)     if $form->{transdatefrom};
index a5ecf75..e7fdd33 100644 (file)
 
     <tr>
      <th align="right">[% 'Transaction description' | $T8 %]</th>
-     <td colspan="3"><input name="transaction_description" class="fixed_width"></td>
+     <td><input name="transaction_description" class="fixed_width"></td>
+     <th align="right">[% 'Part Description' | $T8 %]</th>
+     <td><input name="parts_description" size="20"></td>
     </tr>
 
     <tr>
      <th align="right">[% 'Project Number' | $T8 %]</th>
-     <td colspan="3">
+     <td>
       <select name="project_id" class="fixed_width">
        <option></option>
        [%- FOREACH row = ALL_PROJECTS %]
        [%- END %]
       </select>
      </td>
+     <th align="right">[% 'Part Number' | $T8 %]</th>
+     <td><input name="parts_partnumber" size="20"></td>
     </tr>
 
     <tr>