Preview: overall-order-rating-report.php
Size: 24.12 KB
/home/godevadmin/public_html/admin/overall-order-rating-report.php
<?php
include("../include/config.php");
include("../include/functions.php");
validate_admin();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo SITE_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script>
function checkall(objForm)
{
len = objForm.elements.length;
var i=0;
for( i=0 ; i<len ; i++){
if (objForm.elements[i].type=='checkbox')
objForm.elements[i].checked=objForm.check_all.checked;
}
}
function del_prompt(frmobj,comb)
{
//alert(comb);
if(comb=='Delete'){
if(confirm ("Are you sure you want to delete record(s)"))
{
frmobj.action = "order-del.php";
frmobj.what.value="Delete";
frmobj.submit();
}
else{
return false;
}
}
else if(comb=='Deactivate'){
frmobj.action = "order-del.php";
frmobj.what.value="Deactivate";
frmobj.submit();
}
else if(comb=='Activate'){
frmobj.action = "order-del.php";
frmobj.what.value="Activate";
frmobj.submit();
}
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php include("header.php") ?>
<link rel="stylesheet" href="../colorbox/colorbox.css" />
<script src="../colorbox/jquery.colorbox.js"></script>
<link rel="stylesheet" href="calender/css/jquery-ui.css">
<script src="calender/js/jquery-ui.js"></script>
<script>
$(function() {
$( "#search_from_date" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
onClose: function( selectedDate ) {
$( "#search_to_date" ).val(selectedDate);
$( "#search_to_date" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#search_to_date" ).datepicker({
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
})
$( "#search_from_date" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
onClose: function( selectedDate ) {
$( "#visit_date_to" ).val(selectedDate);
$( "#visit_date_to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#search_to_date" ).datepicker({
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
})
});
</script>
<tr>
<td align="right" class="paddRtLt70" valign="top">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<!------------ Search Section ----------------->
<tr>
<td align="left" valign="middle" class="bodr" style="padding-bottom:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="headingbg bodr text14" style="padding-left:20px;">Search<span style="float:right; padding-right:10px;"></span></td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td>
<form name="searchForm" method="post" action="overall-order-rating-report.php">
<table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td width="11%" align="right" ><strong>Order ID:</strong></td>
<td width="18%"><input type="text" name="search_order_id" value="<?php echo $_REQUEST['search_order_id']; ?>"/></td>
<td width="12%" align="right" ><strong>Email:</strong></td>
<td width="15%"><input type="text" name="search_email" value="<?php echo $_REQUEST['search_email']; ?>"/></td>
<td width="8%" align="right" ><strong>Payment Method:</strong></td>
<td width="14%"><select name="search_payment_method" style="width:150px;" >
<option value="">Select Method</option>
<option value="Cash On Delivery" <?php if($_REQUEST['search_payment_method']=='Cash On Delivery'){ ?>selected<?php } ?>>Cash On Delivery</option>
<option value="Online Payment" <?php if($_REQUEST['search_payment_method']=='Online Payment'){ ?>selected<?php } ?>>Online Payment</option>
</select></td>
<td width="6%" rowspan="2"><input type="submit" name="search" value="Search" /></td>
<td width="16%" rowspan="2"><a href="overall-order-rating-report.php">View All</a></td>
</tr>
<tr>
<td width="11%" align="right" ><strong>User ID:</strong></td>
<td width="18%"><input type="text" name="search_user_id" value="<?php echo $_REQUEST['search_user_id']; ?>"/></td>
<td width="12%" align="right" ><strong>Order Status:</strong></td>
<td width="15%"><select name="order_status" style="width:150px;">
<option value="">-Select-</option>
<?php $orderArr=$obj->query("select * from $tbl_order_status where status=1 order by id");
while($resultOrder=$obj->fetchNextObject($orderArr)){?>
<option value="<?php echo stripslashes($resultOrder->id); ?>" <?php if($_REQUEST['order_status']==$resultOrder->id){?>selected<?php } ?> ><?php echo stripslashes($resultOrder->order_status); ?></option>
<?php } ?>
</select></td>
<td width="8%" align="right" ><strong>Order Via:</strong></td>
<td width="14%"><select name="order_via" style="width:150px;">
<option value="">-Select-</option>
<option value="Website" <?php if($_REQUEST['order_via']=='Website'){ ?>selected<?php } ?>>Website</option>
<option value="App" <?php if($_REQUEST['order_via']=='App'){?>selected<?php } ?>>App</option>
</select></td>
</tr>
<tr>
<td width="11%" align="right" ><strong>Payment Status</strong></td>
<td width="18%"><select name="payment_status" style="width:150px;">
<option value="">-Select-</option>
<option value="1" <?php if($_REQUEST['payment_status']=='1'){ ?>selected<?php } ?>> Successful</option>
<option value="0" <?php if($_REQUEST['payment_status']=='0'){ ?>selected<?php } ?>> Unsuccessful</option>
</select></td>
<td width="12%" align="right" ><strong>From Date:</strong></td>
<td width="15%"><input type="text" name="search_from_date" id="search_from_date" value="<?php echo $_REQUEST['search_from_date']; ?>"/></td>
<td width="8%" align="right" ><strong>To Date:</strong></td>
<td width="14%"><input type="text" name="search_to_date" id="search_to_date" value="<?php echo $_REQUEST['search_to_date']; ?>"/></td>
</tr>
<tr><td width="8%" align="right" ><strong>Store:</strong></td>
<td width="14%"><select name="storename" style="width:150px;">
<option value="">-Select-</option>
<?php $storeArr=$obj->query("SELECT storeid,storename FROM `stores` where status=1");
while($resultStore=$obj->fetchNextObject($storeArr)){?>
<option value="<?php echo stripslashes($resultStore->storeid); ?>" <?php if($_REQUEST['storename']==$resultStore->storeid){?>selected<?php } ?> ><?php echo stripslashes($resultStore->storename); ?></option>
<?php } ?>
</select></td>
<td width="8%" align="right" ><strong>Rating Status:</strong></td>
<td width="14%"><select name="raitingstatus" style="width:150px;">
<option value="">-Select-</option>
<option value="Pending" <?php if($_REQUEST['raitingstatus']=='Pending'){?>selected<?php } ?> >Pending</option>
<option value="Skipped" <?php if($_REQUEST['raitingstatus']=='Skipped'){?>selected<?php } ?> >Skipped</option>
<option value="Rated" <?php if($_REQUEST['raitingstatus']=='Rated'){?>selected<?php } ?> >Rated</option>
</select></td>
<td width="8%" align="right" ><strong>Overall Rating:</strong></td>
<td width="14%"><select name="overallrating" style="width:150px;">
<option value="" <?php if($_REQUEST['overallrating']==''){?>selected<?php } ?>>-Select-</option>
<option value="0" <?php if($_REQUEST['overallrating']=='0'){?>selected<?php } ?> >0</option>
<option value="1" <?php if($_REQUEST['overallrating']==1){?>selected<?php } ?> >1</option>
<option value="2" <?php if($_REQUEST['overallrating']==2){?>selected<?php } ?> >2</option>
<option value="3" <?php if($_REQUEST['overallrating']==3){?>selected<?php } ?> >3</option>
<option value="4" <?php if($_REQUEST['overallrating']==4){?>selected<?php } ?> >4</option>
<option value="5" <?php if($_REQUEST['overallrating']==5){?>selected<?php } ?> >5</option>
</select></td>
</tr>
<tr>
<td width="8%" align="right" ><strong>State:</strong></td>
<td width="14%"><select name="state" style="width:150px;">
<option value="">-Select-</option>
<?php $stateArr=$obj->query("SELECT DISTINCT stateCode,state FROM `tbl_us_zipcodes` WHERE stateCode IS not null and state is not null");
while($resultState=$obj->fetchNextObject($stateArr)){?>
<option value="<?php echo stripslashes($resultState->stateCode); ?>" <?php if($_REQUEST['state']==$resultState->stateCode){?>selected<?php } ?> ><?php echo stripslashes($resultState->state);?>(<?php echo stripslashes($resultState->stateCode);?>)</option>
<?php } ?>
</select></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr><td height="10"></td></tr>
<!----- Search End --------->
<tr>
<td align="left" valign="middle" class="headingbg bodr text14">
<em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: View Overall Order Rating Report
<span style="float:right;">
<form name="exportfrm" action="export-overall-rating.php" onsubmit="return validateForm()">
<input type="hidden" name="exportExcel" value="yes" />
<input type="hidden" name="search_order_id" value="<?php echo $_REQUEST['search_order_id'];?>" />
<input type="hidden" name="search_email" value="<?php echo $_REQUEST['search_email'];?>" />
<input type="hidden" name="search_payment_method" value="<?php echo $_REQUEST['search_payment_method'];?>" />
<input type="hidden" name="search_user_id" value="<?php echo $_REQUEST['search_user_id'];?>" />
<input type="hidden" name="order_status" value="<?php echo $_REQUEST['order_status'];?>" />
<input type="hidden" name="order_via" value="<?php echo $_REQUEST['order_via'];?>" />
<input type="hidden" name="search_from_date" value="<?php echo $_REQUEST['search_from_date'];?>" />
<input type="hidden" name="search_to_date" value="<?php echo $_REQUEST['search_to_date'];?>" />
<input type="hidden" name="storename" value="<?php echo $_REQUEST['storename'];?>" />
<input type="hidden" name="raitingstatus" value="<?php echo $_REQUEST['raitingstatus'];?>" />
<input type="hidden" name="overallrating" value="<?php echo $_REQUEST['overallrating'];?>" />
<input type="hidden" name="state" value="<?php echo $_REQUEST['state'];?>" />
<input type="submit" name="export" class="button" value="Export To Excel" />
</form>
</span>
</td>
</tr>
<form name="frm" method="post" action="order-del.php" enctype="multipart/form-data">
<tr>
<td height="100" align="left" valign="top" bgcolor="#FFFFFF" class="bodr">
<table width="100%" cellpadding="0" cellspacing="0">
<?php if($_SESSION['sess_msg']){ ?>
<tr><td align="center"><font color="#FF0000"><strong><?php echo $_SESSION['sess_msg'];$_SESSION['sess_msg']='';?></strong></font></td></tr>
<?php }?>
<tr>
<td align="left">
<?php
$where='';
if($_REQUEST['search_order_id']!=''){
$name=$_REQUEST['search_order_id'];
$where.=" and id='".$name."'";
}
if($_REQUEST['search_user_id']!=''){
$name=$_REQUEST['search_user_id'];
$where.=" and user_id='".$name."'";
}
if($_REQUEST['search_email']!=''){
$name=$_REQUEST['search_email'] ;
$where.=" and ship_email like '%$name%' ";
}
if($_REQUEST['search_payment_method']){
$name=$_REQUEST['search_payment_method'] ;
$where.=" and payment_method like '%$name%' ";
}
if($_REQUEST['order_status']!=''){
$name=$_REQUEST['order_status'] ;
$where.=" and order_status='".$name."'";
}
if($_REQUEST['search_from_date']!='' && $_REQUEST['search_to_date']!=''){
if($_REQUEST['search_from_date']==$_REQUEST['search_to_date']){
$where.=" and order_date>='".$_REQUEST['search_from_date']."'";
} else {
$where.=" and order_date>='".$_REQUEST['search_from_date']."' and order_date<='".$_REQUEST['search_to_date']."' ";
}
}
if($_REQUEST['payment_status']!=''){
$name=$_REQUEST['payment_status'];
$where.=" and payment_status='".$name."'";
}
if($_REQUEST['storename']){
$name=$_REQUEST['storename'] ;
$where.=" and storeid='".$name."'";
}
if($_REQUEST['raitingstatus']){
$name=$_REQUEST['raitingstatus'] ;
$where.=" and rating_status like '%$name%' ";
} else {
$name="Rated";
$where.=" and rating_status like '%$name%' ";
}
if($_REQUEST['overallrating'] || $_REQUEST['overallrating']=='0'){
$name=$_REQUEST['overallrating'];
$where.=" and overall_rating='".$name."'";
}
if($_REQUEST['state']!=''){
$name=$_REQUEST['state'] ;
$where.=" and d.stateCode like '%$name%' ";
}
$start=0;
if(isset($_GET['start'])) $start=$_GET['start'];
$pagesize=50;
if(isset($_GET['pagesize'])) $pagesize=$_GET['pagesize'];
$order_by='id';
if(isset($_GET['order_by'])) $order_by=$_GET['order_by'];
$order_by2='desc';
if(isset($_GET['order_by2'])) $order_by2=$_GET['order_by2'];
$sql=$obj->Query("select c.*,d.stateCode,d.state from $tbl_order as c left join tbl_us_zipcodes as d on d.zipCode=c.ship_pincode where 1=1 $where order by $order_by $order_by2 limit $start, $pagesize");
$sql2=$obj->query("select c.* ,d.stateCode,d.state from $tbl_order as c left join tbl_us_zipcodes as d on d.zipCode=c.ship_pincode where 1=1 $where order by $order_by $order_by2",$debug=-1);
$reccnt=$obj->numRows($sql2);
if($reccnt==0)
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><font face="Arial, Helvetica, sans-serif" color="#FF0000" size="+1">No Record</font></td>
</tr>
</table>
<?php
}
else
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><strong><?php echo $reccnt; ?> Records Found.</strong></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>S No.</strong></td>
<td width="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Date</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order ID</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Store ID</strong></td>
<td width="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>User Id / Email</strong></td>
<td width="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>State</strong></td>
<td width="13%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Rating status</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Overall Rating</strong></td>
<td width="8%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Overall review</strong></td>
<td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Status</strong></td> <td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Payment Status</strong></td>
<!--<td width="11%" align="center" bgcolor="#f3f4f6" class="padd5" > <input name="check_all" type="checkbox" id="check_all" onclick="checkall(this.form)" value="check_all" /></td> -->
</tr>
<?php
$i=0;
while($line=$obj->fetchNextObject($sql))
{
$i++;
$m=0;
if($line->overall_rating <4 ){
if($line->overall_rating!=''){
$m=1;
} else {
}
}
if($i%2==0)
{
if($m==1){
$bgcolor = "#f5d8d8";
} else {
$bgcolor = "#f3f4f6";
}
}
else
{
if($m==1){
$bgcolor = "#f5d8d8";
} else {
$bgcolor = "";
}
}
?>
<tr bgcolor="<?php echo $bgcolor;?>">
<td class="padd5"><strong><?php echo $i+$start; ?>.</strong></td>
<td class="padd5">
<?php
echo date('d M Y H:i',strtotime($line->order_date));
?>
</td>
<td class="padd5">
<?php
echo stripslashes($line->id);
?>
</td>
<td class="padd5">
<?php
echo stripslashes($line->storeid);
?>
</td>
<td class="padd5">
<?php
echo stripslashes($line->user_id)." <br/>".stripslashes($line->ship_email)." ";
?>
</td>
<td class="padd5"><?php echo stripslashes($line->state); if($line->stateCode){?> (<?php echo stripslashes($line->stateCode);?>)<?php } ?>
</td>
<td class="padd5">
<?php
echo stripslashes($line->rating_status);
?>
</td>
<td class="padd5"><?php echo stripslashes($line->overall_rating);?></</td>
<td class="padd5">
<?php echo stripslashes($line->overall_review);?>
</td>
<td class="padd5">
<?php
echo getField('order_status',$tbl_order_status,$line->order_status);
?>
</td>
<td align="center" class="padd5">
<?php
if($line->payment_status==1){ ?>
<img src="images/green.gif" title="Successfull" />
<?php } else{?>
<img src="images/red.gif" title="Unsuccessfull" />
<?php }?>
</td>
<!--<td align="center" valign="middle" class="padd5">
<input type="checkbox" name="ids[]" value="<?php echo $line->id;?>" />
</td> -->
</tr>
<?php
}
?>
<tr>
<td valign="top" colspan="14" align="right">
</td> </tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"> </td>
</tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"><?php include("../include/paging.inc.php"); ?>
</td> </tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"> </td>
</tr>
<tr><td align="right" style="padding-right:80px;" colspan="14"> <input type="hidden" name="what" value="what" />
<!-- <input type="submit" name="Submit" value="Delete" class="button" onclick="return del_prompt(this.form,this.value)" /> --></td></tr>
</table><?php }?>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr><td height="100"></td></tr>
<?php include('footer.php'); ?>
<script>
function validateForm() {
var sx = document.forms["searchForm"]["search_to_date"].value;
var sy = document.forms["searchForm"]["search_from_date"].value;
document.forms["exportfrm"]["search_from_date"].value=sy;
document.forms["exportfrm"]["search_to_date"].value=sx;
var monthDiff = function(d1, d2) {
if( d2 < d1 ) {
var dTmp = d2;
d2 = d1;
d1 = dTmp;
}
var months = (d2.getFullYear() - d1.getFullYear()) * 12;
months -= d1.getMonth() + 1;
months += d2.getMonth();
if( d1.getDate() <= d2.getDate() ) months += 1;
return months;
}
var mf=monthDiff(new Date(sy), new Date(sx));
if (sy == "") {
alert("From Date Must be filled out");
return false;
}
if (sx == "") {
alert("To Date Must be filled out");
return false;
}
if(mf>3){
alert("Please select date range not more than 3 months");
return false;
}
}
</script>
</table>
</body>
</html>
Directory Contents
Dirs: 10 × Files: 414