displayingfor invoices of 'member of' for Accounts

So we are pulling data from SAP. I have Accounts (soldtos) with accounts (shiptos) using the ‘Members of’ subpanel. All the invoices are assigned to shiptos.

I have been asked to create a subpanel on the Accounts (soldto) that displays all the invoices associated with the Accounts(shiptos).

any easy way to complete this?

Tammy

I do have the SQL for the panel. Just don’t know where to it and get the subpanel created…

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
GO

so I found

http://developer.sugarcrm.com/2013/02/27/add-custom-subpanel-in-accounts-module/

in the SugarCRM developers blog. but having problems. I modified to be invoices and used my sql. but now im getting an error and cant find it.

Last thing logged in sugarcrm log file is a query for security groups.

I found a How to add a custom subpanel but I had to play with the code because when I added in the function to pull the data - it had me break up my sql into select/from/where parts in an array. well those don’t get added to the query for the subpanel. I had to put all my query into the ‘where’ and put exists in() around it.

It works now.

Thanks,
Tammy B)