System: Windows NT WINDOWS18 10.0 build 17763 (Windows Server 2016) AMD64 | User: IWPD_3544(appclien)

Path: D:\Inetpub\vhosts\appclients.in\fruits-vegitables.nmvm.org\user

[Back to List]
<?php
$msg='';
error_reporting(0);
include("include/header.php");
include('include/admin-main.php');
/*
if(isset($_REQUEST['sid'])){
 $condition= "where reg_id='$_REQUEST[sid]' AND vendor_ID='admin'";
}else{
 $condition="where vendor_ID='admin'";
}*/
$select_obj= new admin();
$result=$select_obj->select_order_product("cart","where user_id='$_SESSION[user_reg_id]' group by code_id order by id DESC");

 /* this code is used for inactive */
if($_REQUEST['action']=='update'){
 if($_REQUEST['status']=="Cancelled"){
//select product id
	$p_Q = mysqli_query($con,"SELECT * FROM cart where id='".$_REQUEST['id']."'");
	$cartData = mysqli_fetch_array($p_Q);
    //select product stock
	$pro_data_Q = mysqli_query($con,"SELECT * FROM product where id='".$cartData['product_id']."'");
	$productData = mysqli_fetch_array($pro_data_Q);
	$incStock = $productData['stock']+$_REQUEST['tqty'];
     mysqli_query($con,"update product set stock='$incStock' where id='".$cartData['product_id']."'");
  }

    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 
	}
}
?>
<!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")?> Product 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>
<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-->
    <section class="panel">
      <header class="panel-heading"> All Order Details </header>
      <div class="panel-body">
        <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>Shipping Charge</th>
				<th>Total Price</th>
                <th>Order Date</th>
				<th class="hidden-phone">Stock/Sell</th>
                <th>Status/Payment Status</th>
                <th>Action</th>
              </tr>
            </thead>
            <tbody>
              <?php $totalAmount=0;
			  while($row=mysqli_fetch_array($result)){
			  //total sell product from cart
			  $total_sell=0;
			  $sell_product_Q=mysqli_query($con,"select * from cart where product_id='$row[product_id]' and status='Delivered'");
			  while($totalSell=mysqli_fetch_array($sell_product_Q)){
   			    $total_sell=$total_sell+$totalSell['quantity'];
			  }
			  //select order details
			  $result_1=$select_obj->select_order_product("cart","where code_id='$row[code_id]' AND user_id='$_SESSION[user_reg_id]' order by id DESC");
			  ?>
              <tr class="gradeA">
			    <td class="center hidden-phone" style="display:none;"><?php echo $row['id'];?></td>
                <td class="center hidden-phone" style="text-align:left; width:200px"><?php 
				            echo "<small>
							<b>Name: </b>".$row['bll_name']." (".$row['reg_id'].")<br />"."<b>Mobile No: </b>".$row['bll_mob']."<br />".
						   "<b>Email ID: </b>".$row['bll_email']."<br />".
						   "<b>Address: </b>".$row['bll_addr'].",".$row['bll_state']." ".$row['bll_city']." ".$row['bll_pin']."<small>";
				?></td>
                <td class="center hidden-phone"><?php echo $row['code_id'];?></td>
			   
			   
			   <td class="center hidden-phone" style="width:200px; text-align:left">
		  <?php 
		      $totalPriceIS=0;	
			  while($row_1=mysqli_fetch_array($result_1)){
			  $prc_exp = explode("*M*",$row_1['Color']);
		      $price = $prc_exp[0];
			  //select vendor ID
			  $sel_vendor_Q=mysqli_query($con,"select * from register where reg_id='$row_1[reg_id]'") or die(mysqli_error());
			  $vendorID=mysqli_fetch_array($sel_vendor_Q);
			  
			  $sel_d=mysqli_query($con,"select * from product where id='$row_1[product_id]'") or die(mysqli_error());
			  $row_data=mysqli_fetch_array($sel_d);
			  
			  $totalPrice=$price*$row_1['quantity'];
			  $totalPriceIS=$totalPriceIS+$totalPrice;
			  $dcd_img=json_decode($row_data['img']);
?>
                  <img src="../image/product/<?php echo $dcd_img[0]; ?>"  alt="" height="50px"/>
                 <br><?php echo "<strong>Product Name: </strong> ".$row_data['name']." <br>- ".$row_1['Size']."<br>"."<strong>PID:</strong> P".$row_1['product_id']."<br>"."<strong>Price:</strong> ".$price."<br>"."<br><strong>Quantity:</strong> ".$row_1['quantity'];
				}
				$totalAmount = $totalAmount+$totalPriceIS;
				?></td>
				<td class="center hidden-phone"><?php echo $row['tot_shipping_charge'];?></td>
				<td class="center hidden-phone"><?php echo $totalPriceIS+$row['tot_shipping_charge'];?></td>
			    <td class="center hidden-phone"><?php echo date('d-m-Y',$row['order_date']);?></td>
				<td class="center hidden-phone"><?php echo $row_data['stock']."/".$total_sell;?></td>
                <td class="center hidden-phone">
				<?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><br />';
						if(!empty($row['transID'])) echo "Online";else echo "COD"; }else{?>
				
				<div class="dropdown">
                    <button class="btn-primary dropdown-toggle" type="button" data-toggle="dropdown" style="border:1px"><?php echo $row['status']?> <span class="caret"></span></button> &nbsp; <?php if(!empty($row['transID'])) echo "Online";else echo "COD"; ?>
                    <ul class="dropdown-menu">
                      <?php $actionArray=array('In process','On the way','Tomorrow delivery','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 }?> 
				 
			      <?php if($row['cancellation_sts']==1)echo "Request: <small style='color:red'>".$row['cancelled_reason']."</small>";?>
				  </td>
                <td><?php if($row['status']=='In process'){?>
                  <a href="order print.php?action=orderPrint&id=<?php echo $row['id']?>" title="Print order">
                  <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">
                  <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 $totalAmount?></td></tr>
		       </tbody>
		 </table>
        </div>
      </div>
    </section>
    <!-- page end-->
  </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>Product ID</td><td>'+aData[4]+'</td></tr>';
		  sOut += '<tr><td>Product Name</td><td>'+aData[5]+'</td></tr>';
          sOut += '<tr style="display:none"><td>Size</td><td>'+aData[6]+'</td></tr>';
		  sOut += '<tr style="display:none"><td>Color:</td><td>'+aData[7]+'</td></tr>';
		  sOut += '<tr><td>Price:</td><td>'+aData[8]+'</td></tr>';
		  sOut += '<tr style="display:none"><td>Old Price:</td><td>'+aData[9]+'</td></tr>';
		  sOut += '<tr><td>Qty:</td><td>'+aData[10]+'</td></tr>';
		  sOut += '<tr><td>Total Price:</td><td>'+aData[11]+'</td></tr>';
		  sOut += '<tr><td>Image:</td><td>'+aData[12]+'</td></tr>';
		  sOut += '<tr><td>Date:</td><td>'+aData[13]+'</td></tr>';
		  sOut += '<tr><td>Stock/Sell:</td><td>'+aData[14]+'</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 = '<img src="assets/advanced-datatable/examples/examples_support/details_open.png">';
          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>