accrual: Add --end option.
For assemble-audit-reports as shown.
This commit is contained in:
parent
1fcab6af32
commit
1cc4e732f4
2 changed files with 21 additions and 3 deletions
|
@ -667,6 +667,14 @@ and `balance` any other time.
|
||||||
You can either specify a fiscal year, or a negative offset from the current
|
You can either specify a fiscal year, or a negative offset from the current
|
||||||
fiscal year, to start loading entries from. The default is to load the current,
|
fiscal year, to start loading entries from. The default is to load the current,
|
||||||
unaudited books.
|
unaudited books.
|
||||||
|
""")
|
||||||
|
parser.add_argument(
|
||||||
|
'--end', '--stop', '-e',
|
||||||
|
dest='stop_date',
|
||||||
|
metavar='DATE',
|
||||||
|
type=cliutil.date_arg,
|
||||||
|
help="""Do not consider entries from this date forward, in YYYY-MM-DD
|
||||||
|
format.
|
||||||
""")
|
""")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--output-file', '-O',
|
'--output-file', '-O',
|
||||||
|
@ -723,7 +731,12 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
for error in load_errors:
|
for error in load_errors:
|
||||||
bc_printer.print_error(error, file=stderr)
|
bc_printer.print_error(error, file=stderr)
|
||||||
|
|
||||||
postings_src = data.Posting.from_entries(entries)
|
stop_date = args.stop_date or datetime.date(datetime.MAXYEAR, 12, 31)
|
||||||
|
postings_src: Iterator[data.Posting] = (
|
||||||
|
posting
|
||||||
|
for posting in data.Posting.from_entries(entries)
|
||||||
|
if posting.meta.date < stop_date
|
||||||
|
)
|
||||||
for rewrite_path in args.rewrite_rules:
|
for rewrite_path in args.rewrite_rules:
|
||||||
try:
|
try:
|
||||||
ruleset = rewrite.RewriteRuleset.from_yaml(rewrite_path)
|
ruleset = rewrite.RewriteRuleset.from_yaml(rewrite_path)
|
||||||
|
@ -775,7 +788,7 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
args.output_file = out_dir_path / now.strftime('AgingReport_%Y-%m-%d_%H:%M.ods')
|
args.output_file = out_dir_path / now.strftime('AgingReport_%Y-%m-%d_%H:%M.ods')
|
||||||
logger.info("Writing report to %s", args.output_file)
|
logger.info("Writing report to %s", args.output_file)
|
||||||
out_bin = cliutil.bytes_output(args.output_file, stdout)
|
out_bin = cliutil.bytes_output(args.output_file, stdout)
|
||||||
report = AgingReport(rt_wrapper, out_bin)
|
report = AgingReport(rt_wrapper, out_bin, args.stop_date)
|
||||||
report.ods.set_common_properties(config.books_repo())
|
report.ods.set_common_properties(config.books_repo())
|
||||||
elif args.report_type is ReportType.OUTGOING:
|
elif args.report_type is ReportType.OUTGOING:
|
||||||
rt_wrapper = config.rt_wrapper()
|
rt_wrapper = config.rt_wrapper()
|
||||||
|
|
|
@ -184,7 +184,12 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
(ledger.main, list(common_args('Receipts', args.audit_year, '--receipts'))),
|
(ledger.main, list(common_args('Receipts', args.audit_year, '--receipts'))),
|
||||||
(ledger.main, list(common_args('Disbursements', next_year, '--disbursements'))),
|
(ledger.main, list(common_args('Disbursements', next_year, '--disbursements'))),
|
||||||
(ledger.main, list(common_args('Receipts', next_year, '--receipts'))),
|
(ledger.main, list(common_args('Receipts', next_year, '--receipts'))),
|
||||||
(accrual.main, list(common_args('AgingReport.ods'))),
|
(accrual.main, list(common_args(f'FY{next_year}AgingReport.ods'))),
|
||||||
|
(accrual.main, list(common_args(
|
||||||
|
f'FY{args.audit_year}AgingReport.ods',
|
||||||
|
None,
|
||||||
|
f'--end={audit_end.isoformat()}',
|
||||||
|
))),
|
||||||
(balance_sheet.main, list(common_args('Summary', args.audit_year))),
|
(balance_sheet.main, list(common_args('Summary', args.audit_year))),
|
||||||
(fund.main, list(common_args('FundReport', args.audit_year))),
|
(fund.main, list(common_args('FundReport', args.audit_year))),
|
||||||
(fund.main, list(common_args('FundReport', next_year))),
|
(fund.main, list(common_args('FundReport', next_year))),
|
||||||
|
|
Loading…
Reference in a new issue