I am a web developer and building an accounting system for a client however I am almost good at programming but very bad at accounting and maths; and my client is not able to explain/communicate properly and present the equation of the calculations. So, here is the matter:
This is about creating bill of sale of products and calculating rate, discount, tax and total. Screenshot of a related portion of the software
Suppose,
Original price (op) = 100
Discount (d) = 5
So, selling price (sp) (including tax) = 95
Tax rate (tr) = 15%
There are textboxes for showing product rate (pr), tax amount (ta) and taxable value (tv) which need to be calculated from about data. I am able to calculate these initially as following:
tv = sp / (1 + (tr / 100))
= 95 / (1 + (15 / 100))
= 95 / 1.15
= 82.61
ta = tv * (tr / 100)
= 82.61 * (15 / 100)
= 82.61 * 0.15
= 12.39
pr = tv + d
= 82.61 + 5
= 87.61
But I don't know and the client is not able to explain properly how to find other value (discount or product rate) if I change any of these two. If I change the discount then product rate and tax amount need to be recalculated, and if I change the product rate then discount and tax amount need to be recalculated. The tax rate (tr) 15 and selling price (sp) 95 are constants/fixed/readonly/non-editable.
According to this description, please give equations to find discount and product rate if any of these two is changed.
Assume you have a new pair of product rate ($pr$) and discount ($d$). Then $ tv = pr - d $
Tax amount ($ ta $) can then be calculated in the exact same way as before from the new taxable value ($tv$). Selling price ($sp$) equals
$ sp = \dfrac{100+tr}{100} \cdot tv $.
Let's see what happens if we assume a constant selling price ($sp$) and a constant tax rate ($tr$). Then
$tv = \dfrac{sp}{1 + \dfrac{tr}{100}}$
This means that taxable value ($tv$) is also constant. Now this implies that tax amount is also constant. In this case all that can change if we change the discount is
$pr = tv + d$
and if we change the product rate all that changes is discount
$d = pr - tv$.