diff --git a/conservancy_beancount/reports/accrual.py b/conservancy_beancount/reports/accrual.py index 39a306f78a89ed0dc61abb04a93414933bca5924..b6b0bfee42170956eadc3093fcf98f2a157f19ed 100644 --- a/conservancy_beancount/reports/accrual.py +++ b/conservancy_beancount/reports/accrual.py @@ -667,6 +667,14 @@ and `balance` any other time. 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, 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( '--output-file', '-O', @@ -723,7 +731,12 @@ def main(arglist: Optional[Sequence[str]]=None, for error in load_errors: 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: try: 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') logger.info("Writing report to %s", args.output_file) 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()) elif args.report_type is ReportType.OUTGOING: rt_wrapper = config.rt_wrapper() diff --git a/conservancy_beancount/tools/audit_report.py b/conservancy_beancount/tools/audit_report.py index 096a78ca6a634acfbc3dfe17862db47108e89e30..a8a773e2434ae4ef486911f56a7e0240905257e5 100644 --- a/conservancy_beancount/tools/audit_report.py +++ b/conservancy_beancount/tools/audit_report.py @@ -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('Disbursements', next_year, '--disbursements'))), (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))), (fund.main, list(common_args('FundReport', args.audit_year))), (fund.main, list(common_args('FundReport', next_year))),