Esempio n. 1
0
    def get_history(self, account):
        transactions = []
        last_order = None

        for tr in self.document.split('\n')[1:]:
            cols = tr.split(';')

            if len(cols) < 4:
                continue

            t = FrenchTransaction(0)
            date = cols[self.COL_DATE]
            raw = cols[self.COL_TEXT]
            amount = cols[self.COL_AMOUNT]

            t.parse(date, re.sub(r'[ ]+', ' ', raw))

            if t.raw.startswith('PRELEVEMENT ACHATS DIFFERES'):
                t._coming = False
                if last_order is None:
                    last_order = t.date
            else:
                t._coming = True

            t.set_amount(amount)
            transactions.append(t)

        # go to the previous stop date before the last order
        while last_order is not None and last_order.day != account._outstanding_date.day:
            last_order = last_order - datetime.timedelta(days=1)

        for t in transactions:
            if t.date <= last_order:
                t._coming = False

        return iter(transactions)
Esempio n. 2
0
    def get_history(self, account):
        transactions = []
        last_order = None

        for tr in self.document.split('\n')[1:]:
            cols = tr.split(';')

            if len(cols) < 4:
                continue

            t = FrenchTransaction(0)
            date = cols[self.COL_DATE]
            raw = cols[self.COL_TEXT]
            amount = cols[self.COL_AMOUNT]

            t.parse(date, re.sub(r'[ ]+', ' ', raw))

            if t.raw.startswith('PRELEVEMENT ACHATS DIFFERES'):
                t._coming = False
                if last_order is None:
                    last_order = t.date
            else:
                t._coming = True

            t.set_amount(amount)
            transactions.append(t)

        # go to the previous stop date before the last order
        while last_order is not None and last_order.day != account._outstanding_date.day:
            last_order = last_order - datetime.timedelta(days=1)

        for t in transactions:
            if t.date <= last_order:
                t._coming = False

        return iter(transactions)