SQL Object
 
Syntax
 
SQL.CreateOrder(KlantNrCodeQuantity, TextLinesPriceDiscount _
            [, ProjectRef][, BezorgType][, NoPackingList,][ NoUpdateStatus])
 
Description
Generates a new order in the specified project, performing credit verification and applying debtor and/or project-specific pricing agreements.
 
When the function completes successfully, it also executes the SQL Server stored procedure
'sp_genereerPaklijst' is executed, which automatically updates the inventory. This also sets the packing list status to '5' so that the order can also be invoiced directly.
 
Returns the newly created order number on success, otherwise 0 (zero).
 
NOTE: The stored procedure only works with the default warehouse code.
 
Parameter
Description
KlantNr
Customer code, which is also used with the Relationship Management application, alphanumeric.
Code
An array of type Variant, contains the list of item numbers.
Quantity
An array of type Variant, contains the numbers, related to the Code array. Use only Long or Single values, because calculations are performed with the array values.
TextLines
An array of type String, contains the texts for the related Code array. Normally, article descriptions are applied here.
Price
An array of type Currency, contains all unit prices, related to the Code array.
Discount
An array of type Single, contains a discount percentage for each individual Code array item.
ProjectRef
An optional parameter of type String, which contains the name of the project under which the order is to be generated. If not specified, the default name 'BALIEVERKOOP' is used.
BezorgType
Optional. Used to set the delivery type:
0 = do not deliver
1..n delivery method, as set in menu/options.
NoPackingList
Optional. If TRUE, no packing list is created in the database.
NoUpdateStatus
Optional. If TRUE, when a packing list is created, the status is not set to 5 (ready to bill). Works only in combination with NoPacklingList=FALSE.
 
See Also
Example
Sub Main()
 
    Dim MyCode(5) As Long
    Dim MyQnty(5) As Single
    Dim MyText(5) As String
    Dim MyPric(5) As Currency
    Dim MyDisc(5) As Single
    Dim MyProject As String
 
    MyCode(1) = 703763
    MyQnty(1) = 3
    MyText(1) = "Weegschaal 30 kg"
    MyPric(1) = 35.75
    MyDisc(1) = 0
    MyCode(2) = 504554
    MyQnty(2) = 1.5
    MyText(2) = "Waspoeder Bont"
    MyPric(2) = 12.79
    MyDisc(2) = 0.15 ' 15 procent
    MyCode(3) = 440078
    MyQnty(3) = 15
    MyText(3) = "Weegschaal 30 kg"
    MyPric(3) = 35.75
    MyDisc(3) = 0.20 ' 20%
 
    MyProject = InputBox$("Project?")
 
    Debug.Print SQL.CreateOrder("BL4998", MyCode(), MyQnty(), MyText(), _
                                MyPric(), MyDisc(), MyProject, 0)
 
End Sub