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 ReporteRol(Report): title = 'Lista de Roles' page_size = landscape(A5) margin_left = 1 * cm margin_top = 1 * cm margin_right = 1 * cm margin_bottom = 1 * cm class band_begin(ReportBand): height = 0.5 * cm elements = [ Label(text='', top=0.1 * cm, left=8 * cm), ] class band_detail(ReportBand): height = 1 * cm elements = ( ObjectValue(attribute_name='id', top=0, left=0.5 * cm), ObjectValue(attribute_name='nombre', top=0, left=1.5 * cm), ObjectValue(attribute_name='categoria', top=0, left=5 * cm), ObjectValue(attribute_name='descripcion', top=0, left=6.5 * cm), ObjectValue(attribute_name='fecHor_creacion', top=0, left=12 * cm), ObjectValue(attribute_name='usuario_creador', top=0, left=16.5 * cm), ) class band_page_header(ReportBand): height = 1.2 * 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="ID", top=0.8 * cm, left=0.5 * cm), Label(text=u"Nombre", top=0.8 * cm, left=1.5 * cm), Label(text=u"Categoria", top=0.8 * cm, left=4.5 * cm), Label(text=u"Descripcion", top=0.8 * cm, left=6.5 * cm), Label(text=u"Fecha/Creacion", top=0.8 * cm, left=12 * cm), Label(text=u"Usuario/Creador", top=0.8 * cm, left=16.5 * 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 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}, ) ), ]
class ReporteUsuario(Report): title = 'Lista de Usuarios' page_size = landscape(A5) margin_left = 1 * cm margin_top = 1 * cm margin_right = 1 * cm margin_bottom = 1 * cm class band_begin(ReportBand): height = 0.5 * cm elements = [ Label(text='', top=0.1 * cm, left=8 * cm), ] 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_page_header(ReportBand): height = 1.2 * 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="ID", top=0.8 * cm, left=0.5 * cm), Label(text=u"usuario", top=0.8 * cm, left=2.5 * cm), Label(text=u"Nombre", top=0.8 * cm, left=4.5 * cm), Label(text=u"Apellido", top=0.8 * cm, left=6.5 * cm), Label(text=u"Email", top=0.8 * cm, left=8.5 * 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 ReportNewMems(Report): title = "New Memberships" author = "John Smith Corporation" page_size = landscape(A5) def __init__(self, *args, **kwargs): super(ReportNewMems, self).__init__(*args, **kwargs) class band_page_header(ReportBand): height = 1.2 * cm elements = [ Label(text="Name", top=0.8 * cm, left=0 * cm), Label(text="Email", top=0.8 * cm, left=2.5 * cm), Label(text="Type", top=0.8 * cm, left=5.5 * cm), Label(text="Application", top=0.8 * cm, left=8.5 * cm), Label(text="Price Paid", top=0.8 * cm, left=11.5 * cm), Label(text="Start Date", top=0.8 * cm, left=14.5 * cm), Label(text="End Date", top=0.8 * cm, left=17.5 * cm), ] class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='user', left=0 * cm, get_value=lambda instance: instance.user.last_name + ', ' + instance.user.first_name), ObjectValue(attribute_name='user', left=2.5 * cm, get_value=lambda instance: instance.user.email), ObjectValue(attribute_name='membership_type', left=5.5 * cm), ObjectValue(attribute_name='ma', left=8.5 * cm), ObjectValue(attribute_name='invoice', left=11.5 * cm, get_value=lambda instance: instance.invoice.total if instance.invoice else ''), #ObjectValue(attribute_name='payment_method', left=15*cm), ObjectValue(attribute_name='subscribe_dt', left=14.5 * cm, get_value=lambda instance: instance.subscribe_dt. strftime('%m/%d/%Y')), ObjectValue(attribute_name='expire_dt', left=17.5 * cm, get_value=lambda instance: instance.expire_dt.strftime( '%m/%d/%Y')), )
class MyReport(Report): title = _title page_size = landscape(A4) class band_page_header(ReportBand): height = 1.3*cm auto_expand_height = True elements = _elements 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 = tuple(detailElements)
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}, )) ]
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), ] ), ), ]
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}, ), ), ]
class simple(Report): additional_fonts = { 'Candara': os.path.join( cur_dir, '../main/static/fonts/Candara.ttf'), # full path to font file 'Candara-Bold': os.path.join(cur_dir, '../main/static/fonts/Candarab.ttf'), 'Candara-Italic': os.path.join(cur_dir, '../main/static/fonts/Candarai.ttf'), 'Calibri': os.path.join( cur_dir, '../main/static/fonts/Calibri.ttf'), # full path to font file 'Calibri-Bold': os.path.join(cur_dir, '../main/static/fonts/Calibri_Bold.ttf'), 'Calibri-Italic': os.path.join(cur_dir, '../main/static/fonts/Calibri_Italic.ttf'), 'Calibri-Bold-Italic': os.path.join(cur_dir, '../main/static/fonts/Calibri_Bold_Italic.ttf'), 'Trebuchet-MS': os.path.join(cur_dir, '../main/static/fonts/Trebuchet_MS.ttf'), 'Trebuchet-MS-Bold': os.path.join(cur_dir, '../main/static/fonts/Trebuchet_MS_Bold.ttf'), } title = 'Invoice' # default_style = {'fontName': 'Calibri','fontSize': 10} author = 'William Muganwa' default_style = {'fontName': 'Calibri', 'fontSize': 10} page_size = landscape(A4) margin_left = 1.8 * cm # margin_top = 0.5*cm # margin_right = 0.5*cm # margin_bottom = 0.5*cm class band_page_header(ReportBand): height = 0.5 * cm elements = [ Image(left=0.5 * cm, top=0.1 * cm, width=4 * cm, height=5.12 * cm, filename=os.path.join( cur_dir, '../main/static/images/intouchlogo.png')), Label(text='<b>intouch</b>', top=0.8 * cm, left=2.8 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 18 }), Label(text='<b>COMMUNICATIONS</b>', top=1.5 * cm, left=2.8 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Intouch Communications Ltd</b>', top=2.2 * cm, width=BAND_WIDTH, left=22.6 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 9 }), Label(text='<b>3rd Floor, Prince House, Remera</b>', top=2.6 * cm, width=BAND_WIDTH, left=22.2 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 9 }), Label(text='<b>Tel 1: +(250)-788-304-441,</b>', top=3 * cm, width=BAND_WIDTH, left=23.3 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 9 }), Label(text='<b>Tel 1: +(250)-785-971-082</b>', top=3.4 * cm, width=BAND_WIDTH, left=23.4 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 9 }), Label(text='<b>TIN: 102830733</b>', top=3.8 * cm, width=BAND_WIDTH, left=24.6 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 9 }), # Label(text='<b>Intouch Communications Ltd</b>', top=0.2*cm, width=BAND_WIDTH,style={'alignment':TA_RIGHT,'fontName': 'Candara-Bold','fontSize':9}), # Label(text='<b>3rd Floor, Prince House, Remera</b>', top=0.6*cm, width=BAND_WIDTH, style={'alignment':TA_RIGHT, 'fontName': 'Candara-Bold', 'fontSize':9}), # Label(text='<b>Tel 1: +(250)-788-304-441,</b>', top=1*cm, width=BAND_WIDTH, style={'alignment':TA_RIGHT, 'fontName': 'Candara-Bold', 'fontSize':9}), # Label(text='<b>Tel 1: +(250)-785-971-082</b>', top=1.4*cm, width=BAND_WIDTH, style={'alignment':TA_RIGHT, 'fontName': 'Candara-Bold', 'fontSize':9}), # Label(text='<b>TIN: 102830733</b>', top=1.8*cm, width=BAND_WIDTH, style={'alignment':TA_RIGHT, 'fontName': 'Candara-Bold', 'fontSize':9}), # SystemField(expression= '%(report_title)s', top=0.1*cm, left=0, width=BAND_WIDTH, # style={'fontName' : 'Helvetica', 'fontSize' : 10, 'alignment' : TA_CENTER} # ) ] class band_page_footer(ReportBand): height = 3 * cm elements = [ Label(text='<b>PAYMENT MODES: CHEQUE, BANK TRANSFER</b>', width=BAND_WIDTH, top=0.1 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 12, }), Label( text= 'Payment to be done to the account name and number shown below, Currency in Rwandan Francs', width=BAND_WIDTH, top=0.5 * cm, style={ 'fontSize': 12, 'fontName': 'Calibri' }), Label(text='Account name: INTOUCH COMMUNICATIONS LTD', width=BAND_WIDTH, top=1.2 * cm, style={ 'fontSize': 12, 'fontName': 'Calibri' }), Label(text='Bank Name: KCB', width=BAND_WIDTH, top=1.7 * cm, style={ 'fontSize': 10, 'fontName': 'Calibri' }), Label(text='Branch: Remera', width=BAND_WIDTH, top=2.1 * cm, style={ 'fontSize': 10, 'fontName': 'Calibri' }), Label(text='Account No.:4401710142', width=BAND_WIDTH, top=2.5 * cm, style={ 'fontSize': 10, 'fontName': 'Calibri' }), Label(text='Currency: RWANDAN FRANCS', width=BAND_WIDTH, top=2.9 * cm, style={ 'fontSize': 10, 'fontName': 'Calibri' }), # 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}), was for time printed # SystemField(expression=u'Page %(page_number)d of %(page_count)d', top=0.1*cm, # width=BAND_WIDTH, style= {'alignment': TA_RIGHT, 'fontName' : 'Helvetica', # 'fontSize' : 10},), ] # borders = {'top': True} class band_begin(ReportBand): height = 0.3 * cm elements = [ Label(text='<b>Invoice</b>', top=4 * cm, width=BAND_WIDTH, left=25.5 * cm, style={ 'fontName': 'Candara-Bold', 'fontSize': 10 }), # ObjectValue(expression='rick', left=25.5*cm,top=4.7*cm,width=BAND_WIDTH,style={'fontName': 'Calibri-Bold','fontSize':10}), Label(text='<b>Attention</b>', top=4.9 * cm, left=0.5 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Customer No</b>', top=5.7 * cm, left=0.5 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Our Reference</b>', top=6.7 * cm, left=0.5 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Customer</b>', top=5.7 * cm, left=8 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Description</b>', top=6.7 * cm, left=8 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Invoice Date</b>', top=5.7 * cm, left=15.5 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Label(text='<b>Invoice Due Date</b>', top=6.7 * cm, left=15.5 * cm, width=BAND_WIDTH, style={ 'alignment': TA_LEFT, 'fontName': 'Candara-Bold', 'fontSize': 10 }), Rect(left=0 * cm, top=7.9 * cm, width=2.5 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='<b>Item</b>', top=8.1 * cm, left=0.5 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=2.5 * cm, top=7.9 * cm, width=9 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='<b>Description</>', top=8.1 * cm, left=4 * cm, style={ 'fontName': 'Candara-Bold', 'alignment': TA_CENTER }), Rect(left=11.5 * cm, top=7.9 * cm, width=5 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='<b>Qty</b>', top=8.1 * cm, left=11.2 * cm, style={ 'fontName': 'Candara-Bold', 'alignment': TA_CENTER }), Rect(left=16.5 * cm, top=7.9 * cm, width=6 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='UNIT PRICE(RWF)', top=8.1 * cm, left=17 * cm, style={ 'fontName': 'Candara-Bold', 'alignment': TA_CENTER }), Rect(left=22.5 * cm, top=7.9 * cm, width=4 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='SUM(RWF)', top=8.1 * cm, left=22.3 * cm, style={ 'fontName': 'Candara-Bold', 'alignment': TA_CENTER }), # Rect(left=0*cm, top=8.8*cm, width=26.5*cm, height=1.5*cm, fill=False,stroke=True), # Label(text='Invoice Details', top=9.3*cm, left=10.3*cm, style={'fontName': 'Candara-Bold', 'alignment': TA_CENTER}), Rect(left=0 * cm, top=10.3 * cm, width=22.5 * cm, height=1.5 * cm, fill=False, stroke=True), Label(text='VAT included in price', top=10.8 * cm, left=0.5 * cm, style={ 'fontName': 'Candara-Bold', 'alignment': TA_LEFT }), Rect(left=22.5 * cm, top=10.3 * cm, width=4 * cm, height=1.5 * cm, fill=False, stroke=True), # Empty Label Rect(left=0 * cm, top=11.8 * cm, width=13 * cm, height=2.5 * cm, fill=False, stroke=True), Label(text='Received By:_________________________________________', top=12.3 * cm, left=0.5 * cm, width=BAND_WIDTH, style={ 'fontSize': 12, 'fontName': 'Candara-Bold' }), Label( text= 'Date:__________________________________________________________', top=13.2 * cm, left=0.5 * cm, width=BAND_WIDTH, style={'fontName': 'Candara-Bold'}), Rect(left=13 * cm, top=11.8 * cm, width=3.5 * cm, height=2.5 * cm, fill=False, stroke=True), Label(text='Currency:', top=12.3 * cm, left=13.7 * cm, style={'fontSize': 12}), Label(text='RWF', top=12.9 * cm, left=13.7 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=16.5 * cm, top=11.8 * cm, width=6 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='TOTAL EXCLU VAT:', top=12 * cm, left=19.1 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=22.5 * cm, top=11.8 * cm, width=4 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='xxxxx', top=12 * cm, left=24.2 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=16.5 * cm, top=12.7 * cm, width=6 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='VAT 18%:', top=12.9 * cm, left=20.7 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=22.5 * cm, top=12.7 * cm, width=4 * cm, height=0.9 * cm, fill=False, stroke=True), Label(text='xxxxx', top=12.9 * cm, left=24.2 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=16.5 * cm, top=13.6 * cm, width=6 * cm, height=0.7 * cm, fill=False, stroke=True), Label(text='TOTAL:', top=13.7 * cm, left=20.8 * cm, style={'fontName': 'Candara-Bold'}), Rect(left=22.5 * cm, top=13.6 * cm, width=4 * cm, height=0.7 * cm, fill=False, stroke=True), Label(text='xxxxx', top=13.7 * cm, left=24.2 * cm, style={'fontName': 'Candara-Bold'}), # Label Here ] 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 ReporteArtefacto(Report): title = 'Lista de Artefactos' page_size = landscape(A5) margin_left = 1 * cm margin_top = 1 * cm margin_right = 1 * cm margin_bottom = 1 * cm class band_begin(ReportBand): height = 0.5 * cm elements = [ Label(text='', top=0.1 * cm, left=8 * cm), ] class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='id', top=0, left=0.5 * cm), ObjectValue(attribute_name='nombre', top=0, left=2 * cm), ObjectValue(attribute_name='proyecto', top=0, left=4 * cm), ObjectValue(attribute_name='complejidad', top=0, left=6 * cm), ObjectValue(attribute_name='descripcion_corta', top=0, left=7 * cm), ObjectValue(attribute_name='descripcion_larga', top=0, left=11 * cm), ) class band_page_header(ReportBand): height = 1.2 * 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="ID", top=0.8 * cm, left=0.5 * cm), Label(text=u"Nombre", top=0.8 * cm, left=2 * cm), Label(text=u"Proyecto", top=0.8 * cm, left=4 * cm), Label(text=u"Complej.", top=0.8 * cm, left=5.5 * cm), Label(text=u"Descrip_corta", top=0.8 * cm, left=7 * cm), Label(text=u"Descrip_larga", top=0.8 * cm, left=11 * 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='SAIP 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}
class ReporteProyecto(Report): title = 'Lista de Proyectos' page_size = landscape(A5) margin_left = 1 * cm margin_top = 1 * cm margin_right = 1 * cm margin_bottom = 1 * cm class band_begin(ReportBand): height = 0.5 * cm elements = [ Label(text='', top=0.1 * cm, left=8 * cm), ] class band_detail(ReportBand): height = 0.5 * cm elements = ( ObjectValue(attribute_name='id', top=0, left=0.5 * cm), ObjectValue(attribute_name='nombre', top=0, left=2.5 * cm), ObjectValue(attribute_name='usuario_lider', top=0, left=4.5 * cm), ObjectValue(attribute_name='descripcion', top=0, left=6 * cm), ObjectValue(attribute_name='fecha_inicio', top=0, left=12 * cm), ObjectValue(attribute_name='fecha_fin', top=0, left=15 * cm), ) class band_page_header(ReportBand): height = 1.2 * 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="ID", top=0.8 * cm, left=0.5 * cm), Label(text=u"Nombre", top=0.8 * cm, left=2.5 * cm), Label(text=u"Lider", top=0.8 * cm, left=4.5 * cm), Label(text=u"Descripcion", top=0.8 * cm, left=6 * cm), Label(text=u"Inicio", top=0.8 * cm, left=12 * cm), Label(text=u"Fin", top=0.8 * cm, left=15 * 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='SAIP Reports', top=0.1 * cm), SystemField(expression=u'%(now:%Y, %b %d)s %(now:%H:%M)s', top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'top': True}