<?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=QueryGen_Case%3A_Create_Inventory_Transactions_From_Structure</id>
	<title>QueryGen Case: Create Inventory Transactions From Structure - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=QueryGen_Case%3A_Create_Inventory_Transactions_From_Structure"/>
	<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=QueryGen_Case:_Create_Inventory_Transactions_From_Structure&amp;action=history"/>
	<updated>2026-05-15T16:07:49Z</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=QueryGen_Case:_Create_Inventory_Transactions_From_Structure&amp;diff=526&amp;oldid=prev</id>
		<title>WikiAdmin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=QueryGen_Case:_Create_Inventory_Transactions_From_Structure&amp;diff=526&amp;oldid=prev"/>
		<updated>2023-07-14T13:00:35Z</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 13:00, 14 July 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff::1.12:old-525:rev-526 --&gt;
&lt;/table&gt;</summary>
		<author><name>WikiAdmin</name></author>
	</entry>
	<entry>
		<id>http://in.compucrete.com/index.php?title=QueryGen_Case:_Create_Inventory_Transactions_From_Structure&amp;diff=525&amp;oldid=prev</id>
		<title>Intra&gt;Chanson at 14:30, 11 May 2018</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=QueryGen_Case:_Create_Inventory_Transactions_From_Structure&amp;diff=525&amp;oldid=prev"/>
		<updated>2018-05-11T14:30:29Z</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;[[CATEGORY: QueryGen]]&lt;br /&gt;
=Case: Repairing missing inventory transaction detail from mixes=&lt;br /&gt;
In some versions of Keystone where mixes can be created but the process structure flag is turned off Inventory transactions would only be created for the mix and not the mix components.  This procedure will create transactions for the ingredients.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=QueryGen Settings=&lt;br /&gt;
&lt;br /&gt;
==Source query==&lt;br /&gt;
'''Note'''&lt;br /&gt;
*This contains many more fields than required for diagnostic reporting.&lt;br /&gt;
*The case statement lists only some of the possible units of measure conversions required.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select PC.PRODUCT_CODE &amp;quot;PCP&amp;quot;,STR.QTY_ASSEMBLY,-X.QTY_CHANGE &amp;quot;Mix Qty&amp;quot;,&lt;br /&gt;
PC.UNIT_OF_MEASURE &amp;quot;Inv UM&amp;quot;,pc.ingredient_type,str.comp_ums &amp;quot;Mix UM&amp;quot;,str.assy_product_code &amp;quot;MixID&amp;quot;,&lt;br /&gt;
STR.COMP_UMS||PC.UNIT_OF_MEASURE COMPSTRUM,PC.DESCRIPTION_1 &amp;quot;ING NAME&amp;quot;,PC.INVENTORY_GL &amp;quot;PCINVGL&amp;quot;,pc.costofsales_gl &amp;quot;COGS&amp;quot;,&lt;br /&gt;
(select sum(s2.qty_assembly) from artprstr s2 &lt;br /&gt;
 inner join artprod p2 on p2.product_code=s2.comp_product_code and p2.ingredient_type='C'&lt;br /&gt;
 where s2.assy_product_code=str.assY_PRODUCT_CODE)  &amp;quot;CemPrYd&amp;quot;,&lt;br /&gt;
CASE STR.COMP_UMS||PC.UNIT_OF_MEASURE&lt;br /&gt;
WHEN 'LBTN' THEN -X.QTY_CHANGE*STR.QTY_ASSEMBLY/2000&lt;br /&gt;
WHEN 'OZGL' THEN -X.QTY_CHANGE*STR.QTY_ASSEMBLY/128&lt;br /&gt;
WHEN '/CGL' THEN -X.QTY_CHANGE*STR.QTY_ASSEMBLY*(select sum(s2.qty_assembly) from artprstr s2 &lt;br /&gt;
 inner join artprod p2 on p2.product_code=s2.comp_product_code and p2.ingredient_type='C'&lt;br /&gt;
 where s2.assy_product_code=str.assY_PRODUCT_CODE)/200000&lt;br /&gt;
ELSE  -X.QTY_CHANGE*STR.QTY_ASSEMBLY END &amp;quot;New Ing Qty&amp;quot;,&lt;br /&gt;
PC.STANDARD_COST,&lt;br /&gt;
X.* from artprtrx x&lt;br /&gt;
inner join artprod pa on pa.product_code=x.product_code&lt;br /&gt;
INNER JOIN ARTPRSTR STR ON STR.ASSY_PRODUCT_CODE=X.PRODUCT_CODE&lt;br /&gt;
INNER JOIN ARTPROD PC ON STR.COMP_PRODUCT_CODE=PC.PRODUCT_CODE&lt;br /&gt;
where pa.product_type='M'&lt;br /&gt;
AND TRX_TYPE='S'&lt;br /&gt;
ORDER BY TRX_DATE DESC,session_no,trans_no&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Heading Query==&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
/* drop table tmp_sno; */&lt;br /&gt;
CREATE  TABLE TMP_SNO(SNO INTEGER);&lt;br /&gt;
INSERT INTO TMP_SNO (SNO)  SELECT session_no FROM CCP_SESSION_BEGIN('ADMIN', 'Insert Prod Trx from structure', '127.0.0.1', '3.X');&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Update Query==&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
INSERT INTO artprtrx /* Updating MIX: {MixID} */&lt;br /&gt;
( SESSION_NO, TRANS_NO, PRODUCT_CODE, UNIT_OF_MEASURE, QTY_CHANGE, COST, TRX_TYPE, TRX_DATE, TRX_TIME, INVENTORY_GL, OFFSET_GL, SRC_TRANS_NO, SRC_LINE_NO, SRC_DOC_NO )  VALUES &lt;br /&gt;
( (SELECT SNO FROM TMP_SNO), {PCP|INC=1}, '{PCP}', '{Inv UM}', {New Ing Qty}, 0, 'S', '{TRX_DATE}', {TRX_TIME}, '{PCINVGL}', '{COGS}', {SRC_TRANS_NO}, {SRC_LINE_NO}, '{SRC_DOC_NO}'    );&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;/div&gt;</summary>
		<author><name>Intra&gt;Chanson</name></author>
	</entry>
</feed>