- my %chart_labels = ();
- my @chart_values = ();
- my %charts = ();
- my $taxchart_init;
- foreach my $item (@{ $form->{ALL_CHARTS} }) {
- if ($item->{charttype} eq 'H'){ #falls überschrift
- next; #überspringen (Bug 1150)
- }
- my $key = $item->{accno} . "--" . $item->{tax_id};
- $taxchart_init = $item->{tax_id} unless (@chart_values);
- push(@chart_values, $key);
- $chart_labels{$key} = $item->{accno} . "--" . $item->{description};
- $charts{$item->{accno}} = $item;
- }
-
- my %taxchart_labels = ();
- my @taxchart_values = ();
- my %taxcharts = ();
- foreach my $item (@{ $form->{TAX_ACCOUNTS} }) {
- my $key = $item->{id} . "--" . $item->{rate};
- $taxchart_init = $key if ($taxchart_init == $item->{id});
- push(@taxchart_values, $key);
- $taxchart_labels{$key} = $item->{taxdescription} . " " . $item->{rate} * 100 . ' %';
- $taxcharts{$item->{id}} = $item;
- }
+ my %charts_by_id = map { ($_->{id} => $_) } @{ $::form->{ALL_CHARTS} };
+ my $default_chart = $::form->{ALL_CHARTS}[0];
+ my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;