Quantcast
Channel: SCN: Message List - Reporting and Printing
Viewing all articles
Browse latest Browse all 2719

Re: Need to join two queries A/R statemet and Activity report

$
0
0

Hi,

 

Try this :

 

Declare @d datetime

set @d /*Select 1 from jdt1 t where t.duedate*/='[%0]'

 

 

SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number', 

T4.[ClgCode], T5.[U_NAME], T7.[Name] as Status,

T3.[U_AIS_DVIInvName] as 'SF Invoice Name',

(T3.U_AIS_DVISFSO) as 'SO#', T3.[DocDate],T3.Taxdate as 'Month Of Service',

T3.[U_AIS_DVIOpptyNm],T3.[U_AIS_DVIAdvNm],T3.[U_AIS_DVIManNm],T3.[U_AIS_DVIAcctNm], T4.[Recontact],

  T4.[Details], T4.[Notes], T4.[CntctType], T6.[Name],    

CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'   

       WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'

           ,ISNULL((SELECT T0.Debit-T0.Credit

           WHERE DateDiff(day, T0.DueDate,@d)=0

           and DateDiff(day, T0.DueDate,@d)=30 and

            DateDiff(day, T0.DueDate,@d)= 60 and DateDiff(day, T0.DueDate,@d)=90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days'

             FROM JDT1 T0

              INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode

             left  join OINV T3 on T3.CardCode=T1.CardCode

             left join OCLG T4 on t3.docentry = t3.docentry and  T3.[ObjType]  =  T4.[DocType]

              left outer JOIN OUSR T5 ON T4.UserSign = T5.USERID

              left outer join OCLT T6 ON T4.CntctType = T6.Code

left outer join OCLS T7 ON  T4.CntctSbjct = T7.Code where T4.[CntctType] =6 or T4.[CntctType] =7 and T1.CardType = 'C' 

 

Thanks & Regards,

Nagarajan


Viewing all articles
Browse latest Browse all 2719

Trending Articles



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