<?php 
global $event_details;
foreach ($table_data as $event_id => $date_data) {
    setup_event_details($event_id);
    ?>
    <table class="epl_dates_times_prices_table" >
        <tr class="">
            <td><h2><?php 
    echo epl_format_string($event_details['post_title']);
    ?>
</h2></td>
            <td class="epl_w200">
                <?php 
    if (!epl_is_multi_location() && epl_get_event_property('_epl_event_location', true) > 0) {
        ?>
                    <div class="">

                        <?php 
        echo get_the_location_name();
        ?>
<br />
                        <?php 
        echo get_the_location_address();
        ?>
 <?php 
        echo get_the_location_address2();
        ?>
<br />
                        <?php 
Ejemplo n.º 2
0
?>

    <?php 
if (epl_get_element('discount_amount', $money_totals)) {
    ?>
        <tr class="epl_discount_amount">

            <td class="epl_w200">
                <?php 
    echo epl_e('Discount');
    ?>
                <?php 
    if (epl_get_element('discount_description', $money_totals) != '') {
        ?>
                    <span class="discount_description"> (<?php 
        echo epl_format_string($money_totals['discount_description']);
        ?>
)</span>
                <?php 
    }
    ?>
            </td>
            <td class="epl_total_price epl_w100 epl_ta_r"> -<?php 
    echo epl_get_formatted_curr($money_totals['discount_amount'], null, true);
    ?>
</td>
        </tr>
    <?php 
}
?>
    <?php 
 function attendee_list_table($args = array())
 {
     $defaults = array('event_id' => epl_get_element('event_id', $_REQUEST));
     $args = wp_parse_args($args, $defaults);
     extract($args);
     global $event_details;
     $this->ecm->set_event_regis_post_ids($event_id);
     //$event_id = ( int ) (!isset( $args['event_id'] ) ? $_REQUEST['event_id'] : $event_id);
     $_totals = $this->ecm->get_event_regis_snapshot($event_id);
     //if ( epl_is_empty_array( $event_details ) )
     $this->ecm->setup_event_details($event_id);
     $display = epl_get_element('_epl_show_attendee_list_template', $event_details, 'attendee-list-1');
     if (epl_get_element('_epl_show_attendee_list_link', $event_details, 0) == 0 && !current_user_can('manage_options')) {
         return null;
     }
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $event_addit_forms = isset($event_details['_epl_addit_regis_forms']) && $event_details['_epl_addit_regis_forms'] != '' ? array_flip($event_details['_epl_addit_regis_forms']) : array();
     //find the list of all forms
     $available_forms = $this->ecm->get_list_of_available_forms();
     $available_fields = $this->ecm->get_list_of_available_fields();
     //isolate the forms that are selected inside the event
     $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms);
     $addit_forms = array_intersect_key($available_forms, $event_addit_forms);
     //This will combine all the fields in all the forms so that we can construct a header row.
     $tickey_buyer_fields = array();
     foreach ($ticket_buyer_forms as $_form_id => $_form_info) {
         $tickey_buyer_fields += $_form_info['epl_form_fields'];
     }
     $event_addit_fields = array();
     foreach ($addit_forms as $_form_id => $_form_info) {
         $event_addit_fields += $_form_info['epl_form_fields'];
     }
     $epl_fields_inside_form = array_flip($tickey_buyer_fields);
     //get the field ids inside the form
     $epl_addit_fields_inside_form = array_flip($event_addit_fields);
     //get the field ids inside the form
     //when creating a form in form manager, the user may rearrange fields.  Find their desired order
     $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $event_details['_epl_attendee_list_field']);
     $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $event_details['_epl_attendee_list_field']);
     $epl_fields_to_display = $epl_fields_to_display + $epl_addit_fields_to_display;
     $csv_row = '';
     $list = array();
     $header_row = array();
     $header_pulled = false;
     $row = array();
     //$header_row[] = '';
     //$header_row[] = epl__( 'Regis Date' );
     //$header_row[] = epl__( 'Event Date' );
     //$header_row[] = epl__( 'Time' );
     $regis_ids = $this->ecm->get_event_regis_post_ids(false);
     //as of 1.1, the dates are stored as timestamps.
     //This will format the date for display based on the settings admin date format.
     //foreach ( $event_details['_epl_start_date'] as $k => &$v )
     //  $v = epl_admin_date_display( $v );
     foreach ($regis_ids as $regis_id => $att_count) {
         //$regis_data = $this->ecm->get_post_meta_all( $regis_id );
         $regis_data = $this->ecm->setup_regis_details($regis_id, true);
         //Sometime there may be incomplete db records.  These will cause issues below.
         //In those cases, skip and move to the next item
         if (!isset($regis_data['_epl_dates']['_epl_start_date'][$event_id])) {
             continue;
         }
         if (($startus = get_the_regis_status(null, true)) && $startus <= 1 || $startus > 5) {
             continue;
         }
         $event_times = $regis_data['_epl_dates']['_epl_start_time'][$event_id];
         //$event_prices = $regis_data['_epl_dates']['_epl_start_time'][$event_id];
         $regis_date = implode(' & ', array_intersect_key(epl_get_element('_epl_start_date', $event_details, array()), array_flip((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id])));
         $regis_time = implode(' & ', array_intersect_key(epl_get_element('_epl_start_time', $event_details, array()), array_flip((array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])));
         $date_labels = array();
         $date_labels[0] = '';
         $time_labels = array();
         $time_labels[0] = '';
         $ticket_labels = array();
         $ticket_labels[0] = $att_count;
         $purchased_tickets = (array) $regis_data['_epl_dates']['_att_quantity'][$event_id];
         $attendee_info = $regis_data['_epl_attendee_info'];
         $start = 1;
         foreach ($purchased_tickets as $price_id => $qty) {
             if ($event_details['_epl_price_type'][$price_id] != 'att') {
                 continue;
             }
             $_qty = is_array($qty) ? array_sum($qty) : $qty;
             //current( $qty );
             if ($_qty > 0) {
                 $date_label[] = current((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id]);
                 if (epl_get_element('_epl_pricing_type', $event_details) == 10) {
                     if (in_array($event_details['_epl_price_parent_time_id'][$price_id], (array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])) {
                         $time_labels = array_pad($time_labels, $start + $_qty, epl_get_element($event_details['_epl_price_parent_time_id'][$price_id], $event_details['_epl_start_time']));
                     } else {
                         $time_labels = array_pad($time_labels, $start + $_qty, '');
                     }
                 }
                 $ticket_labels = array_pad($ticket_labels, $start + $_qty, $event_details['_epl_price_name'][$price_id]);
                 $start += $_qty;
             }
         }
         $_r = array();
         $grand_total = epl_get_formatted_curr(epl_nz($regis_data['_epl_grand_total'], 0.0));
         $amount_paid = epl_get_formatted_curr(epl_nz($regis_data['_epl_payment_amount'], 0.0));
         $tickets_to_show = array_intersect_key($purchased_tickets, $event_details['_epl_price_name']);
         $att_counter = 1;
         $counter = 0;
         foreach ($tickets_to_show as $ticket_id => $ticket_qty) {
             if (is_array($ticket_qty)) {
                 $tmp_price_inner_keys = array_keys($ticket_qty);
                 $ticket_qty = array_sum($ticket_qty);
             }
             if ($ticket_qty == 0) {
                 continue;
             }
             for ($i = 0; $i <= $ticket_qty; $i++) {
                 if ($i == 0 && !epl_is_empty_array($event_addit_forms)) {
                     //continue;
                     //$row[] = epl__( 'Registrant' );
                 } else {
                     //$row[] = epl__( 'Attendee' );
                     $grand_total = '';
                     $amount_paid = '';
                     $regis_status = '';
                     $payment_method = '';
                 }
                 foreach ($epl_fields_to_display as $field_id => $field_atts) {
                     if (!$header_pulled) {
                         $header_row[] = html_entity_decode(htmlspecialchars_decode($field_atts['label'], ENT_QUOTES));
                     }
                     $value = '';
                     //new v1.2.b9+
                     if (isset($attendee_info[$field_id][$event_id][$ticket_id])) {
                         $value = epl_get_element($counter, $attendee_info[$field_id][$event_id][$ticket_id]);
                     } elseif (isset($attendee_info[$field_id][$event_id][$counter])) {
                         $value = $attendee_info[$field_id][$event_id][$counter];
                     }
                     if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                         $value = isset($field_atts['epl_field_choice_text'][$value]) && $field_atts['epl_field_choice_text'][$value] !== '' ? $field_atts['epl_field_choice_text'][$value] : $value;
                     } elseif ($field_atts['input_type'] == 'checkbox') {
                         if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) {
                             $value = implode(',', (array) $value);
                         } elseif (!epl_is_empty_array($value)) {
                             $value = implode(',', array_intersect_key($field_atts['epl_field_choice_text'], array_flip($value)));
                         } else {
                             $value = html_entity_decode(htmlspecialchars_decode($value));
                         }
                     }
                     /* else {
                     
                                               $value = html_entity_decode( htmlspecialchars_decode( $value ) );
                                               } */
                     $row[] = html_entity_decode(htmlspecialchars_decode($value, ENT_QUOTES));
                 }
                 $header_pulled = true;
                 //decode special chars (Swedish, Nordic)
                 //array_walk( $row, create_function( '&$item', '$item = utf8_decode($item);' ) );
                 if (!epl_is_empty_array($row)) {
                     $list[$regis_id]['att_count'] = $att_count;
                     $list[$regis_id]['attendees'][] = $row;
                     //$this->epl->epl_table->add_row( $row );
                 }
                 //$csv_row .= implode( ",", $row ) . "\r\n";
                 $row = array();
                 $counter++;
                 $att_counter++;
             }
         }
         $counter = 0;
     }
     //$tmpl = array( 'table_open' => '<table cellpadding="2" cellspacing="0" border="1" class="event_attendee_list_table">' );
     $data['event_title'] = epl_format_string($event_details['post_title']);
     $data['header_row'] = $header_row;
     $data['list'] = $list;
     return $this->epl->load_view('front/attendee-list/' . $display, $data, true);
 }
 function epl_attendee_list($table = true, $email_only = false, $regis_post_id = null)
 {
     global $epl_fields;
     $event_id = intval($_REQUEST['event_id']);
     $date_id = epl_get_element('date_id', $_REQUEST);
     $time_id = epl_get_element('time_id', $_REQUEST);
     $names_only = epl_get_element('names_only', $_REQUEST, 0) == 1;
     $email_list = array();
     //$regis_post_id = epl_get_element( 'post_ID', $_REQUEST, null );
     $this->setup_event_details($event_id);
     $_totals = $this->get_event_regis_snapshot($event_id);
     $this->set_event_regis_post_ids($event_id, $regis_post_id);
     global $event_details, $regis_details;
     $event_title = $event_details['post_title'];
     $event_date_keys = array_keys($event_details['_epl_start_date']);
     if (!$table) {
         $filename = str_replace(array(" ", ','), "-", $event_title) . "_" . date_i18n("Y-m-d");
         //header( "Content-type: application/x-msdownload", true, 200 );
         header('Content-Encoding: UTF-8');
         header('Content-Type: application/csv;charset=UTF-8');
         header("Content-Disposition: attachment; filename={$filename}.csv");
         header("Pragma: no-cache");
         header("Expires: 0");
         echo "";
         //BOM to make other utf-8 chars work
     } else {
     }
     //$this->setup_event_details( $event_id );
     //echo "<pre class='prettyprint'>" . print_r($event_details, true). "</pre>";
     //find the forms that the user has selected for this event
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $event_addit_forms = epl_get_element('_epl_addit_regis_forms', $event_details) ? array_flip($event_details['_epl_addit_regis_forms']) : array();
     /*
      * find price forms if any.
      */
     $price_forms = epl_get_element('_epl_price_forms', $event_details, array());
     $_price_forms = array();
     foreach ($price_forms as $k => $v) {
         $_price_forms += $v;
     }
     //find the list of all forms
     $available_forms = $this->get_list_of_available_forms();
     $available_fields = $this->get_list_of_available_fields();
     //isolate the ticket buyer forms that are selected inside the event
     $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms);
     //isolate the additional forms for attendees.
     $addit_forms = array_intersect_key($available_forms, array_merge($event_addit_forms, $_price_forms));
     //This will combine all the fields in all the forms so that we can construct a header row.
     $tickey_buyer_fields = array();
     foreach ($ticket_buyer_forms as $_form_id => $_form_info) {
         $tickey_buyer_fields = array_merge($tickey_buyer_fields, $_form_info['epl_form_fields']);
     }
     //combine all the fields from the attendee forms
     $event_addit_fields = array();
     foreach ($addit_forms as $_form_id => $_form_info) {
         //$event_addit_fields += $_form_info['epl_form_fields'];
         $event_addit_fields = array_merge($event_addit_fields, $_form_info['epl_form_fields']);
     }
     $glob_discounts = EPL_discount_model::get_instance()->get_global_discount_configs();
     $this->epl->load_config('global-discount-fields');
     $epl_fields_inside_form = array_flip($tickey_buyer_fields);
     //get the field ids inside the form
     $epl_addit_fields_inside_form = array_flip($event_addit_fields);
     //get the field ids inside the form
     //when creating a form in form manager, the user may rearrange fields.  Find their desired order
     $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_fields_inside_form);
     $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_addit_fields_inside_form);
     //final list of all the fields to display
     $epl_fields_to_display = $epl_fields_to_display;
     $csv_row = '';
     $header_row = array();
     $header_pulled = false;
     $tb_header_pulled = false;
     $row = array();
     $tb_form_data_header = array();
     $form_data_header = array();
     $tb_form_data = array();
     $form_data = array();
     //$header_row[] = '';
     $header_row[] = epl__('Regis ID');
     $header_row[] = epl__('Regis Date');
     $header_row[] = epl__('Status');
     $header_row[] = epl__('Payment Method');
     $header_row[] = epl__('Total');
     $header_row[] = epl__('Amount Paid');
     $header_row[] = epl__('Discount Code');
     $header_row[] = epl__('Event Date');
     $header_row[] = epl__('Time');
     $header_row[] = epl__('Ticket');
     foreach ($epl_fields_to_display as $field_id => $field_atts) {
         $tb_form_data_header[] = epl_format_string($field_atts['label']);
     }
     if (!epl_is_empty_array($epl_addit_fields_to_display)) {
         foreach ($epl_addit_fields_to_display as $field_id => $field_atts) {
             $form_data_header[] = epl_format_string($field_atts['label']);
         }
     }
     //get all the registration post ids for this event
     $regis_ids = $this->get_event_regis_post_ids(false, $regis_post_id);
     //as of 1.1, the dates are stored as timestamps.
     //This will format the date for display based on the settings admin date format.
     foreach ($event_details['_epl_start_date'] as $k => &$v) {
         $v = epl_admin_date_display($v);
     }
     $pack_regis = epl_get_element('_epl_pack_regis', $event_details, 0) == 10;
     $zebra = 'odd';
     //for each registration
     foreach ($regis_ids as $regis_id => $att_count) {
         //setup the registration details
         $regis_data = $this->setup_regis_details($regis_id, true);
         $version = preg_replace('/(\\.\\w\\d+)/', '', epl_get_element('_epl_plugin_version', $regis_details, EPL_PLUGIN_VERSION));
         //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($regis_data, true). "</pre>";
         //Sometime there may be incomplete db records.  These will cause issues below.
         //In those cases, skip and move to the next item
         if (!isset($regis_data['_epl_dates']['_epl_start_date'][$event_id])) {
             continue;
         }
         if (get_the_regis_status(null, true) <= 1) {
             continue;
         }
         $zebra = $zebra == 'odd' ? 'even' : 'odd';
         $total_att = epl_get_element('_total_att_' . $event_id, $regis_data);
         //event times and prices
         //$event_times = $regis_data['_epl_dates']['_epl_start_time'][$event_id];
         //$event_prices = $regis_data['_epl_dates']['_epl_start_time'][$event_id];
         $disc_code_id = trim(epl_get_element('discount_code_id', $regis_data['_epl_events'][$event_id]['money_totals']));
         $disc_source = $event_details;
         $disc_code = epl_get_element_m($disc_code_id, '_epl_discount_code', $disc_source, '');
         if ($disc_code == '') {
             $disc_code = epl_get_element_m($disc_code_id, '_epl_discount_code', $glob_discounts);
             $disc_source = $glob_discounts;
         }
         if ($disc_code_id != '') {
             $code_amount = epl_get_element_m($disc_code_id, '_epl_discount_amount', $disc_source);
             $code_type = epl_get_element_m($disc_code_id, '_epl_discount_type', $disc_source);
             $code_type = $epl_fields['epl_discount_fields']['_epl_discount_type']['options'][$code_type];
             $disc_code .= " ({$code_amount} {$code_type})";
         }
         $reserved_dates = epl_get_element_m($event_id, '_epl_start_date', $regis_data['_epl_dates'], array());
         $reserved_times = epl_get_element_m($event_id, '_epl_start_time', $regis_data['_epl_dates'], array());
         if (!$pack_regis && $date_id && !in_array($date_id, $reserved_dates)) {
             continue;
         }
         if (!$pack_regis && $time_id && !in_array($time_id, $reserved_times)) {
             continue;
         }
         //this isolates the dates and times that the user has registered for
         $reserved_dates = implode(' & ', array_intersect_key($event_details['_epl_start_date'], array_flip($reserved_dates)));
         $reserved_times_display = implode(' & ', array_intersect_key($event_details['_epl_start_time'], array_flip($reserved_times)));
         //init vars
         $date_labels = array();
         $date_labels[0] = '';
         $time_labels = array();
         $time_labels[0] = '';
         $ticket_labels = array();
         $ticket_labels[0] = $att_count;
         $purchased_tickets = (array) $regis_data['_epl_dates']['_att_quantity'][$event_id];
         //?????????
         $start = 1;
         foreach ($purchased_tickets as $price_id => $qty) {
             if (epl_is_date_level_price() && $date_id) {
                 $_qty = $qty[$date_id];
                 //current( $qty );
             } else {
                 $_qty = is_array($qty) ? array_sum($qty) : $qty;
             }
             //current( $qty );
             if ($_qty > 0) {
                 $date_label[] = current((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id]);
                 if (epl_get_element('_epl_pricing_type', $event_details) == 10) {
                     if (in_array($event_details['_epl_price_parent_time_id'][$price_id], (array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])) {
                         $time_labels = array_pad($time_labels, $start + $_qty, epl_get_element($event_details['_epl_price_parent_time_id'][$price_id], $event_details['_epl_start_time']));
                     } else {
                         $time_labels = array_pad($time_labels, $start + $_qty, '');
                     }
                 }
                 $ticket_labels = array_pad($ticket_labels, $start + $_qty, $event_details['_epl_price_name'][$price_id]);
                 $start += $_qty;
             }
             if (epl_is_date_level_price() && $date_id) {
                 $purchased_tickets[$price_id] = array_intersect_key($purchased_tickets[$price_id], array_flip($date_label));
             }
         }
         $_r = array();
         $regis_status = isset($regis_data['_epl_regis_status']) ? $epl_fields['epl_regis_payment_fields']['_epl_regis_status']['options'][$regis_data['_epl_regis_status']] : '';
         $_pm_id = EPL_Registration_model::get_instance()->setup_current_data($regis_data)->get_payment_profile_id();
         $payment_method = $epl_fields['epl_regis_payment_fields']['_epl_payment_method']['options'][$_pm_id];
         $grand_total = epl_get_formatted_curr(epl_nz($regis_data['_epl_grand_total'], 0.0));
         $amount_paid = epl_get_formatted_curr(epl_nz($regis_data['_epl_payment_amount'], 0.0));
         $attendee_info = $regis_data['_epl_attendee_info'];
         //################################### Ticket buyer Data ############################################
         //$row[] = epl__( 'Registrant' );
         $row[] = $regis_data['__epl']['_regis_id'];
         //epl_anchor( admin_url( "post.php?post={$regis_data['ID']}&action=edit" ), $regis_data['__epl']['_regis_id'] );
         $row[] = $regis_data['post_date'];
         $row[] = $regis_status;
         $row[] = epl_escape_csv_val($payment_method);
         $row[] = $table ? $grand_total : epl_escape_csv_val($grand_total);
         $row[] = $table ? $amount_paid : epl_escape_csv_val($amount_paid);
         $row[] = epl_escape_csv_val($disc_code);
         //      $tb_form_data[] = ''; //epl_escape_csv_val( $regis_date );
         //    $tb_form_data[] = ''; //$regis_time; //(epl_is_date_level_time ( ))?$regis_time:$time_labels[$i]; //
         //
         //          $tb_form_data[] = ''; //epl_escape_csv_val( epl_get_element( $ticket_id, $event_details['_epl_price_name'] ) ); //$regis_price;
         foreach ($epl_fields_to_display as $field_id => $field_atts) {
             $value = isset($attendee_info[$field_id]) ? epl_get_element(0, $attendee_info[$field_id][$event_id]) : '';
             if ($field_atts['input_slug'] == 'email') {
                 $email_list[$regis_id] = $value;
                 if ($regis_post_id && $regis_post_id != $regis_id) {
                     unset($email_list[$regis_id]);
                 }
             }
             if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                 $value = isset($field_atts['epl_field_choice_text'][$value]) && $field_atts['epl_field_choice_text'][$value] !== '' ? $field_atts['epl_field_choice_text'][$value] : $value;
             } elseif ($field_atts['input_type'] == 'checkbox') {
                 if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) {
                     $value = implode(',', (array) $value);
                 } else {
                     if (is_array($value)) {
                         $value = implode(',', array_intersect_key($field_atts['epl_field_choice_text'], array_flip((array) $value)));
                     }
                 }
             }
             //if ( !$names_only || ($names_only && in_array( $field_atts['input_slug'], array( 'first_name', 'last_name' ) ) !== false) ) {
             $tb_form_data[] = epl_escape_csv_val(html_entity_decode(htmlspecialchars_decode($value, ENT_QUOTES)));
             //if ( !$tb_header_pulled )
             // $tb_form_data_header[] = epl_escape_csv_val( html_entity_decode( htmlspecialchars_decode( $field_atts['label'], ENT_QUOTES ) ) );
             //}
         }
         $tb_header_pulled = true;
         $row = !$names_only ? array_merge($row, $tb_form_data) : array_merge($row, $tb_form_data);
         $row = apply_filters('ecm__epl_attendee_list__row_primary_registrant', $row);
         //if ( $table && (!$names_only || epl_is_empty_array( $addit_forms )) )
         //  $this->epl->epl_table->add_row( $row, $zebra );
         //if ( !$names_only || epl_is_empty_array( $addit_forms ) )
         //  $csv_row .= implode( ",", $row ) . "\r\n";
         $row = array();
         //###################  End Ticket Buyer Data #########################################
         $tickets_to_show = array_intersect_key($purchased_tickets, $event_details['_epl_price_name']);
         $counter = 1;
         $att_counter = 1;
         foreach ($tickets_to_show as $ticket_id => $ticket_quantities) {
             if (is_array($ticket_quantities)) {
                 $tmp_price_inner_keys = array_keys($ticket_quantities);
                 $ticket_qty = array_sum($ticket_quantities);
             }
             if ($ticket_qty == 0) {
                 continue;
             }
             //if(strlen($ticket_id) > 2)
             foreach ($ticket_quantities as $ticket_qty_id => $quantities) {
                 if (version_compare($version, '1.2.9', '<')) {
                     $counter = 1;
                 }
                 for ($i = 0; $i < $quantities; $i++) {
                     //not good, runs every time in the loop
                     if ($pack_regis && ($attendance_dates = epl_get_element("_pack_attendance_dates_{$event_id}_{$ticket_id}_" . ($i + 1), $regis_data, null))) {
                         $pack_count = count($attendance_dates);
                         $attendance_date_number = array_search($date_id, array_keys($attendance_dates)) + 1;
                         //from the even dates, we want to find the next consecutive x days.
                         $first_date_key = key($attendance_dates);
                         $offset = array_search($first_date_key, $event_date_keys);
                         $attendance_dates = array_slice($event_details['_epl_start_date'], $offset, $pack_count);
                     }
                     if ($pack_regis && $date_id && !isset($attendance_dates[$date_id])) {
                         break;
                         continue;
                     }
                     //$row[] = ''; //epl_get_element( '_epl_addit_regis_form_counter_label', $event_details, epl__( 'Attendee' ) ) . ' ' . $att_counter;
                     /* $grand_total = '';
                        $amount_paid = '';
                        $regis_status = '';
                        $payment_method = ''; */
                     $ticket_label = epl_escape_csv_val(epl_get_element($ticket_id, $event_details['_epl_price_name']));
                     if (epl_is_date_level_price()) {
                         $reserved_date_key = $ticket_qty_id;
                         $reserved_dates = epl_get_element_m($ticket_qty_id, '_epl_start_date', $event_details);
                     }
                     if (epl_is_date_level_time()) {
                         $reserved_time_key = $reserved_times[$ticket_qty_id];
                         $reserved_times_display = epl_get_element_m($reserved_time_key, '_epl_start_time', $event_details);
                     }
                     //$row[] = epl__( 'Attendee' );
                     $row[] = $regis_data['__epl']['_regis_id'];
                     $row[] = $regis_data['post_date'];
                     $row[] = $regis_status;
                     $row[] = epl_escape_csv_val($payment_method);
                     $row[] = $table ? $grand_total : epl_escape_csv_val($grand_total);
                     $row[] = $table ? $amount_paid : epl_escape_csv_val($amount_paid);
                     $row[] = epl_escape_csv_val($disc_code);
                     //discount code placeholder
                     $row[] = epl_escape_csv_val($reserved_dates);
                     $row[] = $reserved_times_display;
                     //(epl_is_date_level_time ( ))?$regis_time:$time_labels[$i]; //
                     $row[] = $ticket_label . ($pack_regis ? ' ' . $attendance_date_number . '/' . $pack_count : '');
                     //$regis_price;
                     /* form data, if any */
                     foreach ($epl_addit_fields_to_display as $field_id => $field_atts) {
                         if (!$header_pulled) {
                             // if ( !$names_only || ($names_only && in_array( $field_atts['input_slug'], array( 'first_name', 'last_name' ) ) !== false) )// TODO - make better
                             //   $form_data_header[] = epl_escape_csv_val( html_entity_decode( htmlspecialchars_decode( $field_atts['label'], ENT_QUOTES ) ) );
                         }
                         $value = '';
                         //new v1.2.b9+
                         if (isset($attendee_info[$field_id][$event_id][$ticket_id])) {
                             $value = epl_get_element($counter, $attendee_info[$field_id][$event_id][$ticket_id]);
                         } elseif (isset($attendee_info[$field_id][$event_id][$counter])) {
                             $value = $attendee_info[$field_id][$event_id][$counter];
                         }
                         if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') {
                             $value = isset($field_atts['epl_field_choice_text'][$value]) && $field_atts['epl_field_choice_text'][$value] !== '' ? $field_atts['epl_field_choice_text'][$value] : $value;
                         } elseif ($field_atts['input_type'] == 'checkbox') {
                             if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) {
                                 $value = implode(',', (array) $value);
                             } elseif (!epl_is_empty_array($value)) {
                                 $value = implode(',', array_intersect_key($field_atts['epl_field_choice_text'], array_flip($value)));
                             } else {
                                 $value = html_entity_decode(htmlspecialchars_decode($value));
                             }
                         }
                         /* else {
                         
                                                       $value = html_entity_decode( htmlspecialchars_decode( $value ) );
                                                       } */
                         //if ( !$names_only || ($names_only && in_array( $field_atts['input_slug'], array( 'first_name', 'last_name' ) ) !== false) )
                         $form_data[] = epl_escape_csv_val(html_entity_decode(htmlspecialchars_decode($value, ENT_QUOTES)));
                     }
                     $header_pulled = true;
                     //decode special chars (Swedish, Nordic)
                     $row = !$names_only ? array_merge($row, array_merge($tb_form_data, $form_data)) : array_merge($tb_form_data, $form_data);
                     $row = apply_filters('ecm__epl_attendee_list__row_attendee', $row);
                     array_walk($row, create_function('&$item', '$item = utf8_decode($item);'));
                     if ($table) {
                         $this->epl->epl_table->add_row($row, $zebra);
                     }
                     $csv_row .= implode(",", $row) . "\r\n";
                     $row = array();
                     $form_data = array();
                     $counter++;
                     $att_counter++;
                 }
             }
         }
         $tb_form_data = array();
     }
     $header_row = !$names_only ? array_merge($header_row, array_merge($tb_form_data_header, $form_data_header)) : array_merge($tb_form_data_header, $form_data_header);
     $header_row = apply_filters('ecm__epl_attendee_list__header_row', $header_row);
     array_walk($header_row, create_function('&$item', '$item = utf8_decode($item);'));
     if ($table) {
         $tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="" id="epl_attendee_list_table">');
         $this->epl->epl_table->set_template($tmpl);
         $this->epl->epl_table->set_heading($header_row);
         $t = $this->epl->epl_table->generate();
         return $t;
     } elseif ($email_only) {
         return $email_list;
     } else {
         echo implode(",", $header_row) . "\r\n";
         echo $csv_row;
         exit;
     }
 }
?>
</td>
                <td style="text-align: left;"><?php 
echo epl_get_formatted_curr($regis->discount_amount, null, true);
?>
</td>
            </tr>
            <tr>
                <td style="text-align: left;"><?php 
epl_e('Total');
?>
</td>
                <td style="text-align: left;"><?php 
echo epl_get_formatted_curr($regis->grand_total, null, true);
?>
</td>
            </tr>


        </table>
    </div>


    <div class="invoice_section_full" style="font-size: 0.8em;">
        <?php 
echo epl_format_string($invoice_settings['epl_invoice_instruction']);
?>
    </div>

</div>
    $payment_data = epl_get_regis_payments();
    if (!empty($payment_data) && !epl_is_zero_total()) {
        if (count($payment_data) > 0) {
            ?>
                        <tr>
                            <td colspan="2" style="text-align: center;font-weight: bold;"><?php 
            epl_e('Completed Payments');
            ?>
</td>
                        </tr>

                        <?php 
        }
        $total_paid = 0;
        foreach ($payment_data as $time => $p) {
            $payment_display = epl_format_string(get_post_meta($p['_epl_payment_method'], '_epl_pay_display', true));
            $total_paid += $p['_epl_payment_amount'];
            ?>
                        <tr>
                            <td>
                                <?php 
            echo epl_formatted_date($p['_epl_payment_date']);
            ?>
                  

                            </td>
                            <td>
                                <?php 
            echo epl_get_formatted_curr($p['_epl_payment_amount'], null, true);
            ?>
                                <?php