<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>

<?php   

  $default;
 
  if($_GET["month"]!=NULL ){

      $default= $_GET["month"];
    }
    else{
      $default= date("m");
    }

  $m->where("Month_Id", $default);
  $month=$m->get("eduportal_month_config");

   if(isset($_REQUEST['user_id'])){
   $m->where("month_id", $_REQUEST['month']);
   $m->where("user_id", $_REQUEST['user_id']);
   $users = $m->get("eduportal_users_auditlog_detail");
 } else {

   $users = $m->get("eduportal_users_auditlog_detail");
 }
 


?>



<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Print Users Activity Report</title>
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
// window.print();
</script>
<style type="text/css">

tr th {border-top:1px solid gray;border-left:1px solid gray;border-bottom:1px solid gray;text-align:center;background-color:lightgray;font-size:14px;}
tr td {border-bottom:1px solid gray;border-left:1px solid gray;font-size:14px;}
  
.border{border:1px solid black;}
.center{text-align:center;}
.alignment{padding-left:1%;text-align:left;}

</style>
</head>
<body style="font-size:12px;">


<br>

<div style="text-align:center;font-size:30px;font-weight:bold;"> User Activity Report </div>

<hr style="width:100%;">

<div style="width:33%;float:left;font-size:16px;">  <b> <!-- Class Name: --></b> 

<?php echo $class[0]['Class_Name'];?> 

</div>

<div style="width:33%; float:left;font-size:20px; "> <b> Report Month:</b> <?php echo $month[0]['Month_Name'];?>  </div>

<input type="hidden" name="saleman" value="">
<input type="hidden" name="customer" value="">

<br><br><br>
   
<table id="datatable" class="table table-striped table-bordered"style="background-color: white;">
                      <thead>
                        <tr>
                          <th style="padding: 0.5%;" width="2%">S.No</th>
                          <th style="padding: 0.5%;" width="10%">User Name</th>
                          <th style="padding: 0.5%;" width="55%">Action</th>
                          <th style="padding: 0.5%;" width="10%">Month</th>
                          <th style="padding: 0.5%;" width="10%">Date</th>
                          <th style="padding: 0.5%;border-right: 1px solid black;" width="10%">Time</th>
                        
                        </tr>
                      </thead>
                      <tbody>

                        
<?php  $count=1;
$date= date("Y-m-d");

foreach($users as $user){
  if(isset($_REQUEST['user_id'])){
  $m->where("user_id", $_REQUEST['user_id']);
  $username=$m->get("edu_user_config");
} else {
  $m->where("user_id", $user['user_id']);
  $username=$m->get("edu_user_config");
}
 
  $m->where("Month_Id", $user['month_id']);
  $months=$m->get("eduportal_month_config");


?>
                        <tr>
                          <td style="text-align:center;"><?php echo $count; $count++;?></td>
                         

                          <td style="padding: 0.5%;"><?php echo $username[0]['user_fname'];?></td>
                          <td style="padding: 0.5%;"><?php echo $user['action'];?></td>
                          <td style="padding: 0.5%;"><?php echo $months[0]['Month_Name'];?></td>
                          <td style="padding: 0.5%;"><?php echo $user['date'];?></td>
                          <td style="padding: 0.5%;border-right: 1px solid black;"><?php echo $user['time'];?></td>
                       
                        </tr>
<?php } ?>
                      

                      </tbody>
                    </table>

</body>
</html>
