pixiReportGetShippableOrders
Returns the order lines that can be shipped from current stock, either as line details or as totals (orders, value, shipping cost, picks), optionally per location.
Evaluates open orders and checks, line by line, whether there is enough stock to ship them. It then returns either the shippable lines or summary figures.
Candidate orders and lines
- Only order lines with status
ANGorEIN, a non-NULLItemRefandQty> 0 are considered. - The order's customer must belong to
ShopId(Customers.CustomerOf). An emptyShopIdmeans all shops. - Orders are excluded if the invoice address (
AddrRef) or the shipping address (ShipAdrRef) is locked (ASlocked = 'Y'). - Orders are also excluded if the order itself is locked (
OhSLocked = 'Y'). - Unless
IncludeOrdersWithAnyShipDate = 1, only orders with noShipdateor aShipdatebefore tomorrow (today or earlier) are included.
Stock check
The internal procedure pixi_CalculateStockForOrderLines sets a shippable flag on each candidate line. It runs with zero-stock items skipped, so lines of items without stock are not shippable.
- The calculation takes into account the stock in locations with
SpecialStock = 0, existing reservations and earlier unreserved order lines. - Lines with status
EINalways count as shippable. - An order counts as partial or unshippable if at least one of its candidate lines is not shippable.
Filter by delivery mode
OnlyPartDelivery = 0,IncludePartDelivery = 0: only lines of orders whose candidate lines are all shippable (complete orders).OnlyPartDelivery = 0,IncludePartDelivery = 1: all shippable lines, from complete and from partial orders.OnlyPartDelivery = 1: only the shippable lines of partial orders.IncludePartDeliveryis ignored in this case.
Currency
If the setting MultiCurrencyEnabled is 1, Price and ShipCost are converted into the database currency. The conversion uses the exchange rate of the database rate source that has the same currency and date as the order's exchange rate. If no such rate exists, the values are not converted. dbCurrency then contains the database currency code; otherwise it is NULL.
Output
Exactly one result set is returned, chosen by ViewDetails and PerLocation:
ViewDetails = 1: one row per shippable line, sorted byOrderNrandOrderlineRef. WithPerLocation = 1the columnLocationIdis added.ViewDetails = 0,PerLocation = 0: one total row.ViewDetails = 0,PerLocation = 1: one total row per location.
Notes
- All reads use
NOLOCK, so the figures can include uncommitted data. - The setting
UseFIFObyLocationcontrols the stock basis insidepixi_CalculateStockForOrderLines:0: total stock of all locations withSpecialStock = 0.1: stock of the line's own location.
- Only lines in status
ANG/EINdecide whether an order is complete. Lines of the same order in other statuses are ignored, both in the check and in the output. ShipCostis the shipping cost of the order header. In the detail result sets it is repeated on every line of the order. In the totals it is counted once per order, or once per order and location withPerLocation = 1. An order with lines in several locations therefore contributes its shipping cost to each of those locations.OrderTotalis computed asSUM(Price * Qty).NULLvalues for the bit parameters are treated as 0.PerLocationis marked in the code as the "old way".- The helper procedure calls
log.EventDurationInsert(definition not attached), which probably writes a duration log entry. - On large databases the call can be expensive, because it calculates stock for all open lines.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ViewDetails
|
bit boolean |
NULL |
1 returns one row per shippable line; 0 (or NULL) returns totals. Allowed values
Example: |
IncludePartDelivery
|
bit boolean |
NULL |
1 includes the shippable lines of partial orders in addition to complete orders. Ignored when Allowed values
Example: |
OnlyPartDelivery
|
bit boolean |
NULL |
1 returns only the shippable lines of orders that cannot be shipped completely. Allowed values
Example: |
ShopId
|
varchar(3) string |
– |
Restricts the result to orders of customers of this shop ( Example: |
IncludeOrdersWithAnyShipDate
|
bit boolean |
0 |
1 also includes orders whose ship date lies in the future. Allowed values
Example: |
PerLocation
|
bit boolean |
0 |
1 adds the location to the details or groups the totals by location (marked as "old way" in the code). Allowed values
Example: |
Result set 1 · If ViewDetails = 1 and PerLocation = 0
One row per shippable order line, sorted by OrderNr, OrderlineRef.
| Column | Type | Description |
|---|---|---|
OrderlineRef
|
int |
Order line key |
OrderNr
Nullable |
int |
Order number |
Qty
|
int |
Line quantity |
ItemRef
|
int |
Item key |
Status
Nullable |
varchar(3) string |
Line status ( |
ShipCost
Nullable |
money decimal |
Shipping cost of the order, in database currency if multi-currency is enabled |
Price
Nullable |
money decimal |
Line price, in database currency if multi-currency is enabled |
Shippable
|
int |
Always 1 |
dbCurrency
Nullable |
varchar(3) string |
Database currency code if multi-currency is enabled, otherwise NULL |
Result set 2 · If ViewDetails = 0 and PerLocation = 0
One row with totals over all shippable lines.
| Column | Type | Description |
|---|---|---|
Orders
|
int |
Number of distinct orders |
OrderTotal
Nullable |
money decimal |
Sum of |
ShipCost
|
money decimal |
Sum of shipping costs, counted once per order |
Picks
Nullable |
int |
Sum of quantities |
dbCurrency
Nullable |
varchar(3) string |
Database currency code if multi-currency is enabled, otherwise NULL |
Result set 3 · If ViewDetails = 1 and PerLocation = 1
Like the detail rows above, with the location of each line added.
| Column | Type | Description |
|---|---|---|
OrderlineRef
|
int |
Order line key |
OrderNr
Nullable |
int |
Order number |
LocationId
Nullable |
varchar(3) string |
Location of the order line |
Qty
|
int |
Line quantity |
ItemRef
|
int |
Item key |
Status
Nullable |
varchar(3) string |
Line status ( |
ShipCost
Nullable |
money decimal |
Shipping cost of the order |
Price
Nullable |
money decimal |
Line price |
Shippable
|
int |
Always 1 |
dbCurrency
Nullable |
varchar(3) string |
Database currency code if multi-currency is enabled, otherwise NULL |
Result set 4 · If ViewDetails = 0 and PerLocation = 1
One total row per location; no rows if nothing is shippable.
| Column | Type | Description |
|---|---|---|
Orders
|
int |
Number of distinct orders in the location |
LocationId
Nullable |
varchar(3) string |
Location |
OrderTotal
Nullable |
money decimal |
Sum of |
ShipCost
Nullable |
money decimal |
Sum of shipping costs, counted once per order and location |
Picks
Nullable |
int |
Sum of quantities in the location |
dbCurrency
Nullable |
varchar(3) string |
Database currency code if multi-currency is enabled, otherwise NULL |
Response example
<SqlRowSet1>
<row>
<Orders>42</Orders>
<OrderTotal>3875.4000</OrderTotal>
<ShipCost>209.5800</ShipCost>
<Picks>118</Picks>
<dbCurrency>EUR</dbCurrency>
</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:pixiReportGetShippableOrders>
<!-- <ViewDetails>1</ViewDetails> -->
<!-- <IncludePartDelivery>0</IncludePartDelivery> -->
<!-- <OnlyPartDelivery>0</OnlyPartDelivery> -->
<!-- <ShopId>HOH</ShopId> -->
<!-- <IncludeOrdersWithAnyShipDate>0</IncludeOrdersWithAnyShipDate> -->
<!-- <PerLocation>0</PerLocation> -->
</ns1:pixiReportGetShippableOrders>
</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:pixiReportGetShippableOrders>
<!-- <ViewDetails>1</ViewDetails> -->
<!-- <IncludePartDelivery>0</IncludePartDelivery> -->
<!-- <OnlyPartDelivery>0</OnlyPartDelivery> -->
<!-- <ShopId>HOH</ShopId> -->
<!-- <IncludeOrdersWithAnyShipDate>0</IncludeOrdersWithAnyShipDate> -->
<!-- <PerLocation>0</PerLocation> -->
</ns1:pixiReportGetShippableOrders>
</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 = [
// 'ViewDetails' => '1',
// 'IncludePartDelivery' => '0',
// 'OnlyPartDelivery' => '0',
// 'ShopId' => 'HOH',
// 'IncludeOrdersWithAnyShipDate' => '0',
// 'PerLocation' => '0',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiReportGetShippableOrders', $soapArguments);
- SQL object:
- dbo.pipiReportGetShippableOrders