diff --git a/sigi/apps/servidores/views.py b/sigi/apps/servidores/views.py new file mode 100644 index 0000000..bef9289 --- /dev/null +++ b/sigi/apps/servidores/views.py @@ -0,0 +1,33 @@ +# -*- coding: utf8 -*- + +import new +from django.template import RequestContext +from django.shortcuts import render_to_response, get_object_or_404, redirect +from django.db.models import Avg, Max, Min, Count +from sigi.apps.servidores.models import Servidor, Funcao +from sigi.shortcuts import render_to_pdf + +def servidores_por_funcao(request): + report = Funcao.objects.values('funcao').annotate(funcao__count=Count('funcao')).order_by('funcao__count') + total = Funcao.objects.count() + + context = RequestContext(request, { + 'pagesize':'A4', + 'report': report, + 'total': total + }) + + return render_to_pdf('servidores/servidores_por_funcao.html', context) + +def servidores_por_cargo(request): + report = Funcao.objects.values('cargo').annotate(cargo__count=Count('cargo')).order_by('cargo__count') + total = Funcao.objects.count() + + context = RequestContext(request, { + 'pagesize':'A4', + 'report': report, + 'total': total + }) + + return render_to_pdf('servidores/servidores_por_cargo.html', context) + diff --git a/sigi/templates/admin/servidores/servidor/change_list.html b/sigi/templates/admin/servidores/servidor/change_list.html new file mode 100644 index 0000000..f688d16 --- /dev/null +++ b/sigi/templates/admin/servidores/servidor/change_list.html @@ -0,0 +1,20 @@ +{% extends 'admin/change_list.html' %} +{% load i18n reporting_tags %} + +{% block object-tools %} + +{% endblock %} diff --git a/sigi/templates/base_report.html b/sigi/templates/base_report.html new file mode 100644 index 0000000..9c7bf95 --- /dev/null +++ b/sigi/templates/base_report.html @@ -0,0 +1,84 @@ +{% load smart_if %} + + + + + My Title + + {% block extra_head %} + {% endblock %} + + + + {% block report %} + {% endblock %} + + + diff --git a/sigi/templates/servidores/servidores_por_cargo.html b/sigi/templates/servidores/servidores_por_cargo.html new file mode 100644 index 0000000..381b4e1 --- /dev/null +++ b/sigi/templates/servidores/servidores_por_cargo.html @@ -0,0 +1,50 @@ +{% extends "base_report.html" %} + +{% block extra_head %} + +{% endblock %} + +{% block subsecretaria %} +SUBSECRETARIA DE ADMINISTRAÇÃO – SSADM +{% endblock %} + +{% block report %} +
+

Relatório de Servidores por Cargo

+ + + + + + + {% for r in report %} + + + + + + {% endfor %} + + + + + +
CargoServidores
{{ forloop.counter }}{{ r.cargo }}{{ r.cargo__count }}
Total{{ total }}
+
+{% endblock %} diff --git a/sigi/templates/servidores/servidores_por_funcao.html b/sigi/templates/servidores/servidores_por_funcao.html new file mode 100644 index 0000000..e318806 --- /dev/null +++ b/sigi/templates/servidores/servidores_por_funcao.html @@ -0,0 +1,50 @@ +{% extends "base_report.html" %} + +{% block extra_head %} + +{% endblock %} + +{% block subsecretaria %} +SUBSECRETARIA DE ADMINISTRAÇÃO – SSADM +{% endblock %} + +{% block report %} +
+

Relatório de Servidores por Função

+ + + + + + + {% for r in report %} + + + + + + {% endfor %} + + + + + +
FunçãoServidores
{{ forloop.counter }}{{ r.funcao }}{{ r.funcao__count }}
Total{{ total }}
+
+{% endblock %} diff --git a/sigi/urls.py b/sigi/urls.py index 2eff650..ec38f1e 100644 --- a/sigi/urls.py +++ b/sigi/urls.py @@ -41,6 +41,11 @@ urlpatterns = patterns( # reports diagnosticos (r'^sigi/diagnosticos/diagnostico/(?P\w+).pdf', 'sigi.apps.diagnosticos.views.diagnostico_pdf'), + # reports servidores + (r'^sigi/servidores/servidores_por_funcao.pdf', + 'sigi.apps.servidores.views.servidores_por_funcao'), + (r'^sigi/servidores/servidores_por_cargo.pdf', + 'sigi.apps.servidores.views.servidores_por_cargo'), #Carrinho Casa (r'^sigi/casas/casalegislativa/carrinho/deleta_itens_carrinho', 'sigi.apps.casas.views.deleta_itens_carrinho'),