djaodjin / djaodjin-saas

Django application for software-as-service and subscription businesses
Other
564 stars 124 forks source link

Export financial transactions as CSV #24

Closed rene-armida closed 9 years ago

rene-armida commented 9 years ago

Two admin views show financial transactions: "funds" and "billing." In both cases, we want to add both (1) the same style of date picker as on the "Retention" screen, allowing for filtering the transactions by date, and (2) a CSV download of the transaction data.

TODO: specify the CSV fields in each case.

smirolo commented 9 years ago

Fields:

In the double entry ledger which the Transaction table is, which side (orig/dest) is printed depends on the point or reference. On the funds page we are interested into producing what goes in / out of the provider. On the billing page we are interested into what goes in / out of the subscriber.

rene-armida commented 9 years ago

Check out TransactionListBaseAPIView in transactions.py for this.

rene-armida commented 9 years ago

The export should always use the dest_amount field, in both cases. The difference between the fields is primarily about units - for each ledger entry (a row), the amounts are always the same, unless they are in different currencies. In both cases, we want the download to include the amount and units relative to the receiver, hence the preference for the dest_ fields.

It would be helpful if we included minus signs ahead of debit amounts; beware that all entries in the transactions table will be positive. This logic is in TransactionSerializer._is_debit and the is_debit template tag.

smirolo commented 9 years ago

Transactions in CSV should be sorted by date. Right now, the order just looks random.

rene-armida commented 9 years ago

You're probably right - I don't think I specified a sort order, so they're going to be randomly ordered by the database. I'll fix it.

smirolo commented 9 years ago

done.