?
Current Path : /home1/savoy/public_html/oscarerp.com/application/views/report/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/oscarerp.com/application/views/report/xls_employee_attendance_report.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); $start_date = $this->mastermodel->convertdateformat($postdata['from_date']); $end_date = $this->mastermodel->convertdateformat($postdata['to_date']); $diff = abs(strtotime($start_date) - strtotime($end_date)); $days = floor($diff / (60 * 60 * 24)) + 1; $html = ""; ?> <html> <head> <style> table,tr,td,th{ border-collapse: collapse; } </style> <table width="100%"> <tr> <td colspan="2"></td> <td colspan="2"></td> <td align="right"><img src="<?= base_url() ?>assets/logo/<?= $logo ?>" style="float:right; max-height: 100px;"/></td> </tr> <tr> <td colspan="5" style="font-size:16px;" align="center"><b><u>Employee Attendance Report</u></b></td> </tr> <tr> <td colspan="3">From: <?= $postdata['from_date'] ?></td> </tr> <tr> <td>To: <?= $postdata['to_date'] ?></td> </tr> <tr> <td colspan="3">Printout Date : <?= date('d-m-Y') ?>,<?= date('h:i:s a') ?></td> </tr> </table> <br><br> <body> <table style="border: 1px solid black;"> <thead> <tr style="border: 1px solid black;"> <th style="text-align:left;border: 1px solid black;" width="5px" bgcolor="#7FCEFF" >Sl No</th> <th style="text-align:left;width: 300px;border: 1px solid black;" bgcolor="#7FCEFF" >Employee Name</th> <?php $head_start = $start_date; while (strtotime($head_start) <= strtotime($end_date)) { ?> <th style="text-align:center;width: 70px;border: 1px solid black;" bgcolor="#7FCEFF"> <?= date("d", strtotime($head_start)); ?> <br/> <?= date("D", strtotime($head_start)); ?> </th> <?php $head_start = date("Y-m-d", strtotime("+1 day", strtotime($head_start))); } ?> <th style="text-align:center;width: 130px;border: 1px solid black;" bgcolor="#7FCEFF">Total</th> </tr> </thead> <tbody> <?php $sno =1; foreach ($report as $item) { ?> <tr> <td style="border: 1px solid black; background-color:#cdc9c9;"><?= $sno++ ?></td> <td style="border: 1px solid black; background-color:#cdc9c9;"><?= $item['employee_name'] ?></td> <?php $body_start = $start_date; $detes = explode('#', $item['att_details'] ); $status = explode('#', $item['att_stat'] ); $total = 0; while (strtotime($body_start) <= strtotime($end_date)) { $key = array_search($body_start, $detes); if(is_numeric($key)) { $total += $status[$key] == 'P' ? 1 : 0; $attendance_status = $status[$key]; } else { $attendance_status = ''; } ?> <th style="text-align:center;width: 70px;border: 1px solid black;"> <?= $attendance_status ?> </th> <?php $body_start = date("Y-m-d", strtotime("+1 day", strtotime($body_start))); } ?> <td style="border: 1px solid black; background-color:#cdc9c9;"><?= $total ?></td> </tr> <?php } ?> </tbody> </table> </body> </html> <?php $filename = "Employee_Attendance report"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=" . $filename . ".xls"); header("Pragma: no-cache"); header("Expires: 0"); echo $html; exit; ?>