Integration_GoodsReturnSerialBatch Stored Procedure

<< Click to Display Table of Contents >>

Navigation:  iVend Database Database > Stored Procedures >

Integration_GoodsReturnSerialBatch Stored Procedure

Navigation: iVend Database Database > Stored Procedures >

hm_btn_navigate_prevhm_btn_navigate_tophm_btn_navigate_next

iVend 6.6 Database Help

Integration_GoodsReturnSerialBatch Stored Procedure

Collapse All Expand All

iVend Database Database : Integration_GoodsReturnSerialBatch Stored Procedure

Properties

Creation Date

4/13/2015 12:00 PM

Encrypted

dbimages_boolean-false

Ansi Nulls

dbimages_boolean-true

Parameters

Parameter

Direction

Description

Data Type

Size

@GoodsReturnKey

In

The Goods Return Key (Primary Key of InvGoodsReturn) for which the serial and batch information needs to be pulled from iVend.

VarWChar

50

@RETURN_VALUE

Return Value

 

Integer

4

Objects that Integration_GoodsReturnSerialBatch depends on

 

Database Object

Object Type

Description

Dep Level

InvBatch table

InvBatch

Table

Batch details gets affected when doing any transaction with item which has been batch tracked.

1

InvGoodsReturn table

InvGoodsReturn

Table

Stores the data related to Inventory Goods Return

1

InvGoodsReturnBatch table

InvGoodsReturnBatch

Table

Stores the data related to inventory goods return for batch

1

InvGoodsReturnDetail table

InvGoodsReturnDetail

Table

Stores the details of inventory goods return

1

InvGoodsReturnSerial table

InvGoodsReturnSerial

Table

Stores the data related to serial inventory goods return

1

InvSerial table

InvSerial

Table

Serial details gets affected when doing any transaction with the item which has been serial tracked.

1

Procedure Source Code

-- Goods Return transactions in iVend

--##SUMMARY_END

CREATE PROCEDURE [dbo].[Integration_GoodsReturnSerialBatch]

    @GoodsReturnKey NVARCHAR(50)

AS

BEGIN

SET NOCOUNT ON

SELECT InvGoodsReturn.GoodsReturnKey,

  InvGoodsReturnDetail.GoodsReturnDetailKey AS CXS_TDKY,

          'Serial' AS BSType,

          1 AS Quantity,

           InvSerial.SerialNumber AS InternalSerialBatchNumber,

           InvGoodsReturnDetail.LineNumber, isNull(InvSerial.SystemNumber, 0) AS SystemNumber,

  CONVERT(NVARCHAR, InvSerial.AdmissionDate, 112) As InDate,

  CONVERT(NVARCHAR, InvSerial.ExpirationDate, 112) As ExpDate,

  CONVERT(NVARCHAR, InvSerial.ManufacturingDate, 112) As PrdDate

FROM InvGoodsReturn INNER JOIN InvGoodsReturnDetail ON InvGoodsReturn.GoodsReturnKey = InvGoodsReturnDetail.GoodsReturnKey

      INNER JOIN InvGoodsReturnSerial ON InvGoodsReturnDetail.GoodsReturnDetailKey = InvGoodsReturnSerial.GoodsReturnDetailKey

      INNER JOIN InvSerial ON InvGoodsReturnSerial.SerialKey = InvSerial.SerialKey

WHERE InvGoodsReturn.GoodsReturnKey = @GoodsReturnKey

  UNION

SELECT InvGoodsReturn.GoodsReturnKey,

  InvGoodsReturnDetail.GoodsReturnDetailKey AS CXS_TDKY,

  'Batch' AS BSType,

  InvGoodsReturnBatch.Quantity AS Quantity,

  InvBatch.BatchNumber AS InternalSerialBatchNumber,

  InvGoodsReturnDetail.LineNumber,0 as SystemNumber,

  CONVERT(NVARCHAR, InvBatch.AdmissionDate, 112) As InDate,

  CONVERT(NVARCHAR, InvBatch.ExpirationDate, 112) As ExpDate,

  CONVERT(NVARCHAR, InvBatch.ManufacturingDate, 112) As PrdDate

FROM InvGoodsReturn INNER JOIN InvGoodsReturnDetail ON InvGoodsReturn.GoodsReturnKey = InvGoodsReturnDetail.GoodsReturnKey

      INNER JOIN InvGoodsReturnBatch ON InvGoodsReturnDetail.GoodsReturnDetailKey = InvGoodsReturnBatch.GoodsReturnDetailKey

      INNER JOIN InvBatch ON InvGoodsReturnBatch.BatchKey = InvBatch.BatchKey

WHERE   InvGoodsReturn.GoodsReturnKey = @GoodsReturnKey

ORDER BY CXS_TDKY, BSType, InternalSerialBatchNumber

END

See Also

Related Objects

iVend Database Database

 

 


© 2019 All Rights Reserved.

Send comments on this topic.