Factuur Business Central
Endpoint:
We gebruiken het standaard sales_invoice endpoint met een expand op factuurregels.
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesinvoice_get{custom_endpoint}?$filter=lastModifiedDateTime gt {lastModified:yyyy-MM-ddTHH:mm:ss.fffffZ} and status eq 'Open'&$expand=salesInvoiceLines
Let op, voor EDI moeten de volgende velden aan het endpoint toegevoegd worden. De klant plus het schip-aan-, zeil-aan- en factuur-aan-adres moeten daarom worden uitgebreid met een GLN die moet terugkeren uit de oproep.
- gln
- shipToGln
- sellToGln
- billToGln
De verwachte response ziet er als volgt uit.
{
"id": "9e0f5c9c-44e3-ea11-bb43-000d3a2feca1",
"number": "PS-INV103001",
"externalDocumentNumber": "",
"invoiceDate": "2019-01-15",
"postingDate": "2019-01-15",
"dueDate": "2019-01-15",
"customerPurchaseOrderReference": "",
"customerId": "f3a5738a-44e3-ea11-bb43-000d3a2feca1",
"customerNumber": "20000",
"customerName": "Trey Research",
"billToName": "Trey Research",
"billToCustomerId": "f3a5738a-44e3-ea11-bb43-000d3a2feca1",
"billToCustomerNumber": "20000",
"shipToName": "Trey Research",
"shipToContact": "Helen Ray",
"sellToAddressLine1": "153 Thomas Drive",
"sellToAddressLine2": "",
"sellToCity": "Chicago",
"sellToCountry": "US",
"sellToState": "IL",
"sellToPostCode": "61236",
"billToAddressLine1": "153 Thomas Drive",
"billToAddressLine2": "",
"billToCity": "Chicago",
"billToCountry": "US",
"billToState": "IL",
"billToPostCode": "61236",
"shipToAddressLine1": "153 Thomas Drive",
"shipToAddressLine2": "",
"shipToCity": "Chicago",
"shipToCountry": "US",
"shipToState": "IL",
"shipToPostCode": "61236",
"currencyId": "00000000-0000-0000-0000-000000000000",
"currencyCode": "USD",
"orderId": "00000000-0000-0000-0000-000000000000",
"orderNumber": "",
"paymentTermsId": "0ba5738a-44e3-ea11-bb43-000d3a2feca1",
"shipmentMethodId": "00000000-0000-0000-0000-000000000000",
"salesperson": "PS",
"pricesIncludeTax": false,
"remainingAmount": 0,
"discountAmount": 0,
"discountAppliedBeforeTax": true,
"totalAmountExcludingTax": 164.7,
"totalTaxAmount": 8.24,
"totalAmountIncludingTax": 172.94,
"status": "Paid",
"lastModifiedDateTime": "2020-08-21T00:25:58.337Z",
"phoneNumber": "",
"email": "helen.ray@contoso.com",
"gln": "", // UNB
"shipToGln": "", // NAD DP
"sellToGln": "", // NAD BY
"billToGln": "", // NAD IV
"salesInvoiceLines": [
{
"@odata.etag": "W/\"JzIwOzEyNjA3OTk0NzYwMjI4NjE4MTU2MTswMDsn\"",
"id": "ad3c34ad-c64a-453e-a485-25fd5833ce12",
"documentId": "00000000-0000-0000-0000-000000000000",
"sequence": 20000,
"itemId": "ad3c34ad-c64a-453e-a485-25fd5833ce12",
"accountId": "00000000-0000-0000-0000-000000000000",
"lineType": "Item",
"lineObjectNumber": "ITEMCODE-123",
"description": "Item omschrijving",
"description2": "",
"unitOfMeasureId": "00000000-0000-0000-0000-000000000000",
"unitOfMeasureCode": "",
"quantity": 2000,
"unitPrice": 21.9,
"discountAmount": 0,
"discountPercent": 0,
"discountAppliedBeforeTax": false,
"amountExcludingTax": 43800,
"taxCode": "GEEN BTW",
"taxPercent": 0,
"totalTaxAmount": 0,
"amountIncludingTax": 43800.00,
"invoiceDiscountAllocation": 0,
"netAmount": 43800,
"netTaxAmount": 0,
"netAmountIncludingTax": 43800,
"shipmentDate": "2023-11-14",
"itemVariantId": "00000000-0000-0000-0000-000000000000",
"locationId": "00000000-0000-0000-0000-000000000000"
}
]
}