/home3/vehiclea/public_html/admin-appleiitfoundationschools-com/testing.php
<?php
include('include/header.php');
$select_branch = select_branch();
$select_category = select_category();
$select_creditDataLimit = select_creditDataLimit();
$selectAcademicYear = select_academic();
?>
<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 active">Daybook Credit</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">Daybook Credit Entry</h5>
<?php
if(!empty($_POST['submit'])){
daybookcreate_insert();
}
if(!empty($_GET['failed'])){
?>
<div align="center"><h4 style="color:red;">Already Vocher Number Inserted </h4></div>
<?php
}
?>
<?php
if(!empty($_GET['succ'])){
?>
<div align="center">
<h4 style="color:green;">Data Insert 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" id="academicYear" class="form-control">
<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">Voucher No</label>
<input type="text" class="form-control noSpace" id="vNum" name="vNum" placeholder="Enter Voucher No">
</div>
<div class="col-md-3">
<label for="exampleInputEmail1" class="form-label">Date</label>
<input class="form-control" id="datepicker" name="selectdate" type="text" 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']?>"><?= $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" placeholder="Enter 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" placeholder="Enter Amount">
</div>
<div class="col-md-3">
<label for="exampleInputEmail1" class="form-label">Type</label>
<input type="text" class="form-control" id="type" value="Credit" name="type" readonly>
</div>
</div>
<div class="mt-4">
<input type="submit" class="btn btn-primary" value="Submit" name="submit" id="submit">
</div>
</form>
<h5 class="card-title">Reports</h5>
<table class="table datatable">
<thead>
<tr role="row">
<th scope="col" style="display: none;">Id</th>
<th scope="col">Academic Year</th>
<th scope="col">Voucher No</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
$i=1;
while($selectCredit = mysqli_fetch_array($select_creditDataLimit))
{
?>
<tr>
<td style="display: none"><?php echo $selectCredit['id']; ?></td>
<td><?php echo $selectCredit['academicYear']; ?></td>
<td><?php echo $selectCredit['VocherNumber']; ?></td>
<td><?php echo date('d-M-Y',strtotime($selectCredit['date'])); ?></td>
<td><?php echo $selectCredit['branch_name']; ?></td>
<td><?php echo $selectCredit['category_name']; ?></td>
<td><?php echo $selectCredit['reason']; ?></td>
<td><?php echo $selectCredit['amount']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
</main><!-- End #main -->
<script src="https://code.jquery.com/jquery-1.11.1.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 academicYear = $('#academicYear').val();
var price = $('#amount').val();
var datepicker = $('#datepicker').val();
var VocherNumber = $('#vNum').val();
var vouch_regex=/([0-9])/;
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(vouch_regex.test(VocherNumber)==false ){
swal('Please Enter one Number');
return false;
}
else{
return true;
}
}
$( function() {
$("#datepicker").datepicker({
dateFormat: "d-M-yy",
type: 'datetime',
onClick: function() {
table.draw();
},
changeMonth: true,
changeYear: true
})
});
</script>
<script>
$('.noSpace').keyup(function() {
this.value = this.value.replace(/\s/g,'');
});
</script>
<?php include('include/footer.php'); ?>
@LwBee Strong Bypass
Upload File
Create New File