{
  "schemaVersion": 1,
  "fixtureId": "restaurant-procure-to-pay-v1",
  "kit": "restaurant-group",
  "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-GRP-1001",
      "poDate": "2026-08-05",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "261.93",
      "taxTotal": "13.10",
      "grossTotal": "275.03"
    },
    {
      "poNumber": "PO-GRP-1002",
      "poDate": "2026-08-12",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "309.92",
      "taxTotal": "15.49",
      "grossTotal": "325.41"
    },
    {
      "poNumber": "PO-GRP-1003",
      "poDate": "2026-08-19",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "239.65",
      "taxTotal": "11.98",
      "grossTotal": "251.63"
    },
    {
      "poNumber": "PO-GRP-1004",
      "poDate": "2026-08-26",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "165.66",
      "taxTotal": "8.29",
      "grossTotal": "173.95"
    }
  ],
  "goodsReceived": [
    {
      "grnNumber": "GRN-GRP-2001",
      "poNumber": "PO-GRP-1001",
      "orderedQuantity": 63,
      "deliveredQuantity": 63,
      "returnedQuantity": 0,
      "acceptedQuantity": 63,
      "lineStatuses": [
        "received in full",
        "received in full",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-GRP-2002",
      "poNumber": "PO-GRP-1002",
      "orderedQuantity": 78,
      "deliveredQuantity": 74,
      "returnedQuantity": 0,
      "acceptedQuantity": 74,
      "lineStatuses": [
        "received in full",
        "short delivery",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-GRP-2003",
      "poNumber": "PO-GRP-1003",
      "orderedQuantity": 102,
      "deliveredQuantity": 102,
      "returnedQuantity": 0,
      "acceptedQuantity": 102,
      "lineStatuses": [
        "received in full",
        "substituted",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-GRP-2004",
      "poNumber": "PO-GRP-1004",
      "orderedQuantity": 81,
      "deliveredQuantity": 81,
      "returnedQuantity": 3,
      "acceptedQuantity": 78,
      "lineStatuses": [
        "received in full",
        "received in full",
        "part returned"
      ]
    }
  ],
  "invoices": [
    {
      "invoiceNumber": "INV-GRP-5001",
      "invoiceDate": "2026-08-07",
      "dueDate": "2026-09-06",
      "supplierId": "SUP-01",
      "poNumber": "PO-GRP-1001",
      "grnNumber": "GRN-GRP-2001",
      "lines": 3,
      "netTotal": "261.93",
      "lineTaxSum": "13.10",
      "documentLevelTax": "13.10",
      "statedTaxTotal": "13.10",
      "totalDue": "275.03",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-GRP-5002",
      "invoiceDate": "2026-08-14",
      "dueDate": "2026-09-13",
      "supplierId": "SUP-02",
      "poNumber": "PO-GRP-1002",
      "grnNumber": "GRN-GRP-2002",
      "lines": 3,
      "netTotal": "309.92",
      "lineTaxSum": "15.49",
      "documentLevelTax": "15.50",
      "statedTaxTotal": "15.49",
      "totalDue": "325.41",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-GRP-5003",
      "invoiceDate": "2026-08-21",
      "dueDate": "2026-09-20",
      "supplierId": "SUP-01",
      "poNumber": "PO-GRP-1003",
      "grnNumber": "GRN-GRP-2003",
      "lines": 3,
      "netTotal": "560.27",
      "lineTaxSum": "28.01",
      "documentLevelTax": "28.01",
      "statedTaxTotal": "28.02",
      "totalDue": "588.29",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-GRP-5004",
      "invoiceDate": "2026-08-28",
      "dueDate": "2026-09-27",
      "supplierId": "SUP-02",
      "poNumber": "PO-GRP-1004",
      "grnNumber": "GRN-GRP-2004",
      "lines": 3,
      "netTotal": "165.66",
      "lineTaxSum": "8.29",
      "documentLevelTax": "8.28",
      "statedTaxTotal": "8.29",
      "totalDue": "173.95",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-GRP-5002",
      "invoiceDate": "2026-08-17",
      "dueDate": "2026-09-16",
      "supplierId": "SUP-02",
      "poNumber": "PO-GRP-1002",
      "grnNumber": "GRN-GRP-2002",
      "lines": 2,
      "netTotal": "254.28",
      "lineTaxSum": "12.71",
      "documentLevelTax": "12.71",
      "statedTaxTotal": "12.71",
      "totalDue": "266.99",
      "usesDuplicateNumber": true
    }
  ],
  "creditNotes": [
    {
      "creditNoteNumber": "CN-GRP-7001",
      "againstInvoiceNumber": "INV-GRP-5002",
      "creditedQuantity": 4,
      "netTotal": "8.56",
      "taxTotal": "0.43",
      "grossTotal": "8.99",
      "overCreditedUnits": 0
    },
    {
      "creditNoteNumber": "CN-GRP-7002",
      "againstInvoiceNumber": "INV-GRP-5004",
      "creditedQuantity": 5,
      "netTotal": "9.50",
      "taxTotal": "0.48",
      "grossTotal": "9.98",
      "overCreditedUnits": 2
    }
  ],
  "statements": [
    {
      "statementNumber": "STM-GRP-6001",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-01",
      "rows": 5,
      "closingBalance": "1317.12",
      "declaredAgeing": {
        "current": "863.32",
        "31-60": "192.52",
        "61-90": "151.27",
        "90-plus": "110.01"
      },
      "trueAgeing": {
        "current": "863.32",
        "31-60": "192.52",
        "61-90": "151.27",
        "90-plus": "110.01"
      },
      "declaredAgeingSum": "1317.12",
      "ageingDifference": "0.00",
      "omittedFromAgeing": null
    },
    {
      "statementNumber": "STM-GRP-6002",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-02",
      "rows": 8,
      "closingBalance": "1333.12",
      "declaredAgeing": {
        "current": "756.37",
        "31-60": "244.06",
        "61-90": "195.25",
        "90-plus": "146.43"
      },
      "trueAgeing": {
        "current": "747.38",
        "31-60": "244.06",
        "61-90": "195.25",
        "90-plus": "146.43"
      },
      "declaredAgeingSum": "1342.11",
      "ageingDifference": "8.99",
      "omittedFromAgeing": "CN-GRP-7001"
    }
  ],
  "remittance": {
    "remittanceNumber": "REM-GRP-8001",
    "paymentDate": "2026-09-05",
    "remittanceTotal": "1041.96",
    "withheldTotal": "1608.28",
    "statementsClosingTotal": "2650.24",
    "reconciliation": "remittanceTotal + withheldTotal == statementsClosingTotal",
    "paidDocuments": [
      "OPN-GRP-9001",
      "OPN-GRP-9002",
      "INV-GRP-5001",
      "OPN-GRP-9004",
      "OPN-GRP-9005",
      "INV-GRP-5004",
      "CN-GRP-7002"
    ],
    "withheldDocuments": [
      "OPN-GRP-9003",
      "INV-GRP-5003",
      "OPN-GRP-9006",
      "INV-GRP-5002",
      "INV-GRP-5002",
      "CN-GRP-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": "977.16",
    "purchaseOrderNetIfContractTierApplied": "937.92",
    "purchaseOrderNetIfCasePriceReadAsUnitPrice": "11949.56",
    "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-GRP-5003 dated 2026-08-21"
      ],
      "detail": "Invoice INV-GRP-5003 states a tax total of 28.02 CAD and a total due of 588.29 CAD. Its three line tax amounts sum to 28.01 CAD, one cent less. The document-level calculation round(net x 0.05, 2) on a net of 560.27 gives 28.01 CAD.",
      "assertion": "statedTaxTotal - lineTaxSum == 0.01"
    },
    {
      "id": "po-invoice-quantity-mismatch",
      "title": "Invoice bills the ordered quantity after a recorded short delivery",
      "documents": [
        "INV-GRP-5002 line 2",
        "GRN-GRP-2002 line 2"
      ],
      "detail": "Purchase order PO-GRP-1002 line 2 ordered 26 each of ING-03. Goods-received note GRN-GRP-2002 records 22 each delivered. Invoice INV-GRP-5002 line 2 bills 26 each, a variance of 4 each and 8.56 CAD net.",
      "assertion": "invoicedQuantity - deliveredQuantity == 4"
    },
    {
      "id": "duplicate-invoice-number",
      "title": "Two different invoices carry the same invoice number",
      "documents": [
        "INV-GRP-5002 dated 2026-08-17",
        "INV-GRP-5002 dated 2026-08-14"
      ],
      "detail": "Invoice number INV-GRP-5002 is used twice: once dated 2026-08-14 with 3 lines totalling 325.41 CAD, and again dated 2026-08-17 with 2 lines totalling 266.99 CAD. Both are listed on statement STM-GRP-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-GRP-7002",
        "GRN-GRP-2004"
      ],
      "detail": "Goods-received note GRN-GRP-2004 line 3 records 3 l returned. Credit note CN-GRP-7002 credits 5 l at 1.90 CAD. The 2 l difference overstates the credit by 3.80 CAD net and 3.99 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-GRP-6002"
      ],
      "detail": "Statement STM-GRP-6002 for supplier SUP-02 declares ageing buckets of 756.37 current, 244.06 at 31-60 days, 195.25 at 61-90 days and 146.43 over 90 days, summing to 1342.11 CAD. The closing balance on the same document is 1333.12 CAD. The difference of 8.99 CAD is exactly credit note CN-GRP-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)"
    }
  ]
}
