I have a account hierarchy. I have accounts that are members of a parent account. Using accounts to handle soldtos and groups accounts (shiptos) children of soldto accounts.

We want to display in the invoice subpanel = the invoices belonging to the shiptos(children accounts) of the soldto accounts. basically the

account(soldto) -- 1-to-many -- account(shipto) -- 1-to-Many -- invoices.

Invoices are displaying on the account(shipto) page but need them to be displayed at the parent level (or grandparent level for invoices).

I figured out the sql I need to get the data I want:

SELECT INV.[id]
,INV.[name]
,INV.[date_entered]
,INV.[date_modified]
,INV.[description]
,INV.[assigned_user_id]
,INV.billing_account_id
FROM [suitecrm].[dbo].[aos_invoices] INV,
suitecrm.dbo.accounts P,
suitecrm.dbo.accounts C
Where
/* P.id = '307719' AND -- parent w/ one child w/ multi inv
*/ P.id = '303453' AND
P.id = C.parent_id AND
INV.billing_account_id = C.id
order by INV.billing_account_id, INV.id


but not sure where to add this and what all the steps are to make it all happen.

Thanks,
tammy Lewis