Internal Orders Report

GET /reports/orders

This report returns all the data for the internal orders that match the query criteria. It generates a JSON file that can be downloaded from the response url.

Parameters

All query parameters are optional.

  • sender: id of area or division (location) that sent the order/return
  • division: id of division (location) that received the order
  • from: Timestamp representing the minimum age of the inspections queried. To fetch all inspections that have been created before today, from can be set to the timestamp of 00:00 of today. The server is set to UTC.
  • to: Timestamp representing the maximum age of the inspections queried. To fetch all new inspections that have been created since yesterday, to can be set to the timestamp of 00:00 of today. The server is set to UTC.
  • status: order status to filter for - no default, will load all if not specified
  • type: order type to filter for - one of "ORDER" or "RETURN"

Status codes

  • 200 on success

Response properties

  • url: The URL where the report can be accessed.

Example response:

{
  "url": "https://s3.eu-central-1.amazonaws.com/exports.yourbarmate.com/c6a61b00-178f-4604-a51b-927cb9b4e302/order-report-1730205514020.json?..."
}

The report is generated fresh every time you request it.

Report

The generated report is a JSON file with the following properties:

  • orders: Array of all orders and returns that that fulfill the filter criteria.
  • stock: All moved stock per item in the orders/returns.
  • summary: Totals for the report and per product group and per account code.
orders

Entries in the orders array have the following properties:

  • created: The created timestamp of the order/return that also funcions as its ID.
  • type: One of "ORDER" or "RETURN".
  • status: the status of the order/return. One of "MOVED", "CANCELLED" or "REJECTED".
  • area_id: id of the area that created the order/return.
  • settled: timestamp of when the order was completed, cancelled or rejected.
  • entries: an array of the item entries in the order/return.
stock

Stock is a map indexed by the id of each item that was ordered or returned in any of the orders or returns in the report. The value of the map is an object with the following properties:

  • item: details of the item.
  • orders: ids of the orders that contain this item
  • returns: ids of the returns that contain this item
  • queue: Object representing the stock that was moved for this item.
    • ordered: All stock that was moved as part of a completed order.
    • returned: All stock that was moved as part of a completed return.
    • aggregated: Object representing the aggregated stock from orders and returns:
      • type: If more stock was ordered than returned then it is "ORDER" otherwise "RETURN"
      • stock: The actual stock data with values count, price, total and optionally ml if there are fractional counts.
  • summary: Object containing the monetary value of all moved stock for this item.
    • ordered: Value of moved stock as part of orders
    • returned: Value of moved stock as part of returns
    • value: Total aggregated value of stock movements. If more stock was returned than moved in the report, this value will be negative.
summary

This object holds the aggregated monetary values for the report. The summary also contains the values grouped by Categories and Account codes.

  • ordered: Total monetary value of all stock moved as part of orders.
  • returned: Total monetary value of all stock moved as part of returns.
  • value: Aggregated monetary value of all stock moved. If more stock was returned than moved in the report, this value will be negative.
  • category: Array of all Categories that have items in the report.
  • account_code: Array of all Account codes that have items in the report.

Both category and account_code arrays contain object with the following properties:

  • id: The id of the category or the account code. Can also contain '-' for no account code.
  • name: The name of the category or the account code. Can also contain '-' for no account code.
  • ordered: Value of items in this group that were moved as part of orders.
  • returned: Value of items in this group that were moved as part of returns.
  • value: Total aggregated value of stock movements for the group. If more stock was returned than moved, this value will be negative.

Example JSON

{
  "orders": [
    {
      "created": 1744026633001,
      "type": "ORDER",
      "status": "REQUESTED",
      "area_id": "l01",
      "settled": 1744026633111,
      "entries": [
        { "item": "00-001", "count": 1, "status": "MOVED" },
        { "item": "00-002", "count": 2, "status": "MOVED" },
        { "item": "00-003", "count": 3, "status": "MOVED" }
      ]
    },
    {
      "created": 1744026633002,
      "type": "RETURN",
      "status": "REQUESTED",
      "area_id": "l01",
      "settled": 1744026633222,
      "entries": [{ "item": "00-002", "count": 1, "status": "MOVED" }]
    }
  ],
  "stock": [
    {
      "item": {
        "id": "00-001",
        "category": "cat_______test",
        "name": "Item 1"
      },
      "orders": [1744026633001],
      "returns": [],
      "queue": {
        "ordered": [{ "count": 1, "price": 999, "total": 999 }],
        "returned": [],
        "aggregated": {
          "type": "ORDER",
          "stock": { "count": 1, "price": 999, "total": 999 }
        }
      },
      "summary": { "ordered": 999, "returned": 0, "value": 999 }
    },
    {
      "item": {
        "id": "00-002",
        "category": "cat_______test",
        "name": "Item 2"
      },
      "orders": [1744026633001],
      "returns": [1744026633002],
      "queue": {
        "ordered": [{ "count": 2, "price": 1250, "total": 2500 }],
        "returned": [{ "count": 1, "price": 1250, "total": 1250 }],
        "aggregated": {
          "type": "ORDER",
          "stock": { "count": 1, "price": 1250, "total": 1250 }
        }
      },
      "summary": { "ordered": 2500, "returned": 1250, "value": 1250 }
    },
    {
      "item": {
        "id": "00-003",
        "category": "cat_______test",
        "name": "Item 3"
      },
      "orders": [1744026633001],
      "returns": [],
      "queue": {
        "ordered": [{ "count": 3, "price": 500, "total": 1500 }],
        "returned": [],
        "aggregated": {
          "type": "ORDER",
          "stock": { "count": 3, "price": 500, "total": 1500 }
        }
      },
      "summary": { "ordered": 1500, "returned": 0, "value": 1500 }
    }
  ],
  "summary": {
    "ordered": 4999,
    "returned": 1250,
    "value": 3749,
    "category": [
      {
        "id": "cat_______test",
        "name": "Test Category",
        "ordered": 4999,
        "returned": 1250,
        "value": 3749
      }
    ],
    "account_code": [
      {
        "id": "-",
        "name": "-",
        "ordered": 4999,
        "returned": 1250,
        "value": 3749
      }
    ]
  }
}