Example #1
0
    def processAll(self):
        for root, dirs, files in os.walk(self._wayTemp):
            for file in files:
                if file.lower().endswith(('.txt')):
                    wayFile = os.path.join(root, file)
                    self._proofs.append(self.process(wayFile))

        return funcoesUteis.removeAnArrayFromWithinAnother(self._proofs)
Example #2
0
    def processAll(self):
        for root, dirs, files in os.walk(self._wayOriginalToRead):
            for file in files:
                wayFile = os.path.join(root, file)

                if file.lower().endswith(('.dbk', '.txt')):
                    self._livroCaixaRural.append(self.process(wayFile))

        return [ funcoesUteis.removeAnArrayFromWithinAnother(self._livroCaixaRural), self._accountPlan ]
Example #3
0
    def processAll(self):
        for root, dirs, files in os.walk(self._wayOriginalToRead):
            for file in files:
                wayFile = os.path.join(root, file)

                if file.lower().endswith(('.xls', '.xlsx')):
                    self._payments.append(self.process(wayFile))

        return funcoesUteis.removeAnArrayFromWithinAnother(self._payments)
Example #4
0
    def processAll(self):
        numberFile = 0
        for root, dirs, files in os.walk(self._wayTemp):
            for file in files:
                if file.lower().endswith(('.ofx', '.ofc', '.txt')):
                    numberFile += 1
                    wayFile = os.path.join(root, file)
                    self._extracts.append(self.process(wayFile, numberFile))

        return funcoesUteis.removeAnArrayFromWithinAnother(self._extracts)
    def __init__(self):
        self._namesProductsBase = leXls_Xlsx(os.path.join('C:/Programming/baymax/backend/extract/data/bkp', 'produtos_comparar.xlsx'))
        self._namesProductsBase = funcoesUteis.removeAnArrayFromWithinAnother(self._namesProductsBase)
        self._geempre = ExtractGeempre()
        self._today = datetime.date.today()
        self._currentMonth = self._today.month
        self._currentYear = self._today.year

        self._connectionMongo = ConnectMongo()
        self._dbMongo = self._connectionMongo.getConnetion()
        self._collection = self._dbMongo['ExtractEntryNoteProducts']
Example #6
0
    def processAll(self):
        for root, _, files in os.walk(self._wayTemp):
            for file in files:
                if file.lower().endswith(('.txt')):
                    wayFile = os.path.join(root, file)
                    resultProcess = self.process(wayFile)
                    if resultProcess is not None:
                        self._proofs.append(resultProcess)

        self._proofs = funcoesUteis.removeAnArrayFromWithinAnother(
            self._proofs)
        return self._proofs
Example #7
0
    def process(self):
        banksNumberList = []
        list(
            map(
                lambda proofPayment: banksNumberList.append(proofPayment[
                    'value']), self._banksList))

        if banksNumberList.count(341) > 0:
            print(f'\t - Processando comprovantes de pagamento do Itaú')
            from read_files.ProofsItau.Main import ProofsItau

            proofsItau = ProofsItau(self._wayTemp)
            self._proofs.append(proofsItau.processAll())

        if banksNumberList.count(33) > 0:
            print(f'\t - Processando comprovantes de pagamento do Santander')
            from read_files.ProofsPaymentsSantander import ProofsPaymentsSantander
            proofsPaymentsSantander = ProofsPaymentsSantander(self._wayTemp)
            self._proofs.append(proofsPaymentsSantander.processAll())

        if banksNumberList.count(3) > 0:
            print(f'\t - Processando comprovantes de pagamento do Amazônia')
            from read_files.ProofsAmazonia.Main import ProofsAmazonia

            proofsAmazonia = ProofsAmazonia(self._wayTemp)
            self._proofs.append(proofsAmazonia.processAll())

        if banksNumberList.count(756) > 0:
            print(f'\t - Processando comprovantes de pagamento do Sicoob')
            from read_files.ProofsSicoob.Main import ProofsSicoob

            proofsSicoob = ProofsSicoob(self._wayTemp)
            self._proofs.append(proofsSicoob.processAll())

        if banksNumberList.count(237) > 0:
            print(f'\t - Processando comprovantes de pagamento do Bradesco')
            from read_files.ProofsBradesco.Main import ProofsBradesco

            proofsBradesco = ProofsBradesco(self._wayTemp)
            self._proofs.append(proofsBradesco.processAll())

        return funcoesUteis.removeAnArrayFromWithinAnother(self._proofs)
Example #8
0
    def process(self):

        print('\n - Etapa 1: Lendo os PDFs')
        readPDFs = ReadPDFs(self._codiEmp, self._wayFilesTemp,
                            self._wayFilesToRead)
        readPDFs.processSplitPdfOnePageEach()
        readPDFs.transformPDFToText()
        readPDFs.doBackupFolderPDF(
        )  # faz o bkp pra não perder os dados quando apagar as informações

        print(' - Etapa 2: Lendo os OFXs ')
        extractsOFX = ExtractsOFX(self._codiEmp, self._wayFilesToRead,
                                  self._wayFilesTemp)
        extracts = extractsOFX.processAll()

        print(' \t- Etapa 2.1: Retirando lançamento de extrato duplicados. ')
        deleteExtractDuplicate = DeleteExtractDuplicate(extracts)
        self._extracts.append(deleteExtractDuplicate.process())

        # reads the financy
        print(' - Etapa 3: Lendo o financeiro do cliente')
        hasFinancy = funcoesUteis.returnDataFieldInDict(
            self._settings, ["financy", "has"])
        if hasFinancy is True or self._lenghtLayoutsAccountPaid > 0:
            systemFinancy = funcoesUteis.returnDataFieldInDict(
                self._settings, ["financy", "system"])
            if systemFinancy == "":
                readGeneral = ReadGeneral(self._codiEmp, self._wayFilesToRead,
                                          self._settings)
                readGeneralData = readGeneral.processAll()
                self._payments = readGeneralData[0]

                self._extracts.append(readGeneralData[1])
            else:
                callReadFilePayments = CallReadFilePayments(
                    systemFinancy, self._codiEmp, self._wayFilesToRead,
                    self._wayFilesTemp)
                self._payments = callReadFilePayments.process()
        else:
            print(
                '\t - Cliente sem a configuração do sistema financeiro realizada (provavelmente esta empresa não possui)'
            )

        self._extracts = funcoesUteis.removeAnArrayFromWithinAnother(
            self._extracts)

        # reads the txts
        print(
            ' - Etapa 4: Lendo os comprovantes de pagamentos e analisando as estruturas deles.'
        )
        callReadFileProofs = CallReadFileProofs(self._codiEmp,
                                                self._wayFilesTemp,
                                                self._wayFilesToRead,
                                                self._banksToProof)
        proofsOfPayments = callReadFileProofs.process()

        print(
            ' - Etapa 4.1: Retirando lançamento de comprovantes duplicados. ')
        deleteProofDuplicate = DeleteProofPaymentDuplicate(proofsOfPayments)
        self._proofsOfPayments = deleteProofDuplicate.process()

        print(
            ' - Etapa 5: Comparação entre o Financeiro com os Comprovantes de Pagamentos e Extratos.'
        )
        comparePaymentsAndProofWithExtracts = ComparePaymentsAndProofWithExtracts(
            self._settings, self._extracts, self._payments,
            self._proofsOfPayments)
        paymentsCompareWithProofAndExtracts = comparePaymentsAndProofWithExtracts.comparePaymentsFinalWithExtract(
        )
        extractsCompareWithProofAndExtracts = comparePaymentsAndProofWithExtracts.analyseIfExtractIsInPayment(
        )
        # print(paymentsCompareWithProofAndExtracts)

        print(' - Etapa 6: Filtrando os pagamentos do período informado.')
        filterPeriod = FilterPeriod(self._inicialDate, self._finalDate,
                                    paymentsCompareWithProofAndExtracts,
                                    extractsCompareWithProofAndExtracts)
        extractsWithFilter = filterPeriod.filterExtracts()
        paymentsWithFilter = filterPeriod.filterPayments()

        sequentialStep = 7

        hasOwnAccountPlan = funcoesUteis.returnDataFieldInDict(
            self._settings, ["financy", "hasOwnAccountPlan"])
        if hasOwnAccountPlan is False or hasOwnAccountPlan == "":
            print(
                f' - Etapa {sequentialStep}: Buscando a conta do fornecedor/despesa dentro do sistema.'
            )
            comparePaymentsFinalWithDataBase = ComparePaymentsFinalWithDataBase(
                self._codiEmp, self._finalDate, paymentsWithFilter)
            paymentsFinal = comparePaymentsFinalWithDataBase.process()
            sequentialStep += 1
        else:
            paymentsFinal = paymentsWithFilter

        print(
            f' - Etapa {sequentialStep}: Configurando as contas contábeis de acordo planilha de configuracoes preenchida.'
        )
        compareWithSettings = CompareWithSettings(self._codiEmp, paymentsFinal,
                                                  extractsWithFilter)
        extractsCompareWithSettings = compareWithSettings.processExtracts()
        paymentsCompareWithSettings = compareWithSettings.processPayments()
        sequentialStep += 1

        print(f' - Etapa {sequentialStep}: Exportando informações')
        generateExcel = GenerateExcel(self._codiEmp)
        generateExcel.sheetPayments(paymentsCompareWithSettings)
        generateExcel.sheetExtract(extractsCompareWithSettings)
        generateExcel.closeFile()
        sequentialStep += 1

        print(
            f' - Etapa {sequentialStep}: Salvando arquivos que não foram lidos'
        )
        returnFilesDontFindForm = ReturnFilesDontFindForm(
            self._codiEmp, self._wayFilesTemp)
        returnFilesDontFindForm.processAll()

        print(' - Processo Finalizado.')
        os.system('pause > nul')