BBnepal-Accounts/application/views/admin/total_due_report.php

414 lines
20 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<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;
}
</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">
<div class="subsec_sec" style="display:block">
<div class="subject_lsec dashboard_graph report_sec_graph">
<div class="report_sec_cover">
<div class="report_sec_left">
<?php
$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'] : '';
$theExportHeader = 'The Due Reports';
$today_date_time_array = explode(' ', $today_date);
// $today_date_array = $today_date_time_array[0];
$today_date_array = explode('-', $today_date_time_array[0]);
$current_year = $today_date_array[0];
if (isset($school_info) && !empty($school_info)) {
$theExportHeader = $school_info['school_name'] . '\n' . '\n Due Reports - ' . $current_year;
}
?>
</div>
<div class="subject_lhead">Due Reports</div>
<form id="searchFilters" action="<?= base_url(); ?>admin/total-due-report" method="POST">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-3">
<div class="subject-filter">
<label>Select Batch <span style="font-weight:bold;color:red;"> * </span></label>
<select id="f_batch" name="f_batch" class=" 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>
<div class="text-danger cierr"><?php echo form_error('f_batch'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="subject-filter">
<label>Select Course <span style="font-weight:bold;color:red;"> * </span></label>
<select id="f_course" name="f_course" class=" form-control">
<option value="">Select Course</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>
</div>
</div>
<div class="col-md-3">
<div class=" form-group subject-filter">
<label>Select Section</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 } ?>
</div>
</div>
<div class="col-md-3">
<div class="date-filter pt-4">
<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>
</form>
</div>
</div>
<!-- new divs added -->
<div class="tab-content">
<!-- new divs added -->
<div class="applicnts-list-wrap ">
<div class=" ">
<!-- changed ID -->
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<th>S.No</th>
<th>Roll No</th>
<th>Student Id </th>
<th>Student Name</th>
<!-- <th>Course</th> -->
<th>Section</th>
<th>Total Assigned Amount</th>
<th>Paid Amount</th>
<th>Due Amount</th>
<th>Contact No</th>
<!-- <th>Action</th> -->
</tr>
</thead>
<tbody>
<?php
//dd($student_fees);
$sno = 1;
if (isset($student_fees) && !empty($student_fees)) {
foreach ($student_fees as $svalue) {
?>
<tr>
<td><?= $sno; ?></td>
<td><?= $svalue['roll_no']; ?></td>
<td><?= $svalue['studentId']; ?></td>
<td><?= $svalue['student_name']; ?></td>
<!-- <td><?= $svalue['course_name']; ?></td> -->
<td><?= $svalue['section_name']; ?></td>
<td><?= $svalue['total_assigned_amount']; ?></td>
<td><?= $svalue['total_paid_amount']; ?></td>
<td><?= $svalue['total_pending_amount']; ?></td>
<td><?= $svalue['emergency_contact_number']; ?></td>
<!-- <td>
<form method="post" action="<?php echo base_url(); ?>admin/total-due-report">
<input type="text" name="contact_number" value="<?= $svalue['emergency_contact_number']; ?>">
<input type="submit" name="send_alert" class="btn btn-sm subject_addbtn" style="padding: 6px 20px; font-size: 14px;" value="Send Alert">
</form>
</td> -->
</tr>
<?php
$sno++;
}
} ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<!-- <th> </th> -->
<th></th>
<th></th>
<th style="font-size:13px;" class="text-center"> Total<br>(In <?= $currency_symbol; ?>)</th>
<th style="font-size:13px;" class="text-center"></th>
<th style="font-size:13px;" class="text-center"></th>
<th style="font-size:13px;" class="text-center"></th>
<th></th>
<!-- <th></th> -->
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</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).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);
}
});
$(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({
"bLengthChange": false,
"dom": 'lBfrtip',
"paging": false,
"fixedHeader": {
header: true,
footer: true
},
"buttons": [{
extend: 'pdfHtml5',
// orientation: 'landscape',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
},
orientation: 'landscape',
pageSize: 'A4',
header: true,
footer: true,
title: jsTheExportHeader,
customize: function(doc) {
var rowCount = document.getElementById("tbl1").rows.length;
var theTdCnt = 9;
for (i = 0; i < rowCount; i++) {
for (j = 0; j < theTdCnt; j++) {
doc.content[1].table.body[i][j].alignment = 'center';
}
}
},
},
{
extend: 'csvHtml5',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
},
// messageTop: 'The information in this table is copyright to Sirius Cybernetics Corp.'
},
{
extend: 'excelHtml5',
header: true,
footer: true,
title: jsTheExportHeader,
exportOptions: {
columns: "thead th:not(.noExport)",
rows: function(indx, rowData, domElement) {
return $(domElement).css("display") != "none";
}
},
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
$('row c[r^="C"]', sheet).attr('s', '2');
}
}
],
"footerCallback": function(row, data, start, end, display) {
for (let td_count = 5; td_count <= 7; td_count++) {
var api = this.api(),
data;
// Remove the formatting to get integer data for summation
var intVal = function(i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '') * 1 :
typeof i === 'number' ?
i : 0;
};
// Total over all pages
total = api
.column(td_count)
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
// Total over this page
pageTotal = api
.column(td_count, {
page: 'current'
})
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
$(api.column(td_count).footer()).html(
//currency_symbol + ' ' + pageTotal + ' ( ' + currency_symbol + ' ' + total + ' total )'
pageTotal
);
}
}
});
//table js end
//multiple select js start
$('#f_section').selectpicker();
$('#f_feetype').selectpicker();
//multiple select js end
});
</script>
</body>
</html>