<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Items Cost in negative in inventory sales report]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=8157</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8157&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Items Cost in negative in inventory sales report.]]></description>
		<lastBuildDate>Sat, 01 Jun 2019 08:14:46 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35077#p35077</link>
			<description><![CDATA[<p>The Code I have suggested in post#34 will affect many reports. So doing this may need to change reports. And also the previous data may need to be adjusted in stock_moves table.</p><p>Hence therefore a separate log idea is better i think.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sat, 01 Jun 2019 08:14:46 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35077#p35077</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35070#p35070</link>
			<description><![CDATA[<p>Further investigating this topic I found that the function defined at Line # 425 of /includes/db/inventory_db.inc&nbsp; <strong>function update_stock_move</strong> is not used anywhere in the system.</p><p>I have tried to help @zia why the cost is -ve. This might be helpful for others in this forum so I am attaching <a href="https://prnt.sc/nvkezx">here</a>.</p><p>This Image explains the affect of using <strong>Cost Update on the Average Cost of the Product</strong></p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Thu, 30 May 2019 19:10:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35070#p35070</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35062#p35062</link>
			<description><![CDATA[<p>Hello @joe, I found that there is already a Log System for Average Cost in FA in stock_moves table but that is not properly used with Stock Adjustments.</p><p>In the file <strong>/inventory/includes/db/items_adjust_db.inc</strong> if we modify code at Line # 103 as below then Stock_Moves Table will have complete log of Transaction Affecting the Average Cost.</p><div class="codebox"><pre><code>$calculated_avg_cost = get_unit_cost($stock_id); //added by faisal
    add_stock_move(ST_INVADJUST, $stock_id, $adj_id, $location, //modified by faisal
        $date_, $reference, $quantity,$calculated_avg_cost, $standard_cost);</code></pre></div><p>After Doing this <strong>/inventory/inquiry/stock_movements.php</strong> can be modified to show the columns as below</p><div class="codebox"><pre><code>array_push($th, _(&quot;Date&quot;), _(&quot;Detail&quot;), _(&quot;Quantity In&quot;), _(&quot;Quantity Out&quot;), _(&quot;Quantity On Hand&quot;),_(&quot;Price&quot;), _(&quot;Avg Cost&quot;));//Modified by faisal</code></pre></div><p>and </p><div class="codebox"><pre><code>qty_cell($after_qty, false, $dec);
    amount_cell($myrow[&quot;price&quot;]); //added by faisal
    amount_cell($myrow[&quot;standard_cost&quot;]); //added by faisal</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Wed, 29 May 2019 21:40:31 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35062#p35062</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35049#p35049</link>
			<description><![CDATA[<p>Fine, In the log some more fields are necessary but for that we may need to increase arguments in function. Like TransactionDate, TransactionType and TransactionRef or ID, User</p><p>Similarly the direct CostUpdate of any items shall also reflect in this Log.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 27 May 2019 07:54:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35049#p35049</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35046#p35046</link>
			<description><![CDATA[<p>I have a meeting with Janusz medio June.&nbsp; We will, among other thngs, discuss this topic too.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Mon, 27 May 2019 04:35:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35046#p35046</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35044#p35044</link>
			<description><![CDATA[<p>@joe, we can add this function to <strong>purchasing/includes/db/grn_db.inc</strong>. to create a log file in the company&#039;s folder for each item whenever the average cost is updated in the system for any reason.</p><p>This function (in my instance) also sends an Email Alert to BCC Email of the company.</p><div class="codebox"><pre><code>function update_cost_log($new_material_cost, $curr_material_cost, $qty, $price, $stock_id, $qoh )
{
  global $path_to_root, $db_connections;
    $company = $db_connections[$_SESSION[&quot;wa_current_user&quot;]-&gt;company][&quot;name&quot;]; //added by faisal
    $date = Today().&quot; &quot;.Now();// date(&quot;Y-m-d h:i:sa&quot;, $d);

  $tran_type = $qty &gt; 0 ? &quot;Stock IN&quot; : &quot;Stock Out&quot;;

  $log = &quot;date=$date,  company=$company,  stock_id=&quot;.get_item($stock_id)[&#039;description&#039;].&quot;,&quot;;
  $log .=&quot;Quntity On Hand=$qoh,&quot;;
  $log .= &quot;Current Material Cost=$curr_material_cost,&quot;;
  $log .= &quot;$tran_type=$qty,&quot;;
  $log .= &quot;Price to Receive Stock=$price,&quot;;
  $log .= &quot;Calculated Material Cost = $new_material_cost&quot;;

  file_put_contents(company_path().&quot;/&quot;.$stock_id.&#039;.log&#039;,$log.PHP_EOL,FILE_APPEND);

if (!get_company_pref(&#039;avg_cost_alert&#039;)) return;

      require_once($path_to_root . &quot;/reporting/includes/class.mail.inc&quot;);

      $mail = new email(&quot;ABC&quot;, &quot;smtp@abc.net&quot;);

          $mail-&gt;phpmailer-&gt;addAddress(get_company_pref(&#039;bcc_email&#039;));

          $mail-&gt;subject(&quot;Average Cost Alert&quot;);
          $mail-&gt;text($log);
          $mail-&gt;send();
    }</code></pre></div><p>This function can be called at Line # 74 in the above file as below</p><div class="codebox"><pre><code>if ($curr_material_cost &lt;&gt; $material_cost)
        update_cost_log($material_cost, $curr_material_cost, $qty, $price_in_home_currency, $stock_id, $qoh); //by faisal</code></pre></div><p>The same process can be repeated for manufacturing/includes/db/work_order_costing_db.inc</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 27 May 2019 02:57:09 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35044#p35044</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35043#p35043</link>
			<description><![CDATA[<p>@zia, first of all you are using very older version. At FA on daily basis bugs are identified and rectified. It may be very cumbersome for any senior member here to support you on an older version. I would recommend that to avoid any future problems you keep your FA instance updated to the latest repo.</p><p>Secondly you can send me your ERPs credentials via Forum Email. I will try to locate the problem.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sun, 26 May 2019 15:36:36 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35043#p35043</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35042#p35042</link>
			<description><![CDATA[<p>any update for my issue. @boxygen or any other expert.</p>]]></description>
			<author><![CDATA[null@example.com (zia)]]></author>
			<pubDate>Sun, 26 May 2019 11:26:05 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35042#p35042</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35041#p35041</link>
			<description><![CDATA[<p>May be we can maintain a log file in the company&#039;s folder for each item. That Log file can be called in Item Setup to view history with Date and Time, User and Transaction affecting the Average Cost. The user shall be able to refresh that log file.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sun, 26 May 2019 10:51:43 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35041#p35041</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35040#p35040</link>
			<description><![CDATA[<p>Of course, but please help me finding where to fix this.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sun, 26 May 2019 09:31:58 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35040#p35040</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35039#p35039</link>
			<description><![CDATA[<p>@joe, this area of FA that average cost of the item get changes but there is no LOG maintained for such change shall be addressed in 2.5.</p><p>This has placed me at very critical situation sometimes when a client asks why this Average Cost arrives?</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sun, 26 May 2019 07:00:51 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35039#p35039</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35015#p35015</link>
			<description><![CDATA[<p>any help guys.</p>]]></description>
			<author><![CDATA[null@example.com (zia)]]></author>
			<pubDate>Thu, 23 May 2019 05:49:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35015#p35015</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35000#p35000</link>
			<description><![CDATA[<div class="quotebox"><cite>kvvaradha wrote:</cite><blockquote><p>@barbarian - he also don&#039;t know when the entries are created. Because all of them are auto created. This&nbsp; entries created by the update average cost method. This issue was fixed from 2.4 onwards. So you can compare code between the two version and get it</p></blockquote></div><p>Oh, so it is auto created means direct supplier invoice feature?</p>]]></description>
			<author><![CDATA[null@example.com (barbarian)]]></author>
			<pubDate>Wed, 22 May 2019 08:23:52 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35000#p35000</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34998#p34998</link>
			<description><![CDATA[<p>@kvvaradha,</p><p>if you allow me then i can share with you erp credentials then you can check, because i am stuck here and did every possible thing,</p>]]></description>
			<author><![CDATA[null@example.com (zia)]]></author>
			<pubDate>Wed, 22 May 2019 07:30:18 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34998#p34998</guid>
		</item>
		<item>
			<title><![CDATA[Re: Items Cost in negative in inventory sales report]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34996#p34996</link>
			<description><![CDATA[<p>There are two possibilities, either you have any entries left to void or the standard cost was not updated. Check once again from beginning to end and get solution for it</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Wed, 22 May 2019 07:24:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34996#p34996</guid>
		</item>
	</channel>
</rss>
