120 lines
3.9 KiB
PHP
120 lines
3.9 KiB
PHP
<?php
|
|
header("Content-type:application/octet-stream");
|
|
|
|
header("Content-type: application/x-msdownload");
|
|
header("Content-Disposition: attachment; filename=excel_task_history_report.xls");
|
|
header("Pragma: no-cache");
|
|
header("Expires: 0");
|
|
|
|
?>
|
|
<?php
|
|
$from_date = $_REQUEST['startDate2'];
|
|
$to_date = $_REQUEST['endDate2'];
|
|
include ('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
|
//include('pop_up_top.php');
|
|
$task_filter = isset($_REQUEST['task_filter']) ? $_REQUEST['task_filter'] : [];
|
|
|
|
$sanitized_filters = [];
|
|
foreach ($task_filter as $filter) {
|
|
$sanitized_filter = filter_var($filter, FILTER_SANITIZE_STRING);
|
|
$sanitized_filters[] = $sanitized_filter;
|
|
}
|
|
|
|
$in_values = "'" . implode("','", $sanitized_filters) . "'";
|
|
|
|
?>
|
|
|
|
<body>
|
|
<style>
|
|
.tbl2 {
|
|
font-size: 12px;
|
|
|
|
border: 1px solid black;
|
|
border-collapse: collapse;
|
|
|
|
}
|
|
|
|
.tbl2 td,
|
|
th {
|
|
font-size: 12px;
|
|
|
|
border: 1px solid black;
|
|
border-collapse: collapse;
|
|
|
|
padding: 4px
|
|
}
|
|
</style>
|
|
|
|
<h5 align="center">Task History Report</h5>
|
|
<table border="1" width="100%" class="tbl2">
|
|
<?php
|
|
// $sql_task_report="select * from task_report ";
|
|
//echo $sql;
|
|
//$result_task_report = @mysqli_query($conn,base64_decode($filterkey));
|
|
//echo $result;
|
|
?>
|
|
<th width=1% bgcolor="yellow">Sr.</th>
|
|
<th width=3% bgcolor="yellow">Date</th>
|
|
<th width=3% bgcolor="yellow">Time</th>
|
|
<th width=8% bgcolor="yellow">Name</th>
|
|
<th width=2% bgcolor="yellow">Frequency</th>
|
|
<th width=2% bgcolor="yellow">Status</th>
|
|
<th width=5% bgcolor="yellow">Status Comment</th>
|
|
<th width=3% bgcolor="yellow">Submitted Time </th>
|
|
<th width=3% bgcolor="yellow">Submitted by</th>
|
|
</tr>
|
|
<?php
|
|
|
|
$sql_task_report = "select task_date,task_id from task_master_status where task_id in ($in_values) and task_date between STR_TO_DATE('" . $from_date . "', '%d-%m-%Y') AND STR_TO_DATE('" . $to_date . "', '%d-%m-%Y') order by task_date ASC";
|
|
//echo $sql_task_report;
|
|
error_log("sql: " . $sql_task_report);
|
|
$result_task_report = @mysqli_query($conn, $sql_task_report);
|
|
|
|
|
|
$count = 0;
|
|
|
|
while ($row_task_report = @mysqli_fetch_array($result_task_report)) {
|
|
$query_for_date = " SELECT a.*, b.task_name, b.frequency, c.user_name FROM task_master_status a left join task_master b on a.task_id = b.task_id left join tbl_users c on a.modified_by = c.user_id where a.task_id = '" . $row_task_report['task_id'] . "' and a.task_date='" . $row_task_report['task_date'] . "' ";
|
|
error_log("sql: " . $query_for_date);
|
|
$result_for_date = @mysqli_query($conn, $query_for_date);
|
|
while ($row_for_date = @mysqli_fetch_array($result_for_date)) {
|
|
$task_name = $row_for_date['task_name'];
|
|
$task_time = $row_for_date['task_time'];
|
|
$frequency = $row_for_date['frequency'];
|
|
$status = $row_for_date['status'] == 'on' ? 'Completed' : 'Pending';
|
|
$status_comment = $row_for_date['status_comment'];
|
|
$user_name = $row_for_date['user_name'];
|
|
$last_modified = $row_for_date['last_modified'];
|
|
}
|
|
|
|
$task_date = date_format(date_create($row_task_report['task_date']), "d-M-Y ");
|
|
|
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td text-align="left"><?php echo $count + 1; ?></td>
|
|
<td text-align="left"><?php echo $task_date; ?></td>
|
|
<td text-align="left"><?php echo $task_time; ?></td>
|
|
<td text-align="left"><?php echo $task_name; ?></td>
|
|
<td text-align="left"><?php echo $frequency; ?></td>
|
|
<td text-align="left"><?php echo $status; ?></td>
|
|
<td text-align="left"><?php echo $status_comment; ?></td>
|
|
<td text-align="left"><?php echo $last_modified; ?></td>
|
|
<td text-align="left"><?php echo $user_name; ?></td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
<?php
|
|
$count++;
|
|
|
|
}
|
|
?>
|
|
|
|
</table>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|