{
  "schemaVersion": 1,
  "fixtureId": "restaurant-procure-to-pay-v1",
  "kit": "restaurant-food-truck",
  "asOf": "2026-09-08",
  "currency": "CAD",
  "taxName": "GST",
  "taxRate": "0.05",
  "moneyFormat": "Every monetary value below is a decimal string with exactly two places.",
  "documentCounts": {
    "priceListRows": 48,
    "purchaseOrders": 4,
    "purchaseOrderLines": 12,
    "goodsReceivedNotes": 4,
    "goodsReceivedLines": 12,
    "invoiceDocuments": 5,
    "distinctInvoiceNumbers": 4,
    "invoiceLines": 14,
    "creditNotes": 2,
    "statements": 2,
    "remittanceLines": 13,
    "threeWayMatchRows": 14
  },
  "priceList": {
    "suppliers": [
      "SUP-01",
      "SUP-02"
    ],
    "items": [
      "ING-01",
      "ING-02",
      "ING-03",
      "ING-04",
      "ING-05",
      "ING-06"
    ],
    "effectiveDates": [
      "2026-08-05",
      "2026-08-12",
      "2026-08-19",
      "2026-08-26"
    ],
    "contractTierMinQuantity": 250,
    "contractTierReachedByAnyOrder": false
  },
  "purchaseOrders": [
    {
      "poNumber": "PO-TRK-1001",
      "poDate": "2026-08-05",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "187.70",
      "taxTotal": "9.38",
      "grossTotal": "197.08"
    },
    {
      "poNumber": "PO-TRK-1002",
      "poDate": "2026-08-12",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "99.36",
      "taxTotal": "4.97",
      "grossTotal": "104.33"
    },
    {
      "poNumber": "PO-TRK-1003",
      "poDate": "2026-08-19",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "65.85",
      "taxTotal": "3.30",
      "grossTotal": "69.15"
    },
    {
      "poNumber": "PO-TRK-1004",
      "poDate": "2026-08-26",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "135.66",
      "taxTotal": "6.79",
      "grossTotal": "142.45"
    }
  ],
  "goodsReceived": [
    {
      "grnNumber": "GRN-TRK-2001",
      "poNumber": "PO-TRK-1001",
      "orderedQuantity": 57,
      "deliveredQuantity": 57,
      "returnedQuantity": 0,
      "acceptedQuantity": 57,
      "lineStatuses": [
        "received in full",
        "received in full",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-TRK-2002",
      "poNumber": "PO-TRK-1002",
      "orderedQuantity": 72,
      "deliveredQuantity": 68,
      "returnedQuantity": 0,
      "acceptedQuantity": 68,
      "lineStatuses": [
        "received in full",
        "short delivery",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-TRK-2003",
      "poNumber": "PO-TRK-1003",
      "orderedQuantity": 96,
      "deliveredQuantity": 96,
      "returnedQuantity": 0,
      "acceptedQuantity": 96,
      "lineStatuses": [
        "received in full",
        "substituted",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-TRK-2004",
      "poNumber": "PO-TRK-1004",
      "orderedQuantity": 75,
      "deliveredQuantity": 75,
      "returnedQuantity": 3,
      "acceptedQuantity": 72,
      "lineStatuses": [
        "received in full",
        "received in full",
        "part returned"
      ]
    }
  ],
  "invoices": [
    {
      "invoiceNumber": "INV-TRK-5001",
      "invoiceDate": "2026-08-07",
      "dueDate": "2026-09-06",
      "supplierId": "SUP-01",
      "poNumber": "PO-TRK-1001",
      "grnNumber": "GRN-TRK-2001",
      "lines": 3,
      "netTotal": "187.70",
      "lineTaxSum": "9.38",
      "documentLevelTax": "9.39",
      "statedTaxTotal": "9.38",
      "totalDue": "197.08",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-TRK-5002",
      "invoiceDate": "2026-08-14",
      "dueDate": "2026-09-13",
      "supplierId": "SUP-02",
      "poNumber": "PO-TRK-1002",
      "grnNumber": "GRN-TRK-2002",
      "lines": 3,
      "netTotal": "99.36",
      "lineTaxSum": "4.97",
      "documentLevelTax": "4.97",
      "statedTaxTotal": "4.97",
      "totalDue": "104.33",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-TRK-5003",
      "invoiceDate": "2026-08-21",
      "dueDate": "2026-09-20",
      "supplierId": "SUP-01",
      "poNumber": "PO-TRK-1003",
      "grnNumber": "GRN-TRK-2003",
      "lines": 3,
      "netTotal": "24.25",
      "lineTaxSum": "1.22",
      "documentLevelTax": "1.21",
      "statedTaxTotal": "1.23",
      "totalDue": "25.48",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-TRK-5004",
      "invoiceDate": "2026-08-28",
      "dueDate": "2026-09-27",
      "supplierId": "SUP-02",
      "poNumber": "PO-TRK-1004",
      "grnNumber": "GRN-TRK-2004",
      "lines": 3,
      "netTotal": "135.66",
      "lineTaxSum": "6.79",
      "documentLevelTax": "6.78",
      "statedTaxTotal": "6.79",
      "totalDue": "142.45",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-TRK-5002",
      "invoiceDate": "2026-08-17",
      "dueDate": "2026-09-16",
      "supplierId": "SUP-02",
      "poNumber": "PO-TRK-1002",
      "grnNumber": "GRN-TRK-2002",
      "lines": 2,
      "netTotal": "45.84",
      "lineTaxSum": "2.29",
      "documentLevelTax": "2.29",
      "statedTaxTotal": "2.29",
      "totalDue": "48.13",
      "usesDuplicateNumber": true
    }
  ],
  "creditNotes": [
    {
      "creditNoteNumber": "CN-TRK-7001",
      "againstInvoiceNumber": "INV-TRK-5002",
      "creditedQuantity": 4,
      "netTotal": "8.92",
      "taxTotal": "0.45",
      "grossTotal": "9.37",
      "overCreditedUnits": 0
    },
    {
      "creditNoteNumber": "CN-TRK-7002",
      "againstInvoiceNumber": "INV-TRK-5004",
      "creditedQuantity": 5,
      "netTotal": "1.05",
      "taxTotal": "0.05",
      "grossTotal": "1.10",
      "overCreditedUnits": 2
    }
  ],
  "statements": [
    {
      "statementNumber": "STM-TRK-6001",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-01",
      "rows": 5,
      "closingBalance": "547.74",
      "declaredAgeing": {
        "current": "222.56",
        "31-60": "137.96",
        "61-90": "108.39",
        "90-plus": "78.83"
      },
      "trueAgeing": {
        "current": "222.56",
        "31-60": "137.96",
        "61-90": "108.39",
        "90-plus": "78.83"
      },
      "declaredAgeingSum": "547.74",
      "ageingDifference": "0.00",
      "omittedFromAgeing": null
    },
    {
      "statementNumber": "STM-TRK-6002",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-02",
      "rows": 8,
      "closingBalance": "472.24",
      "declaredAgeing": {
        "current": "293.81",
        "31-60": "78.25",
        "61-90": "62.60",
        "90-plus": "46.95"
      },
      "trueAgeing": {
        "current": "284.44",
        "31-60": "78.25",
        "61-90": "62.60",
        "90-plus": "46.95"
      },
      "declaredAgeingSum": "481.61",
      "ageingDifference": "9.37",
      "omittedFromAgeing": "CN-TRK-7001"
    }
  ],
  "remittance": {
    "remittanceNumber": "REM-TRK-8001",
    "paymentDate": "2026-09-05",
    "remittanceTotal": "635.20",
    "withheldTotal": "384.78",
    "statementsClosingTotal": "1019.98",
    "reconciliation": "remittanceTotal + withheldTotal == statementsClosingTotal",
    "paidDocuments": [
      "OPN-TRK-9001",
      "OPN-TRK-9002",
      "INV-TRK-5001",
      "OPN-TRK-9004",
      "OPN-TRK-9005",
      "INV-TRK-5004",
      "CN-TRK-7002"
    ],
    "withheldDocuments": [
      "OPN-TRK-9003",
      "INV-TRK-5003",
      "OPN-TRK-9006",
      "INV-TRK-5002",
      "INV-TRK-5002",
      "CN-TRK-7001"
    ]
  },
  "threeWayMatch": {
    "rows": 14,
    "matchedRows": 9,
    "exceptionRows": 5,
    "resultCounts": {
      "duplicate-invoice-number": 2,
      "item-substituted": 1,
      "matched": 9,
      "matched-credit-expected": 1,
      "quantity-variance": 1
    }
  },
  "costingTraps": {
    "purchaseOrderNetAtListPrice": "488.57",
    "purchaseOrderNetIfContractTierApplied": "468.88",
    "purchaseOrderNetIfCasePriceReadAsUnitPrice": "5433.66",
    "note": "The first figure is correct. The second is what a costing engine produces if it applies the contract tier price without checking the break quantity. The third is what it produces if it reads price_per_case as the unit price."
  },
  "deliberateDefects": [
    {
      "id": "vat-rounding-one-cent",
      "title": "Stated tax total is one cent above the sum of the line tax amounts",
      "documents": [
        "INV-TRK-5003 dated 2026-08-21"
      ],
      "detail": "Invoice INV-TRK-5003 states a tax total of 1.23 CAD and a total due of 25.48 CAD. Its three line tax amounts sum to 1.22 CAD, one cent less. The document-level calculation round(net x 0.05, 2) on a net of 24.25 gives 1.21 CAD.",
      "assertion": "statedTaxTotal - lineTaxSum == 0.01"
    },
    {
      "id": "po-invoice-quantity-mismatch",
      "title": "Invoice bills the ordered quantity after a recorded short delivery",
      "documents": [
        "INV-TRK-5002 line 2",
        "GRN-TRK-2002 line 2"
      ],
      "detail": "Purchase order PO-TRK-1002 line 2 ordered 24 kg of ING-03. Goods-received note GRN-TRK-2002 records 20 kg delivered. Invoice INV-TRK-5002 line 2 bills 24 kg, a variance of 4 kg and 8.92 CAD net.",
      "assertion": "invoicedQuantity - deliveredQuantity == 4"
    },
    {
      "id": "duplicate-invoice-number",
      "title": "Two different invoices carry the same invoice number",
      "documents": [
        "INV-TRK-5002 dated 2026-08-17",
        "INV-TRK-5002 dated 2026-08-14"
      ],
      "detail": "Invoice number INV-TRK-5002 is used twice: once dated 2026-08-14 with 3 lines totalling 104.33 CAD, and again dated 2026-08-17 with 2 lines totalling 48.13 CAD. Both are listed on statement STM-TRK-6002 and both are included in its closing balance.",
      "assertion": "count(invoices where invoiceNumber == that number) == 2"
    },
    {
      "id": "credit-note-over-credit",
      "title": "Credit note credits more units than the goods-received note records returned",
      "documents": [
        "CN-TRK-7002",
        "GRN-TRK-2004"
      ],
      "detail": "Goods-received note GRN-TRK-2004 line 3 records 3 each returned. Credit note CN-TRK-7002 credits 5 each at 0.21 CAD. The 2 each difference overstates the credit by 0.42 CAD net and 0.44 CAD including GST.",
      "assertion": "creditedQuantity - returnedQuantity == 2"
    },
    {
      "id": "statement-ageing-does-not-sum",
      "title": "Statement ageing buckets do not sum to the closing balance",
      "documents": [
        "STM-TRK-6002"
      ],
      "detail": "Statement STM-TRK-6002 for supplier SUP-02 declares ageing buckets of 293.81 current, 78.25 at 31-60 days, 62.60 at 61-90 days and 46.95 over 90 days, summing to 481.61 CAD. The closing balance on the same document is 472.24 CAD. The difference of 9.37 CAD is exactly credit note CN-TRK-7001, which appears in the transaction lines but was never applied to the ageing analysis.",
      "assertion": "sum(declaredAgeing) - closingBalance == creditNote.grossTotal"
    },
    {
      "id": "edi-segment-count-trailer",
      "title": "EDI 810 SE segment count disagrees with the actual segment count",
      "documents": [
        "edi-810-invalid-segment-count.edi"
      ],
      "detail": "The SE segment of the invalid interchange declares a segment count two lower than the number of segments actually present between ST and SE inclusive. Every other segment, the ISA/GS/GE/IEA control numbers and the TDS total are unchanged from edi-810-invoice.edi, so a parser that checks only syntax accepts the file.",
      "assertion": "SE01 != count(segments from ST to SE inclusive)"
    }
  ]
}
