initial commit

This commit is contained in:
Markus Zimmerberger
2024-02-26 15:40:47 +01:00
commit 3eac6f838a
8 changed files with 240 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.utils import ImageReader
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle
import gspread
import csv
import locale
import datetime
locale.setlocale(locale.LC_ALL, 'de_DE')
gc = gspread.service_account()
sh = gc.open('Zeiterfassung alle Projekte')
worksheet = sh.worksheet('Dezember 2023')
invoice_nr = 'R000543'
# read the whole sheet
list_of_dicts = worksheet.get_all_records(numericise_ignore=['all'])
doc = SimpleDocTemplate(f"{invoice_nr}.pdf", pagesize=A4)
# container for the 'Flowable' objects
elements = []
data= [['00', '01', '02', '03', '04'],
['10', '11', '12', '13', '14'],
['20', '21', '22', '23', '24'],
['30', '31', '32', '33', '34']]
t = Table(data)
t.setStyle(TableStyle([('BACKGROUND',(1,1),(-2,-2),colors.green),
('TEXTCOLOR',(0,0),(1,-1),colors.red)]))
elements.append(t)
# write the document to disk
doc.build(elements)
""" for key in ["wgwr3", "wgwr_service", "dkarb", "bauwb"]:
elsap_id = list_of_dicts[2].get(f"sum_{key}")
if elsap_id != "":
#elsap_id = worksheet.acell('H3').value #'2061818_00030_0000000020'
csvexport_filename = f"{datetime.date.today().strftime('%Y_%m')}_01_{elsap_id}_{username}" """