Hi,
Try add one more condition to see:
where
OINV.DocTotal-OINV.PaidToDate>0 and DATEDIFF(Day,OINV.DocDate,GETDATE())>10
and OINV.CardCode=(select ORDR.CardCode from ORDR where ORDR.DocEntry=@list_of_cols_val_tab_del)
and (OINV.CardCode NOT IN (SELECT CardCode FROM OCRD WHERE County in ('Test', 'Test2') AND DATEDIFF(Day,OINV.DocDate,GETDATE())< 60)
Thanks,
Gordon