From 1c4ffcb55a5eedaf554b219dfa68ead5d4889147 Mon Sep 17 00:00:00 2001 From: Johann Maierhofer <126261667+JohannMaierhofer@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:31:45 +0200 Subject: [PATCH] =?UTF-8?q?Kontoauszug=20auch=20in=20Navigationsmen=C3=BC?= =?UTF-8?q?=20(#274)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JVerein/Queries/MitgliedQuery.java | 18 ++++---- .../JVerein/gui/action/KontoauszugAction.java | 4 ++ .../JVerein/gui/control/FilterControl.java | 11 ++++- .../JVerein/gui/control/MitgliedControl.java | 25 ++++++----- .../JVerein/gui/navigation/MyExtension.java | 6 ++- .../JVerein/gui/view/KontoauszugView.java | 44 ++++++++++++++----- src/de/jost_net/JVerein/io/Kontoauszug.java | 17 ++++++- 7 files changed, 87 insertions(+), 38 deletions(-) diff --git a/src/de/jost_net/JVerein/Queries/MitgliedQuery.java b/src/de/jost_net/JVerein/Queries/MitgliedQuery.java index 9a77e871c..653ee87f0 100644 --- a/src/de/jost_net/JVerein/Queries/MitgliedQuery.java +++ b/src/de/jost_net/JVerein/Queries/MitgliedQuery.java @@ -24,7 +24,7 @@ import java.util.Date; import de.jost_net.JVerein.Einstellungen; -import de.jost_net.JVerein.gui.control.MitgliedControl; +import de.jost_net.JVerein.gui.control.FilterControl; import de.jost_net.JVerein.gui.input.MailAuswertungInput; import de.jost_net.JVerein.gui.util.EigenschaftenUtil; import de.jost_net.JVerein.keys.Datentyp; @@ -43,7 +43,7 @@ public class MitgliedQuery { - private MitgliedControl control; + private FilterControl control; private boolean and = false; @@ -53,13 +53,13 @@ public class MitgliedQuery String zusatzfelder = null; - public MitgliedQuery(MitgliedControl control) + public MitgliedQuery(FilterControl control) { this.control = control; } @SuppressWarnings("unchecked") - public ArrayList get(int adresstyp) throws RemoteException + public ArrayList get(int adresstyp, String sort) throws RemoteException { zusatzfeld = control.getAdditionalparamprefix1(); @@ -69,9 +69,8 @@ public ArrayList get(int adresstyp) throws RemoteException ArrayList bedingungen = new ArrayList<>(); sql = "select distinct mitglied.*, ucase(name), ucase(vorname) "; - if (control.isSortierungAktiv()) + if (sort != null && !sort.isEmpty()) { - String sort = (String) control.getSortierung().getValue(); if (sort.equals("Geburtstagsliste")) { sql += ", month(geburtsdatum), day(geburtsdatum) "; @@ -209,11 +208,11 @@ public ArrayList get(int adresstyp) throws RemoteException bedingungen.add(Integer.valueOf(bg.getID())); } } - if (adresstyp != 0) + if (adresstyp > 0) { addCondition("adresstyp = " + adresstyp); } - else + else if (adresstyp == 0) { addCondition("adresstyp != " + 1); } @@ -408,9 +407,8 @@ else if (control.getMitgliedStatus().getValue().equals("Abgemeldet")) // Workaround für einen Bug in IntegerInput } } - if (control.isSortierungAktiv()) + if (sort != null && !sort.isEmpty()) { - String sort = (String) control.getSortierung().getValue(); if (sort.equals("Name, Vorname")) { sql += " ORDER BY ucase(name), ucase(vorname)"; diff --git a/src/de/jost_net/JVerein/gui/action/KontoauszugAction.java b/src/de/jost_net/JVerein/gui/action/KontoauszugAction.java index 653735606..7a10b4016 100644 --- a/src/de/jost_net/JVerein/gui/action/KontoauszugAction.java +++ b/src/de/jost_net/JVerein/gui/action/KontoauszugAction.java @@ -31,5 +31,9 @@ public void handleAction(Object context) { GUI.startView(KontoauszugView.class.getName(), context); } + else + { + GUI.startView(KontoauszugView.class.getName(), null); + } } } diff --git a/src/de/jost_net/JVerein/gui/control/FilterControl.java b/src/de/jost_net/JVerein/gui/control/FilterControl.java index cedd5fbda..327c32074 100644 --- a/src/de/jost_net/JVerein/gui/control/FilterControl.java +++ b/src/de/jost_net/JVerein/gui/control/FilterControl.java @@ -142,7 +142,8 @@ public class FilterControl extends AbstractControl public enum Mitgliedstyp { MITGLIED, NICHTMITGLIED, - NOT_USED + NOT_USED, + ALLE } @@ -162,6 +163,11 @@ public void init(String settingsprefix, String additionalparamprefix1, this.additionalparamprefix2 = additionalparamprefix2; } + public Settings getSettings() + { + return settings; + } + public String getSettingsprefix() { return settingsprefix; @@ -199,6 +205,7 @@ public SelectInput getSuchAdresstyp(Mitgliedstyp typ) throws RemoteException at.addFilter("jvereinid != 1 or jvereinid is null"); break; case NOT_USED: + case ALLE: break; } at.setOrder("order by bezeichnung"); @@ -209,7 +216,7 @@ public SelectInput getSuchAdresstyp(Mitgliedstyp typ) throws RemoteException .createObject(Adresstyp.class, "1"); suchadresstyp = new SelectInput(at != null ? PseudoIterator.asList(at) : null, def); } - else if (typ == Mitgliedstyp.NICHTMITGLIED) + else if (typ == Mitgliedstyp.NICHTMITGLIED || typ == Mitgliedstyp.ALLE) { Adresstyp def = null; try diff --git a/src/de/jost_net/JVerein/gui/control/MitgliedControl.java b/src/de/jost_net/JVerein/gui/control/MitgliedControl.java index 16f3b1e80..712f0f6e4 100644 --- a/src/de/jost_net/JVerein/gui/control/MitgliedControl.java +++ b/src/de/jost_net/JVerein/gui/control/MitgliedControl.java @@ -2070,7 +2070,7 @@ public Button getLehrgangNeu() public TablePart getMitgliedTable(int atyp, Action detailaction) throws RemoteException { - part = new TablePart(new MitgliedQuery(this).get(atyp), + part = new TablePart(new MitgliedQuery(this).get(atyp, null), detailaction); new MitgliedSpaltenauswahl().setColumns(part, atyp); part.setContextMenu(new MitgliedMenu(detailaction)); @@ -2091,7 +2091,7 @@ public TablePart refreshMitgliedTable(int atyp) throws RemoteException } lastrefresh = System.currentTimeMillis(); part.removeAll(); - ArrayList mitglieder = new MitgliedQuery(this).get(atyp); + ArrayList mitglieder = new MitgliedQuery(this).get(atyp, null); for (Mitglied m : mitglieder) { part.addItem(m); @@ -2524,11 +2524,15 @@ private void starteAuswertung() throws RemoteException final IAuswertung ausw = (IAuswertung) getAusgabe().getValue(); saveAusgabeSettings(); saveFilterSettings(); + String sort = null; + if (isSortierungAktiv() && getSortierung().getValue() != null) + { + sort = (String) getSortierung().getValue(); + } ArrayList list = null; - list = new MitgliedQuery(this).get(1); + list = new MitgliedQuery(this).get(1, sort); try { - String sort = (String) sortierung.getValue(); String dateinamensort = ""; if (sort.equals("Name, Vorname")) { @@ -2629,6 +2633,11 @@ private void starteAdressAuswertung() throws RemoteException final IAuswertung ausw = (IAuswertung) getAusgabe().getValue(); saveAusgabeSettings(); saveFilterSettings(); + String sort = null; + if (isSortierungAktiv() && getSortierung().getValue() != null) + { + sort = (String) getSortierung().getValue(); + } ArrayList list = null; Adresstyp atyp = (Adresstyp) getSuchAdresstyp(Mitgliedstyp.NICHTMITGLIED).getValue(); if (atyp == null) @@ -2636,10 +2645,9 @@ private void starteAdressAuswertung() throws RemoteException GUI.getStatusBar().setErrorText("Bitte Mitgliedstyp auswählen"); return; } - list = new MitgliedQuery(this).get(Integer.parseInt(atyp.getID())); + list = new MitgliedQuery(this).get(Integer.parseInt(atyp.getID()), sort); try { - String sort = (String) sortierung.getValue(); String dateinamensort = ""; if (sort.equals("Name, Vorname")) { @@ -2728,11 +2736,6 @@ public boolean isInterrupted() } } - public Settings getSettings() - { - return settings; - } - private void starteStatistik() throws RemoteException { FileDialog fd = new FileDialog(GUI.getShell(), SWT.SAVE); diff --git a/src/de/jost_net/JVerein/gui/navigation/MyExtension.java b/src/de/jost_net/JVerein/gui/navigation/MyExtension.java index 99d54e83d..d7c374c60 100644 --- a/src/de/jost_net/JVerein/gui/navigation/MyExtension.java +++ b/src/de/jost_net/JVerein/gui/navigation/MyExtension.java @@ -61,6 +61,7 @@ import de.jost_net.JVerein.gui.action.KontenrahmenExportAction; import de.jost_net.JVerein.gui.action.KontenrahmenImportAction; import de.jost_net.JVerein.gui.action.KontoListAction; +import de.jost_net.JVerein.gui.action.KontoauszugAction; import de.jost_net.JVerein.gui.action.KursteilnehmerSucheAction; import de.jost_net.JVerein.gui.action.LastschriftListAction; import de.jost_net.JVerein.gui.action.LehrgaengeListeAction; @@ -132,12 +133,13 @@ public void extend(Extendable extendable) mitglieder.addChild(new MyItem(mitglieder, "Sollbuchungen", new SollbuchungListeAction(), "calculator.png")); mitglieder.addChild(new MyItem(mitglieder, "Spendenbescheinigungen", - new SpendenbescheinigungListeAction(), "list.png")); - + new SpendenbescheinigungListeAction(), "list.png")); mitglieder.addChild(new MyItem(mitglieder, "Rechnungen", new MitgliedskontoRechnungAction(), "document-print.png")); mitglieder.addChild(new MyItem(mitglieder, "Mahnungen", new MitgliedskontoMahnungAction(), "document-print.png")); + mitglieder.addChild(new MyItem(mitglieder, "Kontoauszüge", + new KontoauszugAction(), "document-print.png")); mitglieder.addChild(new MyItem(mitglieder, "Spendenbescheinigungen", new SpendenbescheinigungSendAction(), "document-print.png")); diff --git a/src/de/jost_net/JVerein/gui/view/KontoauszugView.java b/src/de/jost_net/JVerein/gui/view/KontoauszugView.java index 3027e8ae9..4b1c47b2c 100644 --- a/src/de/jost_net/JVerein/gui/view/KontoauszugView.java +++ b/src/de/jost_net/JVerein/gui/view/KontoauszugView.java @@ -18,6 +18,7 @@ import de.jost_net.JVerein.gui.action.DokumentationAction; import de.jost_net.JVerein.gui.action.MailVorlageZuweisenAction; +import de.jost_net.JVerein.gui.control.FilterControl.Mitgliedstyp; import de.jost_net.JVerein.gui.control.MitgliedskontoControl; import de.willuhn.jameica.gui.AbstractView; import de.willuhn.jameica.gui.GUI; @@ -39,21 +40,40 @@ public void bind() throws Exception control.init("kontoauszug.", null, null); LabelGroup group = new LabelGroup(getParent(), "Filter"); - ColumnLayout cl = new ColumnLayout(group.getComposite(), 2); - SimpleContainer left = new SimpleContainer(cl.getComposite()); - left.addInput(control.getDifferenz()); - - SimpleContainer right = new SimpleContainer(cl.getComposite()); - right.addInput(control.getDatumvon()); - right.addInput(control.getDatumbis()); - - SimpleContainer cont1 = new SimpleContainer(getParent(), false); - cont1.addHeadline("Info"); - cont1.addInput(control.getInfo()); + if (this.getCurrentObject() == null) + { + ColumnLayout cl = new ColumnLayout(group.getComposite(), 2); + SimpleContainer left = new SimpleContainer(cl.getComposite()); + left.addInput(control.getSuchAdresstyp(Mitgliedstyp.ALLE)); + left.addInput(control.getMitgliedStatus()); + left.addInput(control.getBeitragsgruppeAusw()); + left.addInput(control.getMailauswahl()); + + SimpleContainer right = new SimpleContainer(cl.getComposite()); + right.addInput(control.getDatumvon()); + right.addInput(control.getDatumbis()); + right.addInput(control.getDifferenz()); + right.addInput(control.getStichtag(false)); + } + else + { + ColumnLayout cl = new ColumnLayout(group.getComposite(), 2); + SimpleContainer left = new SimpleContainer(cl.getComposite()); + left.addInput(control.getDifferenz()); + + SimpleContainer right = new SimpleContainer(cl.getComposite()); + right.addInput(control.getDatumvon()); + right.addInput(control.getDatumbis()); + + SimpleContainer cont1 = new SimpleContainer(getParent(), false); + cont1.addHeadline("Info"); + cont1.addInput(control.getInfo()); + } + SimpleContainer cont = new SimpleContainer(getParent(), true); cont.addHeadline("Parameter"); - + cont.addInput(control.getAusgabeart()); cont.addHeadline("Mail"); diff --git a/src/de/jost_net/JVerein/io/Kontoauszug.java b/src/de/jost_net/JVerein/io/Kontoauszug.java index 1294a5f0f..0638418a5 100644 --- a/src/de/jost_net/JVerein/io/Kontoauszug.java +++ b/src/de/jost_net/JVerein/io/Kontoauszug.java @@ -35,12 +35,15 @@ import com.itextpdf.text.Element; import de.jost_net.JVerein.Einstellungen; +import de.jost_net.JVerein.Queries.MitgliedQuery; +import de.jost_net.JVerein.gui.control.FilterControl.Mitgliedstyp; import de.jost_net.JVerein.gui.control.MitgliedskontoControl; import de.jost_net.JVerein.gui.control.MitgliedskontoControl.DIFFERENZ; import de.jost_net.JVerein.gui.control.MitgliedskontoNode; import de.jost_net.JVerein.io.Adressbuch.Adressaufbereitung; import de.jost_net.JVerein.keys.Ausgabeart; import de.jost_net.JVerein.keys.Zahlungsweg; +import de.jost_net.JVerein.rmi.Adresstyp; import de.jost_net.JVerein.rmi.Mitglied; import de.jost_net.JVerein.util.Dateiname; import de.jost_net.JVerein.util.JVDateFormatTTMMJJJJ; @@ -68,7 +71,19 @@ public Kontoauszug(Object object, MitgliedskontoControl control) throws Exceptio this(); ArrayList mitglieder = new ArrayList<>(); - if (object != null && object instanceof Mitglied) + if (object == null && control.isSuchAdresstypActive() && + control.getSuchAdresstyp(Mitgliedstyp.ALLE).getValue() != null) + { + Adresstyp atyp = (Adresstyp) control.getSuchAdresstyp(Mitgliedstyp.ALLE).getValue(); + mitglieder = new MitgliedQuery(control). + get(Integer.parseInt(atyp.getID()), null); + } + else if (object == null && control.isSuchAdresstypActive() && + control.getSuchAdresstyp(Mitgliedstyp.ALLE).getValue() == null) + { + mitglieder = new MitgliedQuery(control).get(-1, null); + } + else if (object != null && object instanceof Mitglied) { mitglieder.add((Mitglied) object); }