pixiReportShipOutPerTimeQuant
Returns the number of scanned-out (shipped) invoices per time slot of a configurable length within a date range, optionally for one shop.
Splits the range from startDateTime to endDateTime into consecutive slots of timePeriod hours. For each slot it counts the invoices whose ScanOutdate (scan-out time at shipping) lies in the slot, and returns one row per slot.
startDateTimedefaults to the start of the current day (00:00),endDateTimedefaults to the current time.timePeriodis the slot length in hours and may be fractional (e.g.0.5= 30 minutes). Default is2. IfNULLis passed explicitly,1hour is used.- The last slot ends at
endDateTimeand can be shorter than the others. shopIDfilters on the shop the invoice's customer belongs to (Customers.CustomerOf). An empty string (default) counts invoices of all shops.- Every slot produces a row, including slots with a count of
0. - Rows are returned in the order the slots were created, i.e. chronologically, although the final select has no explicit
ORDER BY.
Notes
- Reads
InvoicesandCustomerswithNOLOCK, so counts may include uncommitted data. - The slot filter uses
BETWEEN, so both limits are included. An invoice scanned out exactly on a slot boundary is counted in two adjacent slots. startTimePeriodandendTimePeriodare text in SQL Server's default datetime format (e.g.Jan 15 2024 2:00PM). They have minute precision, so seconds are lost.- The label
endTimePeriodof the last slot is not shortened toendDateTime. It shows the full nominal slot end, even though the count only goes up toendDateTime. - The column
shopIDrepeats the passed parameter value; it is an empty string when all shops are counted. - Slot limits are calculated by adding fractions of a day as
float, so very small periods can produce rounding drift. - A
timePeriodof0or a negative value makes the loop never end, because the slot start never moves forward. Always pass a positive value. - One query runs per slot, so long ranges with short periods can be slow.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
startDateTime
|
datetime dateTime |
NULL |
Start of the evaluated range. Example: |
endDateTime
|
datetime dateTime |
NULL |
End of the evaluated range. Example: |
timePeriod
|
float decimal |
2 |
Length of each time slot in hours; fractional values are allowed. An explicit Example: |
shopID
|
varchar(3) string |
– |
Shop ID that the invoice's customer must belong to ( Example: |
Result set 1 · Always; one row per time slot. Empty if startDateTime is not before endDateTime.
Number of scanned-out invoices per time slot.
| Column | Type | Description |
|---|---|---|
shopID
Nullable |
varchar(3) string |
Value of the |
SUMShipOut
Nullable |
int |
Number of invoices with |
startTimePeriod
Nullable |
varchar(50) string |
Slot start as text in SQL Server's default datetime format, e.g. |
endTimePeriod
Nullable |
varchar(50) string |
Nominal slot end as text in the same format. For the last slot this can be later than |
Response example
<SqlRowSet1>
<row>
<shopID>ABC</shopID>
<SUMShipOut>42</SUMShipOut>
<startTimePeriod>Jan 15 2024 12:00AM</startTimePeriod>
<endTimePeriod>Jan 15 2024 1:00AM</endTimePeriod>
</row>
<row>
<shopID>ABC</shopID>
<SUMShipOut>17</SUMShipOut>
<startTimePeriod>Jan 15 2024 1:00AM</startTimePeriod>
<endTimePeriod>Jan 15 2024 2:00AM</endTimePeriod>
</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:pixiReportShipOutPerTimeQuant>
<!-- <startDateTime>2024-01-15T00:00:00</startDateTime> -->
<!-- <endDateTime>2024-01-15T18:00:00</endDateTime> -->
<!-- <timePeriod>1</timePeriod> -->
<!-- <shopID>ABC</shopID> -->
</ns1:pixiReportShipOutPerTimeQuant>
</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:pixiReportShipOutPerTimeQuant>
<!-- <startDateTime>2024-01-15T00:00:00</startDateTime> -->
<!-- <endDateTime>2024-01-15T18:00:00</endDateTime> -->
<!-- <timePeriod>1</timePeriod> -->
<!-- <shopID>ABC</shopID> -->
</ns1:pixiReportShipOutPerTimeQuant>
</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 = [
// 'startDateTime' => '2024-01-15T00:00:00',
// 'endDateTime' => '2024-01-15T18:00:00',
// 'timePeriod' => '1',
// 'shopID' => 'ABC',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiReportShipOutPerTimeQuant', $soapArguments);
- SQL object:
- dbo.pipiReportShipOutPerTimeQuant