Thanks Kennedy-
Most of our invoices have one line, some have two, if it is not a problem to have both lines show up on an aging the below in yellow would be helpful to add to the report. If not, the below in green would work.
Second I have added the tables below.
T0.[U_AIS_DVIInvName] as 'SF Invoice Name', T0.Taxdate as 'Month Of Service',isnull(T0.U_AIS_DVISFSO,T3.U_AIS_DVISFSO) as 'SO#',T0.NumAtCard as 'PO#',
isnull(T0.U_AIS_DVIAdvNm,T3.U_AIS_DVIAdvNm) as 'Advertiser', isnull(T0.U_AIS_DVIOpptyNm,T3.U_AIS_DVIOpptyNm) as
'Campaign',T1.Dscription,T1.Quantity as 'Impressions',T1.Pricebefdi as 'CPM', T1.linetotal as 'Total', T1.[LineVat],
T0.doctotal as 'Invoice Total',
T0.[U_AIS_DVIInvName] as 'SF Invoice Name', T0.Taxdate as 'Month Of Service',isnull(T0.U_AIS_DVISFSO,T3.U_AIS_DVISFSO) as 'SO#',T0.NumAtCard as 'PO#',
isnull(T0.U_AIS_DVIAdvNm,T3.U_AIS_DVIAdvNm) as 'Advertiser', isnull(T0.U_AIS_DVIOpptyNm,T3.U_AIS_DVIOpptyNm) as 'Campaign'
from ORIN T0
left outer join RIN1 T1 on T0.docentry = T1.docentry
left outer join RDR1 T2 on T1.Baseentry = T2.docentry and T1.baseline = T2.linenum
left outer join ORDR T3 on T2.docentry = T3.docentry