# SalesOrderHeaders

> One sales order (verkooporder): who ordered it, who is invoiced, its dates, terms, currency and documents.

Subject: Sales orders.

One sales order (verkooporder): who ordered it, who is invoiced, its dates, terms, currency and documents. It holds no amounts: an order's value is the sum of its lines. Where its quantities are in the orderflow is on SalesOrderLineStatuses.

Label in Fledge: Verkooporder header.

| | |
| --- | --- |
| URL | `https://odata-api.fledge.nl/v2-8/SalesOrderHeaders` |
| Key | `administration_id`, `sales_order_header_id` |
| Administration-specific | yes: always filter on `administration_id` |
| Operations | GET list, GET one, POST, PATCH, DELETE |
| Read licenses | BASIS, URENPC |
| Write licenses | VERKOOP |
| Scopes | FLEDGE_PORTAL, FLEDGE_TERMINAL |

> **Watch out:** The Fledge API never sets is_finished, so it doesn't tell whether an order is done. Use the order's open status lines (SalesOrderLineStatuses/any(s: s/is_finished eq false and ...)).

> **Watch out:** is_confirmed goes back to false when a delivery note is made, so false doesn't mean never confirmed. For approval in the orderflow use status 2 on the open status lines.

> **Watch out:** order_discount is only a proposal for new lines (after a price agreement and the customer's group discount); the discount that counts is SalesOrderLines.discount_percentage.

## Example requests

```http
GET https://odata-api.fledge.nl/v2-8/SalesOrderHeaders?$filter=administration_id eq 1&$select=sales_order_header_id,confirmed_date,debtor_id,invoice_debtor_id&$top=50
GET https://odata-api.fledge.nl/v2-8/SalesOrderHeaders(administration_id=1,sales_order_header_id='{sales_order_header_id}')
```

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `administration_id` (key) | Int32 | Administratienummer |
| `sales_order_header_id` (key) | String, not null | Verkoopordernummer |
| `agent_id` | Int32 | verwijzing naar de tabel agnt (agent) |
| `changed_by` | Int32 | User laatste wijziging |
| `confirmed_date` | Date | Bevestigde leverdatum. The delivery date confirmed to the customer. |
| `confirmed_date_shift_reason` | String | Reden verschuiving |
| `confirmed_delivery_date_confirmed_on_date` | Date | Leverdatum bevestigd op |
| `cost_center_id` | Int32 | Verdeel oms nr: Kostenplaatsverdelingsnummer |
| `created_by` | Int32 | User aanmaak |
| `creation_date` | Date | Datum aanmaak |
| `currency_code_id` | Int32 | Valutanummer |
| `currency_unit` | Int32 | Eenheid valuta |
| `customer_group_id` | Int32 | Debiteurgroep nummer |
| `date_last_invoice` | Date | Datum faktuur: Datum laatste faktuur |
| `days_in_transport` | Int32 | Transportdagen |
| `debtor_id` | Int32 | Debiteurnummer. The customer (Debtors) who ordered. |
| `invoice_debtor_id` | Int32 | Faktuurdebiteur. The customer the invoice goes to; the order's own customer unless it invoices to another. |
| `deed_of_assignment` | Boolean | Akte van cessie (j/n) |
| `delivery_condition_id` | Int32 | Leveringsconditie |
| `delivery_note_relation_address_id` | Int32 | Afleveradres |
| `delivery_note_contact_person_id` | Int32 | Pakbon naar |
| `sales_delivery_note_layout_id` | Int32 | Layout |
| `description` | String | Verkooporderomschrijving |
| `district_id` | Int32 | verwijzing naar tabel rayn (rayon) |
| `entry_order_number` | Int32 | Vgn: Boekstukvolgnummer betaling |
| `entry_payment_number` | String | Boekstuk betaling |
| `exchange_rate` | Decimal | Koers |
| `financial_year_payment` | Int32 | Boekjaar betaling |
| `flow_of_goods_code_id` | Int32 | Intrastat goederenstroomcode |
| `is_finished` | Boolean | Afgesloten (ja/nee). Never set by the Fledge API, so it doesn't tell whether an order is done. Use the open status lines. |
| `has_vat` | Boolean | BTW j/n |
| `intrastat_destination_country` | Int32 | Land bestemming: Land van bestemming voor intrastat-aangifte. |
| `intrastat_traffic_area_id` | Int32 | Verkeersgebied code: Verkeersgebiedcode |
| `intrastat_transport_mode_id` | Int32 | Vervoerwijze code: Intrastat vervoerwijzecode |
| `intrastat_type_id` | Int32 | ICT: Soort order mbt intrastataangifte (0 = Nederland; 2 = ICL binnen EU; 4 = ICL buiten EU; 6 = ICV binnen EU; 8 = ICV buiten EU).. Values: 0 = Domestic (Nederland); 2 = Intra-community delivery, within the EU (ICL); 4 = Intra-community delivery, outside the EU; 6 = Intra-community acquisition, within the EU (ICV); 8 = Intra-community acquisition, outside the EU |
| `invoice_address_id` | Int32 | Faktuuradres |
| `invoice_contact_person_id` | Int32 | Faktuur naar: Faktuurpersoon |
| `sales_invoice_layout_id` | Int32 | Faktuur layout nummer |
| `invoice_rate_from_order_or_currency` | Int32 | Koers fact.: Koers die gebruikt wordt bij factureren (0 = koers van de order, 1= koers uit de valuta tabel) |
| `invoice_relation_id` | Int32 | Relatienr. fact.deb.: Relatienummer factuurdebiteur. The invoice customer's relation; set by the backend from invoice_debtor_id. |
| `is_confirmed` | Boolean | Bevestigd ja/nee. Whether an order confirmation (opdrachtbevestiging) was made. Set back to false when a delivery note is made, so false doesn't mean it was never confirmed. |
| `is_partial_delivery` | Boolean | Deellevering j/n |
| `is_instalment_invoice` | Boolean | Termijn facturering. An instalment order (termijnorder), invoiced through SalesOrderInstalments instead of per line. |
| `is_transport_by_container` | Boolean | Vervoer middels container (intrastat) ja/nee |
| `language_code_id` | Int32 | Taalkode |
| `last_change_date` | Date | Datum laatste wijziging |
| `last_delivery` | Date | Datum levering: Datum laatste levering |
| `leading_currency` | Int32 | Bepalende valuta. Which price the backend keeps on a foreign order and converts the other from.. Values: 0 = The local price leads; 1 = The foreign price leads |
| `memo` | String | Memo |
| `memo_production` | String | Memo productie |
| `order_confirmation_address` | Int32 | Bevestigingsadres: Adres opdrachtbevestiging |
| `order_confirmation_contact_person` | Int32 | Bevestiging naar: Opdrachtbevestiging contactpersoon |
| `order_confirmation_layout_id` | Int32 | Orderbevestigingsnummer |
| `order_date` | Date | Datum order. The date the order was placed. |
| `order_discount` | Decimal | Orderkorting. The customer's discount, proposed for a new line when neither a price agreement nor the customer's group discount gives one. It is not applied to the order: the line's discount_percentage is. |
| `order_week` | Int32 | Week order |
| `origin` | Int32 | Herkomst |
| `our_reference` | String | Onze referentie |
| `payment_condition_id` | Int32 | Betalingskonditie |
| `picklist_layout_id` | Int32 | Picklistlayout |
| `planning_date` | Date | Datum planning. The planned delivery date of the order. Each line has its own planning_date, which can differ. |
| `profit_margin` | Decimal | Winstmarge |
| `sales_quotation_header_id` | String | Offertenummer |
| `relation_id` | Int32 | Relatienr. orderdeb.: Relatienummer orderdebiteur. The customer's relation; set by the backend from debtor_id. |
| `route_id` | Int32 | Routenummer |
| `salesman_id` | Int32 | Verkopernummer |
| `sales_order_header_type` | Int32 | Type verkooporderorder. Values: 0 = Normal order; 2 = Take-away order (afhaalorder) |
| `sales_order_selection` | String | Selectie. A generated search string. Don't filter or parse it. |
| `sales_order_type_id` | Int32 | Verkooporder soort. The kind of order (soort), from SalesOrderTypes. Not the same as sales_order_header_type. |
| `shipping_method_id` | Int32 | Verzendmethode nummer |
| `statistical_system_code_id` | Int32 | Stelsel-code: Intrastat statistisch stelsel code |
| `statistic_number_id` | String | Statistiek nummer |
| `trademark_id` | Int32 | Handelsmerk id |
| `transaction_code_id` | Int32 | Transactie code intrastat |
| `warehouse_address_id` | Int32 | Adresnummer |
| `warehouse_aisle_id` | Int32 | Magazijn |
| `warehouse_shelf_id` | Int32 | Locatie |
| `planning_week` | Int32 | Week planning |
| `your_reference` | String | Uw referentie |

## Relations

- `Administration` → [Administrations](https://docs.fledge.nl/en/api/reference/Administrations.md) (one)
- `Agent` → [Agents](https://docs.fledge.nl/en/api/reference/Agents.md) (one)
- `ChangedByUser` → [Users](https://docs.fledge.nl/en/api/reference/Users.md) (one)
- `CostCenterDivisionDescription` → [CostCenterDivisionDescriptions](https://docs.fledge.nl/en/api/reference/CostCenterDivisionDescriptions.md) (one)
- `CountryCode` → [CountryCodes](https://docs.fledge.nl/en/api/reference/CountryCodes.md) (one)
- `CreatedByUser` → [Users](https://docs.fledge.nl/en/api/reference/Users.md) (one)
- `Debtor` → [Debtors](https://docs.fledge.nl/en/api/reference/Debtors.md) (one)
- `DebtorGroups` → [DebtorGroups](https://docs.fledge.nl/en/api/reference/DebtorGroups.md) (one)
- `DebtorInvoice` → [Debtors](https://docs.fledge.nl/en/api/reference/Debtors.md) (one)
- `DeliveryNoteAddress` → [RelationAddresses](https://docs.fledge.nl/en/api/reference/RelationAddresses.md) (one)
- `DeliveryNoteContactPerson` → [RelationContactPeople](https://docs.fledge.nl/en/api/reference/RelationContactPeople.md) (one)
- `DeliveryCondition` → [DeliveryConditions](https://docs.fledge.nl/en/api/reference/DeliveryConditions.md) (one)
- `District` → [Districts](https://docs.fledge.nl/en/api/reference/Districts.md) (one)
- `IntrastatGoodsFlow` → [IntrastatGoodsFlows](https://docs.fledge.nl/en/api/reference/IntrastatGoodsFlows.md) (one)
- `IntrastatStatisticScheme` → [IntrastatStatisticSchemes](https://docs.fledge.nl/en/api/reference/IntrastatStatisticSchemes.md) (one)
- `IntrastatTrafficArea` → [IntrastatTrafficAreas](https://docs.fledge.nl/en/api/reference/IntrastatTrafficAreas.md) (one)
- `IntrastatTransaction` → [IntrastatTransactions](https://docs.fledge.nl/en/api/reference/IntrastatTransactions.md) (one)
- `IntrastatTransportMode` → [IntrastatTransportModes](https://docs.fledge.nl/en/api/reference/IntrastatTransportModes.md) (one)
- `InvoiceAddress` → [RelationAddresses](https://docs.fledge.nl/en/api/reference/RelationAddresses.md) (one)
- `InvoiceContactPerson` → [RelationContactPeople](https://docs.fledge.nl/en/api/reference/RelationContactPeople.md) (one)
- `InvoiceRelation` → [Relations](https://docs.fledge.nl/en/api/reference/Relations.md) (one)
- `LanguageCode` → [LanguageCodes](https://docs.fledge.nl/en/api/reference/LanguageCodes.md) (one)
- `OrderConfirmationAddress` → [RelationAddresses](https://docs.fledge.nl/en/api/reference/RelationAddresses.md) (one)
- `OrderConfirmationContactPerson` → [RelationContactPeople](https://docs.fledge.nl/en/api/reference/RelationContactPeople.md) (one)
- `OrderConfirmationLayout` → [OrderConfirmationLayouts](https://docs.fledge.nl/en/api/reference/OrderConfirmationLayouts.md) (one)
- `PaymentTerm` → [PaymentConditions](https://docs.fledge.nl/en/api/reference/PaymentConditions.md) (one)
- `PicklistLayout` → [PicklistLayouts](https://docs.fledge.nl/en/api/reference/PicklistLayouts.md) (one)
- `Relation` → [Relations](https://docs.fledge.nl/en/api/reference/Relations.md) (one)
- `Route` → [Routes](https://docs.fledge.nl/en/api/reference/Routes.md) (one)
- `SalesDeliveryNoteLayout` → [SalesDeliveryNoteLayouts](https://docs.fledge.nl/en/api/reference/SalesDeliveryNoteLayouts.md) (one)
- `SalesInvoiceLayout` → [SalesInvoiceLayouts](https://docs.fledge.nl/en/api/reference/SalesInvoiceLayouts.md) (one)
- `Salesman` → [Salesmen](https://docs.fledge.nl/en/api/reference/Salesmen.md) (one)
- `SalesOrderType` → [SalesOrderTypes](https://docs.fledge.nl/en/api/reference/SalesOrderTypes.md) (one)
- `SalesQuotationHeader` → [SalesQuotationHeaders](https://docs.fledge.nl/en/api/reference/SalesQuotationHeaders.md) (one)
- `ShippingMethod` → [ShippingMethods](https://docs.fledge.nl/en/api/reference/ShippingMethods.md) (one)
- `WarehouseAddress` → [WarehouseAddresses](https://docs.fledge.nl/en/api/reference/WarehouseAddresses.md) (one)
- `WarehouseAisle` → [WarehouseAisles](https://docs.fledge.nl/en/api/reference/WarehouseAisles.md) (one)
- `WarehouseShelf` → [WarehouseShelfs](https://docs.fledge.nl/en/api/reference/WarehouseShelfs.md) (one)
- `DocumentLinks` → [DocumentLinks](https://docs.fledge.nl/en/api/reference/DocumentLinks.md) (many)
- `SalesOrderLines` → [SalesOrderLines](https://docs.fledge.nl/en/api/reference/SalesOrderLines.md) (many)
- `SalesOrderLineStatuses` → [SalesOrderLineStatuses](https://docs.fledge.nl/en/api/reference/SalesOrderLineStatuses.md) (many)
- `ServiceProductionLinks` → [ServiceProductionLinks](https://docs.fledge.nl/en/api/reference/ServiceProductionLinks.md) (many)

## Actions

- `POST SalesOrderHeaders/confirmPickedArticles` — body: `PickListConfirmations` PickListConfirmationDto[]: administration_id (Int32), sales_order_header_id (String), sales_order_line_id (Int32), sales_order_line_status_id (Int32), quantity (Decimal), is_completed (Boolean)
- `POST SalesOrderHeaders/deliverGoods` — body: `deliverGoods` DeliverGoodsDto: SalesOrderLineStatuses (DeliverGoodsSalesOrderLineStatusDto[]), null_deliveries (Boolean), delivery_date (Date), package_amount (Int32), total_value (Decimal), total_weight (Decimal), gross_total_weight (Decimal), waybill_id (String), memo (String) — returns DeliveryNoteHeader[]
- `POST SalesOrderHeaders/generatePicklist` — body: `SalesOrderLineStatuses` GeneratePicklistSalesOrderLineStatusDto[]: administration_id (Int32), sales_order_header_id (String), sales_order_line_id (Int32), sales_order_line_status_id (Int32), quantity_to_picklist (Decimal), is_finished (Boolean) — returns PickListHeader[]
- `GET SalesOrderHeaders/nextId(…)` — returns SalesOrderHeaderNextIdResultDto
- `POST SalesOrderHeaders(administration_id=1,sales_order_header_id='{sales_order_header_id}')/toSalesOrderConfirmation` — returns SalesOrderConfirmationHeader

---

Source: https://docs.fledge.nl/en/api/reference/SalesOrderHeaders
