Re: Model for debt, credit and balance

2010-02-19 Thread Jeremy Dillworth
Presumably you'll eventually have enough transactions that you'll want to start paging them. At that point, it would change how you would arrive at the balance. If a user is looking at page 30, you shouldn't need to retrieve the transactions from pages 1-29. Eventually, you may want to consider so

Re: Model for debt, credit and balance

2010-02-18 Thread Marcelo Barbero
It worked!!! Thanks a lot. Marcelo 2010/2/18 Tim : > There might be a better way, but something like this should work. > > In your view, build a list... > > transaction_list = [] > balance = 0 > for tran in Transaction.objects.order_by('date'): >    balance = balance + tran.debit >    balance = ba

Re: Model for debt, credit and balance

2010-02-18 Thread Tim
There might be a better way, but something like this should work. In your view, build a list... transaction_list = [] balance = 0 for tran in Transaction.objects.order_by('date'): balance = balance + tran.debit balance = balance - tran.credit transaction_list.append({'transaction':tra

Model for debt, credit and balance

2010-02-18 Thread Marcelo Barbero
I have a model with accounting records, in which the last two columns are "Debt" and "Credit". I would like to do a report that is something like the following: Description DebtCredit Balance Movement 1100.000.00 100.00 Movement 2