-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpol_report.py
59 lines (53 loc) · 2.07 KB
/
pol_report.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import config
import mailer
import datetime
import dbcon
from dateutil.relativedelta import *
personen = dbcon.personen()
abteilungsconfig = dbcon.abteilungsconfig()
for p in dbcon.persons_pol():
person = {}
person["id"] = str(p[0])
person["abteilung"] = str(p[1])
person["anrede"] = str(p[2])
person["name"] = str(p[3])
person["vorname"] = p[4]
person["pruefokdat"] = "N/A"
person["pruefnextdat"] = "N/A"
person["ungueltig"] = ""
pruefokdat = dbcon.pruefokdat_pol(p[0])
if isinstance(pruefokdat[0], datetime.date):
person["pruefokdat"] = pruefokdat[0].isoformat()
pruefnextdat = dbcon.pruefnextdat_pol(person["id"], pruefokdat)
if isinstance(pruefnextdat[0], datetime.date):
person["pruefnextdat"] = pruefnextdat[0].isoformat()
today = datetime.date.today()
if pruefnextdat[0] < today :
person["ungueltig"] = "<font color=red>ungültig</font>"
else:
if pruefnextdat[0] < today+relativedelta(months=3) :
person["ungueltig"] = "<font color=orange>einholen!</font>"
else:
person["pruefnextdat"] = "N/A"
person["ungueltig"] = "<font color=red>ungültig</font>"
else :
pruefnextdat = dbcon.pruefnextdat_pol(person["id"])
if isinstance(pruefnextdat[0], datetime.date):
person["pruefnextdat"] = pruefnextdat[0].isoformat()
today = datetime.date.today()
if pruefnextdat[0] < today :
person["ungueltig"] = "<font color=red>ungültig</font>"
else:
if pruefnextdat[0] < today+relativedelta(months=3) :
person["ungueltig"] = "<font color=orange>einholen!</font>"
else :
person["pruefnextdat"] = "N/A"
person["ungueltig"] = "<font color=red>ungültig</font>"
if abteilungsconfig[person["abteilung"]]["send_pol"] == "1":
personen[person["abteilung"]].append(person)
print("DEBUG: ================= personen dict ================= " )
print(personen)
print("DEBUG: ================= abteilungsconfig dict ================= ")
print(abteilungsconfig)
for k in personen.keys():
mailer.send_mail_pol(k, personen[k])