Menu

Calculate an owner-operator settlement and IFTA roll-up in TypeScript
📰

Calculate an owner-operator settlement and IFTA roll-up in TypeScript

DEV Community: node·eth shihao·4 days ago
#lxOQ5FKx
#devtonodejs#devto#dev#jurisdiction#week
Long article (1501 words) — no AI summary yet.
Reading 0:00
15s threshold

A carrier owes an owner-operator $3,200.02 for the week. Import the same $400.30 fuel-card receipt twice and an unguarded settlement drops to $2,799.72. The same import can inflate the state fuel total by 105.125 gallons. Here, a repeated receipt ID stops the report before either total is issued.

Calculate the weekly settlement in cents

The example agreement pays 75% of linehaul , 100% of the fuel surcharge (FSC) , and approved reimbursements. It deducts fuel advances at face value. Apply the 75% share once to aggregate weekly linehaul. The fixture rounds half up at that step, so $3,150.015 becomes $3,150.02. Store money as bigint cents and use 7,500 basis points for the linehaul share.

Settlement line Calculation Amount

Linehaul share $4,200.02 × 75%, rounded to cents $3,150.02

Fuel surcharge $600.00 × 100% $600.00

Reimbursements Approved credits $125.50

Fuel advances −($400.30 + $275.20) −$675.50

Net settlement $3,200.02

Use the fuel-card feed's stable receipt ID across imports.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.