pixiGetItemSalesStats
Returns sales statistics for one item: quantities sold in the last 30/120/365 days, open and held quantities, open single-item orders and the ABC class.
Returns one row of sales figures for a single item.
- Item lookup: the item is identified by
EANUPCorItemNrInt. The first item (lowestItemKey) whose EAN matches@EANUPCor whose internal item number matches@ItemNrIntis used. - Open single-item orders (
Open1SS): counts all orders that contain at least one order line of this item with statusANGand whose order lines (all lines of the order, any status) add up to a total quantity of exactly 1. - Sales buckets: all order lines of the item with an order date within the last 365 days (relative to the current date and time) are considered, except lines with status
STOorNLB.Sales30: quantity ordered in the last 30 daysSales120: quantity ordered in the last 120 days (includes the 30-day range)Sales365: quantity ordered in the last 365 daysOrderQtyANG: quantity of lines with statusANGwithin the last 365 daysOrderQtyHAL: quantity of lines with statusHALwithin the last 365 days
- ABC class: determined by the item tags
A,BorC(checked in this order); empty string if none of these tags is assigned.
Notes
- All reads use
NOLOCK, so figures may include uncommitted data. - If both parameters are passed, they are combined with
OR; the item with the lowestItemKeymatching either value is used. Pass only one identifier to avoid ambiguity. - If no item is found, no error is returned:
Open1SSis0,ABCand all sales columns areNULL. - The sales columns are
NULL(not0) when there are no matching order lines in the respective range. - The time ranges are computed from the current date and time (
GETDATE()minus n days), not from midnight. Open1SSsums the quantity of all lines of an order, including lines of other statuses (e.g. cancelled lines), when checking for a total of 1.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
EANUPC
|
varchar(13) string |
NULL |
EAN/UPC of the item. Alternative to Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Internal item number. Alternative to Example: |
Result set 1 · Always (one row, even if no item is found)
Sales statistics of the item.
| Column | Type | Description |
|---|---|---|
Open1SS
|
int |
Number of orders with an open ( |
ABC
Nullable |
char(1) string |
ABC class from item tags ( |
Sales30
Nullable |
int |
Quantity ordered in the last 30 days (excluding |
Sales120
Nullable |
int |
Quantity ordered in the last 120 days (excluding |
Sales365
Nullable |
int |
Quantity ordered in the last 365 days (excluding |
OrderQtyANG
Nullable |
int |
Quantity of order lines with status |
OrderQtyHAL
Nullable |
int |
Quantity of order lines with status |
Response example
<SqlRowSet1>
<row>
<Open1SS>3</Open1SS>
<ABC>A</ABC>
<Sales30>42</Sales30>
<Sales120>160</Sales120>
<Sales365>512</Sales365>
<OrderQtyANG>7</OrderQtyANG>
<OrderQtyHAL>2</OrderQtyHAL>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetItemSalesStats>
<!-- <EANUPC>4006381333931</EANUPC> -->
<!-- <ItemNrInt>ART-100234</ItemNrInt> -->
</ns1:pixiGetItemSalesStats>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetItemSalesStats>
<!-- <EANUPC>4006381333931</EANUPC> -->
<!-- <ItemNrInt>ART-100234</ItemNrInt> -->
</ns1:pixiGetItemSalesStats>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
// 'EANUPC' => '4006381333931',
// 'ItemNrInt' => 'ART-100234',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetItemSalesStats', $soapArguments);
- SQL object:
- dbo.pipiGetItemSalesStats