diff options
author | Sebastian Reichel <sre@ring0.de> | 2013-01-03 02:04:39 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2013-01-03 02:04:39 +0100 |
commit | 01739552b828669de053fb2f8ae924c18aeba4b9 (patch) | |
tree | 002accbe8246740ad7343a982aa5945f57f26a69 | |
parent | 8f0e8e52887795199309edf114a849a7784451b2 (diff) | |
download | serial-barcode-scanner-01739552b828669de053fb2f8ae924c18aeba4b9.tar.bz2 |
fix december invoice
-rwxr-xr-x | invoice/generate-invoice.py | 11 |
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")) |