Пример #1
0
def get_total_data(drive):
    page = BeautifulSoup(drive.page_source, 'lxml')
    div = page.find('div', {'id': 'Totais'})
    if div:
        dados_totais = nfce.obter_texto_labels(nfce.NfceParse._dados_totais,
                                               div, True, True, True)
        return dados_totais
    else:
        return None
Пример #2
0
def get_delivery_data(drive):
    page = BeautifulSoup(drive.page_source, 'lxml')
    id = page.find('div', {'id': 'Transporte'})
    if id:
        dados_transporte = nfce.obter_texto_labels(
            nfce.NfceParse._dados_transporte, id, True)
        return dados_transporte
    else:
        return None
Пример #3
0
def get_cofins_data(tag):
    td = tag.find('td', {'class': 'table-titulo-aba-interna'}, text='COFINS')
    if td:
        if td.parent.parent.name == 'tbody':
            tabela = td.parent.parent.parent
        else:
            tabela = td.parent.parent
        div = tabela.next_sibling
        dados_cofins = nfce.obter_texto_labels(nfce.NfceParse._dados_cofins,
                                               div, True, True, True)
        return dados_cofins
    else:
        return None
Пример #4
0
def get_pis_data(tag):
    td = tag.find('td', {'class': 'table-titulo-aba-interna'}, text='PIS')
    if td:
        #obtem a tag <table> que contém a <td> procurada, a estrutura do html esta assim <table> <tbory><tr><td>
        if td.parent.parent.name == 'tbody':
            tabela = td.parent.parent.parent
        else:
            tabela = td.parent.parent
        #pega a proxima div irmã que contém os labels relativos ao ICMS normal
        div = tabela.next_sibling
        dados_pis = nfce.obter_texto_labels(nfce.NfceParse._dados_pis, div,
                                            True, True, True)

        return dados_pis
    else:
        return None