{
  "name": "Closing one instrument repair ticket against the approved estimate",
  "page": "https://otherworldlabs.com/solo-instrument-repair-log/",
  "endpoint": "https://otherworldlabs.com/solo-instrument-repair-log/api.json",
  "question": "For one finished instrument repair ticket, what does the ticket come to once parts at cost, the tech's own markup, bench hours at the tech's own rate, a shop-supplies charge and the tax rate the tech entered on the lines they marked are added up, what is the balance after the deposit, and how far is the total from the figure the customer approved - in dollars, as a percent of that figure, and against the tech's own call-the-customer rule?",
  "answers": "one closed ticket at a time; the page keeps no history and this endpoint stores nothing",
  "version": "2026-10-11",
  "licence": "The arithmetic is not ours to license. Reuse the formulas; the page is free and needs no attribution.",
  "method": "static description plus a worked example; the same formulas run in the page in the reader's browser, with nothing a reader types sent anywhere: the page itself reports up to four anonymous counts of its own use (opened, anything first typed, offer reached, offer link clicked) and loads its type from Google's font hosts, and neither of those carries a figure or a word typed into the page",
  "currency": "whatever the figures are entered in; the page does no conversion and attaches no currency to a figure",
  "rounding": {
    "money": "two decimals by round2(x) = Math.round(x * 100) / 100 on the double. Math.round puts a half toward POSITIVE INFINITY rather than away from zero, so -0.125 comes out as -0.12 and not as -0.13, and 0.125 comes out as 0.13. Negative money is reachable here in two places - the signed difference columns and the balance due when the deposit is above the ticket total - so the behaviour at a negative half cent is part of the answer and not a curiosity. round2 is applied at the point each figure is defined and again to every sum, difference and product built out of figures already rounded, so no figure below is worked from a longer number than the one the page shows.",
    "percentages": "the variance percent is the one percentage this engine derives, and it is round1(x) = Math.round(x * 10) / 10 of (varianceDollars / approvedTotal x 100), computed from the ALREADY ROUNDED varianceDollars and the approvedTotal AS HELD to the range and the step the form offers - the two figures the page prints beside it. An earlier wording of this sentence said 'as typed', which contradicted the rest of the same sentence and the engine with it: an approved total pasted as 185.004 is held to 185.00 and the percent is worked from 185.00, which is the figure printed beside it (round 2 of the review, R2-M1). Math.round again puts a half toward positive infinity, so a quotient of -1.25 prints as -1.2 and not as -1.3. The other percentages this endpoint returns (partsMarkupPct, taxRatePct, thresholdPct) are not derived: they are the figures the reader typed, held to the step the form offers.",
    "counts": "ticketNumber, partsCount and each line's quantity are whole: a typed fraction is rounded to the nearest whole by Math.round (a half toward positive infinity) and the page prints both the figure typed and the figure used. benchHours is held to the nearest quarter hour the same way.",
    "ranges_and_steps": "every typed figure is first held to the range and the step the form offers, by w = Math.round(v / step) * step, then to six decimals to clear the binary dust, then clamped into [low, high]. Where the held figure differs from the figure typed, the page prints a line saying both and this endpoint returns the held figure. The ranges are in `inputs` below and they are the ranges the page's own controls offer."
  },
  "blank_is_not_zero": "Eight inputs have a blank state that is not the figure zero, and the difference changes what is printed. ticketNumber blank means the ticket is not numbered yet: ticketNumber comes back null and the two printed stubs say so in words instead of printing a number. partsCount blank is not a count of zero: with no count the endpoint reads every parts line the request carries, up to the eight the form offers, and the form itself always sends one of its own values. approvedTotal blank means NO APPROVED FIGURE IS ON THIS TICKET: every variance figure and the call-the-customer flag are withheld rather than computed against nothing, and the ticket total, the balance due and the bench hours each print IN THE GLANCE with an asterisk saying they are measured against nothing - in the glance and nowhere else: the printable ticket prints the ticket total and the claim check the balance due with no asterisk on either, because the key that explains the mark sits on screen with the glance and not on the sheet a customer takes away, and a mark whose key is not on the same sheet explains nothing (round 3 of the review, R3-M2). approvedTotal of zero is an approved figure of nothing: the dollar variance is computed against it and the variance PERCENT is withheld, because there is no denominator. approvedParts and approvedLabour blank mean the quote was written as one number, and the parts and labour rows of the table then carry no approved figure and no difference. partsMarkupPct blank means no markup rule of yours, so none is added and the page offers no figure in its place; a markup of zero is a rule of zero. thresholdDollars and thresholdPct blank mean no call-the-customer rule, so no flag is printed at all. Four more inputs - hours, ratePerHour, shopSupplies and each parts line's cost - read as zero when blank for every figure they feed, and blank on all four at once is the one thing they are read for separately: it is what hasWork is false on, below.",
  "inputs": [
    {
      "name": "ticketNumber",
      "type": "integer",
      "unit": "the ticket's own number",
      "required": false,
      "range": "1 to 99999, whole",
      "note": "The next number in the tech's own pad or book. Blank is allowed and returns null; the printable stub then says the ticket is not numbered yet. It is never generated here. No money figure is computed from it either, and it is one of the five name fields isExample compares with the shipped example's, so it is read by that test like the other four (R3-B1)."
    },
    {
      "name": "instrument",
      "type": "string",
      "unit": "none",
      "required": false,
      "note": "Free text, as written at intake. Whitespace is collapsed and it is cut at 60 characters. It is printed back on the stub and the claim check, and NO MONEY FIGURE IS COMPUTED FROM IT. It is read by exactly one test, and the three outputs that test decides are the most visible thing this endpoint returns: it is one of the five name fields isExample compares with the shipped example's, so changing it alone - with every figure still the example's - returns isExample false, withheld true and withheldReason 'every figure on it is still the example's', and the page built on this endpoint then dashes every computed figure it would otherwise print. See outputs isExample, withheld and withheldReason. An earlier wording of this note said the field 'is read by no calculation', which was true of the money arithmetic and false of the endpoint as a whole, and a reimplementation written from it disagreed with the page on three of the thirty-six fields (round 3 of the review, R3-B1)."
    },
    {
      "name": "customerRef",
      "type": "string",
      "unit": "none",
      "required": false,
      "note": "Free text, as written at intake, cut at 60 characters. This is all the page ever holds of a customer name, telephone number or serial, and no field asks for any of the three by name. NO MONEY FIGURE IS COMPUTED FROM IT, and like instrument it is one of the five name fields isExample compares with the shipped example's, so changing it alone decides isExample, withheld and withheldReason and so whether any figure is printed at all. See outputs isExample, withheld and withheldReason. An earlier wording of this note said 'Read by no calculation' (round 3 of the review, R3-B1)."
    },
    {
      "name": "dateIn",
      "type": "string",
      "unit": "none",
      "required": false,
      "note": "Free text, cut at 12 characters; the tech's own bench record. No date arithmetic is done anywhere here, and no money figure is computed from it; it is one of the five name fields isExample compares with the shipped example's (R3-B1)."
    },
    {
      "name": "dateFinished",
      "type": "string",
      "unit": "none",
      "required": false,
      "note": "Free text, cut at 12 characters. No date arithmetic is done anywhere here, and no money figure is computed from it; it is the fifth of the name fields isExample compares with the shipped example's (R3-B1)."
    },
    {
      "name": "approvedTotal",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 20000, step 0.01",
      "note": "The total written on the ticket when the customer agreed to the work. Blank and zero are different states; see `blank_is_not_zero`."
    },
    {
      "name": "approvedParts",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 20000, step 0.01",
      "note": "Only where the tech wrote the quote in two parts. Blank means they did not. Nothing here checks it against approvedTotal and nothing back-solves one from the other."
    },
    {
      "name": "approvedLabour",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 20000, step 0.01",
      "note": "The other half of a quote written in two parts. The parts and labour rows of the table carry a difference only when BOTH of these are given."
    },
    {
      "name": "partsCount",
      "type": "integer",
      "unit": "parts lines",
      "required": false,
      "range": "0 to 8, whole",
      "note": "How many of the eight parts lines the form offers are live. A caller who leaves it out has every line the request carries read, up to eight; a value above eight is held at eight and a value below nothing at nothing. Only the first partsCount entries of parts[] are read, so every sum over parts below is a sum over those lines and not over every entry the request carries."
    },
    {
      "name": "parts[].desc",
      "type": "string",
      "unit": "none",
      "required": false,
      "note": "Label only; whitespace collapsed, cut at 40 characters, and replaced by 'Part n' when blank. Read by no calculation."
    },
    {
      "name": "parts[].cost",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 2000, step 0.01",
      "note": "What the supplier invoiced for ONE of this part, before any markup. Blank reads as nothing."
    },
    {
      "name": "parts[].qty",
      "type": "integer",
      "unit": "of them",
      "required": false,
      "range": "1 to 99, whole",
      "note": "How many of that part the ticket used. BLANK READS AS ONE, which is the state the form reaches when a cost is typed and the quantity box is left empty, and it is why a line may also be given as a bare number: a parts entry that is a number or a numeric string is read as that line's cost each with a quantity of one. A typed zero is held at the form's own floor of one and the page says so."
    },
    {
      "name": "partsMarkupPct",
      "type": "number",
      "unit": "per cent",
      "required": false,
      "range": "0 to 200, whole",
      "note": "The tech's own markup rule on parts. No default and no suggestion is made here or on the page. Blank and zero are different states; see `blank_is_not_zero`."
    },
    {
      "name": "hours",
      "type": "number",
      "unit": "hours",
      "required": false,
      "range": "0 to 60, step 0.25",
      "note": "Bench hours on this ticket, from the tech's own time log. Held to the nearest quarter hour."
    },
    {
      "name": "ratePerHour",
      "type": "number",
      "unit": "money an hour",
      "required": false,
      "range": "0 to 500, whole dollars",
      "note": "The tech's own hourly rate. No default and no suggestion is made here or on the page."
    },
    {
      "name": "shopSupplies",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 500, step 0.01",
      "note": "A shop-supplies charge the tech sets. It is never a percentage of anything here."
    },
    {
      "name": "taxParts",
      "type": "boolean",
      "unit": "none",
      "required": false,
      "note": "Whether the parts-charged figure is one of the lines the tech marks taxable. Accepted as true, 1, '1', 'yes' or 'on'; anything else, including absent, reads as not marked. Which lines are taxable is the tech's call and their state's, and nothing here states a rule about it."
    },
    {
      "name": "taxLabour",
      "type": "boolean",
      "unit": "none",
      "required": false,
      "note": "Whether labour is one of the lines the tech marks taxable. Whether labour is taxable where the tech works is a question for them and their state; this endpoint has no opinion and applies only the mark given."
    },
    {
      "name": "taxSupplies",
      "type": "boolean",
      "unit": "none",
      "required": false,
      "note": "Whether the shop-supplies charge is one of the lines the tech marks taxable."
    },
    {
      "name": "taxRatePct",
      "type": "number",
      "unit": "per cent",
      "required": false,
      "range": "0 to 15, step 0.001",
      "note": "The one rate the tech enters for where they work, applied only to the lines they marked. No rate is suggested, looked up or defaulted. Blank reads as nothing, and a rate of nothing returns a tax of nothing."
    },
    {
      "name": "deposit",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 20000, step 0.01",
      "note": "What was already taken, off the ticket. A deposit above the ticket total returns a NEGATIVE balanceDue, which is a refund owed rather than money due. Of the ticket's own money figures - partsAtCost, partsCharged, labourCharge, shopSupplies, taxAmount, ticketTotal and balanceDue - it is the only one that can come out below nothing, and gates.json's sign rules are written on exactly that reading. The signed difference columns (varianceDollars, partsVarianceDollars, labourVarianceDollars) and headroomDollars are not figures of that class: they are steps between two figures and they are signed by design. An earlier wording of this note claimed the uniqueness over every figure on the page rather than over that class, which contradicted rounding.money in this same file, where the two places negative money is reachable are named (round 4 of the review, R4-B3)."
    },
    {
      "name": "thresholdDollars",
      "type": "number",
      "unit": "money",
      "required": false,
      "range": "0 to 2000, whole dollars",
      "note": "The tech's own rule: call the customer once the ticket runs this far past the approved figure. Blank means no dollar rule. No figure is suggested."
    },
    {
      "name": "thresholdPct",
      "type": "number",
      "unit": "per cent",
      "required": false,
      "range": "0 to 100, whole",
      "note": "The same rule said as a percent of the approved figure. Either or both may be given; blank means no percent rule. No figure is suggested."
    }
  ],
  "outputs": [
    {
      "name": "ticketNumber",
      "unit": "the ticket's own number",
      "formula": "the figure typed, held to 1 to 99999 and whole; null when blank"
    },
    {
      "name": "partsLinesCounted",
      "unit": "parts lines",
      "formula": "partsCount held to 0 to 8 and whole; where partsCount is blank, the number of entries parts[] carries, held to 8"
    },
    {
      "name": "partsAtCost",
      "unit": "money",
      "formula": "the running sum over the first partsLinesCounted lines of round2(cost x qty), each line rounded before it is added and the running sum rounded again at every line"
    },
    {
      "name": "partsMarkupPct",
      "unit": "per cent",
      "formula": "the markup rule typed, held to 0 to 200 and whole; null when blank"
    },
    {
      "name": "markupAmount",
      "unit": "money",
      "formula": "round2(partsAtCost x partsMarkupPct / 100); exactly nothing when partsMarkupPct is null, because no markup rule means none is added"
    },
    {
      "name": "partsCharged",
      "unit": "money",
      "formula": "round2(partsAtCost + markupAmount)"
    },
    {
      "name": "benchHours",
      "unit": "hours",
      "formula": "the hours typed, held to 0 to 60 and to the nearest quarter"
    },
    {
      "name": "ratePerHour",
      "unit": "money an hour",
      "formula": "the rate typed, held to 0 to 500 and whole"
    },
    {
      "name": "labourCharge",
      "unit": "money",
      "formula": "round2(benchHours x ratePerHour)"
    },
    {
      "name": "shopSupplies",
      "unit": "money",
      "formula": "the charge typed, held to 0 to 500 and to the cent"
    },
    {
      "name": "taxableSubtotal",
      "unit": "money",
      "formula": "round2 of the sum of the lines marked taxable: partsCharged where taxParts, labourCharge where taxLabour, shopSupplies where taxSupplies, and nothing for a line that is not marked"
    },
    {
      "name": "taxRatePct",
      "unit": "per cent",
      "formula": "the rate typed, held to 0 to 15 and three decimals"
    },
    {
      "name": "taxAmount",
      "unit": "money",
      "formula": "round2(taxableSubtotal x taxRatePct / 100)"
    },
    {
      "name": "ticketTotal",
      "unit": "money",
      "formula": "round2(partsCharged + labourCharge + shopSupplies + taxAmount)"
    },
    {
      "name": "deposit",
      "unit": "money",
      "formula": "the deposit typed, held to 0 to 20000 and to the cent"
    },
    {
      "name": "balanceDue",
      "unit": "money",
      "formula": "round2(ticketTotal - deposit); returned negative where the deposit is above the ticket total, which is a refund owed"
    },
    {
      "name": "approvedTotal",
      "unit": "money",
      "formula": "the approved total typed, held to 0 to 20000 and to the cent; null when blank, and null is what withholds every variance figure below"
    },
    {
      "name": "approvedParts",
      "unit": "money",
      "formula": "the approved parts figure typed, held the same way; null when blank"
    },
    {
      "name": "approvedLabour",
      "unit": "money",
      "formula": "the approved labour figure typed, held the same way; null when blank"
    },
    {
      "name": "varianceDollars",
      "unit": "money",
      "formula": "round2(ticketTotal - approvedTotal); SIGNED, negative where the ticket closed inside the approved figure; null when approvedTotal is null"
    },
    {
      "name": "variancePct",
      "unit": "per cent",
      "formula": "round1(varianceDollars / approvedTotal x 100), worked from the already rounded varianceDollars; signed, and NOT bounded to 0 to 100 - a ticket at more than twice its approved figure is over 100% and one inside it is negative. null when approvedTotal is null OR when approvedTotal is exactly nothing, because there is then no denominator. The value returned here is the figure; the page built on this endpoint prints it AT ONE DECIMAL in every state, trailing zero and all, so 1.95 prints as 2.0% and -100 as -100.0% rather than as 2% and -100% beside another ticket's 2.4% (round 3 of the review, R3-M5). The figure is unchanged by that: one decimal is the precision round1 leaves it at"
    },
    {
      "name": "partsVarianceDollars",
      "unit": "money",
      "formula": "round2(partsCharged - approvedParts); signed; null unless BOTH approvedParts and approvedLabour are given, because a quote written as one number carries no approved parts figure and nothing here invents one"
    },
    {
      "name": "labourVarianceDollars",
      "unit": "money",
      "formula": "round2(labourCharge - approvedLabour); signed; null on the same condition as partsVarianceDollars"
    },
    {
      "name": "thresholdDollars",
      "unit": "money",
      "formula": "the dollar rule typed, held to 0 to 2000 and whole; null when blank"
    },
    {
      "name": "thresholdPct",
      "unit": "per cent",
      "formula": "the percent rule typed, held to 0 to 100 and whole; null when blank"
    },
    {
      "name": "percentRuleDollars",
      "unit": "money",
      "formula": "round2(approvedTotal x thresholdPct / 100): the percent rule said in dollars. null when approvedTotal is null or thresholdPct is null"
    },
    {
      "name": "bindingAllowanceDollars",
      "unit": "money",
      "formula": "the smaller of thresholdDollars and percentRuleDollars where both exist, and whichever exists where only one does; null when neither does"
    },
    {
      "name": "boundBy",
      "unit": "none",
      "formula": "'the dollar rule' where thresholdDollars is below percentRuleDollars, 'the percent rule' where percentRuleDollars is below thresholdDollars, 'both rules at once' where the two are equal, and whichever of the two exists where only one does; null when neither does. It is a string, not a figure"
    },
    {
      "name": "thresholdFired",
      "unit": "none",
      "formula": "true where varianceDollars EXCEEDS thresholdDollars, or exceeds percentRuleDollars, or both; false otherwise and false whenever approvedTotal is null. A variance exactly equal to the allowance does not fire it: the rule is strictly past, not at"
    },
    {
      "name": "headroomDollars",
      "unit": "money",
      "formula": "round2(bindingAllowanceDollars - varianceDollars); SIGNED, so it is negative once the flag has fired and that negative is how far past the allowance the ticket reached. null when approvedTotal is null or no rule is set"
    },
    {
      "name": "closing",
      "unit": "one of four",
      "formula": "4 where approvedTotal is null; else 3 where thresholdFired; else 2 where varianceDollars is above nothing; else 1. The four are the four closings the page tells apart, in that order of precedence"
    },
    {
      "name": "closingName",
      "unit": "none",
      "formula": "'no-approved-figure' for closing 4, 'over-rule' for 3, 'over-inside-rule' for 2, 'inside' for 1. A string, not a figure"
    },
    {
      "name": "hasWork",
      "unit": "true or false",
      "formula": "true where ANY ONE of hours, ratePerHour, shopSupplies or a cost on one of the parts lines the count makes live is not blank; false where all four are blank. A TYPED ZERO IS NOT BLANK: a warranty job booked at no charge has a figure on it and hasWork is true. Only the parts lines inside partsCount are read, which is the same rule partsAtCost follows"
    },
    {
      "name": "isExample",
      "unit": "true or false",
      "formula": "true where the request carries, figure for figure, the worked ticket the page ships in its own fields AND carries that ticket's own name: the ticket is published below as example.inputs. THE FIGURES, and this is the whole list: approvedTotal, approvedParts, approvedLabour, partsCount, partsMarkupPct, hours, ratePerHour, shopSupplies, taxRatePct, deposit, thresholdDollars, thresholdPct, the three taxable marks taxParts, taxLabour and taxSupplies, and the cost and the quantity of each of the parts lines partsCount makes live. THE NAME, and this is the whole of it: ticketNumber, instrument, customerRef, dateIn, dateFinished. NOTHING ELSE IS READ - parts[].desc is a label no calculation reads, and a parts line outside the live count feeds no figure - so neither a retyped part label nor a costed line left outside the count can make the example's figures somebody else's (round 2 of the review, R2-B1 and R2-B2: with labels compared, typing one part name over the example's cancelled the withholding on a ticket the reader had already numbered). Figures are compared at six decimals AS THE REQUEST CARRIES THEM, not after holding to the form's step, so 185 and 185.00 are the same figure while an approved total of 185.004 - which holds to the example's 185.00 - is the reader's own figure and not the example's; a blank is the same only as a blank. Of the five name fields, ticketNumber is compared as a figure, at six decimals exactly like the list above (so 1042 and 1042.0 are the same ticket and a blank is the same only as a blank); the other four - instrument, customerRef, dateIn, dateFinished - are compared as text, trimmed, whitespace collapsed, at 60 characters (REVIEW-closing.md M2: an earlier wording of this sentence said the name is compared as text without carving out the one of the five that is a number). The page uses it for one thing: while it is true the figures on the page are the page's own example and the page says so over them"
    },
    {
      "name": "withheld",
      "unit": "true or false",
      "formula": "true where withheldReason is not null, false where it is null. Where it is true the PAGE prints no ticket total, no balance due, no variance in dollars or in percent, no closing and no table cell of its own: every one of them is dashed, because none of them is about a repair anybody has typed. The figures in this endpoint's own reply are still computed from whatever the request carried; withheld says what the page does with them"
    },
    {
      "name": "withheldReason",
      "unit": "none",
      "formula": "null on a ticket of the reader's own; \"every figure on it is still the example's\" where every figure in the request is the shipped example's and the ticket's number, instrument, reference or dates are not, which is the state a visitor reaches by filling the first input block and reading on; \"no work is entered on it\" where hasWork is false. WHICH INPUTS ARE FIGURES AND WHICH ARE THE NAME is the two lists isExample names above, and a parts label is in neither of them: a reader who types their own part name over the example's has typed no figure, so this reason still fires (round 2 of the review, R2-M2 asked for the split to be named here rather than left to be inferred). The example's own state, with both halves shipped, is NOT a withheld state: it is the worked example and isExample says so. A string, not a figure"
    }
  ],
  "formula": [
    "every typed figure is first held to its range and its step: w = Math.round(v / step) * step, rounded to six decimals, then clamped into [low, high]; a blank figure is either the range's low or null, and which of the two is per input in `blank_is_not_zero`",
    "for each of the first partsLinesCounted lines: lineCost = round2(cost x qty), with a blank qty read as 1",
    "partsAtCost = the running sum of those lineCosts, rounded to the cent at every step",
    "markupAmount = round2(partsAtCost x partsMarkupPct / 100), or exactly 0 where partsMarkupPct is null",
    "partsCharged = round2(partsAtCost + markupAmount)",
    "labourCharge = round2(benchHours x ratePerHour)",
    "taxableSubtotal = round2((taxParts ? partsCharged : 0) + (taxLabour ? labourCharge : 0) + (taxSupplies ? shopSupplies : 0))",
    "taxAmount = round2(taxableSubtotal x taxRatePct / 100)",
    "ticketTotal = round2(partsCharged + labourCharge + shopSupplies + taxAmount)",
    "balanceDue = round2(ticketTotal - deposit)",
    "varianceDollars = round2(ticketTotal - approvedTotal), withheld as null where approvedTotal is null",
    "variancePct = round1(varianceDollars / approvedTotal x 100), withheld as null where approvedTotal is null or exactly 0",
    "partsVarianceDollars = round2(partsCharged - approvedParts) and labourVarianceDollars = round2(labourCharge - approvedLabour), both withheld as null unless approvedParts AND approvedLabour are both given",
    "percentRuleDollars = round2(approvedTotal x thresholdPct / 100), withheld as null where either is null",
    "bindingAllowanceDollars = the lesser of thresholdDollars and percentRuleDollars, and boundBy names which; where only one of the two exists it is that one",
    "thresholdFired = varianceDollars > thresholdDollars OR varianceDollars > percentRuleDollars, over whichever of the two exists, and false where approvedTotal is null",
    "headroomDollars = round2(bindingAllowanceDollars - varianceDollars)",
    "closing = 4 if approvedTotal is null, else 3 if thresholdFired, else 2 if varianceDollars > 0, else 1"
  ],
  "identities": [
    "ticketTotal equals partsCharged + labourCharge + shopSupplies + taxAmount, and the page prints that sum as its own expression",
    "partsCharged equals partsAtCost + markupAmount",
    "varianceDollars equals ticketTotal - approvedTotal wherever approvedTotal is given, and the table's ticket-total difference cell is that same figure",
    "headroomDollars equals bindingAllowanceDollars - varianceDollars, so thresholdFired is true exactly where headroomDollars is below nothing",
    "no ticket, split or not, carries an approved shop-supplies figure or an approved tax figure: there is no input for either and no output derives one. The table's approved and difference cells for those two rows are dashed in every state",
    "all of these are asserted by the page's own test harness over the whole generated sweep"
  ],
  "example": {
    "note": "the ticket the page ships filled in, so this endpoint and the page answer with the same figures",
    "inputs": {
      "ticketNumber": 1042,
      "instrument": "Yamaha YAS-23 alto sax",
      "customerRef": "intake slip 1042",
      "dateIn": "2026-09-28",
      "dateFinished": "2026-10-06",
      "approvedTotal": 185,
      "approvedParts": 45,
      "approvedLabour": 140,
      "partsCount": 2,
      "parts": [
        {
          "desc": "neck cork and pad set",
          "cost": 18.4,
          "qty": 1
        },
        {
          "desc": "G# key spring",
          "cost": 2.75,
          "qty": 2
        }
      ],
      "partsMarkupPct": 30,
      "hours": 2.5,
      "ratePerHour": 60,
      "shopSupplies": 6,
      "taxParts": true,
      "taxLabour": false,
      "taxSupplies": true,
      "taxRatePct": 6.5,
      "deposit": 50,
      "thresholdDollars": 40,
      "thresholdPct": 15
    },
    "outputs": {
      "ticketNumber": 1042,
      "partsLinesCounted": 2,
      "partsAtCost": 23.9,
      "partsMarkupPct": 30,
      "markupAmount": 7.17,
      "partsCharged": 31.07,
      "benchHours": 2.5,
      "ratePerHour": 60,
      "labourCharge": 150,
      "shopSupplies": 6,
      "taxableSubtotal": 37.07,
      "taxRatePct": 6.5,
      "taxAmount": 2.41,
      "ticketTotal": 189.48,
      "deposit": 50,
      "balanceDue": 139.48,
      "approvedTotal": 185,
      "approvedParts": 45,
      "approvedLabour": 140,
      "varianceDollars": 4.48,
      "variancePct": 2.4,
      "partsVarianceDollars": -13.93,
      "labourVarianceDollars": 10,
      "thresholdDollars": 40,
      "thresholdPct": 15,
      "percentRuleDollars": 27.75,
      "bindingAllowanceDollars": 27.75,
      "boundBy": "the percent rule",
      "thresholdFired": false,
      "headroomDollars": 23.27,
      "closing": 2,
      "closingName": "over-inside-rule",
      "hasWork": true,
      "isExample": true,
      "withheld": false,
      "withheldReason": null
    }
  },
  "not_covered": [
    "Whether the figures are right. Every rate, markup, supplies charge, tax rate and threshold here is typed by the reader; nothing is suggested, looked up or defaulted, and no figure is checked against a market, a schedule or a published rate.",
    "Sales tax, beyond applying the one rate given to the lines marked. Which lines are taxable, whether labour is taxable where the reader works, and what the rate is are matters of their own state's law. Nothing here states a tax rule.",
    "What may be done with an instrument nobody collects. Abandoned-property and repairer's-lien rules are state law; the page asks the question and the kit poses it as a decision for the reader, and neither answers it.",
    "Any written-estimate or consumer-protection duty: whether an estimate had to be in writing, whether an overage needed approval before the work was done, and what notice was required. State law again, and not stated here.",
    "Anything about the instrument. There is no condition, no valuation, no insurance figure and no judgement about whether the work was the right work.",
    "Invoicing, payment, refunds, card fees, discounts, multiple deposits and part payments. One deposit figure goes in and one balance comes out.",
    "Dates, beyond printing the two given back on the stub. No turnaround, no age, no overdue figure and no days-on-the-bench count is computed anywhere here.",
    "Any history. One ticket at a time; the page stores nothing between visits and this endpoint holds nothing at all."
  ],
  "no_advice": "This endpoint returns arithmetic on figures supplied to it. It recommends no rate, no markup, no supplies charge, no tax rate, no deposit and no threshold, it makes no comparative against a paper pad or any named software, and it is not legal, tax, financial or business advice."
}
