Update documentation on comparative statements
Rename "period" to "year" in the UI to better reflect the mechanism
This commit is contained in:
parent
7fd09c68de
commit
25f0e8eeba
12
README.md
12
README.md
@ -56,6 +56,18 @@ Ledger-pyreport by default observes the convention that positive amounts in Ledg
|
||||
|
||||
A commodity which has *any* price data in Ledger (including those specified through `@` or `@@`, or explicitly through `P`) will be regarded as a commodity measured at fair market value, and automatically revalued accordingly. A commodity which has *no* price data in Ledger (i.e. lot prices through `{…}` or `{{…}}` only) will be regarded as a commodity measured at historical cost, and will not be subsequently revalued.
|
||||
|
||||
## Comparative statements
|
||||
|
||||
ledger-pyreport can be used to produce comparative statements, for example ‘compare *n* years’ or ‘compare *n* months’.
|
||||
|
||||
The dates in the ‘date’ and ‘period start’ fields represent the most recent period. These two fields are then advanced backwards in increments of the specified time interval to determine dates for the preceding periods.
|
||||
|
||||
However, if the interval is set to ‘months’, and the ‘date’ is the last day of a calendar month, then preceding dates will also be set to the last day of each preceding calendar month.
|
||||
|
||||
Example 1: Setting a date of 2019-10-31 and period start of 2019-07-01 with ‘compare *n* years’ will generate *year to date* comparisons as at 31 October of each year. To generate year end comparisons, set a date of 2020-06-30 with period start 2019-07-01.
|
||||
|
||||
Example 2: Setting a date of 2019-10-31 and period start of 2019-07-01 with ‘compare *n* months’ will compare the *overlapping* 4-month periods Jul–Oct, Jun–Sep, May–Aug, etc. To instead compare calendar months, set a date of 2019-10-31 with period start 2019-10-01.
|
||||
|
||||
## Caution on standards compliance
|
||||
|
||||
ledger-pyreport is developed with reference to the [AASB Australian Accounting Standards](https://www.aasb.gov.au/Pronouncements/Current-standards.aspx) and [IFRS International Financial Reporting Standards](https://www.ifrs.org/issued-standards/list-of-standards/), and we prefer compliance with those standards whenever practical. (We do not specifically consider United States FASB GAAP compliance.)
|
||||
|
@ -40,7 +40,7 @@ def make_period(pstart, date, compare, cmp_period):
|
||||
labels = []
|
||||
|
||||
for i in range(0, compare + 1):
|
||||
if cmp_period == 'period':
|
||||
if cmp_period == 'year':
|
||||
date2 = date.replace(year=date.year - i)
|
||||
pstarts.append(pstart.replace(year=pstart.year - i))
|
||||
dates.append(date2)
|
||||
@ -85,7 +85,7 @@ def trial():
|
||||
date = datetime.strptime(flask.request.args['date'], '%Y-%m-%d')
|
||||
pstart = datetime.strptime(flask.request.args['pstart'], '%Y-%m-%d')
|
||||
compare = int(flask.request.args.get('compare', '0'))
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'period')
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'year')
|
||||
cash = flask.request.args.get('cash', False)
|
||||
|
||||
if compare == 0:
|
||||
@ -139,7 +139,7 @@ def balance():
|
||||
date = datetime.strptime(flask.request.args['date'], '%Y-%m-%d')
|
||||
pstart = datetime.strptime(flask.request.args['pstart'], '%Y-%m-%d')
|
||||
compare = int(flask.request.args.get('compare', '0'))
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'period')
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'year')
|
||||
cash = flask.request.args.get('cash', False)
|
||||
|
||||
pstarts, dates, labels = make_period(pstart, date, compare, cmp_period)
|
||||
@ -163,7 +163,7 @@ def pandl():
|
||||
date_beg = datetime.strptime(flask.request.args['date_beg'], '%Y-%m-%d')
|
||||
date_end = datetime.strptime(flask.request.args['date_end'], '%Y-%m-%d')
|
||||
compare = int(flask.request.args.get('compare', '0'))
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'period')
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'year')
|
||||
cash = flask.request.args.get('cash', False)
|
||||
scope = flask.request.args.get('scope', 'pandl')
|
||||
|
||||
@ -210,7 +210,7 @@ def cashflow():
|
||||
date_beg = datetime.strptime(flask.request.args['date_beg'], '%Y-%m-%d')
|
||||
date_end = datetime.strptime(flask.request.args['date_end'], '%Y-%m-%d')
|
||||
compare = int(flask.request.args.get('compare', '0'))
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'period')
|
||||
cmp_period = flask.request.args.get('cmpperiod', 'year')
|
||||
method = flask.request.args['method']
|
||||
|
||||
dates_beg, dates_end, labels = make_period(date_beg, date_end, compare, cmp_period)
|
||||
|
@ -29,7 +29,7 @@
|
||||
<label>
|
||||
Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)">
|
||||
<select name="cmpperiod" data-inputgroup="cmpperiod" oninput="selc(this)">
|
||||
<option value="period" selected>periods</option>
|
||||
<option value="year" selected>years</option>
|
||||
<option value="month">months</option>
|
||||
</select>
|
||||
</label>
|
||||
@ -45,7 +45,7 @@
|
||||
<label>
|
||||
Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)">
|
||||
<select name="cmpperiod" data-inputgroup="cmpperiod" oninput="selc(this)">
|
||||
<option value="period" selected>periods</option>
|
||||
<option value="year" selected>years</option>
|
||||
<option value="month">months</option>
|
||||
</select>
|
||||
</label>
|
||||
@ -61,7 +61,7 @@
|
||||
<label>
|
||||
Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)">
|
||||
<select name="cmpperiod" data-inputgroup="cmpperiod" oninput="selc(this)">
|
||||
<option value="period" selected>periods</option>
|
||||
<option value="year" selected>years</option>
|
||||
<option value="month">months</option>
|
||||
</select>
|
||||
</label>
|
||||
@ -82,7 +82,7 @@
|
||||
<label>
|
||||
Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)">
|
||||
<select name="cmpperiod" data-inputgroup="cmpperiod" oninput="selc(this)">
|
||||
<option value="period" selected>periods</option>
|
||||
<option value="year" selected>years</option>
|
||||
<option value="month">months</option>
|
||||
</select>
|
||||
</label>
|
||||
|
Reference in New Issue
Block a user