A subcontractor installs $6,000 of electrical materials that appeared on the last draw as stored stock. Move the $6,000 from stored to installed work. That transfer alone adds zero to the gross earned amount. It can still change the net amount when the contract holds different percentages on work and stored materials. In the example below, two schedule-of-values lines roll up to $17,850 due on the current draw.
Reconcile the schedule of values before calculating the draw
Each line carries the approved scheduled value, prior installed work, and materials still stored from the previous application. This period adds newly performed work, transfers stock into installed work, and records newly stored materials. In the electrical line, the transfer brings stored stock from $10,000 down to $4,000 before $2,000 of new stock arrives. The current stored balance is $6,000.
The sample uses 10% retainage on work and 5% on stored materials. It rounds each retainage amount per line, half up, and adds the rounded amounts for the cover total. The current request is cumulative earned less cumulative retainage and prior certified net. Use the prior certificate number and amount as inputs so a delayed cash receipt does not change the next request. Confirm the contract's rounding, rate, and release rules before using the math in a draw. AIA subcontractor payment application · Continuation sheet
Save the block as draw.mts and run node draw.mts with Node.js 24. The assertions cover the stock transfer, rounding, overbilling, and the prior certificate reconciliation. Node.js TypeScript documentation
import assert from "node:assert/strict"; type SovLine = { id: string; original: bigint; approvedChanges: bigint; priorInstalled: bigint; priorStored: bigint; newWork: bigint; stockInstalled: bigint; newStored: bigint; }; function retain(cents: bigint, basisPoints: bigint): bigint { assert(basisPoints >= 0n && basisPoints <= 10_000n, "Invalid retainage rate"); return (cents * basisPoints + 5_000n) / 10_000n; } function rollLine(line: SovLine, workBps: bigint, storedBps: bigint) { const { id, original, approvedChanges, priorInstalled, priorStored, newWork, stockInstalled, newStored } = line; assert([original, priorInstalled, priorStored, newWork, stockInstalled, newStored] .every((amount) => amount >= 0n), `${id}: negative input`); assert(stockInstalled <= priorStored, `${id}: installed more than opening stock`); const scheduled = original + approvedChanges; const installed = priorInstalled + newWork + stockInstalled; const stored = priorStored - stockInstalled + newStored; const gross = installed + stored; assert(gross <= scheduled, `${id}: exceeds approved scheduled value`); const held = retain(installed, workBps) + retain(stored, storedBps); return { id, scheduled, installed, stored, gross, held, earnedNet: gross - held }; } function draw(lines: SovLine[], priorCertifiedNet: bigint, workBps: bigint, storedBps: bigint) { assert(lines.length > 0 && new Set(lines.map(({ id }) => id)).size === lines.length, "Expected distinct schedule-of-values line IDs"); assert(priorCertifiedNet >= 0n, "Expected a nonnegative prior certificate total"); const rows = lines.map((line) => rollLine(line, workBps, storedBps)); const scheduled = rows.reduce((sum, row) => sum + row.scheduled, 0n); const gross = rows.reduce((sum, row) => sum + row.gross, 0n); const held = rows.reduce((sum, row) => sum + row.held, 0n); const earnedNet = gross - held; return { rows, scheduled, gross, held, earnedNet, currentDue: earnedNet - priorCertifiedNet, balanceIncludingRetainage: scheduled - earnedNet, }; } const electrical: SovLine = { id: "26-00", original: 6_000_000n, approvedChanges: 500_000n, priorInstalled: 2_000_000n, priorStored: 1_000_000n, newWork: 1_200_000n, stockInstalled: 600_000n, newStored: 200_000n, }; const plumbing: SovLine = { id: "22-00", original: 3_500_000n, approvedChanges: 0n, priorInstalled: 1_000_000n, priorStored: 0n, newWork: 500_000n, stockInstalled: 0n, newStored: 100_000n, }; const result = draw([electrical, plumbing], 3_650_000n, 1_000n, 500n); assert.equal(result.rows[0].installed, 3_800_000n); assert.equal(result.rows[0].stored, 600_000n); assert.equal(result.scheduled, 10_000_000n); assert.equal(result.gross, 6_000_000n); assert.equal(result.held, 565_000n); assert.equal(result.earnedNet, 5_435_000n); assert.equal(result.currentDue, 1_785_000n); assert.equal(result.balanceIncludingRetainage, 4_565_000n); const transferOnly = rollLine({ ...electrical, newWork: 0n, newStored: 0n }, 1_000n, 500n); assert.equal(transferOnly.gross, electrical.priorInstalled + electrical.priorStored); assert.equal(transferOnly.held, 280_000n); assert.equal(retain(5n, 1_000n), 1n); assert.throws(() => rollLine({ ...electrical, stockInstalled: 1_000_001n }, 1_000n, 500n), /opening stock/); assert.throws(() => rollLine({ ...electrical, newWork: 4_000_000n }, 1_000n, 500n), /scheduled value/); console.table(result.rows); console.log(`${result.currentDue} cents due on this draw`); Keep the certified schedule snapshot and its approved change-order references with the draw ID. Route a negative current request to review as a correction. Both exports can read the same reconciled rows and totals. For a subcontractor workflow with PDF and XLSX exports, see PayAppPack.