Rapport des postes par implantation
authorJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 16 Feb 2012 21:23:21 +0000 (15:23 -0600)
committerJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 16 Feb 2012 21:23:21 +0000 (15:23 -0600)
project/menu.py
project/rh/admin.py
project/rh/models.py
project/rh/templates/rh/rapports/postes_implantation.html [new file with mode: 0644]
project/rh/urls.py
project/rh/views.py

index db65907..23eae40 100644 (file)
@@ -45,6 +45,8 @@ class CustomMenu(Menu):
                                    #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.MenuItem('Rapport des postes par service', reverse('rhr_postes_service')),
+                                   items.MenuItem('Rappor des postes par implantation', reverse('rhr_postes_implantation')),
                                ]
                               ),
             ]
index 062c1e1..990f9b0 100644 (file)
@@ -694,7 +694,7 @@ class PosteAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, admi
             responsable = ''
 
         try:
-            employe = "%s %s" % (obj.responsable.rh_dossiers.all()[0].employe.nom.upper(), obj.responsable.rh_dossiers.all()[0].employe.prenom)
+            employeposte_change = "%s %s" % (obj.responsable.rh_dossiers.all()[0].employe.nom.upper(), obj.responsable.rh_dossiers.all()[0].employe.prenom)
             employe_id = obj.responsable.rh_dossiers.all()[0].id
             employe = u"""<br /><a href="%s" onclick="return showAddAnotherPopup(this)"><img src="%simg/loupe.png" title="Aperçu de l'employé"></a> <a href="%s">%s</a>""" % \
                     (
index 3bb46e0..6ccbca3 100644 (file)
@@ -308,6 +308,9 @@ class PosteComparaison_(AUFMetadata):
     def montant_euros(self):
         return round(float(self.montant) * float(self.taux_devise()), 2)
 
+    def __unicode__(self):
+        return self.nom
+
 class PosteComparaison(PosteComparaison_):
     pass
 
diff --git a/project/rh/templates/rh/rapports/postes_implantation.html b/project/rh/templates/rh/rapports/postes_implantation.html
new file mode 100644 (file)
index 0000000..dbd30ee
--- /dev/null
@@ -0,0 +1,25 @@
+{% extends 'rh/rapports/base.html' %}
+{% load adminmedia rapports i18n %}
+
+{% block nomrapport %}Rapport postes par implantation{% endblock %}
+{% block count_elements %}{% endblock %}
+
+{% block contentrapport %}
+<ul>
+    {% for d in data %}
+        <li>{{ d.region.nom }}
+            <ul>
+                {% for i in d.implantations %}
+                    <li> {{ i.implantation.nom }} ({{ i.num_postes }})
+                        <ul>
+                            {% for p in i.postes %}
+                            <li>{{ p.nom }} [{{ p.id }}]</li>
+                            {% endfor %}
+                        </ul>
+                    </li>
+                {% endfor %}
+            </ul>
+        </li>
+    {% endfor %}
+</ul>
+{% endblock %}
index 8a391d8..9b708ea 100644 (file)
@@ -7,6 +7,8 @@ urlpatterns = patterns(
     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'),
+    url(r'^admin/rh/rapports/postes_par_service$', 'rapports_postes_service', name='rhr_postes_service'),
+    url(r'^admin/rh/rapports/postes_par_implantation$', 'rapports_postes_implantation', name='rhr_postes_implantation'),
     url(r'^admin/rh/dossier/(\d+)/apercu/$', 'dossier_apercu', name='dossier_apercu'),
     url(r'^admin/rh/employe/(\d+)/apercu/$', 'employe_apercu', name='employe_apercu'),
     url(r'^admin/rh/poste/(\d+)/apercu/$', 'poste_apercu', name='poste_apercu'),
index d00a28d..116829c 100644 (file)
@@ -280,6 +280,39 @@ def rapports_remuneration(request):
 
     return render_to_response('rh/rapports/remuneration.html', c, RequestContext(request))
 
+@login_required
+@drh_or_admin_required
+def rapports_postes_implantation(request):
+    c = {}
+    data = []
+    for r in ref.Region.objects.all():
+        implantations = []
+        for i in ref.Implantation.objects.filter(region=r):
+            implantations.append({
+                'implantation': i,
+                'postes': rh.Poste.objects.filter(implantation=i),
+                'num_postes': rh.Poste.objects.filter(implantation=i).count(),
+                })
+        data.append({
+            'region': r,
+            'implantations': implantations
+            })
+
+    c['data'] = data
+
+
+    return render_to_response('rh/rapports/postes_implantation.html', c, RequestContext(request))
+
+
+@login_required
+@drh_or_admin_required
+def rapports_postes_service(request):
+    c = {}
+    services = []
+
+    return render_to_response('rh/rapports/postes_par_service.html', c, RequestContext(request))
+
+
 def region_protected(model):
     def wrapper(func):
         def wrapped(request, id):