Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3276

Purchase Register Query Report

$
0
0

Dear Experts,

 

 

I want to add Row level freight1 amount with Excise & Non Excise  amount in Purchase Report. Kindly guide me the same.

 

 

DECLARE @StartDate DATETIME, @endDate DATETIME, @dummy INTEGER

SELECT TOP 1 @dummy = T0.DocEntry FROM OPCH T0 WHERE T0.DocDate >='[%0]' AND T0.DocDate <='[%1]'

SELECT @StartDate ='[%0]', @endDate ='[%1]'

 


SELECT T0.[DocEntry], T1.[SeriesName], T0.[DocNum]as 'A/P Invoice', T0.[CardCode]as 'Vendor Code', T0.[CardName]as 'Vendor Name',

(Select max(TaxId11) FROM CRD7 Where [CardCode] = T0.[CardCode] and [AddrType]='S')as 'TIN No',

T0.[NumAtCard]as 'Bill No', T0.[TaxDate]as 'Bill Date',

((Select Sum(LineTotal) From PCH1 where DocEntry=T0.DocEntry)-T0.[DiscSum])as 'Basic Amount',

(Select Sum(TaxSum) From PCH4 where statype IN (-90,-60,-55) and DocEntry=T0.DocEntry)as 'Excise Duty',

(Select Sum(LineTotal) From PCH3 Where DocEntry=T0.DocEntry)as 'P/Freight/Others',

(Select max(TaxRate) From PCH4 Where statype=1 and DocEntry=T0.DocEntry) as 'VAT %',

(Select Sum(TaxSum) From PCH4 Where statype=1 and DocEntry=T0.DocEntry) as 'VAT Amount',

(Select max(TaxRate) From PCH4 Where statype=4 and DocEntry=T0.DocEntry) as 'CST %',

(Select Sum(TaxSum) From PCH4 Where statype=4 and DocEntry=T0.DocEntry) as 'CST Amount',

(Select Sum(TaxSum) From PCH4 where statype IN (5,6,-10) and DocEntry=T0.DocEntry)as 'Service Tax',

T0.[WTSum]as 'TDS Amount', T0.[DocTotal]as 'Total', T0.[DpmAmnt]as 'Down Payment', T0.[RoundDif]as 'Round Off',

 


Case When (Select Max(LocCode) From PCH1 Where DocEntry=T0.DocEntry)=2 Then 'Thane'

     When (Select Max(LocCode) From PCH1 Where DocEntry=T0.DocEntry)=3 Then '' End 'Location'

 


FROM OPCH T0

LEFT OUTER JOIN NNM1 T1 ON T0.[Series] = T1.[Series]

WHERE T0.[DocDate] >=@StartDate AND T0.[DocDate] <=@endDate

ORDER BY T0.[DocDate]

 

Regards

Amol


Viewing all articles
Browse latest Browse all 3276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>