USE [befri_Goldhoo]
GO

/****** Object:  View [Discount].[V_SalesItem]    Script Date: 2020/12/3 17:13:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE VIEW [Discount].[V_SalesItem]
AS
SELECT  a.ItemType, a.ItemId, a.ItemNumber, a.ItemName, a.AliasName, a.Spec, a.CostPrice, a.SalesPrice, a.SearchCode, 
                   a.InventoryCategoryId, a.CategoryNumber, a.CategoryName, a.DisplayOrder, a.MasterImageUrl, a.IsCustomizable, 
                   a.Added, a.Status, a.ZHInvName, a.ZHInvNumber, a.DZInvName, a.DZInvNumber, a.HandledUrl, a.IsDiscount, 
                   b.WarehouseId, b.Quantity AS InventoryAcc, b.DiscountCoef, ii.Introduction, a.DeliveryCycle, a.DeliveryCycleStr
FROM      shop_order.V_SalesItem AS a INNER JOIN
                   Discount.DiscountAcc AS b ON a.IsDiscount = 1 AND a.ItemId = b.InventoryId AND b.Quantity > 0 LEFT OUTER JOIN
                   basedata.InventoryIntro AS ii ON a.ItemId = ii.InventoryId
GO


