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";
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 ($null, $null, $null, $null, $null, $year, $null, $null, $null) =
118 $form->all_departments(\%myconfig);
119 if (@{ $form->{all_departments} }) {
120 $form->{selectdepartment} = "<option>\n";
123 $form->{selectdepartment} .=
124 "<option>$_->{description}--$_->{id}\n"
125 } (@{ $form->{all_departments} });
130 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
131 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
133 | if $form->{selectdepartment};
135 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
138 my %project_labels = ();
139 my @project_values = ("");
140 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
141 push(@project_values, $item->{"id"});
142 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
146 NTI($cgi->popup_menu('-name' => "project_id",
147 '-values' => \@project_values,
148 '-labels' => \%project_labels));
150 # use JavaScript Calendar or not
151 $form->{jsscript} = $jscalendar;
153 if ($form->{report} eq "ustva") {
156 if ($form->{report} eq "balance_sheet") {
157 $name_1 = "asofdate";
159 $value_1 = "$form->{asofdate}";
160 $trigger_1 = "trigger1";
161 $name_2 = "compareasofdate";
162 $id_2 = "compareasofdate";
163 $value_2 = "$form->{compareasofdate}";
164 $trigger_2 = "trigger2";
165 } elsif ($form->{report} =~ /(receipts|payments)$/) {
166 $name_1 = "fromdate";
168 $value_1 = "$form->{fromdate}";
169 $trigger_1 = "trigger1";
173 $trigger_2 = "trigger2";
175 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
183 $trigger_2 = "trigger2";
186 $name_1 = "fromdate";
188 $value_1 = "$form->{fromdate}";
189 $trigger_1 = "trigger1";
193 $trigger_2 = "trigger2";
198 # with JavaScript Calendar
199 if ($form->{jsscript}) {
203 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
205 <input type=button name=$name_2 id="$trigger_2" value=|
206 . $locale->text('button') . qq|>|;
210 Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
213 <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
215 <input type=button name=$name_1 id="$trigger_1" value=|
216 . $locale->text('button') . qq|>|;
218 <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
220 <input type=button name=$name_2 id="$trigger_2" value=|
221 . $locale->text('button') . qq|>
226 Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
227 "$name_2", "BL", "$trigger_2");
231 # without JavaScript Calendar
234 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
237 qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1 onBlur=\"check_right_date_format(this)\">|;
239 qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
242 $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
244 $onload = qq|focus()|;
245 $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
246 $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
248 <body onLoad="$onload">
250 <form method=post action=$form->{script}>
252 <input type=hidden name=title value="$form->{title}">
256 <th class=listtop>$form->{title}</th>
265 if ($form->{report} eq "projects") {
268 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
269 <td colspan=5><input name=projectnumber size=25</td>
271 <input type=hidden name=nextsub value=generate_projects>
273 <th align=right>| . $locale->text('From') . qq|</th>
276 <th align=right>| . $locale->text('Bis') . qq|</th>
287 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
288 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
289 . $locale->text('Heading') . qq|
290 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
291 . $locale->text('Subtotal') . qq|</td>
298 if ($form->{report} eq "income_statement") {
301 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
302 <td colspan=3>$projectnumber</td>
304 <input type=hidden name=nextsub value=generate_income_statement>
308 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
309 . $locale->text('Customized Report') . qq|</th>
312 <th colspan=1>| . $locale->text('Year') . qq|</th>
313 <td><input name=year size=11 title="|
314 . $locale->text('YYYY') . qq|" value="$year"></td>
321 <b> | . $locale->text('Yearly') . qq|</b> </td>
322 <th align=left>| . $locale->text('Quarterly') . qq|</th>
323 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
326 <td align=right> <input name=duetyp class=radio type=radio value="13"
328 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
329 . $locale->text('Quarter') . qq|</td>
333 <td><input name=duetyp class=radio type=radio value="1" $checked > |
334 . $locale->text('January') . qq|</td>
338 <td><input name=duetyp class=radio type=radio value="5" $checked > |
339 . $locale->text('May') . qq|</td>
340 <td><input name=duetyp class=radio type=radio value="9" $checked > |
341 . $locale->text('September') . qq|</td>
345 <td align= right> </td>
346 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
347 . $locale->text('Quarter') . qq|</td>
348 <td><input name=duetyp class=radio type=radio value="2" $checked > |
349 . $locale->text('February') . qq|</td>
350 <td><input name=duetyp class=radio type=radio value="6" $checked > |
351 . $locale->text('June') . qq|</td>
352 <td><input name=duetyp class=radio type=radio value="10" $checked > |
353 . $locale->text('October') . qq|</td>
357 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
358 . $locale->text('Quarter') . qq|</td>
359 <td><input name=duetyp class=radio type=radio value="3" $checked > |
360 . $locale->text('March') . qq|</td>
361 <td><input name=duetyp class=radio type=radio value="7" $checked > |
362 . $locale->text('July') . qq|</td>
363 <td><input name=duetyp class=radio type=radio value="11" $checked > |
364 . $locale->text('November') . qq|</td>
369 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
370 . $locale->text('Quarter') . qq| </td>
371 <td><input name=duetyp class=radio type=radio value="4" $checked > |
372 . $locale->text('April') . qq|</td>
373 <td><input name=duetyp class=radio type=radio value="8" $checked > |
374 . $locale->text('August') . qq|</td>
375 <td><input name=duetyp class=radio type=radio value="12" $checked > |
376 . $locale->text('December') . qq|</td>
380 <td colspan=5><hr size=3 noshade></td>
383 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
384 . $locale->text('Free report period') . qq|</th>
385 <td align=left colspan=4>| . $locale->text('From') . qq|
388 | . $locale->text('Bis') . qq|
394 <td colspan=5><hr size=3 noshade></td>
397 <th align=leftt>| . $locale->text('Method') . qq|</th>
398 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
399 . $locale->text('Accrual') . qq|
400 <input name=method class=radio type=radio value=cash $cash>|
401 . $locale->text('EUR') . qq|</td>
408 if ($form->{report} eq "bwa") {
411 <th align=right nowrap>| . $locale->text('Project') . qq|</th>
412 <td colspan=3>$projectnumber</td>
414 <input type=hidden name=nextsub value=generate_bwa>
418 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
419 . $locale->text('Customized Report') . qq|</th>
422 <th colspan=1>| . $locale->text('Year') . qq|</th>
423 <td><input name=year size=11 title="|
424 . $locale->text('YYYY') . qq|" value="$year"></td>
431 <b> | . $locale->text('Yearly') . qq|</b> </td>
432 <th align=left>| . $locale->text('Quarterly') . qq|</th>
433 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
436 <td align=right> <input name=duetyp class=radio type=radio value="13"
438 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
439 . $locale->text('Quarter') . qq|</td>
441 $checked = "checked";
443 <td><input name=duetyp class=radio type=radio value="1" $checked > |
444 . $locale->text('January') . qq|</td>
448 <td><input name=duetyp class=radio type=radio value="5" $checked > |
449 . $locale->text('May') . qq|</td>
450 <td><input name=duetyp class=radio type=radio value="9" $checked > |
451 . $locale->text('September') . qq|</td>
455 <td align= right> </td>
456 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
457 . $locale->text('Quarter') . qq|</td>
458 <td><input name=duetyp class=radio type=radio value="2" $checked > |
459 . $locale->text('February') . qq|</td>
460 <td><input name=duetyp class=radio type=radio value="6" $checked > |
461 . $locale->text('June') . qq|</td>
462 <td><input name=duetyp class=radio type=radio value="10" $checked > |
463 . $locale->text('October') . qq|</td>
467 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
468 . $locale->text('Quarter') . qq|</td>
469 <td><input name=duetyp class=radio type=radio value="3" $checked > |
470 . $locale->text('March') . qq|</td>
471 <td><input name=duetyp class=radio type=radio value="7" $checked > |
472 . $locale->text('July') . qq|</td>
473 <td><input name=duetyp class=radio type=radio value="11" $checked > |
474 . $locale->text('November') . qq|</td>
479 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
480 . $locale->text('Quarter') . qq| </td>
481 <td><input name=duetyp class=radio type=radio value="4" $checked > |
482 . $locale->text('April') . qq|</td>
483 <td><input name=duetyp class=radio type=radio value="8" $checked > |
484 . $locale->text('August') . qq|</td>
485 <td><input name=duetyp class=radio type=radio value="12" $checked > |
486 . $locale->text('December') . qq|</td>
490 <td colspan=5><hr size=3 noshade></td>
493 <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
494 . $locale->text('Free report period') . qq|</th>
495 <td align=left colspan=4>| . $locale->text('From') . qq|
498 | . $locale->text('Bis') . qq|
504 <td colspan=5><hr size=3 noshade></td>
507 <th align=leftt>| . $locale->text('Method') . qq|</th>
508 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
509 . $locale->text('Accrual') . qq|
510 <input name=method class=radio type=radio value=cash $cash>|
511 . $locale->text('EUR') . qq|</td>
514 <th align=right colspan=4>|
515 . $locale->text('Decimalplaces')
517 <td><input name=decimalplaces size=3 value="2"></td>
524 if ($form->{report} eq "ustva") {
529 <input type=hidden name=nextsub value=generate_ustva>
533 <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
534 . $locale->text('Zeitraum') . qq|</th>
537 <th colspan=1>| . $locale->text('Year') . qq|</th>
538 <td><input name=year size=11 title="|
539 . $locale->text('YYYY') . qq|" value="$year"></td>
546 <b> | . $locale->text('Yearly') . qq|</b> </td>
547 <th align=left>| . $locale->text('Quarterly') . qq|</th>
548 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
551 <td align=right> <input name=duetyp class=radio type=radio value="13"
553 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
554 . $locale->text('Quarter') . qq|</td>
556 $checked = "checked";
558 <td><input name=duetyp class=radio type=radio value="1" $checked > |
559 . $locale->text('January') . qq|</td>
563 <td><input name=duetyp class=radio type=radio value="5" $checked > |
564 . $locale->text('May') . qq|</td>
565 <td><input name=duetyp class=radio type=radio value="9" $checked > |
566 . $locale->text('September') . qq|</td>
570 <td align= right> </td>
571 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
572 . $locale->text('Quarter') . qq|</td>
573 <td><input name=duetyp class=radio type=radio value="2" $checked > |
574 . $locale->text('February') . qq|</td>
575 <td><input name=duetyp class=radio type=radio value="6" $checked > |
576 . $locale->text('June') . qq|</td>
577 <td><input name=duetyp class=radio type=radio value="10" $checked > |
578 . $locale->text('October') . qq|</td>
582 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
583 . $locale->text('Quarter') . qq|</td>
584 <td><input name=duetyp class=radio type=radio value="3" $checked > |
585 . $locale->text('March') . qq|</td>
586 <td><input name=duetyp class=radio type=radio value="7" $checked > |
587 . $locale->text('July') . qq|</td>
588 <td><input name=duetyp class=radio type=radio value="11" $checked > |
589 . $locale->text('November') . qq|</td>
594 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
595 . $locale->text('Quarter') . qq| </td>
596 <td><input name=duetyp class=radio type=radio value="4" $checked > |
597 . $locale->text('April') . qq|</td>
598 <td><input name=duetyp class=radio type=radio value="8" $checked > |
599 . $locale->text('August') . qq|</td>
600 <td><input name=duetyp class=radio type=radio value="12" $checked > |
601 . $locale->text('December') . qq|</td>
605 <td colspan=5><hr size=3 noshade></td>
608 <th align=left>| . $locale->text('Method') . qq|</th>
609 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
610 . $locale->text('Accrual') . qq|
611 <input name=method class=radio type=radio value=cash $cash>|
612 . $locale->text('EUR') . qq|</td>
625 if ($form->{report} eq "balance_sheet") {
627 <input type=hidden name=nextsub value=generate_balance_sheet>
629 <th align=right>| . $locale->text('as at') . qq|</th>
634 <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
641 <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
642 <td><input name=decimalplaces size=3 value="2"></td>
651 <th align=right>| . $locale->text('Method') . qq|</th>
652 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
653 . $locale->text('Accrual') . qq|
654 <input name=method class=radio type=radio value=cash $cash>|
655 . $locale->text('EUR') . qq|</td>
659 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
660 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
661 . $locale->text('Heading') . qq|
662 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
663 . $locale->text('Subtotal') . qq|
664 <input name=l_accno class=checkbox type=checkbox value=Y> |
665 . $locale->text('Account Number') . qq|</td>
672 if ($form->{report} eq "trial_balance") {
674 <input type=hidden name=nextsub value=generate_trial_balance>
675 <input type=hidden name=eur value=$eur>
677 <th align=right>| . $locale->text('From') . qq|</th>
682 <th align=right>| . $locale->text('Bis') . qq|</th>
695 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
696 <td><input name=l_heading class=checkbox type=checkbox value=Y> |
697 . $locale->text('Heading') . qq|
698 <input name=l_subtotal class=checkbox type=checkbox value=Y> |
699 . $locale->text('Subtotal') . qq|
700 <input name=all_accounts class=checkbox type=checkbox value=Y> |
701 . $locale->text('All Accounts') . qq|</td>
708 if ($form->{report} =~ /^tax_/) {
709 $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
711 RP->get_taxaccounts(\%myconfig, \%$form);
714 <input type=hidden name=nextsub value=generate_tax_report>
716 <th align=right>| . $locale->text('From') . qq|</th>
717 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
718 <th align=right>| . $locale->text('Bis') . qq|</th>
719 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
722 <th align=right>| . $locale->text('Report for') . qq|</th>
726 $checked = "checked";
727 foreach $ref (@{ $form->{taxaccounts} }) {
730 qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
732 <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
733 <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
740 <input type=hidden name=db value=$form->{db}>
741 <input type=hidden name=sort value=transdate>
746 <th align=right>| . $locale->text('Method') . qq|</th>
747 <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
748 . $locale->text('Accrual') . qq|
749 <input name=method class=radio type=radio value=cash $cash>|
750 . $locale->text('EUR') . qq|</td>
759 <th align=right>| . $locale->text('Include in Report') . qq|</th>
763 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
764 <td>| . $locale->text('ID') . qq|</td>
765 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
766 <td>| . $locale->text('Invoice') . qq|</td>
767 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
768 <td>| . $locale->text('Date') . qq|</td>
771 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
774 if ($form->{db} eq 'ar') {
775 print $locale->text('Customer');
777 if ($form->{db} eq 'ap') {
778 print $locale->text('Vendor');
782 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
783 <td>| . $locale->text('Amount') . qq|</td>
784 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
785 <td>| . $locale->text('Tax') . qq|</td>
786 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
787 <td>| . $locale->text('Total') . qq|</td>
790 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
791 <td>| . $locale->text('Subtotal') . qq|</td>
800 if ($form->{report} =~ /^nontaxable_/) {
801 $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
804 <input type=hidden name=nextsub value=generate_tax_report>
806 <input type=hidden name=db value=$form->{db}>
807 <input type=hidden name=sort value=transdate>
808 <input type=hidden name=report value=$form->{report}>
811 <th align=right>| . $locale->text('From') . qq|</th>
812 <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
813 <th align=right>| . $locale->text('Bis') . qq|</th>
814 <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
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') . qq|</td>
824 <th align=right>| . $locale->text('Include in Report') . qq|</th>
828 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
829 <td>| . $locale->text('ID') . qq|</td>
830 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
831 <td>| . $locale->text('Invoice') . qq|</td>
832 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
833 <td>| . $locale->text('Date') . qq|</td>
836 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
839 if ($form->{db} eq 'ar') {
840 print $locale->text('Customer');
842 if ($form->{db} eq 'ap') {
843 print $locale->text('Vendor');
847 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
848 <td>| . $locale->text('Amount') . qq|</td>
849 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
850 <td>| . $locale->text('Total') . qq|</td>
853 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
854 <td>| . $locale->text('Subtotal') . qq|</td>
863 if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
864 if ($form->{report} eq 'ar_aging') {
865 $label = $locale->text('Customer');
866 $form->{vc} = 'customer';
868 $label = $locale->text('Vendor');
869 $form->{vc} = 'vendor';
872 $nextsub = "generate_$form->{report}";
875 $form->all_vc(\%myconfig, $form->{vc},
876 ($form->{vc} eq 'customer') ? "AR" : "AP");
878 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
879 @{ $form->{"all_$form->{vc}"} };
883 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
884 : qq|<input name=$form->{vc} size=35>|;
888 <th align=right>| . $locale->text($label) . qq|</th>
892 <th align=right>| . $locale->text('Bis') . qq|</th>
898 <input type=hidden name=type value=statement>
899 <input type=hidden name=format value=html>
900 <input type=hidden name=media value=screen>
902 <input type=hidden name=nextsub value=$nextsub>
903 <input type=hidden name=action value=$nextsub>
909 # above action can be removed if there is more than one input field
911 if ($form->{report} =~ /(receipts|payments)$/) {
912 $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
914 RP->paymentaccounts(\%myconfig, \%$form);
916 $selection = "<option>\n";
917 foreach $ref (@{ $form->{PR} }) {
918 $paymentaccounts .= "$ref->{accno} ";
919 $selection .= "<option>$ref->{accno}--$ref->{description}\n";
922 chop $paymentaccounts;
925 <input type=hidden name=nextsub value=list_payments>
927 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
928 <td colspan=3><select name=account>$selection</select>
929 <input type=hidden name=paymentaccounts value="$paymentaccounts">
933 <th align=right>| . $locale->text('Reference') . qq|</th>
934 <td colspan=3><input name=reference></td>
937 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
938 <td colspan=3><input name=source></td>
941 <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
942 <td colspan=3><input name=memo size=30></td>
945 <th align=right>| . $locale->text('From') . qq|</th>
950 <th align=right>| . $locale->text('Bis') . qq|</th>
957 <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
958 <th align=left colspan=3>|
959 . $locale->text('Include Exchangerate Difference') . qq|</td>
964 <input type=hidden name=db value=$form->{db}>
965 <input type=hidden name=sort value=transdate>
976 <td><hr size=3 noshade></td>
981 <input type=hidden name=path value=$form->{path}>
982 <input type=hidden name=login value=$form->{login}>
983 <input type=hidden name=password value=$form->{password}>
985 <input type=submit class=submit name=action value="|
986 . $locale->text('Continue') . qq|">
989 # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
990 USTVA->get_config($userspath, 'finanzamt.ini');
992 $disabled = qq|disabled="disabled"|;
993 $disabled = '' if ($form->{elster} eq '1');
994 if ($form->{report} eq 'ustva') {
996 <input type=submit class=submit name=action value="|
997 . $locale->text('debug') . qq|">
998 <input type=submit class=submit name=action $disabled
999 value="| . $locale->text('winston_export') . qq|">
1002 <input type=submit class=submit name=action value="|
1003 . $locale->text('config') . qq|">
1014 $lxdebug->leave_sub();
1017 sub continue { call_sub($form->{"nextsub"}); }
1020 $lxdebug->enter_sub();
1021 my $nextsub = shift;
1023 $form->{project_id} = $form->{project_id_1};
1024 if ($form->{projectnumber} && !$form->{project_id}) {
1025 $form->{rowcount} = 1;
1027 # call this instead of update
1028 $form->{update} = $nextsub;
1029 $form->{projectnumber_1} = $form->{projectnumber};
1031 delete $form->{sort};
1034 # if there is one only, assign id
1035 $form->{project_id} = $form->{project_id_1};
1038 $lxdebug->leave_sub();
1041 sub generate_income_statement {
1042 $lxdebug->enter_sub();
1044 $form->{padding} = " ";
1045 $form->{bold} = "<b>";
1046 $form->{endbold} = "</b>";
1047 $form->{br} = "<br>";
1049 if ($form->{reporttype} eq "custom") {
1051 #forgotten the year --> thisyear
1052 if ($form->{year} !~ m/^\d\d\d\d$/) {
1053 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
1059 if ($form->{duetyp} eq "13") {
1060 $form->{fromdate} = "1.1.$form->{year}";
1061 $form->{todate} = "31.12.$form->{year}";
1065 if ($form->{duetyp} eq "A") {
1066 $form->{fromdate} = "1.1.$form->{year}";
1067 $form->{todate} = "31.3.$form->{year}";
1069 if ($form->{duetyp} eq "B") {
1070 $form->{fromdate} = "1.4.$form->{year}";
1071 $form->{todate} = "30.6.$form->{year}";
1073 if ($form->{duetyp} eq "C") {
1074 $form->{fromdate} = "1.7.$form->{year}";
1075 $form->{todate} = "30.9.$form->{year}";
1077 if ($form->{duetyp} eq "D") {
1078 $form->{fromdate} = "1.10.$form->{year}";
1079 $form->{todate} = "31.12.$form->{year}";
1084 $form->{duetyp} eq "1" && do {
1085 $form->{fromdate} = "1.1.$form->{year}";
1086 $form->{todate} = "31.1.$form->{year}";
1089 $form->{duetyp} eq "2" && do {
1090 $form->{fromdate} = "1.2.$form->{year}";
1092 #this works from 1901 to 2099, 1900 and 2100 fail.
1093 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
1094 $form->{todate} = "$leap.2.$form->{year}";
1097 $form->{duetyp} eq "3" && do {
1098 $form->{fromdate} = "1.3.$form->{year}";
1099 $form->{todate} = "31.3.$form->{year}";
1102 $form->{duetyp} eq "4" && do {
1103 $form->{fromdate} = "1.4.$form->{year}";
1104 $form->{todate} = "30.4.$form->{year}";
1107 $form->{duetyp} eq "5" && do {
1108 $form->{fromdate} = "1.5.$form->{year}";
1109 $form->{todate} = "31.5.$form->{year}";
1112 $form->{duetyp} eq "6" && do {
1113 $form->{fromdate} = "1.6.$form->{year}";
1114 $form->{todate} = "30.6.$form->{year}";
1117 $form->{duetyp} eq "7" && do {
1118 $form->{fromdate} = "1.7.$form->{year}";
1119 $form->{todate} = "31.7.$form->{year}";
1122 $form->{duetyp} eq "8" && do {
1123 $form->{fromdate} = "1.8.$form->{year}";
1124 $form->{todate} = "31.8.$form->{year}";
1127 $form->{duetyp} eq "9" && do {
1128 $form->{fromdate} = "1.9.$form->{year}";
1129 $form->{todate} = "30.9.$form->{year}";
1132 $form->{duetyp} eq "10" && do {
1133 $form->{fromdate} = "1.10.$form->{year}";
1134 $form->{todate} = "31.10.$form->{year}";
1137 $form->{duetyp} eq "11" && do {
1138 $form->{fromdate} = "1.11.$form->{year}";
1139 $form->{todate} = "30.11.$form->{year}";
1142 $form->{duetyp} eq "12" && do {
1143 $form->{fromdate} = "1.12.$form->{year}";
1144 $form->{todate} = "31.12.$form->{year}";
1150 RP->income_statement(\%myconfig, \%$form);
1152 ($form->{department}) = split /--/, $form->{department};
1155 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1156 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
1158 # if there are any dates construct a where
1159 if ($form->{fromdate} || $form->{todate}) {
1161 unless ($form->{todate}) {
1162 $form->{todate} = $form->current_date(\%myconfig);
1165 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
1166 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
1168 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1169 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
1171 $form->{this_period} = "$shortfromdate\n$shorttodate";
1173 $locale->text('for Period')
1174 . qq|\n$longfromdate |
1175 . $locale->text('Bis')
1179 if ($form->{comparefromdate} || $form->{comparetodate}) {
1180 $longcomparefromdate =
1181 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
1182 $shortcomparefromdate =
1183 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
1185 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
1186 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
1188 $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
1190 "\n$longcomparefromdate "
1191 . $locale->text('Bis')
1192 . qq| $longcomparetodate|;
1195 # setup variables for the form
1196 @a = qw(company address businessnumber);
1197 map { $form->{$_} = $myconfig{$_} } @a;
1199 $form->{templates} = $myconfig{templates};
1201 $form->{IN} = "income_statement.html";
1203 $form->parse_template;
1205 $lxdebug->leave_sub();
1208 sub generate_balance_sheet {
1209 $lxdebug->enter_sub();
1211 $form->{padding} = " ";
1212 $form->{bold} = "<b>";
1213 $form->{endbold} = "</b>";
1214 $form->{br} = "<br>";
1216 RP->balance_sheet(\%myconfig, \%$form);
1218 $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
1220 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1222 ($form->{department}) = split /--/, $form->{department};
1224 # define Current Earnings account
1225 $padding = ($form->{l_heading}) ? $form->{padding} : "";
1226 push(@{ $form->{equity_account} },
1227 $padding . $locale->text('Current Earnings'));
1229 $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
1230 $form->{last_period} =
1231 $locale->date(\%myconfig, $form->{compareasofdate}, 0);
1233 $form->{IN} = "balance_sheet.html";
1235 # setup company variables for the form
1236 map { $form->{$_} = $myconfig{$_};
1237 $form->{$_} =~ s/\\n/\n/g; }
1238 (qw(company address businessnumber nativecurr));
1240 $form->{templates} = $myconfig{templates};
1242 $form->parse_template;
1244 $lxdebug->leave_sub();
1247 sub generate_projects {
1248 $lxdebug->enter_sub();
1250 &get_project(generate_projects);
1251 $form->{projectnumber} = $form->{projectnumber_1};
1253 $form->{nextsub} = "generate_projects";
1254 $form->{title} = $locale->text('Project Transactions');
1255 RP->trial_balance(\%myconfig, \%$form);
1259 $lxdebug->leave_sub();
1265 # included links to display transactions for period entered
1266 # added headers and subtotals
1268 sub generate_trial_balance {
1269 $lxdebug->enter_sub();
1271 # get for each account initial balance, debits and credits
1272 RP->trial_balance(\%myconfig, \%$form);
1274 $form->{nextsub} = "generate_trial_balance";
1275 $form->{title} = $locale->text('Trial Balance');
1278 $lxdebug->leave_sub();
1282 $lxdebug->enter_sub();
1284 $title = $form->escape($form->{title});
1286 if ($form->{department}) {
1287 ($department) = split /--/, $form->{department};
1288 $options = $locale->text('Department') . " : $department<br>";
1289 $department = $form->escape($form->{department});
1291 if ($form->{projectnumber}) {
1293 $locale->text('Project Number') . " : $form->{projectnumber}<br>";
1294 $projectnumber = $form->escape($form->{projectnumber});
1297 # if there are any dates
1298 if ($form->{fromdate} || $form->{todate}) {
1299 if ($form->{fromdate}) {
1300 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
1302 if ($form->{todate}) {
1303 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1306 $form->{period} = "$fromdate - $todate";
1309 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
1312 $options .= $form->{period};
1314 @column_index = qw(accno description begbalance debit credit endbalance);
1316 $column_header{accno} =
1317 qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
1318 $column_header{description} =
1319 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1320 $column_header{debit} =
1321 qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
1322 $column_header{credit} =
1323 qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
1324 $column_header{begbalance} =
1325 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1326 $column_header{endbalance} =
1327 qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
1336 <th class=listtop>$form->{title}</th>
1338 <tr height="5"></tr>
1347 map { print "$column_header{$_}\n" } @column_index;
1353 # sort the whole thing by account numbers and display
1354 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
1356 $description = $form->escape($ref->{description});
1359 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}&accno=$ref->{accno}&description=$description|;
1361 $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
1363 $debit = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit}, 2, " ") : " ";
1364 $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, " ") : " ";
1366 $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
1368 $form->format_amount(\%myconfig,
1369 ($ref->{balance} + $ref->{amount}) * $ml,
1372 # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
1374 if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
1375 map { $column_data{$_} = "<th> </th>" }
1376 qw(accno begbalance endbalance);
1378 $subtotalbegbalance =
1379 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1380 $subtotalendbalance =
1381 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1383 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1385 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1387 $column_data{description} = "<th>$subtotaldescription</th>";
1388 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1389 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1390 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1391 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1394 <tr class=listsubtotal>
1396 map { print "$column_data{$_}\n" } @column_index;
1403 if ($ref->{charttype} eq "H") {
1405 $subtotaldescription = $ref->{description};
1406 $subtotaldebit = $ref->{debit};
1407 $subtotalcredit = $ref->{credit};
1408 $subtotalbegbalance = 0;
1409 $subtotalendbalance = 0;
1411 next unless $form->{l_heading};
1413 map { $column_data{$_} = "<th> </th>" }
1414 qw(accno debit credit begbalance endbalance);
1415 $column_data{description} =
1416 "<th class=listheading>$ref->{description}</th>";
1419 if ($ref->{charttype} eq "A") {
1420 $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
1421 $column_data{description} = "<td>$ref->{description}</td>";
1422 $column_data{debit} = "<td align=right>$debit</td>";
1423 $column_data{credit} = "<td align=right>$credit</td>";
1424 $column_data{begbalance} = "<td align=right>$begbalance</td>";
1425 $column_data{endbalance} = "<td align=right>$endbalance</td>";
1427 $totaldebit += $ref->{debit};
1428 $totalcredit += $ref->{credit};
1430 $subtotalbegbalance += $ref->{balance} * $ml;
1431 $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
1435 if ($ref->{charttype} eq "H") {
1437 <tr class=listheading>
1440 if ($ref->{charttype} eq "A") {
1444 <tr class=listrow$i>
1448 map { print "$column_data{$_}\n" } @column_index;
1455 # print last subtotal
1456 if ($subtotal && $form->{l_subtotal}) {
1457 map { $column_data{$_} = "<th> </th>" }
1458 qw(accno begbalance endbalance);
1459 $subtotalbegbalance =
1460 $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
1461 $subtotalendbalance =
1462 $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
1464 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
1466 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
1467 $column_data{description} = "<th>$subdescription</th>";
1468 $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
1469 $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
1470 $column_data{debit} = "<th align=right>$subtotaldebit</th>";
1471 $column_data{credit} = "<th align=right>$subtotalcredit</th>";
1474 <tr class=listsubtotal>
1476 map { print "$column_data{$_}\n" } @column_index;
1483 $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
1484 $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
1486 map { $column_data{$_} = "<th> </th>" }
1487 qw(accno description begbalance endbalance);
1489 $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
1490 $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
1493 <tr class=listtotal>
1496 map { print "$column_data{$_}\n" } @column_index;
1504 <td><hr size=3 noshade></td>
1512 $lxdebug->leave_sub();
1515 sub generate_ar_aging {
1516 $lxdebug->enter_sub();
1519 ($form->{customer}) = split(/--/, $form->{customer});
1520 $customer = $form->escape($form->{customer}, 1);
1521 $title = $form->escape($form->{title}, 1);
1523 $form->{ct} = "customer";
1524 $form->{arap} = "ar";
1527 qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
1529 RP->aging(\%myconfig, \%$form);
1532 $lxdebug->leave_sub();
1535 sub generate_ap_aging {
1536 $lxdebug->enter_sub();
1539 ($form->{vendor}) = split(/--/, $form->{vendor});
1540 $vendor = $form->escape($form->{vendor}, 1);
1541 $title = $form->escape($form->{title}, 1);
1543 $form->{ct} = "vendor";
1544 $form->{arap} = "ap";
1547 qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
1549 RP->aging(\%myconfig, \%$form);
1552 $lxdebug->leave_sub();
1556 $lxdebug->enter_sub();
1560 $column_header{statement} = qq|<th> </th>|;
1561 $column_header{ct} =
1562 qq|<th class=listheading>|
1563 . $locale->text(ucfirst $form->{ct})
1565 $column_header{invnumber} =
1566 qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
1567 $column_header{transdate} =
1568 qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
1569 $column_header{duedate} =
1570 qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
1571 $column_header{c0} =
1572 qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
1573 $column_header{c30} = qq|<th class=listheading>30</th>|;
1574 $column_header{c60} = qq|<th class=listheading>60</th>|;
1575 $column_header{c90} = qq|<th class=listheading>90</th>|;
1578 (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
1580 if ($form->{department}) {
1581 $option .= "\n<br>" if $option;
1582 ($department) = split /--/, $form->{department};
1583 $option .= $locale->text('Department') . " : $department";
1584 $department = $form->escape($form->{department}, 1);
1585 $form->{callback} .= "&department=$department";
1588 if ($form->{arap} eq 'ar') {
1589 if ($form->{customer}) {
1590 $option .= "\n<br>" if $option;
1591 $option .= $form->{customer};
1594 if ($form->{arap} eq 'ap') {
1595 shift @column_index;
1596 if ($form->{vendor}) {
1597 $option .= "\n<br>" if $option;
1598 $option .= $form->{vendor};
1602 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
1603 $option .= "\n<br>" if $option;
1605 $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
1610 <form method=post action=$form->{script}>
1614 <th class=listtop>$form->{title}</th>
1616 <tr height="5"></tr>
1623 <tr class=listheading>
1626 map { print "$column_header{$_}\n" } @column_index;
1636 foreach $ref (@{ $form->{AG} }) {
1638 if ($ctid != $ref->{ctid}) {
1643 $c0subtotal = ($c0subtotal != 0) ?
1644 $form->format_amount(\%myconfig, $c0subtotal, 2, " ") : "";
1645 $c30subtotal = ($c30subtotal != 0) ?
1646 $form->format_amount(\%myconfig, $c30subtotal, 2, " ") : "";
1647 $c60subtotal = ($c60subtotal != 0) ?
1648 $form->format_amount(\%myconfig, $c60subtotal, 2, " ") : "";
1649 $c90subtotal = ($c90subtotal != 0) ?
1650 $form->format_amount(\%myconfig, $c90subtotal, 2, " ") : "";
1653 $column_data{ct} = qq|<th> </th>|;
1654 $column_data{invnumber} = qq|<th> </th>|;
1655 $column_data{transdate} = qq|<th> </th>|;
1656 $column_data{duedate} = qq|<th> </th>|;
1658 qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1660 qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1662 qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1664 qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1670 <tr class=listsubtotal>
1673 map { print "$column_data{$_}\n" } @column_index;
1675 $column_data{statement} = qq|<td> </td>|;
1689 $column_data{ct} = qq|<td>$ref->{name}</td>|;
1690 $column_data{statement} =
1691 qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
1692 <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
1696 $c0subtotal += $ref->{c0};
1697 $c30subtotal += $ref->{c30};
1698 $c60subtotal += $ref->{c60};
1699 $c90subtotal += $ref->{c90};
1701 $c0total += $ref->{c0};
1702 $c30total += $ref->{c30};
1703 $c60total += $ref->{c60};
1704 $c90total += $ref->{c90};
1706 $ref->{c0} = ($ref->{c0} != 0) ? $form->format_amount(\%myconfig, $ref->{c0}, 2, " ") : "";
1707 $ref->{c30} = ($ref->{c30} != 0) ? $form->format_amount(\%myconfig, $ref->{c30}, 2, " ") : "";
1708 $ref->{c60} = ($ref->{c60} != 0) ? $form->format_amount(\%myconfig, $ref->{c60}, 2, " ") : "";
1709 $ref->{c90} = ($ref->{c90} != 0) ? $form->format_amount(\%myconfig, $ref->{c90}, 2, " ") : "";
1712 qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
1713 . $form->escape($form->{callback});
1715 $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
1716 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
1717 $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
1718 $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
1719 $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
1720 $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
1721 $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
1726 <tr class=listrow$j>
1729 map { print "$column_data{$_}\n" } @column_index;
1735 $column_data{ct} = qq|<td> </td>|;
1736 $column_data{statement} = qq|<td> </td>|;
1738 $ctid = $ref->{ctid};
1743 $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
1744 $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
1745 $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
1746 $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
1749 <tr class=listsubtotal>
1752 map { $column_data{$_} = qq|<th> </th>| } @column_index;
1754 $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
1755 $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
1756 $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
1757 $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
1759 map { print "$column_data{$_}\n" } @column_index;
1763 <tr class=listtotal>
1766 $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
1767 $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
1768 $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
1769 $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
1771 $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
1772 $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
1773 $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
1774 $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
1776 map { print "$column_data{$_}\n" } @column_index;
1779 <input type=hidden name=rowcount value=$i>
1788 &print_options if ($form->{arap} eq 'ar');
1794 <td><hr size=3 noshade></td>
1799 if ($form->{arap} eq 'ar') {
1801 <input type=hidden name=todate value=$form->{todate}>
1803 <input type=hidden name=title value="$form->{title}">
1805 <input type=hidden name=arap value=$form->{arap}>
1806 <input type=hidden name=ct value=$form->{ct}>
1807 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
1809 <input type=hidden name=department value="$form->{department}">
1811 <input type=hidden name=path value=$form->{path}>
1812 <input type=hidden name=login value=$form->{login}>
1813 <input type=hidden name=password value=$form->{password}>
1816 <input class=submit type=submit name=action value="|
1817 . $locale->text('Select all') . qq|">
1818 <input class=submit type=submit name=action value="|
1819 . $locale->text('Print') . qq|">
1820 <input class=submit type=submit name=action value="|
1821 . $locale->text('E-mail') . qq|">|;
1831 $lxdebug->leave_sub();
1835 $lxdebug->enter_sub();
1837 RP->aging(\%myconfig, \%$form);
1839 map { $_->{checked} = "checked" } @{ $form->{AG} };
1843 $lxdebug->leave_sub();
1847 $lxdebug->enter_sub();
1849 # get name and email addresses
1850 for $i (1 .. $form->{rowcount}) {
1851 if ($form->{"statement_$i"}) {
1852 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1853 RP->get_customer(\%myconfig, \%$form);
1859 $form->error($locale->text('Nothing selected!')) unless $selected;
1861 if ($myconfig{role} eq 'admin') {
1863 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
1864 <td><input name=bcc size=30 value="$form->{bcc}"></td>
1868 $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
1870 $form->{media} = "email";
1877 <form method=post action=$form->{script}>
1883 <tr height="5"></tr>
1888 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1889 <td><input name=email size=30 value="$form->{email}"></td>
1890 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
1891 <td><input name=cc size=30 value="$form->{cc}"></td>
1894 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
1895 <td><input name=subject size=30 value="$form->{subject}"></td>
1905 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
1908 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
1919 map { delete $form->{$_} }
1920 qw(action email cc bcc subject message type sendmode format header);
1922 # save all other variables
1923 foreach $key (keys %$form) {
1924 $form->{$key} =~ s/\"/"/g;
1925 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1932 <td><hr size=3 noshade></td>
1936 <input type=hidden name=nextsub value=send_email>
1939 <input name=action class=submit type=submit value="|
1940 . $locale->text('Continue') . qq|">
1947 $lxdebug->leave_sub();
1951 $lxdebug->enter_sub();
1953 $form->{OUT} = "$sendmail";
1955 $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
1956 unless $form->{subject};
1958 RP->aging(\%myconfig, \%$form);
1960 $form->{"statement_1"} = 1;
1965 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
1967 $lxdebug->leave_sub();
1971 $lxdebug->enter_sub();
1973 if ($form->{media} eq 'printer') {
1974 $form->error($locale->text('Select postscript or PDF!'))
1975 if ($form->{format} !~ /(postscript|pdf)/);
1978 for $i (1 .. $form->{rowcount}) {
1979 if ($form->{"statement_$i"}) {
1980 $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1986 $form->error($locale->text('Nothing selected!')) unless $selected;
1988 if ($form->{media} eq 'printer') {
1989 $form->{OUT} = "| $myconfig{printer}";
1990 $form->{"$form->{ct}_id"} = "";
1992 $form->{"statement_1"} = 1;
1995 RP->aging(\%myconfig, \%$form);
1999 $form->redirect($locale->text('Statements sent to printer!'))
2000 if ($form->{media} eq 'printer');
2002 $lxdebug->leave_sub();
2006 $lxdebug->enter_sub();
2010 "ä" => "ae", "ö" => "oe", "ü" => "ue",
2011 "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue",
2016 $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
2018 $form->{templates} = "$myconfig{templates}";
2020 my $suffix = "html";
2021 my $attachment_suffix = "html";
2022 if ($form->{format} eq 'postscript') {
2023 $form->{postscript} = 1;
2025 $attachment_suffix = "ps";
2026 } elsif ($form->{format} eq 'pdf') {
2029 $attachment_suffix = "pdf";
2032 $form->{IN} = "$form->{type}.$suffix";
2035 # Save $form->{email} because it will be overwritten.
2036 $form->{EMAIL_RECIPIENT} = $form->{email};
2039 while (@{ $form->{AG} }) {
2041 $ref = shift @{ $form->{AG} };
2043 if ($ctid != $ref->{ctid}) {
2045 $ctid = $ref->{ctid};
2048 if ($form->{"statement_$i"}) {
2051 (name, street, zipcode, city, country, contact, email,
2052 "$form->{ct}phone", "$form->{ct}fax");
2053 map { $form->{$_} = $ref->{$_} } @a;
2055 $form->{ $form->{ct} } = $form->{name};
2056 $form->{"$form->{ct}_id"} = $ref->{ctid};
2058 map { $form->{$_} = () } qw(invnumber invdate duedate);
2060 foreach $item (qw(c0 c30 c60 c90)) {
2061 $form->{$item} = ();
2062 $form->{"${item}total"} = 0;
2065 &statement_details($ref);
2069 if (scalar(@{ $form->{AG} }) > 0) {
2071 # one or more left to go
2072 if ($ctid == $form->{AG}->[0]->{ctid}) {
2073 $ref = shift @{ $form->{AG} };
2074 &statement_details($ref);
2077 $ref = scalar(@{ $form->{AG} });
2083 # set initial ref to 0
2090 $form->{"${_}total"} =
2091 $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
2092 } (c0, c30, c60, c90, "");
2094 $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix";
2095 map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements));
2097 $form->parse_template(\%myconfig, $userspath);
2102 # saving the history
2103 if(!exists $form->{addition} && $form->{id} ne "") {
2104 $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
2105 $form->{addition} = "PRINTED";
2106 $form->{what_done} = $form->{type};
2107 $form->save_history($form->dbconnect(\%myconfig));
2109 # /saving the history
2110 $lxdebug->leave_sub();
2113 sub statement_details {
2114 $lxdebug->enter_sub();
2117 push @{ $form->{invnumber} }, $ref->{invnumber};
2118 push @{ $form->{invdate} }, $ref->{transdate};
2119 push @{ $form->{duedate} }, $ref->{duedate};
2121 foreach $item (qw(c0 c30 c60 c90)) {
2122 if ($ref->{exchangerate} * 1) {
2124 $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
2126 $form->{"${item}total"} += $ref->{$item};
2127 $form->{total} += $ref->{$item};
2128 push @{ $form->{$item} },
2129 $form->format_amount(\%myconfig, $ref->{$item}, 2);
2132 $lxdebug->leave_sub();
2135 sub generate_tax_report {
2136 $lxdebug->enter_sub();
2138 RP->tax_report(\%myconfig, \%$form);
2140 $descvar = "$form->{accno}_description";
2141 $description = $form->escape($form->{$descvar});
2142 $ratevar = "$form->{accno}_rate";
2144 $department = $form->escape($form->{department});
2148 "$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}";
2150 # construct callback
2151 $description = $form->escape($form->{$descvar}, 1);
2152 $department = $form->escape($form->{department}, 1);
2154 "$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}";
2156 $title = $form->escape($form->{title});
2157 $href .= "&title=$title";
2158 $title = $form->escape($form->{title}, 1);
2159 $callback .= "&title=$title";
2161 $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
2164 $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2166 foreach $item (@columns) {
2167 if ($form->{"l_$item"} eq "Y") {
2168 push @column_index, $item;
2170 # add column to href and callback
2171 $callback .= "&l_$item=Y";
2172 $href .= "&l_$item=Y";
2176 if ($form->{l_subtotal} eq 'Y') {
2177 $callback .= "&l_subtotal=Y";
2178 $href .= "&l_subtotal=Y";
2181 if ($form->{department}) {
2182 ($department) = split /--/, $form->{department};
2183 $option = $locale->text('Department') . " : $department";
2186 # if there are any dates
2187 if ($form->{fromdate} || $form->{todate}) {
2188 if ($form->{fromdate}) {
2189 $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
2191 if ($form->{todate}) {
2192 $todate = $locale->date(\%myconfig, $form->{todate}, 1);
2195 $form->{period} = "$fromdate - $todate";
2198 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2201 if ($form->{db} eq 'ar') {
2202 $name = $locale->text('Customer');
2206 if ($form->{db} eq 'ap') {
2207 $name = $locale->text('Vendor');
2212 $option .= "<br>" if $option;
2213 $option .= "$form->{period}";
2215 $column_header{id} =
2216 qq|<th><a class=listheading href=$href&sort=id>|
2217 . $locale->text('ID')
2219 $column_header{invnumber} =
2220 qq|<th><a class=listheading href=$href&sort=invnumber>|
2221 . $locale->text('Invoice')
2223 $column_header{transdate} =
2224 qq|<th><a class=listheading href=$href&sort=transdate>|
2225 . $locale->text('Date')
2227 $column_header{netamount} =
2228 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
2229 $column_header{tax} =
2230 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
2231 $column_header{amount} =
2232 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
2234 $column_header{name} =
2235 qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
2244 <th class=listtop colspan=$colspan>$form->{title}</th>
2246 <tr height="5"></tr>
2253 <tr class=listheading>
2256 map { print "$column_header{$_}\n" } @column_index;
2262 # add sort and escape callback
2263 $callback = $form->escape($callback . "&sort=$form->{sort}");
2265 if (@{ $form->{TR} }) {
2266 $sameitem = $form->{TR}->[0]->{ $form->{sort} };
2269 foreach $ref (@{ $form->{TR} }) {
2271 $module = ($ref->{invoice}) ? $invoice : $arap;
2273 if ($form->{l_subtotal} eq 'Y') {
2274 if ($sameitem ne $ref->{ $form->{sort} }) {
2276 $sameitem = $ref->{ $form->{sort} };
2280 $totalnetamount += $ref->{netamount};
2281 $totaltax += $ref->{tax};
2282 $ref->{amount} = $ref->{netamount} + $ref->{tax};
2284 $subtotalnetamount += $ref->{netamount};
2285 $subtotaltax += $ref->{tax};
2288 $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2289 } qw(netamount tax amount);
2291 $column_data{id} = qq|<td>$ref->{id}</td>|;
2292 $column_data{invnumber} =
2293 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>|;
2294 $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
2295 $column_data{name} = qq|<td>$ref->{name} </td>|;
2297 map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
2298 qw(netamount tax amount);
2303 <tr class=listrow$i>
2306 map { print "$column_data{$_}\n" } @column_index;
2314 if ($form->{l_subtotal} eq 'Y') {
2318 map { $column_data{$_} = qq|<th> </th>| } @column_index;
2322 <tr class=listtotal>
2326 $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
2328 $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
2329 $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
2331 $column_data{netamount} =
2332 qq|<th class=listtotal align=right>$totalnetamount</th>|;
2333 $column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
2334 $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
2336 map { print "$column_data{$_}\n" } @column_index;
2344 <td><hr size=3 noshade></td>
2352 $lxdebug->leave_sub();
2356 $lxdebug->enter_sub();
2358 map { $column_data{$_} = "<td> </td>" } @column_index;
2360 $subtotalnetamount =
2361 $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
2362 $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
2364 $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
2367 $column_data{netamount} =
2368 "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2369 $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
2370 $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
2372 $subtotalnetamount = 0;
2376 <tr class=listsubtotal>
2378 map { print "\n$column_data{$_}" } @column_index;
2384 $lxdebug->leave_sub();
2388 $lxdebug->enter_sub();
2390 if ($form->{account}) {
2391 ($form->{paymentaccounts}) = split /--/, $form->{account};
2393 if ($form->{department}) {
2394 ($department, $form->{department_id}) = split /--/, $form->{department};
2395 $option = $locale->text('Department') . " : $department";
2398 RP->payments(\%myconfig, \%$form);
2401 $form->sort_columns(qw(transdate reference name paid source memo));
2404 $account = $form->escape($form->{account});
2405 $title = $form->escape($form->{title});
2406 $department = $form->escape($form->{department});
2407 $form->{paymentaccounts} =~ s/ /%20/g;
2408 $reference = $form->escape($form->{reference});
2409 $source = $form->escape($form->{source});
2410 $memo = $form->escape($form->{memo});
2413 "$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";
2415 # construct callback
2416 $account = $form->escape($form->{account}, 1);
2417 $title = $form->escape($form->{title}, 1);
2418 $department = $form->escape($form->{department}, 1);
2419 $reference = $form->escape($form->{reference}, 1);
2420 $source = $form->escape($form->{source}, 1);
2421 $memo = $form->escape($form->{memo}, 1);
2424 "$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}";
2425 $callback = $form->escape($form->{callback});
2427 $column_header{name} =
2428 "<th><a class=listheading href=$href&sort=name>"
2429 . $locale->text('Description')
2431 $column_header{reference} =
2432 "<th><a class=listheading href=$href&sort=invnumber>"
2433 . $locale->text('Reference')
2435 $column_header{transdate} =
2436 "<th><a class=listheading href=$href&sort=transdate>"
2437 . $locale->text('Date')
2439 $column_header{paid} =
2440 "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2441 $column_header{source} =
2442 "<th><a class=listheading href=$href&sort=source>"
2443 . $locale->text('Source')
2445 $column_header{memo} =
2446 "<th><a class=listheading href=$href&sort=memo>"
2447 . $locale->text('Memo')
2450 if ($form->{fromdate}) {
2451 $option .= "\n<br>" if ($option);
2453 $locale->text('From') . " "
2454 . $locale->date(\%myconfig, $form->{fromdate}, 1);
2456 if ($form->{todate}) {
2457 $option .= "\n<br>" if ($option);
2459 $locale->text('bis') . " "
2460 . $locale->date(\%myconfig, $form->{todate}, 1);
2463 @column_index = @columns;
2464 $colspan = $#column_index + 1;
2473 <th class=listtop>$form->{title}</th>
2475 <tr height="5"></tr>
2482 <tr class=listheading>
2485 map { print "\n$column_header{$_}" } @column_index;
2491 foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2493 next unless @{ $form->{ $ref->{id} } };
2497 <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2501 foreach $payment (@{ $form->{ $ref->{id} } }) {
2503 $module = $payment->{module};
2504 $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2505 $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2508 qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2510 $column_data{name} = "<td>$payment->{name} </td>";
2511 $column_data{reference} =
2512 qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2513 $column_data{transdate} = "<td>$payment->{transdate} </td>";
2514 $column_data{paid} =
2516 . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
2518 $column_data{source} = "<td>$payment->{source} </td>";
2519 $column_data{memo} = "<td>$payment->{memo} </td>";
2521 $subtotalpaid += $payment->{paid};
2522 $totalpaid += $payment->{paid};
2527 <tr class=listrow$i>
2530 map { print "\n$column_data{$_}" } @column_index;
2539 map { $column_data{$_} = "<td> </td>" } @column_index;
2541 $column_data{paid} =
2542 "<th class=listsubtotal align=right>"
2543 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
2546 <tr class=listsubtotal>
2549 map { print "\n$column_data{$_}" } @column_index;
2560 map { $column_data{$_} = "<td> </td>" } @column_index;
2562 $column_data{paid} =
2563 "<th class=listtotal align=right>"
2564 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
2567 <tr class=listtotal>
2570 map { print "\n$column_data{$_}" } @column_index;
2579 <td><hr size=3 noshade></td>
2587 $lxdebug->leave_sub();
2591 $lxdebug->enter_sub();
2596 $lxdebug->leave_sub();
2605 sub winston_export {
2606 $lxdebug->enter_sub();
2609 $form->{winston} = 1;
2611 $lxdebug->leave_sub();
2615 $lxdebug->enter_sub();
2617 $form->{sendmode} = "attachment";
2620 $form->{"format"} ? $form->{"format"} :
2621 $myconfig{"template_format"} ? $myconfig{"template_format"} :
2625 $form->{"copies"} ? $form->{"copies"} :
2626 $myconfig{"copies"} ? $myconfig{"copies"} :
2629 $form->{PD}{ $form->{type} } = "selected";
2630 $form->{DF}{ $form->{format} } = "selected";
2631 $form->{OP}{ $form->{media} } = "selected";
2632 $form->{SM}{ $form->{sendmode} } = "selected";
2634 if ($form->{report} eq 'ustva') {
2636 <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
2639 <option value=statement $form->{PD}{statement}>|
2640 . $locale->text('Statement');
2643 if ($form->{media} eq 'email') {
2645 <option value=attachment $form->{SM}{attachment}>|
2646 . $locale->text('Attachment') . qq|
2647 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
2650 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2651 if ($myconfig{printer} && $latex_templates) {
2653 <option value=printer $form->{OP}{printer}>|
2654 . $locale->text('Printer');
2658 if ($latex_templates) {
2660 <option value=html $form->{DF}{html}>|
2661 . $locale->text('HTML') . qq|
2662 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
2663 if ($form->{report} ne 'ustva') {
2665 <option value=postscript $form->{DF}{postscript}>|
2666 . $locale->text('Postscript');
2673 <td><select name=type>$type</select></td>
2674 <td><select name=format>$format</select></td>
2675 <td><select name=media>$media</select></td>
2678 if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
2680 <td>| . $locale->text('Copies') . qq|
2681 <input name=copies size=2 value=$form->{copies}></td>
2690 $lxdebug->leave_sub();
2694 $lxdebug->enter_sub();
2695 $form->{padding} = " ";
2696 $form->{bold} = "<b>";
2697 $form->{endbold} = "</b>";
2698 $form->{br} = "<br>";
2700 if ($form->{reporttype} eq "custom") {
2702 #forgotten the year --> thisyear
2703 if ($form->{year} !~ m/^\d\d\d\d$/) {
2704 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2710 if ($form->{duetyp} eq "13") {
2711 $form->{fromdate} = "1.1.$form->{year}";
2712 $form->{todate} = "31.12.$form->{year}";
2713 $form->{comparefromdate} = "1.01.$form->{year}";
2714 $form->{comparetodate} = "31.12.$form->{year}";
2718 if ($form->{duetyp} eq "A") {
2719 $form->{fromdate} = "1.1.$form->{year}";
2720 $form->{todate} = "31.3.$form->{year}";
2721 $form->{comparefromdate} = "1.01.$form->{year}";
2722 $form->{comparetodate} = "31.03.$form->{year}";
2724 if ($form->{duetyp} eq "B") {
2725 $form->{fromdate} = "1.4.$form->{year}";
2726 $form->{todate} = "30.6.$form->{year}";
2727 $form->{comparefromdate} = "1.01.$form->{year}";
2728 $form->{comparetodate} = "30.06.$form->{year}";
2730 if ($form->{duetyp} eq "C") {
2731 $form->{fromdate} = "1.7.$form->{year}";
2732 $form->{todate} = "30.9.$form->{year}";
2733 $form->{comparefromdate} = "1.01.$form->{year}";
2734 $form->{comparetodate} = "30.09.$form->{year}";
2736 if ($form->{duetyp} eq "D") {
2737 $form->{fromdate} = "1.10.$form->{year}";
2738 $form->{todate} = "31.12.$form->{year}";
2739 $form->{comparefromdate} = "1.01.$form->{year}";
2740 $form->{comparetodate} = "31.12.$form->{year}";
2745 $form->{duetyp} eq "1" && do {
2746 $form->{fromdate} = "1.1.$form->{year}";
2747 $form->{todate} = "31.1.$form->{year}";
2748 $form->{comparefromdate} = "1.01.$form->{year}";
2749 $form->{comparetodate} = "31.01.$form->{year}";
2752 $form->{duetyp} eq "2" && do {
2753 $form->{fromdate} = "1.2.$form->{year}";
2755 #this works from 1901 to 2099, 1900 and 2100 fail.
2756 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2757 $form->{todate} = "$leap.2.$form->{year}";
2758 $form->{comparefromdate} = "1.01.$form->{year}";
2759 $form->{comparetodate} = "$leap.02.$form->{year}";
2762 $form->{duetyp} eq "3" && do {
2763 $form->{fromdate} = "1.3.$form->{year}";
2764 $form->{todate} = "31.3.$form->{year}";
2765 $form->{comparefromdate} = "1.01.$form->{year}";
2766 $form->{comparetodate} = "31.03.$form->{year}";
2769 $form->{duetyp} eq "4" && do {
2770 $form->{fromdate} = "1.4.$form->{year}";
2771 $form->{todate} = "30.4.$form->{year}";
2772 $form->{comparefromdate} = "1.01.$form->{year}";
2773 $form->{comparetodate} = "30.04.$form->{year}";
2776 $form->{duetyp} eq "5" && do {
2777 $form->{fromdate} = "1.5.$form->{year}";
2778 $form->{todate} = "31.5.$form->{year}";
2779 $form->{comparefromdate} = "1.01.$form->{year}";
2780 $form->{comparetodate} = "31.05.$form->{year}";
2783 $form->{duetyp} eq "6" && do {
2784 $form->{fromdate} = "1.6.$form->{year}";
2785 $form->{todate} = "30.6.$form->{year}";
2786 $form->{comparefromdate} = "1.01.$form->{year}";
2787 $form->{comparetodate} = "30.06.$form->{year}";
2790 $form->{duetyp} eq "7" && do {
2791 $form->{fromdate} = "1.7.$form->{year}";
2792 $form->{todate} = "31.7.$form->{year}";
2793 $form->{comparefromdate} = "1.01.$form->{year}";
2794 $form->{comparetodate} = "31.07.$form->{year}";
2797 $form->{duetyp} eq "8" && do {
2798 $form->{fromdate} = "1.8.$form->{year}";
2799 $form->{todate} = "31.8.$form->{year}";
2800 $form->{comparefromdate} = "1.01.$form->{year}";
2801 $form->{comparetodate} = "31.08.$form->{year}";
2804 $form->{duetyp} eq "9" && do {
2805 $form->{fromdate} = "1.9.$form->{year}";
2806 $form->{todate} = "30.9.$form->{year}";
2807 $form->{comparefromdate} = "1.01.$form->{year}";
2808 $form->{comparetodate} = "30.09.$form->{year}";
2811 $form->{duetyp} eq "10" && do {
2812 $form->{fromdate} = "1.10.$form->{year}";
2813 $form->{todate} = "31.10.$form->{year}";
2814 $form->{comparefromdate} = "1.01.$form->{year}";
2815 $form->{comparetodate} = "31.10.$form->{year}";
2818 $form->{duetyp} eq "11" && do {
2819 $form->{fromdate} = "1.11.$form->{year}";
2820 $form->{todate} = "30.11.$form->{year}";
2821 $form->{comparefromdate} = "1.01.$form->{year}";
2822 $form->{comparetodate} = "30.11.$form->{year}";
2825 $form->{duetyp} eq "12" && do {
2826 $form->{fromdate} = "1.12.$form->{year}";
2827 $form->{todate} = "31.12.$form->{year}";
2828 $form->{comparefromdate} = "1.01.$form->{year}";
2829 $form->{comparetodate} = "31.12.$form->{year}";
2834 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
2835 $form->{fromdate} = "${dd}.${mm}.${yy}";
2836 ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
2837 $form->{todate} = "${dd}.${mm}.${yy}";
2838 $form->{comparefromdate} = "01.01.$yy";
2839 $form->{comparetodate} = $form->{todate};
2842 RP->bwa(\%myconfig, \%$form);
2844 ($form->{department}) = split /--/, $form->{department};
2847 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
2848 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
2850 # if there are any dates construct a where
2851 if ($form->{fromdate} || $form->{todate}) {
2853 unless ($form->{todate}) {
2854 $form->{todate} = $form->current_date(\%myconfig);
2857 my %germandate = ("dateformat" => "dd.mm.yyyy");
2859 $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
2860 $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
2862 $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
2863 $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
2865 $form->{this_period} = "$shortfromdate\n$shorttodate";
2867 $locale->text('for Period')
2868 . qq|\n$longfromdate |
2869 . $locale->text('bis')
2873 # setup variables for the form
2874 @a = qw(company address businessnumber);
2875 map { $form->{$_} = $myconfig{$_} } @a;
2876 $form->{templates} = $myconfig{templates};
2878 $form->{IN} = "bwa.html";
2880 $form->parse_template;
2882 $lxdebug->leave_sub();
2885 sub generate_ustva {
2886 $lxdebug->enter_sub();
2888 # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
2889 USTVA->get_config($userspath, 'finanzamt.ini');
2891 # &get_project(generate_bwa);
2892 @anmeldungszeitraum =
2893 qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
2895 foreach $item (@anmeldungszeitraum) {
2896 $form->{$item} = "";
2898 if ($form->{reporttype} eq "custom") {
2900 #forgotten the year --> thisyear
2901 if ($form->{year} !~ m/^\d\d\d\d$/) {
2902 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
2908 if ($form->{duetyp} eq "13") {
2909 $form->{fromdate} = "1.1.$form->{year}";
2910 $form->{todate} = "31.12.$form->{year}";
2914 if ($form->{duetyp} eq "A") {
2915 $form->{fromdate} = "1.1.$form->{year}";
2916 $form->{todate} = "31.3.$form->{year}";
2917 $form->{"0441"} = "X";
2919 if ($form->{duetyp} eq "B") {
2920 $form->{fromdate} = "1.4.$form->{year}";
2921 $form->{todate} = "30.6.$form->{year}";
2922 $form->{"0442"} = "X";
2924 if ($form->{duetyp} eq "C") {
2925 $form->{fromdate} = "1.7.$form->{year}";
2926 $form->{todate} = "30.9.$form->{year}";
2927 $form->{"0443"} = "X";
2929 if ($form->{duetyp} eq "D") {
2930 $form->{fromdate} = "1.10.$form->{year}";
2931 $form->{todate} = "31.12.$form->{year}";
2932 $form->{"0444"} = "X";
2937 $form->{duetyp} eq "1" && do {
2938 $form->{fromdate} = "1.1.$form->{year}";
2939 $form->{todate} = "31.1.$form->{year}";
2940 $form->{"0401"} = "X";
2943 $form->{duetyp} eq "2" && do {
2944 $form->{fromdate} = "1.2.$form->{year}";
2946 #this works from 1901 to 2099, 1900 and 2100 fail.
2947 $leap = ($form->{year} % 4 == 0) ? "29" : "28";
2948 $form->{todate} = "$leap.2.$form->{year}";
2949 $form->{"0402"} = "X";
2952 $form->{duetyp} eq "3" && do {
2953 $form->{fromdate} = "1.3.$form->{year}";
2954 $form->{todate} = "31.3.$form->{year}";
2955 $form->{"0403"} = "X";
2958 $form->{duetyp} eq "4" && do {
2959 $form->{fromdate} = "1.4.$form->{year}";
2960 $form->{todate} = "30.4.$form->{year}";
2961 $form->{"0404"} = "X";
2964 $form->{duetyp} eq "5" && do {
2965 $form->{fromdate} = "1.5.$form->{year}";
2966 $form->{todate} = "31.5.$form->{year}";
2967 $form->{"0405"} = "X";
2970 $form->{duetyp} eq "6" && do {
2971 $form->{fromdate} = "1.6.$form->{year}";
2972 $form->{todate} = "30.6.$form->{year}";
2973 $form->{"0406"} = "X";
2976 $form->{duetyp} eq "7" && do {
2977 $form->{fromdate} = "1.7.$form->{year}";
2978 $form->{todate} = "31.7.$form->{year}";
2979 $form->{"0407"} = "X";
2982 $form->{duetyp} eq "8" && do {
2983 $form->{fromdate} = "1.8.$form->{year}";
2984 $form->{todate} = "31.8.$form->{year}";
2985 $form->{"0408"} = "X";
2988 $form->{duetyp} eq "9" && do {
2989 $form->{fromdate} = "1.9.$form->{year}";
2990 $form->{todate} = "30.9.$form->{year}";
2991 $form->{"0409"} = "X";
2994 $form->{duetyp} eq "10" && do {
2995 $form->{fromdate} = "1.10.$form->{year}";
2996 $form->{todate} = "31.10.$form->{year}";
2997 $form->{"0410"} = "X";
3000 $form->{duetyp} eq "11" && do {
3001 $form->{fromdate} = "1.11.$form->{year}";
3002 $form->{todate} = "30.11.$form->{year}";
3003 $form->{"0411"} = "X";
3006 $form->{duetyp} eq "12" && do {
3007 $form->{fromdate} = "1.12.$form->{year}";
3008 $form->{todate} = "31.12.$form->{year}";
3009 $form->{"0412"} = "X";
3015 # $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
3016 # $form->{year}= $1;
3017 # $form->{fromdate}="1.1.$form->{year}";
3018 # $form->{todate}="31.3.$form->{year}";
3019 # $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3022 RP->ustva(\%myconfig, \%$form);
3024 ($form->{department}) = split /--/, $form->{department};
3027 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
3028 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
3030 # if there are any dates construct a where
3031 if ($form->{fromdate} || $form->{todate}) {
3033 unless ($form->{todate}) {
3034 $form->{todate} = $form->current_date(\%myconfig);
3037 $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
3038 $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
3040 $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
3041 $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
3043 $form->{this_period} = "$shortfromdate\n$shorttodate";
3045 $locale->text('for Period')
3046 . qq|<br>\n$longfromdate |
3047 . $locale->text('bis')
3051 if ($form->{comparefromdate} || $form->{comparetodate}) {
3052 $longcomparefromdate =
3053 $locale->date(\%myconfig, $form->{comparefromdate}, 1);
3054 $shortcomparefromdate =
3055 $locale->date(\%myconfig, $form->{comparefromdate}, 0);
3057 $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
3058 $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
3060 $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
3062 "\n$longcomparefromdate "
3063 . $locale->text('bis')
3064 . qq| $longcomparetodate|;
3067 $form->{Datum_heute} =
3068 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
3070 if ( $form->{format} eq 'pdf'
3071 or $form->{format} eq 'postscript') {
3072 $form->{padding} = "~~";
3073 $form->{bold} = "\textbf{";
3074 $form->{endbold} = "}";
3075 $form->{br} = '\\\\';
3077 @numbers = qw(51r 86r 97r 93r 96 43 45
3079 foreach $number (@numbers) {
3080 $form->{$number} =~ s/,/~~/g;
3083 } elsif ($form->{format} eq 'html') {
3084 $form->{padding} = " ";
3085 $form->{bold} = "<b>";
3086 $form->{endbold} = "</b>";
3087 $form->{br} = "<br>"
3091 # setup variables for the form
3092 @a = qw(company address businessnumber);
3093 map { $form->{$_} = $myconfig{$_} } @a;
3095 $form->{address} =~ s/\\n/$form->{br}/g;
3097 if ($form->{winston} eq '1') {
3101 $form->{templates} = $myconfig{templates};
3102 $form->{IN} = "$form->{type}";
3103 $form->{IN} .= '.tex'
3104 if ( $form->{format} eq 'pdf'
3105 or $form->{format} eq 'postscript');
3106 $form->{IN} .= '.html' if ($form->{format} eq 'html');
3108 $form->parse_template(\%myconfig, $userspath);
3110 # $form->parse_template;
3112 $lxdebug->leave_sub();