InventoryLocationQuantityUpdates Stored Procedure

<< Click to Display Table of Contents >>

Navigation:  iVend Database Database > Stored Procedures >

InventoryLocationQuantityUpdates Stored Procedure

Navigation: iVend Database Database > Stored Procedures >

hm_btn_navigate_prevhm_btn_navigate_tophm_btn_navigate_next

iVend 6.6 Database Help

InventoryLocationQuantityUpdates Stored Procedure

Collapse All Expand All

iVend Database Database : InventoryLocationQuantityUpdates Stored Procedure

Description

Updates the inventory location quantity depending on the delata update

Properties

Creation Date

9/18/2015 10:23 AM

Encrypted

dbimages_boolean-false

Ansi Nulls

dbimages_boolean-true

Parameters

Parameter

Direction

Description

Data Type

Size

@pInventoryLocationLogKey

In

Reference key of the Inventory Item Log.

VarWChar

50

@pDebug

In

Whether this procedure has to be executed in Debug mode or not

VarChar

1

@RETURN_VALUE

Return Value

 

Integer

4

Objects that InventoryLocationQuantityUpdates depends on

 

Database Object

Object Type

Description

Dep Level

InvInventoryLocation table

InvInventoryLocation

Table

Stores the location information for the Inventory available at different locations

1

InvInventoryLocationLog table

InvInventoryLocationLog

Table

Stores the logs or Audit information of location for the Inventory available at different locations

1

Procedure Source Code

CREATE PROCEDURE [dbo].[InventoryLocationQuantityUpdates]

(

@pInventoryLocationLogKey NVARCHAR(50),

@pDebug     CHAR(1) = 'N'

)

AS

BEGIN

SET NOCOUNT ON

Declare @ErrorDesc varchar(255)

If @pDebug = 'Y'

  SELECT 'UPDATE THE INVENTORY'

  UPDATE B

  Set B.AvailableQuantity = CASE WHEN UpdateType IN(0, 1) THEN B.AvailableQuantity + A.InQty - A.OutQty - ISNULL(A.AllocatedQuantity, 0) ELSE B.AvailableQuantity END,

   B.InStockQuantity = CASE WHEN UpdateType IN(0, 2, 3) THEN B.InStockQuantity + A.InQty - A.OutQty ELSE B.InStockQuantity END,

   B.OnFulFillmentQuantity = B.OnFulFillmentQuantity + ISNULL(A.OnFulfillmentQuanity,0),

   B.AllocatedQuantity = ISNULL(B.AllocatedQuantity, 0) + ISNULL(A.AllocatedQuantity, 0),

   B.Modified = A.Created

  FROM  InvInventoryLocationLog A,  InvInventoryLocation B

  WHERE A.ProductKey = B.ProductKey

  AND  A.WarehouseKey = B.WarehouseKey

  AND  A.LocationKey   = B.LocationKey

  AND  A.InventoryLocationLogKey = @pInventoryLocationLogKey

IF(@@ERROR <>0)

    BEGIN

  SET @ErrorDesc = 'Error while updating inventory'

        GOTO ERRORHANDLER

END

RETURN

ERRORHANDLER:

RAISERROR('%s',16,-1,@ErrorDesc)

RETURN

END

See Also

Related Objects

iVend Database Database

 

 


© 2019 All Rights Reserved.

Send comments on this topic.