def __init__(self): super(TributosTotais, self).__init__() self.elements = [] self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) txt = self.inclui_campo_sem_borda(nome='trib_tot', conteudo=u'NFe.tributos_totais_nfce', top=0 * cm, left=0 * cm, width=7.6 * cm, height=0.5 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_6, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_6 } self.elements.append( Line(top=0.6 * cm, bottom=0.6 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) self.height = 0.6 * cm
def campo_variavel_contingencia(self): self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) txt = self.inclui_texto_sem_borda(nome='msg_contingencia', texto=u'EMITIDA EM CONTINGÊNCIA', top=0 * cm, left=0 * cm, width=7.6 * cm, height=0.5 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_8, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_8 } txt = self.inclui_texto_sem_borda(nome='msg_contingencia', texto=u'Pendente de autorização', top=0.4 * cm, left=0 * cm, width=7.6 * cm, height=0.4 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_7 } #for l in [0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55]: for l in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]: self.elements.append( Line(top=l * cm, bottom=l * cm, left=0 * cm, right=1.7 * cm, stroke_width=0.1)) self.elements.append( Line(top=l * cm, bottom=l * cm, left=5.9 * cm, right=7.6 * cm, stroke_width=0.1)) self.height = 0.9 * cm
def __init__(self): super(CanhotoRetrato, self).__init__() self.elements = [] lbl, txt = self.inclui_texto(nome='', titulo='', texto=u'', top=0*cm, left=0*cm, width=16*cm) fld = self.inclui_campo_sem_borda(nome='canhoto_recebemos', conteudo=u'NFe.canhoto_formatado', top=0*cm, left=0*cm, width=16*cm) fld.borders = {'top': 1.0, 'right': 1.0, 'bottom': 1.0, 'left':1.0 }#mudança de borda fld.padding_top = 0.08*cm fld.padding_left = 0.08*cm fld.padding_bottom = 0.08*cm fld.padding_right = 0.08*cm fld.style = DESCRITIVO_CAMPO fld.height = 0.70*cm self.inclui_texto(nome='canhoto_data', titulo=u'DATA DE RECEBIMENTO', texto='', top=0.7*cm, left=0*cm, width=2.7*cm) self.inclui_texto(nome='canhoto_assinatura', titulo=u'IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR', texto='', top=0.7*cm, left=2.7*cm, width=13.3*cm) lbl, txt = self.inclui_texto(nome='canhoto_nfe', titulo=u'NF-e', texto='', top=0*cm, left=16*cm, width=3.4*cm, height=1.4*cm, margem_direita=True) lbl.style = DESCRITIVO_NUMERO fld = self.inclui_campo_sem_borda(nome='canhoto_numero', conteudo=u'NFe.numero_formatado', top=0.35*cm, left=16*cm, width=3.4*cm, height=0.5*cm) fld.style = DESCRITIVO_NUMERO fld = self.inclui_campo_sem_borda(nome='canhoto_serie', conteudo=u'NFe.serie_formatada', top=0.8*cm, left=16*cm, width=3.4*cm, height=0.5*cm) fld.style = DESCRITIVO_NUMERO self.elements.append(Line(top=1.65*cm, bottom=1.65*cm, left=0*cm, right=19.4*cm, stroke_width=0.1)) self.height = 1.9*cm
class band_page_header(ReportBand): height = 1.5 * cm elements = [ Image(left=0.4 * cm, top=0, width=4 * cm, height=5.12 * cm, filename=os.path.join(RUTA_PROYECTO, '../control/escom.gif')), SystemField(expression='%(report_title)s', top=0.1 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 21, 'alignment': TA_CENTER }), Label(text="Escuela Superior de Cómputo", top=0.8 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 16, 'alignment': TA_CENTER }), SystemField(expression=u'Pagina %(page_number)d de %(page_count)d', top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'bottom': Line(stroke_width=5)}
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_ext', texto=u'versão', top=1.1*cm, left=8.8*cm, width=1.4*cm, height=0.6*cm) txt.style = DESCRITIVO_DANFE_GERAL fld = self.inclui_campo_sem_borda(nome='danfe_entrada_saida', conteudo=u'NFe.infNFe.versao.valor', top=1.1*cm, left=9.8*cm, width=0.6*cm, height=0.6*cm) fld.style = DESCRITIVO_DANFE_GERAL txt = self.inclui_texto_sem_borda(nome='danfe_entrada', texto=u'0 - ENTRADA', top=1.5*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.9*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.65*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
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}), ])
class band_summary(ReportBand): height = 1.5 * cm elements = [ Label(text='Kárdex', 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 }), ] borders = {'bottom': Line(stroke_width=2)}
def __init__(self): super(InfoTotais.band_header, self).__init__() self.elements = [] self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) txt = self.inclui_texto_sem_borda(nome='', texto='Qtde. Total de Itens', top=0.1 * cm, left=0 * cm, width=3.8 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_campo_sem_borda(nome=u'qtd_itens', conteudo=u'NFe.quantidade_itens', top=0.1 * cm, left=3.8 * cm, width=3.8 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7, 'alignment': TA_RIGHT } txt = self.inclui_texto_sem_borda(nome='', texto='Valor Total R$', top=0.6 * cm, left=0 * cm, width=3.8 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_campo_sem_borda(nome=u'valor_total', conteudo=u'NFe.valor_total_nota', top=0.6 * cm, left=3.8 * cm, width=3.8 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7, 'alignment': TA_RIGHT } #self.auto_expand_height = True self.height = 1.1 * cm
def campo_variavel_contingencia_fsda(self): # # 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.dados_contingencia_fsda_para_codigo_barras', top=(2.375 + ((1.625 - 0.8) / 2.0))*cm, left=11.9*cm, width=0.025*cm, height=0.8*cm)) lbl, fld = self.inclui_campo(nome='remetente_var2', titulo=u'DADOS DA NF-e', conteudo=u'NFe.dados_contingencia_fsda_formatados', top=4*cm, left=11.4*cm, width=8*cm, margem_direita=True) fld.style = DADO_CHAVE
def __init__(self): super(CanhotoPaisagem, self).__init__() self.elements = [] self.inclui_texto( nome='canhoto_recebemos', titulo= u'RECEBEMOS OS PRODUTOS E/OU SERVIÇOS CONSTANTES DA NOTA FISCAL ELETRÔNICA INDICADA AO LADO DE', texto='', top=0 * cm, left=0 * cm, width=16 * cm) self.inclui_texto(nome='canhoto_data', titulo=u'DATA DE RECEBIMENTO', texto='', top=0.7 * cm, left=0 * cm, width=2.7 * cm) self.inclui_texto(nome='canhoto_assinatura', titulo=u'IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR', texto='', top=0.7 * cm, left=2.7 * cm, width=13.3 * cm) lbl, txt = self.inclui_texto(nome='canhoto_nfe', titulo=u'NF-e', texto='', top=0 * cm, left=16 * cm, width=3.4 * cm, height=1.4 * cm, margem_direita=True) lbl.style = DESCRITIVO_NUMERO txt = self.inclui_texto_sem_borda(nome='canhoto_numero', texto=u'Nº 000.000.000', top=0.4 * cm, left=16 * cm, width=3.4 * cm, height=0.5 * cm) txt.style = DESCRITIVO_NUMERO txt = self.inclui_texto_sem_borda(nome='canhoto_numero', texto=u'SÉRIE 000', top=0.8 * cm, left=16 * cm, width=3.4 * cm, height=0.5 * cm) txt.style = DESCRITIVO_NUMERO self.elements.append( Line(top=1.65 * cm, bottom=1.65 * cm, left=0 * cm, right=19.4 * cm, stroke_width=0.1)) self.height = 1.9 * cm
class band_page_footer(ReportBand): height = 0.5 * cm elements = [ Label(text='Created with Geraldo Reports', top=0.1 * cm, right=0), 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': Line(stroke_color=red, stroke_width=3)}
class band_summary(ReportBand): height = 0.8 * cm elements = [ Label(text=_(u"Total") + ":", top=0.1 * cm, left=0), ObjectValue(attribute_name='id', top=0.1 * cm, left=1 * cm, action=FIELD_ACTION_COUNT, display_format='%s'), ] borders = {'top': Line(stroke_color=navy, stroke_width=2)}
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)}
def __init__(self): super(IdConsumidor, self).__init__() self.elements = [] self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1)))
def __init__(self): super(ConsultaChave, self).__init__() self.elements = [] self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) txt = self.inclui_texto_sem_borda( nome='consulta_chave_texto', texto=u'Consulte pela Chave de Acesso em', top=0.1 * cm, left=0 * cm, width=7.6 * cm, height=0.5 * cm) txt.style = { 'fontName': FONTE_NFCE_NEGRITO, 'fontSize': FONTE_TAMANHO_6, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_6 } txt = self.inclui_campo_sem_borda( nome='endereco_consulta_chave', conteudo=u'NFe.endereco_consulta_chave_nfce', top=0.5 * cm, left=0 * cm, width=7.6 * cm, height=0.4 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_5, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_5 } txt = self.inclui_campo_sem_borda(nome='chave_formatada', conteudo=u'NFe.chave_formatada', top=1 * cm, left=0 * cm, width=7.6 * cm, height=0.5 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_6, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_6 } self.height = 1.5 * cm
class Header(ReportBand): height = 3.4 * cm borders = {'bottom': False} elements = [ SystemField(expression='%(report_title)s', top=1.9 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 12, 'alignment': TA_CENTER }), SystemField(expression='Page %(page_number)d of %(page_count)d', top=0.7 * cm, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 8, 'alignment': TA_RIGHT }), SystemField(expression='Printed in %(now:%d/%m/%Y %H:%M)s ', top=0.2 * cm, width=BAND_WIDTH, style={ 'fontName': 'Helvetica', 'fontSize': 8, 'alignment': TA_RIGHT }), ] if clinic_info: elements.append( Label(text="%s" % organization, top=0.9 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER })) if len(organization.photo): elements.append( Image(left=0.1 * cm, top=0.1 * cm, filename=imagefile)) if header_line: elements.append( Line(left=0.0 * cm, right=19 * cm, top=3.3 * cm, bottom=3.3 * cm))
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 band_begin(ReportBand): height = 4.0 * cm elements = [ # Write the contents outline of this document. Label(text=u"目录", top=1.2 * cm, left=0 * cm, width=BAND_WIDTH, style={ "alignment": TA_CENTER, "fontSize": 14 }), Line(left=0 * cm, top=1.9 * cm, bottom=1.9 * cm, right=19 * cm), Label( text= u"I: 全局基本概况.............................................................................................................................................................1", top=2.0 * cm, left=0.5 * cm, width=BAND_WIDTH, style={"fontName": 'wqy'}), Label( text= u"II: 服务器访问状况........................................................................................................................................................2", top=2.6 * cm, left=0.5 * cm, width=BAND_WIDTH), Label( text= u"III: 用户分布状况..........................................................................................................................................................3", top=3.2 * cm, left=0.5 * cm, width=BAND_WIDTH), Label( text= u"VI: 客户端分布状况.......................................................................................................................................................4", top=3.8 * cm, left=0.5 * cm, width=BAND_WIDTH), Label( text= u"V: 用户-服务器访问流分析............................................................................................................................................5", top=4.4 * cm, left=0.5 * cm, width=BAND_WIDTH), # Line Separator. #Line(left=0*cm, top=4.1*cm, bottom=4.1*cm, right=19*cm), ] borders = {'bottom': False}
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, 'textColor': navy }), Label(text="ID", top=0.8 * cm, left=0), Label(text="username", top=0.8 * cm, left=3 * cm), Label(text="First name", top=0.8 * cm, left=8 * cm), Label(text="Last name", top=0.8 * cm, left=13 * cm), Label(text="Staff", top=0.8 * cm, left=18 * cm), ] borders = {'bottom': Line(stroke_color=navy)}
def __init__(self): super(IdNFCe, self).__init__() self.elements = [] self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) txt = self.inclui_campo_sem_borda(nome='id_nfce', conteudo=u'NFe.id_nfce', top=0.1 * cm, left=0 * cm, width=7.6 * cm, height=0.5 * cm) txt.style = { 'fontName': FONTE_NFCE_NEGRITO, 'fontSize': FONTE_TAMANHO_7, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_campo_sem_borda( nome='id_nfce', conteudo=u'NFe.data_emissao_danfe_nfce', top=0.5 * cm, left=0 * cm, width=7.6 * cm, height=0.4 * cm) txt.style = { 'fontName': FONTE_NFCE_NEGRITO, 'fontSize': FONTE_TAMANHO_6, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_6 } self.height = 0.9 * cm
class band_page_header(ReportBand): height = 1.5*cm elements = [ Image(left=0.4*cm, top=0, width=4*cm, height=5.12*cm, filename= os.path.join(RUTA_PROYECTO,'../media/img/escom.gif')), SystemField(expression='%(report_title)s', top=0.1*cm, left=0, width=BAND_WIDTH, style={'fontName': 'Helvetica-Bold', 'fontSize': 21, 'alignment': TA_CENTER}), Label(text="Escuela Superior de Cómputo", top=0.8*cm, left=0,width=BAND_WIDTH, style={'fontName': 'Helvetica-Bold', 'fontSize': 16, 'alignment': TA_CENTER}), Label(text="Nombre", top=7*cm, left=3*cm, width=1.5*cm, style={'fontName': 'Helvetica-Bold', 'fontSize':8 ,'borderWidth': 1, 'borderColor': navy, 'borderPadding': 1, 'borderRadius': 2}), Label(text="Boleta", top=7*cm, left=0.5*cm,width=1.5*cm,style={'fontName': 'Helvetica-Bold', 'fontSize':8,'borderWidth': 1, 'borderColor': navy, 'borderPadding': 1, 'borderRadius': 2}), Label(text="Calificación", top=7*cm, left=8*cm,width=1.5*cm,style={'fontName': 'Helvetica-Bold', 'fontSize':8,'borderWidth': 1, 'borderColor': navy, 'borderPadding': 1, 'borderRadius': 2}), SystemField(expression=u'Pagina %(page_number)d de %(page_count)d', top=0.1*cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'bottom': Line(stroke_width=5)}
class band_page_header(ReportBand): height = 1.8 * cm bElements = [ SystemField(expression='%(report_title)s', top=0.5 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER }), SystemField(expression=_('Page %(page_number)d of %(page_count)d'), top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), UDSImage(filename=stock.getStockImagePath(stock.LOGO), left=0.0 * cm, top=0.0 * cm, width=2.0 * cm, height=2.0 * cm), ] borders = {'bottom': Line(stroke_color=colors.red, stroke_width=3)}
def campo_variavel_homologacao(self): self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) txt = self.inclui_texto_sem_borda( nome='amb_2', texto=u'EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO – SEM VALOR FISCAL', top=0 * cm, left=0 * cm, width=7.6 * cm, height=0.5 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_8, 'alignment': TA_CENTER, 'leading': FONTE_TAMANHO_7 } txt.padding_top = 0.3 * cm self.height = 1 * cm
class band_detail(ReportBand): elements = [ # LOGO Image(left=0 * cm, top=0 * cm, width=12 * cm, height=6 * cm, style={'alignment': TA_LEFT}, filename=os.path.join(cur_dir, 'static/kasa/img/logo6.jpg')), # TVRTKA ObjectValue(attribute_name='operater', get_value=lambda x: '{x.operater.tvrtka}'.format(x=x), width=17 * cm, top=0.3 * cm, style={'alignment': TA_RIGHT}), ObjectValue( attribute_name='operater', get_value=lambda x: '{x.operater.tvrtka.adresa}'.format(x=x), width=17 * cm, top=0.8 * cm, style={'alignment': TA_RIGHT}), ObjectValue( attribute_name='operater', get_value=lambda x: 'OIB:{x.operater.tvrtka.oib}'.format(x=x), width=17 * cm, top=1.3 * cm, style={'alignment': TA_RIGHT}), ObjectValue(attribute_name='operater', get_value=lambda x: 'IBAN: {x.operater.tvrtka.iban}'. format(x=x) if x.operater.tvrtka.iban else "", width=17 * cm, top=1.8 * cm, style={'alignment': TA_RIGHT}), # KUPAC ObjectValue(attribute_name='kupac', top=3.2 * cm), ObjectValue(attribute_name='kupac', get_value=lambda x: '{x.kupac.adresa}'.format(x=x), top=3.7 * cm), ObjectValue(attribute_name='kupac', get_value=lambda x: 'OIB: {x.kupac.oib}'.format(x=x), top=4.2 * cm), # Label(text='OIB: 48531576841', top=5.1*cm), ObjectValue(attribute_name='vrijeme_izdavanja', get_value=lambda x: x.vrijeme_izdavanja.strftime( 'Datum: %d/%m/%Y'), top=4.8 * cm, width=5 * cm, left=12.5 * cm, style={'alignment': TA_LEFT}), ObjectValue(attribute_name='vrijeme_izdavanja', get_value=lambda x: x.vrijeme_izdavanja.strftime( 'Vrijeme: %H:%M'), top=5.3 * cm, width=5 * cm, left=12.5 * cm, style={'alignment': TA_LEFT}), ObjectValue(get_value=lambda x: 'Vrsta plaćanja: {x.opis_nacina_placanja}'.format(x=x), top=5.8 * cm, width=5 * cm, left=12.5 * cm, style={'alignment': TA_LEFT}), ObjectValue(get_value=lambda x: 'Račun {x.oznaka}'.format(x=x), top=5.8 * cm, width=17 * cm, style={ 'alignment': TA_LEFT, 'fontSize': 12 }), Label(text='R.br.', top=7 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10 }), Label(text='Naziv', top=7 * cm, left=1.5 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10 }), Label(text='Jed.cijena', top=7 * cm, left=7 * cm, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 10 }), Label(text='Količina', top=7 * cm, left=10 * cm, style={ 'fontName': 'Segoe UI Bold', 'fontSize': 10 }), Label(text='Ukupna cijena', top=7 * cm, width=17 * cm, style={ 'alignment': TA_RIGHT, 'fontName': 'Helvetica-Bold', 'fontSize': 10 }), Line( top=25 * cm, left=0.0 * cm, right=17 * cm, bottom=25 * cm, stroke_width=0.8, ), Label(text='Fiskali d.o.o.', top=25.2 * cm, width=17 * cm, style={ 'alignment': TA_CENTER, 'fontSize': 10 }), Label(text='Telefon: 023 300 201 E-mail: [email protected]', top=25.6 * cm, width=17 * cm, style={ 'alignment': TA_CENTER, 'fontSize': 10 }), ]
def __init__(self): super(RodapeRetrato, self).__init__() self.elements = [] # 1ª linha lbl, fld = self.inclui_campo_imposto( nome='clc_bip', titulo='RPS.aliquota_pis_formatada', conteudo='RPS.ValorPIS.formato_danfe', top=0 * cm, left=0 * cm, width=3.88 * cm) lbl, fld = self.inclui_campo_imposto( nome='clc_vip', titulo='RPS.aliquota_cofins_formatada', conteudo='RPS.ValorCOFINS.formato_danfe', top=0 * cm, left=3.88 * cm, width=3.88 * cm) lbl, fld = self.inclui_campo_imposto( nome='clc_bis', titulo='RPS.aliquota_inss_formatada', conteudo='RPS.ValorINSS.formato_danfe', top=0 * cm, left=7.76 * cm, width=3.88 * cm) lbl, fld = self.inclui_campo_imposto( nome='clc_vis', titulo='RPS.aliquota_ir_formatada', conteudo='RPS.ValorIR.formato_danfe', top=0 * cm, left=11.64 * cm, width=3.88 * cm) lbl, fld = self.inclui_campo_imposto( nome='clc_vpn', titulo='RPS.aliquota_csll_formatada', conteudo='RPS.ValorCSLL.formato_danfe', top=0 * cm, left=15.52 * cm, width=3.88 * cm, margem_direita=True) lbl = self._inclui_texto(nome='titulo_discriminacao', texto='VALOR TOTAL DO RPS =', top=0.85 * cm, left=0 * cm, width=19.4 * cm) lbl.style = DESCRICAO_VALOR_TOTAL self.elements.append(lbl) fld = self._inclui_campo(nome='total', conteudo='RPS.ValorTotalRPS.formato_danfe', top=0.85 * cm, left=14.4 * cm, width=5 * cm) fld.style = VALOR_TOTAL self.elements.append(fld) lbl, fld = self.inclui_campo_numerico( nome='iss_im', titulo='VALOR TOTAL DAS DEDUÇÕES', conteudo='RPS.ValorDeducoes.formato_danfe', top=1.5 * cm, left=0 * cm, width=4.85 * cm) lbl, fld = self.inclui_campo_numerico( nome='iss_vr', titulo='BASE DE CÁLCULO DO ISS', conteudo='RPS.BaseCalculo.formato_danfe', top=1.5 * cm, left=4.85 * cm, width=4.85 * cm) lbl, fld = self.inclui_campo_numerico( nome='iss_bc', titulo='ALÍQUOTA', conteudo='RPS.AliquotaAtividade.formato_danfe', top=1.5 * cm, left=9.7 * cm, width=4.85 * cm) lbl, fld = self.inclui_campo_numerico( nome='iss_vr', titulo='VALOR DO ISS', conteudo='RPS.ValorISS.formato_danfe', top=1.5 * cm, left=14.55 * cm, width=4.85 * cm, margem_direita=True) self.inclui_descritivo(nome='titulo_discriminacao', titulo='INFORMAÇÕES IMPORTANTES', top=2.2 * cm, left=0 * cm, width=19.4 * cm) fld = Campo(attribute_name='RPS.informacoes_formatadas', top=2.62 * cm, left=0 * cm, width=19.4 * cm) fld.style = DADO_CAMPO_NORMAL fld.height = 3.98 * cm self.elements.append(fld) self.elements.append( Line(top=6.6 * cm, bottom=6.6 * cm, left=0 * cm, right=19.4 * cm, stroke_width=0.1)) fld = RPSRetrato.ObsImpressao() fld.top = 6.6 * cm self.elements.append(fld) self.height = 6.6 * cm
def __init__(self): super(TomadorRetrato, self).__init__() self.elements = [] self.inclui_descritivo(nome='titulo_tomador', titulo='TOMADOR DE SERVIÇOS', top=0 * cm, left=0 * cm, width=19.4 * cm) # 1ª linha lbl = Titulo(text='Razão Social/Nome:', top=0.42 * cm, left=0 * cm, width=2.8 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.RazaoSocialTomador.valor', top=0.42 * cm, left=2.6 * cm, width=16.8 * cm) self.elements.append(fld) # 2ª linha lbl = Titulo(text='CNPJ/CPF:', top=0.84 * cm, left=0 * cm, width=1.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.cnpj_tomador_formatado', top=0.84 * cm, left=1.4 * cm, width=18 * cm) self.elements.append(fld) # 3ª linha lbl = Titulo(text='Endereço:', top=1.26 * cm, left=0 * cm, width=1.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.endereco_tomador_formatado', top=1.26 * cm, left=1.4 * cm, width=18 * cm) self.elements.append(fld) # 4ª linha lbl = Titulo(text='Município:', top=1.68 * cm, left=0 * cm, width=1.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.CidadeTomadorDescricao.valor', top=1.68 * cm, left=1.4 * cm, width=18 * cm) self.elements.append(fld) self.elements.append( Line(top=2.1 * cm, bottom=2.1 * cm, left=0 * cm, right=19.4 * cm, stroke_width=0.1)) self.height = 2.1 * cm
def __init__(self): super(PrestadorRetrato, self).__init__() self.elements = [] self.inclui_descritivo(nome='titulo_prestador', titulo='PRESTADOR DE SERVIÇOS', top=0 * cm, left=0 * cm, width=19.4 * cm) # 1ª linha lbl = Titulo(text='Razão Social/Nome:', top=0.42 * cm, left=0 * cm, width=2.8 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.prestador.nome', top=0.42 * cm, left=2.6 * cm, width=16.8 * cm) self.elements.append(fld) # 2ª linha lbl = Titulo(text='CNPJ/CPF:', top=0.84 * cm, left=0 * cm, width=1.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.prestador.cnpj', top=0.84 * cm, left=1.4 * cm, width=18 * cm) self.elements.append(fld) lbl = Titulo(text='Inscrição mobiliária:', top=0.84 * cm, left=8 * cm, width=3.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.prestador.im', top=0.84 * cm, left=10.7 * cm, width=18 * cm) self.elements.append(fld) # 3ª linha lbl = Titulo(text='Endereço:', top=1.26 * cm, left=0 * cm, width=1.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.prestador.endereco', top=1.26 * cm, left=1.4 * cm, width=18 * cm) self.elements.append(fld) # 4ª linha lbl = Titulo(text='Município:', top=1.68 * cm, left=0 * cm, width=1.4 * cm) self.elements.append(lbl) fld = Campo(attribute_name='RPS.prestador.cidade', top=1.68 * cm, left=1.4 * cm, width=18 * cm) self.elements.append(fld) self.elements.append( Line(top=2.1 * cm, bottom=2.1 * cm, left=0 * cm, right=19.4 * cm, stroke_width=0.1)) self.height = 2.1 * cm
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}), ])
class band_begin(ReportBand): height = 20.1 * cm elements = [ # Write the outline for this whole document. Label(text=u"目录", top=0.2 * cm, left=0 * cm, width=BAND_WIDTH, style={ "alignment": TA_CENTER, "fontSize": 14 }), Label( text= u"I: 全局基本概况.............................................................................................................................................................1", top=1.0 * cm, left=0.5 * cm, width=BAND_WIDTH, style={"fontName": 'wqy'}), Label( text= u"II: 服务器访问状况........................................................................................................................................................2", top=1.6 * cm, left=0.5 * cm, width=BAND_WIDTH), Label( text= u"III: 用户分布状况..........................................................................................................................................................3", top=2.2 * cm, left=0.5 * cm, width=BAND_WIDTH), Label( text= u"VI: 客户端分布状况.......................................................................................................................................................4", top=2.8 * cm, left=0.5 * cm, width=BAND_WIDTH), Label( text= u"V: 用户-服务器访问流分析............................................................................................................................................5", top=3.4 * cm, left=0.5 * cm, width=BAND_WIDTH), # Draw the User Dist in Japan. Image(left=0 * cm, top=4.0 * cm, filename=os.path.join( cur_dir, '../charts/output/distribution_of_users_in_japan.jpg')), # Line Separator. Line(left=0 * cm, top=4.1 * cm, bottom=4.1 * cm, right=19 * cm), # Data structure Label(text="Total visit", top=4.2 * cm, left=0), Label(text="Test visit", top=4.2 * cm, left=3 * cm), Label(text="Real visit", top=4.2 * cm, left=6 * cm), # Write the Global Data. Label(text=global_stat[0], top=4.7 * cm, left=0), Label(text=global_stat[1], top=4.7 * cm, left=3 * cm), Label(text=global_stat[2], top=4.7 * cm, left=6 * cm), ] borders = {'bottom': True}
def __init__(self): super(InfoProdutos.band_header, self).__init__() self.elements = [] txt = self.inclui_texto_sem_borda(nome='', texto='Código', top=0 * cm, left=0 * cm, width=1.9 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_texto_sem_borda(nome='', texto='Descrição', top=0 * cm, left=1.9 * cm, width=2.1 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_texto_sem_borda(nome='', texto='Qtde', top=0 * cm, left=4 * cm, width=1 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_texto_sem_borda(nome='', texto='UN', top=0 * cm, left=5 * cm, width=0.7 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_texto_sem_borda(nome='', texto='V Un.', top=0 * cm, left=5.7 * cm, width=0.95 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } txt = self.inclui_texto_sem_borda(nome='', texto='Total', top=0 * cm, left=6.65 * cm, width=0.95 * cm) txt.style = { 'fontName': FONTE_NFCE, 'fontSize': FONTE_TAMANHO_7, 'leading': FONTE_TAMANHO_7 } self.elements.append( Line(top=0.1 * cm, bottom=0.1 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) self.elements.append( Line(top=0.51 * cm, bottom=0.51 * cm, left=0 * cm, right=7.6 * cm, stroke_width=0.3, dash=(1, 1))) self.height = 0.51 * cm