<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Inventory planning report 2.4.3]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7311&amp;type=atom" />
	<updated>2018-02-05T22:32:44Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7311</id>
		<entry>
			<title type="html"><![CDATA[Re: Inventory planning report 2.4.3]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30727#p30727" />
			<content type="html"><![CDATA[<p>Ah, now I see the problem. Of course it gives weird results using the move.stock_id value instead of move.qty <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Will be fixed asap and committed to 2.4. repo. Thanks for observing this.</p><p>/Joe</p><p><a href="https://github.com/FrontAccountingERP/FA/commit/2b58a999e31c48e47358d9c9e87b0f69849f029f">Committed</a></p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2018-02-05T22:32:44Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30727#p30727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Inventory planning report 2.4.3]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30726#p30726" />
			<content type="html"><![CDATA[<p>Hello,</p><p>Strange, shouldn&#039;t IFNULL(move.stock_id, 0) give the same result as you suggest. I will investigate this.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2018-02-05T22:19:28Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30726#p30726</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Inventory planning report 2.4.3]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30725#p30725" />
			<content type="html"><![CDATA[<p>There&#039;s a small error in reporting/rep302.php in the first sql statement that causes the QOH column to show weird results.</p><p>I copied the similar statement from rep303.php with a change from QtyOnHand to qty_on_hand and that seems to correct the issue.</p><p>Here is the new code: </p><div class="codebox"><pre><code>function getTransactions($category, $location)
{
    $sql = &quot;SELECT item.category_id,
            category.description AS cat_description,
            item.stock_id, item.units,
            item.description, item.inactive,
            IF(move.stock_id IS NULL, &#039;&#039;, move.loc_code) AS loc_code,
            SUM(IF(move.stock_id IS NULL,0,move.qty)) AS qty_on_hand
        FROM (&quot;
            .TB_PREF.&quot;stock_master item,&quot;
            .TB_PREF.&quot;stock_category category)
            LEFT JOIN &quot;.TB_PREF.&quot;stock_moves move ON item.stock_id=move.stock_id
        WHERE item.category_id=category.category_id
        AND (item.mb_flag=&#039;B&#039; OR item.mb_flag=&#039;M&#039;)&quot;;
    if ($category != 0)
        $sql .= &quot; AND item.category_id = &quot;.db_escape($category);
    if ($location != &#039;all&#039;)
        $sql .= &quot; AND IF(move.stock_id IS NULL, &#039;1=1&#039;,move.loc_code = &quot;.db_escape($location).&quot;)&quot;;

    $sql .= &quot; GROUP BY item.category_id,
        category.description,
        item.stock_id,
        item.description
        ORDER BY item.category_id,
        item.stock_id&quot;;

    return db_query($sql,&quot;No transactions were returned&quot;);

}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ckrosco]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=1158</uri>
			</author>
			<updated>2018-02-05T21:08:27Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30725#p30725</id>
		</entry>
</feed>
