move lib
[auf_rh_dae.git] / project / rh / lib.py
CommitLineData
49c98347
PP
1
2def calc_remun(dossier):
3 thisyear = datetime.date.today().year
4 thisyearfilter = Q(date_debut__year=thisyear) | Q(date_fin__year=thisyear)
5
da6c523f 6 remunnow = dossier.rh_remunerations.filter(thisyearfilter)
49c98347
PP
7
8 remun_sum = 0
9 remun_sum_euro = 0
10 sums = defaultdict(int)
11 sums_euro = defaultdict(int)
12 for r in remunnow:
13 nature = r.type.nature_remuneration
14 sums[nature] += r.montant
15 sums_euro[nature] += r.montant_euro()
16 remun_sum += r.montant
17 remun_sum_euro += r.montant_euro()
18
19 remun = {}
20 sums = dict(sums)
21 for n, s in sums.iteritems():
22 remun[n] = [sums[n], sums_euro[n]]
23
24 return remun, remun_sum, remun_sum_euro
53ae644d
OL
25
26