class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='name', left=0.5 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), ObjectValue(attribute_name='real_name', left=6 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), ObjectValue(attribute_name='last_access', left=15 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), )
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='name', left=0.5 * cm), ObjectValue(attribute_name='real_name', left=3 * cm), ObjectValue(attribute_name='last_access', left=7 * cm), )
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='id', top=1 * cm, left=0.5 * cm), ObjectValue(attribute_name='placa', top=1 * cm, left=3 * cm), ) borders = {'all': False}
class band_summary(ReportBand): height = 1.5 * cm elements = [ Label(text='Horario de clases', top=0.1 * cm, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), ObjectValue(attribute_name='get_full_alumno', top=0 * cm, left=0, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 8, 'alignment': TA_LEFT }), ObjectValue(attribute_name='alumno.cve_usuario.get_full_name', top=0.4 * cm, left=0, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 8, 'alignment': TA_LEFT }), ]
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='id', left=0.5 * cm), ObjectValue(attribute_name='date_creation', left=3 * cm, get_value=lambda instance: six.text_type(instance)), )
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='user', left=0.5 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), ObjectValue(attribute_name='sessions', left=5.5 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), ObjectValue(attribute_name='hours', left=7.5 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), ObjectValue(attribute_name='average', left=12 * cm, style={'fontName': 'Helvetica', 'fontSize': 8}), )
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_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='cliente.nome', left=0.5 * cm), ObjectValue(attribute_name='dataEntrega', left=6 * cm), ObjectValue(attribute_name='valorCobrado', left=10 * cm), ObjectValue(attribute_name='valorGasto', left=14 * cm), )
class band_detail(DetailBand): height=0.5*cm elements=[ ObjectValue(attribute_name='materia.cve_materia',top=5*cm, left=0.2*cm, style={'fontName': 'Helvetica', 'fontSize':8}), ObjectValue(attribute_name='materia.nombre',top=5*cm, left=2*cm, style={'fontName': 'Helvetica', 'fontSize':8}), ObjectValue(attribute_name='periodo',top=5*cm, left=6.2*cm, style={'fontName': 'Helvetica', 'fontSize':8}), ObjectValue(attribute_name='evaluacion',top=5*cm, left=8.3*cm, style={'fontName': 'Helvetica', 'fontSize':8}), ObjectValue(attribute_name='calificacion',top=5*cm, left=10.7*cm, style={'fontName': 'Helvetica', 'fontSize':8}), ]
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='id', top=0, left=0.5 * cm), ObjectValue(attribute_name='username', top=0, left=2.5 * cm), ObjectValue(attribute_name='first_name', top=0, left=4.5 * cm), ObjectValue(attribute_name='last_name', top=0, left=6.5 * cm), ObjectValue(attribute_name='email', top=0, left=8.5 * cm), )
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='name', left=0.5 * cm), ObjectValue( attribute_name='age', left=3 * cm, get_value=lambda instance: six.text_type(instance['age'])), )
class band_detail(ReportBand): height = 0.7 * cm elements = [ Rect(left=0 * cm, top=8.8 * cm, width=2.5 * cm, height=0.9 * cm, fill=False, stroke=True), # above is rectangle for item ObjectValue(attribute_name='id', left=0 * cm, top=0 * cm), Rect(left=2.5 * cm, top=8.8 * cm, width=9 * cm, height=0.9 * cm, fill=False, stroke=True), # above is rectangle for description ObjectValue(attribute_name='item_desc', width=BAND_WIDTH, left=3 * cm, top=0 * cm), Rect(left=11.5 * cm, top=8.8 * cm, width=5 * cm, height=0.9 * cm, fill=False, stroke=True), # above is rectangle for qty ObjectValue(attribute_name='Quantity', width=BAND_WIDTH, left=12.2 * cm, top=0 * cm), Rect(left=16.5 * cm, top=8.8 * cm, width=6 * cm, height=0.9 * cm, fill=False, stroke=True), # above is rectangle for unit price ObjectValue(attribute_name='unitPrice_rwf', width=BAND_WIDTH, left=17 * cm, top=0 * cm), Rect(left=22.5 * cm, top=8.8 * cm, width=4 * cm, height=0.9 * cm, fill=False, stroke=True), # above is rectangle for sum ObjectValue(attribute_name='total', width=BAND_WIDTH, left=23 * cm, top=0 * cm), ]
class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='cliente.nome', left=0.5 * cm), ObjectValue(attribute_name='dataVenda', left=6 * cm, get_value=lambda instance: instance.dataVenda.strftime( '%d/%m/%Y')), ObjectValue(attribute_name='valorCobrado', left=10 * cm), ObjectValue(attribute_name='valorGasto', left=14 * cm), )
class band_summary(ReportBand): height = 1.5*cm elements = [ ObjectValue(attribute_name='materia_grupo.profesor.cve_usuario.get_full_name_prof' , top= 0*cm,left=0,style={'fontName': 'Helvetica-Bold', 'fontSize':8, 'alignment': TA_LEFT}), ObjectValue(attribute_name='materia_grupo.materia.get_full_name_mate' , top= 0.4*cm,left=0*cm,style={'fontName': 'Helvetica-Bold', 'fontSize':8, 'alignment': TA_LEFT}), ObjectValue(attribute_name='materia_grupo.grupo.get_full_name_gpo' , top= 0.8*cm,left=0*cm,style={'fontName': 'Helvetica-Bold', 'fontSize':8, 'alignment': TA_LEFT}), ] borders = {'bottom': Line(stroke_width=2)}
class band_summary(ReportBand): height = 0.8 * cm elements = [ SystemField(expression=u'----------------------------------------------------------------------------------------------------------------------------------------------------------------', top=0.1*cm, width=BAND_WIDTH), Label(text="Lucro", top=0.5*cm,style={'fontName': 'Helvetica-Bold'}, left=0.5*cm), ObjectValue(attribute_name='valorCobrado', top=0.5*cm, left=4*cm,\ action=FIELD_ACTION_SUM), Label(text="Gastos", top=1*cm, style={'fontName': 'Helvetica-Bold'},left=0.5*cm), ObjectValue(attribute_name='valorGasto', top=1*cm, left=4*cm,\ action=FIELD_ACTION_SUM), ]
class band_summary(ReportBand): height = 0.5 * cm elements = [ Label(text='Totals:'), ObjectValue(expression='avg(age)', left=5 * cm, style={'fontName': 'Helvetica-Bold'}), ObjectValue(expression='sum(weight)', left=6.5 * cm, style={'fontName': 'Helvetica-Bold'}), ] borders = {'top': True}
class band_summary(ReportBand): height = 1.5*cm elements = [ ObjectValue(attribute_name='get_full_alumno' , top= 0*cm,left=2*cm,style={'fontName': 'Helvetica-Bold', 'fontSize':8, 'alignment': TA_LEFT}), ObjectValue(attribute_name='alumno.cve_usuario.get_full_name' , top= 0*cm,left=7.5*cm,style={'fontName': 'Helvetica-Bold', 'fontSize':8, 'alignment': TA_LEFT}), Label(text='Plan de estudios: 09', top=0*cm, left=13*cm, style={'fontName': 'Helvetica-bold', 'fontSize':8}), Label(text='Licenciatura en: Ingeniería en sistemas computacionales', top=0.5*cm, left=2*cm, width=9*cm, style={'fontName': 'Helvetica-bold', 'fontSize':8}), Label(text='Último grupo: ', top=0.5*cm, left=13*cm, style={'fontName': 'Helvetica-bold', 'fontSize':8}), #ObjectValue(attribute_name='materia',top=0.5*cm, left=15*cm, style={'fontName': 'Helvetica-bold', 'fontSize':8}), ] borders = {'bottom': Line(stroke_width=2)}
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}), ) ), ) ]
class band_detail(ReportBand): height = 0.5*cm bandera=True elements=( ObjectValue(attribute_name='alumno.cve_usuario',top=5*cm, left=0.5*cm, style={'fontName': 'Helvetica-Bold', 'fontSize':8}), ObjectValue(attribute_name='alumno.cve_usuario.get_full_name' , top=5*cm,left=3*cm ,style={'fontName': 'Helvetica-Bold', 'fontSize':8}), ObjectValue(attribute_name='calificacion' , top=5*cm,left=8*cm ,style={'fontName': 'Helvetica-Bold', 'fontSize':8}), )
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), ]
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}
def __init__(self, queryset, formato): super(CasasLegislativasLabelsSemPresidente, self).__init__(queryset=queryset, formato=formato) calc_width = (self.largura_etiqueta - self.label_margin_left - self.label_margin_right) * cm calc_height = lambda rows: (self.delta * rows) * cm calc_top = lambda row: (self.label_margin_top + row * self.delta) * cm calc_left = self.label_margin_left * cm my_elements = [ Label( text=label_text(_(u'A Sua Excelência o(a) Senhor(a)')), top=calc_top(0), left=calc_left, width=calc_width, ), ObjectValue(attribute_name='nome', top=calc_top(1), left=calc_left, width=calc_width, height=calc_height(2), get_value=lambda instance: (_(u"Presidente da %s") % instance.nome)), ObjectValue( attribute_name='logradouro', top=calc_top(3), left=calc_left, width=calc_width, height=calc_height(2), get_value=lambda instance: "%s - %s - %s." % (instance.logradouro, instance.bairro, instance.municipio), ), ObjectValue(attribute_name='cep', top=calc_top(8), left=calc_left, width=calc_width, get_value=lambda instance: "%s: %s" % (_(u"CEP"), instance.cep)), ] self.band_detail = DetailBand(width=(self.largura_etiqueta) * cm, height=(self.altura_etiqueta) * cm, elements=my_elements, display_inline=True, default_style={ 'fontName': 'Helvetica', 'fontSize': self.tamanho_fonte })
class band_summary(ReportBand): height = 0.5 * cm elements = [ Label(text='Totals:', top=1.5 * cm), ObjectValue(expression='count(placa)', top=1.5 * cm, left=5 * cm), ] borders = {'top': True}
class band_detail(ReportBand): height = 2 * cm elements = [ ObjectValue(attribute_name='timestamp', top=0, left=0 * cm, width=3 * cm, get_value=lambda instance: instance.timestamp.strftime( '%m-%d-%Y %H:%M')), ObjectValue(attribute_name='message', top=0, left=3 * cm, width=11 * cm), ObjectValue(attribute_name='event_type', top=0, left=14.5 * cm), ] borders = {'bottom': True}
class band_detail(DetailBand): height = 0.7 * cm elements = [ Label(text='Name'), ObjectValue(expression='name', left=1.5 * cm), ] borders = {'bottom': True}
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}, ), ), ]
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}), ) ), ) ]
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}
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), )
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), )