function calculate_attendee_financial_Data()
{
    global $value_to_display;
    // Load the ajax js in header after jquery
    wp_enqueue_script('btcg-attendees-finance-data', plugin_dir_url(__FILE__) . 'js/btcg-event-attendees-finance-data.js', array('jquery'), false, false);
    // Get Event ID and load the event tickets
    $current_event_id = isset($_GET['event_id']) ? intval($_GET['event_id']) : 0;
    //$current_event = get_post( $current_event_id );
    $current_event_tickets = TribeEventsTickets::get_event_tickets($current_event_id);
    // Getting Ticket Ids
    $ticket_ids = array();
    foreach ($current_event_tickets as $current_event_ticket) {
        $ticket_ids[] = $current_event_ticket->ID;
    }
    // Fetching all orders and searching the ticket id in the orders
    $attendees_list = TribeEventsTickets::get_event_attendees($current_event_id);
    $amount_sold_online = 0;
    $amount_sold_offline = 0;
    foreach ($attendees_list as $attendee) {
        $current_order_id = $attendee['order_id'];
        $order_details = new WC_Order($current_order_id);
        // Getting order detail
        $current_order_items = $order_details->get_items();
        // Getting line items in the order
        $current_orderpayment_method = get_post_meta($current_order_id, '_payment_method', true);
        // Get payment method
        $offline_methods = array('bacs', 'cod', 'cheque');
        $online_methods = array('paypal', 'simplify_commerce', 'authorize_net_cim_credit_card', 'authorize_net_cim_echeck');
        foreach ($current_order_items as $current_order_item) {
            if (in_array($current_order_item['product_id'], $ticket_ids)) {
                if (in_array($current_orderpayment_method, $offline_methods)) {
                    $amount_sold_offline = $amount_sold_offline + $current_order_item['line_total'];
                }
                if (in_array($current_orderpayment_method, $online_methods)) {
                    $amount_sold_online = $amount_sold_online + $current_order_item['line_total'];
                }
            }
        }
    }
    $value_to_display = '<strong>Online Sales:</strong> ' . wc_price($amount_sold_online) . '<br/>';
    $value_to_display .= '<strong>Offline Sales:</strong> ' . wc_price($amount_sold_offline) . '<br/>';
    $value_to_display .= '<strong>Gross Sales:</strong> ' . wc_price($amount_sold_offline + $amount_sold_online);
    // Adding inline javascript
    add_action('admin_head', 'attendees_inline_js');
}
Ejemplo n.º 2
0
<?php

$event_id = isset($_GET["event_id"]) ? intval($_GET["event_id"]) : 0;
$event = get_post($event_id);
$tickets = TribeEventsTickets::get_event_tickets($event_id);
?>

<div class="wrap">
	<div id="icon-edit" class="icon32 icon32-tickets-attendees"><br></div>
	<h2><?php 
_e('Attendees', 'tribe-events-calendar');
?>
</h2>
	<h2><?php 
echo $event->post_title;
?>
</h2>

	<div id="tribe-filters" class="metabox-holder">
		<div id="filters-wrap" class="postbox">
			<h3 title="Click to toggle"><?php 
_e('Event Summary', 'tribe-events-calendar');
?>
</h3>



			<table class="eventtable ticket_list">
				<tr>
					<td width="33%" valign="top">
						<?php 
Ejemplo n.º 3
0
 /**
  * Includes the tickets metabox inside the Event edit screen
  *
  * @param $post_id
  */
 public function do_meta_box($post_id)
 {
     $startMinuteOptions = TribeEventsViewHelpers::getMinuteOptions(null);
     $endMinuteOptions = TribeEventsViewHelpers::getMinuteOptions(null);
     $startHourOptions = TribeEventsViewHelpers::getHourOptions(null, true);
     $endHourOptions = TribeEventsViewHelpers::getHourOptions(null, false);
     $startMeridianOptions = TribeEventsViewHelpers::getMeridianOptions(null, true);
     $endMeridianOptions = TribeEventsViewHelpers::getMeridianOptions(null);
     $tickets = TribeEventsTickets::get_event_tickets($post_id);
     include $this->path . 'admin-views/tickets/meta-box.php';
 }
 function braintrust_class_attendee_list($post)
 {
     global $wpdb;
     $order_id = $post->ID;
     $order = new WC_Order($order_id);
     $ordered_items = $order->get_items();
     $tickets = TribeEventsTickets::get_event_tickets($event_id);
     foreach ($ordered_items as $item_id => $values) {
         $_product_id = $values['product_id'];
         if (get_post_meta($_product_id, '_tribe_wooticket_for_event', true) > 0) {
             $event_id = get_post_meta($_product_id, '_tribe_wooticket_for_event', true);
             echo '<h3>' . __(get_the_title($event_id)) . '</h3>';
             echo '<table class="wp-list-table widefat fixed attendees">';
             echo '<thead>';
             echo '<tr>';
             echo '<th scope="col" id="btcg_attendee" class="manage-column column-btcg_attendee" style="">First Name</th>';
             echo '<th scope="col" id="btcg_attendee" class="manage-column column-btcg_attendee" style="">Last Name</th>';
             echo '<th scope="col" id="btcg_attendee" class="manage-column column-btcg_attendee" style="">Email</th>';
             echo '<th scope="col" id="btcg_attendee" class="manage-column column-btcg_attendee" style="">Job Title</th>';
             echo '<th scope="col" id="btcg_attendee" class="manage-column column-btcg_attendee" style="">Dietary Restrictions</th>';
             echo '</tr>';
             echo '</thead>';
             $attendee_count = $values['qty'];
             if ($attendee_count > 0) {
                 echo '<tbody id="the-list" data-wp-lists="list:attendee">';
                 $alternate_class = "alternate";
                 for ($n = 1; $n <= $attendee_count; $n++) {
                     $alternate_class = $n % 2 == 0 ? "" : "alternate";
                     echo '<tr class="' . $alternate_class . '">';
                     echo '<td>';
                     $first_name = get_post_meta($order_id, 'attendee_first_name_' . $_product_id . '_' . $n, true);
                     if (empty($first_name)) {
                         $first_name = get_post_meta($order_id, 'attendee_name_' . $_product_id . '_' . $n, true);
                     }
                     echo $first_name;
                     echo '</td>';
                     echo '<td>';
                     echo get_post_meta($order_id, 'attendee_last_name_' . $_product_id . '_' . $n, true);
                     echo '</td>';
                     echo '<td>';
                     echo get_post_meta($order_id, 'attendee_email_' . $_product_id . '_' . $n, true);
                     echo '</td>';
                     echo '<td>';
                     echo get_post_meta($order_id, 'attendee_job_title_' . $_product_id . '_' . $n, true);
                     echo '</td>';
                     echo '<td>';
                     echo get_post_meta($order_id, 'attendee_dietary_restrictions_' . $_product_id . '_' . $n, true);
                     echo '</td>';
                     echo '</tr>';
                 }
                 echo '</tbody>';
             }
             echo '</table>';
         }
     }
 }