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')
537 <th align=right colspan=4>| . $locale->text('Decimalplaces') . qq|</th>
538 <td><input name=decimalplaces size=3></td>
545 if ($form->{report} eq "ustva") {
550 <input type=hidden name=nextsub value=generate_ustva>
554 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
555 . $locale->text('Zeitraum')
559 <th colspan=1>| . $locale->text('Year') . qq|</th>
560 <td><input name=year size=11 title="|
561 . $locale->text('YYYY')
562 . qq|" value="$year"></td>
569 <b> | . $locale->text('Yearly') . qq|</b> </td>
570 <th align=left>| . $locale->text('Quarterly') . qq|</th>
571 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
574 <td align=right> <input name=duetyp class=radio type=radio value="13"
576 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
577 . $locale->text('Quarter')
580 $checked = "checked";
582 <td><input name=duetyp class=radio type=radio value="1" $checked > |
583 . $locale->text('January')
588 <td><input name=duetyp class=radio type=radio value="5" $checked > |
589 . $locale->text('May')
591 <td><input name=duetyp class=radio type=radio value="9" $checked > |
592 . $locale->text('September')
597 <td align= right> </td>
598 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
599 . $locale->text('Quarter')
601 <td><input name=duetyp class=radio type=radio value="2" $checked > |
602 . $locale->text('February')
604 <td><input name=duetyp class=radio type=radio value="6" $checked > |
605 . $locale->text('June')
607 <td><input name=duetyp class=radio type=radio value="10" $checked > |
608 . $locale->text('October')
613 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
614 . $locale->text('Quarter')
616 <td><input name=duetyp class=radio type=radio value="3" $checked > |
617 . $locale->text('March')
619 <td><input name=duetyp class=radio type=radio value="7" $checked > |
620 . $locale->text('July')
622 <td><input name=duetyp class=radio type=radio value="11" $checked > |
623 . $locale->text('November')
629 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
630 . $locale->text('Quarter')
632 <td><input name=duetyp class=radio type=radio value="4" $checked > |
633 . $locale->text('April')
635 <td><input name=duetyp class=radio type=radio value="8" $checked > |
636 . $locale->text('August')
638 <td><input name=duetyp class=radio type=radio value="12" $checked > |
639 . $locale->text('December')
644 <td colspan=5><hr size=3 noshade></td>
647 <th align=left>| . $locale->text('Method') . qq|</th>
648 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
649 . $locale->text('Accrual') . qq|
650 <input name=method class=radio type=radio value=cash $cash>|
651 . $locale->text('EUR')
665 if ($form->{report} eq "balance_sheet") {
667 <input type=hidden name=nextsub value=generate_balance_sheet>
669 <th align=right>| . $locale->text('as at') . qq|</th>
674 <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
681 <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
682 <td><input name=decimalplaces size=3></td>
691 <th align=right>| . $locale->text('Method') . qq|</th>
692 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
693 . $locale->text('Accrual') . qq|
694 <input name=method class=radio type=radio value=cash $cash>|
695 . $locale->text('EUR')
700 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
701 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
702 . $locale->text('Heading') . qq|
703 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
704 . $locale->text('Subtotal') . qq|
705 <input name=l_accno class=checkbox type=checkbox value=Y> |
706 . $locale->text('Account Number')
714 if ($form->{report} eq "trial_balance") {
716 <input type=hidden name=nextsub value=generate_trial_balance>
717 <input type=hidden name=eur value=$eur>
719 <th align=right>| . $locale->text('From') . qq|</th>
724 <th align=right>| . $locale->text('Bis') . qq|</th>
737 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
738 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
739 . $locale->text('Heading') . qq|
740 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
741 . $locale->text('Subtotal') . qq|
742 <input name=all_accounts class=checkbox type=checkbox value=Y> |
743 . $locale->text('All Accounts')
751 if ($form->{report} =~ /^tax_/) {
754 $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
756 RP->get_taxaccounts(\%myconfig, \%$form);
759 <input type=hidden name=nextsub value=generate_tax_report>
761 <th align=right>| . $locale->text('From') . qq|</th>
762 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
763 <th align=right>| . $locale->text('Bis') . qq|</th>
764 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
767 <th align=right>| . $locale->text('Report for') . qq|</th>
771 $checked = "checked";
772 foreach $ref (@{ $form->{taxaccounts} }) {
775 qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
777 <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
778 <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
785 <input type=hidden name=db value=$form->{db}>
786 <input type=hidden name=sort value=transdate>
792 if (@{ $form->{gifi_taxaccounts} }) {
795 <th align=right>| . $locale->text('GIFI') . qq|</th>
799 foreach $ref (@{ $form->{gifi_taxaccounts} }) {
802 qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description}
804 <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}">
805 <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
817 <th align=right>| . $locale->text('Method') . qq|</th>
818 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
819 . $locale->text('Accrual') . qq|
820 <input name=method class=radio type=radio value=cash $cash>|
821 . $locale->text('EUR')
831 <th align=right>| . $locale->text('Include in Report') . qq|</th>
835 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
836 <td>| . $locale->text('ID') . qq|</td>
837 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
838 <td>| . $locale->text('Invoice') . qq|</td>
839 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
840 <td>| . $locale->text('Date') . qq|</td>
843 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
846 if ($form->{db} eq 'ar') {
847 print $locale->text('Customer');
849 if ($form->{db} eq 'ap') {
850 print $locale->text('Vendor');
854 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
855 <td>| . $locale->text('Amount') . qq|</td>
856 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
857 <td>| . $locale->text('Tax') . qq|</td>
858 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
859 <td>| . $locale->text('Total') . qq|</td>
862 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
863 <td>| . $locale->text('Subtotal') . qq|</td>
872 if ($form->{report} =~ /^nontaxable_/) {
875 $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
878 <input type=hidden name=nextsub value=generate_tax_report>
880 <input type=hidden name=db value=$form->{db}>
881 <input type=hidden name=sort value=transdate>
882 <input type=hidden name=report value=$form->{report}>
885 <th align=right>| . $locale->text('From') . qq|</th>
886 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
887 <th align=right>| . $locale->text('Bis') . qq|</th>
888 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
891 <th align=right>| . $locale->text('Method') . qq|</th>
892 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
893 . $locale->text('Accrual') . qq|
894 <input name=method class=radio type=radio value=cash $cash>|
895 . $locale->text('EUR')
899 <th align=right>| . $locale->text('Include in Report') . qq|</th>
903 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
904 <td>| . $locale->text('ID') . qq|</td>
905 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
906 <td>| . $locale->text('Invoice') . qq|</td>
907 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
908 <td>| . $locale->text('Date') . qq|</td>
911 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
914 if ($form->{db} eq 'ar') {
915 print $locale->text('Customer');
917 if ($form->{db} eq 'ap') {
918 print $locale->text('Vendor');
922 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
923 <td>| . $locale->text('Amount') . qq|</td>
924 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
925 <td>| . $locale->text('Total') . qq|</td>
928 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
929 <td>| . $locale->text('Subtotal') . qq|</td>
938 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
941 if ($form->{report} eq 'ar_aging') {
942 $label = $locale->text('Customer');
943 $form->{vc} = 'customer';
945 $label = $locale->text('Vendor');
946 $form->{vc} = 'vendor';
949 $nextsub = "generate_$form->{report}";
952 $form->all_vc(\%myconfig, $form->{vc},
953 ($form->{vc} eq 'customer') ? "AR" : "AP");
955 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
956 @{ $form->{"all_$form->{vc}"} };
960 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
961 : qq|<input name=$form->{vc} size=35>|;
965 <th align=right>| . $locale->text($label) . qq|</th>
969 <th align=right>| . $locale->text('Bis') . qq|</th>
975 <input type=hidden name=type value=statement>
976 <input type=hidden name=format value=html>
977 <input type=hidden name=media value=screen>
979 <input type=hidden name=nextsub value=$nextsub>
980 <input type=hidden name=action value=$nextsub>
986 # above action can be removed if there is more than one input field
988 if ($form->{report} =~ /(receipts|payments)$/) {
991 $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
993 RP->paymentaccounts(\%myconfig, \%$form);
995 $selection = "<option>\n";
996 foreach $ref (@{ $form->{PR} }) {
997 $paymentaccounts .= "$ref->{accno} ";
998 $selection .= "<option>$ref->{accno}--$ref->{description}\n";
1001 chop $paymentaccounts;
1004 <input type=hidden name=nextsub value=list_payments>
1006 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
1007 <td colspan=3><select name=account>$selection</select>
1008 <input type=hidden name=paymentaccounts value="$paymentaccounts">
1012 <th align=right>| . $locale->text('Reference') . qq|</th>
1013 <td colspan=3><input name=reference></td>
1016 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
1017 <td colspan=3><input name=source></td>
1020 <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
1021 <td colspan=3><input name=memo size=30></td>
1024 <th align=right>| . $locale->text('From') . qq|</th>
1029 <th align=right>| . $locale->text('Bis') . qq|</th>
1036 <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
1037 <th align=left colspan=3>|
1038 . $locale->text('Include Exchangerate Difference')
1044 <input type=hidden name=db value=$form->{db}>
1045 <input type=hidden name=sort value=transdate>
1056 <td><hr size=3 noshade></td>
1061 <input type=hidden name=path value=$form->{path}>
1062 <input type=hidden name=login value=$form->{login}>
1063 <input type=hidden name=password value=$form->{password}>
1065 <input type=submit class=submit name=action value="|
1066 . $locale->text('Continue') . qq|">
1069 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
1070 # Einlesen der Finanzamtdaten
1071 get_config($userspath, 'finanzamt.ini');
1073 $disabled = qq|disabled="disabled"|;
1074 $disabled = '' if ($form->{elster} eq '1');
1075 if ($form->{report} eq 'ustva') {
1077 <input type=submit class=submit name=action value="|
1078 . $locale->text('debug') . qq|">
1079 <input type=submit class=submit name=action $disabled
1080 value="| . $locale->text('winston_export') . qq|">
1083 <input type=submit class=submit name=action value="|
1084 . $locale->text('config') . qq|">
1095 $lxdebug->leave_sub();
1098 sub continue { &{ $form->{nextsub} } }
1101 $lxdebug->enter_sub();
1102 my $nextsub = shift;
1104 $form->{project_id} = $form->{project_id_1};
1105 if ($form->{projectnumber} && !$form->{project_id}) {
1106 $form->{rowcount} = 1;
1108 # call this instead of update
1109 $form->{update} = $nextsub;
1110 $form->{projectnumber_1} = $form->{projectnumber};
1112 delete $form->{sort};
1115 # if there is one only, assign id
1116 $form->{project_id} = $form->{project_id_1};
1119 $lxdebug->leave_sub();
1122 sub generate_income_statement {
1123 $lxdebug->enter_sub();
1125 $form->{padding} = " ";
1126 $form->{bold} = "<b>";
1127 $form->{endbold} = "</b>";
1128 $form->{br} = "<br>";
1130 &get_project(generate_income_statement);
1132 $form->{projectnumber} = $form->{projectnumber_1};
1134 if ($form->{reporttype} eq "custom") {
1136 #forgotten the year --> thisyear
1137 if ($form->{year} !~ m/^\d\d\d\d$/) {
1138 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
1144 if ($form->{duetyp} eq "13") {
1145 $form->{fromdate} = "1.1.$form->{year}";
1146 $form->{todate} = "31.12.$form->{year}";
1150 if ($form->{duetyp} eq "A") {
1151 $form->{fromdate} = "1.1.$form->{year}";
1152 $form->{todate} = "31.3.$form->{year}";
1154 if ($form->{duetyp} eq "B") {
1155 $form->{fromdate} = "1.4.$form->{year}";
1156 $form->{todate} = "30.6.$form->{year}";
1158 if ($form->{duetyp} eq "C") {
1159 $form->{fromdate} = "1.7.$form->{year}";
1160 $form->{todate} = "30.9.$form->{year}";
1162 if ($form->{duetyp} eq "D") {
1163 $form->{fromdate} = "1.10.$form->{year}";
1164 $form->{todate} = "31.12.$form->{year}";
1169 $form->{duetyp} eq "1" && do {
1170 $form->{fromdate} = "1.1.$form->{year}";
1171 $form->{todate} = "31.1.$form->{year}";
1174 $form->{duetyp} eq "2" && do {
1175 $form->{fromdate} = "1.2.$form->{year}";
1177 #this works from 1901 to 2099, 1900 and 2100 fail.
1178 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
1179 $form->{todate} = "$leap.2.$form->{year}";
1182 $form->{duetyp} eq "3" && do {
1183 $form->{fromdate} = "1.3.$form->{year}";
1184 $form->{todate} = "31.3.$form->{year}";
1187 $form->{duetyp} eq "4" && do {
1188 $form->{fromdate} = "1.4.$form->{year}";
1189 $form->{todate} = "30.4.$form->{year}";
1192 $form->{duetyp} eq "5" && do {
1193 $form->{fromdate} = "1.5.$form->{year}";
1194 $form->{todate} = "31.5.$form->{year}";
1197 $form->{duetyp} eq "6" && do {
1198 $form->{fromdate} = "1.6.$form->{year}";
1199 $form->{todate} = "30.6.$form->{year}";
1202 $form->{duetyp} eq "7" && do {
1203 $form->{fromdate} = "1.7.$form->{year}";
1204 $form->{todate} = "31.7.$form->{year}";
1207 $form->{duetyp} eq "8" && do {
1208 $form->{fromdate} = "1.8.$form->{year}";
1209 $form->{todate} = "31.8.$form->{year}";
1212 $form->{duetyp} eq "9" && do {
1213 $form->{fromdate} = "1.9.$form->{year}";
1214 $form->{todate} = "30.9.$form->{year}";
1217 $form->{duetyp} eq "10" && do {
1218 $form->{fromdate} = "1.10.$form->{year}";
1219 $form->{todate} = "31.10.$form->{year}";
1222 $form->{duetyp} eq "11" && do {
1223 $form->{fromdate} = "1.11.$form->{year}";
1224 $form->{todate} = "30.11.$form->{year}";
1227 $form->{duetyp} eq "12" && do {
1228 $form->{fromdate} = "1.12.$form->{year}";
1229 $form->{todate} = "31.12.$form->{year}";
1235 RP->income_statement(\%myconfig, \%$form);
1237 ($form->{department}) = split /--/, $form->{department};
1240 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1241 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
1243 # if there are any dates construct a where
1244 if ($form->{fromdate} || $form->{todate}) {
1246 unless ($form->{todate}) {
1247 $form->{todate} = $form->current_date(\%myconfig);
1250 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
1251 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
1253 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1254 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
1256 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
1258 $locale->text('for Period')
1259 . qq|<br>\n$longfromdate |
1260 . $locale->text('Bis')
1264 if ($form->{comparefromdate} || $form->{comparetodate}) {
1265 $longcomparefromdate =
1266 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
1267 $shortcomparefromdate =
1268 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
1270 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
1271 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
1273 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
1275 "<br>\n$longcomparefromdate "
1276 . $locale->text('Bis')
1277 . qq| $longcomparetodate|;
1280 # setup variables for the form
1281 @a = qw(company address businessnumber);
1282 map { $form->{$_} = $myconfig{$_} } @a;
1283 $form->{address} =~ s/\\n/<br>/g;
1285 $form->{templates} = $myconfig{templates};
1287 $form->{IN} = "income_statement.html";
1289 $form->parse_template;
1291 $lxdebug->leave_sub();
1294 sub generate_balance_sheet {
1295 $lxdebug->enter_sub();
1297 $form->{padding} = " ";
1298 $form->{bold} = "<b>";
1299 $form->{endbold} = "</b>";
1300 $form->{br} = "<br>";
1302 RP->balance_sheet(\%myconfig, \%$form);
1304 $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
1306 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1308 ($form->{department}) = split /--/, $form->{department};
1310 # define Current Earnings account
1311 $padding = ($form->{l_heading}) ? $form->{padding} : "";
1312 push(@{ $form->{equity_account} },
1313 $padding . $locale->text('Current Earnings'));
1315 $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
1316 $form->{last_period} =
1317 $locale->date(\%myconfig, $form->{compareasofdate}, 0);
1319 $form->{IN} = "balance_sheet.html";
1321 # setup company variables for the form
1322 map { $form->{$_} = $myconfig{$_} }
1323 (qw(company address businessnumber nativecurr));
1324 $form->{address} =~ s/\\n/<br>/g;
1326 $form->{templates} = $myconfig{templates};
1328 $form->parse_template;
1330 $lxdebug->leave_sub();
1333 sub generate_projects {
1334 $lxdebug->enter_sub();
1336 &get_project(generate_projects);
1337 $form->{projectnumber} = $form->{projectnumber_1};
1339 $form->{nextsub} = "generate_projects";
1340 $form->{title} = $locale->text('Project Transactions');
1341 RP->trial_balance(\%myconfig, \%$form);
1345 $lxdebug->leave_sub();
1351 # included links to display transactions for period entered
1352 # added headers and subtotals
1354 sub generate_trial_balance {
1355 $lxdebug->enter_sub();
1357 # get for each account initial balance, debits and credits
1358 RP->trial_balance(\%myconfig, \%$form);
1360 $form->{nextsub} = "generate_trial_balance";
1361 $form->{title} = $locale->text('Trial Balance');
1364 $lxdebug->leave_sub();
1368 $lxdebug->enter_sub();
1370 $title = $form->escape($form->{title});
1372 if ($form->{department}) {
1373 ($department) = split /--/, $form->{department};
1374 $options = $locale->text('Department') . " : $department<br>";
1375 $department = $form->escape($form->{department});
1377 if ($form->{projectnumber}) {
1379 $locale->text('Project Number') . " : $form->{projectnumber}<br>";
1380 $projectnumber = $form->escape($form->{projectnumber});
1383 # if there are any dates
1384 if ($form->{fromdate} || $form->{todate}) {
1385 if ($form->{fromdate}) {
1386 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1388 if ($form->{todate}) {
1389 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1392 $form->{period} = "$fromdate - $todate";
1395 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1398 $options .= $form->{period};
1400 @column_index = qw(accno description begbalance debit credit endbalance);
1402 $column_header{accno} =
1403 qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
1404 $column_header{description} =
1405 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1406 $column_header{debit} =
1407 qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
1408 $column_header{credit} =
1409 qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
1410 $column_header{begbalance} =
1411 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1412 $column_header{endbalance} =
1413 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1415 if ($form->{accounttype} eq 'gifi') {
1416 $column_header{accno} =
1417 qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>|;
1427 <th class=listtop>$form->{title}</th>
1429 <tr height="5"></tr>
1438 map { print "$column_header{$_}\n" } @column_index;
1444 # sort the whole thing by account numbers and display
1445 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
1447 $description = $form->escape($ref->{description});
1450 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}|;
1452 if ($form->{accounttype} eq 'gifi') {
1453 $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description";
1454 $na = $locale->text('N/A');
1455 map { $ref->{$_} = $na } qw(accno description) unless $ref->{accno};
1457 $href .= "&accno=$ref->{accno}&description=$description";
1460 $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
1462 $debit = $form->format_amount(\%myconfig, $ref->{debit}, 2, " ");
1463 $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
1465 $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
1467 $form->format_amount(\%myconfig,
1468 ($ref->{balance} + $ref->{amount}) * $ml,
1471 # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
1473 if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
1474 map { $column_data{$_} = "<th> </th>" }
1475 qw(accno begbalance endbalance);
1477 $subtotalbegbalance =
1478 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1479 $subtotalendbalance =
1480 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1482 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1484 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1486 $column_data{description} = "<th>$subtotaldescription</th>";
1487 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1488 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1489 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1490 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1493 <tr class=listsubtotal>
1495 map { print "$column_data{$_}\n" } @column_index;
1502 if ($ref->{charttype} eq "H") {
1504 $subtotaldescription = $ref->{description};
1505 $subtotaldebit = $ref->{debit};
1506 $subtotalcredit = $ref->{credit};
1507 $subtotalbegbalance = 0;
1508 $subtotalendbalance = 0;
1510 next unless $form->{l_heading};
1512 map { $column_data{$_} = "<th> </th>" }
1513 qw(accno debit credit begbalance endbalance);
1514 $column_data{description} =
1515 "<th class=listheading>$ref->{description}</th>";
1518 if ($ref->{charttype} eq "A") {
1519 $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
1520 $column_data{description} = "<td>$ref->{description}</td>";
1521 $column_data{debit} = "<td align=right>$debit</td>";
1522 $column_data{credit} = "<td align=right>$credit</td>";
1523 $column_data{begbalance} = "<td align=right>$begbalance</td>";
1524 $column_data{endbalance} = "<td align=right>$endbalance</td>";
1526 $totaldebit += $ref->{debit};
1527 $totalcredit += $ref->{credit};
1529 $subtotalbegbalance += $ref->{balance} * $ml;
1530 $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
1534 if ($ref->{charttype} eq "H") {
1536 <tr class=listheading>
1539 if ($ref->{charttype} eq "A") {
1543 <tr class=listrow$i>
1547 map { print "$column_data{$_}\n" } @column_index;
1554 # print last subtotal
1555 if ($subtotal && $form->{l_subtotal}) {
1556 map { $column_data{$_} = "<th> </th>" }
1557 qw(accno begbalance endbalance);
1558 $subtotalbegbalance =
1559 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1560 $subtotalendbalance =
1561 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1563 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1565 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1566 $column_data{description} = "<th>$subdescription</th>";
1567 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1568 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1569 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1570 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1573 <tr class=listsubtotal>
1575 map { print "$column_data{$_}\n" } @column_index;
1582 $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
1583 $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
1585 map { $column_data{$_} = "<th> </th>" }
1586 qw(accno description begbalance endbalance);
1588 $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
1589 $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
1592 <tr class=listtotal>
1595 map { print "$column_data{$_}\n" } @column_index;
1603 <td><hr size=3 noshade></td>
1611 $lxdebug->leave_sub();
1614 sub generate_ar_aging {
1615 $lxdebug->enter_sub();
1618 ($form->{customer}) = split(/--/, $form->{customer});
1619 $customer = $form->escape($form->{customer}, 1);
1620 $title = $form->escape($form->{title}, 1);
1622 $form->{ct} = "customer";
1623 $form->{arap} = "ar";
1626 qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
1628 RP->aging(\%myconfig, \%$form);
1631 $lxdebug->leave_sub();
1634 sub generate_ap_aging {
1635 $lxdebug->enter_sub();
1638 ($form->{vendor}) = split(/--/, $form->{vendor});
1639 $vendor = $form->escape($form->{vendor}, 1);
1640 $title = $form->escape($form->{title}, 1);
1642 $form->{ct} = "vendor";
1643 $form->{arap} = "ap";
1646 qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
1648 RP->aging(\%myconfig, \%$form);
1651 $lxdebug->leave_sub();
1655 $lxdebug->enter_sub();
1659 $column_header{statement} = qq|<th> </th>|;
1660 $column_header{ct} =
1661 qq|<th class=listheading>|
1662 . $locale->text(ucfirst $form->{ct})
1664 $column_header{invnumber} =
1665 qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
1666 $column_header{transdate} =
1667 qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
1668 $column_header{duedate} =
1669 qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
1670 $column_header{c0} =
1671 qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
1672 $column_header{c30} = qq|<th class=listheading>30</th>|;
1673 $column_header{c60} = qq|<th class=listheading>60</th>|;
1674 $column_header{c90} = qq|<th class=listheading>90</th>|;
1677 (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
1679 if ($form->{department}) {
1680 $option .= "\n<br>" if $option;
1681 ($department) = split /--/, $form->{department};
1682 $option .= $locale->text('Department') . " : $department";
1683 $department = $form->escape($form->{department}, 1);
1684 $form->{callback} .= "&department=$department";
1687 if ($form->{arap} eq 'ar') {
1688 if ($form->{customer}) {
1689 $option .= "\n<br>" if $option;
1690 $option .= $form->{customer};
1693 if ($form->{arap} eq 'ap') {
1694 shift @column_index;
1695 if ($form->{vendor}) {
1696 $option .= "\n<br>" if $option;
1697 $option .= $form->{vendor};
1701 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1702 $option .= "\n<br>" if $option;
1704 $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
1709 <form method=post action=$form->{script}>
1713 <th class=listtop>$form->{title}</th>
1715 <tr height="5"></tr>
1722 <tr class=listheading>
1725 map { print "$column_header{$_}\n" } @column_index;
1735 foreach $ref (@{ $form->{AG} }) {
1737 if ($ctid != $ref->{ctid}) {
1743 $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1745 $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1747 $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1749 $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1752 $column_data{ct} = qq|<th> </th>|;
1753 $column_data{invnumber} = qq|<th> </th>|;
1754 $column_data{transdate} = qq|<th> </th>|;
1755 $column_data{duedate} = qq|<th> </th>|;
1757 qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1759 qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1761 qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1763 qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1769 <tr class=listsubtotal>
1772 map { print "$column_data{$_}\n" } @column_index;
1774 $column_data{statement} = qq|<td> </td>|;
1788 $column_data{ct} = qq|<td>$ref->{name}</td>|;
1789 $column_data{statement} =
1790 qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
1791 <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
1795 $c0subtotal += $ref->{c0};
1796 $c30subtotal += $ref->{c30};
1797 $c60subtotal += $ref->{c60};
1798 $c90subtotal += $ref->{c90};
1800 $c0total += $ref->{c0};
1801 $c30total += $ref->{c30};
1802 $c60total += $ref->{c60};
1803 $c90total += $ref->{c90};
1805 $ref->{c0} = $form->format_amount(\%myconfig, $ref->{c0}, 2, " ");
1806 $ref->{c30} = $form->format_amount(\%myconfig, $ref->{c30}, 2, " ");
1807 $ref->{c60} = $form->format_amount(\%myconfig, $ref->{c60}, 2, " ");
1808 $ref->{c90} = $form->format_amount(\%myconfig, $ref->{c90}, 2, " ");
1811 qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
1812 . $form->escape($form->{callback});
1814 $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
1815 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
1816 $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
1817 $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
1818 $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
1819 $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
1820 $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
1825 <tr class=listrow$j>
1828 map { print "$column_data{$_}\n" } @column_index;
1834 $column_data{ct} = qq|<td> </td>|;
1835 $column_data{statement} = qq|<td> </td>|;
1837 $ctid = $ref->{ctid};
1842 $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1843 $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1844 $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1845 $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1848 <tr class=listsubtotal>
1851 map { $column_data{$_} = qq|<th> </th>| } @column_index;
1853 $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1854 $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1855 $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1856 $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1858 map { print "$column_data{$_}\n" } @column_index;
1862 <tr class=listtotal>
1865 $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
1866 $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
1867 $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
1868 $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
1870 $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
1871 $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
1872 $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
1873 $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
1875 map { print "$column_data{$_}\n" } @column_index;
1878 <input type=hidden name=rowcount value=$i>
1887 &print_options if ($form->{arap} eq 'ar');
1893 <td><hr size=3 noshade></td>
1898 if ($form->{arap} eq 'ar') {
1900 <input type=hidden name=todate value=$form->{todate}>
1902 <input type=hidden name=title value="$form->{title}">
1904 <input type=hidden name=arap value=$form->{arap}>
1905 <input type=hidden name=ct value=$form->{ct}>
1906 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
1908 <input type=hidden name=department value="$form->{department}">
1910 <input type=hidden name=path value=$form->{path}>
1911 <input type=hidden name=login value=$form->{login}>
1912 <input type=hidden name=password value=$form->{password}>
1915 <input class=submit type=submit name=action value="|
1916 . $locale->text('Select all') . qq|">
1917 <input class=submit type=submit name=action value="|
1918 . $locale->text('Print') . qq|">
1919 <input class=submit type=submit name=action value="|
1920 . $locale->text('E-mail') . qq|">
1924 if ($form->{menubar}) {
1925 require "$form->{path}/menu.pl";
1936 $lxdebug->leave_sub();
1940 $lxdebug->enter_sub();
1942 RP->aging(\%myconfig, \%$form);
1944 map { $_->{checked} = "checked" } @{ $form->{AG} };
1948 $lxdebug->leave_sub();
1952 $lxdebug->enter_sub();
1954 $form->{sendmode} = "attachment";
1955 $form->{copies} = 2 unless $form->{copies};
1957 $form->{PD}{ $form->{type} } = "selected";
1958 $form->{DF}{ $form->{format} } = "selected";
1959 $form->{OP}{ $form->{media} } = "selected";
1960 $form->{SM}{ $form->{sendmode} } = "selected";
1963 <option value=statement $form->{PD}{statement}>|
1964 . $locale->text('Statement');
1966 if ($form->{media} eq 'email') {
1968 <option value=attachment $form->{SM}{attachment}>|
1969 . $locale->text('Attachment') . qq|
1970 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
1973 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1974 if ($myconfig{printer} && $latex) {
1976 <option value=printer $form->{OP}{printer}>|
1977 . $locale->text('Printer');
1983 <option value=postscript $form->{DF}{postscript}>|
1984 . $locale->text('Postscript') . qq|
1985 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
1991 <td><select name=type>$type</select></td>
1992 <td><select name=format>$format</select></td>
1993 <td><select name=media>$media</select></td>
1996 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
1998 <td>| . $locale->text('Copies') . qq|
1999 <input name=copies size=2 value=$form->{copies}></td>
2008 $lxdebug->leave_sub();
2012 $lxdebug->enter_sub();
2014 # get name and email addresses
2015 for $i (1 .. $form->{rowcount}) {
2016 if ($form->{"statement_$i"}) {
2017 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
2018 RP->get_customer(\%myconfig, \%$form);
2024 $form->error($locale->text('Nothing selected!')) unless $selected;
2026 if ($myconfig{role} eq 'admin') {
2028 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
2029 <td><input name=bcc size=30 value="$form->{bcc}"></td>
2033 $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
2035 $form->{media} = "email";
2042 <form method=post action=$form->{script}>
2048 <tr height="5"></tr>
2053 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
2054 <td><input name=email size=30 value="$form->{email}"></td>
2055 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
2056 <td><input name=cc size=30 value="$form->{cc}"></td>
2059 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
2060 <td><input name=subject size=30 value="$form->{subject}"></td>
2070 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
2073 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
2084 map { delete $form->{$_} }
2085 qw(action email cc bcc subject message type sendmode format header);
2087 # save all other variables
2088 foreach $key (keys %$form) {
2089 $form->{$key} =~ s/\"/"/g;
2090 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2097 <td><hr size=3 noshade></td>
2101 <input type=hidden name=nextsub value=send_email>
2104 <input name=action class=submit type=submit value="|
2105 . $locale->text('Continue') . qq|">
2112 $lxdebug->leave_sub();
2116 $lxdebug->enter_sub();
2118 $form->{OUT} = "$sendmail";
2120 $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
2121 unless $form->{subject};
2123 RP->aging(\%myconfig, \%$form);
2125 $form->{"statement_1"} = 1;
2130 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
2132 $lxdebug->leave_sub();
2136 $lxdebug->enter_sub();
2138 if ($form->{media} eq 'printer') {
2139 $form->error($locale->text('Select postscript or PDF!'))
2140 if ($form->{format} !~ /(postscript|pdf)/);
2143 for $i (1 .. $form->{rowcount}) {
2144 if ($form->{"statement_$i"}) {
2145 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
2151 $form->error($locale->text('Nothing selected!')) unless $selected;
2153 if ($form->{media} eq 'printer') {
2154 $form->{OUT} = "| $myconfig{printer}";
2155 $form->{"$form->{ct}_id"} = "";
2157 $form->{"statement_1"} = 1;
2160 RP->aging(\%myconfig, \%$form);
2164 $form->redirect($locale->text('Statements sent to printer!'))
2165 if ($form->{media} eq 'printer');
2167 $lxdebug->leave_sub();
2171 $lxdebug->enter_sub();
2173 $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
2175 $form->{templates} = "$myconfig{templates}";
2177 # setup variables for the form
2178 @a = qw(company address businessnumber tel fax);
2179 map { $form->{$_} = $myconfig{$_} } @a;
2180 $form->format_string(@a);
2182 $form->{IN} = "$form->{type}.html";
2184 if ($form->{format} eq 'postscript') {
2185 $form->{postscript} = 1;
2186 $form->{IN} =~ s/html$/tex/;
2188 if ($form->{format} eq 'pdf') {
2190 $form->{IN} =~ s/html$/tex/;
2194 while (@{ $form->{AG} }) {
2196 $ref = shift @{ $form->{AG} };
2198 if ($ctid != $ref->{ctid}) {
2200 $ctid = $ref->{ctid};
2203 if ($form->{"statement_$i"}) {
2206 (name, street, zipcode, city, country, contact, email,
2207 "$form->{ct}phone", "$form->{ct}fax");
2208 map { $form->{$_} = $ref->{$_} } @a;
2209 $form->format_string(@a);
2211 $form->{ $form->{ct} } = $form->{name};
2212 $form->{"$form->{ct}_id"} = $ref->{ctid};
2214 map { $form->{$_} = () } qw(invnumber invdate duedate);
2216 foreach $item (qw(c0 c30 c60 c90)) {
2217 $form->{$item} = ();
2218 $form->{"${item}total"} = 0;
2221 &statement_details($ref);
2225 if (scalar(@{ $form->{AG} }) > 0) {
2227 # one or more left to go
2228 if ($ctid == $form->{AG}->[0]->{ctid}) {
2229 $ref = shift @{ $form->{AG} };
2230 &statement_details($ref);
2233 $ref = scalar(@{ $form->{AG} });
2239 # set initial ref to 0
2246 $form->{"${_}total"} =
2247 $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
2248 } (c0, c30, c60, c90, "");
2250 $form->parse_template(\%myconfig, $userspath);
2256 $lxdebug->leave_sub();
2259 sub statement_details {
2260 $lxdebug->enter_sub();
2263 push @{ $form->{invnumber} }, $ref->{invnumber};
2264 push @{ $form->{invdate} }, $ref->{transdate};
2265 push @{ $form->{duedate} }, $ref->{duedate};
2267 foreach $item (qw(c0 c30 c60 c90)) {
2270 $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
2272 $form->{"${item}total"} += $ref->{$item};
2273 $form->{total} += $ref->{$item};
2274 push @{ $form->{$item} },
2275 $form->format_amount(\%myconfig, $ref->{$item}, 2);
2278 $lxdebug->leave_sub();
2281 sub generate_tax_report {
2282 $lxdebug->enter_sub();
2284 RP->tax_report(\%myconfig, \%$form);
2286 $descvar = "$form->{accno}_description";
2287 $description = $form->escape($form->{$descvar});
2288 $ratevar = "$form->{accno}_rate";
2290 if ($form->{accno} =~ /^gifi_/) {
2291 $descvar = "gifi_$form->{accno}_description";
2292 $description = $form->escape($form->{$descvar});
2293 $ratevar = "gifi_$form->{accno}_rate";
2296 $department = $form->escape($form->{department});
2300 "$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}";
2302 # construct callback
2303 $description = $form->escape($form->{$descvar}, 1);
2304 $department = $form->escape($form->{department}, 1);
2306 "$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}";
2308 $form->{title} = $locale->text('GIFI') . " - "
2309 if ($form->{accno} =~ /^gifi_/);
2311 $title = $form->escape($form->{title});
2312 $href .= "&title=$title";
2313 $title = $form->escape($form->{title}, 1);
2314 $callback .= "&title=$title";
2316 $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
2319 $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2321 foreach $item (@columns) {
2322 if ($form->{"l_$item"} eq "Y") {
2323 push @column_index, $item;
2325 # add column to href and callback
2326 $callback .= "&l_$item=Y";
2327 $href .= "&l_$item=Y";
2331 if ($form->{l_subtotal} eq 'Y') {
2332 $callback .= "&l_subtotal=Y";
2333 $href .= "&l_subtotal=Y";
2336 if ($form->{department}) {
2337 ($department) = split /--/, $form->{department};
2338 $option = $locale->text('Department') . " : $department";
2341 # if there are any dates
2342 if ($form->{fromdate} || $form->{todate}) {
2343 if ($form->{fromdate}) {
2344 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
2346 if ($form->{todate}) {
2347 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
2350 $form->{period} = "$fromdate - $todate";
2353 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2356 if ($form->{db} eq 'ar') {
2357 $name = $locale->text('Customer');
2361 if ($form->{db} eq 'ap') {
2362 $name = $locale->text('Vendor');
2367 $option .= "<br>" if $option;
2368 $option .= "$form->{period}";
2370 $column_header{id} =
2371 qq|<th><a class=listheading href=$href&sort=id>|
2372 . $locale->text('ID')
2374 $column_header{invnumber} =
2375 qq|<th><a class=listheading href=$href&sort=invnumber>|
2376 . $locale->text('Invoice')
2378 $column_header{transdate} =
2379 qq|<th><a class=listheading href=$href&sort=transdate>|
2380 . $locale->text('Date')
2382 $column_header{netamount} =
2383 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
2384 $column_header{tax} =
2385 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
2386 $column_header{amount} =
2387 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
2389 $column_header{name} =
2390 qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
2399 <th class=listtop colspan=$colspan>$form->{title}</th>
2401 <tr height="5"></tr>
2408 <tr class=listheading>
2411 map { print "$column_header{$_}\n" } @column_index;
2417 # add sort and escape callback
2418 $callback = $form->escape($callback . "&sort=$form->{sort}");
2420 if (@{ $form->{TR} }) {
2421 $sameitem = $form->{TR}->[0]->{ $form->{sort} };
2424 foreach $ref (@{ $form->{TR} }) {
2426 $module = ($ref->{invoice}) ? $invoice : $arap;
2428 if ($form->{l_subtotal} eq 'Y') {
2429 if ($sameitem ne $ref->{ $form->{sort} }) {
2431 $sameitem = $ref->{ $form->{sort} };
2435 $totalnetamount += $ref->{netamount};
2436 $totaltax += $ref->{tax};
2437 $ref->{amount} = $ref->{netamount} + $ref->{tax};
2439 $subtotalnetamount += $ref->{netamount};
2440 $subtotaltax += $ref->{tax};
2443 $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2444 } qw(netamount tax amount);
2446 $column_data{id} = qq|<td>$ref->{id}</td>|;
2447 $column_data{invnumber} =
2448 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>|;
2449 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
2450 $column_data{name} = qq|<td>$ref->{name} </td>|;
2452 map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
2453 qw(netamount tax amount);
2458 <tr class=listrow$i>
2461 map { print "$column_data{$_}\n" } @column_index;
2469 if ($form->{l_subtotal} eq 'Y') {
2473 map { $column_data{$_} = qq|<th> </th>| } @column_index;
2477 <tr class=listtotal>
2481 $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
2483 $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
2484 $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
2486 $column_data{netamount} =
2487 qq|<th class=listtotal align=right>$totalnetamount</th>|;
2488 $column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
2489 $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
2491 map { print "$column_data{$_}\n" } @column_index;
2499 <td><hr size=3 noshade></td>
2507 $lxdebug->leave_sub();
2511 $lxdebug->enter_sub();
2513 map { $column_data{$_} = "<td> </td>" } @column_index;
2515 $subtotalnetamount =
2516 $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
2517 $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
2519 $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
2522 $column_data{netamount} =
2523 "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2524 $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
2525 $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
2527 $subtotalnetamount = 0;
2531 <tr class=listsubtotal>
2533 map { print "\n$column_data{$_}" } @column_index;
2539 $lxdebug->leave_sub();
2543 $lxdebug->enter_sub();
2545 if ($form->{account}) {
2546 ($form->{paymentaccounts}) = split /--/, $form->{account};
2548 if ($form->{department}) {
2549 ($department, $form->{department_id}) = split /--/, $form->{department};
2550 $option = $locale->text('Department') . " : $department";
2553 RP->payments(\%myconfig, \%$form);
2556 $form->sort_columns(qw(transdate reference name paid source memo));
2559 $account = $form->escape($form->{account});
2560 $title = $form->escape($form->{title});
2561 $department = $form->escape($form->{department});
2562 $form->{paymentaccounts} =~ s/ /%20/g;
2563 $reference = $form->escape($form->{reference});
2564 $source = $form->escape($form->{source});
2565 $memo = $form->escape($form->{memo});
2568 "$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";
2570 # construct callback
2571 $account = $form->escape($form->{account}, 1);
2572 $title = $form->escape($form->{title}, 1);
2573 $department = $form->escape($form->{department}, 1);
2574 $reference = $form->escape($form->{reference}, 1);
2575 $source = $form->escape($form->{source}, 1);
2576 $memo = $form->escape($form->{memo}, 1);
2579 "$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}";
2580 $callback = $form->escape($form->{callback});
2582 $column_header{name} =
2583 "<th><a class=listheading href=$href&sort=name>"
2584 . $locale->text('Description')
2586 $column_header{reference} =
2587 "<th><a class=listheading href=$href&sort=invnumber>"
2588 . $locale->text('Reference')
2590 $column_header{transdate} =
2591 "<th><a class=listheading href=$href&sort=transdate>"
2592 . $locale->text('Date')
2594 $column_header{paid} =
2595 "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2596 $column_header{source} =
2597 "<th><a class=listheading href=$href&sort=source>"
2598 . $locale->text('Source')
2600 $column_header{memo} =
2601 "<th><a class=listheading href=$href&sort=memo>"
2602 . $locale->text('Memo')
2605 if ($form->{fromdate}) {
2606 $option .= "\n<br>" if ($option);
2608 $locale->text('From') . " "
2609 . $locale->date(\%myconfig, $form->{fromdate}, 1);
2611 if ($form->{todate}) {
2612 $option .= "\n<br>" if ($option);
2614 $locale->text('bis') . " "
2615 . $locale->date(\%myconfig, $form->{todate}, 1);
2618 @column_index = @columns;
2619 $colspan = $#column_index + 1;
2628 <th class=listtop>$form->{title}</th>
2630 <tr height="5"></tr>
2637 <tr class=listheading>
2640 map { print "\n$column_header{$_}" } @column_index;
2646 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2648 next unless @{ $form->{ $ref->{id} } };
2652 <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2656 foreach $payment (@{ $form->{ $ref->{id} } }) {
2658 $module = $payment->{module};
2659 $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2660 $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2663 qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2665 $column_data{name} = "<td>$payment->{name} </td>";
2666 $column_data{reference} =
2667 qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2668 $column_data{transdate} = "<td>$payment->{transdate} </td>";
2669 $column_data{paid} =
2671 . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
2673 $column_data{source} = "<td>$payment->{source} </td>";
2674 $column_data{memo} = "<td>$payment->{memo} </td>";
2676 $subtotalpaid += $payment->{paid};
2677 $totalpaid += $payment->{paid};
2682 <tr class=listrow$i>
2685 map { print "\n$column_data{$_}" } @column_index;
2694 map { $column_data{$_} = "<td> </td>" } @column_index;
2696 $column_data{paid} =
2697 "<th class=listsubtotal align=right>"
2698 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
2701 <tr class=listsubtotal>
2704 map { print "\n$column_data{$_}" } @column_index;
2715 map { $column_data{$_} = "<td> </td>" } @column_index;
2717 $column_data{paid} =
2718 "<th class=listtotal align=right>"
2719 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
2722 <tr class=listtotal>
2725 map { print "\n$column_data{$_}" } @column_index;
2734 <td><hr size=3 noshade></td>
2742 $lxdebug->leave_sub();
2746 $lxdebug->enter_sub();
2751 $lxdebug->leave_sub();
2760 sub winston_export {
2761 $lxdebug->enter_sub();
2762 print(STDERR "Winston Export1\n");
2765 $form->{winston} = 1;
2767 $lxdebug->leave_sub();
2771 $lxdebug->enter_sub();
2773 $form->{sendmode} = "attachment";
2774 $form->{copies} = 2 unless $form->{copies};
2776 $form->{PD}{ $form->{type} } = "selected";
2777 $form->{DF}{ $form->{format} } = "selected";
2778 $form->{OP}{ $form->{media} } = "selected";
2779 $form->{SM}{ $form->{sendmode} } = "selected";
2781 if ($form->{report} eq 'ustva') {
2783 <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
2786 <option value=statement $form->{PD}{statement}>|
2787 . $locale->text('Statement');
2790 if ($form->{media} eq 'email') {
2792 <option value=attachment $form->{SM}{attachment}>|
2793 . $locale->text('Attachment') . qq|
2794 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
2797 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2798 if ($myconfig{printer} && $latex) {
2800 <option value=printer $form->{OP}{printer}>|
2801 . $locale->text('Printer');
2807 <option value=html $form->{DF}{html}>|
2808 . $locale->text('HTML') . qq|
2809 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
2810 if ($form->{report} ne 'ustva') {
2812 <option value=postscript $form->{DF}{postscript}>|
2813 . $locale->text('Postscript');
2820 <td><select name=type>$type</select></td>
2821 <td><select name=format>$format</select></td>
2822 <td><select name=media>$media</select></td>
2825 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
2827 <td>| . $locale->text('Copies') . qq|
2828 <input name=copies size=2 value=$form->{copies}></td>
2837 $lxdebug->leave_sub();
2841 $lxdebug->enter_sub();
2842 $form->{padding} = " ";
2843 $form->{bold} = "<b>";
2844 $form->{endbold} = "</b>";
2845 $form->{br} = "<br>";
2847 # &get_project(generate_bwa);
2849 if ($form->{reporttype} eq "custom") {
2851 #forgotten the year --> thisyear
2852 if ($form->{year} !~ m/^\d\d\d\d$/) {
2853 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2859 if ($form->{duetyp} eq "13") {
2860 $form->{fromdate} = "1.1.$form->{year}";
2861 $form->{todate} = "31.12.$form->{year}";
2862 $form->{comparefromdate} = "1.01.$form->{year}";
2863 $form->{comparetodate} = "31.12.$form->{year}";
2867 if ($form->{duetyp} eq "A") {
2868 $form->{fromdate} = "1.1.$form->{year}";
2869 $form->{todate} = "31.3.$form->{year}";
2870 $form->{comparefromdate} = "1.01.$form->{year}";
2871 $form->{comparetodate} = "31.03.$form->{year}";
2873 if ($form->{duetyp} eq "B") {
2874 $form->{fromdate} = "1.4.$form->{year}";
2875 $form->{todate} = "30.6.$form->{year}";
2876 $form->{comparefromdate} = "1.01.$form->{year}";
2877 $form->{comparetodate} = "30.06.$form->{year}";
2879 if ($form->{duetyp} eq "C") {
2880 $form->{fromdate} = "1.7.$form->{year}";
2881 $form->{todate} = "30.9.$form->{year}";
2882 $form->{comparefromdate} = "1.01.$form->{year}";
2883 $form->{comparetodate} = "30.09.$form->{year}";
2885 if ($form->{duetyp} eq "D") {
2886 $form->{fromdate} = "1.10.$form->{year}";
2887 $form->{todate} = "31.12.$form->{year}";
2888 $form->{comparefromdate} = "1.01.$form->{year}";
2889 $form->{comparetodate} = "31.12.$form->{year}";
2894 $form->{duetyp} eq "1" && do {
2895 $form->{fromdate} = "1.1.$form->{year}";
2896 $form->{todate} = "31.1.$form->{year}";
2897 $form->{comparefromdate} = "1.01.$form->{year}";
2898 $form->{comparetodate} = "31.01.$form->{year}";
2901 $form->{duetyp} eq "2" && do {
2902 $form->{fromdate} = "1.2.$form->{year}";
2904 #this works from 1901 to 2099, 1900 and 2100 fail.
2905 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2906 $form->{todate} = "$leap.2.$form->{year}";
2907 $form->{comparefromdate} = "1.01.$form->{year}";
2908 $form->{comparetodate} = "$leap.02.$form->{year}";
2911 $form->{duetyp} eq "3" && do {
2912 $form->{fromdate} = "1.3.$form->{year}";
2913 $form->{todate} = "31.3.$form->{year}";
2914 $form->{comparefromdate} = "1.01.$form->{year}";
2915 $form->{comparetodate} = "31.03.$form->{year}";
2918 $form->{duetyp} eq "4" && do {
2919 $form->{fromdate} = "1.4.$form->{year}";
2920 $form->{todate} = "30.4.$form->{year}";
2921 $form->{comparefromdate} = "1.01.$form->{year}";
2922 $form->{comparetodate} = "30.04.$form->{year}";
2925 $form->{duetyp} eq "5" && do {
2926 $form->{fromdate} = "1.5.$form->{year}";
2927 $form->{todate} = "31.5.$form->{year}";
2928 $form->{comparefromdate} = "1.01.$form->{year}";
2929 $form->{comparetodate} = "31.05.$form->{year}";
2932 $form->{duetyp} eq "6" && do {
2933 $form->{fromdate} = "1.6.$form->{year}";
2934 $form->{todate} = "30.6.$form->{year}";
2935 $form->{comparefromdate} = "1.01.$form->{year}";
2936 $form->{comparetodate} = "30.06.$form->{year}";
2939 $form->{duetyp} eq "7" && do {
2940 $form->{fromdate} = "1.7.$form->{year}";
2941 $form->{todate} = "31.7.$form->{year}";
2942 $form->{comparefromdate} = "1.01.$form->{year}";
2943 $form->{comparetodate} = "31.07.$form->{year}";
2946 $form->{duetyp} eq "8" && do {
2947 $form->{fromdate} = "1.8.$form->{year}";
2948 $form->{todate} = "31.8.$form->{year}";
2949 $form->{comparefromdate} = "1.01.$form->{year}";
2950 $form->{comparetodate} = "31.08.$form->{year}";
2953 $form->{duetyp} eq "9" && do {
2954 $form->{fromdate} = "1.9.$form->{year}";
2955 $form->{todate} = "30.9.$form->{year}";
2956 $form->{comparefromdate} = "1.01.$form->{year}";
2957 $form->{comparetodate} = "30.09.$form->{year}";
2960 $form->{duetyp} eq "10" && do {
2961 $form->{fromdate} = "1.10.$form->{year}";
2962 $form->{todate} = "31.10.$form->{year}";
2963 $form->{comparefromdate} = "1.01.$form->{year}";
2964 $form->{comparetodate} = "31.10.$form->{year}";
2967 $form->{duetyp} eq "11" && do {
2968 $form->{fromdate} = "1.11.$form->{year}";
2969 $form->{todate} = "30.11.$form->{year}";
2970 $form->{comparefromdate} = "1.01.$form->{year}";
2971 $form->{comparetodate} = "30.11.$form->{year}";
2974 $form->{duetyp} eq "12" && do {
2975 $form->{fromdate} = "1.12.$form->{year}";
2976 $form->{todate} = "31.12.$form->{year}";
2977 $form->{comparefromdate} = "1.01.$form->{year}";
2978 $form->{comparetodate} = "31.12.$form->{year}";
2983 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
2984 $form->{fromdate} = "${dd}.${mm}.${yy}";
2985 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
2986 $form->{todate} = "${dd}.${mm}.${yy}";
2987 $form->{comparefromdate} = "01.01.$yy";
2988 $form->{comparetodate} = $form->{todate};
2991 RP->bwa(\%myconfig, \%$form);
2993 ($form->{department}) = split /--/, $form->{department};
2996 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2997 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
2999 # if there are any dates construct a where
3000 if ($form->{fromdate} || $form->{todate}) {
3002 unless ($form->{todate}) {
3003 $form->{todate} = $form->current_date(\%myconfig);
3006 my %germandate = ("dateformat" => "dd.mm.yyyy");
3008 $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
3009 $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
3011 $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
3012 $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
3014 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
3016 $locale->text('for Period')
3017 . qq|<br>\n$longfromdate |
3018 . $locale->text('bis')
3022 # setup variables for the form
3023 @a = qw(company address businessnumber);
3024 map { $form->{$_} = $myconfig{$_} } @a;
3025 $form->{address} =~ s/\\n/<br>/g;
3026 $form->{templates} = $myconfig{templates};
3028 $form->{IN} = "bwa.html";
3030 $form->parse_template;
3032 $lxdebug->leave_sub();
3035 sub generate_ustva {
3036 $lxdebug->enter_sub();
3038 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
3039 # Einlesen der Finanzamtdaten
3040 print(STDERR "Winston4\n");
3041 get_config($userspath, 'finanzamt.ini');
3043 # &get_project(generate_bwa);
3044 @anmeldungszeitraum =
3045 qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
3047 foreach $item (@anmeldungszeitraum) {
3048 $form->{$item} = "";
3050 print(STDERR "Winston2\n");
3051 if ($form->{reporttype} eq "custom") {
3053 #forgotten the year --> thisyear
3054 if ($form->{year} !~ m/^\d\d\d\d$/) {
3055 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
3061 if ($form->{duetyp} eq "13") {
3062 $form->{fromdate} = "1.1.$form->{year}";
3063 $form->{todate} = "31.12.$form->{year}";
3067 if ($form->{duetyp} eq "A") {
3068 $form->{fromdate} = "1.1.$form->{year}";
3069 $form->{todate} = "31.3.$form->{year}";
3070 $form->{"0441"} = "X";
3072 if ($form->{duetyp} eq "B") {
3073 $form->{fromdate} = "1.4.$form->{year}";
3074 $form->{todate} = "30.6.$form->{year}";
3075 $form->{"0442"} = "X";
3077 if ($form->{duetyp} eq "C") {
3078 $form->{fromdate} = "1.7.$form->{year}";
3079 $form->{todate} = "30.9.$form->{year}";
3080 $form->{"0443"} = "X";
3082 if ($form->{duetyp} eq "D") {
3083 $form->{fromdate} = "1.10.$form->{year}";
3084 $form->{todate} = "31.12.$form->{year}";
3085 $form->{"0444"} = "X";
3090 $form->{duetyp} eq "1" && do {
3091 $form->{fromdate} = "1.1.$form->{year}";
3092 $form->{todate} = "31.1.$form->{year}";
3093 $form->{"0401"} = "X";
3096 $form->{duetyp} eq "2" && do {
3097 $form->{fromdate} = "1.2.$form->{year}";
3099 #this works from 1901 to 2099, 1900 and 2100 fail.
3100 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
3101 $form->{todate} = "$leap.2.$form->{year}";
3102 $form->{"0402"} = "X";
3105 $form->{duetyp} eq "3" && do {
3106 $form->{fromdate} = "1.3.$form->{year}";
3107 $form->{todate} = "31.3.$form->{year}";
3108 $form->{"0403"} = "X";
3111 $form->{duetyp} eq "4" && do {
3112 $form->{fromdate} = "1.4.$form->{year}";
3113 $form->{todate} = "30.4.$form->{year}";
3114 $form->{"0404"} = "X";
3117 $form->{duetyp} eq "5" && do {
3118 $form->{fromdate} = "1.5.$form->{year}";
3119 $form->{todate} = "31.5.$form->{year}";
3120 $form->{"0405"} = "X";
3123 $form->{duetyp} eq "6" && do {
3124 $form->{fromdate} = "1.6.$form->{year}";
3125 $form->{todate} = "30.6.$form->{year}";
3126 $form->{"0406"} = "X";
3129 $form->{duetyp} eq "7" && do {
3130 $form->{fromdate} = "1.7.$form->{year}";
3131 $form->{todate} = "31.7.$form->{year}";
3132 $form->{"0407"} = "X";
3135 $form->{duetyp} eq "8" && do {
3136 $form->{fromdate} = "1.8.$form->{year}";
3137 $form->{todate} = "31.8.$form->{year}";
3138 $form->{"0408"} = "X";
3141 $form->{duetyp} eq "9" && do {
3142 $form->{fromdate} = "1.9.$form->{year}";
3143 $form->{todate} = "30.9.$form->{year}";
3144 $form->{"0409"} = "X";
3147 $form->{duetyp} eq "10" && do {
3148 $form->{fromdate} = "1.10.$form->{year}";
3149 $form->{todate} = "31.10.$form->{year}";
3150 $form->{"0410"} = "X";
3153 $form->{duetyp} eq "11" && do {
3154 $form->{fromdate} = "1.11.$form->{year}";
3155 $form->{todate} = "30.11.$form->{year}";
3156 $form->{"0411"} = "X";
3159 $form->{duetyp} eq "12" && do {
3160 $form->{fromdate} = "1.12.$form->{year}";
3161 $form->{todate} = "31.12.$form->{year}";
3162 $form->{"0412"} = "X";
3168 # $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
3169 # $form->{year}= $1;
3170 # $form->{fromdate}="1.1.$form->{year}";
3171 # $form->{todate}="31.3.$form->{year}";
3172 # $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3175 RP->ustva(\%myconfig, \%$form);
3177 ($form->{department}) = split /--/, $form->{department};
3180 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3181 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
3183 # if there are any dates construct a where
3184 if ($form->{fromdate} || $form->{todate}) {
3186 unless ($form->{todate}) {
3187 $form->{todate} = $form->current_date(\%myconfig);
3190 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
3191 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
3193 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
3194 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
3196 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
3198 $locale->text('for Period')
3199 . qq|<br>\n$longfromdate |
3200 . $locale->text('bis')
3204 if ($form->{comparefromdate} || $form->{comparetodate}) {
3205 $longcomparefromdate =
3206 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
3207 $shortcomparefromdate =
3208 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
3210 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
3211 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
3213 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
3215 "<br>\n$longcomparefromdate "
3216 . $locale->text('bis')
3217 . qq| $longcomparetodate|;
3220 $form->{Datum_heute} =
3221 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
3223 if ( $form->{format} eq 'pdf'
3224 or $form->{format} eq 'postscript') {
3225 $form->{padding} = "~~";
3226 $form->{bold} = "\textbf{";
3227 $form->{endbold} = "}";
3228 $form->{br} = '\\\\';
3230 @numbers = qw(51r 86r 97r 93r 96 43 45
3232 foreach $number (@numbers) {
3233 $form->{$number} =~ s/,/~~/g;
3236 } elsif ($form->{format} eq 'html') {
3237 $form->{padding} = " ";
3238 $form->{bold} = "<b>";
3239 $form->{endbold} = "</b>";
3240 $form->{br} = "<br>"
3244 # setup variables for the form
3245 @a = qw(company address businessnumber);
3246 map { $form->{$_} = $myconfig{$_} } @a;
3248 $form->{address} =~ s/\\n/$form->{br}/g;
3250 if ($form->{winston} eq '1') {
3251 print(STDERR "fast bei winston\n");
3255 $form->{templates} = $myconfig{templates};
3256 $form->{IN} = "$form->{type}";
3257 $form->{IN} .= '.tex'
3258 if ( $form->{format} eq 'pdf'
3259 or $form->{format} eq 'postscript');
3260 $form->{IN} .= '.html' if ($form->{format} eq 'html');
3262 $form->parse_template(\%myconfig, $userspath);
3264 # $form->parse_template;
3266 $lxdebug->leave_sub();