StockInfo::GetFirstChange (Interface: StockInfo)
 
Initializes and fills the file of stock changes and positions on the first record.
 
VARIANT_BOOL GetFirstChange (
    enum eStockInfoType eStockInfoType,
    BSTR bsArtNum,
    VARIANT vWarehouse,
    VARIANT vLocation,
    VARIANT vSerialNumber,
    VARIANT_BOOL bWithPartitions,
    VARIANT_BOOL bChronological,
    VARIANT* pvTotalQnt
)
 
Parameters
eStockInfoType
[in] A value of the 'eStockInfoType' enumeration.
bsArtNum
[in] The article number of which you want to consult the stock changes. This article number cannot be blank (an exception will be thrown otherwise).
vWarehouse
[in] The warehouse for which you want to know the stock changes.
If you supply a VARIANT of subtype VT_EMPTY, all warehouses will be taken into account.
A VARIANT of subtype BSTR limits the records to this specific warehouse.
vLocation
[in] The location for which you want to know the stock changes.
If you supply a VARIANT of subtype VT_EMPTY, all locations will be taken into account.
A VARIANT of subtype BSTR limits the records to this specific location.
A specific location can only be supplied if the parameter vWarehouse contains a specific warehouse as well, otherwise an exception will be thrown.
vSerialNumber
[in] The serial number for which you want to know the stock changes.
If you supply a VARIANT of subtype VT_EMPTY, all serial numbers will be taken into account.
A VARIANT of subtype BSTR limits the records to this specific serial number.
bWithPartitions
[in] True if you want partitions to be added to the stock changes, otherwise False.
bChronological
[in] True if you want the stock changes to be presented in a chronological (according to the document date) order, otherwise False.
pvTotalQnt
[out] Returns a VARIANT, subtype DOUBLE, containing the total quantity of the requested stock info. This value is only reliable if the method returns True.
 
Return value
True if a file with stock changes can be created and it contains records, otherwise False.
 
Remarks
If the option 'Access management' is active, the user must have sufficient rights for consulting the asked stock change, otherwise an exception will be thrown.
E.g. if the user wants to consult the changes for 'On order', the right for Consultation stock 'on order' must be granted.
Supplying data or choosing a eStockInfoType for an option that is not active will result in an exception.
E.g. Supplying a serial number (vSerialNumber) or the value sitSerialNum for eStockInfoType if the option 'Serial Numbers' is not active, will throw an exception of type errSrlNotActive ('The Serial Number option is not installed or not active.').
If you have a lot of stock changes, creating the stock changes file can take several minutes!
 
See Also
CreateStockInfo
GetNextChange
 
Samples
 
C++
 
// Get all the stock changes for the item 'In stock' for article 'Art_001' in all warehouses, on all locations and for all serial numbers, without partitions and in chronological order.
VARIANT vTotalQnt;
if (pStockInfo->GetFirstChange (sitStock, "Art_001", NULL, NULL, NULL, VARIANT_FALSE, VARIANT_TRUE, &vTotalQnt))
{
    // Process data
}

C#
 
// Get all the stock changes for the item 'In stock' for article 'Art_001' in all warehouses, on all locations and for all serial numbers, without partitions and in chronological order.
object oWarehouse = null, oLocation = null, oSerialNumber = null, oTotalQnt;
if (oStockInfo.GetFirstChange (eStockInfoType.sitStock, "Art_001", oWarehouse, oLocation, oSerialNumber, false, true, out oTotalQnt))
{
    // Process data
}

VBS
 
' Get all the stock changes for the item 'In stock' for article 'Art_001' in all warehouses, on all locations and for all serial numbers, without partitions and in chronological order.
Dim oWarehouse, oLocation, oSerialNumber, oTotalQnt
If oStockInfo.GetFirstChange(sitStock, "Art_001", oWarehouse, oLocation, oSerialNumber, False, True, oTotalQnt) Then
    ' Process data
End If

VB.NET
 
' Get all the stock changes for the item 'In stock' for article 'Art_001' in all warehouses, on all locations and for all serial numbers, without partitions and in chronological order.
Dim oWarehouse, oLocation, oSerialNumber, oTotalQnt As Object
If oStockInfo.GetFirstChange(eStockInfoType.sitStock, "Art_001", oWarehouse, oLocation, oSerialNumber, False, True, oTotalQnt) Then
    ' Process data
End If