select cdr_recordId, cdr_dstCompanyType, cdr_dstName from tbl_CDR_Distributors with (nolock) where ownerId = and fsl_tablecode = and fsl_dstId = 1319 select distinct Claiming_Account_No from tbl_IMPORT_Deductions with (nolock) where eai_batchId = and ownerId= and ownerType = and nullif( Claiming_Account_No, '' ) is not null and not Claiming_Account_Name like '%DOT FOODS%' select cdr.cdr_recordId from tbl_CDR_Distributors cdr with (nolock) where cdr.ownerId = and cdr.fsl_tablecode = and exists ( select * from tbl_CDR_DstCodes dstCodes where dstCodes.ownerId = cdr.ownerId and dstCodes.ownerType = cdr.fsl_tablecode and dstCodes.cdr_recordId = cdr.cdr_recordId and dstCodes.cdr_dstCode = ) update tbl_IMPORT_Deductions set fseCdrRecordId = where ownerId = and ownerType = and eai_batchId = and Claiming_Account_No = and not Claiming_Account_Name like '%DOT FOODS%' select distinct Claiming_Account_Name from tbl_IMPORT_Deductions with (nolock) where eai_batchId = and ownerId= and ownerType = and nullif( Claiming_Account_Name, '' ) is not null and fseCdrRecordId is null and not Claiming_Account_Name like '%DOT FOODS%' select cdr.cdr_recordId from tbl_CDR_Distributors cdr with (nolock) where cdr.ownerId = and cdr.fsl_tablecode = and cdr.cdr_dstName = select cdr.cdr_recordId from tbl_IMPORT_Aliases a with (nolock) inner join tbl_CDR_Distributors cdr with (nolock) on cdr.ownerId = a.ownerId and cdr.fsl_tablecode = a.ownerType and cdr.cdr_recordId = a.objectId where a.ownerId = and a.ownerType = and a.alias = and a.objectType = 'CDR' update tbl_IMPORT_Deductions set fseCdrRecordId = where ownerId = and ownerType = and eai_batchId = and Claiming_Account_Name = and fseCdrRecordId is null and not Claiming_Account_Name like '%DOT FOODS%' select eai_importId, eai_lineNumber, fseCdrRecordId, deduction, deduction_date, check_no, created_on, external_ref from tbl_IMPORT_Deductions with (nolock) where ownerId = and ownerType = and eai_batchId = and ( fseCdrRecordId is not null ) and not Claiming_Account_Name like '%DOT FOODS%' select claimId from tbl_TPM_Claims with (nolock) where ownerId = and ownerType = and partnerType = 'CDR' and deductionRef = and deductionDate = select claimId from tbl_TPM_Claims with (nolock) where ownerId = and ownerType = and payeeId = 0 and partnerType = 'CDR' and partnerId = and claimInvoice = and claimRef = and claimDate = update tbl_IMPORT_Deductions set fseClaimId = , fseClaimStatus = where ownerId = and ownerType = and eai_batchId = and eai_importId = and eai_lineNumber = select eai_lineNumber, eai_importId, fseCdrRecordId, deduction, deduction_date, check_no, external_ref, created_on, requested, claiming_account_name from tbl_IMPORT_Deductions with (nolock) where ownerId = and ownerType = and eai_batchId = and fseClaimStatus = 'A' and not Claiming_Account_Name like '%DOT FOODS%' insert into tbl_TPM_Claims ( deductionRef, deductionDate, createDate, createUserId, updateDate, updateUserId, ownerId, ownerType, payeeId, partnerId, partnerType, claimInvoice, claimDate, claimRef, claimType, claimStatus, statusReasonId, claimAmount, claimDescription ) values ( , , , -1, , -1, , , , , , , , , 'D', 'HOLD', , 'OPEN', null, , ) update tbl_IMPORT_Deductions set fseClaimId = where ownerId = and ownerType = and eai_batchId = and eai_importId = and eai_lineNumber = select claiming_account_no, claiming_account_name, min( eai_lineNumber ) first_line, count(*) line_count from tbl_IMPORT_Deductions with (nolock) where fseCdrRecordId is null and eai_batchId = and ownerId = and ownerType = and not Claiming_Account_Name like '%DOT FOODS%' group by claiming_account_no, claiming_account_name order by claiming_account_no, claiming_account_name select eai_lineNumber lineNumber, deduction, deduction_date, claiming_account_no, claiming_account_name, check_no, created_on, requested, external_ref, case when fseClaimId is not null then case when fseClaimStatus = 'A' then 'New Claim Added' else 'Skipping Already Loaded' end when fseCdrRecordId is null then 'Customer Not Found' else 'Unknown mapping Issue' end import_status from tbl_IMPORT_Deductions with (nolock) where ownerId = and ownerType = and eai_batchId = order by lineNumber select c.claimId from tbl_TPM_Claims c with (nolock) inner join tbl_CDR_Distributors cdr with (nolock) on cdr.cdr_recordId = c.partnerId and 'CDR' = c.partnerType and cdr.ownerId = c.ownerId and cdr.fsl_tablecode = c.ownerType inner join tbl_DST_Distributors dst with (nolock) on dst.dstId = cdr.fsl_dstId where c.ownerId = 54 and c.ownerType = 'MFR' and c.ownerId = and c.ownerType = and nullif( c.deductionRef, '' ) is not null and not exists ( select * from tbl_TPM_ClaimContracts cc where cc.claimId = c.claimId and cc.ownerId = c.ownerId and cc.ownerType = c.ownerType ) and c.processorUserId is null and c.readyToAudit = 'N' and isNumeric( c.claimInvoice ) = 1 and nullif( c.claimRef, '' ) is null and cdr.cdr_dstCompanyType = 'B' and dst.dstParentCo = 4036 order by c.claimId select autoAuditAmountThresholdAmt, partnerType from tbl_TPM_ClaimantAutoAuditOptions with (nolock) where ownerId = and ownerType = and assignedContractNbr = and partnerId = 0 and partnerType = 'CDR' insert into tbl_TPM_ClaimantAutoAuditOptions ( ownerId, ownerType, partnerType, partnerId, assignedContractNbr, autoAuditEnabled, autoAuditAmountThresholdAmt, autoAuditApprovedThresholdAmt, autoAuditRepayThresholdAmt, autoAuditMethod, claimCount, lastClaimDate, avgClaimAMount, avgClaimVariance ) values( , , 'CDR', 0, , 'Y', 5000, 5000, 0, 'AMT', 0, , 0, 0 )