<?php include("homeheader.php");?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap -->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="../vendors/iCheck/skins/flat/green.css" rel="stylesheet">
    <!-- Datatables -->
    <link href="../vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
    <link href="../vendors/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
    <link href="../vendors/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
    <link href="../vendors/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
    <link href="../vendors/datatables.net-scroller-bs/css/scroller.bootstrap.min.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="../css/custom.css" rel="stylesheet">
  </head>
  <body>

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
	  
	  
	    <?php 
			$user = $dat['company'];
			$qry=mysql_query("select * from airtime_admin where username='$user' and account='Mobisky' ");
			
			if(mysql_num_rows($qry)> 0){
				?>
		<div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <!--div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title">
			    <div class="profile_pic" style="margin-top:-10px;">
					<img src="../images/mlogo.png" alt="" class="img-circle profile_img" />
			    </div>
			   <span>Instant Airtime </span>
            </div>
            <div class="clearfix"></div-->
            <!-- menu profile quick info -->
            <div class="profile">
              <div class="profile_pic">
			    <?php 
			  if($img == ""){
				  ?>
				   <img src="../profileimages/noimage.gif" alt="..." class="img-circle profile_img">
				  <?php
			  }else{
				?>
				 <img src="<?php echo $photo ?>" alt="..." class="img-circle profile_img" width="40px;" height="60px;">
            <?php				
			  }
			  ?>
              </div>
              <div class="profile_info">
                <span>Mobisky Admin </span>
				<h2> <?php $fname = $dat['fname']; $lname = $dat['lname']; echo $fname." ".$lname ?> </h2>
             <!--   <h2>John Doe</h2> -->
              </div>
            </div>
            <!-- /menu profile quick info -->
            <br/>	
				  <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section">
			  
      	 <?php include("sidebar.php"); ?>
              </div>
            </div>	
			<!--end side menubar -->
			</div>
        </div>
		
		 <?php include("admintopmenubar.php"); ?>
		 
				 <!-- page content -->
        <div class="right_col" role="main">
		  <!-- /top navigation -->
		     <div class="row">
          <!-- top tiles -->
          <div class="row tile_count">
            <div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
              <p>Airtime Portal </p>
            </div>
            
          </div>
		  </div>
          <!-- /top tiles -->
		 
		 <div class="row">
		 
		 
		 	 <!-- contacts table -->
		 
		       <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Account Topups History List  </h2>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
	
                     <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
						     <th>Company</th>
                          <th>Account For</th>
                          <th>Phone</th>
						  <th>Airtime Sent</th>
						  <th>Date Sent</th>
						  <th>Status</th>
						  <th>Requestid</th>
             
                        </tr>
                      </thead>
                      <tbody>
                      <?php
					  $us = mysql_query("select airtime_sending_records.recipient,airtime_sending_records.airtime_sent,airtime_sending_records.date_sent,airtime_sending_records.status,airtime_sending_records.requestid,airtime_customer.fname,airtime_customer.lname,airtime_customer.company from airtime_sending_records left join airtime_customer on airtime_customer.customer_id=airtime_sending_records.customer_id ORDER BY airtime_sending_records.r_id desc LIMIT 8000");
					   while($rws = mysql_fetch_assoc($us)){
				
								  
								    echo "<tr>";
									  	echo '<td>' .  $rws['company']. '</td>';
						    		echo '<td>' .  $rws['fname']. ' ' .  $rws['lname'].'</td>';
						        	echo '<td>' .  $rws['recipient']. '</td>';
						            echo '<td>' .  $rws['airtime_sent']. '</td>';
						        	echo '<td>' .  $rws['date_sent']. '</td>';
									echo '<td>' .$rws['status'].'</td>';
									echo '<td>' .$rws['requestid'].'</td>';
									?>
							
									<?php		
						   }
						   
							  
                       echo "</table>";
					  
					  ?>  
                       
                      </tbody>
                    </table>
                  
                  </div>
                </div>
              </div>
		 <!-- end contacts table -->
		 	 
		  </div>
		  
		  </div>
		 
				
				<?php
			}
			else{
				
				?>
				 <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <!--div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title">
			   <div class="profile_pic" style="margin-top:-10px;">
			  <img src="../images/mlogo.png" alt="" class="img-circle profile_img" />
			    </div>
			        <span>Instant Airtime </span>
            </div>

            <div class="clearfix"></div-->

			
            <!-- menu profile quick info -->
            <div class="profile">
              <div class="profile_pic">
			     <?php 
			  if($img == ""){
				  ?>
				   <img src="../profileimages/noimage.gif" alt="..." class="img-circle profile_img">
				  <?php
			  }else{
				?>
				 <img src="<?php echo $photo ?>" alt="..." class="img-circle profile_img" width="40px;" height="60px;">
            <?php				
			  }
			  ?>
              </div>
             <div class="profile_info">

                <span>Admin </span>
				<h2> <?php $fname = $dat['fname']; $lname = $dat['lname']; echo $fname." ".$lname ?> </h2>
             <!--   <h2>John Doe</h2> -->
              </div>
            </div>
            <!-- /menu profile quick info -->

            <br />

            <!-- sidebar menu -->
          <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section">
			  
                <h3>General</h3>
                <ul class="nav side-menu">
                  <li ><a  href="adminpage.php" ><i class="fa fa-home"></i>  Home <span class="fa fa-chevron-right"></span></a> </li>
                   <li><a href="#">  Users <span class="fa fa-chevron-down"></span></a> 
				  <ul class="nav child_menu">
					    <li><a  href="adduser.php" ><i class="fa fa-bug"></i>Create User<span class="fa fa-chevron-right"></span></a> </li>
						<li class="active"><a  href="viewuser.php" ><i class="fa fa-edit"></i>View Users<span class="fa fa-chevron-down"></span></a> </li>
					   </ul>
				  </li>
                  <li  ><a href="contacts.php">  View Contacts <span class="fa fa-chevron-right"></span> </a> </li>
                  <li ><a href="groups.php"> View Groups  <span class="fa fa-chevron-right"></span> </a>   </li>
				<!--li><a href="requests.php">Topup Requests  <span class="fa fa-chevron-right"></span> </a>   </li>
                   <li><a href="topupaccount.php">Topup My account <span class="fa fa-chevron-right"></span> </a>   </li-->
				   <!--li class="active"><a href="#"> Reports <span class="fa fa-chevron-down"></span></a>  
					   <ul class="nav child_menu">
					    <li><a  href="buyinghistory.php" > Credit Purchase History <span class="fa fa-chevron-right"></span> </a> </li>
						<li><a  href="sendinghistory.php" > Credit Sending History <span class="fa fa-chevron-right"></span> </a></li>
					   </ul>
				   </li-->
                </ul>
              </div>

            </div>
			 </div>
        </div>
		
		<?php  include("topmenubar.php"); ?>
				
				 <!-- page content -->
        <div class="right_col" role="main">
		  <!-- /top navigation -->
		     <div class="row">
          <!-- top tiles -->
          <div class="row tile_count">
            <div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
              <p>Airtime Portal </p>
            </div>
            
          </div>
		  </div>
          <!-- /top tiles -->
		 
		 <div class="row">
		 
		 
		 	 <!-- contacts table -->
		 
		       <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Airtime Sending History List  </h2>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
	
                     <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Account For</th>
						  <th>Amount Requested</th>
						  <th>Date Requested</th>
						  <th>Amount Awarded</th>
						  <th>Date Awarded</th>
                          <th>Delete</th>
                        </tr>
                      </thead>
                      <tbody>
                      <?php
					  $frm  = $dat['company'];
					  $us = mysql_query("select * from airtime_topup_requests where company='$frm' and status='Done' ");
					   while($rws = mysql_fetch_assoc($us)){
							    $id=  $rws['request_id']; 
								$cid=  $rws['customer_id'];
						         $message=  $rws['message'];
						         $amnt=  $rws['amount_requested'];
						         $sts=  $rws['status'];
						         $rdte=  $rws['date_requested'];
								 
					  
						   $s = mysql_query("select * from airtime_customer where customer_id='$cid' ");
						   $rw = mysql_fetch_assoc($s);
							    $fname =  $rw['fname'];
							    $lname =  $rw['lname'];
								  
								    echo "<tr>";
									echo '<td>' . $fname. " ".$lname. '</td>';
									echo '<td>' . $amnt . '</td>';
									echo '<td>' . $rdte . '</td>';
									echo '<td>' .$rws['amount_awarded'].'</td>';
									echo '<td>' .$rws['date_awarded'].'</td>';
									?>
									<td>
										<a rel="tooltip" title="Delete Record" id="<?php echo $id ?>" href="#deleterecord<?php echo $id ?>" data-toggle="modal">
								       <i class='fa fa-trash'></i></a>
									    <?php include('deleterecord.php'); ?>	
										</td>
									<?php		
						   }
						   
							  
                       echo "</table>";
					  
					  ?>  
                       
                      </tbody>
                    </table>
                  
                  </div>
                </div>
              </div>
		 <!-- end contacts table -->
		 	 
		  </div>
		  
		  </div>
				
			<?php	
			}
			
			
		?>
	  
       
		  
	 </div>
		  
  </div>	  
		          <!-- /page content. End of main -->

     <?php include("footerlinks.php"); ?>
	 
	   <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="../vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="../vendors/nprogress/nprogress.js"></script>
    <!-- Datatables -->
    <script src="../vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="../vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="../vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="../vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="../vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="../vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="../vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="../vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <script src="../vendors/jszip/dist/jszip.min.js"></script>
    <script src="../vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="../vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="../js/custom.js"></script>

    <!-- Datatables -->
    <script>
      $(document).ready(function() {
        var handleDataTableButtons = function() {
          if ($("#datatable-buttons").length) {
            $("#datatable-buttons").DataTable({
              dom: "Bfrtip",
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
          }
        };

        TableManageButtons = function() {
          "use strict";
          return {
            init: function() {
              handleDataTableButtons();
            }
          };
        }();

        $('#datatable').dataTable();
        $('#datatable-keytable').DataTable({
          keys: true
        });

        $('#datatable-responsive').DataTable();

        $('#datatable-scroller').DataTable({
          ajax: "js/datatables/json/scroller-demo.json",
          deferRender: true,
          scrollY: 380,
          scrollCollapse: true,
          scroller: true
        });

        var table = $('#datatable-fixed-header').DataTable({
          fixedHeader: true
        });

        TableManageButtons.init();
      });
    </script>
    <!-- /Datatables -->
  </body>
</html>