def __get_transactions(self, conn): """Get transactions for account If no specific account, get all. """ #Get id id_select = None if (self.account != None): if not self.account in self.accounts: raise RuntimeError("Unknown account :Account"+\ self.account+" not found") else: id_select = str(self.accounts[self.account]).strip() #Get transactions c = conn.cursor() if (id_select == None): c.execute('''SELECT time,note,amount,category_id FROM Items''') else: c.execute('SELECT time,note,amount,category_id FROM Items WHERE account_id==? ORDER BY time', (id_select,)) for row in c: self.transactions.append(pyf.transaction(datetime.date.fromtimestamp(row[0]/1000), float(row[2])/100, row[1], self.categories[row[3]])) c.close()
def __init__(self, filename): """Initialize """ qfx.__init__(self,filename) for x in self._content: self.transactions.append(pyf.transaction(\ self.__getdate(x.get("DTPOSTED")), float(x.get("TRNAMT")), x.get("NAME"), x.get("TRNTYPE")))
def __init__(self, filename): """Initialize """ csv.__init__(self,filename) for x in self._content: y = x[1].split("/") self.transactions.append(pyf.transaction(datetime.date(int(y[2]), int(y[0]), int(y[1])), float(x[3].replace('$','')), x[2], x[0]))