Rapport de postes par services
authorJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 16 Feb 2012 21:48:59 +0000 (15:48 -0600)
committerJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 16 Feb 2012 21:48:59 +0000 (15:48 -0600)
project/menu.py
project/rh/templates/rh/rapports/postes_service.html [new file with mode: 0644]
project/rh/views.py

index 23eae40..ee79a23 100644 (file)
@@ -45,7 +45,7 @@ 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('Rapport des postes par service', reverse('rhr_postes_service')),
                                    items.MenuItem('Rappor des postes par implantation', reverse('rhr_postes_implantation')),
                                ]
                               ),
diff --git a/project/rh/templates/rh/rapports/postes_service.html b/project/rh/templates/rh/rapports/postes_service.html
new file mode 100644 (file)
index 0000000..07b1345
--- /dev/null
@@ -0,0 +1,19 @@
+{% 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.service.nom }} ({{ d.num_postes }})
+            <ul>
+                {% for p in d.postes %}
+                <li>{{ p.nom }} [{{ p.id }}]</li>
+                {% endfor %}
+            </ul>
+        </li>
+    {% endfor %}
+</ul>
+{% endblock %}
index 116829c..e27ca7c 100644 (file)
@@ -308,9 +308,14 @@ def rapports_postes_implantation(request):
 @drh_or_admin_required
 def rapports_postes_service(request):
     c = {}
-    services = []
+    data = []
+    for s in rh.Service.objects.all():
+        postes = rh.Poste.objects.filter(service=s).all()
+        num_postes = rh.Poste.objects.filter(service=s).count()
+        data.append({'service': s, 'num_postes': num_postes, 'postes': postes}) 
 
-    return render_to_response('rh/rapports/postes_par_service.html', c, RequestContext(request))
+    c['data'] = data
+    return render_to_response('rh/rapports/postes_service.html', c, RequestContext(request))
 
 
 def region_protected(model):