I think this is what he wants.
The easiest way is to keep each alias individual but create a new code called GroupID. The Master Account will have the card alias of the master account therefore it is known that this is the master account. IF master account is not set, then it should stay blank so that it is easier to look for reseller accounts and to know that they are only CUSTOMERS and not resellers.
- for Sub Accounts, the GroupID must match the master account OR it can match a Sub account of a master account
eg:
- card alias 111 is master account of 111
- card alias 112 is subaccount of 111
- card alias 113 is subaccount of 111
- card alias 114 is subaccount of 113
- card alias 115 is subaccount of 114
- card alias 116 has no master account set.
Therefore it would look like this
Code:
Card Master sub sub-sub
Alias GroupID account account
111 111
112 111 111
113 111 111
114 113 111 113
115 114 111 113 114
116 none
Now the issue comes to searching for master accounts, master sub accounts, etc.
You need a few searches to be setup:
- Search master accounts by card alias = master account
- search resellers within a master account: master account = 111, search within
Now if you need to do CDR checking, then you will need to run a multilevel search. You need to match and check all Call Aliases and GroupIDs under a specific master account.
eg:
1: search for all subaccounts for 1 master account. Put into array.
2: check card aliases from 1st search and see if the master account matches any subaccounts from the master account. If so, add it to 1st search array.
3: redo step 2 from step 1's end point of array and only search the part of the array of 2nd search.
4: Rince and repeat until the loop does not find any more subaccounts.
Also I guess the master accounts should be able to have an admin interface too to setup their own subaccounts to.
Is this what you want to do?