summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Rudolph <johannes.rudolph@gmx.com>2018-01-02 13:59:53 +0100
committerSebastian Reichel <sre@ring0.de>2018-06-28 01:52:53 +0200
commitf6f85e718f9ade5453468a69441ea3b103d1e100 (patch)
tree0f37231189e25ff4e3dba430b9e5125fdddb7625
parent207e77c7cbab87f3bf537dd11ca391f12df01129 (diff)
downloadserial-barcode-scanner-f6f85e718f9ade5453468a69441ea3b103d1e100.tar.bz2
invoice: add CSV for jVerein
This adds one more CSV to be used with jVerein's "Zusatzbeiträge" feature.
-rw-r--r--example.cfg2
-rw-r--r--src/invoice/invoice.vala17
2 files changed, 18 insertions, 1 deletions
diff --git a/example.cfg b/example.cfg
index 628d73f..27172b1 100644
--- a/example.cfg
+++ b/example.cfg
@@ -30,3 +30,5 @@ addressrow = Kreativität trifft Technik e.V., Bahnhofsplatz 10, 26122 Oldenburg
footer1 = <b>Kreativität trifft Technik e.V.</b>\nAmtsgericht Oldenburg VR 201044\n\nHackspace „Mainframe“\nFabLab „Fab-O-Lab“\nSchnittstelle „Schnittstelle“\n\nBahnhofsplatz 10 • 26122 Oldenburg
footer2 = <b>Raiffeisenbank Oldenburg</b>\nIBAN: DE34 2806 0228 0037 0185 00\nBIC: GENODEF1OL2\n\n\n<b>Finanzamt Oldenburg</b>\nAls gemeinnützig anerkannt.\nSteuer Nr.: 64/220/18413
footer3 = <b>Mail:</b> vorstand@kreativitaet-trifft-technik.de\n<b>Web:</b> www.kreativitaet-trifft-technik.de\n\n\n\n<b>BGB-Vorstand:</b>\nPatrick Günther, Jan Janssen, Andre Schäfer, Lars Hüsemann
+[JVEREIN]
+membership_number = intern
diff --git a/src/invoice/invoice.vala b/src/invoice/invoice.vala
index 68710ca..ce47c7b 100644
--- a/src/invoice/invoice.vala
+++ b/src/invoice/invoice.vala
@@ -37,6 +37,7 @@ public class InvoiceImplementation {
string shortname;
string spacename;
string vat;
+ string jverein_membership_number;
public InvoiceImplementation() throws IOError, KeyFileError {
mailer = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Mail", "/io/mainframe/shopsystem/mailer");
@@ -49,6 +50,7 @@ public class InvoiceImplementation {
shortname = cfg.get_string("GENERAL", "shortname");
spacename = cfg.get_string("GENERAL", "spacename");
vat = cfg.get_string("INVOICE", "vat");
+ jverein_membership_number = cfg.get_string("JVEREIN", "membership_number");
}
public void send_invoice(bool temporary, int64 timestamp, int user) throws IOError, InvoicePDFError, DatabaseError {
@@ -121,9 +123,13 @@ public class InvoiceImplementation {
public void send_invoices(bool temporary, int64 timestamp) throws IOError, InvoicePDFError, DatabaseError {
int64 prevtimestamp = timestamp - day_in_seconds;
+ string due_date_string = "";
- if(!temporary)
+ if(!temporary) {
prevtimestamp = new DateTime.from_unix_local(timestamp).add_months(-1).to_unix();
+ var due_date = new DateTime.from_unix_local(timestamp).add_days(10);
+ due_date_string = due_date.format("%d.%m.%Y");
+ }
Timespan ts = get_timespan(temporary, prevtimestamp);
Timespan tst = get_timespan(false, prevtimestamp);
@@ -149,6 +155,13 @@ public class InvoiceImplementation {
treasurer_mail.subject = mailtitle;
treasurer_mail.add_recipient({"Schatzmeister", treasurermailaddress}, RecipientType.TO);
var csvinvoicedata = "";
+ var csvjvereininvoicedata = "";
+ if(jverein_membership_number == "extern") {
+ csvjvereininvoicedata = "Ext_Mitglieds_Nr;Betrag;Buchungstext;Fälligkeit;Intervall;Endedatum";
+ }
+ else {
+ csvjvereininvoicedata = "Mitglieds_Nr;Betrag;Buchungstext;Fälligkeit;Intervall;Endedatum";
+ }
foreach(var userid in users) {
number++;
@@ -175,12 +188,14 @@ public class InvoiceImplementation {
if(!temporary) {
treasurer_mail.add_attachment(invoicedata.pdffilename, "application/pdf", invoicedata.pdfdata);
csvinvoicedata += @"$(userdata.id),$(userdata.lastname),$(userdata.firstname),$invoiceid,$total_sum\n";
+ csvjvereininvoicedata += @"$(userdata.id);$total_sum;Shopsystem Rechnung Nummer $invoiceid;$due_date_string;0;$due_date_string\n";
}
}
if(!temporary) {
treasurer_mail.set_main_part(get_treasurer_text(), MessageType.PLAIN);
treasurer_mail.add_attachment("invoice.csv", "text/csv; charset=utf-8", csvinvoicedata.data);
+ treasurer_mail.add_attachment("jvereininvoice.csv", "text/csv; charset=utf-8", csvjvereininvoicedata.data);
mailer.send_mail(treasurer_path);
}
}