Integration_StockTransferSerialBatch Stored Procedure

<< Click to Display Table of Contents >>

Navigation:  iVend Database Database > Stored Procedures >

Integration_StockTransferSerialBatch Stored Procedure

Navigation: iVend Database Database > Stored Procedures >

hm_btn_navigate_prevhm_btn_navigate_tophm_btn_navigate_next

iVend 6.6 Database Help

Integration_StockTransferSerialBatch Stored Procedure

Collapse All Expand All

iVend Database Database : Integration_StockTransferSerialBatch 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

@StockTransferKey

In

(Primary Key of InvStockTransfer) for which the Stock Transfer information needs to be pulled from iVend

VarWChar

50

@RETURN_VALUE

Return Value

 

Integer

4

Objects that Integration_StockTransferSerialBatch 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

InvSerial table

InvSerial

Table

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

1

InvStockTransfer table

InvStockTransfer

Table

Stores stock transfer details

1

InvStockTransferBatch table

InvStockTransferBatch

Table

This gets affected in case the stock transfer is done for a batch product

1

InvStockTransferDetail table

InvStockTransferDetail

Table

Detail table which stores the stock transfer detail information.

1

InvStockTransferSerial table

InvStockTransferSerial

Table

This gets affected in case the stock transfer is done for a serially tracked product

1

Procedure Source Code

-- Stock Transfer transactions in iVend

--##SUMMARY_END

CREATE PROCEDURE [dbo].[Integration_StockTransferSerialBatch]

-- Add the parameters for the stored procedure here

@StockTransferKey NVARCHAR(50)

AS

BEGIN

-- SET NOCOUNT ON added to prevent extra result sets from

-- interfering with SELECT statements.

SET NOCOUNT ON;

SELECT C.StockTransferKey,

 B.StockTransferDetailKey ,

'Serial' AS BSType,

 A.SerialNumber AS InternalSerialBatchNumber,0 as Quantity,0 as QuantityOpened,

0 as QuantityShipped,0 as QuantityReceived, isNull(A.SystemNumber, 0) As SystemNumber,

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

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

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

FROM  InvSerial A INNER JOIN

                     InvStockTransferSerial B ON A.SerialKey = B.SerialKey INNER JOIN

                     InvStockTransfer C INNER JOIN

                     InvStockTransferDetail D ON C.StockTransferKey = D.StockTransferKey ON

                     B.StockTransferDetailKey = D.StockTransferDetailKey

Where (C.StockTransferKey =@StockTransferKey)

union

SELECT C.StockTransferKey,

 B.StockTransferDetailKey ,

'Batch' AS BSType,

 A.BatchNumber AS InternalSerialBatchNumber,B.Quantity,B.QuantityOpen,

 B.QuantityShipped,B.QuantityReceived,0 as SystemNumber,

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

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

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

FROM  InvBatch A INNER JOIN

                     InvStockTransferBatch B ON A.BatchKey = B.BatchKey INNER JOIN

                     InvStockTransfer C INNER JOIN

                     InvStockTransferDetail D ON C.StockTransferKey = D.StockTransferKey ON

                     B.StockTransferDetailKey = D.StockTransferDetailKey

Where (C.StockTransferKey =@StockTransferKey)

Order By B.StockTransferDetailKey, BSType, InternalSerialBatchNumber

--SELECT StockTransferKey

END

----------------------------------------------------------------------------------------------------------------------------------------------------------

See Also

Related Objects

iVend Database Database

 

 


© 2019 All Rights Reserved.

Send comments on this topic.