1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
15 # Contributors: Antonio Gallardo <agssa@ibw.com.ni>
16 # Benjamin Lee <benjaminlee@consultant.com>
17 # Philip Reetz <p.reetz@linet-services.de>
20 # This program is free software; you can redistribute it and/or modify
21 # it under the terms of the GNU General Public License as published by
22 # the Free Software Foundation; either version 2 of the License, or
23 # (at your option) any later version.
25 # This program is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write to the Free Software
31 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 #======================================================================
34 # module for preparing Income Statement and Balance Sheet
36 #======================================================================
38 require "bin/mozilla/arap.pl";
39 require "bin/mozilla/common.pl";
50 # this is for our long dates
51 # $locale->text('January')
52 # $locale->text('February')
53 # $locale->text('March')
54 # $locale->text('April')
55 # $locale->text('May ')
56 # $locale->text('June')
57 # $locale->text('July')
58 # $locale->text('August')
59 # $locale->text('September')
60 # $locale->text('October')
61 # $locale->text('November')
62 # $locale->text('December')
64 # this is for our short month
65 # $locale->text('Jan')
66 # $locale->text('Feb')
67 # $locale->text('Mar')
68 # $locale->text('Apr')
69 # $locale->text('May')
70 # $locale->text('Jun')
71 # $locale->text('Jul')
72 # $locale->text('Aug')
73 # $locale->text('Sep')
74 # $locale->text('Oct')
75 # $locale->text('Nov')
76 # $locale->text('Dec')
78 # $locale->text('Balance Sheet')
79 # $locale->text('Income Statement')
80 # $locale->text('Trial Balance')
81 # $locale->text('AR Aging')
82 # $locale->text('AP Aging')
83 # $locale->text('Tax collected')
84 # $locale->text('Tax paid')
85 # $locale->text('Receipts')
86 # $locale->text('Payments')
87 # $locale->text('Project Transactions')
88 # $locale->text('Non-taxable Sales')
89 # $locale->text('Non-taxable Purchases')
92 $lxdebug->enter_sub();
94 %title = ('balance_sheet' => 'Balance Sheet',
95 'income_statement' => 'Income Statement',
96 'trial_balance' => 'Trial Balance',
97 'ar_aging' => 'AR Aging',
98 'ap_aging' => 'Offene Verbindlichkeiten',
99 'tax_collected' => 'Tax collected',
100 'tax_paid' => 'Tax paid',
101 'nontaxable_sales' => 'Non-taxable Sales',
102 'nontaxable_purchases' => 'Non-taxable Purchases',
103 'receipts' => 'Receipts',
104 'payments' => 'Payments',
105 'projects' => 'Project Transactions',
106 'bwa' => 'Betriebswirtschaftliche Auswertung',
107 'ustva' => 'Umsatzsteuervoranmeldung',);
109 $form->{title} = $locale->text($title{ $form->{report} });
111 $accrual = ($eur) ? "" : "checked";
112 $cash = ($eur) ? "checked" : "";
114 $year = (localtime)[5] + 1900;
117 $form->all_departments(\%myconfig);
118 if (@{ $form->{all_departments} }) {
119 $form->{selectdepartment} = "<option>\n";
122 $form->{selectdepartment} .=
123 "<option>$_->{description}--$_->{id}\n"
124 } (@{ $form->{all_departments} });
129 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
130 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
132 | if $form->{selectdepartment};
134 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
137 my %project_labels = ();
138 my @project_values = ("");
139 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
140 push(@project_values, $item->{"id"});
141 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
145 NTI($cgi->popup_menu('-name' => "project_id",
146 '-values' => \@project_values,
147 '-labels' => \%project_labels));
149 # use JavaScript Calendar or not
150 $form->{jsscript} = $jscalendar;
152 if ($form->{report} eq "ustva") {
155 if ($form->{report} eq "balance_sheet") {
156 $name_1 = "asofdate";
158 $value_1 = "$form->{asofdate}";
159 $trigger_1 = "trigger1";
160 $name_2 = "compareasofdate";
161 $id_2 = "compareasofdate";
162 $value_2 = "$form->{compareasofdate}";
163 $trigger_2 = "trigger2";
164 } elsif ($form->{report} =~ /(receipts|payments)$/) {
165 $name_1 = "fromdate";
167 $value_1 = "$form->{fromdate}";
168 $trigger_1 = "trigger1";
172 $trigger_2 = "trigger2";
174 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
182 $trigger_2 = "trigger2";
185 $name_1 = "fromdate";
187 $value_1 = "$form->{fromdate}";
188 $trigger_1 = "trigger1";
192 $trigger_2 = "trigger2";
197 # with JavaScript Calendar
198 if ($form->{jsscript}) {
202 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
204 <input type=button name=$name_2 id="$trigger_2" value=|
205 . $locale->text('button') . qq|>|;
209 Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
212 <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
214 <input type=button name=$name_1 id="$trigger_1" value=|
215 . $locale->text('button') . qq|>|;
217 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
219 <input type=button name=$name_2 id="$trigger_2" value=|
220 . $locale->text('button') . qq|>
225 Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
226 "$name_2", "BL", "$trigger_2");
230 # without JavaScript Calendar
233 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
236 qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1 onBlur=\"check_right_date_format(this)\">|;
238 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
241 $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
243 $onload = qq|focus()|;
244 $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
245 $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
247 <body onLoad="$onload">
249 <form method=post action=$form->{script}>
251 <input type=hidden name=title value="$form->{title}">
255 <th class=listtop>$form->{title}</th>
264 if ($form->{report} eq "projects") {
267 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
268 <td colspan=5><input name=projectnumber size=25</td>
270 <input type=hidden name=nextsub value=generate_projects>
272 <th align=right>| . $locale->text('From') . qq|</th>
275 <th align=right>| . $locale->text('Bis') . qq|</th>
286 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
287 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
288 . $locale->text('Heading') . qq|
289 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
290 . $locale->text('Subtotal') . qq|</td>
297 if ($form->{report} eq "income_statement") {
300 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
301 <td colspan=3>$projectnumber</td>
303 <input type=hidden name=nextsub value=generate_income_statement>
307 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
308 . $locale->text('Customized Report') . qq|</th>
311 <th colspan=1>| . $locale->text('Year') . qq|</th>
312 <td><input name=year size=11 title="|
313 . $locale->text('YYYY') . qq|" value="$year"></td>
320 <b> | . $locale->text('Yearly') . qq|</b> </td>
321 <th align=left>| . $locale->text('Quarterly') . qq|</th>
322 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
325 <td align=right> <input name=duetyp class=radio type=radio value="13"
327 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
328 . $locale->text('Quarter') . qq|</td>
332 <td><input name=duetyp class=radio type=radio value="1" $checked > |
333 . $locale->text('January') . qq|</td>
337 <td><input name=duetyp class=radio type=radio value="5" $checked > |
338 . $locale->text('May') . qq|</td>
339 <td><input name=duetyp class=radio type=radio value="9" $checked > |
340 . $locale->text('September') . qq|</td>
344 <td align= right> </td>
345 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
346 . $locale->text('Quarter') . qq|</td>
347 <td><input name=duetyp class=radio type=radio value="2" $checked > |
348 . $locale->text('February') . qq|</td>
349 <td><input name=duetyp class=radio type=radio value="6" $checked > |
350 . $locale->text('June') . qq|</td>
351 <td><input name=duetyp class=radio type=radio value="10" $checked > |
352 . $locale->text('October') . qq|</td>
356 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
357 . $locale->text('Quarter') . qq|</td>
358 <td><input name=duetyp class=radio type=radio value="3" $checked > |
359 . $locale->text('March') . qq|</td>
360 <td><input name=duetyp class=radio type=radio value="7" $checked > |
361 . $locale->text('July') . qq|</td>
362 <td><input name=duetyp class=radio type=radio value="11" $checked > |
363 . $locale->text('November') . qq|</td>
368 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
369 . $locale->text('Quarter') . qq| </td>
370 <td><input name=duetyp class=radio type=radio value="4" $checked > |
371 . $locale->text('April') . qq|</td>
372 <td><input name=duetyp class=radio type=radio value="8" $checked > |
373 . $locale->text('August') . qq|</td>
374 <td><input name=duetyp class=radio type=radio value="12" $checked > |
375 . $locale->text('December') . qq|</td>
379 <td colspan=5><hr size=3 noshade></td>
382 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
383 . $locale->text('Free report period') . qq|</th>
384 <td align=left colspan=4>| . $locale->text('From') . qq|
387 | . $locale->text('Bis') . qq|
393 <td colspan=5><hr size=3 noshade></td>
396 <th align=leftt>| . $locale->text('Method') . qq|</th>
397 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
398 . $locale->text('Accrual') . qq|
399 <input name=method class=radio type=radio value=cash $cash>|
400 . $locale->text('EUR') . qq|</td>
407 if ($form->{report} eq "bwa") {
410 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
411 <td colspan=3>$projectnumber</td>
413 <input type=hidden name=nextsub value=generate_bwa>
417 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
418 . $locale->text('Customized Report') . qq|</th>
421 <th colspan=1>| . $locale->text('Year') . qq|</th>
422 <td><input name=year size=11 title="|
423 . $locale->text('YYYY') . qq|" value="$year"></td>
430 <b> | . $locale->text('Yearly') . qq|</b> </td>
431 <th align=left>| . $locale->text('Quarterly') . qq|</th>
432 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
435 <td align=right> <input name=duetyp class=radio type=radio value="13"
437 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
438 . $locale->text('Quarter') . qq|</td>
440 $checked = "checked";
442 <td><input name=duetyp class=radio type=radio value="1" $checked > |
443 . $locale->text('January') . qq|</td>
447 <td><input name=duetyp class=radio type=radio value="5" $checked > |
448 . $locale->text('May') . qq|</td>
449 <td><input name=duetyp class=radio type=radio value="9" $checked > |
450 . $locale->text('September') . qq|</td>
454 <td align= right> </td>
455 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
456 . $locale->text('Quarter') . qq|</td>
457 <td><input name=duetyp class=radio type=radio value="2" $checked > |
458 . $locale->text('February') . qq|</td>
459 <td><input name=duetyp class=radio type=radio value="6" $checked > |
460 . $locale->text('June') . qq|</td>
461 <td><input name=duetyp class=radio type=radio value="10" $checked > |
462 . $locale->text('October') . qq|</td>
466 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
467 . $locale->text('Quarter') . qq|</td>
468 <td><input name=duetyp class=radio type=radio value="3" $checked > |
469 . $locale->text('March') . qq|</td>
470 <td><input name=duetyp class=radio type=radio value="7" $checked > |
471 . $locale->text('July') . qq|</td>
472 <td><input name=duetyp class=radio type=radio value="11" $checked > |
473 . $locale->text('November') . qq|</td>
478 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
479 . $locale->text('Quarter') . qq| </td>
480 <td><input name=duetyp class=radio type=radio value="4" $checked > |
481 . $locale->text('April') . qq|</td>
482 <td><input name=duetyp class=radio type=radio value="8" $checked > |
483 . $locale->text('August') . qq|</td>
484 <td><input name=duetyp class=radio type=radio value="12" $checked > |
485 . $locale->text('December') . qq|</td>
489 <td colspan=5><hr size=3 noshade></td>
492 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
493 . $locale->text('Free report period') . qq|</th>
494 <td align=left colspan=4>| . $locale->text('From') . qq|
497 | . $locale->text('Bis') . qq|
503 <td colspan=5><hr size=3 noshade></td>
506 <th align=leftt>| . $locale->text('Method') . qq|</th>
507 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
508 . $locale->text('Accrual') . qq|
509 <input name=method class=radio type=radio value=cash $cash>|
510 . $locale->text('EUR') . qq|</td>
513 <th align=right colspan=4>|
514 . $locale->text('Decimalplaces')
516 <td><input name=decimalplaces size=3 value="2"></td>
523 if ($form->{report} eq "ustva") {
528 <input type=hidden name=nextsub value=generate_ustva>
532 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
533 . $locale->text('Zeitraum') . qq|</th>
536 <th colspan=1>| . $locale->text('Year') . qq|</th>
537 <td><input name=year size=11 title="|
538 . $locale->text('YYYY') . qq|" value="$year"></td>
545 <b> | . $locale->text('Yearly') . qq|</b> </td>
546 <th align=left>| . $locale->text('Quarterly') . qq|</th>
547 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
550 <td align=right> <input name=duetyp class=radio type=radio value="13"
552 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
553 . $locale->text('Quarter') . qq|</td>
555 $checked = "checked";
557 <td><input name=duetyp class=radio type=radio value="1" $checked > |
558 . $locale->text('January') . qq|</td>
562 <td><input name=duetyp class=radio type=radio value="5" $checked > |
563 . $locale->text('May') . qq|</td>
564 <td><input name=duetyp class=radio type=radio value="9" $checked > |
565 . $locale->text('September') . qq|</td>
569 <td align= right> </td>
570 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
571 . $locale->text('Quarter') . qq|</td>
572 <td><input name=duetyp class=radio type=radio value="2" $checked > |
573 . $locale->text('February') . qq|</td>
574 <td><input name=duetyp class=radio type=radio value="6" $checked > |
575 . $locale->text('June') . qq|</td>
576 <td><input name=duetyp class=radio type=radio value="10" $checked > |
577 . $locale->text('October') . qq|</td>
581 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
582 . $locale->text('Quarter') . qq|</td>
583 <td><input name=duetyp class=radio type=radio value="3" $checked > |
584 . $locale->text('March') . qq|</td>
585 <td><input name=duetyp class=radio type=radio value="7" $checked > |
586 . $locale->text('July') . qq|</td>
587 <td><input name=duetyp class=radio type=radio value="11" $checked > |
588 . $locale->text('November') . qq|</td>
593 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
594 . $locale->text('Quarter') . qq| </td>
595 <td><input name=duetyp class=radio type=radio value="4" $checked > |
596 . $locale->text('April') . qq|</td>
597 <td><input name=duetyp class=radio type=radio value="8" $checked > |
598 . $locale->text('August') . qq|</td>
599 <td><input name=duetyp class=radio type=radio value="12" $checked > |
600 . $locale->text('December') . qq|</td>
604 <td colspan=5><hr size=3 noshade></td>
607 <th align=left>| . $locale->text('Method') . qq|</th>
608 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
609 . $locale->text('Accrual') . qq|
610 <input name=method class=radio type=radio value=cash $cash>|
611 . $locale->text('EUR') . qq|</td>
624 if ($form->{report} eq "balance_sheet") {
626 <input type=hidden name=nextsub value=generate_balance_sheet>
628 <th align=right>| . $locale->text('as at') . qq|</th>
633 <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
640 <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
641 <td><input name=decimalplaces size=3 value="2"></td>
650 <th align=right>| . $locale->text('Method') . qq|</th>
651 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
652 . $locale->text('Accrual') . qq|
653 <input name=method class=radio type=radio value=cash $cash>|
654 . $locale->text('EUR') . qq|</td>
658 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
659 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
660 . $locale->text('Heading') . qq|
661 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
662 . $locale->text('Subtotal') . qq|
663 <input name=l_accno class=checkbox type=checkbox value=Y> |
664 . $locale->text('Account Number') . qq|</td>
671 if ($form->{report} eq "trial_balance") {
673 <input type=hidden name=nextsub value=generate_trial_balance>
674 <input type=hidden name=eur value=$eur>
676 <th align=right>| . $locale->text('From') . qq|</th>
681 <th align=right>| . $locale->text('Bis') . qq|</th>
694 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
695 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
696 . $locale->text('Heading') . qq|
697 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
698 . $locale->text('Subtotal') . qq|
699 <input name=all_accounts class=checkbox type=checkbox value=Y> |
700 . $locale->text('All Accounts') . qq|</td>
707 if ($form->{report} =~ /^tax_/) {
708 $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
710 RP->get_taxaccounts(\%myconfig, \%$form);
713 <input type=hidden name=nextsub value=generate_tax_report>
715 <th align=right>| . $locale->text('From') . qq|</th>
716 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
717 <th align=right>| . $locale->text('Bis') . qq|</th>
718 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
721 <th align=right>| . $locale->text('Report for') . qq|</th>
725 $checked = "checked";
726 foreach $ref (@{ $form->{taxaccounts} }) {
729 qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
731 <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
732 <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
739 <input type=hidden name=db value=$form->{db}>
740 <input type=hidden name=sort value=transdate>
745 <th align=right>| . $locale->text('Method') . qq|</th>
746 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
747 . $locale->text('Accrual') . qq|
748 <input name=method class=radio type=radio value=cash $cash>|
749 . $locale->text('EUR') . qq|</td>
758 <th align=right>| . $locale->text('Include in Report') . qq|</th>
762 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
763 <td>| . $locale->text('ID') . qq|</td>
764 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
765 <td>| . $locale->text('Invoice') . qq|</td>
766 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
767 <td>| . $locale->text('Date') . qq|</td>
770 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
773 if ($form->{db} eq 'ar') {
774 print $locale->text('Customer');
776 if ($form->{db} eq 'ap') {
777 print $locale->text('Vendor');
781 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
782 <td>| . $locale->text('Amount') . qq|</td>
783 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
784 <td>| . $locale->text('Tax') . qq|</td>
785 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
786 <td>| . $locale->text('Total') . qq|</td>
789 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
790 <td>| . $locale->text('Subtotal') . qq|</td>
799 if ($form->{report} =~ /^nontaxable_/) {
800 $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
803 <input type=hidden name=nextsub value=generate_tax_report>
805 <input type=hidden name=db value=$form->{db}>
806 <input type=hidden name=sort value=transdate>
807 <input type=hidden name=report value=$form->{report}>
810 <th align=right>| . $locale->text('From') . qq|</th>
811 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
812 <th align=right>| . $locale->text('Bis') . qq|</th>
813 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
816 <th align=right>| . $locale->text('Method') . qq|</th>
817 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
818 . $locale->text('Accrual') . qq|
819 <input name=method class=radio type=radio value=cash $cash>|
820 . $locale->text('EUR') . qq|</td>
823 <th align=right>| . $locale->text('Include in Report') . qq|</th>
827 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
828 <td>| . $locale->text('ID') . qq|</td>
829 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
830 <td>| . $locale->text('Invoice') . qq|</td>
831 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
832 <td>| . $locale->text('Date') . qq|</td>
835 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
838 if ($form->{db} eq 'ar') {
839 print $locale->text('Customer');
841 if ($form->{db} eq 'ap') {
842 print $locale->text('Vendor');
846 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
847 <td>| . $locale->text('Amount') . qq|</td>
848 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
849 <td>| . $locale->text('Total') . qq|</td>
852 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
853 <td>| . $locale->text('Subtotal') . qq|</td>
862 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
863 if ($form->{report} eq 'ar_aging') {
864 $label = $locale->text('Customer');
865 $form->{vc} = 'customer';
867 $label = $locale->text('Vendor');
868 $form->{vc} = 'vendor';
871 $nextsub = "generate_$form->{report}";
874 $form->all_vc(\%myconfig, $form->{vc},
875 ($form->{vc} eq 'customer') ? "AR" : "AP");
877 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
878 @{ $form->{"all_$form->{vc}"} };
882 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
883 : qq|<input name=$form->{vc} size=35>|;
887 <th align=right>| . $locale->text($label) . qq|</th>
891 <th align=right>| . $locale->text('Bis') . qq|</th>
897 <input type=hidden name=type value=statement>
898 <input type=hidden name=format value=html>
899 <input type=hidden name=media value=screen>
901 <input type=hidden name=nextsub value=$nextsub>
902 <input type=hidden name=action value=$nextsub>
908 # above action can be removed if there is more than one input field
910 if ($form->{report} =~ /(receipts|payments)$/) {
911 $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
913 RP->paymentaccounts(\%myconfig, \%$form);
915 $selection = "<option>\n";
916 foreach $ref (@{ $form->{PR} }) {
917 $paymentaccounts .= "$ref->{accno} ";
918 $selection .= "<option>$ref->{accno}--$ref->{description}\n";
921 chop $paymentaccounts;
924 <input type=hidden name=nextsub value=list_payments>
926 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
927 <td colspan=3><select name=account>$selection</select>
928 <input type=hidden name=paymentaccounts value="$paymentaccounts">
932 <th align=right>| . $locale->text('Reference') . qq|</th>
933 <td colspan=3><input name=reference></td>
936 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
937 <td colspan=3><input name=source></td>
940 <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
941 <td colspan=3><input name=memo size=30></td>
944 <th align=right>| . $locale->text('From') . qq|</th>
949 <th align=right>| . $locale->text('Bis') . qq|</th>
956 <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
957 <th align=left colspan=3>|
958 . $locale->text('Include Exchangerate Difference') . qq|</td>
963 <input type=hidden name=db value=$form->{db}>
964 <input type=hidden name=sort value=transdate>
975 <td><hr size=3 noshade></td>
980 <input type=hidden name=login value=$form->{login}>
981 <input type=hidden name=password value=$form->{password}>
983 <input type=submit class=submit name=action value="|
984 . $locale->text('Continue') . qq|">
987 # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
988 USTVA->get_config($userspath, 'finanzamt.ini');
990 $disabled = qq|disabled="disabled"|;
991 $disabled = '' if ($form->{elster} eq '1');
992 if ($form->{report} eq 'ustva') {
994 <input type=submit class=submit name=action value="|
995 . $locale->text('debug') . qq|">
996 <input type=submit class=submit name=action $disabled
997 value="| . $locale->text('winston_export') . qq|">
1000 <input type=submit class=submit name=action value="|
1001 . $locale->text('config') . qq|">
1012 $lxdebug->leave_sub();
1015 sub continue { call_sub($form->{"nextsub"}); }
1018 $lxdebug->enter_sub();
1019 my $nextsub = shift;
1021 $form->{project_id} = $form->{project_id_1};
1022 if ($form->{projectnumber} && !$form->{project_id}) {
1023 $form->{rowcount} = 1;
1025 # call this instead of update
1026 $form->{update} = $nextsub;
1027 $form->{projectnumber_1} = $form->{projectnumber};
1029 delete $form->{sort};
1032 # if there is one only, assign id
1033 $form->{project_id} = $form->{project_id_1};
1036 $lxdebug->leave_sub();
1039 sub generate_income_statement {
1040 $lxdebug->enter_sub();
1042 $form->{padding} = " ";
1043 $form->{bold} = "<b>";
1044 $form->{endbold} = "</b>";
1045 $form->{br} = "<br>";
1047 if ($form->{reporttype} eq "custom") {
1049 #forgotten the year --> thisyear
1050 if ($form->{year} !~ m/^\d\d\d\d$/) {
1051 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
1057 if ($form->{duetyp} eq "13") {
1058 $form->{fromdate} = "1.1.$form->{year}";
1059 $form->{todate} = "31.12.$form->{year}";
1063 if ($form->{duetyp} eq "A") {
1064 $form->{fromdate} = "1.1.$form->{year}";
1065 $form->{todate} = "31.3.$form->{year}";
1067 if ($form->{duetyp} eq "B") {
1068 $form->{fromdate} = "1.4.$form->{year}";
1069 $form->{todate} = "30.6.$form->{year}";
1071 if ($form->{duetyp} eq "C") {
1072 $form->{fromdate} = "1.7.$form->{year}";
1073 $form->{todate} = "30.9.$form->{year}";
1075 if ($form->{duetyp} eq "D") {
1076 $form->{fromdate} = "1.10.$form->{year}";
1077 $form->{todate} = "31.12.$form->{year}";
1082 $form->{duetyp} eq "1" && do {
1083 $form->{fromdate} = "1.1.$form->{year}";
1084 $form->{todate} = "31.1.$form->{year}";
1087 $form->{duetyp} eq "2" && do {
1088 $form->{fromdate} = "1.2.$form->{year}";
1090 #this works from 1901 to 2099, 1900 and 2100 fail.
1091 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
1092 $form->{todate} = "$leap.2.$form->{year}";
1095 $form->{duetyp} eq "3" && do {
1096 $form->{fromdate} = "1.3.$form->{year}";
1097 $form->{todate} = "31.3.$form->{year}";
1100 $form->{duetyp} eq "4" && do {
1101 $form->{fromdate} = "1.4.$form->{year}";
1102 $form->{todate} = "30.4.$form->{year}";
1105 $form->{duetyp} eq "5" && do {
1106 $form->{fromdate} = "1.5.$form->{year}";
1107 $form->{todate} = "31.5.$form->{year}";
1110 $form->{duetyp} eq "6" && do {
1111 $form->{fromdate} = "1.6.$form->{year}";
1112 $form->{todate} = "30.6.$form->{year}";
1115 $form->{duetyp} eq "7" && do {
1116 $form->{fromdate} = "1.7.$form->{year}";
1117 $form->{todate} = "31.7.$form->{year}";
1120 $form->{duetyp} eq "8" && do {
1121 $form->{fromdate} = "1.8.$form->{year}";
1122 $form->{todate} = "31.8.$form->{year}";
1125 $form->{duetyp} eq "9" && do {
1126 $form->{fromdate} = "1.9.$form->{year}";
1127 $form->{todate} = "30.9.$form->{year}";
1130 $form->{duetyp} eq "10" && do {
1131 $form->{fromdate} = "1.10.$form->{year}";
1132 $form->{todate} = "31.10.$form->{year}";
1135 $form->{duetyp} eq "11" && do {
1136 $form->{fromdate} = "1.11.$form->{year}";
1137 $form->{todate} = "30.11.$form->{year}";
1140 $form->{duetyp} eq "12" && do {
1141 $form->{fromdate} = "1.12.$form->{year}";
1142 $form->{todate} = "31.12.$form->{year}";
1148 RP->income_statement(\%myconfig, \%$form);
1150 ($form->{department}) = split /--/, $form->{department};
1153 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1154 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
1156 # if there are any dates construct a where
1157 if ($form->{fromdate} || $form->{todate}) {
1159 unless ($form->{todate}) {
1160 $form->{todate} = $form->current_date(\%myconfig);
1163 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
1164 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
1166 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1167 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
1169 $form->{this_period} = "$shortfromdate\n$shorttodate";
1171 $locale->text('for Period')
1172 . qq|\n$longfromdate |
1173 . $locale->text('Bis')
1177 if ($form->{comparefromdate} || $form->{comparetodate}) {
1178 $longcomparefromdate =
1179 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
1180 $shortcomparefromdate =
1181 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
1183 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
1184 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
1186 $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
1188 "\n$longcomparefromdate "
1189 . $locale->text('Bis')
1190 . qq| $longcomparetodate|;
1193 # setup variables for the form
1194 @a = qw(company address businessnumber);
1195 map { $form->{$_} = $myconfig{$_} } @a;
1197 $form->{templates} = $myconfig{templates};
1199 $form->{IN} = "income_statement.html";
1201 $form->parse_template;
1203 $lxdebug->leave_sub();
1206 sub generate_balance_sheet {
1207 $lxdebug->enter_sub();
1209 $form->{padding} = " ";
1210 $form->{bold} = "<b>";
1211 $form->{endbold} = "</b>";
1212 $form->{br} = "<br>";
1214 RP->balance_sheet(\%myconfig, \%$form);
1216 $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
1218 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1220 ($form->{department}) = split /--/, $form->{department};
1222 # define Current Earnings account
1223 $padding = ($form->{l_heading}) ? $form->{padding} : "";
1224 push(@{ $form->{equity_account} },
1225 $padding . $locale->text('Current Earnings'));
1227 $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
1228 $form->{last_period} =
1229 $locale->date(\%myconfig, $form->{compareasofdate}, 0);
1231 $form->{IN} = "balance_sheet.html";
1233 # setup company variables for the form
1234 map { $form->{$_} = $myconfig{$_};
1235 $form->{$_} =~ s/\\n/\n/g; }
1236 (qw(company address businessnumber nativecurr));
1238 $form->{templates} = $myconfig{templates};
1240 $form->parse_template;
1242 $lxdebug->leave_sub();
1245 sub generate_projects {
1246 $lxdebug->enter_sub();
1248 &get_project(generate_projects);
1249 $form->{projectnumber} = $form->{projectnumber_1};
1251 $form->{nextsub} = "generate_projects";
1252 $form->{title} = $locale->text('Project Transactions');
1253 RP->trial_balance(\%myconfig, \%$form);
1257 $lxdebug->leave_sub();
1263 # included links to display transactions for period entered
1264 # added headers and subtotals
1266 sub generate_trial_balance {
1267 $lxdebug->enter_sub();
1269 # get for each account initial balance, debits and credits
1270 RP->trial_balance(\%myconfig, \%$form);
1272 $form->{nextsub} = "generate_trial_balance";
1273 $form->{title} = $locale->text('Trial Balance');
1276 $lxdebug->leave_sub();
1280 $lxdebug->enter_sub();
1282 $title = $form->escape($form->{title});
1284 if ($form->{department}) {
1285 ($department) = split /--/, $form->{department};
1286 $options = $locale->text('Department') . " : $department<br>";
1287 $department = $form->escape($form->{department});
1289 if ($form->{projectnumber}) {
1291 $locale->text('Project Number') . " : $form->{projectnumber}<br>";
1292 $projectnumber = $form->escape($form->{projectnumber});
1295 # if there are any dates
1296 if ($form->{fromdate} || $form->{todate}) {
1297 if ($form->{fromdate}) {
1298 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1300 if ($form->{todate}) {
1301 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1304 $form->{period} = "$fromdate - $todate";
1307 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1310 $options .= $form->{period};
1312 @column_index = qw(accno description begbalance debit credit endbalance);
1314 $column_header{accno} =
1315 qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
1316 $column_header{description} =
1317 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1318 $column_header{debit} =
1319 qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
1320 $column_header{credit} =
1321 qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
1322 $column_header{begbalance} =
1323 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1324 $column_header{endbalance} =
1325 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1334 <th class=listtop>$form->{title}</th>
1336 <tr height="5"></tr>
1345 map { print "$column_header{$_}\n" } @column_index;
1351 # sort the whole thing by account numbers and display
1352 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
1354 $description = $form->escape($ref->{description});
1357 qq|ca.pl?action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|;
1359 $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
1361 $debit = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit}, 2, " ") : " ";
1362 $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, " ") : " ";
1364 $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
1366 $form->format_amount(\%myconfig,
1367 ($ref->{balance} + $ref->{amount}) * $ml,
1370 # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
1372 if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
1373 map { $column_data{$_} = "<th> </th>" }
1374 qw(accno begbalance endbalance);
1376 $subtotalbegbalance =
1377 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1378 $subtotalendbalance =
1379 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1381 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1383 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1385 $column_data{description} = "<th>$subtotaldescription</th>";
1386 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1387 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1388 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1389 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1392 <tr class=listsubtotal>
1394 map { print "$column_data{$_}\n" } @column_index;
1401 if ($ref->{charttype} eq "H") {
1403 $subtotaldescription = $ref->{description};
1404 $subtotaldebit = $ref->{debit};
1405 $subtotalcredit = $ref->{credit};
1406 $subtotalbegbalance = 0;
1407 $subtotalendbalance = 0;
1409 next unless $form->{l_heading};
1411 map { $column_data{$_} = "<th> </th>" }
1412 qw(accno debit credit begbalance endbalance);
1413 $column_data{description} =
1414 "<th class=listheading>$ref->{description}</th>";
1417 if ($ref->{charttype} eq "A") {
1418 $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
1419 $column_data{description} = "<td>$ref->{description}</td>";
1420 $column_data{debit} = "<td align=right>$debit</td>";
1421 $column_data{credit} = "<td align=right>$credit</td>";
1422 $column_data{begbalance} = "<td align=right>$begbalance</td>";
1423 $column_data{endbalance} = "<td align=right>$endbalance</td>";
1425 $totaldebit += $ref->{debit};
1426 $totalcredit += $ref->{credit};
1428 $subtotalbegbalance += $ref->{balance} * $ml;
1429 $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
1433 if ($ref->{charttype} eq "H") {
1435 <tr class=listheading>
1438 if ($ref->{charttype} eq "A") {
1442 <tr class=listrow$i>
1446 map { print "$column_data{$_}\n" } @column_index;
1453 # print last subtotal
1454 if ($subtotal && $form->{l_subtotal}) {
1455 map { $column_data{$_} = "<th> </th>" }
1456 qw(accno begbalance endbalance);
1457 $subtotalbegbalance =
1458 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1459 $subtotalendbalance =
1460 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1462 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1464 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1465 $column_data{description} = "<th>$subdescription</th>";
1466 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1467 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1468 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1469 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1472 <tr class=listsubtotal>
1474 map { print "$column_data{$_}\n" } @column_index;
1481 $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
1482 $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
1484 map { $column_data{$_} = "<th> </th>" }
1485 qw(accno description begbalance endbalance);
1487 $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
1488 $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
1491 <tr class=listtotal>
1494 map { print "$column_data{$_}\n" } @column_index;
1502 <td><hr size=3 noshade></td>
1510 $lxdebug->leave_sub();
1513 sub generate_ar_aging {
1514 $lxdebug->enter_sub();
1517 ($form->{customer}) = split(/--/, $form->{customer});
1518 $customer = $form->escape($form->{customer}, 1);
1519 $title = $form->escape($form->{title}, 1);
1521 $form->{ct} = "customer";
1522 $form->{arap} = "ar";
1525 qq|$form->{script}?action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
1527 RP->aging(\%myconfig, \%$form);
1530 $lxdebug->leave_sub();
1533 sub generate_ap_aging {
1534 $lxdebug->enter_sub();
1537 ($form->{vendor}) = split(/--/, $form->{vendor});
1538 $vendor = $form->escape($form->{vendor}, 1);
1539 $title = $form->escape($form->{title}, 1);
1541 $form->{ct} = "vendor";
1542 $form->{arap} = "ap";
1545 qq|$form->{script}?action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
1547 RP->aging(\%myconfig, \%$form);
1550 $lxdebug->leave_sub();
1554 $lxdebug->enter_sub();
1558 $column_header{statement} = qq|<th> </th>|;
1559 $column_header{ct} =
1560 qq|<th class=listheading>|
1561 . $locale->text(ucfirst $form->{ct})
1563 $column_header{invnumber} =
1564 qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
1565 $column_header{transdate} =
1566 qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
1567 $column_header{duedate} =
1568 qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
1569 $column_header{c0} =
1570 qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
1571 $column_header{c30} = qq|<th class=listheading>30</th>|;
1572 $column_header{c60} = qq|<th class=listheading>60</th>|;
1573 $column_header{c90} = qq|<th class=listheading>90</th>|;
1576 (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
1578 if ($form->{department}) {
1579 $option .= "\n<br>" if $option;
1580 ($department) = split /--/, $form->{department};
1581 $option .= $locale->text('Department') . " : $department";
1582 $department = $form->escape($form->{department}, 1);
1583 $form->{callback} .= "&department=$department";
1586 if ($form->{arap} eq 'ar') {
1587 if ($form->{customer}) {
1588 $option .= "\n<br>" if $option;
1589 $option .= $form->{customer};
1592 if ($form->{arap} eq 'ap') {
1593 shift @column_index;
1594 if ($form->{vendor}) {
1595 $option .= "\n<br>" if $option;
1596 $option .= $form->{vendor};
1600 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1601 $option .= "\n<br>" if $option;
1603 $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
1608 <form method=post action=$form->{script}>
1612 <th class=listtop>$form->{title}</th>
1614 <tr height="5"></tr>
1621 <tr class=listheading>
1624 map { print "$column_header{$_}\n" } @column_index;
1634 foreach $ref (@{ $form->{AG} }) {
1636 if ($ctid != $ref->{ctid}) {
1641 $c0subtotal = ($c0subtotal != 0) ?
1642 $form->format_amount(\%myconfig, $c0subtotal, 2, " ") : "";
1643 $c30subtotal = ($c30subtotal != 0) ?
1644 $form->format_amount(\%myconfig, $c30subtotal, 2, " ") : "";
1645 $c60subtotal = ($c60subtotal != 0) ?
1646 $form->format_amount(\%myconfig, $c60subtotal, 2, " ") : "";
1647 $c90subtotal = ($c90subtotal != 0) ?
1648 $form->format_amount(\%myconfig, $c90subtotal, 2, " ") : "";
1651 $column_data{ct} = qq|<th> </th>|;
1652 $column_data{invnumber} = qq|<th> </th>|;
1653 $column_data{transdate} = qq|<th> </th>|;
1654 $column_data{duedate} = qq|<th> </th>|;
1656 qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1658 qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1660 qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1662 qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1668 <tr class=listsubtotal>
1671 map { print "$column_data{$_}\n" } @column_index;
1673 $column_data{statement} = qq|<td> </td>|;
1687 $column_data{ct} = qq|<td>$ref->{name}</td>|;
1688 $column_data{statement} =
1689 qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
1690 <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
1694 $c0subtotal += $ref->{c0};
1695 $c30subtotal += $ref->{c30};
1696 $c60subtotal += $ref->{c60};
1697 $c90subtotal += $ref->{c90};
1699 $c0total += $ref->{c0};
1700 $c30total += $ref->{c30};
1701 $c60total += $ref->{c60};
1702 $c90total += $ref->{c90};
1704 $ref->{c0} = ($ref->{c0} != 0) ? $form->format_amount(\%myconfig, $ref->{c0}, 2, " ") : "";
1705 $ref->{c30} = ($ref->{c30} != 0) ? $form->format_amount(\%myconfig, $ref->{c30}, 2, " ") : "";
1706 $ref->{c60} = ($ref->{c60} != 0) ? $form->format_amount(\%myconfig, $ref->{c60}, 2, " ") : "";
1707 $ref->{c90} = ($ref->{c90} != 0) ? $form->format_amount(\%myconfig, $ref->{c90}, 2, " ") : "";
1710 qq|$ref->{module}.pl?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
1711 . $form->escape($form->{callback});
1713 $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
1714 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
1715 $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
1716 $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
1717 $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
1718 $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
1719 $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
1724 <tr class=listrow$j>
1727 map { print "$column_data{$_}\n" } @column_index;
1733 $column_data{ct} = qq|<td> </td>|;
1734 $column_data{statement} = qq|<td> </td>|;
1736 $ctid = $ref->{ctid};
1741 $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1742 $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1743 $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1744 $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1747 <tr class=listsubtotal>
1750 map { $column_data{$_} = qq|<th> </th>| } @column_index;
1752 $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1753 $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1754 $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1755 $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1757 map { print "$column_data{$_}\n" } @column_index;
1761 <tr class=listtotal>
1764 $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
1765 $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
1766 $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
1767 $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
1769 $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
1770 $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
1771 $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
1772 $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
1774 map { print "$column_data{$_}\n" } @column_index;
1777 <input type=hidden name=rowcount value=$i>
1786 &print_options if ($form->{arap} eq 'ar');
1792 <td><hr size=3 noshade></td>
1797 if ($form->{arap} eq 'ar') {
1799 <input type=hidden name=todate value=$form->{todate}>
1801 <input type=hidden name=title value="$form->{title}">
1803 <input type=hidden name=arap value=$form->{arap}>
1804 <input type=hidden name=ct value=$form->{ct}>
1805 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
1807 <input type=hidden name=department value="$form->{department}">
1809 <input type=hidden name=login value=$form->{login}>
1810 <input type=hidden name=password value=$form->{password}>
1813 <input class=submit type=submit name=action value="|
1814 . $locale->text('Select all') . qq|">
1815 <input class=submit type=submit name=action value="|
1816 . $locale->text('Print') . qq|">
1817 <input class=submit type=submit name=action value="|
1818 . $locale->text('E-mail') . qq|">|;
1828 $lxdebug->leave_sub();
1832 $lxdebug->enter_sub();
1834 RP->aging(\%myconfig, \%$form);
1836 map { $_->{checked} = "checked" } @{ $form->{AG} };
1840 $lxdebug->leave_sub();
1844 $lxdebug->enter_sub();
1846 # get name and email addresses
1847 for $i (1 .. $form->{rowcount}) {
1848 if ($form->{"statement_$i"}) {
1849 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1850 RP->get_customer(\%myconfig, \%$form);
1856 $form->error($locale->text('Nothing selected!')) unless $selected;
1858 if ($myconfig{role} eq 'admin') {
1860 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
1861 <td><input name=bcc size=30 value="$form->{bcc}"></td>
1865 $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
1867 $form->{media} = "email";
1874 <form method=post action=$form->{script}>
1880 <tr height="5"></tr>
1885 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1886 <td><input name=email size=30 value="$form->{email}"></td>
1887 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
1888 <td><input name=cc size=30 value="$form->{cc}"></td>
1891 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
1892 <td><input name=subject size=30 value="$form->{subject}"></td>
1902 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
1905 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
1916 map { delete $form->{$_} }
1917 qw(action email cc bcc subject message type sendmode format header);
1919 # save all other variables
1920 foreach $key (keys %$form) {
1921 $form->{$key} =~ s/\"/"/g;
1922 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1929 <td><hr size=3 noshade></td>
1933 <input type=hidden name=nextsub value=send_email>
1936 <input name=action class=submit type=submit value="|
1937 . $locale->text('Continue') . qq|">
1944 $lxdebug->leave_sub();
1948 $lxdebug->enter_sub();
1950 $form->{OUT} = "$sendmail";
1952 $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
1953 unless $form->{subject};
1955 RP->aging(\%myconfig, \%$form);
1957 $form->{"statement_1"} = 1;
1962 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
1964 $lxdebug->leave_sub();
1968 $lxdebug->enter_sub();
1970 if ($form->{media} eq 'printer') {
1971 $form->error($locale->text('Select postscript or PDF!'))
1972 if ($form->{format} !~ /(postscript|pdf)/);
1975 for $i (1 .. $form->{rowcount}) {
1976 if ($form->{"statement_$i"}) {
1977 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1983 $form->error($locale->text('Nothing selected!')) unless $selected;
1985 if ($form->{media} eq 'printer') {
1986 $form->{OUT} = "| $myconfig{printer}";
1987 $form->{"$form->{ct}_id"} = "";
1989 $form->{"statement_1"} = 1;
1992 RP->aging(\%myconfig, \%$form);
1996 $form->redirect($locale->text('Statements sent to printer!'))
1997 if ($form->{media} eq 'printer');
1999 $lxdebug->leave_sub();
2003 $lxdebug->enter_sub();
2007 "ä" => "ae", "ö" => "oe", "ü" => "ue",
2008 "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue",
2013 foreach my $key (keys %replacements) {
2014 my $new_key = SL::Iconv::convert("ISO-8859-15", $dbcharset, $key);
2015 $replacements{$new_key} = $replacements{$key} if $new_key ne $key;
2018 $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
2020 $form->{templates} = "$myconfig{templates}";
2022 my $suffix = "html";
2023 my $attachment_suffix = "html";
2024 if ($form->{format} eq 'postscript') {
2025 $form->{postscript} = 1;
2027 $attachment_suffix = "ps";
2028 } elsif ($form->{format} eq 'pdf') {
2031 $attachment_suffix = "pdf";
2034 $form->{IN} = "$form->{type}.$suffix";
2037 # Save $form->{email} because it will be overwritten.
2038 $form->{EMAIL_RECIPIENT} = $form->{email};
2041 while (@{ $form->{AG} }) {
2043 $ref = shift @{ $form->{AG} };
2045 if ($ctid != $ref->{ctid}) {
2047 $ctid = $ref->{ctid};
2050 if ($form->{"statement_$i"}) {
2053 (name, street, zipcode, city, country, contact, email,
2054 "$form->{ct}phone", "$form->{ct}fax");
2055 map { $form->{$_} = $ref->{$_} } @a;
2057 $form->{ $form->{ct} } = $form->{name};
2058 $form->{"$form->{ct}_id"} = $ref->{ctid};
2060 map { $form->{$_} = () } qw(invnumber invdate duedate);
2062 foreach $item (qw(c0 c30 c60 c90)) {
2063 $form->{$item} = ();
2064 $form->{"${item}total"} = 0;
2067 &statement_details($ref);
2071 if (scalar(@{ $form->{AG} }) > 0) {
2073 # one or more left to go
2074 if ($ctid == $form->{AG}->[0]->{ctid}) {
2075 $ref = shift @{ $form->{AG} };
2076 &statement_details($ref);
2079 $ref = scalar(@{ $form->{AG} });
2085 # set initial ref to 0
2092 $form->{"${_}total"} =
2093 $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
2094 } (c0, c30, c60, c90, "");
2096 $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix";
2097 map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements));
2099 $form->parse_template(\%myconfig, $userspath);
2104 # saving the history
2105 if(!exists $form->{addition} && $form->{id} ne "") {
2106 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
2107 $form->{addition} = "PRINTED";
2108 $form->{what_done} = $form->{type};
2109 $form->save_history($form->dbconnect(\%myconfig));
2111 # /saving the history
2112 $lxdebug->leave_sub();
2115 sub statement_details {
2116 $lxdebug->enter_sub();
2119 push @{ $form->{invnumber} }, $ref->{invnumber};
2120 push @{ $form->{invdate} }, $ref->{transdate};
2121 push @{ $form->{duedate} }, $ref->{duedate};
2123 foreach $item (qw(c0 c30 c60 c90)) {
2124 if ($ref->{exchangerate} * 1) {
2126 $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
2128 $form->{"${item}total"} += $ref->{$item};
2129 $form->{total} += $ref->{$item};
2130 push @{ $form->{$item} },
2131 $form->format_amount(\%myconfig, $ref->{$item}, 2);
2134 $lxdebug->leave_sub();
2137 sub generate_tax_report {
2138 $lxdebug->enter_sub();
2140 RP->tax_report(\%myconfig, \%$form);
2142 $descvar = "$form->{accno}_description";
2143 $description = $form->escape($form->{$descvar});
2144 $ratevar = "$form->{accno}_rate";
2146 $department = $form->escape($form->{department});
2150 "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
2152 # construct callback
2153 $description = $form->escape($form->{$descvar}, 1);
2154 $department = $form->escape($form->{department}, 1);
2156 "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
2158 $title = $form->escape($form->{title});
2159 $href .= "&title=$title";
2160 $title = $form->escape($form->{title}, 1);
2161 $callback .= "&title=$title";
2163 $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
2166 $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2168 foreach $item (@columns) {
2169 if ($form->{"l_$item"} eq "Y") {
2170 push @column_index, $item;
2172 # add column to href and callback
2173 $callback .= "&l_$item=Y";
2174 $href .= "&l_$item=Y";
2178 if ($form->{l_subtotal} eq 'Y') {
2179 $callback .= "&l_subtotal=Y";
2180 $href .= "&l_subtotal=Y";
2183 if ($form->{department}) {
2184 ($department) = split /--/, $form->{department};
2185 $option = $locale->text('Department') . " : $department";
2188 # if there are any dates
2189 if ($form->{fromdate} || $form->{todate}) {
2190 if ($form->{fromdate}) {
2191 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
2193 if ($form->{todate}) {
2194 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
2197 $form->{period} = "$fromdate - $todate";
2200 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2203 if ($form->{db} eq 'ar') {
2204 $name = $locale->text('Customer');
2208 if ($form->{db} eq 'ap') {
2209 $name = $locale->text('Vendor');
2214 $option .= "<br>" if $option;
2215 $option .= "$form->{period}";
2217 $column_header{id} =
2218 qq|<th><a class=listheading href=$href&sort=id>|
2219 . $locale->text('ID')
2221 $column_header{invnumber} =
2222 qq|<th><a class=listheading href=$href&sort=invnumber>|
2223 . $locale->text('Invoice')
2225 $column_header{transdate} =
2226 qq|<th><a class=listheading href=$href&sort=transdate>|
2227 . $locale->text('Date')
2229 $column_header{netamount} =
2230 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
2231 $column_header{tax} =
2232 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
2233 $column_header{amount} =
2234 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
2236 $column_header{name} =
2237 qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
2246 <th class=listtop colspan=$colspan>$form->{title}</th>
2248 <tr height="5"></tr>
2255 <tr class=listheading>
2258 map { print "$column_header{$_}\n" } @column_index;
2264 # add sort and escape callback
2265 $callback = $form->escape($callback . "&sort=$form->{sort}");
2267 if (@{ $form->{TR} }) {
2268 $sameitem = $form->{TR}->[0]->{ $form->{sort} };
2271 foreach $ref (@{ $form->{TR} }) {
2273 $module = ($ref->{invoice}) ? $invoice : $arap;
2275 if ($form->{l_subtotal} eq 'Y') {
2276 if ($sameitem ne $ref->{ $form->{sort} }) {
2278 $sameitem = $ref->{ $form->{sort} };
2282 $totalnetamount += $ref->{netamount};
2283 $totaltax += $ref->{tax};
2284 $ref->{amount} = $ref->{netamount} + $ref->{tax};
2286 $subtotalnetamount += $ref->{netamount};
2287 $subtotaltax += $ref->{tax};
2290 $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2291 } qw(netamount tax amount);
2293 $column_data{id} = qq|<td>$ref->{id}</td>|;
2294 $column_data{invnumber} =
2295 qq|<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
2296 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
2297 $column_data{name} = qq|<td>$ref->{name} </td>|;
2299 map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
2300 qw(netamount tax amount);
2305 <tr class=listrow$i>
2308 map { print "$column_data{$_}\n" } @column_index;
2316 if ($form->{l_subtotal} eq 'Y') {
2320 map { $column_data{$_} = qq|<th> </th>| } @column_index;
2324 <tr class=listtotal>
2328 $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
2330 $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
2331 $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
2333 $column_data{netamount} =
2334 qq|<th class=listtotal align=right>$totalnetamount</th>|;
2335 $column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
2336 $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
2338 map { print "$column_data{$_}\n" } @column_index;
2346 <td><hr size=3 noshade></td>
2354 $lxdebug->leave_sub();
2358 $lxdebug->enter_sub();
2360 map { $column_data{$_} = "<td> </td>" } @column_index;
2362 $subtotalnetamount =
2363 $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
2364 $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
2366 $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
2369 $column_data{netamount} =
2370 "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2371 $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
2372 $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
2374 $subtotalnetamount = 0;
2378 <tr class=listsubtotal>
2380 map { print "\n$column_data{$_}" } @column_index;
2386 $lxdebug->leave_sub();
2390 $lxdebug->enter_sub();
2392 if ($form->{account}) {
2393 ($form->{paymentaccounts}) = split /--/, $form->{account};
2395 if ($form->{department}) {
2396 ($department, $form->{department_id}) = split /--/, $form->{department};
2397 $option = $locale->text('Department') . " : $department";
2400 RP->payments(\%myconfig, \%$form);
2403 $form->sort_columns(qw(transdate reference name paid source memo));
2406 $account = $form->escape($form->{account});
2407 $title = $form->escape($form->{title});
2408 $department = $form->escape($form->{department});
2409 $form->{paymentaccounts} =~ s/ /%20/g;
2410 $reference = $form->escape($form->{reference});
2411 $source = $form->escape($form->{source});
2412 $memo = $form->escape($form->{memo});
2415 "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo";
2417 # construct callback
2418 $account = $form->escape($form->{account}, 1);
2419 $title = $form->escape($form->{title}, 1);
2420 $department = $form->escape($form->{department}, 1);
2421 $reference = $form->escape($form->{reference}, 1);
2422 $source = $form->escape($form->{source}, 1);
2423 $memo = $form->escape($form->{memo}, 1);
2426 "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}";
2427 $callback = $form->escape($form->{callback});
2429 $column_header{name} =
2430 "<th><a class=listheading href=$href&sort=name>"
2431 . $locale->text('Description')
2433 $column_header{reference} =
2434 "<th><a class=listheading href=$href&sort=invnumber>"
2435 . $locale->text('Reference')
2437 $column_header{transdate} =
2438 "<th><a class=listheading href=$href&sort=transdate>"
2439 . $locale->text('Date')
2441 $column_header{paid} =
2442 "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2443 $column_header{source} =
2444 "<th><a class=listheading href=$href&sort=source>"
2445 . $locale->text('Source')
2447 $column_header{memo} =
2448 "<th><a class=listheading href=$href&sort=memo>"
2449 . $locale->text('Memo')
2452 if ($form->{fromdate}) {
2453 $option .= "\n<br>" if ($option);
2455 $locale->text('From') . " "
2456 . $locale->date(\%myconfig, $form->{fromdate}, 1);
2458 if ($form->{todate}) {
2459 $option .= "\n<br>" if ($option);
2461 $locale->text('bis') . " "
2462 . $locale->date(\%myconfig, $form->{todate}, 1);
2465 @column_index = @columns;
2466 $colspan = $#column_index + 1;
2475 <th class=listtop>$form->{title}</th>
2477 <tr height="5"></tr>
2484 <tr class=listheading>
2487 map { print "\n$column_header{$_}" } @column_index;
2493 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2495 next unless @{ $form->{ $ref->{id} } };
2499 <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2503 foreach $payment (@{ $form->{ $ref->{id} } }) {
2505 $module = $payment->{module};
2506 $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2507 $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2510 qq|${module}.pl?action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2512 $column_data{name} = "<td>$payment->{name} </td>";
2513 $column_data{reference} =
2514 qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2515 $column_data{transdate} = "<td>$payment->{transdate} </td>";
2516 $column_data{paid} =
2518 . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
2520 $column_data{source} = "<td>$payment->{source} </td>";
2521 $column_data{memo} = "<td>$payment->{memo} </td>";
2523 $subtotalpaid += $payment->{paid};
2524 $totalpaid += $payment->{paid};
2529 <tr class=listrow$i>
2532 map { print "\n$column_data{$_}" } @column_index;
2541 map { $column_data{$_} = "<td> </td>" } @column_index;
2543 $column_data{paid} =
2544 "<th class=listsubtotal align=right>"
2545 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
2548 <tr class=listsubtotal>
2551 map { print "\n$column_data{$_}" } @column_index;
2562 map { $column_data{$_} = "<td> </td>" } @column_index;
2564 $column_data{paid} =
2565 "<th class=listtotal align=right>"
2566 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
2569 <tr class=listtotal>
2572 map { print "\n$column_data{$_}" } @column_index;
2581 <td><hr size=3 noshade></td>
2589 $lxdebug->leave_sub();
2593 $lxdebug->enter_sub();
2598 $lxdebug->leave_sub();
2607 sub winston_export {
2608 $lxdebug->enter_sub();
2611 $form->{winston} = 1;
2613 $lxdebug->leave_sub();
2617 $lxdebug->enter_sub();
2619 $form->{sendmode} = "attachment";
2622 $form->{"format"} ? $form->{"format"} :
2623 $myconfig{"template_format"} ? $myconfig{"template_format"} :
2627 $form->{"copies"} ? $form->{"copies"} :
2628 $myconfig{"copies"} ? $myconfig{"copies"} :
2631 $form->{PD}{ $form->{type} } = "selected";
2632 $form->{DF}{ $form->{format} } = "selected";
2633 $form->{OP}{ $form->{media} } = "selected";
2634 $form->{SM}{ $form->{sendmode} } = "selected";
2636 if ($form->{report} eq 'ustva') {
2638 <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
2641 <option value=statement $form->{PD}{statement}>|
2642 . $locale->text('Statement');
2645 if ($form->{media} eq 'email') {
2647 <option value=attachment $form->{SM}{attachment}>|
2648 . $locale->text('Attachment') . qq|
2649 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
2652 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2653 if ($myconfig{printer} && $latex_templates) {
2655 <option value=printer $form->{OP}{printer}>|
2656 . $locale->text('Printer');
2660 if ($latex_templates) {
2662 <option value=html $form->{DF}{html}>|
2663 . $locale->text('HTML') . qq|
2664 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
2665 if ($form->{report} ne 'ustva') {
2667 <option value=postscript $form->{DF}{postscript}>|
2668 . $locale->text('Postscript');
2675 <td><select name=type>$type</select></td>
2676 <td><select name=format>$format</select></td>
2677 <td><select name=media>$media</select></td>
2680 if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
2682 <td>| . $locale->text('Copies') . qq|
2683 <input name=copies size=2 value=$form->{copies}></td>
2692 $lxdebug->leave_sub();
2696 $lxdebug->enter_sub();
2697 $form->{padding} = " ";
2698 $form->{bold} = "<b>";
2699 $form->{endbold} = "</b>";
2700 $form->{br} = "<br>";
2702 if ($form->{reporttype} eq "custom") {
2704 #forgotten the year --> thisyear
2705 if ($form->{year} !~ m/^\d\d\d\d$/) {
2706 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2712 if ($form->{duetyp} eq "13") {
2713 $form->{fromdate} = "1.1.$form->{year}";
2714 $form->{todate} = "31.12.$form->{year}";
2715 $form->{comparefromdate} = "1.01.$form->{year}";
2716 $form->{comparetodate} = "31.12.$form->{year}";
2720 if ($form->{duetyp} eq "A") {
2721 $form->{fromdate} = "1.1.$form->{year}";
2722 $form->{todate} = "31.3.$form->{year}";
2723 $form->{comparefromdate} = "1.01.$form->{year}";
2724 $form->{comparetodate} = "31.03.$form->{year}";
2726 if ($form->{duetyp} eq "B") {
2727 $form->{fromdate} = "1.4.$form->{year}";
2728 $form->{todate} = "30.6.$form->{year}";
2729 $form->{comparefromdate} = "1.01.$form->{year}";
2730 $form->{comparetodate} = "30.06.$form->{year}";
2732 if ($form->{duetyp} eq "C") {
2733 $form->{fromdate} = "1.7.$form->{year}";
2734 $form->{todate} = "30.9.$form->{year}";
2735 $form->{comparefromdate} = "1.01.$form->{year}";
2736 $form->{comparetodate} = "30.09.$form->{year}";
2738 if ($form->{duetyp} eq "D") {
2739 $form->{fromdate} = "1.10.$form->{year}";
2740 $form->{todate} = "31.12.$form->{year}";
2741 $form->{comparefromdate} = "1.01.$form->{year}";
2742 $form->{comparetodate} = "31.12.$form->{year}";
2747 $form->{duetyp} eq "1" && do {
2748 $form->{fromdate} = "1.1.$form->{year}";
2749 $form->{todate} = "31.1.$form->{year}";
2750 $form->{comparefromdate} = "1.01.$form->{year}";
2751 $form->{comparetodate} = "31.01.$form->{year}";
2754 $form->{duetyp} eq "2" && do {
2755 $form->{fromdate} = "1.2.$form->{year}";
2757 #this works from 1901 to 2099, 1900 and 2100 fail.
2758 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2759 $form->{todate} = "$leap.2.$form->{year}";
2760 $form->{comparefromdate} = "1.01.$form->{year}";
2761 $form->{comparetodate} = "$leap.02.$form->{year}";
2764 $form->{duetyp} eq "3" && do {
2765 $form->{fromdate} = "1.3.$form->{year}";
2766 $form->{todate} = "31.3.$form->{year}";
2767 $form->{comparefromdate} = "1.01.$form->{year}";
2768 $form->{comparetodate} = "31.03.$form->{year}";
2771 $form->{duetyp} eq "4" && do {
2772 $form->{fromdate} = "1.4.$form->{year}";
2773 $form->{todate} = "30.4.$form->{year}";
2774 $form->{comparefromdate} = "1.01.$form->{year}";
2775 $form->{comparetodate} = "30.04.$form->{year}";
2778 $form->{duetyp} eq "5" && do {
2779 $form->{fromdate} = "1.5.$form->{year}";
2780 $form->{todate} = "31.5.$form->{year}";
2781 $form->{comparefromdate} = "1.01.$form->{year}";
2782 $form->{comparetodate} = "31.05.$form->{year}";
2785 $form->{duetyp} eq "6" && do {
2786 $form->{fromdate} = "1.6.$form->{year}";
2787 $form->{todate} = "30.6.$form->{year}";
2788 $form->{comparefromdate} = "1.01.$form->{year}";
2789 $form->{comparetodate} = "30.06.$form->{year}";
2792 $form->{duetyp} eq "7" && do {
2793 $form->{fromdate} = "1.7.$form->{year}";
2794 $form->{todate} = "31.7.$form->{year}";
2795 $form->{comparefromdate} = "1.01.$form->{year}";
2796 $form->{comparetodate} = "31.07.$form->{year}";
2799 $form->{duetyp} eq "8" && do {
2800 $form->{fromdate} = "1.8.$form->{year}";
2801 $form->{todate} = "31.8.$form->{year}";
2802 $form->{comparefromdate} = "1.01.$form->{year}";
2803 $form->{comparetodate} = "31.08.$form->{year}";
2806 $form->{duetyp} eq "9" && do {
2807 $form->{fromdate} = "1.9.$form->{year}";
2808 $form->{todate} = "30.9.$form->{year}";
2809 $form->{comparefromdate} = "1.01.$form->{year}";
2810 $form->{comparetodate} = "30.09.$form->{year}";
2813 $form->{duetyp} eq "10" && do {
2814 $form->{fromdate} = "1.10.$form->{year}";
2815 $form->{todate} = "31.10.$form->{year}";
2816 $form->{comparefromdate} = "1.01.$form->{year}";
2817 $form->{comparetodate} = "31.10.$form->{year}";
2820 $form->{duetyp} eq "11" && do {
2821 $form->{fromdate} = "1.11.$form->{year}";
2822 $form->{todate} = "30.11.$form->{year}";
2823 $form->{comparefromdate} = "1.01.$form->{year}";
2824 $form->{comparetodate} = "30.11.$form->{year}";
2827 $form->{duetyp} eq "12" && do {
2828 $form->{fromdate} = "1.12.$form->{year}";
2829 $form->{todate} = "31.12.$form->{year}";
2830 $form->{comparefromdate} = "1.01.$form->{year}";
2831 $form->{comparetodate} = "31.12.$form->{year}";
2836 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
2837 $form->{fromdate} = "${dd}.${mm}.${yy}";
2838 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
2839 $form->{todate} = "${dd}.${mm}.${yy}";
2840 $form->{comparefromdate} = "01.01.$yy";
2841 $form->{comparetodate} = $form->{todate};
2844 RP->bwa(\%myconfig, \%$form);
2846 ($form->{department}) = split /--/, $form->{department};
2849 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2850 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
2852 # if there are any dates construct a where
2853 if ($form->{fromdate} || $form->{todate}) {
2855 unless ($form->{todate}) {
2856 $form->{todate} = $form->current_date(\%myconfig);
2859 my %germandate = ("dateformat" => "dd.mm.yyyy");
2861 $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
2862 $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
2864 $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
2865 $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
2867 $form->{this_period} = "$shortfromdate\n$shorttodate";
2869 $locale->text('for Period')
2870 . qq|\n$longfromdate |
2871 . $locale->text('bis')
2875 # setup variables for the form
2876 @a = qw(company address businessnumber);
2877 map { $form->{$_} = $myconfig{$_} } @a;
2878 $form->{templates} = $myconfig{templates};
2880 $form->{IN} = "bwa.html";
2882 $form->parse_template;
2884 $lxdebug->leave_sub();
2887 sub generate_ustva {
2888 $lxdebug->enter_sub();
2890 # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
2891 USTVA->get_config($userspath, 'finanzamt.ini');
2893 # &get_project(generate_bwa);
2894 @anmeldungszeitraum =
2895 qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
2897 foreach $item (@anmeldungszeitraum) {
2898 $form->{$item} = "";
2900 if ($form->{reporttype} eq "custom") {
2902 #forgotten the year --> thisyear
2903 if ($form->{year} !~ m/^\d\d\d\d$/) {
2904 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2910 if ($form->{duetyp} eq "13") {
2911 $form->{fromdate} = "1.1.$form->{year}";
2912 $form->{todate} = "31.12.$form->{year}";
2916 if ($form->{duetyp} eq "A") {
2917 $form->{fromdate} = "1.1.$form->{year}";
2918 $form->{todate} = "31.3.$form->{year}";
2919 $form->{"0441"} = "X";
2921 if ($form->{duetyp} eq "B") {
2922 $form->{fromdate} = "1.4.$form->{year}";
2923 $form->{todate} = "30.6.$form->{year}";
2924 $form->{"0442"} = "X";
2926 if ($form->{duetyp} eq "C") {
2927 $form->{fromdate} = "1.7.$form->{year}";
2928 $form->{todate} = "30.9.$form->{year}";
2929 $form->{"0443"} = "X";
2931 if ($form->{duetyp} eq "D") {
2932 $form->{fromdate} = "1.10.$form->{year}";
2933 $form->{todate} = "31.12.$form->{year}";
2934 $form->{"0444"} = "X";
2939 $form->{duetyp} eq "1" && do {
2940 $form->{fromdate} = "1.1.$form->{year}";
2941 $form->{todate} = "31.1.$form->{year}";
2942 $form->{"0401"} = "X";
2945 $form->{duetyp} eq "2" && do {
2946 $form->{fromdate} = "1.2.$form->{year}";
2948 #this works from 1901 to 2099, 1900 and 2100 fail.
2949 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2950 $form->{todate} = "$leap.2.$form->{year}";
2951 $form->{"0402"} = "X";
2954 $form->{duetyp} eq "3" && do {
2955 $form->{fromdate} = "1.3.$form->{year}";
2956 $form->{todate} = "31.3.$form->{year}";
2957 $form->{"0403"} = "X";
2960 $form->{duetyp} eq "4" && do {
2961 $form->{fromdate} = "1.4.$form->{year}";
2962 $form->{todate} = "30.4.$form->{year}";
2963 $form->{"0404"} = "X";
2966 $form->{duetyp} eq "5" && do {
2967 $form->{fromdate} = "1.5.$form->{year}";
2968 $form->{todate} = "31.5.$form->{year}";
2969 $form->{"0405"} = "X";
2972 $form->{duetyp} eq "6" && do {
2973 $form->{fromdate} = "1.6.$form->{year}";
2974 $form->{todate} = "30.6.$form->{year}";
2975 $form->{"0406"} = "X";
2978 $form->{duetyp} eq "7" && do {
2979 $form->{fromdate} = "1.7.$form->{year}";
2980 $form->{todate} = "31.7.$form->{year}";
2981 $form->{"0407"} = "X";
2984 $form->{duetyp} eq "8" && do {
2985 $form->{fromdate} = "1.8.$form->{year}";
2986 $form->{todate} = "31.8.$form->{year}";
2987 $form->{"0408"} = "X";
2990 $form->{duetyp} eq "9" && do {
2991 $form->{fromdate} = "1.9.$form->{year}";
2992 $form->{todate} = "30.9.$form->{year}";
2993 $form->{"0409"} = "X";
2996 $form->{duetyp} eq "10" && do {
2997 $form->{fromdate} = "1.10.$form->{year}";
2998 $form->{todate} = "31.10.$form->{year}";
2999 $form->{"0410"} = "X";
3002 $form->{duetyp} eq "11" && do {
3003 $form->{fromdate} = "1.11.$form->{year}";
3004 $form->{todate} = "30.11.$form->{year}";
3005 $form->{"0411"} = "X";
3008 $form->{duetyp} eq "12" && do {
3009 $form->{fromdate} = "1.12.$form->{year}";
3010 $form->{todate} = "31.12.$form->{year}";
3011 $form->{"0412"} = "X";
3017 # $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
3018 # $form->{year}= $1;
3019 # $form->{fromdate}="1.1.$form->{year}";
3020 # $form->{todate}="31.3.$form->{year}";
3021 # $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3024 RP->ustva(\%myconfig, \%$form);
3026 ($form->{department}) = split /--/, $form->{department};
3029 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3030 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
3032 # if there are any dates construct a where
3033 if ($form->{fromdate} || $form->{todate}) {
3035 unless ($form->{todate}) {
3036 $form->{todate} = $form->current_date(\%myconfig);
3039 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
3040 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
3042 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
3043 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
3045 $form->{this_period} = "$shortfromdate\n$shorttodate";
3047 $locale->text('for Period')
3048 . qq|<br>\n$longfromdate |
3049 . $locale->text('bis')
3053 if ($form->{comparefromdate} || $form->{comparetodate}) {
3054 $longcomparefromdate =
3055 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
3056 $shortcomparefromdate =
3057 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
3059 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
3060 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
3062 $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
3064 "\n$longcomparefromdate "
3065 . $locale->text('bis')
3066 . qq| $longcomparetodate|;
3069 $form->{Datum_heute} =
3070 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
3072 if ( $form->{format} eq 'pdf'
3073 or $form->{format} eq 'postscript') {
3074 $form->{padding} = "~~";
3075 $form->{bold} = "\textbf{";
3076 $form->{endbold} = "}";
3077 $form->{br} = '\\\\';
3079 @numbers = qw(51r 86r 97r 93r 96 43 45
3081 foreach $number (@numbers) {
3082 $form->{$number} =~ s/,/~~/g;
3085 } elsif ($form->{format} eq 'html') {
3086 $form->{padding} = " ";
3087 $form->{bold} = "<b>";
3088 $form->{endbold} = "</b>";
3089 $form->{br} = "<br>"
3093 # setup variables for the form
3094 @a = qw(company address businessnumber);
3095 map { $form->{$_} = $myconfig{$_} } @a;
3097 $form->{address} =~ s/\\n/$form->{br}/g;
3099 if ($form->{winston} eq '1') {
3103 $form->{templates} = $myconfig{templates};
3104 $form->{IN} = "$form->{type}";
3105 $form->{IN} .= '.tex'
3106 if ( $form->{format} eq 'pdf'
3107 or $form->{format} eq 'postscript');
3108 $form->{IN} .= '.html' if ($form->{format} eq 'html');
3110 $form->parse_template(\%myconfig, $userspath);
3112 # $form->parse_template;
3114 $lxdebug->leave_sub();