}
$query =
- qq|SELECT
- dunning_create_invoices_for_fees, dunning_ar_amount_fee,
- dunning_ar_amount_interest, dunning_ar
+ qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar
FROM defaults|;
- ($form->{create_invoices_for_fees}, $form->{AR_amount_fee},
- $form->{AR_amount_interest}, $form->{AR} ) = selectrow_query($form, $dbh, $query);
+ ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query);
$dbh->disconnect();
$form->{"email_subject_$i"}, $form->{"email_body_$i"},
$form->{"template_$i"}, $form->{"fee_$i"}, $form->{"interest_rate_$i"},
$form->{"active_$i"} ? 't' : 'f', $form->{"auto_$i"} ? 't' : 'f', $form->{"email_$i"} ? 't' : 'f',
- $form->{"email_attachment_$i"} ? 't' : 'f', conv_i($form->{"payment_terms_$i"}), conv_i($form->{"terms_$i"}));
+ $form->{"email_attachment_$i"} ? 't' : 'f', conv_i($form->{"payment_terms_$i"}), conv_i($form->{"terms_$i"}),
+ $form->{"create_invoices_for_fees_$i"} ? 't' : 'f');
if ($form->{"id_$i"}) {
$query =
qq|UPDATE dunning_config SET
email_subject = ?, email_body = ?,
template = ?, fee = ?, interest_rate = ?,
active = ?, auto = ?, email = ?,
- email_attachment = ?, payment_terms = ?, terms = ?
+ email_attachment = ?, payment_terms = ?, terms = ?,
+ create_invoices_for_fees = ?
WHERE id = ?|;
push(@values, conv_i($form->{"id_$i"}));
} else {
qq|INSERT INTO dunning_config
(dunning_level, dunning_description, email_subject, email_body,
template, fee, interest_rate, active, auto, email,
- email_attachment, payment_terms, terms)
+ email_attachment, payment_terms, terms, create_invoices_for_fees)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
}
do_query($form, $dbh, $query, @values);
}
}
- $query = qq|UPDATE defaults SET dunning_create_invoices_for_fees = ?|;
- @values = ($form->{create_invoices_for_fees} ? 't' : 'f');
-
- if ($form->{create_invoices_for_fees}) {
- $query .= qq|, dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|;
- push @values, conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR});
- }
-
+ $query = qq|UPDATE defaults SET dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|;
+ @values = (conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR}));
do_query($form, $dbh, $query, @values);
$dbh->commit();
my ($query, @values, $sth, $ref);
- $query =
- qq|SELECT
- dunning_create_invoices_for_fees, dunning_ar_amount_fee,
- dunning_ar_amount_interest, dunning_ar
- FROM defaults|;
- ($form->{create_invoices_for_fees}, $form->{AR_amount_fee},
- $form->{AR_amount_interest}, $form->{AR} ) = selectrow_query($form, $dbh, $query);
+ $query = qq|SELECT dcfg.create_invoices_for_fees
+ FROM dunning d
+ LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id)
+ WHERE d.dunning_id = ?|;
+ my ($create_invoices_for_fees) = selectrow_query($form, $dbh, $query, $dunning_id);
- if (!$form->{create_invoices_for_fees}) {
+ if (!$create_invoices_for_fees) {
$main::lxdebug->leave_sub();
return;
}
+ $query = qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar FROM defaults|;
+ ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query);
+
$query =
qq|SELECT
fee,
$self->send_email($myconfig, $form, $dunning_id, $dbh);
}
- $dbh->commit();
+# $dbh->commit();
$dbh->disconnect();
$main::lxdebug->leave_sub();
Variablen in Mahnungen und Rechnungen über Mahngebühren</a>
<ol>
+ <li><a href="dokumentenvorlagen-und-variablen.html#dunning_vorlagennamen">
+ Namen der Vorlagen</a></li>
+
<li><a href="dokumentenvorlagen-und-variablen.html#dunning_allgemein">
Allgemeine Variablen in Mahnungen</a></li>
<h2><a name="dunning">Variablen in Mahnungen und Rechnungen über Mahngebühren</a></h2>
+ <h3><a name="dunning_vorlagennamen">Namen der Vorlagen</a></h3>
+
+ <p>Die Namen der Vorlagen werden im System-Menü vom Benutzer
+ eingegeben. Wird für ein Mahnlevel die Option zur automatischen
+ Erstellung einer Rechnung über die Mahngebühren und Zinsen
+ aktiviert, so wird der Name der Vorlage für diese Rechnung aus
+ dem Vorlagenname für diese Mahnstufe mit dem
+ Zusatz <code>_invoice</code> gebildet. Weiterhin werden die
+ Kürzel für die ausgewählte Sprache und den
+ ausgewählten Drucker angehängt.</p>
+
<h3><a name="dunning_allgemein">Allgemeine Variablen in Mahnungen:</a></h3>
<p>Die Variablen des Verkäufers stehen wie gewohnt
'Aug' => 'Aug',
'August' => 'August',
'Auto Send?' => 'Auto. Versand?',
- 'Automatically create customer invoices for fees and interests' => 'Automatisches Erstellen von Debitorenrechnungen über Mahngebühren und Zinsen',
'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung für Gebühren und Zinsen zu Mahnung %s',
'BOM' => 'Stückliste',
'BWA' => 'BWA',
'Create Buchungsgruppen' => 'Buchungsgruppe erfassen',
'Create Chart of Accounts' => 'Kontenplan anlegen',
'Create Dataset' => 'Datenbank anlegen',
+ 'Create invoice?' => 'Rechnung erstellen?',
'Create new' => 'Neu erfassen',
'Credit' => 'Haben',
'Credit Account' => 'Habenkonto',
'II' => 'II',
'III' => 'III',
'IV' => 'IV',
+ 'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => 'Wenn das automatische Erstellen einer Rechnung über Mahngebühren und Zinsen für ein Mahnlevel aktiviert ist, so werden die folgenden Konten für die Rechnung benutzt.',
'If you see this message, you most likely just setup your LX-Office and haven\'t added any entry types. If this is the case, the option is accessible for administrators in the System menu.' => 'Wenn Sie diese Meldung sehen haben Sie wahrscheinlich ein frisches LX-Office Setup und noch keine Buchungsgruppen eingerichtet. Ein Administrator kann dies im Systemmenü erledigen.',
'If you want to delete such a dataset you have to edit the user(s) that are using the dataset in question and have them use another dataset.' => 'Wenn Sie eine solche Datenbank löschen wollen, so müssen Sie zuerst die Benutzer bearbeiten, die die fragliche Datenbank benutzen, und sie so ändern, dass sie eine andere Datenbank benutzen.',
'Image' => 'Grafik',
--- /dev/null
+-- @tag: dunning_invoices_per_dunning_level
+-- @description: Umstellung der Konfiguration für das automatische Erzeugen von Rechnungen über Mahngebühren von "global" auf "pro Mahnlevel"
+-- @depends: dunning_invoices_for_fees
+ALTER TABLE dunning_config ADD COLUMN create_invoices_for_fees boolean;
+ALTER TABLE dunning_config ALTER COLUMN create_invoices_for_fees SET DEFAULT TRUE;
+UPDATE dunning_config SET create_invoices_for_fees =
+ (SELECT dunning_create_invoices_for_fees FROM defaults LIMIT 1);
+ALTER TABLE defaults DROP COLUMN dunning_create_invoices_for_fees;
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/dunning.js"></script>
- <script type="text/javascript">
- <!--
- function enable_invoice_controls(enable) {
- document.Form.AR.disabled = !enable;
- document.Form.AR_amount_fee.disabled = !enable;
- document.Form.AR_amount_interest.disabled = !enable;
- }
- -->
- </script>
-
<div class="listtop" width="100%">[% title %]</div>
<form method="post" action="dn.pl" name="Form">
<th class="listheading">Mahnlevel</th>
<th class="listheading">Mahnstufenbeschreibung</th>
<th class="listheading">Aktiviert?</th>
- <th class="listheading">Auto. Versand?</th>
<th class="listheading">eMail-Versand?</th>
+<!-- <th class="listheading">Auto. Versand?</th> -->
+ <th class="listheading">Rechnung erstellen?</th>
<th class="listheading">Fristsetzung</th>
<th class="listheading">Fällikeitsdatum +Tage</th>
<th class="listheading">Gebühr</th>
<input type="hidden" name="email_attachment_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_attachment) %]">
</td>
- <td><input type="checkbox" name="auto_[% DUNNING_it.count %]" value="1" [% IF row.auto %]checked[% END %]></td>
+<!-- <td><input type="checkbox" name="auto_[% DUNNING_it.count %]" value="1" [% IF row.auto %]checked[% END %]></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% DUNNING_it.count %]" value="1" [% IF row.create_invoices_for_fees %]checked[% END %]></td>
<td><input name="payment_terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.payment_terms) %]"></td>
<td><input name="terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.terms) %]"></td>
<td><input name="fee_[% DUNNING_it.count %]" size="5" value="[% HTML.escape(row.fee) %]"></td>
<input type="hidden" name="email_attachment_[% rowcount %]">
</td>
- <td><input type="checkbox" name="auto_[% rowcount %]" value="1" checked></td>
+<!-- <td><input type="checkbox" name="auto_[% rowcount %]" value="1" checked></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% rowcount %]" value="1" checked></td>
<td><input name="payment_terms_[% rowcount %]" size="3"></td>
<td><input name="terms_[% rowcount %]" size="3"></td>
<td><input name="fee_[% rowcount %]" size="5"></td>
<hr size="3" noshade>
- <p>
- <input type="checkbox" name="create_invoices_for_fees" id="create_invoices_for_fees"
- [% IF create_invoices_for_fees %]checked[% END %]
- value="1" onclick="enable_invoice_controls(this.checked);">
- <label for="create_invoices_for_fees">Automatisches Erstellen von Debitorenrechnungen über Mahngebühren und Zinsen</label>
- </p>
+ <p>Wenn das automatische Erstellen einer Rechnung über Mahngebühren und Zinsen für ein Mahnlevel aktiviert ist, so werden die folgenden Konten für die Rechnung benutzt.</p>
<table>
<tr>
<th align="right">Konto für Gebühren</th>
<td>
- <select name="AR_amount_fee" [% UNLESS create_invoices_for_fees %]disabled[% END %]>
+ <select name="AR_amount_fee">
[% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_fee_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
[% END %]
</select>
<tr>
<th align="right">Konto für Zinsen</th>
<td>
- <select name="AR_amount_interest" [% UNLESS create_invoices_for_fees %]disabled[% END %]>
+ <select name="AR_amount_interest">
[% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_interest_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
[% END %]
</select>
<tr>
<th align="right">Buchen auf</th>
<td>
- <select name="AR" [% UNLESS create_invoices_for_fees %]disabled[% END %]>
+ <select name="AR">
[% FOREACH row = SELECT_AR %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
[% END %]
</select>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/dunning.js"></script>
- <script type="text/javascript">
- <!--
- function enable_invoice_controls(enable) {
- document.Form.AR.disabled = !enable;
- document.Form.AR_amount_fee.disabled = !enable;
- document.Form.AR_amount_interest.disabled = !enable;
- }
- -->
- </script>
-
<div class="listtop" width="100%">[% title %]</div>
<form method="post" action="dn.pl" name="Form">
<th class="listheading"><translate>Dunning Level</translate></th>
<th class="listheading"><translate>Dunning Description</translate></th>
<th class="listheading"><translate>Active?</translate></th>
- <th class="listheading"><translate>Auto Send?</translate></th>
<th class="listheading"><translate>eMail Send?</translate></th>
+<!-- <th class="listheading"><translate>Auto Send?</translate></th> -->
+ <th class="listheading"><translate>Create invoice?</translate></th>
<th class="listheading"><translate>Fristsetzung</translate></th>
<th class="listheading"><translate>Duedate +Days</translate></th>
<th class="listheading"><translate>Fee</translate></th>
<input type="hidden" name="email_attachment_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_attachment) %]">
</td>
- <td><input type="checkbox" name="auto_[% DUNNING_it.count %]" value="1" [% IF row.auto %]checked[% END %]></td>
+<!-- <td><input type="checkbox" name="auto_[% DUNNING_it.count %]" value="1" [% IF row.auto %]checked[% END %]></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% DUNNING_it.count %]" value="1" [% IF row.create_invoices_for_fees %]checked[% END %]></td>
<td><input name="payment_terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.payment_terms) %]"></td>
<td><input name="terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.terms) %]"></td>
<td><input name="fee_[% DUNNING_it.count %]" size="5" value="[% HTML.escape(row.fee) %]"></td>
<input type="hidden" name="email_attachment_[% rowcount %]">
</td>
- <td><input type="checkbox" name="auto_[% rowcount %]" value="1" checked></td>
+<!-- <td><input type="checkbox" name="auto_[% rowcount %]" value="1" checked></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% rowcount %]" value="1" checked></td>
<td><input name="payment_terms_[% rowcount %]" size="3"></td>
<td><input name="terms_[% rowcount %]" size="3"></td>
<td><input name="fee_[% rowcount %]" size="5"></td>
<hr size="3" noshade>
- <p>
- <input type="checkbox" name="create_invoices_for_fees" id="create_invoices_for_fees"
- [% IF create_invoices_for_fees %]checked[% END %]
- value="1" onclick="enable_invoice_controls(this.checked);">
- <label for="create_invoices_for_fees"><translate>Automatically create customer invoices for fees and interests</translate></label>
- </p>
+ <p><translate>If the automatic creation of invoices for fees and
+ interest is switched on for a dunning level then the following
+ accounts will be used for the invoice.</translate></p>
<table>
<tr>
<th align="right"><translate>Account for fees</translate></th>
<td>
- <select name="AR_amount_fee" [% UNLESS create_invoices_for_fees %]disabled[% END %]>
+ <select name="AR_amount_fee">
[% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_fee_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
[% END %]
</select>
<tr>
<th align="right"><translate>Account for interest</translate></th>
<td>
- <select name="AR_amount_interest" [% UNLESS create_invoices_for_fees %]disabled[% END %]>
+ <select name="AR_amount_interest">
[% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_interest_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
[% END %]
</select>
<tr>
<th align="right"><translate>Record in</translate></th>
<td>
- <select name="AR" [% UNLESS create_invoices_for_fees %]disabled[% END %]>
+ <select name="AR">
[% FOREACH row = SELECT_AR %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
[% END %]
</select>