pixiReportGetStockItems
Returns a stock evaluation per item with stock quantity, average purchase price, stock value, stock age, last order date and sales quantities for three periods.
Builds a stock evaluation report for all items that have at least one bin entry in InvBinItem. According to the header comment it was made for stock evaluation and price recalculation for a specific customer (GCH).
Filter
- If
SupplNris set, only items whoseItems.SupplNrequals this value are included. If it isNULL(default), all items with bin entries are returned. - Items without any
InvBinItemrow are not returned. Items whose bin rows add up to 0 are still returned.
Calculated values per item
EK: average supplier price fromfPixi_GetAverageSupplPrice. It averagesAddItems.SupplPriceof all supplier records linked through the item'sIntLinkNr1, ignoringNULLand 0 prices and the supplierMGS. If no such price exists,0is returned.AnzahlArtikelAufLager: sum ofBinItemQtyover all bin locations of the item.EKGesamt: stock quantity multiplied byEK.AufLagerSeit/AufLagerSeitTage: earliestUpdateDateinInvBinItemLogwith a positive quantity, and the number of days since then.LetzteBestellung/LetzteBestellungTage: latestOrderDateof any order line for the item, and the number of days since then.soldRange1,soldRange2,soldRange3: sum ofOrderlines.Qtyfor order lines with anOrderDatewithin the lastSoldRange1,SoldRange2orSoldRange3days, counted back from the current server time.
The result has no defined sort order and no paging.
Notes
- All tables are read with
NOLOCK, so the figures can include uncommitted data. - Sales quantities and the last order date count all order lines of the item, regardless of order or line status (for example cancelled lines are not excluded).
soldRange*,LetzteBestellung,AufLagerSeitand the day columns areNULLif there are no matching order lines or log entries.- The average purchase price always excludes the supplier
MGS; this is hard-coded infPixi_GetAverageSupplPrice. The function's fallback query is identical to the first query, so it effectively returns0if no price is found. - Each item triggers several correlated subqueries and a scalar function call. Without a
SupplNrfilter the call can run for a long time on large catalogues.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
SupplNr
|
varchar(4) string |
NULL |
Supplier number ( Example: |
SoldRange1
|
int | 30 |
Number of days back from now for the sales sum in column Example: |
SoldRange2
|
int | 90 |
Number of days back from now for the sales sum in column Example: |
SoldRange3
|
int | 120 |
Number of days back from now for the sales sum in column Example: |
Result set 1 · Always; one row per item with at least one InvBinItem entry matching the supplier filter.
Stock evaluation per item.
| Column | Type | Description |
|---|---|---|
ItemKey
|
int |
Internal item key. |
Artikelnummer
Nullable |
string |
Supplier item number ( |
EANUPC
Nullable |
string |
EAN/UPC of the item. |
Lieferant
Nullable |
string |
Supplier number of the item ( |
Artikelname
Nullable |
string |
Item name. |
VK
Nullable |
decimal |
Selling price ( |
EK
|
money decimal |
Average supplier price over linked supplier records, excluding supplier |
AnzahlArtikelAufLager
Nullable |
int |
Total stock quantity over all bin locations. |
EKGesamt
Nullable |
money decimal |
Stock value: stock quantity × |
AufLagerSeit
Nullable |
datetime dateTime |
Earliest date the item was put to stock (first |
AufLagerSeitTage
Nullable |
int |
Days since |
LetzteBestellung
Nullable |
datetime dateTime |
Latest order date of any order line for the item. |
LetzteBestellungTage
Nullable |
int |
Days since |
soldRange1
Nullable |
int |
Quantity ordered within the last |
soldRange2
Nullable |
int |
Quantity ordered within the last |
soldRange3
Nullable |
int |
Quantity ordered within the last |
Response example
<SqlRowSet1>
<row>
<ItemKey>10452</ItemKey>
<Artikelnummer>MG-4711</Artikelnummer>
<EANUPC>4006381333931</EANUPC>
<Lieferant>MGS</Lieferant>
<Artikelname>Steckdosenleiste 6-fach</Artikelname>
<VK>24.9900</VK>
<EK>11.2500</EK>
<AnzahlArtikelAufLager>38</AnzahlArtikelAufLager>
<EKGesamt>427.5000</EKGesamt>
<AufLagerSeit>2023-02-14T09:31:00</AufLagerSeit>
<AufLagerSeitTage>412</AufLagerSeitTage>
<LetzteBestellung>2024-03-28T16:05:12</LetzteBestellung>
<LetzteBestellungTage>4</LetzteBestellungTage>
<soldRange1>12</soldRange1>
<soldRange2>31</soldRange2>
<soldRange3>40</soldRange3>
</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:pixiReportGetStockItems>
<!-- <SupplNr>MGS</SupplNr> -->
<!-- <SoldRange1>30</SoldRange1> -->
<!-- <SoldRange2>90</SoldRange2> -->
<!-- <SoldRange3>180</SoldRange3> -->
</ns1:pixiReportGetStockItems>
</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:pixiReportGetStockItems>
<!-- <SupplNr>MGS</SupplNr> -->
<!-- <SoldRange1>30</SoldRange1> -->
<!-- <SoldRange2>90</SoldRange2> -->
<!-- <SoldRange3>180</SoldRange3> -->
</ns1:pixiReportGetStockItems>
</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 = [
// 'SupplNr' => 'MGS',
// 'SoldRange1' => '30',
// 'SoldRange2' => '90',
// 'SoldRange3' => '180',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiReportGetStockItems', $soapArguments);
- SQL object:
- dbo.pipiReportGetStockItems