Revision 621f6f08
Von Cem Aydin vor mehr als 1 Jahr hinzugefügt
SL/Controller/ChartOfAccounts.pm | ||
---|---|---|
1 |
package SL::Controller::ChartOfAccounts; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::Base); |
|
5 |
|
|
6 |
use POSIX qw(strftime); |
|
7 |
|
|
8 |
use SL::CA; |
|
9 |
|
|
10 |
use SL::ReportGenerator; |
|
11 |
use SL::Controller::Helper::ReportGenerator; |
|
12 |
use SL::Locale::String; |
|
13 |
|
|
14 |
use Rose::Object::MakeMethods::Generic ( |
|
15 |
scalar => [ qw(report) ], |
|
16 |
); |
|
17 |
|
|
18 |
__PACKAGE__->run_before(sub { $::auth->assert('report'); }); |
|
19 |
|
|
20 |
sub action_list { |
|
21 |
my ($self) = @_; |
|
22 |
|
|
23 |
if ( $::instance_conf->get_accounting_method eq 'cash' ) { |
|
24 |
$::form->{method} = "cash"; |
|
25 |
} |
|
26 |
|
|
27 |
$self->prepare_report; |
|
28 |
$self->set_report_data; |
|
29 |
$self->report->generate_with_headers; |
|
30 |
} |
|
31 |
|
|
32 |
# private functions |
|
33 |
|
|
34 |
sub prepare_report { |
|
35 |
my ($self) = @_; |
|
36 |
|
|
37 |
$self->report(SL::ReportGenerator->new(\%::myconfig, $::form)); |
|
38 |
|
|
39 |
my @columns = qw(accno description debit credit); |
|
40 |
my %column_defs = ( |
|
41 |
accno => { text => t8('Account') }, |
|
42 |
description => { text => t8('Description') }, |
|
43 |
debit => { text => t8('Debit') }, |
|
44 |
credit => { text => t8('Credit') }, |
|
45 |
); |
|
46 |
|
|
47 |
$self->report->set_options( |
|
48 |
std_column_visibility => 1, |
|
49 |
controller_class => 'ChartOfAccounts', |
|
50 |
output_format => 'HTML', |
|
51 |
title => t8('Chart of Accounts'), |
|
52 |
allow_pdf_export => 1, |
|
53 |
allow_csv_export => 1, |
|
54 |
attachment_basename => t8('chart_of_accounts') . strftime('_%Y%m%d', localtime time), |
|
55 |
); |
|
56 |
$self->report->set_columns(%column_defs); |
|
57 |
$self->report->set_column_order(@columns); |
|
58 |
|
|
59 |
$self->report->set_export_options(qw(list)); |
|
60 |
$self->report->set_options_from_form; |
|
61 |
$self->report->set_sort_indicator($::form->{sort}, 1); |
|
62 |
} |
|
63 |
|
|
64 |
sub set_report_data { |
|
65 |
my ($self) = @_; |
|
66 |
|
|
67 |
my $debit_sum = 0.; |
|
68 |
my $credit_sum = 0.; |
|
69 |
|
|
70 |
# i tried to use the get_balance function from SL::DB::Manager::Chart here, |
|
71 |
# but the results i got were different (numbers and defined balance/amount), |
|
72 |
# the database queries in CA are more sophisticated, therefore i'm still using these for now, |
|
73 |
# also performance wise they seem faster |
|
74 |
CA->all_accounts(\%::myconfig, \%$::form); |
|
75 |
|
|
76 |
my $formatted_zero = $::form->format_amount(\%::myconfig, 0., 2); |
|
77 |
|
|
78 |
for my $chart (@{ $::form->{CA} }) { |
|
79 |
my $balance = $chart->{amount}; |
|
80 |
|
|
81 |
my $link = "controller.pl?action=ListTransactions%2freport_settings&accno=$chart->{accno}&link=1"; |
|
82 |
if (defined($balance)) { |
|
83 |
my %data = ( |
|
84 |
accno => { data => $chart->{accno}, link => $link }, |
|
85 |
description => { data => $chart->{description} }, |
|
86 |
debit => { data => $balance < 0 ? $::form->format_amount(\%::myconfig, $balance * -1., 2) : ''}, |
|
87 |
credit => { data => $balance >= 0 ? $::form->format_amount(\%::myconfig, $balance, 2) : ''}, |
|
88 |
); |
|
89 |
$data{$_}->{align} = 'right' for qw(debit credit); |
|
90 |
map { $data{$_}->{class} = 'listheading' } keys %data if ($chart->{charttype} eq "H") ; |
|
91 |
$self->report->add_data(\%data); |
|
92 |
|
|
93 |
if ($balance < 0) { |
|
94 |
$debit_sum += $balance; |
|
95 |
} else { |
|
96 |
$credit_sum += $balance; |
|
97 |
} |
|
98 |
} |
|
99 |
} |
|
100 |
my %data_total = ( |
|
101 |
accno => { data => t8('Total') }, |
|
102 |
description => { data => '' }, |
|
103 |
debit => { data => $::form->format_amount(\%::myconfig, $debit_sum * -1., 2)}, |
|
104 |
credit => { data => $::form->format_amount(\%::myconfig, $credit_sum, 2)}, |
|
105 |
); |
|
106 |
%data_total{$_}->{align} = 'right' for qw(debit credit); |
|
107 |
%data_total{$_}->{class} = 'listtotal' for keys %data_total; |
|
108 |
|
|
109 |
$self->report->add_data(\%data_total); |
|
110 |
} |
|
111 |
|
|
112 |
1; |
SL/Controller/ListTransactions.pm | ||
---|---|---|
1 |
package SL::Controller::ListTransactions; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::Base); |
|
5 |
|
|
6 |
use POSIX qw(strftime); |
|
7 |
use List::Util qw(first); |
|
8 |
use Archive::Zip; |
|
9 |
|
|
10 |
use SL::DB::Chart; |
|
11 |
use SL::DB::AccTransaction; |
|
12 |
use SL::CA; |
|
13 |
|
|
14 |
use SL::ReportGenerator; |
|
15 |
use SL::Controller::Helper::ReportGenerator; |
|
16 |
use SL::Locale::String; |
|
17 |
use SL::SessionFile::Random; |
|
18 |
use SL::Helper::Flash qw(flash); |
|
19 |
|
|
20 |
use SL::Presenter::DatePeriod qw(get_dialog_defaults_from_report_generator |
|
21 |
populate_hidden_variables); |
|
22 |
|
|
23 |
use Rose::Object::MakeMethods::Generic ( |
|
24 |
scalar => [ qw(defaults title account from_date to_date report_type report) ], |
|
25 |
'scalar --get_set_init' => [ qw(accounts_list) ], |
|
26 |
); |
|
27 |
|
|
28 |
__PACKAGE__->run_before(sub { $::auth->assert('report'); }); |
|
29 |
|
|
30 |
# actions |
|
31 |
|
|
32 |
sub action_report_settings { |
|
33 |
my ($self) = @_; |
|
34 |
|
|
35 |
$self->set_defaults; |
|
36 |
|
|
37 |
# if we're coming from a linked entry we want to pre-select the chart picker |
|
38 |
if ($::form->{link}) { |
|
39 |
my $account = first { $_->{accno} eq $::form->{accno} } @{ $self->accounts_list }; |
|
40 |
$self->defaults->{chart_id} = $account->{chart_id}; |
|
41 |
} |
|
42 |
|
|
43 |
$self->setup_report_settings_action_bar; |
|
44 |
$self->render('list_transactions/report_settings', |
|
45 |
title => t8('List Transactions'), |
|
46 |
accounts_list => $self->accounts_list, |
|
47 |
defaults => $self->defaults, |
|
48 |
); |
|
49 |
} |
|
50 |
|
|
51 |
sub action_list { |
|
52 |
my ($self) = @_; |
|
53 |
|
|
54 |
$self->set_dates; |
|
55 |
|
|
56 |
$self->report_type('HTML'); |
|
57 |
|
|
58 |
# set account number from chart picker chart_id |
|
59 |
my $account = first { $_->{chart_id} eq $::form->{chart_id} } @{ $self->accounts_list }; |
|
60 |
if (!$account) { |
|
61 |
flash('error', t8('No account selected. Please select an account.')); |
|
62 |
return $self->action_report_settings; |
|
63 |
} |
|
64 |
$::form->{accno} = $account->{accno}; |
|
65 |
|
|
66 |
$self->set_title; |
|
67 |
|
|
68 |
$self->setup_list_action_bar; |
|
69 |
$self->prepare_report; |
|
70 |
$self->set_report_data; |
|
71 |
$self->report->generate_with_headers; |
|
72 |
} |
|
73 |
|
|
74 |
sub action_csv_options_export_all_charts { |
|
75 |
my ($self) = @_; |
|
76 |
|
|
77 |
$self->set_dates; |
|
78 |
|
|
79 |
# misusing the set_defaults function here a bit to easily |
|
80 |
# get the values from the form, |
|
81 |
# we have to get the values here because we have to forward them |
|
82 |
# to the csv options form using a hidden array |
|
83 |
$self->set_defaults; |
|
84 |
|
|
85 |
$self->defaults->{fromdate} = $self->from_date; |
|
86 |
$self->defaults->{todate} = $self->to_date; |
|
87 |
|
|
88 |
# dialog state is returned in a nested hash, this has to be flattened here |
|
89 |
my @hidden; |
|
90 |
push @hidden, map { |
|
91 |
{ key => 'dateperiod_selected_preset_' . $_, value => $self->defaults->{dialog}->{$_} } |
|
92 |
} keys %{ $self->defaults->{dialog} }; |
|
93 |
delete($self->defaults->{dialog}); |
|
94 |
|
|
95 |
# handle the rest of the state |
|
96 |
push @hidden, map { |
|
97 |
{ key => $_, value => $self->defaults->{$_} } |
|
98 |
} keys %{ $self->defaults }; |
|
99 |
|
|
100 |
$self->setup_csv_options_action_bar; |
|
101 |
$self->render('report_generator/csv_export_options', |
|
102 |
title => t8('CSV export -- options'), |
|
103 |
HIDDEN => \@hidden, |
|
104 |
); |
|
105 |
} |
|
106 |
|
|
107 |
sub action_export_all_charts { |
|
108 |
my ($self) = @_; |
|
109 |
|
|
110 |
my $zip = Archive::Zip->new(); |
|
111 |
|
|
112 |
for my $account (@{ $self->accounts_list }) { |
|
113 |
$::form->{accno} = $account->{accno}; |
|
114 |
|
|
115 |
my $sfile = SL::SessionFile::Random->new(mode => "w"); |
|
116 |
|
|
117 |
$self->set_title; |
|
118 |
$self->report_type('CSV'); |
|
119 |
|
|
120 |
$self->prepare_report; |
|
121 |
$self->set_report_data; |
|
122 |
$self->report->_generate_csv_content($sfile->fh); |
|
123 |
$sfile->fh->close; |
|
124 |
|
|
125 |
$zip->addFile( |
|
126 |
$sfile->{file_name}, |
|
127 |
t8('list_of_transactions') . "_" . t8('account') . "_" . $account->{accno} . ".csv" |
|
128 |
); |
|
129 |
} |
|
130 |
|
|
131 |
my $zipfile = SL::SessionFile::Random->new(mode => "w"); |
|
132 |
unless ( $zip->writeToFileNamed($zipfile->file_name) == Archive::Zip::AZ_OK ) { |
|
133 |
die 'zipfile write error'; |
|
134 |
} |
|
135 |
$zipfile->fh->close; |
|
136 |
|
|
137 |
$self->send_file( |
|
138 |
$zipfile->file_name, |
|
139 |
type => 'application/zip', |
|
140 |
name => t8('list_of_transactions') . strftime('_%Y%m%d', localtime time) . '.zip', |
|
141 |
); |
|
142 |
} |
|
143 |
|
|
144 |
# local functions |
|
145 |
|
|
146 |
sub set_defaults { |
|
147 |
my ($self) = @_; |
|
148 |
|
|
149 |
# use values from form, then report generator form, then fallback |
|
150 |
my %fallback = ( |
|
151 |
#accno => $self->accounts_list->[0]->{accno}, |
|
152 |
chart_id => '', |
|
153 |
reporttype => 'custom', |
|
154 |
year => DateTime->today->year, |
|
155 |
duetyp => '13', |
|
156 |
dateperiod_from_date => '', |
|
157 |
dateperiod_to_date => '', |
|
158 |
show_subtotals => 0, |
|
159 |
sort => 'transdate', |
|
160 |
); |
|
161 |
my %defaults; |
|
162 |
for (keys %fallback) { |
|
163 |
$defaults{$_} = $::form->{$_} // $::form->{'report_generator_hidden_' . $_} // $fallback{$_}; |
|
164 |
} |
|
165 |
|
|
166 |
$defaults{dialog} = get_dialog_defaults_from_report_generator('dateperiod'); |
|
167 |
|
|
168 |
$self->defaults(\%defaults); |
|
169 |
} |
|
170 |
|
|
171 |
sub set_title { |
|
172 |
my ($self) = @_; |
|
173 |
my $account = first { $_->{accno} eq $::form->{accno} } @{ $self->accounts_list }; |
|
174 |
$self->title(join(" ", t8('List Transactions'), t8('Account'), $account->{text})); |
|
175 |
} |
|
176 |
|
|
177 |
sub set_dates { |
|
178 |
my ($self) = @_; |
|
179 |
|
|
180 |
# set dates according to selection |
|
181 |
$self->from_date($::form->{dateperiod_from_date}); |
|
182 |
$self->to_date($::form->{dateperiod_to_date}); |
|
183 |
|
|
184 |
# set this into form here for the CA-> routines |
|
185 |
$::form->{fromdate} = $self->from_date; |
|
186 |
$::form->{todate} = $self->to_date; |
|
187 |
# (no further checks needed, a reasonable error is shown when dates are invalid) |
|
188 |
} |
|
189 |
|
|
190 |
sub prepare_report { |
|
191 |
my ($self) = @_; |
|
192 |
|
|
193 |
$self->report(SL::ReportGenerator->new(\%::myconfig, $::form)); |
|
194 |
|
|
195 |
my @columns = qw(transdate reference description gegenkonto debit credit ustkonto ustrate balance); |
|
196 |
my %column_defs = ( |
|
197 |
transdate => { text => t8('Date'), }, |
|
198 |
reference => { text => t8('Reference'), }, |
|
199 |
description => { text => t8('Description'), }, |
|
200 |
debit => { text => t8('Debit'), }, |
|
201 |
credit => { text => t8('Credit'), }, |
|
202 |
gegenkonto => { text => t8('Gegenkonto'), }, |
|
203 |
ustkonto => { text => t8('USt-Konto'), }, |
|
204 |
balance => { text => t8('Balance'), }, |
|
205 |
ustrate => { text => t8('Satz %'), }, |
|
206 |
); |
|
207 |
|
|
208 |
$self->report->set_options( |
|
209 |
std_column_visibility => 1, |
|
210 |
controller_class => 'ListTransactions', |
|
211 |
output_format => $self->report_type, |
|
212 |
title => $self->title, |
|
213 |
allow_pdf_export => 1, |
|
214 |
allow_csv_export => 1, |
|
215 |
attachment_basename => t8('list_of_transactions') . strftime('_%Y%m%d', localtime time), |
|
216 |
top_info_text => $self->get_top_info_text, |
|
217 |
); |
|
218 |
$self->report->set_columns(%column_defs); |
|
219 |
$self->report->set_column_order(@columns); |
|
220 |
|
|
221 |
my @hidden_variables = qw(accno chart_id show_subtotals sort); |
|
222 |
populate_hidden_variables('dateperiod', \@hidden_variables); |
|
223 |
|
|
224 |
$self->report->set_export_options(qw(list), @hidden_variables); |
|
225 |
$self->report->set_options_from_form; |
|
226 |
$self->report->set_sort_indicator($::form->{sort}, 1); |
|
227 |
# this is getting triggered but doesn't seem to have an effect |
|
228 |
#$::locale->set_numberformat_wo_thousands_separator(\%::myconfig) if lc($self->report->{options}->{output_format}) eq 'csv'; |
|
229 |
} |
|
230 |
|
|
231 |
sub set_report_data { |
|
232 |
my ($self) = @_; |
|
233 |
|
|
234 |
CA->all_transactions(\%::myconfig, \%$::form); |
|
235 |
|
|
236 |
# this data is used in custom header |
|
237 |
$self->{eb_value} = $::form->{beginning_balance}; |
|
238 |
$self->{saldo_old} += $::form->{beginning_balance}; |
|
239 |
$self->{debit_old} += $::form->{beginning_balance}; |
|
240 |
$self->{credit_old} += $::form->{beginning_balance}; |
|
241 |
|
|
242 |
$self->set_report_custom_headers(); |
|
243 |
|
|
244 |
# initialise totals |
|
245 |
$self->{total_debit} = 0.; |
|
246 |
$self->{total_credit} = 0.; |
|
247 |
my $subtotal_debit = 0.; |
|
248 |
my $subtotal_credit = 0.; |
|
249 |
$self->{balance} = $self->{saldo_old}; |
|
250 |
|
|
251 |
# used for subtotals below |
|
252 |
my $sort_key = $::form->{sort}; |
|
253 |
|
|
254 |
my $idx = 0; |
|
255 |
for my $tr (@{ $::form->{CA} }) { |
|
256 |
|
|
257 |
# sum up totals |
|
258 |
$self->{total_debit} += $tr->{debit}; |
|
259 |
$self->{total_credit} += $tr->{credit}; |
|
260 |
$subtotal_debit += $tr->{debit}; |
|
261 |
$subtotal_credit += $tr->{credit}; |
|
262 |
$self->{balance} -= $tr->{debit}; |
|
263 |
$self->{balance} += $tr->{credit}; |
|
264 |
|
|
265 |
# formatting |
|
266 |
my $credit = $tr->{credit} ? $::form->format_amount(\%::myconfig, $tr->{credit}, 2) : '0'; |
|
267 |
my $debit = $tr->{debit} ? $::form->format_amount(\%::myconfig, $tr->{debit}, 2) : '0'; |
|
268 |
my $ustrate = $::form->format_amount(\%::myconfig, $tr->{ustrate} * 100, 2) if ($tr->{ustrate} != 0); |
|
269 |
|
|
270 |
my $gegenkonto_string = ""; |
|
271 |
foreach my $gegenkonto (@{ $tr->{GEGENKONTO} }) { |
|
272 |
if ($gegenkonto_string eq "") { |
|
273 |
$gegenkonto_string = $gegenkonto->{accno}; |
|
274 |
} else { |
|
275 |
$gegenkonto_string .= ", " . $gegenkonto->{accno}; |
|
276 |
} |
|
277 |
} |
|
278 |
|
|
279 |
my $reference_link = "$tr->{module}.pl?action=edit&id=$tr->{id}"; |
|
280 |
|
|
281 |
my %data = ( |
|
282 |
transdate => { data => $tr->{transdate}, }, |
|
283 |
reference => { data => $tr->{reference}, link => $reference_link }, |
|
284 |
description => { data => $tr->{description}, }, |
|
285 |
gegenkonto => { data => $gegenkonto_string, }, |
|
286 |
debit => { data => $debit }, |
|
287 |
credit => { data => $credit }, |
|
288 |
ustkonto => { data => $tr->{ustkonto}, }, |
|
289 |
ustrate => { data => $ustrate }, |
|
290 |
balance => { data => $::form->format_amount(\%::myconfig, $self->{balance}, 2, 'DRCR') }, |
|
291 |
); |
|
292 |
$data{$_}->{align} = 'right' for qw(debit credit ustkonto ustrate balance); |
|
293 |
# use a row set here in order to keep the table coloring intact |
|
294 |
my @row_set; |
|
295 |
push @row_set, \%data; |
|
296 |
|
|
297 |
# show subtotals if setting enabled and ( last element reached or |
|
298 |
# next element has a different value in the field selected by sort key ) |
|
299 |
if ( ($::form->{show_subtotals}) && |
|
300 |
( ($idx == scalar @{ $::form->{CA} } - 1) || |
|
301 |
($tr->{$sort_key} ne $::form->{CA}->[$idx + 1]->{$sort_key}) ) ) { |
|
302 |
|
|
303 |
my %data = map { $_ => { class => 'listtotal' } } keys %{ $self->report->{columns} }; |
|
304 |
$data{credit}->{data} = $::form->format_amount(\%::myconfig, $subtotal_credit, 2); |
|
305 |
$data{debit}->{data} = $::form->format_amount(\%::myconfig, $subtotal_debit, 2); |
|
306 |
push @row_set, \%data; |
|
307 |
|
|
308 |
$subtotal_credit = 0.; |
|
309 |
$subtotal_debit = 0.; |
|
310 |
} |
|
311 |
$self->report->add_data(\@row_set); |
|
312 |
$idx++; |
|
313 |
} |
|
314 |
|
|
315 |
# debit credit and balance totals line |
|
316 |
my %data = map { $_ => { class => 'listtotal' } } keys %{ $self->report->{columns} }; |
|
317 |
$data{credit}->{data} = $::form->format_amount(\%::myconfig, $self->{total_credit}, 2); |
|
318 |
$data{debit}->{data} = $::form->format_amount(\%::myconfig, $self->{total_debit}, 2); |
|
319 |
$data{balance}->{data} = $::form->format_amount(\%::myconfig, $self->{balance}, 2, 'DRCR'); |
|
320 |
$data{$_}->{align} = 'right' for qw(debit credit balance); |
|
321 |
$self->report->add_data(\%data); |
|
322 |
|
|
323 |
$self->set_report_footer_lines(); |
|
324 |
} |
|
325 |
|
|
326 |
sub set_report_footer_lines { |
|
327 |
my ($self) = @_; |
|
328 |
# line 1 |
|
329 |
my %data = map { $_ => { class => 'listtotal' } } keys %{ $self->report->{columns} }; |
|
330 |
$data{reference}->{data} = t8('EB-Wert'); |
|
331 |
$data{description} = { data => t8('Saldo neu'), class => 'listtotal', colspan => 2 }; |
|
332 |
$data{debit} = { data => t8('Jahresverkehrszahlen neu'), class => 'listtotal', colspan => 2 }; |
|
333 |
$self->report->add_data(\%data); |
|
334 |
|
|
335 |
# line 2 |
|
336 |
my %data2 = map { $_ => { class => 'listtotal' } } keys %{ $self->report->{columns} }; |
|
337 |
$data2{reference}->{data} = format_debit_credit($self->{eb_value}); |
|
338 |
$data2{description} = { data => format_debit_credit($self->{balance}), class => 'listtotal', colspan => 2 }; |
|
339 |
$data2{debit}->{data} = $::form->format_amount(\%::myconfig, abs($self->{total_debit}), 2) . " S"; |
|
340 |
$data2{credit}->{data} = $::form->format_amount(\%::myconfig, $self->{total_credit}, 2) . " H"; |
|
341 |
$self->report->add_data(\%data2); |
|
342 |
} |
|
343 |
|
|
344 |
sub set_report_custom_headers { |
|
345 |
my ($self) = @_; |
|
346 |
|
|
347 |
my @custom_headers = (); |
|
348 |
# line 1 |
|
349 |
push @custom_headers, [ |
|
350 |
{ text => t8('Letzte Buchung'), }, |
|
351 |
{ text => t8('EB-Wert'), }, |
|
352 |
{ text => t8('Saldo alt'), 'colspan' => 2, }, |
|
353 |
{ text => t8('Jahresverkehrszahlen alt'), 'colspan' => 2, }, |
|
354 |
{ text => '', 'colspan' => 2, }, |
|
355 |
]; |
|
356 |
push @custom_headers, [ |
|
357 |
{ text => $::form->{last_transaction}, }, |
|
358 |
{ text => format_debit_credit($self->{eb_value}), }, |
|
359 |
{ text => format_debit_credit($self->{saldo_old}), 'colspan' => 2, }, |
|
360 |
{ text => $::form->format_amount(\%::myconfig, abs($self->{debit_old}), 2) . " S", }, |
|
361 |
{ text => $::form->format_amount(\%::myconfig, $self->{credit_old}, 2) . " H", }, |
|
362 |
{ text => '', 'colspan' => 2, }, |
|
363 |
]; |
|
364 |
# line 2 |
|
365 |
# sorting is selected with radio button |
|
366 |
#my $link = "controller.pl?action=ListTransactions%2freport_settings&accno=$::form->{accno}&fromdate=$::form->{fromdate}&todate=$::form->{todate}&show_subtotals=$::form->{show_subtotals}"; |
|
367 |
push @custom_headers, [ |
|
368 |
{ text => t8('Date'), }, # link => $link . "&sort=transdate", }, |
|
369 |
{ text => t8('Reference'), }, #'link' => $link . "&sort=reference", }, |
|
370 |
{ text => t8('Description'), }, #'link' => $link . "&sort=description", }, |
|
371 |
{ text => t8('Gegenkonto'), }, |
|
372 |
{ text => t8('Debit'), }, |
|
373 |
{ text => t8('Credit'), }, |
|
374 |
{ text => t8('USt-Konto'), }, |
|
375 |
{ text => t8('Satz %'), }, |
|
376 |
{ text => t8('Balance'), }, |
|
377 |
]; |
|
378 |
|
|
379 |
$self->report->set_custom_headers(@custom_headers); |
|
380 |
} |
|
381 |
|
|
382 |
# action bar |
|
383 |
|
|
384 |
sub setup_report_settings_action_bar { |
|
385 |
my ($self, %params) = @_; |
|
386 |
|
|
387 |
for my $bar ($::request->layout->get('actionbar')) { |
|
388 |
$bar->add( |
|
389 |
action => [ |
|
390 |
t8('Show'), |
|
391 |
submit => [ '#report_settings', { action => 'ListTransactions/list' } ], |
|
392 |
accesskey => 'enter', |
|
393 |
], |
|
394 |
combobox => [ |
|
395 |
action => [ |
|
396 |
t8('Export'), |
|
397 |
], |
|
398 |
action => [ |
|
399 |
t8('Export all accounts to CSV (ZIP file)'), |
|
400 |
submit => [ '#report_settings', { action => 'ListTransactions/csv_options_export_all_charts' } ], |
|
401 |
], |
|
402 |
], # end of combobox "Export" |
|
403 |
); |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
407 |
sub setup_csv_options_action_bar { |
|
408 |
my ($self, %params) = @_; |
|
409 |
for my $bar ($::request->layout->get('actionbar')) { |
|
410 |
$bar->add( |
|
411 |
action => [ |
|
412 |
t8('Export'), |
|
413 |
submit => [ '#report_generator_form', { action => 'ListTransactions/export_all_charts' } ], |
|
414 |
accesskey => 'enter', |
|
415 |
], |
|
416 |
action => [ |
|
417 |
t8('Back'), |
|
418 |
submit => [ '#report_generator_form', { action => 'ListTransactions/report_settings' } ], |
|
419 |
], |
|
420 |
); |
|
421 |
} |
|
422 |
} |
|
423 |
|
|
424 |
sub setup_list_action_bar { |
|
425 |
my ($self, %params) = @_; |
|
426 |
for my $bar ($::request->layout->get('actionbar')) { |
|
427 |
$bar->add( |
|
428 |
action => [ |
|
429 |
t8('Back'), |
|
430 |
submit => [ '#report_generator_form', { action => 'ListTransactions/report_settings' } ], |
|
431 |
], |
|
432 |
); |
|
433 |
} |
|
434 |
} |
|
435 |
|
|
436 |
# helper |
|
437 |
|
|
438 |
sub get_top_info_text { |
|
439 |
my ($self) = @_; |
|
440 |
my @text; |
|
441 |
if ($::form->{department}) { |
|
442 |
my ($department) = split /--/, $::form->{department}; |
|
443 |
push @text, $::locale->text('Department') . " : $department"; |
|
444 |
} |
|
445 |
if ($::form->{projectnumber}) { |
|
446 |
push @text, $::locale->text('Project Number') . " : $::form->{projectnumber}<br>"; |
|
447 |
} |
|
448 |
push @text, join " ", t8('Period:'), $self->from_date, "-", $self->to_date; |
|
449 |
push @text, join " ", t8('Report date:'), $::locale->format_date_object(DateTime->now_local); |
|
450 |
push @text, join " ", t8('Company:'), $::instance_conf->get_company; |
|
451 |
join "\n", @text; |
|
452 |
} |
|
453 |
|
|
454 |
sub format_debit_credit { |
|
455 |
my $dc = shift; |
|
456 |
my $formatted_dc = $::form->format_amount(\%::myconfig, abs($dc), 2) . ' '; |
|
457 |
$formatted_dc .= ($dc > 0) ? t8('Credit (one letter abbreviation)') : t8('Debit (one letter abbreviation)'); |
|
458 |
$formatted_dc; |
|
459 |
} |
|
460 |
|
|
461 |
sub init_accounts_list { |
|
462 |
CA->all_accounts(\%::myconfig, \%$::form); |
|
463 |
my @accounts_list = map { { |
|
464 |
text => "$_->{accno} - $_->{description}", |
|
465 |
accno => $_->{accno}, |
|
466 |
chart_id => $_->{id}, |
|
467 |
} } @{ $::form->{CA} }; |
|
468 |
\@accounts_list; |
|
469 |
} |
|
470 |
|
|
471 |
1; |
locale/de/all | ||
---|---|---|
750 | 750 |
'Company name and address' => 'Firmenname und -adresse', |
751 | 751 |
'Company settings' => 'Firmeneinstellungen', |
752 | 752 |
'Company\'s email signature' => 'Firmen-E-Mail-Signatur', |
753 |
'Company:' => 'Firma:', |
|
753 | 754 |
'Compare to' => 'Gegenüberstellen zu', |
754 | 755 |
'Complexities' => 'Komplexitätsgrade', |
755 | 756 |
'Complexity' => 'Komplexität', |
... | ... | |
1612 | 1613 |
'Experimental Features' => 'Experimentelle Features', |
1613 | 1614 |
'Export' => 'Export', |
1614 | 1615 |
'Export Number' => 'Exportnummer', |
1616 |
'Export all accounts to CSV (ZIP file)' => 'Alle Konten als CSV exportieren (ZIP-Datei)', |
|
1615 | 1617 |
'Export as CSV' => 'Als CSV exportieren', |
1616 | 1618 |
'Export as PDF' => 'Als PDF exportieren', |
1617 | 1619 |
'Export date' => 'Exportdatum', |
... | ... | |
2046 | 2048 |
'Item values' => 'Artikelwerte', |
2047 | 2049 |
'Item variables' => 'Artikelvariablen', |
2048 | 2050 |
'JS Tests' => 'JS-Tests', |
2051 |
'Jahresverkehrszahlen alt' => 'Jahresverkehrszahlen alt', |
|
2049 | 2052 |
'Jahresverkehrszahlen neu' => 'Jahresverkehrszahlen neu', |
2050 | 2053 |
'Jan' => 'Jan', |
2051 | 2054 |
'January' => 'Januar', |
... | ... | |
2116 | 2119 |
'Letter saved!' => 'Brief gespeichert!', |
2117 | 2120 |
'Letternumber' => 'Briefnummer', |
2118 | 2121 |
'Letters' => 'Briefe', |
2122 |
'Letzte Buchung' => 'Letzte Buchung', |
|
2119 | 2123 |
'Liability' => 'Passiva/Mittelherkunft', |
2120 | 2124 |
'Limit part selection' => 'Artikelauswahl eingrenzen', |
2121 | 2125 |
'Line Total' => 'Zeilensumme', |
... | ... | |
2343 | 2347 |
'No Shopimages' => 'Keine Shop-Bilder', |
2344 | 2348 |
'No VAT Info for this Factur-X/ZUGFeRD invoice, please ask your vendor to add this for his Factur-X/ZUGFeRD data.' => 'Konnte keine UST-ID für diese Factur-X-/ZUGFeRD-Rechnungen finden, bitte fragen Sie bei Ihren Lieferanten nach, ob dieses Feld im Factur-X-/ZUGFeRD-Datensatz gesetzt wird.', |
2345 | 2349 |
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', |
2350 |
'No account selected. Please select an account.' => 'Kein Konto ausgewählt. Bitte Konto auswählen.', |
|
2346 | 2351 |
'No action defined.' => 'Keine Aktion definiert.', |
2347 | 2352 |
'No address selected to delete' => 'Keine Adresse zum Löschen ausgewählt', |
2348 | 2353 |
'No article has been selected yet.' => 'Es wurde noch kein Artikel ausgewählt.', |
... | ... | |
3062 | 3067 |
'Report and misc. Preferences' => 'Sonstige Einstellungen', |
3063 | 3068 |
'Report configuration overview' => 'Berichtskonfigurationsübersicht', |
3064 | 3069 |
'Report date' => 'Berichtsdatum', |
3070 |
'Report date:' => 'Bericht Datum:', |
|
3065 | 3071 |
'Report for' => 'Bericht für', |
3066 | 3072 |
'Report separately' => 'Preis separat ausweisen', |
3067 | 3073 |
'Reports' => 'Berichte', |
... | ... | |
3150 | 3156 |
'SWIFT MT940 format' => 'SWIFT-MT940-Format', |
3151 | 3157 |
'Saldo Credit' => 'Saldo Haben', |
3152 | 3158 |
'Saldo Debit' => 'Saldo Soll', |
3159 |
'Saldo alt' => 'Saldo alt', |
|
3153 | 3160 |
'Saldo neu' => 'Saldo neu', |
3154 | 3161 |
'Saldo per' => 'Saldo per', |
3155 | 3162 |
'Sales' => 'Verkauf', |
... | ... | |
3461 | 3468 |
'Show requirement spec template' => 'Pflichtenheftvorlage anzeigen', |
3462 | 3469 |
'Show sales letters report' => 'Verkaufsbrief anzeigen', |
3463 | 3470 |
'Show settings' => 'Einstellungen anzeigen', |
3471 |
'Show subtotals' => 'Zwischensummen anzeigen', |
|
3464 | 3472 |
'Show the picture in the part form' => 'Bild in Warenmaske anzeigen', |
3465 | 3473 |
'Show the pictures in the result for search parts' => 'Bilder in Suchergebnis für Stammdaten -> Berichte -> Waren anzeigen', |
3466 | 3474 |
'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => 'Sollen Warengewichte und Gesamtgewicht in Aufträgen, Rechnungen und Lieferscheinen angezeigt werden?', |
... | ... | |
3496 | 3504 |
'Sorry, I am too stupid to figure out the default warehouse/bin and the sold qty. I drop the default warehouse/bin option.' => 'Entschuldigung, ich bin nicht in der Lage Standard-Lager und die Menge in gewählten Belegen gleichzeitig anzuzeigen. Ich lass die Standard-Lager weg.', |
3497 | 3505 |
'Sort' => 'Sortieren', |
3498 | 3506 |
'Sort By' => 'Sortiert nach', |
3507 |
'Sort by' => 'Sortieren nach', |
|
3499 | 3508 |
'Sort order' => 'Sortierfolge', |
3500 | 3509 |
'Sorting' => 'Sortierung', |
3501 | 3510 |
'Source' => 'Beleg', |
... | ... | |
4637 | 4646 |
'Zipcode and city' => 'PLZ und Stadt', |
4638 | 4647 |
'[email]' => '[email]', |
4639 | 4648 |
'absolute' => 'absolut', |
4649 |
'account' => 'konto', |
|
4640 | 4650 |
'account_description' => 'Beschreibung', |
4641 | 4651 |
'accrual' => 'Soll-Versteuerung', |
4642 | 4652 |
'action= not defined!' => 'action= nicht definiert!', |
locale/en/all | ||
---|---|---|
750 | 750 |
'Company name and address' => '', |
751 | 751 |
'Company settings' => '', |
752 | 752 |
'Company\'s email signature' => '', |
753 |
'Company:' => '', |
|
753 | 754 |
'Compare to' => '', |
754 | 755 |
'Complexities' => '', |
755 | 756 |
'Complexity' => '', |
... | ... | |
1612 | 1613 |
'Experimental Features' => '', |
1613 | 1614 |
'Export' => '', |
1614 | 1615 |
'Export Number' => '', |
1616 |
'Export all accounts to CSV (ZIP file)' => '', |
|
1615 | 1617 |
'Export as CSV' => '', |
1616 | 1618 |
'Export as PDF' => '', |
1617 | 1619 |
'Export date' => '', |
... | ... | |
2045 | 2047 |
'Item values' => '', |
2046 | 2048 |
'Item variables' => '', |
2047 | 2049 |
'JS Tests' => '', |
2050 |
'Jahresverkehrszahlen alt' => '', |
|
2048 | 2051 |
'Jahresverkehrszahlen neu' => '', |
2049 | 2052 |
'Jan' => '', |
2050 | 2053 |
'January' => '', |
... | ... | |
2115 | 2118 |
'Letter saved!' => '', |
2116 | 2119 |
'Letternumber' => '', |
2117 | 2120 |
'Letters' => '', |
2121 |
'Letzte Buchung' => '', |
|
2118 | 2122 |
'Liability' => '', |
2119 | 2123 |
'Limit part selection' => '', |
2120 | 2124 |
'Line Total' => '', |
... | ... | |
2342 | 2346 |
'No Shopimages' => '', |
2343 | 2347 |
'No VAT Info for this Factur-X/ZUGFeRD invoice, please ask your vendor to add this for his Factur-X/ZUGFeRD data.' => '', |
2344 | 2348 |
'No Vendor was found matching the search parameters.' => '', |
2349 |
'No account selected. Please select an account.' => '', |
|
2345 | 2350 |
'No action defined.' => '', |
2346 | 2351 |
'No address selected to delete' => '', |
2347 | 2352 |
'No article has been selected yet.' => '', |
... | ... | |
3061 | 3066 |
'Report and misc. Preferences' => '', |
3062 | 3067 |
'Report configuration overview' => '', |
3063 | 3068 |
'Report date' => '', |
3069 |
'Report date:' => '', |
|
3064 | 3070 |
'Report for' => '', |
3065 | 3071 |
'Report separately' => '', |
3066 | 3072 |
'Reports' => '', |
... | ... | |
3149 | 3155 |
'SWIFT MT940 format' => '', |
3150 | 3156 |
'Saldo Credit' => '', |
3151 | 3157 |
'Saldo Debit' => '', |
3158 |
'Saldo alt' => '', |
|
3152 | 3159 |
'Saldo neu' => '', |
3153 | 3160 |
'Saldo per' => '', |
3154 | 3161 |
'Sales' => 'Sales', |
... | ... | |
3460 | 3467 |
'Show requirement spec template' => '', |
3461 | 3468 |
'Show sales letters report' => '', |
3462 | 3469 |
'Show settings' => '', |
3470 |
'Show subtotals' => '', |
|
3463 | 3471 |
'Show the picture in the part form' => '', |
3464 | 3472 |
'Show the pictures in the result for search parts' => '', |
3465 | 3473 |
'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => '', |
... | ... | |
3495 | 3503 |
'Sorry, I am too stupid to figure out the default warehouse/bin and the sold qty. I drop the default warehouse/bin option.' => '', |
3496 | 3504 |
'Sort' => '', |
3497 | 3505 |
'Sort By' => '', |
3506 |
'Sort by' => '', |
|
3498 | 3507 |
'Sort order' => '', |
3499 | 3508 |
'Sorting' => '', |
3500 | 3509 |
'Source' => '', |
... | ... | |
4635 | 4644 |
'Zipcode and city' => '', |
4636 | 4645 |
'[email]' => '', |
4637 | 4646 |
'absolute' => '', |
4647 |
'account' => '', |
|
4638 | 4648 |
'account_description' => '', |
4639 | 4649 |
'accrual' => '', |
4640 | 4650 |
'action= not defined!' => '', |
menus/user/00-erp.yaml | ||
---|---|---|
878 | 878 |
icon: chart_of_accounts |
879 | 879 |
order: 100 |
880 | 880 |
access: report |
881 |
module: ca.pl |
|
882 | 881 |
params: |
883 |
action: chart_of_accounts |
|
882 |
action: ChartOfAccounts/list |
|
883 |
- parent: reports |
|
884 |
id: reports_list_transactions |
|
885 |
name: List Transactions |
|
886 |
order: 150 |
|
887 |
access: report |
|
888 |
params: |
|
889 |
action: ListTransactions/report_settings |
|
884 | 890 |
- parent: reports |
885 | 891 |
id: reports_trial_balance |
886 | 892 |
name: Trial Balance |
templates/design40_webpages/list_transactions/report_settings.html | ||
---|---|---|
1 |
[% USE HTML %] |
|
2 |
[% USE LxERP %] |
|
3 |
[% USE L %] |
|
4 |
[% USE P %] |
|
5 |
[% USE T8 %] |
|
6 |
|
|
7 |
[% INCLUDE 'common/flash.html' %] |
|
8 |
|
|
9 |
<h1>[% title | html %]</h1> |
|
10 |
|
|
11 |
<form name="Form" method="post" action="controller.pl" id="report_settings"> |
|
12 |
|
|
13 |
[% L.hidden_tag("action", "ListTransactions/report_settings") %] |
|
14 |
|
|
15 |
<div class="wrapper"> |
|
16 |
<h3>[% "Account" | $T8 %]</h3> |
|
17 |
[% P.chart.picker('chart_id', defaults.chart_id) %] |
|
18 |
|
|
19 |
<h3>[% "Period" | $T8 %]</h3> |
|
20 |
[% P.date_period.picker('dateperiod', defaults.dateperiod_from_date, |
|
21 |
defaults.dateperiod_to_date, |
|
22 |
dialog_defaults => defaults.dialog) %] |
|
23 |
|
|
24 |
<h3>[% "Options" | $T8 %]</h3> |
|
25 |
<div class="wi-lightwide">[% L.checkbox_tag('show_subtotals', checked => defaults.show_subtotals, |
|
26 |
label => LxERP.t8('Show subtotals')) %]</div> |
|
27 |
|
|
28 |
<h3>[% "Sort by" | $T8 %]</h3> |
|
29 |
<div class="wi-normal">[% P.radio_button_tag('sort', value => 'transdate', |
|
30 |
checked => defaults.sort == 'transdate', |
|
31 |
label => LxERP.t8('Date')) %]</div> |
|
32 |
<div class="wi-normal">[% P.radio_button_tag('sort', value => 'reference', |
|
33 |
checked => defaults.sort == 'reference', |
|
34 |
label => LxERP.t8('Reference')) %]</div> |
|
35 |
<div class="wi-normal">[% P.radio_button_tag('sort', value => 'description', |
|
36 |
checked => defaults.sort == 'description', |
|
37 |
label => LxERP.t8('Description')) %]</div> |
|
38 |
</div> |
|
39 |
|
|
40 |
</form> |
templates/webpages/list_transactions/report_settings.html | ||
---|---|---|
1 |
[%- USE HTML %] |
|
2 |
[%- USE LxERP %] |
|
3 |
[%- USE L %] |
|
4 |
[%- USE P %] |
|
5 |
[%- USE T8 %] |
|
6 |
|
|
7 |
[%- INCLUDE 'common/flash.html' %] |
|
8 |
|
|
9 |
<form name="Form" method="post" action="controller.pl" id="report_settings"> |
|
10 |
[% L.hidden_tag("action", "ListTransactions/report_settings") %] |
|
11 |
|
|
12 |
<h2>[% "Account" | $T8 %]</h2> |
|
13 |
|
|
14 |
[% P.chart.picker('chart_id', defaults.chart_id) %] |
|
15 |
|
|
16 |
<h2>[% "Period" | $T8 %]</h2> |
|
17 |
[% P.date_period.picker('dateperiod', defaults.dateperiod_from_date, |
|
18 |
defaults.dateperiod_to_date, |
|
19 |
dialog_defaults => defaults.dialog) %] |
|
20 |
|
|
21 |
<h2>[% "Options" | $T8 %]</h2> |
|
22 |
|
|
23 |
[% L.checkbox_tag('show_subtotals', checked => defaults.show_subtotals, |
|
24 |
label => LxERP.t8('Show subtotals')) %] |
|
25 |
|
|
26 |
<h2>[% "Sort by" | $T8 %]</h2> |
|
27 |
|
|
28 |
[% P.radio_button_tag('sort', value => 'transdate', |
|
29 |
checked => defaults.sort == 'transdate', |
|
30 |
label => LxERP.t8('Date')) %] |
|
31 |
[% P.radio_button_tag('sort', value => 'reference', |
|
32 |
checked => defaults.sort == 'reference', |
|
33 |
label => LxERP.t8('Reference')) %] |
|
34 |
[% P.radio_button_tag('sort', value => 'description', |
|
35 |
checked => defaults.sort == 'description', |
|
36 |
label => LxERP.t8('Description')) %] |
|
37 |
|
|
38 |
</form> |
|
39 |
|
|
40 |
<hr> |
Auch abrufbar als: Unified diff
Neuer Controller für Berichte->Kontenübersicht / Buchungsliste
Ersetzt bin/mozilla/ca.pl.
Es werden weiterhin die Datenbankfunktionen aus SL::CA verwendet.
Zusätzlicher Menüpunkt für Buchungsliste eingefügt. Das Konto kann dort
zusammen mit der Periode und Einstellungen ausgewählt werden. Dann via
"Zeigen" angezeigt.
Zusätzlich gibt es neu dort die Funktion:
Export -> Alle Konten als CSV exportieren (ZIP-Datei)
Diese exportiert alle Buchungslisten als CSV und bietet diese in einem
ZIP file zum Download an.
Wenn die Buchungsliste über den Link aus der Kontenübersicht
ausgewählt wird, wird das Konto vorausgewählt.