To the Last Cent
Finance defers a 12-month service contract and expects every month to carry its slice of the revenue — and the twelve slices to add up to the invoice, exactly. Divide 100.00 by 12 and round each line and you have created four missing cents; the base application's Deferral Utilities solve this by making one line absorb the rounding drift. You are building that generator: two allocation methods, currency precision on every line, and a schedule that always sums back to the source amount to the last cent.
Requirements
The starter contains a table named "Deferral Schedule Line" — the buffer your code fills. Keep its fields and keys exactly as shipped; the grading tests read the lines back from it:
"Period No."—Integer, the primary key, numbered1..NoOfPeriods"Posting Date"—Date, the first day of the periodAmount—Decimal, the slice of the source amount deferred into the period
Create a codeunit named "Deferral Schedule" with two public procedures:
procedure GenerateStraightLine(var DeferralScheduleLine: Record "Deferral Schedule Line"; TotalAmount: Decimal; StartDate: Date; NoOfPeriods: Integer)
procedure GenerateDaysPerPeriod(var DeferralScheduleLine: Record "Deferral Schedule Line"; TotalAmount: Decimal; StartDate: Date; NoOfPeriods: Integer)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
- 12 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