class band_page_header(ReportBand): height = 4.2 * cm label_top = 3.7 * cm default_style = {'fontName': 'Helvetica', 'fontSize': 9} BASE_DIR = os.path.abspath(os.path.dirname(__file__) + '../../../../') #BASE_DIR = os.path.abspath(os.getcwd() + '../..') elements = [ Image( filename=BASE_DIR + static('img/logo-interlegis.jpg'), left=15.5 * cm, right=1 * cm, top=0.1 * cm, bottom=1 * cm, width=4.2 * cm, height=3 * cm, ), Image( filename=BASE_DIR + 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 }), ] borders = {'bottom': True}
def inserir_logo(self, path_imagem): logo = Image(left=0.5 * cm, top=0.3 * cm, right=10 * cm, bottom=0.5 * cm, width=5.5 * cm, height=5.5 * cm, filename=path_imagem) self.elements.append(logo)
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, ), ]
def dados_emitente_logo_horizontal(self, arquivo_imagem): elements = [] # # Dados do remetente # img = Image() img.top = 0.1*cm img.left = 0.1*cm # # Tamanhos equilaventes, em centímetros, a 3,8 x 2,5, em 128 dpi # estranhamente, colocar os tamanhos em centímetros encolhe a imagem # img.width = 191 img.height = 116 img.filename = arquivo_imagem elements.append(img) fld = Campo() fld.nome = 'fld_rem_nome' fld.attribute_name = u'NFe.infNFe.emit.xNome.valor' fld.top = 0.2*cm fld.left = 4*cm fld.width = 4*cm fld.height = 1.4*cm fld.style = EMIT_NOME elements.append(fld) fld = Campo() fld.nome = 'fld_rem_endereco_3' fld.attribute_name = u'NFe.endereco_emitente_formatado_linha_3' fld.top = 1.7*cm fld.left = 4*cm fld.width = 4*cm fld.height = 0.45*cm fld.style = EMIT_DADOS elements.append(fld) fld = Campo() fld.nome = 'fld_rem_endereco_4' fld.attribute_name = u'NFe.endereco_emitente_formatado_linha_4' fld.top = 2.05*cm fld.left = 4*cm fld.width = 4*cm fld.height = 0.45*cm fld.style = EMIT_DADOS elements.append(fld) fld = Campo() fld.nome = 'fld_rem_endereco_1' fld.attribute_name = u'NFe.endereco_emitente_formatado_linha_1' fld.top = 2.5*cm fld.left = 0*cm fld.width = 8*cm fld.height = 0.7*cm fld.style = EMIT_DADOS elements.append(fld) fld = Campo() fld.nome = 'fld_rem_endereco_2' fld.attribute_name = u'NFe.endereco_emitente_formatado_linha_2' fld.top = 3.2*cm fld.left = 0*cm fld.width = 8*cm fld.height = 0.7*cm fld.style = EMIT_DADOS elements.append(fld) return elements