Project WIP Recognition Engine
Every month-end, finance runs Calculate WIP on running projects so the income statement shows earned revenue and matched costs instead of raw postings. Business Central ships five WIP methods for this; you are going to build the recognition arithmetic behind three of them — Percentage of Completion, Cost of Sales, and Completed Contract — as a small stateful engine that is pumped with usage and invoice postings across periods and asked for a fresh recognition snapshot after each one.
Requirements
Create an enum named "Job WIP Recognition Method" with exactly three values, named "Percentage of Completion", "Cost of Sales" and "Completed Contract" (ordinal numbers are your choice).
Create a codeunit named "Job WIP Engine" with five public procedures:
procedure Initialize(WIPMethod: Enum "Job WIP Recognition Method"; BudgetTotalCost: Decimal; BillableTotalPrice: Decimal)
procedure PostUsage(CostAmount: Decimal)
procedure PostInvoice(PriceAmount: Decimal)
procedure CompleteProject()
procedure Recalculate(var RecognizedCosts: Decimal; var RecognizedSales: Decimal; var WIPBalance: Decimal)Lifecycle rules:
Initializestarts a fresh project on the codeunit instance: it stores the method, the budget total cost and the billable total price, and resets everything else — cumulative usage, cumulative invoiced and the completed flag. CallingInitializeagain on the same instance begins a brand-new project with no leftovers from the previous one.PostUsageaddsCostAmountto the project's cumulative usage total cost;PostInvoiceaddsPriceAmountto the project's cumulative invoiced total price. The tests only ever post positive amounts with at most two decimal places, andBudgetTotalCost/BillableTotalPriceare never negative.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 19 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in