| Current Path : /home2/wtmwscom/www/admin/ |
| Current File : /home2/wtmwscom/www/admin/lead_report.php |
<?php
$title= "All Lead Profile";
include 'header.php';
include_once('lib/ps_pagination.php');
$param = '';
$param .= isset($_GET['from_date']) && $_GET['from_date']!='' ? "&from_date=".$_GET['from_date'] : '';
$param .= isset($_GET['to_date']) && $_GET['to_date']!='' ? "&to_date=".$_GET['to_date'] : '';
$param .= isset($_GET['name']) && $_GET['name']!='' ? "&name=".$_GET['name'] : '';
$query = "SELECT l.recid AS recid, l.uid AS uid, l.reg_date as reg_date, l.name as name, l.dob as dob, l.email as email, l.mobile as mobile, l.city as city, l.pan_no as pan_no, l.filename as filename, l.status as status, l.create_by_uid as create_by_uid, u.name as user_name FROM lead l INNER JOIN user u ON l.create_by_uid = u.uid WHERE l.recid != 0";
$query .= isset($_GET['from_date']) && $_GET['from_date']!='' && isset($_GET['to_date']) && $_GET['to_date']!='' ? " AND (reg_date BETWEEN '".$_GET['from_date']."' AND '".$_GET['to_date']."')" : '';
$query .= isset($_GET['name']) && $_GET['name']!='' ? " AND name LIKE '%".$_GET['name']."%'" : '';
?>
<h1>All Lead Profile</h1>
<?php echo getMessage();?>
<section id="comments">
<form action="" method="get">
<p>
<input style="float: left;" type="text" name="from_date" value="<?php if(isset($_GET['from_date'])){echo $_GET['from_date'];}?>" class="datepicker" placeholder="From Date" />
<input style="float: left;" type="text" name="to_date" value="<?php if(isset($_GET['to_date'])){echo $_GET['to_date'];}?>" class="datepicker" placeholder="To Date" />
<input style="float: left;" type="text" name="name" value="<?php if(isset($_GET['name'])){echo $_GET['name'];}?>" placeholder="Search by Name" />
<input type="submit" id="submit" value="Search">
</p>
</form>
</section>
<section>
<table style="width: 100%;">
<thead>
<tr>
<th>S. No.</th>
<th>Creted By</th>
<th>Lead Number</th>
<th>Name</th>
<th>Mobile</th>
<th>PAN</th>
<th>City</th>
<th>Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$pager = new PS_Pagination($connection, $query, 50, 5, $param);
$pager->setDebug(true);
$result = $pager->paginate();
if($result){
if(!isset($_GET['page'])){ $i=1; }else{ $i=(($_GET['page']-1)*50)+1; }
while ($row = mysqli_fetch_object($result)){
?>
<tr <?php if($i%2){echo "class='light'";}else{echo "class='dark'";}?>>
<td><?php echo $i;?></td>
<td><a href="edit_profile.php?uid=<?php echo $row->create_by_uid;?>"><?php echo $row->user_name;?></a></td>
<td>
<?php if($row->status == 0){ ?>
<a href="lead_edit.php?uid=<?php echo $row->uid;?>"><?php echo $row->uid;?></a>
<?php } else { ?>
<?php echo $row->uid;?>
<?php }?>
</td>
<td><?php echo $row->name;?></td>
<td><?php echo $row->mobile;?></td>
<td><a href="../member/uploads/<?php echo $row->filename;?>"><?php echo $row->pan_no;?></a></td>
<td><?php echo $row->city;?></td>
<td><?php echo date("d M, Y h:i A", strtotime($row->reg_date));?></td>
<td>
<?php if($row->status == 0 ){?>
<button onclick="processLeadStatus(<?php echo $row->create_by_uid;?>,<?php echo $row->recid;?>, 1)">APPROVE</button>
<button onclick="processLeadStatus(<?php echo $row->create_by_uid;?>,<?php echo $row->recid;?>, 2)">REJECT</button>
<?php }
elseif($row->status == 1 ) echo "APPROVED"; elseif($row->status == 2 ) echo "REJECTED";?>
</td>
</tr>
<?php
$i++;}
}?>
</tbody>
</table>
<?php echo $pager->renderFullNav();?>
</section>
<script type="text/javascript">
function processLeadStatus(uid, recid, status){
var r=confirm("Do you update lead status of lead id "+recid);
if(r){
$.post("lead_status_model.php",{'uid':uid,'recid':recid, 'status':status,},function(data){
alert(data);
location.reload();
});
}
}
</script>
<?php include 'footer.php';?>