Filtert Steuern bei Dialogbuchungen
[kivitendo-erp.git] / SL / GL.pm
index 1fc1f3a..a422877 100644 (file)
--- a/SL/GL.pm
+++ b/SL/GL.pm
@@ -801,5 +801,24 @@ sub get_chart_balances {
   $main::lxdebug->leave_sub();
 }
 
+sub get_tax_dropdown {
+  my $myconfig = \%main::myconfig;
+  my $form = $main::form;
+
+  my $dbh = $form->get_standard_dbh($myconfig);
+
+  my $query = qq|SELECT category FROM chart WHERE accno = ?|;
+  my ($category) = selectrow_query($form, $dbh, $query, $form->{accno});
+
+  $query = qq|SELECT * FROM tax WHERE chart_categories like '%$category%' order by taxkey, rate|;
+
+  my $sth = prepare_execute_query($form, $dbh, $query);
+
+  $form->{TAX_ACCOUNTS} = [];
+  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
+    push(@{ $form->{TAX_ACCOUNTS} }, $ref);
+  }
+
+}
 
 1;