Reorganize project structure

This commit is contained in:
Markus Zimmerberger
2024-11-19 09:22:39 +01:00
parent 48d06341ef
commit 7d76e217f1
13 changed files with 142 additions and 68 deletions
+50
View File
@@ -0,0 +1,50 @@
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
import yaml
with open("config.yaml", encoding='utf8') as f:
cfg = yaml.load(f, Loader=yaml.FullLoader)
locale.setlocale(locale.LC_ALL, 'de_DE')
gc = gspread.service_account()
sh = gc.open('Zeiterfassung alle Projekte')
worksheet = sh.worksheet(cfg['worksheet_name'])
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}" """