Skip to main content

Financial Queries

Use this page as the financial-accounting query library. The groups below organize reusable SQL by the question students are trying to answer: statement tie-out, settlement timing, working capital, sales-commission payable, payroll liabilities, manufacturing cost, CAPEX, budget, and commercial performance.

Financial Query Groups

Revenue, margin, and commercial pricing

Use these queries to connect billed revenue, gross margin, promotions, price realization, and customer-facing commercial activity.

Open a query when you want to inspect the SQL, copy it into SQLite, or trace the source-table logic.

Monthly Revenue and Gross Margin
Customer Credit and Refunds
Revenue and Gross Margin by Collection Style Lifecycle Supply Mode
Price Realization vs List by Segment Customer Region Collection Style
Gross Margin Impact of Promotions vs Nonpromotion Sales
Annual Net Revenue Bridge
Invoice Revenue Cutoff Exception Summary
Invoice Revenue Cutoff Exception Trace

AR, AP, customer cash, and working capital

Use these queries to separate invoice aging, cash application, supplier settlement, and month-end working-capital pressure.

Open a query when you want to inspect the SQL, copy it into SQLite, or trace the source-table logic.

AR Aging Open Invoices
AP Aging Open Invoices
Customer Deposits and Unapplied Cash Aging
Working Capital Bridge by Month
Cash Conversion Timing Review
Monthly AR Aging Detail
Monthly AR Aging Summary
Monthly AP Aging Detail
Monthly AP Aging Summary
Sales Commission Payable Rollforward

Payroll, accruals, and manufacturing cost

Use these queries to explain payroll liabilities, gross-to-net pay, accrued expenses, and manufacturing-accounting movement.

Open a query when you want to inspect the SQL, copy it into SQLite, or trace the source-table logic.

Manufacturing WIP Clearing Variance
Payroll Liability Rollforward
Gross to Net Payroll Review
Payroll Cash Payments and Remittances
Accrued Expense Rollforward
Accrued vs Invoiced vs Paid Timing
Hourly Payroll Hours to Paid Earnings Bridge
Manufacturing Cost Component Bridge
Payroll Expense Mix by Cost Center and Pay Class
Payroll and People Cost Mix by Cost Center Job Family Level

Trial balance, statements, reconciliation, and close

Use these queries to move from posted GL activity into trial balance, financial statements, control-account support, and close validation.

Open a query when you want to inspect the SQL, copy it into SQLite, or trace the source-table logic.

Trial Balance by Period
Journal and Close Cycle Review
Control Account Reconciliation
Retained Earnings and Close Entry Impact
Income Statement Monthly
Income Statement Quarterly
Income Statement Annual
Balance Sheet Monthly
Balance Sheet Quarterly
Balance Sheet Annual
Cash Flow Statement Indirect Monthly
Cash Flow Statement Indirect Quarterly
Cash Flow Statement Indirect Annual
Cash Flow Statement Direct Monthly
Cash Flow Statement Direct Quarterly
Cash Flow Statement Direct Annual
Annual Income to Equity Bridge
Post Close Profit and Loss Leakage Review
Round Dollar Manual Journal Close Sensitivity Review

Budget, pro forma, CAPEX, fixed assets, and design services

Use these queries to connect explicit budget assumptions, pro forma statements, fixed-asset lifecycle events, debt timing, and design-service revenue.

Open a query when you want to inspect the SQL, copy it into SQLite, or trace the source-table logic.

Forecast vs Actual Demand by Week Item Group Collection Lifecycle
Recommendation Conversion by Type Priority Planner
Pro Forma Income Statement Monthly
Pro Forma Balance Sheet Monthly
Pro Forma Cash Flow Indirect Monthly
Budget vs Actual Statement Bridge Monthly
Budget vs Actual Working Capital and Cash Bridge
Fixed Asset Rollforward by Behavior Group
Capex Acquisitions Financing and Disposals
Debt Amortization and Cash Impact
Design Service Revenue and Billed Hours by Customer Month

Main Table Families

TopicMain tables
Balance sheet reportingGLEntry, Account, JournalEntry
Cash flow reportingGLEntry, Account, JournalEntry
Fixed assets and CAPEXFixedAsset, FixedAssetEvent, DebtAgreement, DebtScheduleLine, PurchaseInvoice, DisbursementPayment, JournalEntry, GLEntry
Income statement reportingGLEntry, Account, JournalEntry
Revenue and gross marginSalesInvoice, SalesInvoiceLine, Shipment, ShipmentLine, CreditMemo, CreditMemoLine, Item, PriceList, PriceListLine, PromotionProgram, GLEntry, Account
AR and customer cashSalesInvoice, CashReceipt, CashReceiptApplication, CreditMemo, CustomerRefund, Customer
AP and supplier cashPurchaseInvoice, PurchaseInvoiceLine, DisbursementPayment, Supplier, GoodsReceipt
Working capitalGLEntry, Account, SalesInvoice, CashReceiptApplication, SalesCommissionAccrual, SalesCommissionAdjustment, SalesCommissionPayment, PurchaseInvoice, DisbursementPayment, PayrollRegister, PayrollLiabilityRemittance
Sales commissionsSalesCommissionRate, SalesCommissionAccrual, SalesCommissionAdjustment, SalesCommissionPayment, SalesCommissionPaymentLine, SalesInvoiceLine, CreditMemoLine, GLEntry, Account
Accrued expensesJournalEntry, PurchaseInvoice, PurchaseInvoiceLine, Shipment, GLEntry, Account, Supplier, Item
Payroll liabilities and supportPayrollPeriod, TimeClockEntry, LaborTimeEntry, PayrollRegister, PayrollRegisterLine, PayrollPayment, PayrollLiabilityRemittance, Employee
Manufacturing balancesWorkOrderClose, ProductionCompletionLine, MaterialIssueLine, JournalEntry, GLEntry, Account
Trial balance and close cycleGLEntry, JournalEntry, Account

Financial Statement Reconciliation Path

This sequence follows the statement tie from annual net income into retained earnings, then narrows into revenue reconciliation when the statement view and the operational view stop matching. Work through the queries in order so the bridge stays connected from statement to ledger to source document.

Open each query from the guide and work through the sequence from statement tie-out into revenue cutoff detail.

  1. Annual Income to Equity Bridge

    Start with the annual statement tie between net income, retained earnings, and the balance-sheet residual.

  2. Post Close Profit and Loss Leakage Review

    Then confirm that no revenue, expense, or `8010` balances remain open after the close.

  3. Round Dollar Manual Journal Close Sensitivity Review

    Use this sensitivity review only when a custom anomaly profile or manual edit leaves unexplained residuals after close.

  4. Annual Net Revenue Bridge

    Then move account by account into annual net revenue.

  5. Invoice Revenue Cutoff Exception Summary

    Open the cutoff summary when annual net revenue does not tie from source documents into the GL.

  6. Invoice Revenue Cutoff Exception Trace

    Then inspect the affected invoice lines, shipment lines, and revenue GL rows in detail.

CAPEX and Fixed Asset Path

This sequence starts in the fixed-asset subledger, then ties the asset lifecycle back into manufacturing cost, debt cash flows, and the budget roll-forward. Work through it in order so students keep the operational document chain separate from depreciation, note financing, and disposal accounting.

This is the fastest path for teaching the asset register, depreciation routing, financing cash, and disposal effects as one connected story.

  1. Fixed Asset Rollforward by Behavior Group

    Start with the monthly rollforward by behavior group so manufacturing, warehouse, and office assets stay separated.

  2. Capex Acquisitions Financing and Disposals

    Then trace the lifecycle events behind each addition, financing choice, and disposal.

  3. Debt Amortization and Cash Impact

    Use the debt schedule next so principal, interest, and cash timing are explicit.

  4. Manufacturing Cost Component Bridge

    Then connect manufacturing-equipment depreciation back into manufacturing clearing and conversion cost.

  5. Cash Flow Statement Indirect Monthly

    Use the indirect cash flow statement to show how CAPEX moves into investing cash while note activity moves into financing cash.

  6. Pro Forma Cash Flow Indirect Monthly

    Finish with the pro forma cash flow to compare the explicit CAPEX and note schedule with the budget roll-forward.

  • Keep the broader timing scan in view through Audit Queries, especially Cutoff and timing analysis and Potential anomaly review. Those queries show the wider timing population, while the reconciliation sequence narrows the investigation to the invoices that actually affect annual net-revenue tie-out.
  • If the cutoff summary shows invoices with InvoiceBeforeShipmentFlag = 1 and InvoiceYearVsGlYearFlag = 1, treat that pattern as seeded anomaly behavior inside the published teaching dataset rather than a defect in the statement logic.
  • After net revenue, repeat the same source-to-GL-to-statement-to-close pattern for COGS, manufacturing variance, labor, overhead, operating expenses, other income and expense, and retained earnings.

Interpretation Notes

  • Revenue posts at invoicing. COGS posts at shipment.
  • CashReceipt does not equal settled AR by itself. Use CashReceiptApplication.
  • Payroll register activity records liabilities first; cash leaves through payroll payments and remittances later.
  • Working-capital analysis gets stronger when students separate balances from timing.
  • Forecast, policy, and replenishment tables support planning-informed working-capital and inventory-timing analysis.
  • Explicit price-list, promotion, and override lineage lets students analyze revenue and margin against commercial rules.
  • The richer item master now supports collection, style family, lifecycle, and supply-mode financial analysis without changing the underlying posting model.
  • The richer employee master now supports job-family, job-level, and people-cost review without requiring a separate HR-history subledger.
  • Customer deposits and unapplied cash analysis should start from CashReceipt and CashReceiptApplication, alongside AR.
  • Sales commission analysis should start from SalesInvoiceLine.LineTotal, then trace SalesCommissionAccrual, SalesCommissionAdjustment, SalesCommissionPaymentLine, and SalesCommissionPayment into 2034 and 6290.
  • Accrued-expense analysis should focus on 2040, PurchaseInvoiceLine.AccrualJournalEntryID, the service-item lines that settle finance-managed estimates, and the outbound-freight accrual and settlement pattern created from Shipment.FreightCost.
  • Year-end close entries are real posted journals and should be filtered when you want raw multi-year P&L activity.
  • The income-statement starter queries use pre-close P&L activity, so they exclude the year-end close journals that zero out revenue and expense accounts.
  • The balance-sheet starter queries are point-in-time ending-balance statements, not monthly activity reports.
  • The balance-sheet starter queries derive Current Year Earnings for interim periods so assets continue to tie to liabilities plus equity before the annual close moves earnings into retained earnings.
  • The indirect-method cash flow starter queries reconcile from pre-close net income into operating cash, then combine that with investing and financing cash movements.
  • The direct-method cash flow starter queries classify cash-ledger activity into teaching buckets such as customer receipts, supplier payments, payroll, and other operating cash.
  • The cash flow starter queries treat opening journals as the Beginning Cash seed for the first reporting period instead of showing them as operating, investing, or financing flows.
  • Manufacturing-equipment depreciation debits 1090 Manufacturing Cost Clearing, so it belongs in manufacturing-cost interpretation rather than warehouse or office operating expense review.
  • Warehouse and office fixed-asset depreciation debits 6130, which keeps those assets in operating expense even when they share the same broad fixed-asset lifecycle controls as plant equipment.
  • CAPEX additions, note-financing reclasses, debt payments, and disposals now sit in the same financial-analysis path, so students can reconcile the asset register to investing cash, financing cash, and gain-or-loss activity.
  • The published default SQLite is anomaly-enriched when anomaly_mode is standard, so it is useful for teaching comparisons but not as the clean baseline for database-integrity reconciliation.