Exemplo n.º 1
0
class SubReport_StavkeRacuna(SubReport):
    def get_queryset(self, subrepo, racun):
        return racun.stavkaracuna_set.all().order_by('rbr')

    band_detail = ReportBand(height=0.7 * cm,
                             additional_fonts={'Segoe UI': SEGOE_UI},
                             default_style={
                                 'fontName': 'Segoe UI',
                                 'fontSize': 12
                             },
                             elements=[
                                 ObjectValue(attribute_name='rbr',
                                             top=6.7 * cm,
                                             left=0.2 * cm,
                                             width=17 * cm,
                                             style={'alignment': TA_LEFT}),
                                 ObjectValue(
                                     attribute_name='naziv_artikla',
                                     top=6.7 * cm,
                                     left=1.5 * cm,
                                 ),
                                 ObjectValue(attribute_name='cijena_artikla',
                                             top=6.7 * cm,
                                             left=6 * cm,
                                             width=2 * cm,
                                             style={'alignment': TA_RIGHT}),
                                 Label(
                                     text='kn',
                                     top=6.7 * cm,
                                     left=8.3 * cm,
                                 ),
                                 ObjectValue(
                                     attribute_name='kolicina',
                                     top=6.7 * cm,
                                     left=10.5 * cm,
                                 ),
                                 ObjectValue(attribute_name='ukupno',
                                             top=6.7 * cm,
                                             width=16.5 * cm,
                                             style={'alignment': TA_RIGHT}),
                                 Label(text='kn',
                                       top=6.7 * cm,
                                       width=17 * cm,
                                       style={'alignment': TA_RIGHT}),
                                 Line(
                                     top=6.6 * cm,
                                     left=0.0 * cm,
                                     right=17 * cm,
                                     bottom=6.6 * cm,
                                     stroke_width=0.8,
                                 ),
                             ])

    band_footer = ReportBand(elements=[
        ObjectValue(
            get_value=lambda x: 'Ukupno {x.ukupni_iznos} kn'.format(x=x),
            top=6.7 * cm,
            width=17 * cm,
            style={'alignment': TA_RIGHT}),
    ])
Exemplo n.º 2
0
class AccessReport(UDSGeraldoReport):
    header_elements = []

    class band_detail(ReportBand):
        height = 400 * mm  # Height bigger than a page, so a new page is launched
        # auto_expand_height = True
        elements = (
            Label(text=_('Users access by date'), top=0.6 * cm, left=0, width=BAND_WIDTH,
                  style={'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER}),
            UDSImage(left=4 * cm, top=1 * cm,
                     width=GERALDO_WIDTH, height=GERALDO_HEIGHT,
                     get_image=lambda x: x.instance['image']),

            Label(text=_('Users access by day of week'), top=GERALDO_HEIGHT + 1.2 * cm, left=0, width=BAND_WIDTH,
                  style={'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER}),
            UDSImage(left=4 * cm, top=GERALDO_HEIGHT + 1.6 * cm,
                     width=GERALDO_WIDTH, height=GERALDO_HEIGHT,
                     get_image=lambda x: x.instance['image2']),

            Label(text=_('Users access by hour'), top=2 * GERALDO_HEIGHT + 2 * cm, left=0, width=BAND_WIDTH,
                  style={'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER}),
            UDSImage(left=4 * cm, top=2 * GERALDO_HEIGHT + 2.4 * cm,
                     width=GERALDO_WIDTH, height=GERALDO_HEIGHT,
                     get_image=lambda x: x.instance['image3']),
        )

    subreports = [
        SubReport(
            queryset_string='%(object)s["data"]',
            band_header=ReportBand(
                height=1 * cm,
                auto_expand_height=True,
                elements=(
                    Label(text=_('Users access by date'), top=0.2 * cm, left=0, width=BAND_WIDTH,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 12, 'alignment': TA_CENTER}),
                    Label(text=_('Date range'), top=1.0 * cm, left=1.2 * cm,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 10}),
                    Label(text=_('Users'), top=1.0 * cm, left=14 * cm,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 10}),
                ),
                # borders={'bottom': True}
            ),
            band_detail=ReportBand(
                height=0.5 * cm,
                elements=(
                    ObjectValue(attribute_name='date', top=0, left=1.2 * cm, width=12 * cm, style={'fontName': 'Helvetica', 'fontSize': 9}),
                    ObjectValue(attribute_name='users', top=0, left=14 * cm, style={'fontName': 'Helvetica', 'fontSize': 9}),
                )
            ),
        )
    ]
Exemplo n.º 3
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},
         ),
     ),
 ]
Exemplo n.º 4
0
class CountersPoolsReport(UDSGeraldoReport):
    title = ''
    author = 'UDS'

    header_elements = []

    header_height = 2.5 * cm

    class band_detail(ReportBand):
        height = 400 * mm  # Height bigger than a page, so a new page is launched for listings
        elements = (
            Label(text=_('Services Asignation'), top=0.6 * cm, left=0, width=BAND_WIDTH,
                  style={'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER}),
            UDSImage(left=4 * cm, top=1 * cm,
                     width=GERALDO_WIDTH, height=GERALDO_HEIGHT,
                     get_image=lambda x: x.instance['image']),
        )

    subreports = [
        SubReport(
            queryset_string='%(object)s["data"]',
            band_header=ReportBand(
                height=1 * cm,
                auto_expand_height=True,
                elements=(
                    Label(text=_('Service asignation by hour'), top=0.2 * cm, left=0, width=BAND_WIDTH,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 12, 'alignment': TA_CENTER}),
                    Label(text=_('Pool'), top=1.0 * cm, left=1.2 * cm,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 10}),
                    Label(text=_('Hour'), top=1.0 * cm, left=10 * cm,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 10}),
                    Label(text=_('Services'), top=1.0 * cm, left=14 * cm,
                          style={'fontName': 'Helvetica-Bold', 'fontSize': 10}),
                ),
                # borders={'bottom': True}
            ),
            band_detail=ReportBand(
                height=0.5 * cm,
                elements=(
                    ObjectValue(attribute_name='name', top=0, left=1.2 * cm, width=8.8 * cm, style={'fontName': 'Helvetica', 'fontSize': 9}),
                    ObjectValue(attribute_name='time', top=0, left=10 * cm, width=4 * cm, style={'fontName': 'Helvetica', 'fontSize': 9}),
                    ObjectValue(attribute_name='value', top=0, left=14 * cm, width=4 * cm, style={'fontName': 'Helvetica', 'fontSize': 9}),
                )
            ),
        )
    ]
Exemplo n.º 5
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},
				)
			    ),
			]
Exemplo n.º 6
0
class InfoCasaLegislativa(ReportDefault):
    title = _(u'Casa Legislativa')

    class band_summary(ReportBand):
        pass

    class band_page_footer(ReportBand):
        height = 1 * cm

        elements = [
            SystemField(expression=_(u'%(now:%d/%m/%Y)s às %(now:%H:%M)s'),
                        top=0.3 * cm),
        ]

    class band_detail(ReportDefault.band_detail):

        posicao_left = [
            0,
            1.3,  # Tipo
            0,
            1.8,  # Regiao
            5.5,
            6.8,  # U.F.
            0,
            2.3,  # Municipio
            0,
            2.4,  # Endereco
            0,
            1.6,  # Bairro
            0,
            1.3,  # CEP
            0,
            1.6,  # CNPJ
            0,
            2.3,  # Telefone
            0,
            2.7,  # Presidente
        ]
        posicao_top = [
            0.5,  # Tipo
            1.3,  # Regiao
            1.3,  # U.F.
            2.1,  # Municipio
            2.9,  # Logradouro
            3.7,  # Bairro
            4.5,  # CEP
            5.3,  # CNPJ
            6.1,  # Telefone
            6.9,  # Presidente
        ]

        height = 30 * cm

        display_inline = True
        default_style = {'fontName': 'Helvetica', 'fontSize': 14}

        elements = [
            Label(
                text=label_text(_(u"Tipo")),
                left=posicao_left[0] * cm,
                top=posicao_top[0] * cm,
            ),
            ObjectValue(
                attribute_name='tipo.nome',
                left=posicao_left[1] * cm,
                top=posicao_top[0] * cm,
                width=6 * cm,
            ),
            Label(
                text=label_text(_(u"Região")),
                left=posicao_left[2] * cm,
                top=posicao_top[1] * cm,
            ),
            ObjectValue(attribute_name='municipio.uf.regiao',
                        left=posicao_left[3] * cm,
                        top=posicao_top[1] * cm,
                        get_value=lambda instance: {
                            'SL': _(u'Sul'),
                            'SD': _(u'Sudeste'),
                            'CO': _(u'Centro-Oeste'),
                            'NE': _(u'Nordeste'),
                            'NO': _(u'Norte'),
                        }[instance.municipio.uf.regiao]),
            Label(
                text=label_text(_(u"UF")),
                left=posicao_left[4] * cm,
                top=posicao_top[2] * cm,
            ),
            ObjectValue(
                attribute_name='municipio.uf',
                left=posicao_left[5] * cm,
                top=posicao_top[2] * cm,
            ),
            Label(
                text=label_text(_(u"Município")),
                left=posicao_left[6] * cm,
                top=posicao_top[3] * cm,
            ),
            ObjectValue(
                attribute_name='municipio.nome',
                left=posicao_left[7] * cm,
                top=posicao_top[3] * cm,
                width=20 * cm,
            ),
            # Linha 3
            Label(
                text=label_text(_(u"Endereço")),
                left=posicao_left[8] * cm,
                top=posicao_top[4] * cm,
            ),
            ObjectValue(
                attribute_name='logradouro',
                left=posicao_left[9] * cm,
                top=posicao_top[4] * cm,
                width=20 * cm,
            ),
            Label(
                text=label_text(_(u"Bairro")),
                left=posicao_left[10] * cm,
                top=posicao_top[5] * cm,
            ),
            ObjectValue(
                attribute_name='bairro',
                left=posicao_left[11] * cm,
                top=posicao_top[5] * cm,
            ),
            Label(
                text=label_text(_(u"CEP")),
                left=posicao_left[12] * cm,
                top=posicao_top[6] * cm,
            ),
            ObjectValue(
                attribute_name='cep',
                left=posicao_left[13] * cm,
                top=posicao_top[6] * cm,
            ),
            Label(
                text=label_text(_(u"CNPJ")),
                left=posicao_left[14] * cm,
                top=posicao_top[7] * cm,
            ),
            ObjectValue(
                attribute_name='cnpj',
                left=posicao_left[15] * cm,
                top=posicao_top[7] * cm,
            ),
            Label(
                text=label_text(_(u"Telefone")),
                left=posicao_left[16] * cm,
                top=posicao_top[8] * cm,
            ),
            ObjectValue(
                attribute_name='telefone',
                left=posicao_left[17] * cm,
                top=posicao_top[8] * cm,
            ),
            Label(
                text=label_text(_(u"Presidente")),
                left=posicao_left[18] * cm,
                top=posicao_top[9] * cm,
            ),
            ObjectValue(
                attribute_name='presidente',
                left=posicao_left[19] * cm,
                top=posicao_top[9] * cm,
                width=20 * cm,
            ),
        ]

    # Telefones
    tel_top = 2 * cm
    tel_left = [0, 3, 5]
    # Contato
    cont_top = 2 * cm
    cont_left = [0, 6, 9]
    # Convenios
    convenio_top = 2 * cm
    convenio_left = [0, 1.8, 4.5, 8, 10.5, 13, 15.5, 18]
    subreports = [
        # Telefones
        SubReport(
            queryset_string='%(object)s.telefones.all()',
            band_header=ReportBand(
                default_style={
                    'fontName': 'Helvetica',
                    'fontSize': 12
                },
                height=2.5 * cm,
                elements=[
                    Label(
                        text=_(u"Telefone(s)"),
                        style={
                            'fontSize': 14,
                            'alignment': TA_CENTER
                        },
                        width=BAND_WIDTH,
                        top=1 * cm,
                    ),
                    Label(text=_(u"Número"),
                          left=tel_left[0] * cm,
                          top=tel_top),
                    Label(text=_(u"Tipo"), left=tel_left[1] * cm, top=tel_top),
                    Label(text=_(u"Nota"), left=tel_left[2] * cm, top=tel_top),
                ],
                borders={'bottom': True},
            ),
            band_detail=ReportBand(
                default_style={
                    'fontName': 'Helvetica',
                    'fontSize': 11
                },
                height=0.5 * cm,
                elements=[
                    ObjectValue(attribute_name='__unicode__',
                                left=tel_left[0] * cm),
                    ObjectValue(
                        attribute_name='tipo',
                        left=tel_left[1] * cm,
                        get_value=lambda instance: {
                            'F': _(u'Fixo'),
                            'M': _(u'Móvel'),
                            'X': _(u'Fax'),
                            'I': _(u'Indefinido')
                        }[instance.tipo],
                    ),
                    ObjectValue(attribute_name='nota', left=tel_left[2] * cm),
                ],
                #borders = {'all':True},
            ),
        ),
        # Contatos
        SubReport(
            queryset_string='%(object)s.funcionario_set.all()',
            band_header=ReportBand(
                default_style={
                    'fontName': 'Helvetica',
                    'fontSize': 12
                },
                height=2.5 * cm,
                elements=[
                    Label(
                        text=_(u"Contato(s)"),
                        style={
                            'fontSize': 14,
                            'alignment': TA_CENTER
                        },
                        width=BAND_WIDTH,
                        top=1 * cm,
                    ),
                    Label(text=_(u"Nome"),
                          left=cont_left[0] * cm,
                          top=cont_top),
                    Label(text=_(u"Nota"),
                          left=cont_left[1] * cm,
                          top=cont_top),
                    Label(text=_(u"E-mail"),
                          left=cont_left[2] * cm,
                          top=cont_top),
                ],
                borders={
                    'bottom': True,
                    'top': True
                },
            ),
            band_detail=ReportBand(
                default_style={
                    'fontName': 'Helvetica',
                    'fontSize': 11
                },
                height=0.5 * cm,
                elements=[
                    ObjectValue(attribute_name='nome', left=cont_left[0] * cm),
                    ObjectValue(attribute_name='nota', left=cont_left[1] * cm),
                    ObjectValue(attribute_name='email',
                                left=cont_left[2] * cm),
                ],
                #borders = {'all':True},
            ),
        ),
        # Convenios
        SubReport(
            queryset_string='%(object)s.convenio_set.all()',
            band_header=ReportBand(default_style={
                'fontName': 'Helvetica',
                'fontSize': 12
            },
                                   height=2.5 * cm,
                                   elements=[
                                       Label(
                                           text=_(u"Convênio(s)"),
                                           style={
                                               'fontSize': 14,
                                               'alignment': TA_CENTER
                                           },
                                           width=BAND_WIDTH,
                                           top=1 * cm,
                                       ),
                                       Label(text=_(u"Projeto"),
                                             left=convenio_left[0] * cm,
                                             top=convenio_top),
                                       Label(text=_(u"Nº Convenio"),
                                             left=convenio_left[1] * cm,
                                             top=convenio_top),
                                       Label(text=_(u"Nº Processo SF"),
                                             left=convenio_left[2] * cm,
                                             top=convenio_top),
                                       Label(text=_(u"Adesão"),
                                             left=convenio_left[3] * cm,
                                             top=convenio_top),
                                       Label(text=_(u"Convênio"),
                                             left=convenio_left[4] * cm,
                                             top=convenio_top),
                                       Label(text=_(u"Equipada"),
                                             left=convenio_left[5] * cm,
                                             top=convenio_top),
                                       Label(text=_(u"Data D.O."),
                                             left=convenio_left[6] * cm,
                                             top=convenio_top),
                                   ],
                                   borders={'bottom': True}),
            band_detail=ReportBand(
                default_style={
                    'fontName': 'Helvetica',
                    'fontSize': 11
                },
                height=0.5 * cm,
                elements=[
                    ObjectValue(attribute_name='projeto.sigla',
                                left=convenio_left[0] * cm),
                    ObjectValue(attribute_name='num_convenio',
                                left=convenio_left[1] * cm),
                    ObjectValue(attribute_name='num_processo_sf',
                                left=convenio_left[2] * cm),
                    ObjectValue(attribute_name='data_adesao',
                                left=convenio_left[3] * cm,
                                get_value=lambda instance: instance.data_adesao
                                .strftime('%d/%m/%Y')
                                if instance.data_adesao is not None else '-'),
                    ObjectValue(attribute_name='data_retorno_assinatura',
                                left=convenio_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_termo_aceite',
                        left=convenio_left[5] * 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='data_pub_diario',
                        left=convenio_left[6] * cm,
                        get_value=lambda instance: instance.data_pub_diario.
                        strftime('%d/%m/%Y')
                        if instance.data_pub_diario is not None else '-'),
                ],
                #borders = {'all':True},
            ),
        )
    ]
Exemplo n.º 7
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},
                    ))
    ]
Exemplo n.º 8
0
 class MyReport(Report):
     def __init__(self, queryset=None, db=None):
         " Initialise parent class & make any necessary modifications "
         Report.__init__(self, queryset)
         self.db = db
     # can't use T() here!
     title = "Kits"
     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=2*cm),
             Label(text="Cost", top=0.8*cm, left=10*cm),
             Label(text="Monthly", top=0.8*cm, left=12*cm),
             Label(text="per Minute", top=0.8*cm, left=14*cm),
             Label(text="per Megabyte", top=0.8*cm, left=16*cm),
             Label(text="Comments", top=0.8*cm, left=18*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=1.8*cm),
                 ObjectValue(attribute_name="description", left=2*cm, width=8*cm),
                 ObjectValue(attribute_name="total_unit_cost", left=10*cm, width=2*cm),
                 ObjectValue(attribute_name="total_monthly_cost", left=12*cm, width=2*cm),
                 ObjectValue(attribute_name="total_minute_cost", left=14*cm, width=2*cm),
                 ObjectValue(attribute_name="total_megabyte_cost", left=16*cm, width=2*cm),
                 ObjectValue(attribute_name="comments", left=18*cm, width=6*cm),
                 )
     subreports = [
         SubReport(
             #queryset_string = "db((db.budget_kit_item.kit_id == %(object)s.id) & (db.budget_item.id == db.budget_kit_item.item_id)).select(db.budget_item.code, db.budget_item.description, db.budget_item.unit_cost)",
             #queryset_string = "db(db.budget_kit_item.kit_id == %(object)s.id).select()",
             band_header = ReportBand(
                     height=0.5*cm,
                     elements=[
                         Label(text="Item ID", top=0, left=0.2*cm, style={"fontName": "Helvetica-Bold"}),
                         Label(text="Quantity", top=0, left=2*cm, style={"fontName": "Helvetica-Bold"}),
                         #Label(text="Unit Cost", top=0, left=4*cm, style={"fontName": "Helvetica-Bold"}),
                         ],
                     borders={"top": True, "left": True, "right": True},
                     ),
             detail_band = ReportBand(
                     height=0.5*cm,
                     elements=[
                         ObjectValue(attribute_name="item_id", top=0, left=0.2*cm),
                         ObjectValue(attribute_name="quantity", top=0, left=2*cm),
                         #ObjectValue(attribute_name="unit_cost", top=0, left=4*cm),
                         ]
                     ),
             ),
         ]
Exemplo n.º 9
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},
            ),
        ),
    ]
Exemplo n.º 10
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},
                )
            ),
        ]
Exemplo n.º 11
0
class SubReport_Porez(SubReport):
    def get_queryset(self, subrepo, racun):
        return racun.racunporez_set.all()

    band_header = ReportBand(elements=[
        Label(
            text='Stopa PDV-a',
            top=6.7 * cm,
            width=17 * cm,
            style={
                'alignment': TA_LEFT,
                'fontName': 'Helvetica-Bold',
                'fontSize': 10
            },
        ),
        Label(
            text='Osnovica PDV-a',
            top=6.7 * cm,
            left=3 * cm,
            width=14 * cm,
            style={
                'alignment': TA_LEFT,
                'fontName': 'Helvetica-Bold',
                'fontSize': 10
            },
        ),
        Label(
            text='Iznos PDV-a',
            top=6.7 * cm,
            left=6 * cm,
            width=11 * cm,
            style={
                'alignment': TA_LEFT,
                'fontName': 'Helvetica-Bold',
                'fontSize': 10
            },
        ),
        Label(
            text='Ukupno',
            top=6.7 * cm,
            width=10.5 * cm,
            style={
                'alignment': TA_RIGHT,
                'fontName': 'Segoe UI Bold',
                'fontSize': 10
            },
        ),
    ])
    band_detail = ReportBand(
        height=0.5 * cm,
        elements=[
            ObjectValue(
                get_value=lambda x: '{x.stopa_poreza} %'.format(x=x),
                attribute_name='stopa_poreza',
                top=6.3 * cm,
                width=2 * cm,
                style={'alignment': TA_CENTER},
            ),
            ObjectValue(
                attribute_name='osnovica_poreza',
                top=6.3 * cm,
                width=5.6 * cm,
                style={'alignment': TA_RIGHT},
            ),
            ObjectValue(
                attribute_name='iznos_poreza',
                top=6.3 * cm,
                width=8 * cm,
                height=0.1 * cm,
                style={'alignment': TA_RIGHT},
            ),
            ObjectValue(
                attribute_name='ukupno',
                top=6.3 * cm,
                width=10.5 * cm,
                style={'alignment': TA_RIGHT},
            ),
        ])
    band_footer = ReportBand(elements=[
        Line(
            top=6.4 * cm,
            left=0.0 * cm,
            right=10.5 * cm,
            bottom=6.4 * cm,
            stroke_width=0.8,
        ),
        Label(text='Ukupno',
              top=6.5 * cm,
              style={
                  'alignment': TA_LEFT,
                  'fontSize': 13
              }),
        ObjectValue(
            attribute_name='ukupno_osnovica',
            top=6.5 * cm,
            width=5.6 * cm,
            style={'alignment': TA_RIGHT},
        ),
        ObjectValue(
            attribute_name='ukupno_porez',
            top=6.5 * cm,
            width=8 * cm,
            style={'alignment': TA_RIGHT},
        ),
        ObjectValue(
            attribute_name='ukupni_iznos',
            top=6.5 * cm,
            width=10.5 * cm,
            style={'alignment': TA_RIGHT},
        ),
        ObjectValue(get_value=lambda x: 'JIR: {x.jir}'.format(x=x),
                    top=8.2 * cm,
                    width=17 * cm,
                    left=0.5 * cm,
                    style={'alignment': TA_LEFT}),
        Rect(left=0 * cm, top=8 * cm, width=10 * cm, height=1.5 * cm),
        ObjectValue(get_value=lambda x: 'ZKI: {x.zki}'.format(x=x),
                    top=8.7 * cm,
                    left=0.5 * cm,
                    width=17 * cm,
                    style={'alignment': TA_LEFT}),
    ])
Exemplo n.º 12
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},
            ))
    ]
Exemplo n.º 13
0
    class MyFamilyReport(Report):
        title = 'NCS_CS'

        class band_detail(DetailBand):
            height = 0.7 * cm
            elements = [
                ObjectValue(expression='name', left=0.5 * cm),
                ObjectValue(expression='c',
                            left=3.5 * cm,
                            get_value=lambda instance: "%.5f" % instance.c),
                ObjectValue(expression='s',
                            left=6.5 * cm,
                            get_value=lambda instance: "%.5f" % instance.s),
                ObjectValue(expression='user', left=9.5 * cm),
                ObjectValue(expression='mdate', left=12.5 * cm),
            ]
            borders = {'top': True, 'bottom': .3}

        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}),
                Label(text="Name", top=0.8 * cm, left=0.5 * cm),
                Label(text="c", top=0.8 * cm, left=3.5 * cm),
                Label(text="s", top=0.8 * cm, left=6.5 * cm),
                Label(text="user", top=0.8 * cm, left=9.5 * cm),
                Label(text="time", top=0.8 * cm, left=12.5 * cm),
            ]
            #borders = {'all': True}

        class band_page_footer(ReportBand):
            height = 0.5 * cm
            elements = [
                Label(text='Geraldo Reports', top=0.1 * cm),
                SystemField(
                    expression='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}

        subreports = [
            SubReport(
                queryset_string='%(object)s.singles',
                # band_header = ReportBand(
                # height=0.9*cm,
                # elements=[
                # Label(text='id', top=0.2*cm, left=0.2*cm, style={'fontName': 'Helvetica-Bold'}),
                # Label(text='name', top=0.2*cm, left=4*cm, style={'fontName': 'Helvetica-Bold'}),
                # ],
                # ),
                band_detail=ReportBand(
                    height=0.5 * cm,

                    # This is a new attribute to force the band width
                    # width = 6*cm,

                    # # This attribute forces a distance at right and bottom sides of the band
                    # margin_right = 0.2*cm,
                    # margin_bottom = 0.2*cm,

                    # # With this attribute as True, the band will try to align in
                    # # the same line
                    # display_inline = True,
                    elements=[
                        ObjectValue(
                            attribute_name='c',
                            left=3.5 * cm,
                            get_value=lambda instance: "%.5f" % instance.c),
                        ObjectValue(
                            attribute_name='s',
                            left=6.5 * cm,
                            get_value=lambda instance: "%.5f" % instance.s),
                    ],
                    #borders={'all': True},
                ),
                # band_footer = ReportBand(
                # height=0.9*cm,
                # elements=[
                # ObjectValue(attribute_name='id', top=0.2*cm, left=4*cm,\
                # action=FIELD_ACTION_COUNT, display_format='%s permissions found',
                # style={'fontName': 'Helvetica-Bold'}),
                # ],
                # ),
            ),
        ]