Changeset - 1cc4e732f4e2
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-10-21 14:51:18
brettcsmith@brettcsmith.org
accrual: Add --end option.

For assemble-audit-reports as shown.
2 files changed with 21 insertions and 3 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/accrual.py
Show inline comments
...
 
@@ -664,12 +664,20 @@ and `balance` any other time.
 
        type=int,
 
        default=0,
 
        help="""How far back to search the books for related transactions.
 
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',
 
        metavar='PATH',
 
        type=Path,
 
        help="""Write the report to this file, or stdout when PATH is `-`.
...
 
@@ -720,13 +728,18 @@ def main(arglist: Optional[Sequence[str]]=None,
 
        elif not entries:
 
            returncode = cliutil.ExitCode.NoDataLoaded
 
    filters.remove_opening_balance_txn(entries)
 
    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)
 
        except ValueError as error:
 
            logger.critical("failed loading rewrite rules from %s: %s",
 
                            rewrite_path, error.args[0])
...
 
@@ -772,13 +785,13 @@ def main(arglist: Optional[Sequence[str]]=None,
 
            if args.output_file is None:
 
                now = datetime.datetime.now()
 
                out_dir_path = config.repository_path() or Path()
 
                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()
 
        if rt_wrapper is None:
 
            logger.error("unable to generate outgoing report: RT client is required")
 
        else:
conservancy_beancount/tools/audit_report.py
Show inline comments
...
 
@@ -181,13 +181,18 @@ def main(arglist: Optional[Sequence[str]]=None,
 
        (ledger.main, list(common_args('GeneralLedger', args.audit_year))),
 
        (ledger.main, list(common_args('GeneralLedger', next_year))),
 
        (ledger.main, list(common_args('Disbursements', args.audit_year, '--disbursements'))),
 
        (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))),
 
    ]
 

	
 
    books = config.books_loader()
0 comments (0 inline, 0 general)