pixiCustomersOpenCases
Returns the lock flag, open orders, unpaid invoices, invoice debt and open order amount of one customer, with the currency code the amounts refer to.
Returns a single row that sums up the open business of the customer identified by CustKey.
The behaviour depends on the setting MultiCurrencyEnabled.
Multi-currency disabled (setting is not 1):
Lockedis1if the customer'sSLockedflag is set to anything other thanN, otherwise0.OpenOrdersis the number of distinct order numbers that have at least one order line of this customer (Orderlines.CustRef) whose status is not a final state inOrderStates(FinalState = 'Y').OpenOrderAmountis the sum ofOrderLineAmountof these non-final order lines. The amounts are added up as stored, without currency conversion.UnpaidInvoicesis the number of invoices of the customer where the paid sum is not equal to the invoice total. A missing paid sum counts as0.DebtByInvoicesis the sum oftotal - PayedSumover all invoices of the customer.BaseCurrencyis the database currency code. It comes from the settingHomeCurrencyand must be a parent currency inpixi.Currency.
Multi-currency enabled (setting is 1):
- The counts are calculated in the same way.
- Each order line amount is divided by the exchange rate of its order header (
OrderHeader.ExchRateId). - Each invoice debt is divided by the exchange rate of the invoice (
Invoices.ExchRateId). - The results are therefore amounts in base currency.
BaseCurrencyis the code of the base currency of the customer's shop (Shops.BaseCurrencyId).
If no customer with the given CustKey exists, the result set is empty.
Notes
- All tables are read with
NOLOCK, so the figures may include uncommitted data. - Without multi-currency, order and invoice amounts in different currencies are added up unconverted.
BaseCurrencythen only gives the database currency code; it is not the actual currency of the sum. - With multi-currency enabled, the following records are left out of the amounts and counts: order lines whose order header has no matching exchange rate, and invoices without a matching exchange rate. No row is returned if the customer's shop or its base currency cannot be found.
- Invoices with a
NULLpaid sum are counted inUnpaidInvoices. Their debt is not part ofDebtByInvoices, becausetotal - NULLis ignored bySUM. - Overpaid invoices are also counted as unpaid and reduce
DebtByInvoices. DebtByInvoicesis0if the customer has no invoices.- The setting value is converted to
BIT. A non-numeric value other thantrue/falsecauses a conversion error.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
CustKey
Required
|
int | – |
Key of the customer ( Example: |
Result set 1 · If setting MultiCurrencyEnabled is not 1 and the customer exists
One row with the customer's open orders and invoices. Amounts are not converted.
| Column | Type | Description |
|---|---|---|
Locked
|
int |
|
OpenOrders
|
int |
Number of distinct orders with at least one order line in a non-final state. |
UnpaidInvoices
|
int |
Number of invoices whose paid sum differs from the total. |
DebtByInvoices
|
decimal |
Sum of |
OpenOrderAmount
|
decimal |
Sum of |
BaseCurrency
Nullable |
varchar(3) string |
Code of the database currency (setting |
Result set 2 · If setting MultiCurrencyEnabled is 1 and the customer, its shop and the shop's base currency exist
One row with the customer's open orders and invoices. Amounts are converted into the base currency.
| Column | Type | Description |
|---|---|---|
Locked
|
int |
|
OpenOrders
|
int |
Number of distinct orders with at least one non-final order line that has an exchange rate. |
UnpaidInvoices
|
int |
Number of invoices with an exchange rate whose paid sum differs from the total. |
DebtByInvoices
|
decimal |
Sum of |
OpenOrderAmount
|
decimal |
Sum of |
BaseCurrency
Nullable |
string |
Code ( |
Response example
<SqlRowSet1>
<row>
<Locked>0</Locked>
<OpenOrders>2</OpenOrders>
<UnpaidInvoices>1</UnpaidInvoices>
<DebtByInvoices>149.9000</DebtByInvoices>
<OpenOrderAmount>312.5000</OpenOrderAmount>
<BaseCurrency>EUR</BaseCurrency>
</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:pixiCustomersOpenCases>
<CustKey>10452</CustKey>
</ns1:pixiCustomersOpenCases>
</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:pixiCustomersOpenCases>
<CustKey>10452</CustKey>
</ns1:pixiCustomersOpenCases>
</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 = [
'CustKey' => '10452',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCustomersOpenCases', $soapArguments);
- SQL object:
- dbo.pipiCustomersOpenCases