Browse Source

estatisticas das normas por vigencia por ano

pull/2429/head
Cesar Carvalho 7 years ago
parent
commit
363c5d28ff
  1. 17
      sapl/base/views.py
  2. 8
      sapl/templates/base/RelatorioNormasVigencia_filter.html

17
sapl/base/views.py

@ -803,8 +803,10 @@ class RelatorioNormasVigenciaView(FilterView):
else:
qs = qs.filter(data_vigencia__lt=datetime.datetime.now().date())
# import ipdb; ipdb.set_trace()
kwargs.update({
'queryset': qs,
'queryset': qs
})
return kwargs
@ -818,12 +820,23 @@ class RelatorioNormasVigenciaView(FilterView):
if not self.filterset.form.is_valid():
return context
normas_totais = NormaJuridica.objects.filter(ano=self.request.GET['ano'])
context['quant_total'] = len(normas_totais)
if self.request.GET['vigencia'] == 'True':
context['vigencia'] = 'Vigente'
context['quant_vigente'] = len(context['object_list'])
context['quant_nao_vigente'] = context['quant_total'] - context['quant_vigente']
else:
context['vigencia'] = 'Não vigente'
context['quant_nao_vigente'] = len(context['object_list'])
context['quant_vigente'] = context['quant_total'] - context['quant_nao_vigente']
qr = self.request.GET.copy()
context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else ''
context['show_results'] = show_results_filter_set(qr)
context['ano'] = self.request.GET['ano']
context['vigencia'] = 'Vigente' if self.request.GET['vigencia'] == 'True' else 'Não vigente'
return context

8
sapl/templates/base/RelatorioNormasVigencia_filter.html

@ -16,6 +16,12 @@
&emsp;Ano: {{ ano }} <br />
&emsp;Vigência: {{ vigencia }} <br />
{% if object_list %}
<br/>
{% if object_list|length > 1 %}
<h3>Foram encontradas {{object_list|length}} normas.</h3>
{% else %}
<h3>Foi encontrada 1 norma.</h3>
{% endif %}
<br/>
<table class="table table-bordered table-hover" style="width:100%">
<thead class="thead-default" >
@ -35,6 +41,8 @@
{% endfor %}
</tbody>
</table>
<h3>Estatísticas das normas do ano:</h3><br>
<h3>{{quant_vigente}} vigente(s) / {{quant_nao_vigente}} não vigente(s)</h3>
{% else %}
<table class="table table-bordered table-hover" style="margin-top:30px;">
<thead class="thead-default" >

Loading…
Cancel
Save