Revision a7e58f7e
Von Moritz Bunkus vor fast 11 Jahren hinzugefügt
SL/Controller/FinancialControllingReport.pm | ||
---|---|---|
167 | 167 |
my %vals; |
168 | 168 |
|
169 | 169 |
foreach my $item (@{ $params{obj}->items }) { |
170 |
$vals{$item->parts_id} ||= { parts_id => $item->parts_id, amount => 0, base_qty => 0 }; |
|
171 |
$vals{$item->parts_id}->{amount} += $item->qty * $item->sellprice * (1 - $item->discount) / (($item->price_factor * 1) || 1); |
|
172 |
$vals{$item->parts_id}->{base_qty} += $item->qty * $item->unit_obj->base_factor; |
|
170 |
my $key = $item->parts_id; |
|
171 |
$key .= ':' . $item->serialnumber if $item->serialnumber; |
|
172 |
|
|
173 |
$vals{$key} ||= { parts_id => $item->parts_id, serialnumber => $item->serialnumber, amount => 0, base_qty => 0 }; |
|
174 |
$vals{$key}->{amount} += $item->qty * $item->sellprice * (1 - $item->discount) / (($item->price_factor * 1) || 1); |
|
175 |
$vals{$key}->{base_qty} += $item->qty * $item->unit_obj->base_factor; |
|
173 | 176 |
} |
174 | 177 |
|
175 | 178 |
return \%vals; |
... | ... | |
183 | 186 |
my $total = 0; |
184 | 187 |
|
185 | 188 |
foreach my $item (grep { $params{order}->{amounts_by_parts_id}->{ $_->{parts_id} } } values %{ $sums }) { |
186 |
my $order_item = $params{order}->{amounts_by_parts_id}->{ $item->{parts_id} }; |
|
187 |
if ($params{by_order} && $order_item->{base_qty}) { |
|
188 |
$total += $order_item->{amount} * $item->{base_qty} / $order_item->{base_qty}; |
|
189 |
} else { |
|
190 |
$total += $item->{amount}; |
|
189 |
my $key = $item->{parts_id}; |
|
190 |
|
|
191 |
if ($params{by_order}) { |
|
192 |
$key .= ':' . $item->{serialnumber}; |
|
193 |
my $order_item = $params{order}->{amounts_by_parts_id}->{ $key } || $params{order}->{amounts_by_parts_id}->{ $item->{parts_id} }; |
|
194 |
|
|
195 |
if ($order_item && $order_item->{base_qty}) { |
|
196 |
$total += $order_item->{amount} * $item->{base_qty} / $order_item->{base_qty}; |
|
197 |
next; |
|
198 |
} |
|
191 | 199 |
} |
200 |
|
|
201 |
$total += $item->{amount}; |
|
192 | 202 |
} |
193 | 203 |
|
194 | 204 |
return $total; |
Auch abrufbar als: Unified diff
Finanzcontrollingbericht: Seriennummern bei Berechnung berücksichtigen