For simplicity, suppose the following tables exist:
Table 1 - List of sellers
ID | Parent_ID | Percentage
----------------------------
1 | - | .5
2 | 1 | .4
3 | 2 | .3
This table shows 3 sellers. 1, primary parent, 2, individual with parents 1 and 3 with parent 2 and superuser 1. ID 1 receives a commission of 50% of all individual sales. Plus, the difference in commission for any subagents between their percentage levels.
For instance:
The following table will list the agent’s sales:
Table 2 - Sales agent
ID | Cost
-------------
2 | 10.00
2 | 5.00
3 | 9.00
In this case:
- Seller ID 3 will earn 30% of his sale, or $ 2.70.
- ID 2 40% (0,4 * 5 ) + (.4 * $10) = $6 / . (0,4 - 0,3) * $9,00 = 0,90 , 2 6,90 .
- 1 , : (.5-.4) (10.00) + (.5-.4) (5.00) + (.5-.4 ) * (9.00) = $2.40
( 1 ) ID 3 (.5-.3). , , , .
, mysql php ( ), , . . , 1 2 3 , - .
?