# get Accounts from chart
my $query = qq{ SELECT
id,
- accno || ' - ' || description AS _taxaccount
+ accno || ' - ' || description AS taxaccount
FROM chart
WHERE link LIKE '%_tax%'
ORDER BY accno
};
# Ausgabe des Templates
- print($form->parse_html_template('am/edit_tax', $parameters_ref));
+ print($form->parse_html_template2('am/edit_tax', $parameters_ref));
$lxdebug->leave_sub();
}
};
# Ausgabe des Templates
- print($form->parse_html_template('am/edit_tax', $parameters_ref));
+ print($form->parse_html_template2('am/edit_tax', $parameters_ref));
$lxdebug->leave_sub();
}
$form->header();
# Ausgabe des Templates
- print($form->parse_html_template('am/list_tax', $parameters_ref));
+ print($form->parse_html_template2('am/list_tax', $parameters_ref));
$lxdebug->leave_sub();
}
sub _get_taxaccount_selection{
- $lxdebug->enter_sub();
+ $lxdebug->enter_sub();
AM->get_tax_accounts(\%myconfig, \%$form);
- my $i = 0;
- foreach my $taxaccount (@{ $form->{ACCOUNTS} } ) {
-
- # Fill in the Taxaxxounts as select options
- if ($form->{chart_id} == $taxaccount->{id}) {
- $form->{ACCOUNTS}[$i]{select_taxaccount} .=
- qq|<option value="$taxaccount->{id}" selected="selected">
- $form->{ACCOUNTS}[$i]{_taxaccount}\n|;
- }
- else {
- $form->{ACCOUNTS}[$i]{select_taxaccount} .=
- qq|<option value="$taxaccount->{id}">
- $form->{ACCOUNTS}[$i]{_taxaccount}<!-- hallo-->\n|;
- }
- $i++;
- }
- return;
+ map { $_->{selected} = $form->{chart_id} == $_->{id} } @{ $form->{ACCOUNTS} };
$lxdebug->leave_sub();
}
-<body>
-<form method="post" action="<TMPL_VAR script>">
- <input type="hidden" name="id" value="<TMPL_VAR id>">
+[% USE HTML %]<body>
+ <form method="post" action="am.pl">
+ <input type="hidden" name="id" value="[% HTML.escape(id) %]">
<input type="hidden" name="type" value="tax">
-<table width="100%">
- <tr>
- <th class="listtop" colspan="2">Steuer <TMPL_VAR title></th>
- </tr>
-</table>
-<table width="100%">
- <tr>
+ <div class="listtop">Steuer [% title %]</div>
+
+ <table width="100%">
+ <tr>
<td>Steuerschlüssel</td>
- <td><input name="taxkey" size="2" value="<TMPL_VAR taxkey>"></td>
- </tr>
+ <td><input name="taxkey" size="2" value="[% HTML.escape(taxkey) %]"></td>
+ </tr>
- <tr>
+ <tr>
<td>Steuername</td>
- <td><input name="taxdescription" size="60" value="<TMPL_VAR taxdescription>"></td>
- </tr>
+ <td><input name="taxdescription" size="60" value="[% HTML.escape(taxdescription) %]"></td>
+ </tr>
- <tr>
+ <tr>
<td>Prozentsatz</td>
- <td><input name="rate" size="10" value="<TMPL_VAR rate>"> %</td>
- </tr>
+ <td><input name="rate" size="10" value="[% HTML.escape(rate) %]"> %</td>
+ </tr>
- <tr>
+ <tr>
<td>Automatikkonto</td>
- <td><select name="chart_id">
- <TMPL_LOOP ACCOUNTS>
- <TMPL_VAR select_taxaccount>
- </TMPL_LOOP>
- </select>
-
- </td>
- </tr>
-
+ <td><select name="chart_id">[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
+ </tr>
-</table>
+ </table>
-<TMPL_UNLESS orphaned>
+ [% IF id %]
+ [% UNLESS orphaned %]
<br />
Konten, die mit dieser Steuer verknüpft sind:
- <TMPL_LOOP TAXINUSE>
- <a href="am.pl?action=edit_account&id=<TMPL_VAR id>&login=<TMPL_VAR
- login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"><TMPL_VAR accno></a>
- </TMPL_LOOP>
+ [% FOREACH row = TAXINUSE %]
+ <a href="am.pl?action=edit_account&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.accno) %]</a>
+ [% END %]
<br />
-</TMPL_UNLESS>
-
-<input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
-<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
-<input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+ [% END %]
+ [% END %]
-<br />
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
-<input type="submit" class="submit" name="action" value="Speichern">
+ <input type="submit" class="submit" name="action" value="Speichern">
-<TMPL_IF orphaned>
- <input type="submit" class="submit" name="action"
- value="Löschen">
-</TMPL_IF>
+ [% IF orphaned %][% IF id %]
+ <input type="submit" class="submit" name="action" value="Löschen">
+ [% END %][% END %]
</form>
</body>
-<body>
-<form method="post" action="<TMPL_VAR script>">
- <input type="hidden" name="id" value="<TMPL_VAR id>">
+[% USE HTML %]<body>
+ <form method="post" action="am.pl">
+ <input type="hidden" name="id" value="[% HTML.escape(id) %]">
<input type="hidden" name="type" value="tax">
-<table width="100%">
- <tr>
- <th class="listtop" colspan="2"><translate>Tax-O-Matic</translate> <TMPL_VAR title></th>
- </tr>
-</table>
-<table width="100%">
- <tr>
+ <div class="listtop"><translate>Tax-O-Matic</translate> [% title %]</div>
+
+ <table width="100%">
+ <tr>
<td><translate>tax_taxkey</translate></td>
- <td><input name="taxkey" size="2" value="<TMPL_VAR taxkey>"></td>
- </tr>
+ <td><input name="taxkey" size="2" value="[% HTML.escape(taxkey) %]"></td>
+ </tr>
- <tr>
+ <tr>
<td><translate>tax_taxdescription</translate></td>
- <td><input name="taxdescription" size="60" value="<TMPL_VAR taxdescription>"></td>
- </tr>
+ <td><input name="taxdescription" size="60" value="[% HTML.escape(taxdescription) %]"></td>
+ </tr>
- <tr>
+ <tr>
<td><translate>tax_percent</translate></td>
- <td><input name="rate" size="10" value="<TMPL_VAR rate>"> %</td>
- </tr>
+ <td><input name="rate" size="10" value="[% HTML.escape(rate) %]"> %</td>
+ </tr>
- <tr>
+ <tr>
<td><translate>tax_chartaccno</translate></td>
- <td><select name="chart_id">
- <TMPL_LOOP ACCOUNTS>
- <TMPL_VAR select_taxaccount>
- </TMPL_LOOP>
- </select>
-
- </td>
- </tr>
-
+ <td><select name="chart_id">[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
+ </tr>
-</table>
+ </table>
-<TMPL_UNLESS orphaned>
+ [% IF id %]
+ [% UNLESS orphaned %]
<br />
<translate>Chartaccounts connected to this Tax:</translate>
- <TMPL_LOOP TAXINUSE>
- <a href="am.pl?action=edit_account&id=<TMPL_VAR id>&login=<TMPL_VAR
- login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"><TMPL_VAR accno></a>
- </TMPL_LOOP>
+ [% FOREACH row = TAXINUSE %]
+ <a href="am.pl?action=edit_account&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.accno) %]</a>
+ [% END %]
<br />
-</TMPL_UNLESS>
-
-<input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
-<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
-<input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+ [% END %]
+ [% END %]
-<br />
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
-<input type="submit" class="submit" name="action" value="<translate>Save</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Save</translate>">
-<TMPL_IF orphaned>
- <input type="submit" class="submit" name="action"
- value="<translate>Delete</translate>">
-</TMPL_IF>
+ [% IF orphaned %][% IF id %]
+ <input type="submit" class="submit" name="action" value="<translate>Delete</translate>">
+ [% END %][% END %]
</form>
</body>
-<body>
+[% USE HTML %]<body>
-<table width="100%">
+ <div class="listtop">[% title %]</div>
+
+ <table>
<tr>
- <th class="listtop"><TMPL_VAR title ESCAPE=HTML></th>
+ <th class="listheading">Steuerschlüssel</th>
+ <th class="listheading">Steuername</th>
+ <th class="listheading">Prozent</th>
+ <th class="listheading">Automatikkonto</th>
+ <th class="listheading">Beschreibung</th>
</tr>
-</table>
-<table>
- <tr>
- <th class="listheading">Steuerschlüssel</th>
- <th class="listheading">Steuername</th>
- <th class="listheading">Prozent</th>
- <th class="listheading">Automatikkonto</th>
- <th class="listheading">Beschreibung</th>
- </tr>
-
-<TMPL_LOOP TAX>
-
-
-<TMPL_IF __odd__>
- <tr class="listrow1"
-<TMPL_ELSE>
- <tr class="listrow0"
-</TMPL_IF>
- onMouseOver="this.style.cursor='pointer';"
- onclick="window.location.href='am.pl?action=edit_tax&id=<TMPL_VAR id
- ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password
- ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>';">
-
- <td align="right"><TMPL_VAR taxkey ESCAPE=HTML></td>
- <td><TMPL_VAR taxdescription ESCAPE=HTML></td>
- <td align="right"><TMPL_VAR rate ESCAPE=HTML> %</td>
- <td align="right"><TMPL_VAR taxnumber ESCAPE=HTML></td>
- <td><TMPL_VAR account_description ESCAPE=HTML></td>
- </tr>
-
-</TMPL_LOOP>
-</table>
-<br />
-<br />
-<form method="post" action="<TMPL_VAR script>">
-
- <input name="callback" type="hidden" value="<TMPL_VAR callback>">
- <input type="hidden" name="type" value="tax">
- <input type="hidden" name="login" value="<TMPL_VAR login>">
- <input type="hidden" name="password" value="<TMPL_VAR password>">
- <input class="submit" type="submit" name="action"
- value="Erfassen">
-</form>
+ [% SET row_odd = '1' %][% FOREACH row = TAX %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td align="right">[% HTML.escape(row.taxkey) %]</td>
+ <td><a href="am.pl?action=edit_tax&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.taxdescription) %]</a></td>
+ <td align="right">[% HTML.escape(row.rate) %] %</td>
+ <td align="right">[% HTML.escape(row.taxnumber) %]</td>
+ <td>[% HTML.escape(row.account_description) %]</td>
+ </tr>
+ [% END %]
+ </table>
+
+ <p>
+ <form method="post" action="am.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="type" value="tax">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+ <input class="submit" type="submit" name="action" value="Erfassen">
+ </form>
+ </p>
</body>
</html>
-<body>
+[% USE HTML %]<body>
-<table width="100%">
+ <div class="listtop">[% title %]</div>
+
+ <table>
<tr>
- <th class="listtop"><TMPL_VAR title ESCAPE=HTML></th>
+ <th class="listheading"><translate>tax_taxkey</translate></th>
+ <th class="listheading"><translate>tax_taxdescription</translate></th>
+ <th class="listheading"><translate>tax_rate</translate></th>
+ <th class="listheading"><translate>taxnumber</translate></th>
+ <th class="listheading"><translate>account_description</translate></th>
</tr>
-</table>
-<table>
- <tr>
- <th class="listheading"><translate>tax_taxkey</translate></th>
- <th class="listheading"><translate>tax_taxdescription</translate></th>
- <th class="listheading"><translate>tax_rate</translate></th>
- <th class="listheading"><translate>taxnumber</translate></th>
- <th class="listheading"><translate>account_description</translate></th>
- </tr>
-
-<TMPL_LOOP TAX>
-
-
-<TMPL_IF __odd__>
- <tr class="listrow1"
-<TMPL_ELSE>
- <tr class="listrow0"
-</TMPL_IF>
- onMouseOver="this.style.cursor='pointer';"
- onclick="window.location.href='am.pl?action=edit_tax&id=<TMPL_VAR id
- ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password
- ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>';">
-
- <td align="right"><TMPL_VAR taxkey ESCAPE=HTML></td>
- <td><TMPL_VAR taxdescription ESCAPE=HTML></td>
- <td align="right"><TMPL_VAR rate ESCAPE=HTML> %</td>
- <td align="right"><TMPL_VAR taxnumber ESCAPE=HTML></td>
- <td><TMPL_VAR account_description ESCAPE=HTML></td>
- </tr>
-
-</TMPL_LOOP>
-</table>
-<br />
-<br />
-<form method="post" action="<TMPL_VAR script>">
-
- <input name="callback" type="hidden" value="<TMPL_VAR callback>">
- <input type="hidden" name="type" value="tax">
- <input type="hidden" name="login" value="<TMPL_VAR login>">
- <input type="hidden" name="password" value="<TMPL_VAR password>">
- <input class="submit" type="submit" name="action"
- value="<translate>Add</translate>">
-</form>
+ [% SET row_odd = '1' %][% FOREACH row = TAX %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td align="right">[% HTML.escape(row.taxkey) %]</td>
+ <td><a href="am.pl?action=edit_tax&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.taxdescription) %]</a></td>
+ <td align="right">[% HTML.escape(row.rate) %] %</td>
+ <td align="right">[% HTML.escape(row.taxnumber) %]</td>
+ <td>[% HTML.escape(row.account_description) %]</td>
+ </tr>
+ [% END %]
+ </table>
+
+ <p>
+ <form method="post" action="am.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="type" value="tax">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+ <input class="submit" type="submit" name="action" value="<translate>Add</translate>">
+ </form>
+ </p>
</body>
</html>