select distinct c.claimId, c.claimDate, c.claimRef, c.claimAmount, c.claimInvoice, cc.requestId from tbl_TPM_Claims c inner join tbl_TPM_ClaimContracts cc on cc.ownerId = c.ownerId and cc.ownerType = c.ownerType and cc.claimId = c.claimId and cc.requestId in ( 4806, 8357, 14573 ) and cc.reconciled = 'N' where c.deductionRef is not null and c.autoPrepared = 'Y' -- and c.claimId = 113449 order by c.claimDate
#htmleditformat( _data )#
update tbl_TPM_Claims set autoPrepared = 'N', processorUserId = null, readyToAudit = 'N' where ownerId = 54 and ownerType = 'MFR' and claimId = delete from tbl_TPM_ClaimContracts where ownerId = 54 and ownerType = 'MFR' and claimId = delete from tbl_TPM_ProofOfDelivery where ownerId = 54 and ownerType = 'MFR' and claimId = select count(*) as itemCount from tbl_TPM_RequestProducts where requestId =

before itemCount(#requestId#) = #qmd_rpSummary.itemCount#

select count(*) as itemCount from tbl_TPM_RequestProducts where requestId =

after itemCount(#requestId#) = #qmd_rpSummary.itemCount#