1 #=====================================================================
 
   4 # Based on SQL-Ledger Version 2.1.9
 
   5 # Web http://www.lx-office.org
 
   7 #=====================================================================
 
   8 # SQL-Ledger Accounting
 
   9 # Copyright (c) 1998-2002
 
  11 #  Author: Dieter Simader
 
  12 #   Email: dsimader@sql-ledger.org
 
  13 #     Web: http://www.sql-ledger.org
 
  15 #  Contributors: Antonio Gallardo <agssa@ibw.com.ni>
 
  16 #                Benjamin Lee <benjaminlee@consultant.com>
 
  17 #                Philip Reetz <p.reetz@linet-services.de>
 
  20 # This program is free software; you can redistribute it and/or modify
 
  21 # it under the terms of the GNU General Public License as published by
 
  22 # the Free Software Foundation; either version 2 of the License, or
 
  23 # (at your option) any later version.
 
  25 # This program is distributed in the hope that it will be useful,
 
  26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  28 # GNU General Public License for more details.
 
  29 # You should have received a copy of the GNU General Public License
 
  30 # along with this program; if not, write to the Free Software
 
  31 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  32 #======================================================================
 
  34 # module for preparing Income Statement and Balance Sheet
 
  36 #======================================================================
 
  38 require "$form->{path}/arap.pl";
 
  47 # this is for our long dates
 
  48 # $locale->text('January')
 
  49 # $locale->text('February')
 
  50 # $locale->text('March')
 
  51 # $locale->text('April')
 
  52 # $locale->text('May ')
 
  53 # $locale->text('June')
 
  54 # $locale->text('July')
 
  55 # $locale->text('August')
 
  56 # $locale->text('September')
 
  57 # $locale->text('October')
 
  58 # $locale->text('November')
 
  59 # $locale->text('December')
 
  61 # this is for our short month
 
  62 # $locale->text('Jan')
 
  63 # $locale->text('Feb')
 
  64 # $locale->text('Mar')
 
  65 # $locale->text('Apr')
 
  66 # $locale->text('May')
 
  67 # $locale->text('Jun')
 
  68 # $locale->text('Jul')
 
  69 # $locale->text('Aug')
 
  70 # $locale->text('Sep')
 
  71 # $locale->text('Oct')
 
  72 # $locale->text('Nov')
 
  73 # $locale->text('Dec')
 
  75 # $locale->text('Balance Sheet')
 
  76 # $locale->text('Income Statement')
 
  77 # $locale->text('Trial Balance')
 
  78 # $locale->text('AR Aging')
 
  79 # $locale->text('AP Aging')
 
  80 # $locale->text('Tax collected')
 
  81 # $locale->text('Tax paid')
 
  82 # $locale->text('Receipts')
 
  83 # $locale->text('Payments')
 
  84 # $locale->text('Project Transactions')
 
  85 # $locale->text('Non-taxable Sales')
 
  86 # $locale->text('Non-taxable Purchases')
 
  89   $lxdebug->enter_sub();
 
  91   %title = ('balance_sheet'        => 'Balance Sheet',
 
  92             'income_statement'     => 'Income Statement',
 
  93             'trial_balance'        => 'Trial Balance',
 
  94             'ar_aging'             => 'AR Aging',
 
  95             'ap_aging'             => 'Offene Verbindlichkeiten',
 
  96             'tax_collected'        => 'Tax collected',
 
  97             'tax_paid'             => 'Tax paid',
 
  98             'nontaxable_sales'     => 'Non-taxable Sales',
 
  99             'nontaxable_purchases' => 'Non-taxable Purchases',
 
 100             'receipts'             => 'Receipts',
 
 101             'payments'             => 'Payments',
 
 102             'projects'             => 'Project Transactions',
 
 103             'bwa'                  => 'Betriebswirtschaftliche Auswertung',
 
 104             'ustva'                => 'Umsatzsteuervoranmeldung',);
 
 106   $form->{title} = $locale->text($title{ $form->{report} });
 
 108   $accrual = ($eur) ? ""        : "checked";
 
 109   $cash    = ($eur) ? "checked" : "";
 
 111   ($null, $null, $null, $null, $null, $year, $null, $null, $null) =
 
 116   $form->all_departments(\%myconfig);
 
 117   if (@{ $form->{all_departments} }) {
 
 118     $form->{selectdepartment} = "<option>\n";
 
 121       $form->{selectdepartment} .=
 
 122         "<option>$_->{description}--$_->{id}\n"
 
 123     } (@{ $form->{all_departments} });
 
 128           <th align=right nowrap>| . $locale->text('Department') . qq|</th>
 
 129           <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
 
 131 | if $form->{selectdepartment};
 
 133   # use JavaScript Calendar or not
 
 134   $form->{jsscript} = $jscalendar;
 
 136   if ($form->{report} eq "ustva") {
 
 139     if ($form->{report} eq "balance_sheet") {
 
 140       $name_1    = "asofdate";
 
 142       $value_1   = "$form->{asofdate}";
 
 143       $trigger_1 = "trigger1";
 
 144       $name_2    = "compareasofdate";
 
 145       $id_2      = "compareasofdate";
 
 146       $value_2   = "$form->{compareasofdate}";
 
 147       $trigger_2 = "trigger2";
 
 148     } elsif ($form->{report} =~ /(receipts|payments)$/) {
 
 149       $name_1    = "fromdate";
 
 151       $value_1   = "$form->{fromdate}";
 
 152       $trigger_1 = "trigger1";
 
 156       $trigger_2 = "trigger2";
 
 158       if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
 
 166         $trigger_2 = "trigger2";
 
 169         $name_1    = "fromdate";
 
 171         $value_1   = "$form->{fromdate}";
 
 172         $trigger_1 = "trigger1";
 
 176         $trigger_2 = "trigger2";
 
 181   # with JavaScript Calendar
 
 182   if ($form->{jsscript}) {
 
 186          <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
 
 188         <input type=button name=$name_2 id="$trigger_2" value=|
 
 189         . $locale->text('button') . qq|>|;
 
 193         Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
 
 196          <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
 
 198         <input type=button name=$name_1 id="$trigger_1" value=|
 
 199         . $locale->text('button') . qq|>|;
 
 201          <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
 
 203          <input type=button name=$name_2 id="$trigger_2" value=|
 
 204         . $locale->text('button') . qq|>
 
 209         Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
 
 210                             "$name_2", "BL", "$trigger_2");
 
 214     # without JavaScript Calendar
 
 217         qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
 
 220         qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
 
 222         qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
 
 231 <form method=post action=$form->{script}>
 
 233 <input type=hidden name=title value="$form->{title}">
 
 237     <th class=listtop>$form->{title}</th>
 
 246   if ($form->{report} eq "projects") {
 
 249           <th align=right nowrap>| . $locale->text('Project') . qq|</th>
 
 250           <td colspan=5><input name=projectnumber size=25</td>
 
 252         <input type=hidden name=nextsub value=generate_projects>
 
 254           <th align=right>| . $locale->text('From') . qq|</th>
 
 257           <th align=right>| . $locale->text('Bis') . qq|</th>
 
 268           <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
 
 269           <td><input name=l_heading class=checkbox type=checkbox value=Y> |
 
 270       . $locale->text('Heading') . qq|
 
 271           <input name=l_subtotal class=checkbox type=checkbox value=Y> |
 
 272       . $locale->text('Subtotal') . qq|</td>
 
 279   if ($form->{report} eq "income_statement") {
 
 282           <th align=right nowrap>| . $locale->text('Project') . qq|</th>
 
 283           <td colspan=3><input name=projectnumber size=25</td>
 
 285         <input type=hidden name=nextsub value=generate_income_statement>
 
 289           <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
 
 290       . $locale->text('Customized Report') . qq|</th>
 
 293           <th colspan=1>| . $locale->text('Year') . qq|</th>
 
 294           <td><input name=year size=11 title="|
 
 295       . $locale->text('YYYY') . qq|" value="$year"></td>
 
 302 <b> | . $locale->text('Yearly') . qq|</b> </td>
 
 303                 <th align=left>| . $locale->text('Quarterly') . qq|</th>
 
 304                 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
 
 307                 <td align=right>  <input name=duetyp class=radio type=radio value="13"
 
 309                 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
 
 310       . $locale->text('Quarter') . qq|</td>
 
 314                 <td><input name=duetyp class=radio type=radio value="1" $checked > |
 
 315       . $locale->text('January') . qq|</td>
 
 319                 <td><input name=duetyp class=radio type=radio value="5" $checked > |
 
 320       . $locale->text('May') . qq|</td>
 
 321                 <td><input name=duetyp class=radio type=radio value="9" $checked > |
 
 322       . $locale->text('September') . qq|</td>
 
 326                 <td align= right> </td>
 
 327                 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
 
 328       . $locale->text('Quarter') . qq|</td>
 
 329                 <td><input name=duetyp class=radio type=radio value="2" $checked > |
 
 330       . $locale->text('February') . qq|</td>
 
 331                 <td><input name=duetyp class=radio type=radio value="6" $checked > |
 
 332       . $locale->text('June') . qq|</td>
 
 333                 <td><input name=duetyp class=radio type=radio value="10" $checked > |
 
 334       . $locale->text('October') . qq|</td>
 
 338                 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
 
 339       . $locale->text('Quarter') . qq|</td>
 
 340                 <td><input name=duetyp class=radio type=radio value="3" $checked > |
 
 341       . $locale->text('March') . qq|</td>
 
 342                 <td><input name=duetyp class=radio type=radio value="7" $checked > |
 
 343       . $locale->text('July') . qq|</td>
 
 344                 <td><input name=duetyp class=radio type=radio value="11" $checked > |
 
 345       . $locale->text('November') . qq|</td>
 
 350                 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
 
 351       . $locale->text('Quarter') . qq| </td>
 
 352                 <td><input name=duetyp class=radio type=radio value="4" $checked > |
 
 353       . $locale->text('April') . qq|</td>
 
 354                 <td><input name=duetyp class=radio type=radio value="8" $checked > |
 
 355       . $locale->text('August') . qq|</td>
 
 356                 <td><input name=duetyp class=radio type=radio value="12" $checked > |
 
 357       . $locale->text('December') . qq|</td>
 
 361                 <td colspan=5><hr size=3 noshade></td>
 
 364           <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
 
 365       . $locale->text('Free report period') . qq|</th>
 
 366           <td align=left colspan=4>| . $locale->text('From') . qq| 
 
 369               | . $locale->text('Bis') . qq|
 
 375                 <td colspan=5><hr size=3 noshade></td>
 
 378           <th align=leftt>| . $locale->text('Method') . qq|</th>
 
 379           <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
 
 380       . $locale->text('Accrual') . qq|
 
 381            <input name=method class=radio type=radio value=cash $cash>|
 
 382       . $locale->text('EUR') . qq|</td>
 
 389   if ($form->{report} eq "bwa") {
 
 392           <th align=right nowrap>| . $locale->text('Project') . qq|</th>
 
 393           <td colspan=3><input name=projectnumber size=25</td>
 
 395         <input type=hidden name=nextsub value=generate_bwa>
 
 399           <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
 
 400       . $locale->text('Customized Report') . qq|</th>
 
 403           <th colspan=1>| . $locale->text('Year') . qq|</th>
 
 404           <td><input name=year size=11 title="|
 
 405       . $locale->text('YYYY') . qq|" value="$year"></td>
 
 412 <b> | . $locale->text('Yearly') . qq|</b> </td>
 
 413                 <th align=left>| . $locale->text('Quarterly') . qq|</th>
 
 414                 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
 
 417                 <td align=right>  <input name=duetyp class=radio type=radio value="13"
 
 419                 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
 
 420       . $locale->text('Quarter') . qq|</td>
 
 422     $checked = "checked";
 
 424                 <td><input name=duetyp class=radio type=radio value="1" $checked > |
 
 425       . $locale->text('January') . qq|</td>
 
 429                 <td><input name=duetyp class=radio type=radio value="5" $checked > |
 
 430       . $locale->text('May') . qq|</td>
 
 431                 <td><input name=duetyp class=radio type=radio value="9" $checked > |
 
 432       . $locale->text('September') . qq|</td>
 
 436                 <td align= right> </td>
 
 437                 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
 
 438       . $locale->text('Quarter') . qq|</td>
 
 439                 <td><input name=duetyp class=radio type=radio value="2" $checked > |
 
 440       . $locale->text('February') . qq|</td>
 
 441                 <td><input name=duetyp class=radio type=radio value="6" $checked > |
 
 442       . $locale->text('June') . qq|</td>
 
 443                 <td><input name=duetyp class=radio type=radio value="10" $checked > |
 
 444       . $locale->text('October') . qq|</td>
 
 448                 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
 
 449       . $locale->text('Quarter') . qq|</td>
 
 450                 <td><input name=duetyp class=radio type=radio value="3" $checked > |
 
 451       . $locale->text('March') . qq|</td>
 
 452                 <td><input name=duetyp class=radio type=radio value="7" $checked > |
 
 453       . $locale->text('July') . qq|</td>
 
 454                 <td><input name=duetyp class=radio type=radio value="11" $checked > |
 
 455       . $locale->text('November') . qq|</td>
 
 460                 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
 
 461       . $locale->text('Quarter') . qq| </td>
 
 462                 <td><input name=duetyp class=radio type=radio value="4" $checked > |
 
 463       . $locale->text('April') . qq|</td>
 
 464                 <td><input name=duetyp class=radio type=radio value="8" $checked > |
 
 465       . $locale->text('August') . qq|</td>
 
 466                 <td><input name=duetyp class=radio type=radio value="12" $checked > |
 
 467       . $locale->text('December') . qq|</td>
 
 471                 <td colspan=5><hr size=3 noshade></td>
 
 474           <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
 
 475       . $locale->text('Free report period') . qq|</th>
 
 476           <td align=left colspan=4>| . $locale->text('From') . qq| 
 
 479               | . $locale->text('Bis') . qq| 
 
 485                 <td colspan=5><hr size=3 noshade></td>
 
 488           <th align=leftt>| . $locale->text('Method') . qq|</th>
 
 489           <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
 
 490       . $locale->text('Accrual') . qq|
 
 491            <input name=method class=radio type=radio value=cash $cash>|
 
 492       . $locale->text('EUR') . qq|</td>
 
 495          <th align=right colspan=4>|
 
 496       . $locale->text('Decimalplaces')
 
 498              <td><input name=decimalplaces size=3></td>
 
 505   if ($form->{report} eq "ustva") {
 
 510         <input type=hidden name=nextsub value=generate_ustva>
 
 514           <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
 
 515       . $locale->text('Zeitraum') . qq|</th>
 
 518           <th colspan=1>| . $locale->text('Year') . qq|</th>
 
 519           <td><input name=year size=11 title="|
 
 520       . $locale->text('YYYY') . qq|" value="$year"></td>
 
 527 <b> | . $locale->text('Yearly') . qq|</b> </td>
 
 528                 <th align=left>| . $locale->text('Quarterly') . qq|</th>
 
 529                 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
 
 532                 <td align=right>  <input name=duetyp class=radio type=radio value="13"
 
 534                 <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
 
 535       . $locale->text('Quarter') . qq|</td>
 
 537     $checked = "checked";
 
 539                 <td><input name=duetyp class=radio type=radio value="1" $checked > |
 
 540       . $locale->text('January') . qq|</td>
 
 544                 <td><input name=duetyp class=radio type=radio value="5" $checked > |
 
 545       . $locale->text('May') . qq|</td>
 
 546                 <td><input name=duetyp class=radio type=radio value="9" $checked > |
 
 547       . $locale->text('September') . qq|</td>
 
 551                 <td align= right> </td>
 
 552                 <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
 
 553       . $locale->text('Quarter') . qq|</td>
 
 554                 <td><input name=duetyp class=radio type=radio value="2" $checked > |
 
 555       . $locale->text('February') . qq|</td>
 
 556                 <td><input name=duetyp class=radio type=radio value="6" $checked > |
 
 557       . $locale->text('June') . qq|</td>
 
 558                 <td><input name=duetyp class=radio type=radio value="10" $checked > |
 
 559       . $locale->text('October') . qq|</td>
 
 563                 <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
 
 564       . $locale->text('Quarter') . qq|</td>
 
 565                 <td><input name=duetyp class=radio type=radio value="3" $checked > |
 
 566       . $locale->text('March') . qq|</td>
 
 567                 <td><input name=duetyp class=radio type=radio value="7" $checked > |
 
 568       . $locale->text('July') . qq|</td>
 
 569                 <td><input name=duetyp class=radio type=radio value="11" $checked > |
 
 570       . $locale->text('November') . qq|</td>
 
 575                 <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
 
 576       . $locale->text('Quarter') . qq| </td>
 
 577                 <td><input name=duetyp class=radio type=radio value="4" $checked > |
 
 578       . $locale->text('April') . qq|</td>
 
 579                 <td><input name=duetyp class=radio type=radio value="8" $checked > |
 
 580       . $locale->text('August') . qq|</td>
 
 581                 <td><input name=duetyp class=radio type=radio value="12" $checked > |
 
 582       . $locale->text('December') . qq|</td>
 
 586                 <td colspan=5><hr size=3 noshade></td>
 
 589           <th align=left>| . $locale->text('Method') . qq|</th>
 
 590           <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
 
 591       . $locale->text('Accrual') . qq|
 
 592            <input name=method class=radio type=radio value=cash $cash>|
 
 593       . $locale->text('EUR') . qq|</td>
 
 606   if ($form->{report} eq "balance_sheet") {
 
 608         <input type=hidden name=nextsub value=generate_balance_sheet>
 
 610           <th align=right>| . $locale->text('as at') . qq|</th>
 
 615           <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
 
 622           <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
 
 623           <td><input name=decimalplaces size=3></td>
 
 632           <th align=right>| . $locale->text('Method') . qq|</th>
 
 633           <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
 
 634       . $locale->text('Accrual') . qq|
 
 635            <input name=method class=radio type=radio value=cash $cash>|
 
 636       . $locale->text('EUR') . qq|</td>
 
 640           <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
 
 641           <td><input name=l_heading class=checkbox type=checkbox value=Y> |
 
 642       . $locale->text('Heading') . qq|
 
 643           <input name=l_subtotal class=checkbox type=checkbox value=Y> |
 
 644       . $locale->text('Subtotal') . qq|
 
 645           <input name=l_accno class=checkbox type=checkbox value=Y> |
 
 646       . $locale->text('Account Number') . qq|</td>
 
 653   if ($form->{report} eq "trial_balance") {
 
 655         <input type=hidden name=nextsub value=generate_trial_balance>
 
 656         <input type=hidden name=eur value=$eur>
 
 658           <th align=right>| . $locale->text('From') . qq|</th>
 
 663           <th align=right>| . $locale->text('Bis') . qq|</th>
 
 676           <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
 
 677           <td><input name=l_heading class=checkbox type=checkbox value=Y> |
 
 678       . $locale->text('Heading') . qq|
 
 679           <input name=l_subtotal class=checkbox type=checkbox value=Y> |
 
 680       . $locale->text('Subtotal') . qq|
 
 681           <input name=all_accounts class=checkbox type=checkbox value=Y> |
 
 682       . $locale->text('All Accounts') . qq|</td>
 
 689   if ($form->{report} =~ /^tax_/) {
 
 692     $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
 
 694     RP->get_taxaccounts(\%myconfig, \%$form);
 
 697         <input type=hidden name=nextsub value=generate_tax_report>
 
 699           <th align=right>| . $locale->text('From') . qq|</th>
 
 700           <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
 
 701           <th align=right>| . $locale->text('Bis') . qq|</th>
 
 702           <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
 
 705           <th align=right>| . $locale->text('Report for') . qq|</th>
 
 709     $checked = "checked";
 
 710     foreach $ref (@{ $form->{taxaccounts} }) {
 
 713         qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
 
 715     <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
 
 716     <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
 
 723   <input type=hidden name=db value=$form->{db}>
 
 724   <input type=hidden name=sort value=transdate>
 
 730     if (@{ $form->{gifi_taxaccounts} }) {
 
 733           <th align=right>| . $locale->text('GIFI') . qq|</th>
 
 737       foreach $ref (@{ $form->{gifi_taxaccounts} }) {
 
 740           qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description}
 
 742       <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}">
 
 743       <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
 
 755           <th align=right>| . $locale->text('Method') . qq|</th>
 
 756           <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
 
 757       . $locale->text('Accrual') . qq|
 
 758            <input name=method class=radio type=radio value=cash $cash>|
 
 759       . $locale->text('EUR') . qq|</td>
 
 768           <th align=right>| . $locale->text('Include in Report') . qq|</th>
 
 772                 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
 
 773                 <td>| . $locale->text('ID') . qq|</td>
 
 774                 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
 
 775                 <td>| . $locale->text('Invoice') . qq|</td>
 
 776                 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
 
 777                 <td>| . $locale->text('Date') . qq|</td>
 
 780                 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
 
 783     if ($form->{db} eq 'ar') {
 
 784       print $locale->text('Customer');
 
 786     if ($form->{db} eq 'ap') {
 
 787       print $locale->text('Vendor');
 
 791                 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
 
 792                 <td>| . $locale->text('Amount') . qq|</td>
 
 793                 <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
 
 794                 <td>| . $locale->text('Tax') . qq|</td>
 
 795                 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
 
 796                 <td>| . $locale->text('Total') . qq|</td>
 
 799                 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
 
 800                 <td>| . $locale->text('Subtotal') . qq|</td>
 
 809   if ($form->{report} =~ /^nontaxable_/) {
 
 812     $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
 
 815         <input type=hidden name=nextsub value=generate_tax_report>
 
 817         <input type=hidden name=db value=$form->{db}>
 
 818         <input type=hidden name=sort value=transdate>
 
 819         <input type=hidden name=report value=$form->{report}>
 
 822           <th align=right>| . $locale->text('From') . qq|</th>
 
 823           <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
 
 824           <th align=right>| . $locale->text('Bis') . qq|</th>
 
 825           <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
 
 828           <th align=right>| . $locale->text('Method') . qq|</th>
 
 829           <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
 
 830       . $locale->text('Accrual') . qq|
 
 831            <input name=method class=radio type=radio value=cash $cash>|
 
 832       . $locale->text('EUR') . qq|</td>
 
 835           <th align=right>| . $locale->text('Include in Report') . qq|</th>
 
 839                 <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
 
 840                 <td>| . $locale->text('ID') . qq|</td>
 
 841                 <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
 
 842                 <td>| . $locale->text('Invoice') . qq|</td>
 
 843                 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
 
 844                 <td>| . $locale->text('Date') . qq|</td>
 
 847                 <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
 
 850     if ($form->{db} eq 'ar') {
 
 851       print $locale->text('Customer');
 
 853     if ($form->{db} eq 'ap') {
 
 854       print $locale->text('Vendor');
 
 858                 <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
 
 859                 <td>| . $locale->text('Amount') . qq|</td>
 
 860                 <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
 
 861                 <td>| . $locale->text('Total') . qq|</td>
 
 864                 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
 
 865                 <td>| . $locale->text('Subtotal') . qq|</td>
 
 874   if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
 
 877     if ($form->{report} eq 'ar_aging') {
 
 878       $label = $locale->text('Customer');
 
 879       $form->{vc} = 'customer';
 
 881       $label = $locale->text('Vendor');
 
 882       $form->{vc} = 'vendor';
 
 885     $nextsub = "generate_$form->{report}";
 
 888     $form->all_vc(\%myconfig, $form->{vc},
 
 889                   ($form->{vc} eq 'customer') ? "AR" : "AP");
 
 891     map { $vc .= "<option>$_->{name}--$_->{id}\n" }
 
 892       @{ $form->{"all_$form->{vc}"} };
 
 896       ? qq|<select name=$form->{vc}><option>\n$vc</select>|
 
 897       : qq|<input name=$form->{vc} size=35>|;
 
 901           <th align=right>| . $locale->text($label) . qq|</th>
 
 905           <th align=right>| . $locale->text('Bis') . qq|</th>
 
 911         <input type=hidden name=type value=statement>
 
 912         <input type=hidden name=format value=html>
 
 913         <input type=hidden name=media value=screen>
 
 915         <input type=hidden name=nextsub value=$nextsub>
 
 916         <input type=hidden name=action value=$nextsub>
 
 922   # above action can be removed if there is more than one input field
 
 924   if ($form->{report} =~ /(receipts|payments)$/) {
 
 927     $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
 
 929     RP->paymentaccounts(\%myconfig, \%$form);
 
 931     $selection = "<option>\n";
 
 932     foreach $ref (@{ $form->{PR} }) {
 
 933       $paymentaccounts .= "$ref->{accno} ";
 
 934       $selection       .= "<option>$ref->{accno}--$ref->{description}\n";
 
 937     chop $paymentaccounts;
 
 940         <input type=hidden name=nextsub value=list_payments>
 
 942           <th align=right nowrap>| . $locale->text('Account') . qq|</th>
 
 943           <td colspan=3><select name=account>$selection</select>
 
 944             <input type=hidden name=paymentaccounts value="$paymentaccounts">
 
 948           <th align=right>| . $locale->text('Reference') . qq|</th>
 
 949           <td colspan=3><input name=reference></td>
 
 952           <th align=right nowrap>| . $locale->text('Source') . qq|</th>
 
 953           <td colspan=3><input name=source></td>
 
 956           <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
 
 957           <td colspan=3><input name=memo size=30></td>
 
 960           <th align=right>| . $locale->text('From') . qq|</th>
 
 965           <th align=right>| . $locale->text('Bis') . qq|</th>
 
 972           <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
 
 973           <th align=left colspan=3>|
 
 974       . $locale->text('Include Exchangerate Difference') . qq|</td>
 
 979           <input type=hidden name=db value=$form->{db}>
 
 980           <input type=hidden name=sort value=transdate>
 
 991     <td><hr size=3 noshade></td>
 
 996 <input type=hidden name=path value=$form->{path}>
 
 997 <input type=hidden name=login value=$form->{login}>
 
 998 <input type=hidden name=password value=$form->{password}>
 
1000 <input type=submit class=submit name=action value="|
 
1001     . $locale->text('Continue') . qq|">
 
1004   # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
 
1005   # Einlesen der Finanzamtdaten
 
1006   get_config($userspath, 'finanzamt.ini');
 
1008   $disabled = qq|disabled="disabled"|;
 
1009   $disabled = '' if ($form->{elster} eq '1');
 
1010   if ($form->{report} eq 'ustva') {
 
1012   <input type=submit class=submit name=action value="|
 
1013       . $locale->text('debug') . qq|">
 
1014   <input type=submit class=submit name=action $disabled
 
1015    value="| . $locale->text('winston_export') . qq|">
 
1018    <input type=submit class=submit name=action value="|
 
1019       . $locale->text('config') . qq|">
 
1030   $lxdebug->leave_sub();
 
1033 sub continue { &{ $form->{nextsub} } }
 
1036   $lxdebug->enter_sub();
 
1037   my $nextsub = shift;
 
1039   $form->{project_id} = $form->{project_id_1};
 
1040   if ($form->{projectnumber} && !$form->{project_id}) {
 
1041     $form->{rowcount} = 1;
 
1043     # call this instead of update
 
1044     $form->{update}          = $nextsub;
 
1045     $form->{projectnumber_1} = $form->{projectnumber};
 
1047     delete $form->{sort};
 
1050     # if there is one only, assign id
 
1051     $form->{project_id} = $form->{project_id_1};
 
1054   $lxdebug->leave_sub();
 
1057 sub generate_income_statement {
 
1058   $lxdebug->enter_sub();
 
1060   $form->{padding} = "  ";
 
1061   $form->{bold}    = "<b>";
 
1062   $form->{endbold} = "</b>";
 
1063   $form->{br}      = "<br>";
 
1065   &get_project(generate_income_statement);
 
1067   $form->{projectnumber} = $form->{projectnumber_1};
 
1069   if ($form->{reporttype} eq "custom") {
 
1071     #forgotten the year --> thisyear
 
1072     if ($form->{year} !~ m/^\d\d\d\d$/) {
 
1073       $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
 
1079     if ($form->{duetyp} eq "13") {
 
1080       $form->{fromdate} = "1.1.$form->{year}";
 
1081       $form->{todate}   = "31.12.$form->{year}";
 
1085     if ($form->{duetyp} eq "A") {
 
1086       $form->{fromdate} = "1.1.$form->{year}";
 
1087       $form->{todate}   = "31.3.$form->{year}";
 
1089     if ($form->{duetyp} eq "B") {
 
1090       $form->{fromdate} = "1.4.$form->{year}";
 
1091       $form->{todate}   = "30.6.$form->{year}";
 
1093     if ($form->{duetyp} eq "C") {
 
1094       $form->{fromdate} = "1.7.$form->{year}";
 
1095       $form->{todate}   = "30.9.$form->{year}";
 
1097     if ($form->{duetyp} eq "D") {
 
1098       $form->{fromdate} = "1.10.$form->{year}";
 
1099       $form->{todate}   = "31.12.$form->{year}";
 
1104       $form->{duetyp} eq "1" && do {
 
1105         $form->{fromdate} = "1.1.$form->{year}";
 
1106         $form->{todate}   = "31.1.$form->{year}";
 
1109       $form->{duetyp} eq "2" && do {
 
1110         $form->{fromdate} = "1.2.$form->{year}";
 
1112         #this works from 1901 to 2099, 1900 and 2100 fail.
 
1113         $leap = ($form->{year} % 4 == 0) ? "29" : "28";
 
1114         $form->{todate} = "$leap.2.$form->{year}";
 
1117       $form->{duetyp} eq "3" && do {
 
1118         $form->{fromdate} = "1.3.$form->{year}";
 
1119         $form->{todate}   = "31.3.$form->{year}";
 
1122       $form->{duetyp} eq "4" && do {
 
1123         $form->{fromdate} = "1.4.$form->{year}";
 
1124         $form->{todate}   = "30.4.$form->{year}";
 
1127       $form->{duetyp} eq "5" && do {
 
1128         $form->{fromdate} = "1.5.$form->{year}";
 
1129         $form->{todate}   = "31.5.$form->{year}";
 
1132       $form->{duetyp} eq "6" && do {
 
1133         $form->{fromdate} = "1.6.$form->{year}";
 
1134         $form->{todate}   = "30.6.$form->{year}";
 
1137       $form->{duetyp} eq "7" && do {
 
1138         $form->{fromdate} = "1.7.$form->{year}";
 
1139         $form->{todate}   = "31.7.$form->{year}";
 
1142       $form->{duetyp} eq "8" && do {
 
1143         $form->{fromdate} = "1.8.$form->{year}";
 
1144         $form->{todate}   = "31.8.$form->{year}";
 
1147       $form->{duetyp} eq "9" && do {
 
1148         $form->{fromdate} = "1.9.$form->{year}";
 
1149         $form->{todate}   = "30.9.$form->{year}";
 
1152       $form->{duetyp} eq "10" && do {
 
1153         $form->{fromdate} = "1.10.$form->{year}";
 
1154         $form->{todate}   = "31.10.$form->{year}";
 
1157       $form->{duetyp} eq "11" && do {
 
1158         $form->{fromdate} = "1.11.$form->{year}";
 
1159         $form->{todate}   = "30.11.$form->{year}";
 
1162       $form->{duetyp} eq "12" && do {
 
1163         $form->{fromdate} = "1.12.$form->{year}";
 
1164         $form->{todate}   = "31.12.$form->{year}";
 
1170   RP->income_statement(\%myconfig, \%$form);
 
1172   ($form->{department}) = split /--/, $form->{department};
 
1175     $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
1176   $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
 
1178   # if there are any dates construct a where
 
1179   if ($form->{fromdate} || $form->{todate}) {
 
1181     unless ($form->{todate}) {
 
1182       $form->{todate} = $form->current_date(\%myconfig);
 
1185     $longtodate  = $locale->date(\%myconfig, $form->{todate}, 1);
 
1186     $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
 
1188     $longfromdate  = $locale->date(\%myconfig, $form->{fromdate}, 1);
 
1189     $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
 
1191     $form->{this_period} = "$shortfromdate\n$shorttodate";
 
1193         $locale->text('for Period')
 
1194       . qq|\n$longfromdate |
 
1195       . $locale->text('Bis')
 
1199   if ($form->{comparefromdate} || $form->{comparetodate}) {
 
1200     $longcomparefromdate =
 
1201       $locale->date(\%myconfig, $form->{comparefromdate}, 1);
 
1202     $shortcomparefromdate =
 
1203       $locale->date(\%myconfig, $form->{comparefromdate}, 0);
 
1205     $longcomparetodate  = $locale->date(\%myconfig, $form->{comparetodate}, 1);
 
1206     $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
 
1208     $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
 
1210         "\n$longcomparefromdate "
 
1211       . $locale->text('Bis')
 
1212       . qq| $longcomparetodate|;
 
1215   # setup variables for the form
 
1216   @a = qw(company address businessnumber);
 
1217   map { $form->{$_} = $myconfig{$_} } @a;
 
1219   $form->{templates} = $myconfig{templates};
 
1221   $form->{IN} = "income_statement.html";
 
1223   $form->parse_template;
 
1225   $lxdebug->leave_sub();
 
1228 sub generate_balance_sheet {
 
1229   $lxdebug->enter_sub();
 
1231   $form->{padding} = "  ";
 
1232   $form->{bold}    = "<b>";
 
1233   $form->{endbold} = "</b>";
 
1234   $form->{br}      = "<br>";
 
1236   RP->balance_sheet(\%myconfig, \%$form);
 
1238   $form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
 
1240     $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
1242   ($form->{department}) = split /--/, $form->{department};
 
1244   # define Current Earnings account
 
1245   $padding = ($form->{l_heading}) ? $form->{padding} : "";
 
1246   push(@{ $form->{equity_account} },
 
1247        $padding . $locale->text('Current Earnings'));
 
1249   $form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
 
1250   $form->{last_period} =
 
1251     $locale->date(\%myconfig, $form->{compareasofdate}, 0);
 
1253   $form->{IN} = "balance_sheet.html";
 
1255   # setup company variables for the form
 
1256   map { $form->{$_} = $myconfig{$_} }
 
1257     (qw(company address businessnumber nativecurr));
 
1259   $form->{templates} = $myconfig{templates};
 
1261   $form->parse_template;
 
1263   $lxdebug->leave_sub();
 
1266 sub generate_projects {
 
1267   $lxdebug->enter_sub();
 
1269   &get_project(generate_projects);
 
1270   $form->{projectnumber} = $form->{projectnumber_1};
 
1272   $form->{nextsub} = "generate_projects";
 
1273   $form->{title}   = $locale->text('Project Transactions');
 
1274   RP->trial_balance(\%myconfig, \%$form);
 
1278   $lxdebug->leave_sub();
 
1284 # included links to display transactions for period entered
 
1285 # added headers and subtotals
 
1287 sub generate_trial_balance {
 
1288   $lxdebug->enter_sub();
 
1290   # get for each account initial balance, debits and credits
 
1291   RP->trial_balance(\%myconfig, \%$form);
 
1293   $form->{nextsub} = "generate_trial_balance";
 
1294   $form->{title}   = $locale->text('Trial Balance');
 
1297   $lxdebug->leave_sub();
 
1301   $lxdebug->enter_sub();
 
1303   $title = $form->escape($form->{title});
 
1305   if ($form->{department}) {
 
1306     ($department) = split /--/, $form->{department};
 
1307     $options    = $locale->text('Department') . " : $department<br>";
 
1308     $department = $form->escape($form->{department});
 
1310   if ($form->{projectnumber}) {
 
1312       $locale->text('Project Number') . " : $form->{projectnumber}<br>";
 
1313     $projectnumber = $form->escape($form->{projectnumber});
 
1316   # if there are any dates
 
1317   if ($form->{fromdate} || $form->{todate}) {
 
1318     if ($form->{fromdate}) {
 
1319       $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
 
1321     if ($form->{todate}) {
 
1322       $todate = $locale->date(\%myconfig, $form->{todate}, 1);
 
1325     $form->{period} = "$fromdate - $todate";
 
1328       $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
1331   $options .= $form->{period};
 
1333   @column_index = qw(accno description begbalance debit credit endbalance);
 
1335   $column_header{accno} =
 
1336     qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
 
1337   $column_header{description} =
 
1338     qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
 
1339   $column_header{debit} =
 
1340     qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
 
1341   $column_header{credit} =
 
1342     qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
 
1343   $column_header{begbalance} =
 
1344     qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
 
1345   $column_header{endbalance} =
 
1346     qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
 
1348   if ($form->{accounttype} eq 'gifi') {
 
1349     $column_header{accno} =
 
1350       qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>|;
 
1360     <th class=listtop>$form->{title}</th>
 
1362   <tr height="5"></tr>
 
1371   map { print "$column_header{$_}\n" } @column_index;
 
1377   # sort the whole thing by account numbers and display
 
1378   foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
 
1380     $description = $form->escape($ref->{description});
 
1383       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}|;
 
1385     if ($form->{accounttype} eq 'gifi') {
 
1386       $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description";
 
1387       $na = $locale->text('N/A');
 
1388       map { $ref->{$_} = $na } qw(accno description) unless $ref->{accno};
 
1390       $href .= "&accno=$ref->{accno}&description=$description";
 
1393     $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
 
1395     $debit  = $form->format_amount(\%myconfig, $ref->{debit},  2, " ");
 
1396     $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
 
1398       $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
 
1400       $form->format_amount(\%myconfig,
 
1401                            ($ref->{balance} + $ref->{amount}) * $ml,
 
1404     #    next if ($ref->{debit} == 0 && $ref->{credit} == 0);
 
1406     if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
 
1407       map { $column_data{$_} = "<th> </th>" }
 
1408         qw(accno begbalance endbalance);
 
1410       $subtotalbegbalance =
 
1411         $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
 
1412       $subtotalendbalance =
 
1413         $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
 
1415         $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
 
1417         $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
 
1419       $column_data{description} = "<th>$subtotaldescription</th>";
 
1420       $column_data{begbalance}  = "<th align=right>$subtotalbegbalance</th>";
 
1421       $column_data{endbalance}  = "<th align=right>$subtotalendbalance</th>";
 
1422       $column_data{debit}       = "<th align=right>$subtotaldebit</th>";
 
1423       $column_data{credit}      = "<th align=right>$subtotalcredit</th>";
 
1426         <tr class=listsubtotal>
 
1428       map { print "$column_data{$_}\n" } @column_index;
 
1435     if ($ref->{charttype} eq "H") {
 
1437       $subtotaldescription = $ref->{description};
 
1438       $subtotaldebit       = $ref->{debit};
 
1439       $subtotalcredit      = $ref->{credit};
 
1440       $subtotalbegbalance  = 0;
 
1441       $subtotalendbalance  = 0;
 
1443       next unless $form->{l_heading};
 
1445       map { $column_data{$_} = "<th> </th>" }
 
1446         qw(accno debit credit begbalance endbalance);
 
1447       $column_data{description} =
 
1448         "<th class=listheading>$ref->{description}</th>";
 
1451     if ($ref->{charttype} eq "A") {
 
1452       $column_data{accno}       = "<td><a href=$href>$ref->{accno}</a></td>";
 
1453       $column_data{description} = "<td>$ref->{description}</td>";
 
1454       $column_data{debit}       = "<td align=right>$debit</td>";
 
1455       $column_data{credit}      = "<td align=right>$credit</td>";
 
1456       $column_data{begbalance}  = "<td align=right>$begbalance</td>";
 
1457       $column_data{endbalance}  = "<td align=right>$endbalance</td>";
 
1459       $totaldebit  += $ref->{debit};
 
1460       $totalcredit += $ref->{credit};
 
1462       $subtotalbegbalance += $ref->{balance} * $ml;
 
1463       $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
 
1467     if ($ref->{charttype} eq "H") {
 
1469       <tr class=listheading>
 
1472     if ($ref->{charttype} eq "A") {
 
1476       <tr class=listrow$i>
 
1480     map { print "$column_data{$_}\n" } @column_index;
 
1487   # print last subtotal
 
1488   if ($subtotal && $form->{l_subtotal}) {
 
1489     map { $column_data{$_} = "<th> </th>" }
 
1490       qw(accno begbalance endbalance);
 
1491     $subtotalbegbalance =
 
1492       $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
 
1493     $subtotalendbalance =
 
1494       $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
 
1496       $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
 
1498       $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
 
1499     $column_data{description} = "<th>$subdescription</th>";
 
1500     $column_data{begbalance}  = "<th align=right>$subtotalbegbalance</th>";
 
1501     $column_data{endbalance}  = "<th align=right>$subtotalendbalance</th>";
 
1502     $column_data{debit}       = "<th align=right>$subtotaldebit</th>";
 
1503     $column_data{credit}      = "<th align=right>$subtotalcredit</th>";
 
1506       <tr class=listsubtotal>
 
1508     map { print "$column_data{$_}\n" } @column_index;
 
1515   $totaldebit  = $form->format_amount(\%myconfig, $totaldebit,  2, " ");
 
1516   $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
 
1518   map { $column_data{$_} = "<th> </th>" }
 
1519     qw(accno description begbalance endbalance);
 
1521   $column_data{debit}  = qq|<th align=right class=listtotal>$totaldebit</th>|;
 
1522   $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
 
1525         <tr class=listtotal>
 
1528   map { print "$column_data{$_}\n" } @column_index;
 
1536     <td><hr size=3 noshade></td>
 
1544   $lxdebug->leave_sub();
 
1547 sub generate_ar_aging {
 
1548   $lxdebug->enter_sub();
 
1551   ($form->{customer}) = split(/--/, $form->{customer});
 
1552   $customer = $form->escape($form->{customer}, 1);
 
1553   $title    = $form->escape($form->{title},    1);
 
1555   $form->{ct}   = "customer";
 
1556   $form->{arap} = "ar";
 
1559     qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
 
1561   RP->aging(\%myconfig, \%$form);
 
1564   $lxdebug->leave_sub();
 
1567 sub generate_ap_aging {
 
1568   $lxdebug->enter_sub();
 
1571   ($form->{vendor}) = split(/--/, $form->{vendor});
 
1572   $vendor = $form->escape($form->{vendor}, 1);
 
1573   $title  = $form->escape($form->{title},  1);
 
1575   $form->{ct}   = "vendor";
 
1576   $form->{arap} = "ap";
 
1579     qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
 
1581   RP->aging(\%myconfig, \%$form);
 
1584   $lxdebug->leave_sub();
 
1588   $lxdebug->enter_sub();
 
1592   $column_header{statement} = qq|<th> </th>|;
 
1593   $column_header{ct}        =
 
1594       qq|<th class=listheading>|
 
1595     . $locale->text(ucfirst $form->{ct})
 
1597   $column_header{invnumber} =
 
1598     qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
 
1599   $column_header{transdate} =
 
1600     qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
 
1601   $column_header{duedate} =
 
1602     qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
 
1603   $column_header{c0} =
 
1604     qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
 
1605   $column_header{c30} = qq|<th class=listheading>30</th>|;
 
1606   $column_header{c60} = qq|<th class=listheading>60</th>|;
 
1607   $column_header{c90} = qq|<th class=listheading>90</th>|;
 
1610     (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
 
1612   if ($form->{department}) {
 
1613     $option .= "\n<br>" if $option;
 
1614     ($department) = split /--/, $form->{department};
 
1615     $option .= $locale->text('Department') . " : $department";
 
1616     $department = $form->escape($form->{department}, 1);
 
1617     $form->{callback} .= "&department=$department";
 
1620   if ($form->{arap} eq 'ar') {
 
1621     if ($form->{customer}) {
 
1622       $option .= "\n<br>" if $option;
 
1623       $option .= $form->{customer};
 
1626   if ($form->{arap} eq 'ap') {
 
1627     shift @column_index;
 
1628     if ($form->{vendor}) {
 
1629       $option .= "\n<br>" if $option;
 
1630       $option .= $form->{vendor};
 
1634   $todate = $locale->date(\%myconfig, $form->{todate}, 1);
 
1635   $option .= "\n<br>" if $option;
 
1637     $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
 
1642 <form method=post action=$form->{script}>
 
1646     <th class=listtop>$form->{title}</th>
 
1648   <tr height="5"></tr>
 
1655         <tr class=listheading>
 
1658   map { print "$column_header{$_}\n" } @column_index;
 
1668   foreach $ref (@{ $form->{AG} }) {
 
1670     if ($ctid != $ref->{ctid}) {
 
1676           $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
 
1678           $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
 
1680           $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
 
1682           $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
 
1685       $column_data{ct}        = qq|<th> </th>|;
 
1686       $column_data{invnumber} = qq|<th> </th>|;
 
1687       $column_data{transdate} = qq|<th> </th>|;
 
1688       $column_data{duedate}   = qq|<th> </th>|;
 
1690         qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
 
1692         qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
 
1694         qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
 
1696         qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
 
1702         <tr class=listsubtotal>
 
1705         map { print "$column_data{$_}\n" } @column_index;
 
1707         $column_data{statement} = qq|<td> </td>|;
 
1721       $column_data{ct}        = qq|<td>$ref->{name}</td>|;
 
1722       $column_data{statement} =
 
1723         qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
 
1724       <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
 
1728     $c0subtotal  += $ref->{c0};
 
1729     $c30subtotal += $ref->{c30};
 
1730     $c60subtotal += $ref->{c60};
 
1731     $c90subtotal += $ref->{c90};
 
1733     $c0total  += $ref->{c0};
 
1734     $c30total += $ref->{c30};
 
1735     $c60total += $ref->{c60};
 
1736     $c90total += $ref->{c90};
 
1738     $ref->{c0}  = $form->format_amount(\%myconfig, $ref->{c0},  2, " ");
 
1739     $ref->{c30} = $form->format_amount(\%myconfig, $ref->{c30}, 2, " ");
 
1740     $ref->{c60} = $form->format_amount(\%myconfig, $ref->{c60}, 2, " ");
 
1741     $ref->{c90} = $form->format_amount(\%myconfig, $ref->{c90}, 2, " ");
 
1744       qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
 
1745       . $form->escape($form->{callback});
 
1747     $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
 
1748     $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
 
1749     $column_data{duedate}   = qq|<td>$ref->{duedate} </td>|;
 
1750     $column_data{c0}        = qq|<td align=right>$ref->{c0}</td>|;
 
1751     $column_data{c30}       = qq|<td align=right>$ref->{c30}</td>|;
 
1752     $column_data{c60}       = qq|<td align=right>$ref->{c60}</td>|;
 
1753     $column_data{c90}       = qq|<td align=right>$ref->{c90}</td>|;
 
1758         <tr class=listrow$j>
 
1761     map { print "$column_data{$_}\n" } @column_index;
 
1767     $column_data{ct}        = qq|<td> </td>|;
 
1768     $column_data{statement} = qq|<td> </td>|;
 
1770     $ctid = $ref->{ctid};
 
1775   $c0subtotal  = $form->format_amount(\%myconfig, $c0subtotal,  2, " ");
 
1776   $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
 
1777   $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
 
1778   $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
 
1781         <tr class=listsubtotal>
 
1784   map { $column_data{$_} = qq|<th> </th>| } @column_index;
 
1786   $column_data{c0}  = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
 
1787   $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
 
1788   $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
 
1789   $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
 
1791   map { print "$column_data{$_}\n" } @column_index;
 
1795         <tr class=listtotal>
 
1798   $c0total  = $form->format_amount(\%myconfig, $c0total,  2, " ");
 
1799   $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
 
1800   $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
 
1801   $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
 
1803   $column_data{c0}  = qq|<th align=right class=listtotal>$c0total</th>|;
 
1804   $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
 
1805   $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
 
1806   $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
 
1808   map { print "$column_data{$_}\n" } @column_index;
 
1811           <input type=hidden name=rowcount value=$i>
 
1820   &print_options if ($form->{arap} eq 'ar');
 
1826     <td><hr size=3 noshade></td>
 
1831   if ($form->{arap} eq 'ar') {
 
1833 <input type=hidden name=todate value=$form->{todate}>
 
1835 <input type=hidden name=title value="$form->{title}">
 
1837 <input type=hidden name=arap value=$form->{arap}>
 
1838 <input type=hidden name=ct value=$form->{ct}>
 
1839 <input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
 
1841 <input type=hidden name=department value="$form->{department}">
 
1843 <input type=hidden name=path value=$form->{path}>
 
1844 <input type=hidden name=login value=$form->{login}>
 
1845 <input type=hidden name=password value=$form->{password}>
 
1848 <input class=submit type=submit name=action value="|
 
1849       . $locale->text('Select all') . qq|">
 
1850 <input class=submit type=submit name=action value="|
 
1851       . $locale->text('Print') . qq|">
 
1852 <input class=submit type=submit name=action value="|
 
1853       . $locale->text('E-mail') . qq|">
 
1857   if ($form->{menubar}) {
 
1858     require "$form->{path}/menu.pl";
 
1869   $lxdebug->leave_sub();
 
1873   $lxdebug->enter_sub();
 
1875   RP->aging(\%myconfig, \%$form);
 
1877   map { $_->{checked} = "checked" } @{ $form->{AG} };
 
1881   $lxdebug->leave_sub();
 
1885   $lxdebug->enter_sub();
 
1887   # get name and email addresses
 
1888   for $i (1 .. $form->{rowcount}) {
 
1889     if ($form->{"statement_$i"}) {
 
1890       $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
 
1891       RP->get_customer(\%myconfig, \%$form);
 
1897   $form->error($locale->text('Nothing selected!')) unless $selected;
 
1899   if ($myconfig{role} eq 'admin') {
 
1901           <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
 
1902           <td><input name=bcc size=30 value="$form->{bcc}"></td>
 
1906   $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
 
1908   $form->{media} = "email";
 
1915 <form method=post action=$form->{script}>
 
1921   <tr height="5"></tr>
 
1926           <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
 
1927           <td><input name=email size=30 value="$form->{email}"></td>
 
1928           <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
 
1929           <td><input name=cc size=30 value="$form->{cc}"></td>
 
1932           <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
 
1933           <td><input name=subject size=30 value="$form->{subject}"></td>
 
1943           <th align=left nowrap>| . $locale->text('Message') . qq|</th>
 
1946           <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
 
1957   map { delete $form->{$_} }
 
1958     qw(action email cc bcc subject message type sendmode format header);
 
1960   # save all other variables
 
1961   foreach $key (keys %$form) {
 
1962     $form->{$key} =~ s/\"/"/g;
 
1963     print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
 
1970     <td><hr size=3 noshade></td>
 
1974 <input type=hidden name=nextsub value=send_email>
 
1977 <input name=action class=submit type=submit value="|
 
1978     . $locale->text('Continue') . qq|">
 
1985   $lxdebug->leave_sub();
 
1989   $lxdebug->enter_sub();
 
1991   $form->{OUT} = "$sendmail";
 
1993   $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
 
1994     unless $form->{subject};
 
1996   RP->aging(\%myconfig, \%$form);
 
1998   $form->{"statement_1"} = 1;
 
2003                  $locale->text('Statement sent to') . " $form->{$form->{ct}}");
 
2005   $lxdebug->leave_sub();
 
2009   $lxdebug->enter_sub();
 
2011   if ($form->{media} eq 'printer') {
 
2012     $form->error($locale->text('Select postscript or PDF!'))
 
2013       if ($form->{format} !~ /(postscript|pdf)/);
 
2016   for $i (1 .. $form->{rowcount}) {
 
2017     if ($form->{"statement_$i"}) {
 
2018       $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
 
2024   $form->error($locale->text('Nothing selected!')) unless $selected;
 
2026   if ($form->{media} eq 'printer') {
 
2027     $form->{OUT} = "| $myconfig{printer}";
 
2028     $form->{"$form->{ct}_id"} = "";
 
2030     $form->{"statement_1"} = 1;
 
2033   RP->aging(\%myconfig, \%$form);
 
2037   $form->redirect($locale->text('Statements sent to printer!'))
 
2038     if ($form->{media} eq 'printer');
 
2040   $lxdebug->leave_sub();
 
2044   $lxdebug->enter_sub();
 
2046   $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
 
2048   $form->{templates} = "$myconfig{templates}";
 
2050   $form->{IN} = "$form->{type}.html";
 
2052   if ($form->{format} eq 'postscript') {
 
2053     $form->{postscript} = 1;
 
2054     $form->{IN} =~ s/html$/tex/;
 
2056   if ($form->{format} eq 'pdf') {
 
2058     $form->{IN} =~ s/html$/tex/;
 
2062   while (@{ $form->{AG} }) {
 
2064     $ref = shift @{ $form->{AG} };
 
2066     if ($ctid != $ref->{ctid}) {
 
2068       $ctid = $ref->{ctid};
 
2071       if ($form->{"statement_$i"}) {
 
2074           (name, street, zipcode, city, country, contact, email,
 
2075            "$form->{ct}phone", "$form->{ct}fax");
 
2076         map { $form->{$_} = $ref->{$_} } @a;
 
2078         $form->{ $form->{ct} } = $form->{name};
 
2079         $form->{"$form->{ct}_id"} = $ref->{ctid};
 
2081         map { $form->{$_} = () } qw(invnumber invdate duedate);
 
2083         foreach $item (qw(c0 c30 c60 c90)) {
 
2084           $form->{$item} = ();
 
2085           $form->{"${item}total"} = 0;
 
2088         &statement_details($ref);
 
2092           if (scalar(@{ $form->{AG} }) > 0) {
 
2094             # one or more left to go
 
2095             if ($ctid == $form->{AG}->[0]->{ctid}) {
 
2096               $ref = shift @{ $form->{AG} };
 
2097               &statement_details($ref);
 
2100               $ref = scalar(@{ $form->{AG} });
 
2106             # set initial ref to 0
 
2113           $form->{"${_}total"} =
 
2114             $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
 
2115         } (c0, c30, c60, c90, "");
 
2117         $form->parse_template(\%myconfig, $userspath);
 
2123   $lxdebug->leave_sub();
 
2126 sub statement_details {
 
2127   $lxdebug->enter_sub();
 
2130   push @{ $form->{invnumber} }, $ref->{invnumber};
 
2131   push @{ $form->{invdate} },   $ref->{transdate};
 
2132   push @{ $form->{duedate} },   $ref->{duedate};
 
2134   foreach $item (qw(c0 c30 c60 c90)) {
 
2137         $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
 
2139     $form->{"${item}total"} += $ref->{$item};
 
2140     $form->{total}          += $ref->{$item};
 
2141     push @{ $form->{$item} },
 
2142       $form->format_amount(\%myconfig, $ref->{$item}, 2);
 
2145   $lxdebug->leave_sub();
 
2148 sub generate_tax_report {
 
2149   $lxdebug->enter_sub();
 
2151   RP->tax_report(\%myconfig, \%$form);
 
2153   $descvar     = "$form->{accno}_description";
 
2154   $description = $form->escape($form->{$descvar});
 
2155   $ratevar     = "$form->{accno}_rate";
 
2157   if ($form->{accno} =~ /^gifi_/) {
 
2158     $descvar     = "gifi_$form->{accno}_description";
 
2159     $description = $form->escape($form->{$descvar});
 
2160     $ratevar     = "gifi_$form->{accno}_rate";
 
2163   $department = $form->escape($form->{department});
 
2167     "$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}";
 
2169   # construct callback
 
2170   $description = $form->escape($form->{$descvar},   1);
 
2171   $department  = $form->escape($form->{department}, 1);
 
2173     "$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}";
 
2175   $form->{title} = $locale->text('GIFI') . " - "
 
2176     if ($form->{accno} =~ /^gifi_/);
 
2178   $title = $form->escape($form->{title});
 
2179   $href .= "&title=$title";
 
2180   $title = $form->escape($form->{title}, 1);
 
2181   $callback .= "&title=$title";
 
2183   $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
 
2186     $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
 
2188   foreach $item (@columns) {
 
2189     if ($form->{"l_$item"} eq "Y") {
 
2190       push @column_index, $item;
 
2192       # add column to href and callback
 
2193       $callback .= "&l_$item=Y";
 
2194       $href     .= "&l_$item=Y";
 
2198   if ($form->{l_subtotal} eq 'Y') {
 
2199     $callback .= "&l_subtotal=Y";
 
2200     $href     .= "&l_subtotal=Y";
 
2203   if ($form->{department}) {
 
2204     ($department) = split /--/, $form->{department};
 
2205     $option = $locale->text('Department') . " : $department";
 
2208   # if there are any dates
 
2209   if ($form->{fromdate} || $form->{todate}) {
 
2210     if ($form->{fromdate}) {
 
2211       $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
 
2213     if ($form->{todate}) {
 
2214       $todate = $locale->date(\%myconfig, $form->{todate}, 1);
 
2217     $form->{period} = "$fromdate - $todate";
 
2220       $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
2223   if ($form->{db} eq 'ar') {
 
2224     $name    = $locale->text('Customer');
 
2228   if ($form->{db} eq 'ap') {
 
2229     $name    = $locale->text('Vendor');
 
2234   $option .= "<br>" if $option;
 
2235   $option .= "$form->{period}";
 
2237   $column_header{id} =
 
2238       qq|<th><a class=listheading href=$href&sort=id>|
 
2239     . $locale->text('ID')
 
2241   $column_header{invnumber} =
 
2242       qq|<th><a class=listheading href=$href&sort=invnumber>|
 
2243     . $locale->text('Invoice')
 
2245   $column_header{transdate} =
 
2246       qq|<th><a class=listheading href=$href&sort=transdate>|
 
2247     . $locale->text('Date')
 
2249   $column_header{netamount} =
 
2250     qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
 
2251   $column_header{tax} =
 
2252     qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
 
2253   $column_header{amount} =
 
2254     qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
 
2256   $column_header{name} =
 
2257     qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
 
2266     <th class=listtop colspan=$colspan>$form->{title}</th>
 
2268   <tr height="5"></tr>
 
2275         <tr class=listheading>
 
2278   map { print "$column_header{$_}\n" } @column_index;
 
2284   # add sort and escape callback
 
2285   $callback = $form->escape($callback . "&sort=$form->{sort}");
 
2287   if (@{ $form->{TR} }) {
 
2288     $sameitem = $form->{TR}->[0]->{ $form->{sort} };
 
2291   foreach $ref (@{ $form->{TR} }) {
 
2293     $module = ($ref->{invoice}) ? $invoice : $arap;
 
2295     if ($form->{l_subtotal} eq 'Y') {
 
2296       if ($sameitem ne $ref->{ $form->{sort} }) {
 
2298         $sameitem = $ref->{ $form->{sort} };
 
2302     $totalnetamount += $ref->{netamount};
 
2303     $totaltax       += $ref->{tax};
 
2304     $ref->{amount} = $ref->{netamount} + $ref->{tax};
 
2306     $subtotalnetamount += $ref->{netamount};
 
2307     $subtotaltax       += $ref->{tax};
 
2310       $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
 
2311     } qw(netamount tax amount);
 
2313     $column_data{id}        = qq|<td>$ref->{id}</td>|;
 
2314     $column_data{invnumber} =
 
2315       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>|;
 
2316     $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
 
2317     $column_data{name}      = qq|<td>$ref->{name} </td>|;
 
2319     map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
 
2320       qw(netamount tax amount);
 
2325         <tr class=listrow$i>
 
2328     map { print "$column_data{$_}\n" } @column_index;
 
2336   if ($form->{l_subtotal} eq 'Y') {
 
2340   map { $column_data{$_} = qq|<th> </th>| } @column_index;
 
2344         <tr class=listtotal>
 
2348     $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
 
2350     $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
 
2351   $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
 
2353   $column_data{netamount} =
 
2354     qq|<th class=listtotal align=right>$totalnetamount</th>|;
 
2355   $column_data{tax}    = qq|<th class=listtotal align=right>$totaltax</th>|;
 
2356   $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
 
2358   map { print "$column_data{$_}\n" } @column_index;
 
2366     <td><hr size=3 noshade></td>
 
2374   $lxdebug->leave_sub();
 
2378   $lxdebug->enter_sub();
 
2380   map { $column_data{$_} = "<td> </td>" } @column_index;
 
2382   $subtotalnetamount =
 
2383     $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
 
2384   $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
 
2386     $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
 
2389   $column_data{netamount} =
 
2390     "<th class=listsubtotal align=right>$subtotalnetamount</th>";
 
2391   $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
 
2392   $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
 
2394   $subtotalnetamount = 0;
 
2398         <tr class=listsubtotal>
 
2400   map { print "\n$column_data{$_}" } @column_index;
 
2406   $lxdebug->leave_sub();
 
2410   $lxdebug->enter_sub();
 
2412   if ($form->{account}) {
 
2413     ($form->{paymentaccounts}) = split /--/, $form->{account};
 
2415   if ($form->{department}) {
 
2416     ($department, $form->{department_id}) = split /--/, $form->{department};
 
2417     $option = $locale->text('Department') . " : $department";
 
2420   RP->payments(\%myconfig, \%$form);
 
2423     $form->sort_columns(qw(transdate reference name paid source memo));
 
2426   $account    = $form->escape($form->{account});
 
2427   $title      = $form->escape($form->{title});
 
2428   $department = $form->escape($form->{department});
 
2429   $form->{paymentaccounts} =~ s/ /%20/g;
 
2430   $reference = $form->escape($form->{reference});
 
2431   $source    = $form->escape($form->{source});
 
2432   $memo      = $form->escape($form->{memo});
 
2435     "$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";
 
2437   # construct callback
 
2438   $account    = $form->escape($form->{account},    1);
 
2439   $title      = $form->escape($form->{title},      1);
 
2440   $department = $form->escape($form->{department}, 1);
 
2441   $reference  = $form->escape($form->{reference},  1);
 
2442   $source     = $form->escape($form->{source},     1);
 
2443   $memo       = $form->escape($form->{memo},       1);
 
2446     "$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}";
 
2447   $callback = $form->escape($form->{callback});
 
2449   $column_header{name} =
 
2450       "<th><a class=listheading href=$href&sort=name>"
 
2451     . $locale->text('Description')
 
2453   $column_header{reference} =
 
2454       "<th><a class=listheading href=$href&sort=invnumber>"
 
2455     . $locale->text('Reference')
 
2457   $column_header{transdate} =
 
2458       "<th><a class=listheading href=$href&sort=transdate>"
 
2459     . $locale->text('Date')
 
2461   $column_header{paid} =
 
2462     "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
 
2463   $column_header{source} =
 
2464       "<th><a class=listheading href=$href&sort=source>"
 
2465     . $locale->text('Source')
 
2467   $column_header{memo} =
 
2468       "<th><a class=listheading href=$href&sort=memo>"
 
2469     . $locale->text('Memo')
 
2472   if ($form->{fromdate}) {
 
2473     $option .= "\n<br>" if ($option);
 
2475         $locale->text('From') . " "
 
2476       . $locale->date(\%myconfig, $form->{fromdate}, 1);
 
2478   if ($form->{todate}) {
 
2479     $option .= "\n<br>" if ($option);
 
2481         $locale->text('bis') . " "
 
2482       . $locale->date(\%myconfig, $form->{todate}, 1);
 
2485   @column_index = @columns;
 
2486   $colspan      = $#column_index + 1;
 
2495     <th class=listtop>$form->{title}</th>
 
2497   <tr height="5"></tr>
 
2504         <tr class=listheading>
 
2507   map { print "\n$column_header{$_}" } @column_index;
 
2513   foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
 
2515     next unless @{ $form->{ $ref->{id} } };
 
2519           <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
 
2523     foreach $payment (@{ $form->{ $ref->{id} } }) {
 
2525       $module = $payment->{module};
 
2526       $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
 
2527       $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
 
2530         qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
 
2532       $column_data{name}      = "<td>$payment->{name} </td>";
 
2533       $column_data{reference} =
 
2534         qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
 
2535       $column_data{transdate} = "<td>$payment->{transdate} </td>";
 
2536       $column_data{paid}      =
 
2538         . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
 
2540       $column_data{source} = "<td>$payment->{source} </td>";
 
2541       $column_data{memo}   = "<td>$payment->{memo} </td>";
 
2543       $subtotalpaid += $payment->{paid};
 
2544       $totalpaid    += $payment->{paid};
 
2549         <tr class=listrow$i>
 
2552       map { print "\n$column_data{$_}" } @column_index;
 
2561     map { $column_data{$_} = "<td> </td>" } @column_index;
 
2563     $column_data{paid} =
 
2564       "<th class=listsubtotal align=right>"
 
2565       . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
 
2568         <tr class=listsubtotal>
 
2571     map { print "\n$column_data{$_}" } @column_index;
 
2582   map { $column_data{$_} = "<td> </td>" } @column_index;
 
2584   $column_data{paid} =
 
2585     "<th class=listtotal align=right>"
 
2586     . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
 
2589         <tr class=listtotal>
 
2592   map { print "\n$column_data{$_}" } @column_index;
 
2601     <td><hr size=3 noshade></td>
 
2609   $lxdebug->leave_sub();
 
2613   $lxdebug->enter_sub();
 
2618   $lxdebug->leave_sub();
 
2627 sub winston_export {
 
2628   $lxdebug->enter_sub();
 
2631   $form->{winston} = 1;
 
2633   $lxdebug->leave_sub();
 
2637   $lxdebug->enter_sub();
 
2639   $form->{sendmode} = "attachment";
 
2640   $form->{copies}   = 2 unless $form->{copies};
 
2642   $form->{PD}{ $form->{type} }     = "selected";
 
2643   $form->{DF}{ $form->{format} }   = "selected";
 
2644   $form->{OP}{ $form->{media} }    = "selected";
 
2645   $form->{SM}{ $form->{sendmode} } = "selected";
 
2647   if ($form->{report} eq 'ustva') {
 
2649             <option value=ustva $form->{PD}{ustva}>| . $locale->text('ustva');
 
2652             <option value=statement $form->{PD}{statement}>|
 
2653       . $locale->text('Statement');
 
2656   if ($form->{media} eq 'email') {
 
2658             <option value=attachment $form->{SM}{attachment}>|
 
2659       . $locale->text('Attachment') . qq|
 
2660             <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
 
2663             <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
 
2664     if ($myconfig{printer} && $latex_templates) {
 
2666             <option value=printer $form->{OP}{printer}>|
 
2667         . $locale->text('Printer');
 
2671   if ($latex_templates) {
 
2673             <option value=html $form->{DF}{html}>|
 
2674       . $locale->text('HTML') . qq|
 
2675             <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
 
2676     if ($form->{report} ne 'ustva') {
 
2678             <option value=postscript $form->{DF}{postscript}>|
 
2679         . $locale->text('Postscript');
 
2686     <td><select name=type>$type</select></td>
 
2687     <td><select name=format>$format</select></td>
 
2688     <td><select name=media>$media</select></td>
 
2691   if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
 
2693       <td>| . $locale->text('Copies') . qq|
 
2694       <input name=copies size=2 value=$form->{copies}></td>
 
2703   $lxdebug->leave_sub();
 
2707   $lxdebug->enter_sub();
 
2708   $form->{padding} = "  ";
 
2709   $form->{bold}    = "<b>";
 
2710   $form->{endbold} = "</b>";
 
2711   $form->{br}      = "<br>";
 
2713   #  &get_project(generate_bwa);
 
2715   if ($form->{reporttype} eq "custom") {
 
2717     #forgotten the year --> thisyear
 
2718     if ($form->{year} !~ m/^\d\d\d\d$/) {
 
2719       $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
 
2725     if ($form->{duetyp} eq "13") {
 
2726       $form->{fromdate}        = "1.1.$form->{year}";
 
2727       $form->{todate}          = "31.12.$form->{year}";
 
2728       $form->{comparefromdate} = "1.01.$form->{year}";
 
2729       $form->{comparetodate}   = "31.12.$form->{year}";
 
2733     if ($form->{duetyp} eq "A") {
 
2734       $form->{fromdate}        = "1.1.$form->{year}";
 
2735       $form->{todate}          = "31.3.$form->{year}";
 
2736       $form->{comparefromdate} = "1.01.$form->{year}";
 
2737       $form->{comparetodate}   = "31.03.$form->{year}";
 
2739     if ($form->{duetyp} eq "B") {
 
2740       $form->{fromdate}        = "1.4.$form->{year}";
 
2741       $form->{todate}          = "30.6.$form->{year}";
 
2742       $form->{comparefromdate} = "1.01.$form->{year}";
 
2743       $form->{comparetodate}   = "30.06.$form->{year}";
 
2745     if ($form->{duetyp} eq "C") {
 
2746       $form->{fromdate}        = "1.7.$form->{year}";
 
2747       $form->{todate}          = "30.9.$form->{year}";
 
2748       $form->{comparefromdate} = "1.01.$form->{year}";
 
2749       $form->{comparetodate}   = "30.09.$form->{year}";
 
2751     if ($form->{duetyp} eq "D") {
 
2752       $form->{fromdate}        = "1.10.$form->{year}";
 
2753       $form->{todate}          = "31.12.$form->{year}";
 
2754       $form->{comparefromdate} = "1.01.$form->{year}";
 
2755       $form->{comparetodate}   = "31.12.$form->{year}";
 
2760       $form->{duetyp} eq "1" && do {
 
2761         $form->{fromdate}        = "1.1.$form->{year}";
 
2762         $form->{todate}          = "31.1.$form->{year}";
 
2763         $form->{comparefromdate} = "1.01.$form->{year}";
 
2764         $form->{comparetodate}   = "31.01.$form->{year}";
 
2767       $form->{duetyp} eq "2" && do {
 
2768         $form->{fromdate} = "1.2.$form->{year}";
 
2770         #this works from 1901 to 2099, 1900 and 2100 fail.
 
2771         $leap = ($form->{year} % 4 == 0) ? "29" : "28";
 
2772         $form->{todate}          = "$leap.2.$form->{year}";
 
2773         $form->{comparefromdate} = "1.01.$form->{year}";
 
2774         $form->{comparetodate}   = "$leap.02.$form->{year}";
 
2777       $form->{duetyp} eq "3" && do {
 
2778         $form->{fromdate}        = "1.3.$form->{year}";
 
2779         $form->{todate}          = "31.3.$form->{year}";
 
2780         $form->{comparefromdate} = "1.01.$form->{year}";
 
2781         $form->{comparetodate}   = "31.03.$form->{year}";
 
2784       $form->{duetyp} eq "4" && do {
 
2785         $form->{fromdate}        = "1.4.$form->{year}";
 
2786         $form->{todate}          = "30.4.$form->{year}";
 
2787         $form->{comparefromdate} = "1.01.$form->{year}";
 
2788         $form->{comparetodate}   = "30.04.$form->{year}";
 
2791       $form->{duetyp} eq "5" && do {
 
2792         $form->{fromdate}        = "1.5.$form->{year}";
 
2793         $form->{todate}          = "31.5.$form->{year}";
 
2794         $form->{comparefromdate} = "1.01.$form->{year}";
 
2795         $form->{comparetodate}   = "31.05.$form->{year}";
 
2798       $form->{duetyp} eq "6" && do {
 
2799         $form->{fromdate}        = "1.6.$form->{year}";
 
2800         $form->{todate}          = "30.6.$form->{year}";
 
2801         $form->{comparefromdate} = "1.01.$form->{year}";
 
2802         $form->{comparetodate}   = "30.06.$form->{year}";
 
2805       $form->{duetyp} eq "7" && do {
 
2806         $form->{fromdate}        = "1.7.$form->{year}";
 
2807         $form->{todate}          = "31.7.$form->{year}";
 
2808         $form->{comparefromdate} = "1.01.$form->{year}";
 
2809         $form->{comparetodate}   = "31.07.$form->{year}";
 
2812       $form->{duetyp} eq "8" && do {
 
2813         $form->{fromdate}        = "1.8.$form->{year}";
 
2814         $form->{todate}          = "31.8.$form->{year}";
 
2815         $form->{comparefromdate} = "1.01.$form->{year}";
 
2816         $form->{comparetodate}   = "31.08.$form->{year}";
 
2819       $form->{duetyp} eq "9" && do {
 
2820         $form->{fromdate}        = "1.9.$form->{year}";
 
2821         $form->{todate}          = "30.9.$form->{year}";
 
2822         $form->{comparefromdate} = "1.01.$form->{year}";
 
2823         $form->{comparetodate}   = "30.09.$form->{year}";
 
2826       $form->{duetyp} eq "10" && do {
 
2827         $form->{fromdate}        = "1.10.$form->{year}";
 
2828         $form->{todate}          = "31.10.$form->{year}";
 
2829         $form->{comparefromdate} = "1.01.$form->{year}";
 
2830         $form->{comparetodate}   = "31.10.$form->{year}";
 
2833       $form->{duetyp} eq "11" && do {
 
2834         $form->{fromdate}        = "1.11.$form->{year}";
 
2835         $form->{todate}          = "30.11.$form->{year}";
 
2836         $form->{comparefromdate} = "1.01.$form->{year}";
 
2837         $form->{comparetodate}   = "30.11.$form->{year}";
 
2840       $form->{duetyp} eq "12" && do {
 
2841         $form->{fromdate}        = "1.12.$form->{year}";
 
2842         $form->{todate}          = "31.12.$form->{year}";
 
2843         $form->{comparefromdate} = "1.01.$form->{year}";
 
2844         $form->{comparetodate}   = "31.12.$form->{year}";
 
2849     ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
 
2850     $form->{fromdate} = "${dd}.${mm}.${yy}";
 
2851     ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
 
2852     $form->{todate}          = "${dd}.${mm}.${yy}";
 
2853     $form->{comparefromdate} = "01.01.$yy";
 
2854     $form->{comparetodate}   = $form->{todate};
 
2857   RP->bwa(\%myconfig, \%$form);
 
2859   ($form->{department}) = split /--/, $form->{department};
 
2862     $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
2863   $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
 
2865   # if there are any dates construct a where
 
2866   if ($form->{fromdate} || $form->{todate}) {
 
2868     unless ($form->{todate}) {
 
2869       $form->{todate} = $form->current_date(\%myconfig);
 
2872     my %germandate = ("dateformat" => "dd.mm.yyyy");
 
2874     $longtodate  = $locale->date(\%germandate, $form->{todate}, 1);
 
2875     $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
 
2877     $longfromdate  = $locale->date(\%germandate, $form->{fromdate}, 1);
 
2878     $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
 
2880     $form->{this_period} = "$shortfromdate\n$shorttodate";
 
2882         $locale->text('for Period')
 
2883       . qq|\n$longfromdate |
 
2884       . $locale->text('bis')
 
2888   # setup variables for the form
 
2889   @a = qw(company address businessnumber);
 
2890   map { $form->{$_} = $myconfig{$_} } @a;
 
2891   $form->{templates} = $myconfig{templates};
 
2893   $form->{IN} = "bwa.html";
 
2895   $form->parse_template;
 
2897   $lxdebug->leave_sub();
 
2900 sub generate_ustva {
 
2901   $lxdebug->enter_sub();
 
2903   # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
 
2904   # Einlesen der Finanzamtdaten
 
2905   get_config($userspath, 'finanzamt.ini');
 
2907   #  &get_project(generate_bwa);
 
2908   @anmeldungszeitraum =
 
2909     qw(0401, 0402, 0403, 0404, 0405, 0405, 0406, 0407, 0408, 0409, 0410, 0411, 0412, 0441, 0442, 0443, 0444);
 
2911   foreach $item (@anmeldungszeitraum) {
 
2912     $form->{$item} = "";
 
2914   if ($form->{reporttype} eq "custom") {
 
2916     #forgotten the year --> thisyear
 
2917     if ($form->{year} !~ m/^\d\d\d\d$/) {
 
2918       $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
 
2924     if ($form->{duetyp} eq "13") {
 
2925       $form->{fromdate} = "1.1.$form->{year}";
 
2926       $form->{todate}   = "31.12.$form->{year}";
 
2930     if ($form->{duetyp} eq "A") {
 
2931       $form->{fromdate} = "1.1.$form->{year}";
 
2932       $form->{todate}   = "31.3.$form->{year}";
 
2933       $form->{"0441"}   = "X";
 
2935     if ($form->{duetyp} eq "B") {
 
2936       $form->{fromdate} = "1.4.$form->{year}";
 
2937       $form->{todate}   = "30.6.$form->{year}";
 
2938       $form->{"0442"}   = "X";
 
2940     if ($form->{duetyp} eq "C") {
 
2941       $form->{fromdate} = "1.7.$form->{year}";
 
2942       $form->{todate}   = "30.9.$form->{year}";
 
2943       $form->{"0443"}   = "X";
 
2945     if ($form->{duetyp} eq "D") {
 
2946       $form->{fromdate} = "1.10.$form->{year}";
 
2947       $form->{todate}   = "31.12.$form->{year}";
 
2948       $form->{"0444"}   = "X";
 
2953       $form->{duetyp} eq "1" && do {
 
2954         $form->{fromdate} = "1.1.$form->{year}";
 
2955         $form->{todate}   = "31.1.$form->{year}";
 
2956         $form->{"0401"}   = "X";
 
2959       $form->{duetyp} eq "2" && do {
 
2960         $form->{fromdate} = "1.2.$form->{year}";
 
2962         #this works from 1901 to 2099, 1900 and 2100 fail.
 
2963         $leap = ($form->{year} % 4 == 0) ? "29" : "28";
 
2964         $form->{todate} = "$leap.2.$form->{year}";
 
2965         $form->{"0402"} = "X";
 
2968       $form->{duetyp} eq "3" && do {
 
2969         $form->{fromdate} = "1.3.$form->{year}";
 
2970         $form->{todate}   = "31.3.$form->{year}";
 
2971         $form->{"0403"}   = "X";
 
2974       $form->{duetyp} eq "4" && do {
 
2975         $form->{fromdate} = "1.4.$form->{year}";
 
2976         $form->{todate}   = "30.4.$form->{year}";
 
2977         $form->{"0404"}   = "X";
 
2980       $form->{duetyp} eq "5" && do {
 
2981         $form->{fromdate} = "1.5.$form->{year}";
 
2982         $form->{todate}   = "31.5.$form->{year}";
 
2983         $form->{"0405"}   = "X";
 
2986       $form->{duetyp} eq "6" && do {
 
2987         $form->{fromdate} = "1.6.$form->{year}";
 
2988         $form->{todate}   = "30.6.$form->{year}";
 
2989         $form->{"0406"}   = "X";
 
2992       $form->{duetyp} eq "7" && do {
 
2993         $form->{fromdate} = "1.7.$form->{year}";
 
2994         $form->{todate}   = "31.7.$form->{year}";
 
2995         $form->{"0407"}   = "X";
 
2998       $form->{duetyp} eq "8" && do {
 
2999         $form->{fromdate} = "1.8.$form->{year}";
 
3000         $form->{todate}   = "31.8.$form->{year}";
 
3001         $form->{"0408"}   = "X";
 
3004       $form->{duetyp} eq "9" && do {
 
3005         $form->{fromdate} = "1.9.$form->{year}";
 
3006         $form->{todate}   = "30.9.$form->{year}";
 
3007         $form->{"0409"}   = "X";
 
3010       $form->{duetyp} eq "10" && do {
 
3011         $form->{fromdate} = "1.10.$form->{year}";
 
3012         $form->{todate}   = "31.10.$form->{year}";
 
3013         $form->{"0410"}   = "X";
 
3016       $form->{duetyp} eq "11" && do {
 
3017         $form->{fromdate} = "1.11.$form->{year}";
 
3018         $form->{todate}   = "30.11.$form->{year}";
 
3019         $form->{"0411"}   = "X";
 
3022       $form->{duetyp} eq "12" && do {
 
3023         $form->{fromdate} = "1.12.$form->{year}";
 
3024         $form->{todate}   = "31.12.$form->{year}";
 
3025         $form->{"0412"}   = "X";
 
3031   #    $locale->date(\%myconfig, $form->current_date(\%myconfig), 0)=~ /(\d\d\d\d)/;
 
3032   #    $form->{year}= $1;
 
3033   #    $form->{fromdate}="1.1.$form->{year}";
 
3034   #    $form->{todate}="31.3.$form->{year}";
 
3035   #    $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
3038   RP->ustva(\%myconfig, \%$form);
 
3040   ($form->{department}) = split /--/, $form->{department};
 
3043     $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
 
3044   $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
 
3046   # if there are any dates construct a where
 
3047   if ($form->{fromdate} || $form->{todate}) {
 
3049     unless ($form->{todate}) {
 
3050       $form->{todate} = $form->current_date(\%myconfig);
 
3053     $longtodate  = $locale->date(\%myconfig, $form->{todate}, 1);
 
3054     $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
 
3056     $longfromdate  = $locale->date(\%myconfig, $form->{fromdate}, 1);
 
3057     $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
 
3059     $form->{this_period} = "$shortfromdate\n$shorttodate";
 
3061         $locale->text('for Period')
 
3062       . qq|<br>\n$longfromdate |
 
3063       . $locale->text('bis')
 
3067   if ($form->{comparefromdate} || $form->{comparetodate}) {
 
3068     $longcomparefromdate =
 
3069       $locale->date(\%myconfig, $form->{comparefromdate}, 1);
 
3070     $shortcomparefromdate =
 
3071       $locale->date(\%myconfig, $form->{comparefromdate}, 0);
 
3073     $longcomparetodate  = $locale->date(\%myconfig, $form->{comparetodate}, 1);
 
3074     $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
 
3076     $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
 
3078         "\n$longcomparefromdate "
 
3079       . $locale->text('bis')
 
3080       . qq| $longcomparetodate|;
 
3083   $form->{Datum_heute} =
 
3084     $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
 
3086   if (   $form->{format} eq 'pdf'
 
3087       or $form->{format} eq 'postscript') {
 
3088     $form->{padding} = "~~";
 
3089     $form->{bold}    = "\textbf{";
 
3090     $form->{endbold} = "}";
 
3091     $form->{br}      = '\\\\';
 
3093     @numbers = qw(51r 86r 97r 93r 96 43 45
 
3095     foreach $number (@numbers) {
 
3096       $form->{$number} =~ s/,/~~/g;
 
3099       } elsif ($form->{format} eq 'html') {
 
3100     $form->{padding} = "  ";
 
3101     $form->{bold}    = "<b>";
 
3102     $form->{endbold} = "</b>";
 
3103     $form->{br}      = "<br>"
 
3107   # setup variables for the form
 
3108   @a = qw(company address businessnumber);
 
3109   map { $form->{$_} = $myconfig{$_} } @a;
 
3111   $form->{address} =~ s/\\n/$form->{br}/g;
 
3113   if ($form->{winston} eq '1') {
 
3117     $form->{templates} = $myconfig{templates};
 
3118     $form->{IN}        = "$form->{type}";
 
3119     $form->{IN} .= '.tex'
 
3120       if (   $form->{format} eq 'pdf'
 
3121           or $form->{format} eq 'postscript');
 
3122     $form->{IN} .= '.html' if ($form->{format} eq 'html');
 
3124     $form->parse_template(\%myconfig, $userspath);
 
3126     # $form->parse_template;
 
3128   $lxdebug->leave_sub();