BBnepal-Accounts/application/views/admin/journal-vouchers.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

657 lines
33 KiB
PHP

<style>
table.dataTable tfoot th {
font-weight: 600 !important;
}
.form-group .bootstrap-select>.dropdown-toggle {
padding: 9px 9px !important;
font-size: 12px !important;
border: 1px solid #c8c8c8 !important;
background: #fff !important;
}
.error {
color: red;
font-size: 12px;
}
input[type="number"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
width: 160px;
}
table.dataTable tfoot th {
font-weight: 600 !important;
}
.form-group .bootstrap-select>.dropdown-toggle {
padding: 9px 9px !important;
font-size: 12px !important;
border: 1px solid #c8c8c8 !important;
background: #fff !important;
}
.course_grade_details_table input[type="text"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
}
.course_grade_details_table input[type="number"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
width: 90px;
}
.course_grade_details_table td,
.course_grade_details_table th {
border: 0;
padding: 15px 10px;
}
.course_grade_details_table {
border: 0;
}
.course_grade_details_table td {
text-align: left;
padding: 8px 10px;
}
.course_grade_details_table th {
font-weight: 300;
font-size: 15px;
color: black;
border-bottom: 2px solid #032da1;
}
.scrollable_table thead {
display: table;
width: 100%;
}
.scrollable_table tbody {
display: block;
overflow-y: scroll;
max-height: 400px;
}
.scrollable_table th,
.scrollable_table td {
width: 130px;
font-size: 12px;
}
.scrollable_table tr {
display: table;
width: 100%;
box-sizing: border-box;
}
.scrollable_table th:nth-child(1),
.scrollable_table td:nth-child(1) {
width: 42px;
}
span.margin-t {
margin-top: 5px;
display: block;
}
.bootstrap-select .dropdown-toggle .filter-option {
top: 0px;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<?php
if (!empty($this->session->flashdata('success_msg'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('success_msg'); ?>
</div>
<?php
}
if (!empty($this->session->flashdata('error_msg'))) {
?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Failed!</strong> <?php echo $this->session->flashdata('error_msg'); ?>
</div>
<?php } ?>
<div class="subsec_sec" style="display:block">
<form id="searchFilters" action="<?= base_url(); ?>admin/journal-vouchers" method="POST" onkeydown=" return event.key != 'Enter'">
<div class="subject_lsec dashboard_graph report_sec_graph">
<div class="report_sec_cover" style="margin-bottom: 4px;">
<div class="report_sec_left">
<?php
$f_f_types = array();
$currency_symbol = $school_info['currency_symbol'];
$search_batch = (isset($_POST['f_batch']) && !empty($_POST['f_batch'])) ? $_POST['f_batch'] : '';
$search_course_id = (isset($_POST['f_course']) && !empty($_POST['f_course'])) ? $_POST['f_course'] : '';
$search_section = (isset($_POST['f_section']) && !empty($_POST['f_section'])) ? $_POST['f_section'] : '';
$search_fee_types = (isset($_POST['filter_fee_types']) && !empty($_POST['filter_fee_types'])) ? $_POST['filter_fee_types'] : '';
$theExportHeader = 'Scholarships';
if (isset($school_info) && !empty($school_info)) {
$theExportHeader = $school_info['school_name'] . '\n' . $school_info['address'] . '\n Scholarships';
}
if (count($_POST) > 0) {
if (isset($_POST['filter_fee_types']) && !empty($_POST['filter_fee_types'])) {
$f_f_types = $_POST['filter_fee_types'];
}
}
// print_r($_POST);
?>
</div>
<div class="subject_lhead">Journal Vouchers</div>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-2 pr-0">
<div class="subject-filter">
<label class="has-float-label">
<select id="f_batch" name="f_batch" class="custom-select form-control">
<option value="">Select Batch</option>
<?php if (isset($batches) || !empty($batches)) {
foreach ($batches as $row) {
if ($search_batch != '')
$b_selected = ($row['id'] == $search_batch) ? 'selected' : '';
else
$b_selected = ($row['id'] == $school_info['batch_id']) ? 'selected' : '';
?>
<option value="<?php echo $row['id'] ?>" <?= $b_selected; ?>>
<?php echo $row['b_name']; ?></option>
<?php }
} ?>
</select>
<span>Select Batch <span style="font-weight:bold;color:red;"> * </span></span>
</label>
<div class="text-danger cierr"><?php echo form_error('f_batch'); ?></div>
</div>
</div>
<div class="col-md-2 px-0">
<div class="subject-filter">
<label class="has-float-label">
<select id="f_user_type" name="f_user_type" class="custom-select form-control">
<option value="teacher" <?= $user_type == 'teacher' ? 'selected' : '' ?>>Teacher</option>
<option value="student" <?= $user_type == 'student' ? 'selected' : '' ?>>Student</option>
</select>
<span>Send Notice</span>
</label>
</div>
</div>
<div class="col-md-2 px-0 stdSection">
<div class="subject-filter">
<label class="has-float-label">
<select id="f_course" name="f_course" class="custom-select form-control">
<option value="">Select Class</option>
<?php foreach ($course as $c_value) {
$course_selected = ($c_value['id'] == $search_course_id) ? 'selected' : '';
?>
<option value="<?= $c_value['id']; ?>" <?= $course_selected; ?>><?php echo $c_value['course_name']; ?> </option>
<?php } ?>
</select>
<span>Select Class</span>
</label>
</div>
</div>
<div class="col-md-2 px-0 stdSection">
<div class=" form-group subject-filter">
<label class="has-float-label">
<?php if ($search_course_id != '' && $search_course_id > 0) {
$sql = "SELECT s.id as section_id,s.section_name FROM course_sections cs JOIN section s ON s.id=cs.section_id WHERE cs.course_id='$search_course_id' ORDER BY s.id DESC";
$section_list = $this->Admin_model->get_query_result($sql);
?>
<select id="f_section" id="f_section" name="f_section[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select Section</option>
<?php
if (isset($section_list) && !empty($section_list)) {
foreach ($section_list as $se_val) { ?>
<option value="<?php echo $se_val['section_id'] ?>" <?php if (isset($search_section) && !empty($search_section)) {
echo (in_array($se_val['section_id'], $search_section)) ? 'selected' : '';
} ?>><?php echo $se_val['section_name'] ?></option>
<?php }
} ?>
</select>
<?php } else { ?>
<select id="f_section" id="f_section" name="f_section[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select Section</option>
</select>
<?php } ?>
<span>Select Section</span>
</label>
</div>
</div>
<!-- <div class="col-md-3">
<div class="form-group assign_fee_toall mb-0">
<label class="has-float-label mb-0">
<?php if (!empty($all_fee_types) && count($all_fee_types) > 0) {
?>
<select placeholder="Select Fees type" name="filter_fee_types[]" id="filter_fee_types" class="form-control selectpicker" multiple data-live-search="true" required>
<option value="" disabled> -- Select Fees type -- </option>
<?php
foreach ($all_fee_types as $ft_value) {
$disableStatus = '';
if (count($selected_feetype) != 0) {
if (in_array(8, $selected_fee_types)) {
$disableStatus = '';
} else {
$disableStatus = 'disabled';
}
if ($ft_value['id'] == 8) {
$disableStatus = '';
} else {
$disableStatus = 'disabled';
}
}
?>
<option value="<?= $ft_value['id'] ?>" <?php echo (in_array($ft_value['id'], $f_f_types)) ? "selected" : ""; ?> <?= $disableStatus ?>><?= $ft_value['feetype_name'] ?></option>
<?php
} ?>
</select>
<?php
} else { ?>
<select placeholder="Select Fees type" name="filter_fee_types[]" id="filter_fee_types" class="form-control fees_type_list selectpicker" multiple required>
<option value="" disabled> -- Select Fees type -- </option>
<?php
foreach ($all_fee_types as $ft_value) {
?>
<option value="<?= $ft_value['id'] ?>"><?= $ft_value['feetype_name'] ?></option>
<?php } ?>
</select>
<?php } ?>
<span> Fees Type</span>
</label>
<label id="filter_fee_types-error" class="error mb-0" for="filter_fee_types"></label>
</div>
</div> -->
<div class="col-md-3">
<div class="date-filter">
<input type="submit" name="filtersubmit" id="filter_reset1" class="btn btn-success " style="width:250px;height:40px;" value="Filter">
<a href="<?php echo base_url() ?>admin/total-due-report">
<div class="date-filter"> <button type="button" name="reset_filter" id="reset_filter" value="reset_filter" class="subject_addbtn subject_addbtn_nobg"><i class="fas fa-redo"></i>Reset</button>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<form method="post" id="sendSmsAll" action="<?php echo base_url(); ?>Admin/createVoucher">
<input type="hidden" name="batch_id" id="batch_id">
<input type="hidden" name="course_id" id="course_id">
<input type="hidden" name="user_t" id="userT">
<!-- new divs added -->
<div class="tab-content">
<!-- new divs added -->
<div class="applicnts-list-wrap ">
<?php if ($user_type == 'student') { ?>
<!-- changed ID -->
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<th><input type="checkbox" id="chkParent" /></th>
<th>Roll No</th>
<th>Student Id </th>
<th>Student Name</th>
<th>Class</th>
<th>Section</th>
<!-- <th>Guardian Name</th>
<th>Contact Number</th> -->
<!-- <th>Action</th> -->
</tr>
</thead>
<tbody>
<?php
$sno = 1;
if (isset($students) && !empty($students)) {
foreach ($students as $svalue) {
?>
<tr>
<td>
<?php if (empty($svalue['ledger_account'])) { ?>
<input type="checkbox" name="contact_list[]" value="<?= $svalue['studentId'] ?>" />
<?php } else { ?>
<i class="fa fa-check text-success" aria-hidden="true"></i>
<?php } ?>
</td>
<td><?= $svalue['roll_no']; ?></td>
<td class="text-left"><?= $svalue['studentId']; ?></td>
<td class="text-left"><?= $svalue['student_name']; ?></td>
<td class="text-left"><?= $svalue['course_name']; ?></td>
<td class="text-left"><?= $svalue['section_name']; ?></td>
</tr>
<?php
$sno++;
}
} ?>
</tbody>
</table>
<?php } else { ?>
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<th><input type="checkbox" id="chkParent" /></th>
<th>S.No.</th>
<th>Teacher Id</th>
<th>Designation</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
</tr>
</thead>
<tbody>
<?php
$sno = 1;
if (isset($teachers) && !empty($teachers)) {
foreach ($teachers as $teacher) {
?>
<tr>
<td>
<?php if (empty($teacher['ledger_account'])) { ?>
<input type="checkbox" name="contact_list[]" value="<?= $teacher['teacherId'] ?>" />
<?php } else { ?>
<i class="fa fa-check text-success" aria-hidden="true"></i>
<?php } ?>
</td>
<td><?= $sno; ?></td>
<td class="text-capitalize text-left"><?= $teacher['teacherId']; ?></td>
<td class="text-left">
<?php
$desig = '';
foreach ($hr_designation as $desKey => $designation) {
if ($designation['id'] == $teacher['designation']) {
$desig = $designation['title'];
}
}
?>
<?= !empty($desig) ? $desig : '-' ?>
</td>
<td class="text-left"><?= $teacher['teacher_name']; ?></td>
<td class="text-left">
<div class="email-width" title="<?= $teacher['email']; ?>"><?= $teacher['email']; ?></div>
</td>
<td><?= $teacher['mobile']; ?></td>
</tr>
<?php
$sno++;
}
} ?>
</tbody>
</table>
<?php } ?>
<button type="submit" style="font-size: 14px;padding: 6px 25px; " class="subject_addbtn send_ntice float-right mt-3" id="send_ntice">Create Account</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- admin template section end -->
</main>
<!--End right-top side-->
</div>
<script defer src="<?php echo base_url(); ?>assets_admin/js/bootstrap-select.min.js"></script>
<script>
// $(document).on('click', '#filter_reset1', function() {
// $('#txt-submit').show();
// });
$('#filter_fee_types').change(function() {
$('#filter_fee_types').selectpicker('toggle');
$('#new-dropdown-section').addClass('d-none');
var TotalValues = [];
var selectedValues = [];
$('#filter_fee_types option').each(function() {
let item = $(this).val();
if (item != '') {
TotalValues.push(item);
}
});
$('#filter_fee_types option:selected').each(function() {
let selectItem = $(this).val();
if (selectItem != '')
selectedValues.push(selectItem);
});
const intersection = TotalValues.filter(element => selectedValues.includes(element));
const differValues = TotalValues.filter(element => !selectedValues.includes(element));
if (intersection.length > 0) {
if (intersection.includes("3") || intersection.includes("4") || intersection.includes("8")) {
for (let i = 0; i < intersection.length; i++) {
for (let j = 0; j < differValues.length; j++) {
$("#filter_fee_types option[value='" + differValues[j] + "']").prop('disabled', true);
}
$("#filter_fee_types option[value='" + intersection[i] + "']").prop('disabled', false);
}
} else {
$("#filter_fee_types option[value='3']").prop('disabled', true);
$("#filter_fee_types option[value='4']").prop('disabled', true);
$("#filter_fee_types option[value='8']").prop('disabled', true);
}
} else {
$("#filter_fee_types option").prop('disabled', false);
}
});
$(document).on('click', '.send_ntice', function() {
var studentidlist = [];
let batchId = $('#f_batch option:selected').val();
let courseId = $('#f_course option:selected').val();
let markCount = 0;
if (batchId == '') {
markCount++;
alert("Please Select Batch");
}
if (markCount === 0) {
$.each($("input[name='contact_list[]']:checked"), function() {
var item = $(this).data('studentid');
studentidlist.push(item);
});
if (studentidlist.length === 0) {
alert("Please Select Students" + studentidlist.length);
} else {
// alert("Please Select Students 33333 " + studentidlist.length);
$('#sendSmsAll').submit();
}
}
});
</script>
<script>
$(document).ready(function() {
$('.stdSection').hide();
var userType = '<?= $user_type ?>';
var batchId = '<?= $search_batch ?>';
console.log(userType);
if (userType === 'teacher') {
$('.stdSection').hide();
} else {
$('.stdSection').show();
}
$('#userT').val(userType);
$('#batch_id').val(batchId);
$('#chkParent').click(function() {
var isChecked = $(this).prop("checked");
$('#tbl1 tr:has(td)').find('input[type="checkbox"]').prop('checked', isChecked);
});
$('#tbl1 tr:has(td)').find('input[type="checkbox"]').click(function() {
var isChecked = $(this).prop("checked");
var isHeaderChecked = $("#chkParent").prop("checked");
if (isChecked == false && isHeaderChecked)
$("#chkParent").prop('checked', isChecked);
else {
$('#tbl1 tr:has(td)').find('input[type="checkbox"]').each(function() {
if ($(this).prop("checked") == false)
isChecked = false;
});
console.log(isChecked);
$("#chkParent").prop('checked', isChecked);
}
});
});
$(document).ready(function() {
$("#searchFilters").validate({
rules: {
f_batch: 'required',
// f_course: 'required'
},
submitHandler: function(form, e) {
e.preventDefault();
form.submit();
}
});
});
$('#f_course').change(function() {
var course = $('#f_course option:selected').val();
// alert(course);
var divData = '';
if (course != '' && course != 0) {
$.ajax({
url: "<?php echo base_url(); ?>Admin/get_section_by_course",
method: "POST",
data: {
course_id: course
},
dataType: "json",
success: function(response) {
// console.log(response);
// section options code and start from here
divData += "<option value='' disabled> Select Section </option>";
if (response.sections != '') {
$.each(response.sections, function(i, sectiondata) {
divData += "<option value='" + sectiondata.section_id + "'>" + sectiondata.section_name + "</option>";
});
}
// $('#course_error_msg').text();
else {
divData += "<option value=''> -- No Section's Found --</option>";
}
$('#f_section').empty().append(divData).selectpicker("refresh");
// section options code here End from here
}
});
} else {
divData = "<option value=''> -- Select Section -- </option>";
$('#f_section').empty().append(divData);
}
});
$('#f_user_type').change(function() {
var userType = $('#f_user_type option:selected').val();
// alert(course);
if (userType === 'teacher') {
$('.stdSection').hide();
} else {
$('.stdSection').show();
}
$('#userT').val(userType);
});
$(document).ready(function() {
$('.user-drpdown').click(function() {
$('.drpdown-items').toggle();
});
var currency_symbol = "<?php echo $currency_symbol; ?>";
var jsTheExportHeader = '<?php echo $theExportHeader; ?>';
//table js
$('#tbl1').DataTable({
"lengthMenu": [
[50, -1],
[50, "All"]
],
});
//table js end
//multiple select js start
$('#f_section').selectpicker();
$('#f_feetype').selectpicker();
//multiple select js end
});
</script>
</body>
</html>