<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Inventory Adjustment bug / error when trying to adjust 0 end balance]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=8383</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8383&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Inventory Adjustment bug / error when trying to adjust 0 end balance.]]></description>
		<lastBuildDate>Fri, 06 Sep 2019 12:01:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Inventory Adjustment bug / error when trying to adjust 0 end balance]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35919#p35919</link>
			<description><![CDATA[<p>I don&#039;t know how anyone else does it, but I found that decimal precise stock quantities cause problems in FA because it is impossible to get them zeroed out.</p><p>So I had to make the following change to my fork.&nbsp; My fork assumes stock is zero when it falls below the precision specified in Setup.<br /></p><div class="codebox"><pre><code>--- a/core/includes/db/inventory_db.inc
+++ b/core/includes/db/inventory_db.inc
@@ -79,7 +79,8 @@ function check_negative_stock($stock_id, $delta_qty, $location=null, $date=null)
        if ($min_qos &amp;&amp; ($min_qos[&#039;qty&#039;] &lt; $qos[&#039;qty&#039;]))
                $qos = $min_qos;
 
-       return  -$delta_qty &gt; $qos[&#039;qty&#039;] ? $qos : null;
+        $row = get_item_edit_info($stock_id);
+       return  round($delta_qty + $qos[&#039;qty&#039;], $row[&#039;decimals&#039;]) &lt; 0 ? $qos : null;
 }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Braath Waate)]]></author>
			<pubDate>Fri, 06 Sep 2019 12:01:04 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35919#p35919</guid>
		</item>
		<item>
			<title><![CDATA[Inventory Adjustment bug / error when trying to adjust 0 end balance]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35917#p35917</link>
			<description><![CDATA[<p>Hi everyone, </p><br /><p>My current version is 2.4.3 Build 09.12.2017<br />Haven&#039;t had time to do upgrade to latest version yet </p><p>I notice this issue as I am doing some data migration onto our current FA system. It&#039;s mostly just about giving same item different category name just to better our reporting organization </p><br /><br /><p>How would you go move one item to different category btw ? </p><p>For example, we have item &#039;bread&#039; that previously on category &#039;raw material&#039;, now it becomes &#039;finished good&#039; because we just want to sell it as it is </p><p>The bread having ending balance 12 unit in this case</p><p>I find it can be done in 2 steps with IA operation :</p><p>Step 1<br />-------<br />Do Negative Inventory Adjustment of that item /w old category to 0<br />So you go -12 unit </p><p>Step 2<br />-------<br />Set the item and set to new category<br />Do Positive Inventory Adjustment of the same item set to new category to whatever the original balance was, which in this case +12 unit</p><p>Can anyone suggest simpler method ? I am open to that too </p><br /><br /><p>Now, the bug / error that I notice is that when the ending balance is something like of this value or decimal format : 27,328.2900</p><p>In this case, I can&#039;t do negative inventory adjustment of -27,328.2900 because FA will complain that there will be not enough stock </p><p>The most I can do is 27,328.2899 </p><p>Anyone could perhaps point what code I should be looking or why is that ? how would you treat the remaining 0.0001 ?</p>]]></description>
			<author><![CDATA[null@example.com (aleifuuwork)]]></author>
			<pubDate>Fri, 06 Sep 2019 09:45:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35917#p35917</guid>
		</item>
	</channel>
</rss>
