| Current Path : /home2/wtmwscom/public_html/member/ |
| Current File : /home2/wtmwscom/public_html/member/tree_view.php |
<?php
$title = "Tree View";
include 'header.php';
//$plan_package = array(0 => "Free", 1 => "Rs. 10000", 2 => "Rs. 10000", 3 => "Rs. 2500", 4 => "Rs. 2500", 5 => "Rs. 2500",);
$datetime = date('Y-m-d H:i:s');
$paid_user_count = mysqli_fetch_object(mysqli_query($GLOBALS['connection'], "SELECT COUNT(uid) as count FROM user WHERE is_paid = 1 "))->count;
$unpaid_user_count = mysqli_fetch_object(mysqli_query($GLOBALS['connection'], "SELECT COUNT(uid) as count FROM user WHERE is_paid = 0 "))->count;
$plan_package = array();
$package_result = mysqli_query($GLOBALS['connection'], "SELECT * FROM pin_package");
while ($package_row = mysqli_fetch_object($package_result)) {
$plan_package[$package_row->id] = $package_row->package_name . " ($package_row->package_amount)";
}
if (isset($_GET['login_id'])) {
$user_id = mysqli_fetch_object(mysqli_query($GLOBALS['connection'], "SELECT uid FROM user WHERE login_id='" . $_GET['login_id'] . "'"))->uid;
if ($user_id) {
redirect('tree_view.php?no=' . $user_id);
} else {
redirect('tree_view.php');
die();
}
}
$child_ids = get_child_ids($_SESSION['userid']);
$uids = '';
foreach ($child_ids as $key => $level) {
foreach ($level as $key => $value) {
$uids[] = $value;
}
}
if (isset($_GET['no'])) {
$down = array_search($_GET['no'], $uids);
if (!$down) {
redirect('tree_view.php');
die();
}
}
$uid = !empty($_GET['no']) ? $_GET['no'] : $_SESSION['userid'];
$row1 = mysqli_fetch_object(mysqli_query($GLOBALS['connection'], "SELECT uid, login_id, name, reg_date, position, type, status, plan_type, is_paid, topup_datetime FROM user WHERE uid = '$uid'"));
$result = mysqli_query($GLOBALS['connection'], "SELECT uid, login_id, name, reg_date, mobile, position, type, status, plan_type, is_paid, topup_datetime FROM user WHERE placement_id = '$uid'");
?>
<link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<style type="text/css">
/*Now the CSS*/
* {margin: 0; padding: 0;}
.tree ul {
padding-top: 20px; position: relative;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
}
.tree li {
float: left; text-align: center;
list-style-type: none;
position: relative;
padding: 20px 5px 0 5px;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
}
/*We will use ::before and ::after to draw the connectors*/
.tree li::before, .tree li::after{
content: '';
position: absolute; top: 0; right: 50%;
border-top: 1px solid #ccc;
width: 50%; height: 20px;
}
.tree li::after{
right: auto; left: 50%;
border-left: 1px solid #ccc;
}
/*We need to remove left-right connectors from elements without
any siblings*/
.tree li:only-child::after, .tree li:only-child::before {
display: none;
}
/*Remove space from the top of single children*/
.tree li:only-child{ padding-top: 0;}
/*Remove left connector from first child and
right connector from last child*/
.tree li:first-child::before, .tree li:last-child::after{
border: 0 none;
}
/*Adding back the vertical connector to the last nodes*/
.tree li:last-child::before{
border-right: 1px solid #ccc;
border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
}
/*Time to add downward connectors from parents*/
.tree ul ul::before{
content: '';
position: absolute; top: 0; left: 50%;
border-left: 1px solid #ccc;
width: 0; height: 20px;
}
.tree li a{
border: 1px solid #ccc;
padding: 5px 10px;
text-decoration: none;
color: #666;
font-family: arial, verdana, tahoma;
font-size: 11px;
display: inline-block;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
}
/*Time for some hover effects*/
/*We will apply the hover effect the the lineage of the element also*/
.tree li a:hover, .tree li a:hover+ul li a {
background: #c8e4f8; color: #000; border: 1px solid #94a0b4;
}
/*Connector styles on hover*/
.tree li a:hover+ul li::after,
.tree li a:hover+ul li::before,
.tree li a:hover+ul::before,
.tree li a:hover+ul ul::before{
border-color: #94a0b4;
}
.min_chars{
display: block;
width: 40px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
<!--<h1>Team View</h1>
<!--new table ui-->
<?php
// $total_bv = mysqli_fetch_object(mysqli_query($GLOBALS['connection'], "SELECT SUM(pv_amount) as amount_left, SUM(amount_right) as amount_right FROM `product_sale` WHERE uid='$uid' AND date < (SELECT closing_date FROM closing_date WHERE status=1 ORDER BY closing_date DESC LIMIT 1)"));
// $total_bv = mysqli_fetch_object(mysqli_query($GLOBALS['connection'], "SELECT SUM(pv_amount) as amount_left, SUM(amount_right) as amount_right FROM `product_sale` WHERE uid='$uid' AND date < (SELECT closing_date FROM closing_date WHERE status=1 ORDER BY closing_date DESC LIMIT 1)"));
$left_count_array = get_count_child_ids_by_paid($uid, 'L');
$right_count_array = get_count_child_ids_by_paid($uid, 'R');
$child_ids_left = get_child_ids_2($uid, "L");
$child_ids_right = get_child_ids_2($uid, "R");
$uids_left = '';
$uids_right = '';
$childs_left = get_child_levels(get_paid_child_ids_by_reg_date($uid, 'L', $datetime));
$childs_right = get_child_levels(get_paid_child_ids_by_reg_date($uid, 'R', $datetime));
$commission_ids_left = get_commission_ids($childs_left, $uid);
$commission_ids_right = get_commission_ids($childs_right, $uid);
foreach ($child_ids_left as $key => $level) {
foreach ($level as $key => $value) {
if ($uids_left == '') {
$uids_left = $value;
} else {
$uids_left .= ', ' . $value;
}
}
}
foreach ($child_ids_right as $key => $level) {
foreach ($level as $key => $value) {
if ($uids_right == '') {
$uids_right = $value;
} else {
$uids_right .= ', ' . $value;
}
}
}
?>
<div class="">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<h4 class="page-title">Tree View</h4>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item"><a href="#">My Team</a></li>
<li class="breadcrumb-item active">Tree View</li>
</ol>
<div class="state-information d-none d-sm-block">
<!-- <div class="state-graph">
<div id="header-chart-1"></div>
<div class="info">Total Paid User :<?php echo $paid_user_count ?></div>
</div>
<div class="state-graph">
<div id="header-chart-2"></div>
<div class="info">Total Unpaid Users :<?php echo $unpaid_user_count ?></div>
</div>-->
</div><br>
</div>
</div>
</div>
<!-- end row -->
<!-- container-fluid -->
<div class="">
<div class="row">
<div class="col-lg-6">
<div class="card m-b-20">
<div class="card-body">
<h4 class="mt-0 header-title">Tree View</h4>
<div class="tree">
<ul>
<li>
<?php $row0 = mysqli_fetch_object(mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.uid = '$uid'")); ?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row0->uid;?>" title="<?php echo " Name: $row0->name ($row0->login_id), refer_id: $row0->refer_id_name , Position: $row0->position, Reg Date: ".date("d M, Y H:i A", strtotime($row0->reg_date))." ". (!empty($row0->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row0->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row0->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row0->login_id; ?></span>
</a>
<ul>
<li>
<?php
// echo $row0->new_refer;
$result10 = mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.placement_id = '".$row0->uid."' AND u.position = 'L' ");
if(mysqli_num_rows($result10)==1){
$row10 = mysqli_fetch_object($result10);
?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row10->uid;?>" title="<?php echo " Name: $row10->name ($row10->login_id), refer_id: $row10->refer_id_name , Position: $row10->position, Reg Date: ".date("d M, Y H:i A", strtotime($row10->reg_date))." ". (!empty($row10->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row10->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row10->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row10->login_id; ?></span>
</a>
<ul>
<li>
<?php
$result20 = mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.placement_id = '".$row10->uid."' AND u.position = 'L' ");
if(mysqli_num_rows($result20)==1){
$row20 = mysqli_fetch_object($result20);
?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row20->uid;?>" title="<?php echo " Name: $row20->name ($row20->login_id), refer_id: $row20->refer_id_name , Position: $row20->position, Reg Date: ".date("d M, Y H:i A", strtotime($row20->reg_date))." ". (!empty($row20->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row20->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row20->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row20->login_id; ?>
</a>
<?php } else {?>
<a href="./tree_register.php?placement_id=<?php echo $row10->uid; ?>&position=L" title="Add New Member" target="_blank"><i class="fa fa-user-plus fa-2x text-info" aria-hidden="true"></i><br/>Add</a>
<?php } ?>
<!-- <ul>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
</ul>-->
</li>
<li>
<?php
$result21 = mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.placement_id = '".$row10->uid."' AND u.position = 'R' ");
if(mysqli_num_rows($result21)==1){
$row21 = mysqli_fetch_object($result21);
?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row21->uid;?>" title="<?php echo " Name: $row21->name ($row21->login_id), refer_id: $row21->refer_id_name , Position: $row21->position, Reg Date: ".date("d M, Y H:i A", strtotime($row21->reg_date))." ". (!empty($row21->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row21->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row21->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row21->login_id; ?>
</a>
<?php } else {?>
<a href="./tree_register.php?placement_id=<?php echo $row10->uid; ?>&position=R" title="Add New Member" target="_blank"><i class="fa fa-user-plus fa-2x text-info" aria-hidden="true"></i><br/>Add</a>
<?php } ?>
<!-- <ul>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
</ul>-->
</li>
</ul>
<?php } else {?>
<a href="./tree_register.php?placement_id=<?php echo $row0->uid; ?>&position=L" title="Add New Member" target="_blank"><i class="fa fa-user-plus fa-2x text-info" aria-hidden="true"></i><br/>Add</a>
<?php }?>
</li>
<li>
<?php
$result11 = mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.placement_id = '".$row0->uid."' AND u.position = 'R' ");
if(mysqli_num_rows($result11)==1){
$row11 = mysqli_fetch_object($result11);
?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row11->uid;?>" title="<?php echo " Name: $row11->name ($row11->login_id), refer_id: $row11->refer_id_name , Position: $row11->position, Reg Date: ".date("d M, Y H:i A", strtotime($row11->reg_date))." ". (!empty($row11->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row11->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row11->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row11->login_id; ?>
</a>
<ul>
<li>
<?php
$result22 = mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.placement_id = '".$row11->uid."' AND u.position = 'L' ");
if(mysqli_num_rows($result22)==1){
$row22 = mysqli_fetch_object($result22);
?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row22->uid;?>" title="<?php echo " Name: $row22->name ($row22->login_id), refer_id: $row22->refer_id_name , Position: $row22->position, Reg Date: ".date("d M, Y H:i A", strtotime($row22->reg_date))." ". (!empty($row22->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row22->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row22->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row22->login_id; ?>
</a>
<?php } else {?>
<a href="./tree_register.php?placement_id=<?php echo $row11->uid; ?>&position=L" title="Add New Member" target="_blank"><i class="fa fa-user-plus fa-2x text-info" aria-hidden="true"></i><br/>Add</a>
<?php } ?>
<!-- <ul>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
</ul>-->
</li>
<li>
<?php
$result23 = mysqli_query($connection, "SELECT u.*, u1.login_id as refer_id_name FROM user u LEFT JOIN user u1 ON u.refer_id = u1.uid WHERE u.placement_id = '".$row11->uid."' AND u.position = 'R' ");
if(mysqli_num_rows($result23)==1){
$row23 = mysqli_fetch_object($result23);
?>
<a data-toggle="tooltip" href="./tree_view.php?no=<?php echo $row23->uid;?>" title="<?php echo " Name: $row23->name ($row23->login_id), refer_id: $row23->refer_id_name , Position: $row23->position, Reg Date: ".date("d M, Y H:i A", strtotime($row23->reg_date))." ". (!empty($row23->topup_datetime) ? ", Topup Date: ".date("d M, Y H:i A", strtotime($row23->topup_datetime)) : '');?>"><i class="fa fa-user fa-2x <?php echo $row23->is_paid==1 ? 'text-success' : 'text-danger' ;?>" aria-hidden="true"></i>
<br/><span class="min_chars" ><?php echo $row23->login_id; ?>
</a>
<?php } else {?>
<a href="./tree_register.php?placement_id=<?php echo $row11->uid; ?>&position=R" title="Add New Member" target="_blank"><i class="fa fa-user-plus fa-2x text-info" aria-hidden="true"></i><br/>Add</a>
<?php } ?>
<!-- <ul>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
<li>
<a href="#" title="103"><i class="fa fa-user fa-2x text-success" aria-hidden="true"></i></a>
</li>
</ul>-->
</li>
</ul>
<?php } else {?>
<a href="./tree_register.php?placement_id=<?php echo $row0->uid; ?>&position=R" title="Add New Member" target="_blank"><i class="fa fa-user-plus fa-2x text-info" aria-hidden="true"></i><br/>Add</a>
<?php }?>
</li>
</ul>
</li>
</ul>
</div>
<div style="clear: both;"><br/></div>
<div>
<form style="float:right" action="" method="get" >
<p>
<input type="text" name="login_id" placeholder="Search by User Id" style="width: 100px" />
<input style="" type="submit" id="submit" value="Search" class="btn btn-success">
</p>
</form>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card m-b-20">
<div class="card-body">
<h4 class="mt-0 header-title">Users View</h4>
<table class="table table-bordered mb-0">
<thead>
<tr>
<th>Register</th>
<th>Org 1</th>
<th>Org 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Green</td>
<td><?php echo $left_count_array['count_paid'] . ' Members'; ?></td>
<td><?php echo $right_count_array['count_paid'] . ' Members'; ?></td>
</tr>
<tr>
<td>Red</td>
<td><?php echo $left_count_array['count_unpaid'] . ' Members'; ?></td>
<td><?php echo $right_count_array['count_unpaid'] . ' Members'; ?></td>
</tr>
<tr>
<td>Total</td>
<td><?php echo $left_count_array['count_paid'] + $left_count_array['count_unpaid'] . ' Members'; ?></td>
<td><?php echo $right_count_array['count_paid'] + $right_count_array['count_unpaid'] . ' Members'; ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!---COL ENDS HERE OF TABLE-->
</div>
</div>
<div style="clear: both;"></div>
<div class="row">
<div class="col-lg-6">
<div class="card m-b-20">
<div class="card-body">
<h4 class="mt-0 header-title">ID Report </h4>
<table class="table table-bordered mb-0">
<thead>
<tr>
<th>Register</th>
<th>Org 1</th>
<th>Org 2</th>
</tr>
</thead>
<tbody>
<!---matching income report uncomment this rows-->
<tr>
<td>Total B.V.</td>
<td><?php
echo get_total_bv_income($uids_left);
?></td>
<td><?php echo get_total_bv_income($uids_right); ?></td>
</tr>
<tr>
<td>Carry forward B.V.</td>
<td><?php
$carry_amount_array = get_carry_bv_income($uid);
echo $carry_amount_array['left_carry'];
?></td>
<td><?php echo $carry_amount_array['right_carry']; ?></td>
</tr>
<tr>
<td>Total Current B.V.</td>
<td><?php
echo get_current_bv_income($uids_left) + $carry_amount_array['left_carry'];
?></td>
<td><?php echo get_current_bv_income($uids_right) + $carry_amount_array['right_carry']; ?></td>
</tr>
<!---matching report income ends--->
<!----binary pair income report-->
<!-- <tr>
<td>Total B.V.</td>
<td><?php
echo get_total_bv_income($uids_left);
?></td>
<td><?php echo get_total_bv_income($uids_right); ?></td>
</tr>
<tr>
<td>Current Ids (paid)</td>
<td><?php echo count($commission_ids_left); ?></td>
<td><?php echo count($commission_ids_right); ?></td>
</tr>-->
<!--
<!----binary pair income ends--->
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div> <!-- end row -->
<div style="clear: both;"></div>
</div>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip();
})
</script>
<?php include 'footer.php'; ?>