https://forge.joomlapolis.com/https://forge.joomlapolis.com/favicon.ico?17095821032021-05-13T21:30:19ZJoomlapolis forgeCB Paid Subscriptions - Bug #8485: Tax rule "A fixed amount added/substracted from the item price, plus a percentage" does not function correctlyhttps://forge.joomlapolis.com/issues/8485?journal_id=221032021-05-13T21:30:19Zbeat
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/22103/diff?detail_id=29083">diff</a>)</li><li><strong>Status</strong> changed from <i>New</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>beat</i></li></ul> CB Paid Subscriptions - Bug #8485: Tax rule "A fixed amount added/substracted from the item price, plus a percentage" does not function correctlyhttps://forge.joomlapolis.com/issues/8485?journal_id=221042021-05-13T22:42:32Zbeat
<ul><li><strong>% Done</strong> changed from <i>0</i> to <i>70</i></li></ul><p>commit 4557d62ddc41a34933797d525fbfc75d957b4340 fixes the bug that both settings had same result with non-autorecurring baskets.</p>
<p>commit e95ec5be4f195994105fa932285b191924e9c71b clarifies the 2 settings for amount+tax and tax+amount for taxes:</p>
<p>- A fixed amount A, plus a percentage R of the item price P (A+(R*P))<br />- A fixed amount A, plus a percentage R of the sum of the item price P and of the fixed amount A (A+(R*(P+A)))</p>
<p>To implement the above use-case, following settings are working already fine, without this fix too:</p>
<p>A. Create a tax rule for your special partly taxed items<br />B. Create 4 tax rates, assigned to your tax rules:<br />1. Priority 1: remove fixed amount of 75 (fixed amount of -75)<br />2. Priority 2 (ordering: first of priority 2 for that tax rule): add federal tax of 8%<br />3. Priority 2 (if the local tax applies on same amount as federal tax, otherwise choose different priority): province tax<br />4. Priority 3: Add back the removed 75 (fixed amount of 75)</p>
<p>As replied here: <a class="external" href="https://www.joomlapolis.com/forum/255-developer-members-support/243869-taxes-help?start=6#324768">https://www.joomlapolis.com/forum/255-developer-members-support/243869-taxes-help?start=6#324768</a></p>
<p>I am leaving this bug open, as I need to test the cases of auto-recurring baskets with same or different initial prices before closing this bug.</p> CB Paid Subscriptions - Bug #8485: Tax rule "A fixed amount added/substracted from the item price, plus a percentage" does not function correctlyhttps://forge.joomlapolis.com/issues/8485?journal_id=221052021-05-14T09:16:09Zbeat
<ul></ul><a name="Complement-of-explanations"></a>
<h2 >Complement of explanations:<a href="#Complement-of-explanations" class="wiki-anchor">¶</a></h2>
<p>The general taxes and promotions compounder formula is:</p>
<pre>
(P+B)*(1+R)+A - P
</pre>
<p>where:</p>
<p>- P is the item Price<br />- B is the amount Before<br />- R is the rate in computed percents<br />- A is the amount After</p>
<p>The different settings are for:</p>
<p>1. R (with A=0 and B=0) for Percentage R setting<br />2. A (with R=0 and B=0) for Amount A setting<br />3. A and R (with B=0) for "A fixed amount A, plus a percentage R of the item price P (A+(R*P))" setting<br />4. B and R (with A=0) for "A fixed amount A, plus a percentage R of the sum of the item price P and of the fixed amount A (A+(R*(P+A)))" setting<br />5. B or R (never both same time, so when B is used then R=0, and always A=0) for "A fixed amount or percentage depending on the corresponding items price" setting</p>
<p>So with case 3 we have with B=0_</p>
<pre>
(P*(1+R)+A)-P
P + PR + A -P
PR + A
</pre>
<p>And for case 4 we have with A=0 (and in text above "A" is "B" in the generic formula:</p>
<pre><code>
(P + B) * (1 + R) - P
P + PR + B + BR - p
PR + B + BR
PR + B(1+R)
B+R(P+B)
</code></pre> CB Paid Subscriptions - Bug #8485: Tax rule "A fixed amount added/substracted from the item price, plus a percentage" does not function correctlyhttps://forge.joomlapolis.com/issues/8485?journal_id=221062021-05-14T10:01:38Zbeat
<ul></ul><a name="To-reply-to-the-question"></a>
<h3 >To reply to the question:<a href="#To-reply-to-the-question" class="wiki-anchor">¶</a></h3>
<blockquote>
<p>Can't we do a part of the price not taxed with a single tax rate ?</p>
</blockquote>
<p>Wanted (S is the tax Percentage ("R" renamed here to "S"):</p>
<pre>
S(P+C)
</pre>
<a name="1st-method-to-transform-the-formula-into-generic-compounder"></a>
<h3 >1st method to transform the formula into generic compounder:<a href="#1st-method-to-transform-the-formula-into-generic-compounder" class="wiki-anchor">¶</a></h3>
<pre>
(P+B)*(1+S)+A - P
</pre>
<p>Developing:</p>
<pre>
S(P+C)
P+S(P+C) -P
S(P+C)+P -P
(P+C)*S+P -P
(P+C)*(1 + (S-1) +P -P
</pre>
<p>In our generic compounder, we would need to have:</p>
<pre>
B=C
R=S-1
A=P
</pre>
<a name="Another-way-to-achieve-same"></a>
<h3 >Another way to achieve same:<a href="#Another-way-to-achieve-same" class="wiki-anchor">¶</a></h3>
<pre>
(P+C)S
P + (P+C) S -P
P(1+S) + SC - P
</pre>
<p>In that case:<br /><pre>
B=0
R=S
A=SC
</pre></p>
<a name="Check-with-an-example"></a>
<h3 >Check with an example:<a href="#Check-with-an-example" class="wiki-anchor">¶</a></h3>
<p>E.g. Wanted 5% tax on 200-70 = 130, means 130*0.05=6.50.</p>
<p>We have P=200, S=5%, C=-70:</p>
<p><strong>1st method:</strong></p>
<p>Applying it to:</p>
<pre>
(P+C)*(1 + (S-1)) +P -P
</pre>
<p>gives:</p>
<pre>
(200+(-70))*(1+(0.05-1))+200-200 = 6.5
</pre>
<p><strong>2nd method:</strong></p>
<p>Applying it to:</p>
<pre>
P(1+S) + SC - P
</pre>
<p>gives:</p>
<pre>
200*(1+0.05) + (-70*0.05) - 200 = 6.50
</pre>
<p>So that would work, but would be yet a new mode.</p>
<p>However, in case of promotions, it could be useful, so tempted to implement it as a new feature.</p> CB Paid Subscriptions - Bug #8485: Tax rule "A fixed amount added/substracted from the item price, plus a percentage" does not function correctlyhttps://forge.joomlapolis.com/issues/8485?journal_id=221732021-05-28T16:05:13Zbeat
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Resolved</i></li><li><strong>% Done</strong> changed from <i>70</i> to <i>100</i></li></ul> CB Paid Subscriptions - Bug #8485: Tax rule "A fixed amount added/substracted from the item price, plus a percentage" does not function correctlyhttps://forge.joomlapolis.com/issues/8485?journal_id=222542021-06-04T22:29:59Zbeat
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul>