[Emerald] voiding invoices for inactive MBRs

Josh Hillman ( (no email) )
Mon, 17 May 1999 18:50:08 -0400

Would the following script work if I wanted to void all unpaid, non-voided
invoices associated with MBRs that have been deactivated? I'm guessing this
may change the status of an invoice a few times in a row if there are
multiple InvoiceItems associated with that InvoiceID.
This is relative to Emerald 2.1.11, not 2.5.

update i
set i.Type = 'Void',
i.LastModifyDate=getdate(),
i.LastModifyUser=user_name()
from invoices i, invoiceitems ii, masteraccounts ma
where i.invoiceid = ii.invoiceid
and ma.customerid = i.customerid
and ii.paymentid is null
and i.type != 'void'
and ma.active = 0

Josh