<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=DeReconcile_Inventory</id>
	<title>DeReconcile Inventory - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=DeReconcile_Inventory"/>
	<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;action=history"/>
	<updated>2026-05-15T15:15:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;diff=116&amp;oldid=prev</id>
		<title>WikiAdmin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;diff=116&amp;oldid=prev"/>
		<updated>2023-07-14T12:58:48Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:58, 14 July 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff::1.12:old-115:rev-116 --&gt;
&lt;/table&gt;</summary>
		<author><name>WikiAdmin</name></author>
	</entry>
	<entry>
		<id>http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;diff=115&amp;oldid=prev</id>
		<title>Mbradley at 16:45, 27 June 2023</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;diff=115&amp;oldid=prev"/>
		<updated>2023-06-27T16:45:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;These queries can be used to undo an inventory reconciliation or a whole group of reconciliation sessions.  If you dereconcile one session, all sessions after that must be dereconciled.&lt;br /&gt;
&lt;br /&gt;
Review Sessions:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select SESSION_No,trx_date from artprtrx&lt;br /&gt;
where trx_type='B' AND TRX_DATE &amp;gt;'6/1'&lt;br /&gt;
GROUP  BY SESSION_NO,TRX_DATE&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Export Session List - good for creating where clause:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select SESSION_No from artprtrx&lt;br /&gt;
where trx_type='B' AND TRX_DATE &amp;gt;'6/1'&lt;br /&gt;
GROUP  BY SESSION_NO,TRX_DATE&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
List GL accounts (this can be exported):&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select * from glttrx &lt;br /&gt;
where SESSION_NO in&lt;br /&gt;
(317609,318526,319938,320229,320288,320295,&lt;br /&gt;
320431,320500,320517)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update the Reconciled flag in ARTPRTRX (Needed for deletion)&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
update artprtrx&lt;br /&gt;
set reconciled_flag='Y'&lt;br /&gt;
where SESSION_NO in&lt;br /&gt;
(317609,318526,319938,320229,320288,320295,&lt;br /&gt;
320431,320500,320517)&lt;br /&gt;
AND RECONCILED_FLAG&amp;lt;&amp;gt;'Y'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delete the B records created by the Reconciliations.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
DELETE from artprtrx&lt;br /&gt;
where SESSION_NO in&lt;br /&gt;
(317609,318526,319938,320229,320288,320295,&lt;br /&gt;
320431,320500,320517)&lt;br /&gt;
AND TRX_TYPE='B'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clear the Reconciliation fields from the transactions (revert standard transactions back to an unreconciled state)&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
UPDATE artprtrx&lt;br /&gt;
SET RECONCILED_FLAG='N'&lt;br /&gt;
, RECON_SESSION_NO=NULL, RECON_TRANS_NO=NULL&lt;br /&gt;
where RECON_SESSION_NO in&lt;br /&gt;
(317609,318526,319938,320229,320288,320295,&lt;br /&gt;
320431,320500,320517)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delete related G/L:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
DELETE from GLTTRX &lt;br /&gt;
where SESSION_NO in&lt;br /&gt;
(317609,318526,319938,320229,320288,320295,&lt;br /&gt;
320431,320500,320517)&lt;br /&gt;
AND SOURCE_APP='R'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy &amp;amp; Paste into IB Console - Enter in Session Numbers&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
/*Update the Reconciled flag in ARTPRTRX (Needed for deletion)*/&lt;br /&gt;
update artprtrx&lt;br /&gt;
set reconciled_flag='Y'&lt;br /&gt;
where SESSION_NO = :&amp;quot;Recon Session&amp;quot;&lt;br /&gt;
AND RECONCILED_FLAG&amp;lt;&amp;gt;'Y'; /* Test for Y is not needed - but faster */&lt;br /&gt;
&lt;br /&gt;
/*Delete the B records created by the Reconciliations.*/&lt;br /&gt;
DELETE from artprtrx&lt;br /&gt;
where SESSION_NO = :&amp;quot;Recon Session&amp;quot;&lt;br /&gt;
AND TRX_TYPE IN ('C','L','B'); /* Extra protection - do not need to test for B */&lt;br /&gt;
&lt;br /&gt;
/*Clear the Reconciliation fields from the transactions (revert standard transactions back to an unreconciled state)*/&lt;br /&gt;
UPDATE artprtrx&lt;br /&gt;
SET RECONCILED_FLAG='N', RECON_SESSION_NO=NULL, RECON_TRANS_NO=NULL&lt;br /&gt;
where RECON_SESSION_NO = :&amp;quot;Recon Session&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
/*Delete related G/L:*/&lt;br /&gt;
DELETE from GLTTRX &lt;br /&gt;
where SESSION_NO = :&amp;quot;Recon Session&amp;quot;&lt;br /&gt;
AND SOURCE_APP='R';  /* Extra security - not needed to test for R */&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mbradley</name></author>
	</entry>
</feed>