summaryrefslogtreecommitdiffstats
path: root/invoice
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2013-01-03 02:09:58 +0100
committerSebastian Reichel <sre@ring0.de>2013-01-03 02:09:58 +0100
commitb1d535bd60818ecb253f6cf19b0e1ec9a8ca4e65 (patch)
treea49528a0e6b332cd87f94a11e9b2616ae7b60e3c /invoice
parent01739552b828669de053fb2f8ae924c18aeba4b9 (diff)
downloadserial-barcode-scanner-b1d535bd60818ecb253f6cf19b0e1ec9a8ca4e65.tar.bz2
use calendar month for monthly invoice
Diffstat (limited to 'invoice')
-rwxr-xr-xinvoice/generate-invoice.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py
index cccebff..c84fa9d 100755
--- a/invoice/generate-invoice.py
+++ b/invoice/generate-invoice.py
@@ -304,20 +304,12 @@ def daily(timestamp = time.time()):
def monthly(timestamp = time.time()):
requested = datetime.datetime.fromtimestamp(timestamp)
- # timestamps for previous month
- dstop = requested.replace(hour = 8, minute = 0, second = 0, day = 16) - datetime.timedelta(seconds = 1)
- if dstop > requested:
- if dstop.month > 1:
- dstop = dstop.replace(month = dstop.month -1)
- else:
- dstop = dstop.replace(month = 12)
- if dstop.month > 1:
- dstart = dstop.replace(month = dstop.month -1)
- else:
- dstart = dstop.replace(month = 12)
- stop = int(dstop.strftime("%s"))
- start = int(dstart.strftime("%s"))
+ # timestamps for previous month
+ dstop = requested.replace(hour = 0, minute = 0, second = 0, day = 1) - datetime.timedelta(seconds = 1)
+ dstart = dstop.replace(day = 1, hour = 0, minute = 0, second = 0)
+ stop = int(dstop.strftime("%s"))
+ start = int(dstart.strftime("%s"))
title = "Getränkerechnung %04d/%02d" % (dstart.year, dstart.month)
number = 0