Hi Mark...
Try This
SELECT
T0.DocDate as 'Posting Date',
T0.DocNum as 'AR Invoice Number',
T0.CardName,
T0.DocDate as 'Payment Date',
T1.DocNum as 'Incoming Payment Number ',
T0.VatSum,T0.TotalExpns as Frieght,
T0.DocTotal as 'AR Invoice Total', S1.SumApplied As Paidamt,
T1.TrsfrSum,
T1.CashSum,
T1.CreditSum,
T1.CheckSum,
FROM OINV T0
INNER JOIN RCT2 S1 ON T0.DocEntry = S1.DocEntry and s1.InvType='13'
LEFT JOIN ORCT T1 ON s1.DocNum = T1.DocNum
Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode
where T0.DocDate >='[%0]' and T0.DocDate <='[%1]'
Or try this simple query and bulid basic linking done
SELECT distinct T1.[InvoiceId], T0.[DocNum] as 'AR invoice no.', T1.[DocEntry],
t1.docnum as 'payment no.' FROM [dbo].[OINV]
T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry
where t0.docnum = '[%0]' and t0.cardcode = '[%1]'