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

496 lines
28 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;
}
</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'] : '';
$search_feetype = (isset($_POST['f_feetype']) && !empty($_POST['f_feetype'])) ? $_POST['f_feetype'] : '';
$search_start_paid_date = (isset($search_start_paid_date) && !empty($search_start_paid_date)) ? $search_start_paid_date : '';
$search_end_paid_date = (isset($search_end_paid_date) && !empty($search_end_paid_date)) ? $search_end_paid_date : '';
$search_payment_status = (isset($_POST['payment_status']) && !empty($_POST['payment_status'])) ? $_POST['payment_status'] : '';
$theExportHeader = 'The Fee Revert Reports';
if (isset($school_info) && !empty($school_info)) {
$theExportHeader = $school_info['school_name'] . '\n' . $school_info['address'] . '\n Invoice Reports \n';
}
if (count($_POST) > 0) {
if ($search_start_paid_date != '')
$theExportHeader .= ' From ' . $search_start_paid_date;
if ($search_end_paid_date != '')
$theExportHeader .= ' To ' . $search_end_paid_date;
}
// print_r($_POST);
?>
</div>
<div class="subject_lhead"><?php echo ucfirst($search_payment_status) ?> Reports</div>
<form id="searchFilters" action="<?= base_url(); ?>admin/due-reports" 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="form-group subject-filter">
<label>Select FeeType</label>
<select id="f_feetype" name="f_feetype[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select FeeType</option>
<?php foreach ($fees_types as $ft_value) {
?>
<option value="<?= $ft_value['id']; ?>" <?php if (!empty($search_feetype)) {
echo (in_array($ft_value['id'], $search_feetype)) ? 'selected' : '';
} ?>><?= $ft_value['feetype_name']; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="date-filter">
<div class="date-fil-row">
<label>Select Start Date</label>
<input type="text" name="f_start_paid_date" class="form-control w-100 nepal-date" value="<?php echo $search_start_paid_date; ?>" placeholder='dd-mm-yyyy'>
</div>
</div>
</div>
<div class="col-md-3">
<div class="date-filter">
<div class="date-fil-row">
<label>Select End Date</label>
<input type="text" name="f_end_paid_date" class="form-control w-100 nepal-date" value="<?php echo $search_end_paid_date; ?>" placeholder='dd-mm-yyyy'>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group subject-filter">
<label>Payment Status <span style="font-weight:bold;color:red;"> * </span></label>
<select id="payment_status" class="form-control payment_status w-100" name="payment_status">
<option value=""> Select Status </option>
<?php $payment_status_arr = array('paid');
foreach ($payment_status_arr as $ps_val) {
?>
<option value='<?php echo $ps_val; ?>' <?php if ($search_payment_status != '') {
echo ($ps_val == $search_payment_status) ? 'selected' : '';
} ?>><?php echo ucfirst($ps_val) ?></option>
<?php } ?>
</select>
</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/due-reports">
<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 Name</th>
<th>Course</th>
<th>Section</th>
<?php
if (isset($selected_feetype) && !empty($selected_feetype)) {
foreach ($selected_feetype as $sftypes) {
?>
<th><?php echo $sftypes['feetype_name']; ?></th>
<?php
}
}
?>
<th>Total Assigned Amount</th>
<th>Paid Amount</th>
<th>Diduction Amount</th>
<th>Fine Amount</th>
<th>Due Amount</th>
<th>Due Amount</th>
</tr>
</thead>
<tbody>
<?php
// dd($students);
$tdCnt = 1;
if (isset($students) && !empty($students)) {
$sno = 1;
foreach ($students as $student) {
$tdCnt = 10;
?>
<tr>
<td><?php echo $sno; ?></td>
<td><?php echo $student['roll_no']; ?> </td>
<td><?php echo $student['name'] ?> </td>
<td><?php echo $student['course_name'] ?> </td>
<td><?php echo $student['section_name'] ?> </td>
<?php
if (isset($selected_feetype) && !empty($selected_feetype)) {
$theRowTotalAssignedAmt = 0;
$theRowTotalPaidAmt = 0;
$theRowTotalDiscoutAmt = 0;
$theRowTotalFineAmt = 0;
$theRowTotaldueAmt = 0;
foreach ($selected_feetype as $sftypes) {
$theRowTotalAssignedAmt = ($theRowTotalAssignedAmt + $student[$sftypes['id']]['total_assigned_amount']);
$theRowTotalPaidAmt = ($theRowTotalPaidAmt + $student[$sftypes['id']]['total_paid_amount']);
$theRowTotalDiscoutAmt = ($theRowTotalDiscoutAmt + $student[$sftypes['id']]['total_diduction_amount']);
$theRowTotalFineAmt = ($theRowTotalFineAmt + $student[$sftypes['id']]['total_fine_amount']);
$theRowTotaldueAmt = ($theRowTotaldueAmt + $student[$sftypes['id']]['total_pending_amount']);
?>
<th><?php echo $student[$sftypes['id']]['total_paid_amount']; ?></th>
<?php
$tdCnt++;
}
}
?>
<td><?php echo $theRowTotalAssignedAmt; ?> </td>
<td><?php echo ($theRowTotalPaidAmt - $theRowTotalFineAmt); ?> </td>
<td><?php echo $theRowTotalDiscoutAmt; ?> </td>
<td><?php echo $theRowTotalFineAmt; ?> </td>
<td><?php echo $theRowTotaldueAmt; ?></td>
</tr>
<?php $sno++;
}
} ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th>In <?php echo $currency_symbol; ?></th>
<?php
if (isset($selected_feetype) && !empty($selected_feetype)) {
foreach ($selected_feetype as $sftypes) {
?>
<th style='font-size: 14px;'></th>
<?php
}
}
?>
<th style='font-size: 14px;'></th>
<th style='font-size: 14px;'></th>
<th style='font-size: 14px;'></th>
<th style='font-size: 14px;'></th>
<th style='font-size: 14px;'></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',
payment_status: '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 theTdCnt = '<?php echo $tdCnt; ?>';
var theTdStr = new Array();
for (let n = 0; n < theTdCnt; n++) {
theTdStr.push(n);
}
//alert(theTdCnt);
var jsSdate = '<?php echo $search_start_paid_date; ?>';
var jsTdate = '<?php echo $search_end_paid_date; ?>';
//alert(jsSdate+' = '+jsTdate);
var jsTheExportHeader = '<?php echo $theExportHeader; ?>';
console.log(jsTheExportHeader);
$('#tbl1').DataTable({
"lengthMenu": [
[100, -1],
[100, "All"]
],
"dom": 'lBfrtip',
"buttons": [{
extend: 'pdfHtml5',
// orientation: 'landscape',
// exportOptions: {
// columns: [0,1,2,3,4,5],
// },
header: true,
footer: true,
title: jsTheExportHeader,
customize: function(doc) {
var rowCount = document.getElementById("tbl1").rows.length;
//alert(rowCount);
for (i = 0; i < rowCount; i++) {
for (j = 0; j < theTdCnt; j++) {
doc.content[1].table.body[i][j].alignment = 'center';
}
}
doc.styles.table = {
alignment: 'center'
}
},
orientation: 'landscape',
pageSize: 'LEGAL'
// messageTop: 'The information in this table is copyright to Sirius Cybernetics Corp.'
},
{
extend: 'csvHtml5',
exportOptions: {
columns: theTdStr,
},
messageTop: 'The information in this table is copyright to Sirius Cybernetics Corp.'
}
],
"footerCallback": function(row, data, start, end, display) {
//var theDynTdCnt = (theTdCnt - 7);
for (let fi = 5; fi < theTdCnt; fi++) {
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(fi)
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
// Total over this page
pageTotal = api
.column(fi, {
page: 'current'
})
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
$(api.column(fi).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>