Differences

This shows you the differences between two versions of the page.

Link to this comparison view

control_sql_-_look_for_gl_adjustment_entries_on_parts_not_inventoried [2019/01/27 11:29]
control_sql_-_look_for_gl_adjustment_entries_on_parts_not_inventoried [2019/01/27 11:29] (current)
Line 1: Line 1:
 +======  ======
 +
 +
 +
 +===== Explanation of SQL =====
 +
 +
 +
 +When you adjust the inventory level on a Part that is NOT accruing costs, no GL entries should be made.  In some historic cases (in Control 4.3), these entries were made.  This query identifies those entries.  Once reviewed, they may be deleted or zero'd if desired.
 +
 +
 +
 +===== Risk of Data Corruption if Run Improperly =====
 +
 +**High**. Data is modified in this query. Do not run this except under the direction of a Cyrious Technical Support staff member. Doing otherwise may result in lost or contaminated data. All data modifications done through direct SQL **are permanent and non-reversable**.
 +
 +
 +
 +===== SQL =====
 +
 +
 +
 +<code sql>
 +select ID,
 +       GroupID,
 +       Description,
 +       (select ItemName from Part where ID = PartID) as PartName,       
 +       (select AccountName from GLAccount where ID = GLAccountID) as AccountName,       
 +       Amount,
 +       *
 +from GL
 +where PartID is not NULL
 +and PartID in (select ID from Part where AccrueCosts = 0)
 +and AccountID is NULL 
 +and Description is not NULL
 +-- and EntryDateTime >= '1/1/2009'
 +</code>
 +
 +
 +
 +===== Version Information =====
 +  * Entered : 12/2009
 +  * Version : Control 4.3
 +
 +
 +