<QUICK_REPORT_LIST><QUICK_REPORT state="queried" OBJ_ID="AAASXSAASAAAefnAAA" OBJ_VERSION="2025-07-25">
  <QUICK_REPORT_ID datatype="Number">963757</QUICK_REPORT_ID>
  <DESCRIPTION datatype="Text">B&amp;F Year End - Aged Inserts</DESCRIPTION>
  <SQL_EXPRESSION datatype="Text">Select 
	SFPP.VENDOR_PART_NO &quot;BF Item&quot;
	,S.Part_No &quot;IPL Part_No&quot;
	,PC.Description
	,sum(QTY_ONHAND) &quot;On Hand Qty&quot;
	,TOP1.LAST_TRANS &quot;Last Trans Date&quot;
	,TOP1.TRANSACTION_CODE &quot;Trans Type&quot;
	, round(sysdate-BCKFLUSH,0) &quot;Days Since Last Used&quot;

From 
	PURCHASE_PART PP 
	inner join Part_Catalog PC on PC.Part_No=PP.Part_No 
	inner join INVENTORY_PART_IN_STOCK_UIV S on PP.Contract=S.Contract and PP.Part_No=S.Part_No 
	inner join PURCHASE_PART_SUPPLIER SFPP on SFPP.Part_No=S.Part_No and SFPP.Contract=S.Contract
	left join 
		(Select * from (Select Contract,Part_No,DATE_TIME_CREATED Last_Trans,TRANSACTION_CODE,TRANSACTION_ID,ROW_NUMBER() OVER (PARTITION BY Contract,Part_No ORDER BY TRANSACTION_ID DESC) AS RowNumber 
			from INVENTORY_TRANSACTION_HIST2
			where TRANSACTION_CODE in (&apos;BACFLUSH&apos;,&apos;COUNT-OUT&apos;,&apos;COUNT-IN&apos;,&apos;ARRIVAL&apos;,&apos;SOISS&apos;,&apos;UNISS&apos;,&apos;NREC&apos;,&apos;NISS&apos;,&apos;INVSCRAP&apos;,&apos;OESHIP&apos;) ) where RowNumber=1) TOP1 on S.Contract=TOP1.Contract and S.Part_No=TOP1.Part_No

	left join 
		(Select * from (
		Select Contract,Part_No,DATE_CREATED BCKFLUSH,ROW_NUMBER() OVER (PARTITION BY Contract,Part_No ORDER BY TRANSACTION_ID DESC) AS RowNumber from INVENTORY_TRANSACTION_HIST2 where TRANSACTION_CODE in (&apos;BACFLUSH&apos;,&apos;SOISS&apos;) 
		) where RowNumber=1) H2 on H2.Contract=S.Contract and H2.Part_No=S.Part_No   

where STAT_GRP=&apos;ZRM04P&apos; and QTY_ONHAND&gt;0 and S.Contract=&apos;2400&apos; and VENDOR_NO=&apos;5008706&apos;

Group By SFPP.VENDOR_PART_NO, S.Part_No, PC.Description,LAST_TRANS,TOP1.TRANSACTION_CODE,BCKFLUSH
Order By  round(sysdate-BCKFLUSH,0) desc,SFPP.VENDOR_PART_NO</SQL_EXPRESSION>
  <COMMENTS datatype="Text">Created by David Montminy
2024-11-05</COMMENTS>
  <CATEGORY_ID datatype="Number"/>
  <CATEGORY_DESCRIPTION datatype="Text"/>
  <DOMAIN_ID datatype="Number"/>
  <DOMAIN_DESCRIPTION datatype="Text"/>
  <FILE_NAME datatype="Text"/>
  <QR_TYPE datatype="Enum">SQL</QR_TYPE>
  <PO_ID datatype="Text"/>
  <QUERY datatype="Text"/>
  <ROW_TYPE datatype="Text"/>
  <APP_CONFIG_PACKAGE datatype="Text"/>
  <QUICK_REPORT_CATEGORY datatype="Aggregate">
    <REPORT_CATEGORY state="queried">
      <CATEGORY_ID datatype="Number"/>
      <DESCRIPTION datatype="Text"/>
    </REPORT_CATEGORY>
  </QUICK_REPORT_CATEGORY>
  <QUICK_REPORT_DOMAIN datatype="Aggregate">
    <REPORT_DOMAIN state="queried">
      <DOMAIN_ID datatype="Number"/>
      <DESCRIPTION datatype="Text"/>
    </REPORT_DOMAIN>
  </QUICK_REPORT_DOMAIN>
</QUICK_REPORT>
</QUICK_REPORT_LIST>