Filtern nach Kunden-/Lieferantentyp bei Angeboten u. Aufträgen
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 26 Aug 2013 13:26:47 +0000 (15:26 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 26 Aug 2013 13:26:47 +0000 (15:26 +0200)
SL/OE.pm
bin/mozilla/oe.pl
templates/webpages/oe/search.html

index 694732e..683bb0e 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -87,7 +87,7 @@ sub transactions {
     qq|  ex.$rate AS exchangerate, | .
     qq|  pr.projectnumber AS globalprojectnumber, | .
     qq|  e.name AS employee, s.name AS salesman, | .
-    qq|  ct.${vc}number AS vcnumber, ct.country, ct.ustid  | .
+    qq|  ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id  | .
     $periodic_invoices_columns .
     qq|FROM oe o | .
     qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
@@ -126,6 +126,11 @@ SQL
     push @values, "%" . $form->{"projectnumber"} . "%", "%" . $form->{"projectnumber"} . "%" ;
   }
 
+  if ($form->{"business_id"}) {
+    $query .= " AND ct.business_id = ?";
+    push(@values, $form->{"business_id"});
+  }
+
   if ($form->{"${vc}_id"}) {
     $query .= " AND o.${vc}_id = ?";
     push(@values, $form->{"${vc}_id"});
index 8f42a06..3a35b89 100644 (file)
@@ -721,7 +721,8 @@ sub search {
   $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
   $form->get_lists("projects"     => { "key" => "ALL_PROJECTS", "all" => 1 },
                    "departments"  => "ALL_DEPARTMENTS",
-                   "$form->{vc}s" => "ALL_VC");
+                   "$form->{vc}s" => "ALL_VC",
+                   "business_types" => "ALL_BUSINESS_TYPES");
   $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
 
   # constants and subs for template
@@ -829,7 +830,8 @@ 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 salesman_id
-                                                        reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive);
+                                                        reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive
+                                                        business_id);
 
   my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
 
@@ -902,6 +904,11 @@ sub orders {
   push @options, $locale->text('Not delivered')                                                           if $form->{notdelivered};
   push @options, $locale->text('Periodic invoices active')                                                if $form->{periodic_invoices_actibe};
 
+  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;
+  }
+
   $report->set_options('top_info_text'        => join("\n", @options),
                        'raw_top_info_text'    => $form->parse_html_template('oe/orders_top'),
                        'raw_bottom_info_text' => $form->parse_html_template('oe/orders_bottom', { 'SHOW_CONTINUE_BUTTON' => $allow_multiple_orders }),
index b8823de..c71e60f 100644 (file)
@@ -4,6 +4,7 @@
 [%- USE L %]
 [%- SET vclabel = vc == 'customer' ? LxERP.t8('Customer') : LxERP.t8('Vendor') %]
 [%- SET vcnumberlabel = vc == 'customer' ? LxERP.t8('Customer Number') : LxERP.t8('Vendor Number') %]
+[%- SET vctypelabel = vc == 'customer' ? LxERP.t8('Customer type') : LxERP.t8('Vendor type') %]
 
 <form method="post" action="oe.pl">
 
             -%]
      </td>
     </tr>
+    [%- UNLESS ALL_BUSINESS_TYPES.size == 0 %]
+    <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">[% IF is_order %][% 'Order Date' | $T8 %][% ELSE %][% 'Quotation Date' | $T8 %][% END %] [% 'From' | $T8 %]</th>
      <td>