1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
15 # Contributors: Antonio Gallardo <agssa@ibw.com.ni>
16 # Benjamin Lee <benjaminlee@consultant.com>
17 # Philip Reetz <p.reetz@linet-services.de>
20 # This program is free software; you can redistribute it and/or modify
21 # it under the terms of the GNU General Public License as published by
22 # the Free Software Foundation; either version 2 of the License, or
23 # (at your option) any later version.
25 # This program is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write to the Free Software
31 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 #======================================================================
34 # module for preparing Income Statement and Balance Sheet
36 #======================================================================
38 require "bin/mozilla/arap.pl";
39 require "bin/mozilla/common.pl";
49 # this is for our long dates
50 # $locale->text('January')
51 # $locale->text('February')
52 # $locale->text('March')
53 # $locale->text('April')
54 # $locale->text('May ')
55 # $locale->text('June')
56 # $locale->text('July')
57 # $locale->text('August')
58 # $locale->text('September')
59 # $locale->text('October')
60 # $locale->text('November')
61 # $locale->text('December')
63 # this is for our short month
64 # $locale->text('Jan')
65 # $locale->text('Feb')
66 # $locale->text('Mar')
67 # $locale->text('Apr')
68 # $locale->text('May')
69 # $locale->text('Jun')
70 # $locale->text('Jul')
71 # $locale->text('Aug')
72 # $locale->text('Sep')
73 # $locale->text('Oct')
74 # $locale->text('Nov')
75 # $locale->text('Dec')
77 # $locale->text('Balance Sheet')
78 # $locale->text('Income Statement')
79 # $locale->text('Trial Balance')
80 # $locale->text('AR Aging')
81 # $locale->text('AP Aging')
82 # $locale->text('Tax collected')
83 # $locale->text('Tax paid')
84 # $locale->text('Receipts')
85 # $locale->text('Payments')
86 # $locale->text('Project Transactions')
87 # $locale->text('Non-taxable Sales')
88 # $locale->text('Non-taxable Purchases')
91 $lxdebug->enter_sub();
93 %title = ('balance_sheet' => 'Balance Sheet',
94 'income_statement' => 'Income Statement',
95 'trial_balance' => 'Trial Balance',
96 'ar_aging' => 'AR Aging',
97 'ap_aging' => 'Offene Verbindlichkeiten',
98 'tax_collected' => 'Tax collected',
99 'tax_paid' => 'Tax paid',
100 'nontaxable_sales' => 'Non-taxable Sales',
101 'nontaxable_purchases' => 'Non-taxable Purchases',
102 'receipts' => 'Receipts',
103 'payments' => 'Payments',
104 'projects' => 'Project Transactions',
105 'bwa' => 'Betriebswirtschaftliche Auswertung',
106 'ustva' => 'Umsatzsteuervoranmeldung',);
108 $form->{title} = $locale->text($title{ $form->{report} });
110 $accrual = ($eur) ? "" : "checked";
111 $cash = ($eur) ? "checked" : "";
113 $year = (localtime)[5] + 1900;
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 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
136 my %project_labels = ();
137 my @project_values = ("");
138 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
139 push(@project_values, $item->{"id"});
140 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
144 NTI($cgi->popup_menu('-name' => "project_id",
145 '-values' => \@project_values,
146 '-labels' => \%project_labels));
148 # use JavaScript Calendar or not
149 $form->{jsscript} = $jscalendar;
151 if ($form->{report} eq "ustva") {
154 if ($form->{report} eq "balance_sheet") {
155 $name_1 = "asofdate";
157 $value_1 = "$form->{asofdate}";
158 $trigger_1 = "trigger1";
159 $name_2 = "compareasofdate";
160 $id_2 = "compareasofdate";
161 $value_2 = "$form->{compareasofdate}";
162 $trigger_2 = "trigger2";
163 } elsif ($form->{report} =~ /(receipts|payments)$/) {
164 $name_1 = "fromdate";
166 $value_1 = "$form->{fromdate}";
167 $trigger_1 = "trigger1";
171 $trigger_2 = "trigger2";
173 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
181 $trigger_2 = "trigger2";
184 $name_1 = "fromdate";
186 $value_1 = "$form->{fromdate}";
187 $trigger_1 = "trigger1";
191 $trigger_2 = "trigger2";
196 # with JavaScript Calendar
197 if ($form->{jsscript}) {
201 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
203 <input type=button name=$name_2 id="$trigger_2" value=|
204 . $locale->text('button') . qq|>|;
208 Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
211 <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
213 <input type=button name=$name_1 id="$trigger_1" value=|
214 . $locale->text('button') . qq|>|;
216 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
218 <input type=button name=$name_2 id="$trigger_2" value=|
219 . $locale->text('button') . qq|>
224 Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
225 "$name_2", "BL", "$trigger_2");
229 # without JavaScript Calendar
232 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
235 qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1 onBlur=\"check_right_date_format(this)\">|;
237 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
240 $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
242 $onload = qq|focus()|;
243 $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
244 $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
246 <body onLoad="$onload">
248 <form method=post action=$form->{script}>
250 <input type=hidden name=title value="$form->{title}">
254 <th class=listtop>$form->{title}</th>
263 if ($form->{report} eq "projects") {
266 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
267 <td colspan=5><input name=projectnumber size=25</td>
269 <input type=hidden name=nextsub value=generate_projects>
271 <th align=right>| . $locale->text('From') . qq|</th>
274 <th align=right>| . $locale->text('Bis') . qq|</th>
285 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
286 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
287 . $locale->text('Heading') . qq|
288 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
289 . $locale->text('Subtotal') . qq|</td>
296 if ($form->{report} eq "income_statement") {
299 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
300 <td colspan=3>$projectnumber</td>
302 <input type=hidden name=nextsub value=generate_income_statement>
306 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
307 . $locale->text('Customized Report') . qq|</th>
310 <th colspan=1>| . $locale->text('Year') . qq|</th>
311 <td><input name=year size=11 title="|
312 . $locale->text('YYYY') . qq|" value="$year"></td>
319 <b> | . $locale->text('Yearly') . qq|</b> </td>
320 <th align=left>| . $locale->text('Quarterly') . qq|</th>
321 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
324 <td align=right> <input name=duetyp class=radio type=radio value="13"
326 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
327 . $locale->text('Quarter') . qq|</td>
331 <td><input name=duetyp class=radio type=radio value="1" $checked > |
332 . $locale->text('January') . qq|</td>
336 <td><input name=duetyp class=radio type=radio value="5" $checked > |
337 . $locale->text('May') . qq|</td>
338 <td><input name=duetyp class=radio type=radio value="9" $checked > |
339 . $locale->text('September') . qq|</td>
343 <td align= right> </td>
344 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
345 . $locale->text('Quarter') . qq|</td>
346 <td><input name=duetyp class=radio type=radio value="2" $checked > |
347 . $locale->text('February') . qq|</td>
348 <td><input name=duetyp class=radio type=radio value="6" $checked > |
349 . $locale->text('June') . qq|</td>
350 <td><input name=duetyp class=radio type=radio value="10" $checked > |
351 . $locale->text('October') . qq|</td>
355 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
356 . $locale->text('Quarter') . qq|</td>
357 <td><input name=duetyp class=radio type=radio value="3" $checked > |
358 . $locale->text('March') . qq|</td>
359 <td><input name=duetyp class=radio type=radio value="7" $checked > |
360 . $locale->text('July') . qq|</td>
361 <td><input name=duetyp class=radio type=radio value="11" $checked > |
362 . $locale->text('November') . qq|</td>
367 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
368 . $locale->text('Quarter') . qq| </td>
369 <td><input name=duetyp class=radio type=radio value="4" $checked > |
370 . $locale->text('April') . qq|</td>
371 <td><input name=duetyp class=radio type=radio value="8" $checked > |
372 . $locale->text('August') . qq|</td>
373 <td><input name=duetyp class=radio type=radio value="12" $checked > |
374 . $locale->text('December') . qq|</td>
378 <td colspan=5><hr size=3 noshade></td>
381 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
382 . $locale->text('Free report period') . qq|</th>
383 <td align=left colspan=4>| . $locale->text('From') . qq|
386 | . $locale->text('Bis') . qq|
392 <td colspan=5><hr size=3 noshade></td>
395 <th align=leftt>| . $locale->text('Method') . qq|</th>
396 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
397 . $locale->text('Accrual') . qq|
398 <input name=method class=radio type=radio value=cash $cash>|
399 . $locale->text('EUR') . qq|</td>
406 if ($form->{report} eq "bwa") {
409 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
410 <td colspan=3>$projectnumber</td>
412 <input type=hidden name=nextsub value=generate_bwa>
416 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
417 . $locale->text('Customized Report') . qq|</th>
420 <th colspan=1>| . $locale->text('Year') . qq|</th>
421 <td><input name=year size=11 title="|
422 . $locale->text('YYYY') . qq|" value="$year"></td>
429 <b> | . $locale->text('Yearly') . qq|</b> </td>
430 <th align=left>| . $locale->text('Quarterly') . qq|</th>
431 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
434 <td align=right> <input name=duetyp class=radio type=radio value="13"
436 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
437 . $locale->text('Quarter') . qq|</td>
439 $checked = "checked";
441 <td><input name=duetyp class=radio type=radio value="1" $checked > |
442 . $locale->text('January') . qq|</td>
446 <td><input name=duetyp class=radio type=radio value="5" $checked > |
447 . $locale->text('May') . qq|</td>
448 <td><input name=duetyp class=radio type=radio value="9" $checked > |
449 . $locale->text('September') . qq|</td>
453 <td align= right> </td>
454 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
455 . $locale->text('Quarter') . qq|</td>
456 <td><input name=duetyp class=radio type=radio value="2" $checked > |
457 . $locale->text('February') . qq|</td>
458 <td><input name=duetyp class=radio type=radio value="6" $checked > |
459 . $locale->text('June') . qq|</td>
460 <td><input name=duetyp class=radio type=radio value="10" $checked > |
461 . $locale->text('October') . qq|</td>
465 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
466 . $locale->text('Quarter') . qq|</td>
467 <td><input name=duetyp class=radio type=radio value="3" $checked > |
468 . $locale->text('March') . qq|</td>
469 <td><input name=duetyp class=radio type=radio value="7" $checked > |
470 . $locale->text('July') . qq|</td>
471 <td><input name=duetyp class=radio type=radio value="11" $checked > |
472 . $locale->text('November') . qq|</td>
477 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
478 . $locale->text('Quarter') . qq| </td>
479 <td><input name=duetyp class=radio type=radio value="4" $checked > |
480 . $locale->text('April') . qq|</td>
481 <td><input name=duetyp class=radio type=radio value="8" $checked > |
482 . $locale->text('August') . qq|</td>
483 <td><input name=duetyp class=radio type=radio value="12" $checked > |
484 . $locale->text('December') . qq|</td>
488 <td colspan=5><hr size=3 noshade></td>
491 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
492 . $locale->text('Free report period') . qq|</th>
493 <td align=left colspan=4>| . $locale->text('From') . qq|
496 | . $locale->text('Bis') . qq|
502 <td colspan=5><hr size=3 noshade></td>
505 <th align=leftt>| . $locale->text('Method') . qq|</th>
506 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
507 . $locale->text('Accrual') . qq|
508 <input name=method class=radio type=radio value=cash $cash>|
509 . $locale->text('EUR') . qq|</td>
512 <th align=right colspan=4>|
513 . $locale->text('Decimalplaces')
515 <td><input name=decimalplaces size=3 value="2"></td>
522 if ($form->{report} eq "ustva") {
527 <input type=hidden name=nextsub value=generate_ustva>
531 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
532 . $locale->text('Zeitraum') . qq|</th>
535 <th colspan=1>| . $locale->text('Year') . qq|</th>
536 <td><input name=year size=11 title="|
537 . $locale->text('YYYY') . qq|" value="$year"></td>
544 <b> | . $locale->text('Yearly') . qq|</b> </td>
545 <th align=left>| . $locale->text('Quarterly') . qq|</th>
546 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
549 <td align=right> <input name=duetyp class=radio type=radio value="13"
551 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
552 . $locale->text('Quarter') . qq|</td>
554 $checked = "checked";
556 <td><input name=duetyp class=radio type=radio value="1" $checked > |
557 . $locale->text('January') . qq|</td>
561 <td><input name=duetyp class=radio type=radio value="5" $checked > |
562 . $locale->text('May') . qq|</td>
563 <td><input name=duetyp class=radio type=radio value="9" $checked > |
564 . $locale->text('September') . qq|</td>
568 <td align= right> </td>
569 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
570 . $locale->text('Quarter') . qq|</td>
571 <td><input name=duetyp class=radio type=radio value="2" $checked > |
572 . $locale->text('February') . qq|</td>
573 <td><input name=duetyp class=radio type=radio value="6" $checked > |
574 . $locale->text('June') . qq|</td>
575 <td><input name=duetyp class=radio type=radio value="10" $checked > |
576 . $locale->text('October') . qq|</td>
580 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
581 . $locale->text('Quarter') . qq|</td>
582 <td><input name=duetyp class=radio type=radio value="3" $checked > |
583 . $locale->text('March') . qq|</td>
584 <td><input name=duetyp class=radio type=radio value="7" $checked > |
585 . $locale->text('July') . qq|</td>
586 <td><input name=duetyp class=radio type=radio value="11" $checked > |
587 . $locale->text('November') . qq|</td>
592 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
593 . $locale->text('Quarter') . qq| </td>
594 <td><input name=duetyp class=radio type=radio value="4" $checked > |
595 . $locale->text('April') . qq|</td>
596 <td><input name=duetyp class=radio type=radio value="8" $checked > |
597 . $locale->text('August') . qq|</td>
598 <td><input name=duetyp class=radio type=radio value="12" $checked > |
599 . $locale->text('December') . qq|</td>
603 <td colspan=5><hr size=3 noshade></td>
606 <th align=left>| . $locale->text('Method') . qq|</th>
607 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
608 . $locale->text('Accrual') . qq|
609 <input name=method class=radio type=radio value=cash $cash>|
610 . $locale->text('EUR') . qq|</td>
623 if ($form->{report} eq "balance_sheet") {
625 <input type=hidden name=nextsub value=generate_balance_sheet>
627 <th align=right>| . $locale->text('as at') . qq|</th>
632 <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
639 <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
640 <td><input name=decimalplaces size=3 value="2"></td>
649 <th align=right>| . $locale->text('Method') . qq|</th>
650 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
651 . $locale->text('Accrual') . qq|
652 <input name=method class=radio type=radio value=cash $cash>|
653 . $locale->text('EUR') . qq|</td>
657 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
658 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
659 . $locale->text('Heading') . qq|
660 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
661 . $locale->text('Subtotal') . qq|
662 <input name=l_accno class=checkbox type=checkbox value=Y> |
663 . $locale->text('Account Number') . qq|</td>
670 if ($form->{report} eq "trial_balance") {
672 <input type=hidden name=nextsub value=generate_trial_balance>
673 <input type=hidden name=eur value=$eur>
675 <th align=right>| . $locale->text('From') . qq|</th>
680 <th align=right>| . $locale->text('Bis') . qq|</th>
693 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
694 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
695 . $locale->text('Heading') . qq|
696 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
697 . $locale->text('Subtotal') . qq|
698 <input name=all_accounts class=checkbox type=checkbox value=Y> |
699 . $locale->text('All Accounts') . qq|</td>
706 if ($form->{report} =~ /^tax_/) {
707 $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
709 RP->get_taxaccounts(\%myconfig, \%$form);
712 <input type=hidden name=nextsub value=generate_tax_report>
714 <th align=right>| . $locale->text('From') . qq|</th>
715 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
716 <th align=right>| . $locale->text('Bis') . qq|</th>
717 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
720 <th align=right>| . $locale->text('Report for') . qq|</th>
724 $checked = "checked";
725 foreach $ref (@{ $form->{taxaccounts} }) {
728 qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
730 <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
731 <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
738 <input type=hidden name=db value=$form->{db}>
739 <input type=hidden name=sort value=transdate>
744 <th align=right>| . $locale->text('Method') . qq|</th>
745 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
746 . $locale->text('Accrual') . qq|
747 <input name=method class=radio type=radio value=cash $cash>|
748 . $locale->text('EUR') . qq|</td>
757 <th align=right>| . $locale->text('Include in Report') . qq|</th>
761 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
762 <td>| . $locale->text('ID') . qq|</td>
763 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
764 <td>| . $locale->text('Invoice') . qq|</td>
765 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
766 <td>| . $locale->text('Date') . qq|</td>
769 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
772 if ($form->{db} eq 'ar') {
773 print $locale->text('Customer');
775 if ($form->{db} eq 'ap') {
776 print $locale->text('Vendor');
780 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
781 <td>| . $locale->text('Amount') . qq|</td>
782 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
783 <td>| . $locale->text('Tax') . qq|</td>
784 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
785 <td>| . $locale->text('Total') . qq|</td>
788 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
789 <td>| . $locale->text('Subtotal') . qq|</td>
798 if ($form->{report} =~ /^nontaxable_/) {
799 $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
802 <input type=hidden name=nextsub value=generate_tax_report>
804 <input type=hidden name=db value=$form->{db}>
805 <input type=hidden name=sort value=transdate>
806 <input type=hidden name=report value=$form->{report}>
809 <th align=right>| . $locale->text('From') . qq|</th>
810 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
811 <th align=right>| . $locale->text('Bis') . qq|</th>
812 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
815 <th align=right>| . $locale->text('Method') . qq|</th>
816 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
817 . $locale->text('Accrual') . qq|
818 <input name=method class=radio type=radio value=cash $cash>|
819 . $locale->text('EUR') . qq|</td>
822 <th align=right>| . $locale->text('Include in Report') . qq|</th>
826 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
827 <td>| . $locale->text('ID') . qq|</td>
828 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
829 <td>| . $locale->text('Invoice') . qq|</td>
830 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
831 <td>| . $locale->text('Date') . qq|</td>
834 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
837 if ($form->{db} eq 'ar') {
838 print $locale->text('Customer');
840 if ($form->{db} eq 'ap') {
841 print $locale->text('Vendor');
845 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
846 <td>| . $locale->text('Amount') . qq|</td>
847 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
848 <td>| . $locale->text('Total') . qq|</td>
851 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
852 <td>| . $locale->text('Subtotal') . qq|</td>
861 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
862 if ($form->{report} eq 'ar_aging') {
863 $label = $locale->text('Customer');
864 $form->{vc} = 'customer';
866 $label = $locale->text('Vendor');
867 $form->{vc} = 'vendor';
870 $nextsub = "generate_$form->{report}";
873 $form->all_vc(\%myconfig, $form->{vc},
874 ($form->{vc} eq 'customer') ? "AR" : "AP");
876 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
877 @{ $form->{"all_$form->{vc}"} };
881 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
882 : qq|<input name=$form->{vc} size=35>|;
886 <th align=right>| . $locale->text($label) . qq|</th>
890 <th align=right>| . $locale->text('Bis') . qq|</th>
896 <input type=hidden name=type value=statement>
897 <input type=hidden name=format value=html>
898 <input type=hidden name=media value=screen>
900 <input type=hidden name=nextsub value=$nextsub>
901 <input type=hidden name=action value=$nextsub>
907 # above action can be removed if there is more than one input field
909 if ($form->{report} =~ /(receipts|payments)$/) {
910 $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
912 RP->paymentaccounts(\%myconfig, \%$form);
914 $selection = "<option>\n";
915 foreach $ref (@{ $form->{PR} }) {
916 $paymentaccounts .= "$ref->{accno} ";
917 $selection .= "<option>$ref->{accno}--$ref->{description}\n";
920 chop $paymentaccounts;
923 <input type=hidden name=nextsub value=list_payments>
925 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
926 <td colspan=3><select name=account>$selection</select>
927 <input type=hidden name=paymentaccounts value="$paymentaccounts">
931 <th align=right>| . $locale->text('Reference') . qq|</th>
932 <td colspan=3><input name=reference></td>
935 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
936 <td colspan=3><input name=source></td>
939 <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
940 <td colspan=3><input name=memo size=30></td>
943 <th align=right>| . $locale->text('From') . qq|</th>
948 <th align=right>| . $locale->text('Bis') . qq|</th>
955 <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
956 <th align=left colspan=3>|
957 . $locale->text('Include Exchangerate Difference') . qq|</td>
962 <input type=hidden name=db value=$form->{db}>
963 <input type=hidden name=sort value=transdate>
974 <td><hr size=3 noshade></td>
979 <input type=hidden name=login value=$form->{login}>
980 <input type=hidden name=password value=$form->{password}>
982 <input type=submit class=submit name=action value="|
983 . $locale->text('Continue') . qq|">
986 # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
987 USTVA->get_config($userspath, 'finanzamt.ini');
989 $disabled = qq|disabled="disabled"|;
990 $disabled = '' if ($form->{elster} eq '1');
991 if ($form->{report} eq 'ustva') {
993 <input type=submit class=submit name=action value="|
994 . $locale->text('debug') . qq|">
995 <input type=submit class=submit name=action $disabled
996 value="| . $locale->text('winston_export') . qq|">
999 <input type=submit class=submit name=action value="|
1000 . $locale->text('config') . qq|">
1011 $lxdebug->leave_sub();
1014 sub continue { call_sub($form->{"nextsub"}); }
1017 $lxdebug->enter_sub();
1018 my $nextsub = shift;
1020 $form->{project_id} = $form->{project_id_1};
1021 if ($form->{projectnumber} && !$form->{project_id}) {
1022 $form->{rowcount} = 1;
1024 # call this instead of update
1025 $form->{update} = $nextsub;
1026 $form->{projectnumber_1} = $form->{projectnumber};
1028 delete $form->{sort};
1031 # if there is one only, assign id
1032 $form->{project_id} = $form->{project_id_1};
1035 $lxdebug->leave_sub();
1038 sub generate_income_statement {
1039 $lxdebug->enter_sub();
1041 $form->{padding} = " ";
1042 $form->{bold} = "<b>";
1043 $form->{endbold} = "</b>";
1044 $form->{br} = "<br>";
1046 if ($form->{reporttype} eq "custom") {
1048 #forgotten the year --> thisyear
1049 if ($form->{year} !~ m/^\d\d\d\d$/) {
1050 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
1056 if ($form->{duetyp} eq "13") {
1057 $form->{fromdate} = "1.1.$form->{year}";
1058 $form->{todate} = "31.12.$form->{year}";
1062 if ($form->{duetyp} eq "A") {
1063 $form->{fromdate} = "1.1.$form->{year}";
1064 $form->{todate} = "31.3.$form->{year}";
1066 if ($form->{duetyp} eq "B") {
1067 $form->{fromdate} = "1.4.$form->{year}";
1068 $form->{todate} = "30.6.$form->{year}";
1070 if ($form->{duetyp} eq "C") {
1071 $form->{fromdate} = "1.7.$form->{year}";
1072 $form->{todate} = "30.9.$form->{year}";
1074 if ($form->{duetyp} eq "D") {
1075 $form->{fromdate} = "1.10.$form->{year}";
1076 $form->{todate} = "31.12.$form->{year}";
1081 $form->{duetyp} eq "1" && do {
1082 $form->{fromdate} = "1.1.$form->{year}";
1083 $form->{todate} = "31.1.$form->{year}";
1086 $form->{duetyp} eq "2" && do {
1087 $form->{fromdate} = "1.2.$form->{year}";
1089 #this works from 1901 to 2099, 1900 and 2100 fail.
1090 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
1091 $form->{todate} = "$leap.2.$form->{year}";
1094 $form->{duetyp} eq "3" && do {
1095 $form->{fromdate} = "1.3.$form->{year}";
1096 $form->{todate} = "31.3.$form->{year}";
1099 $form->{duetyp} eq "4" && do {
1100 $form->{fromdate} = "1.4.$form->{year}";
1101 $form->{todate} = "30.4.$form->{year}";
1104 $form->{duetyp} eq "5" && do {
1105 $form->{fromdate} = "1.5.$form->{year}";
1106 $form->{todate} = "31.5.$form->{year}";
1109 $form->{duetyp} eq "6" && do {
1110 $form->{fromdate} = "1.6.$form->{year}";
1111 $form->{todate} = "30.6.$form->{year}";
1114 $form->{duetyp} eq "7" && do {
1115 $form->{fromdate} = "1.7.$form->{year}";
1116 $form->{todate} = "31.7.$form->{year}";
1119 $form->{duetyp} eq "8" && do {
1120 $form->{fromdate} = "1.8.$form->{year}";
1121 $form->{todate} = "31.8.$form->{year}";
1124 $form->{duetyp} eq "9" && do {
1125 $form->{fromdate} = "1.9.$form->{year}";
1126 $form->{todate} = "30.9.$form->{year}";
1129 $form->{duetyp} eq "10" && do {
1130 $form->{fromdate} = "1.10.$form->{year}";
1131 $form->{todate} = "31.10.$form->{year}";
1134 $form->{duetyp} eq "11" && do {
1135 $form->{fromdate} = "1.11.$form->{year}";
1136 $form->{todate} = "30.11.$form->{year}";
1139 $form->{duetyp} eq "12" && do {
1140 $form->{fromdate} = "1.12.$form->{year}";
1141 $form->{todate} = "31.12.$form->{year}";
1147 RP->income_statement(\%myconfig, \%$form);
1149 ($form->{department}) = split /--/, $form->{department};
1152 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1153 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
1155 # if there are any dates construct a where
1156 if ($form->{fromdate} || $form->{todate}) {
1158 unless ($form->{todate}) {
1159 $form->{todate} = $form->current_date(\%myconfig);
1162 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
1163 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
1165 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1166 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
1168 $form->{this_period} = "$shortfromdate\n$shorttodate";
1170 $locale->text('for Period')
1171 . qq|\n$longfromdate |
1172 . $locale->text('Bis')
1176 if ($form->{comparefromdate} || $form->{comparetodate}) {
1177 $longcomparefromdate =
1178 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
1179 $shortcomparefromdate =
1180 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
1182 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
1183 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
1185 $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
1187 "\n$longcomparefromdate "
1188 . $locale->text('Bis')
1189 . qq| $longcomparetodate|;
1192 # setup variables for the form
1193 @a = qw(company address businessnumber);
1194 map { $form->{$_} = $myconfig{$_} } @a;
1196 $form->{templates} = $myconfig{templates};
1198 $form->{IN} = "income_statement.html";
1200 $form->parse_template;
1202 $lxdebug->leave_sub();
1205 sub generate_balance_sheet {
1206 $lxdebug->enter_sub();
1208 $form->{padding} = " ";
1209 $form->{bold} = "<b>";
1210 $form->{endbold} = "</b>";
1211 $form->{br} = "<br>";
1213 RP->balance_sheet(\%myconfig, \%$form);
1215 $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
1217 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1219 ($form->{department}) = split /--/, $form->{department};
1221 # define Current Earnings account
1222 $padding = ($form->{l_heading}) ? $form->{padding} : "";
1223 push(@{ $form->{equity_account} },
1224 $padding . $locale->text('Current Earnings'));
1226 $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
1227 $form->{last_period} =
1228 $locale->date(\%myconfig, $form->{compareasofdate}, 0);
1230 $form->{IN} = "balance_sheet.html";
1232 # setup company variables for the form
1233 map { $form->{$_} = $myconfig{$_};
1234 $form->{$_} =~ s/\\n/\n/g; }
1235 (qw(company address businessnumber nativecurr));
1237 $form->{templates} = $myconfig{templates};
1239 $form->parse_template;
1241 $lxdebug->leave_sub();
1244 sub generate_projects {
1245 $lxdebug->enter_sub();
1247 &get_project(generate_projects);
1248 $form->{projectnumber} = $form->{projectnumber_1};
1250 $form->{nextsub} = "generate_projects";
1251 $form->{title} = $locale->text('Project Transactions');
1252 RP->trial_balance(\%myconfig, \%$form);
1256 $lxdebug->leave_sub();
1262 # included links to display transactions for period entered
1263 # added headers and subtotals
1265 sub generate_trial_balance {
1266 $lxdebug->enter_sub();
1268 # get for each account initial balance, debits and credits
1269 RP->trial_balance(\%myconfig, \%$form);
1271 $form->{nextsub} = "generate_trial_balance";
1272 $form->{title} = $locale->text('Trial Balance');
1275 $lxdebug->leave_sub();
1279 $lxdebug->enter_sub();
1281 $title = $form->escape($form->{title});
1283 if ($form->{department}) {
1284 ($department) = split /--/, $form->{department};
1285 $options = $locale->text('Department') . " : $department<br>";
1286 $department = $form->escape($form->{department});
1288 if ($form->{projectnumber}) {
1290 $locale->text('Project Number') . " : $form->{projectnumber}<br>";
1291 $projectnumber = $form->escape($form->{projectnumber});
1294 # if there are any dates
1295 if ($form->{fromdate} || $form->{todate}) {
1296 if ($form->{fromdate}) {
1297 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1299 if ($form->{todate}) {
1300 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1303 $form->{period} = "$fromdate - $todate";
1306 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1309 $options .= $form->{period};
1311 @column_index = qw(accno description begbalance debit credit endbalance);
1313 $column_header{accno} =
1314 qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
1315 $column_header{description} =
1316 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1317 $column_header{debit} =
1318 qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
1319 $column_header{credit} =
1320 qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
1321 $column_header{begbalance} =
1322 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1323 $column_header{endbalance} =
1324 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1333 <th class=listtop>$form->{title}</th>
1335 <tr height="5"></tr>
1344 map { print "$column_header{$_}\n" } @column_index;
1350 # sort the whole thing by account numbers and display
1351 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
1353 $description = $form->escape($ref->{description});
1356 qq|ca.pl?action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|;
1358 $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
1360 $debit = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit}, 2, " ") : " ";
1361 $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, " ") : " ";
1363 $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
1365 $form->format_amount(\%myconfig,
1366 ($ref->{balance} + $ref->{amount}) * $ml,
1369 # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
1371 if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
1372 map { $column_data{$_} = "<th> </th>" }
1373 qw(accno begbalance endbalance);
1375 $subtotalbegbalance =
1376 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1377 $subtotalendbalance =
1378 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1380 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1382 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1384 $column_data{description} = "<th>$subtotaldescription</th>";
1385 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1386 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1387 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1388 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1391 <tr class=listsubtotal>
1393 map { print "$column_data{$_}\n" } @column_index;
1400 if ($ref->{charttype} eq "H") {
1402 $subtotaldescription = $ref->{description};
1403 $subtotaldebit = $ref->{debit};
1404 $subtotalcredit = $ref->{credit};
1405 $subtotalbegbalance = 0;
1406 $subtotalendbalance = 0;
1408 next unless $form->{l_heading};
1410 map { $column_data{$_} = "<th> </th>" }
1411 qw(accno debit credit begbalance endbalance);
1412 $column_data{description} =
1413 "<th class=listheading>$ref->{description}</th>";
1416 if ($ref->{charttype} eq "A") {
1417 $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
1418 $column_data{description} = "<td>$ref->{description}</td>";
1419 $column_data{debit} = "<td align=right>$debit</td>";
1420 $column_data{credit} = "<td align=right>$credit</td>";
1421 $column_data{begbalance} = "<td align=right>$begbalance</td>";
1422 $column_data{endbalance} = "<td align=right>$endbalance</td>";
1424 $totaldebit += $ref->{debit};
1425 $totalcredit += $ref->{credit};
1427 $subtotalbegbalance += $ref->{balance} * $ml;
1428 $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
1432 if ($ref->{charttype} eq "H") {
1434 <tr class=listheading>
1437 if ($ref->{charttype} eq "A") {
1441 <tr class=listrow$i>
1445 map { print "$column_data{$_}\n" } @column_index;
1452 # print last subtotal
1453 if ($subtotal && $form->{l_subtotal}) {
1454 map { $column_data{$_} = "<th> </th>" }
1455 qw(accno begbalance endbalance);
1456 $subtotalbegbalance =
1457 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1458 $subtotalendbalance =
1459 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1461 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1463 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1464 $column_data{description} = "<th>$subdescription</th>";
1465 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1466 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1467 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1468 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1471 <tr class=listsubtotal>
1473 map { print "$column_data{$_}\n" } @column_index;
1480 $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
1481 $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
1483 map { $column_data{$_} = "<th> </th>" }
1484 qw(accno description begbalance endbalance);
1486 $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
1487 $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
1490 <tr class=listtotal>
1493 map { print "$column_data{$_}\n" } @column_index;
1501 <td><hr size=3 noshade></td>
1509 $lxdebug->leave_sub();
1512 sub generate_ar_aging {
1513 $lxdebug->enter_sub();
1516 ($form->{customer}) = split(/--/, $form->{customer});
1517 $customer = $form->escape($form->{customer}, 1);
1518 $title = $form->escape($form->{title}, 1);
1520 $form->{ct} = "customer";
1521 $form->{arap} = "ar";
1524 qq|$form->{script}?action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
1526 RP->aging(\%myconfig, \%$form);
1529 $lxdebug->leave_sub();
1532 sub generate_ap_aging {
1533 $lxdebug->enter_sub();
1536 ($form->{vendor}) = split(/--/, $form->{vendor});
1537 $vendor = $form->escape($form->{vendor}, 1);
1538 $title = $form->escape($form->{title}, 1);
1540 $form->{ct} = "vendor";
1541 $form->{arap} = "ap";
1544 qq|$form->{script}?action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
1546 RP->aging(\%myconfig, \%$form);
1549 $lxdebug->leave_sub();
1553 $lxdebug->enter_sub();
1557 $column_header{statement} = qq|<th> </th>|;
1558 $column_header{ct} =
1559 qq|<th class=listheading>|
1560 . $locale->text(ucfirst $form->{ct})
1562 $column_header{invnumber} =
1563 qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
1564 $column_header{transdate} =
1565 qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
1566 $column_header{duedate} =
1567 qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
1568 $column_header{c0} =
1569 qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
1570 $column_header{c30} = qq|<th class=listheading>30</th>|;
1571 $column_header{c60} = qq|<th class=listheading>60</th>|;
1572 $column_header{c90} = qq|<th class=listheading>90</th>|;
1575 (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
1577 if ($form->{department}) {
1578 $option .= "\n<br>" if $option;
1579 ($department) = split /--/, $form->{department};
1580 $option .= $locale->text('Department') . " : $department";
1581 $department = $form->escape($form->{department}, 1);
1582 $form->{callback} .= "&department=$department";
1585 if ($form->{arap} eq 'ar') {
1586 if ($form->{customer}) {
1587 $option .= "\n<br>" if $option;
1588 $option .= $form->{customer};
1591 if ($form->{arap} eq 'ap') {
1592 shift @column_index;
1593 if ($form->{vendor}) {
1594 $option .= "\n<br>" if $option;
1595 $option .= $form->{vendor};
1599 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1600 $option .= "\n<br>" if $option;
1602 $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
1607 <form method=post action=$form->{script}>
1611 <th class=listtop>$form->{title}</th>
1613 <tr height="5"></tr>
1620 <tr class=listheading>
1623 map { print "$column_header{$_}\n" } @column_index;
1633 foreach $ref (@{ $form->{AG} }) {
1635 if ($ctid != $ref->{ctid}) {
1640 $c0subtotal = ($c0subtotal != 0) ?
1641 $form->format_amount(\%myconfig, $c0subtotal, 2, " ") : "";
1642 $c30subtotal = ($c30subtotal != 0) ?
1643 $form->format_amount(\%myconfig, $c30subtotal, 2, " ") : "";
1644 $c60subtotal = ($c60subtotal != 0) ?
1645 $form->format_amount(\%myconfig, $c60subtotal, 2, " ") : "";
1646 $c90subtotal = ($c90subtotal != 0) ?
1647 $form->format_amount(\%myconfig, $c90subtotal, 2, " ") : "";
1650 $column_data{ct} = qq|<th> </th>|;
1651 $column_data{invnumber} = qq|<th> </th>|;
1652 $column_data{transdate} = qq|<th> </th>|;
1653 $column_data{duedate} = qq|<th> </th>|;
1655 qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1657 qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1659 qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1661 qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1667 <tr class=listsubtotal>
1670 map { print "$column_data{$_}\n" } @column_index;
1672 $column_data{statement} = qq|<td> </td>|;
1686 $column_data{ct} = qq|<td>$ref->{name}</td>|;
1687 $column_data{statement} =
1688 qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
1689 <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
1693 $c0subtotal += $ref->{c0};
1694 $c30subtotal += $ref->{c30};
1695 $c60subtotal += $ref->{c60};
1696 $c90subtotal += $ref->{c90};
1698 $c0total += $ref->{c0};
1699 $c30total += $ref->{c30};
1700 $c60total += $ref->{c60};
1701 $c90total += $ref->{c90};
1703 $ref->{c0} = ($ref->{c0} != 0) ? $form->format_amount(\%myconfig, $ref->{c0}, 2, " ") : "";
1704 $ref->{c30} = ($ref->{c30} != 0) ? $form->format_amount(\%myconfig, $ref->{c30}, 2, " ") : "";
1705 $ref->{c60} = ($ref->{c60} != 0) ? $form->format_amount(\%myconfig, $ref->{c60}, 2, " ") : "";
1706 $ref->{c90} = ($ref->{c90} != 0) ? $form->format_amount(\%myconfig, $ref->{c90}, 2, " ") : "";
1709 qq|$ref->{module}.pl?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
1710 . $form->escape($form->{callback});
1712 $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
1713 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
1714 $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
1715 $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
1716 $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
1717 $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
1718 $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
1723 <tr class=listrow$j>
1726 map { print "$column_data{$_}\n" } @column_index;
1732 $column_data{ct} = qq|<td> </td>|;
1733 $column_data{statement} = qq|<td> </td>|;
1735 $ctid = $ref->{ctid};
1740 $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1741 $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1742 $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1743 $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1746 <tr class=listsubtotal>
1749 map { $column_data{$_} = qq|<th> </th>| } @column_index;
1751 $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1752 $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1753 $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1754 $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1756 map { print "$column_data{$_}\n" } @column_index;
1760 <tr class=listtotal>
1763 $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
1764 $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
1765 $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
1766 $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
1768 $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
1769 $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
1770 $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
1771 $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
1773 map { print "$column_data{$_}\n" } @column_index;
1776 <input type=hidden name=rowcount value=$i>
1785 &print_options if ($form->{arap} eq 'ar');
1791 <td><hr size=3 noshade></td>
1796 if ($form->{arap} eq 'ar') {
1798 <input type=hidden name=todate value=$form->{todate}>
1800 <input type=hidden name=title value="$form->{title}">
1802 <input type=hidden name=arap value=$form->{arap}>
1803 <input type=hidden name=ct value=$form->{ct}>
1804 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
1806 <input type=hidden name=department value="$form->{department}">
1808 <input type=hidden name=login value=$form->{login}>
1809 <input type=hidden name=password value=$form->{password}>
1812 <input class=submit type=submit name=action value="|
1813 . $locale->text('Select all') . qq|">
1814 <input class=submit type=submit name=action value="|
1815 . $locale->text('Print') . qq|">
1816 <input class=submit type=submit name=action value="|
1817 . $locale->text('E-mail') . qq|">|;
1827 $lxdebug->leave_sub();
1831 $lxdebug->enter_sub();
1833 RP->aging(\%myconfig, \%$form);
1835 map { $_->{checked} = "checked" } @{ $form->{AG} };
1839 $lxdebug->leave_sub();
1843 $lxdebug->enter_sub();
1845 # get name and email addresses
1846 for $i (1 .. $form->{rowcount}) {
1847 if ($form->{"statement_$i"}) {
1848 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1849 RP->get_customer(\%myconfig, \%$form);
1855 $form->error($locale->text('Nothing selected!')) unless $selected;
1857 if ($myconfig{role} eq 'admin') {
1859 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
1860 <td><input name=bcc size=30 value="$form->{bcc}"></td>
1864 $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
1866 $form->{media} = "email";
1873 <form method=post action=$form->{script}>
1879 <tr height="5"></tr>
1884 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1885 <td><input name=email size=30 value="$form->{email}"></td>
1886 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
1887 <td><input name=cc size=30 value="$form->{cc}"></td>
1890 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
1891 <td><input name=subject size=30 value="$form->{subject}"></td>
1901 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
1904 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
1915 map { delete $form->{$_} }
1916 qw(action email cc bcc subject message type sendmode format header);
1918 # save all other variables
1919 foreach $key (keys %$form) {
1920 $form->{$key} =~ s/\"/"/g;
1921 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1928 <td><hr size=3 noshade></td>
1932 <input type=hidden name=nextsub value=send_email>
1935 <input name=action class=submit type=submit value="|
1936 . $locale->text('Continue') . qq|">
1943 $lxdebug->leave_sub();
1947 $lxdebug->enter_sub();
1949 $form->{OUT} = "$sendmail";
1951 $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
1952 unless $form->{subject};
1954 RP->aging(\%myconfig, \%$form);
1956 $form->{"statement_1"} = 1;
1961 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
1963 $lxdebug->leave_sub();
1967 $lxdebug->enter_sub();
1969 if ($form->{media} eq 'printer') {
1970 $form->error($locale->text('Select postscript or PDF!'))
1971 if ($form->{format} !~ /(postscript|pdf)/);
1974 for $i (1 .. $form->{rowcount}) {
1975 if ($form->{"statement_$i"}) {
1976 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1982 $form->error($locale->text('Nothing selected!')) unless $selected;
1984 if ($form->{media} eq 'printer') {
1985 $form->{OUT} = "| $myconfig{printer}";
1986 $form->{"$form->{ct}_id"} = "";
1988 $form->{"statement_1"} = 1;
1991 RP->aging(\%myconfig, \%$form);
1995 $form->redirect($locale->text('Statements sent to printer!'))
1996 if ($form->{media} eq 'printer');
1998 $lxdebug->leave_sub();
2002 $lxdebug->enter_sub();
2006 "ä" => "ae", "ö" => "oe", "ü" => "ue",
2007 "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue",
2012 $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
2014 $form->{templates} = "$myconfig{templates}";
2016 my $suffix = "html";
2017 my $attachment_suffix = "html";
2018 if ($form->{format} eq 'postscript') {
2019 $form->{postscript} = 1;
2021 $attachment_suffix = "ps";
2022 } elsif ($form->{format} eq 'pdf') {
2025 $attachment_suffix = "pdf";
2028 $form->{IN} = "$form->{type}.$suffix";
2031 # Save $form->{email} because it will be overwritten.
2032 $form->{EMAIL_RECIPIENT} = $form->{email};
2035 while (@{ $form->{AG} }) {
2037 $ref = shift @{ $form->{AG} };
2039 if ($ctid != $ref->{ctid}) {
2041 $ctid = $ref->{ctid};
2044 if ($form->{"statement_$i"}) {
2047 (name, street, zipcode, city, country, contact, email,
2048 "$form->{ct}phone", "$form->{ct}fax");
2049 map { $form->{$_} = $ref->{$_} } @a;
2051 $form->{ $form->{ct} } = $form->{name};
2052 $form->{"$form->{ct}_id"} = $ref->{ctid};
2054 map { $form->{$_} = () } qw(invnumber invdate duedate);
2056 foreach $item (qw(c0 c30 c60 c90)) {
2057 $form->{$item} = ();
2058 $form->{"${item}total"} = 0;
2061 &statement_details($ref);
2065 if (scalar(@{ $form->{AG} }) > 0) {
2067 # one or more left to go
2068 if ($ctid == $form->{AG}->[0]->{ctid}) {
2069 $ref = shift @{ $form->{AG} };
2070 &statement_details($ref);
2073 $ref = scalar(@{ $form->{AG} });
2079 # set initial ref to 0
2086 $form->{"${_}total"} =
2087 $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
2088 } (c0, c30, c60, c90, "");
2090 $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix";
2091 map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements));
2093 $form->parse_template(\%myconfig, $userspath);
2098 # saving the history
2099 if(!exists $form->{addition} && $form->{id} ne "") {
2100 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
2101 $form->{addition} = "PRINTED";
2102 $form->{what_done} = $form->{type};
2103 $form->save_history($form->dbconnect(\%myconfig));
2105 # /saving the history
2106 $lxdebug->leave_sub();
2109 sub statement_details {
2110 $lxdebug->enter_sub();
2113 push @{ $form->{invnumber} }, $ref->{invnumber};
2114 push @{ $form->{invdate} }, $ref->{transdate};
2115 push @{ $form->{duedate} }, $ref->{duedate};
2117 foreach $item (qw(c0 c30 c60 c90)) {
2118 if ($ref->{exchangerate} * 1) {
2120 $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
2122 $form->{"${item}total"} += $ref->{$item};
2123 $form->{total} += $ref->{$item};
2124 push @{ $form->{$item} },
2125 $form->format_amount(\%myconfig, $ref->{$item}, 2);
2128 $lxdebug->leave_sub();
2131 sub generate_tax_report {
2132 $lxdebug->enter_sub();
2134 RP->tax_report(\%myconfig, \%$form);
2136 $descvar = "$form->{accno}_description";
2137 $description = $form->escape($form->{$descvar});
2138 $ratevar = "$form->{accno}_rate";
2140 $department = $form->escape($form->{department});
2144 "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
2146 # construct callback
2147 $description = $form->escape($form->{$descvar}, 1);
2148 $department = $form->escape($form->{department}, 1);
2150 "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
2152 $title = $form->escape($form->{title});
2153 $href .= "&title=$title";
2154 $title = $form->escape($form->{title}, 1);
2155 $callback .= "&title=$title";
2157 $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
2160 $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2162 foreach $item (@columns) {
2163 if ($form->{"l_$item"} eq "Y") {
2164 push @column_index, $item;
2166 # add column to href and callback
2167 $callback .= "&l_$item=Y";
2168 $href .= "&l_$item=Y";
2172 if ($form->{l_subtotal} eq 'Y') {
2173 $callback .= "&l_subtotal=Y";
2174 $href .= "&l_subtotal=Y";
2177 if ($form->{department}) {
2178 ($department) = split /--/, $form->{department};
2179 $option = $locale->text('Department') . " : $department";
2182 # if there are any dates
2183 if ($form->{fromdate} || $form->{todate}) {
2184 if ($form->{fromdate}) {
2185 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
2187 if ($form->{todate}) {
2188 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
2191 $form->{period} = "$fromdate - $todate";
2194 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2197 if ($form->{db} eq 'ar') {
2198 $name = $locale->text('Customer');
2202 if ($form->{db} eq 'ap') {
2203 $name = $locale->text('Vendor');
2208 $option .= "<br>" if $option;
2209 $option .= "$form->{period}";
2211 $column_header{id} =
2212 qq|<th><a class=listheading href=$href&sort=id>|
2213 . $locale->text('ID')
2215 $column_header{invnumber} =
2216 qq|<th><a class=listheading href=$href&sort=invnumber>|
2217 . $locale->text('Invoice')
2219 $column_header{transdate} =
2220 qq|<th><a class=listheading href=$href&sort=transdate>|
2221 . $locale->text('Date')
2223 $column_header{netamount} =
2224 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
2225 $column_header{tax} =
2226 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
2227 $column_header{amount} =
2228 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
2230 $column_header{name} =
2231 qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
2240 <th class=listtop colspan=$colspan>$form->{title}</th>
2242 <tr height="5"></tr>
2249 <tr class=listheading>
2252 map { print "$column_header{$_}\n" } @column_index;
2258 # add sort and escape callback
2259 $callback = $form->escape($callback . "&sort=$form->{sort}");
2261 if (@{ $form->{TR} }) {
2262 $sameitem = $form->{TR}->[0]->{ $form->{sort} };
2265 foreach $ref (@{ $form->{TR} }) {
2267 $module = ($ref->{invoice}) ? $invoice : $arap;
2269 if ($form->{l_subtotal} eq 'Y') {
2270 if ($sameitem ne $ref->{ $form->{sort} }) {
2272 $sameitem = $ref->{ $form->{sort} };
2276 $totalnetamount += $ref->{netamount};
2277 $totaltax += $ref->{tax};
2278 $ref->{amount} = $ref->{netamount} + $ref->{tax};
2280 $subtotalnetamount += $ref->{netamount};
2281 $subtotaltax += $ref->{tax};
2284 $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2285 } qw(netamount tax amount);
2287 $column_data{id} = qq|<td>$ref->{id}</td>|;
2288 $column_data{invnumber} =
2289 qq|<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
2290 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
2291 $column_data{name} = qq|<td>$ref->{name} </td>|;
2293 map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
2294 qw(netamount tax amount);
2299 <tr class=listrow$i>
2302 map { print "$column_data{$_}\n" } @column_index;
2310 if ($form->{l_subtotal} eq 'Y') {
2314 map { $column_data{$_} = qq|<th> </th>| } @column_index;
2318 <tr class=listtotal>
2322 $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
2324 $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
2325 $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
2327 $column_data{netamount} =
2328 qq|<th class=listtotal align=right>$totalnetamount</th>|;
2329 $column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
2330 $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
2332 map { print "$column_data{$_}\n" } @column_index;
2340 <td><hr size=3 noshade></td>
2348 $lxdebug->leave_sub();
2352 $lxdebug->enter_sub();
2354 map { $column_data{$_} = "<td> </td>" } @column_index;
2356 $subtotalnetamount =
2357 $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
2358 $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
2360 $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
2363 $column_data{netamount} =
2364 "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2365 $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
2366 $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
2368 $subtotalnetamount = 0;
2372 <tr class=listsubtotal>
2374 map { print "\n$column_data{$_}" } @column_index;
2380 $lxdebug->leave_sub();
2384 $lxdebug->enter_sub();
2386 if ($form->{account}) {
2387 ($form->{paymentaccounts}) = split /--/, $form->{account};
2389 if ($form->{department}) {
2390 ($department, $form->{department_id}) = split /--/, $form->{department};
2391 $option = $locale->text('Department') . " : $department";
2394 RP->payments(\%myconfig, \%$form);
2397 $form->sort_columns(qw(transdate reference name paid source memo));
2400 $account = $form->escape($form->{account});
2401 $title = $form->escape($form->{title});
2402 $department = $form->escape($form->{department});
2403 $form->{paymentaccounts} =~ s/ /%20/g;
2404 $reference = $form->escape($form->{reference});
2405 $source = $form->escape($form->{source});
2406 $memo = $form->escape($form->{memo});
2409 "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo";
2411 # construct callback
2412 $account = $form->escape($form->{account}, 1);
2413 $title = $form->escape($form->{title}, 1);
2414 $department = $form->escape($form->{department}, 1);
2415 $reference = $form->escape($form->{reference}, 1);
2416 $source = $form->escape($form->{source}, 1);
2417 $memo = $form->escape($form->{memo}, 1);
2420 "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}";
2421 $callback = $form->escape($form->{callback});
2423 $column_header{name} =
2424 "<th><a class=listheading href=$href&sort=name>"
2425 . $locale->text('Description')
2427 $column_header{reference} =
2428 "<th><a class=listheading href=$href&sort=invnumber>"
2429 . $locale->text('Reference')
2431 $column_header{transdate} =
2432 "<th><a class=listheading href=$href&sort=transdate>"
2433 . $locale->text('Date')
2435 $column_header{paid} =
2436 "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2437 $column_header{source} =
2438 "<th><a class=listheading href=$href&sort=source>"
2439 . $locale->text('Source')
2441 $column_header{memo} =
2442 "<th><a class=listheading href=$href&sort=memo>"
2443 . $locale->text('Memo')
2446 if ($form->{fromdate}) {
2447 $option .= "\n<br>" if ($option);
2449 $locale->text('From') . " "
2450 . $locale->date(\%myconfig, $form->{fromdate}, 1);
2452 if ($form->{todate}) {
2453 $option .= "\n<br>" if ($option);
2455 $locale->text('bis') . " "
2456 . $locale->date(\%myconfig, $form->{todate}, 1);
2459 @column_index = @columns;
2460 $colspan = $#column_index + 1;
2469 <th class=listtop>$form->{title}</th>
2471 <tr height="5"></tr>
2478 <tr class=listheading>
2481 map { print "\n$column_header{$_}" } @column_index;
2487 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2489 next unless @{ $form->{ $ref->{id} } };
2493 <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2497 foreach $payment (@{ $form->{ $ref->{id} } }) {
2499 $module = $payment->{module};
2500 $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2501 $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2504 qq|${module}.pl?ction=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2506 $column_data{name} = "<td>$payment->{name} </td>";
2507 $column_data{reference} =
2508 qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2509 $column_data{transdate} = "<td>$payment->{transdate} </td>";
2510 $column_data{paid} =
2512 . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
2514 $column_data{source} = "<td>$payment->{source} </td>";
2515 $column_data{memo} = "<td>$payment->{memo} </td>";
2517 $subtotalpaid += $payment->{paid};
2518 $totalpaid += $payment->{paid};
2523 <tr class=listrow$i>
2526 map { print "\n$column_data{$_}" } @column_index;
2535 map { $column_data{$_} = "<td> </td>" } @column_index;
2537 $column_data{paid} =
2538 "<th class=listsubtotal align=right>"
2539 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
2542 <tr class=listsubtotal>
2545 map { print "\n$column_data{$_}" } @column_index;
2556 map { $column_data{$_} = "<td> </td>" } @column_index;
2558 $column_data{paid} =
2559 "<th class=listtotal align=right>"
2560 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
2563 <tr class=listtotal>
2566 map { print "\n$column_data{$_}" } @column_index;
2575 <td><hr size=3 noshade></td>
2583 $lxdebug->leave_sub();
2587 $lxdebug->enter_sub();
2592 $lxdebug->leave_sub();
2601 sub winston_export {
2602 $lxdebug->enter_sub();
2605 $form->{winston} = 1;
2607 $lxdebug->leave_sub();
2611 $lxdebug->enter_sub();
2613 $form->{sendmode} = "attachment";
2616 $form->{"format"} ? $form->{"format"} :
2617 $myconfig{"template_format"} ? $myconfig{"template_format"} :
2621 $form->{"copies"} ? $form->{"copies"} :
2622 $myconfig{"copies"} ? $myconfig{"copies"} :
2625 $form->{PD}{ $form->{type} } = "selected";
2626 $form->{DF}{ $form->{format} } = "selected";
2627 $form->{OP}{ $form->{media} } = "selected";
2628 $form->{SM}{ $form->{sendmode} } = "selected";
2630 if ($form->{report} eq 'ustva') {
2632 <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
2635 <option value=statement $form->{PD}{statement}>|
2636 . $locale->text('Statement');
2639 if ($form->{media} eq 'email') {
2641 <option value=attachment $form->{SM}{attachment}>|
2642 . $locale->text('Attachment') . qq|
2643 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
2646 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2647 if ($myconfig{printer} && $latex_templates) {
2649 <option value=printer $form->{OP}{printer}>|
2650 . $locale->text('Printer');
2654 if ($latex_templates) {
2656 <option value=html $form->{DF}{html}>|
2657 . $locale->text('HTML') . qq|
2658 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
2659 if ($form->{report} ne 'ustva') {
2661 <option value=postscript $form->{DF}{postscript}>|
2662 . $locale->text('Postscript');
2669 <td><select name=type>$type</select></td>
2670 <td><select name=format>$format</select></td>
2671 <td><select name=media>$media</select></td>
2674 if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
2676 <td>| . $locale->text('Copies') . qq|
2677 <input name=copies size=2 value=$form->{copies}></td>
2686 $lxdebug->leave_sub();
2690 $lxdebug->enter_sub();
2691 $form->{padding} = " ";
2692 $form->{bold} = "<b>";
2693 $form->{endbold} = "</b>";
2694 $form->{br} = "<br>";
2696 if ($form->{reporttype} eq "custom") {
2698 #forgotten the year --> thisyear
2699 if ($form->{year} !~ m/^\d\d\d\d$/) {
2700 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2706 if ($form->{duetyp} eq "13") {
2707 $form->{fromdate} = "1.1.$form->{year}";
2708 $form->{todate} = "31.12.$form->{year}";
2709 $form->{comparefromdate} = "1.01.$form->{year}";
2710 $form->{comparetodate} = "31.12.$form->{year}";
2714 if ($form->{duetyp} eq "A") {
2715 $form->{fromdate} = "1.1.$form->{year}";
2716 $form->{todate} = "31.3.$form->{year}";
2717 $form->{comparefromdate} = "1.01.$form->{year}";
2718 $form->{comparetodate} = "31.03.$form->{year}";
2720 if ($form->{duetyp} eq "B") {
2721 $form->{fromdate} = "1.4.$form->{year}";
2722 $form->{todate} = "30.6.$form->{year}";
2723 $form->{comparefromdate} = "1.01.$form->{year}";
2724 $form->{comparetodate} = "30.06.$form->{year}";
2726 if ($form->{duetyp} eq "C") {
2727 $form->{fromdate} = "1.7.$form->{year}";
2728 $form->{todate} = "30.9.$form->{year}";
2729 $form->{comparefromdate} = "1.01.$form->{year}";
2730 $form->{comparetodate} = "30.09.$form->{year}";
2732 if ($form->{duetyp} eq "D") {
2733 $form->{fromdate} = "1.10.$form->{year}";
2734 $form->{todate} = "31.12.$form->{year}";
2735 $form->{comparefromdate} = "1.01.$form->{year}";
2736 $form->{comparetodate} = "31.12.$form->{year}";
2741 $form->{duetyp} eq "1" && do {
2742 $form->{fromdate} = "1.1.$form->{year}";
2743 $form->{todate} = "31.1.$form->{year}";
2744 $form->{comparefromdate} = "1.01.$form->{year}";
2745 $form->{comparetodate} = "31.01.$form->{year}";
2748 $form->{duetyp} eq "2" && do {
2749 $form->{fromdate} = "1.2.$form->{year}";
2751 #this works from 1901 to 2099, 1900 and 2100 fail.
2752 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2753 $form->{todate} = "$leap.2.$form->{year}";
2754 $form->{comparefromdate} = "1.01.$form->{year}";
2755 $form->{comparetodate} = "$leap.02.$form->{year}";
2758 $form->{duetyp} eq "3" && do {
2759 $form->{fromdate} = "1.3.$form->{year}";
2760 $form->{todate} = "31.3.$form->{year}";
2761 $form->{comparefromdate} = "1.01.$form->{year}";
2762 $form->{comparetodate} = "31.03.$form->{year}";
2765 $form->{duetyp} eq "4" && do {
2766 $form->{fromdate} = "1.4.$form->{year}";
2767 $form->{todate} = "30.4.$form->{year}";
2768 $form->{comparefromdate} = "1.01.$form->{year}";
2769 $form->{comparetodate} = "30.04.$form->{year}";
2772 $form->{duetyp} eq "5" && do {
2773 $form->{fromdate} = "1.5.$form->{year}";
2774 $form->{todate} = "31.5.$form->{year}";
2775 $form->{comparefromdate} = "1.01.$form->{year}";
2776 $form->{comparetodate} = "31.05.$form->{year}";
2779 $form->{duetyp} eq "6" && do {
2780 $form->{fromdate} = "1.6.$form->{year}";
2781 $form->{todate} = "30.6.$form->{year}";
2782 $form->{comparefromdate} = "1.01.$form->{year}";
2783 $form->{comparetodate} = "30.06.$form->{year}";
2786 $form->{duetyp} eq "7" && do {
2787 $form->{fromdate} = "1.7.$form->{year}";
2788 $form->{todate} = "31.7.$form->{year}";
2789 $form->{comparefromdate} = "1.01.$form->{year}";
2790 $form->{comparetodate} = "31.07.$form->{year}";
2793 $form->{duetyp} eq "8" && do {
2794 $form->{fromdate} = "1.8.$form->{year}";
2795 $form->{todate} = "31.8.$form->{year}";
2796 $form->{comparefromdate} = "1.01.$form->{year}";
2797 $form->{comparetodate} = "31.08.$form->{year}";
2800 $form->{duetyp} eq "9" && do {
2801 $form->{fromdate} = "1.9.$form->{year}";
2802 $form->{todate} = "30.9.$form->{year}";
2803 $form->{comparefromdate} = "1.01.$form->{year}";
2804 $form->{comparetodate} = "30.09.$form->{year}";
2807 $form->{duetyp} eq "10" && do {
2808 $form->{fromdate} = "1.10.$form->{year}";
2809 $form->{todate} = "31.10.$form->{year}";
2810 $form->{comparefromdate} = "1.01.$form->{year}";
2811 $form->{comparetodate} = "31.10.$form->{year}";
2814 $form->{duetyp} eq "11" && do {
2815 $form->{fromdate} = "1.11.$form->{year}";
2816 $form->{todate} = "30.11.$form->{year}";
2817 $form->{comparefromdate} = "1.01.$form->{year}";
2818 $form->{comparetodate} = "30.11.$form->{year}";
2821 $form->{duetyp} eq "12" && do {
2822 $form->{fromdate} = "1.12.$form->{year}";
2823 $form->{todate} = "31.12.$form->{year}";
2824 $form->{comparefromdate} = "1.01.$form->{year}";
2825 $form->{comparetodate} = "31.12.$form->{year}";
2830 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
2831 $form->{fromdate} = "${dd}.${mm}.${yy}";
2832 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
2833 $form->{todate} = "${dd}.${mm}.${yy}";
2834 $form->{comparefromdate} = "01.01.$yy";
2835 $form->{comparetodate} = $form->{todate};
2838 RP->bwa(\%myconfig, \%$form);
2840 ($form->{department}) = split /--/, $form->{department};
2843 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2844 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
2846 # if there are any dates construct a where
2847 if ($form->{fromdate} || $form->{todate}) {
2849 unless ($form->{todate}) {
2850 $form->{todate} = $form->current_date(\%myconfig);
2853 my %germandate = ("dateformat" => "dd.mm.yyyy");
2855 $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
2856 $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
2858 $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
2859 $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
2861 $form->{this_period} = "$shortfromdate\n$shorttodate";
2863 $locale->text('for Period')
2864 . qq|\n$longfromdate |
2865 . $locale->text('bis')
2869 # setup variables for the form
2870 @a = qw(company address businessnumber);
2871 map { $form->{$_} = $myconfig{$_} } @a;
2872 $form->{templates} = $myconfig{templates};
2874 $form->{IN} = "bwa.html";
2876 $form->parse_template;
2878 $lxdebug->leave_sub();
2881 sub generate_ustva {
2882 $lxdebug->enter_sub();
2884 # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
2885 USTVA->get_config($userspath, 'finanzamt.ini');
2887 # &get_project(generate_bwa);
2888 @anmeldungszeitraum =
2889 qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
2891 foreach $item (@anmeldungszeitraum) {
2892 $form->{$item} = "";
2894 if ($form->{reporttype} eq "custom") {
2896 #forgotten the year --> thisyear
2897 if ($form->{year} !~ m/^\d\d\d\d$/) {
2898 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2904 if ($form->{duetyp} eq "13") {
2905 $form->{fromdate} = "1.1.$form->{year}";
2906 $form->{todate} = "31.12.$form->{year}";
2910 if ($form->{duetyp} eq "A") {
2911 $form->{fromdate} = "1.1.$form->{year}";
2912 $form->{todate} = "31.3.$form->{year}";
2913 $form->{"0441"} = "X";
2915 if ($form->{duetyp} eq "B") {
2916 $form->{fromdate} = "1.4.$form->{year}";
2917 $form->{todate} = "30.6.$form->{year}";
2918 $form->{"0442"} = "X";
2920 if ($form->{duetyp} eq "C") {
2921 $form->{fromdate} = "1.7.$form->{year}";
2922 $form->{todate} = "30.9.$form->{year}";
2923 $form->{"0443"} = "X";
2925 if ($form->{duetyp} eq "D") {
2926 $form->{fromdate} = "1.10.$form->{year}";
2927 $form->{todate} = "31.12.$form->{year}";
2928 $form->{"0444"} = "X";
2933 $form->{duetyp} eq "1" && do {
2934 $form->{fromdate} = "1.1.$form->{year}";
2935 $form->{todate} = "31.1.$form->{year}";
2936 $form->{"0401"} = "X";
2939 $form->{duetyp} eq "2" && do {
2940 $form->{fromdate} = "1.2.$form->{year}";
2942 #this works from 1901 to 2099, 1900 and 2100 fail.
2943 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2944 $form->{todate} = "$leap.2.$form->{year}";
2945 $form->{"0402"} = "X";
2948 $form->{duetyp} eq "3" && do {
2949 $form->{fromdate} = "1.3.$form->{year}";
2950 $form->{todate} = "31.3.$form->{year}";
2951 $form->{"0403"} = "X";
2954 $form->{duetyp} eq "4" && do {
2955 $form->{fromdate} = "1.4.$form->{year}";
2956 $form->{todate} = "30.4.$form->{year}";
2957 $form->{"0404"} = "X";
2960 $form->{duetyp} eq "5" && do {
2961 $form->{fromdate} = "1.5.$form->{year}";
2962 $form->{todate} = "31.5.$form->{year}";
2963 $form->{"0405"} = "X";
2966 $form->{duetyp} eq "6" && do {
2967 $form->{fromdate} = "1.6.$form->{year}";
2968 $form->{todate} = "30.6.$form->{year}";
2969 $form->{"0406"} = "X";
2972 $form->{duetyp} eq "7" && do {
2973 $form->{fromdate} = "1.7.$form->{year}";
2974 $form->{todate} = "31.7.$form->{year}";
2975 $form->{"0407"} = "X";
2978 $form->{duetyp} eq "8" && do {
2979 $form->{fromdate} = "1.8.$form->{year}";
2980 $form->{todate} = "31.8.$form->{year}";
2981 $form->{"0408"} = "X";
2984 $form->{duetyp} eq "9" && do {
2985 $form->{fromdate} = "1.9.$form->{year}";
2986 $form->{todate} = "30.9.$form->{year}";
2987 $form->{"0409"} = "X";
2990 $form->{duetyp} eq "10" && do {
2991 $form->{fromdate} = "1.10.$form->{year}";
2992 $form->{todate} = "31.10.$form->{year}";
2993 $form->{"0410"} = "X";
2996 $form->{duetyp} eq "11" && do {
2997 $form->{fromdate} = "1.11.$form->{year}";
2998 $form->{todate} = "30.11.$form->{year}";
2999 $form->{"0411"} = "X";
3002 $form->{duetyp} eq "12" && do {
3003 $form->{fromdate} = "1.12.$form->{year}";
3004 $form->{todate} = "31.12.$form->{year}";
3005 $form->{"0412"} = "X";
3011 # $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
3012 # $form->{year}= $1;
3013 # $form->{fromdate}="1.1.$form->{year}";
3014 # $form->{todate}="31.3.$form->{year}";
3015 # $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3018 RP->ustva(\%myconfig, \%$form);
3020 ($form->{department}) = split /--/, $form->{department};
3023 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3024 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
3026 # if there are any dates construct a where
3027 if ($form->{fromdate} || $form->{todate}) {
3029 unless ($form->{todate}) {
3030 $form->{todate} = $form->current_date(\%myconfig);
3033 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
3034 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
3036 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
3037 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
3039 $form->{this_period} = "$shortfromdate\n$shorttodate";
3041 $locale->text('for Period')
3042 . qq|<br>\n$longfromdate |
3043 . $locale->text('bis')
3047 if ($form->{comparefromdate} || $form->{comparetodate}) {
3048 $longcomparefromdate =
3049 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
3050 $shortcomparefromdate =
3051 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
3053 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
3054 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
3056 $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
3058 "\n$longcomparefromdate "
3059 . $locale->text('bis')
3060 . qq| $longcomparetodate|;
3063 $form->{Datum_heute} =
3064 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
3066 if ( $form->{format} eq 'pdf'
3067 or $form->{format} eq 'postscript') {
3068 $form->{padding} = "~~";
3069 $form->{bold} = "\textbf{";
3070 $form->{endbold} = "}";
3071 $form->{br} = '\\\\';
3073 @numbers = qw(51r 86r 97r 93r 96 43 45
3075 foreach $number (@numbers) {
3076 $form->{$number} =~ s/,/~~/g;
3079 } elsif ($form->{format} eq 'html') {
3080 $form->{padding} = " ";
3081 $form->{bold} = "<b>";
3082 $form->{endbold} = "</b>";
3083 $form->{br} = "<br>"
3087 # setup variables for the form
3088 @a = qw(company address businessnumber);
3089 map { $form->{$_} = $myconfig{$_} } @a;
3091 $form->{address} =~ s/\\n/$form->{br}/g;
3093 if ($form->{winston} eq '1') {
3097 $form->{templates} = $myconfig{templates};
3098 $form->{IN} = "$form->{type}";
3099 $form->{IN} .= '.tex'
3100 if ( $form->{format} eq 'pdf'
3101 or $form->{format} eq 'postscript');
3102 $form->{IN} .= '.html' if ($form->{format} eq 'html');
3104 $form->parse_template(\%myconfig, $userspath);
3106 # $form->parse_template;
3108 $lxdebug->leave_sub();