ajout de system impression team_pdf

This commit is contained in:
Ambulance Clerc
2022-09-26 10:44:57 +02:00
parent 708c1a5bc5
commit 58a789643d
3 changed files with 59 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ BLACK = (0, 0, 0)
class PDF(FPDF):
o_caldav = None
caldavClient = None
start = None
end = None
def init_date(self,date):
@@ -47,6 +48,7 @@ class PDF(FPDF):
def draw_week(self):
self.set_font('Arial', '', 10)
self.caldavClient.get_events_by_date(self.caldavClient.a_team, self.start)
self.ln()
days_fr = ["Lundi","Mardi","Mercredi","Jeudi", "Vendredi", "Samedi", "Dimanche"]
@@ -55,7 +57,9 @@ class PDF(FPDF):
tmp_y = self.get_y()
max_y = tmp_y
dt = self.start + timedelta(days=d)
self.o_caldav.get_caldav_data(periode=1, date=dt)
self.o_caldav.sort_array_by_key(reverse=True)
self.cell(w=50, h=5, align="L", txt=f"{days_fr[d]} {dt.strftime('%d.%m.%Y')}", ln=0)
self.cell(w=60, h=5, align="L", txt=f"Jour", ln=1, border="B")
@@ -73,9 +77,8 @@ class PDF(FPDF):
self.cell(w=115, h=5, align="L", txt=f"", ln=0)
self.cell(w=75, h=5, align="L", txt=f"Nuit", ln=1, border="B")
for item in self.o_caldav.night:
print(f"If NUIT [{item.str_start_date}]<> [{dt.strftime('%d.%m')}]")
if item.str_start_date != dt.strftime('%d.%m'):
print("pass")
continue
self.set_fill_color(255,143,0)
@@ -99,9 +102,10 @@ class PDF(FPDF):
def render_pdf(caldav_object, date=None):
def render_pdf(caldav_object,caldavClient, date=None):
pdf = PDF(orientation='P', unit='mm', format='A4')
pdf.o_caldav = caldav_object
pdf.caldavClient = caldavClient
pdf.init_date(date)
pdf.set_margins(4,2,4)
pdf.add_page()