function myPersonalGroupDetails($id = '')
{
    $table_prefix = mlm_core_get_table_prefix();
    global $wpdb;
    //get loged user's key
    if ($id == '') {
        $key = get_current_user_key();
    } else {
        $key = $wpdb->get_var("SELECT user_key FROM {$table_prefix}mlm_users WHERE user_id = {$id}");
    }
    //Total Users on My left leg
    $personalLegUsers = totalMyPersonalSales($key);
    //paid users on my left leg
    $personalLegActiveUsers = activeUsersOnPersonalSales($key);
    //show total users on left leg
    $totalPersonalLegUsers = myTotalPersonalUsers($key);
    //_e("<pre>");print_r($totalPersonalLegUsers);exit;
    ?>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load('visualization', '1', {packages: ['table']});
    </script>
    <script type="text/javascript">
        var visualization;
        var data;
        var options = {'showRowNumber': true};
        function drawVisualization() {
            // Create and populate the data table.
            var dataAsJson =
                    {cols: [
                            {id: 'A', label: '<?php 
    echo _e("User Name", "binary-mlm-pro");
    ?>
', type: 'string'},
                            {id: 'B', label: '<?php 
    echo _e("User Key", "binary-mlm-pro");
    ?>
 ', type: 'string'},
                            {id: 'D', label: '<?php 
    echo _e("Status", "binary-mlm-pro");
    ?>
', type: 'string'}],
                        rows: [
    <?php 
    foreach ($totalPersonalLegUsers as $row) {
        ?>
                                {c: [{v: '<?php 
        echo $row['username'];
        ?>
'}, {v: '<?php 
        echo $row['user_key'];
        ?>
'}, {v: '<?php 
        echo $row['payment_status'];
        ?>
'}]},
    <?php 
    }
    ?>
                        ]};
            data = new google.visualization.DataTable(dataAsJson);
            // Set paging configuration options
            // Note: these options are changed by the UI controls in the example.
            options['page'] = 'enable';
            options['pageSize'] = 10;
            options['pagingSymbols'] = {prev: 'prev', next: 'next'};
            options['pagingButtonsConfiguration'] = 'auto';
            //options['allowHtml'] = true;
            //data.sort({column:1, desc: false});
            // Create and draw the visualization.
            visualization = new google.visualization.Table(document.getElementById('table'));
            draw();
        }
        function draw() {
            visualization.draw(data, options);
        }
        google.setOnLoadCallback(drawVisualization);
        // sets the number of pages according to the user selection.
        function setNumberOfPages(value) {
            if (value) {
                options['pageSize'] = parseInt(value, 10);
                options['page'] = 'enable';
            } else {
                options['pageSize'] = null;
                options['page'] = null;
            }
            draw();
        }
        // Sets custom paging symbols "Prev"/"Next"
        function setCustomPagingButtons(toSet) {
            options['pagingSymbols'] = toSet ? {next: 'next', prev: 'prev'} : null;
            draw();
        }
        function setPagingButtonsConfiguration(value) {
            options['pagingButtonsConfiguration'] = value;
            draw();
        }
    </script>
    <!--va-matter-->
    <div class="va-matter">
        <!--va-matterbox-->
        <div class="va-matterbox">
            <!--va-headname-->
            <div class="va-headname"><?php 
    _e('My Personal Group Details', 'binary-mlm-pro');
    ?>
</div>
            <!--/va-headname-->
            <div class="va-admin-leg-details">
                <!--va-admin-mid-->
                <div class="paging">
                    <form action="">
                        <div class="left-side">
                            <?php 
    _e('Display Number of Rows', 'binary-mlm-pro');
    ?>
 : &nbsp; 
                        </div>
                        <div class="right-side">
                            <select style="font-size: 12px" onchange="setNumberOfPages(this.value)">
                                <option value="5">5</option>
                                <option selected="selected" value="10">10</option>
                                <option value="20">20</option>
                                <option  value="50">50</option>
                                <option value="100">100</option>
                                <option value="500">500</option>
                                <option value="">All</option>
                            </select>
                        </div>	
                    </form>
                    <div class="right-members">
                        <?php 
    _e('Total Users', 'binary-mlm-pro');
    ?>
: <strong><?php 
    echo $personalLegUsers;
    ?>
</strong>&nbsp;<?php 
    _e('Active Users', 'binary-mlm-pro');
    ?>
: <strong><?php 
    echo $personalLegActiveUsers;
    ?>
</strong>
                    </div>
                    <div class="va-clear"></div>
                </div>
                <div id="table"></div>
                <div class="va-clear"></div>
            </div>		
        </div>
    </div>	
    <?php 
}
function mlmNetworkDetailsPage()
{
    //get loged user's key
    $key = get_current_user_key();
    //Total my personal sales
    $personalSales = totalMyPersonalSales($key);
    //Total my personal sales active users
    $activePersonalSales = activeUsersOnPersonalSales($key);
    //show five users on personal sales
    $fivePersonalUsers = myFivePersonalUsers($key);
    //get logged in user info
    global $current_user, $wpdb;
    $table_prefix = mlm_core_get_table_prefix();
    get_currentuserinfo();
    $username = $current_user->ID;
    $user_info = get_userdata($current_user->ID);
    $_SESSION['ajax'] = 'ajax_check';
    $add_page_id = get_post_id('mlm_registration_page');
    $sponsor_name = $current_user->user_login;
    /**********Affiliate URL CODE***********************/
    $affiliateURLold = site_url() . '?page_id=' . $add_page_id . '&sp=' . $key;
    $affiliateURLnew = site_url() . '/u/' . $sponsor_name;
    $permalink = get_permalink(empty($_GET['page_id']) ? '' : $_GET['page_id']);
    $postidparamalink = strstr($permalink, 'page_id');
    $affiliateURL = $postidparamalink ? $affiliateURLold : $affiliateURLnew;
    /*********E O F Affiliate URL Code************************/
    $view_memberpage_id = $wpdb->get_var("SELECT id FROM {$table_prefix}posts  WHERE `post_content` LIKE '%mlm-view-child-level-member%'\tAND `post_type` != 'revision'");
    // Check Payment Method
    $mlm_method = get_option('wp_mlm_payment_method');
    $mlm_general_settings = get_option('wp_mlm_general_settings');
    $mlm_no_of_level = $mlm_general_settings['mlm-level'];
    $mlm_pay_settings = get_option('wp_mlm_payment_settings');
    //Check If USER is Not PAid then will show option for Payment
    $check_paid = $wpdb->get_var("SELECT payment_status FROM {$table_prefix}mlm_users WHERE user_id = '" . $username . "'");
    if ($check_paid == 0) {
        PayNowOptions($username, 'dashboard');
    }
    ?>
	     <?php 
    if (function_exists('Update_Paypal_Notification')) {
        Update_Paypal_Notification();
    }
    ?>
	
<p class="affiliate_url"><strong>Affiliate URL :</strong> <?php 
    echo $affiliateURL;
    ?>
 </p><br /> 
		<table width="100%" border="0" cellspacing="10" cellpadding="1">
		  <tr>
			<td width="40%" valign="top">
				<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td colspan="2"><strong><?php 
    _e('Personal Information', 'unilevel-mlm-pro');
    ?>
</strong></td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Title', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    _e('Details', 'unilevel-mlm-pro');
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Name', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    echo $user_info->first_name . ' ' . $user_info->last_name;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Address', 'unilevel-mlm-pro');
    ?>
</td>
					<td style="white-space:normal;"><?php 
    echo $user_info->user_address1 . "<br>" . $user_info->user_address2;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('City', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    echo $user_info->user_city;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Contact No', 'unilevel-mlm-pro');
    ?>
.</td>
					<td><?php 
    echo $user_info->user_telephone;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('DOB', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    echo $user_info->user_dob;
    ?>
</td>
				  </tr>
				  
				  
				  
				  <tr>
		<td><a href="<?php 
    echo get_post_id_or_postname('mlm_update_profile_page', 'unilevel-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('Edit', 'unilevel-mlm-pro');
    ?>
</a></td>
		<td><a href="<?php 
    echo get_post_id_or_postname('mlm_network_genealogy_page', 'unilevel-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View Genealogy', 'unilevel-mlm-pro');
    ?>
</a></td>
		</tr>
				</table> 
					<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td colspan="2"><strong><?php 
    _e('My Payouts', 'unilevel-mlm-pro');
    ?>
</strong></td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Date', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    _e('Amount', 'unilevel-mlm-pro');
    ?>
</td>
       <td><?php 
    _e('Action', 'unilevel-mlm-pro');
    ?>
</td>
				  </tr>
<?php 
    $detailsArr = my_payout_function();
    //_e("<pre>");print_r($detailsArr); exit;
    //$page_id = get_post_id('mlm_my_payout_details_page');
    if (count($detailsArr) > 0) {
        $mlm_settings = get_option('wp_mlm_general_settings');
        ?>
			<?php 
        foreach ($detailsArr as $row) {
            $amount = $row->commission_amount + $row->bonus_amount;
            ?>
		<tr>
			<td><?php 
            echo $row->payoutDate;
            ?>
</td>
			<td><?php 
            echo $mlm_settings['currency'] . ' ' . $amount;
            ?>
</td>
			<td><a href="<?php 
            echo get_post_id_or_postname_for_payout('mlm_my_payout_details_page', $row->payout_id);
            ?>
">View</a></td>
			
		</tr>
		
		<?php 
        }
        ?>
	<?php 
    } else {
        ?>
	<div class="no-payout"><?php 
        _e('You have not earned any commisssions yet.', 'unilevel-mlm-pro');
        ?>
 </div>
	
	<?php 
    }
    ?>
				</table>
			</td>
			<td width="40%">
				<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td><strong><?php 
    _e('Network Details', 'unilevel-mlm-pro');
    ?>
</strong></td>
				  </tr>
				  
				  

				 	<tr>
					<td>
						<table width="100%" border="0" cellspacing="10" cellpadding="1">
							<tr>
								<td colspan="2"><strong><?php 
    _e('Personal Sales', 'unilevel-mlm-pro');
    ?>
</strong></td>
							</tr>
							
							<tr>
								<td><?php 
    _e('My Personal Sales', 'unilevel-mlm-pro');
    ?>
: <?php 
    echo $personalSales;
    ?>
</td>
			<td><?php 
    _e('Active', 'unilevel-mlm-pro');
    ?>
: <?php 
    echo $activePersonalSales;
    ?>
</td>
							</tr>
							<?php 
    foreach ($fivePersonalUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
							<tr>
		<td colspan="2"><a href="?page_id=<?php 
    echo $view_memberpage_id;
    ?>
&lvl=1" style="text-decoration: none"><?php 
    _e('View All', 'unilevel-mlm-pro');
    ?>
</a></td>
		</tr>
							
						</table>
					</td>
				  </tr> 
				  
				</table>
			</td>
		  </tr>
		</table>

<?php 
}
function adminMLMUserAccountInterface()
{
    //get database table prefix
    $table_prefix = mlm_core_get_table_prefix();
    global $wpdb;
    $msg = '';
    if (isset($_POST['mlm_user_account'])) {
        $search = $_POST['search_user'];
        $userId = $wpdb->get_var("SELECT ID FROM {$table_prefix}users WHERE user_login = '******' OR user_email = '{$search}'");
        if ($wpdb->num_rows > 0) {
            $_SESSION['search_user'] = $search;
            $_SESSION['session_set'] = 'sets';
            $_SESSION['userID'] = $userId;
        } else {
            $msg = __('You have entered a wrong username or email address', 'unilevel-mlm-pro');
            $_SESSION['search_user'] = $search;
            $_SESSION['session_set'] = '';
            $_SESSION['userID'] = '';
        }
    }
    ?>

<div class='wrap'>
	<div id="icon-users" class="icon32"></div><h1><?php 
    _e('User Report', 'unilevel-mlm-pro');
    ?>
</h1><br />

	<div class="notibar msginfo" style="margin:10px;">
		<a class="close"></a>
		<p><?php 
    _e("Input a member's username or email address in the input box below to get complete information about the member's account. No more switching back and forth into different member accounts to check their account details.", 'unilevel-mlm-pro');
    ?>
</p>
	</div>	

</div>

<div class="forms-ui">

<p><span style='color:red;'><?php 
    if (!empty($error)) {
        _e($error);
    }
    ?>
</span></p>

		<form name="open_user_account" method="post" action="">
	<table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table">
		<tr>
			<th scope="row" class="admin-settings">
				<a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('search-user');"><?php 
    _e('Search By username or email address', 'unilevel-mlm-pro');
    ?>
 :</a>
			</th>
			<td>
				<input type="text" name="search_user" id="search_user" size="52" value="<?php 
    if (!empty($_SESSION['search_user'])) {
        _e(htmlentities($_SESSION['search_user']));
    }
    ?>
">
				<a href="?page=mlm-user-account" style="cursor:pointer;text-decoration:none; margin-left:90px;"><?php 
    _e('Back to User Dashboard', 'unilevel-mlm-pro');
    ?>
</a>
				<div class="toggle-visibility" id="search-user"><?php 
    _e('Please enter username or email address.', 'unilevel-mlm-pro');
    ?>
</div>
				<div style="color:red;"><?php 
    echo $msg;
    ?>
</div>
			</td>
		</tr>
		</table>
		<p class="submit">
	<input type="submit" name="mlm_user_account" id="mlm_user_account" value="<?php 
    _e('Search', 'unilevel-mlm-pro');
    ?>
 &raquo;" class='button-primary' onclick="needToConfirm = false;">
	</p>
	</form>

	<script language="JavaScript">
  populateArrays();
</script>
<!-----sdfgdf -->
<?php 
    if (!empty($_GET['ac'])) {
        if ($_GET['ac'] == 'edit' && $_GET['page'] == 'mlm-user-account') {
            mlm_update_profile($_SESSION['userID']);
        } else {
            if ($_GET['ac'] == 'personal' && $_GET['page'] == 'mlm-user-account') {
                myPersonalGroupDetails($_SESSION['userID']);
            } else {
                if ($_GET['ac'] == 'payout' && $_GET['page'] == 'mlm-user-account') {
                    mlm_my_payout_page($_SESSION['userID']);
                } else {
                    if ($_GET['ac'] == 'payout-details' && $_GET['page'] == 'mlm-user-account') {
                        mlm_my_payout_details_page($_SESSION['userID']);
                    } else {
                        if ($_GET['ac'] == 'network' && $_GET['page'] == 'mlm-user-account') {
                            adminViewUnilevelNetwork($_SESSION['userID']);
                        }
                    }
                }
            }
        }
    } else {
        if (!empty($_SESSION['session_set']) && $_SESSION['session_set'] == 'sets') {
            $key = $wpdb->get_var("SELECT user_key FROM {$table_prefix}mlm_users WHERE user_id = {$_SESSION['userID']}");
            //Total my personal sales
            $personalSales = totalMyPersonalSales($key);
            //Total my personal sales active users
            $activePersonalSales = activeUsersOnPersonalSales($key);
            //show five users on personal sales
            $fivePersonalUsers = myFivePersonalUsers($key);
            $user_info = get_userdata($_SESSION['userID']);
            $add_page_id = get_post_id('mlm_registration_page');
            $sponsor_name = $user_info->user_login;
            $affiliateURL = site_url() . '?page_id=' . $add_page_id . '&sponsor=' . $sponsor_name;
            ?>
	
		<table width="100%" border="0" cellspacing="10" cellpadding="1">
		  <tr>
			<td width="40%" valign="top">
				<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td colspan="2"><strong><?php 
            _e('Personal Information', 'unilevel-mlm-pro');
            ?>
</strong></td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('Title', 'unilevel-mlm-pro');
            ?>
</td>
					<td><?php 
            _e('Details', 'unilevel-mlm-pro');
            ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('Name', 'unilevel-mlm-pro');
            ?>
</td>
					<td><?php 
            echo $user_info->first_name . ' ' . $user_info->last_name;
            ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('Address', 'unilevel-mlm-pro');
            ?>
</td>
					<td style="white-space:normal;"><?php 
            echo $user_info->user_address1 . "<br>" . $user_info->user_address2;
            ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('City', 'unilevel-mlm-pro');
            ?>
</td>
					<td><?php 
            echo $user_info->user_city;
            ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('Contact No', 'unilevel-mlm-pro');
            ?>
.</td>
					<td><?php 
            echo $user_info->user_telephone;
            ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('DOB', 'unilevel-mlm-pro');
            ?>
</td>
					<td><?php 
            echo $user_info->user_dob;
            ?>
</td>
				  </tr>
				   
				  
				  <tr>
		<td><a href="?page=mlm-user-account&ac=edit" style="text-decoration: none"><?php 
            _e('Edit', 'unilevel-mlm-pro');
            ?>
</a></td>
		<td><a href="?page=mlm-user-account&ac=network" style="text-decoration: none"><?php 
            _e('View Genealogy', 'unilevel-mlm-pro');
            ?>
</a></td>
		</tr>
				</table>
					<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td colspan="2"><strong><?php 
            _e('My Payouts', 'unilevel-mlm-pro');
            ?>
</strong></td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
            _e('Date', 'unilevel-mlm-pro');
            ?>
</td>
					<td><?php 
            _e('Amount', 'unilevel-mlm-pro');
            ?>
</td>
       <td><?php 
            _e('Action', 'unilevel-mlm-pro');
            ?>
</td>
				  </tr>
<?php 
            $detailsArr = my_payout_function($_SESSION['userID']);
            //_e("<pre>");print_r($detailsArr); exit;
            //$page_id = get_post_id('mlm_my_payout_details_page');
            if (count($detailsArr) > 0) {
                $mlm_settings = get_option('wp_mlm_general_settings');
                ?>
			<?php 
                foreach ($detailsArr as $row) {
                    $amount = $row->commission_amount + $row->bonus_amount;
                    ?>
		<tr>
			<td><?php 
                    echo $row->payoutDate;
                    ?>
</td>
			<td><?php 
                    echo $mlm_settings['currency'] . ' ' . $amount;
                    ?>
</td>
			<td><a href="?page=mlm-user-account&ac=payout-details&pid=<?php 
                    echo $row->payout_id;
                    ?>
" style="text-decoration:none;"><?php 
                    _e('View', 'unilevel-mlm-pro');
                    ?>
</a></td>	
		</tr>
		<tr><td colspan="2"><a href="?page=mlm-user-account&ac=payout" style="text-decoration:none;"><?php 
                    _e('View All', 'unilevel-mlm-pro');
                    ?>
</a></td></tr>
		<?php 
                }
                ?>
	<?php 
            } else {
                ?>
	<div class="no-payout"> <?php 
                _e('You have not earned any commisssions yet.', 'unilevel-mlm-pro');
                ?>
 </div>
	
	<?php 
            }
            ?>
				</table>
			</td>
			<td width="40%">
				<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td><strong><?php 
            _e('Network Details', 'unilevel-mlm-pro');
            ?>
</strong></td>
				  </tr>
				   

				 	<tr>
					<td>
						<table width="100%" border="0" cellspacing="10" cellpadding="1">
							<tr>
								<td colspan="2"><strong><?php 
            _e('Personal Sales', 'unilevel-mlm-pro');
            ?>
</strong></td>
							</tr>
							
							<tr>
								<td><?php 
            _e('My Personal Sales', 'unilevel-mlm-pro');
            ?>
: <?php 
            echo $personalSales;
            ?>
</td>
			<td>Active: <?php 
            echo $activePersonalSales;
            ?>
</td>
							</tr>
							<?php 
            foreach ($fivePersonalUsers as $key => $value) {
                _e("<tr>");
                foreach ($value as $k => $val) {
                    _e("<td>" . $val . "</td>");
                }
                _e("</tr>");
            }
            ?>
							<tr>
		<td colspan="2"><a href="?page=mlm-user-account&ac=personal" style="text-decoration: none"><?php 
            _e('View All', 'unilevel-mlm-pro');
            ?>
</a></td>
		</tr>
							
						</table>
					</td>
				  </tr> 
				  
				</table>
			</td>
		  </tr>
		</table>
		<?php 
        }
    }
    ?>
<!---sdfdsfsd ->


	</div>
<?php 
}
function mlmNetworkDetailsPage()
{
    //get loged user's key
    $key = get_current_user_key();
    //Total Users on My left leg
    $leftLegUsers = totalLeftLegUsers($key);
    //Total users on my right leg
    $rightLegUsers = totalRightLegUsers($key);
    //paid users on my left leg
    $leftLegActiveUsers = activeUsersOnLeftLeg($key);
    //paid users on my right leg
    $rightLegActiveUsers = activeUsersOnRightLeg($key);
    //Total my personal sales
    $personalSales = totalMyPersonalSales($key);
    //Total my personal sales active users
    $activePersonalSales = activeUsersOnPersonalSales($key);
    //show five users on left leg
    $fiveLeftLegUsers = myFiveLeftLegUsers($key);
    //show five users on right leg
    $fiveRightLegUsers = myFiveRightLegUsers($key);
    //show five users on personal sales
    $fivePersonalUsers = myFivePersonalUsers($key);
    //get logged in user info
    global $current_user, $wpdb;
    get_currentuserinfo();
    $username = $current_user->ID;
    $user_info = get_userdata($current_user->ID);
    $_SESSION['ajax'] = 'ajax_check';
    $add_page_id = get_post_id('mlm_registration_page');
    $sponsor_name = $current_user->user_login;
    $affiliateURLold = site_url() . '?page_id=' . $add_page_id . '&sp=' . $key;
    $affiliateURLnew = site_url() . '/u/' . getusernamebykey($key);
    $permalink = get_permalink(empty($_GET['page_id']) ? '' : $_GET['page_id']);
    $postidparamalink = strstr($permalink, 'page_id');
    $affiliateURL = $postidparamalink ? $affiliateURLold : $affiliateURLnew;
    ?>
    <?php 
    if (function_exists('Update_Paypal_Notification')) {
        Update_Paypal_Notification();
    }
    ?>
    <p class="affiliate_url"><strong>Affiliate URL :</strong> <?php 
    echo $affiliateURL;
    ?>
 </p><br />

    <table width="100%" border="0" cellspacing="10" cellpadding="1">
        <tr>
            <td width="40%" valign="top">
                <table width="100%" border="0" cellspacing="10" cellpadding="1">
                    <tr>
                        <td colspan="2"><strong> <?php 
    _e('Personal Information', 'binary-mlm-pro');
    ?>
</strong></td>
                    </tr>
                    <tr>
                        <td scope="row"><?php 
    _e('Title', 'binary-mlm-pro');
    ?>
</td>
                        <td> <?php 
    _e('Details', 'binary-mlm-pro');
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('Name', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    echo $user_info->first_name . ' ' . $user_info->last_name;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('Address', 'binary-mlm-pro');
    ?>
</td>
                        <td style="white-space:normal;"><?php 
    echo $user_info->user_address1 . "<br>" . $user_info->user_address2;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('City', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    echo $user_info->user_city;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('Contact No', 'binary-mlm-pro');
    ?>
.</td>
                        <td><?php 
    echo $user_info->user_telephone;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('DOB', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    echo $user_info->user_dob;
    ?>
</td>
                    </tr>



                    <tr>
                        <td><a href="<?php 
    echo get_post_id_or_postname('mlm_update_profile_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('Edit', 'binary-mlm-pro');
    ?>
</a></td>
                        <td><a href="<?php 
    echo get_post_id_or_postname('mlm_network_genealogy_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View Genealogy', 'binary-mlm-pro');
    ?>
</a></td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="10" cellpadding="1">
                    <tr>
                        <td colspan="2"><strong><?php 
    _e('My Payouts', 'binary-mlm-pro');
    ?>
</strong></td>
                    </tr>
                    <tr>
                        <td scope="row"><?php 
    _e('Date', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    _e('Amount', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    _e('Action', 'binary-mlm-pro');
    ?>
</td>
                    </tr>
                    <?php 
    $detailsArr = my_payout_function();
    //_e("<pre>");print_r($detailsArr); exit;
    //$page_id = get_post_id('mlm_my_payout_details_page');
    if (count($detailsArr) > 0) {
        $mlm_settings = get_option('wp_mlm_general_settings');
        ?>
                        <?php 
        foreach ($detailsArr as $row) {
            $amount = $row->commission_amount + $row->bonus_amount + $row->referral_commission_amount - $row->tax - $row->service_charge;
            ?>
                            <tr>
                                <td><?php 
            echo $row->payoutDate;
            ?>
</td>
                                <td><?php 
            echo $mlm_settings['currency'] . ' ' . $amount;
            ?>
</td>
                                <td><a href="<?php 
            echo get_post_id_or_postname_for_payout('mlm_my_payout_details_page', $row->payout_id);
            ?>
"><?php 
            echo __('View', 'binary-mlm-pro');
            ?>
</a></td>

                            </tr>

                        <?php 
        }
        ?>
                        <?php 
    } else {
        ?>
                        <div class="no-payout"><?php 
        _e('You have not earned any commisssions yet.', 'binary-mlm-pro');
        ?>
 </div>

                        <?php 
    }
    ?>
                </table>
            </td>
            <td width="40%">
                <table width="100%" border="0" cellspacing="10" cellpadding="1">
                    <tr>
                        <td><strong><?php 
    _e('Network Details', 'binary-mlm-pro');
    ?>
</strong></td>
                    </tr>
                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="10" cellpadding="1">
                                <tr>
                                    <td colspan="2"><strong><?php 
    _e('Left Leg Sales', 'binary-mlm-pro');
    ?>
</strong></td>
                                </tr>

                                <tr>
                                    <td><?php 
    _e('Total on Left Leg', 'binary-mlm-pro');
    ?>
: <?php 
    echo $leftLegUsers;
    ?>
</td>
                                    <td><?php 
    _e('Active', 'binary-mlm-pro');
    ?>
: <?php 
    echo $leftLegActiveUsers;
    ?>
</td>
                                </tr>
                                <?php 
    foreach ($fiveLeftLegUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
                                <tr>
                                    <td colspan="2"><a href="<?php 
    echo get_post_id_or_postname('mlm_left_group_details_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View All', 'binary-mlm-pro');
    ?>
</a></td>
                                </tr>

                            </table>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="10" cellpadding="1">
                                <tr>
                                    <td colspan="2"><strong><?php 
    _e('Right Leg Sales', 'binary-mlm-pro');
    ?>
</strong></td>
                                </tr>

                                <tr>
                                    <td><?php 
    _e('Total on Right Leg', 'binary-mlm-pro');
    ?>
: <?php 
    echo $rightLegUsers;
    ?>
</td>
                                    <td><?php 
    _e('Active', 'binary-mlm-pro');
    ?>
: <?php 
    echo $rightLegActiveUsers;
    ?>
</td>
                                </tr>
                                <?php 
    foreach ($fiveRightLegUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
                                <tr>
                                    <td colspan="2"><a href="<?php 
    echo get_post_id_or_postname('mlm_right_group_details_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View All', 'binary-mlm-pro');
    ?>
</a></td>
                                </tr>

                            </table>
                        </td>
                    </tr>


                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="10" cellpadding="1">
                                <tr>
                                    <td colspan="2"><strong><?php 
    _e('Personal Sales', 'binary-mlm-pro');
    ?>
</strong></td>
                                </tr>

                                <tr>
                                    <td><?php 
    _e('My Personal Sales', 'binary-mlm-pro');
    ?>
: <?php 
    echo $personalSales;
    ?>
</td>
                                    <td><?php 
    _e('Active', 'binary-mlm-pro');
    ?>
: <?php 
    echo $activePersonalSales;
    ?>
</td>
                                </tr>
                                <?php 
    foreach ($fivePersonalUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
                                <tr>
                                    <td colspan="2"><a href="<?php 
    echo get_post_id_or_postname('mlm_personal_group_details_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View All', 'binary-mlm-pro');
    ?>
</a></td>
                                </tr>

                            </table>
                        </td>
                    </tr> 

                </table>
            </td>
        </tr>
    </table>

    <?php 
}