forked from jverein/jverein
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Zwischenstand * Endstand * Add Table Summary * Filter fuer Mitglied Art * Einstellungen abprüfen
- Loading branch information
1 parent
6aa99c7
commit 5c22a3d
Showing
9 changed files
with
456 additions
and
1 deletion.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
src/de/jost_net/JVerein/gui/action/LastschriftDeleteAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/********************************************************************** | ||
* Copyright (c) by Heiner Jostkleigrewe | ||
* This program is free software: you can redistribute it and/or modify it under the terms of the | ||
* GNU General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
* the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
* [email protected] | ||
* www.jverein.de | ||
**********************************************************************/ | ||
package de.jost_net.JVerein.gui.action; | ||
|
||
import java.rmi.RemoteException; | ||
|
||
import de.jost_net.JVerein.rmi.Lastschrift; | ||
import de.willuhn.jameica.gui.Action; | ||
import de.willuhn.jameica.gui.GUI; | ||
import de.willuhn.jameica.gui.dialogs.YesNoDialog; | ||
import de.willuhn.logging.Logger; | ||
import de.willuhn.util.ApplicationException; | ||
|
||
/** | ||
* Loeschen einer Lastschrift. | ||
*/ | ||
public class LastschriftDeleteAction implements Action | ||
{ | ||
|
||
@Override | ||
public void handleAction(Object context) throws ApplicationException | ||
{ | ||
if (context == null | ||
|| (!(context instanceof Lastschrift) && !(context instanceof Lastschrift[]))) | ||
{ | ||
throw new ApplicationException("Keine Lastschrift ausgewählt"); | ||
} | ||
try | ||
{ | ||
Lastschrift[] la = null; | ||
if (context instanceof Lastschrift) | ||
{ | ||
la = new Lastschrift[1]; | ||
la[0] = (Lastschrift) context; | ||
} | ||
else if (context instanceof Lastschrift[]) | ||
{ | ||
la = (Lastschrift[]) context; | ||
} | ||
if (la == null) | ||
{ | ||
return; | ||
} | ||
if (la.length == 0) | ||
{ | ||
return; | ||
} | ||
if (la[0].isNewObject()) | ||
{ | ||
return; | ||
} | ||
YesNoDialog d = new YesNoDialog(YesNoDialog.POSITION_CENTER); | ||
d.setTitle("Lastschrift" + (la.length > 1 ? "en" : "") + " löschen"); | ||
d.setText("Wollen Sie diese Lastschrift" + (la.length > 1 ? "en" : "") | ||
+ " wirklich löschen?"); | ||
try | ||
{ | ||
Boolean choice = (Boolean) d.open(); | ||
if (!choice.booleanValue()) | ||
{ | ||
return; | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Logger.error("Fehler beim Löschen der Lastschrift", e); | ||
return; | ||
} | ||
int count = 0; | ||
for (Lastschrift l : la) | ||
{ | ||
l.delete(); | ||
count++; | ||
} | ||
if (count > 0) | ||
{ | ||
GUI.getStatusBar().setSuccessText(String.format( | ||
"%d Lastschrift" + (count != 1 ? "en" : "") + " gelöscht.", count)); | ||
} | ||
else | ||
{ | ||
GUI.getStatusBar().setErrorText("Keine Lastschrift gelöscht"); | ||
} | ||
} | ||
catch (RemoteException e) | ||
{ | ||
String fehler = "Fehler beim Löschen der Lastschrift."; | ||
GUI.getStatusBar().setErrorText(fehler); | ||
Logger.error(fehler, e); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/de/jost_net/JVerein/gui/action/LastschriftListAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/********************************************************************** | ||
* Copyright (c) by Heiner Jostkleigrewe | ||
* This program is free software: you can redistribute it and/or modify it under the terms of the | ||
* GNU General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
* the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
* [email protected] | ||
* www.jverein.de | ||
**********************************************************************/ | ||
package de.jost_net.JVerein.gui.action; | ||
|
||
import de.jost_net.JVerein.gui.view.LastschriftListeView; | ||
import de.willuhn.jameica.gui.Action; | ||
import de.willuhn.jameica.gui.GUI; | ||
|
||
public class LastschriftListAction implements Action | ||
{ | ||
@Override | ||
public void handleAction(Object context) | ||
{ | ||
GUI.startView(LastschriftListeView.class.getName(), null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 158 additions & 0 deletions
158
src/de/jost_net/JVerein/gui/control/LastschriftControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/********************************************************************** | ||
* Copyright (c) by Heiner Jostkleigrewe | ||
* This program is free software: you can redistribute it and/or modify it under the terms of the | ||
* GNU General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
* the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
* [email protected] | ||
* www.jverein.de | ||
**********************************************************************/ | ||
package de.jost_net.JVerein.gui.control; | ||
|
||
import java.rmi.RemoteException; | ||
import java.util.Date; | ||
|
||
import de.jost_net.JVerein.Einstellungen; | ||
import de.jost_net.JVerein.gui.menu.LastschriftMenu; | ||
import de.jost_net.JVerein.rmi.Lastschrift; | ||
import de.jost_net.JVerein.util.JVDateFormatTTMMJJJJ; | ||
import de.willuhn.datasource.rmi.DBIterator; | ||
import de.willuhn.datasource.rmi.DBService; | ||
import de.willuhn.jameica.gui.AbstractView; | ||
import de.willuhn.jameica.gui.Part; | ||
import de.willuhn.jameica.gui.formatter.CurrencyFormatter; | ||
import de.willuhn.jameica.gui.formatter.DateFormatter; | ||
import de.willuhn.jameica.gui.parts.TablePart; | ||
import de.willuhn.jameica.gui.parts.table.FeatureSummary; | ||
import de.willuhn.logging.Logger; | ||
|
||
public class LastschriftControl extends FilterControl | ||
{ | ||
|
||
|
||
private TablePart lastschriftList; | ||
|
||
public LastschriftControl(AbstractView view) | ||
{ | ||
super(view); | ||
settings = new de.willuhn.jameica.system.Settings(this.getClass()); | ||
settings.setStoreWhenRead(true); | ||
} | ||
|
||
public Part getLastschriftList() throws RemoteException | ||
{ | ||
if (lastschriftList != null) | ||
{ | ||
return lastschriftList; | ||
} | ||
lastschriftList = new TablePart(getLastschriften(), null); | ||
lastschriftList.addColumn("Name", "name"); | ||
lastschriftList.addColumn("Vorname", "vorname"); | ||
lastschriftList.addColumn("Zweck", "verwendungszweck"); | ||
lastschriftList.addColumn("Betrag", "betrag", | ||
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT)); | ||
lastschriftList.addColumn("Fälligkeit", "faelligkeit", | ||
new DateFormatter(new JVDateFormatTTMMJJJJ())); | ||
lastschriftList.addColumn("IBAN", "iban"); | ||
lastschriftList.addColumn("Mandat", "mandatid"); | ||
lastschriftList.addColumn("Mandatdatum", "mandatdatum", | ||
new DateFormatter(new JVDateFormatTTMMJJJJ())); | ||
lastschriftList.setRememberColWidths(true); | ||
lastschriftList.setContextMenu(new LastschriftMenu()); | ||
lastschriftList.setRememberOrder(true); | ||
lastschriftList.addFeature(new FeatureSummary()); | ||
lastschriftList.setMulti(true); | ||
return lastschriftList; | ||
} | ||
|
||
public void TabRefresh() | ||
{ | ||
if (lastschriftList == null) | ||
{ | ||
return; | ||
} | ||
try | ||
{ | ||
lastschriftList.removeAll(); | ||
DBIterator<Lastschrift> lastschriften = getLastschriften(); | ||
while (lastschriften.hasNext()) | ||
{ | ||
lastschriftList.addItem(lastschriften.next()); | ||
} | ||
} | ||
catch (RemoteException e1) | ||
{ | ||
Logger.error("Fehler", e1); | ||
} | ||
} | ||
|
||
private DBIterator<Lastschrift> getLastschriften() throws RemoteException | ||
{ | ||
DBService service = Einstellungen.getDBService(); | ||
DBIterator<Lastschrift> lastschriften = service | ||
.createList(Lastschrift.class); | ||
lastschriften.join("abrechnungslauf"); | ||
lastschriften.addFilter("abrechnungslauf.id = lastschrift.abrechnungslauf"); | ||
if (isMitgliedArtAktiv() && getMitgliedArt().getValue() != null) | ||
{ | ||
String tmpArt = (String) getMitgliedArt().getValue(); | ||
if (tmpArt.equalsIgnoreCase("Kursteilnehmer")) | ||
{ | ||
lastschriften.addFilter("(lastschrift.kursteilnehmer IS NOT NULL)"); | ||
} | ||
else | ||
{ | ||
lastschriften.join("mitglied"); | ||
lastschriften.addFilter("mitglied.id = lastschrift.mitglied"); | ||
if (tmpArt.equalsIgnoreCase("Mitglied")) | ||
{ | ||
lastschriften.addFilter("(adresstyp = 1)"); | ||
} | ||
else if (tmpArt.equalsIgnoreCase("Nicht-Mitglied")) | ||
{ | ||
lastschriften.addFilter("(adresstyp > 1)"); | ||
} | ||
} | ||
} | ||
if (isSuchnameAktiv() && getSuchname().getValue() != null) | ||
{ | ||
String tmpSuchname = (String) getSuchname().getValue(); | ||
if (tmpSuchname.length() > 0) | ||
{ | ||
lastschriften.addFilter("(lower(lastschrift.name) like ?)", | ||
new Object[] { tmpSuchname.toLowerCase() + "%"}); | ||
} | ||
} | ||
if (isSuchtextAktiv() && getSuchtext().getValue() != null) | ||
{ | ||
String tmpSuchtext = (String) getSuchtext().getValue(); | ||
if (tmpSuchtext.length() > 0) | ||
{ | ||
lastschriften.addFilter("(lower(verwendungszweck) like ?)", | ||
new Object[] { "%" + tmpSuchtext.toLowerCase() + "%"}); | ||
} | ||
} | ||
if (isDatumvonAktiv() && getDatumvon().getValue() != null) | ||
{ | ||
lastschriften.addFilter("faelligkeit >= ?", | ||
new Object[] { (Date) getDatumvon().getValue() }); | ||
} | ||
if (isDatumbisAktiv() && getDatumbis().getValue() != null) | ||
{ | ||
lastschriften.addFilter("faelligkeit <= ?", | ||
new Object[] { (Date) getDatumbis().getValue() }); | ||
} | ||
|
||
lastschriften.setOrder("ORDER BY name"); | ||
|
||
return lastschriften; | ||
} | ||
|
||
} |
Oops, something went wrong.