]> wagnertech.de Git - mfinanz.git/commitdiff
Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 28 Nov 2011 16:05:37 +0000 (17:05 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 28 Nov 2011 16:05:37 +0000 (17:05 +0100)
SL/RP.pm
SL/User.pm
bin/mozilla/ct.pl
bin/mozilla/io.pl
bin/mozilla/rp.pl
templates/webpages/am/config.html
templates/webpages/ct/form_header.html
templates/webpages/rp/e_mail.html [new file with mode: 0644]
templates/webpages/rp/print_options.html [new file with mode: 0644]
templates/webpages/rp/report.html [new file with mode: 0644]
templates/webpages/rp/tax_report.html [new file with mode: 0644]

index 49dbff603ae732bcdac3d4d5e7200dd842dce2b5..e0ed0b4eea27b9c903379cb4643c5eee7306146a 100644 (file)
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -1307,7 +1307,7 @@ sub get_taxaccounts {
        FROM chart c, tax t
        WHERE (c.link LIKE '%CT_tax%') AND (c.id = t.chart_id)
        ORDER BY c.accno|;
-  $form->{taxaccounts} = selectall_hashref_quert($form, $dbh, $query);
+  $form->{taxaccounts} = selectall_hashref_query($form, $dbh, $query);
 
   $dbh->disconnect;
 
index 888d042c486750035fc54b2a1a42b3c190ab3819..18bf0697b731e20cc48d46c46f7b5b0724a53942 100644 (file)
@@ -752,7 +752,7 @@ sub config_vars {
   my @conf = qw(address admin businessnumber company countrycode
     currency dateformat dbconnect dbdriver dbhost dbport dboptions
     dbname dbuser dbpasswd email fax name numberformat password
-    printer role sid signature stylesheet tel templates vclimit angebote
+    printer sid signature stylesheet tel templates vclimit angebote
     bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen
     taxnumber co_ustid duns menustyle template_format default_media
     default_printer_id copies show_form_details favorites
index a7d4eccd3fb442594858a2b6905b334947b05e91..33b0c83329fbd605887c1a28048cb8d04b1d554e 100644 (file)
@@ -321,7 +321,6 @@ sub form_header {
 
   $form->{ALL_SALESMEN}   = $form->{ALL_EMPLOYEES};
   $form->{taxincluded}    = ($form->{taxincluded}) ? "checked" : "";
-  $form->{is_admin}       = $myconfig{role} eq 'admin';
   $form->{is_customer}    = $form->{db}     eq 'customer';
   $form->{salesman_label} = sub { $_[0]->{name} ne "" ? $_[0]->{name} : $_[0]->{login} };
   $form->{shipto_label}   = \&_shipto_label;
index 59b594aacbd739ecb015fc608da80f42567c656e..5df76ed77da5bc9c323b5c2344cef73d72ad3580 100644 (file)
@@ -951,7 +951,7 @@ sub edit_e_mail {
                                      subject       => $subject,
                                      print_options => print_options('inline' => 1),
                                      HIDDEN        => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
-                                     SHOW_BCC      => $myconfig{role} eq 'admin' });
+                                     SHOW_BCC      => $::auth->assert('email_bcc', 'may fail') });
 
   $main::lxdebug->leave_sub();
 }
index dc1b153843e80c9f075b12bf72c28afb9ea6f36e..4bc4673d2db471f8f0c61f2b5c3eab66a4ab8867 100644 (file)
@@ -120,805 +120,108 @@ sub check_rp_access {
 }
 
 sub report {
-  $main::lxdebug->enter_sub();
+  $::lxdebug->enter_sub;
 
   check_rp_access();
 
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
   my %title = (
-            'balance_sheet'        => 'Balance Sheet',
-            'income_statement'     => 'Income Statement',
-            'trial_balance'        => 'Trial Balance',
-            'ar_aging'             => 'Search AR Aging',
-            'ap_aging'             => 'Search AP Aging',
-            'tax_collected'        => 'Tax collected',
-            'tax_paid'             => 'Tax paid',
-            'nontaxable_sales'     => 'Non-taxable Sales',
-            'nontaxable_purchases' => 'Non-taxable Purchases',
-            'receipts'             => 'Receipts',
-            'payments'             => 'Payments',
-            'projects'             => 'Project Transactions',
-            'bwa'                  => 'Business evaluation',
+    balance_sheet        => $::locale->text('Balance Sheet'),
+    income_statement     => $::locale->text('Income Statement'),
+    trial_balance        => $::locale->text('Trial Balance'),
+    ar_aging             => $::locale->text('Search AR Aging'),
+    ap_aging             => $::locale->text('Search AP Aging'),
+    tax_collected        => $::locale->text('Tax collected'),
+    tax_paid             => $::locale->text('Tax paid'),
+    nontaxable_sales     => $::locale->text('Non-taxable Sales'),
+    nontaxable_purchases => $::locale->text('Non-taxable Purchases'),
+    receipts             => $::locale->text('Receipts'),
+    payments             => $::locale->text('Payments'),
+    projects             => $::locale->text('Project Transactions'),
+    bwa                  => $::locale->text('Business evaluation'),
   );
 
-  $form->{title} = $locale->text($title{ $form->{report} });
-
-  my $accrual =  $::instance_conf->get_accounting_method eq 'cash' ? ""        : "checked";
-  my $cash    =  $::instance_conf->get_accounting_method eq 'cash' ? "checked" : "";
-
-  my $year = (localtime)[5] + 1900;
+  $::form->{title} = $title{$::form->{report}};
 
   # get departments
-  $form->all_departments(\%myconfig);
-  if (@{ $form->{all_departments} || [] }) {
-    $form->{selectdepartment} = "<option>\n";
-    map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } @{ $form->{all_departments} || [] };
-  }
-
-  my $department;
-  $department = qq|
-        <tr>
-          <th align=right nowrap>| . $locale->text('Department') . qq|</th>
-          <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
-        </tr>
-| if $form->{selectdepartment};
-
-  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
-                                   "all" => 1 });
-
-  my %project_labels = ();
-  my @project_values = ("");
-  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
-    push(@project_values, $item->{"id"});
-    $project_labels{$item->{"id"}} = $item->{"projectnumber"};
-  }
-
-  my $projectnumber =
-    NTI($::request->{cgi}->popup_menu('-name' => "project_id",
-                               '-values' => \@project_values,
-                               '-labels' => \%project_labels));
-
-  # use JavaScript Calendar or not
-  $form->{jsscript} = 1;
-  my $jsscript = "";
-  my ( $name_1, $id_1, $value_1, $trigger_1, $name_2, $id_2, $value_2, $trigger_2, );
-  if ($form->{report} eq "balance_sheet") {
-    $name_1    = "asofdate";
-    $id_1      = "asofdate";
-    $value_1   = "$form->{asofdate}";
-    $trigger_1 = "trigger1";
-    $name_2    = "compareasofdate";
-    $id_2      = "compareasofdate";
-    $value_2   = "$form->{compareasofdate}";
-    $trigger_2 = "trigger2";
-  } elsif ($form->{report} =~ /(receipts|payments)$/) {
-    $name_1    = "fromdate";
-    $id_1      = "fromdate";
-    $value_1   = "$form->{fromdate}";
-    $trigger_1 = "trigger1";
-    $name_2    = "todate";
-    $id_2      = "todate";
-    $value_2   = "";
-    $trigger_2 = "trigger2";
-  } elsif (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
-    $name_1    = "fromdate";
-    $id_1      = "fromdate";
-    $value_1   = "$form->{fromdate}";
-    $trigger_1 = "trigger1";
-    $name_2    = "todate";
-    $id_2      = "todate";
-    $value_2   = "";
-    $trigger_2 = "trigger2";
-
-  } else {
-    $name_1    = "fromdate";
-    $id_1      = "fromdate";
-    $value_1   = "$form->{fromdate}";
-    $trigger_1 = "trigger1";
-    $name_2    = "todate";
-    $id_2      = "todate";
-    $value_2   = "";
-    $trigger_2 = "trigger2";
+  $::form->all_departments(\%::myconfig);
+  if (@{ $::form->{all_departments} || [] }) {
+    $::form->{selectdepartment} = "<option>\n";
+    map { $::form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } @{ $::form->{all_departments} || [] };
   }
 
-  my ($button1, $button1_2, $button2, $button2_2);
-  my $checked;
-
-  # with JavaScript Calendar
-  if ($form->{jsscript}) {
-    if ($name_1 eq "") {
-      $button1   = qq| <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
-      $button1_2 = qq| <input type=button name=$name_2 id="$trigger_2" value=| . $locale->text('button') . qq|>|;
-
-      #write Trigger
-      $jsscript = Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
-    } else {
-      $button1   = qq| <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
-      $button1_2 = qq| <input type=button name=$name_1 id="$trigger_1" value=| . $locale->text('button') . qq|>|;
-      $button2   = qq| <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
-      $button2_2 = qq| <input type=button name=$name_2 id="$trigger_2" value=| . $locale->text('button') . qq|> |;
-
-      #write Trigger
-      $jsscript = Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1", "$name_2", "BL", "$trigger_2");
-    }
-  } else {
+  $::form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 });
 
-    # without JavaScript Calendar
-    if ($name_1 eq "") {
-      $button1 = qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
-    } else {
-      $button1 = qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1 onBlur=\"check_right_date_format(this)\">|;
-      $button2 = qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
-    }
-  }
-  $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
-  $form->header;
   my $onload = qq|focus()|;
-  $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
-  $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
-  print qq|
-<body onLoad="$onload">
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=title value="$form->{title}">
-
-<table width=100% border="0">
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table border="0">
-      $department
-|;
-
-  if ($form->{report} eq "projects") {
-    print qq|
-        <tr>
-          <th align=right nowrap>| . $locale->text('Project') . qq|</th>
-          <td colspan=5><input name=projectnumber size=25</td>
-        </tr>
-        <input type=hidden name=nextsub value=generate_projects>
-        <tr>
-          <th align=right>| . $locale->text('From') . qq|</th>
-          <td>$button1</td>
-          <td>$button1_2</td>
-          <th align=right>| . $locale->text('Bis') . qq|</th>
-          <td>$button2</td>
-          <td>$button2_2</td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td>
-      <table>
-        <tr>
-          <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
-          <td><input name=l_heading class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Heading') . qq|
-          <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Subtotal') . qq|</td>
-        </tr>
-
-$jsscript
-|;
-  }
-
-  if ($form->{report} eq "income_statement") {
-    print qq|
-        <tr>
-          <th align=right nowrap>| . $locale->text('Project') . qq|</th>
-          <td colspan=3>$projectnumber</td>
-        </tr>
-        <input type=hidden name=nextsub value=generate_income_statement>
-</table>
-<table>
-        <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="custom" checked> | . $locale->text('Customized Report') . qq|</th>
-        </tr>
-        <tr>
-          <th colspan=1>| . $locale->text('Year') . qq|</th>
-          <td><input name=year size=11 title="| . $locale->text('YYYY') . qq|" value="$year"></td>
-        </tr>
-|;
-
-    print qq|
-        <tr>
-                <td align=right> <b> | . $locale->text('Yearly') . qq|</b> </td>
-                <th align=left>| . $locale->text('Quarterly') . qq|</th>
-                <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
-        </tr>
-        <tr>
-                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13" "checked"></td>
-                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. | . $locale->text('Quarter') . qq|</td>
-|;
-    $checked = "";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;| . $locale->text('January') . qq|</td>
-|;
-    $checked = "";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;| . $locale->text('May') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;| . $locale->text('September') . qq|</td>
-
-        </tr>
-        <tr>
-                <td align= right>&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;| . $locale->text('February') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;| . $locale->text('June') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;| . $locale->text('October') . qq|</td>
-        </tr>
-        <tr>
-                <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;| . $locale->text('March') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;| . $locale->text('July') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;| . $locale->text('November') . qq|</td>
-
-        </tr>
-        <tr>
-                <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. | . $locale->text('Quarter') . qq|&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;| . $locale->text('April') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;| . $locale->text('August') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;| . $locale->text('December') . qq|</td>
-
-        </tr>
-        <tr>
-                   <td colspan=5><hr size=3 noshade></td>
-        </tr>
-        <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="free" $checked> | . $locale->text('Free report period') . qq|</th>
-          <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
-              $button1
-              $button1_2&nbsp;
-              | . $locale->text('Bis') . qq|
-              $button2
-              $button2_2&nbsp;
-          </td>
-        </tr>
-        <tr>
-                   <td colspan=5><hr size=3 noshade></td>
-        </tr>
-        <tr>
-          <th align=leftt>| . $locale->text('Method') . qq|</th>
-          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>| . $locale->text('Accrual') . qq|
-          &nbsp;<input name=method class=radio type=radio value=cash $cash>| . $locale->text('EUR') . qq|</td>
-        </tr>
-
-$jsscript
-|;
-  }
-
-  if ($form->{report} eq "bwa") {
-    print qq|
-        <tr>
-          <th align=right nowrap>| . $locale->text('Project') . qq|</th>
-          <td colspan=3>$projectnumber</td>
-        </tr>
-        <input type=hidden name=nextsub value=generate_bwa>
-</table>
-<table>
-        <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="custom" checked> | . $locale->text('Customized Report') . qq|</th>
-        </tr>
-        <tr>
-          <th colspan=1>| . $locale->text('Year') . qq|</th>
-          <td><input name=year size=11 title="| . $locale->text('YYYY') . qq|" value="$year"></td>
-        </tr>
-|;
-
-    print qq|
-        <tr>
-                <td align=right> <b> | . $locale->text('Yearly') . qq|</b> </td>
-                <th align=left>| . $locale->text('Quarterly') . qq|</th>
-                <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
-        </tr>
-        <tr>
-                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"
-$checked></td>
-                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. | . $locale->text('Quarter') . qq|</td>
-|;
-    $checked = "checked";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;| . $locale->text('January') . qq|</td>
-|;
-    $checked = "";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;| . $locale->text('May') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;| . $locale->text('September') . qq|</td>
-
-        </tr>
-        <tr>
-                <td align= right>&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;| . $locale->text('February') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;| . $locale->text('June') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;| . $locale->text('October') . qq|</td>
-        </tr>
-        <tr>
-                <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;| . $locale->text('March') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;| . $locale->text('July') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;| . $locale->text('November') . qq|</td>
-
-        </tr>
-        <tr>
-                <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. | . $locale->text('Quarter') . qq|&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;| . $locale->text('April') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;| . $locale->text('August') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;| . $locale->text('December') . qq|</td>
-
-        </tr>
-        <tr>
-                   <td colspan=5><hr size=3 noshade></td>
-        </tr>
-        <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="free" $checked> | . $locale->text('Free report period') . qq|</th>
-          <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
-              $button1
-              $button1_2&nbsp;
-              | . $locale->text('Bis') . qq|&nbsp;
-              $button2
-              $button2_2
-          </td>
-        </tr>
-        <tr>
-                   <td colspan=5><hr size=3 noshade></td>
-        </tr>
-        <tr>
-          <th align=leftt>| . $locale->text('Method') . qq|</th>
-          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>| . $locale->text('Accrual') . qq|
-          &nbsp;<input name=method class=radio type=radio value=cash $cash>| . $locale->text('EUR') . qq|</td>
-        </tr>
-        <tr>
-         <th align=right colspan=4>| . $locale->text('Decimalplaces') . qq|</th>
-             <td><input name=decimalplaces size=3 value="2"></td>
-         </tr>
-
-$jsscript
-|;
-  }
-
-  if ($form->{report} eq "balance_sheet") {
-    print qq|
-        <input type=hidden name=nextsub value=generate_balance_sheet>
-        <tr>
-          <th align=right>| . $locale->text('as at') . qq|</th>
-          <td>
-            $button1
-            $button1_2
-          </td>
-          <th align=right nowrap>| . $locale->text('Compare to') . qq|</th>
-          <td>
-          $button2
-          $button2_2
-          </td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
-          <td><input name=decimalplaces size=3 value="2"></td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td>
-      <table>
-        <tr>
-          <th align=right>| . $locale->text('Method') . qq|</th>
-          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>| . $locale->text('Accrual') . qq|
-          &nbsp;<input name=method class=radio type=radio value=cash $cash>| . $locale->text('EUR') . qq|</td>
-        </tr>
-
-        <tr>
-          <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
-          <td><input name=l_heading class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Heading') . qq|
-          <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Subtotal') . qq|
-          <input name=l_accno class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Account Number') . qq|</td>
-        </tr>
-
-$jsscript
-|;
-  }
-
-  if ($form->{report} eq "trial_balance") {
-    print qq|
-        <tr>
-          <th align=right nowrap>| . $locale->text('Project') . qq|</th>
-          <td colspan=3>$projectnumber</td>
-        </tr>
-        <input type=hidden name=nextsub value=generate_trial_balance>
-</table>
-<table>
-        <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="custom" checked> | . $locale->text('Customized Report') . qq|</th>
-        </tr>
-        <tr>
-          <th colspan=1>| . $locale->text('Year') . qq|</th>
-          <td><input name=year size=11 title="| . $locale->text('YYYY') . qq|" value="$year"></td>
-        </tr>
-|;
-
-    print qq|
-        <tr>
-                <td align=right> <b> | . $locale->text('Yearly') . qq|</b> </td>
-                <th align=left>| . $locale->text('Quarterly') . qq|</th>
-                <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
-        </tr>
-        <tr>
-                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13" $checked></td>
-                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. | . $locale->text('Quarter') . qq|</td>
-|;
-    $checked = "checked";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;| . $locale->text('January') . qq|</td>
-|;
-    $checked = "";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;| . $locale->text('May') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;| . $locale->text('September') . qq|</td>
-
-        </tr>
-        <tr>
-                <td align= right>&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;| . $locale->text('February') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;| . $locale->text('June') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;| . $locale->text('October') . qq|</td>
-        </tr>
-        <tr>
-                <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;| . $locale->text('March') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;| . $locale->text('July') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;| . $locale->text('November') . qq|</td>
-
-        </tr>
-        <tr>
-                <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. | . $locale->text('Quarter') . qq|&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;| . $locale->text('April') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;| . $locale->text('August') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;| . $locale->text('December') . qq|</td>
-
-        </tr>
-        <tr>
-                   <td colspan=5><hr size=3 noshade></td>
-        </tr>
-        <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="free" $checked> | . $locale->text('Free report period') . qq|</th>
-          <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
-              $button1
-              $button1_2&nbsp;
-              | . $locale->text('Bis') . qq|&nbsp;
-              $button2
-              $button2_2
-          </td>
-        </tr>
-        <tr>
-                   <td colspan=5><hr size=3 noshade></td>
-        </tr>
-        <tr>
-          <th align=leftt>| . $locale->text('Method') . qq|</th>
-          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>| . $locale->text('Accrual') . qq|
-          &nbsp;<input name=method class=radio type=radio value=cash $cash>| . $locale->text('EUR') . qq|</td>
-        </tr>
-       <tr>
-         <th align=right colspan=4>| . $locale->text('All Accounts') . qq|</th>
-             <td><input name=all_accounts type=checkbox value=1></td>
-         </tr>
-        <tr>
-         <th align=right colspan=4>| . $locale->text('Decimalplaces') . qq|</th>
-             <td><input name=decimalplaces size=3 value="2"></td>
-         </tr>
-
-$jsscript
-|;
-  }
-
-  if ($form->{report} =~ /^tax_/) {
-    $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
-
-    RP->get_taxaccounts(\%myconfig, \%$form);
-
-    print qq|
-        <input type=hidden name=nextsub value=generate_tax_report>
-        <tr>
-          <th align=right>| . $locale->text('From') . qq|</th>
-          <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
-          <th align=right>| . $locale->text('Bis') . qq|</th>
-          <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('Report for') . qq|</th>
-          <td colspan=3>
-|;
-
-    $checked = "checked";
-    foreach my $ref (@{ $form->{taxaccounts} }) {
-
-      print
-        qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked>&nbsp;$ref->{description}
-
-    <input name="$ref->{accno}_description" type=hidden value="$ref->{description}">
-    <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
-
-      $checked = "";
-
-    }
-
-    print qq|
-  <input type=hidden name=db value=$form->{db}>
-  <input type=hidden name=sort value=transdate>
-
-          </td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('Method') . qq|</th>
-          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>| . $locale->text('Accrual') . qq|
-          &nbsp;<input name=method class=radio type=radio value=cash $cash>| . $locale->text('EUR') . qq|</td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td>
-      <table>
-        <tr>
-          <th align=right>| . $locale->text('Include in Report') . qq|</th>
-          <td>
-            <table>
-              <tr>
-                <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
-                <td>| . $locale->text('ID') . qq|</td>
-                <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Invoice') . qq|</td>
-                <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Date') . qq|</td>
-              </tr>
-              <tr>
-                <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
-                <td>|;
-
-    if ($form->{db} eq 'ar') {
-      print $locale->text('Customer');
-    }
-    if ($form->{db} eq 'ap') {
-      print $locale->text('Vendor');
-    }
-
-    print qq|</td>
-                <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Amount') . qq|</td>
-                <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Tax') . qq|</td>
-                <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
-                <td>| . $locale->text('Total') . qq|</td>
-              </tr>
-              <tr>
-                <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
-                <td>| . $locale->text('Subtotal') . qq|</td>
-              </tr>
-            </table>
-          </td>
-        </tr>
-|;
-
-  }
-
-  if ($form->{report} =~ /^nontaxable_/) {
-    $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
-
-    print qq|
-        <input type=hidden name=nextsub value=generate_tax_report>
-
-        <input type=hidden name=db value=$form->{db}>
-        <input type=hidden name=sort value=transdate>
-        <input type=hidden name=report value=$form->{report}>
-
-        <tr>
-          <th align=right>| . $locale->text('From') . qq|</th>
-          <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
-          <th align=right>| . $locale->text('Bis') . qq|</th>
-          <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('Method') . qq|</th>
-          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
-      . $locale->text('Accrual') . qq|
-          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR') . qq|</td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('Include in Report') . qq|</th>
-          <td colspan=3>
-            <table>
-              <tr>
-                <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
-                <td>| . $locale->text('ID') . qq|</td>
-                <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Invoice') . qq|</td>
-                <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Date') . qq|</td>
-              </tr>
-              <tr>
-                <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
-                <td>|;
-
-    if ($form->{db} eq 'ar') {
-      print $locale->text('Customer');
-    }
-    if ($form->{db} eq 'ap') {
-      print $locale->text('Vendor');
-    }
-
-    print qq|</td>
-                <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
-                <td>| . $locale->text('Amount') . qq|</td>
-                <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
-                <td>| . $locale->text('Total') . qq|</td>
-              </tr>
-              <tr>
-                <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
-                <td>| . $locale->text('Subtotal') . qq|</td>
-              </tr>
-            </table>
-          </td>
-        </tr>
-|;
 
-  }
+  my $is_projects         = $::form->{report} eq "projects";
+  my $is_income_statement = $::form->{report} eq "income_statement";
+  my $is_bwa              = $::form->{report} eq "bwa";
+  my $is_balance_sheet    = $::form->{report} eq "balance_sheet";
+  my $is_trial_balance    = $::form->{report} eq "trial_balance";
+  my $is_taxreport        = $::form->{report} =~ /^tax_/;
+  my $is_nontaxable       = $::form->{report} =~ /^nontaxable_/;
+  my $is_aging            = $::form->{report} =~ /^a[rp]_aging$/;
+  my $is_payments         = $::form->{report} =~ /(receipts|payments)$/;
+
+#  if (is_taxreport) {
+#    $::form->{db} = ($::form->{report} =~ /_collected/) ? "ar" : "ap";
+#    RP->get_taxaccounts(\%::myconfig, $::form);
+#  }
+#
+#  if ($is_nontaxable) {
+#    $::form->{db} = ($::form->{report} =~ /_sales/) ? "ar" : "ap";
+#  }
 
   my ($label, $nextsub, $vc);
-  if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
-    if ($form->{report} eq 'ar_aging') {
-      $label = $locale->text('Customer');
-      $form->{vc} = 'customer';
-    } else {
-      $label = $locale->text('Vendor');
-      $form->{vc} = 'vendor';
-    }
+  if ($is_aging) {
+    my $is_sales  = $::form->{report} eq 'ar_aging';
+    $label        = $is_sales ? $::locale->text('Customer') : $::locale->text('Vendor');
+    $::form->{vc} = $is_sales ? 'customer' : 'vendor';
 
-    $nextsub = "generate_$form->{report}";
+    $nextsub = "generate_$::form->{report}";
 
     # setup vc selection
-    $form->all_vc(\%myconfig, $form->{vc},
-                  ($form->{vc} eq 'customer') ? "AR" : "AP");
-
-    map { $vc .= "<option>$_->{name}--$_->{id}\n" }
-      @{ $form->{"all_$form->{vc}"} };
-
-    $vc =
-      ($vc)
-      ? qq|<select name=$form->{vc}><option>\n$vc</select>|
-      : qq|<input name=$form->{vc} size=35>|;
-
-    print qq|
-        <tr>
-          <th align=right>| . $locale->text($label) . qq|</th>
-          <td>$vc</td>
-        </tr>
-        <tr>
-          <td>| . $locale->text('Review of Aging list') . qq|</td>
-          <td><select name="review_of_aging_list">
-              <option></option>
-              <option>0-30</option>
-              <option>30-60</option>
-              <option>60-90</option>
-              <option>90-120</option>
-              <option>> 120</option>
-              </select>
-          </td>
-        </tr>
-        <tr>
-          <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
-              $button1
-              $button1_2&nbsp;
-              | . $locale->text('Bis') . qq|&nbsp;
-              $button2
-              $button2_2
-          </td>
-        </tr>
-        <input type=hidden name=type value=statement>
-        <input type=hidden name=format value=html>
-        <input type=hidden name=media value=screen>
-
-        <input type=hidden name=nextsub value=$nextsub>
-        <input type=hidden name=action value=$nextsub>
-
-$jsscript
-|;
+    $::form->all_vc(\%::myconfig, $::form->{vc}, $is_sales ? "AR" : "AP");
+    $vc .= "<option>$_->{name}--$_->{id}\n" for @{ $::form->{"all_$::form->{vc}"} };
+    $vc = ($vc)
+        ? qq|<select name=$::form->{vc}><option>\n$vc</select>|
+        : qq|<input name=$::form->{vc} size=35>|;
   }
 
-  # above action can be removed if there is more than one input field
-
   my ($selection, $paymentaccounts);
-  if ($form->{report} =~ /(receipts|payments)$/) {
-    $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
+  if ($is_payments) {
+    $::form->{db} = $::form->{report} =~ /payments$/ ? "ap" : "ar";
 
-    RP->paymentaccounts(\%myconfig, \%$form);
+    RP->paymentaccounts(\%::myconfig, $::form);
 
     $selection = "<option>\n";
-    foreach my $ref (@{ $form->{PR} }) {
+    for my $ref (@{ $::form->{PR} }) {
       $paymentaccounts .= "$ref->{accno} ";
       $selection       .= "<option>$ref->{accno}--$ref->{description}\n";
     }
-
-    chop $paymentaccounts;
-
-    print qq|
-        <input type=hidden name=nextsub value=list_payments>
-        <tr>
-          <th align=right nowrap>| . $locale->text('Account') . qq|</th>
-          <td colspan=3><select name=account>$selection</select>
-            <input type=hidden name=paymentaccounts value="$paymentaccounts">
-          </td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('Reference') . qq|</th>
-          <td colspan=3><input name=reference></td>
-        </tr>
-        <tr>
-          <th align=right nowrap>| . $locale->text('Source') . qq|</th>
-          <td colspan=3><input name=source></td>
-        </tr>
-        <tr>
-          <th align=right nowrap>| . $locale->text('Memo') . qq|</th>
-          <td colspan=3><input name=memo size=30></td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('From') . qq|</th>
-          <td>
-            $button1
-            $button1_2
-          </td>
-          <th align=right>| . $locale->text('Bis') . qq|</th>
-          <td>
-            $button2
-            $button2_2
-          </td>
-        </tr>
-        <tr>
-          <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
-          <th align=left colspan=3>| . $locale->text('Include Exchangerate Difference') . qq|</td>
-        </tr>
-
-$jsscript
-
-          <input type=hidden name=db value=$form->{db}>
-          <input type=hidden name=sort value=transdate>
-|;
-
   }
 
-  print qq|
-
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<br>
-<input type=submit class=submit name=action value="| . $locale->text('Continue') . qq|">
-
-</form>
-
-</body>
-</html>
-|;
+  $::form->header;
+  print $::form->parse_html_template('rp/report', {
+    paymentaccounts     => $paymentaccounts,
+    selection           => $selection,
+    is_aging            => $is_aging,
+    vc                  => $vc,
+    label               => $label,
+    year                => DateTime->today->year,
+    onload              => $onload,
+    nextsub             => $nextsub,
+    accrual             => $::instance_conf->get_accounting_method ne 'cash',
+    cash                => $::instance_conf->get_accounting_method eq 'cash',
+    is_payments         => $is_payments,
+    is_trial_balance    => $is_trial_balance,
+    is_balance_sheet    => $is_balance_sheet,
+    is_bwa              => $is_bwa,
+    is_income_statement => $is_income_statement,
+    is_projects         => $is_projects,
+  });
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 sub continue { call_sub($main::form->{"nextsub"}); }
@@ -1804,116 +1107,39 @@ sub select_all {
 }
 
 sub e_mail {
-  $main::lxdebug->enter_sub();
-
-  $main::auth->assert('general_ledger');
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
+  $::lxdebug->enter_sub;
+  $::auth->assert('general_ledger');
 
   # get name and email addresses
   my $selected = 0;
-  for my $i (1 .. $form->{rowcount}) {
-    if ($form->{"statement_$i"}) {
-      $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
-      RP->get_customer(\%myconfig, \%$form);
-      $selected = 1;
-      last;
-    }
+  for my $i (1 .. $::form->{rowcount}) {
+    next unless $::form->{"statement_$i"};
+    $::form->{"$::form->{ct}_id"} = $::form->{"$::form->{ct}_id_$i"};
+    RP->get_customer(\%::myconfig, $::form);
+    $selected = 1;
+    last;
   }
 
-  $form->error($locale->text('Nothing selected!')) unless $selected;
-
-  my $bcc = '';
-  if ($myconfig{role} eq 'admin') {
-    $bcc = qq|
-          <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
-          <td><input name=bcc size=30 value="$form->{bcc}"></td>
-|;
-  }
+  $::form->error($::locale->text('Nothing selected!')) unless $selected;
 
-  my $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
-
-  $form->{media} = "email";
-
-  $form->header;
-
-  print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
-  <tr class=listtop>
-    <th>$title</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr>
-          <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
-          <td><input name=email size=30 value="$form->{email}"></td>
-          <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
-          <td><input name=cc size=30 value="$form->{cc}"></td>
-        </tr>
-        <tr>
-          <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
-          <td><input name=subject size=30 value="$form->{subject}"></td>
-          $bcc
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr>
-          <th align=left nowrap>| . $locale->text('Message') . qq|</th>
-        </tr>
-        <tr>
-          <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td>
-|;
-
-  &print_options;
-
-  map { delete $form->{$_} }
-    qw(action email cc bcc subject message type sendmode format header);
+  $::form->{media} = "email";
 
   # save all other variables
-  foreach my $key (keys %$form) {
-    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
-    $form->{$key} =~ s/\"/&quot;/g;
-    print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
+  my @hidden_values;
+  for my $key (keys %$::form) {
+    next if any { $key eq $_ } qw(login password action email cc bcc subject message type sendmode format header);
+    next unless '' eq ref $::form->{$key};
+    push @hidden_values, $key;
   }
 
-  print qq|
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<input type=hidden name=nextsub value=send_email>
-
-<br>
-<input name=action class=submit type=submit value="|
-    . $locale->text('Continue') . qq|">
-</form>
-
-</body>
-</html>
-|;
+  $::form->header;
+  print $::form->parse_html_template('rp/e_mail', {
+    show_bcc      => $::auth->assert('email_bcc', 'may fail'),
+    print_options => print_options(inline => 1),
+    hidden_values => \@hidden_values,
+  });
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 sub send_email {
@@ -2123,259 +1349,138 @@ sub statement_details {
 }
 
 sub generate_tax_report {
-  $main::lxdebug->enter_sub();
-
-  $main::auth->assert('report');
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
+  $::lxdebug->enter_sub;
+  $::auth->assert('report');
 
-  RP->tax_report(\%myconfig, \%$form);
+  RP->tax_report(\%::myconfig, $::form);
 
-  my $descvar     = "$form->{accno}_description";
-  my $description = $form->escape($form->{$descvar});
-  my $ratevar     = "$form->{accno}_rate";
+  my $descvar     = "$::form->{accno}_description";
   my ($subtotalnetamount, $subtotaltax, $subtotal) = (0, 0, 0);
 
-  my $department = $form->escape($form->{department});
-
   # construct href
-  my $href =
-    "$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&report=$form->{report}";
+  my $href     =
+  my $callback = build_std_url('action=generate_tax_report', $descvar,
+    qw(fromdate todate db method accno department report title));
 
-  # construct callback
-  $description = $form->escape($form->{$descvar},   1);
-  $department  = $form->escape($form->{department}, 1);
-  my $callback    =
-    "$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&report=$form->{report}";
-
-  my $title = $form->escape($form->{title});
-  $href .= "&title=$title";
-  $title = $form->escape($form->{title}, 1);
-  $callback .= "&title=$title";
-
-  $form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
-
-  my @columns =
-    $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
+  my @columns = $::form->sort_columns(qw(id transdate invnumber name netamount tax amount));
   my @column_index;
 
-  foreach my $item (@columns) {
-    if ($form->{"l_$item"} eq "Y") {
-      push @column_index, $item;
-
-      # add column to href and callback
+  for my $item (@columns, 'subtotal') {
+    if ($::form->{"l_$item"} eq "Y") {
       $callback .= "&l_$item=Y";
       $href     .= "&l_$item=Y";
     }
   }
 
-  if ($form->{l_subtotal} eq 'Y') {
-    $callback .= "&l_subtotal=Y";
-    $href     .= "&l_subtotal=Y";
+  for my $item (@columns) {
+    if ($::form->{"l_$item"} eq "Y") {
+      push @column_index, $item;
+    }
   }
 
-  my $option;
-  if ($form->{department}) {
-    ($department) = split /--/, $form->{department};
-    $option = $locale->text('Department') . " : $department";
+  my @options;
+  if ($::form->{department}) {
+    my ($department) = split /--/, $::form->{department};
+    push @options, $::locale->text('Department') . " : $department";
   }
 
-  my ($fromdate, $todate);
   # if there are any dates
-  if ($form->{fromdate} || $form->{todate}) {
-    if ($form->{fromdate}) {
-      $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
-    }
-    if ($form->{todate}) {
-      $todate = $locale->date(\%myconfig, $form->{todate}, 1);
-    }
-
-    $form->{period} = "$fromdate - $todate";
+  if ($::form->{fromdate} || $::form->{todate}) {
+    my $fromdate = $::form->{fromdate} ? $::locale->date(\%::myconfig, $::form->{fromdate}, 1) : '';
+    my $todate   = $::form->{todate}   ? $::locale->date(\%::myconfig, $::form->{todate}, 1)   : '';
+    push @options, "$fromdate - $todate";
   } else {
-    $form->{period} =
-      $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
+    push @options, $::locale->date(\%::myconfig, $::form->current_date, 1);
   }
 
   my ($name, $invoice, $arap);
-  if ($form->{db} eq 'ar') {
-    $name    = $locale->text('Customer');
+  if ($::form->{db} eq 'ar') {
+    $name    = $::locale->text('Customer');
     $invoice = 'is.pl';
     $arap    = 'ar.pl';
   }
-  if ($form->{db} eq 'ap') {
-    $name    = $locale->text('Vendor');
+  if ($::form->{db} eq 'ap') {
+    $name    = $::locale->text('Vendor');
     $invoice = 'ir.pl';
     $arap    = 'ap.pl';
   }
 
-  $option .= "<br>" if $option;
-  $option .= "$form->{period}";
-
-  my %column_header;
-  $column_header{id}        = qq|<th><a class=listheading href=$href&sort=id>| . $locale->text('ID') . qq|</th>|;
-  $column_header{invnumber} = qq|<th><a class=listheading href=$href&sort=invnumber>| . $locale->text('Invoice') . qq|</th>|;
-  $column_header{transdate} = qq|<th><a class=listheading href=$href&sort=transdate>| . $locale->text('Date') . qq|</th>|;
-  $column_header{netamount} = qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
-  $column_header{tax}       = qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
-  $column_header{amount}    = qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
-
-  $column_header{name}      = qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
-
-  $form->header;
-
-  print qq|
-<body>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>$option</td>
-  </tr>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr class=listheading>
-|;
-
-  map { print "$column_header{$_}\n" } @column_index;
+  my %column_header = (
+    id        => $::locale->text('ID'),
+    invnumber => $::locale->text('Invoice'),
+    transdate => $::locale->text('Date'),
+    netamount => $::locale->text('Amount'),
+    tax       => $::locale->text('Tax'),
+    amount    => $::locale->text('Total'),
+    name      => $name,
+  );
 
-  print qq|
-        </tr>
-|;
+  my %column_sorted = map { $_ => 1 } qw(id invnumber transdate);
 
-  # add sort and escape callback
-  $callback = $form->escape($callback . "&sort=$form->{sort}");
+  $callback .= "&sort=$::form->{sort}";
 
   my $sameitem;
-  if (@{ $form->{TR} }) {
-    $sameitem = $form->{TR}->[0]->{ $form->{sort} };
+  if (@{ $::form->{TR} }) {
+    $sameitem = $::form->{TR}->[0]->{ $::form->{sort} };
   }
 
-  my ($totalnetamount, $totaltax);
-  my ($i);
-  foreach my $ref (@{ $form->{TR} }) {
+  my ($totalnetamount, $totaltax, @data);
+  for my $ref (@{ $::form->{TR} }) {
 
     my $module = ($ref->{invoice}) ? $invoice : $arap;
 
-    if ($form->{l_subtotal} eq 'Y') {
-      if ($sameitem ne $ref->{ $form->{sort} }) {
-        tax_subtotal(\@column_index, \$subtotalnetamount, \$subtotaltax, \$subtotal);
-        $sameitem = $ref->{ $form->{sort} };
+    if ($::form->{l_subtotal} eq 'Y') {
+      if ($sameitem ne $ref->{ $::form->{sort} }) {
+        push @data, {
+          subtotal  => 1,
+          netamount => $subtotalnetamount,
+          tax       => $subtotaltax,
+          amount    => $subtotal,
+        };
+        $subtotalnetamount = 0;
+        $subtotaltax       = 0;
+        $sameitem          = $ref->{ $::form->{sort} };
       }
     }
 
-    $totalnetamount += $ref->{netamount};
-    $totaltax       += $ref->{tax};
-    $ref->{amount} = $ref->{netamount} + $ref->{tax};
-
     $subtotalnetamount += $ref->{netamount};
     $subtotaltax       += $ref->{tax};
+    $totalnetamount    += $ref->{netamount};
+    $totaltax          += $ref->{tax};
+    $ref->{amount}      = $ref->{netamount} + $ref->{tax};
 
-    map {
-      $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, "&nbsp;");
-    } qw(netamount tax amount);
-
-    my %column_data;
-    $column_data{id}        = qq|<td>$ref->{id}</td>|;
-    $column_data{invnumber} =
-      qq|<td><a href=$module?action=edit&id=$ref->{id}&callback=$callback>$ref->{invnumber}</a></td>|;
-    $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
-    $column_data{name}      = qq|<td>$ref->{name}&nbsp;</td>|;
-
-    map { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
-      qw(netamount tax amount);
-
-    $i++;
-    $i %= 2;
-    print qq|
-        <tr class=listrow$i>
-|;
-
-    map { print "$column_data{$_}\n" } @column_index;
-
-    print qq|
-        </tr>
-|;
-
+    push @data, { map { $_ => { data => $ref->{$_} } } keys %$ref };
+    $data[-1]{invnumber}{link} = "$module?action=edit&id=$ref->{id}&callback=$callback";
+    $data[-1]{$_}{numeric}     = 1 for qw(netamount tax amount);
   }
 
-  if ($form->{l_subtotal} eq 'Y') {
-    tax_subtotal(\@column_index, \$subtotalnetamount, \$subtotaltax, \$subtotal);
+  if ($::form->{l_subtotal} eq 'Y') {
+    push @data, {
+      subtotal  => 1,
+      netamount => $subtotalnetamount,
+      tax       => $subtotaltax,
+      amount    => $subtotal,
+    };
   }
 
-  my %column_data;
-  map { $column_data{$_} = qq|<th>&nbsp;</th>| } @column_index;
-
-  print qq|
-        </tr>
-        <tr class=listtotal>
-|;
-
-  my $total          = $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, "&nbsp;");
-  $totalnetamount = $form->format_amount(\%myconfig, $totalnetamount, 2, "&nbsp;");
-  $totaltax       = $form->format_amount(\%myconfig, $totaltax, 2, "&nbsp;");
-
-  $column_data{netamount} = qq|<th class=listtotal align=right>$totalnetamount</th>|;
-  $column_data{tax}    = qq|<th class=listtotal align=right>$totaltax</th>|;
-  $column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
-
-  map { print "$column_data{$_}\n" } @column_index;
-
-  print qq|
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-</body>
-</html>
-|;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub tax_subtotal {
-  $main::lxdebug->enter_sub();
-
-  my ($column_index, $subtotalnetamount, $subtotaltax, $subtotal) = @_;
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  my %column_data;
-  map { $column_data{$_} = "<td>&nbsp;</td>" } @{ $column_index };
-
-  $$subtotalnetamount = $form->format_amount(\%myconfig, $$subtotalnetamount, 2, "&nbsp;");
-  $$subtotaltax       = $form->format_amount(\%myconfig, $$subtotaltax, 2, "&nbsp;");
-  $$subtotal          = $form->format_amount(\%myconfig, $$subtotalnetamount + $$subtotaltax, 2, "&nbsp;");
-
-  $column_data{netamount} = "<th class=listsubtotal align=right>$$subtotalnetamount</th>";
-  $column_data{tax}       = "<th class=listsubtotal align=right>$$subtotaltax</th>";
-  $column_data{amount}    = "<th class=listsubtotal align=right>$$subtotal</th>";
-
-  $$subtotalnetamount = 0;
-  $$subtotaltax       = 0;
-
-  print qq|
-        <tr class=listsubtotal>
-|;
-  map { print "\n$column_data{$_}" } @{ $column_index };
+  push @data, {
+    total     => 1,
+    netamount => $totalnetamount,
+    tax       => $totaltax,
+    amount    => $totalnetamount + $totaltax,
+  };
 
-  print qq|
-        </tr>
-|;
+  $::form->header;
+  print $::form->parse_html_template('rp/tax_report', {
+    column_index  => \@column_index,
+    column_header => \%column_header,
+    column_sorted => \%column_sorted,
+    sort_base     => $href,
+    DATA          => \@data,
+    options       => \@options,
+  });
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 sub list_payments {
@@ -2512,79 +1617,28 @@ sub list_payments {
 }
 
 sub print_options {
-  $main::lxdebug->enter_sub();
+  $::lxdebug->enter_sub;
 
   my ($dont_print) = @_;
 
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $form->{sendmode} = "attachment";
-
-  $form->{"format"} =
-    $form->{"format"} ? $form->{"format"} :
-    $myconfig{"template_format"} ? $myconfig{"template_format"} :
-    "pdf";
+  $::form->{sendmode} = "attachment";
+  $::form->{format} ||= $::myconfig{template_format} || "pdf";
+  $::form->{copies} ||= $::myconfig{copies}          || 2;
 
-  $form->{"copies"} =
-    $form->{"copies"} ? $form->{"copies"} :
-    $myconfig{"copies"} ? $myconfig{"copies"} :
-    2;
+  $::form->{PD}{ $::form->{type} }     = "selected";
+  $::form->{DF}{ $::form->{format} }   = "selected";
+  $::form->{OP}{ $::form->{media} }    = "selected";
+  $::form->{SM}{ $::form->{sendmode} } = "selected";
 
-  $form->{PD}{ $form->{type} }     = "selected";
-  $form->{DF}{ $form->{format} }   = "selected";
-  $form->{OP}{ $form->{media} }    = "selected";
-  $form->{SM}{ $form->{sendmode} } = "selected";
-
-  my ($media);
-  my $type = qq|
-            <option value=statement $form->{PD}{statement}>| . $locale->text('Statement');
-
-  if ($form->{media} eq 'email') {
-    $media = qq|
-            <option value=attachment $form->{SM}{attachment}>| . $locale->text('Attachment') . qq|
-            <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
-  } else {
-    $media = qq|
-            <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
-    if ($myconfig{printer} && $::lx_office_conf{print_templates}->{latex}) {
-      $media .= qq|
-            <option value=printer $form->{OP}{printer}>| . $locale->text('Printer');
-    }
-  }
-
-  my $format;
-  if ($::lx_office_conf{print_templates}->{latex}) {
-    $format .= qq|
-            <option value=html $form->{DF}{html}>| . $locale->text('HTML')
-      . qq| <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF')
-      . qq| <option value=postscript $form->{DF}{postscript}>| . $locale->text('Postscript');
-  }
-
-  my $output = qq|
-<table>
-  <tr>
-    <td><select name=type>$type</select></td>
-    <td><select name=format>$format</select></td>
-    <td><select name=media>$media</select></td>
-|;
-
-  if ($myconfig{printer} && $::lx_office_conf{print_templates}->{latex} && $form->{media} ne 'email') {
-    $output .= qq|
-      <td>| . $locale->text('Copies') . qq|
-      <input name=copies size=2 value=$form->{copies}></td>
-|;
-  }
-
-  $output .= qq|
-  </tr>
-</table>
-|;
+  my $output = $::form->parse_html_template('rp/print_options', {
+    got_printer => $::myconfig{printer},
+    show_latex  => $::lx_office_conf{print_templates}->{latex},
+    is_email    => $::form->{media} eq 'email',
+  });
 
   print $output unless $dont_print;
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 
   return $output;
 }
index 9c22678a24a9035e83cae34ba6dd1e7b42d94030..ea5b41b220b6d6a2ae93c1a01ba74b7937ba14f9 100644 (file)
@@ -16,7 +16,6 @@
   </ul>
 
   <input type="hidden" name="type" value="preferences">
-  <input type="hidden" name="role" value="[% HTML.escape(myconfig_role) %]">
 
   <div class="tabcontentstyle">
 
index 796f2a3ba9d2dbfe0a8086c48252c2c83115c8c9..90e1a904edc94f533f93979fa48d8ff2317ba81f 100644 (file)
@@ -1,10 +1,11 @@
 [%- USE T8 %]
 [% USE HTML %][% USE LxERP %]
 [% USE L %]
-[% L.javascript_tag('jquery') %]
 <body>
 
- <div class="listtop">[% title %]</div>
+ <h1>[% title %]</h1>
+
+ [% PROCESS 'common/flash.html' %]
 
  <form method="post" name="ct" action="ct.pl" >
 
diff --git a/templates/webpages/rp/e_mail.html b/templates/webpages/rp/e_mail.html
new file mode 100644 (file)
index 0000000..6d44c8f
--- /dev/null
@@ -0,0 +1,48 @@
+[%- USE HTML %]
+[%- USE L %]
+[%- USE LxERP %]
+[%- USE T8 %]
+<body>
+
+<h1>[% 'E-mail Statement to' | $T8 %] [% $ct %]</h1>
+
+<form method=post action='[% script %]'>
+
+<table>
+  <tr>
+    <th align=right nowrap>[% 'E-mail' | $T8 %]</th>
+    <td><input name=email size=30 value="[% email %]"></td>
+    <th align=right nowrap>[% 'Cc' | $T8 %]</th>
+    <td><input name=cc size=30 value="[% cc %]"></td>
+  </tr>
+  <tr>
+    <th align=right nowrap>[% 'Subject' | $T8 %]</th>
+    <td><input name=subject size=30 value="[% subject %]"></td>
+[% IF show_bcc %]
+    <th align=right nowrap=true>[% 'Bcc' | $T8 %]</th>
+    <td><input name=bcc size=30 value="[% bcc | $T8 %]"></td>
+[%- END %]
+  </tr>
+</table>
+<table width=100%>
+  <tr>
+    <th align=left nowrap>[% 'Message' | $T8 %]</th>
+  </tr>
+  <tr>
+    <td><textarea name=message rows=15 cols=60 wrap=soft>[% message %]</textarea></td>
+  </tr>
+</table>
+[% print_options %]
+<hr size=3 noshade>
+
+<input type=hidden name=nextsub value=send_email>
+[%- FOREACH var = hidden_values %]
+[% L.hidden_tag(var, $var) %]
+[%- END %]
+
+<br>
+<input name=action class=submit type=submit value="[% 'Continue' | $T8 %]">
+</form>
+
+</body>
+</html>
diff --git a/templates/webpages/rp/print_options.html b/templates/webpages/rp/print_options.html
new file mode 100644 (file)
index 0000000..776a02d
--- /dev/null
@@ -0,0 +1,36 @@
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+[%- USE T8 %]
+<table>
+  <tr>
+    <td>
+     <select name=type>
+      <option value=statement [% PD.statement %]>[% 'Statement' | $T8 %]</option>
+     </select>
+    </td>
+    <td>
+     <select name=format>
+      <option value=html [% DF.html %]>[% 'HTML' | $T8 %]</option>
+      <option value=pdf [% DF.pdf %]>[% 'PDF' | $T8 %]</option>
+      <option value=postscript [% DF.postscript %]>[% 'Postscript' | $T8 %]</option>
+     </select>
+    </td>
+    <td>
+     <select name=media>
+[%- IF is_email %]
+      <option value=attachment [% SM.attachment %]>[% 'Attachment' | $T8 %]</option>
+      <option value=inline [% SM.inline %]>[% 'In-line' | $T8 %]</option>
+[%- ELSE %]
+      <option value=screen [% OP.screen %]>[% 'Screen' | $T8 %]</option>
+  [%- IF got_printer && show_latex %]
+      <option value=printer [% OP.printer %]>[% 'Printer' | $T8 %]</option>
+  [%- END %]
+[%- END %]
+     </select>
+    </td>
+[%- IF got_printer && show_latex && !is_email %]
+      <td>[% 'Copies' | $T8 %]<input name=copies size=2 value=[% copies %]></td>
+[%- END %]
+  </tr>
+</table>
diff --git a/templates/webpages/rp/report.html b/templates/webpages/rp/report.html
new file mode 100644 (file)
index 0000000..934bf89
--- /dev/null
@@ -0,0 +1,352 @@
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+[%- USE T8 %]
+
+[%- BLOCK customized_report %]
+  <tr>
+    <th align=left><input name=reporttype class=radio type=radio value="custom" checked>[% 'Customized Report' | $T8 %]</th>
+  </tr>
+  <tr>
+    <th colspan=1>[% 'Year' | $T8 %]</th>
+    <td><input name=year size=11 title="[% 'YYYY' | $T8 %]" value="[% year %]"></td>
+  </tr>
+  <tr>
+    <td align=right> <b>[% 'Yearly' | $T8 %]</b> </td>
+    <th align=left>[% 'Quarterly' | $T8 %]</th>
+    <th align=left colspan=3>[% 'Monthly' | $T8 %]</th>
+  </tr>
+  <tr>
+    <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"></td>
+    <td><input name=duetyp class=radio type=radio value="A">&nbsp;1. [% 'Quarter' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="1" checked>&nbsp;[% 'January' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="5">&nbsp;[% 'May' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="9">&nbsp;[% 'September' | $T8 %]</td>
+  </tr>
+  <tr>
+    <td align= right>&nbsp;</td>
+    <td><input name=duetyp class=radio type=radio value="B">&nbsp;2. [% 'Quarter' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="2">&nbsp;[% 'February' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="6">&nbsp;[% 'June' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="10">&nbsp;[% 'October' | $T8 %]</td>
+  </tr>
+  <tr>
+    <td> &nbsp;</td>
+    <td><input name=duetyp class=radio type=radio value="C">&nbsp;3. [% 'Quarter' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="3">&nbsp;[% 'March' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="7">&nbsp;[% 'July' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="11">&nbsp;[% 'November' | $T8 %]</td>
+  </tr>
+  <tr>
+    <td> &nbsp;</td>
+    <td><input name=duetyp class=radio type=radio value="D">&nbsp;4. [% 'Quarter' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="4">&nbsp;[% 'April' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="8">&nbsp;[% 'August' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="12">&nbsp;[% 'December' | $T8 %]</td>
+  </tr>
+  <tr>
+    <td colspan=5><hr size=3 noshade></td>
+  </tr>
+  <tr>
+    <th align=left><input name=reporttype class=radio type=radio value="free">[% 'Free report period' | $T8 %]</th>
+    <td align=left colspan=4>
+      [% 'From' | $T8 %] [% L.date_tag('fromdate', fromdate) %]
+      [% 'Bis' | $T8 %] [% L.date_tag('todate') %]
+    </td>
+  </tr>
+  <tr>
+    <td colspan=5><hr size=3 noshade></td>
+  </tr>
+[%- END %]
+[%- BLOCK cash_or_accrual %]
+  <tr>
+    <th align=leftt>[% 'Method' | $T8 %]</th>
+    <td colspan=3>
+      [% L.radio_button_tag('method', value='accrual', checked=accrual, label=LxERP.t8('Accrual')) %]
+      [% L.radio_button_tag('method', value='cash', checked=cash, label=LxERP.t8('EUR')) %]
+    </td>
+  </tr>
+[%- END %]
+[%- BLOCK projectnumber %]
+  <tr>
+    <th align=right nowrap>[% 'Project' | $T8 %]</th>
+    <td colspan=3>[% L.select_tag('project_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', with_empty=1)) %]</td>
+  </tr>
+[%- END %]
+
+<body onLoad="[% onload %]">
+<h1>[% title %]</h1>
+
+<form method=post action='[% script %]'>
+
+<input type=hidden name=title value="[% title %]">
+
+<table border="0">
+[%- IF selectdepartment %]
+  <tr>
+    <th align=right nowrap>[% 'Department' | $T8 %]</th>
+    <td colspan=3><select name=department>[% selectdepartment %]</select></td>
+  </tr>
+[%- END %]
+
+[%- IF is_projects %]
+  <tr>
+    <th align=right nowrap>[% 'Project' | $T8 %]</th>
+    <td colspan=5><input name=projectnumber size=25</td>
+  </tr>
+  <input type=hidden name=nextsub value=generate_projects>
+  <tr>
+    <th align=right>[% 'as at' | $T8 %]</th>
+    <td> [% L.date_tag('fromdate', fromdate) %]</td>
+    <th align=right nowrap>[% 'Compare to' | $T8 %]</th>
+    <td>[% L.date_tag('todate') %]</td>
+  </tr>
+</table>
+<table>
+  <tr>
+    <th align=right nowrap>[% 'Include in Report' | $T8 %]</th>
+    <td><input name=l_heading class=checkbox type=checkbox value=Y>&nbsp;[% 'Heading' | $T8 %]
+    <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;[% 'Subtotal' | $T8 %]</td>
+  </tr>
+[%- END %]
+
+[%- IF is_income_statement %]
+[%- PROCESS projectnumber %]
+  <input type=hidden name=nextsub value=generate_income_statement>
+</table>
+<table>
+[%- PROCESS customized_report %]
+[%- PROCESS cash_or_accrual %]
+[%- END %]
+
+[%- IF is_bwa %]
+[%- PROCESS projectnumber %]
+  <input type=hidden name=nextsub value=generate_bwa>
+</table>
+<table>
+[%- PROCESS customized_report %]
+[%- PROCESS cash_or_accrual %]
+  <tr>
+  <th align=right colspan=4>[% 'Decimalplaces' | $T8 %]</th>
+    <td><input name=decimalplaces size=3 value="2"></td>
+  </tr>
+[%- END %]
+
+[%- IF is_balance_sheet %]
+  <input type=hidden name=nextsub value=generate_balance_sheet>
+  <tr>
+    <th align=right>[% 'as at' | $T8 %]</th>
+    <td> [% L.date_tag('asofdate', asofdate) %]</td>
+    <th align=right nowrap>[% 'Compare to' | $T8 %]</th>
+    <td>[% L.date_tag('compareasofdate', compareasofdate) %]</td>
+  </tr>
+  <tr>
+    <th align=right>[% 'Decimalplaces' | $T8 %]</th>
+    <td><input name=decimalplaces size=3 value="2"></td>
+  </tr>
+</table>
+<table>
+[%- PROCESS cash_or_accrual %]
+  <tr>
+    <th align=right nowrap>[% 'Include in Report' | $T8 %]</th>
+    <td><input name=l_heading class=checkbox type=checkbox value=Y>&nbsp;[% 'Heading' | $T8 %]
+    <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;[% 'Subtotal' | $T8 %]
+    <input name=l_accno class=checkbox type=checkbox value=Y>&nbsp;[% 'Account Number' | $T8 %]</td>
+  </tr>
+[%- END %]
+
+[%- IF is_trial_balance %]
+[%- PROCESS projectnumber %]
+  <input type=hidden name=nextsub value=generate_trial_balance>
+</table>
+<table>
+[%- PROCESS customized_report %]
+[%- PROCESS cash_or_accrual %]
+ <tr>
+   <th align=right colspan=4>[% 'All Accounts' | $T8 %]</th>
+   <td><input name=all_accounts type=checkbox value=1></td>
+ </tr>
+ <tr>
+   <th align=right colspan=4>[% 'Decimalplaces' | $T8 %]</th>
+   <td><input name=decimalplaces size=3 value="2"></td>
+ </tr>
+[%- END %]
+
+[%- IF is_aging %]
+  <tr>
+    <th align=right>[% label %]</th>
+    <td>[% vc %]</td>
+  </tr>
+  <tr>
+    <td>[% 'Review of Aging list' | $T8 %]</td>
+    <td><select name="review_of_aging_list">
+        <option></option>
+        <option>0-30</option>
+        <option>30-60</option>
+        <option>60-90</option>
+        <option>90-120</option>
+        <option>&gt; 120</option>
+        </select>
+    </td>
+  </tr>
+  <tr>
+    <td align=left colspan=4>
+      [% 'From' | $T8 %] [% L.date_tag('fromdate', fromdate) %]
+      [% 'Bis' | $T8 %] [% L.date_tag('todate') %]
+    </td>
+  </tr>
+  <input type=hidden name=type value=statement>
+  <input type=hidden name=format value=html>
+  <input type=hidden name=media value=screen>
+
+  <input type=hidden name=nextsub value='[% nextsub %]'>
+  <input type=hidden name=action value='[% nextsub %]'>
+[%- END %]
+
+[%- IF is_payments %]
+  <input type=hidden name=nextsub value=list_payments>
+  <tr>
+    <th align=right nowrap>[% 'Account' | $T8 %]</th>
+    <td colspan=3><select name=account>[% selection %]</select>
+      <input type=hidden name=paymentaccounts value="[% paymentaccounts %]">
+    </td>
+  </tr>
+  <tr>
+    <th align=right>[% 'Reference' | $T8 %]</th>
+    <td colspan=3><input name=reference></td>
+  </tr>
+  <tr>
+    <th align=right nowrap>[% 'Source' | $T8 %]</th>
+    <td colspan=3><input name=source></td>
+  </tr>
+  <tr>
+    <th align=right nowrap>[% 'Memo' | $T8 %]</th>
+    <td colspan=3><input name=memo size=30></td>
+  </tr>
+  <tr>
+    <th align=right>[% 'From' | $T8 %]</th>
+    <td>[% L.date_tag('fromdate', fromdate) %]</td>
+    <th align=right>[% 'Bis' | $T8 %]</th>
+    <td>[% L.date_tag('todate') %]</td>
+  </tr>
+  <tr>
+    <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
+    <th align=left colspan=3>[% 'Include Exchangerate Difference' | $T8 %]</td>
+  </tr>
+
+  <input type=hidden name=db value='[% db %]'>
+  <input type=hidden name=sort value=transdate>
+[%- END %]
+
+[%- IF 0 # is_taxreport %]
+  <input type=hidden name=nextsub value=generate_tax_report>
+  <tr>
+    <th align=right>[% 'From' | $T8 %]</th>
+    <td>[% L.date_tag('fromdate', fromdate) %]</td>
+    <th align=right>[% 'Bis' | $T8 %]</th>
+    <td>[% L.date_tag('todate', todate) %]</td>
+  </tr>
+  <tr>
+    <th align=right>[% 'Report for' | $T8 %]</th>
+    <td colspan=3>
+[% FOREACH row IN taxaccounts %]
+      <input name=accno class=radio type=radio value='[% row.accno %]' [% loop.first ? 'checked' : '' %]>&nbsp;[% row.description %]
+      <input name="[% row.accno %]_description" type=hidden value="[% row.description %]">
+      <input name="[% row.accno %]_rate" type=hidden value="[% row.rate %]">
+[%- END %]
+      <input type=hidden name=db value='[% db %]'>
+      <input type=hidden name=sort value=transdate>
+    </td>
+  </tr>
+[%- PROCESS cash_or_accrual %]
+</table>
+<table>
+  <tr>
+    <th align=right>[% 'Include in Report' | $T8 %]</th>
+    <td>
+      <table>
+        <tr>
+          <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
+          <td>[% 'ID' | $T8 %]</td>
+          <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Invoice' | $T8 %]</td>
+          <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Date' | $T8 %]</td>
+        </tr>
+        <tr>
+          <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
+          <td>
+            [% LxERP.t8('Customer') IF db == 'ar' %]
+            [% LxERP.t8('Vendor')   IF db == 'ap' %]
+         </td>
+          <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Amount' | $T8 %]</td>
+          <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Tax' | $T8 %]</td>
+          <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
+          <td>[% 'Total' | $T8 %]</td>
+        </tr>
+        <tr>
+          <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
+          <td>[% 'Subtotal' | $T8 %]</td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+[%- END %]
+
+[%- IF 0 # is_nontaxable %]
+  <input type=hidden name=nextsub value=generate_tax_report>
+
+  <input type=hidden name=db value=[% db %]>
+  <input type=hidden name=sort value=transdate>
+  <input type=hidden name=report value='[% report %]'>
+
+  <tr>
+    <th align=right>[% 'From' | $T8 %]</th>
+    <td>[% L.date_tag('fromdate', fromdate) %]</td>
+    <th align=right>[% 'Bis' | $T8 %]</th>
+    <td>[% L.date_tag('todate', todate) %]</td>
+  </tr>
+[%- PROCESS cash_or_accrual %]
+  <tr>
+    <th align=right>[% 'Include in Report' | $T8 %]</th>
+    <td colspan=3>
+      <table>
+        <tr>
+          <td><input name="l_id" class=checkbox type=checkbox value=Y></td>
+          <td>[% 'ID' | $T8 %]</td>
+          <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Invoice' | $T8 %]</td>
+          <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Date' | $T8 %]</td>
+        </tr>
+        <tr>
+          <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
+          <td>
+            [% LxERP.t8('Customer') IF db == 'ar' %]
+            [% LxERP.t8('Vendor')   IF db == 'ap' %]
+       </td>
+          <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
+          <td>[% 'Amount' | $T8 %]</td>
+          <td><input name="l_amount" class=checkbox type=checkbox value=Y></td>
+          <td>[% 'Total' | $T8 %]</td>
+        </tr>
+        <tr>
+          <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
+          <td>[% 'Subtotal' | $T8 %]</td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+[%- END %]
+</table>
+
+<hr size=3 noshade>
+<br>
+<input type=submit class=submit name=action value="[% 'Continue' | $T8 %]">
+
+</form>
+
+</body>
+</html>
diff --git a/templates/webpages/rp/tax_report.html b/templates/webpages/rp/tax_report.html
new file mode 100644 (file)
index 0000000..4ff5b50
--- /dev/null
@@ -0,0 +1,62 @@
+[%- USE L %]
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE T8 %]
+
+[% BLOCK sub_total %]
+  <tr class='[% class %]'>
+  [% FOREACH col IN column_index %]
+    <td class='[% class %] numeric'>
+      [%- SWITCH col %]
+      [%- CASE [ 'netamount', 'tax', 'amount' ] %][% LxERP.format_amount(row.$col, 2) %]
+      [%- CASE %]&nbsp;[% END %]
+    </td>
+  [% END %]
+  </tr>
+[% END %]
+
+<body>
+
+<h1>[% title %] [% SET tax_report__accno_title = accno _ '_description' %][% GET $tax_report__accno_title %]</h1>
+
+<p>
+ [% FOREACH option IN options %][% option %][% '<br>' UNLESS loop.last %][% END %]
+</p>
+
+<table width=100%>
+  <tr class=listheading>
+    [%- FOREACH col IN column_index %]
+    <th>
+     [%- IF column_sorted.$col %]<a href="[% sort_base %]&sort=[% col %]">[% END %]
+     [%- column_header.$col %]
+     [%- IF column_sorted.$col %]</a>[% END %]
+    </th>
+    [%- END %]
+  </tr>
+
+[%- FOREACH row IN DATA %]
+ [% IF row.subtotal %]
+  [% PROCESS sub_total class='listsubtotal' %]
+ [% ELSIF row.total %]
+  [% PROCESS sub_total class='listtotal' %]
+ [% ELSE %]
+  <tr class='listrow[% loop.count % 2 %]'>
+  [%- FOREACH col IN column_index %]
+    <td[% IF row.$col.numeric %] class="numeric"[% END %]>
+       [%- IF row.$col.link %]<a href="[% row.$col.link %]">[% END %]
+       [%- IF row.$col.numeric %]
+         [%- LxERP.format_amount(row.$col.data, 2) | html %]
+       [%- ELSE %]
+         [%- row.$col.data | html %]
+       [%- END %]
+       [%- IF row.$col.link %]</a>[% END %]
+    </td>
+  [%- END %]
+  </tr>
+ [% END %]
+[%- END %]
+</table>
+<hr size=3 noshade>
+</body>
+</html>
+