summaryrefslogtreecommitdiff
path: root/app/income/parser.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-09-27 11:33:59 -0500
committerluxagraf <sng@luxagraf.net>2018-09-27 11:33:59 -0500
commit1596c642731e5839da942c7727bbc1fa8016fdee (patch)
treec8630e2332d4e40a3335a67f1931462eb020c700 /app/income/parser.py
parentefabaed1ef7ec2baafabed9dfd3c08dc192d98bd (diff)
version 9 of stylesheet
Diffstat (limited to 'app/income/parser.py')
-rw-r--r--app/income/parser.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/income/parser.py b/app/income/parser.py
new file mode 100644
index 0000000..9524902
--- /dev/null
+++ b/app/income/parser.py
@@ -0,0 +1,19 @@
+with open('timesheet.csv', newline='') as csvfile:
+ reader = csv.reader(csvfile, delimiter=';')
+ counter = 0
+ f = "%Y-%m-%d %H:%M:%S"
+ for row in reader:
+ if counter > 0:
+ timer = row[0]+' '+row[1]
+ timerer = row[0]+' '+row[2]
+ time_start = datetime.datetime.strptime(timer, f)
+ time_end = datetime.datetime.strptime(timerer, f)
+ print(row[4])
+ print(timerer, time_end)
+ InvoiceItem.objects.get_or_create(
+ time_start=time_start,
+ time_end=time_end,
+ work_done=row[4]
+ )
+ counter = counter +1
+f = "%Y-%m-%d %H:%M:%S"