Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sollbuchung Neu Button. Sollbuchung Menü erweitert #625

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/de/jost_net/JVerein/gui/action/RechnungNeuAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
**********************************************************************/
package de.jost_net.JVerein.gui.action;

import java.rmi.RemoteException;
import java.util.Date;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.control.MitgliedskontoNode;
import de.jost_net.JVerein.gui.dialogs.RechnungDialog;
import de.jost_net.JVerein.rmi.Formular;
import de.jost_net.JVerein.rmi.Mitgliedskonto;
Expand All @@ -41,6 +43,23 @@ public void handleAction(Object context) throws ApplicationException
TablePart tp = (TablePart) context;
context = tp.getSelection();
}
if (context instanceof MitgliedskontoNode)
{
MitgliedskontoNode mkn = (MitgliedskontoNode) context;

if (mkn.getType() == MitgliedskontoNode.SOLL)
{
try
{
context = Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, mkn.getID());
}
catch (RemoteException e)
{
throw new ApplicationException("Fehler beim erstellen der Rechnung!");
}
}
}
if (context instanceof Mitgliedskonto)
{
mks = new Mitgliedskonto[] { (Mitgliedskonto) context };
Expand Down
53 changes: 23 additions & 30 deletions src/de/jost_net/JVerein/gui/action/SollbuchungNeuAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
**********************************************************************/
package de.jost_net.JVerein.gui.action;

import java.rmi.RemoteException;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.control.MitgliedskontoNode;
import de.jost_net.JVerein.gui.view.SollbuchungDetailView;
import de.jost_net.JVerein.rmi.Mitglied;
import de.jost_net.JVerein.rmi.Mitgliedskonto;
Expand All @@ -30,44 +27,40 @@
public class SollbuchungNeuAction implements Action
{

private Mitglied m;

public SollbuchungNeuAction(Mitglied m)
{
super();
this.m = m;
}

@Override
public void handleAction(Object context) throws ApplicationException
{
MitgliedskontoNode mkn = null;
Mitgliedskonto mk = null;

if (context instanceof MitgliedskontoNode)
try
{
mkn = (MitgliedskontoNode) context;
try
mk = (Mitgliedskonto) Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, null);
mk.setBetrag(0.0);
if (m != null)
{
Mitglied m = (Mitglied) Einstellungen.getDBService()
.createObject(Mitglied.class, mkn.getID());
mk = (Mitgliedskonto) Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, null);
mk.setZahlungsweg(m.getZahlungsweg());
if (m.getID() == null)
{
throw new ApplicationException(
"Neues Mitglied bitte erst speichern. Dann k�nnen Zusatzbetr�ge aufgenommen werden.");
}
mk.setMitglied(m);
JohannMaierhofer marked this conversation as resolved.
Show resolved Hide resolved
mk.setBetrag(0.0);
}
catch (RemoteException e)
{
throw new ApplicationException(
"Fehler bei der Erzeugung einer Sollbuchung");
mk.setZahlungsweg(m.getZahlungsweg());
mk.setZahler(m.getZahler());
}
}
else
catch (Exception e)
{
try
{
mk = (Mitgliedskonto) Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, null);
mk.setBetrag(0.0);
}
catch (Exception e)
{
throw new ApplicationException(
"Fehler bei der Erzeugung einer neuen Sollbuchung", e);
}
throw new ApplicationException(
"Fehler bei der Erzeugung einer neuen Sollbuchung", e);
}
GUI.startView(new SollbuchungDetailView(), mk);
}
Expand Down
23 changes: 21 additions & 2 deletions src/de/jost_net/JVerein/gui/action/SollbuchungRechnungAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import java.rmi.RemoteException;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.control.MitgliedskontoNode;
import de.jost_net.JVerein.gui.view.RechnungView;
import de.jost_net.JVerein.rmi.Mitgliedskonto;
import de.willuhn.jameica.gui.Action;
Expand All @@ -27,9 +29,25 @@
public class SollbuchungRechnungAction implements Action
{
@Override
public void handleAction(Object context)
throws ApplicationException
public void handleAction(Object context) throws ApplicationException
{
if (context instanceof MitgliedskontoNode)
{
MitgliedskontoNode mkn = (MitgliedskontoNode) context;

if (mkn.getType() == MitgliedskontoNode.SOLL)
{
try
{
context = Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, mkn.getID());
}
catch (RemoteException e)
{
throw new ApplicationException("Fehler beim anzeigen der Rechnung!");
}
}
}
if (context instanceof Mitgliedskonto)
{
Mitgliedskonto mk = (Mitgliedskonto) context;
Expand All @@ -47,5 +65,6 @@ public void handleAction(Object context)
throw new ApplicationException("Fehler beim anzeigen der Rechnung!");
}
}

}
}
8 changes: 8 additions & 0 deletions src/de/jost_net/JVerein/gui/control/MitgliedControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import de.jost_net.JVerein.gui.action.MailDetailAction;
import de.jost_net.JVerein.gui.action.MitgliedDetailAction;
import de.jost_net.JVerein.gui.action.MitgliedNextBGruppeBearbeitenAction;
import de.jost_net.JVerein.gui.action.SollbuchungNeuAction;
import de.jost_net.JVerein.gui.action.WiedervorlageAction;
import de.jost_net.JVerein.gui.action.ZusatzbetraegeAction;
import de.jost_net.JVerein.gui.formatter.BuchungsartFormatter;
Expand Down Expand Up @@ -2171,6 +2172,13 @@ public Button getZusatzbetragNeu()
new ZusatzbetraegeAction(getMitglied()), null, false, "document-new.png");
}

public Button getSollbuchungNeu()
{
return new Button("Neue Sollbuchung",
new SollbuchungNeuAction(getMitglied()), null, false,
"document-new.png");
}

public Button getWiedervorlageNeu()
{
return new Button("Neue Wiedervorlage",
Expand Down
35 changes: 35 additions & 0 deletions src/de/jost_net/JVerein/gui/control/RechnungControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import de.jost_net.JVerein.gui.input.MailAuswertungInput;
import de.jost_net.JVerein.gui.input.PersonenartInput;
import de.jost_net.JVerein.gui.menu.RechnungMenu;
import de.jost_net.JVerein.gui.view.MahnungMailView;
import de.jost_net.JVerein.gui.view.RechnungMailView;
import de.jost_net.JVerein.gui.parts.SollbuchungPositionListPart;
import de.jost_net.JVerein.io.Rechnungsausgabe;
import de.jost_net.JVerein.keys.FormularArt;
Expand Down Expand Up @@ -60,6 +62,7 @@
import de.willuhn.jameica.gui.parts.table.FeatureSummary;
import de.willuhn.jameica.hbci.HBCIProperties;
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;

public class RechnungControl extends DruckMailControl
{
Expand Down Expand Up @@ -684,4 +687,36 @@ public TextInput getZahlungsweg() throws RemoteException
zahlungsweg.disable();
return zahlungsweg;
}

public Button getRechnungDruckUndMailButton()
{

Button b = new Button("Druck und Mail", new Action()
{

@Override
public void handleAction(Object context) throws ApplicationException
{
Rechnung re = getRechnung();
GUI.startView(RechnungMailView.class, new Rechnung[] { (Rechnung) re });
}
}, getRechnung(), false, "document-print.png");
return b;
}

public Button getMahnungDruckUndMailButton()
{

Button b = new Button("Mahnung Druck und Mail", new Action()
{

@Override
public void handleAction(Object context) throws ApplicationException
{
Rechnung re = getRechnung();
GUI.startView(MahnungMailView.class, new Rechnung[] { (Rechnung) re });
}
}, getRechnung(), false, "document-print.png");
return b;
}
}
80 changes: 77 additions & 3 deletions src/de/jost_net/JVerein/gui/menu/MitgliedskontoMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.action.IstbuchungEditAction;
import de.jost_net.JVerein.gui.action.IstbuchungLoesenAction;
import de.jost_net.JVerein.gui.action.RechnungNeuAction;
import de.jost_net.JVerein.gui.action.SollbuchungEditAction;
import de.jost_net.JVerein.gui.action.SollbuchungLoeschenAction;
import de.jost_net.JVerein.gui.action.SollbuchungNeuAction;
import de.jost_net.JVerein.gui.action.SollbuchungRechnungAction;
import de.jost_net.JVerein.gui.action.SpendenbescheinigungAction;
import de.jost_net.JVerein.gui.control.MitgliedskontoNode;
import de.jost_net.JVerein.keys.Spendenart;
import de.jost_net.JVerein.rmi.Buchung;
import de.jost_net.JVerein.rmi.Mitgliedskonto;
import de.willuhn.datasource.rmi.DBIterator;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.parts.CheckedContextMenuItem;
Expand All @@ -46,12 +48,14 @@ public class MitgliedskontoMenu extends ContextMenu
*/
public MitgliedskontoMenu()
{
addItem(new MitgliedItem("Neue Sollbuchung", new SollbuchungNeuAction(),
"document-new.png"));
addItem(new SollItem("Sollbuchung bearbeiten", new SollbuchungEditAction(),
"text-x-generic.png"));
addItem(new SollOhneIstItem("Sollbuchung l�schen",
new SollbuchungLoeschenAction(), "user-trash-full.png"));
addItem(new MitRechnungItem("Rechnung anzeigen",
new SollbuchungRechnungAction(), "file-invoice.png"));
addItem(new OhneRechnungItem("Rechnung(en) erstellen",
new RechnungNeuAction(), "file-invoice.png"));
addItem(ContextMenuItem.SEPARATOR);
addItem(new SollMitIstItem("Istbuchung bearbeiten",
new IstbuchungEditAction(), "text-x-generic.png"));
Expand Down Expand Up @@ -241,4 +245,74 @@ else if (mkn.getType() == MitgliedskontoNode.IST)
}
}

private static class OhneRechnungItem extends CheckedContextMenuItem
{

private OhneRechnungItem(String text, Action action, String icon)
{
super(text, action, icon);
}

@Override
public boolean isEnabledFor(Object o)
{
if (o instanceof MitgliedskontoNode)
{
MitgliedskontoNode mkn = (MitgliedskontoNode) o;
if (mkn.getType() != MitgliedskontoNode.SOLL)
{
return false;
}

try
{
Mitgliedskonto mk = Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, mkn.getID());
return mk.getRechnung() == null;
}
catch (RemoteException e)
{
Logger.error("Fehler", e);
}
return false;
}
return false;
}
}

private static class MitRechnungItem extends CheckedContextMenuItem
{

private MitRechnungItem(String text, Action action, String icon)
{
super(text, action, icon);
}

@Override
public boolean isEnabledFor(Object o)
{

if (o instanceof MitgliedskontoNode)
{
MitgliedskontoNode mkn = (MitgliedskontoNode) o;
if (mkn.getType() != MitgliedskontoNode.SOLL)
{
return false;
}

try
{
Mitgliedskonto mk = Einstellungen.getDBService()
.createObject(Mitgliedskonto.class, mkn.getID());
return mk.getRechnung() != null;
}
catch (RemoteException e)
{
Logger.error("Fehler", e);
}
return false;
}
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ private void zeichneMitgliedkonto(MitgliedskontoControl controlMk,
{
Container cont = getTabOrLabelContainer(parentComposite,
"Mitgliedskonto");

cont.getComposite().setLayoutData(new GridData(GridData.FILL_VERTICAL));
cont.getComposite().setLayout(new GridLayout(1, false));

ButtonArea buttonszus = new ButtonArea();
buttonszus.addButton(control.getSollbuchungNeu());
buttonszus.paint(cont.getComposite());
controlMk.getMitgliedskontoTree(control.getMitglied())
.paint(cont.getComposite());
}
Expand Down
4 changes: 0 additions & 4 deletions src/de/jost_net/JVerein/gui/view/RechnungMailView.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ public void bind() throws Exception
DokumentationUtil.RECHNUNG_MAIL, false, "question-circle.png");
buttons.addButton(new Button("Mail-Vorlage", new MailVorlageZuweisenAction(),
control, false, "view-refresh.png"));
/*buttons.addButton(new Button("Export",
new MitgliedskontoExportAction(EXPORT_TYP.RECHNUNGEN,
getCurrentObject()),
control, false, "document-save.png"));*/
buttons.addButton(control.getStartRechnungButton(this.getCurrentObject()));
buttons.paint(this.getParent());
}
Expand Down
2 changes: 2 additions & 0 deletions src/de/jost_net/JVerein/gui/view/RechnungView.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public void bind() throws Exception
ButtonArea buttons = new ButtonArea();
buttons.addButton("Hilfe", new DokumentationAction(),
DokumentationUtil.RECHNUNG, false, "question-circle.png");
buttons.addButton(control.getRechnungDruckUndMailButton());
buttons.addButton(control.getMahnungDruckUndMailButton());
buttons.paint(this.getParent());
}
}
2 changes: 1 addition & 1 deletion src/de/jost_net/JVerein/gui/view/SollbuchungListeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void bind() throws Exception
buttons.addButton(new Button("Export",
new SollbuchungExportAction(EXPORT_TYP.MITGLIEDSKONTO), control, false,
"document-save.png"));
buttons.addButton("Neu", new SollbuchungNeuAction(), control, false,
buttons.addButton("Neu", new SollbuchungNeuAction(null), control, false,
"document-new.png");
buttons.paint(this.getParent());
}
Expand Down