Never mind, I managed to find it myself and I would like to share it with all in the forum!
SELECT
'20130701' AS'OB as of',MAX(T1.FormatCode)AS'Acct.',SUM(T0.[Debit])AS'Debit',SUM(T0.[Credit])AS'Credit',SUM(T0.[Debit])-SUM(T0.[Credit])AS'OB'
FROM [dbo].[JDT1] T0
INNER JOIN OACT T1 ON T1.AcctCode =T0.Account
WHERE T0.RefDate <'20130701'
GROUP BY T1.AcctCode
ORDER BY T1.AcctCode
Hope this helps someone else!
Cheers,
Ajay Audich