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

Abrechnungslauf ohne SEPA File Abfrage #136

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/de/jost_net/JVerein/gui/control/AbrechnungSEPAControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public SelectInput getAbbuchungsausgabe()
Abrechnungsausgabe aus = Abrechnungsausgabe.getByKey(settings
.getInt("abrechnungsausgabe", Abrechnungsausgabe.SEPA_DATEI.getKey()));
if (aus != Abrechnungsausgabe.SEPA_DATEI
&& aus != Abrechnungsausgabe.HIBISCUS)
&& aus != Abrechnungsausgabe.HIBISCUS
&& aus != Abrechnungsausgabe.KEINE_DATEI)
{
aus = Abrechnungsausgabe.HIBISCUS;
}
Expand Down Expand Up @@ -430,12 +431,8 @@ public void run(ProgressMonitor monitor) throws ApplicationException

monitor.setPercentComplete(100);
monitor.setStatus(ProgressMonitor.STATUS_DONE);
if (abupar.abbuchungsausgabe == Abrechnungsausgabe.SEPA_DATEI)
{
GUI.getStatusBar().setSuccessText(String.format("Abrechnung durchgef�hrt, SEPA-Datei %s geschrieben.", abupar.sepafileRCUR.getAbsolutePath()));
} else {
GUI.getStatusBar().setSuccessText("Abrechnung durchgef�hrt, Hibiscus-Lastschrift geschrieben.");
}
GUI.getStatusBar().setSuccessText("Abrechnung durchgef�hrt" + abupar.getText());

}
catch (ApplicationException ae)
{
Expand All @@ -451,9 +448,16 @@ public void run(ProgressMonitor monitor) throws ApplicationException
{
Logger.error(String.format("error while creating %s", abupar.sepafileRCUR.getAbsolutePath()), e);
ae = new ApplicationException(String.format("Fehler beim Erstellen der Abbuchungsdatei: %s", abupar.sepafileRCUR.getAbsolutePath()), e);
} else {
}
else if (abupar.abbuchungsausgabe == Abrechnungsausgabe.HIBISCUS)
{
Logger.error("error while creating debit in Hibiscus", e);
ae = new ApplicationException("Fehler beim Erstellen der Hibiscus-Lastschrift", e);
}
else
{
Logger.error("error during operation", e);
ae = new ApplicationException("Fehler beim Abrechnungslauf", e);
}
GUI.getStatusBar().setErrorText(ae.getMessage());
throw ae;
Expand Down
26 changes: 13 additions & 13 deletions src/de/jost_net/JVerein/gui/control/PreNotificationControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import de.jost_net.JVerein.io.Ct1Ueberweisung;
import de.jost_net.JVerein.io.FormularAufbereitung;
import de.jost_net.JVerein.io.MailSender;
import de.jost_net.JVerein.keys.Abrechnungsausgabe;
import de.jost_net.JVerein.keys.Ct1Ausgabe;
import de.jost_net.JVerein.keys.FormularArt;
import de.jost_net.JVerein.rmi.Abrechnungslauf;
import de.jost_net.JVerein.rmi.Formular;
Expand Down Expand Up @@ -204,14 +204,14 @@ public SelectInput getct1Ausgabe()
{
return ct1ausgabe;
}
Abrechnungsausgabe aus = Abrechnungsausgabe.getByKey(
settings.getInt("ct1ausgabe", Abrechnungsausgabe.SEPA_DATEI.getKey()));
if (aus != Abrechnungsausgabe.SEPA_DATEI
&& aus != Abrechnungsausgabe.HIBISCUS)
Ct1Ausgabe aus = Ct1Ausgabe.getByKey(
settings.getInt("ct1ausgabe", Ct1Ausgabe.SEPA_DATEI.getKey()));
if (aus != Ct1Ausgabe.SEPA_DATEI
&& aus != Ct1Ausgabe.HIBISCUS)
{
aus = Abrechnungsausgabe.HIBISCUS;
aus = Ct1Ausgabe.HIBISCUS;
}
ct1ausgabe = new SelectInput(Abrechnungsausgabe.values(), aus);
ct1ausgabe = new SelectInput(Ct1Ausgabe.values(), aus);
ct1ausgabe.setName("Ausgabe");
return ct1ausgabe;
}
Expand Down Expand Up @@ -281,7 +281,7 @@ public void handleAction(Object context)
{
try
{
Abrechnungsausgabe aa = (Abrechnungsausgabe) ct1ausgabe.getValue();
Ct1Ausgabe aa = (Ct1Ausgabe) ct1ausgabe.getValue();
settings.setAttribute("ct1ausgabe", aa.getKey());
if (ausfuehrungsdatum.getValue() == null)
{
Expand Down Expand Up @@ -408,9 +408,9 @@ private void generiere1ct(Object currentObject) throws Exception
{
Abrechnungslauf abrl = (Abrechnungslauf) currentObject;
File file = null;
Abrechnungsausgabe aa = Abrechnungsausgabe.getByKey(
settings.getInt("ct1ausgabe", Abrechnungsausgabe.SEPA_DATEI.getKey()));
if (aa == Abrechnungsausgabe.SEPA_DATEI)
Ct1Ausgabe aa = Ct1Ausgabe.getByKey(
settings.getInt("ct1ausgabe", Ct1Ausgabe.SEPA_DATEI.getKey()));
if (aa == Ct1Ausgabe.SEPA_DATEI)
{
FileDialog fd = new FileDialog(GUI.getShell(), SWT.SAVE);
fd.setText("SEPA-Ausgabedatei w�hlen.");
Expand Down Expand Up @@ -439,8 +439,8 @@ private void generiere1ct(Object currentObject) throws Exception
}
String faelligkeitsdatum = settings.getString("faelligkeitsdatum", null);
Date faell = Datum.toDate(faelligkeitsdatum);
Abrechnungsausgabe ct1ausgabe = Abrechnungsausgabe.getByKey(
settings.getInt("ct1ausgabe", Abrechnungsausgabe.SEPA_DATEI.getKey()));
Ct1Ausgabe ct1ausgabe = Ct1Ausgabe.getByKey(
settings.getInt("ct1ausgabe", Ct1Ausgabe.SEPA_DATEI.getKey()));
String verwendungszweck = settings.getString("verwendungszweck", "");
Ct1Ueberweisung ct1ueberweisung = new Ct1Ueberweisung();
int anzahl = ct1ueberweisung.write(abrl, file, faell, ct1ausgabe,
Expand Down
42 changes: 21 additions & 21 deletions src/de/jost_net/JVerein/io/AbrechnungSEPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
**********************************************************************/
package de.jost_net.JVerein.io;

import java.math.RoundingMode;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
Expand Down Expand Up @@ -154,10 +155,12 @@ public AbrechnungSEPA(AbrechnungSEPAParam param, ProgressMonitor monitor)
}

ArrayList<Zahler> z = lastschrift.getZahler();
if (param.abbuchungsausgabe == Abrechnungsausgabe.SEPA_DATEI)
// Wenn keine Buchungen vorhanden sind, wird kein File erzeugt.
if ((param.abbuchungsausgabe == Abrechnungsausgabe.SEPA_DATEI) && !z.isEmpty())
{
writeSepaFile(param, lastschrift, z);
monitor.log(String.format("SEPA-Datei %s geschrieben.", param.sepafileRCUR.getAbsolutePath()));
param.setText(String.format(", SEPA-Datei %s geschrieben.", param.sepafileRCUR.getAbsolutePath()));
}

BigDecimal summemitgliedskonto = new BigDecimal("0");
Expand Down Expand Up @@ -246,8 +249,13 @@ public AbrechnungSEPA(AbrechnungSEPAParam param, ProgressMonitor monitor)
}
if (param.abbuchungsausgabe == Abrechnungsausgabe.HIBISCUS)
{
buchenHibiscus(param, z);
monitor.log("Hibiscus-Lastschrift erzeugt.");
// Wenn keine Buchungen vorhanden sind, wird nichts an Hibiscus �bergeben.
if (z.size() != 0)
{
buchenHibiscus(param, z);
monitor.log("Hibiscus-Lastschrift erzeugt.");
param.setText(String.format(", Hibiscus-Lastschrift erzeugt."));
}
}
if (param.pdffileRCUR != null)
{
Expand Down Expand Up @@ -293,17 +301,17 @@ private void abrechnenMitglieder(AbrechnungSEPAParam param,
{
list.addFilter(
"(zahlungsrhytmus = ? or zahlungsrhytmus = ? or zahlungsrhytmus = ?)",
new Object[] { new Integer(Zahlungsrhythmus.HALBJAEHRLICH),
new Integer(Zahlungsrhythmus.VIERTELJAEHRLICH),
new Integer(Zahlungsrhythmus.MONATLICH) });
new Object[] { Integer.valueOf(Zahlungsrhythmus.HALBJAEHRLICH),
Integer.valueOf(Zahlungsrhythmus.VIERTELJAEHRLICH),
Integer.valueOf(Zahlungsrhythmus.MONATLICH) });
}
if (param.abbuchungsmodus == Abrechnungsmodi.JAVIMO)
{
list.addFilter(
"(zahlungsrhytmus = ? or zahlungsrhytmus = ? or zahlungsrhytmus = ?)",
new Object[] { new Integer(Zahlungsrhythmus.JAEHRLICH),
new Integer(Zahlungsrhythmus.VIERTELJAEHRLICH),
new Integer(Zahlungsrhythmus.MONATLICH) });
new Object[] { Integer.valueOf(Zahlungsrhythmus.JAEHRLICH),
Integer.valueOf(Zahlungsrhythmus.VIERTELJAEHRLICH),
Integer.valueOf(Zahlungsrhythmus.MONATLICH) });
}
if (param.abbuchungsmodus == Abrechnungsmodi.VIMO)
{
Expand Down Expand Up @@ -443,7 +451,7 @@ private JVereinZahler abrechnungMitgliederSub(AbrechnungSEPAParam param, Progres
zahler.setPersonId(m.getID());
zahler.setPersonTyp(JVereinZahlerTyp.MITGLIED);
zahler.setBetrag(
new BigDecimal(betr).setScale(2, BigDecimal.ROUND_HALF_UP));
new BigDecimal(betr).setScale(2, RoundingMode.HALF_UP));
new BIC(m.getBic()); // Pr�fung des BIC
zahler.setBic(m.getBic());
new IBAN(m.getIban()); // Pr�fung der IBAN
Expand Down Expand Up @@ -538,7 +546,7 @@ private void abbuchenZusatzbetraege(AbrechnungSEPAParam param,
zahler.setPersonId(m.getID());
zahler.setPersonTyp(JVereinZahlerTyp.MITGLIED);
zahler.setBetrag(new BigDecimal(z.getBetrag()).setScale(2,
BigDecimal.ROUND_HALF_UP));
RoundingMode.HALF_UP));
new BIC(m.getBic());
new IBAN(m.getIban());
zahler.setBic(m.getBic());
Expand Down Expand Up @@ -615,7 +623,7 @@ private void abbuchenKursteilnehmer(AbrechnungSEPAParam param,
zahler.setPersonId(kt.getID());
zahler.setPersonTyp(JVereinZahlerTyp.KURSTEILNEHMER);
zahler.setBetrag(new BigDecimal(kt.getBetrag()).setScale(2,
BigDecimal.ROUND_HALF_UP));
RoundingMode.HALF_UP));
new BIC(kt.getBic());
new IBAN(kt.getIban());
zahler.setBic(kt.getBic());
Expand Down Expand Up @@ -662,9 +670,6 @@ public void run()

private void writeSepaFile(AbrechnungSEPAParam param, Basislastschrift lastschrift, ArrayList<Zahler> alle_zahler) throws Exception
{
if (alle_zahler.isEmpty()) {
return;
}
Properties ls_properties = new Properties();
ls_properties.setProperty("src.bic", lastschrift.getBIC());
ls_properties.setProperty("src.iban", lastschrift.getIBAN());
Expand Down Expand Up @@ -705,11 +710,6 @@ private void writeSepaFile(AbrechnungSEPAParam param, Basislastschrift lastschri
private void buchenHibiscus(AbrechnungSEPAParam param, ArrayList<Zahler> z)
throws ApplicationException
{
if (z.size() == 0)
{
// Wenn keine Buchungen vorhanden sind, wird nichts an Hibiscus �bergeben.
return;
}
try
{
SepaLastschrift[] lastschriften = new SepaLastschrift[z.size()];
Expand Down Expand Up @@ -838,7 +838,7 @@ private void writeMitgliedskonto(Mitglied mitglied, Date datum, String zweck1,
}
if (buchungsart != null)
{
buchung.setBuchungsart(new Long(buchungsart.getID()));
buchung.setBuchungsart(Long.valueOf(buchungsart.getID()));
}
buchung.store();
}
Expand Down
13 changes: 12 additions & 1 deletion src/de/jost_net/JVerein/io/AbrechnungSEPAParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public class AbrechnungSEPAParam
public final DBService service;

public Konto konto;

private String text = "";

public AbrechnungSEPAParam(AbrechnungSEPAControl ac, File sepafileRCUR, SepaVersion sepaVersion, String pdffileRCUR)
throws ApplicationException, RemoteException
Expand Down Expand Up @@ -143,6 +145,15 @@ public AbrechnungSEPAParam(AbrechnungSEPAControl ac, File sepafileRCUR, SepaVers
{
service = null;
}

}

public String getText()
{
return text;
}

public void setText(String in)
{
text = in;
}
}
9 changes: 4 additions & 5 deletions src/de/jost_net/JVerein/io/Ct1Ueberweisung.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import de.jost_net.JVerein.Variable.AllgemeineMap;
import de.jost_net.JVerein.Variable.LastschriftMap;
import de.jost_net.JVerein.Variable.VarTools;
import de.jost_net.JVerein.keys.Abrechnungsausgabe;
import de.jost_net.JVerein.keys.Ct1Ausgabe;
import de.jost_net.JVerein.rmi.Abrechnungslauf;
import de.jost_net.JVerein.rmi.Lastschrift;
import de.jost_net.JVerein.util.JVDateFormatDATETIME;
Expand Down Expand Up @@ -62,7 +62,7 @@ public Ct1Ueberweisung()
}

public int write(Abrechnungslauf abrl, File file, Date faell,
Abrechnungsausgabe ct1ausgabe, String verwendungszweck) throws Exception
Ct1Ausgabe ct1ausgabe, String verwendungszweck) throws Exception
{
Velocity.init();
switch (ct1ausgabe)
Expand All @@ -72,13 +72,12 @@ public int write(Abrechnungslauf abrl, File file, Date faell,

case HIBISCUS:
return hibiscusausgabe(abrl, file, faell, ct1ausgabe, verwendungszweck);

}
return -1;
}

private int dateiausgabe(Abrechnungslauf abrl, File file, Date faell,
Abrechnungsausgabe ct1ausgabe, String verwendungszweck) throws Exception
Ct1Ausgabe ct1ausgabe, String verwendungszweck) throws Exception
{
ueb = new Ueberweisung();
ueb.setAusfuehrungsdatum(faell);
Expand Down Expand Up @@ -107,7 +106,7 @@ private int dateiausgabe(Abrechnungslauf abrl, File file, Date faell,
}

private int hibiscusausgabe(Abrechnungslauf abrl, File file, Date faell,
Abrechnungsausgabe ct1ausgabe, String verwendungszweck) throws Exception
Ct1Ausgabe ct1ausgabe, String verwendungszweck) throws Exception
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/de/jost_net/JVerein/keys/Abrechnungsausgabe.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public enum Abrechnungsausgabe
{

SEPA_DATEI(1, "Datei"), HIBISCUS(2, "Hibiscus");
SEPA_DATEI(1, "Datei"), HIBISCUS(2, "Hibiscus"), KEINE_DATEI(3, "Keine");
private final String text;

private final int key;
Expand Down
63 changes: 63 additions & 0 deletions src/de/jost_net/JVerein/keys/Ct1Ausgabe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**********************************************************************
* 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/>.
*
* heiner@jverein.de
* www.jverein.de
**********************************************************************/
package de.jost_net.JVerein.keys;

/**
* Abrechnungsausgabe
*/
public enum Ct1Ausgabe
{

SEPA_DATEI(1, "Datei"), HIBISCUS(2, "Hibiscus");
private final String text;

private final int key;

Ct1Ausgabe(int key, String text)
{
this.key = key;
this.text = text;
}

public int getKey()
{
return key;
}

public String getText()
{
return text;
}

public static Ct1Ausgabe getByKey(int key)
{
for (Ct1Ausgabe ara : Ct1Ausgabe.values())
{
if (ara.getKey() == key)
{
return ara;
}
}
return null;
}

@Override
public String toString()
{
return getText();
}
}