tempo-to-invoice-generator/invoice.py

42 lines
874 B
Python
Raw Normal View History

2024-12-15 15:02:08 -06:00
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2024 Jacob Babor <jacob@babor.tech>
#
# 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 }')