From: PA Parent Date: Tue, 13 Dec 2011 20:11:44 +0000 (-0500) Subject: Rapport Remunération X-Git-Tag: DAE+RH~238^2~8 X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=commitdiff_plain;h=e2c0b1acc65c5ef328caf6a680ba68988d4737dc Rapport Remunération --- diff --git a/project/menu.py b/project/menu.py index db73ace..e8f310c 100644 --- a/project/menu.py +++ b/project/menu.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + """ This file was generated with the custommenu management command, it contains the classes for the admin menu, you can customize this class as you want. @@ -29,6 +31,7 @@ class CustomMenu(Menu): children=[ items.MenuItem('Rapport des postes', reverse('rhr_postes')), items.MenuItem('Rapport des contrats', reverse('rhr_contrats')), + items.MenuItem('Rapport de rémunération', reverse('rhr_remuneration')), ] ), items.AppList( diff --git a/project/rh/templates/rh/rapports/remuneration.html b/project/rh/templates/rh/rapports/remuneration.html new file mode 100644 index 0000000..7fa0395 --- /dev/null +++ b/project/rh/templates/rh/rapports/remuneration.html @@ -0,0 +1,47 @@ +{% extends 'rh/rapports/base.html' %} +{% load adminmedia rapports i18n %} + +{% block nomrapport %}Rapport de rémunération{% endblock %} + +{% block contentrapport %} + +
+

{% trans 'Filter' %}

+{% comment %} +{% filter_region_contrat %} +{% filter_implantation_contrat %} +{% filter_type_contrat %} +{% filter_echeance_contrat %} +{% endcomment %} +
+ + + + + + + + + + + + + + + +{% spaceless %}{% for employe in employes %} + + + + + + + + + + + +{% endfor %}{% endspaceless %} +
# de l'employéNomPrénomTraitementIndemnitéChargesAccessoireRASTotal
{{ employe.id }}{{ employe.nom }}{{ employe.prenom }}{{ employe.Traitement|default:0|floatformat:2 }} €{{ employe.Indemnite|default:0|floatformat:2 }} €{{ employe.Charges|default:0|floatformat:2 }} €{{ employe.Accessoire|default:0|floatformat:2 }} €{{ employe.RAS|default:0|floatformat:2 }} €{{ employe.remun_sum_euro|default:0|floatformat:2 }} €
+ +{% endblock %} diff --git a/project/rh/urls.py b/project/rh/urls.py index ea19452..ec96cf2 100644 --- a/project/rh/urls.py +++ b/project/rh/urls.py @@ -17,4 +17,5 @@ urlpatterns += patterns( 'project.rh.views', url(r'^admin/rh/rapports/postes$', 'rapports_poste', name='rhr_postes'), url(r'^admin/rh/rapports/contrats$', 'rapports_contrat', name='rhr_contrats'), + url(r'^admin/rh/rapports/remuneration$', 'rapports_remuneration', name='rhr_remuneration'), ) diff --git a/project/rh/views.py b/project/rh/views.py index 882ed6d..fde04ad 100644 --- a/project/rh/views.py +++ b/project/rh/views.py @@ -10,6 +10,7 @@ from datamaster_modeles import models as ref from project.lib import get_employe_from_id from rh import models as rh +from rh.lib import calc_remun # homes @login_required @@ -134,3 +135,62 @@ def rapports_contrat(request): } return render_to_response('rh/rapports/contrats.html', c, RequestContext(request)) + + +def rapports_remuneration(request): + + lookup_params = dict(request.GET.items()) + + for key, value in lookup_params.items(): + if not isinstance(key, str): + # 'key' will be used as a keyword argument later, so Python + # requires it to be a string. + del lookup_params[key] + lookup_params[smart_str(key)] = value + + employes = rh.Employe.objects.all() + employes = employes.filter(**lookup_params) + + output = [] + + for employe in employes: + line = {} + output.append(line) + + dossiers = employe.dossiers.all() + + remun = {} + remun_sum_euro = 0 + + for dossier in dossiers: + this_remun, this_remun_sum, this_remun_sum_euro = calc_remun(dossier) + + for item in this_remun: + if item not in remun: + remun[item] = this_remun[item] + else: + remun[item][0] += this_remun[item][0] + remun[item][1] += this_remun[item][1] + + remun_sum_euro += this_remun_sum_euro + + line['remun_sum_euro'] = remun_sum_euro + + for r in remun: + if r == u'Indemnité': + print r + line['Indemnite'] = remun[r][1] + else: + line[r] = remun[r][1] + + line['id'] = employe.id + line['nom'] = employe.nom + line['prenom'] = employe.prenom + + + c = { + 'title': 'Rapport de remuneration', + 'employes': output, + } + + return render_to_response('rh/rapports/remuneration.html', c, RequestContext(request))