summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2013-01-03 02:04:39 +0100
committerSebastian Reichel <sre@ring0.de>2013-01-03 02:04:39 +0100
commit01739552b828669de053fb2f8ae924c18aeba4b9 (patch)
tree002accbe8246740ad7343a982aa5945f57f26a69
parent8f0e8e52887795199309edf114a849a7784451b2 (diff)
downloadserial-barcode-scanner-01739552b828669de053fb2f8ae924c18aeba4b9.tar.bz2
fix december invoice
-rwxr-xr-xinvoice/generate-invoice.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py
index 452d23f..cccebff 100755
--- a/invoice/generate-invoice.py
+++ b/invoice/generate-invoice.py
@@ -307,8 +307,15 @@ def monthly(timestamp = time.time()):
# timestamps for previous month
dstop = requested.replace(hour = 8, minute = 0, second = 0, day = 16) - datetime.timedelta(seconds = 1)
if dstop > requested:
- dstop = dstop.replace(month = dstop.month -1)
- dstart = dstop.replace(month = dstop.month -1)
+ 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"))