pixiGetPosInvoiceLines
Returns the lines of a POS (point of sale) invoice, with item number, EAN, name, quantity, prices and discount, for a given document number.
Returns all lines of the POS document whose document number (POSheader2.PHdocNr) equals InvoiceNr.
- The call first runs the common API envelope
Pixi_ApiEnvelope. It checks the call frequency limit for this function and records the time of the call. - If the envelope returns result code
200, the procedure selects the POS lines (POSitem2) of the matching POS header (POSheader2). It joins each line to its item (items) with an inner join. - Each row contains the internal item number, EAN, item name, quantity, the document date and number, and the price fields of the line. A missing discount is returned as
0.0.
The filter is an exact match on the document number. The code sets no sort order, so the order of the lines is not guaranteed. If no POS document matches, an empty result set is returned.
Notes
- All reads use
NOLOCK. Uncommitted data can be returned. - Lines whose item no longer exists in
itemsare not returned, because the item is joined with an inner join. ItemPrice_Nettois calculated asPIendPrice - PIvatInPrice, i.e. the line total minus the VAT included in it.ItemPrice_Bruttois taken directly fromPIprice. The code does not show whether this is a unit price or a line price.Pixi_ApiEnvelopewrites the call time toAPI_STATISTICS. If a minimum interval is configured inAPI_CONTROLand the last call was too recent, the envelope returns aResultCode/ResultTextrow with code502instead of the invoice lines.- The output parameters
ResultCodeandResultTextcarry the envelope result (200/OKon success).
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
InvoiceNr
Required
|
varchar(20) string |
– |
Document number of the POS invoice ( Example: |
ResultCode
OUTPUT
|
char(3) string |
NULL |
Result code of the API envelope: Allowed values
Example: |
ResultText
OUTPUT
|
varchar(1024) string |
NULL |
Result text of the API envelope, e.g. Example: |
Result set 1 · If the API envelope returns 200 (call not throttled)
One row per line of the POS document with the given number.
| Column | Type | Description |
|---|---|---|
ItemNrInt
Nullable |
string |
Internal item number ( |
ItemEan
Nullable |
string |
EAN/UPC of the item ( |
ItemName
Nullable |
string |
Item name ( |
ItemQty
Nullable |
decimal |
Quantity of the line ( |
InvDate
Nullable |
dateTime |
Date of the POS document ( |
InvoiceNr
Nullable |
string |
Document number of the POS invoice ( |
ItemPrice_Brutto
Nullable |
decimal |
Gross price of the line ( |
ItemPrice_Netto
Nullable |
decimal |
Net amount, calculated as |
Discount
|
decimal |
Discount of the line ( |
ItemPrice_Total
Nullable |
decimal |
Final price of the line including VAT ( |
Result set 2 · If the call frequency limit from API_CONTROL is exceeded (returned by Pixi_ApiEnvelope instead of the lines)
Status row of the API envelope.
| Column | Type | Description |
|---|---|---|
ResultCode
|
char(3) string |
Always |
ResultText
|
varchar(1024) string |
Throttling message with the remaining wait time in milliseconds. |
Response example
<SqlRowSet1>
<row>
<ItemNrInt>100245</ItemNrInt>
<ItemEan>4006381333931</ItemEan>
<ItemName>Kugelschreiber blau</ItemName>
<ItemQty>2</ItemQty>
<InvDate>2024-03-15T14:32:00</InvDate>
<InvoiceNr>POS-100023</InvoiceNr>
<ItemPrice_Brutto>2.38</ItemPrice_Brutto>
<ItemPrice_Netto>4.00</ItemPrice_Netto>
<Discount>0.0</Discount>
<ItemPrice_Total>4.76</ItemPrice_Total>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| 502 | ({WaitMsec}) Frequency quote exceeded. Next call to this function can be made in ca. {WaitMsec} milliseconds | The function was called again before the minimum interval (`MIN_BREATHING_MSEC` in `API_CONTROL`) had passed. Wait for the given number of milliseconds and call again. |
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:pixiGetPosInvoiceLines>
<InvoiceNr>POS-100023</InvoiceNr>
<!-- <ResultCode>200</ResultCode> -->
<!-- <ResultText>OK</ResultText> -->
</ns1:pixiGetPosInvoiceLines>
</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:pixiGetPosInvoiceLines>
<InvoiceNr>POS-100023</InvoiceNr>
<!-- <ResultCode>200</ResultCode> -->
<!-- <ResultText>OK</ResultText> -->
</ns1:pixiGetPosInvoiceLines>
</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 = [
'InvoiceNr' => 'POS-100023',
// 'ResultCode' => '200',
// 'ResultText' => 'OK',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetPosInvoiceLines', $soapArguments);
- SQL object:
- dbo.pipiGetPosInvoiceLines