Filtern nach Kunden-/Lieferantentyp bei Lieferschein-Berichten.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Thu, 5 Jun 2014 20:08:06 +0000 (22:08 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 28 Apr 2015 13:28:16 +0000 (15:28 +0200)
Conflicts:

bin/mozilla/do.pl

SL/DO.pm
bin/mozilla/do.pl
templates/webpages/do/search.html

index eb74e26..e764ac6 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -67,7 +67,8 @@ sub transactions {
   my $query =
     qq|SELECT dord.id, dord.donumber, dord.ordnumber, dord.cusordnumber,
          dord.transdate, dord.reqdate,
-         ct.${vc}number, ct.name, dord.${vc}_id, dord.globalproject_id,
+         ct.${vc}number, ct.name, ct.business_id,
+         dord.${vc}_id, dord.globalproject_id,
          dord.closed, dord.delivered, dord.shippingpoint, dord.shipvia,
          dord.transaction_description, dord.itime::DATE AS insertdate,
          pr.projectnumber AS globalprojectnumber,
@@ -98,6 +99,11 @@ sub transactions {
     push @values, conv_i($form->{project_id}), conv_i($form->{project_id});
   }
 
+  if ($form->{"business_id"}) {
+    push @where,  qq|ct.business_id = ?|;
+    push @values, conv_i($form->{"business_id"});
+  }
+
   if ($form->{"${vc}_id"}) {
     push @where,  qq|dord.${vc}_id = ?|;
     push @values, $form->{"${vc}_id"};
index 7e8eabb..33ab98c 100644 (file)
@@ -492,10 +492,11 @@ sub search {
 
   $form->{vc} = $form->{type} eq 'purchase_delivery_order' ? 'vendor' : 'customer';
 
-  $form->get_lists("projects"     => { "key" => "ALL_PROJECTS",
-                                       "all" => 1 },
-                   "departments"  => "ALL_DEPARTMENTS",
-                   "$form->{vc}s" => "ALL_VC");
+  $form->get_lists("projects"       => { "key" => "ALL_PROJECTS",
+                                         "all" => 1 },
+                   "departments"    => "ALL_DEPARTMENTS",
+                   "$form->{vc}s"   => "ALL_VC",
+                   "business_types" => "ALL_BUSINESS_TYPES");
   $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
 
   $form->{SHOW_VC_DROP_DOWN} =  $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
@@ -551,7 +552,7 @@ sub orders {
   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
-                                          insertdatefrom insertdateto);
+                                          insertdatefrom insertdateto business_id);
 
   my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
 
@@ -614,6 +615,10 @@ sub orders {
     push @options, $locale->text('Order Number') . " : $form->{ordnumber}";
   }
   push @options, $locale->text('Serial Number') . " : $form->{serialnumber}" if $form->{serialnumber};
+  if ($form->{business_id}) {
+    my $vc_type_label = $form->{vc} eq 'customer' ? $locale->text('Customer type') : $locale->text('Vendor type');
+    push @options, $vc_type_label . " : " . SL::DB::Business->new(id => $form->{business_id})->load->description;
+  }
   if ($form->{transaction_description}) {
     push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
   }
index ae86cb2..baa00bb 100644 (file)
@@ -9,6 +9,8 @@
  [%- SET is_customer = '0' %]
  [%- END %]
 
+ [%- SET vctypelabel = vc == 'customer' ? LxERP.t8('Customer type') : LxERP.t8('Vendor type') %]
+
  <script type="text/javascript">
    $(function(){ document.Form.donumber.focus(); });
  </script>
      <td colspan="3"><input name="serialnumber" class="fixed_width"></td>
     </tr>
 
+    [%- IF ALL_BUSINESS_TYPES.size %]
+    <tr>
+     <th align="right" nowrap>[% vctypelabel %]</th>
+     <td colspan="3">
+      [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1, style='width:250px') %]
+     </td>
+    </tr>
+    [%- END %]
+
     <tr>
      <th align="right">[% 'Delivery Order Date' | $T8 %] [% 'From' | $T8 %]</th>
      <td>