<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7130&amp;type=atom" />
	<updated>2017-11-23T08:08:19Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7130</id>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29728#p29728" />
			<content type="html"><![CDATA[<p><s>@itronics: Please fix <a href="https://github.com/FrontAccountingERP/FA/commit/1fef446949c9d246b6dc5ed48cfe4ff3567f72f9">this commit</a> as above.</s>. <a href="https://github.com/FrontAccountingERP/FA/commit/92e11c9649d04cd9cc1d78d0213460a80ae2faa9">Committed</a>.</p><p>The <strong>function get_full_price_for_item()</strong> takes only 5 arguments but the usage in the said commit calls for a change from 6 to 7 arguments now!</p><p><s>FA remains broken till this is fixed.</s></p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-23T08:08:19Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29728#p29728</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29625#p29625" />
			<content type="html"><![CDATA[<p>Yes.</p><p>@itronics: please commit fixes in post #6 here.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-17T07:14:07Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29625#p29625</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29624#p29624" />
			<content type="html"><![CDATA[<p>here is how line 80 should look ? <br /></p><div class="codebox"><pre><code>$delivery_line-&gt;price * $qty, 0, $delivery-&gt;tax_included, $delivery-&gt;tax_group_array) - $line_taxfree_price;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alaa]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20274</uri>
			</author>
			<updated>2017-11-17T07:13:24Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29624#p29624</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29623#p29623" />
			<content type="html"><![CDATA[<p>There are 2 corrections in my post above.</p><p>The <strong>function exception_handler()</strong> is defined in <strong>includes/errors.inc</strong> file and is included in line 372 (before function usage) in <strong>includes/session.inc</strong>. So all are okay here.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-17T07:10:35Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29623#p29623</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29622#p29622" />
			<content type="html"><![CDATA[<p>@apmuthu&nbsp; it works now but i have error message now<br />set_exception_handler() expects the argument (exception_handler) to be a valid callback in file: /home/accounting/public_html/test/includes/session.inc at line 375</p>]]></content>
			<author>
				<name><![CDATA[Alaa]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20274</uri>
			</author>
			<updated>2017-11-17T07:08:26Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29622#p29622</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29621#p29621" />
			<content type="html"><![CDATA[<p>Typo&nbsp; - missing comma - in commit.</p><p>Alter line 76 in the file <strong>sales/includes/db/sales_delivery_db.inc</strong>:<br /></p><div class="codebox"><pre><code>            $delivery_line-&gt;price*$qty, 0, $delivery-&gt;tax_included</code></pre></div><p>to:<br /></p><div class="codebox"><pre><code>            $delivery_line-&gt;price*$qty, 0, $delivery-&gt;tax_included,</code></pre></div><p>Also terminate line 80 with a semicolon.</p><p>@itronics: please commit it.<br />@Alaa: Nice catch.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-17T06:58:51Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29621#p29621</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29620#p29620" />
			<content type="html"><![CDATA[<p>this seems to cuz the following error that prevent me from login</p><p>Parse error: syntax error, unexpected &#039;$delivery&#039; (T_VARIABLE) in /home/Accounting/public_html/Test/sales/includes/db/sales_delivery_db.inc on line 77</p>]]></content>
			<author>
				<name><![CDATA[Alaa]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20274</uri>
			</author>
			<updated>2017-11-17T06:46:54Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29620#p29620</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29617#p29617" />
			<content type="html"><![CDATA[<p>So now we will have it uniformly as 11.905 in both Sales Delivery and Sales Invoice!</p><p>A search for the string &quot;FIXME&quot; in the entire codebase will popup several files!</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-16T21:18:13Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29617#p29617</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29616#p29616" />
			<content type="html"><![CDATA[<p>Yes, indeed, seems this was leaved unfinished in 2.4RC development. <a href="https://sourceforge.net/p/frontaccounting/git/ci/2d01d55a1449c6187b25743f8e08ccf8d79bd713/">Fixed.</a></p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2017-11-16T19:10:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29616#p29616</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29607#p29607" />
			<content type="html"><![CDATA[<p>Will ask Janusz to have a look.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-11-15T21:31:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29607#p29607</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29606#p29606" />
			<content type="html"><![CDATA[<p>The <strong>function write_customer_trans_detail_item($debtor_trans_type, $debtor_trans_no, $stock_id, $description, $quantity, $unit_price, $unit_tax, $discount_percent, $std_cost, $src_id, $line_id=0)</strong> is defined in <strong>sales/includes/db/cust_trans_details_db.inc</strong>.</p><p>When creating the Sales Delivery, the working lines 71-88 of <strong>sales/includes/db/sales_delivery_db.inc</strong> are:<br /></p><div class="codebox"><pre><code>    foreach ($delivery-&gt;line_items as $line_no =&gt; $delivery_line) {

        $line_price = $delivery_line-&gt;line_price();
        $line_taxfree_price = get_tax_free_price_for_item($delivery_line-&gt;stock_id,
            $delivery_line-&gt;price, 0, $delivery-&gt;tax_included,
            $delivery-&gt;tax_group_array);

        $line_tax = get_full_price_for_item($delivery_line-&gt;stock_id, $delivery_line-&gt;price,
            0, $delivery-&gt;tax_included, $delivery-&gt;tax_group_array) - $line_taxfree_price;

        $delivery_line-&gt;standard_cost = get_unit_cost($delivery_line-&gt;stock_id);

        /* add delivery details for all lines */
        write_customer_trans_detail_item(ST_CUSTDELIVERY, $delivery_no, $delivery_line-&gt;stock_id,
            $delivery_line-&gt;item_description, $delivery_line-&gt;qty_dispatched,
            $delivery_line-&gt;line_price(), $line_tax,
            $delivery_line-&gt;discount_percent, $delivery_line-&gt;standard_cost, $delivery_line-&gt;src_id,
            $trans_no ? $delivery_line-&gt;id : 0);</code></pre></div><p>When creating the Sales Invoice, the corresponding working lines 105-119 of <strong>sales/includes/db/sales_invoice_db.inc</strong> are:<br /></p><div class="codebox"><pre><code>    foreach ($invoice-&gt;line_items as $line_no =&gt; $invoice_line) {
        $qty = $invoice_line-&gt;qty_dispatched;
        $line_taxfree_price = get_tax_free_price_for_item($invoice_line-&gt;stock_id,
            $invoice_line-&gt;price * $qty, 0, $invoice-&gt;tax_included,
            $invoice-&gt;tax_group_array);

        $line_tax = get_full_price_for_item($invoice_line-&gt;stock_id,
            $invoice_line-&gt;price * $qty, 0, $invoice-&gt;tax_included,
            $invoice-&gt;tax_group_array) - $line_taxfree_price;

        write_customer_trans_detail_item(ST_SALESINVOICE, $invoice_no, $invoice_line-&gt;stock_id,
            $invoice_line-&gt;item_description, $invoice_line-&gt;qty_dispatched,
            $invoice_line-&gt;line_price(), $qty ? $line_tax/$qty : 0, $invoice_line-&gt;discount_percent,
            $invoice_line-&gt;standard_cost, $invoice_line-&gt;src_id,
            $trans_no ? $invoice_line-&gt;id : 0);</code></pre></div><p>Observe that the former is just a number whilst the latter is the result of a division by quantity if it exists. The latter results in some rounding off errors. Can the invoice not just be the unit tax as in the sales order? The element in question is in the&nbsp; 7th parameter in the call to the function <strong>write_customer_trans_detail_item()</strong> in each case.</p><p>The sql for the <strong>sales order</strong> is:<br /></p><div class="codebox"><pre><code>INSERT INTO `1_debtor_trans_details` VALUES
(&#039;13&#039;, &#039;5&#039;, &#039;13&#039;, &#039;102&#039;, &#039;iPhone 6 64GB&#039;, &#039;250&#039;, &#039;11.9&#039;, &#039;2&#039;, &#039;0&#039;, &#039;150&#039;, &#039;2&#039;, &#039;11&#039;),</code></pre></div><p>whilst that for the <strong>sales invoice</strong> is:<br /></p><div class="codebox"><pre><code>INSERT INTO `1_debtor_trans_details` VALUES
(&#039;15&#039;, &#039;5&#039;, &#039;10&#039;, &#039;102&#039;, &#039;iPhone 6 64GB&#039;, &#039;250&#039;, &#039;11.905&#039;, &#039;2&#039;, &#039;0&#039;, &#039;150&#039;, &#039;0&#039;, &#039;13&#039;),</code></pre></div><p>Note the difference:11.9 and 11.905 for unit_tax.</p><p>@joe: does this need fixing?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-11-15T19:18:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29606#p29606</id>
		</entry>
</feed>
