# SalesOrderPaymentsViaOrderByTypeOrderId
Gets information about a single sales order
The expand query parameter corresponds to sections in the Visma.net.ERP.SalesOrders.Api.Dto.SalesOrder.SalesOrderDto.
If an expand value is not specified it will not be filled and returned in the response object.
Sample request:
`GET /salesorders/SO/000100?expand=customer,payment`
`GET /salesorders/SO/000100?expand=lines,linefees`
## Documentation
The expand query parameter corresponds to sections in the Visma.net.ERP.SalesOrders.Api.Dto.SalesOrder.SalesOrderDto.
If an expand value is not specified it will not be filled and returned in the response object.
Sample request:
`GET /salesorders/SO/000100?expand=customer,payment`
`GET /salesorders/SO/000100?expand=lines,linefees`
- Catalog: `NgSalesOrders`
- Schema: `SalesOrders`
This is a read-only table function. The Visma.net Financials API may not support changing the data or the Invantive UniversalSQL driver for Visma.net Financials does not cover it. In the latter case, please use the table NativePlatformScalarRequests to upload data to the Visma.net Financials API.
## Parameters of Table Function
The following parameters can be used to control the behaviour of the table function `SalesOrderPaymentsViaOrderByTypeOrderId`. A value must be provided at all times for required parameters, but optional parameters in general do not need to have a value and the execution will default to a pre-defined behaviour. Values can be specified by position and by name. In both cases, all parameters not specified will be evaluated using their default values.
Value specification by position is done by listing all values from the first to the last needed value. For example: a `select * from table(value1, value2, value3)` on a table with four parameters will use the default value for the fourth parameter and the specified values for the first three.
Value specification by name is done by listing all values that require a value. For example with `select * from table(name1 => value1, name3 => value3)` on the same table will use the default values for the second and fourth parameters and the specified values for the first and third.
| Name | Data Type | Required | Default Value | Documentation |
|---|:---:|:---:|:---:|---|
| `orderId` | `` | ☑ | | The id of the sales order to get |
| `type` | `` | ☑ | | The type of sales order to get |
## Columns of Table Function
The columns of the table function `SalesOrderPaymentsViaOrderByTypeOrderId` are shown below. Each column has an SQL data type.
| Name | Data Type | Label | Required | Documentation |
|---|:---:|---|:---:|---|
| `COMPANY_CODE` | `varchar2(30)` | Company Code | ☑ | Partition code, segmenting the data. |
| `COMPANY_NAME` | `varchar2(240)` | Company Name | ☑ | Name of the partition. |
| `amountAppliedToOrder` | `double` | | ☐ | The amount of the payment applied to the order |
| `balance` | `double` | Balance | ☐ | The balance of the payment |
| `billedAmount` | `double` | | ☐ | The amount of the payment that is applied to the order and transferred to related invoice(s) |
| `billing_address_city` | `varchar2` | | ☐ | The city |
| `billing_address_country_id` | `varchar2` | | ☐ | The id |
| `billing_address_country_name` | `varchar2` | | ☐ | The name |
| `billing_address_county_id` | `varchar2` | | ☐ | The id |
| `billing_address_county_name` | `varchar2` | | ☐ | The name |
| `billing_address_id` | `int32` | | ☐ | The address id |
| `billing_address_line1` | `varchar2` | | ☐ | Address line 1 |
| `billing_address_line2` | `varchar2` | | ☐ | Address line 2 |
| `billing_address_line3` | `varchar2` | | ☐ | Address line 3 |
| `billing_address_overridesDefault` | `char` | | ☐ | Whether this address overrides the default address |
| `billing_address_postalCode` | `varchar2` | | ☐ | The postal code |
| `billing_contact_attention` | `varchar2` | | ☐ | Any attention for the contact |
| `billing_contact_email` | `varchar2` | | ☐ | The e-mail address of the contact |
| `billing_contact_fax` | `varchar2` | | ☐ | The fax number of the contact |
| `billing_contact_id` | `int32` | | ☐ | The id of the contact |
| `billing_contact_name` | `varchar2` | | ☐ | The name of the contact |
| `billing_contact_overridesDefault` | `char` | | ☐ | Whether this overrides the default contact |
| `billing_contact_phone1` | `varchar2` | | ☐ | The phone number of the contact |
| `billing_contact_phone2` | `varchar2` | | ☐ | The secondary phone number of the contact |
| `branch_description` | `varchar2` | | ☐ | The description |
| `branch_id` | `varchar2` | | ☐ | The id |
| `cancelBy` | `datetime` | Cancel by | ☐ | The cancel date for the order |
| `cashAccount` | `varchar2` | Cash Account | ☐ | The cash account of the payment |
| `createdBy` | `varchar2` | | ☐ | The user name of the creator of the order. If the order was created by an API call this field will be null or empty. |
| `currencyId_2` | `varchar2` | | ☐ | CurrencyId for the order. |
| `currencyId` | `varchar2` | Currency ID | ☐ | The currency for the payment |
| `currencyRate` | `double` | | ☐ | The currency rate of the order. To calculate the order amount in base currency, take the order amount and multiply with the currencyRate. |
| `customFields_customDateTimeUtc1` | `datetime` | | ☐ | A free custom colum of type DateTime - in UTC timezone |
| `customFields_customDec1` | `double` | | ☐ | A free custom colum of type decimal with max 4 decimals. |
| `customFields_customDec2` | `double` | | ☐ | A free custom colum of type decimal with max 4 decimals. |
| `customFields_customInt1` | `int32` | | ☐ | A free custom colum of type int |
| `customFields_customInt2` | `int32` | | ☐ | A free custom colum of type int |
| `customFields_customStr1` | `varchar2` | | ☐ | A free custom colum of type string with max length 100. |
| `customFields_customStr2` | `varchar2` | | ☐ | A free custom colum of type string with max length 100. |
| `customFields_customStr3` | `varchar2` | | ☐ | A free custom colum of type string with max length 100. |
| `customFields_customStr4` | `varchar2` | | ☐ | A free custom colum of type string with max length 100. |
| `customFields_customStr5` | `varchar2` | | ☐ | A free custom colum of type string with max length 100. |
| `customer_contactId` | `int32` | | ☐ | The contact id for the customer |
| `customer_id` | `varchar2` | | ☐ | The unique id of the the customer |
| `customer_internalId` | `int32` | Customer Internal ID | ☐ | An internal unique id of the customer |
| `customer_location_corporateId` | `varchar2` | | ☐ | The corporate id of the location |
| `customer_location_countryId` | `varchar2` | | ☐ | The country code of the location |
| `customer_location_gln` | `varchar2` | | ☐ | The global localization number of the location |
| `customer_location_id` | `varchar2` | | ☐ | Location id |
| `customer_location_internalId` | `int32` | | ☐ | An internal id of the customer location |
| `customer_location_name` | `varchar2` | | ☐ | Location description |
| `customer_location_taxRegistrationId` | `varchar2` | | ☐ | The tax registration id of the location |
| `customer_location_warehouseId` | `varchar2` | | ☐ | The site id of the location |
| `customer_name` | `varchar2` | Customer Name | ☐ | The customer name |
| `customer_order` | `varchar2` | | ☐ | The customer order text |
| `customer_refNo` | `varchar2` | | ☐ | The customer ref number text |
| `customer_taxZone_description` | `varchar2` | | ☐ | The description |
| `customer_taxZone_id` | `varchar2` | | ☐ | The id |
| `date` | `datetime` | Date | ☐ | Date the order was submitted |
| `description` | `varchar2` | Description | ☐ | Description of the order |
| `documentType` | `varchar2` | Document Type | ☐ | The type of payment document that is applied to the sales order |
| `emailed` | `char` | Emailed | ☐ | Indicates if the document was emailed |
| `financialInformation_cashDiscountDate` | `datetime` | | ☐ | |
| `financialInformation_dueDate` | `datetime` | | ☐ | |
| `financialInformation_invoiceDate` | `datetime` | | ☐ | |
| `financialInformation_invoiceId` | `varchar2` | | ☐ | The id of the invoice issued for the order |
| `financialInformation_invoiceSeparately` | `char` | | ☐ | Whether the order should be invoiced separately |
| `financialInformation_postPeriod` | `varchar2` | | ☐ | The post period for the invoice |
| `financialInformation_terms_description` | `varchar2` | | ☐ | The description |
| `financialInformation_terms_id` | `varchar2` | | ☐ | The id |
| `freight_amountInBaseCurrency` | `double` | | ☐ | The amounts calculated based on the ship terms in base currency of the order. |
| `freight_amount` | `double` | | ☐ | The amounts calculated based on the ship terms.
/// |
| `freight_costInBaseCurrency` | `double` | | ☐ | The freight cost calculated for the sales order in base currency. |
| `freight_cost` | `double` | | ☐ | The freight cost calculated for the sales order, |
| `freight_premiumAmountInBaseCurrency` | `double` | | ☐ | The additional freight charges in base currency for handling the order. |
| `freight_premiumAmount` | `double` | | ☐ | The additional freight charges for handling the order. |
| `freight_taxCategoryId` | `varchar2` | | ☐ | The tax category that applies to the freight amount.
By default, it is the tax category associated with the ship via code selected for the order. |
| `freight_volume` | `double` | | ☐ | |
| `freight_weight` | `double` | | ☐ | |
| `isRotRutDeductible` | `char` | | ☐ | Whether the order is ROT/RUT deductible |
| `lastModified` | `datetime` | Last Modified | ☐ | Date the order was last modified
Unless a specific time zone offset is included (e.g. '2012-12-24T00:00:00+02:00'), the passed date is considered to be in the UTC time zone. |
| `note` | `varchar2` | Note | ☐ | Any notes on the order |
| `orderId` | `varchar2` | | ☐ | The unique identifier of the order |
| `orderQty` | `double` | Order Quantity | ☐ | The total quantity of inventory items in the order |
| `origin__links` | `varchar2` | | ☐ | Links applicable for the dto The JSON text of the nested object. |
| `origin_orderId` | `varchar2` | | ☐ | The unique id of the origin order |
| `origin_orderType` | `varchar2` | | ☐ | The order type code for the origin order |
| `originalOrderId` | `varchar2` | | ☐ | The unique identifier of the original order |
| `originalOrderType` | `varchar2` | | ☐ | The type code for the original sales order |
| `owner_id` | `varchar2` | Owner ID | ☐ | The identifier of the employee |
| `owner_internalId` | `varchar2` | Owner Internal ID | ☐ | The internal unique identifier of the employee |
| `parentCustomer_id` | `varchar2` | | ☐ | The unique id of the the customer |
| `parentCustomer_internalId` | `int32` | | ☐ | An internal unique id of the customer |
| `parentCustomer_name` | `varchar2` | | ☐ | The customer name |
| `paymentMethod` | `varchar2` | | ☐ | The payment method of the payment |
| `paymentSettings_cashAccountId` | `varchar2` | | ☐ | The cash account to use |
| `paymentSettings_paymentMethod_description` | `varchar2` | | ☐ | The description |
| `paymentSettings_paymentMethod_id` | `varchar2` | | ☐ | The id |
| `paymentSettings_paymentReference` | `varchar2` | | ☐ | The payment reference |
| `print_descriptionOnInvoice` | `char` | | ☐ | Set to true to print description on the invoice |
| `print_noteOnExternalDocuments` | `char` | | ☐ | Set to true to print note on external documents |
| `print_noteOnInternalDocuments` | `char` | | ☐ | Set to true to print note on internal documents |
| `project_description` | `varchar2` | Project Description | ☐ | The description |
| `project_id` | `varchar2` | Project ID | ☐ | The id |
| `project_internalId` | `int32` | | ☐ | An internal unique identifier of the project |
| `referenceNumber` | `varchar2` | Reference Number | ☐ | The reference number of the payment document |
| `reference` | `varchar2` | | ☐ | The external reference number of the payment |
| `requestOn` | `datetime` | Request On | ☐ | Date the order was requested |
| `rotRut_apartment` | `varchar2` | | ☐ | The apartment reference |
| `rotRut_distributedAmount` | `double` | | ☐ | The total amount distributed among the specified personal IDs |
| `rotRut_distributedAutomatically` | `char` | | ☐ | Whether the ROT/RUT is distributed automatically |
| `rotRut_estate` | `varchar2` | | ☐ | The estate reference |
| `rotRut_materialCostAmount` | `double` | | ☐ | Cost amount for lines with inventory ROT/RUT item type Material |
| `rotRut_organizationNumber` | `varchar2` | | ☐ | The organization number |
| `rotRut_otherCostAmount` | `double` | | ☐ | Cost amount for lines with inventory ROT/RUT item type OtherCost |
| `rotRut_totalDeductableAmount` | `double` | | ☐ | The total amount that is tax deductable |
| `rotRut_type` | `varchar2` | | ☐ | The type of ROT/RUT |
| `rotRut_workPriceAmount` | `double` | | ☐ | Price amount for lines with inventory ROT/RUT item type Service |
| `salesPerson_description` | `varchar2` | Sales Person Description | ☐ | The description |
| `salesPerson_id` | `varchar2` | Sales Person ID | ☐ | The id |
| `shipping_address_city` | `varchar2` | | ☐ | The city |
| `shipping_address_country_id` | `varchar2` | | ☐ | The id |
| `shipping_address_country_name` | `varchar2` | | ☐ | The name |
| `shipping_address_county_id` | `varchar2` | | ☐ | The id |
| `shipping_address_county_name` | `varchar2` | | ☐ | The name |
| `shipping_address_id` | `int32` | | ☐ | The address id |
| `shipping_address_line1` | `varchar2` | | ☐ | Address line 1 |
| `shipping_address_line2` | `varchar2` | | ☐ | Address line 2 |
| `shipping_address_line3` | `varchar2` | | ☐ | Address line 3 |
| `shipping_address_overridesDefault` | `char` | | ☐ | Whether this address overrides the default address |
| `shipping_address_postalCode` | `varchar2` | | ☐ | The postal code |
| `shipping_contact_attention` | `varchar2` | | ☐ | Any attention for the contact |
| `shipping_contact_email` | `varchar2` | | ☐ | The e-mail address of the contact |
| `shipping_contact_fax` | `varchar2` | | ☐ | The fax number of the contact |
| `shipping_contact_id` | `int32` | | ☐ | The id of the contact |
| `shipping_contact_name` | `varchar2` | | ☐ | The name of the contact |
| `shipping_contact_overridesDefault` | `char` | | ☐ | Whether this overrides the default contact |
| `shipping_contact_phone1` | `varchar2` | | ☐ | The phone number of the contact |
| `shipping_contact_phone2` | `varchar2` | | ☐ | The secondary phone number of the contact |
| `shipping_fobPoint_description` | `varchar2` | | ☐ | The description |
| `shipping_fobPoint_id` | `varchar2` | | ☐ | The id |
| `shipping_insurance` | `char` | | ☐ | Whether insurance applies to this shipping |
| `shipping_intrastatTransactionType_description` | `varchar2` | | ☐ | The description |
| `shipping_intrastatTransactionType_id` | `int32` | | ☐ | The id |
| `shipping_preferredWarehouse_description` | `varchar2` | | ☐ | The description |
| `shipping_preferredWarehouse_id` | `varchar2` | | ☐ | The id |
| `shipping_priority` | `int32` | | ☐ | Priority of the order |
| `shipping_residentialDelivery` | `char` | | ☐ | Whether this is residential delivery |
| `shipping_rule` | `varchar2` | | ☐ | The shipping rule |
| `shipping_saturdayDelivery` | `char` | | ☐ | Whether this is a saturday delivery |
| `shipping_scheduledDate` | `datetime` | | ☐ | The shipping scheduled date |
| `shipping_shipSeparately` | `char` | | ☐ | Whether this order can/is shipped separately |
| `shipping_shipVia_description` | `varchar2` | | ☐ | The description |
| `shipping_shipVia_id` | `varchar2` | | ☐ | The id |
| `shipping_terms_description` | `varchar2` | | ☐ | The description |
| `shipping_terms_id` | `varchar2` | | ☐ | The id |
| `shipping_zone_description` | `varchar2` | | ☐ | The description |
| `shipping_zone_id` | `varchar2` | | ☐ | The id |
| `status_2_cancelled` | `char` | | ☐ | Whether this order is in a cancelled state |
| `status_2_description` | `varchar2` | | ☐ | The status name for the order |
| `status_2_hold` | `char` | | ☐ | Whether this order is in a held state |
| `status` | `varchar2` | Status | ☐ | The status of the payment |
| `totalAmount` | `double` | Total Amount | ☐ | The total amount of the payment |
| `totals_costTotalInBaseCurrency` | `double` | | ☐ | The total of the costs on the lines of the sales order in base currency. |
| `totals_costTotal` | `double` | | ☐ | The total of the costs on the lines of the sales order. How the `costTotal` is calculated is dependent on the option `useReplacementCostForMarginAndProfit`.
If this option is `true` the `costTotal` will be calculated based on the `replacementUnitCost`.
If this option is `false`, the `costTotal` will be calculate based on `unitCost` |
| `totals_discountTotalInBaseCurrency` | `double` | | ☐ | The discount total in base currency |
| `totals_discountTotal` | `double` | | ☐ | The discount total |
| `totals_exciseDutyTotalInBaseCurrency` | `double` | | ☐ | The sum of excise duty for the lines in base currency |
| `totals_exciseDutyTotal` | `double` | | ☐ | The sum of excise duty for the lines |
| `totals_freightCostInBaseCurrency` | `double` | | ☐ | The freight cost calculated for the sales order in base currency. Not applicable for transfer order types. |
| `totals_freightCost` | `double` | | ☐ | The freight cost calculated for the sales order. Not applicable for transfer order types. |
| `totals_freightTotalInBaseCurrency` | `double` | | ☐ | The freight amount calculated in accordance with the shipping terms in base currency. Not applicable for transfer order types. |
| `totals_freightTotal` | `double` | | ☐ | The freight amount calculated in accordance with the shipping terms. Not applicable for transfer order types. |
| `totals_orderTotalInBaseCurrency` | `double` | | ☐ | The order total in base currency |
| `totals_orderTotal` | `double` | | ☐ | The order total |
| `totals_paymentTotalInBaseCurrency` | `double` | | ☐ | The total amount of payments connected to the order in the base currency |
| `totals_paymentTotal` | `double` | | ☐ | The total amount of payments connected to the order in the order currency |
| `totals_taxExemptTotalInBaseCurrency` | `double` | | ☐ | The VAT exempt total in base currency |
| `totals_taxExemptTotal` | `double` | | ☐ | The VAT exempt total |
| `totals_taxTotalInBaseCurrency` | `double` | | ☐ | The tax total in base currency |
| `totals_taxTotal` | `double` | | ☐ | The tax total |
| `totals_taxableTotalInBaseCurrency` | `double` | | ☐ | The VAT taxable in base currency |
| `totals_taxableTotal` | `double` | | ☐ | The VAT taxable total |
| `totals_unbilledAmountInBaseCurrency` | `double` | | ☐ | The sum of unbilled amounts for the lines in base currency |
| `totals_unbilledAmount` | `double` | | ☐ | The sum of unbilled amounts for the lines |
| `totals_unshippedAmountInBaseCurrency` | `double` | | ☐ | The sum of unshipped amounts for the lines in base currency |
| `totals_unshippedAmount` | `double` | | ☐ | The sum of unshipped amounts for the lines |
| `type` | `varchar2` | Type | ☐ | The type code for the sales order |
| `useReplacementCostForMarginAndProfit` | `char` | | ☐ | When this option is set to `true`, the `costTotal` of the order will be calculated based on `replacementUnitCost`.
If option is set to `false`, the `costTotal` will be calculated based on `unitCost` |
| `version` | `blob` | | ☐ | An internal order version used for detecting concurrent updates to an order |