{
    "rest": true,
    "allowMapping": true,
    "type": "purchaseorder",
    "id": "purchaseorder",
    "criteria": "transaction",
    "select": "transactionline.class, transactionline.department",
    "where": "WHERE type = 'PurchOrd' AND voided = 'F'",
    "inner": "INNER JOIN (SELECT transaction AS txn, MIN(linesequencenumber) AS first_seq FROM transactionline GROUP BY transaction) tl_min ON tl_min.txn = TRANSACTION.id INNER JOIN transactionline ON (transactionline.TRANSACTION = TRANSACTION.id AND transactionline.linesequencenumber = tl_min.first_seq)",
    "ignore": [
        "class", "department"
    ],
    "mapping": {
        "title": "tranId",
        "billingaddress": "billingAddress",
        "class": "class",
        "department": "department",
        "duedate": "dueDate",
        "entity": "entity",
        "email": "email",
        "exchangerate": "exchangeRate",
        "memo": "memo",
        "terms": "terms",
        "trandate": "tranDate",
        "enddate": "endDate",
        "location": "location",
        "message": "message",
        "shipdate": "shipDate",
        "startdate": "startDate",
        "subsidiary": "subsidiary",
        "total": "total",
        "shipmethod": "shipMethod",
        "orderstatus": "orderStatus"
    },

    "dependencies": {
        "purchaseorderline": {
            "name": "Transaction Lines",
            "model": "TransactionLine",
            "path": "/src/Domain/TransactionLines/Data/criteria.json",
            "where": "WHERE transaction.type = 'PurchOrd'"
        }
    }
}
