>>> from pprint import pprint
>>> a = Account.objects.get(code='M201064001')
>>> pprint(a.report(ending='2012-02', length=3))
{'M201064001': {'2011-12': {'cons': 0.12,
'corp': 0.88,
'total': Decimal('900')},
'2012-01': {'cons': 0.12,
'corp': 0.88,
'total': Decimal('900')},
'2012-02': {'cons': 0.12,
'corp': 0.88,
'total': Decimal('800')}}}
>>> aa = Account.objects.filter(code__startswith='M20106400')
>>> r = aa.reports.report(ending='2012-02', length=3, billed=True, exclude_total=True)
>>> pprint(r)
{'M201064001': {'2011-12': {'cons': 0.12,
'corp': 0.88,
'billed': Decimal('1900')},
'2012-01': {'cons': 0.12,
'corp': 0.88,
'billed': Decimal('1900')},
'2012-02': {'cons': 0.12,
'corp': 0.88,
'billed': Decimal('1800')}},
'M201064002': {'2011-12': {'cons': 0.35,
'corp': 0.65,
'billed': Decimal('1700')},
'2012-01': {'cons': 0.4,
'corp': 0.6,
'billed': Decimal('1700')},
'2012-02': {'cons': 0.34,
'corp': 0.66,
'billed': Decimal('1600')}}}
Created
May 28, 2012 17:02
-
-
Save airstrike/2820101 to your computer and use it in GitHub Desktop.
Complex reports API draft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment