vw_ProductCost View

<< Click to Display Table of Contents >>

Navigation:  iVend Database Database > Views >

vw_ProductCost View

Navigation: iVend Database Database > Views >

hm_btn_navigate_prevhm_btn_navigate_tophm_btn_navigate_next

iVend 6.6 Database Help

vw_ProductCost View

Collapse All Expand All

iVend Database Database : vw_ProductCost View

Properties

Creation Date

9/12/2019 6:40 PM

Is Schema Bound

dbimages_boolean-false

Encrypted

dbimages_boolean-false

Ansi Nulls

dbimages_boolean-true

Columns

 

Column Name

Description

Datatype

Length

Allow Nulls

Default

Formula

 

ProductCost

 

Numeric

9 (20,5)

 

 

 

 

ProductKey

 

VarWChar

50

 

 

 

 

WarehouseKey

 

VarWChar

50

 

 

 

Objects that vw_ProductCost depends on

 

Database Object

Object Type

Description

Dep Level

CfgEnterprise table

CfgEnterprise

Table

Stores the basic configuration entries for the system . These settings are mandatory for the system to work properly.

2

CfgSiteInformation table

CfgSiteInformation

Table

Stores the site information. Enterprise always has the site id as 1. System Table Warning : Should not be modified directly

2

GetCompanyDateTime function

GetCompanyDateTime

User Defined Function

 

1

InvInventoryItem table

InvInventoryItem

Table

Stores inventory details for each Product for each Warehouse

1

InvProduct table

InvProduct

Table

Stores the product related details.

1

InvProductCost table

InvProductCost

Table

Store the historical cost of the product.

1

InvWarehouse table

InvWarehouse

Table

Defines a list of all warehouses defined in the system.

1

View Definition

CREATE VIEW [dbo].[vw_ProductCost]

AS

SELECT CASE A.CostingMethod WHEN 1 THEN ISNULL(AverageCost, 0)

      WHEN 2 THEN ISNULL

                       ((SELECT       TOP 1 Cost

                          FROM         InvProductCost WITH (NOLOCK)

                          WHERE        ProductKey = B.ProductKey AND WarehouseKey IN (C.WarehouseKey, '0') AND SubsidiaryKey IN (C.SubsidiaryKey, '0')

      AND IsDeleted = 0 AND CONVERT(VARCHAR, EffectiveDate, 112)

                                                    <= dbo.GetCompanyDateTime()

                          ORDER BY EffectiveDate DESC), 0)

      ELSE 0 END

      AS ProductCost,

       A.ProductKey, C.WarehouseKey

FROM dbo.InvProduct AS A

INNER JOIN dbo.InvInventoryItem AS B ON A.ProductKey = B.ProductKey

INNER JOIN dbo.InvWarehouse AS C ON C.WarehouseKey = B.WarehouseKey

See Also

Related Objects

iVend Database Database

 

 


© 2019 All Rights Reserved.

Send comments on this topic.