<< Click to Display Table of Contents >> Navigation: iVend Database Database > Stored Procedures > UpdateInventoryCost Stored Procedure |
Navigation: iVend Database Database > Stored Procedures >
iVend 6.6 Database Help
UpdateInventoryCost Stored Procedure
Collapse All Expand All
iVend Database Database : UpdateInventoryCost Stored Procedure |
Description
Used in replication to update the cost of an item if the costing method is set to enterprise
Properties
Creation Date |
4/13/2015 12:00 PM |
Encrypted |
|
Ansi Nulls |
Parameters
Parameter |
Direction |
Description |
Data Type |
Size |
@pProductCostUpdateLogKey |
In |
|
VarWChar |
50 |
@RETURN_VALUE |
Return Value |
|
Integer |
4 |
Objects that UpdateInventoryCost depends on
|
Database Object |
Object Type |
Description |
Dep Level |
Table |
Stores inventory details for each Product for each Warehouse |
1 |
||
Table |
Stores the log information for the Product cost |
1 |
||
Table |
Defines a list of all warehouses defined in the system. |
1 |
Procedure Source Code
CREATE PROCEDURE [dbo].[UpdateInventoryCost] ( @pProductCostUpdateLogKey nvarchar(50) ) AS BEGIN SET NOCOUNT ON Declare @ErrorDesc varchar(255), @lProductKey nvarchar(50), @lAverageCost DECIMAL(20,5), @lSubsidiaryKey nvarchar(50) Select @lProductKey = ProductKey , @lAverageCost = UpdatedCost, @lSubsidiaryKey = SubsidiaryKey From InvProductCostUpdateLog Where ProductCostUpdateLogKey = @pProductCostUpdateLogKey Update InvInventoryItem Set AverageCost = @lAverageCost Where ProductKey = @lProductKey And WarehouseKey IN (SELECT WarehouseKey From InvWarehouse Where SubsidiaryKey IN(@lSubsidiaryKey , 0)) IF(@@ERROR <>0) BEGIN SET @ErrorDesc = 'Error while updating the item cost.' GOTO ERRORHANDLER END RETURN ERRORHANDLER: RAISERROR('%s',16,-1,@ErrorDesc) RETURN END |
See Also
© 2019 All Rights Reserved.
Send comments on this topic.