EVOLUTION-NINJA
Edit File: attendance_report.php
<?php $this->load->view('includes/header.php')?> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/grid_style.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid-bootstrap-ui.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/bootstrap-datetimepicker.min.css'); ?>" /> <script type="text/ecmascript" src="<?php echo base_url('assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/ecmascript" src="<?php echo base_url('assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <script src="<?php echo base_url('assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/moment.js'); ?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap-datetimepicker.min.js'); ?>"></script> <script src="<?php echo base_url('assets/js/jquery.table2excel.js'); ?>" type="text/javascript"></script> <div class="content-wrapper"> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="#">HR</a></li> <li class="breadcrumb-item">Attendence Report</li> </ol> </div> </div> </div> </div> <div class="row print_button"> <div class="col-md-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h3 style="text-align: center;" class="page-title"> Employee Attendance Report </h3><br> <form class="filter_choice_submit"> <div class="row" style="padding-top: 30px;"> <div class="col-sm-4"> <div class="form-group"> <label>From Date</label> <input type="text" name="report_date" class="form-control report_date" id="from_date" > </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>To Date</label> <input type="text" name="report_date" class="form-control report_date" id="to_date" > </div> </div> <div class="col-sm-4 months"> </div> <div class="col-sm-4"> <div class="form-group"> <label>Employee</label> <select name="employee" class="form-control employee" id="employee"> <option value="">Select Employee</option> <option value="All">All</option> <?php foreach($employee_type as $key => $value) { ?> <option value="<?php echo $value->emp_id; ?>"><?php echo $value->full_name;?> </option> <?php } ?> </select> </div> </div> </div> <div class="row " style="padding-top: 30px;"> <div class="form-group"> <div class="col-sm-6"> <button type="button" class="btn btn-primary get_report">Submit</button> <a href="<?php echo site_url('employee-list');?>"><button type="reset" class="btn btn-secondary">Cancel</button></a> </div> </div> </div> </form> <div id ="datejaytab" style="margin-top:3%" class="grid table-responsive"> <table id="datelist1"></table> <div id="datepager1"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> <div style="display:none;"> <table border="1" style="border-spacing: 0px !important;" id="status_export_table" class="status_export_table"> </table> </div> </div> </div> </div> </div> <!-- row --> <div class="row total_no_w_hourse"> <button type="button" onclick="print_page();" class="btn btn-primary print_button" style="margin-bottom: 20px;margin-left: 15px;">Print</button> <div class="table-responsive" style="text-align:center;"> <h4>Total No. Of Working Hours</h4> <table class="table table-bordered w-auto" id="print_table"> <thead> <tr> <th>Sl.No.</th> <th>Employee Name</th> <th>Department / Date</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th class="red">7</th> <th>8</th> <th>9</th> <th>10</th> <th>11</th> <th>12</th> <th>13</th> <th class="red">14</th> <th>15</th> <th>16</th> <th>17</th> <th>18</th> <th>19</th> <th>20</th> <th class="red">21</th> <th>22</th> <th>23</th> <th>24</th> <th>25</th> <th>26</th> <th>27</th> <th class="red">28</th> <th>29</th> <th>30</th> <th>31</th> <th>No.of Worked Hours</th> <th>No.Of Working hours</th> <th>No.Of Days</th> <th>Differance</th> </tr> </thead> <tbody class="report_table"> <!-- <tr> <td>1</td> <td>Chandrakala S</td> <td>Admin</td> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> <td class="red">7</td> <td>8</td> <td>9</td> <td>10</td> <td>11</td> <td>12</td> <td>13</td> <td class="red">14</td> <td>15</td> <td>16</td> <td>17</td> <td>18</td> <td>19</td> <td>20</td> <td class="red">21</td> <td>22</td> <td>23</td> <td>24</td> <td>25</td> <td>26</td> <td>27</td> <td class="red">28</td> <td>29</td> <td>30</td> <td>31</td> <td>192.7</td> <td>192</td> <td>0.70</td> </tr> --> </tbody> </table> </div> <!-- table-responsive --> </div> <!-- row --> <br><br> <br><br> <!-- <div class="row total_no_w_hourses"> <div class="table-responsive text-nowrap"> <h4>Department wise Attendance for the Month of February 2021</h4> <h5>Marketing</h5> <table class="table table-bordered w-auto" style="margin: 0 auto;"> <thead> <tr> <th>Sl.No.</th> <th>Employee ID</th> <th>Employee Name</th> <th>Dapartment</th> <th>Working Hour</th> <th>Worked Hour</th> <th class="red">Difference</th> <th>Lunch Hour</th> <th>Lunched hour</th> <th class="red">Difference</th> <th colspan="3">Leaves- M L</th> <th colspan="3">Leaves- C L</th> <th>LOP</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>02</td> <td>Madhu K</td> <td>Marketing</td> <td>280</td> <td>210</td> <td class="red">2</td> <td>26</td> <td>24</td> <td class="red">-2</td> <td>12</td> <td>1</td> <td>11</td> <td>6</td> <td>1</td> <td>5</td> <td>0</td> </tr> </tbody> </table> </div> </div> --> <!-- row --> </div> <!-- content-wrapper --> <style type="text/css"> pre { background-color: transparent; border: 1px solid transparent; line-height: 1.6; text-align: justify; } .total_no_w_hourse h4{ text-align: center; } .total_no_w_hourse{ margin-right: 0 !important; margin-left: 0 !important; } .total_no_w_hourses{ margin-right: 0 !important; margin-left: 0 !important; } .table-bordered>thead>tr>th, .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th { border: 1px solid #c5c5c5 !important; font-size: 14px !important; padding:4px !important; } .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } .red{ color: #ff0000; } .total_no_w_hourses h4{ text-align: center; background: #f7f3f3; padding: 10px; margin-bottom: 0; } .total_no_w_hourses h5{ text-align: center; background: #ffeded; padding: 10px; border-top: 2px solid #fff; } </style> <script type="text/javascript"> $(".report_date").datepicker({ dateFormat: 'dd-mm-yy', }).on('changeDate', function(ev){ $('.report_date').datepicker('hide'); }); $(document).ready(function(){ var content = ''; content += '<div class="form-group">'; content += '<label>Month</label>'; content += '<select class="form-control month" id="months" name="months">'; content += '<option value="">Select</option>'; content += '<option value="01">January</option>'; content += '<option value="02">Febraury</option>'; content += '<option value="03">March</option>'; content += '<option value="04">April</option>'; content += '<option value="05">May</option>'; content += '<option value="06">June</option>'; content += '<option value="07">July</option>'; content += '<option value="08">August</option>'; content += '<option value="09">September</option>'; content += '<option value="10">October</option>'; content += '<option value="11">November</option>'; content += '<option value="12">December</option>'; content += '</select>'; content += '</div>'; $('.months').append(content); var from_date = $("#from_date").val(); if(from_date !="") { var from_date = $("#from_date").val(); } else { var from_date = 0; } var to_date = $("#to_date").val(); if(to_date !="") { var to_date = $("#to_date").val(); } else { var to_date = 0; } var employee = $("#employee").val(); if(employee !="") { var employee = $("#employee").val(); } else { var employee = 0; } $('.get_report').click(function() { $('.status_export_table').empty(); id = jQuery("#datelist1").jqGrid('getDataIDs'); var month = $("#months").val(); if(month !="") { var month = $("#months").val(); } else { var month = 0; } var employee = $("#employee").val(); if(employee !="") { var employee = $("#employee").val(); } else { var employee = 0; } $.ajax({ url:"<?php echo site_url('datewise-attendance-report')?>?month="+month+"&employee="+employee, type : "GET", data : {from_date:from_date,to_date:to_date,employee:employee}, success:function(data){ response=jQuery.parseJSON(data); console.log(response); if(response.result == 1) { var con1 = ''; $.each( response.message, function( key, value2 ) { $('.status_export_table').show(); var sl_no = key+1; con1 += '<tr>'; con1 += '<td>'+sl_no+'</td>'; con1 += '<td>'+value2.employee_name+'</td>'; con1 += '<td>'+value2.dept_name+'</td>'; if(value2.total_hr1 == "0:0") { con1 += '<td>'+value2.leave_type1+'</td>'; } else { con1 += '<td>'+value2.total_hr1+'</td>'; } if(value2.total_hr2 == "0:0") { con1 += '<td>'+value2.leave_type2+'</td>'; } else { con1 += '<td>'+value2.total_hr2+'</td>'; } if(value2.total_hr3 == "0:0") { con1 += '<td>'+value2.leave_type3+'</td>'; } else { con1 += '<td>'+value2.total_hr3+'</td>'; } if(value2.total_hr4 == "0:0") { con1 += '<td>'+value2.leave_type4+'</td>'; } else { con1 += '<td>'+value2.total_hr4+'</td>'; } if(value2.total_hr5 == "0:0") { con1 += '<td>'+value2.leave_type5+'</td>'; } else { con1 += '<td>'+value2.total_hr5+'</td>'; } if(value2.total_hr6 == "0:0") { con1 += '<td>'+value2.leave_type6+'</td>'; } else { con1 += '<td>'+value2.total_hr6+'</td>'; } if(value2.total_hr7 == "0:0") { con1 += '<td>'+value2.leave_type7+'</td>'; } else { con1 += '<td>'+value2.total_hr7+'</td>'; } if(value2.total_hr8 == "0:0") { con1 += '<td>'+value2.leave_type8+'</td>'; } else { con1 += '<td>'+value2.total_hr8+'</td>'; } if(value2.total_hr9 == "0:0") { con1 += '<td>'+value2.leave_type9+'</td>'; } else { con1 += '<td>'+value2.total_hr9+'</td>'; } /* con1 += '<td>'+value2.total_hr1+'</td>'; con1 += '<td>'+value2.total_hr2+'</td>'; con1 += '<td>'+value2.total_hr3+'</td>'; con1 += '<td>'+value2.total_hr4+'</td>'; con1 += '<td>'+value2.total_hr5+'</td>'; con1 += '<td>'+value2.total_hr6+'</td>'; con1 += '<td>'+value2.total_hr7+'</td>'; con1 += '<td>'+value2.total_hr8+'</td>'; con1 += '<td>'+value2.total_hr9+'</td>';*/ if(value2.total_hr10 == "0:0") { con1 += '<td>'+value2.leave_type10+'</td>'; } else { con1 += '<td>'+value2.total_hr10+'</td>'; } if(value2.total_hr11 == "0:0") { con1 += '<td>'+value2.leave_type11+'</td>'; } else { con1 += '<td>'+value2.total_hr11+'</td>'; } if(value2.total_hr12 == "0:0") { con1 += '<td>'+value2.leave_type12+'</td>'; } else { con1 += '<td>'+value2.total_hr12+'</td>'; } if(value2.total_hr13 == "0:0") { con1 += '<td>'+value2.leave_type13+'</td>'; } else { con1 += '<td>'+value2.total_hr13+'</td>'; } if(value2.total_hr14 == "0:0") { con1 += '<td>'+value2.leave_type14+'</td>'; } else { con1 += '<td>'+value2.total_hr14+'</td>'; } if(value2.total_hr15 == "0:0") { con1 += '<td>'+value2.leave_type15+'</td>'; } else { con1 += '<td>'+value2.total_hr15+'</td>'; } if(value2.total_hr16 == "0:0") { con1 += '<td>'+value2.leave_type16+'</td>'; } else { con1 += '<td>'+value2.total_hr16+'</td>'; } if(value2.total_hr17 == "0:0") { con1 += '<td>'+value2.leave_type17+'</td>'; } else { con1 += '<td>'+value2.total_hr17+'</td>'; } if(value2.total_hr18 == "0:0") { con1 += '<td>'+value2.leave_type18+'</td>'; } else { con1 += '<td>'+value2.total_hr18+'</td>'; } if(value2.total_hr19 == "0:0") { con1 += '<td>'+value2.leave_type19+'</td>'; } else { con1 += '<td>'+value2.total_hr19+'</td>'; } if(value2.total_hr20 == "0:0") { con1 += '<td>'+value2.leave_type20+'</td>'; } else { con1 += '<td>'+value2.total_hr20+'</td>'; } if(value2.total_hr21 == "0:0") { con1 += '<td>'+value2.leave_type21+'</td>'; } else { con1 += '<td>'+value2.total_hr21+'</td>'; } if(value2.total_hr22 == "0:0") { con1 += '<td>'+value2.leave_type22+'</td>'; } else { con1 += '<td>'+value2.total_hr22+'</td>'; } if(value2.total_hr23 == "0:0") { con1 += '<td>'+value2.leave_type23+'</td>'; } else { con1 += '<td>'+value2.total_hr23+'</td>'; } if(value2.total_hr24 == "0:0") { con1 += '<td>'+value2.leave_type24+'</td>'; } else { con1 += '<td>'+value2.total_hr24+'</td>'; } if(value2.total_hr25 == "0:0") { con1 += '<td>'+value2.leave_type25+'</td>'; } else { con1 += '<td>'+value2.total_hr25+'</td>'; } if(value2.total_hr26 == "0:0") { con1 += '<td>'+value2.leave_type26+'</td>'; } else { con1 += '<td>'+value2.total_hr26+'</td>'; } if(value2.total_hr27 == "0:0") { con1 += '<td>'+value2.leave_type27+'</td>'; } else { con1 += '<td>'+value2.total_hr27+'</td>'; } if(value2.total_hr28 == "0:0") { con1 += '<td>'+value2.leave_type28+'</td>'; } else { con1 += '<td>'+value2.total_hr28+'</td>'; } if(value2.total_hr29 == "0:0") { con1 += '<td>'+value2.leave_type29+'</td>'; } else { con1 += '<td>'+value2.total_hr29+'</td>'; } if(value2.total_hr30 == "0:0") { con1 += '<td>'+value2.leave_type30+'</td>'; } else { con1 += '<td>'+value2.total_hr30+'</td>'; } if(value2.total_hr31 == "0:0") { con1 += '<td>'+value2.leave_type31+'</td>'; } else { con1 += '<td>'+value2.total_hr31+'</td>'; } con1 += '<td>'+value2.no_of_worked_hrs+'</td>'; con1 += '<td>'+value2.total_working_hours+'</td>'; con1 += '<td>'+value2.no_of_days+'</td>'; con1 += '<td>'+value2.difference+'</td>'; con1 += '</tr>'; }); $('.report_table').empty(); $('.report_table').append(con1); } else { toastr["error"](response.message); $(".update").attr("disabled", true); } } }); function status_export_data(){ $(".status_export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Employee Attendance Report", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } var from_date = $("#from_date").val(); var to_date = $("#to_date").val(); var employee = $("#employee").val(); load_all_progress(); function load_all_progress() { $("#datelist1").setGridParam( { url:"<?php echo site_url('datewise-attendance-report-list/')?>?from_date="+from_date+"&to_date="+to_date+"&employee="+employee, mtype : "get", page:1 }).trigger("reloadGrid");//Reload grid trigger $("#datelist1").setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); return false } $("#datelist1").jqGrid({ url:"<?php echo site_url('datewise-attendance-report-list/')?>?from_date="+from_date+"&to_date="+to_date+"&employee="+employee, mtype : "get", datatype: "json", colNames:['id','Employee ID','Name','Entry Date','Exit Date','Login','Break','Logout','Total Working Hours'], colModel:[ {name:'id',index:'id', width:60, hidden:true,editable:false,key:true}, {name:'employee_id',index:'employee_id', width:150, hidden:false,editable:false}, {name:'full_name',index:'full_name', width:150, hidden:false,editable:false}, {name:'entry_date',index:'entry_date', width:100, hidden:false,editable:false}, {name:'exit_date',index:'exit_date', width:100, hidden:false,editable:false}, {name:'entry_time',index:'entry_time', width:100, hidden:false,editable:false}, {name:'break_time',index:'break_time',editable:false, width:100}, {name:'exit_time',index:'exit_time',editable:false, width:100}, {name:'working',index:'working',editable:false, width:100}, ], rowNum:20, rowTotal: 2000, rowList : [20,30], rownumbers: true, //rownumWidth: 60, pager:"#datepager1", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: true, loadonce:true, autoencode: true, caption:"Employee Attendance Report", //Subgrid1... subGrid: false, }); $("#datelist1").jqGrid("setLabel", "rn", "SL"); $("#datelist1").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#datelist1").jqGrid('navGrid','#datepager1', {edit:false,add:false,del:false,search:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, closeAfterDelete:true, closeAfterEdit:true } ).navButtonAdd('#datepager1', { caption:"Export", buttonicon:"", onClickButton: attendance_report_export, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); function attendance_report_export() { $('.status_export_table').empty(); id = jQuery("#datelist1").jqGrid('getDataIDs'); var report_date = $(".report_date").val(); $.ajax({ url:"<?php echo site_url('datewise-attendance-report-list/')?>?from_date="+from_date+"&to_date="+to_date+"&employee="+employee, type : "GET", data : {from_date:from_date,to_date:to_date,employee:employee}, success:function(data){ response=jQuery.parseJSON(data); console.log(response); var count =1; var content = ''; content +='<thead><tr><th>Sl No</th><th>Employee ID</th><th>Name</th><th>Login</th><th>Break</th><th>Logout</th><th>Total Working Hours</th></tr></thead>'; $.each(response,function(key,va){ content +='<tr><td>'+count+'</td><td>'+va.employee_id+'</td><td>'+va.full_name+'</td><td>'+va.entry_time+'</td><td>'+va.break_time+'</td><td>'+va.exit_time+'</td><td>'+va.working+'</td></tr>'; count++; }); $('.status_export_table').append(content); status_export_data(); } }); function status_export_data(){ $(".status_export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Employee Attendance Report", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } } }); }); function load_back() { window.location.href = '<?php echo site_url('dashboard');?>'; } function print_page() { var divToPrint=document.getElementById('print_table'); newWin= window.open(""); newWin.document.write('<html><head><title></title>'); newWin.document.write('</head>'); newWin.document.write(divToPrint.outerHTML); newWin.document.write('</html>'); document.getElementById('print_table').style.display=newWin; newWin.close(); var originalTitle = document.title; document.title = "Dayakar Hospital"; $(".print_button").hide(); window.print(); //window.history.back(); document.title = originalTitle; } </script> <?php $this->load->view('includes/footer.php')?>