Hi Millicent Darkwah
/* select t1.RefDate from jdt1 t1 */
declare @periodtodate as date
Set @periodtodate =/* T1.RefDate*/ '[%0]'
Select T0.cardcode ,t2.GroupName,T0.Cardname, sum(t1.debit - t1.credit) As Balance , T0.DebPayAcct As 'ControlAccount'
From ocrd T0
Inner join JDT1 T1 on T0.cardcode = t1.shortname
Inner join OCRG t2 on T0.GroupCode = t2.GroupCode
Where t1.RefDate <= @PeriodToDate and T0.CardType = 'C'
Group by T0.cardcode , T0.Cardname, t2.GroupName, T0.DebPayAcct
You can use the DebPayAcct from ocrd to check with the control account
Hope Helpful
Regards
Kennedy