From: Olivier Larchevêque Date: Tue, 26 Apr 2011 20:30:02 +0000 (-0400) Subject: ss-total remun X-Git-Tag: DAE~150^2~36 X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=commitdiff_plain;h=57bd966cd7d83c8b6b3b81e9bcfdf34ddb61375d ss-total remun --- diff --git a/project/dae/models.py b/project/dae/models.py index a26afc9..3f9bf1b 100644 --- a/project/dae/models.py +++ b/project/dae/models.py @@ -374,6 +374,18 @@ class Dossier(models.Model): def __unicode__(self): return u'%s - %s' % (self.poste.nom, self.employe) + def get_couts_auf(self): + """ + On retire les MAD BSTG + """ + return [r for r in self.remuneration_set.all() if r.type_id not in (2, )] + + def get_aides_auf(self): + """ + On récupère les MAD BSTG + """ + return [r for r in self.remuneration_set.all() if r.type_id in (2, )] + # Tester l'enregistrement car les models.py sont importés au complet if not reversion.is_registered(Dossier): reversion.register(Dossier) diff --git a/project/dae/templates/dae/embauche-remun.html b/project/dae/templates/dae/embauche-remun.html index cc499e5..4818721 100644 --- a/project/dae/templates/dae/embauche-remun.html +++ b/project/dae/templates/dae/embauche-remun.html @@ -6,8 +6,54 @@ Conversion en Euros Précision -{% for remun in dossier.remuneration_set.all %} + + + Coûts AUF + + EUR + + +{% for remun in dossier.get_couts_auf %} + + {{ remun.type }} + + {{ remun.devise }} + + + + + + + + + {{ remun.montant_euro_mois }} + {{ remun.montant_euro }} + + +{% empty %} + + Aucun coût au registre + + +{% endfor %} + + + + BSTG - Salaire de mise à disposition + + EUR + + +{% for remun in dossier.get_aides_auf %} + {{ remun.type }} {{ remun.devise }} @@ -26,7 +72,7 @@ {{ remun.montant_euro_mois }} - {{ remun.montant_euro }} + {{ remun.montant_euro }} @@ -37,3 +83,9 @@ {% endfor %} + + + TOTAL + + EUR + diff --git a/project/media/js/dae-embauche.js b/project/media/js/dae-embauche.js index b6b8be5..4ab1e9c 100644 --- a/project/media/js/dae-embauche.js +++ b/project/media/js/dae-embauche.js @@ -30,6 +30,24 @@ function round2(n) { return Math.round(n * 100) / 100; } +function remun_totaux() { + var total_cout = 0; + $("tr.cout td.cumulable").each(function() { + total_cout += clean_float($(this).html()); + }); + $("#sous-total-cout").html(total_cout); + + var total_aide = 0; + $("tr.aide td.cumulable").each(function() { + total_aide += clean_float($(this).html()); + }); + $("#sous-total-aide").html(total_aide); + + var total = total_cout - total_aide; + $("#remun-total").html(total); + +} + $('#global-cost input[id^="montant"]').live('keyup', function() { var value = $(this).val(), idParts = $(this).attr('id').split('-'), @@ -44,6 +62,7 @@ $('#global-cost input[id^="montant"]').live('keyup', function() { var taux = $('#taux_devise-' + id).val(); $('#montant_euro_mois-' + id).text(clean_float(round2(value / taux / 12))); $('#montant_euro-' + id).text(clean_float(round2(value / taux))); + remun_totaux(); }); activateDossierDropDowns(); @@ -105,6 +124,7 @@ $(document).ready(function() { }); } }); + remun_totaux(); }); diff --git a/project/media/js/dae.js b/project/media/js/dae.js index e464166..828dfe2 100644 --- a/project/media/js/dae.js +++ b/project/media/js/dae.js @@ -1,10 +1,12 @@ /* string to float */ function clean_float(value){ - if (isNaN(value) || value == undefined) + if (isNaN(value) || value == undefined || value == "") { output = 0; - else + } + else { output = parseFloat(value); output = Math.round(output*100)/100; + } return parseInt(output); }