Preview: order-list-old.php
Size: 37.56 KB
/home/godevadmin/www/admin/order-list-old.php
<?php
session_start();
include("../include/config.php");
include("../include/functions.php");
validate_admin();
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))){
header('Location: order-list-responsive.php');
exit;
}
?>
<!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>
<script type="text/javascript">
if (screen.width <= 768) {
document.location = "<?php echo SITE_URL;?>admin/order-list-responsive.php";
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<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)
{
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>
<style>
.order-cta {
border: 1px solid;
background: #eaeaea;
padding: 4px 4px;
color: #000;
cursor: pointer;
margin-top: 10PX;
display: block;
text-align: center;
}
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php
include("header.php");
$userlocationWhere='';
$user_type = getFieldWhere('user_type', 'tbl_admin', 'id', $_SESSION['sess_admin_id']);
$user_location=getFieldWhere('location', 'tbl_admin', 'id', $_SESSION['sess_admin_id']);
$user_location=implode("','",explode(",",$user_location));
//echo "select group_concat(distinct zip) as zip from tbl_store_zip where state in ('$user_location') and zip!=''";
$userziparr=array();
$userzip=$obj->query("select distinct(zip) as zip from tbl_store_zip where state in ('$user_location') and zip!=''");
while($resuserZip=$obj->fetchNextObject($userzip)){
array_push($userziparr,$resuserZip->zip);
}
$userLocationZip=implode(',',$userziparr);
if($user_location!=''){
$userlocationWhere='and tbl_order.ship_pincode in('.$userLocationZip.')';
}
?>
<link rel="stylesheet" href="../css/colorbox.css" />
<script src="../js/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="order-list.php">
<table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td width="10%" align="right" ><strong>Order ID:</strong></td>
<td width="15%"><input type="text" name="search_order_id" value="<?php echo $_REQUEST['search_order_id']; ?>"/></td>
<td width="10%" align="right" ><strong>Email:</strong></td>
<td width="15%"><input type="text" name="search_email" value="<?php echo $_REQUEST['search_email']; ?>"/></td>
<td width="10%" align="right" ><strong>Customer Type:</strong></td>
<td width="15%"><select name="search_customer_type" style="width:150px;" >
<option value="">All</option>
<option value="New" <?php if ($_REQUEST['search_customer_type'] == 'New') { ?>selected<?php } ?>>New</option>
<option value="Existing" <?php if ($_REQUEST['search_customer_type'] == 'Existing') { ?>selected<?php } ?>>Existing</option> </select></td>
<td width="10%" align="right" ><strong>Store Name:</strong></td>
<td width="15%"><select name="search_storename" style="width:150px;" >
<option value="">All</option>
<?php
$storenum = $obj->query("select storeid,storename from stores order by storename");
while ($storenumrec = $obj->fetchNextObject($storenum)) {
?>
<option value="<?php echo $storenumrec->storeid; ?>" <?php if ($storenumrec->storeid == $_REQUEST['search_storename']) { ?>selected<?php } ?>><?php echo ucwords($storenumrec->storename); ?></option>
<?php } ?> </select></td>
</tr>
<tr>
<td width="10%" align="right" ><strong>Order Status:</strong></td>
<td width="15%"><select name="search_orderstatus" style="width:150px;" >
<option value="" selected="selected">All</option>
<?php
$sorderstatus = $obj->query("select * from tbl_order_status where status=1 order by id");
while ($resultorderstatus = $obj->fetchNextObject($sorderstatus)) {
?>
<option value="<?php echo $resultorderstatus->id; ?>" <?php if ($resultorderstatus->id == $_REQUEST['search_orderstatus']) { ?>selected<?php } ?>><?php echo ucwords($resultorderstatus->order_status); ?></option>
<?php } ?> </select></td>
<td width="10%" align="right" ><strong>Order Type:</strong></td>
<td width="15%"><select name="search_ordertype" style="width:150px;" >
<option value="">All</option>
<option value="Local" <?php if ($_REQUEST['search_ordertype'] == 'Local') { ?>selected<?php } ?>>Local</option>
<option value="Suburb" <?php if ($_REQUEST['search_ordertype'] == 'Suburb') { ?>selected<?php } ?>>Suburb</option>
<option value="UPS" <?php if ($_REQUEST['search_ordertype'] == 'UPS') { ?>selected<?php } ?>>UPS</option>
<option value="Wholesale" <?php if ($_REQUEST['search_ordertype'] == 'Wholesale') { ?>selected<?php } ?>>Wholesale</option>
</select></td>
<td width="10%" align="right" ><strong>Payment Status:</strong></td>
<td width="15%"><select name="search_paymentstatus" style="width:150px;" >
<option value="">All</option>
<option value="1" <?php if ($_REQUEST['search_paymentstatus'] == '1') { ?>selected<?php } ?>>Successful</option>
<option value="0" <?php if ($_REQUEST['search_paymentstatus'] == '0') { ?>selected<?php } ?>>Unsuccessful</option> </select></td>
<td width="10%" align="right" ><strong>Ordered Device:</strong></td>
<td width="15%"><select name="search_device" style="width:150px;" >
<option value="">All</option>
<option value="Mobile" <?php if ($_REQUEST['search_device'] == 'Mobile') { ?>selected<?php } ?>>Mobile</option>
<option value="Tablet" <?php if ($_REQUEST['search_device'] == 'Tablet') { ?>selected<?php } ?>>Tablet</option>
<option value="Desktop" <?php if ($_REQUEST['search_device'] == 'Desktop') { ?>selected<?php } ?>>Desktop</option> </select></td>
</tr>
<tr>
<td width="10%" align="right" ><strong>User ID:</strong></td>
<td width="15%"><input type="text" name="search_user_id" value="<?php echo $_REQUEST['search_user_id']; ?>"/></td>
<td width="10%" 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="10%" align="right" ><strong>To Date:</strong></td>
<td width="15%"><input type="text" name="search_to_date" id="search_to_date" value="<?php echo $_REQUEST['search_to_date']; ?>"/></td>
<td width="7%" align="right"><input type="submit" name="search" value="Search" style="background:#0099CC; border:5px solid #0099CC; color:#fff" /></td>
<td width="12%" align="center" ><a href="order-list.php" style="background:#009966; border:6px solid #009966; color:#fff">View All</a></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<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;">Order Status<span style="float:right; padding-right:10px;"></span></td>
</tr>
<tr>
<td height="10"></td>
</tr>-->
<tr>
<?php
$where = '';
if ($_REQUEST['search_order_id'] != '') {
$name = $_REQUEST['search_order_id'];
$where .= " and tbl_order.id='" . $name . "'";
}
if ($_REQUEST['search_ordertype'] != '') {
$name = $_REQUEST['search_ordertype'];
if ($name == 'Local') {
$where .= " and (tbl_order.order_type='" . $name . "' || tbl_order.order_type='') and tbl_order.usps_expected_delivery=''";
} elseif ($name == 'UPS') {
$where .= " and (tbl_order.order_type='" . $name . "' || tbl_order.order_type='') and tbl_order.usps_expected_delivery!=''";
} else {
$where .= " and tbl_order.order_type='" . $name . "'";
}
}
if ($_REQUEST['search_user_id'] != '') {
$name = $_REQUEST['search_user_id'];
$where .= " and tbl_order.user_id='" . $name . "'";
}
if ($_REQUEST['search_email'] != '') {
$name = $_REQUEST['search_email'];
$where .= " and ship_email like '%$name%' ";
}
if ($_REQUEST['search_orderstatus'] != '') {
$name = $_REQUEST['search_orderstatus'];
$where .= " and tbl_order.order_status='" . $name . "'";
}
if ($_REQUEST['search_paymentstatus'] != '') {
$name = $_REQUEST['search_paymentstatus'];
$where .= " and tbl_order.payment_status='" . $name . "'";
}
if ($_REQUEST['search_storename'] != '') {
$name = $_REQUEST['search_storename'];
$where .= " and tbl_order_itmes.storeid like '%$name%'";
}
if ($_REQUEST['search_device'] != '') {
$name = $_REQUEST['search_device'];
$where .= " and tbl_order.order_via='" . $name . "'";
}
if ($_REQUEST['search_from_date'] != '' && $_REQUEST['search_to_date'] != '') {
$where .= " and tbl_order.order_date>='" . $_REQUEST['search_from_date'] . "' and tbl_order.order_date<='" . $_REQUEST['search_to_date'] . "' ";
}
$start = 0;
if (isset($_GET['start']))
$start = $_GET['start'];
$pagesize = 20;
if (isset($_GET['pagesize']))
$pagesize = $_GET['pagesize'];
//echo "select tbl_order_itmes.storeid,tbl_order_itmes.section,tbl_order.id,tbl_order.ship_email,tbl_order.user_id,tbl_order.order_via,tbl_order.tax_value,tbl_order.delivery_type,tbl_order.order_type,tbl_order.total_amount,tbl_order.ship_type,tbl_order.order_date,tbl_order.usps_expected_delivery,tbl_order.tracking_no,tbl_order.payment_method,tbl_order.order_status,tbl_order.payment_status,tbl_order.delivery_note,ship_fname,ship_lname,ship_house_no,ship_street,ship_complex,ship_landmark,ship_pincode,ship_area,ship_state,ship_city_id,ship_mobile,tbl_order.deliverby,tbl_order.is_send_to_vendor,tbl_order.vendor_sync_comments from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 and tbl_order.ship_pincode in($userLocationZip) group by tbl_order.id, tbl_order.ship_pincode order by tbl_order.id desc limit $start,$pagesize"; exit;
$sql = $obj->Query("select tbl_order_itmes.storeid,tbl_order_itmes.section,tbl_order.id,tbl_order.ship_email,tbl_order.user_id,tbl_order.order_via,tbl_order.tax_value,tbl_order.delivery_type,tbl_order.order_type,tbl_order.total_amount,tbl_order.ship_type,tbl_order.order_date,tbl_order.usps_expected_delivery,tbl_order.tracking_no,tbl_order.payment_method,tbl_order.order_status,tbl_order.payment_status,tbl_order.delivery_note,tbl_order.sub_id,ship_fname,ship_lname,ship_house_no,ship_street,ship_complex,ship_landmark,ship_pincode,ship_area,ship_state,ship_city_id,ship_mobile,tbl_order.deliverby,tbl_order.is_send_to_vendor,tbl_order.vendor_sync_comments from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 $userlocationWhere $where group by tbl_order.id order by tbl_order.id desc limit $start,$pagesize");
$sql2 = $obj->query("select tbl_order_itmes.storeid,tbl_order.id,tbl_order.ship_email,tbl_order.user_id,tbl_order.order_via,tbl_order.tax_value,tbl_order.delivery_type,tbl_order.delivery_day,tbl_order.total_amount,tbl_order.ship_type,tbl_order.order_date,tbl_order.order_status,tbl_order.payment_status,tbl_order.delivery_note from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 $userlocationWhere $where group by tbl_order.id", $debug = -1);
// exit;
$reccnt = $obj->numRows($sql2);
?>
<td><?php if ($user_type == 'admin') { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td width="17%" class="text14" >Today : <strong>Total Order : <?php echo $numrows1 = $obj->numRows($obj->query("select tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_date like '%" . date('Y-m-d') . "%' $where group by tbl_order.id", $debug = -1)); ?> </strong></td>
<td width="14%" class="text14"><strong>Delivered : <?php echo $numrows11 = $obj->numRows($obj->query("select tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=3 and tbl_order.order_date like '%" . date('Y-m-d') . "%' $where group by tbl_order.id")); ?></strong></td>
<td width="11%" class="text14"><strong>Declined : <?php echo $numrows12 = $obj->numRows($obj->query("select tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=5 and tbl_order.order_date like '%" . date('Y-m-d') . "%' $where group by tbl_order.id")); ?></strong></td>
<td width="23%" class="text14"><strong>Pending : <?php echo $numrows1 - $numrows11 - $numrows12; ?></strong></td>
</tr>
<tr><td> </td></tr>
<tr align="center" style="font-weight:bold;">
<td width="17%" ><strong>Orders : Total Order : <?php echo $numrows1 = $obj->numRows($obj->query("select tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 $where group by tbl_order.id", $debug = -1)); ?> </strong></td>
<td width="14%"><strong>Delivered : <?php echo $numrows11 = $obj->numRows($obj->query("select tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=3 $where group by tbl_order.id")); ?></strong></td>
<td width="11%"><strong>Declined : <?php echo $numrows12 = $obj->numRows($obj->query("select tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=5 $where group by tbl_order.id")); ?></strong></td>
<td width="23%"><strong>Pending : <?php echo $numrows1 - $numrows11 - $numrowsl2; ?></strong></td>
</tr>
<tr><td> </td></tr>
<tr align="center">
<td width="17%" class="text15" > <strong>All</strong> : <strong>Total Amount : <?php
$ordertot = $obj->query("SELECT tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date,tbl_order.total_amount FROM tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=3 $where group by tbl_order.id");
$cstot = 0;
while ($rstot = $obj->fetchNextObject($ordertot)) {
$cstot = $cstot + $rstot->total_amount;
}
echo $website_currency_symbol . number_format($cstot, 2);
?> </strong></td>
<td width="12%" class="text15"><strong>Average Order Value : <?php echo $website_currency_symbol . number_format($cstot / $numrows11, 2); ?></strong></td>
<td width="9%" class="text15"><strong>Total Tax : <?php
$ordertax = $obj->query("SELECT tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date,tbl_order.tax_value FROM tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=3 $where group by tbl_order.id");
$cstax = 0;
while ($rstax = $obj->fetchNextObject($ordertax)) {
$cstax = $cstax + $rstax->tax_value;
}
echo $website_currency_symbol . number_format($cstax, 2);
?></strong></td>
<td width="14%" class="text15"><strong>Total Tip : <?php
$ordertip = $obj->query("SELECT tbl_order.id,tbl_order_itmes.storeid,tbl_order.order_date,tbl_order.drivertip FROM tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where tbl_order.order_status=3 $where group by tbl_order.id");
$cstip = 0;
while ($rstip = $obj->fetchNextObject($ordertip)) {
$cstip = $cstip + $rstip->drivertip;
}
echo $website_currency_symbol . number_format($cstip, 2);
?></strong></td>
</tr>
</table><?php } ?></td>
</tr>
</table></td>
</tr>
<tr><td height="10"></td></tr>
<!----- Search End --------->
<tr>
<td align="left" valign="middle" class="headingbg bodr text14">
<script>
$(document).ready(function () {
$(".iframerefund").colorbox({iframe: true, width: "800px;", height: "600px;", frameborder: "0", scrolling: true});
});
</script>
<em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: View Orders
<a href="addrefund.php" class="iframerefund"><button name="refund" class="button" style="float:right; margin-right:30px; background:#FF6600; border:5px solid #FF6600; color:#fff; padding:3px 10px 3px 10px">Refund</button></a>
</td>
</tr>
<form name="frm" method="post" id="order-form" 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
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 {
if ($_REQUEST['search_customer_type'] != '') {
$sql3 = $obj->Query("select tbl_order_itmes.storeid,tbl_order.id,tbl_order.ship_email,tbl_order.user_id,tbl_order.order_via,tbl_order.tax_value,tbl_order.delivery_type,tbl_order.delivery_day,tbl_order.total_amount,tbl_order.ship_type,tbl_order.order_date,tbl_order.payment_method,tbl_order.order_status,tbl_order.payment_status,tbl_order.delivery_note from $tbl_order inner join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 $where group by tbl_order.id order by tbl_order.id desc");
$x = 0;
while ($line3 = $obj->fetchNextObject($sql3)) {
$cuArr = $obj->query("select count(*) as ucs from $tbl_order where user_id='$line3->user_id' and id<='$line3->id'");
$urs = $obj->fetchNextObject($cuArr);
if ($urs->ucs > 1) {
$usercount = "Existing";
} else {
$usercount = "New";
}
if ($_REQUEST['search_customer_type'] == $usercount) {
$x++;
}
} $reccnt = $x;
}
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="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Date</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Time</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order ID</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>User Id / Email</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Total Amount</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order via</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Customer type (no. of Orders)</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Last Order</strong></td>
<td width="4%" 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="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Type</strong></td>
<td align="left" bgcolor="#f3f4f6" class="padd5"><strong>Customer Details</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Details</strong></td>
<td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Print</strong></td>
<td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Stores</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Section/Delivery Partner</strong></td>
<td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Courier Items</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Driver/Partner</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Send to partner</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Partner Sync Response</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Comments</strong></td>
<td width="19%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Special Message</strong></td>
<td width="13%" 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)) {
$prosub='';
if($line->sub_id){
$subArr=explode(",",$line->sub_id);
if(count($subArr)>0){
foreach($subArr as $value){
$sqlsubs=$obj->query("SELECT b.product_id,b.subscription_type FROM user_subscription as a left join user_subscription_order_details as b on a.sub_id=b.subs_id WHERE a.userid='" . $line->user_id . "' and a.sub_id=$value");
$Subresult = $obj->fetchNextObject($sqlsubs);
$prosub.=$Subresult->subscription_type.',';
}
$prosub=trim($prosub,',');
}
}
if ($_REQUEST['search_customer_type'] != '') {
$cuArr = $obj->query("select count(*) as ucs from $tbl_order where user_id='$line->user_id' and id<='$line->id'");
$urs = $obj->fetchNextObject($cuArr);
if ($urs->ucs > 1) {
$usercount = "Existing";
} else {
$usercount = "New";
}
}
if ($_REQUEST['search_customer_type'] == $usercount) {
$i++;
if ($line->delivery_day != '') {
$bgcolor = "#66CCFF";
} else {
if ($i % 2 == 0) {
$bgcolor = "#f3f4f6";
} 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 CalculateOrderTime($line->order_date);
?>
</td>
<td class="padd5">
<?php
echo stripslashes($line->id);
?>
<?php if($prosub){
echo '<br>Subscription:'.$prosub;
}?>
</td>
<td class="padd5">
<?php
echo stripslashes($line->user_id) . " <br/>" . stripslashes($line->ship_email) . " ";
?>
</td>
<td class="padd5">
<?php
echo $website_currency_symbol . " " . number_format($line->total_amount, 2);
?>
</td>
<td class="padd5">
<?php echo stripslashes($line->order_via); ?>
</td>
<td class="padd5">
<?php
$cArr = $obj->query("select count(*) as cs from $tbl_order where user_id='$line->user_id' and id<='$line->id'");
$rs = $obj->fetchNextObject($cArr);
if ($rs->cs > 1) {
echo "Existing <strong style='color:#000'>($rs->cs)</strong>";
} else {
echo "New";
}
?>
</td>
<td class="padd5">
<?php
$custdetail = $obj->query("select user_id,order_date from $tbl_order where user_id='$line->user_id' and id<='$line->id' order by order_date desc limit 2");
if ($rs->cs > 1) {
$data = '';
while ($reccust = $obj->fetchNextObject($custdetail)) {
$data = $reccust->order_date . ',' . $data;
}
$data = explode(",", $data);
echo OrderTimedifference($data[0], $data[1]) . " <strong style='color:#000'>(" . $data[0] . ")</strong>";
} else {
echo $line->order_date;
}
?>
</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 class="padd5">
<script>
$(document).ready(function () {
$(".iframeadres<?php echo $line->id; ?>").colorbox({iframe: true, width: "700px;", height: "500px;", frameborder: "0", scrolling: true});
});
</script>
<?php
if ($line->usps_expected_delivery == '' && $line->order_type !== 'Suburb' && $line->order_type !== 'Wholesale') {
echo "Local";
} elseif ($line->order_type == 'UPS' || $line->usps_expected_delivery !== '') {
echo "UPS";
?><br><a href="editorderdetail.php?order_id=<?php echo $line->id; ?>" class="iframeadres<?php echo $line->id; ?>" style="color:#0066CC; font-weight:bold">Edit Detail</a><?php
} else {
echo $line->order_type;
}
?>
</td>
<td class="padd5"><?php echo ucwords($line->ship_fname . " " . $line->ship_lname); ?><br /><?php echo $line->ship_mobile; ?><br />
<strong>Add:</strong> <?php
if($line->ship_full_address==''){
echo $line->ship_house_no . ", " . $line->ship_street . ", " . $line->ship_complex . ", " . $line->ship_area . " " . $line->ship_city_id . " " . $line->ship_state . ", " . $line->ship_pincode;
} else {
echo $line->ship_full_address. ", ".$line->ship_complex .", " . $line->ship_pincode;
}?></td>
<script>
$(document).ready(function () {
$(".iframeOrder<?php echo $line->id; ?>").colorbox({iframe: true, width: "900px;", height: "700px;", frameborder: "0", scrolling: true});
$(".iframeAddc<?php echo $line->id; ?>").colorbox({iframe: true, width: "800px;", height: "600px;", frameborder: "0", scrolling: true});
$(".iframeViewc<?php echo $line->id; ?>").colorbox({iframe: true, width: "800px;", height: "600px;", frameborder: "0", scrolling: true});
});
</script>
<td class="padd5">
<a href="vieworder-detail.php?order_id=<?php echo $line->id; ?>" class="iframeOrder<?php echo $line->id; ?>" >View Detail</a>
<?php
$itemSql = $obj->Query("select i.courier, i.ups_tracking_no as tracking_no from tbl_order_itmes i where i.order_id ='".$line->id."' and i.courier !='' ");
$x = 0;
$tracking_nos = array();
while ($orderItems = $obj->fetchNextObject($itemSql)) {
if($orderItems->tracking_no !='' && strtolower($orderItems->courier)=='ups'){
$tracking_nos[$orderItems->tracking_no] =$orderItems->courier.' Tracking :<a href="https://www.ups.com/track?loc=en_US&tracknum='.$orderItems->tracking_no.'" target="_blank">'.$orderItems->tracking_no.'</a><br />';
} else if($orderItems->tracking_no !='' && strtolower($orderItems->courier)=='dhl'){
$tracking_nos[$orderItems->tracking_no] =$orderItems->courier.' Tracking :<a href="https://www.dhl.com/en/express/tracking.html?AWB='.$orderItems->tracking_no.'&brand=DHL" target="_blank">'.$orderItems->tracking_no.'</a><br />';
} else if($orderItems->tracking_no !='' && strtolower($orderItems->courier)=='fedex'){
$tracking_nos[$orderItems->tracking_no] =$orderItems->courier.' Tracking :<a href="https://www.fedex.com/fedextrack/?tracknumbers='.$orderItems->tracking_no.'&cntry_code=us" target="_blank">'.$orderItems->tracking_no.'</a><br />';
}
$i++;
}
if(count($tracking_nos)>0){
echo "<hr />";
foreach ($tracking_nos as $tracking_no){
echo "<br/>".$tracking_no;
}
}
?>
</td>
<td class="padd5">
<input type="button" name="print" value="Print Invoice" onclick="window.open('printInvoice.php?order_id=<?php echo $line->id; ?>')" />
<br>
<a class="order-cta" href="shopper-order-view-detail.php?order_id=<?php echo stripslashes($line->id);?>">
Make Order
</a>
</td>
<td class="padd5">
<?php
$sqlstore = $obj->query("select storeid from tbl_order_itmes where order_id='$line->id; ?>'");
$strarr = '';
while ($storeres = $obj->fetchNextObject($sqlstore)) {
$strarr[] = $storeres->storeid;
}
$storearray = array_values(array_unique($strarr));
$storecount = count($storearray);
for ($x = 0; $x < $storecount; $x++) {
echo getFieldWhere('storename', 'stores', 'storeid', $storearray[$x]) . ", ";
}
$storeList = implode(',', $storearray);
?>
</td>
<td align="center" class="padd5">
<?php
$section_qry = "
SELECT tbl_order_itmes.section , GROUP_CONCAT( DISTINCT tbl_order_itmes.storeid) storeids FROM tbl_order_itmes
WHERE tbl_order_itmes.order_id = '" . $line->id . "' group by tbl_order_itmes.section
";
$sectiondetail = $obj->query($section_qry);
while ($sectionDetailRslt = $obj->fetchNextObject($sectiondetail)) {
$section = $sectionDetailRslt->section;
$storeids = $sectionDetailRslt->storeids;
if ($section == 'grocery') {
$grocery_delivery_partner = "SELECT
GROUP_CONCAT(DISTINCT tbl_store_zip.grocery_delivery_partner) grocery
FROM
tbl_store_zip
WHERE
tbl_store_zip.zip = '" . $line->ship_pincode . "'
AND
tbl_store_zip.storeid IN( $storeids)
group by tbl_store_zip.zip";
$grocery_delivery_partnerRslt = $obj->query($grocery_delivery_partner);
$grocery_partner = $obj->fetchNextObject($grocery_delivery_partnerRslt);
echo ucwords($section . " / " . $grocery_partner->grocery) . "<br/>";
} else if ($section != 'grocery') {
$food_delivery_partner = "SELECT
GROUP_CONCAT( DISTINCT tbl_store_zip.food_delivery_partner) food
FROM
tbl_store_zip
WHERE
tbl_store_zip.zip = '" . $line->ship_pincode . "'
AND
tbl_store_zip.storeid IN( $storeids)
group by tbl_store_zip.zip";
$food_delivery_partnerRslt = $obj->query($food_delivery_partner);
$food_partner = $obj->fetchNextObject($food_delivery_partnerRslt);
echo ucwords($section . " / " . $food_partner->food) . "<br/>";
}
}
?>
</td>
<td class="padd5">
<?php
if ($line->order_type == 'UPS' || $line->usps_expected_delivery !== '') {
for ($x = 0; $x < $storecount; $x++) {
?>
<a href="view-items.php?order_id=<?php echo $line->id; ?>&id=<?php echo $storearray[$x]; ?>" class="iframeItems<?php echo $line->id; ?>" >Label (<?php echo ucwords(getFieldWhere('storename', 'stores', 'storeid', $storearray[$x])); ?>)<br /></a>
<?php
}
}
?></td>
<td class="padd5">
<?php
$section_qry = "
SELECT tbl_order_itmes.courier,tbl_order_itmes.ups_tracking_no FROM tbl_order_itmes
WHERE tbl_order_itmes.storeid=184 AND tbl_order_itmes.order_id = '" . $line->id . "' ";
$sectiondetail = $obj->query($section_qry);
while ($sectionDetailRslt = $obj->fetchNextObject($sectiondetail)) {
echo $sectionDetailRslt->courier.' / '.$sectionDetailRslt->ups_tracking_no;
}
?>
<?php
echo $line->deliverby;
?>
</td>
<td class="padd5"> <?php
echo $line->is_send_to_vendor;
?>
</td>
<td class="padd5"> <?php
echo $line->vendor_sync_comments;
?>
</td>
<td class="padd5"> <a href="addcommets.php?order_id=<?php echo $line->id; ?>" class="iframeAddc<?php echo $line->id; ?>"><img src="images/add.png" border="0" title="Add Comment" width="20" height="20" /></a>
<a href="viewcommets.php?order_id=<?php echo $line->id; ?>" class="iframeViewc<?php echo $line->id; ?>"><img src="images/comments.png" border="0" title="View Comment" width="20" height="20" /></a>
<a href="adddriver.php?order_id=<?php echo $line->id; ?>" class="iframeAddc<?php echo $line->id; ?>"><img src="images/delivery.png" border="0" title="Add Delivery" width="20" height="20" /></a></td>
<td class="padd5">
<?php
echo $line->delivery_note;
?>
</td>
<td align="center" valign="middle" class="padd5">
<input type="checkbox" class="order-checkbox" name="ids[]" value="<?php echo $line->id; ?>" />
</td>
</tr>
<?php
}
}
?>
<tr>
<td valign="top" colspan="14" align="right">
</td> <td colspan="6"></td> </tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"> </td>
<td colspan="6"></td>
</tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"><?php include("../include/paging.inc.php"); ?>
</td> <td colspan="6"></td> </tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"> </td>
</tr>
<tr>
<td colspan="16"></td>
<td align="right" style="padding-right:80px;" colspan="2"> <a href="javascript:;" onclick="addBulkComments();" class="iframeAddc<?php echo $line->id; ?>"><img src="images/add.png" border="0" title="Add Comment" width="20" height="20" /></a>
</td>
<td align="right" style="padding-right:80px;" colspan="2"> <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 addBulkComments() {
var checkedVals = $('.order-checkbox:checkbox:checked').map(function () {
return this.value;
}).get();
///alert(checkedVals.join(","));
if (checkedVals != '') {
$.colorbox({href: "addcommetsBulk.php?order_id=" + checkedVals, iframe: true, width: "700px;", height: "500px;", frameborder: "0", scrolling: true});
} else {
alert("Please select checkbox for bulk action");
}
}
</script>
</table>
</body>
</html>
Directory Contents
Dirs: 10 × Files: 414