Workin on it
This commit is contained in:
parent
d07a87c863
commit
506e6dd377
41
invoice.py
Executable file
41
invoice.py
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#! /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 }')
|
Loading…
Reference in New Issue
Block a user