
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[AccDocumentGoods]
AS
SELECT Header.ID, Header.Number, Header.UserNumber, Header.DocDate, Header.Flags, Header.IsPermanent, Item.ID AS ItemID, 
    Item.TotalID, Item.ControlID, Item.DetailID1, Item.DetailID2, Item.Credit, Item.Debit, Item.Description, CAST(COALESCE (Item.Confirmed,
    0) AS bit) AS Selected, dbo.FARSI_DATE2(Header.DocDate) as DocDatePer, Item.RelationID, Item.ShowOrder, Item.CostCenter, Item.Project, Header.TempNumber, 
    Header.TempDate, COALESCE (Item.Confirmed,0) as Confirmed 
FROM dbo.AccDocHeader as Header WITH (NOLOCK) LEFT OUTER JOIN
     dbo.AccDocItem as Item WITH (NOLOCK) ON Header.ID = Item.HeaderID
WHERE        (Header.ID > 0) AND (Item.ID > 0)
GO


