Revision bcadac51
Von Sven Schöling vor fast 16 Jahren hinzugefügt
SL/RP.pm | ||
---|---|---|
92 | 92 |
foreach my $category (grep { !/C/ } @categories) { |
93 | 93 |
|
94 | 94 |
$TMPL_DATA->{$category} = []; |
95 |
my $ml = $account{$category}{ml}; |
|
95 | 96 |
|
96 | 97 |
foreach my $key (sort keys %{ $form->{$category} }) { |
97 | 98 |
|
98 |
my $row = { %{ $form->{$category}{$key} } };
|
|
99 |
my $row = { %{ $form->{$category}{$key} } }; |
|
99 | 100 |
|
100 | 101 |
# if charttype "heading" - calculate this entry, start a new batch of charts belonging to this heading and skip the rest bo the loop |
102 |
# header charts are not real charts. start a sub aggregation with them, but don't calculate anything with them |
|
101 | 103 |
if ($row->{charttype} eq "H") { |
102 | 104 |
if ($account{$category}{subtotal} && $form->{l_subtotal}) { |
103 | 105 |
$row->{subdescription} = $account{$category}{subdescription}; |
104 |
$row->{this} = $account{$category}{subthis} * $account{$category}{ml}; # format: $dec, $dash
|
|
105 |
$row->{last} = $account{$category}{sublast} * $account{$category}{ml} if $last_period; # format: $dec, $dash
|
|
106 |
$row->{this} = $account{$category}{subthis} * $ml; # format: $dec, $dash
|
|
107 |
$row->{last} = $account{$category}{sublast} * $ml if $last_period; # format: $dec, $dash
|
|
106 | 108 |
} |
107 | 109 |
|
108 | 110 |
$row->{subheader} = 1; |
109 |
$account{$category}{subthis} = $form->{$category}{$key}{this};
|
|
110 |
$account{$category}{sublast} = $form->{$category}{$key}{last};
|
|
111 |
$account{$category}{subdescription} = $form->{$category}{$key}{description};
|
|
111 |
$account{$category}{subthis} = $row->{this};
|
|
112 |
$account{$category}{sublast} = $row->{last};
|
|
113 |
$account{$category}{subdescription} = $row->{description};
|
|
112 | 114 |
$account{$category}{subtotal} = 1; |
113 | 115 |
|
114 |
$form->{$category}{$key}{this} = 0;
|
|
115 |
$form->{$category}{$key}{last} = 0;
|
|
116 |
$row->{this} = 0;
|
|
117 |
$row->{last} = 0;
|
|
116 | 118 |
|
117 | 119 |
next unless $form->{l_heading}; |
118 | 120 |
} |
119 | 121 |
|
120 |
$row->{this} = $form->{$category}{$key}{this} * $account{$category}{ml}; |
|
121 |
|
|
122 |
# only add assets |
|
123 |
if ($row->{charttype} eq 'A') { |
|
124 |
$form->{total}{$category}{this} += $row->{this}; |
|
125 |
} |
|
126 |
|
|
127 |
if ($last_period) { |
|
128 |
$row->{last} = $form->{$category}{$key}{last} * $account{$category}{ml}; |
|
129 |
$form->{total}{$category}{last} += $row->{last}; |
|
122 |
for my $period (qw(this last)) { |
|
123 |
next if ($period eq 'last' && !$last_period); |
|
124 |
# only add assets |
|
125 |
$row->{$period} *= $ml; |
|
126 |
$form->{total}{$category}{$period} += $row->{$period}; # if ($row->{charttype} eq 'A') { # why?? |
|
130 | 127 |
} |
131 | 128 |
|
132 | 129 |
push @{ $TMPL_DATA->{$category} }, $row; |
133 | 130 |
} # foreach |
134 | 131 |
|
132 |
# resolve heading/subtotal |
|
135 | 133 |
if ($account{$category}{subtotal} && $form->{l_subtotal}) { |
136 | 134 |
$TMPL_DATA->{$category}[-1]{subdescription} = $account{$category}{subdescription}; |
137 |
$TMPL_DATA->{$category}[-1]{this} = $account{$category}{subthis} * $account{$category}{ml}; # format: $dec, $dash
|
|
138 |
$TMPL_DATA->{$category}[-1]{last} = $account{$category}{sublast} * $account{$category}{ml} if $last_period; # format: $dec, $dash
|
|
135 |
$TMPL_DATA->{$category}[-1]{this} = $account{$category}{subthis} * $ml; # format: $dec, $dash
|
|
136 |
$TMPL_DATA->{$category}[-1]{last} = $account{$category}{sublast} * $ml if $last_period; # format: $dec, $dash
|
|
139 | 137 |
} |
140 | 138 |
|
141 | 139 |
$TMPL_DATA->{total}{$category}{this} = sum map { $_->{this} } @{ $TMPL_DATA->{$category} }; |
Auch abrufbar als: Unified diff
weitere bilanzlogik einschmelzungen.