---> select fileFormat from tbl_EAI_inboundFileProcessors with (nolock) where fileProcessor = '/mstrQueries/utilityQueries/DataImport/Sales/invoiceHistory.cfm' and ownerId = and ownerType = Processing Stopped
Invoice History Processor not installed for client!
SELECT fsl_dstId, cdr_recordId, cdr_dstCode, cdr_dstName, redistInvPrefix FROM tbl_CDR_Distributors with (nolock) where ownerId = and fsl_tablecode = and redistIsActive = 'Y' AND cdr_dstcompanyType = 'R' select lineCount from tbl_EAI_inboundBatches where batchId = select substring(invoice_number,1,1) as alpha from tbl_IMPORT_RedistributionData where eai_batchId = group by substring(invoice_number,1,1) select distinct exclusionId from tbl_IMPORT_Exclusions with (nolock) where ownerId = and ownerType = and exclusionType = 'SKU' select cdr_recordId from tbl_CDR_distributors with (nolock) where ownerId = and FSL_TableCode = and cdr_dstcompanyType in ('R') and fsl_dstId = update tbl_IMPORT_RedistributionData set fseRedistCdrRecordId = where invoice_number like and eai_batchId = and ownerId = and ownerType = select * from tbl_IMPORT_RedistributionData where invoice_number like and eai_batchId = and ownerId = and ownerType = and fseRedistCdrRecordId > 0 select top 1 cdr_RecordId, fsl_dstId from tbl_CDR_distributors where cdr_recordId in ( select cdr_RecordId from tbl_CDR_DstCodes where cdr_dstCode like and ownerId = and ownerType = ) and cdr_dstcompanyType in ('B', 'O') order by cdr_dstcompanyType, cdr_RecordId insert into tbl_CDR_Distributors ( ownerId, fsl_tablecode, cdr_dstCompanyType, cdr_dstCode, cdr_dstName, recordSource, cdr_territoryId, crmActive, lastUpdated, cdr_dstAddress1,cdr_dstAddress2, cdr_dstcity, cdr_dststate, cdr_dstzip ) values( , , 'B', , , , , 'N', , , , , , ) insert into tbl_CDR_DstCodes ( ownerId, ownerType, cdr_recordId, cdr_dstCode, cdr_dstCode_type ) values( , , , , 'M' ) ---> ---> SELECT cdr_recordId FROM TBL_CDR_Distributors with (nolock) where 1=1 and fsl_dstId = and cdr_dstCode like and ownerId = and fsl_tableCode = and cdr_dstCompanyType = 'S' and cdr_specialAcctType = 'RDA' and cdr_redistAcctFor = insert into tbl_CDR_Distributors (ownerId, fsl_tableCode, cdr_dstName, cdr_dstAddress1, cdr_dstAddress2, cdr_dstcity, cdr_dststate, cdr_dstzip, cdr_dstCountryId, cdr_dstmarketinggrp, cdr_territoryId, fsl_dstId, recState, setMethod, mfr_bsr_id, crmActive,FocusAccount,classificationId, fseTerritoryIdStatus, cdr_priority, useSysFields, hasSysFields, cdr_dstPath, cdr_dstCode, cdr_dstcompanyType, fsl_masterlinkYN, cdr_specialAcctType, cdr_redistAcctFor, recordSource, createDate ) select ownerId, fsl_tableCode, cdr_dstName, cdr_dstAddress1, cdr_dstAddress2, cdr_dstcity, cdr_dststate, cdr_dstzip, cdr_dstCountryId, cdr_dstmarketinggrp, cdr_territoryId, fsl_dstId, recState, setMethod, mfr_bsr_id, crmActive,FocusAccount, classificationId, fseTerritoryIdStatus, cdr_priority, useSysFields, hasSysFields, cdr_dstPath , '' cdr_dstCode, 'S' cdr_dstcompanyType, 'N' fsl_masterlinkYN, 'RDA' cdr_specialAcctType, #fseRedistCdrRecordId# cdr_redistAcctFor, '' recordSource, getDate() createDate from tbl_CDR_Distributors redist with (nolock) where ownerId = and fsl_tablecode = and cdr_recordId = select max(cdr_recordId) as cdr_recordId from tbl_CDR_Distributors with (nolock) where ownerId = and fsl_tablecode = and cdr_redistAcctFor = and cdr_dstcompanyType = 'S' select fsl_dstId from tbl_CDR_Distributors with (nolock) where ownerId = and fsl_tablecode = and cdr_recordId = update tbl_CDR_Distributors set cdr_dstCode = , recordSource = where cdr_recordId = and ownerId = and fsl_tableCode = insert into tbl_CDR_DstCodes (ownerId, ownerType, cdr_recordId, cdr_dstCode, cdr_dstcode_type, cdr_dstCode_comments) values ( , , , , , ) update tbl_IMPORT_RedistributionData set fseCdrRecordId = where eai_importId = and eai_batchId = and ownerId = and ownerType = and invoice_number = update tbl_IMPORT_RedistributionData set fseSkuId = where eai_importId = and eai_batchId = and ownerId = and ownerType = and invoice_number = select * from tbl_CDR_InvoiceHistory with (nolock) where ownerId = and ownerType = and skuId = and cdr_recordId = and invoiceNumber like update tbl_IMPORT_RedistributionData set duplicate = where eai_importId = and eai_batchId = and ownerId = and ownerType = and invoice_number = and fseSkuId = select distinct cdr_dstCode, cdr_dstName from tbl_CDR_Distributors with (nolock) where cdr_dstCode is not null and ownerId = and fsl_tableCode = and recordSource = select distinct substring(invoice_number,1,1) as initial, count(*) as records from tbl_IMPORT_RedistributionData with (nolock) where eai_batchId = and ownerId = and ownerType = and fseRedistCdrRecordId = 0 and substring(invoice_number,1,1) <> 'S' group by substring(invoice_number,1,1) select distinct sku,sku_description, count(*) as records from tbl_IMPORT_RedistributionData with (nolock) where eai_batchId = and ownerId = and ownerType = and coalesce(fseSkuId,null) = null group by sku,sku_description select distinct customer_number, customer_name, count(*) as records from tbl_IMPORT_RedistributionData with (nolock) where eai_batchId = and ownerId = and ownerType = and coalesce(fseCdrRecordId,0) = 0 group by customer_number, customer_name select distinct customer_number, customer_name, count(*) as records from tbl_IMPORT_RedistributionData imp with (nolock) INNER JOIN tbl_CDR_Distributors cdr with (nolock) ON cdr.cdr_recordId = imp.fseCdrRecordId and cdr.ownerId = imp.ownerId and cdr.fsl_tableCode = imp.ownerType where imp.eai_batchId = and imp.ownerId = and imp.ownerType = and coalesce(imp.fseCdrRecordId,0)> 0 and cdr.cdr_territoryId = 0 group by customer_number, customer_name select distinct customer_number, customer_name, invoice_number, count(*) as records from tbl_IMPORT_RedistributionData with (nolock) where eai_batchId = and ownerId = and ownerType = and coalesce(duplicate,'')= 'Y' group by invoice_number, customer_number, customer_name select s.sku, s.skuDesc sku_description, cdr.cdr_dstCode customer_number, cdr.cdr_dstName customer_name, r.invoice_date , r.invoice_number , case_qty, sales_price as extended_price,lb_qty, fseCdrRecordId as fseCdr_RecordId, fseRedistCdrRecordId from tbl_IMPORT_RedistributionData r with (nolock) inner join tbl_PRD_SKus s with (nolock) on s.skuId = r.fseSkuId and s.ownerId = r.ownerId and s.fsl_tablecode = r.ownerType inner join tbl_CDR_Distributors cdr with (nolock) on cdr.cdr_recordId= r.fseCdrRecordId and cdr.ownerId= r.ownerId and cdr.fsl_tablecode = r.ownerType where r.ownerId = and r.ownerType = and r.eai_batchId = and nullif( cdr.cdr_dstCode, '' ) is not null and fseSkuId is not null and coalesce(fseCdrRecordId,0) <> 0 and coalesce(duplicate,'') <> 'Y' select sum( LB_QTY ) lb_qty from qmd_invoiceHistorySource where lb_qty > 0 ---> insert into tbl_IMPORT_InvoiceHistory ( eai_batchId, eai_lineNumber, ownerId, ownerType , SKU , SKU_DESCRIPTION , CUSTOMER_NUMBER , CUSTOMER_NAME , INVOICE_DATE , INVOICE_NUMBER , CASE_QTY , EXTENDED_PRICE , LB_QTY , REVERSEINVOICE ) values ( , , , , , , , , , , , , , ) ---> update tbl_EAI_InboundBatches set loadedColumns = , lineCount = where batchId = update tbl_EAI_inboundBatches set processingState = where batchId = and ownerId = and ownerType =

Invoice History Batch: #qmd_invHistBatch.batchId#: #qmd_invHistBatch.status# #htmleditformat( qmd_invHistBatch.message )#

select sku, customer_name ,invoice_number, case_qty as cases, extended_price as price ,lb_qty as LB from qmd_invoiceHistorySource