Beispiel #1
0
 class MyReport(Report):
     def __init__(self, queryset=None, T=None):
         " Initialise parent class & make any necessary modifications "
         Report.__init__(self, queryset)
         self.T = T
     def _T(self, rawstring):
         return self.T(rawstring)
     # can't use T() here!
     #title = _T("Items")
     title = "Items"
     page_size = landscape(A4)
     class band_page_header(ReportBand):
         height = 1.3*cm
         elements = [
             SystemField(expression="%(report_title)s", top=0.1*cm,
                 left=0, width=BAND_WIDTH, style={"fontName": "Helvetica-Bold",
                 "fontSize": 14, "alignment": TA_CENTER}
                 ),
             Label(text="Code", top=0.8*cm, left=0.2*cm),
             Label(text="Description", top=0.8*cm, left=3*cm),
             Label(text="Unit Cost", top=0.8*cm, left=13*cm),
             Label(text="per Month", top=0.8*cm, left=15*cm),
             Label(text="per Minute", top=0.8*cm, left=17*cm),
             Label(text="per Megabyte", top=0.8*cm, left=19*cm),
             Label(text="Comments", top=0.8*cm, left=21*cm),
         ]
         borders = {"bottom": True}
     class band_page_footer(ReportBand):
         height = 0.5*cm
         elements = [
             Label(text="%s" % request.utcnow.date(), top=0.1*cm, left=0),
             SystemField(expression="Page # %(page_number)d of %(page_count)d", top=0.1*cm,
                 width=BAND_WIDTH, style={"alignment": TA_RIGHT}),
         ]
         borders = {"top": True}
     class band_detail(ReportBand):
         height = 0.5*cm
         auto_expand_height = True
         elements = (
                 ObjectValue(attribute_name="code", left=0.2*cm, width=2.8*cm),
                 ObjectValue(attribute_name="description", left=3*cm, width=10*cm),
                 ObjectValue(attribute_name="unit_cost", left=13*cm, width=2*cm),
                 ObjectValue(attribute_name="monthly_cost", left=15*cm, width=2*cm),
                 ObjectValue(attribute_name="minute_cost", left=17*cm, width=2*cm),
                 ObjectValue(attribute_name="megabyte_cost", left=19*cm, width=2*cm),
                 ObjectValue(attribute_name="comments", left=21*cm, width=6*cm),
                 )
     groups = [
     ReportGroup(attribute_name="category_type",
         band_header=ReportBand(
             height=0.7*cm,
             elements=[
                 ObjectValue(attribute_name="category_type", left=0, top=0.1*cm,
                     get_value=lambda instance: instance.category_type and budget_category_type_opts[instance.category_type],
                     style={"fontName": "Helvetica-Bold", "fontSize": 12})
             ],
             borders={"bottom": True},
         ),
     ),
 ]
Beispiel #2
0
	class ReportCfgItem(Report):
		title = 'Server Audit'
		author = 'Matthew Macdonald-Wallace'

		page_size = landscape(A5)
		margin_left = 2*cm
		margin_top = 0.5*cm
		margin_right = 0.5*cm
		margin_bottom = 0.5*cm

		class band_detail(ReportBand):
			height = 0.5*cm
			elements=(
			    ObjectValue(attribute_name='Hostname', left=0.5*cm),
			    ObjectValue(attribute_name='Rack', left=3*cm),
			)
			
		class band_page_header(ReportBand):
		    height = 1.3*cm
		    elements = [
			    SystemField(expression='%(report_title)s', top=0.1*cm, left=0, width=BAND_WIDTH,
				style={'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER}),
			    Label(text="Hostname", top=0.8*cm, left=0.5*cm),
			    Label(text=u"Rack", top=0.8*cm, left=3*cm),
			    SystemField(expression=u'Page %(page_number)d of %(page_count)d', top=0.1*cm,
				width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
			    ]
		    borders = {'bottom': True}

		class band_page_footer(ReportBand):
		    height = 0.5*cm
		    elements = [
			    Label(text='Geraldo Reports', top=0.1*cm),
			    SystemField(expression=u'Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s', top=0.1*cm,
				width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
			    ]
		    borders = {'top': True}

		groups = [
			ReportGroup(attribute_name = 'Hostname',
			    band_header = ReportBand(
				height = 0.7*cm,
				elements = [
				    ObjectValue(attribute_name='Hostname', left=0, top=0.1*cm, width=20*cm,
					get_value=lambda instance: 'Hostname: ' + (instance.Hostname),
					style={'fontName': 'Helvetica-Bold', 'fontSize': 12})
				    ],
				borders = {'bottom': True},
				)
			    ),
			]
Beispiel #3
0
class CasasLegislativasReport(ReportDefault):
    title = _(u'Relatório de Casas Legislativas')
    height = 80 * cm
    page_size = landscape(A4)

    class band_page_header(ReportDefault.band_page_header):

        label_top = ReportDefault.band_page_header.label_top
        label_left = [0.3, 1, 5.5, 11, 17, 22]
        elements = list(ReportDefault.band_page_header.elements)

        elements = [
            Image(
                filename=static('img/logo-interlegis.jpg'),
                left=23.5 * cm,
                right=1 * cm,
                top=0.1 * cm,
                bottom=1 * cm,
                width=4.2 * cm,
                height=3 * cm,
            ),
            Image(
                filename=static('img/logo-senado.png'),
                left=1 * cm,
                right=1 * cm,
                top=0.1 * cm,
                bottom=1 * cm,
                width=3 * cm,
                height=3 * cm,
            ),
            Label(text=_(u"SENADO FEDERAL"),
                  top=1 * cm,
                  left=0,
                  width=BAND_WIDTH,
                  style={
                      'fontName': 'Helvetica-Bold',
                      'fontSize': 14,
                      'alignment': TA_CENTER
                  }),
            Label(text=_(u"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
                        }),
            Label(
                text=_(u"UF"),
                left=label_left[0] * cm,
                top=label_top,
            ),
            Label(
                text=_(u"Municipio"),
                left=label_left[1] * cm,
                top=label_top,
            ),
            Label(
                text=_(u"Presidente"),
                left=label_left[2] * cm,
                top=label_top,
            ),
            Label(
                text=_(u"Endereço"),
                left=label_left[3] * cm,
                top=label_top,
            ),
            Label(
                text=_(u"Endereço na Internet"),
                left=label_left[4] * cm,
                top=label_top,
            ),
            Label(
                text=_(u"Email"),
                left=label_left[5] * cm,
                top=label_top,
            ),
        ]

    class band_page_footer(ReportDefault.band_page_footer):
        pass

    class band_detail(ReportDefault.band_detail):

        label_left = [0.3, 1, 5.5, 11, 17, 22]

        elements = [
            ObjectValue(
                attribute_name='municipio.uf.sigla',
                left=label_left[0] * cm,
                width=1 * cm,
            ),
            ObjectValue(
                attribute_name='municipio.nome',
                left=label_left[1] * cm,
            ),
            ObjectValue(
                attribute_name='presidente',
                left=label_left[2] * cm,
            ),
            ObjectValue(
                attribute_name='logradouro',
                left=label_left[3] * cm,
                get_value=lambda instance: instance.logradouro + ' - ' +
                instance.bairro,
            ),
            ObjectValue(
                attribute_name='pagina_web',
                left=label_left[4] * cm,
            ),
            ObjectValue(
                attribute_name='email',
                left=label_left[5] * cm,
            ),
        ]

    groups = [
        ReportGroup(attribute_name='municipio.uf',
                    band_header=ReportBand(
                        height=0.7 * cm,
                        elements=[ObjectValue(attribute_name='municipio.uf')],
                        borders={'top': True},
                    ))
    ]
Beispiel #4
0
class ReportGrupoInst(Report):

    title = 'a'

    class band_summary(ReportBand):
        height = 0.8 * cm
        elements = [
            Label(text="Total general:", top=0.1*cm, left=0),
            ObjectValue(attribute_name='id', top=0.1*cm, left=2.5*cm,\
                action=FIELD_ACTION_COUNT, display_format='%s '),
        ]
        borders = {'all': True}

    page_size = landscape(A5)
    margin_left = 2 * cm
    margin_top = 0.5 * cm
    margin_right = 0.5 * cm
    margin_bottom = 0.5 * cm

    class band_detail(ReportBand):
        height = 0 * cm
        elements = ()

    class band_page_header(ReportBand):
        height = 1.3 * cm
        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'Page %(page_number)d of %(page_count)d',
                        top=0.1 * cm,
                        width=BAND_WIDTH,
                        style={'alignment': TA_RIGHT}),
        ]

    #    borders = {'bottom': True}

    class band_page_footer(ReportBand):
        height = 0.5 * cm
        elements = [
            Label(text="Colmed IX°",
                  top=0.1 * cm,
                  left=0,
                  style={
                      'alignment': TA_LEFT,
                      'fontName': 'Helvetica',
                      'fontSize': 10
                  }),
            SystemField(expression=u' %(now:%b %d %Y)s, %(now:%H:%M)s hs.',
                        top=0.1 * cm,
                        width=BAND_WIDTH,
                        style={
                            'alignment': TA_RIGHT,
                            'fontName': 'Helvetica',
                            'fontSize': 10
                        })
        ]

    #   borders = {'top': True}

    groups = [
        ReportGroup(
            attribute_name='institucion',
            band_header=ReportBand(
                height=0.7 * cm,
                elements=[
                    ObjectValue(attribute_name='Institucion',
                                left=1,
                                top=0.1 * cm,
                                width=20 * cm,
                                get_value=lambda instance: 'Institucion: ' +
                                (instance.institucion.nombre),
                                style={
                                    'fontName': 'Helvetica-Bold',
                                    'fontSize': 12
                                }),

                    # ObjectValue(attribute_name='especialidad', action=FIELD_ACTION_COUNT,
                    #     display_format='%s ', left=15*cm, top=0.1*cm,style={'fontName': 'Helvetica-Bold', 'fontSize': 12})
                ],
                #   borders = {'bottom': True},
            ),
            band_footer=ReportBand(
                height=0.7 * cm,
                elements=[
                    ObjectValue(attribute_name='id',
                                action=FIELD_ACTION_COUNT,
                                display_format='Total por Instituc.: %s',
                                left=13 * cm,
                                top=0.1 * cm,
                                style={
                                    'fontName': 'Helvetica-BoldOblique',
                                    'fontSize': 9
                                })
                ],
                borders={
                    'top': True,
                    'left': True,
                    'right': True,
                    'bottom': True
                },
            ),
        ),
        ReportGroup(
            attribute_name='especialidad',
            band_header=ReportBand(
                height=0.5 * cm,
                elements=[
                    ObjectValue(attribute_name='Especialidad',
                                left=15,
                                top=0.1 * cm,
                                width=20 * cm,
                                get_value=lambda instance:
                                (instance.especialidad.nombre),
                                style={
                                    'fontName': 'Helvetica-Bold',
                                    'fontSize': 10
                                }),
                    ObjectValue(attribute_name='id',
                                action=FIELD_ACTION_COUNT,
                                display_format='%s ',
                                left=10 * cm,
                                top=0.1 * cm,
                                style={
                                    'fontName': 'Helvetica-Bold',
                                    'fontSize': 10
                                })
                ],
                #borders = {'bottom': True},
            ),
        ),
    ]
Beispiel #5
0
class Reportchartofacc(Report):
    title = 'Chart Of Account Report \n'
    author = 'Infologic Solutions'

    page_size = A4  #landscape(A4)#
    margin_left = 2*cm
    margin_top = 0.5*cm
    margin_right = 0.5*cm
    margin_bottom = 0.5*cm


    class band_detail(ReportBand):
        height = 0.5*cm
        elements=(
            ObjectValue(attribute_name='accname', left=1.3*cm),
            ObjectValue(attribute_name='acccode', left=14*cm,)
            #ObjectValue(attribute_name='datecreated', left=17*cm,
               # get_value=lambda instance: instance.datecreated.strftime('%d/%m/%Y')),
            )
    class band_page_header(ReportBand):
        height = 2.0*cm
        elements = [
                SystemField(expression='%(report_title)s', top=0.7*cm, left=0, width=BAND_WIDTH,
                    style={'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER}),
                Label(text="Acc Name", top=1.6*cm, left=1.3*cm),
                Label(text="Acc Code", top=1.6*cm, left=14*cm),
                #Label(text=u"Creation Date", top=1.6*cm, left=17*cm),
                SystemField(expression=u'Page %(page_number)d of %(page_count)d', top=0.1*cm,
                    width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
                SystemField(expression='Ruffwall Company', top=0.1*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 = [
                Label(text='Copyright Ruffwal', top=0.5*cm),
                SystemField(expression=u'Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s', top=0.5*cm,
                    width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
                ]
        #borders = {'top': True}

    groups = [
        ReportGroup(attribute_name = 'groupname',
            band_header = ReportBand(
                height = 0.7*cm,
                elements = [
                    ObjectValue(attribute_name='groupname', left=0, top=0.1*cm, width=20*cm,
                        get_value=lambda instance: ' ' + (instance.groupname),
                        style={'fontName': 'Helvetica-Bold', 'fontSize': 12})
                    ],
                borders = {'bottom': True},
                )
            ),
            ReportGroup(attribute_name = 'subgroupname',
            band_header = ReportBand(
                height = 0.7*cm,
                elements = [
                    ObjectValue(attribute_name='subgroupname', left=10, top=0.1*cm, width=20*cm,
                        get_value=lambda instance: ' ' + (instance.subgroupname),
                        style={'fontName': 'Helvetica-Bold', 'fontSize': 10})
                    ],
                borders = {'bottom': True},
                )
            ),
        ]
Beispiel #6
0
class ConvenioReport(ReportDefault):
    title = _(u'Relatório de Convênios')

    class band_page_header(ReportDefault.band_page_header):

        label_top = ReportDefault.band_page_header.label_top
        label_left = [0, 1.5, 7, 9, 11, 13, 15, 17]
        elements = list(ReportDefault.band_page_header.elements)
        height = 4.7 * cm

        elements += [
            Label(
                text=_(u"UF"),
                left=label_left[0] * cm,
                top=label_top + 0.4 * cm,
            ),
            Label(
                text=_(u"Municipio"),
                left=label_left[1] * cm,
                top=label_top + 0.4 * cm,
            ),
            Label(
                text=_(u"Data de Adesão"),
                left=label_left[2] * cm,
                top=label_top,
                width=2 * cm,
            ),
            Label(
                text=_(u"Número do Convênio"),
                left=label_left[3] * cm,
                top=label_top,
                width=2 * cm,
            ),
            Label(
                text=_(u"Data do Convênio"),
                left=label_left[4] * cm,
                top=label_top,
                width=2 * cm,
            ),
            Label(
                text=_(u"Data de Publicação"),
                left=label_left[5] * cm,
                top=label_top,
                width=2 * cm,
            ),
            Label(
                text=_(u"Data de Aceite"),
                left=label_left[6] * cm,
                top=label_top,
                width=2 * cm,
            ),
            Label(
                text=_(u"Projeto"),
                left=label_left[7] * cm,
                top=label_top + 0.4 * cm,
                width=2 * cm,
            ),
        ]

    class band_page_footer(ReportDefault.band_page_footer):
        pass

    class band_detail(ReportDefault.band_detail):

        label_left = [0, 1.5, 7, 9, 11, 13, 15, 17]

        elements = [
            ObjectValue(attribute_name='casa_legislativa.municipio.uf.sigla',
                        left=label_left[0] * cm),
            ObjectValue(attribute_name='casa_legislativa.municipio.nome',
                        left=label_left[1] * cm),
            ObjectValue(attribute_name='data_adesao',
                        left=label_left[2] * cm,
                        get_value=lambda instance: instance.data_adesao.
                        strftime('%d/%m/%Y')
                        if instance.data_adesao is not None else '-'),
            ObjectValue(attribute_name='num_convenio',
                        left=label_left[3] * cm),
            ObjectValue(
                attribute_name='data_retorno_assinatura',
                left=label_left[4] * cm,
                get_value=lambda instance: instance.data_retorno_assinatura.
                strftime('%d/%m/%Y')
                if instance.data_retorno_assinatura is not None else '-'),
            ObjectValue(attribute_name='data_pub_diario',
                        left=label_left[5] * cm,
                        get_value=lambda instance: instance.data_pub_diario.
                        strftime('%d/%m/%Y')
                        if instance.data_pub_diario is not None else '-'),
            ObjectValue(attribute_name='data_termo_aceite',
                        left=label_left[6] * cm,
                        get_value=lambda instance: instance.data_termo_aceite.
                        strftime('%d/%m/%Y')
                        if instance.data_termo_aceite is not None else '-'),
            ObjectValue(attribute_name='projeto.sigla',
                        left=label_left[7] * cm),
        ]

    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: '%s: %s' %
                        (_(u'Casa Legislativa'), instance.casa_legislativa.uf))
                ],
                borders={'top': True},
            ))
    ]