<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Update material cost when quantity on hand is zero]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7568&amp;type=atom" />
	<updated>2018-08-30T06:05:19Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7568</id>
		<entry>
			<title type="html"><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32563#p32563" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2018-08-30T06:05:19Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32563#p32563</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32559#p32559" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-08-29T17:24:07Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32559#p32559</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32554#p32554" />
			<content type="html"><![CDATA[<p>Will have a look later.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2018-08-29T11:15:08Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32554#p32554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Update material cost when quantity on hand is zero]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32552#p32552" />
			<content type="html"><![CDATA[<p>@joe, did you check this post.</p><p>I think its good to adapt the calculation,</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2018-08-29T10:33:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32552#p32552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Update material cost when quantity on hand is zero]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31931#p31931" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[notrinos]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=36772</uri>
			</author>
			<updated>2018-06-18T08:09:09Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31931#p31931</id>
		</entry>
</feed>
