pixiGetProductSalesReport
Returns the quantity sold of one item per invoice month and year, optionally restricted to one shop.
Builds a monthly sales report for a single item based on invoice lines.
- Reads invoice lines from the view
PV_InvlinesRepand joins them with the invoices inPV_Rechnungenvia the invoice number. - Filters on the internal item number
ItemNrInt. - If
ShopIDis given, only invoice lines of that shop are counted; if it is omitted orNULL, all shops are included. - Groups by invoice month and invoice year and sums the sold quantity (
QtySold). - Rows are sorted chronologically: by year ascending, then month ascending.
Only months in which the item was invoiced appear in the result; months without sales are not returned as zero rows.
Notes
- According to the header comment the procedure was created for a specific customer (JAL).
- Both views are read
WITH (NOLOCK), so the figures may include uncommitted data. - The definitions of
PV_InvlinesRepandPV_Rechnungenare not attached; the exact meaning ofQtySold(e.g. whether credit notes reduce it) and the data types of the month/year columns depend on these views. - There is no date range filter; the full invoice history of the item is aggregated, which can be slow for items with many invoice lines.
- An unknown
ItemNrIntreturns an empty result set, not an error.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemNrInt
Required
|
varchar(50) string |
– |
Internal item number of the item whose sales are reported. Example: |
ShopID
|
varchar(3) string |
NULL |
Optional shop ID. If set, only invoice lines of this shop are summed; Example: |
Result set 1 · Always (empty if the item has no invoice lines matching the filter)
One row per invoice month and year with the total quantity sold, sorted by year and month ascending.
| Column | Type | Description |
|---|---|---|
Monat
Nullable |
int |
Invoice month ( |
Jahr
Nullable |
int |
Invoice year ( |
Sum
Nullable |
decimal |
Sum of |
Response example
<SqlRowSet1>
<row>
<Monat>11</Monat>
<Jahr>2023</Jahr>
<Sum>42</Sum>
</row>
<row>
<Monat>12</Monat>
<Jahr>2023</Jahr>
<Sum>67</Sum>
</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:pixiGetProductSalesReport>
<ItemNrInt>100234</ItemNrInt>
<!-- <ShopID>WEB</ShopID> -->
</ns1:pixiGetProductSalesReport>
</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:pixiGetProductSalesReport>
<ItemNrInt>100234</ItemNrInt>
<!-- <ShopID>WEB</ShopID> -->
</ns1:pixiGetProductSalesReport>
</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 = [
'ItemNrInt' => '100234',
// 'ShopID' => 'WEB',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetProductSalesReport', $soapArguments);
- SQL object:
- dbo.pipiGetProductSalesReport