# Pulling Invoices by Part Number **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2016-09-27 14:56 UTC **Views:** 543 **Replies:** 1 **URL:** https://www.epiusers.help/t/pulling-invoices-by-part-number/35599 --- ## Post #1 by @asmith1057 Has anyone found or written a BAQ for pulling A/R invoices that have certain part numbers that were sold? Thanks, Anthony --- ## Post #2 by @ShannaM Hi Anthony, I’ve written one that uses InvoiceDtl table. It’s in E9, but it works like a champ… for each InvcDtl no-lock where not InvcDtl.CustNum IN (1, 185, 197, 26, 440, 812, 818, 90) And not InvcDtl.PartNum IN ('LABOR','MISC','SHIPPING (Non-Taxable)','SHIPPING CHARGE','ZZZ-EXP CSCE') And InvcDtl.UnitPrice > 0 , each Customer no-lock where (InvcDtl.Company = Customer.Company and InvcDtl.CustNum = Customer.CustNum ) , each InvcHead no-lock where not InvcHead.InvoiceType = 'MIS' , each Part no-lock , each OrderHed no-lock , each PartCost no-lock where PartCost.CostID = '1' where (InvcDtl.Company = InvcHead.Company and InvcDtl.InvoiceNum = InvcHead.InvoiceNum ) outer-join where (InvcDtl.Company = Part.Company and InvcDtl.PartNum = Part.PartNum ) where (InvcHead.Company = OrderHed.Company and InvcHead.OrderNum = OrderHed.OrderNum ) where (Part.Company = PartCost.Company and Part.PartNum = PartCost.PartNum ). Hope this helps. Shanna Martin | Supply Chain Manager Savox Communications | www.savox.com T. 604.248.2679 F. 604.270.2138 E. shanna.martin@savox.com --- **Canonical:** https://www.epiusers.help/t/pulling-invoices-by-part-number/35599 **Original content:** https://www.epiusers.help/t/pulling-invoices-by-part-number/35599