<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7130</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7130&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in debtor_trans_details entry for $unit_tax is different for SD and SI.]]></description>
		<lastBuildDate>Thu, 23 Nov 2017 08:08:19 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29728#p29728</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 23 Nov 2017 08:08:19 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29728#p29728</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29625#p29625</link>
			<description><![CDATA[<p>Yes.</p><p>@itronics: please commit fixes in post #6 here.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Fri, 17 Nov 2017 07:14:07 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29625#p29625</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29624#p29624</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alaa)]]></author>
			<pubDate>Fri, 17 Nov 2017 07:13:24 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29624#p29624</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29623#p29623</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Fri, 17 Nov 2017 07:10:35 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29623#p29623</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29622#p29622</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alaa)]]></author>
			<pubDate>Fri, 17 Nov 2017 07:08:26 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29622#p29622</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29621#p29621</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Fri, 17 Nov 2017 06:58:51 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29621#p29621</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29620#p29620</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alaa)]]></author>
			<pubDate>Fri, 17 Nov 2017 06:46:54 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29620#p29620</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29617#p29617</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 16 Nov 2017 21:18:13 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29617#p29617</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29616#p29616</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (itronics)]]></author>
			<pubDate>Thu, 16 Nov 2017 19:10:50 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29616#p29616</guid>
		</item>
		<item>
			<title><![CDATA[Re: debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29607#p29607</link>
			<description><![CDATA[<p>Will ask Janusz to have a look.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Wed, 15 Nov 2017 21:31:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29607#p29607</guid>
		</item>
		<item>
			<title><![CDATA[debtor_trans_details entry for $unit_tax is different for SD and SI]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=29606#p29606</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 15 Nov 2017 19:18:57 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=29606#p29606</guid>
		</item>
	</channel>
</rss>
