If a transactions is set to Orphaned, but the linking invoice has been made, and there is a linking deposit check, You can update the trans_status to Approved.
update A
set Trans_status = 'APPROVED',
Trans_Message = 'APPROVED',
SettledDate = GETUTCDATE()
--select A.*
from AR_Deposit_Check c
join AR_ACH a on c.ACH_Id = a.ACH_Id
join AR_Invoice I on I.Invoice_I A.Amount d = A.Invoice_Id and A.Amount = A.Payment
where Trans_Status like '%orphan%' and a.Invoice_Id <> 1 and I.Net_Due = 0