log_write("error", "process", "Refund amount can not be more than the credit balance of " . format_money($credit_balance) . "");
    }
    /*
    	Check for any errors
    */
    if (error_check()) {
        $_SESSION["error"]["form"]["credit-refund_view"] = "failed";
        header("Location: ../index.php?page=customers/credit-refund.php&id_customer=" . $obj_customer->id . "&id_order=" . $obj_customer->id_order);
        exit(0);
    } else {
        /*
        	Update the database
        */
        // update
        if ($obj_refund->id) {
            log_write("notification", "process", "Successfully updated the refund.");
            $obj_refund->action_update();
        } else {
            log_write("notification", "process", "Successfully created a new refund transaction.");
            $obj_refund->action_create();
        }
        // return to services page
        header("Location: ../index.php?page=customers/credit.php&id_customer=" . $obj_customer->id . "");
        exit(0);
    }
} else {
    // user does not have perms to view this page/isn't logged on
    error_render_noperms();
    header("Location: ../index.php?page=message.php");
    exit(0);
}