Remove Pending (P) Flag from Invoices in SedonaOffice
When there is no pending EFT payment on an invoice, but the system has not updated the flag, this script can be run to remove the pending flag from the invoice.
/* Remove the EFT Pending Flag on Invoices */
Update i set has_pending_eft = 'N'
-- SELECT c.customer_number, i.*
from ar_Invoice I
join ar_customer c on c.customer_id = i.customer_id
Left Outer Join
(Select aic.Invoice_Id, a.ach_id, 'Y' as Pending
from AR_ACH a JOIN AR_ACH_Invoice AIC on a.ACH_Id = aic.ACH_Id
Where Voided = 'N' and Posted = 'N' and a.Invoice_Id > 1
and isnull(trans_status, '') NOT IN ('REJECTED', 'ORPHANED')
AND ((Response_Type in ('', 'F') and Second_Response_Type in ('', 'F'))
or Second_Response_Type = 'F')) ACHStatus on ACHStatus.Invoice_Id = I.Invoice_Id
Where ACHStatus.Invoice_Id is null
and i.has_pending_eft <> 'N'