<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Update material cost when quantity on hand is zero]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7568</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7568&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Update material cost when quantity on hand is zero.]]></description>
		<lastBuildDate>Thu, 30 Aug 2018 06:05:19 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=32563#p32563</link>
			<description><![CDATA[<p>This has been updated. Will be committed in a while.</p><p>/Joe</p><p><a href="https://github.com/FrontAccountingERP/FA/commit/ca3af895c069979d693a98c49255a48664061cd4">Committed</a></p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 30 Aug 2018 06:05:19 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=32563#p32563</guid>
		</item>
		<item>
			<title><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=32559#p32559</link>
			<description><![CDATA[<p>If you need to implement it this way, then the following should suffice as $qoh=0 for the first computation:<br /></p><div class="codebox"><pre><code>if ($qty &gt; 0 &amp;&amp; ($qoh != -$qty)) {
    if($qoh == 0 &amp;&amp; $avg_cost != 0)
        $avg_cost = ($avg_cost + ($unit_cost*$qty_new)/$qty)/2;
    else
        $avg_cost = ($avg_cost*($qoh+$qty_delayed)+$unit_cost*$qty_new)/($qoh+$qty);
}</code></pre></div><p>Hope the first computation too will remain a weighted average cost.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 29 Aug 2018 17:24:07 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=32559#p32559</guid>
		</item>
		<item>
			<title><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=32554#p32554</link>
			<description><![CDATA[<p>Will have a look later.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Wed, 29 Aug 2018 11:15:08 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=32554#p32554</guid>
		</item>
		<item>
			<title><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=32552#p32552</link>
			<description><![CDATA[<p>@joe, did you check this post.</p><p>I think its good to adapt the calculation,</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Wed, 29 Aug 2018 10:33:42 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=32552#p32552</guid>
		</item>
		<item>
			<title><![CDATA[Update material cost when quantity on hand is zero]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=31931#p31931</link>
			<description><![CDATA[<p>If we make purchase or produce a work order for an items while quantity on hand of this items is zero then item&#039;s material cost will be replaced by last transaction&#039;s price.<br />This is not causing overall problems but makes&nbsp; a small issue which can be seen in Inventory Dashboard:<br />-Top 10 sold Items shows sold item&#039;s cost but in the mentioning case this cost is being constituted by the last items cost that have not been sold.</p><p>Why is this important ? In single unit production the price (material cost) of products is rarely the same, even change with large amplitude between orders</p><p>I would like to propose new calculation that calculates a more realistic costs for manufacturing items:</p><p>lines 106 - 107 of work_order_costing_db.inc should be :<br /></p><div class="codebox"><pre><code>if ($qty &gt; 0 &amp;&amp; ($qoh != -$qty)) {
    if($qoh == 0 &amp;&amp; $avg_cost != 0)
        $avg_cost = ($avg_cost + ($unit_cost*$qty_new)/($qoh+$qty))/2;
    else
        $avg_cost = ($avg_cost*($qoh+$qty_delayed)+$unit_cost*$qty_new)/($qoh+$qty);
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (notrinos)]]></author>
			<pubDate>Mon, 18 Jun 2018 08:09:09 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=31931#p31931</guid>
		</item>
	</channel>
</rss>
