def __init__(self): super(RemetenteRetrato, self).__init__() self.elements = [] # Quadro do emitente self.inclui_texto(nome='quadro_emitente', titulo='', texto='', top=0*cm, left=0*cm, width=8*cm, height=4*cm) # # Área central - Dados do DANFE # lbl, txt = self.inclui_texto(nome='danfe', titulo='', texto=u'DANFE', top=0*cm, left=8*cm, width=3.4*cm, height=4*cm) txt.style = DESCRITIVO_DANFE txt = self.inclui_texto_sem_borda(nome='danfe_ext', texto=u'DOCUMENTO AUXILIAR DA NOTA FISCAL ELETRÔNICA', top=0.6*cm, left=8*cm, width=3.4*cm, height=4*cm) txt.style = DESCRITIVO_DANFE_GERAL txt = self.inclui_texto_sem_borda(nome='danfe_entrada', texto=u'0 - ENTRADA', top=1.45*cm, left=8.3*cm, width=3.4*cm, height=4*cm) txt.style = DESCRITIVO_DANFE_ES txt = self.inclui_texto_sem_borda(nome='danfe_saida', texto=u'1 - SAÍDA', top=1.85*cm, left=8.3*cm, width=3.4*cm, height=4*cm) txt.style = DESCRITIVO_DANFE_ES fld = self.inclui_campo_sem_borda(nome='danfe_entrada_saida', conteudo=u'NFe.infNFe.ide.tpNF.valor', top=1.6*cm, left=10.4*cm, width=0.6*cm, height=0.6*cm) fld.style = DESCRITIVO_NUMERO fld.borders = {'top': 0.1, 'right': 0.1, 'bottom': 0.1, 'left': 0.1} fld.padding_bottom = 0.2*cm fld = self.inclui_campo_sem_borda(nome='danfe_numero', conteudo=u'NFe.numero_formatado', top=2.4*cm, left=8*cm, width=3.4*cm, height=0.5*cm) fld.style = DESCRITIVO_NUMERO fld = self.inclui_campo_sem_borda(nome='danfe_serie', conteudo=u'NFe.serie_formatada', top=2.85*cm, left=8*cm, width=3.4*cm, height=0.5*cm) fld.style = DESCRITIVO_NUMERO fld = SystemField(name='fld_danfe_folha', expression=u'FOLHA %(page_number)02d/%(page_count)02d', top=3.3*cm, left=8*cm, width=3.4*cm, height=0.5*cm) fld.padding_top = 0.1*cm fld.style = DESCRITIVO_NUMERO self.elements.append(fld) # # No caso dos códigos de barra, altura (height) e largura (width) se referem às barras, não à imagem # self.elements.append(Line(top=0*cm, bottom=0*cm, left=11.4*cm, right=19.4*cm, stroke_width=0.1)) self.elements.append(BarCode(type=u'Code128', attribute_name=u'NFe.chave_para_codigo_barras', top=((1.625-0.8)/2.0)*cm, left=11.3*cm, width=0.025*cm, height=0.8*cm)) lbl, fld = self.inclui_campo(nome='remetente_chave', titulo=u'CHAVE DE ACESSO', conteudo=u'NFe.chave_formatada', top=1.625*cm, left=11.4*cm, width=8*cm, margem_direita=True) fld.style = DADO_CHAVE self.inclui_campo(nome='remetente_natureza', titulo=u'NATUREZA DA OPERAÇÃO', conteudo=u'NFe.infNFe.ide.natOp.valor', top=4*cm, left=0*cm, width=11.4*cm) self.inclui_campo(nome='remetente_ie', titulo=u'INSCRIÇÃO ESTADUAL', conteudo=u'NFe.infNFe.emit.IE.valor', top=4.70*cm, left=0*cm, width=6.4*cm) self.inclui_campo(nome='remetente_iest', titulo=u'INSCRIÇÃO ESTADUAL DO SUBSTITUTO TRIBUTÁRIO', conteudo=u'NFe.infNFe.emit.IEST.valor', top=4.70*cm, left=6.4*cm, width=6.6*cm) self.inclui_campo(nome='remetente_cnpj', titulo=u'CNPJ', conteudo=u'NFe.cnpj_emitente_formatado', top=4.70*cm, left=13*cm, width=6.4*cm, margem_direita=True) self.height = 5.4*cm
def inserir_data_emissao(self): txt = SystemField(expression='Data: %(now:%d/%m/%Y)s', top=1.45 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm) txt.style = { 'fontName': REPORT_FONT_BOLD, 'fontSize': 9, 'alignment': TA_CENTER, 'leading': 9 } self.elements.append(txt)
def inserir_data_emissao(self, data_emissao): if data_emissao: txt = ObjectValue(attribute_name='format_data_emissao', display_format='Data: %s', top=1.45 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm) else: txt = SystemField(expression='Data: %(now:%d/%m/%Y)s', top=1.45 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm) txt.style = {'fontName': REPORT_FONT_BOLD, 'fontSize': 9, 'alignment': TA_CENTER, 'leading': 9} self.elements.append(txt)
class band_page_footer(ReportBand): height = 1 * cm elements = [ SystemField(expression='Pagina N°: %(page_number)s', top=0.1 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 10, 'alignment': TA_CENTER }), ]
def __init__(self): super(BandaFoot, self).__init__() self.ender_info = False self.elements = [] self.elements.append(Line(top=1.5 * cm, bottom=1.5 * cm, left=0 * cm, right=19.4 * cm, stroke_width=0.3)) txt = Label(text='Gerado por SGEO', top=1.5 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm) txt.style = {'fontName': REPORT_FONT_BOLD, 'fontSize': 8, 'alignment': TA_LEFT, 'leading': 8} self.elements.append(txt) txt = SystemField(expression='Data da impressão: %(now:%d/%m/%Y)s', top=1.5 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm) txt.style = {'fontName': REPORT_FONT, 'fontSize': 8, 'alignment': TA_RIGHT, 'leading': 8} self.elements.append(txt) self.height = 2 * cm
def __init__(self): super(TopoPagina, self).__init__() self.elements = [] txt = SystemField(expression='%(report_title)s', top=0.65 * cm, left=0 * cm, width=19.4 * cm, height=0.8 * cm) txt.style = {'fontName': REPORT_FONT_BOLD, 'fontSize': 15, 'alignment': TA_CENTER, 'leading': 15} self.elements.append(txt) txt = SystemField(expression='Página %(page_number)s de %(last_page_number)s', top=3.1 * cm, left=0 * cm, width=19.4 * cm, height=0.5 * cm) txt.style = {'fontName': REPORT_FONT, 'fontSize': 8.5, 'alignment': TA_RIGHT, 'leading': 8.5} self.elements.append(txt) self.elements.append(Line(top=3.6 * cm, bottom=3.6 * cm, left=0 * cm, right=19.4 * cm, stroke_width=0.3)) self.height = 3.65 * cm
class band_page_header(ReportBand): height = 4 * 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="RAZON SOCIAL: %s" % RAZON_SOCIAL_EMPRESA, top=0.8 * cm, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 10 }), Label(text="CUIT: %s" % CUIT, top=1.2 * cm, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 10 }), Label(text="DOMICILIO COMERCIAL: %s" % DOMICILIO_COMERCIAL, top=1.5 * cm, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 10 }), SystemField(expression='Periodo: %(var:periodo)s', top=1.5 * cm, left=23 * cm, style={ 'fontName': 'Helvetica', 'fontSize': 10 }), SystemField(expression='Fecha emisión: %(now:%d/%m/%Y)s', top=2 * cm, width=8 * cm), SystemField(expression='Folio N°: %(page_number)s', top=2 * cm, left=23 * cm, style={ 'fontName': 'Helvetica', 'fontSize': 10 }), Line(left=0, top=2.7 * cm, right=29.7 * cm, bottom=2.7 * cm), # Encabezado de tabla Label(text="Fecha", top=2.9 * cm, left=0, width=2 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="Comprobante", top=2.9 * cm, left=2.1 * cm, width=3.5 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="Razón Social", top=2.9 * cm, left=5.7 * cm, width=7 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="CUIT", top=2.9 * cm, left=13.7 * cm, width=2.5 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="Imp. Neto", top=2.9 * cm, left=17.2 * cm, width=2 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="IVA(10.5%)", top=2.9 * cm, left=20.2 * cm, width=2 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="IVA(21%)", top=2.9 * cm, left=22.2 * cm, width=2 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="Exento", top=2.9 * cm, left=23.7 * cm, width=2 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Label(text="Imp. Total", top=2.9 * cm, left=26 * cm, width=2 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10, 'alignment': TA_CENTER }), Line(left=0, top=3.5 * cm, right=29.7 * cm, bottom=3.5 * cm), ]