<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Tax included supplier’s price leaves GRC hanging]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5978</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5978&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Tax included supplier’s price leaves GRC hanging.]]></description>
		<lastBuildDate>Wed, 14 Oct 2015 08:11:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24511#p24511</link>
			<description><![CDATA[<p>@apmuthu<br />Yes, I&#039;m aware of this supp_trans method. But in fact the purchasing module needs wider redesign anyway, so I don&#039;t want to introduce more changes in 2.3 than absolute minimum.<br />Thank you all for pointing this problem out <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" />.<br />Janusz</p>]]></description>
			<author><![CDATA[null@example.com (itronics)]]></author>
			<pubDate>Wed, 14 Oct 2015 08:11:24 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24511#p24511</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24509#p24509</link>
			<description><![CDATA[<p>I confirm &quot;Latest fix&quot; by @itronics does the job.</p><p>Thanks</p>]]></description>
			<author><![CDATA[null@example.com (Petros)]]></author>
			<pubDate>Tue, 13 Oct 2015 23:15:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24509#p24509</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24508#p24508</link>
			<description><![CDATA[<p>@Petros: Please try @itronics <a href="https://github.com/FrontAccountingERP/FA/commit/a9e2c0e710a5431ce3c31ef89d4c94bf69538238">latest fix</a> and revert with your findings.</p><p>@itronics: Please note that the same deprecated function in your fix is present in <strong>purchasing/includes/supp_trans_class.inc</strong> and check whether the same should be done there and the old function removed in it&#039;s entirety everywhere. The deprecated <strong>taxfree_charge_price()</strong> method/function is not being used in any standard extension.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 13 Oct 2015 20:57:38 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24508#p24508</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24504#p24504</link>
			<description><![CDATA[<p>@apmuthu<br />https://drive.google.com/file/d/0B8DlmARQ8isNc3Nuc0dWODRhYUk/view?usp=sharing</p><p>The Tax_calc.inc file that brought harmony between me, my received inventory and GRC account is in the link.</p><br /><p>Cheers.</p>]]></description>
			<author><![CDATA[null@example.com (Petros)]]></author>
			<pubDate>Tue, 13 Oct 2015 19:14:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24504#p24504</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24503#p24503</link>
			<description><![CDATA[<p>The issue <a href="http://https:/sourceforge.net/p/frontaccounting/git/ci/a9e2c0e710a5431ce3c31ef89d4c94bf69538238/">has been fixed</a>. <br />The unbalanced postings on clearing account were result of different net value calculations made in invoice and GRN processing. Now in both cases net value for goods received/invoiced is calculated from overall line tax included value.</p><p>Janusz</p>]]></description>
			<author><![CDATA[null@example.com (itronics)]]></author>
			<pubDate>Tue, 13 Oct 2015 19:04:08 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24503#p24503</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24502#p24502</link>
			<description><![CDATA[<p>I think that removing roundings is not the right way to solve the problem. All the GL postings are made with defined (usually 1 cent) accuracy, and this should be preserved. I guess the problem lies somewhere in calculations/roundings order. I will try investigate it.<br />Janusz</p>]]></description>
			<author><![CDATA[null@example.com (itronics)]]></author>
			<pubDate>Tue, 13 Oct 2015 17:01:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24502#p24502</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24493#p24493</link>
			<description><![CDATA[<p>Please post your version of the modified file that works with standard settings in preferences so that it&#039;s effect may be studies in the sales and other portions it may possibly affect.</p><p>@joe / @itronics: your insights please.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 13 Oct 2015 05:18:34 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24493#p24493</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24488#p24488</link>
			<description><![CDATA[<p>The culprit was found in taxes\tax_calc.inc like you hinted, I turned off the rounding function from all the lines (except the ones about shipping cost) and went back to my p.o. receive. </p><p>Yes! the inventory was valued correctly and once the supplier&#039;s invoice is processed, GRC account is NIL.<br />What&#039;s surprising again is that the purchase module continue to be flawless, while what was disrupting p.o receive was caught in taxes. It&#039;s easy to think why. A tax is a multiplier, it&#039;s a rate, and is not wise to round it as it&#039;s multiplied product is expected to be reconciled against physical documents. (The supplier&#039;s bill in our case). If anything we have to round, should be the product and not the tax nor the rate. Hence, turning it off from selected lines in tax_calc.inc makes sense.&nbsp; </p><br /><p>&#039;&#039;Rounding is done for consistent storage value in the db to persist across version changes of the db server.&#039;&#039;&nbsp; I am in support of the existence of rounding functions here and there, if I can add, application optimization is another reason. The round codes in all php files you listed above, their purpose is obvious and are essential. However, like I said in a previous post, it should round results and not multiplicative factors such as taxes and rates.</p>]]></description>
			<author><![CDATA[null@example.com (Petros)]]></author>
			<pubDate>Tue, 13 Oct 2015 00:11:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24488#p24488</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24484#p24484</link>
			<description><![CDATA[<p>@Petros: In file <strong>taxes/tax_calc.inc</strong> the functions <strong>get_tax_free_price_for_item()</strong> and <strong>get_tax_for_items()</strong> use the formula for calculation you stated.</p><p>Please see if these are the places you would like to change.</p><p>Rounding is done for consistent storage value in the db to persist across version changes of the db server.</p><p>Other places where such code is available are listed below.</p><p>In file <strong>purchasing/includes/db/supp_payment_db.inc</strong> lines 114 to 116 when $rate &lt;&gt; 0:</p><div class="codebox"><pre><code>        $supp_amount = round($amount / $rate, user_price_dec());
        $supp_discount = round($discount / $rate, user_price_dec());
        $supp_charge = round($charge / $rate, user_price_dec());</code></pre></div><p>In file <strong>purchasing/includes/db/invoice_db.inc</strong> lines 129 to 133:</p><div class="codebox"><pre><code>    foreach ($taxes as $n =&gt; $taxitem)
    {
        $taxes[$n][&#039;Value&#039;] =  round2($taxitem[&#039;Value&#039;], user_price_dec());
        $tax_total += $taxes[$n][&#039;Value&#039;];
    }</code></pre></div><p>and lines 137 to 143:</p><div class="codebox"><pre><code>    $item_added_tax = 0;
    if (!$supp_trans-&gt;tax_included)
    {
        $taxes = $supp_trans-&gt;get_taxes($supp_trans-&gt;tax_group_id);
        foreach ($taxes as $n =&gt; $taxitem)
            $item_added_tax += isset($taxitem[&#039;Override&#039;]) ? $taxitem[&#039;Override&#039;] : round2($taxitem[&#039;Value&#039;], user_price_dec());
    }</code></pre></div><p>In file <strong>purchasing/includes/supp_trans_class.inc</strong> lines 112 to 117:</p><div class="codebox"><pre><code>        foreach ($this-&gt;grn_items as $ln_itm) 
        {
            $items[] = $ln_itm-&gt;item_code;
            $prices[] =round( ($ln_itm-&gt;this_quantity_inv * $ln_itm-&gt;chg_price),
                user_price_dec());
        }</code></pre></div><p>lines 160 to 162:</p><div class="codebox"><pre><code>        foreach ($this-&gt;grn_items as $ln_itm)
            $total += round(($ln_itm-&gt;this_quantity_inv * $ln_itm-&gt;taxfree_charge_price($tax_group_id, $tax_group)),
             user_price_dec());</code></pre></div><p>lines 176 to 177:</p><div class="codebox"><pre><code>        foreach ($this-&gt;grn_items as $ln_itm)
            $total += round($ln_itm-&gt;this_quantity_inv * $ln_itm-&gt;chg_price, user_price_dec());</code></pre></div><p>In file <strong>purchasing/includes/po_class.inc lines</strong> 141 to 144:</p><div class="codebox"><pre><code>        foreach ($this-&gt;line_items as $ln_itm) {
            $items[] = $ln_itm-&gt;stock_id;
            $prices[] = round($ln_itm-&gt;price * ($receival ? $ln_itm-&gt;receive_qty : $ln_itm-&gt;quantity),  user_price_dec());
        }</code></pre></div><p>lines 164 to 184:</p><div class="codebox"><pre><code>    function get_trans_total() {
        
        $total = 0;
        $dec = user_price_dec();

        foreach ($this-&gt;line_items as $ln_itm) {
            $items[] = $ln_itm-&gt;stock_id;
            $value = round($ln_itm-&gt;quantity * $ln_itm-&gt;price, $dec);
            $prices[] =$value;
            $total += $value;
        }

        if (!$this-&gt;tax_included ) {
            $taxes = get_tax_for_items($items, $prices, 0, $this-&gt;tax_group_id,
            $this-&gt;tax_included,  $this-&gt;tax_group_array);

            foreach($taxes as $tax)
                $total += round($tax[&#039;Value&#039;], $dec);
        }
        return $total;
    }</code></pre></div><p>In file <strong>purchasing/po_entry_items.php lines</strong> 465 to 470:</p><div class="codebox"><pre><code>            foreach($cart-&gt;line_items as $key =&gt; $line) {
                $inv-&gt;add_grn_to_trans($line-&gt;grn_item_id, $line-&gt;po_detail_rec, $line-&gt;stock_id,
                    $line-&gt;item_description, $line-&gt;receive_qty, 0, $line-&gt;receive_qty,
                    $line-&gt;price, $line-&gt;price, true, get_standard_cost($line-&gt;stock_id), &#039;&#039;);
                $inv-&gt;ov_amount += round2(($line-&gt;receive_qty * $line-&gt;price), user_price_dec());
            }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 12 Oct 2015 17:48:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24484#p24484</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24480#p24480</link>
			<description><![CDATA[<p>I&#039;m afraid that will just remove rounding from purchasing prices applied in p.o and supplier&#039;s invoice. We need to remove rounding from taxfree_charge_price.<br />You see rounding can exist behind the screen but it should round the right items. In our case what fa does upon p.o. receive is:<br />ENTERED QTY X (ROUND($4.5/1.05,2))=INVENTORY VALUE<br />But what it should do is:<br />ENTERED QTY X ($4.5/1.05)=ROUND(INVENTORY VALUE,2)<br />Or<br />It should stop rounding at all as the functions in display would round it anyway.</p>]]></description>
			<author><![CDATA[null@example.com (Petros)]]></author>
			<pubDate>Mon, 12 Oct 2015 16:01:34 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24480#p24480</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24471#p24471</link>
			<description><![CDATA[<p>Please try to replace line 106 in <strong>purchasing/includes/purchasing_db.inc</strong>:<br /></p><div class="codebox"><pre><code>    $price = round($price * $data[&#039;conversion_factor&#039;], user_price_dec());</code></pre></div><p>with<br /></p><div class="codebox"><pre><code>    $price = $price * $data[&#039;conversion_factor&#039;];</code></pre></div><p>along with the default setting in preferences for the decimals and revert. Also state if there was any other place where the said function <strong>user_price_dec()</strong> should not be used.</p><p>The <strong>user_price_dec()</strong>, it appears, should be used only for display purposes and the highest precision should be used while storing data. This, of course, is limited to the number of decimal places available in the table&#039;s field where it is stored.</p><p>If this were to work, then all places where INSERT / UPDATE / REPLACE are used with this function, should be re-examined.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 12 Oct 2015 05:49:17 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24471#p24471</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24469#p24469</link>
			<description><![CDATA[<p>FLOAT_COMP_DELTA&nbsp; doesn&#039;t seem to have an effect (in fact left me with a blank web page at a point <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /> ) <br />I managed to successfully receive items without left-over GRC balances by setting my decimal places to 10 digits. Once again confirming that it is the setting in preferences that affects inventory valuation during POD. I insist we nullify the effect of&nbsp; &nbsp;user_price_dec() during p.o. receiving.</p>]]></description>
			<author><![CDATA[null@example.com (Petros)]]></author>
			<pubDate>Sat, 10 Oct 2015 23:38:12 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24469#p24469</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24468#p24468</link>
			<description><![CDATA[<p>There is a constant defined as <strong>FLOAT_COMP_DELTA</strong> - see if it affects your values. Check it&#039;s appearance in <strong>purchasing/includes/db/suppliers_db.inc</strong> under function <strong>get_supplier_details()</strong> for the sql statement&#039;s WHERE clause:<br /></p><div class="codebox"><pre><code>&quot;AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc &gt; &quot;.FLOAT_COMP_DELTA</code></pre></div><p>A similar code fragment is in <strong>purchasing/includes/db/supp_trans_db.inc</strong> in function <strong>get_sql_for_supplier_inquiry()</strong> apart from other files.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 10 Oct 2015 19:16:11 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24468#p24468</guid>
		</item>
		<item>
			<title><![CDATA[Tax included supplier’s price leaves GRC hanging]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=24465#p24465</link>
			<description><![CDATA[<p>This error occurs when dealing with large quantity credit purchase from a supplier whose price includes tax.<br />Suppose a supplier “X” whose price includes tax and a P.O. for 5000 pcs of item “X” @ $4.35.</p><p>Receive the whole of the P.O. quantity. (i.e. process POD)<br />Book the supplier’s invoice.<br />Now, go and check on Trial balance or Balancesheet or GL enquiry how it all worked out.<br />You’ll find out that inventory is properly received. A/P and pertaining sales tax are registered and surprisingly, there is uncleared balance on GRC account. Why?<br />During the POD processing, the POD, instead of simply picking up details from the P.O., it is coded to engage itself in to developing a new inventory rate, net of tax and rounded to &quot;user defined&quot; decimal places. And that rounding difference multiplied by large qty such as 5000 pcs leaves Goods Received Clearing account with uncleared balance of, say, $14.<br />SOLUTION<br />Whoever can go through the codes for POD and stop it from rounding the rate it developed, solves the problem.</p>]]></description>
			<author><![CDATA[null@example.com (Petros)]]></author>
			<pubDate>Sat, 10 Oct 2015 18:04:06 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=24465#p24465</guid>
		</item>
	</channel>
</rss>
