Commit | Line | Data |
---|---|---|
c99116c3 JPC |
1 | # encoding: utf-8 |
2 | ||
fc62be5d EMS |
3 | import odsgen |
4 | ||
5 | ||
6 | def masse_salariale(lignes, annee, titres_traitements, titres_indemnites, | |
7 | titres_primes, titres_charges, masse_salariale_totale): | |
8 | doc = odsgen.Document() | |
9 | doc.add_iso_date_style('iso-date') | |
10 | ||
11 | table = doc.add_table(name=u'Masse salariale') | |
12 | for width in ( | |
13 | ['1.75cm', '5cm', '4cm', '3cm', '3.5cm', '5cm', '4cm', '6cm', | |
14 | '14cm', '2.5cm', '1.5cm', '4.5cm', '3cm', '1.5cm', '3.75cm', | |
15 | '0.5cm', '2.5cm', '2cm', '3cm', '0.5cm', '1.5cm', '4cm', | |
16 | '3.25cm', '5cm', '0.5cm', '4.25cm'] + | |
17 | ['5cm'] * len(titres_traitements) + ['4cm', '0.5cm'] + | |
18 | ['5cm'] * len(titres_indemnites) + ['4cm', '0.5cm'] + | |
19 | ['5cm'] * len(titres_primes) + ['4cm', '0.5cm'] + | |
20 | ['5cm'] * len(titres_charges) + ['4cm', '0.5cm'] + | |
21 | ['3.75cm'] * 4 + ['0.5cm', '2.75cm', '4cm'] | |
22 | ): | |
23 | table.add_column(columnwidth=width) | |
24 | ||
25 | row = table.add_row() | |
26 | row.add_cells([ | |
27 | u'Bureau', u'Pays', u'Implantation', u'Valeur du point', | |
28 | u"Numéro d'employé", u'Nom', u'Prénom', u'Type de poste', | |
29 | u'Intitulé du poste', u'Niveau actuel', u'Points', | |
30 | u'Régime de travail annuel', u'Local / Expatrié', u'Statut', | |
31 | u'Date de fin de contrat' | |
32 | ], fontweight='bold') | |
33 | row.add_cell(backgroundcolor='#d3d3d3') | |
34 | row.add_cells([ | |
35 | u'Date de début', u'Date de fin', u'Nombre de jours' | |
36 | ], fontweight='bold') | |
37 | row.add_cell(backgroundcolor='#d3d3d3') | |
38 | row.add_cells([ | |
39 | u'Devise', u'Salaire BSTG ANNUEL', u'Salaire BSTG EUR', | |
40 | u'Organisme BSTG' | |
41 | ], fontweight='bold') | |
42 | row.add_cell(backgroundcolor='#d3d3d3') | |
43 | row.add_cells( | |
44 | [u'Salaire théorique annuel'] + titres_traitements + | |
45 | [u'Total des traitements'], | |
46 | backgroundcolor='#ecab44', fontweight='bold' | |
47 | ) | |
48 | row.add_cell(backgroundcolor='#d3d3d3') | |
49 | row.add_cells( | |
50 | titres_indemnites + [u'Total des indemnités'], | |
51 | backgroundcolor='#fff840', fontweight='bold' | |
52 | ) | |
53 | row.add_cell(backgroundcolor='#d3d3d3') | |
54 | row.add_cells( | |
55 | titres_primes + [u'Total des primes'], | |
56 | backgroundcolor='#d7fb0f', fontweight='bold' | |
57 | ) | |
58 | row.add_cell(backgroundcolor='#d3d3d3') | |
59 | row.add_cells( | |
60 | titres_charges + [u'Total des charges'], | |
61 | backgroundcolor='#fb680f', fontweight='bold' | |
62 | ) | |
63 | row.add_cell(backgroundcolor='#d3d3d3') | |
64 | row.add_cell( | |
65 | u'Total des traitements', backgroundcolor='#ecab44', | |
66 | fontweight='bold' | |
67 | ) | |
68 | row.add_cell( | |
69 | u'Total des indemnités', backgroundcolor='#fff840', | |
70 | fontweight='bold' | |
71 | ) | |
72 | row.add_cell( | |
73 | u'Total des primes', backgroundcolor='#d7fb0f', | |
74 | fontweight='bold' | |
75 | ) | |
76 | row.add_cell( | |
77 | u'Total des charges', backgroundcolor='#fb680f', | |
78 | fontweight='bold' | |
79 | ) | |
80 | row.add_cell(backgroundcolor='#d3d3d3') | |
81 | row.add_cells( | |
82 | [u'Masse salariale', u'Masse salariale EUR'], | |
83 | backgroundcolor='#e6c6ed', fontweight='bold' | |
c99116c3 JPC |
84 | ) |
85 | ||
fc62be5d EMS |
86 | for ligne in lignes: |
87 | row = table.add_row() | |
88 | row.add_cells([ | |
89 | ligne['poste'].implantation.region.code, | |
90 | ligne['poste'].implantation.adresse_physique_pays.nom, | |
91 | ligne['poste'].implantation.nom_court | |
92 | ]) | |
93 | row.add_cell(ligne['valeur_point'], decimalplaces=2) | |
94 | row.add_cells([ | |
95 | ligne['dossier'].employe.id or 'VACANT', | |
96 | ligne['dossier'].employe.nom, | |
97 | ligne['dossier'].employe.prenom, | |
98 | ligne['poste'].type_poste.nom, | |
99 | ligne['poste'].nom, | |
100 | unicode(ligne['dossier'].classement), | |
101 | ligne['dossier'].classement | |
102 | and ligne['dossier'].classement.coefficient, | |
103 | ligne['regime_travail'], | |
104 | ligne['local_expatrie'], | |
105 | ligne['dossier'].statut.code, | |
106 | ]) | |
107 | row.add_cell(ligne['dossier'].date_fin, datastylename='iso-date') | |
108 | row.add_cell(backgroundcolor='#d3d3d3') | |
109 | row.add_cells([ | |
110 | ligne['date_debut'], ligne['date_fin'] | |
111 | ], datastylename='iso-date') | |
112 | row.add_cell(ligne['jours']) | |
113 | row.add_cell(backgroundcolor='#d3d3d3') | |
114 | row.add_cell(ligne['devise']) | |
115 | row.add_cells([ | |
116 | ligne['salaire_bstg'], ligne['salaire_bstg_eur'] | |
117 | ], decimalplaces=2) | |
118 | row.add_cell( | |
119 | ligne['dossier'].organisme_bstg | |
120 | and ligne['dossier'].organisme_bstg.nom, | |
121 | ) | |
122 | row.add_cell(backgroundcolor='#d3d3d3') | |
123 | row.add_cells( | |
124 | [ligne['salaire_theorique']] + ligne['traitements'] + | |
125 | [ligne['total_traitements']], | |
126 | decimalplaces=2 | |
127 | ) | |
128 | row.add_cell(backgroundcolor='#d3d3d3') | |
129 | row.add_cells( | |
130 | ligne['indemnites'] + [ligne['total_indemnites']], | |
131 | decimalplaces=2 | |
132 | ) | |
133 | row.add_cell(backgroundcolor='#d3d3d3') | |
134 | row.add_cells( | |
135 | ligne['primes'] + [ligne['total_primes']], | |
136 | decimalplaces=2 | |
137 | ) | |
138 | row.add_cell(backgroundcolor='#d3d3d3') | |
139 | row.add_cells( | |
140 | ligne['charges'] + [ligne['total_charges']], | |
141 | decimalplaces=2 | |
142 | ) | |
143 | row.add_cell(backgroundcolor='#d3d3d3') | |
144 | row.add_cells([ | |
145 | ligne['total_traitements'], ligne['total_indemnites'], | |
146 | ligne['total_primes'], ligne['total_charges'] | |
147 | ], decimalplaces=2) | |
148 | row.add_cell(backgroundcolor='#d3d3d3') | |
149 | row.add_cells([ | |
150 | ligne['masse_salariale'], ligne['masse_salariale_eur'] | |
151 | ], decimalplaces=2) | |
152 | return doc |