<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h5 class="m-0">Fees Payment Dashboard</h5>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item">Dashboard</li>
              <li class="breadcrumb-item ">Income</li>
              <li class="breadcrumb-item active">Payment Dashboard</li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-2 col-sm-2 col-12">
            <div class="info-box">
              <div class="info-box-content">
                <center>
                    <button type="button" class="btn btn-success" data-toggle="modal" data-target="#modalpayment" id="seemodal">
                  <i class="fa fa-plus"></i> Pay Fee
                </button>
                </center>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          
            <div class="col-md-2 col-sm-2 col-12">
            <div class="info-box">
                <div class="info-box-content">
             <a href="Pupils.php?page=Manage_Fee" class="text-info" title="Click to refresh data">Refresh Data<i class="fa fa-refresh btn text-primary"></i>
             </a>
             </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
 
         
        <div class="col-md-2 col-sm-2 col-12">
            <div class="info-box">
              <div class="info-box-content">
                <center>
                    <a href="Pupils.php?page=Fee_Balances" class="btn btn-danger" >
                  <i class="fa fa-arrow-right"></i> Fee Balances
                </a>
                </center>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div> 
          
          <div class="col-md-2 col-sm-2 col-12">
            <div class="info-box">
              <div class="info-box-content">
                <center>
                    <a href="Pupils.php?page=Fee" class="btn btn-warning" >
                  <i class="fa fa-arrow-right"></i> UPDATE FEES
                </a>
                </center>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div> 
          
           <div class="col-md-2 col-sm-2 col-12">
            <div class="info-box">
              <?php
                include('../include/config.php');
                $result = mysqli_query($con,"SELECT SUM(TuFee) as tincome FROM feestatement where Year='$yr' AND Term='Term Two'");
                while($row = $result->fetch_assoc()) 
                {
                  $incoome=$row["tincome"];
                }
                ?>
              <div class="info-box-content">
                <span class="info-box-text">Tution Fee Paid</span>
                <span class="badge bg-warning"><?php echo $yr.' - Term Two'; ?></span>
                <h4 class="info-box-number budge text-danger"><?php echo $incoome; ?></h4>
              </div>
    
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          
          
           <div class="col-md-2 col-sm-2 col-12">
            <div class="info-box">
              <div class="info-box-content">
                <center>
                    <a href="Pupils.php?page=Link" class="btn btn-primary" >
                  <i class="fa fa-arrow-right"></i> Fee Statements
                </a>
                </center>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div> 
          
          </div>
         </div>
    </section>
         
    <section class="content" style="text-decoration:none;font-weight:normal;font-family:Times;font-size:12px">
           <div class="row">
        
             <div class="table-responsive" id="divpaidfees">
                 <table class="table table-bordered" id="tablefees" >
                     <thead>
                         <tr>
                             <th>#</th>
                             <th>Receipt No</th>
                             <th>Term</th>
                             <th>Pupils Name</th>
                             <th>Adm No.</th>
                             <th>Class</th>
                             <th>Paid Amount</th>
                             <th>Account Credited</th>
                             <th>Date of Payment</th>
                             <th>Saved by</th>
                             <th>Action</th>
                         </tr>
                     </thead>
                     <tbody>
                            <?php
                        $sql = "select feestatement.*,Staffs.Name as nm,pupils.names as pnam,pupils.AdmNo as adm,bankdata.Bname as bnm,bankdata.Account as act from feestatement left join Staffs ON Staffs.id=feestatement.User left join bankdata ON bankdata.id=feestatement.Bank left join pupils ON pupils.count=feestatement.pid ORDER BY count DESC Limit 30";
                        $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["Voucherid"]; ?></td>
                        <td><?php echo $row["Term"].' '.$row["Year"]; ?></td>
                        <td><?php echo $row["pnam"]; ?></td>
                        <td><?php echo $row["adm"]; ?></td>
                        <td><?php echo $row["Grad"]; ?></td>
                        <td class="alert-success"><strong><?php echo $row["PaidAmount"]; ?></strong></td>
                        <td><strong class="text-info"><?php echo $row["bnm"]; ?></strong> : <small><?php echo $row["act"]; ?></small></td>
                        <td><?php echo $row["BankDate"]; ?></td>
                        <td><?php echo $row["nm"]; ?></td>
                        <td>
                            
                            <input type="hidden" name="feepaididholder" class="feepaididholder" value="<?php echo $row["count"]; ?>" />
                            
                            <i class="fa fa-refresh btn-xs text-success btn updatepaidfee" id="updatepaidfee" title="Update this fee record"> </i> 
                            |
                            <i class="fa fa-trash btn-xs text-danger btn btndletepayment" id="btndletepayment"> Delete</i> 
                        </td>
                        
                            </tr>
                            <?php
                            $cnt=$cnt+1;
                            }
                        }
                            ?>
                     </tbody>
                 </table> 
              </div>
            </div>
    </section>
</div>

