From: Jean-Philippe Caissy Date: Tue, 3 Apr 2012 22:14:21 +0000 (-0500) Subject: Masse salariale: BSTG X-Git-Tag: 1.6.5~158^2~11 X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=commitdiff_plain;h=a69271894b8bdf55482c08471e1a033f10ff54f3 Masse salariale: BSTG --- diff --git a/project/rh/masse_salariale.py b/project/rh/masse_salariale.py index 485c8b2..5e20822 100644 --- a/project/rh/masse_salariale.py +++ b/project/rh/masse_salariale.py @@ -26,8 +26,8 @@ TYPE_REMUN_SCOLARITE = (5,) TYPE_REMUN_TRANSP = (9,) TYPE_REMUN_13E = (18,) TYPE_PRIME_INTERIM = (19,) -TYPE_REMUN_ALL_INDEMNITES = list(itertools.chain(*(TYPE_REMUN_BSTG, - TYPE_REMUN_MAD, TYPE_REMUN_BASE, TYPE_REMUN_FONC_RESP, +TYPE_REMUN_ALL_INDEMNITES = list(itertools.chain(*( + TYPE_REMUN_BSTG, TYPE_REMUN_BASE, TYPE_REMUN_FONC_RESP, TYPE_REMUN_EXPAT, TYPE_REMUN_LOGEMENT, TYPE_REMUN_TRANSP, TYPE_REMUN_13E, TYPE_PRIME_INTERIM, TYPE_REMUN_SCOLARITE))) TYPE_PRIME_INSTALLATION = (13,) @@ -87,7 +87,7 @@ class MasseSalariale(): custom_filter = {} for k, v in self.custom_filter.items(): custom_filter[k.replace('dossier__', '')] = v - count_dossiers_by_employe = dict((d['id'], d['count']) for d in + count_dossiers_by_employe = dict((d['id'], d['count']) for d in rh.Dossier.objects.filter(q_range).values('id') \ .filter(**custom_filter) \ .annotate(count=Count('employe'))) @@ -141,7 +141,7 @@ class MasseSalariale(): {'columnwidth': '7.25cm'}), ('niveau', u"Niveau actel", {'columnwidth': '1.75cm'}), ('point', u"Point", {'columnwidth': '1.75cm'}), - ('regime_de_travail', u"Régime de travail actuel", + ('regime_de_travail', u"Régime de travail annuel", {'columnwidth': '2cm'}), ('local_expatrie', u"Local / Expatrié", {'columnwidth': '2.25cm'}), @@ -154,14 +154,14 @@ class MasseSalariale(): ('nb_jours', u"Nombre de jours", {'columnwidth': '2.82cm'}), HEADER_SEPARATOR, ('devise', u"Devise", {'columnwidth': '1.46cm'}), - ('salaire_bstg_annuel', u"Salaire BSTG ANNUEL", + ('salaire_bstg_annuel', u"Salaire BSTG annuel", {'columnwidth': '2.5cm'}), - ('salaire_bstg_total', u"Salaire BSTG total ", + ('salaire_bstg_euro', u"Salaire BSTG EUR", {'columnwidth': '2.5cm'}), ('organisme_bstg', u"Organisme BSTG", {'columnwidth': '2.9cm'}), HEADER_SEPARATOR, - ('salaire_theorique', u"Salaire théorique actuel", + ('salaire_theorique', u"Salaire théorique annuel", {'columnwidth': '2.5cm', 'background-color': '#ecab44'}), ('salaire_base_brut', u"Salaire de base brut", {'columnwidth': '2.5cm', 'background-color': '#ecab44'}), @@ -268,7 +268,7 @@ class MasseSalariale(): if d.principal: dossier = list(dossiers)[0] - regime = (float(dossier.poste.regime_travail) /100 ) * \ + regime = (float(dossier.poste.regime_travail) / 100) * \ (float(dossier.regime_travail) / 100) if dossier.statut_residence == "expat": @@ -304,6 +304,7 @@ class MasseSalariale(): if not meme_devise: for r in remuns: self.convertir(r) + devise = remuns[0].devise bstg_dossier = None for d in dossiers: @@ -313,12 +314,16 @@ class MasseSalariale(): bstg_remun = None if bstg_dossier: for r in bstg_dossier.rh_remunerations.all(): - if r.type.id in TYPE_REMUN_BSTG: - bstg_remun = r + if r.type.id in TYPE_REMUN_MAD: + bstg_remun = rh.Remuneration( + montant=float(r.montant), + devise=r.devise + ) if bstg_remun: bstg_remun_euro = rh.Remuneration( - montant=bstg_remun.montant, devise=bstg_remun.devise + montant=float(bstg_remun.montant), + devise=bstg_remun.devise ) self.convertir(bstg_remun_euro) @@ -369,9 +374,12 @@ class MasseSalariale(): date_debut, date_fin).days \ / float(rapport_date_delta.days) - if r.type_id in TYPE_REMUN_MAD: + if r.dossier_id == 1329: + print facteur, regime + if r.type_id in TYPE_REMUN_BSTG: salaire_complement += montant * facteur - else: + + if r.type_id not in TYPE_REMUN_MAD: masse_salariale += montant masse_salariale_annee += montant * facteur * regime @@ -400,7 +408,8 @@ class MasseSalariale(): indemnites['interim'] += montant * facteur if r.type_id not in TYPE_REMUN_ALL_INDEMNITES \ - and r.type.nature_remuneration == TYPE_NATURE_INDEMN: + and r.type.nature_remuneration == TYPE_NATURE_INDEMN \ + and r.type_id != TYPE_REMUN_MAD: indemnites['autre_recurr'] += montant * facteur if r.type_id in TYPE_PRIME_INSTALLATION: @@ -432,7 +441,9 @@ class MasseSalariale(): if r.type.nature_remuneration == TYPE_NATURE_CHARGES: total_remun_annee['charges'] += montant * facteur - if r.type.nature_remuneration == TYPE_NATURE_TRAITEMENT: + if (r.type.nature_remuneration == TYPE_NATURE_TRAITEMENT and + r.type.id != TYPE_REMUN_MAD + ) or r.type_id == TYPE_REMUN_BSTG: total_remun_annee['traitement'] += montant * facteur total_indemnites = sum(indemnites.values()) @@ -481,7 +492,7 @@ class MasseSalariale(): 'devise': devise.code, 'salaire_bstg_annuel': bstg_remun.montant \ if bstg_remun else "", - 'salaire_bstg_total': bstg_remun_euro.montant \ + 'salaire_bstg_euro': bstg_remun_euro.montant \ if bstg_remun else "", 'organisme_bstg': dossier.organisme_bstg or "", 'salaire_theorique': salaire_theorique, diff --git a/project/rh/templates/rh/rapports/masse_salariale.html b/project/rh/templates/rh/rapports/masse_salariale.html index 558e1ff..56e4173 100644 --- a/project/rh/templates/rh/rapports/masse_salariale.html +++ b/project/rh/templates/rh/rapports/masse_salariale.html @@ -80,7 +80,7 @@ {% endif %} {% endcomment %} {{ row|hash:column|floatformat:2|localize }} - {% if forloop.last %} + {% if forloop.last or column|contains:"euro" %} EUR {% else %} {{ row.devise }} diff --git a/project/rh/templatetags/rapports.py b/project/rh/templatetags/rapports.py index 2f251e9..465cb93 100644 --- a/project/rh/templatetags/rapports.py +++ b/project/rh/templatetags/rapports.py @@ -237,3 +237,7 @@ def hash(h, key): def is_float(v): if type(v) == type(float()): return True + +@register.filter() +def contains(value, arg): + return arg in value