Exemplo n.º 1
0
    def exportPayments(self):

        numberLotesProcessed = []

        try:
            payments = sorted(self._payments, key=itemgetter('numberLote'))
        except Exception:
            payments = self._payments

        payments = self.sumAmountPaidPerLote(payments)

        for key, payment in enumerate(payments):
            accountCodeDebit = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(payment, "accountCode"),
                isInt=True)
            accountCodeCredit = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(payment, "accountCodeBank",
                                                   0),
                isInt=True)
            amountPaid = funcoesUteis.analyzeIfFieldIsValid(
                payment, "amountPaid", 0)
            numberLote = funcoesUteis.analyzeIfFieldIsValid(
                payment, "numberLote")

            if accountCodeDebit > 0 and accountCodeCredit > 0:

                # somente gera o cabeçalho e o total do lote caso ainda não tenha processado aquele 'numberLote'
                if numberLotesProcessed.count(numberLote) == 0:
                    self._file.write(self.header6000())

                if amountPaid > 0:
                    self._file.write(self.entry6100(payment, 'D', 'N'))
                if amountPaid < 0:
                    self._file.write(
                        self.entry6100(payment, 'C', 'N')
                    )  # os negativos tenho que creditar, geralmente são os descontos

                # faz a checagem do lote novamente pois precisa gerar antes o débito pra depois o crédito
                if numberLotesProcessed.count(numberLote) == 0:
                    self._file.write(
                        self.entry6100(payment,
                                       'C',
                                       'N',
                                       isAmountPaidPerLote=True))
                    numberLotesProcessed.append(numberLote)

                self._file.write(self.entry6100(payment, 'D', 'J'))
                self._file.write(self.entry6100(payment, 'D', 'M'))
                self._file.write(self.entry6100(payment, 'C', 'D'))
Exemplo n.º 2
0
 def showWarningsPayments(self, payment, key):
     accountCodeDebit = funcoesUteis.treatNumberField(
         funcoesUteis.analyzeIfFieldIsValid(payment, "accountCode"),
         isInt=True)
     accountCodeCredit = funcoesUteis.treatNumberField(
         funcoesUteis.analyzeIfFieldIsValid(payment, "accountCodeBank", 0),
         isInt=True)
     if accountCodeDebit == 0:
         print(
             f"\t\t - Na planilha de Pagamentos na linha {key+2} não foi configurado a conta do fornecedor/despesa."
         )
     if accountCodeCredit == 0:
         print(
             f"\t\t - Na planilha de Pagamentos na linha {key+2} não foi configurado a conta do banco."
         )
Exemplo n.º 3
0
    def process(self):
        try:
            companiesDominio = self._geempre.getCompanies()

            companiesExcel = leXls_Xlsx(
                'C:/Programming/baymax/backend/extract/data/empresas_grupo.xlsm',
                'EMPRESAS')

            print('- Exportando dados de movimentação geral empresas:')

            for companie in companiesExcel:
                codi_emp = funcoesUteis.treatNumberField(companie[0],
                                                         isInt=True)
                nome_emp = funcoesUteis.treatTextField(companie[1])
                group = funcoesUteis.treatTextField(companie[2])

                dataCompanie = {'codi_emp': codi_emp, 'groupCompanie': group}

                existCompanieDominio = list(
                    filter(
                        lambda companieDominio: companieDominio['codi_emp'] ==
                        codi_emp, companiesDominio))
                if len(existCompanieDominio) > 0:
                    self._collection.update_one({"codi_emp": codi_emp},
                                                {"$set": dataCompanie},
                                                upsert=True)
                    print(f"\t - {codi_emp} - {nome_emp}")

        except Exception as e:
            print(f"O erro é: {e}")
        finally:
            self._connectionMongo.closeConnection()
Exemplo n.º 4
0
 def readFornWithAccount(self, wayFile):
     dataTxt = leTxt(wayFile)
     for data in dataTxt:
         dataSplit = data.split(';')
         codiFornecedor = funcoesUteis.treatNumberField(dataSplit[1],
                                                        isInt=True)
         self._fornecedoresExistLanc.append(codiFornecedor)
    def exportData(self):
        print('- Exportando dados de integração:')
        try:
            companiesSettingsView = list(self._dbMongo['CompaniesSettingsView'].find({}))
            for companieSettingView in companiesSettingsView:
                del companieSettingView['_id']

                codiEmp = companieSettingView['codi_emp']                
                print(f"\t- Processando empresa {codiEmp} - {companieSettingView['nome_emp']}")

                cgceEmp = str(treatNumberField(companieSettingView['cgce_emp']))
                cgceMatriz = cgceEmp[:8]

                isCompanyBranch = treatTextField(companieSettingView['isCompanyBranch'])

                if isCompanyBranch == 'NAO':
                    companieMonthsAmountNotes = self.getCompaniesMonthsAmountNotes(cgceMatriz)
                else:
                    companieMonthsAmountNotes = self.getCompaniesMonthsAmountNotes(cgceEmp)
                
                self.saveMongo(codiEmp, cgceMatriz, companieMonthsAmountNotes)

        except Exception as e:
            print(f"Erro ao executar a consulta. O erro é: {e}")
        finally:
            self._connectionMongo.closeConnection()
            self._DB.closeConnection()
Exemplo n.º 6
0
 def cleanExtractWithOnlyDataNecessary(self, extract):
     del extract['historicCode']
     del extract['historic']
     document = funcoesUteis.analyzeIfFieldIsValid(extract, "document", None)
     document = funcoesUteis.treatNumberField(document, isInt=True)
     extract['document'] = document
     return extract
Exemplo n.º 7
0
    def exportExtracts(self):
        for key, extract in enumerate(self._extracts):
            accountCodeDebit = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(extract,
                                                   "accountCodeDebit"),
                isInt=True)
            accountCodeCredit = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(extract,
                                                   "accountCodeCredit"),
                isInt=True)
            operation = funcoesUteis.analyzeIfFieldIsValid(
                extract, "operation")

            if accountCodeDebit > 0 and accountCodeCredit > 0:
                self._file.write(self.header6000())
                self._file.write(self.entry6100(extract, 'D'))
                self._file.write(self.entry6100(extract, 'C'))
Exemplo n.º 8
0
    def showWarningsExtracts(self, extract, key):
        accountCodeDebit = funcoesUteis.treatNumberField(
            funcoesUteis.analyzeIfFieldIsValid(extract, "accountCodeDebit"),
            isInt=True)
        accountCodeCredit = funcoesUteis.treatNumberField(
            funcoesUteis.analyzeIfFieldIsValid(extract, "accountCodeCredit"),
            isInt=True)

        foundProofInPayments = funcoesUteis.analyzeIfFieldIsValid(
            extract, "foundProofInPayments", False)
        if foundProofInPayments is True and accountCodeDebit > 0 and accountCodeCredit > 0:
            print(
                f"\t\t - Na planilha do ExtratoBancario na linha {key+2} existe a informação que é uma transação que tem no financeiro do cliente, todavia foi inserido pra importá-la também no extrato."
            )

        operation = funcoesUteis.analyzeIfFieldIsValid(extract, "operation")
        if operation == "+" and (accountCodeDebit == 0
                                 or accountCodeCredit == 0):
            print(
                f"\t\t - Na planilha do ExtratoBancario na linha {key+2} a operação é SOMA mas não foi configurado a conta do débito ou crédito."
            )
Exemplo n.º 9
0
    def readFornGenerateDominio(self, wayFile):
        dataTxt = leTxt(wayFile)
        for data in dataTxt:
            dataSplit = data.split('|')
            codiFornecedor = funcoesUteis.treatNumberField(dataSplit[-1],
                                                           isInt=True)

            if self._fornecedoresExistLanc.count(codiFornecedor) == 0:
                dataSplit[19] = ''

            self._fornecedores.append(dataSplit)

        self.generateNewFileForn()
Exemplo n.º 10
0
    def exportLivroCaixa(self):
        for key, livroCaixa in enumerate(self._livroCaixa):
            account = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "account")
            accountCode = funcoesUteis.treatNumberField(funcoesUteis.analyzeIfFieldIsValid(self._accountPlan, account), isInt=True)
            livroCaixa['accountCode'] = accountCode

            if accountCode == 0:
                print(f' \t- ERRO: Na linha {key+2} não foi feita a relação da conta {account} com o Plano de Contas')
            
            if accountCode > 0:
                self._file.write(self.header6000())
                self._file.write(self.entry6100(livroCaixa))
                self._file.write(self.entry6140(livroCaixa, key))
Exemplo n.º 11
0
    def process(self):
        try:
            companiesDominio = self._geempre.getCompanies()

            companiesExcel = leXls_Xlsx(
                'C:/Programming/baymax/backend/extract/data/empresas_integrattion_old.xlsx',
                'Já Avaliadas - Hist')

            print('- Lendo dados das integrações antigas:')

            for companie in companiesExcel:
                codi_emp = funcoesUteis.treatNumberField(companie[0],
                                                         isInt=True)
                nome_emp = funcoesUteis.treatTextField(companie[1])
                responsibleFinancialClientOld = funcoesUteis.treatTextField(
                    companie[4])
                obsAccountPaidOld = funcoesUteis.treatTextField(companie[8])
                dateAccountPaidOld = funcoesUteis.treatTextField(companie[7])
                layoutsAccountPaidOld = funcoesUteis.treatTextField(
                    companie[9])
                hasIntegrated = funcoesUteis.treatTextField(companie[10])

                dataCompanie = {
                    'codi_emp': codi_emp,
                    'responsibleFinancialClientOld':
                    responsibleFinancialClientOld,
                    'obsAccountPaidOld': obsAccountPaidOld,
                    'dateAccountPaidOld': dateAccountPaidOld,
                    'layoutsAccountPaidOld': layoutsAccountPaidOld
                }

                existCompanieDominio = list(
                    filter(
                        lambda companieDominio: companieDominio['codi_emp'] ==
                        codi_emp, companiesDominio))
                if len(existCompanieDominio) > 0 and hasIntegrated == "SIM":
                    self._collection.update_one({"codi_emp": codi_emp},
                                                {"$set": dataCompanie},
                                                upsert=True)
                    print(f"\t - {codi_emp} - {nome_emp}")

        except Exception as e:
            print(f"O erro é: {e}")
        finally:
            self._connectionMongo.closeConnection()
Exemplo n.º 12
0
    def searchIfANote(self, historic):
        positionNote = -1
        noteCorrect = ""

        if historic.find(' NUMERO') >= 0:
            positionNote = historic.find(' NUMERO') + len(' NUMERO')

        if historic.find(' CUPOM') >= 0:
            positionNote = historic.find(' CUPOM') + len(' NUMERO')

        if historic.find(' NF') >= 0:
            positionNote = historic.find(' NF') + len(' NF')

        if positionNote >= 0:
            note = historic[positionNote:].lstrip()
            noteSplitHyphen = note.split('-')
            noteSplitSpace = note.split(' ')

            noteHyphenOne = funcoesUteis.analyzeIfFieldIsValidMatrix(noteSplitHyphen, 1).strip()
            noteHyphenTwo = funcoesUteis.analyzeIfFieldIsValidMatrix(noteSplitHyphen, 2).strip()
            if noteHyphenOne == "":
                noteHyphen = noteHyphenTwo.split(' ')[0].strip()
            else:
                noteHyphen = noteHyphenOne

            noteSpace = funcoesUteis.analyzeIfFieldIsValidMatrix(noteSplitSpace, 1).strip()
            if noteSpace.find('-') >= 0:
                noteCorrect = noteHyphen
            else:
                noteCorrect = noteSpace

            noteIsNumeric = funcoesUteis.treatNumberField(noteCorrect, isInt=True)
            if noteIsNumeric > 0:
                noteCorrect == noteCorrect
            else:
                noteCorrect = ""
        
        return noteCorrect
Exemplo n.º 13
0
    def process(self):
        try:
            companiesDominio = list(self._collection.find({}))

            companiesExcel = leXls_Xlsx(
                'C:/Programming/baymax/backend/extract/data/empresas_externos.xlsx',
                'GERAL')

            print('- Processando empresas dos externos:')

            for companie in companiesExcel:
                codi_emp = funcoesUteis.treatNumberField(companie[0],
                                                         isInt=True)
                nome_emp = funcoesUteis.treatTextField(companie[1])

                existCompanieDominio = list(
                    filter(
                        lambda companieDominio: companieDominio['codi_emp'] ==
                        codi_emp, companiesDominio))
                if len(existCompanieDominio) > 0:
                    dataCompanie = {
                        'codi_emp':
                        codi_emp,
                        'grupos_contabil':
                        f"{existCompanieDominio[0]['grupos_contabil']},EXTERNOS",
                        'grupos_fiscal':
                        f"{existCompanieDominio[0]['grupos_fiscal']},EXTERNOS"
                    }
                    self._collection.update_one({"codi_emp": codi_emp},
                                                {"$set": dataCompanie},
                                                upsert=True)
                    print(f"\t - {codi_emp} - {nome_emp}")

        except Exception as e:
            print(f"O erro é: {e}")
        finally:
            self._connectionMongo.closeConnection()
Exemplo n.º 14
0
    def process(self):
        valuesOfLine = {}

        isProofFileThisClass = False

        nameProvider = ""
        cgceProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        dueDate = None
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        paymentDate = None

        for data in self._dataFile:
            # if isProofFileThisClass == False and data.find('TIPO DE PAGAMENTO PIX') >= 0:
            #     isProofFileThisClass = True

            data = str(data)
            dataSplitTwoPoints = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(
                    dataSplitTwoPoints, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(
                    dataSplitTwoPoints, 2))

            if data.find('DADOS DO PAGADOR') >= 0:
                self._typeLineRead = 'PAGADOR'
            elif data.find('DADOS DO RECEBEDOR') >= 0:
                self._typeLineRead = 'RECEBEDOR'
            elif data.find('DADOS DA TRANSACAO') >= 0:
                self._typeLineRead = 'TRANSACAO'

            if self._typeLineRead == 'PAGADOR':
                if fieldOne.count('AGENCIA/CONTA') > 0:
                    account = funcoesUteis.analyzeIfFieldIsValidMatrix(
                        fieldTwo.split('/'), 2)
                    account = str(funcoesUteis.treatNumberField(account))

                if fieldOne.count('CPF / CNPJ') > 0:
                    cgcePaying = fieldTwo
            elif self._typeLineRead == 'RECEBEDOR':
                if fieldOne == "NOME DO RECEBEDOR":
                    nameProvider = fieldTwo

                if fieldOne.count('CPF / CNPJ') > 0:
                    cgceProvider = funcoesUteis.treatNumberField(fieldTwo)

            elif self._typeLineRead == 'TRANSACAO':
                if fieldOne == "VALOR":
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)

                if fieldOne.count('DATA DA TRANSF') > 0:
                    paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)

            if fieldOne.count('TIPO DE PAGAMENTO') > 0:
                # print(fieldOne, fieldTwo, paymentDate, amountPaid, isProofFileThisClass)
                if paymentDate is not None and amountPaid > 0:
                    valuesOfLine = {
                        "paymentDate": paymentDate,
                        "nameProvider": nameProvider,
                        "cgceProvider": cgceProvider,
                        "dueDate": dueDate,
                        "bank": 'ITAU',
                        "account": account,
                        "amountPaid": round(amountPaid, 2),
                        "amountInterest": round(amountInterest, 2),
                        "amountDiscount": round(amountDiscount, 2),
                        "amountOriginal": round(amountOriginal, 2),
                        "historic": historic,
                        "category": 'PIX',
                        "cgcePaying": cgcePaying,
                        "foundProof": True,
                        "amountPaidPerLote": round(amountPaid, 2),
                        "wayFile": self._file
                    }

                    return valuesOfLine.copy()
Exemplo n.º 15
0
    def processExtracts(self):

        for key, extract in enumerate(self._extracts):
            nameBank = funcoesUteis.analyzeIfFieldIsValid(
                extract, "bank", None)
            account = funcoesUteis.analyzeIfFieldIsValid(
                extract, "account", None)
            operation = funcoesUteis.analyzeIfFieldIsValid(
                extract, "operation", None)
            historic = funcoesUteis.analyzeIfFieldIsValid(
                extract, "historic", None)

            accountCodeDebit = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(extract, "accountCodeDebit",
                                                   0),
                isInt=True)
            accountCodeCredit = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(extract,
                                                   "accountCodeCredit", 0),
                isInt=True)

            # --- retorna a conta débito/crédito referente ao banco
            accountCodeBank = self.returnDataBanks(nameBank, account,
                                                   'EXTRATO BANCARIO')
            accountCodeBank = 0 if accountCodeBank is None else accountCodeBank

            if operation == "+":
                extract[
                    "accountCodeDebit"] = "" if accountCodeBank == 0 else accountCodeBank

            if operation == "-":
                extract[
                    "accountCodeCredit"] = "" if accountCodeBank == 0 else accountCodeBank

            # --- retorna a conta débito/crédito referente a contrapartida
            accountCodeExtract = self.returnDataExtract(historic, operation)
            accountCodeExtract = 0 if accountCodeExtract is None else accountCodeExtract

            foundProofInPayments = funcoesUteis.analyzeIfFieldIsValid(
                extract, "foundProofInPayments", False)

            if operation == "+" and accountCodeCredit == 0:
                extract[
                    "accountCodeCredit"] = "" if accountCodeExtract == 0 else accountCodeExtract

            if operation == "-" and accountCodeDebit == 0 and foundProofInPayments is False:
                extract[
                    "accountCodeDebit"] = "" if accountCodeExtract == 0 else accountCodeExtract

            self._extractsWithNewAccountCode.append(extract)

            # show de warnings
            if self._updateOrExtract is True:
                self.showWarningsExtracts(extract, key)

        return self._extractsWithNewAccountCode


# if __name__ == "__main__":
#     payments = [{'paymentDate': '31/10/2019', 'nameProvider': 'SANEAGO', 'cnpjProvider': '', 'amountPaid': 311.8, 'bank': 'ITAU', 'account': '44388', 'foundProof': True, 'document': '2099407921', 'historic': 'PAGAMENTO AGUA/ESGOTO REF.MES 10/2019 -', 'amountDiscount': 0.0, 'amountInterest': 0.0, 'amountOriginal': 311.8, 'accountPlan': 'AGUA E ESGOTO', 'bankCheck': '', 'dateExtract': '', 'bankExtract': '', 'accountExtract': '', 'historicExtract': '', 'findNote': False, 'accountCode': 0, 'cgceProvider': '', 'codiEmp': '1428'}, {'paymentDate': '31/10/2019', 'nameProvider': 'SANEAGO', 'cnpjProvider': '', 'amountPaid': 311.8, 'bank': 'ITAU', 'account': '44388', 'foundProof': True, 'document': '2099407921', 'historic': 'PAGAMENTO AGUA/ESGOTO REF.MES 10/2019 -', 'amountDiscount': 0.0, 'amountInterest': 0.0, 'amountOriginal': 311.8, 'accountPlan': 'AGUA E ESGOTO', 'bankCheck': '', 'dateExtract': '', 'bankExtract': '', 'accountExtract': '', 'historicExtract': '', 'findNote': False, 'accountCode': 0, 'cgceProvider': '', 'codiEmp': '1428'}, {'paymentDate': '03/10/2019', 'nameProvider': 'SALVARO INDUSTRIA E COMERCIO D', 'cnpjProvider': '', 'amountPaid': 5250.0, 'bank': 'ITAU', 'account': '44388', 'foundProof': True, 'document': '19142', 'historic': 'VLR. REF. COMPRAS CF. NF. NUM. 19142 -', 'amountDiscount': 0.0, 'amountInterest': 0.0, 'amountOriginal': 5250.0, 'accountPlan': 'COMPRA MERCADORIA', 'bankCheck': '', 'dateExtract': '', 'bankExtract': '', 'accountExtract': '', 'historicExtract': '', 'findNote': True, 'accountCode': 1158.0, 'cgceProvider': '80142250000103', 'codiEmp': '1428'}]
#     extracts = [{'bankId': 'ITAU', 'account': '4372443889', 'typeTransaction': 'DEBIT', 'dateTransaction': '01/10/2019', 'amount': 6500.0, 'operation': '-', 'document': '20191001001', 'historic': 'INT TED 759316'}]
#     compareWithSettings = CompareWithSettings(1428, payments, extracts)
#     print(compareWithSettings.processExtracts())
Exemplo n.º 16
0
    def processPayments(self):

        for key, payment in enumerate(self._payments):
            document = funcoesUteis.analyzeIfFieldIsValid(
                payment, "document", None)
            nameProvider = funcoesUteis.analyzeIfFieldIsValid(
                payment, "nameProvider", None)
            accountPlan = funcoesUteis.analyzeIfFieldIsValid(
                payment, "accountPlan", None)
            category = funcoesUteis.analyzeIfFieldIsValid(
                payment, "category", None)
            historic = funcoesUteis.analyzeIfFieldIsValid(
                payment, "historic", None)
            bank = funcoesUteis.analyzeIfFieldIsValid(payment, "bank", None)
            account = funcoesUteis.analyzeIfFieldIsValid(payment, "account")

            # busca a conta da despesa/fornecedor
            accountCode = funcoesUteis.treatNumberField(
                funcoesUteis.analyzeIfFieldIsValid(payment, "accountCode", 0),
                isInt=True)
            dataProviderOrExpense = self.returnDataProviderOrExpense(
                nameProvider, accountPlan, category, historic)
            accountCodeNew = funcoesUteis.analyzeIfFieldIsValid(
                dataProviderOrExpense, 'accountDominio', None)
            overwriteAccount = funcoesUteis.analyzeIfFieldIsValid(
                dataProviderOrExpense, 'overwriteAccount', '')
            if overwriteAccount == 'SIM':
                accountCode = 0 if accountCodeNew is None else accountCodeNew
            else:
                if accountCode == 0:
                    accountCode = 0 if accountCodeNew is None else accountCodeNew

            # pra empresas que tem plano de contas no sistema deles e o plano não bate, tem que fazer um de-para
            accountCodeOld = funcoesUteis.analyzeIfFieldIsValid(
                payment, "accountCodeOld", None)
            if accountCode == 0 and accountCodeOld != "" and accountCodeOld is not None:
                accountCode = funcoesUteis.treatNumberField(
                    funcoesUteis.analyzeIfFieldIsValid(
                        self._valuesFromToAccounts, accountCodeOld, None),
                    isInt=True)
                accountCode = 0 if accountCode is None else accountCode

            accountCodeBank = self.returnDataBanks(bank, account,
                                                   'FINANCEIRO DO CLIENTE')

            payment["accountCode"] = accountCode
            payment["accountCodeBank"] = accountCodeBank

            # print(self._valuesAccountAndHistoricOthers)
            payment[
                "historicCodeDiscount"] = funcoesUteis.returnDataFieldInDict(
                    self._valuesAccountAndHistoricOthers,
                    [("DESCONTO", "HISTORICO")], 0)
            payment[
                "historicCodeInterest"] = funcoesUteis.returnDataFieldInDict(
                    self._valuesAccountAndHistoricOthers,
                    [("JUROS", "HISTORICO")], 0)
            payment["historicCodeFine"] = funcoesUteis.returnDataFieldInDict(
                self._valuesAccountAndHistoricOthers, [("MULTA", "HISTORICO")],
                0)
            payment[
                "historicCodePagamento"] = funcoesUteis.returnDataFieldInDict(
                    self._valuesAccountAndHistoricOthers,
                    [("PAGAMENTO", "HISTORICO")], 0)
            payment[
                "accountCodeDiscount"] = funcoesUteis.returnDataFieldInDict(
                    self._valuesAccountAndHistoricOthers,
                    [("DESCONTO", "CONTA CONTABIL")], 434)
            payment[
                "accountCodeInterest"] = funcoesUteis.returnDataFieldInDict(
                    self._valuesAccountAndHistoricOthers,
                    [("JUROS", "CONTA CONTABIL")], 372)
            payment["accountCodeFine"] = funcoesUteis.returnDataFieldInDict(
                self._valuesAccountAndHistoricOthers,
                [("MULTA", "CONTA CONTABIL")], 352)

            compositionHistoricPrimeiraPalavraNumero = funcoesUteis.analyzeIfFieldIsValid(
                self._valuesAccountAndHistoricOthers,
                "PRIMEIRA PALAVRA E UM NUMERO")
            compositionHistoricPrimeiraPalavraNaoNumero = funcoesUteis.analyzeIfFieldIsValid(
                self._valuesAccountAndHistoricOthers,
                "PRIMEIRA PALAVRA NAO E UM NUMERO")
            compositionHistoricDiferenteVazio = funcoesUteis.analyzeIfFieldIsValid(
                self._valuesAccountAndHistoricOthers, "FOR DIFERENTE DE VAZIO")
            compositionHistoricVazio = funcoesUteis.analyzeIfFieldIsValid(
                self._valuesAccountAndHistoricOthers, "FOR VAZIO")

            if document is not None and document != "":
                documentSplit = str(document).split()

                if funcoesUteis.treatNumberField(
                        documentSplit[0], True
                ) > 0 and compositionHistoricPrimeiraPalavraNumero != "":
                    payment[
                        "compositionHistoric"] = compositionHistoricPrimeiraPalavraNumero
                if funcoesUteis.treatNumberField(
                        documentSplit[0], True
                ) == 0 and compositionHistoricPrimeiraPalavraNaoNumero != "":
                    payment[
                        "compositionHistoric"] = compositionHistoricPrimeiraPalavraNaoNumero
                if document != "" and compositionHistoricDiferenteVazio != "":
                    payment[
                        "compositionHistoric"] = compositionHistoricDiferenteVazio
            else:
                payment["compositionHistoric"] = compositionHistoricVazio

            # print(payment)

            self._paymentsWithNewAccountCode.append(payment)

            # show de warnings
            if self._updateOrExtract is True:
                self.showWarningsPayments(payment, key)

        return self._paymentsWithNewAccountCode
Exemplo n.º 17
0
    def process(self):
        valuesOfLine = {}

        isFgts = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None

        for data in self._dataFile:
            if isFgts == False and data.find(
                    'RECOLHIMENTO') >= 0 and data.find('FGTS') >= 0:
                isFgts = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))

            if fieldOne.count('AGENCIA') > 0 and fieldOne.count('CONTA') > 0:
                account = fieldTwo.split('/')
                account = funcoesUteis.analyzeIfFieldIsValidMatrix(account, 2)
                account = str(funcoesUteis.treatNumberField(account))
            if fieldOne == "PAGAMENTO EFETUADO EM":
                paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)
            if fieldOne == "VALOR RECOLHIDO":
                amountPaid = funcoesUteis.treatDecimalField(fieldTwo)
            if fieldOne.count('DESCRICAO DO PAGAMENTO') > 0:
                nameProvider = f"RECOLHIMENTO FGTS - {fieldTwo}"

            if paymentDate is not None and amountPaid > 0 and isFgts is True:
                valuesOfLine = {
                    "paymentDate": paymentDate,
                    "nameProvider": nameProvider,
                    "cgceProvider": "",
                    "dueDate": None,
                    "bank": 'ITAU',
                    "account": account,
                    "amountPaid": round(amountPaid, 2),
                    "amountInterest": round(amountInterest, 2),
                    "amountDiscount": round(amountDiscount, 2),
                    "amountFine": round(amountFine, 2),
                    "amountOriginal": round(amountOriginal, 2),
                    "historic": historic,
                    "category": 'FGTS - RECOLHEIMENTO',
                    "cgcePaying": "",
                    "foundProof": True,
                    "amountPaidPerLote": round(amountPaid, 2),
                    "wayFile": self._file
                }

                return valuesOfLine.copy()
Exemplo n.º 18
0
    def process(self):
        valuesOfFile = []
        valuesOfLine = {}

        isPagamento = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None
        dueDate = None
        countQtdDataNecessaryToProofIsValid = 0

        for data in self._dataFile:
            # print(data)
            if data.find('SICOOB - SISTEMA DE COOPERATIVAS') >= 0:
                countQtdDataNecessaryToProofIsValid = 0
                countQtdDataNecessaryToProofIsValid += 1

            if data.find('PAGAMENTO DE TITULO') >= 0:
                countQtdDataNecessaryToProofIsValid += 1

            if countQtdDataNecessaryToProofIsValid >= 2:
                isPagamento = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))
            # fieldThree = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))

            if fieldOne == 'CONTA':
                account = funcoesUteis.treatNumberField(fieldTwo.split('/')[0])

            if fieldOne.count('NOME') > 0 and fieldOne.count(
                    "BENEFICIARIO") > 0:
                nameProvider = fieldTwo

            if fieldOne.count('CNPJ') > 0 and fieldOne.count(
                    "BENEFICIARIO") > 0:
                cgceProvider = fieldTwo

            if fieldOne.count('CNPJ') > 0 and fieldOne.count("PAGADOR") > 0:
                cgcePaying = fieldTwo

            if fieldOne == "DATA PAGAMENTO":
                paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)

            if fieldOne == "DATA VENCIMENTO":
                dueDate = funcoesUteis.retornaCampoComoData(fieldTwo)

            if fieldOne == "VALOR DOCUMENTO":
                amountOriginal = funcoesUteis.treatDecimalField(fieldTwo)

            if fieldOne.count('DESCONTO') > 0 and fieldOne.count(
                    "ABATIMENTO") > 0:
                amountDiscount = funcoesUteis.treatDecimalField(fieldTwo)

            if fieldOne.count('OUTROS ACRESCIMOS') > 0:
                amountInterest = funcoesUteis.treatDecimalField(fieldTwo)

            if fieldOne == "VALOR PAGO":
                amountPaid = funcoesUteis.treatDecimalField(fieldTwo)

            if fieldOne == "VALOR PAGO":
                if paymentDate is not None and amountPaid > 0 and isPagamento is True:
                    valuesOfLine = {
                        "paymentDate": paymentDate,
                        "nameProvider": nameProvider,
                        "cgceProvider": cgceProvider,
                        "dueDate": dueDate,
                        "bank": 'SICOOB',
                        "account": account,
                        "amountPaid": round(amountPaid, 2),
                        "amountInterest": round(amountInterest, 2),
                        "amountDiscount": round(amountDiscount, 2),
                        "amountFine": round(amountFine, 2),
                        "amountOriginal": round(amountOriginal, 2),
                        "historic": historic,
                        "category": '',
                        "cgcePaying": cgcePaying,
                        "foundProof": True,
                        "amountPaidPerLote": round(amountPaid, 2),
                        "wayFile": self._file
                    }

                    valuesOfFile.append(valuesOfLine.copy())

        return valuesOfFile
Exemplo n.º 19
0
    def process(self):
        valuesOfLine = {}

        isDarf = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None

        for data in self._dataFile:
            if isDarf == False and data.find('PAGAMENTO') >= 0 and (
                    data.find('DARF') >= 0
                    or data.find('SIMPLES NACIONAL') >= 0):
                isDarf = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))

            if fieldOne.count('CONTA DEBITADA') > 0:
                self._accountDebitOrCredit = 'DEBIT'
            elif fieldOne.count('AGENTE ARRECADADOR') > 0:
                self._accountDebitOrCredit = 'CREDIT'

            if self._accountDebitOrCredit == 'DEBIT':
                # if fieldOne.count('AGENCIA/CONTA') > 0:
                #     account = fieldTwo.split()
                #     account = funcoesUteis.analyzeIfFieldIsValidMatrix(account, 2)
                #     account = str(funcoesUteis.treatNumberField(account))
                if fieldOne.count('AGENCIA') > 0 and fieldOne.count(
                        'CONTA') > 0:
                    account = fieldTwo.split('/')
                    account = funcoesUteis.analyzeIfFieldIsValidMatrix(
                        account, 2)
                    account = str(
                        funcoesUteis.treatNumberField(account, isInt=True))
            elif self._accountDebitOrCredit == 'CREDIT':
                if fieldOne == "DATA DO PAGAMENTO":
                    paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)
                if fieldOne == "VALOR PRINCIPAL":
                    amountOriginal = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "DESCONTO":
                    amountDiscount = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "VALOR DOS JUROS/ENCARGOS":
                    amountInterest = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "VALOR DA MULTA":
                    amountFine = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "VALOR TOTAL":
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne.count('CPF OU CNPJ') > 0:
                    nameProvider = f"DARF - {fieldTwo}"
                if nameProvider == "":
                    nameProvider = "SIMPLES NACIONAL"

            if fieldOne.count('AGENCIA') > 0 and fieldOne.count('CONTA') > 0:
                if paymentDate is not None and amountPaid > 0 and isDarf is True:
                    valuesOfLine = {
                        "paymentDate":
                        paymentDate,
                        "nameProvider":
                        nameProvider,
                        "cgceProvider":
                        "",
                        "dueDate":
                        None,
                        "bank":
                        'ITAU',
                        "account":
                        account,
                        "amountPaid":
                        round(amountPaid, 2),
                        "amountInterest":
                        round(amountInterest, 2),
                        "amountDiscount":
                        round(amountDiscount, 2),
                        "amountFine":
                        round(amountFine, 2),
                        "amountOriginal":
                        round(amountOriginal, 2),
                        "historic":
                        historic,
                        "category":
                        'DARF' if nameProvider != "SIMPLES NACIONAL" else
                        nameProvider,
                        "cgcePaying":
                        "",
                        "foundProof":
                        True,
                        "amountPaidPerLote":
                        round(amountPaid, 2),
                        "wayFile":
                        self._file
                    }

                    return valuesOfLine.copy()
Exemplo n.º 20
0
    def process(self):
        valuesOfLine = {}

        isProofPagamentoBoleto = False

        nameProvider = ""
        cgceProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        dueDate = None
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)

        for data in self._dataFile:
            if isProofPagamentoBoleto == False and data.find(
                    'PAGAMENTO DE BOLETO') >= 0:
                isProofPagamentoBoleto = True

            data = str(data)
            dataSplitTwoPoints = data.split(':')
            dataSplitSpace = data.split(' ')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(
                    dataSplitTwoPoints, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(
                    dataSplitTwoPoints, 2))

            if fieldOne.count('AGENCIA/CONTA') > 0:
                account = funcoesUteis.analyzeIfFieldIsValidMatrix(
                    fieldTwo.split('/'), 2)
                account = str(funcoesUteis.treatNumberField(account))
                # account = str(funcoesUteis.treatNumberField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split('-'), 1), isInt=True))

                cgcePaying = funcoesUteis.treatNumberField(
                    funcoesUteis.analyzeIfFieldIsValidMatrix(
                        dataSplitTwoPoints, 3))

            # faço esta separação pra poder identificar o que deve ser lido, pois os dados estão na linha abaixo e não onde 'BENEFICIARIO' por exemplo
            if fieldOne == 'BENEFICIARIO':
                self._typeLineRead = 'beneficiario'
            elif fieldOne.count('VALOR DO BOLETO') > 0 or fieldOne.count(
                    'VALOR DO DOCUMENTO') > 0:
                self._typeLineRead = 'valor_boleto'
            elif fieldOne.count('DESCONTO') > 0 and fieldOne.count('(-)') > 0:
                self._typeLineRead = 'desconto'
            elif fieldOne.count('MORA/MULTA') > 0 and fieldOne.count(
                    '(+)') > 0:
                self._typeLineRead = 'juros'
            if data.count('VALOR DO PAGAMENTO') > 0 and data.count('R$') > 0:
                self._typeLineRead = 'valor_pago'
            elif data.count('DATA DE PAGAMENTO') > 0:
                self._typeLineRead = 'data_pagamento'

            # dados da linha do BENEFICIARIO
            if self._typeLineRead == 'beneficiario' and fieldOne.count(
                    'BENEFICIARIO') == 0:
                # alguns comprovantes de boleto tem a RAZAO SOCIAL e CNPJ também
                if (fieldOne == "RAZAO SOCIAL"):
                    nameProvider = ' '.join(
                        dataSplitSpace[2:len(dataSplitSpace) - 2])
                    cgceProvider = funcoesUteis.treatNumberField(
                        dataSplitSpace[len(dataSplitSpace) - 2])
                else:
                    nameProvider = ' '.join(
                        dataSplitSpace[:len(dataSplitSpace) - 1])

                nameProvider = nameProvider.strip()
                dueDate = funcoesUteis.retornaCampoComoData(
                    dataSplitSpace[len(dataSplitSpace) - 1])
            # dados da linha do VALOR ORIGINAL DO BOLETO
            elif self._typeLineRead == 'valor_boleto' and fieldOne.count(
                    'VALOR DO BOLETO') == 0 and fieldOne.count(
                        'VALOR DO DOCUMENTO') == 0:
                amountOriginal = funcoesUteis.treatDecimalField(
                    dataSplitSpace[len(dataSplitSpace) - 1])
            # dados da linha do VALOR DESCONTO
            elif self._typeLineRead == 'desconto' and fieldOne.count(
                    'DESCONTO') == 0:
                amountDiscount = funcoesUteis.treatDecimalField(
                    dataSplitSpace[len(dataSplitSpace) - 1])
            # dados da linha do VALOR MORA/MULTA
            elif self._typeLineRead == 'juros' and fieldOne.count(
                    'MORA/MULTA') == 0:
                amountInterest = funcoesUteis.treatDecimalField(
                    dataSplitSpace[len(dataSplitSpace) - 1])
            # dados da linha do VALOR MORA/MULTA
            elif self._typeLineRead == 'valor_pago' and data.count(
                    'VALOR DO PAGAMENTO') == 0 and data.count('R$') == 0:
                amountPaid = funcoesUteis.treatDecimalField(
                    dataSplitSpace[len(dataSplitSpace) - 1])

            for valueOfLineDatePayment in self._valuesOfLineDatePayment:
                if data[0:len(valueOfLineDatePayment
                              )] == valueOfLineDatePayment:
                    paymentDate = funcoesUteis.treatTextField(
                        data[len(valueOfLineDatePayment) +
                             1:len(valueOfLineDatePayment) + 11])
                    if paymentDate.find('.') >= 0:
                        paymentDate = funcoesUteis.retornaCampoComoData(
                            paymentDate.replace('.', '/'))
                    else:
                        paymentDate = funcoesUteis.retornaCampoComoData(
                            paymentDate)

                    if paymentDate is not None and amountPaid > 0 and isProofPagamentoBoleto is True:
                        valuesOfLine = {
                            "paymentDate": paymentDate,
                            "nameProvider": nameProvider,
                            "cgceProvider": cgceProvider,
                            "dueDate": dueDate,
                            "bank": 'ITAU',
                            "account": account,
                            "amountPaid": round(amountPaid, 2),
                            "amountInterest": round(amountInterest, 2),
                            "amountDiscount": round(amountDiscount, 2),
                            "amountOriginal": round(amountOriginal, 2),
                            "historic": historic,
                            "category": 'PAGTO DE BOLETO',
                            "cgcePaying": cgcePaying,
                            "foundProof": True,
                            "amountPaidPerLote": round(amountPaid, 2),
                            "wayFile": self._file
                        }

                        return valuesOfLine.copy()
Exemplo n.º 21
0
    def process(self):
        valuesOfLine = {}

        isTransferencia = False

        nameProvider = ""
        cgceProvider = ''
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None
        
        for data in self._dataFile:
            if isTransferencia == False and data.find('COMPROVANTE DE TRANSF') >= 0:
                isTransferencia = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))
            fieldThree = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))

            if fieldOne.count('DO DOCUMENTO') > 0:
                self._accountDebitOrCredit = 'DEBIT'
            elif fieldOne.count('FAVORECIDO') > 0:
                self._accountDebitOrCredit = 'CREDIT'
            
            if fieldTwo.count("DATA DA TRANSF") > 0:
                paymentDate = funcoesUteis.retornaCampoComoData(fieldThree)

            if self._accountDebitOrCredit == 'DEBIT':
                if fieldOne == 'CONTA':
                    account = str(funcoesUteis.treatNumberField(fieldTwo, isInt=True))

            if fieldOne == 'NOME':
                nameProvider = fieldTwo  
            if fieldOne == 'CPF':
                cgceProvider = fieldTwo            
            if fieldOne == 'CNPJ':
                cgceProvider = fieldTwo
            if fieldOne == "VALOR":
                amountPaid = funcoesUteis.treatDecimalField(fieldTwo)
            if fieldOne.count("DATA DA TRANSF") > 0:
                paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)

            if fieldOne == "DESCRICAO":
                if paymentDate is not None and amountPaid > 0 and isTransferencia is True:
                    valuesOfLine = {
                        "paymentDate": paymentDate,
                        "nameProvider": nameProvider,
                        "cgceProvider": cgceProvider,
                        "dueDate": None,
                        "bank": 'AMAZONIA',
                        "account": account,
                        "amountPaid": round(amountPaid, 2),
                        "amountInterest": round(amountInterest, 2),
                        "amountDiscount": round(amountDiscount, 2),
                        "amountFine": round(amountFine, 2),
                        "amountOriginal": round(amountOriginal, 2),
                        "historic": historic,
                        "category": 'TRANSFERENCIA',
                        "cgcePaying": "",
                        "foundProof": True,
                        "amountPaidPerLote": round(amountPaid, 2),
                        "wayFile": self._file
                    }

                    return valuesOfLine.copy()
    def returnDataInstallmentsEntryNote(self,
                                        dueDate=None,
                                        note=0,
                                        cgceProvider=None,
                                        ddoc_ent=None,
                                        dent_ent=None,
                                        amountPayment=0.0,
                                        amountOriginal=0.0):
        if dueDate is None:
            return None  # se a data de vencimento for nula já nem processa o resto

        if note == "" or note is None:
            note = 0
        if cgceProvider == "":
            cgceProvider = None
        if ddoc_ent == "":
            ddoc_ent = None
        if dent_ent == "":
            dent_ent = None

        # se o vencimento for nulo já nem percorre os dados
        if dueDate is None:
            return None

        for installment in self._installments:
            provider = self.returnDataProvider(installment["codi_for"])

            dueDateEntryNote = funcoesUteis.transformaCampoDataParaFormatoBrasileiro( \
                funcoesUteis.retornaCampoComoData(funcoesUteis.analyzeIfFieldIsValid(installment, "vcto_entp"), 2) )
            cgceProviderEntryNote = funcoesUteis.analyzeIfFieldIsValid(
                provider, "cgce_for", None)
            noteEntryNote = int(
                funcoesUteis.analyzeIfFieldIsValid(installment, "nume_ent", 0))
            issueEntryNote = funcoesUteis.transformaCampoDataParaFormatoBrasileiro( \
                funcoesUteis.retornaCampoComoData(funcoesUteis.analyzeIfFieldIsValid(installment, "ddoc_ent"), 2) )
            entryEntryNote = funcoesUteis.transformaCampoDataParaFormatoBrasileiro( \
                funcoesUteis.retornaCampoComoData(funcoesUteis.analyzeIfFieldIsValid(installment, "dent_ent"), 2) )
            amountInstallmentEntryNote = float(
                funcoesUteis.analyzeIfFieldIsValid(installment, "vlor_entp",
                                                   0.0))

            # o int é pra poder tirar o .0 de quando é exportado os dados
            note = funcoesUteis.treatNumberField(note, True)

            if note != 0:  # se a nota for válida compara os dados com ela, uma comparação no mínimo tem que ser igual, pq a se a nota tá preenchida ela tem que existir na domínio (mesmo número)
                if dueDateEntryNote == dueDate and noteEntryNote == note:
                    return installment
            else:
                if dueDateEntryNote == dueDate and cgceProviderEntryNote == cgceProvider:
                    return installment

                if dueDateEntryNote == dueDate and issueEntryNote == ddoc_ent and ddoc_ent is not None:
                    return installment

                if dueDateEntryNote == dueDate and entryEntryNote == dent_ent and dent_ent is not None:
                    return installment

                if dueDateEntryNote == dueDate and amountInstallmentEntryNote == amountOriginal and amountOriginal > 0:
                    return installment

                if dueDateEntryNote == dueDate and amountInstallmentEntryNote == amountPayment and amountPayment > 0:
                    return installment
    def returnDataEntryNote(self,
                            note=0,
                            cgceProvider=None,
                            ddoc_ent=None,
                            dent_ent=None,
                            amountPayment=0.0,
                            nameProvider=None,
                            dueDate=None,
                            amountOriginal=0.0):
        if note == "" or note is None:
            note = 0
        if cgceProvider == "":
            cgceProvider = None
        if ddoc_ent == "":
            ddoc_ent = None
        if dent_ent == "":
            dent_ent = None
        if dueDate == "":
            dueDate = None
        if nameProvider == "":
            nameProvider = None

        note = funcoesUteis.treatNumberField(note, True)

        if note == 0 and ddoc_ent is None and dent_ent is None and cgceProvider is None and nameProvider is None:
            return None

        wayFiles = os.path.join(fileDir,
                                f'{folderExtractDatabaseAccount}/entradas/',
                                str(self._codiEmp))

        for root, dirs, files in os.walk(wayFiles):
            for file in sorted(files, reverse=True):
                if file.lower().endswith(('.json')):
                    competenceFile = funcoesUteis.retornaCampoComoData(
                        f'{file[0:4]}-{file[4:6]}-01', 2)
                    if competenceFile > self._finalDate:
                        continue

                    wayFile = os.path.join(root, file)
                    entryNotes = readJson(wayFile)

                    for entryNote in entryNotes:
                        provider = self.returnDataProvider(
                            entryNote["codi_for"])

                        cgceProviderEntryNote = funcoesUteis.analyzeIfFieldIsValid(
                            provider, "cgce_for", None)
                        nameProviderEntryNote = funcoesUteis.analyzeIfFieldIsValid(
                            provider, "nome_for", None)
                        noteEntryNote = int(
                            funcoesUteis.analyzeIfFieldIsValid(
                                entryNote, "nume_ent", 0))
                        issueEntryNote = funcoesUteis.transformaCampoDataParaFormatoBrasileiro( \
                            funcoesUteis.retornaCampoComoData(funcoesUteis.analyzeIfFieldIsValid(entryNote, "ddoc_ent"), 2) )
                        entryEntryNote = funcoesUteis.transformaCampoDataParaFormatoBrasileiro( \
                            funcoesUteis.retornaCampoComoData(funcoesUteis.analyzeIfFieldIsValid(entryNote, "dent_ent"), 2) )
                        amountAccountEntryNote = float(
                            funcoesUteis.analyzeIfFieldIsValid(
                                entryNote, "vcon_ent", 0.0))

                        if note != 0:  # se a nota for válida compara os dados com ela, uma comparação no mínimo tem que ser igual, pq a se a nota tá preenchida ela tem que existir na domínio (mesmo número)
                            if noteEntryNote == note and cgceProviderEntryNote == cgceProvider:
                                return entryNote

                            if noteEntryNote == note and issueEntryNote == ddoc_ent and ddoc_ent is not None:
                                return entryNote

                            if noteEntryNote == note and entryEntryNote == dent_ent and dent_ent is not None:
                                return entryNote

                            if noteEntryNote == note and issueEntryNote == dueDate and dueDate is not None:  # a comparação por vencimento e emissão é pq algumas vezes a data de vencimento é a própria emissão
                                return entryNote

                            if noteEntryNote == note and amountAccountEntryNote == amountOriginal and amountOriginal > 0:
                                return entryNote

                            if noteEntryNote == note and amountAccountEntryNote == amountPayment and amountPayment > 0:
                                return entryNote
                        else:  # se não tiver a nota olha outros pontos de apoios que não são tão confiáveis
                            if issueEntryNote == ddoc_ent and cgceProviderEntryNote == cgceProvider and ddoc_ent is not None:
                                return entryNote

                            if entryEntryNote == dent_ent and cgceProviderEntryNote == cgceProvider and dent_ent is not None:
                                return entryNote

                            if issueEntryNote == dueDate and cgceProviderEntryNote == cgceProvider and dueDate is not None:
                                return entryNote

                            if amountAccountEntryNote == amountOriginal and cgceProviderEntryNote == cgceProvider and amountOriginal > 0:
                                return entryNote

                            if amountAccountEntryNote == amountPayment and cgceProviderEntryNote == cgceProvider and amountPayment > 0:
                                return entryNote

                        # comparação pelo nome, caso as hipóteses acima não retorne nada
                        compareTwoWords = self.compareTwoNames(
                            nameProviderEntryNote, nameProvider)
                        if compareTwoWords[
                                "first7LettersEquals"] is True or compareTwoWords[
                                    "percentWordsEqualsAboutNameTwo"] >= 0.25:
                            if note != 0:  # se a nota for válida compara os dados com ela, uma comparação no mínimo tem que ser igual, pq a se a nota tá preenchida ela tem que existir na domínio (mesmo número)
                                if noteEntryNote == note:
                                    return entryNote
                            else:
                                if issueEntryNote == ddoc_ent and ddoc_ent is not None:
                                    return entryNote

                                if entryEntryNote == dent_ent and dent_ent is not None:
                                    return entryNote

                                if issueEntryNote == dueDate and dueDate is not None:
                                    return entryNote

                                if amountAccountEntryNote == amountOriginal and amountOriginal > 0:
                                    return entryNote

                                if amountAccountEntryNote == amountPayment and amountPayment > 0:
                                    return entryNote
Exemplo n.º 24
0
    def process(self):
        valuesOfLine = {}

        isProofAgendamento = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None

        for data in self._dataFile:
            if isProofAgendamento == False and data.find(
                    'COMPROVANTE DE AGENDAMENTO') >= 0:
                isProofAgendamento = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))

            # faço esta separação pra poder identificar o que deve ser lido, pois os dados estão na linha abaixo e não onde 'BENEFICIARIO' por exemplo
            if fieldOne.count('CONTA A SER DEBITADA') > 0:
                self._typeLineRead = 'conta_debitada'
            elif fieldOne.count('DADOS DO PAGAMENTO') > 0:
                self._typeLineRead = 'dados_pagamento'
            elif fieldOne.count('DADOS DO BENEFICIARIO') > 0:
                self._typeLineRead = 'beneficiario'
            elif fieldOne.count('DADOS DO PAGADOR') > 0:
                self._typeLineRead = 'pagador'
            elif fieldOne.count('DADOS DO BOLETO') > 0:
                self._typeLineRead = 'dados_boleto'

            if self._typeLineRead == "conta_debitada":
                if fieldOne.count('AGENCIA') > 0:
                    account = funcoesUteis.treatTextField(
                        funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))
                    account = str(funcoesUteis.treatNumberField(account))
                    # account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split('-'), 1))
                    # if account.find(' ') > 0:
                    #     account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split(' '), 1))
            if self._typeLineRead == 'beneficiario':
                if fieldOne == "NOME":
                    nameProvider = fieldTwo
                if fieldOne == "RAZAO SOCIAL":
                    nameProvider = fieldTwo
                if fieldOne.count('CNPJ') > 0 or fieldOne.count('CPF') > 0:
                    cgceProvider = funcoesUteis.treatNumberField(fieldTwo)
            if self._typeLineRead == 'pagador':
                if fieldOne.count('CNPJ') > 0 or fieldOne.count('CPF') > 0:
                    cgcePaying = funcoesUteis.treatNumberField(fieldTwo)
            elif self._typeLineRead == 'dados_boleto':
                if fieldOne == "DATA DE VENCIMENTO":
                    dueDate = funcoesUteis.retornaCampoComoData(fieldTwo)
                if fieldOne == "DATA DO PAGAMENTO":
                    paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)
                if fieldOne == "VALOR DO DOCUMENTO":
                    amountOriginal = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "DESCONTO":
                    amountDiscount = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "JUROS/MORA":
                    amountInterest = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "MULTA":
                    amountFine = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "VALOR DO PAGAMENTO":
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)

            for valueOfLineDatePayment in self._valuesOfLineDatePayment:
                if data[0:len(valueOfLineDatePayment
                              )] == valueOfLineDatePayment:
                    if paymentDate is None:  # apenas se for None, pq o de agendamento tem um campo especifico pra data
                        paymentDate = funcoesUteis.treatTextField(
                            data[len(valueOfLineDatePayment) +
                                 1:len(valueOfLineDatePayment) + 11])
                        if paymentDate.find('.') >= 0:
                            paymentDate = funcoesUteis.retornaCampoComoData(
                                paymentDate.replace('.', '/'))
                        else:
                            paymentDate = funcoesUteis.retornaCampoComoData(
                                paymentDate)

                    if paymentDate is not None and amountPaid > 0 and isProofAgendamento is True:
                        valuesOfLine = {
                            "paymentDate": paymentDate,
                            "nameProvider": nameProvider,
                            "cgceProvider": cgceProvider,
                            "dueDate": dueDate,
                            "bank": 'ITAU',
                            "account": account,
                            "amountPaid": round(amountPaid, 2),
                            "amountInterest": round(amountInterest, 2),
                            "amountDiscount": round(amountDiscount, 2),
                            "amountFine": round(amountFine, 2),
                            "amountOriginal": round(amountOriginal, 2),
                            "historic": historic,
                            "category": 'AGENDAMENTO',
                            "cgcePaying": cgcePaying,
                            "foundProof": True,
                            "amountPaidPerLote": round(amountPaid, 2),
                            "wayFile": self._file
                        }

                        return valuesOfLine.copy()
Exemplo n.º 25
0
    def process(self):
        valuesOfLine = {}

        isProofTransferencia = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""

        for data in self._dataFile:
            if isProofTransferencia == False and data.find(
                    'COMPROVANTE DE TRANSFERENCIA') >= 0:
                isProofTransferencia = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))

            if fieldOne.count('IDENTIFICACAO NO EXTRATO') > 0:
                historic = funcoesUteis.treatTextField(fieldTwo)

            if fieldOne.count('CONTA DEBITADA') > 0:
                self._accountDebitOrCredit = 'DEBIT'
            elif fieldOne.count('CONTA CREDITADA') > 0:
                self._accountDebitOrCredit = 'CREDIT'

            if self._accountDebitOrCredit == 'DEBIT':
                if fieldOne.count('AGENCIA') > 0:
                    account = funcoesUteis.treatTextField(
                        funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))
                    account = str(funcoesUteis.treatNumberField(account))
                    # account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split('-'), 1))
                    # if account.find(' ') > 0:
                    #     account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split(' '), 1))
            elif self._accountDebitOrCredit == 'CREDIT':
                if fieldOne == "NOME":
                    nameProvider = fieldTwo

                if fieldOne.count("VALOR") > 0:
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)

            for valueOfLineDatePayment in self._valuesOfLineDatePayment:
                if data[0:len(valueOfLineDatePayment
                              )] == valueOfLineDatePayment:
                    paymentDate = funcoesUteis.treatTextField(
                        data[len(valueOfLineDatePayment) +
                             1:len(valueOfLineDatePayment) + 11])
                    if paymentDate.find('.') >= 0:
                        paymentDate = funcoesUteis.retornaCampoComoData(
                            paymentDate.replace('.', '/'))
                    else:
                        paymentDate = funcoesUteis.retornaCampoComoData(
                            paymentDate)

                    if paymentDate is not None and amountPaid > 0 and isProofTransferencia is True:
                        valuesOfLine = {
                            "paymentDate": paymentDate,
                            "nameProvider": nameProvider,
                            "cgceProvider": '',
                            "dueDate": '',
                            "bank": 'ITAU',
                            "account": account,
                            "amountPaid": round(amountPaid, 2),
                            "historic": historic,
                            "category": 'TRANSFERENCIA',
                            "cgcePaying": '',
                            "foundProof": True,
                            "amountPaidPerLote": round(amountPaid, 2),
                            "wayFile": self._file
                        }

                        return valuesOfLine.copy()
Exemplo n.º 26
0
    def process(self):
        valuesOfLine = {}

        isPagamentoInss = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None
        dueDate = None

        for data in self._dataFile:
            if isPagamentoInss == False and data.find(
                    'COMPROVANTE DE PAGAMENTO') >= 0 and (data.find('INSS') or
                                                          data.find('DARF')):
                isPagamentoInss = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))
            fieldThree = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))

            if fieldOne.count('DO DOCUMENTO') > 0 and fieldTwo.count(
                    "DATA") > 0:
                paymentDate = funcoesUteis.retornaCampoComoData(fieldThree)

            if fieldOne == 'CONTA':
                account = str(
                    funcoesUteis.treatNumberField(fieldTwo, isInt=True))

            if fieldOne.count('MULTA') > 0 or fieldOne.count('JUROS') > 0:
                amountInterest = funcoesUteis.treatDecimalField(fieldTwo)
            if fieldOne == "VALOR TOTAL":
                amountPaid = funcoesUteis.treatDecimalField(fieldTwo)

            if fieldOne == 'DESCRICAO':
                nameProvider = fieldTwo

            if fieldOne == "DESCRICAO":
                if paymentDate is not None and amountPaid > 0 and isPagamentoInss is True:
                    valuesOfLine = {
                        "paymentDate": paymentDate,
                        "nameProvider": nameProvider,
                        "cgceProvider": "",
                        "dueDate": dueDate,
                        "bank": 'AMAZONIA',
                        "account": account,
                        "amountPaid": round(amountPaid, 2),
                        "amountInterest": round(amountInterest, 2),
                        "amountDiscount": round(amountDiscount, 2),
                        "amountFine": round(amountFine, 2),
                        "amountOriginal": round(amountOriginal, 2),
                        "historic": historic,
                        "category": 'PAGAMENTO',
                        "cgcePaying": "",
                        "foundProof": True,
                        "amountPaidPerLote": round(amountPaid, 2),
                        "wayFile": self._file
                    }

                    return valuesOfLine.copy()
Exemplo n.º 27
0
    def process(self):
        valuesOfLine = {}

        isProofDefaultSispag = False

        nameProvider = ""
        namePayee = ""
        historic = ""
        dueDate = None
        cgcePaying = ""
        cnpjProvider = ""
        amountPaid = float(0)
        category = ""
        bank = "ITAU"
        account = ""

        for data in self._dataFile:

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))

            fieldTwo = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))

            if fieldOne.count('COMPROVANTE DE OPERACAO') > 0:
                category = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(data.split('-'), 2))
            if fieldOne.count('PAGAMENTO COM CODIGO DE BARRAS') > 0:
                category = 'PAGTO COD BARRA'
            if fieldOne.count("PAGAMENTO DE CONCESSIONARIAS") > 0:
                category = 'PAGTO CONCESSIONARIA'
            if fieldOne.count("FGTS") > 0 or fieldOne.count("GRRF") > 0:
                category = 'PAGTO FGTS-GRRF'
            if fieldOne.count("GUIA DE RECOLHIMENTO") > 0:
                category = 'PAGTO GRF'
                historic = funcoesUteis.treatTextField(data)
            
            if fieldOne.count("IDENTIFICACAO NO EXTRATO") > 0:
                historic = fieldTwo

            if fieldOne.count('CONTA') > 0 and fieldOne.count('DEBITADA') > 0:
                self._accountDebitOrCredit = 'DEBIT'
            elif fieldOne.count('CONTA A SER CREDITADA') > 0 or fieldOne.count('DADOS DO PAGAMENTO') > 0:
                self._accountDebitOrCredit = 'CREDIT'

            if self._accountDebitOrCredit == 'DEBIT':
                if fieldOne.count('AGENCIA') > 0:
                    account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))
                    account = str(funcoesUteis.treatNumberField(account))
                    # account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split('-'), 1))
                    # if account.find(' ') > 0:
                    #     account = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(account.split(' '), 1))
            elif self._accountDebitOrCredit == 'CREDIT':
                if fieldOne == "NOME":
                    nameProvider = fieldTwo

                if fieldOne == "NOME DO FAVORECIDO":
                    nameProvider = fieldTwo
                    namePayee = nameProvider
                    
                if fieldOne == "INFORMACOES FORNECIDAS PELO PAGADOR":
                    historic = fieldTwo
                
                if fieldOne == "DATA DE VENCIMENTO":
                    dueDate = funcoesUteis.transformaCampoDataParaFormatoBrasileiro(funcoesUteis.retornaCampoComoData(fieldTwo))

                if ( fieldOne.count("CPF") > 0 or fieldOne.count("CNPJ") > 0 ) and fieldOne.count("PAGADOR") > 0:
                    cgcePaying = funcoesUteis.treatNumberField(fieldTwo)

                if ( fieldOne.count("CPF") > 0 or fieldOne.count("CNPJ") > 0 ) and fieldOne.count("PAGADOR") == 0:
                    cnpjProvider = funcoesUteis.treatNumberField(fieldTwo)

                if fieldOne.count("VALOR") > 0:
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)

			# quando é pagamento de imposto não tem o nome do fornecedor, o dados vem na informação complementar
            if historic != "" and dueDate == "" and namePayee == "":
                nameProvider = historic

            # se o nome do fornecedor ainda for vazio, então considero a categoria como fornecedor
            if nameProvider == "" and category != "":
                nameProvider = category

            for valueOfLineDatePayment in self._valuesOfLineDatePayment:
                if data[0 : len(valueOfLineDatePayment) ] == valueOfLineDatePayment:
                    paymentDate = funcoesUteis.treatTextField(data[len(valueOfLineDatePayment)+1:len(valueOfLineDatePayment)+11])
                    paymentDate = funcoesUteis.retornaCampoComoData(paymentDate.replace('.', '/'))

                    if paymentDate is not None and amountPaid > 0:
                        valuesOfLine = {
                            "paymentDate": paymentDate,
                            "nameProvider": nameProvider,
                            "cgceProvider": cnpjProvider,
                            "dueDate": dueDate,
                            "bank": bank,
                            "account": account,
                            "amountPaid": round(amountPaid, 2),
                            "historic": historic,
                            "category": category,
                            "cgcePaying": cgcePaying,
                            "foundProof": True,
                            "amountPaidPerLote": round(amountPaid, 2),
                            "wayFile": self._file
                        }

                        return valuesOfLine.copy()
Exemplo n.º 28
0
    def process(self):
        valuesOfLine = {}

        isPagamento = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None
        dueDate = None

        for data in self._dataFile:
            if isPagamento == False and data.find(
                    'COMPROVANTE DE PAGAMENTO') >= 0:
                isPagamento = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))
            fieldThree = funcoesUteis.treatTextField(
                funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 3))

            if fieldOne.count('DO DOCUMENTO') > 0 and fieldTwo.count(
                    "DATA") > 0:
                paymentDate = funcoesUteis.retornaCampoComoData(fieldThree)

            if fieldOne == 'CONTA':
                account = str(
                    funcoesUteis.treatNumberField(fieldTwo, isInt=True))

            if fieldOne.count('BENEFICIARIO') > 0:
                self._accountDebitOrCredit = 'DEBIT'
            elif fieldOne.count('PAGADOR') > 0:
                self._accountDebitOrCredit = 'CREDIT'
            elif fieldOne.count('SACADOR') > 0:
                self._accountDebitOrCredit = ''

            if self._accountDebitOrCredit == 'DEBIT':
                if fieldOne == 'RAZAO SOCIAL':
                    nameProvider = fieldTwo
                if fieldOne == 'CNPJ/CPF':
                    cgceProvider = fieldTwo

            elif self._accountDebitOrCredit == 'CREDIT':
                if fieldOne == "DATA DO PAGAMENTO":
                    paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)
                if fieldOne == "DATA DE VENCIMENTO":
                    dueDate = funcoesUteis.retornaCampoComoData(fieldTwo)
                if fieldOne == "VALOR NOMINAL":
                    amountOriginal = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == 'ENCARGOS':
                    amountInterest = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "VALOR PAGO":
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "DESCONTO":
                    amountDiscount = funcoesUteis.treatDecimalField(fieldTwo)

            if fieldOne == "VALOR PAGO":
                if paymentDate is not None and amountPaid > 0 and isPagamento is True:
                    valuesOfLine = {
                        "paymentDate": paymentDate,
                        "nameProvider": nameProvider,
                        "cgceProvider": cgceProvider,
                        "dueDate": dueDate,
                        "bank": 'AMAZONIA',
                        "account": account,
                        "amountPaid": round(amountPaid, 2),
                        "amountInterest": round(amountInterest, 2),
                        "amountDiscount": round(amountDiscount, 2),
                        "amountFine": round(amountFine, 2),
                        "amountOriginal": round(amountOriginal, 2),
                        "historic": historic,
                        "category": 'PAGAMENTO',
                        "cgcePaying": "",
                        "foundProof": True,
                        "amountPaidPerLote": round(amountPaid, 2),
                        "wayFile": self._file
                    }

                    return valuesOfLine.copy()
Exemplo n.º 29
0
    def process(self):
        valuesOfLine = {}

        isDarf = False

        nameProvider = ""
        historic = ""
        amountPaid = float(0)
        account = ""
        amountOriginal = float(0)
        amountDiscount = float(0)
        amountInterest = float(0)
        amountFine = float(0)
        paymentDate = None
        
        for data in self._dataFile:
            if isDarf == False and data.find('PAGAMENTO DE GPS') >= 0:
                isDarf = True

            data = str(data)
            dataSplit = data.split(':')

            fieldOne = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 1))
            fieldTwo = funcoesUteis.treatTextField(funcoesUteis.analyzeIfFieldIsValidMatrix(dataSplit, 2))

            if fieldOne.count('CONTA DEBITADA') > 0:
                self._accountDebitOrCredit = 'DEBIT'
            elif fieldOne.count('AGENTE ARRECADADOR') > 0:
                self._accountDebitOrCredit = 'CREDIT'

            if self._accountDebitOrCredit == 'DEBIT':
                if fieldOne.count('AGENCIA') > 0 and fieldOne.count('CONTA') > 0:
                    account = fieldTwo.split('/')
                    account = funcoesUteis.analyzeIfFieldIsValidMatrix(account, 2)
                    account = str(funcoesUteis.treatNumberField(account, isInt=True))
            elif self._accountDebitOrCredit == 'CREDIT':
                if fieldOne == "DATA DO PAGAMENTO":
                    paymentDate = funcoesUteis.retornaCampoComoData(fieldTwo)
                if fieldOne.count("MON/JUR/MUL") > 0:
                    amountInterest = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "VALOR TOTAL":
                    amountPaid = funcoesUteis.treatDecimalField(fieldTwo)
                if fieldOne == "CODIGO DE PAGAMENTO":
                    nameProvider = f"GPS - {fieldTwo}"
                if fieldOne.count('IDENTIFICADOR') > 0:
                    cgceProvider = fieldTwo

            if fieldOne == "AGENCIA" or ( fieldOne.count('AGENCIA') > 0 and fieldOne.count('CONTA') > 0 ):
                if paymentDate is not None and amountPaid > 0 and isDarf is True:
                    valuesOfLine = {
                        "paymentDate": paymentDate,
                        "nameProvider": nameProvider,
                        "cgceProvider": cgceProvider,
                        "dueDate": None,
                        "bank": 'ITAU',
                        "account": account,
                        "amountPaid": round(amountPaid, 2),
                        "amountInterest": round(amountInterest, 2),
                        "amountDiscount": round(amountDiscount, 2),
                        "amountFine": round(amountFine, 2),
                        "amountOriginal": round(amountOriginal, 2),
                        "historic": historic,
                        "category": 'DARF',
                        "cgcePaying": "",
                        "foundProof": True,
                        "amountPaidPerLote": round(amountPaid, 2),
                        "wayFile": self._file
                    }

                    return valuesOfLine.copy()