Revision c092c963
Von Werner Hahn vor etwa 6 Jahren hinzugefügt
SL/Controller/CustomerVendorTurnover.pm | ||
---|---|---|
4 | 4 |
use SL::DBUtils; |
5 | 5 |
use SL::DB::AccTransaction; |
6 | 6 |
use SL::DB::Invoice; |
7 |
use SL::DB; |
|
7 | 8 |
|
8 | 9 |
__PACKAGE__->run_before('check_auth'); |
9 | 10 |
|
10 | 11 |
sub action_list_turnover { |
11 | 12 |
my ($self) = @_; |
12 |
|
|
13 |
|
|
13 | 14 |
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id}; |
14 | 15 |
|
15 | 16 |
my $cv = $::form->{id} || {}; |
16 | 17 |
my $open_invoices; |
17 | 18 |
$open_invoices = SL::DB::Manager::Invoice->get_all( |
18 | 19 |
query => [customer_id => $cv, |
19 |
paid => {lt_sql => 'amount'},
|
|
20 |
paid => {lt_sql => 'amount'}, |
|
20 | 21 |
], |
21 | 22 |
with_objects => ['dunnings'], |
22 | 23 |
); |
... | ... | |
38 | 39 |
my ($self) = @_; |
39 | 40 |
|
40 | 41 |
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id}; |
41 |
my $dbh = $::form->get_standard_dbh();
|
|
42 |
my $dbh = SL::DB->client->dbh()
|
|
42 | 43 |
|
43 | 44 |
my $cv = $::form->{id} || {}; |
44 | 45 |
|
... | ... | |
55 | 56 |
ORDER BY date_part DESC"; |
56 | 57 |
|
57 | 58 |
$self->{dun_statistic} = selectall_hashref_query($::form, $dbh, $query); |
58 |
$self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 });
|
|
59 |
$self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 }); |
|
59 | 60 |
} |
60 | 61 |
sub action_count_open_items_by_month { |
61 | 62 |
|
62 | 63 |
my ($self) = @_; |
63 | 64 |
|
64 | 65 |
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id}; |
65 |
my $dbh = $::form->get_standard_dbh();
|
|
66 |
my $dbh = SL::DB->client->dbh()
|
|
66 | 67 |
|
67 | 68 |
my $cv = $::form->{id} || {}; |
68 | 69 |
|
... | ... | |
79 | 80 |
ORDER BY EXTRACT (YEAR FROM d.transdate) DESC"; |
80 | 81 |
|
81 | 82 |
$self->{dun_statistic} = selectall_hashref_query($::form, $dbh, $query); |
82 |
$self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 });
|
|
83 |
$self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 }); |
|
83 | 84 |
} |
84 | 85 |
sub action_turnover_by_month { |
85 | 86 |
|
... | ... | |
87 | 88 |
|
88 | 89 |
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id}; |
89 | 90 |
|
90 |
my $dbh = $::form->get_standard_dbh();
|
|
91 |
my $dbh = SL::DB->client->dbh()
|
|
91 | 92 |
my $cv = $::form->{id} || {}; |
92 | 93 |
my $query = "SELECT CONCAT(EXTRACT (MONTH FROM transdate),'/',EXTRACT (YEAR FROM transdate)) AS date_part, |
93 | 94 |
count(id) as count, |
... | ... | |
99 | 100 |
ORDER BY EXTRACT (YEAR FROM transdate) DESC, EXTRACT (MONTH FROM transdate) DESC"; |
100 | 101 |
|
101 | 102 |
$self->{turnover_statistic} = selectall_hashref_query($::form, $dbh, $query); |
102 |
$self->render('customer_vendor_turnover/count_turnover', { layout => 0 });
|
|
103 |
$self->render('customer_vendor_turnover/count_turnover', { layout => 0 }); |
|
103 | 104 |
} |
104 | 105 |
sub action_turnover_by_year { |
105 | 106 |
|
... | ... | |
107 | 108 |
|
108 | 109 |
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id}; |
109 | 110 |
|
110 |
my $dbh = $::form->get_standard_dbh();
|
|
111 |
my $dbh = SL::DB->client->dbh()
|
|
111 | 112 |
my $cv = $::form->{id} || {}; |
112 | 113 |
my $query = "SELECT EXTRACT (YEAR FROM transdate) as date_part, |
113 | 114 |
count(id) as count, |
... | ... | |
119 | 120 |
ORDER BY date_part DESC"; |
120 | 121 |
|
121 | 122 |
$self->{turnover_statistic} = selectall_hashref_query($::form, $dbh, $query); |
122 |
$self->render('customer_vendor_turnover/count_turnover', { layout => 0 });
|
|
123 |
$self->render('customer_vendor_turnover/count_turnover', { layout => 0 }); |
|
123 | 124 |
} |
124 | 125 |
sub action_get_invoices { |
125 | 126 |
my ($self) = @_; |
126 |
|
|
127 |
|
|
127 | 128 |
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id}; |
128 | 129 |
|
129 | 130 |
my $cv = $::form->{id} || {}; |
Auch abrufbar als: Unified diff
Kundenstatistik: dbh auf SL::DB->client->dbh umgestellt