OverLord Shell
<?php session_start();
if(!isset($_SESSION['company_id']) || !isset($_SESSION['company_name'])){session_destroy();header("location:login.php");}
if(!in_array($_SESSION['loggedin_user'],array('admin','company'))){
header("location:login.php");
}
include("db/conn.php");
include_once("headerdash.inc.php");
include("sidebar.php");
$actv=$_SESSION['plans'];
$_SESSION['company_id'] = (empty($_SESSION['company_id'])) ? base64_decode($_SESSION['mid']) : $_SESSION['company_id'];
$pagename=substr(basename($_SERVER['PHP_SELF']),0,-4);
$webpagetitle="Enquiries";
$editrowa = getData('busdir_mst_all_company','company_id',$_SESSION['company_id'],null,null);
?>
<!--BEGIN CONTENT-->
<div class="page-content">
<div class="row">
<div class="col-md-8">
<div class="panel-body"
style="margin-right: -12%;
margin-left: -2%;">
<fielsdet><legend><h3 style="color: #eb2c33; padding-bottom: 3%;"><?php
echo $webpagetitle ?></h3></legend>
<a href="my-enquiryadd.php" class="btn btn-primary pull-right"style=" margin-right: 4%; margin-top: 1%;margin-bottom: 1%;">Add New<i class="fa fa-plus mlm"></i></a>
<?php if(!empty($_GET['msg']) && strpos($_GET['msg'],'success')!=FALSE){?>
<div class="note note-success note-dismissable" id="msg">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php if($_GET['msg']=='add_success'){?>Record added Successfully!!!<?php }?>
<?php if($_GET['msg']=='update_success'){?>Record updated Successfully!!!<?php }?>
<?php if($_GET['msg']=='delete_success'){?>Record deleted Successfully!!!<?php }?>
</div>
<?php }?>
<section class="home-content-top">
<div class="tabbable-panel margin-tops4 ">
<div class="tabbable-line">
<ul class="nav nav-tabs tabtop tabsetting">
<li class="active"> <a href="#tab_default_1" data-toggle="tab" onclick="change_tab(1);"> General Enquiries Sent </a> </li>
<li> <a href="#tab_default_4" data-toggle="tab" onclick="change_tab(4);"> General Enquiries Received</a> </li>
<li> <a href="#tab_default_2" data-toggle="tab" onclick="change_tab(2);">Enquiries Sent</a> </li>
<li> <a href="#tab_default_3" data-toggle="tab" onclick="change_tab(3);">Enquiries Received</a> </li>
</ul>
<div class="tab-content margin-tops">
<div class="tab-pane active fade in" id="tab_default_1">
<div class="col-md-12">
<br/><br/>
<div class="table-responsive">
<table class="table table-striped table-hover" id="dataTables-listing">
<thead>
<tr>
<th> # </th>
<th>Category Name </th>
<th>Subcategory Name </th>
<th>Product </th>
<th>name</th>
<th>Mobile</th>
<th>Email</th>
<th>Date & time</th>
<th class="text-center">Message</th>
<!-- <th class="text-center">Product Link</th>-->
</tr>
</thead>
<tbody>
<?php
//old qury
// $listq="SELECT * FROM busdir_mst_product_enquiry where (enq_from='c' or enq_from='s') and comm_id IS NOT NULL and enq_from IS NOT NULL order by enquiry_id desc";
// new query from chandrakant bhamare
$listq="SELECT * FROM busdir_mst_product_enquiry where (enq_from='c' or enq_from='s') and company_id=".$_SESSION['company_id']."";
$i=1;
$listr=$connection->query($listq);
while($listrow=$listr->fetch_assoc()){
if($listrow==''){
?>
<tr> <td colspan=8></td> </tr> <?php }else {?>
<?php
if($listrow['enq_from']=='c'){
// $qu="SELECT * FROM busdir_mst_category t1 INNER JOIN busdir_product t2 ON t1.catid=t2.catid where t1.catid='".$listrow['comm_id']."' ";
$qu="SELECT t1.categoryname,t1.catid FROM busdir_mst_category t1 INNER JOIN busdir_product t2 ON t1.catid=t2.catid where t1.catid='".$listrow['comm_id']."'";
}if($listrow['enq_from']=='s'){
//$qu="SELECT t1.*,t2.categoryname FROM `busdir_mst_subcategory` t1 INNER JOIN `busdir_mst_category` t2 ON t1.catid=t2.catid where t1.subcatid='".$listrow['comm_id']."' ";
$qu="SELECT t2.categoryname,t2.catid,t1.subcategoryname,t1.subcatid FROM `busdir_mst_subcategory` t1 INNER JOIN `busdir_mst_category` t2 ON t1.catid=t2.catid INNER JOIN busdir_product t3 ON t3.catid=t2.catid where t1.subcatid='".$listrow['comm_id']."'";
}
//echo "11";exit;
$listc=$connection->query($qu);
$listrowc=$listc->fetch_assoc();
if(count($listrowc)!=0){?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $listrowc['categoryname']?></td>
<td><?php if(!empty($listrowc['subcategoryname'])){ echo $listrowc['subcategoryname'];} else { echo "--";}?></td>
<td><?php if($listrow['product_name']!=''){ echo $listrow['product_name'];}else { echo "--";} ?></td>
<td><?php if($listrow['product_name']!=''){ echo $listrow['name'];} else { echo "--";}?></td>
<td> <?php if($listrow['product_name']!=''){ echo $listrow['phone'];} else { echo "--"; }?></td>
<td><?php if($listrow['product_name']!=''){ echo $listrow['email']; } else { echo "--"; }?></td>
<td><?php echo date('d-M-Y H:i a',strtotime($listrow['createdon']))?></td>
<td class="text-center"><a href="my_enquiry_view.php?id=<?php echo base64_encode($listrow['enquiry_id'])?>" class="btn btn-warning btn-sm fancyboxajax">View<i class="fa fa-eye mlm"></i></a></td>
<!--<td class="text-center"><a href="product.php?id=<?php echo base64_encode($listrow['product_id'])?>" target="blank"class="btn btn-success btn-sm ">View<i class="fa fa-pencil-square-o mlm"></i></a></td>-->
</tr>
<?php }} ?>
<?php $i++;}$listr->free()?>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade in" id="tab_default_4">
<div class="col-md-12">
<br/><br/>
<div class="table-responsive">
<table class="table table-striped table-hover" id="dataTables-listing4">
<thead>
<tr>
<th> # </th>
<th>Category Name </th>
<th>Subcategory Name </th>
<th>Product </th>
<th>name</th>
<th>Mobile</th>
<th>Email</th>
<th>Date & time</th>
<th class="text-center">Message</th>
<!-- <th class="text-center">Product Link</th>-->
</tr>
</thead>
<tbody>
<?php
$listq="SELECT * FROM busdir_mst_product_enquiry where (enq_from='c' or enq_from='s') and company_id!=".$_SESSION['company_id']."";
$i=1;
$listr=$connection->query($listq);
while($listrow=$listr->fetch_assoc()){
if($listrow==''){
?>
<tr> <td colspan=8></td> </tr> <?php }else {?>
<?php
if($listrow['enq_from']=='c'){
// $qu="SELECT * FROM busdir_mst_category t1 INNER JOIN busdir_product t2 ON t1.catid=t2.catid where t1.catid='".$listrow['comm_id']."' ";
$qu="SELECT t1.categoryname,t1.catid FROM busdir_mst_category t1 INNER JOIN busdir_product t2 ON t1.catid=t2.catid where t1.catid='".$listrow['comm_id']."' ";
}if($listrow['enq_from']=='s'){
//$qu="SELECT t1.*,t2.categoryname FROM `busdir_mst_subcategory` t1 INNER JOIN `busdir_mst_category` t2 ON t1.catid=t2.catid where t1.subcatid='".$listrow['comm_id']."' ";
$qu="SELECT t2.categoryname,t2.catid,t1.subcategoryname,t1.subcatid FROM `busdir_mst_subcategory` t1 INNER JOIN `busdir_mst_category` t2 ON t1.catid=t2.catid INNER JOIN busdir_product t3 ON t3.catid=t2.catid where t1.subcatid='".$listrow['comm_id']."'";
}
//echo "11";exit;
$listc=$connection->query($qu);
$listrowc=$listc->fetch_assoc();
if(count($listrowc)!=0){?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $listrowc['categoryname']?></td>
<td><?php if(!empty($listrowc['subcategoryname'])){echo $listrowc['subcategoryname'];} else { echo "--";}?></td>
<td><?php if($listrow['product_name']!=''){ echo $listrow['product_name'];}else { echo "--";} ?></td>
<td><?php echo $listrow['name'];?></td>
<td> <?php echo $listrow['phone'];?></td>
<td><?php echo $listrow['email']; ?></td>
<td><?php echo date('d-M-Y H:i a',strtotime($listrow['createdon']))?></td>
<td class="text-center"><a href="my_enquiry_view.php?id=<?php echo base64_encode($listrow['enquiry_id'])?>" class="btn btn-warning btn-sm fancyboxajax">View<i class="fa fa-eye mlm"></i></a></td>
<!--<td class="text-center"><a href="product.php?id=<?php echo base64_encode($listrow['product_id'])?>" target="blank"class="btn btn-success btn-sm ">View<i class="fa fa-pencil-square-o mlm"></i></a></td>-->
</tr>
<?php }} ?>
<?php $i++;}$listr->free()?>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab_default_2">
<div class="col-md-12">
<br/><br/>
<div class="table-responsive">
<table class="table table-striped table-hover" id="dataTables-listing1">
<thead>
<tr>
<th>Category Name </th>
<th>Subcategory Name </th>
<th>Product Name </th>
<th>Sent From </th>
<th>Mobile</th>
<th>Email</th>
<th>Date & Time</th>
<th class="text-center">Message</th>
<th class="text-center">Product Link</th>
<!-- <th class="text-center">delete </th>-->
</tr>
</thead>
<tbody>
<?php
// $listq="SELECT *FROM busdir_mst_product_enquiry a INNER JOIN busdir_mst_all_company b ON a.my_company_id = b.my_company_id where a.company_id ='".$_SESSION['company_id']."' and b.active='y' and b.deleted='n'";
$listq="SELECT * FROM busdir_mst_product_enquiry where company_id = '".$_SESSION['company_id']."' and from_company_id !=0 order by enquiry_id desc";
//echo $listq;
$listr=$connection->query($listq);
while($listrow=$listr->fetch_assoc()){
$sqlq="SELECT b.company_name,b.contact_person_name,b.contact_person_phone,b.contact_person_email from busdir_product a,busdir_mst_all_company b where a.product_id=".$listrow['product_id']." and a.product_id !=0 and a.my_company_id=b.my_company_id";
$sqlc=$connection->query($sqlq);
$sqlrow=$sqlc->fetch_assoc();
$qu="SELECT t1.categoryname,t1.catid FROM busdir_mst_category t1 INNER JOIN busdir_product t2 ON t1.catid=t2.catid where t2.product_id='".$listrow['product_id']."'";
$listc=$connection->query($qu);
$listrowc=$listc->fetch_assoc();
$qu1="SELECT t1.subcategoryname,t1.subcatid FROM busdir_mst_subcategory t1 INNER JOIN busdir_product t2 ON t1.subcatid=t2.subcatid where t2.product_id='".$listrow['product_id']."'";
$listc1=$connection->query($qu1);
$listrowc1=$listc1->fetch_assoc();
/*if($listrow==''){
?> <tr> <td colspan=8></td> </tr> <?php }*/
?>
<tr>
<td><?php echo $listrowc['categoryname']?></td>
<td><?php echo $listrowc1['subcategoryname']?></td>
<td><?php echo $listrow['product_name'] ?></td>
<td><?php if($listrow['product_name']!=''){ echo $sqlrow['company_name'];} else { echo "General Enquiry";}?></td>
<?php if($actv!=0){?>
<td> <?php if($listrow['product_name']!=''){ echo $sqlrow['contact_person_phone'];} else { echo "--";}?></td>
<td><?php if($listrow['product_name']!=''){ echo $sqlrow['contact_person_email'];} else { echo "--";}?></td>
<?php }else{ ?>
<td><a href="plansadd.php?msg=upgrade">#####</a></td>
<td><a href="plansadd.php?msg=upgrade">#####</a></td>
<?php } ?>
<td><?php echo date('d-M-Y H:i a',strtotime($listrow['createdon']))?></td>
<td class="text-center"><a href="my_enquiry_view.php?id=<?php echo base64_encode($listrow['enquiry_id'])?>" class="btn btn-warning btn-sm fancyboxajax">View<i class="fa fa-eye mlm"></i></a></td>
<td class="text-center"><?php if($listrow['product_name']!=''){?><a href="product.php?id=<?php echo base64_encode($listrow['product_id'])?>" target="blank"class="btn btn-success btn-sm ">View<i class="fa fa-pencil-square-o mlm"></i></a><?php } else { echo "--";}?></td>
<!-- <td class="text-center"><button type="button" value="<?php echo $listrow['enquiry_id']?>" class="btn btn-sm btn-warning recyclebtn">Delete<i class="fa fa-trash-o mlm"></i></button></td>-->
</tr>
<?php }$listr->free()?>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab_default_3">
<div class="col-md-12">
<br/><br/>
<div class="table-responsive">
<table class="table table-striped table-hover" id="dataTables-listing2">
<thead>
<tr> <th>Product Name </th>
<th>Received from </th>
<th>name</th>
<th>Mobile</th>
<th>Email</th>
<th>Date & Time</th>
<th class="text-center">Message</th>
<th class="text-center">Product Link</th>
<!-- <th class="text-center">Enable / Disable</th>
<th class="text-center">Delete</th>-->
</tr>
</thead>
<tbody>
<?php
$listq="SELECT t1.*,t2.product_name FROM busdir_mst_product_enquiry t1 INNER JOIN busdir_product t2 ON t1.product_id=t2.product_id where t1.from_company_id = '".$_SESSION['company_id']."' order by t1.enquiry_id desc";
//"SELECT *FROM busdir_mst_product_enquiry a INNER JOIN busdir_mst_all_company b ON a.my_company_id = b.my_company_id where a.createdby ='".$_SESSION['company_id']."' and b.active='y'";
//"SELECT * FROM busdir_mst_product_enquiry where createdby = '".$_SESSION['company_id']."'";
//echo $listq;exit;
$listr=$connection->query($listq);
while($listrow=$listr->fetch_assoc()){
if($listrow==''){
?> <tr> <td colspan=8></td> </tr> <?php }else {?>
<tr>
<td><?php echo $listrow['product_name']?></td>
<td><?php echo $listrow['company_name']?></td>
<td><?php echo $listrow['name']?></td>
<td> <?php echo $listrow['phone']?></td>
<td><?php echo $listrow['email']?></td>
<td><?php echo date('d-M-Y H:i a',strtotime($listrow['createdon']))?></td>
<td class="text-center"><a href="my_enquiry_view.php?id=<?php echo base64_encode($listrow['enquiry_id'])?>" class="btn btn-warning btn-sm fancyboxajax">View<i class="fa fa-eye mlm"></i></a></td>
<td class="text-center"><?php if($listrow['product_name']!=''){?><a href="product.php?id=<?php echo base64_encode($listrow['product_id'])?>" target="blank"class="btn btn-success btn-sm ">View<i class="fa fa-pencil-square-o mlm"></i></a><?php } else { echo "--"; }?></td>
<!--<td class="text-center"><button type="button" value="<?php echo $listrow['review_id']?>" class="btn btn-sm btn-<?php if($listrow['approved']!='0')echo "info";else echo "default"?> approved"><?php if($listrow['approved']=='0')echo 'Mark as Approved<i class="fa fa-thumbs-o-up mlm"></i>';else echo 'Approved<i class="fa fa-thumbs-up mlm"></i>'?></button></td>
<td class="text-center"><button type="button" value="<?php echo $listrow['review_id']?>" class="btn btn-sm btn-<?php if($listrow['active']!='n')echo "danger";else echo "success"?> delbtn"><?php if($listrow['active']=='n')echo 'Make Enable<i class="fa fa-check mlm"></i>';else echo 'Make Disable<i class="fa fa-close mlm"></i>'?></button></td>-->
<!-- <td class="text-center"><button type="button" value="<?php echo $listrow['enquiry_id']?>" class="btn btn-sm btn-warning recyclebtn">Delete<i class="fa fa-trash-o mlm"></i></button></td>-->
</tr>
<?php } ?>
<?php }$listr->free()?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
<!--END CONTENT-->
<link type="text/css" rel="stylesheet" href="css/dataTables/dataTables.bootstrap.min.css">
<script src="js/dataTables/jquery.dataTables.min.js"></script>
<script src="js/dataTables/dataTables.bootstrap.min.js"></script>
<link href="css/jquery.fancybox.css" rel="stylesheet">
<script src="js/jquery.fancybox.pack.js"></script>
<script src="js/validate.js"></script>
<script>
$('#dataTables-listing').dataTable( {
"bSort": false
} );
$('#dataTables-listing').dataTable();
$('#dataTables-listing1').dataTable( {
"bSort": false
} );
$('#dataTables-listing1').dataTable();
$('#dataTables-listing2').dataTable( {
"bSort": false
} );
$('#dataTables-listing4').dataTable( {
"bSort": false
} );
$('#dataTables-listing2').dataTable();
if($('#msg').html()!==''){
setTimeout(function(){$('#msg').hide();},5000);
if(location.search.substring(1).length){if(history!==undefined && history.pushState!==undefined){history.pushState({}, document.title, location.pathname+'<?php if(isset($_SESSION['mid']))echo "?id=".$_SESSION['mid']?>');}}
}
$('.fancyboxajax').fancybox({type:'ajax'});
</script>
<?php $connection->close();include("footer.inc.php")?>
xRyukZ - Copyright 2k19