StockVal
This method returns a product value according to some valorization methods passed as parameters (LIFO, FIFO, HIFO, AVG).
Syntax:
oBiz.StockVal(<nArticle>, [<nMethode>][, <bForceVal>][, <dDate>][, <nDocType>])
Parameter |
Description |
nArticle |
Item ID (ar_numero). |
nMethod |
Valuation method. This parameter is optional. If it is not defined, the parameter defined in the Item is used by default. The possible values for this parameter are: 1: purchases weighted average; 2: LIFO Last In First Out; 3: FIFO First In First Out; 4: HIFO Highest In First Out; 5: valuation according to the starting balance. |
bForceVal |
Allows to force the value returned to zero if the method returns a null. |
dDate |
Only the transactions up to this date are considered in the valuation. This parameter is optional. If the parameter is not defined, the today's date is used by default. |
nDocType |
Document type. This parameter is optional. If the parameter is not defined the Creditor Invoice (44) will be used by default. |
Examples:
*/ Instantiate end set the database location.
oBiz = createobject("bizinfo.application")
oBiz.cDatabasePath = "C:\WinBIZ Data"
oBiz.nCompany = 1000
oBiz.nYear = 2017
*/ Return the valuation according to the weighted average for item with ar_numero = 1523.
messagebox(oBiz.StockVal(1523, 1))
*/ Return the valuation according to the LIFO method for the item with ar_numero = 1523. The method can return NULL.
messagebox(oBiz.StockVal(1523, 2, .t.))
*/ Return the valuation according to the FIFO method for the item with ar_numero = 1523 and for the purchases up to the 31.08.2017.
messagebox(oBiz.StockVal(1523, 3, .f., {31.08.2017}))
*/ Return the valuation according to the FIFO method for the item with ar_numero = 1523, for the purchases up to the 31.08.2017. The valuation is based on the Receptions of Goods (type 42).
messagebox(oBiz.StockVal(1523, 3, .f., {31.08.2017}, 42))