#qmd_batch.resultsText# update tbl_EAI_inboundBatches set processingState = where batchId = and ownerId = and ownerType = Initialize
Claims
Finish
select distinct coalesce( client_distributor_id, '' ) client_distributor_id, coalesce( client_distributor_name, '' ) client_distributor_name from tbl_IMPORT_DistributorClaims with (nolock) where ownerId = and ownerType = and eai_batchId = and nullif( client_distributor_id, '' ) is not null and fsecdrRecordId is null select distinct cdr.crmActive, cdr.cdr_recordId, cdr.cdr_territoryId, cdr.cdr_dstName, dst.dstId, dst.dstParentCo from tbl_CDR_Distributors cdr with (nolock) inner join tbl_CDR_DstCodes cdrc with (nolock) on cdrc.cdr_recordId = cdr.cdr_recordId and cdrc.ownerid = cdr.ownerId and cdrc.ownerType = cdr.fsl_tablecode inner join tbl_DST_Distributors dst with (nolock) on dst.dstId = cdr.fsl_dstId where ( cdr.cdr_dstcompanytype = 'B' or cdr.cdr_dstCompanyType = 'R' ) and cdr.ownerId = and cdr.fsl_tablecode = and cdr.fsl_dstId > 0 and LTRIM(RTRIM(SUBSTRING(cdrc.cdr_dstCode, (PATINDEX('%[^0]%', cdrc.cdr_dstCode)), 30))) = update tbl_IMPORT_DistributorClaims set fseCdrRecordId = , fseDstId = , fseParentDstId = where client_distributor_id = and eai_batchId = and ownerId = and ownerType = and fseCdrRecordId is null select client_distributor_id, client_distributor_name, sum( cases ) cases, sum( lbs ) lbs from tbl_IMPORT_DistributorClaims with (nolock) where fseCdrRecordId is null and ownerId = and ownerType = and eai_batchId = and nullif( client_distributor_id, '' ) is not null group by client_distributor_id, client_distributor_name order by cases desc update i set location_customer_nbr = case when left( location_customer_nbr, 4 ) != dst.dstBranchId + '-' then dst.dstBranchId + '-' + location_customer_nbr else location_customer_nbr end from tbl_IMPORT_DistributorClaims i inner join tbl_CDR_Distributors cdr with (nolock) on cdr.cdr_recordId = i.fseCdrRecordId and cdr.ownerId = i.ownerId and cdr.fsl_tablecode = i.ownerType inner join tbl_DST_Distributors dst with (nolock) on dst.dstId = cdr.fsl_dstId and dst.dstParentCo = 4994 where i.ownerId = and i.ownerType = and i.eai_batchId = update pod set pod.fseTraceHash = convert( varchar(100), hashbytes( 'SHA2_256', convert( varchar, coalesce( pod.fseCdrRecordId, 0 ) ) + coalesce( pod.location_customer_nbr, 'blank' ) + coalesce( nullif( pod.location_name, '' ), 'blank' ) + coalesce( nullif( pod.location_address, '' ), 'blank' ) + coalesce( nullif( pod.location_city, '' ), 'blank' ) + coalesce( nullif( pod.location_state, '' ), 'blank' ) + coalesce( nullif( pod.location_zipcode, '' ), 'blank' )), 2) from tbl_IMPORT_DistributorClaims pod with (nolock) where pod.ownerId = and pod.ownerType = and pod.eai_batchId = and pod.fseCdrRecordId > 0 and nullif( pod.location_customer_nbr, '' ) is not null and exists ( select * from tbl_CDR_DstCodes cdr with (nolock) where cdr.cdr_recordId = pod.fseCdrRecordId and cdr.ownerId = pod.ownerId and cdr.ownerType = pod.ownerType and cdr.cdr_dstCode_type = 'M' and cdr.cdr_dstCode <> '' ) select distinct cdr.cdr_dstCode as primary_distributor_id, 'OPR' rec_type, location_customer_nbr as primary_distrib_acctnbr, location_name as company_name, location_address as company_address1, location_city as company_city, location_state as company_state, location_zipcode as company_zip, 'D' as company_priority , fseTraceHash from tbl_IMPORT_DistributorClaims pod inner join tbl_CDR_DstCodes cdr with (nolock) on cdr.cdr_recordId = pod.fseCdrRecordId and cdr.ownerId = pod.ownerId and cdr.ownerType = pod.ownerType and cdr.cdr_dstCode_type = 'M' and cdr.cdr_dstCode <> '' where pod.eai_batchId = and pod.fseTraceHash is not null and pod.ownerId = and pod.ownerType = order by company_name select max( claim_date ) lastClaimDate from tbl_IMPORT_DistributorClaims with (nolock) where eai_batchId = and fseTraceHash is not null and ownerId = and ownerType = and fseTraceHash is not null insert into tbl_IMPORT_Operators ( eai_batchId, eai_lineNumber, ownerId, ownerType , #_c# ) values ( , , , , ) update tbl_EAI_InboundBatches set loadedColumns = , lineCount = where batchId = and ownerId = and ownerType = update tbl_IMPORT_DistributorClaims set fseBaseOperatorBatchId = where eai_batchId = and ownerId = and ownerType = and fseTraceHash is not null update tbl_EAI_inboundBatches set processingState = where batchId = and ownerId = and ownerType = select top 1 fseBaseOperatorBatchId as batchId from tbl_IMPORT_DistributorClaims with (nolock) where eai_batchId = and ownerId = and ownerType = and fseTraceHash is not null select distinct fseOperatorId, fseTraceHash, dl.fsl_choId from tbl_IMPORT_Operators i with (nolock) inner join tbl_OPR_ClientOperators dl with (nolock) on dl.ownerId = i.ownerId and dl.fsltablecode = i.ownerType and dl.operatorId = i.fseOperatorId and dl.oprCompanyType = '0' where i.ownerId = and i.ownerType = and i.eai_batchId in ( ) order by fseOperatorId update cop set cop.fseLocationOperatorId = from tbl_IMPORT_DistributorClaims cop where cop.ownerId = and cop.ownerType = and cop.eai_batchId = and cop.fseTraceHash = select cdr.cdr_dstCode, cdr.cdr_dstName, fseCdrRecordId as partnerId, 'CDR' partnerType, claim_date as claimDate, claim_inv_nbr as claimInvoice, claim_ref_nbr as claimRef, claim_description as claimDescription, sum( dollars ) as claimAmount, sum( cases ) caseCount, count(*) lines from tbl_IMPORT_DistributorClaims i with (nolock) inner join tbl_CDR_Distributors cdr with (nolock) on cdr.cdr_recordId = fseCdrRecordId and cdr.ownerId = i.ownerId and cdr.fsl_tablecode = i.ownerType where i.ownerType = and i.ownerId = and i.eai_batchid = and coalesce( i.fseSkuIdStatus, '' ) != 'R' group by cdr.cdr_dstCode, cdr.cdr_dstName, fseCdrRecordId, claim_date, claim_inv_nbr, claim_ref_nbr, claim_description select partnerType, partnerId, cdr_dstCode as DistributorCode, cdr_dstName as DistributorName, claimDate, claimInvoice, claimRef, claimDescription, claimAmount, caseCount, lines, fseEPODLines as loadableLines from qmd_claimSource select cdr.cdr_recordId, r.contractId, r.requestId, r.payableTo, ct.partnerId, ct.partnerType, ct.assignedContractNbr, r.startDate, r.endDate from tbl_TPM_Requests r with (nolock) inner join tbl_TPM_Contracts ct with (nolock) on ct.contractId = r.contractId and ct.ownerId = r.ownerId and ct.ownerType = r.ownerType and ct.partnerType = 'OPR' and ct.contractName like 'Reinhart Foodservice Blanket Agreement Operator%' inner join tbl_CDR_Distributors cdr with (nolock) on cdr.ownerId = ct.ownerId and cdr.fsl_tablecode = ct.ownerType inner join tbl_DST_Distributors dst with (nolock) on dst.dstId = cdr.fsl_dstId and dst.dstParentCo = 4994 where ct.ownerId = and ct.ownerType = and r.payableTo = 'CDR' update tbl_IMPORT_DistributorClaims set fseClaimId = 0, fseClaimStatus = 'Z' where ownerType = and ownerId = and eai_batchid = and fseCdrRecordId = and claim_date = and claim_inv_nbr = and claim_ref_nbr = and claim_description = select claimId, claimStatus, reconciledDate from tbl_TPM_Claims with (nolock) where partnerId = and partnerType = and claimDate = and claimInvoice = and claimRef = and claimAmount = insert into tbl_TPM_Claims ( createDate, createUserId, updateDate, updateUserId, ownerId, ownerType, payeeId, partnerId, partnerType, claimInvoice, claimDate, claimRef, claimType, claimStatus, statusReasonId, claimAmount, claimDescription ) values ( , -1, , -1, , , , , , , , , 'D', 'OPEN', null, , ) update tbl_IMPORT_DistributorClaims set fseClaimId = , fseClaimStatus = where ownerType = and ownerId = and eai_batchid = and fseCdrRecordId = and claim_date = and claim_inv_nbr = and claim_ref_nbr = and claim_description = update tbl_TPM_Claims set claimPeriodStart = , claimPeriodEnd = where ownerId = and ownerType = and claimId = delete from tbl_TPM_Claims where ownerId = and ownerType = and claimId = update tbl_IMPORT_DistributorClaims set fseClaimId = , fseClaimStatus = where ownerType = and ownerId = and eai_batchid = and fseCdrRecordId = and claim_date = and claim_inv_nbr = and claim_ref_nbr = and claim_description = update tbl_IMPORT_DistributorClaims set fseEPODBatchId = where ownerId = and ownerType = and eai_batchId = and fseClaimId = insert into tbl_IMPORT_ProofOfDelivery ( ownerId, ownerType, eai_batchId, eai_lineNumber,#_childBatchAttrs.loadedColumns# ) values ( , , , , ) update tbl_EAI_inboundBatches set processingState = where batchId = and ownerId = and ownerType = select dc.location_name as operator_name, dc.location_customer_nbr as operator_cust_nbr, cdr.cdr_dstName as distributor_name, cdr.cdr_dstCode as mfr_distributor_code, s.sku as mfr_item_code, s.skuDesc as item_description, dc.cases as quantity, 'CA' as uom, dc.dollars_cs as rebate_unit_price, dc.dollars as total_rebate_price, dc.location_invoice_nbr as operator_inv_nbr, dc.location_invoice_date as operator_inv_date, dc.location_address as operator_street, dc.location_city as operator_city, dc.location_zipcode as operator_zip_code, dc.location_state as operator_state, dc.contract_ref as contract_nbr, dc.fseLocationOperatorId as fseOperatorId /* fseSkuId, location_invoice_date, location_invoice_nbr, location_invoice_date, location_address, location_city, location_state, location_zipcode, cases, dollars_cs, dollars, contract_ref */ from tbl_IMPORT_DistributorClaims dc with (nolock ) inner join tbl_CDR_Distributors cdr with (nolock) on cdr.cdr_recordId = dc.fseCdrRecordId and cdr.ownerId = dc.ownerId and cdr.fsl_tablecode = dc.ownerType inner join tbl_PRD_SKus s with (nolock) on s.skuId = dc.fseSkuId and s.ownerId = dc.ownerId and s.fsl_tablecode = dc.ownerType where dc.ownerType = and dc.ownerId = and dc.eai_batchid = and dc.fseCdrRecordId = and dc.fseSkuId > 0 and dc.claim_date = and dc.claim_inv_nbr = and dc.claim_ref_nbr = and dc.contract_ref = and dc.fseClaimId =