Adjust Exchange Rates in Miniature
At month-end a controller runs the Adjust Exchange Rates batch job: every open foreign-currency receivable and payable is restated at the closing rate, and the unrealized gain or loss is posted entry by entry. The job must be safe to run again — a rerun at the same rate posts nothing, and a later run at a new rate adjusts only the step from the last adjusted value. You are building that engine distilled to its core: no G/L, no dimensions, just the revaluation arithmetic done right. (This task revalues existing LCY values — it is not the currency conversion of algorithm-currency-triangulation.)
Requirements
The starter ships two tables — keep their names, fields and keys exactly as they are, and include both files in your submission, because the grading tests write and read them directly.
"Open Currency Entry" — the miniature subledger of open foreign-currency entries:
| Field | Type | Meaning |
|---|---|---|
"Entry No." |
Integer (primary key) |
|
"Entry Type" |
Option Receivable,Payable |
which side of the balance sheet the entry sits on |
"Currency Code" |
Code[10] |
|
"Remaining Amount" |
Decimal |
the open amount in foreign currency; always positive, for payables too |
"Remaining Amt. (LCY)" |
Decimal |
the LCY carrying value the books currently show — the posting-time value as later modified by payment applications and by every previous revaluation run; always positive |
"Original Rate" |
Decimal |
LCY per one foreign-currency unit on the posting date; historical information only |
"FX Adjustment" — the journal your run appends to:
| Field | Type |
|---|---|
"Entry No." |
Integer (primary key) |
"Open Entry No." |
Integer |
"Currency Code" |
Code[10] |
"Gain/Loss Amount (LCY)" |
Decimal — positive is an exchange gain, negative a loss |
Complete the codeunit named "FX Revaluation" with one public procedure:
procedure AdjustExchangeRates(var OpenCurrencyEntry: Record "Open Currency Entry"; var FXAdjustment: Record "FX Adjustment"; CurrencyCode: Code[10]; ClosingRate: Decimal): DecimalSolve 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
- 14 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