def entry6100(self, data): idRecord = '6100' user = "" branch = "" scp = "" historicCode = 0 accountCodeDebit = 0 accountCodeCredit = 0 dateLivro = funcoesUteis.transformaCampoDataParaFormatoBrasileiro(funcoesUteis.analyzeIfFieldIsValid(data, "dateLivro")) movementType = funcoesUteis.analyzeIfFieldIsValid(data, "movementType") accountCode = funcoesUteis.analyzeIfFieldIsValid(data, "accountCode") historic = funcoesUteis.analyzeIfFieldIsValid(data, "historic") amount = funcoesUteis.analyzeIfFieldIsValid(data, "amount") amount = str(amount).replace('.', ',') if movementType == "RECEITAS": accountCodeDebit = 5 accountCodeCredit = accountCode elif movementType == "DESPESAS": accountCodeDebit = accountCode accountCodeCredit = 5 return f"{idRecord}|{dateLivro}|{accountCodeDebit}|{accountCodeCredit}|{amount}|{historicCode}|{historic}|{user}|{branch}|{scp}|\n"
def returnDataExtract(self, historic=None, operation=None): if historic == "": historic = None if operation == "": operation = None for extractComparation in self._valuesOfFileExtracts: fieldComparation = funcoesUteis.analyzeIfFieldIsValid( extractComparation, "fieldComparation") operationComparation = funcoesUteis.analyzeIfFieldIsValid( extractComparation, "operationComparation") typeComparation = funcoesUteis.analyzeIfFieldIsValid( extractComparation, "typeComparation") valueComparation = funcoesUteis.analyzeIfFieldIsValid( extractComparation, "valueComparation") accountDominio = funcoesUteis.analyzeIfFieldIsValid( extractComparation, "accountDominio") if fieldComparation == 1: # comparação pelo fornecedor if typeComparation == 1: # comparação caso o valor seja idêntico if historic is not None and historic == valueComparation and operationComparation == operation: return accountDominio else: if historic is not None and historic.count( valueComparation ) > 0 and operationComparation == operation: # comparação caso contenha o texto return accountDominio
def sumAmountPaidPerLote(self, valuesOfFile): amountPaidPerLote = {} valuesOfFileWithAmountPaid = [] for key, currentLine in enumerate(valuesOfFile): previousLine = funcoesUteis.analyzeIfFieldIsValidMatrix( valuesOfFile, key - 1, {}, True) previousLine = {} if key == 0 else previousLine previousNumberLote = funcoesUteis.analyzeIfFieldIsValid( previousLine, "numberLote", 0) currentNumberLote = funcoesUteis.analyzeIfFieldIsValid( currentLine, "numberLote") amountPaid = funcoesUteis.analyzeIfFieldIsValid( currentLine, "amountPaid") if previousNumberLote == currentNumberLote: amountPaidPerLote[currentNumberLote] += amountPaid else: amountPaidPerLote[currentNumberLote] = amountPaid for key, data in enumerate(valuesOfFile): numberLote = funcoesUteis.analyzeIfFieldIsValid(data, "numberLote") data['amountPaidPerLote'] = round(amountPaidPerLote[numberLote], 2) valuesOfFileWithAmountPaid.append(data) return valuesOfFileWithAmountPaid
def entry6140(self, data, key): idRecord = '6140' natureLaunch = '' movementType = funcoesUteis.analyzeIfFieldIsValid(data, "movementType") document = funcoesUteis.analyzeIfFieldIsValid(data, "document") documentType = funcoesUteis.analyzeIfFieldIsValid(data, "documentType") participante = funcoesUteis.analyzeIfFieldIsValid(data, "participante", 1) imovelRural = funcoesUteis.analyzeIfFieldIsValid(data, "imovelRural", 1) if movementType == "RECEITAS": movementType = 1 natureLaunch = 'D' elif movementType == "DESPESAS": movementType = 2 natureLaunch = 'C' if documentType == "NOTA FISCAL": documentType = 1 elif documentType == "FATURA": documentType = 2 elif documentType == "RECIBO": documentType = 3 elif documentType == "CONTRATO": documentType = 4 elif documentType == "FOLHA DE PAGAMENTO": documentType = 5 elif documentType == "OUTROS": documentType = 6 if movementType > 0 and documentType > 0: return f"{idRecord}|{movementType}|{document}|{documentType}|{participante}|{imovelRural}|{natureLaunch}|\n" else: print(f' \t- ERRO: Na linha {key+2} o "Tipo do Movimento" está errado ou então o "Tipo do Documento".')
def process(self, xml): callReadXmls = CallReadXmls(xml) nf = callReadXmls.process() if nf is not None: cnpjIssuer = funcoesUteis.analyzeIfFieldIsValid(nf, 'cnpjIssuer') cnpjReceiver = funcoesUteis.analyzeIfFieldIsValid( nf, 'cnpjReceiver') issueDate = funcoesUteis.retornaCampoComoData( funcoesUteis.analyzeIfFieldIsValid(nf, 'issueDateNF'), 2) keyNF = funcoesUteis.analyzeIfFieldIsValid(nf, 'keyNF') if issueDate < self._filterDate: return "" codiEmpIssuer = self.returnDataEmp(cnpjIssuer) codiEmpReceiver = self.returnDataEmp(cnpjReceiver) try: self.copyXmlToFolderCompanieAndCompetence( self._wayToSave, codiEmpIssuer, issueDate, xml, 'Saidas', keyNF) except Exception: pass try: self.copyXmlToFolderCompanieAndCompetence( self._wayToSave, codiEmpReceiver, issueDate, xml, 'Entradas', keyNF) except Exception: pass
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))
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'))
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." )
def filterPayments(self): for payment in self._payments: paymentDate = funcoesUteis.analyzeIfFieldIsValid( payment, "paymentDate", None) extractDate = funcoesUteis.analyzeIfFieldIsValid( payment, "dateExtract", None) if extractDate is None or extractDate == "": extractDate = paymentDate if (self._inicialDate <= paymentDate and paymentDate <= self._finalDate) or (self._inicialDate <= extractDate and extractDate <= self._finalDate): self._paymentsWithFilter.append(payment) return self._paymentsWithFilter
def isPaymentOrExtract(self, data): dateTransaction = funcoesUteis.analyzeIfFieldIsValid( data, "dateTransaction", None) if dateTransaction is None: return "P" # payment pq não existe o dateTransaction else: return "E"
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
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'))
def filterExtracts(self): for extract in self._extracts: extractDate = funcoesUteis.analyzeIfFieldIsValid( extract, "dateTransaction", None) if self._inicialDate <= extractDate and extractDate <= self._finalDate: self._extractsWithFilter.append(extract) return self._extractsWithFilter
def process(self, xml): callReadXmls = CallReadXmls(xml) nf = callReadXmls.process() if nf is None: return "" cnpjIssuer = funcoesUteis.analyzeIfFieldIsValid(nf, 'cnpjIssuer') cnpjReceiver = funcoesUteis.analyzeIfFieldIsValid(nf, 'cnpjReceiver') issueDate = funcoesUteis.retornaCampoComoData( funcoesUteis.analyzeIfFieldIsValid(nf, 'issueDateNF'), 2) keyNF = funcoesUteis.analyzeIfFieldIsValid(nf, 'keyNF') monthIssueDateNF = issueDate.month yearIssueDateNF = issueDate.year codiEmpIssuer = self.returnDataEmp(cnpjIssuer) codiEmpReceiver = self.returnDataEmp(cnpjReceiver) outputNoteDominio = None entryNoteDominio = None if codiEmpIssuer is not None: outputNoteDominio = self.returnDataOutputNoteDominio( codiEmpIssuer, monthIssueDateNF, yearIssueDateNF, keyNF) if codiEmpReceiver is not None: entryNoteDominio = self.returnDataEntryNoteDominio( codiEmpReceiver, monthIssueDateNF, yearIssueDateNF, keyNF) dataProcessNF = { "codiEmpIssuer": codiEmpIssuer, "codiEmpReceiver": codiEmpReceiver, "keyNF": keyNF, "nfXml": nf, "nfEntryNoteDominio": entryNoteDominio, "nfOutputNoteDominio": outputNoteDominio, "wayXml": xml.replace('\\', '/') } self.saveResultProcessEntryNote(dataProcessNF) self.saveResultProcessOutputNote(dataProcessNF)
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." )
def sheetLivroCaixa(self, livrosCaixas): sheet = self._workbook.add_worksheet('Lancamentos') sheet.freeze_panes(1, 0) sheet.write(0, 0, "Data", self._cell_format_header) sheet.write(0, 1, "Tipo Movimento", self._cell_format_header) sheet.write(0, 2, "Conta Contábil", self._cell_format_header) sheet.write(0, 3, "Nome Conta", self._cell_format_header) sheet.write(0, 4, "Valor", self._cell_format_header) sheet.write(0, 5, "Documento", self._cell_format_header) sheet.write(0, 6, "Tipo Documento", self._cell_format_header) sheet.write(0, 7, "Participante", self._cell_format_header) sheet.write(0, 8, "Imóvel Rural", self._cell_format_header) sheet.write(0, 9, "Histórico", self._cell_format_header) for key, livroCaixa in enumerate(livrosCaixas): row = key+1 dateLivro = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "dateLivro") movementType = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "movementType") account = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "account") nameAccount = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "nameAccount") amount = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "amount") document = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "document") documentType = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "documentType") participante = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "participante", 1) imovelRural = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "imovelRural", 1) historic = funcoesUteis.analyzeIfFieldIsValid(livroCaixa, "historic") sheet.write(row, 0, dateLivro, self._cell_format_date) sheet.write(row, 1, movementType) sheet.write(row, 2, account) sheet.write(row, 3, nameAccount) sheet.write(row, 4, amount, self._cell_format_money) sheet.write(row, 5, document) sheet.data_validation(f'G{row+1}', {'validate': 'list', 'source': ['Nota Fiscal', 'Fatura', 'Recibo', 'Contrato', 'Folha de Pagamento', 'Outros']}) sheet.write(row, 7, participante) sheet.write(row, 8, imovelRural) sheet.write(row, 9, historic)
def compareProofWithPayments(self): """ Une os comprovantes de pagamentos com o financeiro do cliente, adicionando os campos que não tem no comprovante de pagamento """ # o range de 1 a 3 é pq primeiro vou rodar o typeComparation com mais confiabilidade (igual a 1), depois rodo com média e fraca por último for numberSequencial in range(1, 4): for key, proof in enumerate(self._proofOfPayments): # se for um pagamento que já tiver lido e encontrado o financeiro dele então ignora a leitura if funcoesUteis.analyzeIfFieldIsValid( proof, 'alreadyFoundTheFinancial', False) is True: continue paymentDate = funcoesUteis.analyzeIfFieldIsValid( proof, 'paymentDate') amountPaid = round( funcoesUteis.analyzeIfFieldIsValid(proof, 'amountPaid', 0.0), 2) bank = funcoesUteis.analyzeIfFieldIsValid(proof, 'bank') account = funcoesUteis.analyzeIfFieldIsValid(proof, 'account') payment = self.returnDataPayment( paymentDate, amountPaid, bank, account, typeComparation=numberSequencial) if payment is not None: for nameField, valueField in payment.items(): valueFieldProof = funcoesUteis.analyzeIfFieldIsValid( proof, nameField, None) if ( valueFieldProof is None or valueFieldProof == '' or valueFieldProof == 0 ) \ and valueField is not None and valueField != '' and valueField != 0: proof[nameField] = valueField # somente o histórico que eu substituo do que está no comprovante de pagamento, mesmo que ele já exista. Pois o histórico do # financeiro sempre é melhor do que o está no comprovante historicPayment = funcoesUteis.analyzeIfFieldIsValid( payment, 'historic') if historicPayment != "": proof['historic'] = historicPayment if payment is not None: self._paymentsWithProofAndFinancy.append( proof) # adiciona o comprovante de pagamento proof['alreadyFoundTheFinancial'] = True else: proof['alreadyFoundTheFinancial'] = False self._proofOfPayments[key] = proof # esta junção de map e filter adiciona no array _paymentsWithProofAndFinancy somente os comprovantes de pagamentos que não encontrou o financeiro dele list(map(lambda proofPayment: self._paymentsWithProofAndFinancy.append(proofPayment), \ filter(lambda proofPayment: proofPayment['alreadyFoundTheFinancial'] is False, self._proofOfPayments)))
def getSettingsLayout(self, layouts): settingsLayouts = [] try: collectionLayouts = self._dbMongo.IntegrattionLayouts for layout in layouts: idLayout = funcoesUteis.analyzeIfFieldIsValid(layout, 'idLayout', None) settings = collectionLayouts.find_one( { "_id": ObjectId(idLayout) } ) bankAndAccountCorrelation = funcoesUteis.analyzeIfFieldIsValid(layout, 'bankAndAccountCorrelation', None) validateIfDataIsThisCompanie = funcoesUteis.analyzeIfFieldIsValid(layout, 'validateIfDataIsThisCompanie', None) if settings is not None: settings['bankAndAccountCorrelation'] = bankAndAccountCorrelation settings['validateIfDataIsThisCompanie'] = validateIfDataIsThisCompanie settingsLayouts.append(settings) except Exception: pass return settingsLayouts
def process(self, pathXml): callReadXmls = CallReadXmls(pathXml) nfs = callReadXmls.process() saveXML = SaveXML(self._wayToSave) if nfs is not None: for nf in nfs: # se tiver apenas uma nota retira o dado do xml pra poder em ver de fazer um write num xml fazer apenas um copy if len(nfs) == 1: nf['xml'] = '' cgceIssuer = funcoesUteis.analyzeIfFieldIsValid( nf, 'cgceIssuer') cgceReceiver = funcoesUteis.analyzeIfFieldIsValid( nf, 'cgceReceiver') issueDate = funcoesUteis.analyzeIfFieldIsValid( nf, 'issueDateNF', None) if issueDate < self._filterDate: continue companieIssuer = self.returnDataEmp(cgceIssuer) companieReceiver = self.returnDataEmp(cgceReceiver) if companieIssuer is not None: nf['companie'] = companieIssuer nf['typeNF'] = 'Saidas' saveXML.save(nf, pathXml) if companieReceiver is not None: nf['companie'] = companieReceiver nf['typeNF'] = 'Entradas' saveXML.save(nf, pathXml)
def removeAlreadyProcessed(self): for root, dirs, files in os.walk(self._wayTemp): for file in files: if file.lower().endswith(('.pdf')): wayFile = os.path.join(root, file) wayFileName = wayFile.replace('/', '\\') if funcoesUteis.analyzeIfFieldIsValid( self._filesRead, wayFileName) != "": os.remove(wayFile) os.remove(wayFile.replace('.pdf', '.txt')) # if __name__ == "__main__": # returnFilesDontFindForm = ReturnFilesDontFindForm(890, 'C:/Programming/baymax/backend/accounting_integration/data/temp/890') # returnFilesDontFindForm.processAll()
def returnDataBanks(self, nameBank="", account=None, compareWith=None): if nameBank is None: nameBank = "" if compareWith == "": compareWith = None for bank in self._valuesOfFileBanks: compareWithComparation = funcoesUteis.analyzeIfFieldIsValid( bank, "compareWith") bankComparation = funcoesUteis.analyzeIfFieldIsValid( bank, "nameBankComparation").replace('-', ' ') accountComparation = funcoesUteis.analyzeIfFieldIsValid( bank, "accountComparation") accountDominio = funcoesUteis.analyzeIfFieldIsValid( bank, "accountDominio") if (compareWithComparation == compareWith or compareWithComparation == "" or compareWithComparation == "FINANCEIRO OU EXTRATO" ) and nameBank.find(bankComparation) >= 0 and ( account.count(accountComparation) > 0 or account == accountComparation): return accountDominio
def processAll(self): for root, dirs, files in os.walk(self._wayTemp): for file in files: if file.lower().endswith(('.pdf')): wayFile = os.path.join(root, file) wayFileName = wayFile.replace('/', '\\') if funcoesUteis.analyzeIfFieldIsValid( self._filesRead, wayFileName) == "": nameFileOriginal = root.split('\\')[-1] wayToSave = os.path.join(self._wayBaseToSaveFiles, nameFileOriginal) if os.path.exists(wayToSave) is False: os.makedirs(wayToSave) shutil.copy(wayFile, os.path.join(wayToSave, file))
def process(self, file): dataFile = leTxt(file) self.processAccountPlan(dataFile) valuesOfLine = {} valuesOfFile = [] for key, data in enumerate(dataFile): try: recordType = data[0:2] dateLivro = funcoesUteis.retornaCampoComoData(data[3:11], 4) account = data[11:19] nameAccount = funcoesUteis.analyzeIfFieldIsValid(self._accountPlan, account)[0] historic = funcoesUteis.treatTextField(data[19:274]) amount = funcoesUteis.treatDecimalField(f'{data[274:285]},{data[285:287]}') note = self.searchIfANote(historic) if note != "": documentType = 1 else: documentType = 2 if account[0] == "1": movementType = 'Receitas' else: movementType = 'Despesas' if recordType == "03": valuesOfLine = { 'dateLivro': dateLivro, 'movementType':movementType, 'account': account, 'nameAccount': nameAccount, 'amount': amount, 'document': note, 'documentType': documentType, 'historic': historic } valuesOfFile.append(valuesOfLine.copy()) except Exception as e: pass return valuesOfFile
def saveMongo(self, codiEmp, cgceMatriz, companieMonthsAmountNotes): dateStart = retornaCampoComoData('01/01/2021') dateNow = datetime.today() - relativedelta(months=1) year = dateStart.year startYear = dateStart.year startMonth = dateStart.month endYear = dateNow.year endMonth = dateNow.month while year <= endYear: months = extractFunctions.returnMonthsOfYear(year, startMonth, startYear, endMonth, endYear) print('\t\t - ', end='') for month in months: companieDataToSave = {} monthYearFormated = f'{month:0>2}/{year}' print(f'{monthYearFormated}, ', end='') amountNotaSaida = list(filter(lambda companieMonths: companieMonths['comp'][:10] == f"{year}-{month:0>2}-01" \ and companieMonths['tipo'] == 'SAIDA', companieMonthsAmountNotes)) amountNotaSaida = analyzeIfFieldIsValidMatrix(amountNotaSaida, 1, []) amountNotaEntrada = list(filter(lambda companieMonths: companieMonths['comp'][:10] == f"{year}-{month:0>2}-01" \ and companieMonths['tipo'] == 'ENTRADA', companieMonthsAmountNotes)) amountNotaEntrada = analyzeIfFieldIsValidMatrix(amountNotaEntrada, 1, []) amountNotaServico = list(filter(lambda companieMonths: companieMonths['comp'][:10] == f"{year}-{month:0>2}-01" \ and companieMonths['tipo'] == 'SERVICO', companieMonthsAmountNotes)) amountNotaServico = analyzeIfFieldIsValidMatrix(amountNotaServico, 1, []) companieDataToSave['qtd_notas_saidas_operacao'] = analyzeIfFieldIsValid(amountNotaSaida, 'qtd_notas_operacao', 0) companieDataToSave['qtd_notas_saidas_operacao_dori'] = analyzeIfFieldIsValid(amountNotaSaida, 'qtd_notas_operacao_dori', 0) companieDataToSave['qtd_notas_entradas_operacao'] = analyzeIfFieldIsValid(amountNotaEntrada, 'qtd_notas_operacao', 0) companieDataToSave['qtd_notas_entradas_operacao_dori'] = analyzeIfFieldIsValid(amountNotaEntrada, 'qtd_notas_operacao_dori', 0) companieDataToSave['qtd_notas_servicos_operacao'] = analyzeIfFieldIsValid(amountNotaServico, 'qtd_notas_operacao', 0) companieDataToSave['qtd_notas_servicos_operacao_dori'] = analyzeIfFieldIsValid(amountNotaServico, 'qtd_notas_operacao_dori', 0) companieDataToSave['codi_emp'] = codiEmp companieDataToSave['cgce_matriz'] = cgceMatriz companieDataToSave['competence'] = f'{year}-{month:0>2}' self._collection.update_one( { "codi_emp": companieDataToSave['codi_emp'], "competence": companieDataToSave['competence'] }, { "$set": companieDataToSave }, upsert=True ) print('') year += 1
def makeSaveData(self, data): obj = { "codi_emp": funcoesUteis.analyzeIfFieldIsValid(data, 'codi_emp'), "statusAccountPaid": funcoesUteis.analyzeIfFieldIsValid(data, 'statusAccountPaid'), "responsibleFinancialClient": funcoesUteis.analyzeIfFieldIsValid(data, 'responsibleFinancialClient'), "layoutsAccountPaid": funcoesUteis.analyzeIfFieldIsValid(data, 'layoutsAccountPaid'), "dateAccountPaid": funcoesUteis.analyzeIfFieldIsValid(data, 'dateAccountPaid'), "analystReceivedTraining": funcoesUteis.analyzeIfFieldIsValid(data, 'analystReceivedTraining'), "emailAccountPaid": funcoesUteis.analyzeIfFieldIsValid(data, 'emailAccountPaid'), "telefoneAccountPaid": funcoesUteis.analyzeIfFieldIsValid(data, 'telefoneAccountPaid'), "obsAccountPaid": funcoesUteis.analyzeIfFieldIsValid(data, 'obsAccountPaid') } return obj
def sheetFolhaPagto(self): sheet = self._workbook.add_worksheet('Lancamentos') sheet.freeze_panes(1, 0) sheet.write(0, 0, "Data", self._cell_format_header) sheet.write(0, 1, "Empresa", self._cell_format_header) sheet.write(0, 2, "Cod. Rubrica", self._cell_format_header) sheet.write(0, 3, "Nome Rubrica", self._cell_format_header) sheet.write(0, 4, "Valor", self._cell_format_header) sheet.write(0, 5, "Provento / Desconto", self._cell_format_header) sheet.write(0, 6, "Tipo Colaborador", self._cell_format_header) sheet.write(0, 7, "Cod. Debito", self._cell_format_header) sheet.write(0, 8, "Cod. Credito", self._cell_format_header) for key, lancamento in enumerate(self._lancamentos): row = key + 1 dateLanc = funcoesUteis.analyzeIfFieldIsValid( lancamento, "dateLanc") nameCompany = funcoesUteis.analyzeIfFieldIsValid( lancamento, "nameCompany") codeRubrica = funcoesUteis.analyzeIfFieldIsValid( lancamento, "codeRubrica") nameRubrica = funcoesUteis.analyzeIfFieldIsValid( lancamento, "nameRubrica") amountRubrica = funcoesUteis.analyzeIfFieldIsValid( lancamento, "amountRubrica") typeColaborador = funcoesUteis.analyzeIfFieldIsValid( lancamento, "typeColaborador") typeEvent = funcoesUteis.analyzeIfFieldIsValid( lancamento, "typeEvent") sheet.write(row, 0, dateLanc, self._cell_format_date) sheet.write(row, 1, nameCompany) sheet.write(row, 2, codeRubrica) sheet.write(row, 3, nameRubrica) sheet.write(row, 4, amountRubrica, self._cell_format_money) sheet.write(row, 5, typeEvent) sheet.write(row, 6, typeColaborador)
def sheetProducts(self): sheet = self._workbook.add_worksheet('Products') sheet.freeze_panes(1, 0) sheet.set_column(10, 12, options={ 'hidden': True }) # qtd, valor unitário e valor total domínio sheet.set_column(15, 17, options={'hidden': True }) # qtd, valor unitário e valor total xml sheet.write(0, 0, "Código Empresa", self._cell_format_header) sheet.write(0, 1, "Código Nota", self._cell_format_header) sheet.write(0, 2, "Número", self._cell_format_header) sheet.write(0, 3, "Tipo Nota", self._cell_format_header) sheet.write(0, 4, "Cliente/Fornecedor", self._cell_format_header) sheet.write(0, 5, "Emissão", self._cell_format_header) sheet.write(0, 6, "Entrada/Saída", self._cell_format_header) sheet.write(0, 7, "Código Produto Domínio", self._cell_format_header) sheet.write(0, 8, "Descrição", self._cell_format_header) sheet.write(0, 9, "CFOP", self._cell_format_header) sheet.write(0, 10, "Quantidade", self._cell_format_header) sheet.write(0, 11, "Valor Unitário", self._cell_format_header) sheet.write(0, 12, "Valor Total", self._cell_format_header) sheet.write(0, 13, "Código Produto XML", self._cell_format_header) sheet.write(0, 14, "Descrição", self._cell_format_header) sheet.write(0, 15, "Quantidade", self._cell_format_header) sheet.write(0, 16, "Valor Unitário", self._cell_format_header) sheet.write(0, 17, "Valor Total", self._cell_format_header) sheet.write(0, 18, "Comparação", self._cell_format_header) sheet.write(0, 19, "Chave Nota", self._cell_format_header) productsAccountSystemXXML = self._collection.find() for key, productAccountSystemXXML in enumerate( productsAccountSystemXXML): row = key + 1 print(f' - Processando {row}') codiEmp = funcoesUteis.analyzeIfFieldIsValid( productAccountSystemXXML, "codiEmp") codiNote = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "codigo_nota"]) numberNote = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "numero"]) typeNF = funcoesUteis.analyzeIfFieldIsValid( productAccountSystemXXML, "typeNF") cliFor = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "cli_for"]) issueDate = funcoesUteis.retornaCampoComoData( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "emissao"]), 2) saidaEntradaDate = funcoesUteis.retornaCampoComoData( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "saida_entrada"]), 2) codeProductAccountSystem = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "codi_pdi"]).strip() nameProductAccountSystem = funcoesUteis.treatTextField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "desc_pdi"])) cfopProductAccountSystem = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "cfop"]) qtdProductAccountSystem = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict(productAccountSystemXXML, ["productDominio", "qtd"])) vunitProductAccountSystem = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "vunit"])) vtotProductAccountSystem = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict(productAccountSystemXXML, ["productDominio", "vtot"])) codeProductXML = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productXML", "prod", "cProd"]).strip() nameProductXML = funcoesUteis.treatTextField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productXML", "prod", "xProd"])) qtdProductXML = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productXML", "prod", "qCom"])) vunitProductXML = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productXML", "prod", "vUnCom"])) vtotProductXML = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productXML", "prod", "vProd"])) valueComparationBetweenAccountSystemAndXML = funcoesUteis.treatDecimalField( funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["valueComparationBetweenAccountSystemAndXML"])) keyNF = funcoesUteis.returnDataFieldInDict( productAccountSystemXXML, ["productDominio", "chave_nfe"]) sheet.write(row, 0, codiEmp) sheet.write(row, 1, codiNote) sheet.write(row, 2, numberNote) sheet.write(row, 3, typeNF) sheet.write(row, 4, cliFor) sheet.write(row, 5, issueDate, self._cell_format_date) sheet.write(row, 6, saidaEntradaDate, self._cell_format_date) sheet.write(row, 7, codeProductAccountSystem) sheet.write(row, 8, nameProductAccountSystem) sheet.write(row, 9, cfopProductAccountSystem) sheet.write(row, 10, qtdProductAccountSystem, self._cell_format_money) sheet.write(row, 11, vunitProductAccountSystem, self._cell_format_money) sheet.write(row, 12, vtotProductAccountSystem, self._cell_format_money) sheet.write(row, 13, codeProductXML) sheet.write(row, 14, nameProductXML) sheet.write(row, 15, qtdProductXML, self._cell_format_money) sheet.write(row, 16, vunitProductXML, self._cell_format_money) sheet.write(row, 17, vtotProductXML, self._cell_format_money) sheet.write(row, 18, valueComparationBetweenAccountSystemAndXML, self._cell_format_money) sheet.write(row, 19, keyNF)
def sheetExtract(self, extracts): sheet = self._workbook.add_worksheet('ExtratosBancarios') sheet.freeze_panes(1, 0) sheet.set_column(9, 10, options={'hidden': True}) sheet.set_column(11, 11, options={'hidden': True}) sheet.set_column(12, 12, options={'hidden': True}) sheet.set_column(14, 16, options={'hidden': True}) sheet.set_column(17, 17, options={'hidden': True}) sheet.write(0, 0, "Data", self._cell_format_header) sheet.write(0, 1, "Debito", self._cell_format_header) sheet.write(0, 2, "Credito", self._cell_format_header) sheet.write(0, 3, "Valor", self._cell_format_header) sheet.write(0, 4, "Cod. Hist", self._cell_format_header) sheet.write(0, 5, "Historico", self._cell_format_header) sheet.write(0, 6, "Encontrou no Financeiro?", self._cell_format_header) sheet.write(0, 7, "-------", self._cell_format_header) sheet.write(0, 8, "-------", self._cell_format_header) sheet.write(0, 9, "Banco", self._cell_format_header) sheet.write(0, 10, "Conta Corrente", self._cell_format_header) sheet.write(0, 11, "Data Extrato", self._cell_format_header) sheet.write(0, 12, "Tipo Transacao", self._cell_format_header) sheet.write(0, 13, "Operacao", self._cell_format_header) sheet.write(0, 14, "Valor Extrato", self._cell_format_header) sheet.write(0, 15, "Documento", self._cell_format_header) sheet.write(0, 16, "Historico Extrato", self._cell_format_header) sheet.write(0, 17, "Valor 2", self._cell_format_header) sheet.write(0, 18, "Banco/Conta", self._cell_format_header) sheet.write(0, 19, "Total Extrato Banco, Dia e Operação", self._cell_format_header_green) sheet.write(0, 20, "Total Financeiro + Extrato", self._cell_format_header_orange) sheet.write(0, 21, "Diferença", self._cell_format_header_red) sheet.write_comment( 0, 20, "Esta coluna é o total da aba 'Pagamentos' por banco e dia + o valor do extrato onde a coluna débito e crédito são válidas (diferente de vazio ou zero)." ) sheet.write_comment( 0, 21, "Esta coluna é o total do extrato por banco e dia menos o total do financeiro do cliente. Esta coluna sempre deve estar com o valor igual à zero." ) extracts = sorted(extracts, key=itemgetter('bank', 'account', 'dateTransaction', 'operation')) for key, extract in enumerate(extracts): row = key + 1 row2 = key + 2 dateExtract = funcoesUteis.analyzeIfFieldIsValid( extract, "dateTransaction") bank = funcoesUteis.analyzeIfFieldIsValid(extract, "bank") account = funcoesUteis.analyzeIfFieldIsValid(extract, "account") typeTransaction = funcoesUteis.analyzeIfFieldIsValid( extract, "typeTransaction") operation = funcoesUteis.analyzeIfFieldIsValid( extract, "operation") document = funcoesUteis.analyzeIfFieldIsValid(extract, "document") historicCode = funcoesUteis.analyzeIfFieldIsValid( extract, "historicCode") historic = funcoesUteis.analyzeIfFieldIsValid(extract, "historic") amount = funcoesUteis.analyzeIfFieldIsValid(extract, "amount") accountCodeDebit = funcoesUteis.analyzeIfFieldIsValid( extract, "accountCodeDebit") accountCodeCredit = funcoesUteis.analyzeIfFieldIsValid( extract, "accountCodeCredit") foundProofInPayments = funcoesUteis.analyzeIfFieldIsValid( extract, "foundProofInPayments") sheet.write(row, 0, dateExtract, self._cell_format_date) sheet.write(row, 1, accountCodeDebit) sheet.write(row, 2, accountCodeCredit) sheet.write(row, 3, amount, self._cell_format_money) sheet.write(row, 4, historicCode) sheet.write(row, 5, historic) sheet.write(row, 6, foundProofInPayments) sheet.write(row, 7, "") sheet.write(row, 8, "") sheet.write(row, 9, bank) sheet.write(row, 10, account) sheet.write(row, 11, dateExtract, self._cell_format_date) sheet.write(row, 12, typeTransaction) sheet.write(row, 13, operation) sheet.write(row, 14, amount, self._cell_format_money) sheet.write(row, 15, document) sheet.write(row, 16, historic) sheet.write_formula( row, 17, f'=IF(AND(B{row2}<>"",B{row2}<>"0",B{row2}<>0,C{row2}<>"",C{row2}<>"0",C{row2}<>0),D{row2},0)', self._cell_format_money) sheet.write_formula(row, 18, f'=CONCATENATE(J{row2},"-",K{row2})') sheet.write_formula( row, 19, f'=SUMIFS(D:D,A:A,A{row2},S:S,S{row2},N:N,N{row2})', self._cell_format_money) sheet.write_formula( row, 20, f'=IF(N{row2}="-",SUMIFS(Pagamentos!O:O,Pagamentos!L:L,A{row2},Pagamentos!G:G,S{row2}),0)+SUMIFS(R:R,A:A,A{row2},S:S,S{row2},N:N,N{row2})', self._cell_format_money) sheet.write_formula(row, 21, f'=T{row2}-U{row2}', self._cell_format_money)
def sheetPayments(self, payments): sheet = self._workbook.add_worksheet('Pagamentos') sheet.freeze_panes(1, 0) sheet.set_column(3, 3, options={'hidden': True}) # parcela sheet.set_column(5, 5, options={'hidden': True}) # cnpj fornecedor sheet.set_column(8, 8, options={'hidden': True}) # comprovante pagto sheet.set_column(10, 10, options={'hidden': True}) # data extrato sheet.set_column(12, 12, options={'hidden': True}) # data vencimento sheet.set_column(13, 13, options={'hidden': True}) # data emissão sheet.write(0, 0, "Lote", self._cell_format_header) sheet.write(0, 1, "Documento", self._cell_format_header) sheet.write(0, 2, "NF na Domínio?", self._cell_format_header) sheet.write(0, 3, "Parcela", self._cell_format_header) # hidden sheet.write(0, 4, "Fornecedor", self._cell_format_header) sheet.write(0, 5, "CNPJ Fornecedor", self._cell_format_header) # hidden sheet.write(0, 6, "Banco Financeiro", self._cell_format_header) sheet.write(0, 7, "Banco Extrato", self._cell_format_header) sheet.write(0, 8, "Comprovante Pagto?", self._cell_format_header) sheet.write(0, 9, "Data Financeiro", self._cell_format_header) sheet.write(0, 10, "Data Extrato", self._cell_format_header) sheet.write(0, 11, "Importação Domínio", self._cell_format_header) sheet.write(0, 12, "Vencimento", self._cell_format_header) sheet.write(0, 13, "Emissão", self._cell_format_header) sheet.write(0, 14, "Valor Pago", self._cell_format_header) sheet.write(0, 15, "Desconto", self._cell_format_header) sheet.write(0, 16, "Juros", self._cell_format_header) sheet.write(0, 17, "Multa", self._cell_format_header) sheet.write(0, 18, "Valor Original", self._cell_format_header) sheet.write(0, 19, "Conta Contabil Domínio", self._cell_format_header) sheet.write(0, 20, "Codigo Empresa", self._cell_format_header) sheet.write(0, 21, "Historico Financeiro", self._cell_format_header) sheet.write(0, 22, "Categoria", self._cell_format_header) sheet.write(0, 23, "Plano de Contas", self._cell_format_header) sheet.write(0, 24, "CNPJ Pagador", self._cell_format_header) sheet.write(0, 25, "Historico Extrato Bancário", self._cell_format_header) sheet.write(0, 26, "Conta Contabil Sistema Cliente", self._cell_format_header) sheet.write(0, 27, "Total no Extrato por Banco e Dia", self._cell_format_header_orange) # ordena os payments por data payments = sorted(payments, key=itemgetter('bank', 'account', 'dateOfImport')) for key, payment in enumerate(payments): row = key + 1 row2 = key + 2 numberLote = funcoesUteis.analyzeIfFieldIsValid( payment, "numberLote", 0) numberLote = row if numberLote == 0 else numberLote document = funcoesUteis.analyzeIfFieldIsValid(payment, "document") findNote = funcoesUteis.analyzeIfFieldIsValid(payment, "findNote") parcelNumber = funcoesUteis.analyzeIfFieldIsValid( payment, "parcelNumber") nameProvider = funcoesUteis.analyzeIfFieldIsValid( payment, "nameProvider") cgceProvider = funcoesUteis.analyzeIfFieldIsValid( payment, "cgceProvider") bankAndAccount = f'{funcoesUteis.analyzeIfFieldIsValid(payment, "bank")}-{funcoesUteis.analyzeIfFieldIsValid(payment, "account")}' bankAndAccountExtract = f'{funcoesUteis.analyzeIfFieldIsValid(payment, "bankExtract")}-{funcoesUteis.analyzeIfFieldIsValid(payment, "accountExtract")}' foundProof = funcoesUteis.analyzeIfFieldIsValid( payment, "foundProof") paymentDate = funcoesUteis.analyzeIfFieldIsValid( payment, "paymentDate", None) extractDate = funcoesUteis.analyzeIfFieldIsValid( payment, "dateExtract", None) dateOfImport = funcoesUteis.analyzeIfFieldIsValid( payment, "dateOfImport", None) dueDate = funcoesUteis.retornaCampoComoData( funcoesUteis.analyzeIfFieldIsValid(payment, "dueDate")) issueDate = funcoesUteis.retornaCampoComoData( funcoesUteis.analyzeIfFieldIsValid(payment, "issueDate")) amountPaid = funcoesUteis.analyzeIfFieldIsValid( payment, "amountPaid") amountDiscount = funcoesUteis.analyzeIfFieldIsValid( payment, "amountDiscount", 0.0) amountInterest = funcoesUteis.analyzeIfFieldIsValid( payment, "amountInterest", 0.0) amountFine = funcoesUteis.analyzeIfFieldIsValid( payment, "amountFine", 0.0) amountOriginal = funcoesUteis.analyzeIfFieldIsValid( payment, "amountOriginal", 0.0) accountCode = funcoesUteis.analyzeIfFieldIsValid( payment, "accountCode") codiEmp = funcoesUteis.analyzeIfFieldIsValid( payment, "companyBranch", None) codiEmp = self._codiEmp if codiEmp is None or str( codiEmp).isnumeric() is False else codiEmp historic = funcoesUteis.analyzeIfFieldIsValid(payment, "historic") category = funcoesUteis.analyzeIfFieldIsValid(payment, "category") accountPlan = funcoesUteis.analyzeIfFieldIsValid( payment, "accountPlan") cgcePaying = funcoesUteis.analyzeIfFieldIsValid( payment, "cgcePaying") historicExtract = funcoesUteis.analyzeIfFieldIsValid( payment, "historicExtract") accountCodeOld = funcoesUteis.analyzeIfFieldIsValid( payment, "accountCodeOld") sheet.write(row, 0, numberLote) sheet.write(row, 1, document) sheet.write(row, 2, findNote) sheet.write(row, 3, parcelNumber) sheet.write(row, 4, nameProvider) sheet.write(row, 5, cgceProvider) sheet.write(row, 6, bankAndAccount) sheet.write(row, 7, bankAndAccountExtract) sheet.write(row, 8, foundProof) sheet.write(row, 9, paymentDate, self._cell_format_date) sheet.write(row, 10, extractDate, self._cell_format_date) sheet.write(row, 11, dateOfImport, self._cell_format_date) sheet.write(row, 12, dueDate, self._cell_format_date) sheet.write(row, 13, issueDate, self._cell_format_date) sheet.write(row, 14, amountPaid, self._cell_format_money) sheet.write(row, 15, amountDiscount, self._cell_format_money) sheet.write(row, 16, amountInterest, self._cell_format_money) sheet.write(row, 17, amountFine, self._cell_format_money) sheet.write(row, 18, amountOriginal, self._cell_format_money) sheet.write(row, 19, accountCode) sheet.write(row, 20, codiEmp) sheet.write(row, 21, historic) sheet.write(row, 22, category) sheet.write(row, 23, accountPlan) sheet.write(row, 24, cgcePaying) sheet.write(row, 25, historicExtract) sheet.write(row, 26, accountCodeOld) sheet.write_formula( row, 27, f'=SUMIFS(ExtratosBancarios!D:D,ExtratosBancarios!S:S,G{row2},ExtratosBancarios!A:A,L{row2},ExtratosBancarios!N:N,"-")', self._cell_format_money)
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())