Finance request
The finance director at fictional Fenwick Cartography needs a reproducible monthly net-revenue report and its leading client.
Inputs
Sales have ClientId, signed Net and Cancelled. Client-directory updates have Id and Name; the last name update wins. Each feed can be consumed once.
Deliverable
Return every noncancelled client total, including zero and negative totals, sorted by net descending and ID ascending. Format Name|Net with two decimal places and no final newline. The headline must match its first row; an empty month has leader None and zero. Own and dispose one report session on success and failure.
Fenwick Cartography is a fictional mapping supplier. Its finance director needs a monthly report showing net revenue per client and the client that leads after refunds. A draft design repeatedly scans the same feeds, copies growing report strings, and closes its session only after success. Those are separate defects; fixing one must not change the accounting rules. Build the report in six carried steps. First establish signed net totals and a stable ranking. Then replace repeated directory scans with a current-name index, format the deliverable, and give one session a clear owner. Finish with a headline calculated from the same rows as the report.
The inputs include cancelled sales, refunds, name updates, missing clients, and empty months. Read counters and allocation checks establish the repeated work you removed. They don't stand in for a measured server latency improvement. Your edited source carries forward between steps, so preserve the working methods as you add the next one.
The final checked answer contains both the report and its leading-client conclusion.