From 511494f16b806131fc0fbcf194feb046159b1c51 Mon Sep 17 00:00:00 2001 From: "Camilo Carlos (Estagiario)" Date: Fri, 30 Jul 2010 17:32:56 +0000 Subject: [PATCH] =?UTF-8?q?Criando=20aplica=C3=A7=C3=A3o=20relatorios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/convenios/models.py | 1 + sigi/apps/convenios/reports.py | 61 +----------------- .../templates/convenios/change_list.html | 1 + sigi/apps/relatorios/__init__.py | 0 sigi/apps/relatorios/models.py | 3 + sigi/apps/relatorios/reports.py | 62 +++++++++++++++++++ sigi/apps/relatorios/tests.py | 23 +++++++ sigi/apps/relatorios/views.py | 1 + sigi/settings.py | 2 + 9 files changed, 96 insertions(+), 58 deletions(-) create mode 100644 sigi/apps/relatorios/__init__.py create mode 100644 sigi/apps/relatorios/models.py create mode 100644 sigi/apps/relatorios/reports.py create mode 100644 sigi/apps/relatorios/tests.py create mode 100644 sigi/apps/relatorios/views.py diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index 2b86da2..58dcd73 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -17,6 +17,7 @@ class Convenio(models.Model): verbose_name='Casa Legislativa' ) casa_legislativa.convenio_uf_filter = True + casa_legislativa.convenio_cl_tipo_filter = True num_processo_sf = models.CharField( 'número do processo SF', max_length=11, diff --git a/sigi/apps/convenios/reports.py b/sigi/apps/convenios/reports.py index 85e1588..c2b437d 100644 --- a/sigi/apps/convenios/reports.py +++ b/sigi/apps/convenios/reports.py @@ -5,70 +5,15 @@ from operator import attrgetter from geraldo import Report, ReportBand, ObjectValue, DetailBand, Label, \ landscape,SystemField, BAND_WIDTH,ReportGroup, \ FIELD_ACTION_SUM, FIELD_ACTION_COUNT - - from geraldo.graphics import Image - from reportlab.lib.units import cm from reportlab.lib.pagesizes import A4 from reportlab.lib.enums import TA_CENTER, TA_RIGHT -#from abc import ABCMeta - -class ReportDefault(Report): - #__metaclass__ = ABCMeta - title = u'Relatório' - author = u'Interlegis' - print_if_empty = True - page_size = A4 - - class band_page_header(ReportBand): - height = 4.2*cm - label_top = 3.7*cm - default_style = {'fontName': 'Helvetica', 'fontSize':9} - - BASE_DIR = os.path.abspath(os.path.dirname(__file__) + '../../../../') - #BASE_DIR = os.path.abspath(os.getcwd() + '../..') - - elements = [ - Image(filename= BASE_DIR + '/media/images/logo-interlegis.jpg', - left=15.5*cm,right=1*cm,top=0.1*cm,bottom=1*cm, - width=4.2*cm,height=3*cm, - ), - Image(filename= BASE_DIR + '/media/images/logo-senado.png', - left=1*cm,right=1*cm,top=0.1*cm,bottom=1*cm, - width=3*cm,height=3*cm, - ), - Label(text="SENADO FEDERAL",top=1*cm,left=0,width=BAND_WIDTH, - style={'fontName': 'Helvetica-Bold','fontSize':14, 'alignment': TA_CENTER} - ), - Label(text="SINTER - Secretaria Especial do Interlegis",top=1.5*cm,left=0,width=BAND_WIDTH, - style={'fontName': 'Helvetica-Bold','fontSize':13, 'alignment': TA_CENTER} - ), - SystemField( - expression='%(report_title)s',top=2.5*cm,left=0,width=BAND_WIDTH, - style={'fontName': 'Helvetica-Bold','fontSize':14, 'alignment': TA_CENTER} - ), - ] - borders = {'bottom': True} - - class band_page_footer(ReportBand): - height = 0.5*cm - - elements = [ - SystemField(expression=u'%(now:%d/%m/%Y)s às %(now:%H:%M)s', top=0.1*cm), - SystemField(expression=u'Página %(page_number)d de %(page_count)d', top=0.1*cm, - width=BAND_WIDTH, style={'alignment': TA_RIGHT} - ), - ] - borders = {'top': True} - - class band_detail(DetailBand): - height = 0.5*cm - default_style = {'fontName': 'Helvetica', 'fontSize': 8} - +from sigi.apps.relatorios.reports import ReportDefault +#from abc import ABCMeta class CasasAderidasReport(object): pass @@ -243,4 +188,4 @@ class ConvenioReportRegiao(Report): ObjectValue(attribute_name='casas', action=FIELD_ACTION_COUNT,) ] ), - ] \ No newline at end of file + ] diff --git a/sigi/apps/convenios/templates/convenios/change_list.html b/sigi/apps/convenios/templates/convenios/change_list.html index e64757a..df01bab 100644 --- a/sigi/apps/convenios/templates/convenios/change_list.html +++ b/sigi/apps/convenios/templates/convenios/change_list.html @@ -5,6 +5,7 @@ {% if has_add_permission %}