Skip to content

Commit

Permalink
Feature kontensaldo (#180)
Browse files Browse the repository at this point in the history
* Fix #163

* Sollte von größer als bis sein

* Zwischenstand

* Final fix

* Und noch was

* Leerzeile auch bei Jahressaldo

* kleine Optimierung

* Weiterer Update

* Text ändern

* Remove ...

* Kontensaldo statt Jahressaldo

* Buchung vor ersten Abschluss erlauben

* Bemerkung einfügen

* Titel korrigieren

* Lösche Bemerkung

* Rename Jahres... to Konten...

* JahressaldoAction umbenannt
  • Loading branch information
JohannMaierhofer committed Mar 15, 2024
1 parent 1236964 commit f2550d4
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 94 deletions.
Expand Up @@ -16,15 +16,15 @@
**********************************************************************/
package de.jost_net.JVerein.gui.action;

import de.jost_net.JVerein.gui.view.JahressaldoView;
import de.jost_net.JVerein.gui.view.KontensaldoView;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.GUI;

public class JahressaldoAction implements Action
public class KontensaldoAction implements Action
{
@Override
public void handleAction(Object context)
{
GUI.startView(JahressaldoView.class.getName(), null);
GUI.startView(KontensaldoView.class.getName(), null);
}
}
Expand Up @@ -24,7 +24,7 @@

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.menu.JahresabschlussMenu;
import de.jost_net.JVerein.gui.parts.JahressaldoList;
import de.jost_net.JVerein.gui.parts.KontensaldoList;
import de.jost_net.JVerein.io.SaldoZeile;
import de.jost_net.JVerein.rmi.Anfangsbestand;
import de.jost_net.JVerein.rmi.Buchung;
Expand Down Expand Up @@ -178,7 +178,7 @@ public Part getJahresabschlussSaldo() throws RemoteException
}
try
{
jahresabschlusssaldoList = new JahressaldoList(null,
jahresabschlusssaldoList = new KontensaldoList(null,
new Geschaeftsjahr((Date) getVon().getValue())).getSaldoList();
}
catch (ApplicationException e)
Expand Down Expand Up @@ -207,7 +207,7 @@ public void handleStore()
ja.store();
if ((Boolean) getAnfangsbestaende().getValue())
{
JahressaldoList jsl = new JahressaldoList(null,
KontensaldoList jsl = new KontensaldoList(null,
new Geschaeftsjahr(ja.getVon()));
ArrayList<SaldoZeile> zeilen = jsl.getInfo();
for (SaldoZeile z : zeilen)
Expand Down
Expand Up @@ -26,7 +26,7 @@
import org.eclipse.swt.widgets.FileDialog;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.parts.JahressaldoList;
import de.jost_net.JVerein.gui.parts.KontensaldoList;
import de.jost_net.JVerein.io.JahressaldoPDF;
import de.jost_net.JVerein.io.SaldoZeile;
import de.jost_net.JVerein.util.Dateiname;
Expand All @@ -44,12 +44,12 @@
import de.willuhn.util.ApplicationException;
import de.willuhn.util.ProgressMonitor;

public class JahressaldoControl extends SaldoControl
public class KontensaldoControl extends SaldoControl
{

private JahressaldoList saldoList;
private KontensaldoList saldoList;

public JahressaldoControl(AbstractView view)
public KontensaldoControl(AbstractView view)
{
super(view);
}
Expand Down Expand Up @@ -85,18 +85,15 @@ public Part getSaldoList() throws ApplicationException
settings.setAttribute("bis",
new JVDateFormatTTMMJJJJ().format(getDatumbis().getDate()));
}

Calendar cal = Calendar.getInstance();
cal.setTime(getDatumvon().getDate());
int jahr = cal.get(Calendar.YEAR);

if (saldoList == null)
{
saldoList = new JahressaldoList(null, new Geschaeftsjahr(jahr));
saldoList = new KontensaldoList(null,
getDatumvon().getDate(), getDatumbis().getDate());
}
else
{
saldoList.setGeschaeftsjahr(new Geschaeftsjahr(jahr));
saldoList.setVonBis(getDatumvon().getDate(), getDatumbis().getDate());
ArrayList<SaldoZeile> zeile = saldoList.getInfo();
saldoList.removeAll();
for (SaldoZeile sz : zeile)
Expand All @@ -109,10 +106,6 @@ public Part getSaldoList() throws ApplicationException
{
throw new ApplicationException("Fehler aufgetreten " + e.getMessage());
}
catch (ParseException e)
{
throw new ApplicationException("Fehler aufgetreten " + e.getMessage());
}
return saldoList.getSaldoList();
}

Expand Down
12 changes: 6 additions & 6 deletions src/de/jost_net/JVerein/gui/navigation/MyExtension.java
Expand Up @@ -55,7 +55,7 @@
import de.jost_net.JVerein.gui.action.FelddefinitionenAction;
import de.jost_net.JVerein.gui.action.FormularListeAction;
import de.jost_net.JVerein.gui.action.JahresabschlussListAction;
import de.jost_net.JVerein.gui.action.JahressaldoAction;
import de.jost_net.JVerein.gui.action.KontensaldoAction;
import de.jost_net.JVerein.gui.action.JubilaeenAction;
import de.jost_net.JVerein.gui.action.KontenrahmenExportAction;
import de.jost_net.JVerein.gui.action.KontenrahmenImportAction;
Expand Down Expand Up @@ -211,8 +211,8 @@ public void extend(Extendable extendable)
new BuchungsklasseSaldoAction(), "euro-sign.png"));
buchfuehrung.addChild(new MyItem(buchfuehrung, "Projektsaldo",
new ProjektSaldoAction(), "euro-sign.png"));
buchfuehrung.addChild(new MyItem(buchfuehrung, "Jahressaldo",
new JahressaldoAction(), "euro-sign.png"));
buchfuehrung.addChild(new MyItem(buchfuehrung, "Kontensaldo",
new KontensaldoAction(), "euro-sign.png"));
buchfuehrung.addChild(new MyItem(buchfuehrung, "Jahresabschlüsse",
new JahresabschlussListAction(), "euro-sign.png"));
jverein.addChild(buchfuehrung);
Expand Down Expand Up @@ -261,9 +261,6 @@ public void extend(Extendable extendable)
new AdministrationEinstellungenStatistikAction(), "wrench.png"));
administration.addChild(administrationEinstellungen);

administration.addChild(new MyItem(administration, "Beitragsgruppen",
new BeitragsgruppeSucheAction(), "clone.png"));

NavigationItem einstellungenbuchfuehrung = null;
einstellungenbuchfuehrung = new MyItem(einstellungenbuchfuehrung,
"Buchführung", null);
Expand All @@ -284,6 +281,9 @@ public void extend(Extendable extendable)
"Projekte", new ProjektListAction(), "screwdriver.png"));
administration.addChild(einstellungenbuchfuehrung);


administration.addChild(new MyItem(administration, "Beitragsgruppen",
new BeitragsgruppeSucheAction(), "clone.png"));
administration
.addChild(new MyItem(administration, "Eigenschaften-Gruppen",
new EigenschaftGruppeListeAction(), "ellipsis-v.png"));
Expand Down
Expand Up @@ -17,8 +17,8 @@
package de.jost_net.JVerein.gui.parts;

import java.rmi.RemoteException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;

import org.eclipse.swt.widgets.Composite;

Expand All @@ -33,33 +33,29 @@
import de.willuhn.jameica.gui.parts.Column;
import de.willuhn.jameica.gui.parts.TablePart;
import de.willuhn.jameica.gui.parts.table.FeatureSummary;
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;

public class JahressaldoList extends TablePart implements Part
public class KontensaldoList extends TablePart implements Part
{

private TablePart saldoList;

private Date von = null;

private Date bis = null;

private Geschaeftsjahr gj = null;

public JahressaldoList(Action action, int jahr) throws RemoteException
public KontensaldoList(Action action, Geschaeftsjahr gj)
{
super(action);
try
{
gj = new Geschaeftsjahr(jahr);
}
catch (ParseException e)
{
Logger.error("Fehler", e);
}
this.von = gj.getBeginnGeschaeftsjahr();
this.bis = gj.getEndeGeschaeftsjahr();
}

public JahressaldoList(Action action, Geschaeftsjahr gj)
public KontensaldoList(Action action, Date von, Date bis)
{
super(action);
this.gj = gj;
this.von = von;
this.bis = bis;
}

public Part getSaldoList() throws ApplicationException
Expand Down Expand Up @@ -115,18 +111,19 @@ public ArrayList<SaldoZeile> getInfo() throws RemoteException
ArrayList<SaldoZeile> zeile = new ArrayList<>();
Konto k = (Konto) Einstellungen.getDBService().createObject(Konto.class,
null);
DBIterator<Konto> konten = k.getKontenEinesJahres(gj);
DBIterator<Konto> konten = k.getKontenVonBis(von, bis);
double anfangsbestand = 0;
double einnahmen = 0;
double ausgaben = 0;
double umbuchungen = 0;
double endbestand = 0;
double jahressaldo = 0;
if (gj != null)
if (von != null)
{
SaldoZeile sz = null;
while (konten.hasNext())
{
SaldoZeile sz = new SaldoZeile(gj, (Konto) konten.next());
sz = new SaldoZeile(von, bis, (Konto) konten.next());
anfangsbestand += (Double) sz.getAttribute("anfangsbestand");
einnahmen += (Double) sz.getAttribute("einnahmen");
ausgaben += (Double) sz.getAttribute("ausgaben");
Expand Down Expand Up @@ -155,7 +152,14 @@ public ArrayList<SaldoZeile> getInfo() throws RemoteException

public void setGeschaeftsjahr(Geschaeftsjahr gj)
{
this.gj = gj;
this.von = gj.getBeginnGeschaeftsjahr();
this.bis = gj.getEndeGeschaeftsjahr();
}

public void setVonBis(Date von, Date bis)
{
this.von = von;
this.bis = bis;
}

@Override
Expand Down
Expand Up @@ -17,28 +17,28 @@
package de.jost_net.JVerein.gui.view;

import de.jost_net.JVerein.gui.action.DokumentationAction;
import de.jost_net.JVerein.gui.control.JahressaldoControl;
import de.jost_net.JVerein.gui.control.KontensaldoControl;
import de.jost_net.JVerein.gui.parts.QuickAccessPart;
import de.jost_net.JVerein.gui.parts.VonBisPart;
import de.willuhn.jameica.gui.AbstractView;
import de.willuhn.jameica.gui.GUI;
import de.willuhn.jameica.gui.parts.ButtonArea;
import de.willuhn.jameica.gui.util.LabelGroup;

public class JahressaldoView extends AbstractView
public class KontensaldoView extends AbstractView
{

@Override
public void bind() throws Exception
{
GUI.getView().setTitle("Jahressaldo");
GUI.getView().setTitle("Konten-Saldo");

final JahressaldoControl control = new JahressaldoControl(this);
final KontensaldoControl control = new KontensaldoControl(this);

VonBisPart vpart = new VonBisPart(control, false);
VonBisPart vpart = new VonBisPart(control, true);
vpart.paint(this.getParent());

QuickAccessPart part = new QuickAccessPart(control, false);
QuickAccessPart part = new QuickAccessPart(control, true);
part.paint(this.getParent());

LabelGroup group2 = new LabelGroup(getParent(), "Saldo", true);
Expand Down
2 changes: 1 addition & 1 deletion src/de/jost_net/JVerein/gui/view/ProjektSaldoView.java
Expand Up @@ -31,7 +31,7 @@ public class ProjektSaldoView extends AbstractView
@Override
public void bind() throws Exception
{
GUI.getView().setTitle("Projekte-Saldo");
GUI.getView().setTitle("Projekt-Saldo");

final ProjektSaldoControl control = new ProjektSaldoControl(this);

Expand Down

0 comments on commit f2550d4

Please sign in to comment.