<?php
session_start();
include('../include/config.php');
session_start();
error_reporting(0);
$gr=$_SESSION['cll'];
$trm=$_SESSION['tmm'];

if(isset($_POST['impres']))
{
$impid =addslashes($_POST['impres']);
$sql = "select * from Imprest where id='$impid'";
$result = $con->query($sql);
while($row = $result->fetch_assoc()) 
{
  $tit=$row["Title"];   
  $amt=$row["Amount"]; 
  $dat=$row["Date"]; 
}
}else
{
    $impid ='0';
    $tit='No Report';
    $amt='0';
    $dat='';
}
?>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Imprest - <?php echo $tit;?> </title>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- SweetAlert2 -->
  <link rel="stylesheet" href="../plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
  <link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="../plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
  <!-- Toastr -->
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  
  <link rel="stylesheet" href="../dist/css/adminlte.min.css">
    <link rel="stylesheet" href="../plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <link rel="stylesheet" href="../plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
  <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css">
  <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  <link rel="shortcut icon" href="../images/logo.ico">
  <style>
      .bigger{
          font-size:16px;
          font-family:Tahoma;
      }
      .farmamount
      {
          font-size:18px;
          color:red;
      }
      .requireds
      {
          color:red;
      }
      #tablefarmincome
      {
       font-size:14px;   
      }
      #tablebankdata
      {
          font-size:14px;
      }
      #idmonthincome
      {
          font-size:14px;
          font-family:Robot;
      }
       #tablebusdata
      {
         font-size:12px;
      }
      #tablestaffsss
      {
          font-size:13px;
          font-family:Tahoma;
      }
      
      #tableexpenditure
      {
          font-size:13px;
      }
      
      .incomeperclasstable
      {
          font-size:14px;
      }
      
      .bstaffedit{
          font-size:10px;
      }
      
      .btnstafdelete{
          font-size:10px;
      }
      
      .side{
          box-shadow: 0 0 0 10px #4fc3dc44,
	0 0 50px #4fc3dc, 0 0 100px #4fc3dc;
	border-radius: 5px;
      }
      
      
	 .fc-dayGridMonth-button{
        font-size:10px;
    }
    
    .fc-dayGridWeek-button{
        font-size:10px;
    }
    
    .fc-list-button{
        font-size:10px;
    }
    
    .fc-today-button{
        font-size:10px;
    }
    
    .fc-prev-button{
        font-size:11px;
    }
    
    .fc-next-button{
        font-size:11px;
    }
    
    body{
        padding:10px;
    }
      
  </style>
  
  <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
    <link rel="stylesheet" href="schedule/fullcalendar/lib/main.min.css">
    <script src="schedule/fullcalendar/lib/main.min.js"></script>
    
    <link rel="stylesheet" href="schedule/fullcalendar/lib/main.min.css">
    <script src="schedule/fullcalendar/lib/main.min.js"></script>
</head>
<body class="hold-transition sidebar-mini layout-fixed" onload="window.print()">
 <div class="wrapper">
     <div class="container" style="border:2px solid gray;border-radius:5px">
        <?php
        $sql = "select SUM(Amount) as Tot  FROM Imprest2 where Imprest='$impid'";
        $result = $con->query($sql);
        while($row = $result->fetch_assoc()) 
        {
        $tot=$row["Tot"]; 
        }
        
        $bal=$amt-$tot;
        ?>
         <center><h3>BISHOP KAIRO EDUCATION CENTRE</h3></center>
          <center><h4>IMPREST REPORT</h4></center>
         <center><h5><u><?php echo $tit; ?></u></h5></center>
         <center>
             
             <h6>Imprest Amount: <u><strong><?php echo $amt; ?></strong></u>  &nbsp; &nbsp; Imprest Balance: <u><strong><?php echo $bal; ?></strong></u> &nbsp; &nbsp; Withdrawal Date: <u><strong>  <?php echo $dat; ?></strong> </u>
             </h6> 
             </center>
         <hr />
      <table class="table table-bordered" id="tablefees" >
                     <thead>
                        
                         <tr style="font-size:15px;font-weight:bold;color:#000">
                             <th>#</th>
                             <th>Particular</th>
                             <th>Amount</th>
                             <th>Category</th>
                             <th>Pay Mode</th>
                             <th>Expense date</th>
                             <th>Entry date</th>
                             <th>Entered By</th>
                         </tr>
                     </thead>
                     <tbody>
                    <?php
                    $sql = "select Imprest2.*,Staffs.Name as nam from Imprest2 left join Staffs ON Staffs.id=Imprest2.User where Imprest='$impid'";
                    $result = $con->query($sql);
                    if ($result->num_rows > 0) 
                    {
                    $cnt='1';
                    while($row = $result->fetch_assoc()) 
                    {
                    ?>	
                    <tr>
                    <td><?php echo $cnt; ?></td>
                    <td><?php echo $row["Particular"]; ?></td>
                    <td><strong><?php echo $row["Amount"]; ?></strong></td>
                    <td><?php echo $row["Cat"]; ?></td>
                    <td><?php echo $row["Mode"]; ?></td>
                    <td><?php echo $row["ExpDate"]; ?></td>
                    <td><?php echo $row["EntryDate"]; ?></td>
                    <td class=""><?php echo $row["nam"]; ?></td>
                    </tr>
                    <?php
                    $cnt=$cnt+1;
                    }
                    }
                    ?>
                     </tbody>
                        <?php
                        $sql = "select SUM(Amount) as Tot  FROM Imprest2 where Imprest='$impid'";
                        $result = $con->query($sql);
                        while($row = $result->fetch_assoc()) 
                        {
                        $tot=$row["Tot"]; 
                        }

                        ?>
                      <tr style="font-size:15px;font-weight:bold" class="bg-secondary">
                        <td colspan="2">TOTAL (KES)</td>
                        <td colspan="6" style="font-size:15px;font-weight:bold"><strong><?php echo $tot; ?></strong>
                        </td>
                        </tr>
                 </table> 
                 <hr />
                 
     </div>
 </div>
 
 <script src="../plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="//plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
  $.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<!-- ChartJS -->
<script src="../plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="./plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="../plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="../plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="../plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="../plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="../plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.js"></script>
<!-- AdminLTE for demo purposes -->
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="../dist/js/pages/dashboard.js"></script>

<!--Data tables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="../plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="../plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="../plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="../plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="../plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
</body>
