If I have a total purchase composed of:
- Item A with a price of $20 and a quantity of 2, subject to a 10% tax rate.
- Item B with a price of $10 and a quantity of 3, subject to a 5% tax rate.
- Item C with a price of $5 and a quantity of 1, subject to a 7% tax rate.
In this scenario, the subtotal for the items amounts to $75.
If a flat $10 discount is applied to the subtotal, how can I accurately distribute this discount among the items, considering their respective tax rates, to ensure the final amount is correct to the cent?