# HistoricSalesOrders

> Sales order lines moved to history (verkooporderhistorie), one flat row per invoice of a line with order, line, delivery and invoice data; count lines by sales_order_header_id + sales_order_line_id, not rows.

Subject: Sales orders.

Sales order lines moved to history (verkooporderhistorie), one flat row per invoice of a line with order, line, delivery and invoice data; count lines by sales_order_header_id + sales_order_line_id, not rows. The legacy ERP moves them here; the Fledge API only reads them. Questions about orders from the past need this set or the invoices, not only SalesOrderLines. Several field names are misleading: read the notes. Quantities and prices are per the article's price unit, as on SalesOrderLines.

Label in Fledge: Verkooporderhistorie.

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

## Example requests

```http
GET https://odata-api.fledge.nl/v2-8/HistoricSalesOrders?$filter=administration_id eq 1&$select=historic_sales_order_id,sales_order_header_id,sales_order_line_id,invoice_quantity,amount_of_packaging_slip,amount_ordered&$top=50
GET https://odata-api.fledge.nl/v2-8/HistoricSalesOrders(administration_id=1,historic_sales_order_id={historic_sales_order_id},sales_order_header_id='{sales_order_header_id}',sales_order_line_id={sales_order_line_id})
```

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `administration_id` (key) | Int32 | Administratienummer |
| `historic_sales_order_id` (key) | Int32, not null | Volgnummer |
| `sales_order_header_id` (key) | String, not null | Order nummer |
| `sales_order_line_id` (key) | Int32, not null | Order regel nummer |
| `actual_state_id` | Int32 | Courantstatus |
| `agent_id` | Int32 | Agent |
| `invoice_quantity` | Decimal | Aantal factuur. The quantity invoiced. |
| `amount_of_packaging_slip` | Decimal | Aantal pakbon. The quantity on the delivery note, not an amount of money. Repeated on every invoice row of the line: count each delivery_note_header_id + delivery_note_line_id once. |
| `amount_ordered` | Decimal | Aantal besteld. The quantity ordered, not an amount of money. |
| `article_group_id` | Int32 | Artikelgroep |
| `article_id` | String | Artikel |
| `based_upon_er` | Boolean | Op basis van VC/NC |
| `benchmark` | Decimal | Maatstaf intrastat-aangifte |
| `confirmation_date_1` | Date | Datum bevestiging |
| `confirmation_date_2` | Date | Datum bevestiging |
| `container` | Boolean | Vervoer via container ja/nee (intrastat-aangifte) |
| `cost` | Decimal | Kostprijs |
| `cost_system` | Int32 | Kostprijs systeem |
| `country_id` | Int32 | Landnummer |
| `created_by` | Int32 | User aanmaak |
| `creation_date` | Date | Datum aanmaak |
| `creditor_id` | Int32 | Leverancier |
| `currency_id` | Int32 | Valutacode |
| `currency_unit` | Int32 | Valuta eenheid |
| `debtor_company_name` | String | Bedrijfsnaam debiteur |
| `debtor_group_id` | Int32 | Debiteurgroep |
| `debtor_id` | Int32 | Debiteur |
| `deed_of_assignment` | Boolean | Akte van cessie (j/n) |
| `delivery_address_id` | Int32 | Aflever adres |
| `delivery_by` | Int32 | User pakbon |
| `delivery_condition_id` | Int32 | Leveringsconditie |
| `delivery_country_id` | Int32 | Landcode aflever adres |
| `delivery_method_id` | Int32 | Verzendmethode |
| `delivery_note_header_id` | String | Pakbon |
| `delivery_note_layout_id` | Int32 | Pakbon layout |
| `delivery_note_line_id` | Int32 | Pakbon regel |
| `delivery_note_memo` | String | Memo pakbon |
| `delivery_note_weight` | Decimal | Gewicht |
| `delivery_person_id` | Int32 | Aflever persoon |
| `description_1` | String | Omschrijving |
| `description_2` | String | Omschrijving |
| `description_3` | String | Omschrijving |
| `destination_address_id` | Int32 | Land bestemming: Land van bestemming (intrastat-aangifte). The destination country for the Intrastat declaration (CountryCodes), not an address. |
| `discount` | Decimal | Korting |
| `district_id` | Int32 | Rayon |
| `drawing_number` | String | Tekeningnummer |
| `exchange_rate` | Decimal | Koers |
| `factor` | Decimal | Factor verkoop eenheid |
| `financial_year` | Int32 | Boekjaar |
| `flow_of_goods_code_id` | Int32 | Intrastat goederenstroomcode |
| `function` | Int32 | Functie van de regel |
| `has_vat` | Boolean | BTW berekenen |
| `header_description` | String | Omschrijving order: Omschrijving verkooporderheader |
| `historical_user` | Int32 | User historie |
| `history_date` | Date | Datum historie |
| `import_origin` | Int32 | Order herkomst |
| `in_intrastat_declaration` | Boolean | Intrastat verwerkt: In intrastat-aangifte verwerkt. Processed in an Intrastat declaration. |
| `intrastat_code` | String | Intrastat nummer. An IntrastatItems code, not a goods code. |
| `intrastat_goods_code_id` | String | Intrastat goederencode. The goods code (IntrastatGoodsCodes). |
| `intrastat_intra_community_delivery_id` | Int32 | Soort ICT-order intrastat-aangifte. The Intrastat order type (0 domestic, 2 or 4 delivery to another country, 6 or 8 acquisition); not a key of another table. |
| `intrastat_moving_date` | Date | Datum intrastat: Datum goederenverplaatsing intrastat. The date the goods moved, for the Intrastat declaration. |
| `intrastat_report_period_id` | Int32 | Volgnummer. The Intrastat reporting period the row was declared in; 0 or empty when not declared. |
| `intrastat_traffic_area_id` | Int32 | Verkeersgebied code: Verkeersgebiedcode |
| `intrastat_weight` | Decimal | Gewicht voor intrastat-aangifte |
| `invoice` | String | Factuur. The invoice number. |
| `invoice_address_country_id` | Int32 | Landcode fact. adres: Landcode factuur adres |
| `invoice_address_id` | Int32 | Factuur adres |
| `invoice_date` | Date | Datum factuur. The date of the invoice. |
| `invoiced_by` | Int32 | User factuur |
| `invoice_debtor_id` | Int32 | Factuur debiteur: Factuurdebiteur |
| `invoice_layout_id` | Int32 | Factuur layout |
| `invoice_line` | Int32 | Factuur regel |
| `invoice_memo` | String | Memo factuur |
| `invoice_person_id` | Int32 | Factuur persoon |
| `invoice_relation_id` | Int32 | Relatie factuur debiteur: Relatie nummer factuur debiteur |
| `invoice_run_id` | Int32 | Factuur run |
| `invoice_value` | Decimal | Factuurwaarde intrastat-aangifte. The invoice value for the Intrastat declaration, not the invoiced amount. |
| `iso_code` | String | Landscode |
| `language_code` | Int32 | Taalcode |
| `line_reference` | String | Referentie verkooporderregel |
| `main_customer_relation_id` | Int32 | Relatie hoofd debiteur: Relatie nummer hoofd debiteur |
| `main_debtor_id` | Int32 | Hoofddebiteur |
| `memo` | String | Memo algemeen |
| `memo_line` | String | Memo regel |
| `nominal_price` | Decimal | Nominale prijs |
| `operator` | String | Operator verkoop eenheid |
| `order_acknowledgment_id` | Int32 | Orderbevestigingsnummer |
| `order_date` | Date | Datum order |
| `order_discount` | Decimal | Order korting |
| `origin` | Int32 | Herkomst (voorraad,inkoop,productie) |
| `our_ref` | String | Onze referentie |
| `packing_note_date` | Date | Datum pakbon |
| `partial_deliveries_allowed` | Boolean | Deellevering toegestaan |
| `part_of_country` | String | Landsdeel |
| `payment_condition_id` | Int32 | Betalingsconditie |
| `periodical_invoice` | Int32 | Periode factuur |
| `picklist_by` | Int32 | User picklist |
| `pick_list_date` | Date | Datum picklist |
| `picklist_header_id` | String | Picklist |
| `picklist_line_id` | Int32 | Picklist regel |
| `planning_date` | Date | Datum planning |
| `postage_price` | Decimal | Porto prijs |
| `postal_application_order_number` | String | Bestelnummer postapplicatie |
| `production_order` | String | Productieorder |
| `productionorder_sub` | Int32 | Productieorder schrap |
| `profit_margin_header` | Decimal | Winstmarge header |
| `profit_margin_line` | Decimal | Winstmarge regel |
| `purchase_order_id` | String | Inkooporder |
| `purchase_order_line_id` | Int32 | Inkooporder regel |
| `relation_id` | Int32 | Relatie nummer debiteur |
| `revision` | String | Revisie |
| `route_id` | Int32 | Route |
| `royalty_price` | Decimal | Royalty |
| `sale_group_id` | Int32 | Omzetgroep |
| `salesman_id` | Int32 | Verkoper |
| `sales_order_header_delivery_date_confirmed` | Date | Bevestigde leverdatum |
| `sales_order_header_delivery_date_confirmed_on` | Date | Leverdatum bevestigd op |
| `sales_order_header_is_confirmed` | Boolean | Bevestigd ja/nee |
| `sales_order_header_shift_reason` | String | Reden verschuiving |
| `sales_order_line_delivery_date_confirmed` | Date | Bevestigde leverdatum |
| `sales_order_line_delivery_date_confirmed_on` | Date | Leverdatum bevestigd op |
| `sales_order_line_is_confirmed` | Boolean | Bevestigd ja/nee |
| `sales_order_line_shift_reason` | String | Reden verschuiving |
| `sales_order_type_id` | Int32 | Verkooporder soort |
| `sales_price_excl_vat` | Decimal | Verkoopprijs bruto. Despite its name, the gross price per unit (before discount). |
| `sales_price_foreign_currency_excl_vat` | Decimal | Verkoopprijs bruto VV |
| `sales_price_foreign_currency_incl_vat` | Decimal | Verkoopprijs netto VV. Despite its name, the net price per unit in the foreign currency, without VAT. |
| `sales_price_with_vat` | Decimal | Verkoopprijs netto. Despite its name, the net price per unit (after discount), without VAT. |
| `sales_quotation_header_id` | String | Verkoopofferte |
| `sales_quotation_line_id` | Int32 | Verkoopofferte regel |
| `sales_unit` | Int32 | Verkoop eenheid |
| `sequence` | Int32 | Volgorde |
| `shipping_type_code_id` | Int32 | Vervoerwijze code: Intrastat vervoerwijzecode |
| `statistical_system_code_id` | Int32 | Stelsel-code: Intrastat statistisch stelsel code |
| `statistic_number` | String | Statistieknummer: Statistieknumer |
| `statistics_value` | Decimal | Statistische waarde intrastat-aangifte |
| `term_orders` | Boolean | In termijnen factureren (ja/nee) |
| `trademark_id` | Int32 | Handelsmerk id |
| `transaction_code_id` | Int32 | Transactie code intrastat |
| `transport_days` | Int32 | Transportdagen |
| `value_till` | Decimal | Waarde |
| `vat_category` | String | BTW rubriek |
| `vat_code` | Int32 | BTW code |
| `vat_number` | String | BTW-nummer |
| `warehouse_address_id` | Int32 | Magazijnadres |
| `warehouse_aisle_id` | Int32 | Magazijn |
| `warehouse_shelf_id` | Int32 | Magazijn locatie |
| `warranty_period_id` | Int32 | Garantie termijn |
| `weight_till` | Decimal | Gewicht |
| `your_ref` | String | Uw referentie |

## Relations

- `Administration` → [Administrations](https://docs.fledge.nl/en/api/reference/Administrations.md) (one)
- `Article` → [Articles](https://docs.fledge.nl/en/api/reference/Articles.md) (one)
- `ArticleMarketableStatus` → [ArticleMarketableStatuses](https://docs.fledge.nl/en/api/reference/ArticleMarketableStatuses.md) (one)
- `CountryCode` → [CountryCodes](https://docs.fledge.nl/en/api/reference/CountryCodes.md) (one)
- `Creditor` → [Creditors](https://docs.fledge.nl/en/api/reference/Creditors.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)
- `DeliveryNoteHeader` → [DeliveryNoteHeaders](https://docs.fledge.nl/en/api/reference/DeliveryNoteHeaders.md) (one)
- `DeliveryCondition` → [DeliveryConditions](https://docs.fledge.nl/en/api/reference/DeliveryConditions.md) (one)
- `HistoricProductionOrderHeader` → [HistoricProductionOrderHeaders](https://docs.fledge.nl/en/api/reference/HistoricProductionOrderHeaders.md) (one)
- `IntrastatGoodsCode` → [IntrastatGoodsCodes](https://docs.fledge.nl/en/api/reference/IntrastatGoodsCodes.md) (one)
- `IntrastatGoodsFlow` → [IntrastatGoodsFlows](https://docs.fledge.nl/en/api/reference/IntrastatGoodsFlows.md) (one)
- `IntrastatReportPeriod` → [IntrastatReportPeriods](https://docs.fledge.nl/en/api/reference/IntrastatReportPeriods.md) (one)
- `IntrastatStatisticsScheme` → [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)
- `InvoiceDebtor` → [Debtors](https://docs.fledge.nl/en/api/reference/Debtors.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)
- `MainCustomerRelation` → [Relations](https://docs.fledge.nl/en/api/reference/Relations.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)
- `PicklistHeader` → [PickListHeaders](https://docs.fledge.nl/en/api/reference/PickListHeaders.md) (one)
- `Relation` → [Relations](https://docs.fledge.nl/en/api/reference/Relations.md) (one)
- `RevenueGroup` → [RevenueGroups](https://docs.fledge.nl/en/api/reference/RevenueGroups.md) (one)
- `SalesDeliveryNoteLayout` → [SalesDeliveryNoteLayouts](https://docs.fledge.nl/en/api/reference/SalesDeliveryNoteLayouts.md) (one)
- `SalesInvoiceHeader` → [SalesInvoiceHeaders](https://docs.fledge.nl/en/api/reference/SalesInvoiceHeaders.md) (one)
- `SalesInvoiceLayout` → [SalesInvoiceLayouts](https://docs.fledge.nl/en/api/reference/SalesInvoiceLayouts.md) (one)
- `SalesInvoiceLine` → [SalesInvoiceLines](https://docs.fledge.nl/en/api/reference/SalesInvoiceLines.md) (one)
- `Salesman` → [Salesmen](https://docs.fledge.nl/en/api/reference/Salesmen.md) (one)
- `SalesOrderHeader` → [SalesOrderHeaders](https://docs.fledge.nl/en/api/reference/SalesOrderHeaders.md) (one)
- `SalesOrderLine` → [SalesOrderLines](https://docs.fledge.nl/en/api/reference/SalesOrderLines.md) (one)
- `SalesOrderType` → [SalesOrderTypes](https://docs.fledge.nl/en/api/reference/SalesOrderTypes.md) (one)
- `ShippingMethod` → [ShippingMethods](https://docs.fledge.nl/en/api/reference/ShippingMethods.md) (one)
- `VatCode` → [VatCodes](https://docs.fledge.nl/en/api/reference/VatCodes.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)
- `WarrantyPeriod` → [WarrantyPeriods](https://docs.fledge.nl/en/api/reference/WarrantyPeriods.md) (one)

---

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