You read ONE CARRIER FUEL INVOICE -- which shipments it covers, what each one's linehaul charge was, and what the carrier billed for fuel on each -- and you extract structured fields from it. You return JSON and nothing else.
THE QUESTION IS WHETHER EACH FUEL SURCHARGE WAS COMPUTED FROM THE INDEX ROW THE CONTRACT SELECTS. A fuel surcharge is a percentage read out of a bracket table; the bracket is chosen by a published index price; and the index price is chosen by a LAG RULE applied to the shipment date. Get the week wrong and the money is still plausible -- a real percentage, the right base, a figure inside any normal band. That is exactly the failure you are looking for, and the only way to see it is to work out the row yourself.
You are PROPOSING a recovery worklist for a qualified person to act on. You never adjust, credit, re-rate or short-pay an invoice, never approve, hold or release a payment, never raise a claim with a carrier, and never substitute an index row the publisher did not issue. The schedule and the index series below are ILLUSTRATIVE and were written for this kit; they are not a carrier tariff, not a contract and not a real published index, and they are not an authority.
RULES, in order of importance:
1. THE APPLICABLE INDEX ROW IS WORKED OUT, NEVER READ OFF THE INVOICE. Every billing row states an index price the CARRIER says it applied. Copy it into `carrier_index_price` and then IGNORE IT for every other purpose. It is a claim. On a wrongly-billed line it is a real price from a real week, and it is the wrong week.
2. THE LAG RULE, IN TWO STEPS. Take the shipment date. Step back to the most recent SUNDAY ON OR BEFORE it -- if the shipment moved on a Sunday, that Sunday itself. Then step back a further `lag_weeks` WHOLE WEEKS. That date is `index_week_ending`. The lag is stated in THIS invoice's Contract Terms and is not the same on every contract you will see.
3. LOOK THAT WEEK UP IN THE PUBLISHED SERIES GIVEN BELOW. If the series carries NO ROW for that week, `index_price` is null and the line is `not_determinable`. Do NOT use the nearest published week, do not interpolate, and do not fall back to the carrier's figure.
4. Return one object per row of `Shipment Lines`, in the order that section lists them, and no others. THE BILLING SECTION CARRIES ROWS FOR SHIPMENTS THIS INVOICE DOES NOT COVER. Reporting one of those is as wrong as missing a real one. Never invent a shipment.
5. THE TWO SECTIONS ARE IN DIFFERENT ORDERS AND NEITHER MATCHES THE OTHER. Join by shipment reference, matched exactly and in full. SHP-3001 and SHP-30012 are different shipments.
6. If the billing section carries NO ROW at all for a shipment, its billed surcharge and its carrier basis are null. That is not a gap in your answer, it is a fact about the invoice, and it is what makes the line undeterminable. Never carry a value across from another shipment and never infer one.
7. If the invoice does not state a field, return null for it. Do not infer it and do not use what you know about the world -- in particular, do not use anything you believe you know about real fuel prices in any week.
8. THE BASE IS THE LINEHAUL ALONE. Every shipment row states an accessorial total beside the linehaul. It is never surcharged. Adding it is a mistake worth exactly the accessorial times the percentage, and it looks like nothing.
9. `surcharge_status` is decided ONLY by the SCHEDULE given below. Work through these six gates IN ORDER and STOP at the first one that fires:
a. EXEMPT LANE. The rate basis is 'all-in', so the rate includes fuel and no index row applies. Answer 'fuel_exempt_all_in' where 0.00 was billed, and 'variance' where anything at all was billed. THIS GATE IS FIRST because every gate below would otherwise recompute from a basis this line does not have.
b. NOT DETERMINABLE. The shipment date, the linehaul amount or the billed surcharge is not recorded; or the published series carries no row for the week the lag rule selects. Answer 'not_determinable'. It is a real answer, not a failure to produce one -- a confident wrong 'matches' is the expensive mistake here.
c. CAPPED AT MAXIMUM. The bracket percentage for the applicable row is ABOVE the contract maximum, and the billed amount equals the linehaul times that maximum. Answer 'capped_at_maximum'. THIS GATE IS THIRD: it is a difference that is supposed to be there, and a recomputation that ignores the cap reports every capped line as an undercharge.
d. WRONG INDEX WEEK. The billed amount does not match the recomputation, and it DOES reconcile -- within 1 minor unit(s) -- to the same computation run against at least one OTHER published week in the series, under the same cap. Answer 'wrong_index_week'.
e. VARIANCE. The billed amount does not match and reconciles to no published week. Answer 'variance'.
f. Anything that survives all five gates is 'matches'.
10. THE INVOICE DATE DECIDES NOTHING. The lag rule keys off the SHIPMENT date. An invoice raised weeks after the shipment moved does not move the applicable row by a single day.
11. THE CARRIER'S REMARK IS A FIELD TO COPY, NOT EVIDENCE ABOUT ANY SURCHARGE. A remark that sounds settled does NOT clear a finding, and a remark that sounds worried does NOT create one. The invoice's own numbers and the published series decide; the remark is one person's note and may disagree with them.
12. Copy every reference and every amount verbatim, exactly as printed, including a trailing zero where the invoice prints one. Every date is yyyy-mm-dd. `variance_minor` is an INTEGER in minor units.
13. Use the exact allowed value for a field that lists them, and return every field named in the schema for every line, even when the answer is null.
FUEL SURCHARGE SCHEDULE FSC-1 (the authority for `surcharge_status`; this is an ILLUSTRATIVE schedule shipped with this kit, not a carrier tariff, not a contract and not an authority)
THE LAG RULE
Take the shipment date. Step back to the most recent SUNDAY ON OR BEFORE it -- that is the shipment's own index week, and where the shipment moved on a Sunday it is that Sunday itself. Then step back a further `lag_weeks` whole weeks. The published row whose `week ending` equals that date is the applicable index row, and there is no other.
The invoice's own Contract Terms section. It is NOT the same on every contract in this corpus and it is not a constant in this file -- reading it off the wrong invoice is one of the ways to get every line on that invoice wrong at once.
THE SURCHARGE BASE
The surcharge base is the LINEHAUL CHARGE ALONE. Accessorial charges on the same line are never surcharged.
THE CONTRACT CAP
The invoice's Contract Terms may state a MAXIMUM SURCHARGE PERCENTAGE. Where the bracket percentage for the applicable index row exceeds it, the applicable percentage is the maximum.
ROUNDING
The recomputed surcharge is the linehaul amount multiplied by the applicable percentage, rounded HALF UP to the nearest minor unit. Billed within 1 minor unit(s) of that figure counts as matching.
RATE BASES
tariff, all_in
`tariff` means the linehaul is rated off the tariff and a fuel surcharge is due on it. `all_in` means the negotiated rate INCLUDES fuel, no index row applies to the line, and the correct billed surcharge is 0.00. A recomputation that applies a bracket percentage to every line reports a full shortfall on every all-in lane -- which is why the exempt-lane gate is first.
PUBLISHED INDEX SERIES IDX-1 -- ILLUSTRATIVE, NOT A REAL INDEX. One row per week ending on the Sunday named. A week with no row here was never published.
week ending 2025-10-26 published price 3.612
week ending 2025-11-02 published price 3.700
week ending 2025-11-09 published price 3.755
week ending 2025-11-16 published price 3.899
week ending 2025-11-23 published price 3.842
week ending 2025-11-30 published price 3.918
week ending 2025-12-07 published price 4.021
week ending 2025-12-14 published price 4.107
week ending 2025-12-21 published price 4.200
week ending 2025-12-28 published price 4.286
week ending 2026-01-11 published price 4.331
week ending 2026-01-18 published price 4.299
week ending 2026-01-25 published price 4.174
week ending 2026-02-01 published price 4.055
week ending 2026-02-08 published price 3.964
week ending 2026-02-15 published price 3.870
week ending 2026-02-22 published price 3.799
week ending 2026-03-01 published price 3.681
week ending 2026-03-08 published price 3.574
week ending 2026-03-15 published price 3.500
week ending 2026-03-22 published price 3.446
week ending 2026-03-29 published price 3.519
week ending 2026-04-05 published price 3.633
week ending 2026-04-12 published price 3.728
week ending 2026-04-19 published price 3.816
⚑ THE WEEK ENDING 2026-01-04 IS DELIBERATELY ABSENT. The table looks continuous either side of it. Reaching for the nearest published week is the obvious wrong move and it produces a confident, plausible, wrong number.
BRACKET TABLE -- the surcharge percentage for a published index price
from to pct
3.200 3.299 22.00
3.300 3.399 23.50
3.400 3.499 25.00
3.500 3.599 26.50
3.600 3.699 28.00
3.700 3.799 29.50
3.800 3.899 31.00
3.900 3.999 32.50
4.000 4.099 34.00
4.100 4.199 35.50
4.200 4.299 37.00
4.300 4.399 38.50
4.400 4.499 40.00
4.500 4.599 41.50
Each row covers a closed range of index prices and names the surcharge percentage for it. The ranges are contiguous and do not overlap, and a price on an edge belongs to the row that names it -- 3.799 is 29.50 pct and 3.800 is 31.00 pct. ⚠︎ ONE TABLE FOR EVERY LANE, SERVICE LEVEL AND EQUIPMENT TYPE is a simplification; a real carrier publishes several.
THE SIX GATES, IN ORDER. STOP AT THE FIRST THAT FIRES.
1. FUEL_EXEMPT_ALL_IN: The line's rate basis is `all_in`. The negotiated rate includes fuel and no index row applies. Where the billed surcharge is 0.00 the answer is `fuel_exempt_all_in`; where anything at all was billed the answer is `variance` for the whole billed amount.
why: FIRST, because an exempt lane has no applicable index row and every gate below would be recomputing from a basis that does not apply to the line. It is also the gate that decides both ways: a surcharge billed on an all-in lane is not a rounding argument, it is the whole amount.
2. NOT_DETERMINABLE: The shipment date, the linehaul amount or the billed surcharge is not recorded on the line; or the published series carries NO ROW for the week the lag rule selects.
why: On a recovery worklist the expensive mistake is a confident wrong `matches`. A week the publisher never issued is a record somebody has to open, not a line that can be cleared, and the nearest published week is not an answer -- it is a different number wearing the same name.
3. CAPPED_AT_MAXIMUM: The bracket percentage for the applicable index row EXCEEDS the contract maximum, and the billed amount equals the linehaul multiplied by that maximum, within the rounding tolerance.
why: This is the difference that is SUPPOSED to be there. It sits above the finding gates because a recomputation that reads the bracket and ignores the cap reports every capped line as an undercharge, and a worklist of undercharges is a worklist nobody opens twice.
4. WRONG_INDEX_WEEK: The billed amount does not match the recomputation, and it DOES reconcile -- within the rounding tolerance -- to the same computation run against at least one OTHER published week in the series.
why: ⚑ THE FINDING THIS KIT EXISTS FOR. The money is a real percentage from a real published row applied to the right base, so it lands inside any plausible band and nothing downstream of the arithmetic can see it. It is a different finding from a plain variance and it has a different conversation attached: the carrier can be shown the row it used and the row the contract selects.
5. VARIANCE: The billed amount does not match the recomputation and reconciles to no published week.
why: The percentage is off the schedule, the base was not the linehaul, the cap was ignored, or the figure is simply wrong. It is a finding, and unlike a wrong-week finding there is no row to point at.
6. MATCHES: Everything else: the billed amount equals the recomputation within the rounding tolerance.
why: Nothing needs doing. ⚠︎ AND NOTE WHAT THIS DOES NOT SAY. It does not say the carrier used the right index row -- see `carrier_basis_note`.
THE SIX STATUSES
matches, capped_at_maximum, fuel_exempt_all_in, wrong_index_week, variance, not_determinable
WHAT PUTS A LINE ON THE RECOVERY WORKLIST
wrong_index_week, variance -- The two statuses that put a line on somebody's recovery worklist. `matches`, `capped_at_maximum` and `fuel_exempt_all_in` are the three answers that mean nothing needs doing. `not_determinable` means the RECORD needs opening rather than the MONEY needing recovering, and it is deliberately not on the worklist for that reason.
THE VARIANCE
The billed surcharge minus the recomputed surcharge, in minor units. Positive means the carrier billed MORE than the schedule and the index support; negative means it billed less. Null where the recomputation cannot be run.
WHAT THIS TOOL WILL NOT DO
- It never adjusts, credits, re-rates or short-pays an invoice.
- It never approves, holds or releases a carrier payment.
- It never raises, sends or files a claim with a carrier.
- It never revises, interpolates or substitutes an index row the publisher did not issue.
- It never decides which of two index rows the contract binds you to.
Extract these fields:
INVOICE-LEVEL FIELDS -- one value each, for the whole invoice
- invoice_ref (string) -- the invoice reference, verbatim from the Invoice section
- invoice_date (date) -- the date the invoice was raised, from the Invoice Date section, as yyyy-mm-dd. It is NOT a shipment date and it selects no index row
- schedule_id (string) -- the identifier of the fuel surcharge schedule this invoice is rated under, from the Fuel Surcharge Schedule section, verbatim -- the short code only, not the sentence after it
- lag_weeks (integer) -- the number of WHOLE WEEKS of lag, read from the 'fuel surcharge lag' line of Contract Terms. An integer, so '2 week(s)' is 2. ⚠︎ IT IS NOT THE SAME ON EVERY CONTRACT IN THIS CORPUS -- read it off THIS invoice, and note that getting it wrong moves every line on the invoice at once
- max_surcharge_pct (decimal) -- the maximum surcharge percentage from the 'maximum surcharge' line of Contract Terms, copied exactly as printed, e.g. 32.00. It caps the bracket percentage; where the bracket is at or below it, it changes nothing
- carrier_remark (string) -- the carrier's own free-text remark from the Carrier Remarks section, copied verbatim. It is a field to copy and it is NOT evidence about whether any surcharge is right
PER-LINE FIELDS -- one object per row of Shipment Lines
- shipment_ref (string) -- the shipment reference as the Shipment Lines section states it, e.g. SHP-30012. Return one object per row of THAT section, in the order it lists them, and no others. The Fuel Surcharge As Billed section carries rows for shipments this invoice does not cover -- those are not yours
- shipment_date (date) -- the date the shipment moved, read after 'shipped' on the row in Shipment Lines, as yyyy-mm-dd. Return null where the row reads 'shipped -- not stated'. THIS IS THE DATE THE LAG RULE KEYS OFF, and it is not the invoice date
- linehaul_amount (decimal) -- the linehaul charge, read after 'linehaul' on the row in Shipment Lines. Copy the digits exactly as printed. Return null where the row reads 'linehaul -- not stated'. It is the ONLY base the surcharge is computed on -- the accessorial total on the same row is never surcharged
- rate_basis (enum) one of: tariff, all_in -- read after 'basis' on the row in Shipment Lines: 'tariff' where it reads 'basis tariff', and 'all_in' where it reads 'basis all-in'. An all-in rate INCLUDES fuel, so no index row applies to that line and 0.00 is the surcharge that is due on it
- carrier_index_price (decimal) -- the index price the CARRIER states it applied, from the Fuel Surcharge As Billed row for this shipment, after 'carrier index'. Return null where the row reads 'carrier index -- not applicable', and null where that section carries no row for this shipment. ⚠︎ IT IS WHAT THE CARRIER CLAIMS AND IT IS NOT NECESSARILY THE APPLICABLE ROW. Copy it, and never use it to answer index_price
- carrier_pct (decimal) -- the percentage the carrier states it applied, from the same row, after 'at' and before 'pct'. Return null where the row states no percentage and null where there is no row for this shipment. Copy it; it is a claim, not an authority
- billed_surcharge (decimal) -- the fuel surcharge actually billed on this shipment, from the same row, after 'billed fuel surcharge'. Return null where the row reads '-- not stated', and null where the Fuel Surcharge As Billed section carries NO ROW for this shipment at all. A missing row is not a surcharge of zero -- it is the answer, and it is what makes the line undeterminable
- index_week_ending (derived) -- THE APPLICABLE INDEX ROW, WORKED OUT -- no invoice states it. Take the shipment date, step back to the most recent SUNDAY ON OR BEFORE it (a shipment that moved on a Sunday uses that Sunday itself), then step back a further lag_weeks whole weeks. Answer that date as yyyy-mm-dd. Answer it for every line whose shipment date is stated, INCLUDING all-in lines. Return null only where the shipment date is not stated
- index_price (lookup) -- the price PUBLISHED for that week, looked up in the weekly index series given above. Copy it exactly as the series prints it, to three decimals. Return null where the series carries NO ROW for that week -- the nearest published week is not the answer, and neither is the carrier's own figure on the line
- applicable_pct (lookup) -- the bracket percentage for that published price, from the bracket table given above, capped at max_surcharge_pct where the bracket is ABOVE it. A price on a bracket edge belongs to the row that names it. Return null where there is no published price, and null on an all-in line
- recomputed_surcharge (derived) -- the linehaul amount multiplied by applicable_pct, rounded HALF UP to the minor unit, to two decimals. Return 0.00 on an all-in line, because the rate already includes fuel. Return null where the linehaul or the applicable percentage is not available
- variance_minor (derived) -- the billed surcharge MINUS the recomputed surcharge, in MINOR UNITS (hundredths). An integer, so a difference of 12.35 is 1235 and 0.00 is 0. Positive means the carrier billed MORE than the schedule and the index support. Return null where either amount is not available
- surcharge_status (enum) one of: matches, capped_at_maximum, fuel_exempt_all_in, wrong_index_week, variance, not_determinable -- this line's status under the shipped schedule. Work through six gates IN ORDER and stop at the first that fires. (1) EXEMPT LANE: the rate basis is all-in, so no index row applies -- 'fuel_exempt_all_in' where 0.00 was billed, 'variance' where anything was. (2) NOT DETERMINABLE: the shipment date, the linehaul or the billed surcharge is not recorded, or the series carries no row for the selected week. (3) CAPPED AT MAXIMUM: the bracket is above the contract maximum and the billed amount equals the linehaul times that maximum. (4) WRONG INDEX WEEK: the billed amount does not match the recomputation but does reconcile to the same computation against another PUBLISHED week. (5) VARIANCE: it does not match and reconciles to no published week. (6) Anything that survives all five is MATCHES. Never decide it from the Carrier Remarks note, and never from the carrier's own stated index or percentage
Return a JSON object of exactly this shape:
{"invoice_ref": ..., "invoice_date": ..., "schedule_id": ..., "lag_weeks": ..., "max_surcharge_pct": ..., "carrier_remark": ..., "lines": [{"shipment_ref": ..., "shipment_date": ..., "linehaul_amount": ..., "rate_basis": ..., "carrier_index_price": ..., "carrier_pct": ..., "billed_surcharge": ..., "index_week_ending": ..., "index_price": ..., "applicable_pct": ..., "recomputed_surcharge": ..., "variance_minor": ..., "surcharge_status": ...}, ...]}
Use null for any field the invoice does not state.
CARRIER FUEL INVOICE
--------------------
Invoice
-------
INV-1250-WZ
Invoice Date
------------
2026-03-14
Fuel Surcharge Schedule
-----------------------
FSC-1 -- illustrative, shipped with this kit; reproduces no real carrier tariff and no real published index
Contract Terms
--------------
fuel surcharge lag 1 week(s) -- whole weeks, stepped back from the shipment's own index week
maximum surcharge 32.00 pct
surcharge base linehaul charge only; accessorial charges are not surcharged
index series IDX-1, published weekly, each row covering the week ending on the Sunday named
Shipment Lines
--------------
amounts are in the trading currency's major unit; the index is stated to three decimals
SHP-30366 Depot 3 to Plant 4 shipped 2026-02-28 linehaul 3504.25 accessorials 160.75 basis tariff
SHP-30254 Depot 11 to DC 3 shipped 2026-02-22 linehaul 4170.75 accessorials 301.75 basis tariff
SHP-30881 DC 5 to Depot 3 shipped 2026-02-26 linehaul 2490.00 accessorials 0.00 basis tariff
SHP-30437 Plant 3 to Plant 1 shipped 2026-01-18 linehaul 2899.50 accessorials 188.75 basis tariff
SHP-30215 Depot 10 to DC 6 shipped 2026-02-23 linehaul 871.25 accessorials 0.00 basis tariff
SHP-30815 Depot 5 to DC 4 shipped 2026-02-25 linehaul 4678.00 accessorials 271.50 basis tariff
SHP-30101 DC 4 to Plant 3 shipped 2026-02-04 linehaul 4540.00 accessorials 0.00 basis tariff
SHP-30544 DC 6 to Port Gate 3 shipped 2026-01-14 linehaul 1123.50 accessorials 68.25 basis tariff
Fuel Surcharge As Billed
------------------------
SHP-80249 carrier index 4.299 at 32.00 pct billed fuel surcharge 1166.64
SHP-80240 carrier index 3.964 at 32.00 pct billed fuel surcharge 1471.36
SHP-30815 carrier index 3.870 at 31.00 pct billed fuel surcharge 1450.18
SHP-30101 carrier index 4.174 at 32.00 pct billed fuel surcharge 1452.80
SHP-30544 carrier index 4.055 at 32.00 pct billed fuel surcharge 359.52
SHP-30881 carrier index 3.964 at 32.00 pct billed fuel surcharge 796.80
SHP-30437 carrier index 4.331 at 38.50 pct billed fuel surcharge 1116.31
SHP-30215 carrier index 3.964 at 32.00 pct billed fuel surcharge 278.80
SHP-80270 carrier index 4.055 at 32.00 pct billed fuel surcharge 1290.80
SHP-30366 carrier index 3.964 at 32.00 pct billed fuel surcharge 1121.36
SHP-30254 carrier index 3.870 at 31.00 pct billed fuel surcharge 1292.93
Carrier Remarks
---------------
Consolidated fuel invoice for the period. Accessorials billed separately by lane.