JezK
Edit File: fee_management.php
<?php session_start(); include('session_check.php'); include('adm_operations.php'); include("menuheader.php"); $operations = new adm_operations(); if (!(in_array(6, $access) && in_array(6, $allow))) echo "<script>location.replace('dashboard.php');</script>"; $fee = 0; if (isset($_GET['term_del'])) { $termdelete = $operations->deleteFeeTermByid($_GET['term_del']); if ($termdelete == 'ok') { echo '<script>window.location.reload("fee_management.php");</script>'; } } $class = $operations->getallClassesforOrder($_SESSION['child']['log_school_id'], $_SESSION['child']['choosen_academic_id']); // get all classes of a school $clsoptions = '<option value="0">--Select Class--</option>'; $scnoptions = '<option value="0">--Select Section--</option>'; if (!empty($class)) { foreach ($class as $cls) if ($_GET['cln'] == $cls['class_id']) $clsoptions .= "<option value='" . $cls['class_id'] . "' selected>" . $cls['class_name'] . "</option>"; else $clsoptions .= "<option value='" . $cls['class_id'] . "' >" . $cls['class_name'] . "</option>"; } if (isset($_GET['cln']) && isset($_GET['scn'])) { $sections = $operations->getallsectionsdetailsbyclassId($_GET['cln']); foreach ($sections as $sec) if ($_GET['scn'] == $sec['section_id']) $scnoptions .= "<option value='" . $sec['section_id'] . "' selected>" . $sec['section_name'] . "</option>"; else $scnoptions .= "<option value='" . $sec['section_id'] . "'>" . $sec['section_name'] . "</option>"; $fee = $operations->getfeetermsBySchool($_SESSION['child']['log_school_id'], $_GET['cln'], $_GET['scn'], $_SESSION['child']['choosen_academic_id']); } ?> <style> #nav { margin: auto; width: 300px !important; padding-left: 0; padding-right: 0; list-style: none; background: #18b88d; } #nav li { display: inline-block; margin: 0 auto; text-align: center; } #nav li a { display: inline-block; padding: 7px 0; text-align: center; text-decoration: none; color: #FFFFFF; margin: auto; } #nav li:hover, li:active { background-color: rgb(54, 120, 102); width: 90px; } #nav li.selected { background: rgb(54, 120, 102); } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } .table-condensed>thead>tr>th, .table-condensed>tbody>tr>th, .table-condensed>tfoot>tr>th, .table-condensed>thead>tr>td, .table-condensed>tbody>tr>td, .table-condensed>tfoot>tr>td { padding: 3px; } </style> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;"> <div class="col-md-9 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px;"> <img src="images/rupee-black.png" title="Fee Management " style="margin: -6px 0px 0px 19px;" />Fee Management </div> <div class="col-md-2 text-center" style="float:right;"> <button type="button" onClick="location.href='add_feeschedule.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;">Add Fee Schedule</button> </div> </div> <br> <div class="menuu"> <ul id="nav" class="margn_auto text-center "> <li class="selected" style="border-right:1px solid #FFFFFF;width:150px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"> <a href="fee_management.php"><img src="images/free-account_white.png" title="Fee Schedule" style="margin-right:5px;" />Fee Schedule</a> </li> <li style="width:152px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"> <a href="fee_accounts.php"><img src="images/exam-schedule_white.png" title="Fee Accounts" style="margin-right:5px;" />Fee Accounts</a> </li> </ul> </div> <div class="row" style="margin-top: 30px;"> <div class="col-md-9 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:20px; margin-left:23px; "> <img src="images/free-account_white.png" style="background-color:black;width:22px;" title="Fee Schedule" /> Fee Schedule </div> </div> <form class="form-horizontal" style="margin-top:20px; "> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px; "> <div class="clearfix"> <div class="form-group row col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 text-md-end"> <b style="color:#666666; ">Class</b> <span style="color:#FF0000;">*</span> </div> <div class="col-md-7"> <select class="form-select" id="classname" name="classname" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" onchange="classchange()"> <?php echo $clsoptions; ?> </select> </div> </div> </div> <div class="clearfix"> <div class="form-group row col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 text-md-end"> <b style="color:#666666; ">Section</b> <span style="color:#FF0000;">*</span> </div> <div class="col-md-7"> <select class="form-select" id="sectionname" name="sectionname" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" onchange="sectionchange()"> <?php echo $scnoptions; ?> </select> </div> </div> </div> </div> </form> <div class="row" style="margin-left:10px;margin-right:10px;"> <div class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;margin-top:10px;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:-10px;"> <thead> <tr class="info"> <th class="col-md-1 text-center">Sl.No</th> <th>Term Name</th> <th>Due Date</th> <th>Amount</th> <th>Actions</th> </tr> </thead> <tbody> <?php $nums = 1; if ($fee != '0') foreach ($fee as $terms) { echo '<tr> <td class="col-sm-1 text-center" style=" font-size:14px;">' . $nums . '</td> <td style=" font-size:14px;">' . $terms[term_name] . '</td> <td style=" font-size:14px;">' . date('d/m/Y', strtotime(str_replace('-', '/', $terms[term_duedate]))) . '</td> <td style="font-size:14px;"><span>₹</span> <span> ' . number_format($terms[term_amount]) . '</span></td> <td class="center"> <a class=" buttonn" href="update_feeschedule.php?fsd=' . $terms['term_id'] . '" style="margin:4px;"> <i class="fa-solid fa-pencil" title ="Edit" style="font-size: 14px; color:#01aee6;"></i> </a> <a class=" buttonn" style="margin:4px;" onclick="deltheterm(' . $terms['term_id'] . ')"> <i class=" fa-solid fa-xmark" title="Delete" style="font-size: 14px; color:#01aee6;"></i> </a> </td> </tr>'; $nums++; } ?> </tbody> </table> </div> </div> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.1.2/js/dataTables.buttons.min.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.print.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.html5.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script> <script type="text/javascript"> $(document).ready(function() { /*$('#myTable').DataTable({ "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3] } ] } } ); $('div.dataTables_filter input').attr('placeholder', 'Search'); */ var classname = $('#classname').find('option:selected').text(); var secname = $('#sectionname').find('option:selected').text(); $('#myTable').DataTable({ dom: 'B<"clear">lfrtip', "iDisplayLength": 100, stateSave: true, buttons: [{ extend: 'print', title: '<center><h3><?php echo $_SESSION['child']['school_name'] ?></h3></center>', message: 'Fee Management<br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?>   Class:' + classname + '   Section:' + secname + '<br>', exportOptions: { columns: [0, 1, 2, 3] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'Fee Management\nAcademic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\t Class:' + classname + '\tSection:' + secname + '\n', exportOptions: { columns: [0, 1, 2, 3] } }, { extend: 'excelHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', exportOptions: { columns: [0, 1, 2, 3] } } ] }); }); </script> <script> function classchange() { var x = $('#classname').val(); if (x == 0) { section_option = '<option value="0">--Select Section--</option>'; $("#sectionname").html(section_option); return false; } else { $.ajax({ url: "ajaxcalls_attn.php", type: "POST", data: "mode=" + "choose_class" + "&data=" + x, success: function(result) { var result2 = eval("(" + result + ")"); var section_option = '<option value="0">--Select Section--</option>'; for (var i = 0; i < result2.length; i++) { section_option += '<option value="' + result2[i].section_id + '">' + result2[i].section_name + '</option>'; } $("#sectionname").html(section_option); }, error: function(e) { alert(e); } }); } } function sectionchange() { var varc = $('#classname').val(); var vars = $('#sectionname').val(); if (varc != 0 && vars != 0) window.location.href = "fee_management.php?cln=" + varc + "&scn=" + vars; } function deltheterm(tid) { var c = $("#classname").val(); var s = $("#sectionname").val(); if (confirm("Do you want to delete this Fee Term ?")) { $.post("termdeleteajax.php", { term_del: tid }, function(data) { if (data == 'ok') { window.location.reload(); } else { alert("This Term can not be deleted as there is data associated with it"); } }); } } </script> </body> </html>