API CreateOrder

Z Podpora.nextis.cz
Přejít na: navigace, hledání

Description

Method allows You to create new order in system.

Exact name

API_CreateOrder

Type

Standard executable stored procedure with table-Valued Parameters.


Specification

Parameter Data type Value range Description Relation
@Series nvarchar(10) Series number starts. Format: Series+Year+Auto Increment Number
@CurrencyID int Currency ID API_GetCurrency.ID
@CurrencyInCurrencyID int Currency in currency ID API_GetCurrency.ID
@ExchangeRate decimal(18,6) Exchange rate
@CustomerBranchID int Customer branch ID API_GetCustomers.ID
@PaymentMethodID int Payment method ID
@SupplierOrderNo nvarchar(80) Supplier Order Number
@Note nvarchar(600) Note
@TransportID int Transport ID API_GetTransports.ID
@ExpeditionID int Expedition ID
@LockRelease int Lock release
@RealizationDate datetime Realization Date
@OrderTypeID int Order type ID
@SeparatedDocument int Separated document
@FinalDocumentTypeID int Final document type ID
@WaitForNextOrder int Wait for next order
@AddDeposits bit Add deposits
@DoNotOrderFromSupplier int Do not order from supplier
@OrderNo nvarchar(25) Order number OUTPUT
@OrderID int Order ID OUTPUT

Table-Valued Parameters Specification

Columns name Data type Value range Description Relation
ProduktGroupID int ProduktGroupID API_GetProductGroups.ID
SupplierID int Supplier ID
Quantity decimal(14,2) Quantity
PurchasePriceInCurrency decimal(19,6) Purchase price in currency
PurchasePriceAfterDiscountInCurrency decimal(19,6) Purchase price after discount in currency

Return

Number : OK - Number of added items
-100 : Order could not be created

Example

DECLARE @return_value int
Declare @OrderItems dbo.ApiOrderItems 
Declare @_OrderNo nvarchar(25)
Declare @_OrderID int

Insert INTO @OrderItems
SELECT 232157, -1, 2, 300, 370
Union
SELECT 5650223, -1, 1, 20, 30

exec @return_value = dbo.[API_CreateOrder] 
@Series = 'ORD',
@CurrencyID = 16034,
@CurrencyInCurrencyID = 16034,
@ExchangeRate = 1,
@CustomerBranchID = 75,
@PaymentMethodID = 2,
@SupplierOrderNo = '',
@Note = 'Some note',
@TransportID = 2,
@ExpeditionID = 1,
@LockRelease = 0,
@RealizationDate = -1,
@OrderTypeID = 0,
@SeparatedDocument = 0,
@FinalDocumentTypeID = 0,
@WaitForNextOrder = 0,
@AddDeposits = 0,
@DoNotOrderFromSupplier = -1,
@OrderItems = @OrderItems,
@OrderNo = @_OrderNo OUTPUT,
@OrderID = @_OrderID OUTPUT

Select @return_value, @_OrderNo, @_OrderID

Notices

API_CreateOrder procedure uses own data type called OrderItems (dbo.ApiOrderItems).