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)
<th colspan="2">Conversion en Euros</th>
<th>Précision</th>
</tr>
-{% for remun in dossier.remuneration_set.all %}
+
+<tr>
+ <th colspan="5">Coûts AUF</th>
+ <th id="sous-total-cout" class="montant"></th>
+ <th>EUR</th>
+</tr>
+
+{% for remun in dossier.get_couts_auf %}
+ <tr class="cout">
+ <td>{{ remun.type }}</td>
+ <td>
+ {{ remun.devise }}
+ <input type="hidden" id="taux_devise-{{ remun.id }}"
+ name="taux_devise-{{ remun.id }}"
+ value="{{ remun.taux_devise }}" />
+ </td>
+ <td>
+ <input type="text" id="montant_mois-{{ remun.id }}"
+ name="montant_mois-{{ remun.id }}"
+ value="{{ remun.montant_mois }}" />
+ </td>
+ <td><input type="text" id="montant-{{ remun.id }}"
+ name="cg-montant-{{ remun.id }}"
+ value="{{ remun.montant|default_if_none:'' }}" />
+ </td>
+ <td id="montant_euro_mois-{{ remun.id }}" class="montant">
+ {{ remun.montant_euro_mois }}</td>
+ <td id="montant_euro-{{ remun.id }}" class="montant cumulable">{{ remun.montant_euro }}</td>
+ <td><input type="text" name="cg-precision-{{ remun.id }}"
+ value="{{ remun.precision|default_if_none:'' }}" /></td>
+ </tr>
+{% empty %}
<tr>
+ <td colspan="6">
+ Aucun coût au registre
+ </td>
+ </tr>
+{% endfor %}
+
+
+<tr>
+ <th colspan="5">BSTG - Salaire de mise à disposition</th>
+ <th id="sous-total-aide" class="montant"></th>
+ <th>EUR</th>
+</tr>
+
+{% for remun in dossier.get_aides_auf %}
+ <tr class="aide">
<td>{{ remun.type }}</td>
<td>
{{ remun.devise }}
</td>
<td id="montant_euro_mois-{{ remun.id }}" class="montant">
{{ remun.montant_euro_mois }}</td>
- <td id="montant_euro-{{ remun.id }}" class="montant">{{ remun.montant_euro }}</td>
+ <td id="montant_euro-{{ remun.id }}" class="montant cumulable">{{ remun.montant_euro }}</td>
<td><input type="text" name="cg-precision-{{ remun.id }}"
value="{{ remun.precision|default_if_none:'' }}" /></td>
</tr>
</td>
</tr>
{% endfor %}
+
+<tr>
+ <th colspan="5">TOTAL</th>
+ <th id="remun-total" class="montant"></th>
+ <th>EUR</th>
+</tr>
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('-'),
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();
});
}
});
+ remun_totaux();
});