<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Deleting fiscal year stock_mov doesn't delete data's]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6343&amp;type=atom" />
	<updated>2016-07-08T09:46:41Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=6343</id>
		<entry>
			<title type="html"><![CDATA[Re: Deleting fiscal year stock_mov doesn't delete data's]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=25741#p25741" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2016-07-08T09:46:41Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=25741#p25741</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Deleting fiscal year stock_mov doesn't delete data's]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=25727#p25727" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2016-07-05T17:59:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=25727#p25727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Deleting fiscal year stock_mov doesn't delete data's]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=25723#p25723" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2016-07-04T07:46:36Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=25723#p25723</id>
		</entry>
</feed>
