ap trial balance query

does anyone have a query that returns the value of the AP trial balance?  We want to extend that functionality to show line dist level detail of vouchers