Preview: order-list.php
Size: 34.86 KB
/home/godevadmin/public_html/admin/order-list.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%">
<?php
include("header.php");
$userlocationWhere='';
if($_SESSION['user_type']!= 'admin') {
$user_type='emp';
$user_location=implode("','",explode(",",$rsU->location));
$userziparr=array();
$userzip=$obj->query("select zip from tbl_store_zip where state in ('$user_location') and zip!='' group by 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>Section:</strong></td>
<td width="15%"><select name="section" style="width:150px;" >
<option value="">All</option>
<?php
$section = $obj->query("select id,section_slug,section_name from tbl_section where status=1 order by section_name");
while ($sectionrow = $obj->fetchNextObject($section)) {
?>
<option value="<?php echo $sectionrow->section_slug; ?>" <?php if ($sectionrow->section_slug == $_REQUEST['section']) { ?>selected<?php } ?>><?php echo ucwords($sectionrow->section_name); ?></option>
<?php } ?> </select></td>
<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 id,order_status 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>
<?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='')";
} 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='".$name."'";
}
if ($_REQUEST['search_device'] != '') {
$name = $_REQUEST['search_device'];
$where .= " and tbl_order.order_via='" . $name . "'";
}
if($_REQUEST['section']!='')
{
$name = $_REQUEST['section'];
$where .= " and tbl_order_itmes.section='".$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 = 30;
if (isset($_GET['pagesize']))
$pagesize = $_GET['pagesize'];
$sql = $obj->Query("select tbl_order_itmes.tracking_link,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.order_type,tbl_order.total_amount,tbl_order.order_date,tbl_order.tracking_no,tbl_order_status.order_status,tbl_order.payment_status,tbl_order.ship_full_address,tbl_order.usps_expected_delivery,tbl_order.delivery_note,tbl_order.delivery_day,tbl_order.deliverby,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.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 left join tbl_order_status on tbl_order_status.id=tbl_order.order_status 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.id 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_itmes.order_id");
$reccnt = $obj->numRows($sql2);
?>
</tr>
</table></td>
</tr>
<!----- Search End
export start --------->
<script type="text/javascript">
function filterOn(){
$("#exportform").show();
$("#exportaction").hide();
}</script>
<tr><td><form name="exportfrm" action="export-orders.php" method="post" style="display: none;" id="exportform">
<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_customer_type" value="<?php echo $_REQUEST['search_customer_type'];?>" />
<input type="hidden" name="search_storename" value="<?php echo $_REQUEST['search_storename'];?>" />
<input type="hidden" name="search_orderstatus" value="<?php echo $_REQUEST['search_orderstatus'];?>" />
<input type="hidden" name="search_ordertype" value="<?php echo $_REQUEST['search_ordertype'];?>" />
<input type="hidden" name="search_paymentstatus" value="<?php echo $_REQUEST['search_paymentstatus'];?>" />
<input type="hidden" name="search_device" value="<?php echo $_REQUEST['search_device'];?>" />
<input type="hidden" name="search_user_id" value="<?php echo $_REQUEST['search_user_id'];?>" />
<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'];?>" />
<label><strong style="color:blue; font-size: 16px;">Select All</strong></label> <input type="checkbox" id="check_all" onclick="checkall(this.form)" value="check_all" name="all" checked> Note: These filters will work after search applied.<br><br>
<div align="left">
<span class="search_order"><input type="checkbox" value="1" name="order_search[]" checked><label>Order ID</label></span>
<span class="search_order"><input type="checkbox" value="2" name="order_search[]" checked><label>Order Amount</label></span>
<span class="search_order"><input type="checkbox" value="3" name="order_search[]" checked><label>Order Type</label></span>
<span class="search_order"><input type="checkbox" value="4" name="order_search[]" checked><label>Order Status</label></span>
<span class="search_order"><input type="checkbox" value="5" name="order_search[]" checked><label>Order Date</label></span>
<span class="search_order"><input type="checkbox" value="6" name="order_search[]" checked><label>Order Via</label></span>
<span class="search_order"><input type="checkbox" value="7" name="order_search[]" checked><label>Payment Status</label></span>
<span class="search_order"><input type="checkbox" value="8" name="order_search[]" checked><label>Customer ID</label></span>
<span class="search_order"><input type="checkbox" value="9" name="order_search[]" checked><label>Customer Email</label></span>
<span class="search_order"><input type="checkbox" value="10" name="order_search[]" checked><label>Customer Phone</label></span>
<span class="search_order"><input type="checkbox" value="11" name="order_search[]" checked><label>Customer Name</label></span>
<span class="search_order"><input type="checkbox" value="12" name="order_search[]" checked><label>Customer Street</label></span>
<span class="search_order"><input type="checkbox" value="13" name="order_search[]" checked><label>Customer City</label></span>
<span class="search_order"><input type="checkbox" value="14" name="order_search[]" checked><label>Customer State</label></span>
<span class="search_order"><input type="checkbox" value="15" name="order_search[]" checked><label>Customer Zipcode</label></span>
</div>
<input type="submit" name="exportorder" value="Export Orders" style="margin-right:50px; background:green; border:5px solid green; border-radius: 5px; color:#fff; padding:3px 10px 3px 10px; float:right;" />
</form>
</td></tr>
<!-- export 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
<span style="float:right; margin-right:30px; background:green; border:3.5px solid green; border-radius: 5px; color:#fff; padding:3px 10px 3px 10px; font-weight:normal;" id="exportaction" onclick="filterOn()">Export Order</span>
<a href="addrefund.php" class="iframerefund"><button name="refund" class="button" style="float:right; margin-right:20px; 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 {
?>
<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="2%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>Sl.</strong></td>
<td width="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Date / Order Time</strong></td>
<td width="3%" 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="3%" 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="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 width="7%" 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="4%" 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="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Courier Items</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Driver/ Partner</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Send to partner</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Partner Sync Response</strong></td>
<td width="3%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Comments</strong></td>
<td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Special Message</strong></td>
<td width="2%" 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++;
$cuArr = $obj->query("select count(order_date) as usrorders from tbl_order where user_id='$line->user_id' and id<'$line->id' order by id desc");
$urs = $obj->fetchNextObject($cuArr);
if ($urs->usrorders > 0) {
$usercount = "Existing";
$usrorders=$urs->usrorders+1;
} else {
$usercount = "New";
$usrorders=1;
}
$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 inner 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 ($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));
?> <strong>/</strong> <?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
echo $usercount." <strong style='color:#000'>($usrorders)</strong>";
?>
</td>
<td class="padd5">
<?php
if($line->order_status=="Under Review"){
$color="color:red;";
}else{
$color='';
}
echo "<span style=".$color.">".$line->order_status."</span>";
if($line->tracking_link!=null or $line->tracking_link!='')
{
echo "<br><a target='_blank' href='".$line->tracking_link.'&disableChat=true&primaryColor=28a745'."' style='color:green'>Track Order</a>";
}
?>
</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 (empty($line->usps_expected_delivery) && $line->order_type !== 'Suburb' && $line->order_type !== 'Wholesale') {
echo "Local";
} elseif ($line->order_type == 'UPS') {
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>
<?php
$moment_id = 0;
$moment_address = '';
$qryItems = $obj->query("SELECT tbl_order_itmes.section, tbl_order_itmes.moment_id, 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");
while ($itemResult = $obj->fetchNextObject($qryItems)) {
if($itemResult->section == 'moments' && !empty($itemResult->moment_id)){
$moment_id = $itemResult->moment_id;
}
}
if($moment_id > 0)
{
$qryMoment = $obj->query("SELECT fname, lname, email, phone, full_address, zipcode FROM tbl_moments WHERE id=$moment_id");
$momentData = $obj->fetchNextObject($momentQuery);
$moment_address .= '<br /><strong>Moment Recipient Address:<br />';
$moment_address .= stripslashes($momentData->fname).' '.stripslashes($momentData->lname).'<br />';
$moment_address .= stripslashes($momentData->full_address).'<br />';
$moment_address .= stripslashes($momentData->phone).'<br />';
$moment_address .= stripslashes($momentData->zipcode).'</strong><br />';
}
?>
<td class="padd5"><?php echo ucwords($line->ship_fname . " " . $line->ship_lname); ?><br /><?php echo trim($line->ship_mobile); ?><br />
<strong>Add:</strong> <?php
if($line->ship_full_address==''){
echo trim($line->ship_house_no) . ", " . trim($line->ship_street) . ", " . trim($line->ship_complex) . ", " . trim($line->ship_area) . " " . trim($line->ship_city_id) . " " . trim($line->ship_state) . ", " . trim($line->ship_pincode);
} else {
echo trim($line->ship_full_address). ", ".trim($line->ship_complex) .", " . trim($line->ship_pincode);
}
echo $moment_address;
?></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,storeid from tbl_order_itmes i where i.order_id ='".$line->id."' and i.courier !='' ");
$x = 0;
$tracking_nos = array();
$driverarr=array();
$partnerarr=array();
while ($orderItems = $obj->fetchNextObject($itemSql)) {
if($orderItems->storeid==184){
array_push($driverarr,$orderItems->courier);
array_push($partnerarr,$orderItems->tracking_no);
}
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 />';
} else if($orderItems->tracking_no !='' && strtolower($orderItems->courier)=='burqup'){
$tracking_nos[$orderItems->tracking_no] =$orderItems->courier.' Tracking :<a href="https://www.burqup.com/track/'.$orderItems->tracking_no.'" 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
$storearr=array();
$storenamearr=array();
$storecount=0;
$sqlstore = $obj->query("select ot.storeid,storename from tbl_order_itmes ot inner join stores s on s.storeid=ot.storeid where order_id='$line->id' group by s.storeid");
while ($storeres = $obj->fetchNextObject($sqlstore)) {
echo ucwords($storeres->storename)."<br>";
array_push($storearr,$storeres->storeid);
array_push($storenamearr,$storeres->storename);
}
$storecount=$obj->numRows($sqlstore);
$storearr=array_values(array_unique($storearr));
$storenamearr=array_values(array_unique($storenamearr));
?>
</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 $storearr[$x]; ?>" class="iframeItems<?php echo $line->id; ?>" >Label (<?php echo ucwords($storenamearr[$x]); ?>)<br /></a>
<?php
}
}
?></td>
<td class="padd5">
<?php
$driverarr=array_values(array_unique($driverarr));
$partnerarr=array_values(array_unique($partnerarr));
for($d=0; $d<count($driverarr); $d++){
echo $driverarr[$d].' / '.$partnerarr[$d].'<br>';
}
echo $line->deliverby;
?>
<input type="button" name="burq" value="BURQUP" onclick="window.open('burqup.php?order_id=<?php echo $line->id; ?>')" />
</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>
<style type="text/css">
div .search_order{
display: inline-block;
width: 16%;
height: 40px;
font-weight: bold;
</style>
</body>
</html>
Directory Contents
Dirs: 10 × Files: 414