Export aller Kontenblätter » Historie » Version 1
Andreas Rudin, 29.05.2019 21:46
1 | 1 | Andreas Rudin | h1. Export aller Kontenblätter |
---|---|---|---|
2 | |||
3 | Vor allem für einen Jahresabschluss ist es normalerweise nötig, unter "Berichte → Konten" die Auszüge von allen bebuchten Konten zu exportieren. |
||
4 | |||
5 | Da es diese Funktion bisher in kivitendo nicht gibt, haben wir einen provisorischen "Hack" erstellt, mit dem alle Kontenblätter für ein bestimmtes Jahr als csv-Dateien exportiert werden können. |
||
6 | |||
7 | Die Änderungen betreffen ausschliesslich die Datei bin/mozilla/ca.pl. |
||
8 | |||
9 | Wir haben dazu die zwei neuen Subroutinen 'csvkonten' und 'csv_transactions' erstellt, wobei letzte vorläufig mal einfach eine Kopie der sub list_transactions mit kleineren Anpassungen darstellt. |
||
10 | |||
11 | Die Angaben zur URL der kivitendo-Instanz, zum Zeitraum und zum Speicherort der erstellen Dateien müssen momentan noch manuell in die Datei ca.pl eingetragen werden. |
||
12 | Dazu folgende 3 Kommentarzeilen in der abgeänderten ca.pl suchen: |
||
13 | '# Im Link muss 'URL_zur_aktiven_kivitendo_Instanz' durch die entsprechende richtige URL ersetzt werden!' |
||
14 | '# Hier manuell das Jahr eingeben' |
||
15 | '# Der folgende Pfad muss je nach Installationspfad der aktiven kivitendo-Instanz individuell angepasst werden!' |
||
16 | |||
17 | Sind die Änderungen gemacht, so erscheint im Titelbalken ein Link 'CSV-Export alle Konten'. Wenn dieser angeklickt wird, so wird für jedes Konto eine csv-Datei in den eingetragenen Pfad geschrieben. |
||
18 | |||
19 | Wer sich die Änderungen nicht selbst zutraut, kann sich an empfang@revamp-it.ch wenden und uns den Auftrag für eine entsprechende Anpassung erteilen (ca. 2 Stunden Arbeit à 100 Franken). |
||
20 | |||
21 | *Wir planen dazu eine Erweiterung für kivitendo mit eigenem Untermenüpunkt zu erstellen, in der der Zeitraum, sowie weitere Einstellungen über das Webinterface von kivitendo konfigurierbar sind. Wer Interesse daran hat und bereit ist, sich an den Kosten zu beteiligen, bitte ein Mail an empfang@revamp-it.ch senden!* |
||
22 | |||
23 | Hier der diff zur kivitendo Version 3.5.2 (wer eine andere Version hat, muss unter Umständen entsprechende Anpassungen machen): |
||
24 | |||
25 | <pre> |
||
26 | diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl |
||
27 | index 774da85..99e8e53 100644 |
||
28 | --- a/bin/mozilla/ca.pl |
||
29 | +++ b/bin/mozilla/ca.pl |
||
30 | @@ -43,6 +43,8 @@ require "bin/mozilla/reportgenerator.pl"; |
||
31 | |||
32 | use strict; |
||
33 | |||
34 | +sub csv_transactions(); |
||
35 | + |
||
36 | 1; |
||
37 | |||
38 | # end of main |
||
39 | @@ -103,6 +105,88 @@ sub chart_of_accounts { |
||
40 | |||
41 | my $report = SL::ReportGenerator->new(\%myconfig, $form); |
||
42 | |||
43 | +# Provisorischen Link zum Erzeugen des csv-Exports für alle Konten gleichzeitig in den Titel eingefügt |
||
44 | +# Im Link muss 'URL_zur_aktiven_kivitendo_Instanz' durch die entsprechende richtige URL ersetzt werden! |
||
45 | + $report->set_options('output_format' => 'HTML', |
||
46 | + 'title' => $form->{title}." <a href='URL_zur_aktiven_kivitendo_Instanz'/ca.pl?action=csvkonten'>CSV-Export alle Konten</a>", |
||
47 | + 'attachment_basename' => $locale->text('chart_of_accounts') . strftime('_%Y%m%d', localtime time), |
||
48 | + 'std_column_visibility' => 1, |
||
49 | + ); |
||
50 | + $report->set_options_from_form(); |
||
51 | + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; |
||
52 | + |
||
53 | + $report->set_columns(%column_defs); |
||
54 | + $report->set_column_order(@columns); |
||
55 | + |
||
56 | + $report->set_export_options('chart_of_accounts'); |
||
57 | + |
||
58 | + $report->set_sort_indicator($form->{sort}, 1); |
||
59 | + |
||
60 | + my %totals = ('debit' => 0, 'credit' => 0); |
||
61 | + |
||
62 | + foreach my $ca (@{ $form->{CA} }) { |
||
63 | + next unless defined $ca->{amount}; |
||
64 | + my $row = { }; |
||
65 | + |
||
66 | + foreach (qw(debit credit)) { |
||
67 | + $totals{$_} += $ca->{$_} * 1; |
||
68 | + $ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_}); |
||
69 | + } |
||
70 | + |
||
71 | + map { $row->{$_} = { 'data' => $ca->{$_} } } @columns; |
||
72 | + |
||
73 | + map { $row->{$_}->{align} = 'right' } qw(debit credit); |
||
74 | + map { $row->{$_}->{class} = 'listheading' } @columns if ($ca->{charttype} eq "H"); |
||
75 | + |
||
76 | + $row->{accno}->{link} = build_std_url('action=list', 'accno=' . E($ca->{accno}), 'description=' . E($ca->{description})); |
||
77 | + |
||
78 | + $report->add_data($row); |
||
79 | + } |
||
80 | + |
||
81 | + my $row = { map { $_ => { 'class' => 'listtotal', 'align' => 'right' } } @columns }; |
||
82 | + map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals{$_}, 2) } qw(debit credit); |
||
83 | + |
||
84 | + $report->add_separator(); |
||
85 | + $report->add_data($row); |
||
86 | + |
||
87 | + $report->generate_with_headers(); |
||
88 | + |
||
89 | + $main::lxdebug->leave_sub(); |
||
90 | +} |
||
91 | + |
||
92 | +# Neue Subroutine zum Durchlaufen aller Konten, damit von jedem Konto automatisch |
||
93 | +# eine csv-Datei erzeugt werden kann. |
||
94 | +# Diese Subroutine soll in Zukunft von einem neuen Untermenue-Punkt aufgerufen werden, |
||
95 | +# -> muss noch im Menü eingerichtet werden link > ca.pl?action=csvkonten |
||
96 | + |
||
97 | +sub csvkonten { |
||
98 | + $main::lxdebug->enter_sub(); |
||
99 | + |
||
100 | + my $form = $main::form; |
||
101 | + my %myconfig = %main::myconfig; |
||
102 | + my $locale = $main::locale; |
||
103 | + |
||
104 | + $main::auth->assert('report'); |
||
105 | + |
||
106 | + $form->{title} = $locale->text('Chart of Accounts'); |
||
107 | + |
||
108 | + if ( $::instance_conf->get_accounting_method eq 'cash' ) { |
||
109 | + # $form->{method} can probably be made redundant now that we have get_accounting_method |
||
110 | + $form->{method} = "cash"; |
||
111 | + } |
||
112 | + |
||
113 | + CA->all_accounts(\%myconfig, \%$form); |
||
114 | + |
||
115 | + my @columns = qw(accno description debit credit); |
||
116 | + my %column_defs = ( |
||
117 | + 'accno' => { 'text' => $locale->text('Account'), }, |
||
118 | + 'description' => { 'text' => $locale->text('Description'), }, |
||
119 | + 'debit' => { 'text' => $locale->text('Debit'), }, |
||
120 | + 'credit' => { 'text' => $locale->text('Credit'), }, |
||
121 | + ); |
||
122 | + |
||
123 | + my $report = SL::ReportGenerator->new(\%myconfig, $form); |
||
124 | + |
||
125 | $report->set_options('output_format' => 'HTML', |
||
126 | 'title' => $form->{title}, |
||
127 | 'attachment_basename' => $locale->text('chart_of_accounts') . strftime('_%Y%m%d', localtime time), |
||
128 | @@ -137,6 +221,10 @@ sub chart_of_accounts { |
||
129 | $row->{accno}->{link} = build_std_url('action=list', 'accno=' . E($ca->{accno}), 'description=' . E($ca->{description})); |
||
130 | |||
131 | $report->add_data($row); |
||
132 | + |
||
133 | + $form->{accno} = $ca->{accno}; |
||
134 | + $form->{description} = $ca->{description}; |
||
135 | + csv_transactions(); |
||
136 | } |
||
137 | |||
138 | my $row = { map { $_ => { 'class' => 'listtotal', 'align' => 'right' } } @columns }; |
||
139 | @@ -573,6 +661,359 @@ sub list_transactions { |
||
140 | $main::lxdebug->leave_sub(); |
||
141 | } |
||
142 | |||
143 | +# Neue Subroutine fuer den automatischen csv-Export aller Konten |
||
144 | +# Sollte noch von allem Unnoetigen, das aus 'list_transactions' stammt |
||
145 | +# befreit werden. |
||
146 | + |
||
147 | +sub csv_transactions { |
||
148 | + $main::lxdebug->enter_sub(); |
||
149 | + |
||
150 | + my $form = $main::form; |
||
151 | + my %myconfig = %main::myconfig; |
||
152 | + my $locale = $main::locale; |
||
153 | + my $defaults = SL::DB::Default->get; |
||
154 | + |
||
155 | + $main::auth->assert('report'); |
||
156 | + |
||
157 | +# Erstellen der Text-Variable $stringAccount zum schrittweisen |
||
158 | +# Aufbau der csv-Datei. Erst am Ende der Subroutine wird der |
||
159 | +# Inhalt der Variable in eine csv-Datei geschrieben. |
||
160 | +# Wichtig: alle Zeilenumbrueche sind noetig und gewollt! |
||
161 | +# Todo: Das Jahr ist momentan fix auf 2018 gesetzt, |
||
162 | +# muss noch via Eingabe dynamisch gesetzt werden koennen! |
||
163 | + |
||
164 | + my $stringAccount = $locale->text('Account') . " " . $form->{accno} . " - " . $form->{description} . " |
||
165 | +;; |
||
166 | +"; |
||
167 | + |
||
168 | + $form->{title} = $locale->text('Account') . " " . $form->{accno} . " - " . $form->{description} . " - csv exportiert"; |
||
169 | + |
||
170 | + # if ($form->{reporttype} eq "custom") { |
||
171 | + |
||
172 | + #forgotten the year --> thisyear |
||
173 | + if ($form->{year} !~ m/^\d\d\d\d$/) { |
||
174 | + $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~ |
||
175 | + /(\d\d\d\d)/; |
||
176 | + # $form->{year} = $1; |
||
177 | + |
||
178 | + |
||
179 | + # Hier manuell das Jahr eingeben |
||
180 | + |
||
181 | + $form->{year} = 2018; |
||
182 | + |
||
183 | + } |
||
184 | + |
||
185 | + #yearly report |
||
186 | + |
||
187 | + $form->{fromdate} = "1.1.$form->{year}"; |
||
188 | + $form->{todate} = "31.12.$form->{year}"; |
||
189 | + $stringAccount = $stringAccount . "1.1." . $form->{year} ." - 31.12." . $form->{year} . " |
||
190 | +"; |
||
191 | + |
||
192 | + CA->all_transactions(\%myconfig, \%$form); |
||
193 | + |
||
194 | + $form->{saldo_old} += $form->{beginning_balance}; |
||
195 | + $form->{saldo_new} += $form->{beginning_balance}; |
||
196 | + my $saldo_old = format_debit_credit($form->{saldo_old}); |
||
197 | + my $eb_string = format_debit_credit($form->{beginning_balance}); |
||
198 | + $form->{balance} = $form->{saldo_old}; |
||
199 | + |
||
200 | + my @options; |
||
201 | + if ($form->{department}) { |
||
202 | + my ($department) = split /--/, $form->{department}; |
||
203 | + push @options, $locale->text('Department') . " : $department"; |
||
204 | + } |
||
205 | + if ($form->{projectnumber}) { |
||
206 | + push @options, $locale->text('Project Number') . " : $form->{projectnumber}<br>"; |
||
207 | + } |
||
208 | + |
||
209 | + my $period; |
||
210 | + if ($form->{fromdate} || $form->{todate}) { |
||
211 | + my ($fromdate, $todate); |
||
212 | + |
||
213 | + if ($form->{fromdate}) { |
||
214 | + $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1); |
||
215 | + } |
||
216 | + if ($form->{todate}) { |
||
217 | + $todate = $locale->date(\%myconfig, $form->{todate}, 1); |
||
218 | + } |
||
219 | + |
||
220 | + $period = "$fromdate - $todate"; |
||
221 | + |
||
222 | + } else { |
||
223 | + $period = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1); |
||
224 | + } |
||
225 | + |
||
226 | + push @options, $period; |
||
227 | + |
||
228 | + # $form->{print_date} = $locale->text('Create Date') . " " . $locale->date(\%myconfig, $form->current_date(\%myconfig), 0); |
||
229 | + push (@options, $form->{print_date}); |
||
230 | + |
||
231 | + $stringAccount = $stringAccount . $locale->text('Create Date') . " " . $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) . " |
||
232 | +"; |
||
233 | + |
||
234 | + # $form->{company} = $locale->text('Company') . " " . $defaults->company; |
||
235 | + push (@options, $form->{company}); |
||
236 | + |
||
237 | + $stringAccount = $stringAccount . $locale->text('Company') . " " . $defaults->company . " |
||
238 | +;; |
||
239 | +"; |
||
240 | + |
||
241 | + my @columns = qw(transdate reference description gegenkonto debit credit ustkonto ustrate balance); |
||
242 | + my %column_defs = ( |
||
243 | + 'transdate' => { 'text' => $locale->text('Date'), }, |
||
244 | + 'reference' => { 'text' => $locale->text('Reference'), }, |
||
245 | + 'description' => { 'text' => $locale->text('Description'), }, |
||
246 | + 'debit' => { 'text' => $locale->text('Debit'), }, |
||
247 | + 'credit' => { 'text' => $locale->text('Credit'), }, |
||
248 | + 'gegenkonto' => { 'text' => $locale->text('Gegenkonto'), }, |
||
249 | + 'ustkonto' => { 'text' => $locale->text('USt-Konto'), }, |
||
250 | + 'balance' => { 'text' => $locale->text('Balance'), }, |
||
251 | + 'ustrate' => { 'text' => $locale->text('Satz %'), }, |
||
252 | + ); |
||
253 | + |
||
254 | + my @hidden_variables = qw(accno fromdate todate description accounttype l_heading subtotal department projectnumber project_id sort method); |
||
255 | + |
||
256 | + #~ my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables); |
||
257 | + |
||
258 | + #~ $form->{callback} = $link . '&sort=' . E($form->{sort}); |
||
259 | + |
||
260 | + my %column_alignment = map { $_ => 'right' } qw(debit credit balance); |
||
261 | + |
||
262 | + my @custom_headers = (); |
||
263 | + # Zeile 1: |
||
264 | + # push @custom_headers, [ |
||
265 | + # { 'text' => 'Letzte Buchung', }, |
||
266 | + # { 'text' => 'EB-Wert', }, |
||
267 | + # { 'text' => 'Saldo alt', 'colspan' => 2, }, |
||
268 | + # { 'text' => 'Jahresverkehrszahlen alt', 'colspan' => 2, }, |
||
269 | + # { 'text' => '', 'colspan' => 2, }, |
||
270 | + # ]; |
||
271 | + $stringAccount = $stringAccount . "Letzte Buchung;EB-Wert;Saldo alt;;Jahresverkehrszahlen alt |
||
272 | +"; |
||
273 | + |
||
274 | + push @custom_headers, [ |
||
275 | + { 'text' => $form->{last_transaction}, }, |
||
276 | + { 'text' => $eb_string, }, |
||
277 | + { 'text' => $saldo_old, 'colspan' => 2, }, |
||
278 | + { 'text' => $form->format_amount(\%myconfig, abs($form->{old_balance_debit}), 2) . " S", }, |
||
279 | + { 'text' => $form->format_amount(\%myconfig, $form->{old_balance_credit}, 2) . " H", }, |
||
280 | + { 'text' => '', 'colspan' => 2, }, |
||
281 | + ]; |
||
282 | + $stringAccount = $stringAccount . $form->{last_transaction} . ";" . $eb_string . ";" . $saldo_old . ";;" . $form->format_amount(\%myconfig, abs($form->{old_balance_debit}), 2) . " S;" . $form->format_amount(\%myconfig, $form->{old_balance_credit}, 2) . " H |
||
283 | +;; |
||
284 | +"; |
||
285 | + |
||
286 | + # Zeile 2: |
||
287 | + # push @custom_headers, [ |
||
288 | + # { 'text' => $locale->text('Date'), 'link' => $link . "&sort=transdate", }, |
||
289 | + # { 'text' => $locale->text('Reference'), 'link' => $link . "&sort=reference", }, |
||
290 | + # { 'text' => $locale->text('Description'), 'link' => $link . "&sort=description", }, |
||
291 | + # { 'text' => $locale->text('Gegenkonto'), }, |
||
292 | + # { 'text' => $locale->text('Debit'), }, |
||
293 | + # { 'text' => $locale->text('Credit'), }, |
||
294 | + # { 'text' => $locale->text('USt-Konto'), }, |
||
295 | + # { 'text' => $locale->text('Satz %'), }, |
||
296 | + # { 'text' => $locale->text('Balance'), }, |
||
297 | + # ]; |
||
298 | + $stringAccount = $stringAccount . $locale->text('Date') . ";" . $locale->text('Reference') . ";" . $locale->text('Description') . ";" . $locale->text('Gegenkonto') . ";" . $locale->text('Debit') . ";" . $locale->text('Credit') . ";" . $locale->text('USt-Konto') . ";" . $locale->text('Satz %') . ";" . $locale->text('Balance') . " |
||
299 | +"; |
||
300 | + |
||
301 | + my $report = SL::ReportGenerator->new(\%myconfig, $form); |
||
302 | + # $report->set_custom_headers(@custom_headers); |
||
303 | + |
||
304 | + $report->set_options('top_info_text' => join("\n", @options), |
||
305 | + 'output_format' => 'HTML', |
||
306 | + 'title' => $form->{title}, |
||
307 | + # 'attachment_basename' => $locale->text('list_of_transactions') . strftime('_%Y%m%d', localtime time), |
||
308 | + 'std_column_visibility' => 0, |
||
309 | + ); |
||
310 | + # $report->set_options_from_form(); |
||
311 | + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; |
||
312 | + |
||
313 | + # $report->set_columns(%column_defs); |
||
314 | + # $report->set_column_order(@columns); |
||
315 | + |
||
316 | + # $report->set_export_options('list_transactions', @hidden_variables); |
||
317 | + |
||
318 | + # $report->set_sort_indicator($form->{sort}, 1); |
||
319 | + |
||
320 | + $column_defs{balance}->{visible} = 1; |
||
321 | + |
||
322 | + my $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1; |
||
323 | + |
||
324 | + my $idx = 0; |
||
325 | + my %totals = ( 'debit' => 0, 'credit' => 0 ); |
||
326 | + my %subtotals = ( 'debit' => 0, 'credit' => 0 ); |
||
327 | + my ($previous_index, $row_set); |
||
328 | + |
||
329 | + foreach my $ca (@{ $form->{CA} }) { |
||
330 | + |
||
331 | + foreach (qw(debit credit)) { |
||
332 | + $subtotals{$_} += $ca->{$_}; |
||
333 | + $totals{$_} += $ca->{$_}; |
||
334 | + if ($_ =~ /debit.*/) { |
||
335 | + $ml = -1; |
||
336 | + } else { |
||
337 | + $ml = 1; |
||
338 | + } |
||
339 | + $form->{balance}= $form->{balance} + $ca->{$_} * $ml; |
||
340 | + $ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0); |
||
341 | + } |
||
342 | + |
||
343 | + my $do_subtotal = 0; |
||
344 | + if (($form->{subtotal}) |
||
345 | + && (($idx == scalar @{ $form->{CA} } - 1) |
||
346 | + || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) { |
||
347 | + $do_subtotal = 1; |
||
348 | + } |
||
349 | + |
||
350 | + my $row = { }; |
||
351 | + |
||
352 | + $ca->{ustrate} = $form->format_amount(\%myconfig, $ca->{ustrate} * 100, 2) if ($ca->{ustrate} != 0); |
||
353 | + |
||
354 | +# Beschreibung immer auf einer Zeile ausgeben: |
||
355 | + my $description = $ca->{description} . " " . $ca->{memo}; |
||
356 | + |
||
357 | +# if ($ca->{memo} ne "") { |
||
358 | +# $ca->{description} .= " \n " . $ca->{memo}; |
||
359 | +# } |
||
360 | + |
||
361 | + foreach my $gegenkonto (@{ $ca->{GEGENKONTO} }) { |
||
362 | + if ($ca->{gegenkonto} eq "") { |
||
363 | + $ca->{gegenkonto} = $gegenkonto->{accno}; |
||
364 | + } else { |
||
365 | + $ca->{gegenkonto} .= ", " . $gegenkonto->{accno}; |
||
366 | + } |
||
367 | + } |
||
368 | + |
||
369 | + foreach (@columns) { |
||
370 | + $row->{$_} = { |
||
371 | + 'data' => $ca->{$_}, |
||
372 | + 'align' => $column_alignment{$_}, |
||
373 | + }; |
||
374 | + } |
||
375 | + |
||
376 | + $row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance}, 2, 'DRCR'); |
||
377 | + |
||
378 | + if ($ca->{index} ne $previous_index) { |
||
379 | +# $report->add_data($row_set) if ($row_set); |
||
380 | + |
||
381 | +# $row_set = [ ]; |
||
382 | + $previous_index = $ca->{index}; |
||
383 | + |
||
384 | + $row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback'); |
||
385 | + |
||
386 | + } elsif ($ca->{index} eq $previous_index) { |
||
387 | + map { $row->{$_}->{data} = '' } qw(reference description); |
||
388 | + $row->{transdate}->{data} = '' if ($form->{sort} eq 'transdate'); |
||
389 | + } |
||
390 | + |
||
391 | + my $row_set = []; |
||
392 | + |
||
393 | + #~ push @{ $row_set }, $row; |
||
394 | + |
||
395 | + #~ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal') if ($do_subtotal); |
||
396 | + |
||
397 | + $stringAccount = $stringAccount . $ca->{transdate} . ";" . $ca->{reference} . ";" . $description . ";" . $ca->{gegenkonto} . ";" . $ca->{debit} . ";" . $ca->{credit} . ";" . $ca->{ustkonto} . ";" . $ca->{ustrate} . ";" . $row->{balance}->{data} ." |
||
398 | +"; |
||
399 | + |
||
400 | + $idx++; |
||
401 | + # $report->add_data($row_set); |
||
402 | + |
||
403 | + } |
||
404 | + |
||
405 | + # $report->add_data($row_set) if ($row_set); |
||
406 | + |
||
407 | + # $report->add_separator(); |
||
408 | + |
||
409 | + my $row = create_subtotal_row(\%totals, \@columns, \%column_alignment, 'listtotal'); |
||
410 | + |
||
411 | + $row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance}, 2, 'DRCR'); |
||
412 | + |
||
413 | + $report->add_data($row); |
||
414 | + |
||
415 | + $stringAccount = $stringAccount . "Total;;;;" . $form->format_amount(\%myconfig, abs($form->{current_balance_debit}) , 2) . ";" . $form->format_amount(\%myconfig, $form->{current_balance_credit}, 2) . ";;;" . format_debit_credit($form->{saldo_new}) . " |
||
416 | +"; |
||
417 | + |
||
418 | + # $report->add_separator(); |
||
419 | + #~ $row = { |
||
420 | + #~ 'transdate' => { |
||
421 | + #~ 'data' => "", |
||
422 | + #~ 'class' => 'listtotal', |
||
423 | + #~ }, |
||
424 | + #~ 'reference' => { |
||
425 | + #~ 'data' => $locale->text('EB-Wert'), |
||
426 | + #~ 'class' => 'listtotal', |
||
427 | + #~ }, |
||
428 | + #~ 'description' => { |
||
429 | + #~ 'data' => $locale->text('Saldo neu'), |
||
430 | + #~ 'colspan' => 2, |
||
431 | + #~ 'class' => 'listtotal', |
||
432 | + #~ }, |
||
433 | + #~ 'debit' => { |
||
434 | + #~ 'data' => $locale->text('Jahresverkehrszahlen neu'), |
||
435 | + #~ 'colspan' => 2, |
||
436 | + #~ 'align' => 'left', |
||
437 | + #~ 'class' => 'listtotal', |
||
438 | + #~ }, |
||
439 | + #~ 'ustkonto' => { |
||
440 | + #~ 'data' => '', |
||
441 | + #~ 'colspan' => 2, |
||
442 | + #~ 'align' => 'left', |
||
443 | + #~ 'class' => 'listtotal', |
||
444 | + #~ }, |
||
445 | + #~ }; |
||
446 | + |
||
447 | + $stringAccount = $stringAccount . ";" . $locale->text('EB-Wert') . ";" . $locale->text('Saldo neu') . ";;" . $locale->text('Jahresverkehrszahlen neu') . " |
||
448 | +"; |
||
449 | + # $report->add_data($row); |
||
450 | + my $saldo_new = format_debit_credit($form->{saldo_new}); |
||
451 | + #~ $row = { |
||
452 | + #~ 'transdate' => { |
||
453 | + #~ 'data' => "", |
||
454 | + #~ 'class' => 'listtotal', |
||
455 | + #~ }, |
||
456 | + #~ 'reference' => { |
||
457 | + #~ 'data' => $eb_string, |
||
458 | + #~ 'class' => 'listtotal', |
||
459 | + #~ }, |
||
460 | + #~ 'description' => { |
||
461 | + #~ 'data' => $saldo_new, |
||
462 | + #~ 'colspan' => 2, |
||
463 | + #~ 'class' => 'listtotal', |
||
464 | + #~ }, |
||
465 | + #~ 'debit' => { |
||
466 | + #~ 'data' => $form->format_amount(\%myconfig, abs($form->{current_balance_debit}) , 2) . " S", |
||
467 | + #~ 'class' => 'listtotal', |
||
468 | + #~ }, |
||
469 | + #~ 'credit' => { |
||
470 | + #~ 'data' => $form->format_amount(\%myconfig, $form->{current_balance_credit}, 2) . " H", |
||
471 | + #~ 'class' => 'listtotal', |
||
472 | + #~ }, |
||
473 | + #~ 'ustkonto' => { |
||
474 | + #~ 'data' => "", |
||
475 | + #~ 'colspan' => 2, |
||
476 | + #~ 'class' => 'listtotal', |
||
477 | + #~ }, |
||
478 | + #~ }; |
||
479 | + |
||
480 | + $stringAccount = $stringAccount . ";" . $eb_string . ";" . $saldo_new . ";;" . $form->format_amount(\%myconfig, abs($form->{current_balance_debit}) , 2) . " S;" . $form->format_amount(\%myconfig, $form->{current_balance_credit}, 2) . " H |
||
481 | +;;"; |
||
482 | + |
||
483 | + # $stringAccount in Datei schreiben |
||
484 | + # Der folgende Pfad muss je nach Installationspfad der aktiven kivitendo-Instanz individuell angepasst werden! |
||
485 | + open ACFILE, ">/var/www/kivitendo-erp/webdav/" . $locale->text('Account') . "_" . $form->{accno} .".csv"; |
||
486 | + print ACFILE $stringAccount; |
||
487 | + close ACFILE; |
||
488 | + |
||
489 | + $report->add_data($row); |
||
490 | + |
||
491 | + $report->generate_with_headers(); |
||
492 | + |
||
493 | + $main::lxdebug->leave_sub(); |
||
494 | +} |
||
495 | + |
||
496 | sub create_subtotal_row { |
||
497 | $main::lxdebug->enter_sub(); |
||
498 | </pre> |