<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Inventory Adjustment bug / error when trying to adjust 0 end balance]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8383&amp;type=atom" />
	<updated>2019-09-06T12:01:04Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=8383</id>
		<entry>
			<title type="html"><![CDATA[Re: Inventory Adjustment bug / error when trying to adjust 0 end balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35919#p35919" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Braath Waate]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41493</uri>
			</author>
			<updated>2019-09-06T12:01:04Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35919#p35919</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Inventory Adjustment bug / error when trying to adjust 0 end balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35917#p35917" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[aleifuuwork]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=42567</uri>
			</author>
			<updated>2019-09-06T09:45:14Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35917#p35917</id>
		</entry>
</feed>
