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 "$form->{path}/arap.pl";
47 # this is for our long dates
48 # $locale->text('January')
49 # $locale->text('February')
50 # $locale->text('March')
51 # $locale->text('April')
52 # $locale->text('May ')
53 # $locale->text('June')
54 # $locale->text('July')
55 # $locale->text('August')
56 # $locale->text('September')
57 # $locale->text('October')
58 # $locale->text('November')
59 # $locale->text('December')
61 # this is for our short month
62 # $locale->text('Jan')
63 # $locale->text('Feb')
64 # $locale->text('Mar')
65 # $locale->text('Apr')
66 # $locale->text('May')
67 # $locale->text('Jun')
68 # $locale->text('Jul')
69 # $locale->text('Aug')
70 # $locale->text('Sep')
71 # $locale->text('Oct')
72 # $locale->text('Nov')
73 # $locale->text('Dec')
75 # $locale->text('Balance Sheet')
76 # $locale->text('Income Statement')
77 # $locale->text('Trial Balance')
78 # $locale->text('AR Aging')
79 # $locale->text('AP Aging')
80 # $locale->text('Tax collected')
81 # $locale->text('Tax paid')
82 # $locale->text('Receipts')
83 # $locale->text('Payments')
84 # $locale->text('Project Transactions')
85 # $locale->text('Non-taxable Sales')
86 # $locale->text('Non-taxable Purchases')
89 $lxdebug->enter_sub();
91 %title = ('balance_sheet' => 'Balance Sheet',
92 'income_statement' => 'Income Statement',
93 'trial_balance' => 'Trial Balance',
94 'ar_aging' => 'AR Aging',
95 'ap_aging' => 'Offene Verbindlichkeiten',
96 'tax_collected' => 'Tax collected',
97 'tax_paid' => 'Tax paid',
98 'nontaxable_sales' => 'Non-taxable Sales',
99 'nontaxable_purchases' => 'Non-taxable Purchases',
100 'receipts' => 'Receipts',
101 'payments' => 'Payments',
102 'projects' => 'Project Transactions',
103 'bwa' => 'Betriebswirtschaftliche Auswertung',
104 'ustva' => 'Umsatzsteuervoranmeldung',);
106 $form->{title} = $locale->text($title{ $form->{report} });
108 $accrual = ($eur) ? "" : "checked";
109 $cash = ($eur) ? "checked" : "";
111 ($null, $null, $null, $null, $null, $year, $null, $null, $null) =
116 $form->all_departments(\%myconfig);
117 if (@{ $form->{all_departments} }) {
118 $form->{selectdepartment} = "<option>\n";
121 $form->{selectdepartment} .=
122 "<option>$_->{description}--$_->{id}\n"
123 } (@{ $form->{all_departments} });
128 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
129 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
131 | if $form->{selectdepartment};
133 # use JavaScript Calendar or not
134 $form->{jsscript} = $jscalendar;
136 if ($form->{report} eq "ustva") {
139 if ($form->{report} eq "balance_sheet") {
140 $name_1 = "asofdate";
142 $value_1 = "$form->{asofdate}";
143 $trigger_1 = "trigger1";
144 $name_2 = "compareasofdate";
145 $id_2 = "compareasofdate";
146 $value_2 = "$form->{compareasofdate}";
147 $trigger_2 = "trigger2";
148 } elsif ($form->{report} =~ /(receipts|payments)$/) {
149 $name_1 = "fromdate";
151 $value_1 = "$form->{fromdate}";
152 $trigger_1 = "trigger1";
156 $trigger_2 = "trigger2";
158 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
166 $trigger_2 = "trigger2";
169 $name_1 = "fromdate";
171 $value_1 = "$form->{fromdate}";
172 $trigger_1 = "trigger1";
176 $trigger_2 = "trigger2";
181 # with JavaScript Calendar
182 if ($form->{jsscript}) {
186 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
188 <input type=button name=$name_2 id="$trigger_2" value=|
189 . $locale->text('button') . qq|>|;
193 Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
196 <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
198 <input type=button name=$name_1 id="$trigger_1" value=|
199 . $locale->text('button') . qq|>|;
201 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
203 <input type=button name=$name_2 id="$trigger_2" value=|
204 . $locale->text('button') . qq|>
209 Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
210 "$name_2", "BL", "$trigger_2");
214 # without JavaScript Calendar
217 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
220 qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
222 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
231 <form method=post action=$form->{script}>
233 <input type=hidden name=title value="$form->{title}">
237 <th class=listtop>$form->{title}</th>
246 if ($form->{report} eq "projects") {
249 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
250 <td colspan=5><input name=projectnumber size=25</td>
252 <input type=hidden name=nextsub value=generate_projects>
254 <th align=right>| . $locale->text('From') . qq|</th>
257 <th align=right>| . $locale->text('Bis') . qq|</th>
268 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
269 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
270 . $locale->text('Heading') . qq|
271 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
272 . $locale->text('Subtotal')
280 if ($form->{report} eq "income_statement") {
283 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
284 <td colspan=3><input name=projectnumber size=25</td>
286 <input type=hidden name=nextsub value=generate_income_statement>
290 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
291 . $locale->text('Customized Report')
295 <th colspan=1>| . $locale->text('Year') . qq|</th>
296 <td><input name=year size=11 title="|
297 . $locale->text('YYYY')
298 . qq|" value="$year"></td>
305 <b> | . $locale->text('Yearly') . qq|</b> </td>
306 <th align=left>| . $locale->text('Quarterly') . qq|</th>
307 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
310 <td align=right> <input name=duetyp class=radio type=radio value="13"
312 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
313 . $locale->text('Quarter')
318 <td><input name=duetyp class=radio type=radio value="1" $checked > |
319 . $locale->text('January')
324 <td><input name=duetyp class=radio type=radio value="5" $checked > |
325 . $locale->text('May')
327 <td><input name=duetyp class=radio type=radio value="9" $checked > |
328 . $locale->text('September')
333 <td align= right> </td>
334 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
335 . $locale->text('Quarter')
337 <td><input name=duetyp class=radio type=radio value="2" $checked > |
338 . $locale->text('February')
340 <td><input name=duetyp class=radio type=radio value="6" $checked > |
341 . $locale->text('June')
343 <td><input name=duetyp class=radio type=radio value="10" $checked > |
344 . $locale->text('October')
349 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
350 . $locale->text('Quarter')
352 <td><input name=duetyp class=radio type=radio value="3" $checked > |
353 . $locale->text('March')
355 <td><input name=duetyp class=radio type=radio value="7" $checked > |
356 . $locale->text('July')
358 <td><input name=duetyp class=radio type=radio value="11" $checked > |
359 . $locale->text('November')
365 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
366 . $locale->text('Quarter')
368 <td><input name=duetyp class=radio type=radio value="4" $checked > |
369 . $locale->text('April')
371 <td><input name=duetyp class=radio type=radio value="8" $checked > |
372 . $locale->text('August')
374 <td><input name=duetyp class=radio type=radio value="12" $checked > |
375 . $locale->text('December')
380 <td colspan=5><hr size=3 noshade></td>
383 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
384 . $locale->text('Free report period')
386 <td align=left colspan=4>| . $locale->text('From') . qq|
389 | . $locale->text('Bis') . qq|
395 <td colspan=5><hr size=3 noshade></td>
398 <th align=leftt>| . $locale->text('Method') . qq|</th>
399 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
400 . $locale->text('Accrual') . qq|
401 <input name=method class=radio type=radio value=cash $cash>|
402 . $locale->text('EUR')
410 if ($form->{report} eq "bwa") {
413 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
414 <td colspan=3><input name=projectnumber size=25</td>
416 <input type=hidden name=nextsub value=generate_bwa>
420 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
421 . $locale->text('Customized Report')
425 <th colspan=1>| . $locale->text('Year') . qq|</th>
426 <td><input name=year size=11 title="|
427 . $locale->text('YYYY')
428 . qq|" value="$year"></td>
435 <b> | . $locale->text('Yearly') . qq|</b> </td>
436 <th align=left>| . $locale->text('Quarterly') . qq|</th>
437 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
440 <td align=right> <input name=duetyp class=radio type=radio value="13"
442 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
443 . $locale->text('Quarter')
446 $checked = "checked";
448 <td><input name=duetyp class=radio type=radio value="1" $checked > |
449 . $locale->text('January')
454 <td><input name=duetyp class=radio type=radio value="5" $checked > |
455 . $locale->text('May')
457 <td><input name=duetyp class=radio type=radio value="9" $checked > |
458 . $locale->text('September')
463 <td align= right> </td>
464 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
465 . $locale->text('Quarter')
467 <td><input name=duetyp class=radio type=radio value="2" $checked > |
468 . $locale->text('February')
470 <td><input name=duetyp class=radio type=radio value="6" $checked > |
471 . $locale->text('June')
473 <td><input name=duetyp class=radio type=radio value="10" $checked > |
474 . $locale->text('October')
479 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
480 . $locale->text('Quarter')
482 <td><input name=duetyp class=radio type=radio value="3" $checked > |
483 . $locale->text('March')
485 <td><input name=duetyp class=radio type=radio value="7" $checked > |
486 . $locale->text('July')
488 <td><input name=duetyp class=radio type=radio value="11" $checked > |
489 . $locale->text('November')
495 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
496 . $locale->text('Quarter')
498 <td><input name=duetyp class=radio type=radio value="4" $checked > |
499 . $locale->text('April')
501 <td><input name=duetyp class=radio type=radio value="8" $checked > |
502 . $locale->text('August')
504 <td><input name=duetyp class=radio type=radio value="12" $checked > |
505 . $locale->text('December')
510 <td colspan=5><hr size=3 noshade></td>
513 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
514 . $locale->text('Free report period')
516 <td align=left colspan=4>| . $locale->text('From') . qq|
519 | . $locale->text('Bis') . qq|
525 <td colspan=5><hr size=3 noshade></td>
528 <th align=leftt>| . $locale->text('Method') . qq|</th>
529 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
530 . $locale->text('Accrual') . qq|
531 <input name=method class=radio type=radio value=cash $cash>|
532 . $locale->text('EUR')
536 <th align=right colspan=4>| . $locale->text('Decimalplaces') . qq|</th>
537 <td><input name=decimalplaces size=3></td>
544 if ($form->{report} eq "ustva") {
549 <input type=hidden name=nextsub value=generate_ustva>
553 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
554 . $locale->text('Zeitraum')
558 <th colspan=1>| . $locale->text('Year') . qq|</th>
559 <td><input name=year size=11 title="|
560 . $locale->text('YYYY')
561 . qq|" value="$year"></td>
568 <b> | . $locale->text('Yearly') . qq|</b> </td>
569 <th align=left>| . $locale->text('Quarterly') . qq|</th>
570 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
573 <td align=right> <input name=duetyp class=radio type=radio value="13"
575 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
576 . $locale->text('Quarter')
579 $checked = "checked";
581 <td><input name=duetyp class=radio type=radio value="1" $checked > |
582 . $locale->text('January')
587 <td><input name=duetyp class=radio type=radio value="5" $checked > |
588 . $locale->text('May')
590 <td><input name=duetyp class=radio type=radio value="9" $checked > |
591 . $locale->text('September')
596 <td align= right> </td>
597 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
598 . $locale->text('Quarter')
600 <td><input name=duetyp class=radio type=radio value="2" $checked > |
601 . $locale->text('February')
603 <td><input name=duetyp class=radio type=radio value="6" $checked > |
604 . $locale->text('June')
606 <td><input name=duetyp class=radio type=radio value="10" $checked > |
607 . $locale->text('October')
612 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
613 . $locale->text('Quarter')
615 <td><input name=duetyp class=radio type=radio value="3" $checked > |
616 . $locale->text('March')
618 <td><input name=duetyp class=radio type=radio value="7" $checked > |
619 . $locale->text('July')
621 <td><input name=duetyp class=radio type=radio value="11" $checked > |
622 . $locale->text('November')
628 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
629 . $locale->text('Quarter')
631 <td><input name=duetyp class=radio type=radio value="4" $checked > |
632 . $locale->text('April')
634 <td><input name=duetyp class=radio type=radio value="8" $checked > |
635 . $locale->text('August')
637 <td><input name=duetyp class=radio type=radio value="12" $checked > |
638 . $locale->text('December')
643 <td colspan=5><hr size=3 noshade></td>
646 <th align=left>| . $locale->text('Method') . qq|</th>
647 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
648 . $locale->text('Accrual') . qq|
649 <input name=method class=radio type=radio value=cash $cash>|
650 . $locale->text('EUR')
664 if ($form->{report} eq "balance_sheet") {
666 <input type=hidden name=nextsub value=generate_balance_sheet>
668 <th align=right>| . $locale->text('as at') . qq|</th>
673 <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
680 <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
681 <td><input name=decimalplaces size=3></td>
690 <th align=right>| . $locale->text('Method') . qq|</th>
691 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
692 . $locale->text('Accrual') . qq|
693 <input name=method class=radio type=radio value=cash $cash>|
694 . $locale->text('EUR')
699 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
700 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
701 . $locale->text('Heading') . qq|
702 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
703 . $locale->text('Subtotal') . qq|
704 <input name=l_accno class=checkbox type=checkbox value=Y> |
705 . $locale->text('Account Number')
713 if ($form->{report} eq "trial_balance") {
715 <input type=hidden name=nextsub value=generate_trial_balance>
716 <input type=hidden name=eur value=$eur>
718 <th align=right>| . $locale->text('From') . qq|</th>
723 <th align=right>| . $locale->text('Bis') . qq|</th>
736 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
737 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
738 . $locale->text('Heading') . qq|
739 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
740 . $locale->text('Subtotal') . qq|
741 <input name=all_accounts class=checkbox type=checkbox value=Y> |
742 . $locale->text('All Accounts')
750 if ($form->{report} =~ /^tax_/) {
753 $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
755 RP->get_taxaccounts(\%myconfig, \%$form);
758 <input type=hidden name=nextsub value=generate_tax_report>
760 <th align=right>| . $locale->text('From') . qq|</th>
761 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
762 <th align=right>| . $locale->text('Bis') . qq|</th>
763 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
766 <th align=right>| . $locale->text('Report for') . qq|</th>
770 $checked = "checked";
771 foreach $ref (@{ $form->{taxaccounts} }) {
774 qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
776 <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
777 <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
784 <input type=hidden name=db value=$form->{db}>
785 <input type=hidden name=sort value=transdate>
791 if (@{ $form->{gifi_taxaccounts} }) {
794 <th align=right>| . $locale->text('GIFI') . qq|</th>
798 foreach $ref (@{ $form->{gifi_taxaccounts} }) {
801 qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description}
803 <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}">
804 <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
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')
830 <th align=right>| . $locale->text('Include in Report') . qq|</th>
834 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
835 <td>| . $locale->text('ID') . qq|</td>
836 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
837 <td>| . $locale->text('Invoice') . qq|</td>
838 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
839 <td>| . $locale->text('Date') . qq|</td>
842 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
845 if ($form->{db} eq 'ar') {
846 print $locale->text('Customer');
848 if ($form->{db} eq 'ap') {
849 print $locale->text('Vendor');
853 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
854 <td>| . $locale->text('Amount') . qq|</td>
855 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
856 <td>| . $locale->text('Tax') . qq|</td>
857 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
858 <td>| . $locale->text('Total') . qq|</td>
861 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
862 <td>| . $locale->text('Subtotal') . qq|</td>
871 if ($form->{report} =~ /^nontaxable_/) {
874 $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
877 <input type=hidden name=nextsub value=generate_tax_report>
879 <input type=hidden name=db value=$form->{db}>
880 <input type=hidden name=sort value=transdate>
881 <input type=hidden name=report value=$form->{report}>
884 <th align=right>| . $locale->text('From') . qq|</th>
885 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
886 <th align=right>| . $locale->text('Bis') . qq|</th>
887 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
890 <th align=right>| . $locale->text('Method') . qq|</th>
891 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
892 . $locale->text('Accrual') . qq|
893 <input name=method class=radio type=radio value=cash $cash>|
894 . $locale->text('EUR')
898 <th align=right>| . $locale->text('Include in Report') . qq|</th>
902 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
903 <td>| . $locale->text('ID') . qq|</td>
904 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
905 <td>| . $locale->text('Invoice') . qq|</td>
906 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
907 <td>| . $locale->text('Date') . qq|</td>
910 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
913 if ($form->{db} eq 'ar') {
914 print $locale->text('Customer');
916 if ($form->{db} eq 'ap') {
917 print $locale->text('Vendor');
921 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
922 <td>| . $locale->text('Amount') . qq|</td>
923 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
924 <td>| . $locale->text('Total') . qq|</td>
927 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
928 <td>| . $locale->text('Subtotal') . qq|</td>
937 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
940 if ($form->{report} eq 'ar_aging') {
941 $label = $locale->text('Customer');
942 $form->{vc} = 'customer';
944 $label = $locale->text('Vendor');
945 $form->{vc} = 'vendor';
948 $nextsub = "generate_$form->{report}";
951 $form->all_vc(\%myconfig, $form->{vc},
952 ($form->{vc} eq 'customer') ? "AR" : "AP");
954 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
955 @{ $form->{"all_$form->{vc}"} };
959 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
960 : qq|<input name=$form->{vc} size=35>|;
964 <th align=right>| . $locale->text($label) . qq|</th>
968 <th align=right>| . $locale->text('Bis') . qq|</th>
974 <input type=hidden name=type value=statement>
975 <input type=hidden name=format value=html>
976 <input type=hidden name=media value=screen>
978 <input type=hidden name=nextsub value=$nextsub>
979 <input type=hidden name=action value=$nextsub>
985 # above action can be removed if there is more than one input field
987 if ($form->{report} =~ /(receipts|payments)$/) {
990 $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
992 RP->paymentaccounts(\%myconfig, \%$form);
994 $selection = "<option>\n";
995 foreach $ref (@{ $form->{PR} }) {
996 $paymentaccounts .= "$ref->{accno} ";
997 $selection .= "<option>$ref->{accno}--$ref->{description}\n";
1000 chop $paymentaccounts;
1003 <input type=hidden name=nextsub value=list_payments>
1005 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
1006 <td colspan=3><select name=account>$selection</select>
1007 <input type=hidden name=paymentaccounts value="$paymentaccounts">
1011 <th align=right>| . $locale->text('Reference') . qq|</th>
1012 <td colspan=3><input name=reference></td>
1015 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
1016 <td colspan=3><input name=source></td>
1019 <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
1020 <td colspan=3><input name=memo size=30></td>
1023 <th align=right>| . $locale->text('From') . qq|</th>
1028 <th align=right>| . $locale->text('Bis') . qq|</th>
1035 <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
1036 <th align=left colspan=3>|
1037 . $locale->text('Include Exchangerate Difference')
1043 <input type=hidden name=db value=$form->{db}>
1044 <input type=hidden name=sort value=transdate>
1055 <td><hr size=3 noshade></td>
1060 <input type=hidden name=path value=$form->{path}>
1061 <input type=hidden name=login value=$form->{login}>
1062 <input type=hidden name=password value=$form->{password}>
1064 <input type=submit class=submit name=action value="|
1065 . $locale->text('Continue') . qq|">
1068 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
1069 # Einlesen der Finanzamtdaten
1070 get_config($userspath, 'finanzamt.ini');
1072 $disabled = qq|disabled="disabled"|;
1073 $disabled = '' if ($form->{elster} eq '1');
1074 if ($form->{report} eq 'ustva') {
1076 <input type=submit class=submit name=action value="|
1077 . $locale->text('debug') . qq|">
1078 <input type=submit class=submit name=action $disabled
1079 value="| . $locale->text('winston_export') . qq|">
1082 <input type=submit class=submit name=action value="|
1083 . $locale->text('config') . qq|">
1094 $lxdebug->leave_sub();
1097 sub continue { &{ $form->{nextsub} } }
1100 $lxdebug->enter_sub();
1101 my $nextsub = shift;
1103 $form->{project_id} = $form->{project_id_1};
1104 if ($form->{projectnumber} && !$form->{project_id}) {
1105 $form->{rowcount} = 1;
1107 # call this instead of update
1108 $form->{update} = $nextsub;
1109 $form->{projectnumber_1} = $form->{projectnumber};
1111 delete $form->{sort};
1114 # if there is one only, assign id
1115 $form->{project_id} = $form->{project_id_1};
1118 $lxdebug->leave_sub();
1121 sub generate_income_statement {
1122 $lxdebug->enter_sub();
1124 $form->{padding} = " ";
1125 $form->{bold} = "<b>";
1126 $form->{endbold} = "</b>";
1127 $form->{br} = "<br>";
1129 &get_project(generate_income_statement);
1131 $form->{projectnumber} = $form->{projectnumber_1};
1133 if ($form->{reporttype} eq "custom") {
1135 #forgotten the year --> thisyear
1136 if ($form->{year} !~ m/^\d\d\d\d$/) {
1137 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
1143 if ($form->{duetyp} eq "13") {
1144 $form->{fromdate} = "1.1.$form->{year}";
1145 $form->{todate} = "31.12.$form->{year}";
1149 if ($form->{duetyp} eq "A") {
1150 $form->{fromdate} = "1.1.$form->{year}";
1151 $form->{todate} = "31.3.$form->{year}";
1153 if ($form->{duetyp} eq "B") {
1154 $form->{fromdate} = "1.4.$form->{year}";
1155 $form->{todate} = "30.6.$form->{year}";
1157 if ($form->{duetyp} eq "C") {
1158 $form->{fromdate} = "1.7.$form->{year}";
1159 $form->{todate} = "30.9.$form->{year}";
1161 if ($form->{duetyp} eq "D") {
1162 $form->{fromdate} = "1.10.$form->{year}";
1163 $form->{todate} = "31.12.$form->{year}";
1168 $form->{duetyp} eq "1" && do {
1169 $form->{fromdate} = "1.1.$form->{year}";
1170 $form->{todate} = "31.1.$form->{year}";
1173 $form->{duetyp} eq "2" && do {
1174 $form->{fromdate} = "1.2.$form->{year}";
1176 #this works from 1901 to 2099, 1900 and 2100 fail.
1177 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
1178 $form->{todate} = "$leap.2.$form->{year}";
1181 $form->{duetyp} eq "3" && do {
1182 $form->{fromdate} = "1.3.$form->{year}";
1183 $form->{todate} = "31.3.$form->{year}";
1186 $form->{duetyp} eq "4" && do {
1187 $form->{fromdate} = "1.4.$form->{year}";
1188 $form->{todate} = "30.4.$form->{year}";
1191 $form->{duetyp} eq "5" && do {
1192 $form->{fromdate} = "1.5.$form->{year}";
1193 $form->{todate} = "31.5.$form->{year}";
1196 $form->{duetyp} eq "6" && do {
1197 $form->{fromdate} = "1.6.$form->{year}";
1198 $form->{todate} = "30.6.$form->{year}";
1201 $form->{duetyp} eq "7" && do {
1202 $form->{fromdate} = "1.7.$form->{year}";
1203 $form->{todate} = "31.7.$form->{year}";
1206 $form->{duetyp} eq "8" && do {
1207 $form->{fromdate} = "1.8.$form->{year}";
1208 $form->{todate} = "31.8.$form->{year}";
1211 $form->{duetyp} eq "9" && do {
1212 $form->{fromdate} = "1.9.$form->{year}";
1213 $form->{todate} = "30.9.$form->{year}";
1216 $form->{duetyp} eq "10" && do {
1217 $form->{fromdate} = "1.10.$form->{year}";
1218 $form->{todate} = "31.10.$form->{year}";
1221 $form->{duetyp} eq "11" && do {
1222 $form->{fromdate} = "1.11.$form->{year}";
1223 $form->{todate} = "30.11.$form->{year}";
1226 $form->{duetyp} eq "12" && do {
1227 $form->{fromdate} = "1.12.$form->{year}";
1228 $form->{todate} = "31.12.$form->{year}";
1234 RP->income_statement(\%myconfig, \%$form);
1236 ($form->{department}) = split /--/, $form->{department};
1239 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1240 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
1242 # if there are any dates construct a where
1243 if ($form->{fromdate} || $form->{todate}) {
1245 unless ($form->{todate}) {
1246 $form->{todate} = $form->current_date(\%myconfig);
1249 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
1250 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
1252 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1253 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
1255 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
1257 $locale->text('for Period')
1258 . qq|<br>\n$longfromdate |
1259 . $locale->text('Bis')
1263 if ($form->{comparefromdate} || $form->{comparetodate}) {
1264 $longcomparefromdate =
1265 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
1266 $shortcomparefromdate =
1267 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
1269 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
1270 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
1272 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
1274 "<br>\n$longcomparefromdate "
1275 . $locale->text('Bis')
1276 . qq| $longcomparetodate|;
1279 # setup variables for the form
1280 @a = qw(company address businessnumber);
1281 map { $form->{$_} = $myconfig{$_} } @a;
1282 $form->{address} =~ s/\\n/<br>/g;
1284 $form->{templates} = $myconfig{templates};
1286 $form->{IN} = "income_statement.html";
1288 $form->parse_template;
1290 $lxdebug->leave_sub();
1293 sub generate_balance_sheet {
1294 $lxdebug->enter_sub();
1296 $form->{padding} = " ";
1297 $form->{bold} = "<b>";
1298 $form->{endbold} = "</b>";
1299 $form->{br} = "<br>";
1301 RP->balance_sheet(\%myconfig, \%$form);
1303 $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
1305 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1307 ($form->{department}) = split /--/, $form->{department};
1309 # define Current Earnings account
1310 $padding = ($form->{l_heading}) ? $form->{padding} : "";
1311 push(@{ $form->{equity_account} },
1312 $padding . $locale->text('Current Earnings'));
1314 $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
1315 $form->{last_period} =
1316 $locale->date(\%myconfig, $form->{compareasofdate}, 0);
1318 $form->{IN} = "balance_sheet.html";
1320 # setup company variables for the form
1321 map { $form->{$_} = $myconfig{$_} }
1322 (qw(company address businessnumber nativecurr));
1323 $form->{address} =~ s/\\n/<br>/g;
1325 $form->{templates} = $myconfig{templates};
1327 $form->parse_template;
1329 $lxdebug->leave_sub();
1332 sub generate_projects {
1333 $lxdebug->enter_sub();
1335 &get_project(generate_projects);
1336 $form->{projectnumber} = $form->{projectnumber_1};
1338 $form->{nextsub} = "generate_projects";
1339 $form->{title} = $locale->text('Project Transactions');
1340 RP->trial_balance(\%myconfig, \%$form);
1344 $lxdebug->leave_sub();
1350 # included links to display transactions for period entered
1351 # added headers and subtotals
1353 sub generate_trial_balance {
1354 $lxdebug->enter_sub();
1356 # get for each account initial balance, debits and credits
1357 RP->trial_balance(\%myconfig, \%$form);
1359 $form->{nextsub} = "generate_trial_balance";
1360 $form->{title} = $locale->text('Trial Balance');
1363 $lxdebug->leave_sub();
1367 $lxdebug->enter_sub();
1369 $title = $form->escape($form->{title});
1371 if ($form->{department}) {
1372 ($department) = split /--/, $form->{department};
1373 $options = $locale->text('Department') . " : $department<br>";
1374 $department = $form->escape($form->{department});
1376 if ($form->{projectnumber}) {
1378 $locale->text('Project Number') . " : $form->{projectnumber}<br>";
1379 $projectnumber = $form->escape($form->{projectnumber});
1382 # if there are any dates
1383 if ($form->{fromdate} || $form->{todate}) {
1384 if ($form->{fromdate}) {
1385 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1387 if ($form->{todate}) {
1388 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1391 $form->{period} = "$fromdate - $todate";
1394 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1397 $options .= $form->{period};
1399 @column_index = qw(accno description begbalance debit credit endbalance);
1401 $column_header{accno} =
1402 qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
1403 $column_header{description} =
1404 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1405 $column_header{debit} =
1406 qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
1407 $column_header{credit} =
1408 qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
1409 $column_header{begbalance} =
1410 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1411 $column_header{endbalance} =
1412 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1414 if ($form->{accounttype} eq 'gifi') {
1415 $column_header{accno} =
1416 qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>|;
1426 <th class=listtop>$form->{title}</th>
1428 <tr height="5"></tr>
1437 map { print "$column_header{$_}\n" } @column_index;
1443 # sort the whole thing by account numbers and display
1444 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
1446 $description = $form->escape($ref->{description});
1449 qq|ca.pl?path=$form->{path}&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}|;
1451 if ($form->{accounttype} eq 'gifi') {
1452 $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description";
1453 $na = $locale->text('N/A');
1454 map { $ref->{$_} = $na } qw(accno description) unless $ref->{accno};
1456 $href .= "&accno=$ref->{accno}&description=$description";
1459 $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
1461 $debit = $form->format_amount(\%myconfig, $ref->{debit}, 2, " ");
1462 $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
1464 $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
1466 $form->format_amount(\%myconfig,
1467 ($ref->{balance} + $ref->{amount}) * $ml,
1470 # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
1472 if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
1473 map { $column_data{$_} = "<th> </th>" }
1474 qw(accno begbalance endbalance);
1476 $subtotalbegbalance =
1477 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1478 $subtotalendbalance =
1479 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1481 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1483 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1485 $column_data{description} = "<th>$subtotaldescription</th>";
1486 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1487 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1488 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1489 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1492 <tr class=listsubtotal>
1494 map { print "$column_data{$_}\n" } @column_index;
1501 if ($ref->{charttype} eq "H") {
1503 $subtotaldescription = $ref->{description};
1504 $subtotaldebit = $ref->{debit};
1505 $subtotalcredit = $ref->{credit};
1506 $subtotalbegbalance = 0;
1507 $subtotalendbalance = 0;
1509 next unless $form->{l_heading};
1511 map { $column_data{$_} = "<th> </th>" }
1512 qw(accno debit credit begbalance endbalance);
1513 $column_data{description} =
1514 "<th class=listheading>$ref->{description}</th>";
1517 if ($ref->{charttype} eq "A") {
1518 $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
1519 $column_data{description} = "<td>$ref->{description}</td>";
1520 $column_data{debit} = "<td align=right>$debit</td>";
1521 $column_data{credit} = "<td align=right>$credit</td>";
1522 $column_data{begbalance} = "<td align=right>$begbalance</td>";
1523 $column_data{endbalance} = "<td align=right>$endbalance</td>";
1525 $totaldebit += $ref->{debit};
1526 $totalcredit += $ref->{credit};
1528 $subtotalbegbalance += $ref->{balance} * $ml;
1529 $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
1533 if ($ref->{charttype} eq "H") {
1535 <tr class=listheading>
1538 if ($ref->{charttype} eq "A") {
1542 <tr class=listrow$i>
1546 map { print "$column_data{$_}\n" } @column_index;
1553 # print last subtotal
1554 if ($subtotal && $form->{l_subtotal}) {
1555 map { $column_data{$_} = "<th> </th>" }
1556 qw(accno begbalance endbalance);
1557 $subtotalbegbalance =
1558 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1559 $subtotalendbalance =
1560 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1562 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1564 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1565 $column_data{description} = "<th>$subdescription</th>";
1566 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1567 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1568 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1569 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1572 <tr class=listsubtotal>
1574 map { print "$column_data{$_}\n" } @column_index;
1581 $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
1582 $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
1584 map { $column_data{$_} = "<th> </th>" }
1585 qw(accno description begbalance endbalance);
1587 $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
1588 $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
1591 <tr class=listtotal>
1594 map { print "$column_data{$_}\n" } @column_index;
1602 <td><hr size=3 noshade></td>
1610 $lxdebug->leave_sub();
1613 sub generate_ar_aging {
1614 $lxdebug->enter_sub();
1617 ($form->{customer}) = split(/--/, $form->{customer});
1618 $customer = $form->escape($form->{customer}, 1);
1619 $title = $form->escape($form->{title}, 1);
1621 $form->{ct} = "customer";
1622 $form->{arap} = "ar";
1625 qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
1627 RP->aging(\%myconfig, \%$form);
1630 $lxdebug->leave_sub();
1633 sub generate_ap_aging {
1634 $lxdebug->enter_sub();
1637 ($form->{vendor}) = split(/--/, $form->{vendor});
1638 $vendor = $form->escape($form->{vendor}, 1);
1639 $title = $form->escape($form->{title}, 1);
1641 $form->{ct} = "vendor";
1642 $form->{arap} = "ap";
1645 qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
1647 RP->aging(\%myconfig, \%$form);
1650 $lxdebug->leave_sub();
1654 $lxdebug->enter_sub();
1658 $column_header{statement} = qq|<th> </th>|;
1659 $column_header{ct} =
1660 qq|<th class=listheading>|
1661 . $locale->text(ucfirst $form->{ct})
1663 $column_header{invnumber} =
1664 qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
1665 $column_header{transdate} =
1666 qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
1667 $column_header{duedate} =
1668 qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
1669 $column_header{c0} =
1670 qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
1671 $column_header{c30} = qq|<th class=listheading>30</th>|;
1672 $column_header{c60} = qq|<th class=listheading>60</th>|;
1673 $column_header{c90} = qq|<th class=listheading>90</th>|;
1676 (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
1678 if ($form->{department}) {
1679 $option .= "\n<br>" if $option;
1680 ($department) = split /--/, $form->{department};
1681 $option .= $locale->text('Department') . " : $department";
1682 $department = $form->escape($form->{department}, 1);
1683 $form->{callback} .= "&department=$department";
1686 if ($form->{arap} eq 'ar') {
1687 if ($form->{customer}) {
1688 $option .= "\n<br>" if $option;
1689 $option .= $form->{customer};
1692 if ($form->{arap} eq 'ap') {
1693 shift @column_index;
1694 if ($form->{vendor}) {
1695 $option .= "\n<br>" if $option;
1696 $option .= $form->{vendor};
1700 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1701 $option .= "\n<br>" if $option;
1703 $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
1708 <form method=post action=$form->{script}>
1712 <th class=listtop>$form->{title}</th>
1714 <tr height="5"></tr>
1721 <tr class=listheading>
1724 map { print "$column_header{$_}\n" } @column_index;
1734 foreach $ref (@{ $form->{AG} }) {
1736 if ($ctid != $ref->{ctid}) {
1742 $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1744 $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1746 $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1748 $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1751 $column_data{ct} = qq|<th> </th>|;
1752 $column_data{invnumber} = qq|<th> </th>|;
1753 $column_data{transdate} = qq|<th> </th>|;
1754 $column_data{duedate} = qq|<th> </th>|;
1756 qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1758 qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1760 qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1762 qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1768 <tr class=listsubtotal>
1771 map { print "$column_data{$_}\n" } @column_index;
1773 $column_data{statement} = qq|<td> </td>|;
1787 $column_data{ct} = qq|<td>$ref->{name}</td>|;
1788 $column_data{statement} =
1789 qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
1790 <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
1794 $c0subtotal += $ref->{c0};
1795 $c30subtotal += $ref->{c30};
1796 $c60subtotal += $ref->{c60};
1797 $c90subtotal += $ref->{c90};
1799 $c0total += $ref->{c0};
1800 $c30total += $ref->{c30};
1801 $c60total += $ref->{c60};
1802 $c90total += $ref->{c90};
1804 $ref->{c0} = $form->format_amount(\%myconfig, $ref->{c0}, 2, " ");
1805 $ref->{c30} = $form->format_amount(\%myconfig, $ref->{c30}, 2, " ");
1806 $ref->{c60} = $form->format_amount(\%myconfig, $ref->{c60}, 2, " ");
1807 $ref->{c90} = $form->format_amount(\%myconfig, $ref->{c90}, 2, " ");
1810 qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
1811 . $form->escape($form->{callback});
1813 $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
1814 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
1815 $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
1816 $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
1817 $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
1818 $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
1819 $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
1824 <tr class=listrow$j>
1827 map { print "$column_data{$_}\n" } @column_index;
1833 $column_data{ct} = qq|<td> </td>|;
1834 $column_data{statement} = qq|<td> </td>|;
1836 $ctid = $ref->{ctid};
1841 $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1842 $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1843 $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1844 $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1847 <tr class=listsubtotal>
1850 map { $column_data{$_} = qq|<th> </th>| } @column_index;
1852 $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1853 $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1854 $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1855 $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1857 map { print "$column_data{$_}\n" } @column_index;
1861 <tr class=listtotal>
1864 $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
1865 $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
1866 $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
1867 $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
1869 $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
1870 $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
1871 $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
1872 $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
1874 map { print "$column_data{$_}\n" } @column_index;
1877 <input type=hidden name=rowcount value=$i>
1886 &print_options if ($form->{arap} eq 'ar');
1892 <td><hr size=3 noshade></td>
1897 if ($form->{arap} eq 'ar') {
1899 <input type=hidden name=todate value=$form->{todate}>
1901 <input type=hidden name=title value="$form->{title}">
1903 <input type=hidden name=arap value=$form->{arap}>
1904 <input type=hidden name=ct value=$form->{ct}>
1905 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
1907 <input type=hidden name=department value="$form->{department}">
1909 <input type=hidden name=path value=$form->{path}>
1910 <input type=hidden name=login value=$form->{login}>
1911 <input type=hidden name=password value=$form->{password}>
1914 <input class=submit type=submit name=action value="|
1915 . $locale->text('Select all') . qq|">
1916 <input class=submit type=submit name=action value="|
1917 . $locale->text('Print') . qq|">
1918 <input class=submit type=submit name=action value="|
1919 . $locale->text('E-mail') . qq|">
1923 if ($form->{menubar}) {
1924 require "$form->{path}/menu.pl";
1935 $lxdebug->leave_sub();
1939 $lxdebug->enter_sub();
1941 RP->aging(\%myconfig, \%$form);
1943 map { $_->{checked} = "checked" } @{ $form->{AG} };
1947 $lxdebug->leave_sub();
1951 $lxdebug->enter_sub();
1953 $form->{sendmode} = "attachment";
1954 $form->{copies} = 2 unless $form->{copies};
1956 $form->{PD}{ $form->{type} } = "selected";
1957 $form->{DF}{ $form->{format} } = "selected";
1958 $form->{OP}{ $form->{media} } = "selected";
1959 $form->{SM}{ $form->{sendmode} } = "selected";
1962 <option value=statement $form->{PD}{statement}>|
1963 . $locale->text('Statement');
1965 if ($form->{media} eq 'email') {
1967 <option value=attachment $form->{SM}{attachment}>|
1968 . $locale->text('Attachment') . qq|
1969 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
1972 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1973 if ($myconfig{printer} && $latex) {
1975 <option value=printer $form->{OP}{printer}>|
1976 . $locale->text('Printer');
1982 <option value=postscript $form->{DF}{postscript}>|
1983 . $locale->text('Postscript') . qq|
1984 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
1990 <td><select name=type>$type</select></td>
1991 <td><select name=format>$format</select></td>
1992 <td><select name=media>$media</select></td>
1995 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
1997 <td>| . $locale->text('Copies') . qq|
1998 <input name=copies size=2 value=$form->{copies}></td>
2007 $lxdebug->leave_sub();
2011 $lxdebug->enter_sub();
2013 # get name and email addresses
2014 for $i (1 .. $form->{rowcount}) {
2015 if ($form->{"statement_$i"}) {
2016 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
2017 RP->get_customer(\%myconfig, \%$form);
2023 $form->error($locale->text('Nothing selected!')) unless $selected;
2025 if ($myconfig{role} eq 'admin') {
2027 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
2028 <td><input name=bcc size=30 value="$form->{bcc}"></td>
2032 $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
2034 $form->{media} = "email";
2041 <form method=post action=$form->{script}>
2047 <tr height="5"></tr>
2052 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
2053 <td><input name=email size=30 value="$form->{email}"></td>
2054 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
2055 <td><input name=cc size=30 value="$form->{cc}"></td>
2058 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
2059 <td><input name=subject size=30 value="$form->{subject}"></td>
2069 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
2072 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
2083 map { delete $form->{$_} }
2084 qw(action email cc bcc subject message type sendmode format header);
2086 # save all other variables
2087 foreach $key (keys %$form) {
2088 $form->{$key} =~ s/\"/"/g;
2089 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2096 <td><hr size=3 noshade></td>
2100 <input type=hidden name=nextsub value=send_email>
2103 <input name=action class=submit type=submit value="|
2104 . $locale->text('Continue') . qq|">
2111 $lxdebug->leave_sub();
2115 $lxdebug->enter_sub();
2117 $form->{OUT} = "$sendmail";
2119 $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
2120 unless $form->{subject};
2122 RP->aging(\%myconfig, \%$form);
2124 $form->{"statement_1"} = 1;
2129 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
2131 $lxdebug->leave_sub();
2135 $lxdebug->enter_sub();
2137 if ($form->{media} eq 'printer') {
2138 $form->error($locale->text('Select postscript or PDF!'))
2139 if ($form->{format} !~ /(postscript|pdf)/);
2142 for $i (1 .. $form->{rowcount}) {
2143 if ($form->{"statement_$i"}) {
2144 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
2150 $form->error($locale->text('Nothing selected!')) unless $selected;
2152 if ($form->{media} eq 'printer') {
2153 $form->{OUT} = "| $myconfig{printer}";
2154 $form->{"$form->{ct}_id"} = "";
2156 $form->{"statement_1"} = 1;
2159 RP->aging(\%myconfig, \%$form);
2163 $form->redirect($locale->text('Statements sent to printer!'))
2164 if ($form->{media} eq 'printer');
2166 $lxdebug->leave_sub();
2170 $lxdebug->enter_sub();
2172 $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
2174 $form->{templates} = "$myconfig{templates}";
2176 # setup variables for the form
2177 @a = qw(company address businessnumber tel fax);
2178 map { $form->{$_} = $myconfig{$_} } @a;
2179 $form->format_string(@a);
2181 $form->{IN} = "$form->{type}.html";
2183 if ($form->{format} eq 'postscript') {
2184 $form->{postscript} = 1;
2185 $form->{IN} =~ s/html$/tex/;
2187 if ($form->{format} eq 'pdf') {
2189 $form->{IN} =~ s/html$/tex/;
2193 while (@{ $form->{AG} }) {
2195 $ref = shift @{ $form->{AG} };
2197 if ($ctid != $ref->{ctid}) {
2199 $ctid = $ref->{ctid};
2202 if ($form->{"statement_$i"}) {
2205 (name, street, zipcode, city, country, contact, email,
2206 "$form->{ct}phone", "$form->{ct}fax");
2207 map { $form->{$_} = $ref->{$_} } @a;
2208 $form->format_string(@a);
2210 $form->{ $form->{ct} } = $form->{name};
2211 $form->{"$form->{ct}_id"} = $ref->{ctid};
2213 map { $form->{$_} = () } qw(invnumber invdate duedate);
2215 foreach $item (qw(c0 c30 c60 c90)) {
2216 $form->{$item} = ();
2217 $form->{"${item}total"} = 0;
2220 &statement_details($ref);
2224 if (scalar(@{ $form->{AG} }) > 0) {
2226 # one or more left to go
2227 if ($ctid == $form->{AG}->[0]->{ctid}) {
2228 $ref = shift @{ $form->{AG} };
2229 &statement_details($ref);
2232 $ref = scalar(@{ $form->{AG} });
2238 # set initial ref to 0
2245 $form->{"${_}total"} =
2246 $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
2247 } (c0, c30, c60, c90, "");
2249 $form->parse_template(\%myconfig, $userspath);
2255 $lxdebug->leave_sub();
2258 sub statement_details {
2259 $lxdebug->enter_sub();
2262 push @{ $form->{invnumber} }, $ref->{invnumber};
2263 push @{ $form->{invdate} }, $ref->{transdate};
2264 push @{ $form->{duedate} }, $ref->{duedate};
2266 foreach $item (qw(c0 c30 c60 c90)) {
2269 $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
2271 $form->{"${item}total"} += $ref->{$item};
2272 $form->{total} += $ref->{$item};
2273 push @{ $form->{$item} },
2274 $form->format_amount(\%myconfig, $ref->{$item}, 2);
2277 $lxdebug->leave_sub();
2280 sub generate_tax_report {
2281 $lxdebug->enter_sub();
2283 RP->tax_report(\%myconfig, \%$form);
2285 $descvar = "$form->{accno}_description";
2286 $description = $form->escape($form->{$descvar});
2287 $ratevar = "$form->{accno}_rate";
2289 if ($form->{accno} =~ /^gifi_/) {
2290 $descvar = "gifi_$form->{accno}_description";
2291 $description = $form->escape($form->{$descvar});
2292 $ratevar = "gifi_$form->{accno}_rate";
2295 $department = $form->escape($form->{department});
2299 "$form->{script}?path=$form->{path}&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}";
2301 # construct callback
2302 $description = $form->escape($form->{$descvar}, 1);
2303 $department = $form->escape($form->{department}, 1);
2305 "$form->{script}?path=$form->{path}&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}";
2307 $form->{title} = $locale->text('GIFI') . " - "
2308 if ($form->{accno} =~ /^gifi_/);
2310 $title = $form->escape($form->{title});
2311 $href .= "&title=$title";
2312 $title = $form->escape($form->{title}, 1);
2313 $callback .= "&title=$title";
2315 $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
2318 $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2320 foreach $item (@columns) {
2321 if ($form->{"l_$item"} eq "Y") {
2322 push @column_index, $item;
2324 # add column to href and callback
2325 $callback .= "&l_$item=Y";
2326 $href .= "&l_$item=Y";
2330 if ($form->{l_subtotal} eq 'Y') {
2331 $callback .= "&l_subtotal=Y";
2332 $href .= "&l_subtotal=Y";
2335 if ($form->{department}) {
2336 ($department) = split /--/, $form->{department};
2337 $option = $locale->text('Department') . " : $department";
2340 # if there are any dates
2341 if ($form->{fromdate} || $form->{todate}) {
2342 if ($form->{fromdate}) {
2343 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
2345 if ($form->{todate}) {
2346 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
2349 $form->{period} = "$fromdate - $todate";
2352 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2355 if ($form->{db} eq 'ar') {
2356 $name = $locale->text('Customer');
2360 if ($form->{db} eq 'ap') {
2361 $name = $locale->text('Vendor');
2366 $option .= "<br>" if $option;
2367 $option .= "$form->{period}";
2369 $column_header{id} =
2370 qq|<th><a class=listheading href=$href&sort=id>|
2371 . $locale->text('ID')
2373 $column_header{invnumber} =
2374 qq|<th><a class=listheading href=$href&sort=invnumber>|
2375 . $locale->text('Invoice')
2377 $column_header{transdate} =
2378 qq|<th><a class=listheading href=$href&sort=transdate>|
2379 . $locale->text('Date')
2381 $column_header{netamount} =
2382 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
2383 $column_header{tax} =
2384 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
2385 $column_header{amount} =
2386 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
2388 $column_header{name} =
2389 qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
2398 <th class=listtop colspan=$colspan>$form->{title}</th>
2400 <tr height="5"></tr>
2407 <tr class=listheading>
2410 map { print "$column_header{$_}\n" } @column_index;
2416 # add sort and escape callback
2417 $callback = $form->escape($callback . "&sort=$form->{sort}");
2419 if (@{ $form->{TR} }) {
2420 $sameitem = $form->{TR}->[0]->{ $form->{sort} };
2423 foreach $ref (@{ $form->{TR} }) {
2425 $module = ($ref->{invoice}) ? $invoice : $arap;
2427 if ($form->{l_subtotal} eq 'Y') {
2428 if ($sameitem ne $ref->{ $form->{sort} }) {
2430 $sameitem = $ref->{ $form->{sort} };
2434 $totalnetamount += $ref->{netamount};
2435 $totaltax += $ref->{tax};
2436 $ref->{amount} = $ref->{netamount} + $ref->{tax};
2438 $subtotalnetamount += $ref->{netamount};
2439 $subtotaltax += $ref->{tax};
2442 $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2443 } qw(netamount tax amount);
2445 $column_data{id} = qq|<td>$ref->{id}</td>|;
2446 $column_data{invnumber} =
2447 qq|<td><a href=$module?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
2448 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
2449 $column_data{name} = qq|<td>$ref->{name} </td>|;
2451 map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
2452 qw(netamount tax amount);
2457 <tr class=listrow$i>
2460 map { print "$column_data{$_}\n" } @column_index;
2468 if ($form->{l_subtotal} eq 'Y') {
2472 map { $column_data{$_} = qq|<th> </th>| } @column_index;
2476 <tr class=listtotal>
2480 $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
2482 $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
2483 $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
2485 $column_data{netamount} =
2486 qq|<th class=listtotal align=right>$totalnetamount</th>|;
2487 $column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
2488 $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
2490 map { print "$column_data{$_}\n" } @column_index;
2498 <td><hr size=3 noshade></td>
2506 $lxdebug->leave_sub();
2510 $lxdebug->enter_sub();
2512 map { $column_data{$_} = "<td> </td>" } @column_index;
2514 $subtotalnetamount =
2515 $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
2516 $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
2518 $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
2521 $column_data{netamount} =
2522 "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2523 $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
2524 $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
2526 $subtotalnetamount = 0;
2530 <tr class=listsubtotal>
2532 map { print "\n$column_data{$_}" } @column_index;
2538 $lxdebug->leave_sub();
2542 $lxdebug->enter_sub();
2544 if ($form->{account}) {
2545 ($form->{paymentaccounts}) = split /--/, $form->{account};
2547 if ($form->{department}) {
2548 ($department, $form->{department_id}) = split /--/, $form->{department};
2549 $option = $locale->text('Department') . " : $department";
2552 RP->payments(\%myconfig, \%$form);
2555 $form->sort_columns(qw(transdate reference name paid source memo));
2558 $account = $form->escape($form->{account});
2559 $title = $form->escape($form->{title});
2560 $department = $form->escape($form->{department});
2561 $form->{paymentaccounts} =~ s/ /%20/g;
2562 $reference = $form->escape($form->{reference});
2563 $source = $form->escape($form->{source});
2564 $memo = $form->escape($form->{memo});
2567 "$form->{script}?path=$form->{path}&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";
2569 # construct callback
2570 $account = $form->escape($form->{account}, 1);
2571 $title = $form->escape($form->{title}, 1);
2572 $department = $form->escape($form->{department}, 1);
2573 $reference = $form->escape($form->{reference}, 1);
2574 $source = $form->escape($form->{source}, 1);
2575 $memo = $form->escape($form->{memo}, 1);
2578 "$form->{script}?path=$form->{path}&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}";
2579 $callback = $form->escape($form->{callback});
2581 $column_header{name} =
2582 "<th><a class=listheading href=$href&sort=name>"
2583 . $locale->text('Description')
2585 $column_header{reference} =
2586 "<th><a class=listheading href=$href&sort=invnumber>"
2587 . $locale->text('Reference')
2589 $column_header{transdate} =
2590 "<th><a class=listheading href=$href&sort=transdate>"
2591 . $locale->text('Date')
2593 $column_header{paid} =
2594 "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2595 $column_header{source} =
2596 "<th><a class=listheading href=$href&sort=source>"
2597 . $locale->text('Source')
2599 $column_header{memo} =
2600 "<th><a class=listheading href=$href&sort=memo>"
2601 . $locale->text('Memo')
2604 if ($form->{fromdate}) {
2605 $option .= "\n<br>" if ($option);
2607 $locale->text('From') . " "
2608 . $locale->date(\%myconfig, $form->{fromdate}, 1);
2610 if ($form->{todate}) {
2611 $option .= "\n<br>" if ($option);
2613 $locale->text('bis') . " "
2614 . $locale->date(\%myconfig, $form->{todate}, 1);
2617 @column_index = @columns;
2618 $colspan = $#column_index + 1;
2627 <th class=listtop>$form->{title}</th>
2629 <tr height="5"></tr>
2636 <tr class=listheading>
2639 map { print "\n$column_header{$_}" } @column_index;
2645 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2647 next unless @{ $form->{ $ref->{id} } };
2651 <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2655 foreach $payment (@{ $form->{ $ref->{id} } }) {
2657 $module = $payment->{module};
2658 $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2659 $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2662 qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2664 $column_data{name} = "<td>$payment->{name} </td>";
2665 $column_data{reference} =
2666 qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2667 $column_data{transdate} = "<td>$payment->{transdate} </td>";
2668 $column_data{paid} =
2670 . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
2672 $column_data{source} = "<td>$payment->{source} </td>";
2673 $column_data{memo} = "<td>$payment->{memo} </td>";
2675 $subtotalpaid += $payment->{paid};
2676 $totalpaid += $payment->{paid};
2681 <tr class=listrow$i>
2684 map { print "\n$column_data{$_}" } @column_index;
2693 map { $column_data{$_} = "<td> </td>" } @column_index;
2695 $column_data{paid} =
2696 "<th class=listsubtotal align=right>"
2697 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
2700 <tr class=listsubtotal>
2703 map { print "\n$column_data{$_}" } @column_index;
2714 map { $column_data{$_} = "<td> </td>" } @column_index;
2716 $column_data{paid} =
2717 "<th class=listtotal align=right>"
2718 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
2721 <tr class=listtotal>
2724 map { print "\n$column_data{$_}" } @column_index;
2733 <td><hr size=3 noshade></td>
2741 $lxdebug->leave_sub();
2745 $lxdebug->enter_sub();
2750 $lxdebug->leave_sub();
2759 sub winston_export {
2760 $lxdebug->enter_sub();
2761 print(STDERR "Winston Export1\n");
2764 $form->{winston} = 1;
2766 $lxdebug->leave_sub();
2770 $lxdebug->enter_sub();
2772 $form->{sendmode} = "attachment";
2773 $form->{copies} = 2 unless $form->{copies};
2775 $form->{PD}{ $form->{type} } = "selected";
2776 $form->{DF}{ $form->{format} } = "selected";
2777 $form->{OP}{ $form->{media} } = "selected";
2778 $form->{SM}{ $form->{sendmode} } = "selected";
2780 if ($form->{report} eq 'ustva') {
2782 <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
2785 <option value=statement $form->{PD}{statement}>|
2786 . $locale->text('Statement');
2789 if ($form->{media} eq 'email') {
2791 <option value=attachment $form->{SM}{attachment}>|
2792 . $locale->text('Attachment') . qq|
2793 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
2796 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2797 if ($myconfig{printer} && $latex) {
2799 <option value=printer $form->{OP}{printer}>|
2800 . $locale->text('Printer');
2806 <option value=html $form->{DF}{html}>|
2807 . $locale->text('HTML') . qq|
2808 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
2809 if ($form->{report} ne 'ustva') {
2811 <option value=postscript $form->{DF}{postscript}>|
2812 . $locale->text('Postscript');
2819 <td><select name=type>$type</select></td>
2820 <td><select name=format>$format</select></td>
2821 <td><select name=media>$media</select></td>
2824 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
2826 <td>| . $locale->text('Copies') . qq|
2827 <input name=copies size=2 value=$form->{copies}></td>
2836 $lxdebug->leave_sub();
2840 $lxdebug->enter_sub();
2841 $form->{padding} = " ";
2842 $form->{bold} = "<b>";
2843 $form->{endbold} = "</b>";
2844 $form->{br} = "<br>";
2846 # &get_project(generate_bwa);
2848 if ($form->{reporttype} eq "custom") {
2850 #forgotten the year --> thisyear
2851 if ($form->{year} !~ m/^\d\d\d\d$/) {
2852 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2858 if ($form->{duetyp} eq "13") {
2859 $form->{fromdate} = "1.1.$form->{year}";
2860 $form->{todate} = "31.12.$form->{year}";
2861 $form->{comparefromdate} = "1.01.$form->{year}";
2862 $form->{comparetodate} = "31.12.$form->{year}";
2866 if ($form->{duetyp} eq "A") {
2867 $form->{fromdate} = "1.1.$form->{year}";
2868 $form->{todate} = "31.3.$form->{year}";
2869 $form->{comparefromdate} = "1.01.$form->{year}";
2870 $form->{comparetodate} = "31.03.$form->{year}";
2872 if ($form->{duetyp} eq "B") {
2873 $form->{fromdate} = "1.4.$form->{year}";
2874 $form->{todate} = "30.6.$form->{year}";
2875 $form->{comparefromdate} = "1.01.$form->{year}";
2876 $form->{comparetodate} = "30.06.$form->{year}";
2878 if ($form->{duetyp} eq "C") {
2879 $form->{fromdate} = "1.7.$form->{year}";
2880 $form->{todate} = "30.9.$form->{year}";
2881 $form->{comparefromdate} = "1.01.$form->{year}";
2882 $form->{comparetodate} = "30.09.$form->{year}";
2884 if ($form->{duetyp} eq "D") {
2885 $form->{fromdate} = "1.10.$form->{year}";
2886 $form->{todate} = "31.12.$form->{year}";
2887 $form->{comparefromdate} = "1.01.$form->{year}";
2888 $form->{comparetodate} = "31.12.$form->{year}";
2893 $form->{duetyp} eq "1" && do {
2894 $form->{fromdate} = "1.1.$form->{year}";
2895 $form->{todate} = "31.1.$form->{year}";
2896 $form->{comparefromdate} = "1.01.$form->{year}";
2897 $form->{comparetodate} = "31.01.$form->{year}";
2900 $form->{duetyp} eq "2" && do {
2901 $form->{fromdate} = "1.2.$form->{year}";
2903 #this works from 1901 to 2099, 1900 and 2100 fail.
2904 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2905 $form->{todate} = "$leap.2.$form->{year}";
2906 $form->{comparefromdate} = "1.01.$form->{year}";
2907 $form->{comparetodate} = "$leap.02.$form->{year}";
2910 $form->{duetyp} eq "3" && do {
2911 $form->{fromdate} = "1.3.$form->{year}";
2912 $form->{todate} = "31.3.$form->{year}";
2913 $form->{comparefromdate} = "1.01.$form->{year}";
2914 $form->{comparetodate} = "31.03.$form->{year}";
2917 $form->{duetyp} eq "4" && do {
2918 $form->{fromdate} = "1.4.$form->{year}";
2919 $form->{todate} = "30.4.$form->{year}";
2920 $form->{comparefromdate} = "1.01.$form->{year}";
2921 $form->{comparetodate} = "30.04.$form->{year}";
2924 $form->{duetyp} eq "5" && do {
2925 $form->{fromdate} = "1.5.$form->{year}";
2926 $form->{todate} = "31.5.$form->{year}";
2927 $form->{comparefromdate} = "1.01.$form->{year}";
2928 $form->{comparetodate} = "31.05.$form->{year}";
2931 $form->{duetyp} eq "6" && do {
2932 $form->{fromdate} = "1.6.$form->{year}";
2933 $form->{todate} = "30.6.$form->{year}";
2934 $form->{comparefromdate} = "1.01.$form->{year}";
2935 $form->{comparetodate} = "30.06.$form->{year}";
2938 $form->{duetyp} eq "7" && do {
2939 $form->{fromdate} = "1.7.$form->{year}";
2940 $form->{todate} = "31.7.$form->{year}";
2941 $form->{comparefromdate} = "1.01.$form->{year}";
2942 $form->{comparetodate} = "31.07.$form->{year}";
2945 $form->{duetyp} eq "8" && do {
2946 $form->{fromdate} = "1.8.$form->{year}";
2947 $form->{todate} = "31.8.$form->{year}";
2948 $form->{comparefromdate} = "1.01.$form->{year}";
2949 $form->{comparetodate} = "31.08.$form->{year}";
2952 $form->{duetyp} eq "9" && do {
2953 $form->{fromdate} = "1.9.$form->{year}";
2954 $form->{todate} = "30.9.$form->{year}";
2955 $form->{comparefromdate} = "1.01.$form->{year}";
2956 $form->{comparetodate} = "30.09.$form->{year}";
2959 $form->{duetyp} eq "10" && do {
2960 $form->{fromdate} = "1.10.$form->{year}";
2961 $form->{todate} = "31.10.$form->{year}";
2962 $form->{comparefromdate} = "1.01.$form->{year}";
2963 $form->{comparetodate} = "31.10.$form->{year}";
2966 $form->{duetyp} eq "11" && do {
2967 $form->{fromdate} = "1.11.$form->{year}";
2968 $form->{todate} = "30.11.$form->{year}";
2969 $form->{comparefromdate} = "1.01.$form->{year}";
2970 $form->{comparetodate} = "30.11.$form->{year}";
2973 $form->{duetyp} eq "12" && do {
2974 $form->{fromdate} = "1.12.$form->{year}";
2975 $form->{todate} = "31.12.$form->{year}";
2976 $form->{comparefromdate} = "1.01.$form->{year}";
2977 $form->{comparetodate} = "31.12.$form->{year}";
2982 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
2983 $form->{fromdate} = "${dd}.${mm}.${yy}";
2984 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
2985 $form->{todate} = "${dd}.${mm}.${yy}";
2986 $form->{comparefromdate} = "01.01.$yy";
2987 $form->{comparetodate} = $form->{todate};
2990 RP->bwa(\%myconfig, \%$form);
2992 ($form->{department}) = split /--/, $form->{department};
2995 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2996 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
2998 # if there are any dates construct a where
2999 if ($form->{fromdate} || $form->{todate}) {
3001 unless ($form->{todate}) {
3002 $form->{todate} = $form->current_date(\%myconfig);
3005 my %germandate = ("dateformat" => "dd.mm.yyyy");
3007 $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
3008 $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
3010 $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
3011 $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
3013 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
3015 $locale->text('for Period')
3016 . qq|<br>\n$longfromdate |
3017 . $locale->text('bis')
3021 # setup variables for the form
3022 @a = qw(company address businessnumber);
3023 map { $form->{$_} = $myconfig{$_} } @a;
3024 $form->{address} =~ s/\\n/<br>/g;
3025 $form->{templates} = $myconfig{templates};
3027 $form->{IN} = "bwa.html";
3029 $form->parse_template;
3031 $lxdebug->leave_sub();
3034 sub generate_ustva {
3035 $lxdebug->enter_sub();
3037 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
3038 # Einlesen der Finanzamtdaten
3039 print(STDERR "Winston4\n");
3040 get_config($userspath, 'finanzamt.ini');
3042 # &get_project(generate_bwa);
3043 @anmeldungszeitraum =
3044 qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
3046 foreach $item (@anmeldungszeitraum) {
3047 $form->{$item} = "";
3049 print(STDERR "Winston2\n");
3050 if ($form->{reporttype} eq "custom") {
3052 #forgotten the year --> thisyear
3053 if ($form->{year} !~ m/^\d\d\d\d$/) {
3054 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
3060 if ($form->{duetyp} eq "13") {
3061 $form->{fromdate} = "1.1.$form->{year}";
3062 $form->{todate} = "31.12.$form->{year}";
3066 if ($form->{duetyp} eq "A") {
3067 $form->{fromdate} = "1.1.$form->{year}";
3068 $form->{todate} = "31.3.$form->{year}";
3069 $form->{"0441"} = "X";
3071 if ($form->{duetyp} eq "B") {
3072 $form->{fromdate} = "1.4.$form->{year}";
3073 $form->{todate} = "30.6.$form->{year}";
3074 $form->{"0442"} = "X";
3076 if ($form->{duetyp} eq "C") {
3077 $form->{fromdate} = "1.7.$form->{year}";
3078 $form->{todate} = "30.9.$form->{year}";
3079 $form->{"0443"} = "X";
3081 if ($form->{duetyp} eq "D") {
3082 $form->{fromdate} = "1.10.$form->{year}";
3083 $form->{todate} = "31.12.$form->{year}";
3084 $form->{"0444"} = "X";
3089 $form->{duetyp} eq "1" && do {
3090 $form->{fromdate} = "1.1.$form->{year}";
3091 $form->{todate} = "31.1.$form->{year}";
3092 $form->{"0401"} = "X";
3095 $form->{duetyp} eq "2" && do {
3096 $form->{fromdate} = "1.2.$form->{year}";
3098 #this works from 1901 to 2099, 1900 and 2100 fail.
3099 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
3100 $form->{todate} = "$leap.2.$form->{year}";
3101 $form->{"0402"} = "X";
3104 $form->{duetyp} eq "3" && do {
3105 $form->{fromdate} = "1.3.$form->{year}";
3106 $form->{todate} = "31.3.$form->{year}";
3107 $form->{"0403"} = "X";
3110 $form->{duetyp} eq "4" && do {
3111 $form->{fromdate} = "1.4.$form->{year}";
3112 $form->{todate} = "30.4.$form->{year}";
3113 $form->{"0404"} = "X";
3116 $form->{duetyp} eq "5" && do {
3117 $form->{fromdate} = "1.5.$form->{year}";
3118 $form->{todate} = "31.5.$form->{year}";
3119 $form->{"0405"} = "X";
3122 $form->{duetyp} eq "6" && do {
3123 $form->{fromdate} = "1.6.$form->{year}";
3124 $form->{todate} = "30.6.$form->{year}";
3125 $form->{"0406"} = "X";
3128 $form->{duetyp} eq "7" && do {
3129 $form->{fromdate} = "1.7.$form->{year}";
3130 $form->{todate} = "31.7.$form->{year}";
3131 $form->{"0407"} = "X";
3134 $form->{duetyp} eq "8" && do {
3135 $form->{fromdate} = "1.8.$form->{year}";
3136 $form->{todate} = "31.8.$form->{year}";
3137 $form->{"0408"} = "X";
3140 $form->{duetyp} eq "9" && do {
3141 $form->{fromdate} = "1.9.$form->{year}";
3142 $form->{todate} = "30.9.$form->{year}";
3143 $form->{"0409"} = "X";
3146 $form->{duetyp} eq "10" && do {
3147 $form->{fromdate} = "1.10.$form->{year}";
3148 $form->{todate} = "31.10.$form->{year}";
3149 $form->{"0410"} = "X";
3152 $form->{duetyp} eq "11" && do {
3153 $form->{fromdate} = "1.11.$form->{year}";
3154 $form->{todate} = "30.11.$form->{year}";
3155 $form->{"0411"} = "X";
3158 $form->{duetyp} eq "12" && do {
3159 $form->{fromdate} = "1.12.$form->{year}";
3160 $form->{todate} = "31.12.$form->{year}";
3161 $form->{"0412"} = "X";
3167 # $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
3168 # $form->{year}= $1;
3169 # $form->{fromdate}="1.1.$form->{year}";
3170 # $form->{todate}="31.3.$form->{year}";
3171 # $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3174 RP->ustva(\%myconfig, \%$form);
3176 ($form->{department}) = split /--/, $form->{department};
3179 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3180 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
3182 # if there are any dates construct a where
3183 if ($form->{fromdate} || $form->{todate}) {
3185 unless ($form->{todate}) {
3186 $form->{todate} = $form->current_date(\%myconfig);
3189 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
3190 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
3192 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
3193 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
3195 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
3197 $locale->text('for Period')
3198 . qq|<br>\n$longfromdate |
3199 . $locale->text('bis')
3203 if ($form->{comparefromdate} || $form->{comparetodate}) {
3204 $longcomparefromdate =
3205 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
3206 $shortcomparefromdate =
3207 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
3209 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
3210 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
3212 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
3214 "<br>\n$longcomparefromdate "
3215 . $locale->text('bis')
3216 . qq| $longcomparetodate|;
3219 $form->{Datum_heute} =
3220 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
3222 if ( $form->{format} eq 'pdf'
3223 or $form->{format} eq 'postscript') {
3224 $form->{padding} = "~~";
3225 $form->{bold} = "\textbf{";
3226 $form->{endbold} = "}";
3227 $form->{br} = '\\\\';
3229 @numbers = qw(51r 86r 97r 93r 96 43 45
3231 foreach $number (@numbers) {
3232 $form->{$number} =~ s/,/~~/g;
3235 } elsif ($form->{format} eq 'html') {
3236 $form->{padding} = " ";
3237 $form->{bold} = "<b>";
3238 $form->{endbold} = "</b>";
3239 $form->{br} = "<br>"
3243 # setup variables for the form
3244 @a = qw(company address businessnumber);
3245 map { $form->{$_} = $myconfig{$_} } @a;
3247 $form->{address} =~ s/\\n/$form->{br}/g;
3249 if ($form->{winston} eq '1') {
3250 print(STDERR "fast bei winston\n");
3254 $form->{templates} = $myconfig{templates};
3255 $form->{IN} = "$form->{type}";
3256 $form->{IN} .= '.tex'
3257 if ( $form->{format} eq 'pdf'
3258 or $form->{format} eq 'postscript');
3259 $form->{IN} .= '.html' if ($form->{format} eq 'html');
3261 $form->parse_template(\%myconfig, $userspath);
3263 # $form->parse_template;
3265 $lxdebug->leave_sub();