postgresql7.1
select ec_order_gift_cert_amount(:order_id)
update ec_items set item_state='void', voided_date=current_timestamp, voided_by=:customer_service_rep where item_id in ([join $item_id_list ", "])
update ec_items set item_state='void', voided_date=current_timestamp, voided_by=:customer_service_rep where order_id=:order_id and product_id=:product_id
select ec_order_gift_cert_amount(:order_id)
insert into ec_problems_log
(problem_id, problem_date, problem_details, order_id)
values
(ec_problem_id_sequence.nextval, current_timestamp, 'We were unable to reinstate the customer''s gift certificate balance because the amount to be reinstated was larger than the original amount used. This shouldn''t have happened unless there was a programming error or unless the database was incorrectly updated manually. The voiding of this order has been aborted.', :order_id)
select ec_one_gift_cert_on_one_order(:cert,:order_id)
insert into ec_gift_certificate_usage
(gift_certificate_id, order_id, amount_reinstated, reinstated_date)
values
(:cert, :order_id, :iteration_reinstate_amount, current_timestamp)