</div>


<h1 class='impact_header'>TRANSACTION HISTORY</h1>

<table width='100%' class='tth_table'>
<tr><th>Plan Type</th><th>Passion Earned</th><th>Location Earned</th>  <th>Status</th> <th>Paypal Transaction Id</th><th>Amount</th><th>Transaction Time</th></tr>
<?php 
$user_id = wp_get_current_user()->ID;
$plan_types = array('1' => 'TIER-1', 2 => 'TIER-2', 3 => 'TIER-3', 4 => 'Additional Passions', 5 => 'Additional Locations');
$results = $wpdb->get_results("select * from transcharity_tier_membership WHERE user_id='{$user_id}'");
$pCounter = 0;
foreach ($results as $key) {
    $plan_selected = $plan_types[$key->plan_type];
    $passion_earned = convertPassionsToText($key->passions);
    $location_earned = convertLocationsToText($key->locations);
    $paypal = unserialize(base64_decode($key->paypal_transaction_history));
    $status = $paypal['st'];
    $transactionId = $paypal['tx'];
    $transactionAmount = number_format($paypal['amt'], 2) . " " . $paypal['cc'];
    $transactionTime = date("m/d/y h:i A", strtotime($key->created_on));
    echo "<tr><td>{$plan_selected}</td><td>{$passion_earned}</td><td>{$location_earned}</td><td>{$status}</td><td>{$transactionId}</td><td>{$transactionAmount}</td><td>{$transactionTime}</td></tr>";
    $pCounter++;
}
if (!$pCounter) {
    echo "<tr><td colspan='7' style='text-align:center'><font color='red'>No Plans has been taken by you so far !</font></td></tr>";
}
?>
</table>

function confirmSelection()
{
    $passions = @implode(",", $_POST['select_transcharity_passion']);
    $locations = @implode(",", $_POST['select_transcharity_location']);
    $data['passions'] = $passions;
    $data['locations'] = $locations;
    $data['plan_type'] = $_POST['transcharity_tier_membership'];
    $html = "";
    if ($passions) {
        $html .= "<b>Added Passions</b> - <br>" . convertPassionsToText($passions) . "<br>";
    }
    if ($locations) {
        $html .= "<b>Added Locations</b> - <br>" . convertLocationsToText($locations);
    }
    $return = array();
    $return['encrypted_data'] = str_replace("=", "", base64_encode(serialize($data)));
    $return['text_to_show'] = $html;
    $return['price'] = getPlanPrice($_POST['transcharity_tier_membership']);
    $return['planDescription'] = getPlanDescription($_POST['transcharity_tier_membership']);
    echo json_encode($return);
    exit;
}