Google
Edit File: mainorders.php
<?php include 'session.php';?> <!DOCTYPE html> <?php include 'reader.php'; //$dbl = new ConDB(); $sessionQuery = "select username from admin_pass"; //$sessionResult = mysql_query($accQry, $db1->conn); if(!$sessionResult = $db1->db->query($sessionQuery)){ die('There was an error running the query [' . $db1->db->error . ']'); } $row = $sessionResult->fetch_assoc(); //$row = mysql_fetch_assoc($sessionResult); //if ($row['session'] == $_SESSION["keys"]) { //} else { //$row = $sessionResult->fetch_assoc(); /* if ($row['username'] == $_SESSION["keys"]) { } else { // header("Location: login.php"); }*/ ?> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Orders</title> <link type="text/css" href="css/bootstrap.min.css" rel="stylesheet"> <link type="text/css" href="css/bootstrap-responsive.min.css" rel="stylesheet"> <link type="text/css" href="css/theme.css" rel="stylesheet"> <link type="text/css" href="images/icons/css/font-awesome.css" rel="stylesheet"> <link type="text/css" href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600' rel='stylesheet'> <link type="text/css" href="css/admin_menu_edit.css" rel="stylesheet"> <link type="text/css" href="css/switch.css" rel="stylesheet"> <style type="text/css"> #orders_id{ color:#fff; }a:focus,a:hover{ color:black; text-decoration:none; } .dropdown-menu>li{ float:none; } </style> </head> <body> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container" style="min-height: 50px;"> <a class="brand" href="merchant.php"> Pinnacle </a> <ul style="list-style-type: none;text-decoration:none;color:black;float:right;padding-top:10px;"> <li class="dropdown" style="padding-top:10px;"> <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#" style="color:black;"> <b><?php echo $login_session; ?></b><span class="caret"></span></a> <ul id="g-account-menu" class="dropdown-menu" role="menu"> <li><a href="logout.php">Logout</a></li> </ul> </li> </ul> </div> </div><!-- /navbar-inner --> </div><!-- /navbar --> <div class="wrapper"> <div class="container"> <div class="row"> <div> <?php include ('menu.php'); ?> </div> </div><br /> <div class="row"> <div> <div class="content"> <div class="module"> <div class="module-head"> <h3>Orders</h3> <!-- <a class="btn mini blue-stripe" style="color:white;background-color:#6d9acd;" onclick="getXlsx();" href="javascript:void(0)" >Generate Excel File</a> --> </div> <div class="module"> <div class="module-head"> </div> <div id="myModal3" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h3 id="myModalLabel">Download</h3> </div> <div class="modal-body" id="linkhere"></div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> </div> </div> <div class="module-body table"> <table cellpadding="0" cellspacing="0" border="0" class="datatable-1 table table-bordered table-striped display" width="100%"> <thead> <tr> <th>Sl No:</th> <th>Event Name</th> <th>Order Counts</th> <th>Created Date</th> <th>Download csv</th> <th>Order Details</th> </tr> </thead> <tbody> <?php $accQry = "SELECT e.event_name,o.event_id,o.created_dt,COUNT(o.event_id) AS ordertotal FROM orders o INNER JOIN event e ON o.event_id = e.event_id GROUP BY o.`event_id` ORDER BY o.created_dt desc"; if(!$result1 = $db1->db->query($accQry)){ die('There was an error running the query [' . $dbl->db->error . ']'); } $i = 1; while ($row = $result1->fetch_assoc()) { ?> <tr id="doc_rows" > <td class="center"><?php echo $i ?></td> <td class="center"><?=$row['event_name']; ?></td> <td class="center"> <?php if($row['event_name'] != NULL){ ?> <a href="orders.php?event_id=<?=$row['event_id'];?>"><?=$row['ordertotal']; ?> </a> <?php } else{echo "0";} ?> </td> <td class="center"> <?Php if($row['created_dt'] != NULL){echo $row['created_dt'];}else{echo "-";} ?> </td> <td> <button id="button_id" style="color:white;background-color:#6d9acd;" onclick="window.location='exportcsv.php?event_id=<?=$row['event_id'];?>&type=order'" >Download</button> </td> <td class="center"> <button id="button_id" style="color:white;background-color:#fcc87b;" onclick="window.location='orders.php?event_id=<?=$row['event_id'];?>'" >Order Details</button> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> </div><!--/.module--> <br /> </div><!--/.content--> </div><!--/.span9--> </div> </div><!--/.container--> </div><!--/.wrapper--> <script src="scripts/jquery-1.9.1.min.js"></script> <script src="scripts/jquery-ui-1.10.1.custom.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/jquery-ui.js"></script> <script src="scripts/datatables/jquery.dataTables.js"></script> <script> $(document).ready(function() { $('.datatable-1').dataTable(); $('.dataTables_paginate').addClass("btn-group datatable-pagination"); $('.dataTables_paginate > a').wrapInner('<span />'); $('.dataTables_paginate > a:first-child').append('<i class="icon-chevron-left shaded"></i>'); $('.dataTables_paginate > a:last-child').append('<i class="icon-chevron-right shaded"></i>'); var width = (window.innerWidth > 0) ? window.innerWidth : screen.width; if(width > 720){ var wid = (width - 90)/6; $(function() { $(".horiz-menu li").width(wid); }); }else{ $(function() { $(".wrapper .container").css({'margin-left':'0px','margin-right':'0px'}); }); } } ); $('#example').DataTable({ stateSave:true } ); function change(){ document.getElementById("custom").submit(); } $( function() { $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' }); } ); function switcher(){ window.location.href = 'users.php'; } function active(){ document.getElementById("active").submit(); } function deleteClicked(id) { console.log(id); $('#myModal').data('id', id).modal('show'); } function getXlsx(){ //console.log(collqry); $.ajax({ // type:"POST", url:"ordersall_xlsx.php", // data:{from:from,to:to,query:qry, collqry:collqry}, success:function(result){ console.log(result); var len = result.length; var filename = result.slice(1,(len-1)); console.log("filename = " + filename); $("#myModal3").modal('show'); $("#linkhere").html("<p><a href="+filename+">Download the Excel sheet here</a></p>"); }, error:function(){} }); } $( function() { var from = $( "#from" ) .datepicker({ changeMonth: true, numberOfMonths: 1, dateFormat: 'yy-mm-dd', }) .on( "change", function() { to.datepicker( "option", "minDate", getDate( this ) ); }), to = $( "#to" ).datepicker({ changeMonth: true, numberOfMonths: 1, dateFormat: 'yy-mm-dd', }) .on( "change", function() { from.datepicker( "option", "maxDate", getDate( this ) ); }); function getDate( element ) { var date; try { date = element.value; } catch( error ) { date = null; } return date; } } ); </script> </body>