Skip to content

Commit

Permalink
Merge branch 'master' into Spendenbescheinigung_auf_zahler_ausstellen
Browse files Browse the repository at this point in the history
  • Loading branch information
Johann Maierhofer committed Dec 26, 2024
2 parents 66cb818 + 7df9f4e commit 1395740
Show file tree
Hide file tree
Showing 20 changed files with 1,218 additions and 37 deletions.
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.MittelverwendungListeView;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.GUI;

public class MittelverwendungListeAction implements Action
{
@Override
public void handleAction(Object context)
{
GUI.startView(MittelverwendungListeView.class.getName(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

package de.jost_net.JVerein.gui.action;

import java.util.Map;

import de.jost_net.JVerein.Variable.AllgemeineMap;
import de.jost_net.JVerein.Variable.MitgliedMap;
import de.jost_net.JVerein.gui.dialogs.ShowVariablesDialog;
import de.jost_net.JVerein.gui.menu.ShowVariablesMenu;
Expand All @@ -28,8 +31,6 @@
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;

import java.util.Map;

public class OpenInsertVariableDialogAction implements Action
{
@SuppressWarnings("unchecked")
Expand All @@ -53,7 +54,7 @@ else if (context instanceof Map)
else if (context instanceof MailEmpfaenger)
{
map = new MitgliedMap().getMap(((MailEmpfaenger) context).getMitglied(),
null);
new AllgemeineMap().getMap(null));
prependCopyText = "$";
}
else
Expand Down
15 changes: 14 additions & 1 deletion src/de/jost_net/JVerein/gui/control/EinstellungControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ public class EinstellungControl extends AbstractControl

private CheckboxInput summenAnlagenkonto;


private IntegerInput qrcodesize;

private CheckboxInput qrcodeptext;
Expand All @@ -335,6 +334,8 @@ public class EinstellungControl extends AbstractControl
private SelectInput afaort;

private TextInput beitragaltersstufen;

private CheckboxInput mittelverwendung;

/**
* Verschlüsselte Datei für besonders sensible Daten (Passwörter)
Expand Down Expand Up @@ -2027,6 +2028,17 @@ public SelectInput getAfaOrt() throws RemoteException
return afaort;
}

public CheckboxInput getMittelverwendung() throws RemoteException
{
if (mittelverwendung != null)
{
return mittelverwendung;
}
mittelverwendung = new CheckboxInput(
Einstellungen.getEinstellung().getMittelverwendung());
return mittelverwendung;
}

public void handleStoreAllgemein()
{
try
Expand Down Expand Up @@ -2114,6 +2126,7 @@ public void handleStoreAnzeige()
e.setAfaInJahresabschluss(false);
else
e.setAfaInJahresabschluss(true);
e.setMittelverwendung((Boolean) mittelverwendung.getValue());

e.store();
Einstellungen.setEinstellung(e);
Expand Down
20 changes: 9 additions & 11 deletions src/de/jost_net/JVerein/gui/control/MailControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@
**********************************************************************/
package de.jost_net.JVerein.gui.control;

import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.TreeSet;

import org.apache.velocity.app.Velocity;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.Variable.AllgemeineMap;
import de.jost_net.JVerein.Variable.MitgliedMap;
import de.jost_net.JVerein.gui.action.MailDetailAction;
import de.jost_net.JVerein.gui.menu.MailAnhangMenu;
import de.jost_net.JVerein.gui.menu.MailAuswahlMenu;
Expand Down Expand Up @@ -49,15 +56,6 @@
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;
import de.willuhn.util.ProgressMonitor;
import org.apache.velocity.app.Velocity;

import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.TreeSet;

public class MailControl extends FilterControl
{
Expand Down
211 changes: 211 additions & 0 deletions src/de/jost_net/JVerein/gui/control/MittelverwendungControl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/**********************************************************************
* 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.io.File;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Date;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.parts.MittelverwendungList;
import de.jost_net.JVerein.io.MittelverwendungExportCSV;
import de.jost_net.JVerein.io.MittelverwendungExportPDF;
import de.jost_net.JVerein.io.MittelverwendungZeile;
import de.jost_net.JVerein.util.Dateiname;
import de.jost_net.JVerein.util.JVDateFormatTTMMJJJJ;
import de.willuhn.jameica.gui.AbstractView;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.GUI;
import de.willuhn.jameica.gui.Part;
import de.willuhn.jameica.gui.parts.Button;
import de.willuhn.jameica.system.Application;
import de.willuhn.jameica.system.BackgroundTask;
import de.willuhn.jameica.system.Settings;
import de.willuhn.util.ApplicationException;
import de.willuhn.util.ProgressMonitor;

public class MittelverwendungControl extends SaldoControl
{

private MittelverwendungList saldoList;

final static String ExportPDF = "PDF";

final static String ExportCSV = "CSV";

public MittelverwendungControl(AbstractView view)
{
super(view);
}

public Button getPDFExportButton()
{
Button b = new Button("PDF", new Action()
{
@Override
public void handleAction(Object context) throws ApplicationException
{
starteExport(ExportPDF);
}
}, null, false, "file-pdf.png");
// button
return b;
}

public Button getCSVExportButton()
{
Button b = new Button("CSV", new Action()
{
@Override
public void handleAction(Object context) throws ApplicationException
{
starteExport(ExportCSV);
}
}, null, false, "xsd.png");
// button
return b;
}

public void handleStore()
{
//
}

public Part getSaldoList() throws ApplicationException
{
try
{
if (getDatumvon().getDate() != null)
{
settings.setAttribute("von",
new JVDateFormatTTMMJJJJ().format(getDatumvon().getDate()));
settings.setAttribute("bis",
new JVDateFormatTTMMJJJJ().format(getDatumbis().getDate()));
}

if (saldoList == null)
{
saldoList = new MittelverwendungList(null,
datumvon.getDate(), datumbis.getDate());
}
else
{
settings.setAttribute("von",
new JVDateFormatTTMMJJJJ().format(getDatumvon().getDate()));

saldoList.setDatumvon(datumvon.getDate());
saldoList.setDatumbis(datumbis.getDate());
ArrayList<MittelverwendungZeile> zeile = saldoList.getInfo();
saldoList.removeAll();
for (MittelverwendungZeile sz : zeile)
{
saldoList.addItem(sz);
}
}
}
catch (RemoteException e)
{
throw new ApplicationException(
String.format("Fehler aufgetreten %s", e.getMessage()));
}
return saldoList.getSaldoList();
}

private void starteExport(String type) throws ApplicationException
{
try
{
ArrayList<MittelverwendungZeile> zeilen = saldoList.getInfo();

FileDialog fd = new FileDialog(GUI.getShell(), SWT.SAVE);
fd.setText("Ausgabedatei wählen.");
//
Settings settings = new Settings(this.getClass());
//
String path = settings.getString("lastdir",
System.getProperty("user.home"));
if (path != null && path.length() > 0)
{
fd.setFilterPath(path);
}
fd.setFileName(new Dateiname("mittelverwendungsrechnung", "",
Einstellungen.getEinstellung().getDateinamenmuster(), type).get());

final String s = fd.open();

if (s == null || s.length() == 0)
{
return;
}

final File file = new File(s);
settings.setAttribute("lastdir", file.getParent());

exportSaldo(zeilen, file, getDatumvon().getDate(),
getDatumbis().getDate(), type);
}
catch (RemoteException e)
{
throw new ApplicationException(
String.format("Fehler beim Aufbau des Reports: %s", e.getMessage()));
}
}

private void exportSaldo(final ArrayList<MittelverwendungZeile> zeile,
final File file, final Date datumvon, final Date datumbis,
final String type)
{
BackgroundTask t = new BackgroundTask()
{
@Override
public void run(ProgressMonitor monitor) throws ApplicationException
{
try
{
if (type.equals(ExportCSV))
new MittelverwendungExportCSV(zeile, file, datumvon, datumbis);
else if (type.equals(ExportPDF))
new MittelverwendungExportPDF(zeile, file, datumvon, datumbis);
GUI.getCurrentView().reload();
}
catch (ApplicationException ae)
{
GUI.getStatusBar().setErrorText(ae.getMessage());
throw ae;
}
}

@Override
public void interrupt()
{
//
}

@Override
public boolean isInterrupted()
{
return false;
}
};
Application.getController().start(t);
}

}
6 changes: 6 additions & 0 deletions src/de/jost_net/JVerein/gui/navigation/MyExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import de.jost_net.JVerein.gui.action.NichtMitgliedSucheAction;
import de.jost_net.JVerein.gui.action.PreNotificationAction;
import de.jost_net.JVerein.gui.action.MitgliedstypListAction;
import de.jost_net.JVerein.gui.action.MittelverwendungListeAction;
import de.jost_net.JVerein.gui.action.AnfangsbestandListAction;
import de.jost_net.JVerein.gui.action.AnlagenlisteAction;
import de.jost_net.JVerein.gui.action.ArbeitseinsaetzeListeAction;
Expand Down Expand Up @@ -213,6 +214,11 @@ public Object extract(ResultSet rs)
new ProjektSaldoAction(), "euro-sign.png"));
buchfuehrung.addChild(new MyItem(buchfuehrung, "Kontensaldo",
new KontensaldoAction(), "euro-sign.png"));
if (Einstellungen.getEinstellung().getMittelverwendung())
{
buchfuehrung.addChild(new MyItem(buchfuehrung, "Mittelverwendung",
new MittelverwendungListeAction(), "euro-sign.png"));
}
if (anlagenkonto)
buchfuehrung.addChild(new MyItem(buchfuehrung, "Anlagenverzeichnis",
new AnlagenlisteAction(), "euro-sign.png"));
Expand Down
Loading

0 comments on commit 1395740

Please sign in to comment.