Kreditorenbuchungen: nur zur Kontenkategorie passende Steuerschlüsselauswahl anbieten
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 20 Jan 2017 13:21:06 +0000 (14:21 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 20 Jan 2017 13:22:58 +0000 (14:22 +0100)
bin/mozilla/ap.pl
templates/webpages/ap/form_header.html

index dc02d13..ca88e92 100644 (file)
@@ -324,11 +324,6 @@ sub form_header {
     $charts{$item->{accno}} = $item;
   }
 
-  my %taxcharts = ();
-  foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
-    $taxcharts{$item->{id}} = $item;
-  }
-
   my $follow_up_vc         =  $form->{vendor};
   $follow_up_vc            =~ s/--.*?//;
   my $follow_up_trans_info =  "$form->{invnumber} ($follow_up_vc)";
@@ -348,8 +343,9 @@ sub form_header {
     my ($default_taxchart, $taxchart_to_use);
     my $amount_chart_id   = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id;
     my $chart_has_changed = $::form->{"previous_AP_amount_chart_id_$i"} && ($amount_chart_id != $::form->{"previous_AP_amount_chart_id_$i"});
+    my @taxcharts         = GL->get_active_taxes_for_chart($amount_chart_id, $transdate);
 
-    foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $transdate) ) {
+    foreach my $item (@taxcharts) {
       my $key             = $item->id . "--" . $item->rate;
       $first_taxchart   //= $item;
       $default_taxchart   = $item if $item->{is_default};
@@ -360,6 +356,7 @@ sub form_header {
     my $selected_taxchart            = $taxchart_to_use->id . '--' . $taxchart_to_use->rate;
     $form->{"selected_taxchart_$i"}  = $selected_taxchart;
     $form->{"AP_amount_chart_id_$i"} = $amount_chart_id;
+    $form->{"taxcharts_$i"}          = \@taxcharts;
   }
 
   $form->{taxchart_value_title_sub} = sub {
index 8c8a173..9623a71 100644 (file)
             </td>
             <td>
               [% temp = 'selected_taxchart_'_ i %]
-              [% L.select_tag('taxchart_'_ i, ALL_TAXCHARTS, value_title_sub = \taxchart_value_title_sub, default = $temp) %]
+              [% taxcharts = 'taxcharts_' _ i %]
+              [% L.select_tag('taxchart_'_ i, $taxcharts, value_title_sub = \taxchart_value_title_sub, default = $temp, style="width: 250px") %]
             </td>
             <td>
               [% temp = "project_id_"_ i %]