{
  "schemaVersion": 1,
  "fixtureId": "restaurant-procure-to-pay-v1",
  "kit": "restaurant-pizzeria",
  "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-PIZ-1001",
      "poDate": "2026-08-05",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "243.81",
      "taxTotal": "12.19",
      "grossTotal": "256.00"
    },
    {
      "poNumber": "PO-PIZ-1002",
      "poDate": "2026-08-12",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "446.60",
      "taxTotal": "22.33",
      "grossTotal": "468.93"
    },
    {
      "poNumber": "PO-PIZ-1003",
      "poDate": "2026-08-19",
      "supplierId": "SUP-01",
      "lines": 3,
      "netTotal": "762.38",
      "taxTotal": "38.13",
      "grossTotal": "800.51"
    },
    {
      "poNumber": "PO-PIZ-1004",
      "poDate": "2026-08-26",
      "supplierId": "SUP-02",
      "lines": 3,
      "netTotal": "439.50",
      "taxTotal": "21.98",
      "grossTotal": "461.48"
    }
  ],
  "goodsReceived": [
    {
      "grnNumber": "GRN-PIZ-2001",
      "poNumber": "PO-PIZ-1001",
      "orderedQuantity": 54,
      "deliveredQuantity": 54,
      "returnedQuantity": 0,
      "acceptedQuantity": 54,
      "lineStatuses": [
        "received in full",
        "received in full",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-PIZ-2002",
      "poNumber": "PO-PIZ-1002",
      "orderedQuantity": 69,
      "deliveredQuantity": 65,
      "returnedQuantity": 0,
      "acceptedQuantity": 65,
      "lineStatuses": [
        "received in full",
        "short delivery",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-PIZ-2003",
      "poNumber": "PO-PIZ-1003",
      "orderedQuantity": 93,
      "deliveredQuantity": 93,
      "returnedQuantity": 0,
      "acceptedQuantity": 93,
      "lineStatuses": [
        "received in full",
        "substituted",
        "received in full"
      ]
    },
    {
      "grnNumber": "GRN-PIZ-2004",
      "poNumber": "PO-PIZ-1004",
      "orderedQuantity": 72,
      "deliveredQuantity": 72,
      "returnedQuantity": 3,
      "acceptedQuantity": 69,
      "lineStatuses": [
        "received in full",
        "received in full",
        "part returned"
      ]
    }
  ],
  "invoices": [
    {
      "invoiceNumber": "INV-PIZ-5001",
      "invoiceDate": "2026-08-07",
      "dueDate": "2026-09-06",
      "supplierId": "SUP-01",
      "poNumber": "PO-PIZ-1001",
      "grnNumber": "GRN-PIZ-2001",
      "lines": 3,
      "netTotal": "243.81",
      "lineTaxSum": "12.19",
      "documentLevelTax": "12.19",
      "statedTaxTotal": "12.19",
      "totalDue": "256.00",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-PIZ-5002",
      "invoiceDate": "2026-08-14",
      "dueDate": "2026-09-13",
      "supplierId": "SUP-02",
      "poNumber": "PO-PIZ-1002",
      "grnNumber": "GRN-PIZ-2002",
      "lines": 3,
      "netTotal": "446.60",
      "lineTaxSum": "22.33",
      "documentLevelTax": "22.33",
      "statedTaxTotal": "22.33",
      "totalDue": "468.93",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-PIZ-5003",
      "invoiceDate": "2026-08-21",
      "dueDate": "2026-09-20",
      "supplierId": "SUP-01",
      "poNumber": "PO-PIZ-1003",
      "grnNumber": "GRN-PIZ-2003",
      "lines": 3,
      "netTotal": "408.36",
      "lineTaxSum": "20.43",
      "documentLevelTax": "20.42",
      "statedTaxTotal": "20.44",
      "totalDue": "428.80",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-PIZ-5004",
      "invoiceDate": "2026-08-28",
      "dueDate": "2026-09-27",
      "supplierId": "SUP-02",
      "poNumber": "PO-PIZ-1004",
      "grnNumber": "GRN-PIZ-2004",
      "lines": 3,
      "netTotal": "439.50",
      "lineTaxSum": "21.98",
      "documentLevelTax": "21.98",
      "statedTaxTotal": "21.98",
      "totalDue": "461.48",
      "usesDuplicateNumber": false
    },
    {
      "invoiceNumber": "INV-PIZ-5002",
      "invoiceDate": "2026-08-17",
      "dueDate": "2026-09-16",
      "supplierId": "SUP-02",
      "poNumber": "PO-PIZ-1002",
      "grnNumber": "GRN-PIZ-2002",
      "lines": 2,
      "netTotal": "386.80",
      "lineTaxSum": "19.34",
      "documentLevelTax": "19.34",
      "statedTaxTotal": "19.34",
      "totalDue": "406.14",
      "usesDuplicateNumber": true
    }
  ],
  "creditNotes": [
    {
      "creditNoteNumber": "CN-PIZ-7001",
      "againstInvoiceNumber": "INV-PIZ-5002",
      "creditedQuantity": 4,
      "netTotal": "10.40",
      "taxTotal": "0.52",
      "grossTotal": "10.92",
      "overCreditedUnits": 0
    },
    {
      "creditNoteNumber": "CN-PIZ-7002",
      "againstInvoiceNumber": "INV-PIZ-5004",
      "creditedQuantity": 5,
      "netTotal": "2.60",
      "taxTotal": "0.13",
      "grossTotal": "2.73",
      "overCreditedUnits": 2
    }
  ],
  "statements": [
    {
      "statementNumber": "STM-PIZ-6001",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-01",
      "rows": 5,
      "closingBalance": "1107.20",
      "declaredAgeing": {
        "current": "684.80",
        "31-60": "179.20",
        "61-90": "140.80",
        "90-plus": "102.40"
      },
      "trueAgeing": {
        "current": "684.80",
        "31-60": "179.20",
        "61-90": "140.80",
        "90-plus": "102.40"
      },
      "declaredAgeingSum": "1107.20",
      "ageingDifference": "0.00",
      "omittedFromAgeing": null
    },
    {
      "statementNumber": "STM-PIZ-6002",
      "statementDate": "2026-08-31",
      "supplierId": "SUP-02",
      "rows": 8,
      "closingBalance": "2166.98",
      "declaredAgeing": {
        "current": "1333.82",
        "31-60": "351.70",
        "61-90": "281.36",
        "90-plus": "211.02"
      },
      "trueAgeing": {
        "current": "1322.90",
        "31-60": "351.70",
        "61-90": "281.36",
        "90-plus": "211.02"
      },
      "declaredAgeingSum": "2177.90",
      "ageingDifference": "10.92",
      "omittedFromAgeing": "CN-PIZ-7001"
    }
  ],
  "remittance": {
    "remittanceNumber": "REM-PIZ-8001",
    "paymentDate": "2026-09-05",
    "remittanceTotal": "1450.33",
    "withheldTotal": "1823.85",
    "statementsClosingTotal": "3274.18",
    "reconciliation": "remittanceTotal + withheldTotal == statementsClosingTotal",
    "paidDocuments": [
      "OPN-PIZ-9001",
      "OPN-PIZ-9002",
      "INV-PIZ-5001",
      "OPN-PIZ-9004",
      "OPN-PIZ-9005",
      "INV-PIZ-5004",
      "CN-PIZ-7002"
    ],
    "withheldDocuments": [
      "OPN-PIZ-9003",
      "INV-PIZ-5003",
      "OPN-PIZ-9006",
      "INV-PIZ-5002",
      "INV-PIZ-5002",
      "CN-PIZ-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": "1892.29",
    "purchaseOrderNetIfContractTierApplied": "1816.86",
    "purchaseOrderNetIfCasePriceReadAsUnitPrice": "19403.10",
    "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-PIZ-5003 dated 2026-08-21"
      ],
      "detail": "Invoice INV-PIZ-5003 states a tax total of 20.44 CAD and a total due of 428.80 CAD. Its three line tax amounts sum to 20.43 CAD, one cent less. The document-level calculation round(net x 0.05, 2) on a net of 408.36 gives 20.42 CAD.",
      "assertion": "statedTaxTotal - lineTaxSum == 0.01"
    },
    {
      "id": "po-invoice-quantity-mismatch",
      "title": "Invoice bills the ordered quantity after a recorded short delivery",
      "documents": [
        "INV-PIZ-5002 line 2",
        "GRN-PIZ-2002 line 2"
      ],
      "detail": "Purchase order PO-PIZ-1002 line 2 ordered 23 kg of ING-03. Goods-received note GRN-PIZ-2002 records 19 kg delivered. Invoice INV-PIZ-5002 line 2 bills 23 kg, a variance of 4 kg and 10.40 CAD net.",
      "assertion": "invoicedQuantity - deliveredQuantity == 4"
    },
    {
      "id": "duplicate-invoice-number",
      "title": "Two different invoices carry the same invoice number",
      "documents": [
        "INV-PIZ-5002 dated 2026-08-17",
        "INV-PIZ-5002 dated 2026-08-14"
      ],
      "detail": "Invoice number INV-PIZ-5002 is used twice: once dated 2026-08-14 with 3 lines totalling 468.93 CAD, and again dated 2026-08-17 with 2 lines totalling 406.14 CAD. Both are listed on statement STM-PIZ-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-PIZ-7002",
        "GRN-PIZ-2004"
      ],
      "detail": "Goods-received note GRN-PIZ-2004 line 3 records 3 each returned. Credit note CN-PIZ-7002 credits 5 each at 0.52 CAD. The 2 each difference overstates the credit by 1.04 CAD net and 1.09 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-PIZ-6002"
      ],
      "detail": "Statement STM-PIZ-6002 for supplier SUP-02 declares ageing buckets of 1333.82 current, 351.70 at 31-60 days, 281.36 at 61-90 days and 211.02 over 90 days, summing to 2177.90 CAD. The closing balance on the same document is 2166.98 CAD. The difference of 10.92 CAD is exactly credit note CN-PIZ-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)"
    }
  ]
}
