Skip to content

Commit

Permalink
Umsatzsteueroption (#134)
Browse files Browse the repository at this point in the history
* Add tax calculation

add columns steuersatz, steuerbetrag in table mitgliedskonto
add availability to print steuersatz and steuerbetrag in bills PDF
calculate steuerbtrag in Abrechnungslauf
show steuersatz and steuerbetrag in Abrechnungslauf view

* Cleanup on tax caclulation

* Update tax calculation

Add bill amount without taxes (nettobetrag)

* Bugfix tax calculation

Fix calulations of taxes nettobetrag and steuerbetrag

* Bugfix tax calculation in member bill account

Bugfix in member bill account
Beautify form preview taxes and values

* code cleanup

* Change wording Summe to USt.

* Add Umsatzsteueroption in settings

Change sum wording in forms if tax option is set to true

* Format sum of taxes wording

* Format taxes

Taxes are now in align right

* Fix: Set tax rate if buchungsart != null

* Fix: Allow null values for nettobetrag, steuersatz, steuerbetrag in database

* Zeige Tabellenspalten nur bei gesetzter Umsatzsteueroption

---------

Co-authored-by: Alexander Dippe <info@dippe-it.de>
  • Loading branch information
dippeal and Alexander Dippe committed Feb 1, 2024
1 parent 6e0a025 commit b66e8bb
Show file tree
Hide file tree
Showing 17 changed files with 308 additions and 49 deletions.
64 changes: 32 additions & 32 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="junit/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="src" path="/jameica"/>
<classpathentry kind="lib" path="lib/nc.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javax.mail-1.6.2.jar"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/hibiscus"/>
<classpathentry exported="true" kind="lib" path="lib/activation.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/obantoo-bin-2.1.12.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bsh-core-2.0b4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/csvjdbc.jar"/>
<classpathentry exported="true" kind="lib" path="lib/itext-hyph-xml.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jollyday-0.4.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/joda-time-2.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/snakeyaml-1.13.jar"/>
<classpathentry exported="true" kind="lib" path="/jameica/lib/swt/win64/swt.jar" sourcepath="/jameica/lib.src/swt/linux/swt.src.zip"/>
<classpathentry exported="true" kind="lib" path="lib/junit-4.8.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javase-3.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/core-3.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="/jameica/lib/de_willuhn_ds/de_willuhn_ds.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/super-csv-2.4.0.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/itext-pdfa-5.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/itextpdf-5.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/freemarker-2.3.23.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jsoup-1.8.3.jar"/>
<classpathentry kind="lib" path="lib/vinnie-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/ez-vcard-0.10.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="junit/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="src" path="/jameica"/>
<classpathentry kind="lib" path="lib/nc.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javax.mail-1.6.2.jar"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/hibiscus"/>
<classpathentry exported="true" kind="lib" path="lib/activation.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/obantoo-bin-2.1.12.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bsh-core-2.0b4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/csvjdbc.jar"/>
<classpathentry exported="true" kind="lib" path="lib/itext-hyph-xml.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jollyday-0.4.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/joda-time-2.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/snakeyaml-1.13.jar"/>
<classpathentry exported="true" kind="lib" path="/jameica/lib/swt/win64/swt.jar" sourcepath="/jameica/lib.src/swt/linux/swt.src.zip"/>
<classpathentry exported="true" kind="lib" path="lib/junit-4.8.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javase-3.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/core-3.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="/jameica/lib/de_willuhn_ds/de_willuhn_ds.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/super-csv-2.4.0.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/itext-pdfa-5.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="/hibiscus/lib/itextpdf-5.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/freemarker-2.3.23.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jsoup-1.8.3.jar"/>
<classpathentry kind="lib" path="lib/vinnie-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/ez-vcard-0.10.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
34 changes: 31 additions & 3 deletions src/de/jost_net/JVerein/Variable/MitgliedskontoMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
package de.jost_net.JVerein.Variable;

import java.rmi.RemoteException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.gui.control.FormularfeldControl;
import de.jost_net.JVerein.rmi.Mitgliedskonto;
import de.jost_net.JVerein.util.JVDateFormatTTMMJJJJ;
import de.willuhn.jameica.gui.formatter.CurrencyFormatter;
import de.willuhn.jameica.gui.formatter.DateFormatter;

public class MitgliedskontoMap
{
Expand All @@ -49,9 +54,15 @@ public Map<String, Object> getMap(ArrayList<Mitgliedskonto> mk,
ArrayList<Date> buda = new ArrayList<>();
ArrayList<String> zg = new ArrayList<>();
ArrayList<String> zg1 = new ArrayList<>();
ArrayList<Double> nettobetrag = new ArrayList<>();
ArrayList<String> steuersatz = new ArrayList<>();
ArrayList<Double> steuerbetrag = new ArrayList<>();
ArrayList<Double> betrag = new ArrayList<>();
ArrayList<Double> ist = new ArrayList<>();
ArrayList<Double> differenz = new ArrayList<>();

DecimalFormat format = new DecimalFormat("0");
CurrencyFormatter formatter = new CurrencyFormatter("%",format);
double summe = 0;
double saldo = 0;
double suist = 0;
Expand All @@ -60,7 +71,10 @@ public Map<String, Object> getMap(ArrayList<Mitgliedskonto> mk,
buda.add(mkto.getDatum());
zg.add(mkto.getZweck1());
zg1.add(mkto.getZweck1());
betrag.add(new Double(mkto.getBetrag()));
nettobetrag.add(Double.valueOf(mkto.getNettobetrag()));
steuersatz.add("("+formatter.format(Double.valueOf(mkto.getSteuersatz()))+")");
steuerbetrag.add(Double.valueOf(mkto.getSteuerbetrag()));
betrag.add(Double.valueOf(mkto.getBetrag()));
ist.add(mkto.getIstSumme());
suist += mkto.getIstSumme();
differenz.add(mkto.getBetrag() - mkto.getIstSumme());
Expand All @@ -69,8 +83,16 @@ public Map<String, Object> getMap(ArrayList<Mitgliedskonto> mk,
}
if (buda.size() > 1)
{
zg1.add("Summe");
zg.add("Summe");
if (Einstellungen.getEinstellung().getOptiert())
{
zg1.add("Rechnungsbetrag inkl. USt.");
zg.add("Rechnungsbetrag inkl. USt.");
}
else
{
zg1.add("Summe");
zg.add("Summe");
}
betrag.add(summe);
differenz.add(saldo);
ist.add(suist);
Expand All @@ -82,6 +104,9 @@ public Map<String, Object> getMap(ArrayList<Mitgliedskonto> mk,
map.put(MitgliedskontoVar.BUCHUNGSDATUM.getName(), buda.toArray());
map.put(MitgliedskontoVar.ZAHLUNGSGRUND.getName(), zg.toArray());
map.put(MitgliedskontoVar.ZAHLUNGSGRUND1.getName(), zg1.toArray());
map.put(MitgliedskontoVar.NETTOBETRAG.getName(), nettobetrag.toArray());
map.put(MitgliedskontoVar.STEUERSATZ.getName(), steuersatz.toArray());
map.put(MitgliedskontoVar.STEUERBETRAG.getName(), steuerbetrag.toArray());
map.put(MitgliedskontoVar.BETRAG.getName(), betrag.toArray());
map.put(MitgliedskontoVar.IST.getName(), ist.toArray());
map.put(MitgliedskontoVar.DIFFERENZ.getName(), differenz.toArray());
Expand All @@ -106,6 +131,9 @@ public Map<String, Object> getMap(Mitgliedskonto mk, Map<String, Object> inma)
map.put(MitgliedskontoVar.BUCHUNGSDATUM.getName(), mk.getDatum());
map.put(MitgliedskontoVar.ZAHLUNGSGRUND.getName(), mk.getZweck1());
map.put(MitgliedskontoVar.ZAHLUNGSGRUND1.getName(), mk.getZweck1());
map.put(MitgliedskontoVar.NETTOBETRAG.getName(), mk.getNettobetrag());
map.put(MitgliedskontoVar.STEUERSATZ.getName(), mk.getSteuersatz());
map.put(MitgliedskontoVar.STEUERBETRAG.getName(), mk.getSteuerbetrag());
map.put(MitgliedskontoVar.BETRAG.getName(), mk.getBetrag());
map.put(MitgliedskontoVar.IST.getName(), mk.getIstSumme());
map.put(MitgliedskontoVar.DIFFERENZ.getName(),
Expand Down
3 changes: 3 additions & 0 deletions src/de/jost_net/JVerein/Variable/MitgliedskontoVar.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public enum MitgliedskontoVar
ZAHLUNGSGRUND1("mitgliedskonto_zahlungsgrund1"), //
ZAHLUNGSGRUND2("mitgliedskonto_zahlungsgrund2"), //
BUCHUNGSDATUM("mitgliedskonto_buchungsdatum"), //
NETTOBETRAG("mitgliedskonto_nettobetrag"), //
STEUERSATZ("mitgliedskonto_steuersatz"), //
STEUERBETRAG("mitgliedskonto_steuerbetrag"), //
BETRAG("mitgliedskonto_betrag"), //
IST("mitgliedskonto_ist"), //
DIFFERENZ("mitgliedskonto_differenz"), //
Expand Down
56 changes: 46 additions & 10 deletions src/de/jost_net/JVerein/gui/action/FormularAnzeigeAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import java.io.File;
import java.io.IOException;
import java.rmi.RemoteException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;

import com.schlevoigt.JVerein.util.Misc;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.Variable.AllgemeineMap;
import de.jost_net.JVerein.Variable.AllgemeineVar;
Expand All @@ -44,6 +47,7 @@
import de.jost_net.JVerein.util.JVDateFormatTTMMJJJJ;
import de.jost_net.JVerein.util.StringTool;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.formatter.CurrencyFormatter;
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;
import jonelo.NumericalChameleon.SpokenNumbers.GermanNumber;
Expand Down Expand Up @@ -251,36 +255,68 @@ public void handleAction(Object context) throws ApplicationException
ArrayList<Date> buda = new ArrayList<>();
ArrayList<String> zg = new ArrayList<>();
ArrayList<String> zg1 = new ArrayList<>();
ArrayList<Double> nettobetrag = new ArrayList<>();
ArrayList<String> steuersatz = new ArrayList<>();
ArrayList<Double> steuerbetrag = new ArrayList<>();
ArrayList<Double> betrag = new ArrayList<>();
ArrayList<Double> ist = new ArrayList<>();
ArrayList<Double> differenz = new ArrayList<>();

// Buchung 1
buda.add(new Date());
zg.add("Testverwendungszweck");
zg1.add("Testverwendungszweck");
betrag.add(150.10d);

DecimalFormat format = new DecimalFormat("0");
CurrencyFormatter formatter = new CurrencyFormatter("%",format);

double steuer = 7d;
steuersatz.add("("+formatter.format(steuer)+")");
double netto = 200d / (1d + (steuer / 100d));
nettobetrag.add(netto);
steuerbetrag.add(200d - netto);
betrag.add(200d);
ist.add(0d);
differenz.add(-150.10d);
differenz.add(-200d);

// Buchung 2
buda.add(new Date());
zg.add("2. Verwendungszweck");
zg1.add("2. Verwendungszweck");
betrag.add(10d);
ist.add(5d);
differenz.add(-5d);
steuer = 19d;
steuersatz.add("("+formatter.format(steuer)+")");
netto = 49.99d / (1d + (steuer / 100d));
nettobetrag.add(netto);
steuerbetrag.add(49.99d - netto);
betrag.add(49.99d);
ist.add(10d);
differenz.add(-39.99d);

// Summe
zg1.add("Summe");
zg.add("Summe");
betrag.add(160.1d);
differenz.add(155.1d);
ist.add(5d);
if (Einstellungen.getEinstellung().getOptiert())
{
zg1.add("Rechnungsbetrag inkl. USt.");
zg.add("Rechnungsbetrag inkl. USt.");
}
else
{
zg1.add("Summe");
zg.add("Summe");
}
betrag.add(249.99d);
differenz.add(239.99d);
ist.add(10d);

map.put(FormularfeldControl.BUCHUNGSDATUM, buda.toArray());
map.put(FormularfeldControl.ZAHLUNGSGRUND, zg.toArray());
map.put(FormularfeldControl.ZAHLUNGSGRUND1, zg1.toArray());
map.put(FormularfeldControl.BETRAG, betrag.toArray());
map.put(MitgliedskontoVar.BUCHUNGSDATUM.getName(), buda.toArray());
map.put(MitgliedskontoVar.ZAHLUNGSGRUND.getName(), zg.toArray());
map.put(MitgliedskontoVar.ZAHLUNGSGRUND1.getName(), zg1.toArray());
map.put(MitgliedskontoVar.NETTOBETRAG.getName(), nettobetrag.toArray());
map.put(MitgliedskontoVar.STEUERSATZ.getName(), steuersatz.toArray());
map.put(MitgliedskontoVar.STEUERBETRAG.getName(), steuerbetrag.toArray());
map.put(MitgliedskontoVar.BETRAG.getName(), betrag.toArray());
map.put(MitgliedskontoVar.IST.getName(), ist.toArray());
map.put(MitgliedskontoVar.DIFFERENZ.getName(), differenz.toArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,22 @@ public Part getSollbuchungsList() throws RemoteException

SollbuchungsList.addColumn("Mitglied", "mitglied");
SollbuchungsList.addColumn("Zweck", "zweck1");
SollbuchungsList.addColumn("Betrag", "betrag",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
if (Einstellungen.getEinstellung().getOptiert())
{
SollbuchungsList.addColumn("Nettobetrag", "nettobetrag",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
SollbuchungsList.addColumn("Steuersatz", "steuersatz",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
SollbuchungsList.addColumn("Steuerbetrag", "steuerbetrag",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
SollbuchungsList.addColumn("Bruttobetrag", "betrag",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
}
else
{
SollbuchungsList.addColumn("Betrag", "betrag",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
}
SollbuchungsList.addColumn("Eingang", "istsumme",
new CurrencyFormatter("", Einstellungen.DECIMALFORMAT));
SollbuchungsList.addColumn("Zahlungsweg", "zahlungsweg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public Object extract(ResultSet rs) throws SQLException

CurrencyFormatter cf = new CurrencyFormatter("EUR",
Einstellungen.DECIMALFORMAT);
String s = String.format("Anzahl: %s; Summe %s", data.anzahl.toString(),
String s = String.format("Anzahl: %s; Summe: %s", data.anzahl.toString(),
cf.format(data.summe));
statistikbuchungen = new LabelInput(s);
statistikbuchungen.setName("Buchungen");
Expand Down Expand Up @@ -309,7 +309,7 @@ public Object extract(ResultSet rs) throws SQLException

CurrencyFormatter cf = new CurrencyFormatter("EUR",
Einstellungen.DECIMALFORMAT);
String s = String.format("Anzahl: %s; Summe %s", data.anzahl.toString(),
String s = String.format("Anzahl: %s; Summe: %s", data.anzahl.toString(),
cf.format(data.summe));
statistiklastschriften = new LabelInput(s);
statistiklastschriften.setName("Lastschriften");
Expand Down
14 changes: 14 additions & 0 deletions src/de/jost_net/JVerein/gui/control/EinstellungControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public class EinstellungControl extends AbstractControl

private CheckboxInput abrlabschliessen;

private CheckboxInput optiert;

/**
* Verschlüsselte Datei für besonders sensible Daten (Passwörter)
*/
Expand Down Expand Up @@ -760,6 +762,17 @@ public IntegerInput getZaehlerLaenge() throws RemoteException
}
return zaehlerlaenge;
}

public CheckboxInput getOptiert() throws RemoteException
{
if (optiert != null)
{
return optiert;
}
optiert = new CheckboxInput(Einstellungen.getEinstellung().getOptiert());
optiert.setName("Umsatzsteueroption");
return optiert;
}

public CheckboxInput getExterneMitgliedsnummer() throws RemoteException
{
Expand Down Expand Up @@ -1927,6 +1940,7 @@ public void handleStoreBuchfuehrung()
Integer ulength = (Integer) unterdrueckunglaenge.getValue();
e.setUnterdrueckungLaenge(ulength);
e.setKontonummerInBuchungsliste((Boolean) kontonummer_in_buchungsliste.getValue());
e.setOptiert((Boolean) getOptiert().getValue());
e.store();
Einstellungen.setEinstellung(e);

Expand Down
10 changes: 10 additions & 0 deletions src/de/jost_net/JVerein/gui/control/MitgliedskontoControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,20 @@ public void handleStore()
Zahlungsweg zw = (Zahlungsweg) getZahlungsweg().getValue();
mkto.setZahlungsweg(zw.getKey());
mkto.setZweck1((String) getZweck1().getValue());

double steuersatz = 0d;
if (getBuchungsart().getValue() != null)
{
mkto.setBuchungsart((Buchungsart) getBuchungsart().getValue());
Buchungsart bart = mkto.getBuchungsart();
steuersatz = bart.getSteuersatz();
}
// Update taxes and netto amount
mkto.setSteuersatz(steuersatz);
double netto = ((Double) getBetrag().getValue() / (1d + (steuersatz / 100d)));
mkto.setNettobetrag(netto);
mkto.setSteuerbetrag((Double) getBetrag().getValue() - netto);

mkto.store();
GUI.getStatusBar().setSuccessText("Mitgliedskonto gespeichert");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void bind() throws Exception
cont.addInput(control.getAutomatischeBuchungskorrekturHibiscus());
cont.addInput(control.getUnterdrueckungOhneBuchung());
cont.addInput(control.getKontonummerInBuchungsliste());
cont.addInput(control.getOptiert());

ButtonArea buttons = new ButtonArea();
buttons.addButton("Hilfe", new DokumentationAction(),
Expand Down
9 changes: 9 additions & 0 deletions src/de/jost_net/JVerein/io/AbrechnungSEPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,19 @@ private void writeMitgliedskonto(Mitglied mitglied, Date datum, String zweck1,
mk.setDatum(datum);
mk.setMitglied(mitglied);
mk.setZweck1(zweck1);
double steuersatz = 0d;
if (buchungsart != null)
{
mk.setBuchungsart(buchungsart);
steuersatz = buchungsart.getSteuersatz();
}
// Set tax rate
mk.setSteuersatz(steuersatz);
// Set bill amount without taxes
double nettobetrag = (steuersatz != 0d) ? (betrag / (1d + (steuersatz / 100d))) : betrag;
mk.setNettobetrag(nettobetrag);
// Set tax amount
mk.setSteuerbetrag(betrag - nettobetrag);
mk.store();
}
if (haben)
Expand Down

0 comments on commit b66e8bb

Please sign in to comment.