<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Deleting fiscal year stock_mov doesn't delete data's]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=6343</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6343&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Deleting fiscal year stock_mov doesn't delete data's.]]></description>
		<lastBuildDate>Fri, 08 Jul 2016 09:46:41 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Deleting fiscal year stock_mov doesn't delete data's]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=25741#p25741</link>
			<description><![CDATA[<p>If it&#039;s so.&nbsp; Than we don&#039;t need to change the stock move dates.&nbsp; We can keep the stock moves table as since as it is.&nbsp; And it&#039;s like the stock locations table.</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Fri, 08 Jul 2016 09:46:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=25741#p25741</guid>
		</item>
		<item>
			<title><![CDATA[Re: Deleting fiscal year stock_mov doesn't delete data's]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=25727#p25727</link>
			<description><![CDATA[<p>All fiscal years store their data in the same database&#039;s tables, We can switch back and forth among the fiscal year of interest and hence the historical data of stock moves need to remain stored.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 05 Jul 2016 17:59:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=25727#p25727</guid>
		</item>
		<item>
			<title><![CDATA[Deleting fiscal year stock_mov doesn't delete data's]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=25723#p25723</link>
			<description><![CDATA[<p>Here is the code of deleting the things on stock mov table.<br /></p><div class="codebox"><pre><code>$sql = &quot;SELECT loc_code, stock_id, SUM(qty) AS qty, SUM(qty*standard_cost) AS std_cost FROM &quot;.TB_PREF.&quot;stock_moves WHERE tran_date &lt;= &#039;$to&#039; GROUP by 
        loc_code, stock_id&quot;;
    $result = db_query($sql, &quot;Could not retrieve supp trans&quot;);
    while ($row = db_fetch($result))
    {
        $sql = &quot;DELETE FROM &quot;.TB_PREF.&quot;stock_moves WHERE tran_date &lt;= &#039;$to&#039; AND loc_code = &#039;{$row[&#039;loc_code&#039;]}&#039; AND stock_id = &#039;{$row[&#039;stock_id&#039;]}&#039;&quot;;
        db_query($sql, &quot;Could not delete stock moves&quot;);
        $qty = $row[&#039;qty&#039;];
        $std_cost = ($qty == 0 ? 0 : round2($row[&#039;std_cost&#039;] / $qty, user_price_dec()));
        $sql = &quot;INSERT INTO &quot;.TB_PREF.&quot;stock_moves (stock_id, loc_code, tran_date, reference, qty, standard_cost) VALUES
            (&#039;{$row[&#039;stock_id&#039;]}&#039;, &#039;{$row[&#039;loc_code&#039;]}&#039;, &#039;$to&#039;, &#039;$ref&#039;, $qty, $std_cost)&quot;;   
        db_query($sql, &quot;Could not insert stock move&quot;);
    }</code></pre></div><p>Here each row inserted again with the end date of fiscal year.&nbsp; How its working?</p><p>and Are we need to keep the stock mov datas for next year?</p><p>shall we check this data&#039;s again after closing the previous year.</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Mon, 04 Jul 2016 07:46:36 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=25723#p25723</guid>
		</item>
	</channel>
</rss>
