|
@ -1,6 +1,14 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
from geraldo import Report, ReportBand, ObjectValue, DetailBand, Label, FIELD_ACTION_SUM, FIELD_ACTION_COUNT |
|
|
from operator import attrgetter |
|
|
|
|
|
from geraldo import Report, ReportBand, ObjectValue, DetailBand, Label, \ |
|
|
|
|
|
landscape,SystemField, BAND_WIDTH,ReportGroup, \ |
|
|
|
|
|
FIELD_ACTION_SUM, FIELD_ACTION_COUNT |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from reportlab.lib.units import cm |
|
|
from reportlab.lib.units import cm |
|
|
|
|
|
from reportlab.lib.pagesizes import A4 |
|
|
|
|
|
from reportlab.lib.enums import TA_CENTER, TA_RIGHT |
|
|
|
|
|
|
|
|
class CasasAderidasReport(object): |
|
|
class CasasAderidasReport(object): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
@ -14,32 +22,70 @@ class SemEquipamentosReport(object): |
|
|
pass |
|
|
pass |
|
|
class ConvenioReport(Report): |
|
|
class ConvenioReport(Report): |
|
|
title = u'Relatórios dos Convênios' |
|
|
title = u'Relatórios dos Convênios' |
|
|
author = u'Interlegis' |
|
|
#author = u'Interlegis' |
|
|
|
|
|
print_if_empty = True |
|
|
|
|
|
page_size = A4#landscape(A4) |
|
|
|
|
|
|
|
|
class band_page_header(ReportBand): |
|
|
class band_page_header(ReportBand): |
|
|
|
|
|
height = 1.3*cm |
|
|
|
|
|
|
|
|
elements = [ |
|
|
elements = [ |
|
|
|
|
|
SystemField( |
|
|
|
|
|
expression='%(report_title)s',top=0.1*cm,left=0,width=BAND_WIDTH, |
|
|
|
|
|
style={'fontName': 'Helvetica-Bold','fontSize':14, 'alignment': TA_CENTER} |
|
|
|
|
|
), |
|
|
|
|
|
SystemField(expression=u'Página %(page_number)d de %(page_count)d', top=0.1*cm, |
|
|
|
|
|
width=BAND_WIDTH, style={'alignment': TA_RIGHT} |
|
|
|
|
|
), |
|
|
Label( |
|
|
Label( |
|
|
text="ID", left=0.5*cm |
|
|
text="Nº Processo", left=0.5*cm, top=0.8*cm |
|
|
), |
|
|
), |
|
|
Label( |
|
|
Label( |
|
|
text="Nº Processo", left=3*cm |
|
|
text="Nome", left=3*cm, top=0.8*cm |
|
|
), |
|
|
), |
|
|
Label( |
|
|
Label( |
|
|
text="Nome", left=5*cm |
|
|
text="Data Adesão", left=7*cm, top=0.8*cm |
|
|
), |
|
|
), |
|
|
Label( |
|
|
Label( |
|
|
text="Data Adesão", left=10*cm |
|
|
text="Projeto", left=10*cm, top=0.8*cm |
|
|
), |
|
|
), |
|
|
] |
|
|
] |
|
|
#borders = {'bottom': True} |
|
|
borders = {'bottom': True} |
|
|
|
|
|
|
|
|
|
|
|
class band_page_footer(ReportBand): |
|
|
|
|
|
height = 0.5*cm |
|
|
|
|
|
|
|
|
|
|
|
elements = [ |
|
|
|
|
|
Label(text='Interlegis', top=0.1*cm), |
|
|
|
|
|
SystemField(expression=u'Impresso em %(now:%d/%m/%Y)s às %(now:%H:%M)s', top=0.1*cm, |
|
|
|
|
|
width=BAND_WIDTH, style={'alignment': TA_RIGHT}), |
|
|
|
|
|
] |
|
|
|
|
|
borders = {'top': True} |
|
|
|
|
|
|
|
|
class band_detail(DetailBand): |
|
|
class band_detail(DetailBand): |
|
|
# height = 0.5*cm |
|
|
height = 0.5*cm |
|
|
elements=[ |
|
|
elements=[ |
|
|
ObjectValue(attribute_name='id', left=0.5*cm), |
|
|
ObjectValue(attribute_name='num_processo_sf', left=0.5*cm), |
|
|
ObjectValue(attribute_name='num_processo_sf', left=3*cm), |
|
|
ObjectValue(attribute_name='casa_legislativa', left=3*cm), |
|
|
ObjectValue(attribute_name='casa_legislativa', left=5*cm), |
|
|
ObjectValue(attribute_name='data_adesao', left=7*cm), |
|
|
ObjectValue(attribute_name='data_adesao', left=10*cm) |
|
|
ObjectValue(attribute_name='projeto', left=10*cm) |
|
|
] |
|
|
] |
|
|
border = {'bottom': True} |
|
|
#border = {'bottom': True} |
|
|
|
|
|
|
|
|
|
|
|
groups = [ |
|
|
|
|
|
ReportGroup(attribute_name='casa_legislativa.municipio.uf', |
|
|
|
|
|
band_header=ReportBand( |
|
|
|
|
|
height=0.7*cm, |
|
|
|
|
|
elements= [ |
|
|
|
|
|
ObjectValue(attribute_name='casa_legislativa.municipio.uf', |
|
|
|
|
|
get_Value= lambda instance: 'CasaLegislativa: '+ (instance.casa_legislativa.uf.regiao) |
|
|
|
|
|
) |
|
|
|
|
|
], |
|
|
|
|
|
borders={'bottom': True}, |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConvenioReportRegiao(Report): |
|
|
class ConvenioReportRegiao(Report): |
|
|
title = u'Relatório dos Convênios por Região' |
|
|
title = u'Relatório dos Convênios por Região' |
|
@ -68,6 +114,7 @@ class ConvenioReportRegiao(Report): |
|
|
ObjectValue(attribute_name='porc_casas_conveniadas', left=15*cm), |
|
|
ObjectValue(attribute_name='porc_casas_conveniadas', left=15*cm), |
|
|
] |
|
|
] |
|
|
border = {'bottom': True} |
|
|
border = {'bottom': True} |
|
|
|
|
|
|
|
|
class band_summary(ReportBand): |
|
|
class band_summary(ReportBand): |
|
|
elements = [ |
|
|
elements = [ |
|
|
Label(text="Total", top=0.1*cm, left=0), |
|
|
Label(text="Total", top=0.1*cm, left=0), |
|
|