Browse Source

Fix #30

pull/66/head
Sesostris Vieira 4 years ago
parent
commit
f0c9143267
  1. 6
      sigi/apps/convenios/templates/convenios/carrinho.html
  2. 16
      sigi/apps/convenios/views.py

6
sigi/apps/convenios/templates/convenios/carrinho.html

@ -68,7 +68,11 @@
<legend>{% trans 'Relatório por' %}</legend>
<ul class="tabs-conteudo">
<li>
<input type="radio" name="filtro_casa" value="cm" checked="checked"/>
<input type="radio" name="filtro_casa" value="tudo" checked="checked"/>
<label>{% trans 'Todos' %}</label>
</li>
<li>
<input type="radio" name="filtro_casa" value="cm"/>
<label>{% trans 'Câmara Municipal' %}</label>
</li>
<li>

16
sigi/apps/convenios/views.py

@ -14,7 +14,12 @@ from geraldo.generators import PDFGenerator
from sigi.apps.casas.models import Orgao
from sigi.apps.contatos.models import UnidadeFederativa
from sigi.apps.convenios.models import Convenio, Projeto
from sigi.apps.convenios.reports import ConvenioPorCMReport, ConvenioPorALReport, ConvenioReportSemAceiteAL, ConvenioReportSemAceiteCM
from sigi.apps.convenios.reports import (ConvenioReport,
ConvenioReportSemAceite,
ConvenioPorCMReport,
ConvenioPorALReport,
ConvenioReportSemAceiteAL,
ConvenioReportSemAceiteCM)
from django.contrib.auth.decorators import login_required
@ -154,7 +159,7 @@ def report(request, id=None):
tipo = request.POST['filtro_casa']
if 'data_aceite' in request.POST:
data_aceite_has = request.POST['data_aceite']
# Verifica filtro se é por Assembleia
# filtro adicional pela seleção do usuário
if tipo == 'al':
qs = qs.filter(casa_legislativa__tipo__sigla='AL')
# Verifica se é com data de aceite
@ -162,12 +167,17 @@ def report(request, id=None):
report = ConvenioReportSemAceiteAL(queryset=qs)
else:
report = ConvenioPorALReport(queryset=qs)
else:
elif tipo == 'cm':
qs = qs.filter(casa_legislativa__tipo__sigla='CM')
if data_aceite_has == 'nao':
report = ConvenioReportSemAceiteCM(queryset=qs)
else:
report = ConvenioPorCMReport(queryset=qs)
else:
if data_aceite_has == 'nao':
report = ConvenioReportSemAceite(queryset=qs)
else:
report = ConvenioReport(queryset=qs)
response = HttpResponse(content_type='application/pdf')
if report:

Loading…
Cancel
Save