aelector: the element where to display costs, and from which the index will be calculated.
accessor: a function to get all items that will be part of the total.
*/
+ // $(selector).hide();
$(selector).each(function(){
var subtot = 0;
var i = $(this).index();
+{% load l10n %}
+
{% for f in remunForm.management_form %}
{{ f }}
{% endfor %}
<tr>
<th>Type</th>
<th>Devise locale</th>
- <th>Annuel</th>
- <th>Annuel Euros</th>
+ <th>Annuel<br/>(visé)</th>
+ <th>Annuel Euros<br/>(visé)</th>
+ <th>Annuel Euros<br/>(ajusté par période)</th>
<th>Précision</th>
{% if not remunForm.read_only %}
<th>Supprimer</th>
<td>{{ f.devise.errors }} {{ f.devise }}</td>
<td class="monnaie cumulable">{{ f.montant.errors }} {{ f.montant }}</td>
<td class="euro cumulable" id="id_{{ f.prefix }}-montant_annuel_euros"></td>
+ <td class="euro-ajuste cumulable" id="id_{{ f.prefix }}-montant_annuel_euros_ajuste">{{ f.instance.montant_ajuste_euros|stringformat:".2f" }}</td>
<td>{{ f.commentaire.errors }} {{ f.commentaire }}</td>
{% if not remunForm.read_only %}
<td>{{ f.DELETE }}</td>
<td><!-- Laisser ce td pour que le javascript fonctionne bien. --></td>
<td class="sous-total"></td>
<td class="sous-total"></td>
+ <td class="sous-total"></td>
<td> </td>
{% if not remunForm.read_only %}
<td> </td>
<th><!-- Laisser ce td pour que le javascript fonctionne bien. --></th>
<th class="total"></th>
<th class="total"></th>
+ <th class="total"></th>
<th> </th>
{% if not remunForm.read_only %}
<th> </th>
<th><!-- Laisser ce td pour que le javascript fonctionne bien. --></th>
<th></th>
<th></th>
+ <th></th>
<th> </th>
{% if not remunForm.read_only %}
<th> </th>
<td>{{ f.devise.errors }} {{ f.devise }}</td>
<td class="monnaie cumulable">{{ f.montant.errors }} {{ f.montant }}</td>
<td class="euro cumulable" id="id_{{ f.prefix }}-montant_annuel_euros"></td>
+ <td class="euro-ajuste cumulable" id="id_{{ f.prefix }}-montant_annuel_euros_ajuste"> {{ f.instance.montant_ajuste_euros|stringformat:".2f" }}</td>
<td>{{ f.commentaire.errors }} {{ f.commentaire }}</td>
{% if not remunForm.read_only %}
<td>{{ f.DELETE }}</td>
<td><!-- Laisser ce td pour que le javascript fonctionne bien. --></td>
<td class="sous-total"></td>
<td class="sous-total"></td>
+ <td class="sous-total"></td>
<td> </td>
{% if not remunForm.read_only %}
<td> </td>
def _dossier(obj):
return obj.dossier.__unicode__()
+ _dossier.short_description = u'Dossier'
list_display = (
'type', _dossier, 'valide', 'communique', 'date_communication'
)
+TWOPLACES = Decimal('0.01')
+
from project.rh.validators import validate_date_passee
# import pour relocaliser le modèle selon la convention (models.py pour
.order_by('-annee')
return taux[0].taux
- def montant_euros(self):
+ def montant_euros_float(self):
try:
taux = self.taux_devise()
except Exception, e:
return e
if not taux:
return None
- return int(round(float(self.montant) * float(taux), 2))
+ return float(self.montant) * float(taux)
+
+ def montant_euros(self):
+ return int(round(self.montant_euros_float(), 2))
class Commentaire(models.Model):
"""
objects = RemunerationManager()
+ def montant_ajuste_euros(self, annee=None):
+ """
+ Le montant ajusté représente le montant annuel, ajusté sur la
+ période de temps travaillée, multipliée par le ratio de temps
+ travaillé (en rapport au temps plein).
+ """
+ if not annee:
+ annee = min(
+ self.date_debut or date.today(), date.today()).year
+
+ debut_annee = date(annee, 1, 1)
+ fin_annee = date(annee, 12, 31)
+ jours_annee = (fin_annee - debut_annee).days + 1
+
+ date_count_debut = max(
+ self.date_debut or debut_annee, debut_annee)
+ date_count_fin = min(self.date_fin or fin_annee, fin_annee)
+ jours = (date_count_fin - date_count_debut).days + 1
+ print "Date debut: ", date_count_debut
+ print "Date fin: ", date_count_fin
+ print "Jours: ", jours
+
+ montant_euro = Decimal(str(self.montant_euros_float()))
+ if self.type.nature_remuneration != u'Accessoire':
+ return (montant_euro * ((
+ min(self.date_fin or fin_annee, fin_annee) -
+ max(self.date_debut or debut_annee, debut_annee)
+ ).days + 1) / jours_annee * self.dossier.regime_travail / 100)
+ else:
+ return montant_euro
+
+
def montant_mois(self):
return round(self.montant / 12, 2)
)
valide = models.BooleanField(default=True)
- communique = models.BooleanField(default=False)
+ communique = models.BooleanField(
+ u'Communiqué',
+ default=False,
+ )
date_communication = models.DateTimeField(
null=True,
blank=True,
{% if dossier.actif %}
<fieldset class="module aligned page-break">
- <h2>Rémunération en cours</h2>
{% for annee in annees %}
- <h2>Pour l'année {{ annee }}</h2>
+ <h2>Rémunérations pour l'année {{ annee }}</h2>
{% rh_remun_form_for_year dossier annee %}
{% endfor %}
</fieldset>
</fieldset>
{% endif %}
-<fieldset class="module aligned">
- <h2>Historique de rémunération</h2>
-{% include "rh/include/remunerations.html" with remunerations=dossier.remunerations %}
-</fieldset>
-
{% include "rh/include/commentaires.html" %}
+{% load dae %}
+
+{% block extrahead %}
+ <script src="{{ STATIC_URL }}js/jquery-1.5.1.min.js"
+ type="text/javascript"></script>
+ <script type="text/javascript">
+ var DEVISES = {};
+ {% for d in devises %}
+ DEVISES['{{d.devise_code}}'] = {{d.taux_euro|stringformat:"f"}};
+ {% endfor %}
+ </script>
+ <script src="{{ STATIC_URL }}js/dae.js" type="text/javascript"></script>
+ <script src="{{ STATIC_URL }}js/remun.js" type="text/javascript"></script>
+{% endblock %}
+
+
<fieldset class="module aligned">
<h2>Identification</h2>
{% include "rh/form-row.html" with label="Nom" value=employe.nom %}
{% include "rh/form-row.html" with label="Adresse courriel personnelle" value=employe.courriel_perso %}
</fieldset>
+{% if dossier_principal %}
+{% if annee %}
+<fieldset class="module aligned page-break">
+ <h2>Rémunérations pour l'année {{ annee }}</h2>
+ {% rh_remun_form_for_year dossier_principal annee %}
+</fieldset>
+{% endif %}
+{% endif %}
+
<fieldset class="module aligned">
<h2>Ayants droit</h2>
{% for ay in employe.ayantdroits.all %}
from project.rh.templatetags.rapports import SortHeaders
from project.rh.historique import get_active_revisions, TodoForm
-TWOPLACES = Decimal('0.01')
+TWOPLACES = rh.TWOPLACES
def devises():
taux_change = Decimal(1)
remuns_par_type = defaultdict(lambda: 0)
+
for remun in remuns:
- if remun.type.nature_remuneration == u'Accessoire':
- remuns_par_type[remun.type_id] += montant_remun(remun)
+ montant_ajuste_euros = remun.montant_ajuste_euros(annee=annee)
+ if len(devises) == 1:
+ devise = remuns[0].devise.code
+ montant_ajuste = (
+ montant_ajuste_euros /
+ Decimal(str(remuns[0].taux_change))
+ ).quantize(TWOPLACES)
else:
- remuns_par_type[remun.type_id] += (
- montant_remun(remun) * ((
- min(remun.date_fin or fin_annee, fin_annee) -
- max(remun.date_debut or debut_annee, debut_annee)
- ).days + 1) / jours_annee *
- dossier.regime_travail / 100
- ).quantize(TWOPLACES)
+ montant_ajuste = montant_ajuste_euros.quantize(TWOPLACES)
+ devise = 'EUR'
+ remuns_par_type[remun.type_id] += montant_ajuste
+
traitements = [
remuns_par_type[type.id]
for type in types_remun_par_nature[u'Traitement']
dossiers = rh.Dossier.objects.filter(q).order_by('-date_debut')
+ dossier_principal = employe.dossier_principal()
+
c = {
'title': u"Employe %s" % (employe, ),
'is_popup': request.GET.get('_popup', False),
'employe': employe,
'dossiers': dossiers,
+ 'dossier_principal': dossier_principal,
'media_url': settings.PRIVE_MEDIA_URL,
+ 'annee': date.today().year -1,
+ 'devises': devises(),
}
return render(request, 'admin/rh/employe/apercu.html', c)