i have created a query based on A/R Invoice in which i need to show Delivery Document No
SELECT T0.[CardCode] as 'Business Partner Code', T0.[CardName] as 'Business Partner',convert(varchar(10),
T0.[DocDate],105) as 'Invoice Date',
T0.[DocNum] as 'Invoice No', T0.[DocTotal] as 'Invoice Amount',
T0.[PaidtoDate] as 'Invoice Paid Amount', (T0.[docTotal] - T0.[PaidtoDate]) as 'Remaining Invoice Amount',
when ('C') then 'Closed'
when ('O') then 'Open'
else 'Invalid Parameters' end AS 'Status'
FROM OINV T0
where CardCode between @CardCodeFrom and @CardCodeTo and DocDate between @DocFromDate and @DocToDate