From bf6fbbcf4491a5aad3c3454846e2f7a446f19523 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Larchev=C3=AAque?= Date: Tue, 17 May 2011 14:29:04 -0400 Subject: [PATCH] fix #1470 --- project/dae/models.py | 86 +++++++++++++++++--- .../templates/dae/embauche-remun-consulter.html | 60 +++++++++++--- 2 files changed, 122 insertions(+), 24 deletions(-) diff --git a/project/dae/models.py b/project/dae/models.py index 4a1565d..9d1f076 100644 --- a/project/dae/models.py +++ b/project/dae/models.py @@ -519,32 +519,94 @@ class Dossier(DossierWorkflow, models.Model): tx = 1 return (float)(tx) * (float)(self.salaire) - def get_couts_auf(self): + def get_remunerations_brutes(self): """ - On retire les MAD BSTG + 1 Salaire de base + 3 Indemnité de base + 4 Indemnité d'expatriation + 5 Indemnité pour frais + 6 Indemnité de logement + 7 Indemnité de fonction + 8 Indemnité de responsabilité + 9 Indemnité de transport + 10 Indemnité compensatrice + 11 Indemnité de subsistance + 12 Indemnité différentielle + 13 Prime d'installation + 14 Billet d'avion + 15 Déménagement + 16 Indemnité de départ + 18 Prime de 13ième mois + 19 Prime d'intérim """ - return [r for r in self.remuneration_set.all() if r.type_id not in (2, )] - - def get_total_couts_auf(self): + ids = [1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19] + return [r for r in self.remuneration_set.all() if r.type_id in ids] + + def get_charges_salariales(self): + """ + 20 Charges salariales ? + """ + ids = [20, ] + return [r for r in self.remuneration_set.all() if r.type_id in ids] + + def get_total_charges_salariales(self): + total = 0.0 + for r in self.get_charges_salariales(): + total += r.montant_euro() + return total + + def get_charges_patronales(self): + """ + 17 Charges patronales + """ + ids = [17, ] + return [r for r in self.remuneration_set.all() if r.type_id in ids] + + def get_total_charges_patronales(self): total = 0.0 - for r in self.get_couts_auf(): + for r in self.get_charges_patronales(): total += r.montant_euro() return total - def get_aides_auf(self): + def get_salaire_brut(self): + """ + somme des rémuérations brutes + """ + total = 0.0 + for r in self.get_remunerations_brutes(): + total += r.montant_euro() + return total + + def get_salaire_net(self): + """ + salaire brut - charges salariales + """ + total_charges = 0.0 + for r in self.get_charges_salariales(): + total_charges += r.montant_euro() + return self.get_salaire_brut() - total_charges + + def get_couts_auf(self): + """ + salaire net + charges patronales + """ + total_charges = 0.0 + for r in self.get_charges_patronales(): + total_charges += r.montant_euro() + return self.get_salaire_net() + total_charges + + def get_remunerations_tierces(self): """ - On récupère les MAD BSTG + 2 Salaire MAD """ return [r for r in self.remuneration_set.all() if r.type_id in (2, )] - def get_total_aides_auf(self): + def get_total_remunerations_tierces(self): total = 0.0 - for r in self.get_aides_auf(): + for r in self.get_remunerations_tierces(): total += r.montant_euro() return total - def get_total_remun(self): - return self.get_total_couts_auf() + self.get_total_aides_auf() # Tester l'enregistrement car les models.py sont importés au complet if not reversion.is_registered(Dossier): diff --git a/project/dae/templates/dae/embauche-remun-consulter.html b/project/dae/templates/dae/embauche-remun-consulter.html index 76c7567..f9d56c6 100644 --- a/project/dae/templates/dae/embauche-remun-consulter.html +++ b/project/dae/templates/dae/embauche-remun-consulter.html @@ -7,16 +7,14 @@ Précision -{% if dossier.get_couts_auf %} - Coûts AUF - {{ dossier.get_total_couts_auf|floatformat:0 }}€ + Salaire brut + {{ dossier.get_salaire_brut|floatformat:0 }}€ -{% endif %} -{% for remun in dossier.get_couts_auf %} +{% for remun in dossier.get_remunerations_brutes %} {{ remun.type }} {{ remun.devise }} @@ -28,15 +26,31 @@ {% endfor %} -{% if dossier.get_aides_auf %} - BSTG - Salaire de mise à disposition - {{ dossier.get_total_aides_auf|floatformat:0 }}€ + Charges salariales + {{ dossier.get_total_charges_salariales|floatformat:0 }}€ -{% endif %} -{% for remun in dossier.get_aides_auf %} +{% for remun in dossier.get_charges_salariales %} + + {{ remun.type }} + {{ remun.devise }} + {{ remun.montant_mois|floatformat:0 }} + {{ remun.montant|floatformat:0 }} + {{ remun.montant_euro_mois|floatformat:0 }} + {{ remun.montant_euro|floatformat:0 }} + {{ remun.precision }} + +{% endfor %} + + + Charges patronales + {{ dossier.get_total_charges_patronales|floatformat:0 }}€ + + + +{% for remun in dossier.get_charges_patronales %} {{ remun.type }} {{ remun.devise }} @@ -49,7 +63,29 @@ {% endfor %} - TOTAL - {{ dossier.get_total_remun|floatformat:0 }}€ + Côuts AUF + {{ dossier.get_couts_auf|floatformat:0 }}€ + + +{% if dossier.get_remunerations_tierces %} + + Autres rémunérations + {{ dossier.get_total_remunerations_tierces|floatformat:0 }}€ + + +{% endif %} + +{% for remun in dossier.get_remunerations_tierces %} + + {{ remun.type }} + {{ remun.devise }} + {{ remun.montant_mois|floatformat:0 }} + {{ remun.montant|floatformat:0 }} + {{ remun.montant_euro_mois|floatformat:0 }} + {{ remun.montant_euro|floatformat:0 }} + {{ remun.precision }} + +{% endfor %} + -- 1.7.10.4