(a) more pl/pgsql voodoo, now using formula v_record.amount + v_vat_amount = v_record.paid_amount + new.amount to check if the invoice has been paid and thus to mark the paricipant as registered (event_participant_status_id=82504), (b) update company main office address (im_offices) so that it shows up in customer invoice