Fixed le nombre de jours travaillé en float
authorJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 22 Mar 2012 13:40:52 +0000 (08:40 -0500)
committerJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 22 Mar 2012 13:40:52 +0000 (08:40 -0500)
project/rh/masse_salariale.py

index fd50a20..0a9e596 100644 (file)
@@ -316,6 +316,11 @@ class MasseSalariale():
                     round(valeur_point.valeur * int(coefficient) * regime, 2) \
                     if valeur_point and coefficient and regime else "")
 
+            if dossier.employe_id == 2046:
+                import pdb; pdb.set_trace()
+
+            rapport_nombre_jours = (float(date_delta.days)
+                    / rapport_date_delta.days)
             item_rapport = {
                     'bureau': dossier.poste.implantation.region.code,
                     'pays': unicode(pays),
@@ -345,70 +350,61 @@ class MasseSalariale():
                     'organisme_bstg': dossier.organisme_bstg or "",
                     'salaire_theorique': salaire_theorique,
                     'salaire_base_brut': \
-                            salaire_base * regime * (
-                                date_delta.days / rapport_date_delta.days
-                            ),
+                            salaire_base * regime * rapport_nombre_jours,
                     'salaire_complementaire': \
-                            salaire_complement * regime * (
-                                date_delta.days / rapport_date_delta.days
-                            ),
+                            salaire_complement * regime *
+                            rapport_nombre_jours,
                     #'salaire_total': None
                     'indemnite_fonctions': indemnites['fonc_resp'] * \
-                            regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            regime * rapport_nombre_jours,
                     'indemnite_expat': indemnites['expat'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'indemnite_logement': indemnites['logement'] * \
-                            regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            regime * rapport_nombre_jours,
                     'indemnite_transp': indemnites['transp'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'indemnite_13e': indemnites['13e'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'prime_interim': indemnites['interim'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'indemnite_autre': indemnites['autre_recurr'] * \
-                            regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            regime * rapport_nombre_jours,
                     'indemnite_sous_total': total_indemnites * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'total_brut': (
                                 total_indemnites + salaire_base +
                                 salaire_complement
-                            ) * regime * (
-                                date_delta.days / rapport_date_delta.days
-                            ),
+                            ) * regime * rapport_nombre_jours,
                     'prime_installation': primes['installation'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'prime_demenagement': primes['demenagement'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'prime_avion': primes['avion'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'prime_autre': primes['autre'] * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'prime_sous_total': sum(primes.values()) * regime * \
-                            (date_delta.days / rapport_date_delta.days),
+                            rapport_nombre_jours,
                     'charges_patronales': charges['patronale'],
                     'charges_autre': charges['autre'],
                     'charges_sous_total': sum(charges.values()),
                     'masse_salariale': masse_salariale,
                     'masse_salariale_annee': masse_salariale * \
-                            regime * (
-                                    date_delta.days / rapport_date_delta.days
-                             ),
+                            regime * rapport_nombre_jours,
                      'masse_salariale_annee_euro': \
-                            masse_salariale_euro.montant * regime * (
-                                    date_delta.days / rapport_date_delta.days
-                            ),
+                            masse_salariale_euro.montant * regime *
+                            rapport_nombre_jours,
             }
 
             for key in item_rapport.keys():
-                if type(item_rapport[key]) in (type(float()), type(long())):
+                if type(item_rapport[key]) == type(float()):
                     item_rapport[key] = round(item_rapport[key], 2)
-            grand_total += masse_salariale
-            grand_total_euro += masse_salariale_euro.montant * regime * (
+
+            grand_total += round(masse_salariale, 2)
+            grand_total_euro += round(masse_salariale_euro.montant * regime 
+                            * (
                                     date_delta.days / rapport_date_delta.days
-                            )
+                            ), 2)
 
             self.rapport.append(item_rapport)