Beides sollte jedoch moeglich sein fuer Konten wie 'steuerfrei'.
t.taxkey,
t.taxdescription,
round(t.rate * 100, 2) AS rate,
- c.accno AS taxnumber,
- c.description AS account_description
+ (SELECT accno FROM chart WHERE id = chart_id) AS taxnumber,
+ (SELECT description FROM chart WHERE id = chart_id) AS account_description
FROM tax t
- JOIN chart c on (chart_id = c.id)
ORDER BY taxkey|;
$sth = $dbh->prepare($query);
# see if it is used by a taxkey
$query = qq|SELECT count(*) FROM taxkeys
- WHERE tax_id = ?|;
+ WHERE tax_id = ? AND chart_id >0|;
($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
if (!$form->{orphaned} ) {
$query = qq|SELECT DISTINCT c.id, c.accno
FROM taxkeys tk
- LEFT JOIN tax t ON (t.id = tk.tax_id)
- LEFT JOIN chart c ON (c.id = tk.chart_id)
+ JOIN tax t ON (t.id = tk.tax_id)
+ JOIN chart c ON (c.id = tk.chart_id)
WHERE tk.tax_id = ?|;
$sth = $dbh->prepare($query);
$form->{rate} = $form->{rate} / 100;
my @values = ($form->{taxkey}, $form->{taxdescription}, $form->{rate}, $form->{chart_id}, $form->{chart_id} );
- if ($form->{id}) {
+ if ($form->{id} ne "") {
$query = qq|UPDATE tax SET
taxkey = ?,
taxdescription = ?,
sub save_tax {
$lxdebug->enter_sub();
- $form->isblank("chart_id", $locale->text('Tax-O-Matic account missing!'));
$form->isblank("rate", $locale->text('Taxrate missing!'));
$form->isblank("taxdescription", $locale->text('Taxdescription missing!'));
$form->isblank("taxkey", $locale->text('Taxkey missing!'));
$form->{rate} = $form->parse_amount(\%myconfig, $form->{rate});
- if ( $form->{rate} <= 0 || $form->{rate} >= 100 ) {
+ if ( $form->{rate} < 0 || $form->{rate} >= 100 ) {
$form->error($locale->text('Tax Percent is a number between 0 and 100'));
}
- if ( $form->{rate} <= 0.99 && $form->{rate} >= 0 ) {
+ if ( $form->{rate} <= 0.99 && $form->{rate} > 0 ) {
$form->error($locale->text('Tax Percent is a number between 0 and 100'));
}
'Tax paid' => 'Vorsteuer',
'Tax saved!' => 'Steuer gespeichert!',
'Tax-O-Matic' => 'Steuer',
- 'Tax-O-Matic account missing!' => 'Automatikkonto fehlt!',
'Tax-o-matic Account' => 'Automatikbuchung auf Konto',
'Taxaccount_coa' => 'Automatikkonto',
'Taxation' => 'Versteuerungs Verfahren',
'Tax deleted!' => 'Steuer gelöscht!',
'Tax saved!' => 'Steuer gespeichert!',
'Tax-O-Matic' => 'Steuer',
- 'Tax-O-Matic account missing!' => 'Automatikkonto fehlt!',
'Tax-o-matic Account' => 'Automatikbuchung auf Konto',
'Taxdescription missing!' => 'Steuername fehlt!',
'Taxkey missing!' => 'Steuerschlüssel fehlt!',
<tr>
<td>Automatikkonto</td>
- <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>
+ <td><select name="chart_id"><option value="0">Kein</option>[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
</tr>
</table>
- [% IF id %]
[% UNLESS orphaned %]
<br />
Konten, die mit dieser Steuer verknüpft sind:
[% END %]
<br />
[% END %]
- [% END %]
<input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
<input type="hidden" name="login" value="[% HTML.escape(login) %]">
<input type="submit" class="submit" name="action" value="Speichern">
- [% IF orphaned %][% IF id %]
+ [% IF orphaned %]
<input type="submit" class="submit" name="action" value="Löschen">
- [% END %][% END %]
+ [% END %]
</form>
</body>
<tr>
<td><translate>tax_chartaccno</translate></td>
- <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>
+ <td><select name="chart_id"><option value="0"><translate>None</translate></option>[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
</tr>
</table>
- [% IF id %]
[% UNLESS orphaned %]
<br />
<translate>Chartaccounts connected to this Tax:</translate>
[% END %]
<br />
[% END %]
- [% END %]
<input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
<input type="hidden" name="login" value="[% HTML.escape(login) %]">
<input type="submit" class="submit" name="action" value="<translate>Save</translate>">
- [% IF orphaned %][% IF id %]
+ [% IF orphaned %]
<input type="submit" class="submit" name="action" value="<translate>Delete</translate>">
- [% END %][% END %]
+ [% END %]
</form>
</body>