Revision 9d113c3f
Von Kivitendo Admin vor fast 10 Jahren hinzugefügt
SL/Controller/GL.pm | ||
---|---|---|
8 | 8 |
use SL::DB::PurchaseInvoice; |
9 | 9 |
use SL::DB::AccTransaction; |
10 | 10 |
use SL::Locale::String qw(t8); |
11 |
use List::Util qw(sum); |
|
11 | 12 |
|
12 | 13 |
__PACKAGE__->run_before('check_auth'); |
13 | 14 |
|
... | ... | |
38 | 39 |
my $ars = SL::DB::Manager::Invoice->get_all( query => [ @arfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'customer' ]); |
39 | 40 |
my $aps = SL::DB::Manager::PurchaseInvoice->get_all(query => [ @apfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'vendor' ]); |
40 | 41 |
|
41 |
# calculate an amount to be displayed for gl transaction
|
|
42 |
# use the sum of all credit amounts as the "amount" of the gl transaction
|
|
42 | 43 |
foreach my $gl ( @$gls ) { |
43 |
my $amount = 0; |
|
44 |
my $acc_trans_lines = SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $gl->id ]); |
|
45 |
foreach my $acc_trans_line ( @$acc_trans_lines ) { |
|
46 |
$amount += $acc_trans_line->amount if $acc_trans_line->amount > 0 ; |
|
47 |
}; |
|
48 |
$gl->{'amount'} = $amount; |
|
44 |
$gl->{'amount'} = sum map { $_->amount if $_->amount > 0 } @{$gl->transactions}; |
|
49 | 45 |
}; |
50 | 46 |
|
51 | 47 |
my $gldata = [ |
Auch abrufbar als: Unified diff
FiBu Schnellsuche - transactions für GL Summe benutzen
Berechnung der GL Summe umgeschrieben.