From 506e6dd377776638509a28012c51647786412e38 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Sun, 15 Dec 2024 15:02:08 -0600 Subject: [PATCH] Workin on it --- invoice.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 invoice.py diff --git a/invoice.py b/invoice.py new file mode 100755 index 0000000..daadd17 --- /dev/null +++ b/invoice.py @@ -0,0 +1,41 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# vim:fenc=utf-8 +# +# Copyright © 2024 Jacob Babor +# +# Distributed under terms of the MIT license. + +from csv import DictReader +from datetime import date +import glob +import re +import requests +import textwrap + +rate = float(41.00) +timesheet = {} + +csv = glob.glob('*.csv') +if not csv: + print('No csv found!') + quit() + +with open(csv[0], 'r') as csv: + items = DictReader(csv) + for row in items: + issue = row["Issue Key"] + date = row["Work date"] + hours = float(row["Hours"]) + + if not date in timesheet.keys(): + timesheet[date] = {} + + if not issue in timesheet[date].keys(): + timesheet[date][issue] = 0 + + timesheet[date][issue] += hours +for k,v in timesheet.items(): + print(k) + for i,h in v.items(): + print(f'{ i } - { h }')