Edit

SetStocktakeForLocation (productCode, count [, location] [, batchNum])

Return Type:  Boolean; true on success; false on error

Definition:  Updates the stocktake count for a product at a given location, and/or for a batch number.

A stocktake must be in progress. Normally you can use the Replace command or ReplaceField function to set a stocktake count for a product when multi-location inventory and batch numbered inventory is not in use. When they are, the stock for a location or batch is stored in a separate table from the product table, and new records may need to be created in that table. This function does that for you. The function can be used to implement a scripted import of stocktake data. It can be used for stock that does not have multiple locations or batches as well. The 3rd and 4th parameters are optional. When no location is supplied, the Default location is assumed.

It is an error to pass a non-existent or non-inventoried product; to call when a stocktake is not active; or for the batchNum parameter to be inconsistent with the batch-tracking status of the product.

Availability:  within an MWScript handler in MoneyWorks Gold 8.1.8 and later

See Also:

StocktakeNewQtyForLocation: Get the current stocktake quantity for a product for a given location

StocktakeStartQtyForLocation: Get the stocktake starting snapshot quantity for a product for a given location