Rechnungsbericht VK und EK nach Steuerzone filtern können
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 11 Mar 2022 17:20:18 +0000 (18:20 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 11 Mar 2022 17:20:18 +0000 (18:20 +0100)
SL/AP.pm
SL/AR.pm
bin/mozilla/ap.pl
bin/mozilla/ar.pl
templates/webpages/ap/search.html
templates/webpages/ar/search.html

index a02d6ff..9f34d99 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -618,6 +618,10 @@ sub ap_transactions {
     $where .= " AND a.ordnumber ILIKE ?";
     push(@values, like($form->{ordnumber}));
   }
+  if ($form->{taxzone_id}) {
+    $where .= " AND a.taxzone_id = ?";
+    push(@values, $form->{taxzone_id});
+  }
   if ($form->{transaction_description}) {
     $where .= " AND a.transaction_description ILIKE ?";
     push(@values, like($form->{transaction_description}));
index 148edd2..73c5786 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -573,9 +573,9 @@ sub ar_transactions {
     $where .= " AND c.business_id = ?";
     push(@values, $business_id);
   }
-  if ($form->{department_id}) {
-    $where .= " AND a.department_id = ?";
-    push(@values, $form->{department_id});
+  if ($form->{taxzone_id}) {
+    $where .= " AND a.taxzone_id = ?";
+    push(@values, $form->{taxzone_id});
   }
   foreach my $column (qw(invnumber ordnumber cusordnumber notes transaction_description shipvia shippingpoint)) {
     if ($form->{$column}) {
index 58f8cc5..9f2d4d9 100644 (file)
@@ -987,6 +987,8 @@ sub search {
   $form->{title} = $locale->text('Vendor Invoices & AP Transactions');
 
   $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
+  $::form->{ALL_TAXZONES}    = SL::DB::Manager::TaxZone   ->get_all_sorted;
+
   # constants and subs for template
   $form->{vc_keys}   = sub { "$_[0]->{name}--$_[0]->{id}" };
 
@@ -1044,7 +1046,7 @@ sub ap_transactions {
 
   my @hidden_variables = map { "l_${_}" } @columns;
   push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes project_id transdatefrom transdateto
-                                           parts_partnumber parts_description department_id);
+                                           parts_partnumber parts_description department_id taxzone_id);
 
   my $href = build_std_url('action=ap_transactions', grep { $form->{$_} } @hidden_variables);
 
index a73ec81..a3205b0 100644 (file)
@@ -964,6 +964,7 @@ sub search {
   $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
   $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
   $form->{ALL_BUSINESS_TYPES} = SL::DB::Manager::Business->get_all_sorted;
+  $form->{ALL_TAXZONES}       = SL::DB::Manager::TaxZone ->get_all_sorted;
 
   $form->{CT_CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'CT');
   ($form->{CT_CUSTOM_VARIABLES_FILTER_CODE},
@@ -1039,7 +1040,7 @@ sub ar_transactions {
   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 parts_partnumber parts_description department_id show_marked_as_closed show_not_mailed
-                                           shippingpoint shipvia);
+                                           shippingpoint shipvia taxzone_id);
   push @hidden_variables, map { "cvar_$_->{name}" } @ct_searchable_custom_variables;
 
   $href =  $params{want_binary_pdf} ? '' : build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
index 59f4b37..c965068 100644 (file)
       <th align=right nowrap>[% 'Order Number' | $T8 %]</th>
       <td>[% L.input_tag("ordnumber", "", style=style) %]</td>
      </tr>
+     <tr>
+      <th align="right">[% 'Steuersatz' | $T8 %]</th>
+      <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style=style) %]</td>
+     </tr>
      <tr>
       <th align="right" nowrap>[% 'Transaction description' | $T8 %]</th>
       <td>[% L.input_tag("transaction_description", "", style=style) %]</td>
index 6604964..d396db3 100644 (file)
      <th align="right">[% 'Salesman' | $T8 %]</th>
      <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style=style) %]</td>
      </tr>
+     <tr>
+      <th align="right">[% 'Steuersatz' | $T8 %]</th>
+      <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style=style) %]</td>
+     </tr>
      <tr>
       <th align=right nowrap>[% 'Transaction description' | $T8 %]</th>
       <td>[% L.input_tag("transaction_description", "", style=style) %]</td>