|
|
@ -1,4 +1,4 @@ |
|
|
|
##parameters=sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro |
|
|
|
# parameters=sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro |
|
|
|
|
|
|
|
"""relatorio_protocolo.py |
|
|
|
External method para gerar o arquivo rml da etiqueta de protocolo |
|
|
@ -11,13 +11,15 @@ import time |
|
|
|
from trml2pdf import parseString |
|
|
|
|
|
|
|
|
|
|
|
def cabecalho(inf_basicas_dic,imagem): |
|
|
|
def cabecalho(dic_cabecalho, imagem): |
|
|
|
"""Gera o codigo rml do cabecalho""" |
|
|
|
tmp_data = '' |
|
|
|
tmp_data+='\t\t\t\t<image x="2.1cm" y="25.7cm" width="59" height="62" file="' + imagem + '"/>\n' |
|
|
|
tmp_data += '\t\t\t\t<image x="2.1cm" y="25.7cm" width="59" height="62" file="' + \ |
|
|
|
imagem + '"/>\n' |
|
|
|
tmp_data += '\t\t\t\t<lines>2cm 25.4cm 19cm 25.4cm</lines>\n' |
|
|
|
tmp_data += '\t\t\t\t<setFont name="Helvetica-Bold" size="15"/>\n' |
|
|
|
tmp_data+='\t\t\t\t<drawString x="5cm" y="27.2cm">' + dic_cabecalho['nom_casa'] + '</drawString>\n' |
|
|
|
tmp_data += '\t\t\t\t<drawString x="5cm" y="27.2cm">' + \ |
|
|
|
dic_cabecalho['nom_casa'] + '</drawString>\n' |
|
|
|
tmp_data += '\t\t\t\t<setFont name="Helvetica" size="12"/>\n' |
|
|
|
tmp_data += '\t\t\t\t<drawString x="5cm" y="26.6cm">Sistema de Apoio ao Processo Legislativo</drawString>\n' |
|
|
|
tmp_data += '\t\t\t\t<setFont name="Helvetica-Bold" size="13"/>\n' |
|
|
@ -25,19 +27,24 @@ def cabecalho(inf_basicas_dic,imagem): |
|
|
|
|
|
|
|
return tmp_data |
|
|
|
|
|
|
|
|
|
|
|
def rodape(lst_rodape): |
|
|
|
"""Gera o codigo rml do rodape""" |
|
|
|
|
|
|
|
tmp_data = '' |
|
|
|
tmp_data += '\t\t\t\t<lines>2cm 3.2cm 19cm 3.2cm</lines>\n' |
|
|
|
tmp_data += '\t\t\t\t<setFont name="Helvetica" size="8"/>\n' |
|
|
|
tmp_data+='\t\t\t\t<drawString x="2cm" y="3.3cm">' + lst_rodape[2] + '</drawString>\n' |
|
|
|
tmp_data += '\t\t\t\t<drawString x="2cm" y="3.3cm">' + \ |
|
|
|
lst_rodape[2] + '</drawString>\n' |
|
|
|
tmp_data += '\t\t\t\t<drawString x="17.9cm" y="3.3cm">Página <pageNumber/></drawString>\n' |
|
|
|
tmp_data+='\t\t\t\t<drawCentredString x="10.5cm" y="2.7cm">' + lst_rodape[0] + '</drawCentredString>\n' |
|
|
|
tmp_data+='\t\t\t\t<drawCentredString x="10.5cm" y="2.3cm">' + lst_rodape[1] + '</drawCentredString>\n' |
|
|
|
tmp_data += '\t\t\t\t<drawCentredString x="10.5cm" y="2.7cm">' + \ |
|
|
|
lst_rodape[0] + '</drawCentredString>\n' |
|
|
|
tmp_data += '\t\t\t\t<drawCentredString x="10.5cm" y="2.3cm">' + \ |
|
|
|
lst_rodape[1] + '</drawCentredString>\n' |
|
|
|
|
|
|
|
return tmp_data |
|
|
|
|
|
|
|
|
|
|
|
def paraStyle(): |
|
|
|
"""Gera o codigo rml que define o estilo dos paragrafos""" |
|
|
|
|
|
|
@ -56,7 +63,8 @@ def paraStyle(): |
|
|
|
|
|
|
|
return tmp_data |
|
|
|
|
|
|
|
def protocolos(lst_protocolos): |
|
|
|
|
|
|
|
def protocolos(lst_protocolos, dic_cabecalho): |
|
|
|
"""Gera o codigo rml do conteudo da pesquisa de protocolos""" |
|
|
|
|
|
|
|
tmp_data = '' |
|
|
@ -73,19 +81,25 @@ def protocolos(lst_protocolos): |
|
|
|
tmp_data += '\t\t<para style="P1">\n' |
|
|
|
tmp_data += '\t\t\t<font color="white"> </font>\n' |
|
|
|
tmp_data += '\t\t</para>\n' |
|
|
|
tmp_data+='\t\t<para style="P2"><b>'+dic_cabecalho['nom_casa']+'</b></para>\n' |
|
|
|
tmp_data += '\t\t<para style="P2"><b>' + \ |
|
|
|
dic_cabecalho['nom_casa'] + '</b></para>\n' |
|
|
|
tmp_data += '\t\t<para style="P2">\n' |
|
|
|
tmp_data += '\t\t\t<font color="white"> </font>\n' |
|
|
|
tmp_data += '\t\t</para>\n' |
|
|
|
tmp_data+='\t\t<barCode code="Code128" x="0.15cm" barHeight="0.34in" barWidth="0.018in">' +dic['titulo']+ '</barCode>\n' |
|
|
|
tmp_data+='\t\t<para style="P2"><b>PROTOCOLO GERAL '+dic['titulo']+'</b></para>\n' |
|
|
|
tmp_data += '\t\t<barCode code="Code128" x="0.15cm" barHeight="0.34in" barWidth="0.018in">' + \ |
|
|
|
dic['titulo'] + '</barCode>\n' |
|
|
|
tmp_data += '\t\t<para style="P2"><b>PROTOCOLO GERAL ' + \ |
|
|
|
dic['titulo'] + '</b></para>\n' |
|
|
|
if dic['data'] != None: |
|
|
|
tmp_data+='\t\t<para style="P2"><b>'+dic['data']+'</b></para>\n' |
|
|
|
tmp_data+='\t\t<para style="P2"><b>'+dic['natureza']+' - '+dic['ident_processo']+'</b></para>\n' |
|
|
|
tmp_data += '\t\t<para style="P2"><b>' + \ |
|
|
|
dic['data'] + '</b></para>\n' |
|
|
|
tmp_data += '\t\t<para style="P2"><b>' + \ |
|
|
|
dic['natureza'] + ' - ' + dic['ident_processo'] + '</b></para>\n' |
|
|
|
|
|
|
|
tmp_data += '\t</story>\n' |
|
|
|
return tmp_data |
|
|
|
|
|
|
|
|
|
|
|
def principal(sessao, imagem, data, lst_protocolos, dic_cabecalho, lst_rodape, dic_filtro={}): |
|
|
|
"""Funcao pricipal que gera a estrutura global do arquivo rml""" |
|
|
|
|
|
|
@ -103,7 +117,7 @@ def principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_fil |
|
|
|
tmp_data += '\t\t</pageTemplate>\n' |
|
|
|
tmp_data += '\t</template>\n' |
|
|
|
tmp_data += paraStyle() |
|
|
|
tmp_data+=protocolos(lst_protocolos) |
|
|
|
tmp_data += protocolos(lst_protocolos, dic_cabecalho) |
|
|
|
tmp_data += '</document>\n' |
|
|
|
tmp_pdf = parseString(tmp_data) |
|
|
|
|
|
|
@ -116,4 +130,5 @@ def principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_fil |
|
|
|
|
|
|
|
# return "/temp_folder/"+arquivoPdf |
|
|
|
|
|
|
|
# return principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro) |
|
|
|
# return |
|
|
|
# principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro) |
|
|
|