{
  "schemaVersion": 1,
  "fixtureId": "restaurant-procure-to-pay-v1",
  "kit": "restaurant-bistro",
  "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-BST-1001",
      "poDate": "2026-08-05",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "207.60",
      "taxTotal": "10.38",
      "grossTotal": "217.98"
    },
    {
      "poNumber": "PO-BST-1002",
      "poDate": "2026-08-12",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "313.84",
      "taxTotal": "15.69",
      "grossTotal": "329.53"
    },
    {
      "poNumber": "PO-BST-1003",
      "poDate": "2026-08-19",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "559.37",
      "taxTotal": "27.97",
      "grossTotal": "587.34"
    },
    {
      "poNumber": "PO-BST-1004",
      "poDate": "2026-08-26",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "371.91",
      "taxTotal": "18.60",
      "grossTotal": "390.51"
    }
  ],
  "goodsReceived": [
    {
      "grnNumber": "GRN-BST-2001",
      "poNumber": "PO-BST-1001",
      "orderedQuantity": 45,
      "deliveredQuantity": 45,
      "returnedQuantity": 0,
      "acceptedQuantity": 45,
      "lineStatuses": [
        "received in full",
        "received in full",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-BST-2002",
      "poNumber": "PO-BST-1002",
      "orderedQuantity": 60,
      "deliveredQuantity": 56,
      "returnedQuantity": 0,
      "acceptedQuantity": 56,
      "lineStatuses": [
        "received in full",
        "short delivery",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-BST-2003",
      "poNumber": "PO-BST-1003",
      "orderedQuantity": 84,
      "deliveredQuantity": 84,
      "returnedQuantity": 0,
      "acceptedQuantity": 84,
      "lineStatuses": [
        "received in full",
        "substituted",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-BST-2004",
      "poNumber": "PO-BST-1004",
      "orderedQuantity": 63,
      "deliveredQuantity": 63,
      "returnedQuantity": 3,
      "acceptedQuantity": 60,
      "lineStatuses": [
        "received in full",
        "received in full",
        "part returned"
      ]
    }
  ],
  "invoices": [
    {
      "invoiceNumber": "INV-BST-5001",
      "invoiceDate": "2026-08-07",
      "dueDate": "2026-09-06",
      "supplierId": "SUP-01",
      "poNumber": "PO-BST-1001",
      "grnNumber": "GRN-BST-2001",
      "lines": 3,
      "netTotal": "207.60",
      "lineTaxSum": "10.38",
      "documentLevelTax": "10.38",
      "statedTaxTotal": "10.38",
      "totalDue": "217.98",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-BST-5002",
      "invoiceDate": "2026-08-14",
      "dueDate": "2026-09-13",
      "supplierId": "SUP-02",
      "poNumber": "PO-BST-1002",
      "grnNumber": "GRN-BST-2002",
      "lines": 3,
      "netTotal": "313.84",
      "lineTaxSum": "15.69",
      "documentLevelTax": "15.69",
      "statedTaxTotal": "15.69",
      "totalDue": "329.53",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-BST-5003",
      "invoiceDate": "2026-08-21",
      "dueDate": "2026-09-20",
      "supplierId": "SUP-01",
      "poNumber": "PO-BST-1003",
      "grnNumber": "GRN-BST-2003",
      "lines": 3,
      "netTotal": "712.81",
      "lineTaxSum": "35.64",
      "documentLevelTax": "35.64",
      "statedTaxTotal": "35.65",
      "totalDue": "748.46",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-BST-5004",
      "invoiceDate": "2026-08-28",
      "dueDate": "2026-09-27",
      "supplierId": "SUP-02",
      "poNumber": "PO-BST-1004",
      "grnNumber": "GRN-BST-2004",
      "lines": 3,
      "netTotal": "371.91",
      "lineTaxSum": "18.60",
      "documentLevelTax": "18.60",
      "statedTaxTotal": "18.60",
      "totalDue": "390.51",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-BST-5002",
      "invoiceDate": "2026-08-17",
      "dueDate": "2026-09-16",
      "supplierId": "SUP-02",
      "poNumber": "PO-BST-1002",
      "grnNumber": "GRN-BST-2002",
      "lines": 2,
      "netTotal": "280.44",
      "lineTaxSum": "14.02",
      "documentLevelTax": "14.02",
      "statedTaxTotal": "14.02",
      "totalDue": "294.46",
      "usesDuplicateNumber": true
    }
  ],
  "creditNotes": [
    {
      "creditNoteNumber": "CN-BST-7001",
      "againstInvoiceNumber": "INV-BST-5002",
      "creditedQuantity": 4,
      "netTotal": "6.68",
      "taxTotal": "0.33",
      "grossTotal": "7.01",
      "overCreditedUnits": 0
    },
    {
      "creditNoteNumber": "CN-BST-7002",
      "againstInvoiceNumber": "INV-BST-5004",
      "creditedQuantity": 5,
      "netTotal": "38.95",
      "taxTotal": "1.95",
      "grossTotal": "40.90",
      "overCreditedUnits": 2
    }
  ],
  "statements": [
    {
      "statementNumber": "STM-BST-6001",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-01",
      "rows": 5,
      "closingBalance": "1326.11",
      "declaredAgeing": {
        "current": "966.44",
        "31-60": "152.59",
        "61-90": "119.89",
        "90-plus": "87.19"
      },
      "trueAgeing": {
        "current": "966.44",
        "31-60": "152.59",
        "61-90": "119.89",
        "90-plus": "87.19"
      },
      "declaredAgeingSum": "1326.11",
      "ageingDifference": "0.00",
      "omittedFromAgeing": null
    },
    {
      "statementNumber": "STM-BST-6002",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-02",
      "rows": 8,
      "closingBalance": "1559.75",
      "declaredAgeing": {
        "current": "973.60",
        "31-60": "247.15",
        "61-90": "197.72",
        "90-plus": "148.29"
      },
      "trueAgeing": {
        "current": "966.59",
        "31-60": "247.15",
        "61-90": "197.72",
        "90-plus": "148.29"
      },
      "declaredAgeingSum": "1566.76",
      "ageingDifference": "7.01",
      "omittedFromAgeing": "CN-BST-7001"
    }
  ],
  "remittance": {
    "remittanceNumber": "REM-BST-8001",
    "paymentDate": "2026-09-05",
    "remittanceTotal": "1120.68",
    "withheldTotal": "1765.18",
    "statementsClosingTotal": "2885.86",
    "reconciliation": "remittanceTotal + withheldTotal == statementsClosingTotal",
    "paidDocuments": [
      "OPN-BST-9001",
      "OPN-BST-9002",
      "INV-BST-5001",
      "OPN-BST-9004",
      "OPN-BST-9005",
      "INV-BST-5004",
      "CN-BST-7002"
    ],
    "withheldDocuments": [
      "OPN-BST-9003",
      "INV-BST-5003",
      "OPN-BST-9006",
      "INV-BST-5002",
      "INV-BST-5002",
      "CN-BST-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": "1452.72",
    "purchaseOrderNetIfContractTierApplied": "1394.38",
    "purchaseOrderNetIfCasePriceReadAsUnitPrice": "15989.32",
    "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-BST-5003 dated 2026-08-21"
      ],
      "detail": "Invoice INV-BST-5003 states a tax total of 35.65 CAD and a total due of 748.46 CAD. Its three line tax amounts sum to 35.64 CAD, one cent less. The document-level calculation round(net x 0.05, 2) on a net of 712.81 gives 35.64 CAD.",
      "assertion": "statedTaxTotal - lineTaxSum == 0.01"
    },
    {
      "id": "po-invoice-quantity-mismatch",
      "title": "Invoice bills the ordered quantity after a recorded short delivery",
      "documents": [
        "INV-BST-5002 line 2",
        "GRN-BST-2002 line 2"
      ],
      "detail": "Purchase order PO-BST-1002 line 2 ordered 20 kg of ING-03. Goods-received note GRN-BST-2002 records 16 kg delivered. Invoice INV-BST-5002 line 2 bills 20 kg, a variance of 4 kg and 6.68 CAD net.",
      "assertion": "invoicedQuantity - deliveredQuantity == 4"
    },
    {
      "id": "duplicate-invoice-number",
      "title": "Two different invoices carry the same invoice number",
      "documents": [
        "INV-BST-5002 dated 2026-08-17",
        "INV-BST-5002 dated 2026-08-14"
      ],
      "detail": "Invoice number INV-BST-5002 is used twice: once dated 2026-08-14 with 3 lines totalling 329.53 CAD, and again dated 2026-08-17 with 2 lines totalling 294.46 CAD. Both are listed on statement STM-BST-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-BST-7002",
        "GRN-BST-2004"
      ],
      "detail": "Goods-received note GRN-BST-2004 line 3 records 3 l returned. Credit note CN-BST-7002 credits 5 l at 7.79 CAD. The 2 l difference overstates the credit by 15.58 CAD net and 16.36 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-BST-6002"
      ],
      "detail": "Statement STM-BST-6002 for supplier SUP-02 declares ageing buckets of 973.60 current, 247.15 at 31-60 days, 197.72 at 61-90 days and 148.29 over 90 days, summing to 1566.76 CAD. The closing balance on the same document is 1559.75 CAD. The difference of 7.01 CAD is exactly credit note CN-BST-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)"
    }
  ]
}
