From 6b1f644cf4630cd22a91892eac6c3a2dfb25659c Mon Sep 17 00:00:00 2001
From: Moritz Bunkus
Date: Thu, 2 Dec 2010 09:11:44 +0100
Subject: [PATCH] =?utf8?q?Unterscheidung=20Bankeinzug/=C3=9Cberweisung=20i?=
=?utf8?q?n=20erster=20Maske=20(Auswahl=20Kunden/Lieferanten)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
---
SL/SEPA.pm | 21 +++++----
bin/mozilla/sepa.pl | 9 ++--
locale/de/all | 7 ++-
menu.ini | 12 +++++
.../webpages/sepa/bank_transfer_add.html | 45 +++++++++++++------
5 files changed, 68 insertions(+), 26 deletions(-)
diff --git a/SL/SEPA.pm b/SL/SEPA.pm
index a5fd4e1ed..53fd2e1aa 100644
--- a/SL/SEPA.pm
+++ b/SL/SEPA.pm
@@ -16,28 +16,31 @@ sub retrieve_open_invoices {
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);
diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl
index bf220e380..81e63e928 100755
--- a/bin/mozilla/sepa.pl
+++ b/bin/mozilla/sepa.pl
@@ -20,8 +20,9 @@ sub bank_transfer_add {
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();
@@ -29,7 +30,7 @@ sub bank_transfer_add {
$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 ' .
@@ -44,7 +45,9 @@ sub bank_transfer_add {
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();
}
diff --git a/locale/de/all b/locale/de/all
index 1affa31e4..1fc92b19b 100644
--- a/locale/de/all
+++ b/locale/de/all
@@ -197,6 +197,7 @@ $self->{texts} = {
'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',
@@ -242,6 +243,8 @@ $self->{texts} = {
'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',
@@ -595,7 +598,6 @@ $self->{texts} = {
'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',
@@ -1061,6 +1063,7 @@ $self->{texts} = {
'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.',
@@ -1219,6 +1222,7 @@ $self->{texts} = {
'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.',
@@ -1236,6 +1240,7 @@ $self->{texts} = {
'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',
diff --git a/menu.ini b/menu.ini
index ffb523f80..dd763b2de 100644
--- a/menu.ini
+++ b/menu.ini
@@ -345,9 +345,15 @@ ACCESS=cash
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
@@ -365,9 +371,15 @@ module=rp.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]
diff --git a/templates/webpages/sepa/bank_transfer_add.html b/templates/webpages/sepa/bank_transfer_add.html
index 1eb34be40..0954d1dbc 100644
--- a/templates/webpages/sepa/bank_transfer_add.html
+++ b/templates/webpages/sepa/bank_transfer_add.html
@@ -1,12 +1,25 @@
[%- 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 %]
[% title %]
--
2.20.1