function tc_ticket_instance_field_value($value = false, $field_value = false, $post_field_type = false, $col_field_id = false, $field_id = false)
{
    //$value, $post_field_type, $var_name
    if ($field_id == 'order') {
        $parent_post = get_post_ancestors($value);
        $parent_post = isset($parent_post[0]) ? $parent_post[0] : 0;
        $order = new TC_Order($parent_post);
        $order_found = false;
        if (get_post_type($order->details->ID) == 'tc_orders') {
            $order_found = true;
        }
        $order_found = apply_filters('tc_order_found', $order_found, $order->details->ID);
        if ($order_found) {
            if (current_user_can('manage_orders_cap')) {
                $value = apply_filters('tc_ticket_instance_order_admin_url', '<a target="_blank" href="' . admin_url('edit.php?post_type=tc_events&page=tc_orders&action=details&ID=' . $order->details->ID) . '">' . $order->details->post_title . '</a>', $parent_post, $order->details->post_title);
            } else {
                $value = $order->details->post_title;
            }
        } else {
            $value = __('N/A', 'tc');
        }
    }
    if ($field_id == 'event') {
        $value = tc_get_ticket_instance_event(false, false, $value);
    }
    if ($field_id == 'ticket_code') {
        $value = $field_value;
    }
    if ($field_id == 'ticket_type_id') {
        $ticket_type = new TC_Ticket($field_value);
        $value = apply_filters('tc_checkout_owner_info_ticket_title', isset($ticket_type->details->post_title) ? $ticket_type->details->post_title : __('N/A', 'tc'), $field_value);
    }
    if ($field_id == 'ticket') {
        $value = '<a target="_blank" href="' . admin_url('edit.php?post_type=tc_events&page=' . $_GET['page'] . '&tc_preview&ticket_instance_id=' . $field_value) . '">' . __('View', 'tc') . '</a> | <a target="_top" href="' . admin_url('edit.php?post_type=tc_events&page=' . $_GET['page'] . '&tc_download&ticket_instance_id=' . $field_value) . '">' . __('Download', 'tc') . '</a>';
    }
    if ($field_id == 'checkins') {
        $ticket_instance = new TC_Ticket_Instance($field_value);
        $checkins_pass = $ticket_instance->get_number_of_checkins('pass');
        $checkins_fail = $ticket_instance->get_number_of_checkins('fail');
        $value = '<a href="' . admin_url('edit.php?post_type=tc_events&page=tc_attendees&action=details&ID=' . $field_value) . '">';
        $value .= '<span class="' . ($checkins_pass > 0 ? 'status_green' : '') . '">' . $checkins_pass . '</span>';
        if ($checkins_fail > 0) {
            $value .= ' | <span class="status_red">' . $checkins_fail . '</span>';
        }
        $value .= __(' Details', 'tc');
        $value .= '</a>';
    }
    if ($field_id == 'owner_name') {
        $owner_name = get_post_meta($value, 'first_name', true) . ' ' . get_post_meta($value, 'last_name', true);
        if (trim($owner_name) == '') {
            $parent_post = get_post_ancestors($value);
            $parent_post = isset($parent_post[0]) ? $parent_post[0] : 0;
            $order = new TC_Order($parent_post);
            $buyer_full_name = $order->details->tc_cart_info['buyer_data']['first_name_post_meta'] . ' ' . $order->details->tc_cart_info['buyer_data']['last_name_post_meta'];
            //$buyer_info		 = get_post_meta( $value, 'tc_cart_info', false );
            if (trim($buyer_full_name) !== '') {
                $value = apply_filters('tc_ticket_buyer_name_element', $buyer_full_name, $parent_post);
            } else {
                $value = apply_filters('tc_ticket_buyer_name_element', '-', $parent_post);
            }
        } else {
            $value = $owner_name;
        }
    }
    return $value;
}
function tc_ticket_instance_field_value($value = false, $field_value = false, $post_field_type = false, $col_field_id = false, $field_id = false)
{
    //$value, $post_field_type, $var_name
    if ($field_id == 'order') {
        $parent_post = get_post_ancestors($value);
        $order = new TC_Order($parent_post[0]);
        if (current_user_can('manage_orders_cap')) {
            $value = '<a target="_blank" href="' . admin_url('admin.php?page=tc_orders&action=details&ID=' . $order->details->ID) . '">' . $order->details->post_title . '</a>';
        } else {
            $value = $order->details->post_title;
        }
    }
    if ($field_id == 'event') {
        $value = tc_get_ticket_instance_event(false, false, $value);
    }
    if ($field_id == 'ticket_code') {
        $value = $field_value;
    }
    if ($field_id == 'ticket_type_id') {
        $ticket_type = new TC_Ticket($field_value);
        $value = $ticket_type->details->post_title;
    }
    if ($field_id == 'ticket') {
        $value = '<a target="_blank" href="' . admin_url('admin.php?page=' . $_GET['page'] . '&tc_preview&ticket_instance_id=' . $field_value) . '">' . __('View', 'tc') . '</a> | <a target="_top" href="' . admin_url('admin.php?page=' . $_GET['page'] . '&tc_download&ticket_instance_id=' . $field_value) . '">' . __('Download', 'tc') . '</a>';
    }
    if ($field_id == 'checkins') {
        $ticket_instance = new TC_Ticket_Instance($field_value);
        $checkins_pass = $ticket_instance->get_number_of_checkins('pass');
        $checkins_fail = $ticket_instance->get_number_of_checkins('fail');
        $value = '<a href="' . admin_url('admin.php?page=tc_attendees&&action=details&ID=' . $field_value) . '">';
        $value .= '<span class="' . ($checkins_pass > 0 ? 'status_green' : '') . '">' . $checkins_pass . '</span>';
        if ($checkins_fail > 0) {
            $value .= ' | <span class="status_red">' . $checkins_fail . '</span>';
        }
        $value .= __(' Details', 'tc');
        $value .= '</a>';
    }
    if ($field_id == 'owner_name') {
        $value = get_post_meta($value, 'first_name', true) . ' ' . get_post_meta($value, 'last_name', true);
        if (trim($value) == '') {
            $value = '-';
        }
    }
    return $value;
}