/home3/vehiclea/public_html/admin-appleiitfoundationschools-com/billBookEntry.php
<?php
session_start();
$_SESSION['active'] = 'billEntry';

  ini_set('max_execution_time', 60000);

   include('include/header.php');

 
   $select_branch = select_branch();
  $select_category = selectBillCategory();
  $selectBillCategoryLimit = selectBillCategoryLimit();
  // $select_debit_data = select_debit_data();
  $selectAcademicYear = select_academic();
  $select_category = selectBillCategory();
?>

<main id="main" class="main">

<div class="pagetitle">
      <h1>School Data</h1>
  <nav>
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="index.php">Home</a></li>
      <li class="breadcrumb-item ">Billbook Credit</li>
    </ol>
  </nav>
</div>
<section class="section">
      <div class="row">
        <div class="col-lg-12">

          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Billbook Credit Entry</h5>

<?php
  
 if(!empty($_POST['submit'])){

     $billBookEntry = executework("INSERT into billBookList (billNo,academicYear,branch_name,category_name,amount,date,reason,created_date,workingUser) values ('".$_POST['billNo']."','".$_POST['academicYear']."','".$_POST['branch_name']."','".$_POST['category_name']."','".$_POST['amount']."','".date('Y-m-d',strtotime($_POST['date']))."','".$_POST['reason']."','".date('Y-m-d')."','".$_POST['workingUser']."')");

    redirect("billBookEntry.php?succ=1");
  }

  if(!empty($_GET['failed'])){
     ?>
   <div align="center"><h4 style="color:red;">Already Billbook Debit Inserted </h4></div>
     <?php
  }
?>

 <?php
   if(!empty($_GET['succ'])){
     ?>
     <div align="center"><h4 style="color:green;">Billbook Debit Inserted Successfully </h4></div>
     <?php
  }
?>
     <form method="post" onsubmit=" return book_validation()">
               <div class="row">  
        <input type="hidden" name="edit_data" id="edit_data" value="<?= $academic['id']?>">
        
                      <div class="col-md-3">
                        <label class="form-label">Academic Year</label> 
                        <select name="academicYear" class="form-control" id="academicYear" onchange="ChangeDate()">
                                <option value="">Please Select Academic Year</option>
                                <?php
                                while($academicYear = mysqli_fetch_array($selectAcademicYear))
                                {
                                ?>
                                <option value="<?= $academicYear['yearOf']?>"> <?= $academicYear['yearOf'] ?> </option>
                                <?php } ?>
                             </select>

                        
                    </div>

                    <div class="col-md-3">
                         <label for="exampleInputEmail1" class="form-label">Bill No</label>
                        <input type="text" class="form-control noSpace" id="billNo" name="billNo" placeholder="Enter Bill Number">
                    </div>

        
      
                      <div class="col-md-3">
                        <label for="exampleInputEmail1" class="form-label">Date</label>
                        <input type="text" class="form-control" id="datepicker" name="date" readonly placeholder="Select Date"> 
                       </div>
                       <?php if($_SESSION['user'] == 'admin') { ?>
                       <div class="col-md-3">
                         <label for="exampleInputEmail1" class="form-label">Branch Name</label>
                            <select name="branch_name" id="branch_name" class="form-control">
                                <option value="">Please Select Branch</option>
                                <?php
                                while($branch = mysqli_fetch_array($select_branch)){
                                ?>
                                <option value="<?= $branch['branch_name']?>"><?= $branch['branch_name']?></option>
                                <?php }?>
                             </select>
                      </div>



                    <?php } else { ?>  
                    <div class="col-md-3">
                         <label for="exampleInputEmail1" class="form-label">Branch Name</label>
                        <input type="text" class="form-control" id="branch_name" value="<?php echo $_SESSION['branchName']; ?>" name="branch_name" readonly>
                    </div>  
                    <?php } ?>

                      <div class="col-md-3">
                         <label for="exampleInputEmail1" class="form-label">Category Name</label>
                            <select name="category_name" id="category_name" class="form-control">
                                <option value="">Please Select Category</option>
                                <?php
                                while($category = mysqli_fetch_array($select_category)){
                                ?>
                                <option value="<?= $category['category_name']?>"><?= $category['category_name']?></option>
                                <?php }?>
                            </select>
                       </div>

                    <div class="col-md-3">
                         <label for="exampleInputEmail1" class="form-label">Amount</label>
                        <input type="text" class="form-control noSpace" id="amount" name="amount" placeholder="Enter Amount">
                    </div>
                     <input type="hidden" name="workingUser" value="<?php echo $_SESSION['user']; ?>">
                      <div class="col-md-3">
                       <label for="exampleInputEmail1" class="form-label">Reason</label>
                       <textarea id="reason" name="reason" class="form-control" placeholder="Enter Reason"></textarea>
                    </div>
                     <div class="col-md-3">
                       <label for="exampleInputEmail1" class="form-label">Type</label>
                       <input type="text"  id="type" name="type" class="form-control" value="Credit" readonly>
                    </div>


                   <!--  datepicker -->


                   
                  </div>
                  <div class="mt-4">
                    <input type="submit" class="btn" value="Add" name="submit" style="background-color: #69F0AE; color: #000000;">
                  </div>
                </form> 

                <h5 class="card-title">Reports</h5>


                 <table class="table datatable">
                <thead style="background-color:#7E57C2; color: #ffff;">
                  <tr> 
                    <th scope="col" style="display: none;">Id</th> 
                    <th scope="col">Bill No</th>
                    <th scope="col">Academic Year</th>
                    <th scope="col">Date</th>
                    <th scope="col">Branch Name</th> 
                    <th scope="col">Category</th> 
                    <th scope="col">Reason</th>  
                    <th scope="col">Amount</th>  
                  </tr>
                </thead> 
                        <tbody>
                          <?php 
                            
                           while ($billBook_dataRec = mysqli_fetch_array($selectBillCategoryLimit)) 
                           { 
                          ?>
                          <tr>
                            <td style="display: none"><?php echo $billBook_dataRec['id']; ?></td> 
                            <td><?php echo $billBook_dataRec['billNo']; ?></td>
                            <td><?php echo $billBook_dataRec['academicYear']; ?></td>  
                            <td><?php echo date('d-M-Y',strtotime($billBook_dataRec['date'])); ?></td>  
                            <td><?php echo $billBook_dataRec['branch_name']; ?></td> 
                            <td><?php echo $billBook_dataRec['category_name']; ?></td>
                            <td><?php echo $billBook_dataRec['reason']; ?></td>  
                            <td><?php echo $billBook_dataRec['amount']; ?></td>  
                         </tr> 
                       <?php } ?>
                     </tbody>
                   </table> 


                



              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  
   

</main><!-- End #main -->  
 
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>


  <script>
    function book_validation()
    {
      
        var billNo = $('#billNo').val()
        var branchname = $('#branch_name').val();
        var category_name = $('#category_name').val();
        var price = $('#price').val();
        var academicYear = $('#academicYear').val();
        var price = $('#amount').val();
        var datepicker = $('#datepicker').val();
        var reason = $('#reason').val(); 
        if(academicYear == '')
        {
          swal('Please Select academic year');
          return false;
        }
        else if(billNo == '')
        {
          swal('Please Enter Bill Number');
          return false;
        }
        
           else if(datepicker == '')
        {
          swal('Please Select Date');
          return false;
        }
        else if(branchname == '')
        {
          swal('Please Enter Branch Name');
          return false;
        }
       else if(category_name == '')
        {
          swal('Please Enter Category Name');
          return false;
        }
        else if(price == '')
        {
          swal('Please Enter price');
          return false;
        } 
        else if(isNaN(price))
        {
          swal('Please Enter Numbers only');
          return false;
        } 
        else{
          return true;
        }
    }
  </script>
<script>  
   $("#academicYear").change(function() { 



    // $("#datepicker").on("change",function(){

    var dateSel = $("#academicYear").val();
    var splitData = dateSel.split("-"); 
    // var year1 = splitData[0];
    // var year2 = '20'+splitData[1]; 

    
}); 
   var year1 = '2015';
    var year2 = '2016'; 


    $(function() { 
    $("#datepicker").datepicker({
      onclick: function(){
        table.draw();
     
      },
      // minDate: '1-Jan-'+ year1,
      // maxDate: '31-Dec-'+ year2,
      dateFormat: "dd-M-yy",
      type:  'datetime', 
      changeMonth: true,
      changeYear: true 
    }); 
    });  

  $('.noSpace').keyup(function() {
 this.value = this.value.replace(/\s/g,'');
});
</script>
  <?php include('include/footer.php'); ?>
@LwBee Strong Bypass

LwBee Strong Bypass Mini Shell

Upload File

Create New File