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 = "compareasofdate";
141 $id_1 = "compareasofdate";
143 $trigger_1 = "trigger1";
144 $name_2 = "asofdate";
146 $value_2 = "$form->{asofdate}";
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", "",
197 <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
199 <input type=button name=$name_1 id="$trigger_1" value=|
200 . $locale->text('button') . qq|>|;
202 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
204 <input type=button name=$name_2 id="$trigger_2" value=|
205 . $locale->text('button') . qq|>
210 Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
211 "$name_2", "BL", "$trigger_2");
215 # without JavaScript Calendar
218 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
221 qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
223 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
232 <form method=post action=$form->{script}>
234 <input type=hidden name=title value="$form->{title}">
238 <th class=listtop>$form->{title}</th>
247 if ($form->{report} eq "projects") {
250 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
251 <td colspan=5><input name=projectnumber size=25</td>
253 <input type=hidden name=nextsub value=generate_projects>
255 <th align=right>| . $locale->text('From') . qq|</th>
258 <th align=right>| . $locale->text('Bis') . qq|</th>
269 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
270 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
271 . $locale->text('Heading') . qq|
272 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
273 . $locale->text('Subtotal')
281 if ($form->{report} eq "income_statement") {
284 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
285 <td colspan=3><input name=projectnumber size=25</td>
287 <input type=hidden name=nextsub value=generate_income_statement>
291 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
292 . $locale->text('Customized Report')
296 <th colspan=1>| . $locale->text('Year') . qq|</th>
297 <td><input name=year size=11 title="|
298 . $locale->text('YYYY')
299 . qq|" value="$year"></td>
306 <b> | . $locale->text('Yearly') . qq|</b> </td>
307 <th align=left>| . $locale->text('Quarterly') . qq|</th>
308 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
311 <td align=right> <input name=duetyp class=radio type=radio value="13"
313 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
314 . $locale->text('Quarter')
319 <td><input name=duetyp class=radio type=radio value="1" $checked > |
320 . $locale->text('January')
325 <td><input name=duetyp class=radio type=radio value="5" $checked > |
326 . $locale->text('May')
328 <td><input name=duetyp class=radio type=radio value="9" $checked > |
329 . $locale->text('September')
334 <td align= right> </td>
335 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
336 . $locale->text('Quarter')
338 <td><input name=duetyp class=radio type=radio value="2" $checked > |
339 . $locale->text('February')
341 <td><input name=duetyp class=radio type=radio value="6" $checked > |
342 . $locale->text('June')
344 <td><input name=duetyp class=radio type=radio value="10" $checked > |
345 . $locale->text('October')
350 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
351 . $locale->text('Quarter')
353 <td><input name=duetyp class=radio type=radio value="3" $checked > |
354 . $locale->text('March')
356 <td><input name=duetyp class=radio type=radio value="7" $checked > |
357 . $locale->text('July')
359 <td><input name=duetyp class=radio type=radio value="11" $checked > |
360 . $locale->text('November')
366 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
367 . $locale->text('Quarter')
369 <td><input name=duetyp class=radio type=radio value="4" $checked > |
370 . $locale->text('April')
372 <td><input name=duetyp class=radio type=radio value="8" $checked > |
373 . $locale->text('August')
375 <td><input name=duetyp class=radio type=radio value="12" $checked > |
376 . $locale->text('December')
381 <td colspan=5><hr size=3 noshade></td>
384 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
385 . $locale->text('Free report period')
387 <td align=left colspan=4>| . $locale->text('From') . qq|
390 | . $locale->text('Bis') . qq|
396 <td colspan=5><hr size=3 noshade></td>
399 <th align=leftt>| . $locale->text('Method') . qq|</th>
400 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
401 . $locale->text('Accrual') . qq|
402 <input name=method class=radio type=radio value=cash $cash>|
403 . $locale->text('EUR')
411 if ($form->{report} eq "bwa") {
414 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
415 <td colspan=3><input name=projectnumber size=25</td>
417 <input type=hidden name=nextsub value=generate_bwa>
421 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
422 . $locale->text('Customized Report')
426 <th colspan=1>| . $locale->text('Year') . qq|</th>
427 <td><input name=year size=11 title="|
428 . $locale->text('YYYY')
429 . qq|" value="$year"></td>
436 <b> | . $locale->text('Yearly') . qq|</b> </td>
437 <th align=left>| . $locale->text('Quarterly') . qq|</th>
438 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
441 <td align=right> <input name=duetyp class=radio type=radio value="13"
443 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
444 . $locale->text('Quarter')
447 $checked = "checked";
449 <td><input name=duetyp class=radio type=radio value="1" $checked > |
450 . $locale->text('January')
455 <td><input name=duetyp class=radio type=radio value="5" $checked > |
456 . $locale->text('May')
458 <td><input name=duetyp class=radio type=radio value="9" $checked > |
459 . $locale->text('September')
464 <td align= right> </td>
465 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
466 . $locale->text('Quarter')
468 <td><input name=duetyp class=radio type=radio value="2" $checked > |
469 . $locale->text('February')
471 <td><input name=duetyp class=radio type=radio value="6" $checked > |
472 . $locale->text('June')
474 <td><input name=duetyp class=radio type=radio value="10" $checked > |
475 . $locale->text('October')
480 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
481 . $locale->text('Quarter')
483 <td><input name=duetyp class=radio type=radio value="3" $checked > |
484 . $locale->text('March')
486 <td><input name=duetyp class=radio type=radio value="7" $checked > |
487 . $locale->text('July')
489 <td><input name=duetyp class=radio type=radio value="11" $checked > |
490 . $locale->text('November')
496 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
497 . $locale->text('Quarter')
499 <td><input name=duetyp class=radio type=radio value="4" $checked > |
500 . $locale->text('April')
502 <td><input name=duetyp class=radio type=radio value="8" $checked > |
503 . $locale->text('August')
505 <td><input name=duetyp class=radio type=radio value="12" $checked > |
506 . $locale->text('December')
511 <td colspan=5><hr size=3 noshade></td>
514 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
515 . $locale->text('Free report period')
517 <td align=left colspan=4>| . $locale->text('From') . qq|
520 | . $locale->text('Bis') . qq|
526 <td colspan=5><hr size=3 noshade></td>
529 <th align=leftt>| . $locale->text('Method') . qq|</th>
530 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
531 . $locale->text('Accrual') . qq|
532 <input name=method class=radio type=radio value=cash $cash>|
533 . $locale->text('EUR')
541 if ($form->{report} eq "ustva") {
546 <input type=hidden name=nextsub value=generate_ustva>
550 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
551 . $locale->text('Zeitraum')
555 <th colspan=1>| . $locale->text('Year') . qq|</th>
556 <td><input name=year size=11 title="|
557 . $locale->text('YYYY')
558 . qq|" value="$year"></td>
565 <b> | . $locale->text('Yearly') . qq|</b> </td>
566 <th align=left>| . $locale->text('Quarterly') . qq|</th>
567 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
570 <td align=right> <input name=duetyp class=radio type=radio value="13"
572 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
573 . $locale->text('Quarter')
576 $checked = "checked";
578 <td><input name=duetyp class=radio type=radio value="1" $checked > |
579 . $locale->text('January')
584 <td><input name=duetyp class=radio type=radio value="5" $checked > |
585 . $locale->text('May')
587 <td><input name=duetyp class=radio type=radio value="9" $checked > |
588 . $locale->text('September')
593 <td align= right> </td>
594 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
595 . $locale->text('Quarter')
597 <td><input name=duetyp class=radio type=radio value="2" $checked > |
598 . $locale->text('February')
600 <td><input name=duetyp class=radio type=radio value="6" $checked > |
601 . $locale->text('June')
603 <td><input name=duetyp class=radio type=radio value="10" $checked > |
604 . $locale->text('October')
609 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
610 . $locale->text('Quarter')
612 <td><input name=duetyp class=radio type=radio value="3" $checked > |
613 . $locale->text('March')
615 <td><input name=duetyp class=radio type=radio value="7" $checked > |
616 . $locale->text('July')
618 <td><input name=duetyp class=radio type=radio value="11" $checked > |
619 . $locale->text('November')
625 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
626 . $locale->text('Quarter')
628 <td><input name=duetyp class=radio type=radio value="4" $checked > |
629 . $locale->text('April')
631 <td><input name=duetyp class=radio type=radio value="8" $checked > |
632 . $locale->text('August')
634 <td><input name=duetyp class=radio type=radio value="12" $checked > |
635 . $locale->text('December')
640 <td colspan=5><hr size=3 noshade></td>
643 <th align=left>| . $locale->text('Method') . qq|</th>
644 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
645 . $locale->text('Accrual') . qq|
646 <input name=method class=radio type=radio value=cash $cash>|
647 . $locale->text('EUR')
661 if ($form->{report} eq "balance_sheet") {
663 <input type=hidden name=nextsub value=generate_balance_sheet>
665 <th align=right>| . $locale->text('as at') . qq|</th>
670 <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
677 <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
678 <td><input name=decimalplaces size=3></td>
687 <th align=right>| . $locale->text('Method') . qq|</th>
688 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
689 . $locale->text('Accrual') . qq|
690 <input name=method class=radio type=radio value=cash $cash>|
691 . $locale->text('EUR')
696 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
697 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
698 . $locale->text('Heading') . qq|
699 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
700 . $locale->text('Subtotal') . qq|
701 <input name=l_accno class=checkbox type=checkbox value=Y> |
702 . $locale->text('Account Number')
710 if ($form->{report} eq "trial_balance") {
712 <input type=hidden name=nextsub value=generate_trial_balance>
713 <input type=hidden name=eur value=$eur>
715 <th align=right>| . $locale->text('From') . qq|</th>
720 <th align=right>| . $locale->text('Bis') . qq|</th>
733 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
734 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
735 . $locale->text('Heading') . qq|
736 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
737 . $locale->text('Subtotal') . qq|
738 <input name=all_accounts class=checkbox type=checkbox value=Y> |
739 . $locale->text('All Accounts')
747 if ($form->{report} =~ /^tax_/) {
750 $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
752 RP->get_taxaccounts(\%myconfig, \%$form);
755 <input type=hidden name=nextsub value=generate_tax_report>
757 <th align=right>| . $locale->text('From') . qq|</th>
758 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
759 <th align=right>| . $locale->text('Bis') . qq|</th>
760 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
763 <th align=right>| . $locale->text('Report for') . qq|</th>
767 $checked = "checked";
768 foreach $ref (@{ $form->{taxaccounts} }) {
771 qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
773 <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
774 <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
781 <input type=hidden name=db value=$form->{db}>
782 <input type=hidden name=sort value=transdate>
788 if (@{ $form->{gifi_taxaccounts} }) {
791 <th align=right>| . $locale->text('GIFI') . qq|</th>
795 foreach $ref (@{ $form->{gifi_taxaccounts} }) {
798 qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description}
800 <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}">
801 <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
813 <th align=right>| . $locale->text('Method') . qq|</th>
814 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
815 . $locale->text('Accrual') . qq|
816 <input name=method class=radio type=radio value=cash $cash>|
817 . $locale->text('EUR')
827 <th align=right>| . $locale->text('Include in Report') . qq|</th>
831 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
832 <td>| . $locale->text('ID') . qq|</td>
833 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
834 <td>| . $locale->text('Invoice') . qq|</td>
835 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
836 <td>| . $locale->text('Date') . qq|</td>
839 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
842 if ($form->{db} eq 'ar') {
843 print $locale->text('Customer');
845 if ($form->{db} eq 'ap') {
846 print $locale->text('Vendor');
850 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
851 <td>| . $locale->text('Amount') . qq|</td>
852 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
853 <td>| . $locale->text('Tax') . qq|</td>
854 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
855 <td>| . $locale->text('Total') . qq|</td>
858 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
859 <td>| . $locale->text('Subtotal') . qq|</td>
868 if ($form->{report} =~ /^nontaxable_/) {
871 $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
874 <input type=hidden name=nextsub value=generate_tax_report>
876 <input type=hidden name=db value=$form->{db}>
877 <input type=hidden name=sort value=transdate>
878 <input type=hidden name=report value=$form->{report}>
881 <th align=right>| . $locale->text('From') . qq|</th>
882 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
883 <th align=right>| . $locale->text('Bis') . qq|</th>
884 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
887 <th align=right>| . $locale->text('Method') . qq|</th>
888 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
889 . $locale->text('Accrual') . qq|
890 <input name=method class=radio type=radio value=cash $cash>|
891 . $locale->text('EUR')
895 <th align=right>| . $locale->text('Include in Report') . qq|</th>
899 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
900 <td>| . $locale->text('ID') . qq|</td>
901 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
902 <td>| . $locale->text('Invoice') . qq|</td>
903 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
904 <td>| . $locale->text('Date') . qq|</td>
907 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
910 if ($form->{db} eq 'ar') {
911 print $locale->text('Customer');
913 if ($form->{db} eq 'ap') {
914 print $locale->text('Vendor');
918 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
919 <td>| . $locale->text('Amount') . qq|</td>
920 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
921 <td>| . $locale->text('Total') . qq|</td>
924 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
925 <td>| . $locale->text('Subtotal') . qq|</td>
934 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
937 if ($form->{report} eq 'ar_aging') {
938 $label = $locale->text('Customer');
939 $form->{vc} = 'customer';
941 $label = $locale->text('Vendor');
942 $form->{vc} = 'vendor';
945 $nextsub = "generate_$form->{report}";
948 $form->all_vc(\%myconfig, $form->{vc},
949 ($form->{vc} eq 'customer') ? "AR" : "AP");
951 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
952 @{ $form->{"all_$form->{vc}"} };
956 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
957 : qq|<input name=$form->{vc} size=35>|;
961 <th align=right>| . $locale->text($label) . qq|</th>
965 <th align=right>| . $locale->text('Bis') . qq|</th>
971 <input type=hidden name=type value=statement>
972 <input type=hidden name=format value=html>
973 <input type=hidden name=media value=screen>
975 <input type=hidden name=nextsub value=$nextsub>
976 <input type=hidden name=action value=$nextsub>
982 # above action can be removed if there is more than one input field
984 if ($form->{report} =~ /(receipts|payments)$/) {
987 $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
989 RP->paymentaccounts(\%myconfig, \%$form);
991 $selection = "<option>\n";
992 foreach $ref (@{ $form->{PR} }) {
993 $paymentaccounts .= "$ref->{accno} ";
994 $selection .= "<option>$ref->{accno}--$ref->{description}\n";
997 chop $paymentaccounts;
1000 <input type=hidden name=nextsub value=list_payments>
1002 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
1003 <td colspan=3><select name=account>$selection</select>
1004 <input type=hidden name=paymentaccounts value="$paymentaccounts">
1008 <th align=right>| . $locale->text('Reference') . qq|</th>
1009 <td colspan=3><input name=reference></td>
1012 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
1013 <td colspan=3><input name=source></td>
1016 <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
1017 <td colspan=3><input name=memo size=30></td>
1020 <th align=right>| . $locale->text('From') . qq|</th>
1025 <th align=right>| . $locale->text('Bis') . qq|</th>
1032 <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
1033 <th align=left colspan=3>|
1034 . $locale->text('Include Exchangerate Difference')
1040 <input type=hidden name=db value=$form->{db}>
1041 <input type=hidden name=sort value=transdate>
1052 <td><hr size=3 noshade></td>
1057 <input type=hidden name=path value=$form->{path}>
1058 <input type=hidden name=login value=$form->{login}>
1059 <input type=hidden name=password value=$form->{password}>
1061 <input type=submit class=submit name=action value="|
1062 . $locale->text('Continue') . qq|">
1065 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
1066 # Einlesen der Finanzamtdaten
1067 get_config($userspath, 'finanzamt.ini');
1069 $disabled = qq|disabled="disabled"|;
1070 $disabled = '' if ($form->{elster} eq '1');
1071 if ($form->{report} eq 'ustva') {
1073 <input type=submit class=submit name=action value="|
1074 . $locale->text('debug') . qq|">
1075 <input type=submit class=submit name=action $disabled
1076 value="| . $locale->text('winston_export') . qq|">
1079 <input type=submit class=submit name=action value="|
1080 . $locale->text('config') . qq|">
1091 $lxdebug->leave_sub();
1094 sub continue { &{ $form->{nextsub} } }
1097 $lxdebug->enter_sub();
1098 my $nextsub = shift;
1100 $form->{project_id} = $form->{project_id_1};
1101 if ($form->{projectnumber} && !$form->{project_id}) {
1102 $form->{rowcount} = 1;
1104 # call this instead of update
1105 $form->{update} = $nextsub;
1106 $form->{projectnumber_1} = $form->{projectnumber};
1108 delete $form->{sort};
1111 # if there is one only, assign id
1112 $form->{project_id} = $form->{project_id_1};
1115 $lxdebug->leave_sub();
1118 sub generate_income_statement {
1119 $lxdebug->enter_sub();
1121 $form->{padding} = " ";
1122 $form->{bold} = "<b>";
1123 $form->{endbold} = "</b>";
1124 $form->{br} = "<br>";
1126 &get_project(generate_income_statement);
1128 $form->{projectnumber} = $form->{projectnumber_1};
1130 if ($form->{reporttype} eq "custom") {
1132 #forgotten the year --> thisyear
1133 if ($form->{year} !~ m/^\d\d\d\d$/) {
1134 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
1140 if ($form->{duetyp} eq "13") {
1141 $form->{fromdate} = "1.1.$form->{year}";
1142 $form->{todate} = "31.12.$form->{year}";
1146 if ($form->{duetyp} eq "A") {
1147 $form->{fromdate} = "1.1.$form->{year}";
1148 $form->{todate} = "31.3.$form->{year}";
1150 if ($form->{duetyp} eq "B") {
1151 $form->{fromdate} = "1.4.$form->{year}";
1152 $form->{todate} = "30.6.$form->{year}";
1154 if ($form->{duetyp} eq "C") {
1155 $form->{fromdate} = "1.7.$form->{year}";
1156 $form->{todate} = "30.9.$form->{year}";
1158 if ($form->{duetyp} eq "D") {
1159 $form->{fromdate} = "1.10.$form->{year}";
1160 $form->{todate} = "31.12.$form->{year}";
1165 $form->{duetyp} eq "1" && do {
1166 $form->{fromdate} = "1.1.$form->{year}";
1167 $form->{todate} = "31.1.$form->{year}";
1170 $form->{duetyp} eq "2" && do {
1171 $form->{fromdate} = "1.2.$form->{year}";
1173 #this works from 1901 to 2099, 1900 and 2100 fail.
1174 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
1175 $form->{todate} = "$leap.2.$form->{year}";
1178 $form->{duetyp} eq "3" && do {
1179 $form->{fromdate} = "1.3.$form->{year}";
1180 $form->{todate} = "31.3.$form->{year}";
1183 $form->{duetyp} eq "4" && do {
1184 $form->{fromdate} = "1.4.$form->{year}";
1185 $form->{todate} = "30.4.$form->{year}";
1188 $form->{duetyp} eq "5" && do {
1189 $form->{fromdate} = "1.5.$form->{year}";
1190 $form->{todate} = "31.5.$form->{year}";
1193 $form->{duetyp} eq "6" && do {
1194 $form->{fromdate} = "1.6.$form->{year}";
1195 $form->{todate} = "30.6.$form->{year}";
1198 $form->{duetyp} eq "7" && do {
1199 $form->{fromdate} = "1.7.$form->{year}";
1200 $form->{todate} = "31.7.$form->{year}";
1203 $form->{duetyp} eq "8" && do {
1204 $form->{fromdate} = "1.8.$form->{year}";
1205 $form->{todate} = "31.8.$form->{year}";
1208 $form->{duetyp} eq "9" && do {
1209 $form->{fromdate} = "1.9.$form->{year}";
1210 $form->{todate} = "30.9.$form->{year}";
1213 $form->{duetyp} eq "10" && do {
1214 $form->{fromdate} = "1.10.$form->{year}";
1215 $form->{todate} = "31.10.$form->{year}";
1218 $form->{duetyp} eq "11" && do {
1219 $form->{fromdate} = "1.11.$form->{year}";
1220 $form->{todate} = "30.11.$form->{year}";
1223 $form->{duetyp} eq "12" && do {
1224 $form->{fromdate} = "1.12.$form->{year}";
1225 $form->{todate} = "31.12.$form->{year}";
1231 RP->income_statement(\%myconfig, \%$form);
1233 ($form->{department}) = split /--/, $form->{department};
1236 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1237 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
1239 # if there are any dates construct a where
1240 if ($form->{fromdate} || $form->{todate}) {
1242 unless ($form->{todate}) {
1243 $form->{todate} = $form->current_date(\%myconfig);
1246 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
1247 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
1249 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1250 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
1252 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
1254 $locale->text('for Period')
1255 . qq|<br>\n$longfromdate |
1256 . $locale->text('Bis')
1260 if ($form->{comparefromdate} || $form->{comparetodate}) {
1261 $longcomparefromdate =
1262 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
1263 $shortcomparefromdate =
1264 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
1266 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
1267 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
1269 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
1271 "<br>\n$longcomparefromdate "
1272 . $locale->text('Bis')
1273 . qq| $longcomparetodate|;
1276 # setup variables for the form
1277 @a = qw(company address businessnumber);
1278 map { $form->{$_} = $myconfig{$_} } @a;
1279 $form->{address} =~ s/\\n/<br>/g;
1281 $form->{templates} = $myconfig{templates};
1283 $form->{IN} = "income_statement.html";
1285 $form->parse_template;
1287 $lxdebug->leave_sub();
1290 sub generate_balance_sheet {
1291 $lxdebug->enter_sub();
1293 $form->{padding} = " ";
1294 $form->{bold} = "<b>";
1295 $form->{endbold} = "</b>";
1296 $form->{br} = "<br>";
1298 RP->balance_sheet(\%myconfig, \%$form);
1300 $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
1302 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1304 ($form->{department}) = split /--/, $form->{department};
1306 # define Current Earnings account
1307 $padding = ($form->{l_heading}) ? $form->{padding} : "";
1308 push(@{ $form->{equity_account} },
1309 $padding . $locale->text('Current Earnings'));
1311 $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
1312 $form->{last_period} =
1313 $locale->date(\%myconfig, $form->{compareasofdate}, 0);
1315 $form->{IN} = "balance_sheet.html";
1317 # setup company variables for the form
1318 map { $form->{$_} = $myconfig{$_} }
1319 (qw(company address businessnumber nativecurr));
1320 $form->{address} =~ s/\\n/<br>/g;
1322 $form->{templates} = $myconfig{templates};
1324 $form->parse_template;
1326 $lxdebug->leave_sub();
1329 sub generate_projects {
1330 $lxdebug->enter_sub();
1332 &get_project(generate_projects);
1333 $form->{projectnumber} = $form->{projectnumber_1};
1335 $form->{nextsub} = "generate_projects";
1336 $form->{title} = $locale->text('Project Transactions');
1337 RP->trial_balance(\%myconfig, \%$form);
1341 $lxdebug->leave_sub();
1347 # included links to display transactions for period entered
1348 # added headers and subtotals
1350 sub generate_trial_balance {
1351 $lxdebug->enter_sub();
1353 # get for each account initial balance, debits and credits
1354 RP->trial_balance(\%myconfig, \%$form);
1356 $form->{nextsub} = "generate_trial_balance";
1357 $form->{title} = $locale->text('Trial Balance');
1360 $lxdebug->leave_sub();
1364 $lxdebug->enter_sub();
1366 $title = $form->escape($form->{title});
1368 if ($form->{department}) {
1369 ($department) = split /--/, $form->{department};
1370 $options = $locale->text('Department') . " : $department<br>";
1371 $department = $form->escape($form->{department});
1373 if ($form->{projectnumber}) {
1375 $locale->text('Project Number') . " : $form->{projectnumber}<br>";
1376 $projectnumber = $form->escape($form->{projectnumber});
1379 # if there are any dates
1380 if ($form->{fromdate} || $form->{todate}) {
1381 if ($form->{fromdate}) {
1382 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1384 if ($form->{todate}) {
1385 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1388 $form->{period} = "$fromdate - $todate";
1391 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1394 $options .= $form->{period};
1396 @column_index = qw(accno description begbalance debit credit endbalance);
1398 $column_header{accno} =
1399 qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
1400 $column_header{description} =
1401 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1402 $column_header{debit} =
1403 qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
1404 $column_header{credit} =
1405 qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
1406 $column_header{begbalance} =
1407 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1408 $column_header{endbalance} =
1409 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1411 if ($form->{accounttype} eq 'gifi') {
1412 $column_header{accno} =
1413 qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>|;
1423 <th class=listtop>$form->{title}</th>
1425 <tr height="5"></tr>
1434 map { print "$column_header{$_}\n" } @column_index;
1440 # sort the whole thing by account numbers and display
1441 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
1443 $description = $form->escape($ref->{description});
1446 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}|;
1448 if ($form->{accounttype} eq 'gifi') {
1449 $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description";
1450 $na = $locale->text('N/A');
1451 map { $ref->{$_} = $na } qw(accno description) unless $ref->{accno};
1453 $href .= "&accno=$ref->{accno}&description=$description";
1456 $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
1458 $debit = $form->format_amount(\%myconfig, $ref->{debit}, 2, " ");
1459 $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
1461 $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
1463 $form->format_amount(\%myconfig,
1464 ($ref->{balance} + $ref->{amount}) * $ml,
1467 # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
1469 if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
1470 map { $column_data{$_} = "<th> </th>" }
1471 qw(accno begbalance endbalance);
1473 $subtotalbegbalance =
1474 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1475 $subtotalendbalance =
1476 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1478 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1480 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1482 $column_data{description} = "<th>$subtotaldescription</th>";
1483 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1484 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1485 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1486 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1489 <tr class=listsubtotal>
1491 map { print "$column_data{$_}\n" } @column_index;
1498 if ($ref->{charttype} eq "H") {
1500 $subtotaldescription = $ref->{description};
1501 $subtotaldebit = $ref->{debit};
1502 $subtotalcredit = $ref->{credit};
1503 $subtotalbegbalance = 0;
1504 $subtotalendbalance = 0;
1506 next unless $form->{l_heading};
1508 map { $column_data{$_} = "<th> </th>" }
1509 qw(accno debit credit begbalance endbalance);
1510 $column_data{description} =
1511 "<th class=listheading>$ref->{description}</th>";
1514 if ($ref->{charttype} eq "A") {
1515 $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
1516 $column_data{description} = "<td>$ref->{description}</td>";
1517 $column_data{debit} = "<td align=right>$debit</td>";
1518 $column_data{credit} = "<td align=right>$credit</td>";
1519 $column_data{begbalance} = "<td align=right>$begbalance</td>";
1520 $column_data{endbalance} = "<td align=right>$endbalance</td>";
1522 $totaldebit += $ref->{debit};
1523 $totalcredit += $ref->{credit};
1525 $subtotalbegbalance += $ref->{balance} * $ml;
1526 $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
1530 if ($ref->{charttype} eq "H") {
1532 <tr class=listheading>
1535 if ($ref->{charttype} eq "A") {
1539 <tr class=listrow$i>
1543 map { print "$column_data{$_}\n" } @column_index;
1550 # print last subtotal
1551 if ($subtotal && $form->{l_subtotal}) {
1552 map { $column_data{$_} = "<th> </th>" }
1553 qw(accno begbalance endbalance);
1554 $subtotalbegbalance =
1555 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1556 $subtotalendbalance =
1557 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1559 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1561 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1562 $column_data{description} = "<th>$subdescription</th>";
1563 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1564 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1565 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1566 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1569 <tr class=listsubtotal>
1571 map { print "$column_data{$_}\n" } @column_index;
1578 $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
1579 $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
1581 map { $column_data{$_} = "<th> </th>" }
1582 qw(accno description begbalance endbalance);
1584 $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
1585 $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
1588 <tr class=listtotal>
1591 map { print "$column_data{$_}\n" } @column_index;
1599 <td><hr size=3 noshade></td>
1607 $lxdebug->leave_sub();
1610 sub generate_ar_aging {
1611 $lxdebug->enter_sub();
1614 ($form->{customer}) = split(/--/, $form->{customer});
1615 $customer = $form->escape($form->{customer}, 1);
1616 $title = $form->escape($form->{title}, 1);
1618 $form->{ct} = "customer";
1619 $form->{arap} = "ar";
1622 qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
1624 RP->aging(\%myconfig, \%$form);
1627 $lxdebug->leave_sub();
1630 sub generate_ap_aging {
1631 $lxdebug->enter_sub();
1634 ($form->{vendor}) = split(/--/, $form->{vendor});
1635 $vendor = $form->escape($form->{vendor}, 1);
1636 $title = $form->escape($form->{title}, 1);
1638 $form->{ct} = "vendor";
1639 $form->{arap} = "ap";
1642 qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
1644 RP->aging(\%myconfig, \%$form);
1647 $lxdebug->leave_sub();
1651 $lxdebug->enter_sub();
1655 $column_header{statement} = qq|<th> </th>|;
1656 $column_header{ct} =
1657 qq|<th class=listheading>|
1658 . $locale->text(ucfirst $form->{ct})
1660 $column_header{invnumber} =
1661 qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
1662 $column_header{transdate} =
1663 qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
1664 $column_header{duedate} =
1665 qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
1666 $column_header{c0} =
1667 qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
1668 $column_header{c30} = qq|<th class=listheading>30</th>|;
1669 $column_header{c60} = qq|<th class=listheading>60</th>|;
1670 $column_header{c90} = qq|<th class=listheading>90</th>|;
1673 (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
1675 if ($form->{department}) {
1676 $option .= "\n<br>" if $option;
1677 ($department) = split /--/, $form->{department};
1678 $option .= $locale->text('Department') . " : $department";
1679 $department = $form->escape($form->{department}, 1);
1680 $form->{callback} .= "&department=$department";
1683 if ($form->{arap} eq 'ar') {
1684 if ($form->{customer}) {
1685 $option .= "\n<br>" if $option;
1686 $option .= $form->{customer};
1689 if ($form->{arap} eq 'ap') {
1690 shift @column_index;
1691 if ($form->{vendor}) {
1692 $option .= "\n<br>" if $option;
1693 $option .= $form->{vendor};
1697 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1698 $option .= "\n<br>" if $option;
1700 $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
1705 <form method=post action=$form->{script}>
1709 <th class=listtop>$form->{title}</th>
1711 <tr height="5"></tr>
1718 <tr class=listheading>
1721 map { print "$column_header{$_}\n" } @column_index;
1731 foreach $ref (@{ $form->{AG} }) {
1733 if ($ctid != $ref->{ctid}) {
1739 $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1741 $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1743 $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1745 $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1748 $column_data{ct} = qq|<th> </th>|;
1749 $column_data{invnumber} = qq|<th> </th>|;
1750 $column_data{transdate} = qq|<th> </th>|;
1751 $column_data{duedate} = qq|<th> </th>|;
1753 qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1755 qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1757 qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1759 qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1765 <tr class=listsubtotal>
1768 map { print "$column_data{$_}\n" } @column_index;
1770 $column_data{statement} = qq|<td> </td>|;
1784 $column_data{ct} = qq|<td>$ref->{name}</td>|;
1785 $column_data{statement} =
1786 qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
1787 <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
1791 $c0subtotal += $ref->{c0};
1792 $c30subtotal += $ref->{c30};
1793 $c60subtotal += $ref->{c60};
1794 $c90subtotal += $ref->{c90};
1796 $c0total += $ref->{c0};
1797 $c30total += $ref->{c30};
1798 $c60total += $ref->{c60};
1799 $c90total += $ref->{c90};
1801 $ref->{c0} = $form->format_amount(\%myconfig, $ref->{c0}, 2, " ");
1802 $ref->{c30} = $form->format_amount(\%myconfig, $ref->{c30}, 2, " ");
1803 $ref->{c60} = $form->format_amount(\%myconfig, $ref->{c60}, 2, " ");
1804 $ref->{c90} = $form->format_amount(\%myconfig, $ref->{c90}, 2, " ");
1807 qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
1808 . $form->escape($form->{callback});
1810 $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
1811 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
1812 $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
1813 $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
1814 $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
1815 $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
1816 $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
1821 <tr class=listrow$j>
1824 map { print "$column_data{$_}\n" } @column_index;
1830 $column_data{ct} = qq|<td> </td>|;
1831 $column_data{statement} = qq|<td> </td>|;
1833 $ctid = $ref->{ctid};
1838 $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1839 $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1840 $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1841 $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1844 <tr class=listsubtotal>
1847 map { $column_data{$_} = qq|<th> </th>| } @column_index;
1849 $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1850 $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1851 $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1852 $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1854 map { print "$column_data{$_}\n" } @column_index;
1858 <tr class=listtotal>
1861 $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
1862 $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
1863 $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
1864 $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
1866 $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
1867 $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
1868 $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
1869 $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
1871 map { print "$column_data{$_}\n" } @column_index;
1874 <input type=hidden name=rowcount value=$i>
1883 &print_options if ($form->{arap} eq 'ar');
1889 <td><hr size=3 noshade></td>
1894 if ($form->{arap} eq 'ar') {
1896 <input type=hidden name=todate value=$form->{todate}>
1898 <input type=hidden name=title value="$form->{title}">
1900 <input type=hidden name=arap value=$form->{arap}>
1901 <input type=hidden name=ct value=$form->{ct}>
1902 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
1904 <input type=hidden name=department value="$form->{department}">
1906 <input type=hidden name=path value=$form->{path}>
1907 <input type=hidden name=login value=$form->{login}>
1908 <input type=hidden name=password value=$form->{password}>
1911 <input class=submit type=submit name=action value="|
1912 . $locale->text('Select all') . qq|">
1913 <input class=submit type=submit name=action value="|
1914 . $locale->text('Print') . qq|">
1915 <input class=submit type=submit name=action value="|
1916 . $locale->text('E-mail') . qq|">
1920 if ($form->{menubar}) {
1921 require "$form->{path}/menu.pl";
1932 $lxdebug->leave_sub();
1936 $lxdebug->enter_sub();
1938 RP->aging(\%myconfig, \%$form);
1940 map { $_->{checked} = "checked" } @{ $form->{AG} };
1944 $lxdebug->leave_sub();
1948 $lxdebug->enter_sub();
1950 $form->{sendmode} = "attachment";
1951 $form->{copies} = 2 unless $form->{copies};
1953 $form->{PD}{ $form->{type} } = "selected";
1954 $form->{DF}{ $form->{format} } = "selected";
1955 $form->{OP}{ $form->{media} } = "selected";
1956 $form->{SM}{ $form->{sendmode} } = "selected";
1959 <option value=statement $form->{PD}{statement}>|
1960 . $locale->text('Statement');
1962 if ($form->{media} eq 'email') {
1964 <option value=attachment $form->{SM}{attachment}>|
1965 . $locale->text('Attachment') . qq|
1966 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
1969 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1970 if ($myconfig{printer} && $latex) {
1972 <option value=printer $form->{OP}{printer}>|
1973 . $locale->text('Printer');
1979 <option value=postscript $form->{DF}{postscript}>|
1980 . $locale->text('Postscript') . qq|
1981 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
1987 <td><select name=type>$type</select></td>
1988 <td><select name=format>$format</select></td>
1989 <td><select name=media>$media</select></td>
1992 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
1994 <td>| . $locale->text('Copies') . qq|
1995 <input name=copies size=2 value=$form->{copies}></td>
2004 $lxdebug->leave_sub();
2008 $lxdebug->enter_sub();
2010 # get name and email addresses
2011 for $i (1 .. $form->{rowcount}) {
2012 if ($form->{"statement_$i"}) {
2013 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
2014 RP->get_customer(\%myconfig, \%$form);
2020 $form->error($locale->text('Nothing selected!')) unless $selected;
2022 if ($myconfig{role} eq 'admin') {
2024 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
2025 <td><input name=bcc size=30 value="$form->{bcc}"></td>
2029 $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
2031 $form->{media} = "email";
2038 <form method=post action=$form->{script}>
2044 <tr height="5"></tr>
2049 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
2050 <td><input name=email size=30 value="$form->{email}"></td>
2051 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
2052 <td><input name=cc size=30 value="$form->{cc}"></td>
2055 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
2056 <td><input name=subject size=30 value="$form->{subject}"></td>
2066 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
2069 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
2080 map { delete $form->{$_} }
2081 qw(action email cc bcc subject message type sendmode format header);
2083 # save all other variables
2084 foreach $key (keys %$form) {
2085 $form->{$key} =~ s/\"/"/g;
2086 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2093 <td><hr size=3 noshade></td>
2097 <input type=hidden name=nextsub value=send_email>
2100 <input name=action class=submit type=submit value="|
2101 . $locale->text('Continue') . qq|">
2108 $lxdebug->leave_sub();
2112 $lxdebug->enter_sub();
2114 $form->{OUT} = "$sendmail";
2116 $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
2117 unless $form->{subject};
2119 RP->aging(\%myconfig, \%$form);
2121 $form->{"statement_1"} = 1;
2126 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
2128 $lxdebug->leave_sub();
2132 $lxdebug->enter_sub();
2134 if ($form->{media} eq 'printer') {
2135 $form->error($locale->text('Select postscript or PDF!'))
2136 if ($form->{format} !~ /(postscript|pdf)/);
2139 for $i (1 .. $form->{rowcount}) {
2140 if ($form->{"statement_$i"}) {
2141 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
2147 $form->error($locale->text('Nothing selected!')) unless $selected;
2149 if ($form->{media} eq 'printer') {
2150 $form->{OUT} = "| $myconfig{printer}";
2151 $form->{"$form->{ct}_id"} = "";
2153 $form->{"statement_1"} = 1;
2156 RP->aging(\%myconfig, \%$form);
2160 $form->redirect($locale->text('Statements sent to printer!'))
2161 if ($form->{media} eq 'printer');
2163 $lxdebug->leave_sub();
2167 $lxdebug->enter_sub();
2169 $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
2171 $form->{templates} = "$myconfig{templates}";
2173 # setup variables for the form
2174 @a = qw(company address businessnumber tel fax);
2175 map { $form->{$_} = $myconfig{$_} } @a;
2176 $form->format_string(@a);
2178 $form->{IN} = "$form->{type}.html";
2180 if ($form->{format} eq 'postscript') {
2181 $form->{postscript} = 1;
2182 $form->{IN} =~ s/html$/tex/;
2184 if ($form->{format} eq 'pdf') {
2186 $form->{IN} =~ s/html$/tex/;
2190 while (@{ $form->{AG} }) {
2192 $ref = shift @{ $form->{AG} };
2194 if ($ctid != $ref->{ctid}) {
2196 $ctid = $ref->{ctid};
2199 if ($form->{"statement_$i"}) {
2202 (name, street, zipcode, city, country, contact, email,
2203 "$form->{ct}phone", "$form->{ct}fax");
2204 map { $form->{$_} = $ref->{$_} } @a;
2205 $form->format_string(@a);
2207 $form->{ $form->{ct} } = $form->{name};
2208 $form->{"$form->{ct}_id"} = $ref->{ctid};
2210 map { $form->{$_} = () } qw(invnumber invdate duedate);
2212 foreach $item (qw(c0 c30 c60 c90)) {
2213 $form->{$item} = ();
2214 $form->{"${item}total"} = 0;
2217 &statement_details($ref);
2221 if (scalar(@{ $form->{AG} }) > 0) {
2223 # one or more left to go
2224 if ($ctid == $form->{AG}->[0]->{ctid}) {
2225 $ref = shift @{ $form->{AG} };
2226 &statement_details($ref);
2229 $ref = scalar(@{ $form->{AG} });
2235 # set initial ref to 0
2242 $form->{"${_}total"} =
2243 $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
2244 } (c0, c30, c60, c90, "");
2246 $form->parse_template(\%myconfig, $userspath);
2252 $lxdebug->leave_sub();
2255 sub statement_details {
2256 $lxdebug->enter_sub();
2259 push @{ $form->{invnumber} }, $ref->{invnumber};
2260 push @{ $form->{invdate} }, $ref->{transdate};
2261 push @{ $form->{duedate} }, $ref->{duedate};
2263 foreach $item (qw(c0 c30 c60 c90)) {
2266 $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
2268 $form->{"${item}total"} += $ref->{$item};
2269 $form->{total} += $ref->{$item};
2270 push @{ $form->{$item} },
2271 $form->format_amount(\%myconfig, $ref->{$item}, 2);
2274 $lxdebug->leave_sub();
2277 sub generate_tax_report {
2278 $lxdebug->enter_sub();
2280 RP->tax_report(\%myconfig, \%$form);
2282 $descvar = "$form->{accno}_description";
2283 $description = $form->escape($form->{$descvar});
2284 $ratevar = "$form->{accno}_rate";
2286 if ($form->{accno} =~ /^gifi_/) {
2287 $descvar = "gifi_$form->{accno}_description";
2288 $description = $form->escape($form->{$descvar});
2289 $ratevar = "gifi_$form->{accno}_rate";
2292 $department = $form->escape($form->{department});
2296 "$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}";
2298 # construct callback
2299 $description = $form->escape($form->{$descvar}, 1);
2300 $department = $form->escape($form->{department}, 1);
2302 "$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}";
2304 $form->{title} = $locale->text('GIFI') . " - "
2305 if ($form->{accno} =~ /^gifi_/);
2307 $title = $form->escape($form->{title});
2308 $href .= "&title=$title";
2309 $title = $form->escape($form->{title}, 1);
2310 $callback .= "&title=$title";
2312 $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
2315 $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2317 foreach $item (@columns) {
2318 if ($form->{"l_$item"} eq "Y") {
2319 push @column_index, $item;
2321 # add column to href and callback
2322 $callback .= "&l_$item=Y";
2323 $href .= "&l_$item=Y";
2327 if ($form->{l_subtotal} eq 'Y') {
2328 $callback .= "&l_subtotal=Y";
2329 $href .= "&l_subtotal=Y";
2332 if ($form->{department}) {
2333 ($department) = split /--/, $form->{department};
2334 $option = $locale->text('Department') . " : $department";
2337 # if there are any dates
2338 if ($form->{fromdate} || $form->{todate}) {
2339 if ($form->{fromdate}) {
2340 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
2342 if ($form->{todate}) {
2343 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
2346 $form->{period} = "$fromdate - $todate";
2349 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2352 if ($form->{db} eq 'ar') {
2353 $name = $locale->text('Customer');
2357 if ($form->{db} eq 'ap') {
2358 $name = $locale->text('Vendor');
2363 $option .= "<br>" if $option;
2364 $option .= "$form->{period}";
2366 $column_header{id} =
2367 qq|<th><a class=listheading href=$href&sort=id>|
2368 . $locale->text('ID')
2370 $column_header{invnumber} =
2371 qq|<th><a class=listheading href=$href&sort=invnumber>|
2372 . $locale->text('Invoice')
2374 $column_header{transdate} =
2375 qq|<th><a class=listheading href=$href&sort=transdate>|
2376 . $locale->text('Date')
2378 $column_header{netamount} =
2379 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
2380 $column_header{tax} =
2381 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
2382 $column_header{amount} =
2383 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
2385 $column_header{name} =
2386 qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
2395 <th class=listtop colspan=$colspan>$form->{title}</th>
2397 <tr height="5"></tr>
2404 <tr class=listheading>
2407 map { print "$column_header{$_}\n" } @column_index;
2413 # add sort and escape callback
2414 $callback = $form->escape($callback . "&sort=$form->{sort}");
2416 if (@{ $form->{TR} }) {
2417 $sameitem = $form->{TR}->[0]->{ $form->{sort} };
2420 foreach $ref (@{ $form->{TR} }) {
2422 $module = ($ref->{invoice}) ? $invoice : $arap;
2424 if ($form->{l_subtotal} eq 'Y') {
2425 if ($sameitem ne $ref->{ $form->{sort} }) {
2427 $sameitem = $ref->{ $form->{sort} };
2431 $totalnetamount += $ref->{netamount};
2432 $totaltax += $ref->{tax};
2433 $ref->{amount} = $ref->{netamount} + $ref->{tax};
2435 $subtotalnetamount += $ref->{netamount};
2436 $subtotaltax += $ref->{tax};
2439 $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2440 } qw(netamount tax amount);
2442 $column_data{id} = qq|<td>$ref->{id}</td>|;
2443 $column_data{invnumber} =
2444 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>|;
2445 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
2446 $column_data{name} = qq|<td>$ref->{name} </td>|;
2448 map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
2449 qw(netamount tax amount);
2454 <tr class=listrow$i>
2457 map { print "$column_data{$_}\n" } @column_index;
2465 if ($form->{l_subtotal} eq 'Y') {
2469 map { $column_data{$_} = qq|<th> </th>| } @column_index;
2473 <tr class=listtotal>
2477 $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
2479 $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
2480 $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
2482 $column_data{netamount} =
2483 qq|<th class=listtotal align=right>$totalnetamount</th>|;
2484 $column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
2485 $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
2487 map { print "$column_data{$_}\n" } @column_index;
2495 <td><hr size=3 noshade></td>
2503 $lxdebug->leave_sub();
2507 $lxdebug->enter_sub();
2509 map { $column_data{$_} = "<td> </td>" } @column_index;
2511 $subtotalnetamount =
2512 $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
2513 $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
2515 $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
2518 $column_data{netamount} =
2519 "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2520 $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
2521 $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
2523 $subtotalnetamount = 0;
2527 <tr class=listsubtotal>
2529 map { print "\n$column_data{$_}" } @column_index;
2535 $lxdebug->leave_sub();
2539 $lxdebug->enter_sub();
2541 if ($form->{account}) {
2542 ($form->{paymentaccounts}) = split /--/, $form->{account};
2544 if ($form->{department}) {
2545 ($department, $form->{department_id}) = split /--/, $form->{department};
2546 $option = $locale->text('Department') . " : $department";
2549 RP->payments(\%myconfig, \%$form);
2552 $form->sort_columns(qw(transdate reference name paid source memo));
2555 $account = $form->escape($form->{account});
2556 $title = $form->escape($form->{title});
2557 $department = $form->escape($form->{department});
2558 $form->{paymentaccounts} =~ s/ /%20/g;
2559 $reference = $form->escape($form->{reference});
2560 $source = $form->escape($form->{source});
2561 $memo = $form->escape($form->{memo});
2564 "$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";
2566 # construct callback
2567 $account = $form->escape($form->{account}, 1);
2568 $title = $form->escape($form->{title}, 1);
2569 $department = $form->escape($form->{department}, 1);
2570 $reference = $form->escape($form->{reference}, 1);
2571 $source = $form->escape($form->{source}, 1);
2572 $memo = $form->escape($form->{memo}, 1);
2575 "$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}";
2576 $callback = $form->escape($form->{callback});
2578 $column_header{name} =
2579 "<th><a class=listheading href=$href&sort=name>"
2580 . $locale->text('Description')
2582 $column_header{reference} =
2583 "<th><a class=listheading href=$href&sort=invnumber>"
2584 . $locale->text('Reference')
2586 $column_header{transdate} =
2587 "<th><a class=listheading href=$href&sort=transdate>"
2588 . $locale->text('Date')
2590 $column_header{paid} =
2591 "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2592 $column_header{source} =
2593 "<th><a class=listheading href=$href&sort=source>"
2594 . $locale->text('Source')
2596 $column_header{memo} =
2597 "<th><a class=listheading href=$href&sort=memo>"
2598 . $locale->text('Memo')
2601 if ($form->{fromdate}) {
2602 $option .= "\n<br>" if ($option);
2604 $locale->text('From') . " "
2605 . $locale->date(\%myconfig, $form->{fromdate}, 1);
2607 if ($form->{todate}) {
2608 $option .= "\n<br>" if ($option);
2610 $locale->text('bis') . " "
2611 . $locale->date(\%myconfig, $form->{todate}, 1);
2614 @column_index = @columns;
2615 $colspan = $#column_index + 1;
2624 <th class=listtop>$form->{title}</th>
2626 <tr height="5"></tr>
2633 <tr class=listheading>
2636 map { print "\n$column_header{$_}" } @column_index;
2642 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2644 next unless @{ $form->{ $ref->{id} } };
2648 <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2652 foreach $payment (@{ $form->{ $ref->{id} } }) {
2654 $module = $payment->{module};
2655 $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2656 $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2659 qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2661 $column_data{name} = "<td>$payment->{name} </td>";
2662 $column_data{reference} =
2663 qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2664 $column_data{transdate} = "<td>$payment->{transdate} </td>";
2665 $column_data{paid} =
2667 . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
2669 $column_data{source} = "<td>$payment->{source} </td>";
2670 $column_data{memo} = "<td>$payment->{memo} </td>";
2672 $subtotalpaid += $payment->{paid};
2673 $totalpaid += $payment->{paid};
2678 <tr class=listrow$i>
2681 map { print "\n$column_data{$_}" } @column_index;
2690 map { $column_data{$_} = "<td> </td>" } @column_index;
2692 $column_data{paid} =
2693 "<th class=listsubtotal align=right>"
2694 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
2697 <tr class=listsubtotal>
2700 map { print "\n$column_data{$_}" } @column_index;
2711 map { $column_data{$_} = "<td> </td>" } @column_index;
2713 $column_data{paid} =
2714 "<th class=listtotal align=right>"
2715 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
2718 <tr class=listtotal>
2721 map { print "\n$column_data{$_}" } @column_index;
2730 <td><hr size=3 noshade></td>
2738 $lxdebug->leave_sub();
2742 $lxdebug->enter_sub();
2747 $lxdebug->leave_sub();
2756 sub winston_export {
2757 $lxdebug->enter_sub();
2758 print(STDERR "Winston Export1\n");
2761 $form->{winston} = 1;
2763 $lxdebug->leave_sub();
2767 $lxdebug->enter_sub();
2769 $form->{sendmode} = "attachment";
2770 $form->{copies} = 2 unless $form->{copies};
2772 $form->{PD}{ $form->{type} } = "selected";
2773 $form->{DF}{ $form->{format} } = "selected";
2774 $form->{OP}{ $form->{media} } = "selected";
2775 $form->{SM}{ $form->{sendmode} } = "selected";
2777 if ($form->{report} eq 'ustva') {
2779 <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
2782 <option value=statement $form->{PD}{statement}>|
2783 . $locale->text('Statement');
2786 if ($form->{media} eq 'email') {
2788 <option value=attachment $form->{SM}{attachment}>|
2789 . $locale->text('Attachment') . qq|
2790 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
2793 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2794 if ($myconfig{printer} && $latex) {
2796 <option value=printer $form->{OP}{printer}>|
2797 . $locale->text('Printer');
2803 <option value=html $form->{DF}{html}>|
2804 . $locale->text('HTML') . qq|
2805 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
2806 if ($form->{report} ne 'ustva') {
2808 <option value=postscript $form->{DF}{postscript}>|
2809 . $locale->text('Postscript');
2816 <td><select name=type>$type</select></td>
2817 <td><select name=format>$format</select></td>
2818 <td><select name=media>$media</select></td>
2821 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
2823 <td>| . $locale->text('Copies') . qq|
2824 <input name=copies size=2 value=$form->{copies}></td>
2833 $lxdebug->leave_sub();
2837 $lxdebug->enter_sub();
2838 $form->{padding} = " ";
2839 $form->{bold} = "<b>";
2840 $form->{endbold} = "</b>";
2841 $form->{br} = "<br>";
2843 # &get_project(generate_bwa);
2845 if ($form->{reporttype} eq "custom") {
2847 #forgotten the year --> thisyear
2848 if ($form->{year} !~ m/^\d\d\d\d$/) {
2849 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2855 if ($form->{duetyp} eq "13") {
2856 $form->{fromdate} = "1.1.$form->{year}";
2857 $form->{todate} = "31.12.$form->{year}";
2858 $form->{comparefromdate} = "1.01.$form->{year}";
2859 $form->{comparetodate} = "31.12.$form->{year}";
2863 if ($form->{duetyp} eq "A") {
2864 $form->{fromdate} = "1.1.$form->{year}";
2865 $form->{todate} = "31.3.$form->{year}";
2866 $form->{comparefromdate} = "1.01.$form->{year}";
2867 $form->{comparetodate} = "31.03.$form->{year}";
2869 if ($form->{duetyp} eq "B") {
2870 $form->{fromdate} = "1.4.$form->{year}";
2871 $form->{todate} = "30.6.$form->{year}";
2872 $form->{comparefromdate} = "1.01.$form->{year}";
2873 $form->{comparetodate} = "30.06.$form->{year}";
2875 if ($form->{duetyp} eq "C") {
2876 $form->{fromdate} = "1.7.$form->{year}";
2877 $form->{todate} = "30.9.$form->{year}";
2878 $form->{comparefromdate} = "1.01.$form->{year}";
2879 $form->{comparetodate} = "30.09.$form->{year}";
2881 if ($form->{duetyp} eq "D") {
2882 $form->{fromdate} = "1.10.$form->{year}";
2883 $form->{todate} = "31.12.$form->{year}";
2884 $form->{comparefromdate} = "1.01.$form->{year}";
2885 $form->{comparetodate} = "31.12.$form->{year}";
2890 $form->{duetyp} eq "1" && do {
2891 $form->{fromdate} = "1.1.$form->{year}";
2892 $form->{todate} = "31.1.$form->{year}";
2893 $form->{comparefromdate} = "1.01.$form->{year}";
2894 $form->{comparetodate} = "31.01.$form->{year}";
2897 $form->{duetyp} eq "2" && do {
2898 $form->{fromdate} = "1.2.$form->{year}";
2900 #this works from 1901 to 2099, 1900 and 2100 fail.
2901 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2902 $form->{todate} = "$leap.2.$form->{year}";
2903 $form->{comparefromdate} = "1.01.$form->{year}";
2904 $form->{comparetodate} = "$leap.02.$form->{year}";
2907 $form->{duetyp} eq "3" && do {
2908 $form->{fromdate} = "1.3.$form->{year}";
2909 $form->{todate} = "31.3.$form->{year}";
2910 $form->{comparefromdate} = "1.01.$form->{year}";
2911 $form->{comparetodate} = "31.03.$form->{year}";
2914 $form->{duetyp} eq "4" && do {
2915 $form->{fromdate} = "1.4.$form->{year}";
2916 $form->{todate} = "30.4.$form->{year}";
2917 $form->{comparefromdate} = "1.01.$form->{year}";
2918 $form->{comparetodate} = "30.04.$form->{year}";
2921 $form->{duetyp} eq "5" && do {
2922 $form->{fromdate} = "1.5.$form->{year}";
2923 $form->{todate} = "31.5.$form->{year}";
2924 $form->{comparefromdate} = "1.01.$form->{year}";
2925 $form->{comparetodate} = "31.05.$form->{year}";
2928 $form->{duetyp} eq "6" && do {
2929 $form->{fromdate} = "1.6.$form->{year}";
2930 $form->{todate} = "30.6.$form->{year}";
2931 $form->{comparefromdate} = "1.01.$form->{year}";
2932 $form->{comparetodate} = "30.06.$form->{year}";
2935 $form->{duetyp} eq "7" && do {
2936 $form->{fromdate} = "1.7.$form->{year}";
2937 $form->{todate} = "31.7.$form->{year}";
2938 $form->{comparefromdate} = "1.01.$form->{year}";
2939 $form->{comparetodate} = "31.07.$form->{year}";
2942 $form->{duetyp} eq "8" && do {
2943 $form->{fromdate} = "1.8.$form->{year}";
2944 $form->{todate} = "31.8.$form->{year}";
2945 $form->{comparefromdate} = "1.01.$form->{year}";
2946 $form->{comparetodate} = "31.08.$form->{year}";
2949 $form->{duetyp} eq "9" && do {
2950 $form->{fromdate} = "1.9.$form->{year}";
2951 $form->{todate} = "30.9.$form->{year}";
2952 $form->{comparefromdate} = "1.01.$form->{year}";
2953 $form->{comparetodate} = "30.09.$form->{year}";
2956 $form->{duetyp} eq "10" && do {
2957 $form->{fromdate} = "1.10.$form->{year}";
2958 $form->{todate} = "31.10.$form->{year}";
2959 $form->{comparefromdate} = "1.01.$form->{year}";
2960 $form->{comparetodate} = "31.10.$form->{year}";
2963 $form->{duetyp} eq "11" && do {
2964 $form->{fromdate} = "1.11.$form->{year}";
2965 $form->{todate} = "30.11.$form->{year}";
2966 $form->{comparefromdate} = "1.01.$form->{year}";
2967 $form->{comparetodate} = "30.11.$form->{year}";
2970 $form->{duetyp} eq "12" && do {
2971 $form->{fromdate} = "1.12.$form->{year}";
2972 $form->{todate} = "31.12.$form->{year}";
2973 $form->{comparefromdate} = "1.01.$form->{year}";
2974 $form->{comparetodate} = "31.12.$form->{year}";
2979 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
2980 $form->{fromdate} = "${dd}.${mm}.${yy}";
2981 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
2982 $form->{todate} = "${dd}.${mm}.${yy}";
2983 $form->{comparefromdate} = "01.01.$yy";
2984 $form->{comparetodate} = $form->{todate};
2987 RP->bwa(\%myconfig, \%$form);
2989 ($form->{department}) = split /--/, $form->{department};
2992 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2993 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
2995 # if there are any dates construct a where
2996 if ($form->{fromdate} || $form->{todate}) {
2998 unless ($form->{todate}) {
2999 $form->{todate} = $form->current_date(\%myconfig);
3002 my %germandate = ("dateformat" => "dd.mm.yyyy");
3004 $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
3005 $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
3007 $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
3008 $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
3010 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
3012 $locale->text('for Period')
3013 . qq|<br>\n$longfromdate |
3014 . $locale->text('bis')
3018 # setup variables for the form
3019 @a = qw(company address businessnumber);
3020 map { $form->{$_} = $myconfig{$_} } @a;
3021 $form->{address} =~ s/\\n/<br>/g;
3022 $form->{templates} = $myconfig{templates};
3024 $form->{IN} = "bwa.html";
3026 $form->parse_template;
3028 $lxdebug->leave_sub();
3031 sub generate_ustva {
3032 $lxdebug->enter_sub();
3034 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
3035 # Einlesen der Finanzamtdaten
3036 print(STDERR "Winston4\n");
3037 get_config($userspath, 'finanzamt.ini');
3039 # &get_project(generate_bwa);
3040 @anmeldungszeitraum =
3041 qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
3043 foreach $item (@anmeldungszeitraum) {
3044 $form->{$item} = "";
3046 print(STDERR "Winston2\n");
3047 if ($form->{reporttype} eq "custom") {
3049 #forgotten the year --> thisyear
3050 if ($form->{year} !~ m/^\d\d\d\d$/) {
3051 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
3057 if ($form->{duetyp} eq "13") {
3058 $form->{fromdate} = "1.1.$form->{year}";
3059 $form->{todate} = "31.12.$form->{year}";
3063 if ($form->{duetyp} eq "A") {
3064 $form->{fromdate} = "1.1.$form->{year}";
3065 $form->{todate} = "31.3.$form->{year}";
3066 $form->{"0441"} = "X";
3068 if ($form->{duetyp} eq "B") {
3069 $form->{fromdate} = "1.4.$form->{year}";
3070 $form->{todate} = "30.6.$form->{year}";
3071 $form->{"0442"} = "X";
3073 if ($form->{duetyp} eq "C") {
3074 $form->{fromdate} = "1.7.$form->{year}";
3075 $form->{todate} = "30.9.$form->{year}";
3076 $form->{"0443"} = "X";
3078 if ($form->{duetyp} eq "D") {
3079 $form->{fromdate} = "1.10.$form->{year}";
3080 $form->{todate} = "31.12.$form->{year}";
3081 $form->{"0444"} = "X";
3086 $form->{duetyp} eq "1" && do {
3087 $form->{fromdate} = "1.1.$form->{year}";
3088 $form->{todate} = "31.1.$form->{year}";
3089 $form->{"0401"} = "X";
3092 $form->{duetyp} eq "2" && do {
3093 $form->{fromdate} = "1.2.$form->{year}";
3095 #this works from 1901 to 2099, 1900 and 2100 fail.
3096 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
3097 $form->{todate} = "$leap.2.$form->{year}";
3098 $form->{"0402"} = "X";
3101 $form->{duetyp} eq "3" && do {
3102 $form->{fromdate} = "1.3.$form->{year}";
3103 $form->{todate} = "31.3.$form->{year}";
3104 $form->{"0403"} = "X";
3107 $form->{duetyp} eq "4" && do {
3108 $form->{fromdate} = "1.4.$form->{year}";
3109 $form->{todate} = "30.4.$form->{year}";
3110 $form->{"0404"} = "X";
3113 $form->{duetyp} eq "5" && do {
3114 $form->{fromdate} = "1.5.$form->{year}";
3115 $form->{todate} = "31.5.$form->{year}";
3116 $form->{"0405"} = "X";
3119 $form->{duetyp} eq "6" && do {
3120 $form->{fromdate} = "1.6.$form->{year}";
3121 $form->{todate} = "30.6.$form->{year}";
3122 $form->{"0406"} = "X";
3125 $form->{duetyp} eq "7" && do {
3126 $form->{fromdate} = "1.7.$form->{year}";
3127 $form->{todate} = "31.7.$form->{year}";
3128 $form->{"0407"} = "X";
3131 $form->{duetyp} eq "8" && do {
3132 $form->{fromdate} = "1.8.$form->{year}";
3133 $form->{todate} = "31.8.$form->{year}";
3134 $form->{"0408"} = "X";
3137 $form->{duetyp} eq "9" && do {
3138 $form->{fromdate} = "1.9.$form->{year}";
3139 $form->{todate} = "30.9.$form->{year}";
3140 $form->{"0409"} = "X";
3143 $form->{duetyp} eq "10" && do {
3144 $form->{fromdate} = "1.10.$form->{year}";
3145 $form->{todate} = "31.10.$form->{year}";
3146 $form->{"0410"} = "X";
3149 $form->{duetyp} eq "11" && do {
3150 $form->{fromdate} = "1.11.$form->{year}";
3151 $form->{todate} = "30.11.$form->{year}";
3152 $form->{"0411"} = "X";
3155 $form->{duetyp} eq "12" && do {
3156 $form->{fromdate} = "1.12.$form->{year}";
3157 $form->{todate} = "31.12.$form->{year}";
3158 $form->{"0412"} = "X";
3164 # $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
3165 # $form->{year}= $1;
3166 # $form->{fromdate}="1.1.$form->{year}";
3167 # $form->{todate}="31.3.$form->{year}";
3168 # $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3171 RP->ustva(\%myconfig, \%$form);
3173 ($form->{department}) = split /--/, $form->{department};
3176 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3177 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
3179 # if there are any dates construct a where
3180 if ($form->{fromdate} || $form->{todate}) {
3182 unless ($form->{todate}) {
3183 $form->{todate} = $form->current_date(\%myconfig);
3186 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
3187 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
3189 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
3190 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
3192 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
3194 $locale->text('for Period')
3195 . qq|<br>\n$longfromdate |
3196 . $locale->text('bis')
3200 if ($form->{comparefromdate} || $form->{comparetodate}) {
3201 $longcomparefromdate =
3202 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
3203 $shortcomparefromdate =
3204 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
3206 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
3207 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
3209 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
3211 "<br>\n$longcomparefromdate "
3212 . $locale->text('bis')
3213 . qq| $longcomparetodate|;
3216 $form->{Datum_heute} =
3217 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
3219 if ( $form->{format} eq 'pdf'
3220 or $form->{format} eq 'postscript') {
3221 $form->{padding} = "~~";
3222 $form->{bold} = "\textbf{";
3223 $form->{endbold} = "}";
3224 $form->{br} = '\\\\';
3226 @numbers = qw(51r 86r 97r 93r 96 43 45
3228 foreach $number (@numbers) {
3229 $form->{$number} =~ s/,/~~/g;
3232 } elsif ($form->{format} eq 'html') {
3233 $form->{padding} = " ";
3234 $form->{bold} = "<b>";
3235 $form->{endbold} = "</b>";
3236 $form->{br} = "<br>"
3240 # setup variables for the form
3241 @a = qw(company address businessnumber);
3242 map { $form->{$_} = $myconfig{$_} } @a;
3244 $form->{address} =~ s/\\n/$form->{br}/g;
3246 if ($form->{winston} eq '1') {
3247 print(STDERR "fast bei winston\n");
3251 $form->{templates} = $myconfig{templates};
3252 $form->{IN} = "$form->{type}";
3253 $form->{IN} .= '.tex'
3254 if ( $form->{format} eq 'pdf'
3255 or $form->{format} eq 'postscript');
3256 $form->{IN} .= '.html' if ($form->{format} eq 'html');
3258 $form->parse_template(\%myconfig, $userspath);
3260 # $form->parse_template;
3262 $lxdebug->leave_sub();