GIF89a php
Current File : /home/viralhoga/public_html/adminpanel/order-details.php
<?php
$msg='';
error_reporting(0);
include("include/header.php");
include('include/admin-main.php');
if(isset($_REQUEST['sid'])){
 $condition= "where reg_id='$_REQUEST[sid]'";
}else{
 $condition="";
}
$select_obj= new admin();

   $limit = 100;  
    if (isset($_GET["page"])){
   $page  = $_GET["page"]; 
     } else{ 
   $page=1;
   };
    
   $start_from = ($page-1) * $limit;
   $limitBy = " LIMIT $start_from, $limit"; 

$result=$select_obj->select_order_product("cart","where paysts='Success' order by id DESC $limitBy");

//select menu name
$menu_details=$select_obj->select_objData("menu","");

if($_REQUEST['action']=="delete")
{
	if(mysqli_query($con,"delete from product where id=".$_REQUEST['id']))
	{	?>
<script type="text/javascript">
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php
	}
	else
	{	?>
<script type="text/javascript">
		alert("Error! Data Not Deleted");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php
	}
}

 /* this code is used for inactive */
if($_REQUEST['action']=='update'){
if(mysqli_query($con,"update cart set status='$_REQUEST[status]' where id=".$_REQUEST['id'])){
	?>
<script>
	alert("Status updated successfully");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}

	   /* this code is assign order to delivery boy */
if($_REQUEST['action']=='assign'){
    if(mysqli_query($con,"update cart set user_id='$_REQUEST[dlbID]' where id=".$_REQUEST['id'])){
	?>
<script>
	alert("Order assign to delivery boy successfully");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}

	   /* this code is used to add in check list */
if($_REQUEST['action']=='No'){
    if(mysqli_query($con,"update product set check_out='No' where id=".$_REQUEST['id'])){
	?>
<script>
	alert("Not show in check list");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}
 /* this code is used to add in check list */
if($_REQUEST['action']=='Yes'){
    if(mysqli_query($con,"update product set check_out='Yes' where id=".$_REQUEST['id'])){
	?>
<script>
	alert("Show in check list");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}

 /* this code is used to show */
if($_REQUEST['action']=='YesShow'){
    if(mysqli_query($con,"update product set h_status='Yes' where id=".$_REQUEST['id'])){
	?>
<script>
	alert("Show on the home page");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}

	   /* this code is used to not show */
if($_REQUEST['action']=='NotShow'){
    if(mysqli_query($con,"update product set h_status='No' where id=".$_REQUEST['id'])){
	?>
<script>
	alert("Not show on the home page");
	window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
	</script>
<?php
	}
	else{
	?>
<script type="text/javascript">
		alert("Error! Data Not Deactive");
		window.location.href="<?php echo $_SERVER['HTTP_REFERER'];?>";
		</script>
<?php 
	}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Mosaddek">
<meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
<link rel="shortcut icon" href="img/favicon.png">
<title><?php include("include/title.php")?> | Order Details</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-reset.css" rel="stylesheet">
<!--external css-->
<link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
<link href="assets/advanced-datatable/media/css/demo_page.css" rel="stylesheet" />
<link href="assets/advanced-datatable/media/css/demo_table.css" rel="stylesheet" />
<!-- Custom styles for this template -->
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet" />
</head>
<script type="text/javascript">
            function validate1(){

                
                    var msg = confirm('Are Your want to delete this record');
                    if(msg == true){
                        return true;
                    }else {
                        return false;

                    }
                }

           function changeSts(){
                    var msg = confirm('Are You want to change status');
                    if(!msg){
                        return false;
                    }else {
                        return true;
                    }
					}
		   function checkOut(){
                    var msg = confirm('Are You want to show in check out list');
                    if(!msg){
                        return false;
                    }else {
                        return true;
                    }
					}
		   function ShowHide(){
                    var msg = confirm('Show/Hide on home page!');
                    if(!msg){
                        return false;
                    }else {
                        return true;
                    }
					}
					
		  function printOrder(){
                    var msg = confirm('Are you want to print order!');
                    if(!msg){
                        return false;
                    }else {
                        return true;
                    }
					}
		function orderdone(){
		alert('Delivery is already done! ');	
		}
</script>
<!----------- Ajax ------------>
<script type="text/javascript">

function showUser123(str)

{

if (str=="")

  {

  document.getElementById("txtHint").innerHTML="";

  return;

  }

if (window.XMLHttpRequest)

  {// code for IE7+, Firefox, Chrome, Opera, Safari

  xmlhttp=new XMLHttpRequest();

  }

else

  {// code for IE6, IE5

  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

xmlhttp.onreadystatechange=function()

  {

  if (xmlhttp.readyState==4 && xmlhttp.status==200)

    {

    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;

    }

  }

xmlhttp.open("GET","getuser.php?q="+str,true);

xmlhttp.send();

}

</script>
<script type="text/javascript">

function showUser1234(str)

{
if (str=="")

  {

  document.getElementById("txtHint1").innerHTML="";

  return;

  }

if (window.XMLHttpRequest)

  {// code for IE7+, Firefox, Chrome, Opera, Safari

  xmlhttp=new XMLHttpRequest();

  }

else

  {// code for IE6, IE5

  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

xmlhttp.onreadystatechange=function()

  {

  if (xmlhttp.readyState==4 && xmlhttp.status==200)

    {

    document.getElementById("txtHint1").innerHTML=xmlhttp.responseText;

    }

  }

xmlhttp.open("GET","getuser2.php?q="+str,true);

xmlhttp.send();

}

</script>
<body>
<?php include 'popup.php';?>
<!--header end-->
<!--sidebar start-->
<?php  include 'menu.php' ?>
<!--sidebar end-->
<!--main content start-->
<section id="main-content">
  <section class="wrapper">
    <!-- page start-->
    <?php if($msg=="pass"){ ?>
    <div class="alert alert-success alert-dismissable" style="width:100%"> <i class="fa fa-check"></i>
      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
      <b>OK! </b>Data saved successfully </div>
    <script>
	  window.location="<?php echo $_SERVER['HTTP_REFERER']?>";
	  </script>
    <?php }?>
    <section class="panel">
      <header class="panel-heading"> All Order Details </header>
      <div class="panel-body">
        <!----<div class="btn-group"> <a href="export-data-from-sql-to-excel.php?sid=<?php echo $_REQUEST['sid']?>">
          <button id="editable-sample_new" class="btn btn-compose"> Export <i class="icon-download"></i> </button>
          </a> </div>--->
        <div class="adv-table">
          <table cellpadding="0" cellspacing="0" border="0" class="display table table-bordered" id="hidden-table-info">
            <thead>
              <tr>
                <th style="display:none">S.No</th>
                <th>Customer Name(ID)</th>
                <th>Order ID</th>
                <th>Product Details</th>
                <th>Total Price</th>
                <th>Order Date</th>
                <th>Payment Status</th>
                <th>Deliver Date</th>
				<th>Order Status</th>
                <th style="//display:none">Action</th>
              </tr>
            </thead>
            <tbody>
              <?php $totalAmount=0;
			  while($row=mysqli_fetch_array($result)){
			  //sel cust details
			  $customerDtl = mysqli_fetch_array($select_obj->select_objData("register","where reg_id='$row[reg_id]'"));
			  ?>
              <tr class="gradeA">
                <td style="display:none;"><?php echo $row['id'];?></td>
                <td style="width:250px; text-align:left">
				<?php
				  $mobile=$row['bll_mob'];
				  $email=$row['bll_email'];
				  if(empty($mobile))$mobile=$customerDtl['ctel'];
				  if(empty($email))$email=$customerDtl['cemail'];
				  echo "<small>
					<b>Name: </b>".$row['bll_name']." (".$row['reg_id'].")<br />"."<b>Mobile No: </b>".$mobile."<br />"."<b>Email ID: </b>".$email;
			   ?>
                </td>
                <td><?php echo $row['code_id'];?></td>
                <td><?php 
			  $totalPriceIS=0;
			  $sel_d=mysqli_query($con,"select * from product where id='$row[product_id]'") or die(mysqli_error());
			  $row_data=mysqli_fetch_array($sel_d); 
			  $totalPrice=$song_price+$channelPrice;
			  $discountAmount = $totalPrice*$row['disPercentage']/100;
			  $totalPayableAmount = $row['totalAmount'];
			  $dcd_img=json_decode($row_data['img']);
              ?>
                  <img src="img/<?php echo $dcd_img[0]; ?>"  alt="" height="50px"/> <br>
                  <?php 
				  if(!empty($row['Color']))echo "<strong>Song Type: </strong>".$row['Color']."<br>";
				  if(!empty($row_data['brand']))echo "<strong>Song Name: </strong>".$row_data['brand']."<br>";
				  if(!empty($row_data['name']))echo "<strong>Singer Name: </strong>".$row_data['name']."<br>";
				  if($row_data['price']!=0)echo "<strong>Song Price: </strong>".$row_data['price']."<br>";
				  echo "<a onClick='disp_popup".$row['id']."()'style='cursor:pointer'><font color='#e02d2b'><strong>Total Submit URL: ".$row['quantity']."</strong></font></a><br>";
				  if($row['disPercentage']!=0)echo "<strong>Discount Amount(%): </strong>".$row['disPercentage']."<br>";
				  echo "<strong>Paid Amount: </strong>".$totalPayableAmount."<br>";
			      $totalAmount = $totalPayableAmount;
				?>
				<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
                <script>
//var popup = setInterval(function(){ disp_popup(); }, 1000);
function disp_popup<?php echo $row['id']?>()
{
	$('#popup<?php echo $row['id']?>').fadeIn("slow");
	clearInterval(popup);
}

function close_btn<?php echo $row['id']?>()
{
	$('#popup<?php echo $row['id']?>').fadeOut("slow");
}
</script>	

<div id="popup<?php echo $row['id']?>" style="display:none; height:100%; width:100%; padding:0; margin:0; position:fixed; top:0; left:0; z-index:1000; background:rgba(0,0,0,0.3);">
	<div style="background:#fff; margin:auto; margin-top:100px; padding:6px; box-shadow:0 0 10px #000; width:400px; ">
	 <div onClick="close_btn<?php echo $row['id']?>();" style="position:relative;right: 0;top: -25px;width: 30px;height: 30px;padding:2px;color:#fff;font-weight:bold;border-radius:50%;background:#a00;cursor:pointer;">&nbsp;X</div>
		<div style="margin-top:-23px; padding:15px 10px;">
			<div style="font-size:16pt; text-align:center; color:rgb(51,102,153); text-shadow:0 1px #fff; font-weight:bold; margin-bottom:10px;">
				Youtube URL and Channel Name
			</div>
			<?php
			 $youtubeUrlData=json_decode($row['bll_country']);
			 $youtubeChannelData=json_decode($row['orderBy']);
			?>
            <table>
			 <?php for($i=0;$i<sizeof($youtubeUrlData);$i++){?>
			 <tr>
			  <td>
			   <?php echo "<b>".$youtubeChannelData[$i]."</b><br>"?>
			   <?php echo $youtubeUrlData[$i]?>
			  </td>
			 </tr>
			 <?php }?>
			</table>
		</div>
	</div>
	<!--</div> -->
</div>
				</td>
                <td><?php echo number_format($totalPayableAmount,2);?></td>
                <td><?php echo date('d/m/Y : h:i:a',$row['order_date']);?></td>
                <td><?php if(!empty($row['paysts']))echo $row['paysts'];?></td>
                <td>Under <?php echo $row_data['stock']?> Days</td>
				<td>
				<?php if($row['status']=="Cancelled"){echo '<li style="list-style:none"><font color="red">Cancelled</font></li>';}
	                    elseif($row['status']=="Delivered"){echo '<li style="list-style:none"><font color="green">Delivered</font></li>';}else{?>
				<div class="dropdown" style="width: 100px;">
                    <button class="btn-primary dropdown-toggle" type="button" data-toggle="dropdown" style="border:1px"><?php echo $row['status']?></button>
                    <ul class="dropdown-menu">
                      <?php $actionArray=array('In process','Delivered','Cancelled');
                        for($a=0;$a<sizeof($actionArray);$a++){
    if($actionArray[$a]!=$row['status']){
  ?>
                      <li style="text-align:left"><a href="order-details.php?action=update&id=<?php echo $row['id']?>&tqty=<?php echo $row['quantity']?>&status=<?php echo $actionArray[$a]?>" onClick="return confirm('Are you want to update the status?')"><?php echo $actionArray[$a]?></a></li>
                      <?php }
   }
                      ?>
                    </ul>
                  </div>
				 <?php }?> 
			    </td>
                <td style="//display:none"><?php if($row['status']=='In process'){?>
                  <a href="order print.php?action=orderPrint&id=<?php echo $row['id']?>" title="Print order" target="_blank">
                  <button class="btn btn-danger btn-xs" onclick='return printOrder()' style="padding: 1px 6px;"><i class="icon-print"></i></button>
                  </a>
                  <?php }else{?>
                  <a href="order print.php?action=orderPrint&id=<?php echo $row['id']?>" title="Print order" target="_blank">
                  <button class="btn btn-danger btn-xs" onclick='return printOrder()' style="padding: 1px 6px;background-color: #41cac0; border-color: #41cac0;"><i class="icon-print"></i></button>
                  </a>
                  <?php }?>
                </td>
              </tr>
              <?php } ?>
            </tbody>
          </table>
          <table>
            <tbody>
              <tr>
                <td><b>Total Amount:</b></td>
                <td><?php echo number_format($totalAmount,2)?></td>
              </tr>
            </tbody>
          </table>
        </div>
        <?php
		if(!empty($limitBy)){  
		$result_db = mysqli_query($con,"SELECT COUNT(id) FROM `cart`");
		$row_db = mysqli_fetch_row($result_db);
        $total_records = $row_db[0];
		if($total_records>500){
            $total_pages = ceil($total_records / $limit);
		    $pagLink = "<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
            <div class='pager_wrapper'>
            <ul class='pagination'>";
			if(!isset($_GET['page']) && empty($_GET['page']))$bgcolor="background: linear-gradient(to bottom, #F9D95E 50%, #B09754";
			for ($i=1; $i<=$total_pages; $i++){
				if(isset($_GET['page']) && !empty($_GET['page']) && $_GET['page']==$i)$bgcolor="background: linear-gradient(to bottom, #F9D95E 50%, #B09754";else if($i==1 && $_GET['page']==1)$bgcolor="background: linear-gradient(to bottom, #F9D95E 50%, #B09754";else $bgcolor='';
              $pagLink .= "<li class='btc_shop_pagi'><a style='$bgcolor' href='order-details.php?page=".$i."'>".$i."</a></li>";	
            }
			$pagLink .="</ul></div>
              </div>";
	      echo $pagLink;
	   }
	  }
	  ?>
      </div>
    </section>
    <!-- page end-->
    <!----popup ---->
    <div class="inbox-body">
      <!-- Modal -->
      <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title">Add New Product</h4>
            </div>
          </div>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>
      <!-- /.modal -->
    </div>
    <!----end popup  ----->
  </section>
</section>
<!--main content end-->
</section>
<!-- js placed at the end of the document so the pages load faster -->
<!--<script src="js/jquery.js"></script>-->
<script type="text/javascript" language="javascript" src="assets/advanced-datatable/media/js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script class="include" type="text/javascript" src="js/jquery.dcjqaccordion.2.7.js"></script>
<script src="js/jquery.scrollTo.min.js"></script>
<script src="js/jquery.nicescroll.js" type="text/javascript"></script>
<script src="js/respond.min.js" ></script>
<script type="text/javascript" language="javascript" src="assets/advanced-datatable/media/js/jquery.dataTables.js"></script>
<!--common script for all pages-->
<script src="js/common-scripts.js"></script>
<script type="text/javascript">
      /* Formating function for row details */
      function fnFormatDetails ( oTable, nTr )
      {
          var aData = oTable.fnGetData( nTr );
          var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
          sOut += '<tr style="display:none"><td>S. No:</td><td>'+aData[1]+'</td></tr>';
		  sOut += '<tr><td>Customer Name(ID):</td><td>'+aData[2]+'</td></tr>';
          sOut += '<tr><td>Order ID:</td><td>'+aData[3]+'</td></tr>';
		  sOut += '<tr><td>Assign Order</td><td>'+aData[4]+'</td></tr>';
		  sOut += '<tr><td>Product Details</td><td>'+aData[5]+'</td></tr>';
		  sOut += '<tr style="display:none"><td>Shipping Charge:</td><td>'+aData[6]+'</td></tr>';
		  sOut += '<tr><td>Total Price:</td><td>'+aData[7]+'</td></tr>';
		  sOut += '<tr><td>Date:</td><td>'+aData[8]+'</td></tr>';
		  sOut += '<tr style="display:none"><td>Stock/Sell:</td><td>'+aData[9]+'</td></tr>';
          sOut += '</table>';

          return sOut;
      }

      $(document).ready(function() {
          /*
           * Insert a 'details' column to the table
           */
          var nCloneTh = document.createElement( 'th' );
          var nCloneTd = document.createElement( 'td' );
          nCloneTd.innerHTML = '';
          nCloneTd.className = "center";

          $('#hidden-table-info thead tr').each( function () {
              this.insertBefore( nCloneTh, this.childNodes[0] );
          } );

          $('#hidden-table-info tbody tr').each( function () {
              this.insertBefore(  nCloneTd.cloneNode( true ), this.childNodes[0] );
          } );

          /*
           * Initialse DataTables, with no sorting on the 'details' column
		   */
                     var oTable = $('#hidden-table-info').dataTable( {
              "aoColumnDefs": [
                  { "bSortable": false, "aTargets": [ 0 ] }
              ],
              "aaSorting": [[1, 'desc']]
          });


          /* Add event listener for opening and closing details
           * Note that the indicator for showing which row is open is not controlled by DataTables,
           * rather it is done here
           */
          $('#hidden-table-info tbody td img').live('click', function () {
              var nTr = $(this).parents('tr')[0];
              if ( oTable.fnIsOpen(nTr) )
              {
                  /* This row is already open - close it */
                  this.src = "assets/advanced-datatable/examples/examples_support/details_open.png";
                  oTable.fnClose( nTr );
              }
              else
              {
                  /* Open this row */
                  this.src = "assets/advanced-datatable/examples/examples_support/details_close.png";
                  oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
              }
          } );
      } );
  </script>
</body>
</html>