<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://in.compucrete.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mbradley</id>
	<title>KeystoneIntranet - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://in.compucrete.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mbradley"/>
	<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php/Special:Contributions/Mbradley"/>
	<updated>2026-05-15T16:08:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;diff=115</id>
		<title>DeReconcile Inventory</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=DeReconcile_Inventory&amp;diff=115"/>
		<updated>2023-06-27T16:45:30Z</updated>

		<summary type="html">&lt;p&gt;Mbradley: &lt;/p&gt;
&lt;hr /&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>