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

1 - Cash, 2 - Transfer, 3 - CardPersonally, 4 - Before, 5 - Voucher, 6 - DeliveryCash, 7 - GoPay, 8 - Payout

@SupplierOrderNo nvarchar(80) Supplier Order Number
@Note nvarchar(600) Note
@TransportID int Transport ID API_GetTransports.ID
@ExpeditionID int Expedition ID

1 - Immediately, 2 - Entire only

@LockRelease int Pause warehouse release (manually authorization required)

0 - OFF 1 - ON

@RealizationDate datetime Realization Date
@OrderTypeID int Order type ID

-1 - NA 0 - Personal, 1 - Warehouse, 2 - Intraday, 5 - Common, 6 - Warehouse (producer), 500 - Manufacturing (Assembly)

@SeparatedDocument int Separated document

0 - OFF 1 - ON

@FinalDocumentTypeID int Final document type ID

0 - OFF 5 - Receipt, 1 - Bank transfer invoice, 2 - Cash invoice, 10 - Delivery note

@WaitForNextOrder int Wait for next order

0 - OFF 1 - ON

@AddDeposits bit Add deposits

0 - NO 1 - YES

@DoNotOrderFromSupplier int Do not order from supplier

0 - Deactivated, 1 - Activated, -1 - Automatic

@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

-1 - Automatic selection

API_GetCustomers.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 all
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).