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

RE: Query, needs help.

$
0
0

Dear Experts,


I would need some enhancements on the below query to consider reconciliation date. E.g.


Invoice No: 1001

Invoice Date: 05.04.2014

Payment Date: 10.04.2014


When I run the report on 05.04.2014 - 09.04.2014, the stats would show 'Opened'


When I run the report on 10 onward, it should show 'Closed'


SELECT

  T0.DocDate AS 'Document Date'

, T0.DocEntry AS 'Document Entry'

, T0.DocDate As 'Document Status'

, T0.DocNum AS 'Document No.'

, T0.CardName AS 'Customer Name'

, T1.ItemCode AS 'Part No.'

, T1.Quantity AS 'Quantity'

, T1.LineTotal AS 'Total in LC'

, T1.TotalFrgn AS 'Total in FC'

, T2.ReconNum AS 'Recon. No.'

, T3.ReconDate AS 'Recon. Date'

, 'Status'=CASE

WHEN T0.DocDate < T3.ReconDate THEN 'O'

ELSE

'C'

END

FROM OINV T0 WITH (NOLOCK)

LEFT JOIN INV1 T1 WITH (NOLOCK) ON T1.DocEntry = T0.DocEntry

LEFT JOIN ITR1 T2 WITH (NOLOCK) ON T2.SrcObjAbs = T0.DocEntry AND T2.SrcObjTyp = T0.ObjType

LEFT JOIN OITR T3 WITH (NOLOCK) ON T3.ReconNum = T2.ReconNum

 

 

Please advice.


Viewing all articles
Browse latest Browse all 7999

Trending Articles



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