USE [AL_QALAM_LIVE]
GO

/****** Object:  View [dbo].[view_MRQ_LIST2]    Script Date: 7/31/2020 4:43:57 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO





ALTER view [dbo].[view_MRQ_LIST2]
AS 
   select ROW_NUMBER() OVER (
      PARTITION BY [InvoiceType]
      ORDER BY [InvoiceType]
   ) row_num,c.Name as Company,i.ShipperID as shipperid,c.AdditionalInfo1 as CompanyShortForm,InvoiceDate,
   i.KeyField as KeyField,i.CreateLog as CreateByUserName,InvoiceID,DeliveryDate,Narration,g.Name as Department,
   InvoiceStatus,
   (Case when InvoiceStatus=1 then 'Pending' when InvoiceStatus=2 then 'Accepted' when InvoiceStatus=3 then 'Rejected' when InvoiceStatus=4 then 'Closed'  else '' end) as OrderStatus,
   '' as col_Action ,c.godownid as godownid,totalamount,discountamount,totaltaxamount as taxamount,netamount,InvoiceType,
   i.CreateLog as CreateLog,i.EditLog as EditLog,i.DeleteLog as DeleteLog
   from InvoiceMaster as i left outer join godowns  as g on i.Shipperid=g.GodownID
   inner join godowns as c on c.GodownID=i.GodownID




GO

