-
Notifications
You must be signed in to change notification settings - Fork 0
/
revocate_mlp.py
executable file
·60 lines (44 loc) · 1.77 KB
/
revocate_mlp.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
60
#!/usr/bin/env python3
from os import path
from os import system
from os import environ
from os import remove
import sys
from datetime import date
from relatorio.templates.opendocument import Template
libreOfficePath = path.join("/", "Applications", "LibreOffice.app", "Contents", "MacOS", "soffice")
documents = path.join(environ['HOME'], "Documents", "Dropbox")
outputDir = path.join(documents, "Inbox", "PDF", "4 - manuell prüfen")
contracts = sys.argv[1:]
if len(contracts) < 1 or sys.argv[1] == "-h" or sys.argv[1] == "--help":
print("Usage:")
print(sys.argv[0] + " contractnumber...")
print("""Revocate premium rise for MLP contract
Options:
-h, --help\tShow help
""")
sys.exit(1)
contractData = {
'02': 'MLP bestpartner topinvest fondsgebundene Lebensversicherung',
'04': 'MLP topinvest fondsgebundene Lebensversicherung',
'07': 'MLP topinvest fondsgebundene Lebensversicherung',
'08': 'MLP Titan Fondspolice',
'09': 'MLP Tital Basisrente',
}
templateData = {
'date': date.today().strftime("%d.%m.%Y"),
'contracts': []
}
outputFile = "MLP"
for contract in contracts:
c = {'key': contract, 'name': contractData[contract]}
templateData['contracts'].append(c)
outputFile = outputFile + "_" + contract
outputFile = outputFile+"_"+date.today().strftime("%Y%m%d")+"_ErhoehungWiderspruch"
basic = Template(source='', filepath=path.join(documents, 'Org', 'versicherung', 'mlp-erhoehung-widerspruch-template.odt'))
basic_generated = basic.generate(o=templateData).render()
open(outputFile+".odt", 'wb').write(basic_generated.getvalue())
system(libreOfficePath + ' --convert-to pdf --outdir "'+outputDir+'" '+outputFile+'.odt')
remove(outputFile+".odt")
system('open "'+path.join(outputDir, outputFile+'.pdf')+'"')
system("open https://web.de")