my $form = $main::form;
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
+ my $arap = $params{vc} eq 'customer' ? 'ar' : 'ap';
+ my $vc = $params{vc} eq 'customer' ? 'customer' : 'vendor';
my $query =
qq|
- SELECT ap.id, ap.invnumber, ap.vendor_id, ap.amount AS invoice_amount, ap.invoice,
- v.name AS vendorname, ap.duedate as duedate,
+ SELECT ${arap}.id, ${arap}.invnumber, ${arap}.${vc}_id, ${arap}.amount AS invoice_amount, ${arap}.invoice,
+ vc.name AS vcname, ${arap}.duedate as duedate,
- COALESCE(v.iban, '') <> '' AND COALESCE(v.bic, '') <> '' AS vendor_bank_info_ok,
+ COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '' AS vc_bank_info_ok,
- ap.amount - ap.paid - COALESCE(open_transfers.amount, 0) AS open_amount
+ ${arap}.amount - ${arap}.paid - COALESCE(open_transfers.amount, 0) AS open_amount
- FROM ap
- LEFT JOIN vendor v ON (ap.vendor_id = v.id)
+ FROM ${arap}
+ LEFT JOIN ${vc} vc ON (${arap}.${vc}_id = vc.id)
LEFT JOIN (SELECT sei.ap_id, SUM(sei.amount) AS amount
FROM sepa_export_items sei
LEFT JOIN sepa_export se ON (sei.sepa_export_id = se.id)
WHERE NOT se.closed
+ AND (se.vc = '${vc}')
GROUP BY sei.ap_id)
- AS open_transfers ON (ap.id = open_transfers.ap_id)
+ AS open_transfers ON (${arap}.id = open_transfers.ap_id)
- WHERE ap.amount > (COALESCE(open_transfers.amount, 0) + ap.paid)
+ WHERE ${arap}.amount > (COALESCE(open_transfers.amount, 0) + ${arap}.paid)
- ORDER BY lower(v.name) ASC, lower(ap.invnumber) ASC
+ ORDER BY lower(vc.name) ASC, lower(${arap}.invnumber) ASC
|;
my $results = selectall_hashref_query($form, $dbh, $query);
my $form = $main::form;
my $locale = $main::locale;
+ my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
- $form->{title} = $locale->text('Prepare bank transfer via SEPA XML');
+ $form->{title} = $vc eq 'customer' ? $::locale->text('Prepare bank collection via SEPA XML') : $locale->text('Prepare bank transfer via SEPA XML');
my $bank_accounts = SL::BankAccount->list();
$form->error($locale->text('You have not added bank accounts yet.'));
}
- my $invoices = SL::SEPA->retrieve_open_invoices();
+ my $invoices = SL::SEPA->retrieve_open_invoices(vc => $vc);
if (!scalar @{ $invoices }) {
$form->show_generic_information($locale->text('Either there are no open invoices, or you have already initiated bank transfers ' .
print $form->parse_html_template('sepa/bank_transfer_add',
{ 'INVOICES' => $invoices,
'BANK_ACCOUNTS' => $bank_accounts,
- 'bank_account_label' => $bank_account_label_sub, });
+ 'bank_account_label' => $bank_account_label_sub,
+ 'vc' => $vc,
+ });
$main::lxdebug->leave_sub();
}
'Are you sure you want to update the prices' => 'Sind Sie sicher, dass Sie die Preise aktualisieren wollen?',
'Article Code' => 'Artikelkürzel',
'Article Code missing!' => 'Artikelkürzel fehlt',
+ 'Artikel' => '',
'As a result, the saved onhand values of the present goods can be stored into a warehouse designated by you, or will be reset for a proper warehouse tracking' => 'Als Konsequenz können die gespeicherten Mengen entweder in ein Lager überführt werden, oder für eine frische Lagerverwaltung resettet werden.',
'Assemblies' => 'Erzeugnisse',
'Assembly Description' => 'Erzeugnis-Beschreibung',
'Bank Connections' => 'Bankverbindungen',
'Bank accounts' => 'Bankkonten',
'Bank code' => 'Bankleitzahl',
+ 'Bank collection via SEPA' => 'Bankeinzug via SEPA',
+ 'Bank collections via SEPA' => 'Bankeinzüge via SEPA',
'Bank transfer amount' => 'Überweisungssumme',
'Bank transfer payment list for export #1' => 'Überweisungszahlungsliste für SEPA-Export #1',
'Bank transfer via SEPA' => 'Überweisung via SEPA',
'EAN-Code' => 'EAN-Code',
'EB-Wert' => 'EB-Wert',
'EK' => 'EK',
- 'EK-Preis' => 'Purchase price',
'ELSE' => 'Zusatz',
'ELSTER Export (Taxbird)' => 'ELSTER-Export nach Taxbird',
'ELSTER Export (Winston)' => 'ELSTER Export nach Winston',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
'No action defined.' => 'Keine Aktion definiert.',
'No backup file has been uploaded.' => 'Es wurde keine Sicherungsdatei hochgeladen.',
+ 'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' => 'Für diesen Kunden wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.',
'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' => 'Für diesen Lieferanten wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.',
'No bins have been added to this warehouse yet.' => 'Es wurden zu diesem Lager noch keine Lagerplätze angelegt.',
'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'Please select a vendor from the list below.' => 'Bitte einen Händler aus der Liste auswählen',
'Please select the chart of accounts this installation is using from the list below.' => 'Bitte wählen Sie den Kontenrahmen aus, der bei dieser Installation verwendet wird.',
'Please select the database you want to backup' => 'Bitte wählen Sie die zu sichernde Datenbank gefunden',
+ 'Please select the destination bank account for the collections:' => 'Bitte wählen Sie das Bankkonto als Ziel für die Einzüge aus:',
'Please select the source bank account for the transfers:' => 'Bitte wählen Sie das Bankkonto als Quelle für die Überweisungen aus:',
'Please seletct the dataset you want to delete:' => 'Bitte wählen Sie die zu löschende Datenbank aus:',
'Please specify a description for the warehouse designated for these goods.' => 'Bitte geben Sie den Namen des Ziellagers für die übernommenen Daten ein.',
'Preis' => 'Preis',
'Preisgruppe' => 'Preisgruppe',
'Preisklasse' => 'Preisgruppe',
+ 'Prepare bank collection via SEPA XML' => 'Einzug via SEPA XML vorbereiten',
'Prepare bank transfer via SEPA XML' => 'Überweisung via SEPA XML vorbereiten',
'Prepayment' => 'Vorauszahlung',
'Preview' => 'Druckvorschau',
module=rc.pl
action=reconciliation
+[Cash--Bank collection via SEPA]
+module=sepa.pl
+action=bank_transfer_add
+vc=customer
+
[Cash--Bank transfer via SEPA]
module=sepa.pl
action=bank_transfer_add
+vc=vendor
[Cash--Reports]
module=menu.pl
action=report
report=payments
+[Cash--Reports--Bank collections via SEPA]
+module=sepa.pl
+action=bank_transfer_search
+vc=customer
+
[Cash--Reports--Bank transfers via SEPA]
module=sepa.pl
action=bank_transfer_search
+vc=vendor
[Reports]
[%- USE T8 %]
[% USE HTML %][% USE LxERP %]
+[% IF vc == 'vendor' %]
+ [% SET is_vendor = 1 %]
+ [% SET arap = 'ap' %]
+ [% SET iris = 'ir' %]
+[% ELSE %]
+ [% SET is_vendor = 0 %]
+ [% SET arap = 'ar' %]
+ [% SET iris = 'is' %]
+[%- END %]
<body>
<p><div class="listtop">[% title %]</div></p>
<form action="sepa.pl" method="post">
<p>
- [% 'Please select the source bank account for the transfers:' | $T8 %]
+ [%- IF is_vendor %]
+ [% 'Please select the source bank account for the transfers:' | $T8 %]
+ [%- ELSE %]
+ [% 'Please select the destination bank account for the collections:' | $T8 %]
+ [%- END %]
<br>
[%- INCLUDE generic/multibox.html
name = 'bank_account.id',
<table border="0">
<tr>
<th class="listheading" align="center"><input type="checkbox" id="select_all"></th>
- <th class="listheading">[% 'Vendor' | $T8 %]</th>
+ <th class="listheading">[% IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
<th class="listheading">[% 'Invoice' | $T8 %]</th>
<th class="listheading" align="right">[% 'Amount' | $T8 %]</th>
<th class="listheading" align="right">[% 'Open amount' | $T8 %]</th>
</tr>
[%- FOREACH invoice = INVOICES %]
- <input type="hidden" name="bank_transfers[+].ap_id" value="[% HTML.escape(invoice.id) %]">
+ <input type="hidden" name="bank_transfers[+].[% arap %]_id" value="[% HTML.escape(invoice.id) %]">
<tr class="listrow[% loop.count % 2 %]">
<td align="center">
- [%- IF invoice.vendor_bank_info_ok %]
+ [%- IF invoice.vc_bank_info_ok %]
<input type="checkbox" name="bank_transfers[].selected" value="1">
[%- END %]
</td>
<td>
- [%- IF loop.first || (previous_vendorname != invoice.vendorname) %]
- <a href="ct.pl?action=edit&db=vendor&id=[% HTML.url(invoice.vendor_id) %]&callback=[% HTML.url('sepa.pl?action=bank_transfer_add') %]">
- [%- GET HTML.escape(invoice.vendorname);
- SET previous_vendorname = invoice.vendorname;
- IF !invoice.vendor_bank_info_ok;
+ [%- IF loop.first || (previous_vcname != invoice.vcname) %]
+ <a href="ct.pl?action=edit&db=[% vc %]&id=[% HTML.url(invoice.vc_id) %]&callback=[% HTML.url('sepa.pl?action=bank_transfer_add&vc=' _ vc) %]">
+ [%- GET HTML.escape(invoice.vcname);
+ SET previous_vcname = invoice.vcname;
+ IF !invoice.vc_bank_info_ok;
GET ' <sup>(1)</sup>';
- SET show_vendor_bank_info_footnote = '1';
+ SET show_vc_bank_info_footnote = '1';
END; -%]
</a>
[%- END -%]
</td>
<td>
- <a href="[% IF invoice.invoice %]ir[% ELSE %]ap[% END %].pl?action=edit&id=[% HTML.escape(invoice.id) %]">
+ <a href="[% IF invoice.invoice %][% iris %][% ELSE %][% arap %][% END %].pl?action=edit&id=[% HTML.escape(invoice.id) %]">
[% HTML.escape(invoice.invnumber) %]
</a>
</td>
</table>
</p>
- [%- IF show_vendor_bank_info_footnote %]
+ [%- IF show_vc_bank_info_footnote %]
<p>
- <sup>(1)</sup> [%- 'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' | $T8 %]
+ <sup>(1)</sup>
+ [%- IF is_vendor %]
+ [%- 'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' | $T8 %]
+ [%- ELSE %]
+ [%- 'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' | $T8 %]
+ [%- END %]
</p>
[%- END %]
</p>
<input type="hidden" name="action" value="dispatcher">
+ <input type="hidden" name="vc" value="[%- HTML.escape(vc) %]">
</form>
<script type="text/javascript" src="js/jquery.js"></script>