Skip to Content
0
Former Member
Dec 12, 2011 at 05:39 AM

Query

88 Views

Below This Query I need T1.[Description], T1.[Quantity] from IEI1

Ho I wiil create this query

DECLARE

@StartDate DATETIME,

@EndDate DATETIME,

@Dummy INTEGER

SELECT TOP 1 @Dummy = DocNum

FROM OIEI T0 WHERE T0.DocDate >= [%1] AND T0.DocDate <= [%2]

SELECT @StartDate='[%1]', @EndDate ='[%2]'

Select DISTINCT t0.DocNum as "Excise Invoice No", t0. DocDate AS "Bill Date",

T0.cardname as "Name of the Supplier" , T0.[NumAtCard][Supplier Inv.] ,

(Select max (T2.TaxId2)from CRD7 T2 where T2.CardCode = t0.CardCode) [Tin No.],

(Select sum(taxsum) FROM IEI4 where docentry = t0.docentry and statype=-90) as "Excise Duty" ,

(Select SUM(taxsum) FROM IEI4 where docentry = t0.docentry and statype=-60) as "Cess" ,

(Select SUM(taxsum) FROM IEI4 where docentry = t0.docentry and statype=-55) as "HCess"

FROM OIEI t0 INNER JOIN IEI4 t3 ON t0.DOCENTRY = t3.DOCENTRY INNER join IEI1 t5 on t0.docentry = t5.docentry INNER JOIN OITM T6 ON T5.ItemCode = T6.ItemCode

WHERE T0.cardname <> ' ' AND T0.DocDate >= @StartDate AND T0.DocDate <= @EndDate AND T6.[MatType]='1'

FOR BROWSE