ESH/task_report_pdf.php
2024-10-23 18:28:06 +05:30

133 lines
4.2 KiB
PHP

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<?php
//include('pdf_header_reverse.php');
include('includes/config/config.php');
include ('includes/functions.php');
include("pdf_ohc_header.php");
include('log_entry.php');
$from_date = $_REQUEST['startDate2'];
$to_date = $_REQUEST['endDate2'];
//include('pop_up_top.php');
?>
<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>
<div id="medical_examination_form" style="display:none">
<table width="100%" >
<tr>
<div style="font-size: 12px">
<td width="25%" align="left"><h5 >Run Date : <?php echo date("d-M-Y"); ?></h5></td>
<td width="50%" align="center" ><h5>Task History Report</h5></td>
<td width="25%" align="left"><h5> User : <?php echo $username ?></h5></td>
<?php if(isset($from_date) && isset($to_date)){?>
<td width="25%" align="right"><h5> Range : <?php echo $from_date; ?> To <?php echo $to_date ;?></h5></td>
<?php }?>
</tr>
</table>
<table 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 DISTINCT(task_date) from task_master_status where 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_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'];
$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
//$total=$total_for_yellow_mines+$total_for_yellow_plant+$total_for_red_plant+$total_for_red_mines+$total_for_white_plant+$total_for_white_mines+$total_for_blue_plant+$total_for_blue_mines;
$count++;
}
?>
</table>
</div>
<form id="medical_examination_form_pdf" action="" method="POST">
<input type="hidden" name="htmlText" id="htmlText" />
</form>
<script>
formSubmit();
function formSubmit(){
$("#htmlText").val($("#medical_examination_form").html());
document.forms['medical_examination_form_pdf'].action="pdf_dynamic.php";
document.forms['medical_examination_form_pdf'].method="post";
document.forms['medical_examination_form_pdf'].submit();
}
</script>
<?php
//include('pdf_footer.php');
?>