Skip to content

Commit

Permalink
Kontoauszug auch in Navigationsmenü (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannMaierhofer authored Jul 30, 2024
1 parent 2ddddbd commit 1c4ffcb
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 38 deletions.
18 changes: 8 additions & 10 deletions src/de/jost_net/JVerein/Queries/MitgliedQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,7 +43,7 @@
public class MitgliedQuery
{

private MitgliedControl control;
private FilterControl control;

private boolean and = false;

Expand All @@ -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<Mitglied> get(int adresstyp) throws RemoteException
public ArrayList<Mitglied> get(int adresstyp, String sort) throws RemoteException
{

zusatzfeld = control.getAdditionalparamprefix1();
Expand All @@ -69,9 +69,8 @@ public ArrayList<Mitglied> get(int adresstyp) throws RemoteException
ArrayList<Object> 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) ";
Expand Down Expand Up @@ -209,11 +208,11 @@ public ArrayList<Mitglied> 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);
}
Expand Down Expand Up @@ -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)";
Expand Down
4 changes: 4 additions & 0 deletions src/de/jost_net/JVerein/gui/action/KontoauszugAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ public void handleAction(Object context)
{
GUI.startView(KontoauszugView.class.getName(), context);
}
else
{
GUI.startView(KontoauszugView.class.getName(), null);
}
}
}
11 changes: 9 additions & 2 deletions src/de/jost_net/JVerein/gui/control/FilterControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public class FilterControl extends AbstractControl
public enum Mitgliedstyp {
MITGLIED,
NICHTMITGLIED,
NOT_USED
NOT_USED,
ALLE
}


Expand All @@ -162,6 +163,11 @@ public void init(String settingsprefix, String additionalparamprefix1,
this.additionalparamprefix2 = additionalparamprefix2;
}

public Settings getSettings()
{
return settings;
}

public String getSettingsprefix()
{
return settingsprefix;
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand Down
25 changes: 14 additions & 11 deletions src/de/jost_net/JVerein/gui/control/MitgliedControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -2091,7 +2091,7 @@ public TablePart refreshMitgliedTable(int atyp) throws RemoteException
}
lastrefresh = System.currentTimeMillis();
part.removeAll();
ArrayList<Mitglied> mitglieder = new MitgliedQuery(this).get(atyp);
ArrayList<Mitglied> mitglieder = new MitgliedQuery(this).get(atyp, null);
for (Mitglied m : mitglieder)
{
part.addItem(m);
Expand Down Expand Up @@ -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<Mitglied> 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"))
{
Expand Down Expand Up @@ -2629,17 +2633,21 @@ 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<Mitglied> list = null;
Adresstyp atyp = (Adresstyp) getSuchAdresstyp(Mitgliedstyp.NICHTMITGLIED).getValue();
if (atyp == null)
{
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"))
{
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/de/jost_net/JVerein/gui/navigation/MyExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));

Expand Down
44 changes: 32 additions & 12 deletions src/de/jost_net/JVerein/gui/view/KontoauszugView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down
17 changes: 16 additions & 1 deletion src/de/jost_net/JVerein/io/Kontoauszug.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -68,7 +71,19 @@ public Kontoauszug(Object object, MitgliedskontoControl control) throws Exceptio
this();
ArrayList<Mitglied> 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);
}
Expand Down

0 comments on commit 1c4ffcb

Please sign in to comment.