I have incorporated the ability to modify an organization and archive an organization.
I added table "tblOrganizationArchive" when you modify the organization structure it then Archives the information.
In the current example it has two organization
4/1
qryTree
qryTree
| Agent |
|---|
| Main Agency |
| ----A |
| -------- C |
| ------------F |
| ------------G |
| -------- E |
| -----B |
| -------- D |
|
6/5
qryTree
qryTree
| Agent |
|---|
| Main Agency |
| ----A |
| --------E |
| ------------F |
| ------------G |
| ----B |
| --------D |
| Inactive |
| ----C |
on 6/5 F,G are put under E and C is moved to Inactive (and dated inactive)
I have the following sales.
The query will use the correct organization for the date of the sale
subFrmAgentSales
subFrmAgentSales
| SaleID | Agent | SaleAmount | DateSold |
|---|
15 | F | $10.00 | 5/1/2023 |
18 | G | $20.00 | 7/1/2023 |
So Sale 15 should use org 4/1 since that is the organization in place on that date
Sale 18 should use org 6/5
This gives the following
subFrmProcessedRoyalties
subFrmProcessedRoyalties
| Seller | Seller Level | Sale Amount | Date Sold | Royalty Agent | Royalty Agent Level | Royalty Percent | Royalty Amount | Date Processed | Organization Date | RoyaltyNote |
|---|
| F | 3 | $10.00 | 5/1/2023 | Main Agency | 0 | 40.00% | $4.00 | 6/6/2023 | 4/1/2023 | |
| F | 3 | $10.00 | 5/1/2023 | A | 1 | 30.00% | $3.00 | 6/6/2023 | 4/1/2023 | |
| F | 3 | $10.00 | 5/1/2023 | Main Agency | 0 | 20.00% | $2.00 | 6/6/2023 | 4/1/2023 | Royalty from Inactive Agent: C |
| F | 3 | $10.00 | 5/1/2023 | F | 3 | 10.00% | $1.00 | 6/6/2023 | 4/1/2023 | |
| G | 3 | $20.00 | 7/1/2023 | Main Agency | 0 | 40.00% | $8.00 | 6/6/2023 | 6/5/2023 | |
| G | 3 | $20.00 | 7/1/2023 | A | 1 | 30.00% | $6.00 | 6/6/2023 | 6/5/2023 | |
| G | 3 | $20.00 | 7/1/2023 | E | 2 | 20.00% | $4.00 | 6/6/2023 | 6/5/2023 | |
| G | 3 | $20.00 | 7/1/2023 | G | 3 | 10.00% | $2.00 | 6/6/2023 | 6/5/2023 | |
As you can see it is correct. For 15 it uses 4/1 and disperses correctly. Note that since on the date processed C was inactive the royalties went to main.
You will need several reports. I demoed a Detail level report and a way to select a specific sale.
View attachment 108306
View attachment 108307
This works and as I said in the beginning, I believe this is the proper design for doing something like this. I will say there are a whole lot of moving pieces to make this come together. So you will have to dig in.
If you spend the time and build some aggregate reports I can demo the filter by time. But you will need lots of reports
Royalties by Agent for example.