<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">Income from school Bus hiring</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">Bus Hire</li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-5 col-sm-5 col-5">
            <div class="info-box">
              <span class="info-box-icon bg-info"><i class="far fa-dollar"></i></span>
              <?php
                include('../include/config.php');
                $result = mysqli_query($con,"SELECT SUM(cost) as tcost FROM busincome where Month='$month'");
                while($row = $result->fetch_assoc()) 
                {
                  $tot=$row["tcost"];
                }
                ?>
              <div class="info-box-content">
                <span class="info-box-text">Income for the Bus this month (<small><?php echo $month;?></small>)</span>
                <h4 class="info-box-number budge"><?php echo $tot.' Ksh'; ?></h4>
              </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="col-md-4"> 
              <h5 class="m-0 text-success">Add new Income</h5>
                <div class="modal-body">
                  <form action="" method="POST" onsubmit="return false">
                      
                      <div class="form-group">
                      <label for="inputProjectLeader">Car/Bus No.</label>
                      <input type="text" style="font-weight:bold" class="form-control text-danger" name="" id="busno" required />
                     </div>
                     
                      <div class="form-group">
                      <label for="inputProjectLeader">Application date</label>
                      <input type="date" class="form-control" name="" id="hiredate" required />
                     </div>
                      
                      <div class="form-group">
                      <label for="inputProjectLeader">Reservation name</label>
                      <input type="text" class="form-control" name="" id="rename" required />
                      </div>
                      
                      <div class="form-group">
                      <label for="inputProjectLeader">Reservation Contact</label>
                      <input type="text" class="form-control" name="" id="recontact" required />
                      </div>
                      
                      <div class="form-group">
                      <label for="inputProjectLeader">Hiring Cost</label>
                      <input type="text" style="font-weight:bold;font-size:16px" onkeypress="return /[0-9]/i.test(event.key)"  class="form-control text-danger" name="" id="hirecost" required />
                      </div>
                      
                    <div class="form-group">
                      <label for="inputProjectLeader">Account Credited</label>
                       <select id="busbnk" class="form-control custom-select">
                            <option selected value="">Select ---</option>
                            <?php
                            $sql = "SELECT * FROM bankdata";
                            $result = $con->query($sql);
                            while($row = $result->fetch_assoc()) 
                            {
                            ?>
                            <option value="<?php echo $row['id']; ?>"> <?php echo $row['Bname'].'->'; ?> <small><?php echo $row['Account']; ?> </small>
                            </option>
                            <?php
                            }
                            ?>
                     </select>
                      </div>
                      
                      <div class="row">
                      <div class="col-md-12"> 
                      <label for="inputProjectLeader">Hired Period</label>
                      </div>
                      <div class="col-md-6"> 
                      <div class="form-group">
                      <label for="inputProjectLeader">From</label>
                      <input type="date" class="form-control" name="" id="bfromm" required />
                      </div>
                      </div>
                      <div class="col-md-6">
                      <div class="form-group">
                      <label for="inputProjectLeader">To</label>
                      <input type="date" class="form-control" name="" id="btoo" required />
                      </div>
                      </div>
                      </div>
                      
                      <div class="form-group">
                      <label for="inputProjectLeader">Any other Information</label>
                      <textarea class="form-control" id="businfo"> </textarea>
                      </div>
                  
                       <div class="form-group">
                         <label id="bushiremsg" style="color:#FFF">.</label> <br />
                        <button style="margin-right:0px;position:relative" class="btn btn-success btn-sm pull-right" id="btnbussaved">Save <i class="fa fa-save"></i>
                        </button>
                       </div>
                      
                      
                  </form>
                </div>
              </div>
               
             <div class="col-md-8">  
             <div class="table-responsive" id="divbus">
                 <table class="table table-bordered" id="tablebusdata" >
                     <thead>
                         <tr>
                             <th>#</th>
                             <th>Reservation Name</th>
                             <th>Bus/Car Hired</th>
                             <th>Hiring Date</th>
                             <th>Hire Cost</th>
                             <th>Reservation Contact</th>
                             <th>Hiring Period</th>
                             <th>Description</th>
                             <th>Action</th>
                         </tr>
                     </thead>
                     <tbody>
                        <?php
                        //include('../include/config.php');
                        $sql = "select * from busincome order by id DESC";
                        $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["client"]; ?></td>
                        <td class="alert-success"><?php echo $row["busid"]; ?>
                        </td>
                        <td><?php echo $row["Hiredate"]; ?></td>
                        <td><strong><?php echo $row["cost"]; ?></strong></td>
                        <td><?php echo $row["contact"]; ?></td>
                        <td><span class="text-success"><?php echo $row["Hfrom"]; ?></span> to <span class="text-danger"><?php echo $row["Hto"]; ?></span>
                        </td>
                         <td>
                            <?php echo $row["Des"]; ?>
                        </td>
                        <td>
                       
                            <input type="hidden" name="bid" class="busid" value="<?php echo $row["id"]; ?>" />
                         <i class="fa fa-pen btn-xs text-info busedit" id="busedit"></i>
                        |
                        <i class="fa fa-trash btn-xs text-danger busdelete" id="busdelete"></i>
                        </td>
                            </tr>
                            <?php
                            $cnt=$cnt+1;
                            }
                        }
                            ?>
                     </tbody>
                 </table> 
              </div>
              </div>
              
            </div>
    </section>
</div>

