# A report as of a day shows the books through that day, and nothing # dated after it, however long after the day it is made. # # wanderbooks: P3 defect 21 (the CPA package's QuickBooks file held entries # dated after the package's as_of); rules.md B-33; regression tests # `every_file_in_an_as_of_package_stops_at_as_of` and # `as_of_package_iif_stops_at_as_of` (ledger-package tests/package.rs). # # Expected values (bookspec/README.md): trial_balance gives each # account's balance as of the day, debit positive and credit negative, # every account listed; profit_and_loss gives each revenue and expense # account's activity for the period on its normal side, every one # listed, and net_income (revenue less expenses). id = "as-of-package-stops-at-as-of" title = "A report as of a day leaves out what is dated after it" rule = "A balance or report as of a day D MUST include every posted entry dated on or before D and MUST NOT include any entry dated after D, whenever it is produced; a period report through D covers the entries dated from the period's first day through D." status = "CONVENTION" sources = [ "IRS Publication 538 (Rev. January 2022), Tax year: \"A tax year is an annual accounting period for keeping records and reporting income and expenses.\" (docs/spec/sources/irs-periods-and-methods.md)", "Pacioli, Summa de arithmetica (1494), ch. 36, the trial balance: the total of the debits equals the total of the credits (Geijsbeek translation, 1914; docs/spec/sources/pacioli-1494.md)", ] tags = ["as-of", "trial-balance", "profit-and-loss", "reversal", "period-boundary"] [setup] currency = "USD" fiscal_year_start = "01-01" basis = "accrual" rounding = "half-away-from-zero" [[setup.accounts]] code = "1000" name = "Checking" type = "asset" [[setup.accounts]] code = "3000" name = "Owner capital" type = "equity" [[setup.accounts]] code = "4000" name = "Sales" type = "revenue" [[setup.accounts]] code = "6000" name = "Rent" type = "expense" # Entry 1. [[events]] date = "2026-01-02" description = "Owner contribution" lines = [ { account = "1000", side = "debit", amount = "10000.00" }, { account = "3000", side = "credit", amount = "10000.00" }, ] # Entry 2. [[events]] date = "2026-02-01" description = "Sale" lines = [ { account = "1000", side = "debit", amount = "4000.00" }, { account = "4000", side = "credit", amount = "4000.00" }, ] # Entry 3: dated the day itself, so in. [[events]] date = "2026-06-30" description = "June rent" lines = [ { account = "6000", side = "debit", amount = "1200.00" }, { account = "1000", side = "credit", amount = "1200.00" }, ] # Entry 4: the day after, so out of anything as of 2026-06-30. [[events]] date = "2026-07-01" description = "July rent" lines = [ { account = "6000", side = "debit", amount = "1200.00" }, { account = "1000", side = "credit", amount = "1200.00" }, ] # Entry 5: a reversal dated after the day leaves its original in. [[events]] date = "2026-07-15" description = "Reversal of the February sale" reverses = 2 [[expect]] query = "trial_balance" as_of = "2026-06-30" values = { "1000" = "12800.00", "3000" = "-10000.00", "4000" = "-4000.00", "6000" = "1200.00" } [[expect]] query = "profit_and_loss" from = "2026-01-01" to = "2026-06-30" values = { "4000" = "4000.00", "6000" = "1200.00", net_income = "2800.00" } # The same books a month later: the July rent and the reversal are in. [[expect]] query = "trial_balance" as_of = "2026-07-31" values = { "1000" = "7600.00", "3000" = "-10000.00", "4000" = "0.00", "6000" = "2400.00" } [[expect]] query = "profit_and_loss" from = "2026-01-01" to = "2026-07-31" values = { "4000" = "0.00", "6000" = "2400.00", net_income = "-2400.00" }