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.
Sollbuchungen manuell erstellen (#598)
* Sollbuchungen manuell erstellen * Code Formatter anwenden --------- Co-authored-by: Johann Maierhofer <[email protected]>
- Loading branch information
1 parent
97c51a5
commit 43f32b7
Showing
14 changed files
with
702 additions
and
66 deletions.
There are no files selected for viewing
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
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
97 changes: 97 additions & 0 deletions
97
src/de/jost_net/JVerein/gui/action/SollbuchungPositionDeleteAction.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,97 @@ | ||
/********************************************************************** | ||
* 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 java.util.ArrayList; | ||
|
||
import de.jost_net.JVerein.gui.view.SollbuchungDetailView; | ||
import de.jost_net.JVerein.rmi.Mitgliedskonto; | ||
import de.jost_net.JVerein.rmi.SollbuchungPosition; | ||
import de.willuhn.jameica.gui.Action; | ||
import de.willuhn.jameica.gui.GUI; | ||
import de.willuhn.jameica.gui.dialogs.YesNoDialog; | ||
import de.willuhn.jameica.gui.parts.TablePart; | ||
import de.willuhn.logging.Logger; | ||
import de.willuhn.util.ApplicationException; | ||
|
||
/** | ||
* Löschen eines Formularfeldes | ||
*/ | ||
public class SollbuchungPositionDeleteAction implements Action | ||
{ | ||
|
||
@Override | ||
public void handleAction(Object context) throws ApplicationException | ||
{ | ||
if (context instanceof TablePart) | ||
{ | ||
TablePart tp = (TablePart) context; | ||
context = tp.getSelection(); | ||
} | ||
if (context == null || !(context instanceof SollbuchungPosition)) | ||
{ | ||
throw new ApplicationException("Keine Sollbuchungsposition ausgewählt"); | ||
} | ||
try | ||
{ | ||
SollbuchungPosition position = (SollbuchungPosition) context; | ||
if (position.isNewObject()) | ||
{ | ||
return; | ||
} | ||
|
||
YesNoDialog d = new YesNoDialog(YesNoDialog.POSITION_CENTER); | ||
d.setTitle("Sollbuchungsposition löschen"); | ||
d.setText("Wollen Sie diese Sollbuchungsposition wirklich löschen?"); | ||
|
||
try | ||
{ | ||
Boolean choice = (Boolean) d.open(); | ||
if (!choice.booleanValue()) | ||
{ | ||
return; | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Logger.error("Fehler beim Löschen der Sollbuchungsposition", e); | ||
return; | ||
} | ||
position.delete(); | ||
// Betrag in Sollbuchung neu berechnen | ||
Double betrag = 0.0; | ||
Mitgliedskonto sollb = position.getSollbuchung(); | ||
ArrayList<SollbuchungPosition> sollbpList = sollb | ||
.getSollbuchungPositionList(); | ||
for (SollbuchungPosition sollp : sollbpList) | ||
{ | ||
betrag += sollp.getBetrag(); | ||
} | ||
sollb.setBetrag(betrag); | ||
sollb.store(); | ||
GUI.startView(SollbuchungDetailView.class.getName(), sollb); | ||
GUI.getStatusBar().setSuccessText("Sollbuchungsposition gelöscht."); | ||
} | ||
catch (RemoteException e) | ||
{ | ||
String fehler = "Fehler beim Löschen der Sollbuchungsposition"; | ||
GUI.getStatusBar().setErrorText(fehler); | ||
Logger.error(fehler, e); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/de/jost_net/JVerein/gui/action/SollbuchungPositionEditAction.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,44 @@ | ||
/********************************************************************** | ||
* 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.SollbuchungPositionView; | ||
import de.jost_net.JVerein.rmi.SollbuchungPosition; | ||
import de.willuhn.jameica.gui.Action; | ||
import de.willuhn.jameica.gui.GUI; | ||
import de.willuhn.util.ApplicationException; | ||
|
||
public class SollbuchungPositionEditAction implements Action | ||
{ | ||
|
||
@Override | ||
public void handleAction(Object context) throws ApplicationException | ||
{ | ||
SollbuchungPosition position = null; | ||
|
||
if (context != null && (context instanceof SollbuchungPosition)) | ||
{ | ||
position = (SollbuchungPosition) context; | ||
} | ||
else | ||
{ | ||
throw new ApplicationException("Keine Sollbuchungsposition ausgewählt"); | ||
} | ||
|
||
GUI.startView(SollbuchungPositionView.class.getName(), position); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/de/jost_net/JVerein/gui/action/SollbuchungPositionNeuAction.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,67 @@ | ||
/********************************************************************** | ||
* 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.Einstellungen; | ||
import de.jost_net.JVerein.gui.view.SollbuchungPositionView; | ||
import de.jost_net.JVerein.rmi.Mitgliedskonto; | ||
import de.jost_net.JVerein.rmi.SollbuchungPosition; | ||
import de.willuhn.jameica.gui.Action; | ||
import de.willuhn.jameica.gui.GUI; | ||
import de.willuhn.logging.Logger; | ||
import de.willuhn.util.ApplicationException; | ||
|
||
public class SollbuchungPositionNeuAction implements Action | ||
{ | ||
|
||
@Override | ||
public void handleAction(Object context) throws ApplicationException | ||
{ | ||
Mitgliedskonto sollbuchung = null; | ||
SollbuchungPosition position = null; | ||
|
||
if (context != null && (context instanceof Mitgliedskonto)) | ||
{ | ||
sollbuchung = (Mitgliedskonto) context; | ||
try | ||
{ | ||
if (sollbuchung.isNewObject()) | ||
{ | ||
throw new ApplicationException( | ||
"Vor dem Anlegen der Sollbuchungsposition muss die Sollbuchung gespeichert werden!"); | ||
} | ||
position = (SollbuchungPosition) Einstellungen.getDBService() | ||
.createObject(SollbuchungPosition.class, null); | ||
position.setSollbuchung(sollbuchung.getID()); | ||
} | ||
catch (RemoteException e) | ||
{ | ||
Logger.error("Fehler", e); | ||
throw new ApplicationException( | ||
"Fehler bei der Erzeugung einer neuen Sollbuchungsposition", e); | ||
} | ||
} | ||
else | ||
{ | ||
throw new ApplicationException("Keine Sollbuchung ausgewählt"); | ||
} | ||
|
||
GUI.startView(SollbuchungPositionView.class.getName(), position); | ||
} | ||
} |
Oops, something went wrong.