ESH/communication_details_excel.php

81 lines
4.0 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php //include('pdf_header.php');
include('includes/config/config.php');
//include('pop_up_top.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=communication_details_excel.xls');
?>
<body>
<?php include('excel_ohc_header.php') ?>
<br><br>
<table border="1" width="100%">
<strong>
<tr bgcolor="#eeeeee">
<td align="left" width="1%">Sr.</td>
<td align="left" width="5%">Shift</td>
<td align="left" width="5%">Shift Start Time</td>
<td align="left" width="5%">Shift End Time</td>
<td align="left" width="5%">Communication Date.</td>
<td align="left" width="5%">Staff Name </td>
<td align="left" width="18%">Communication Details</td>
<td align="left" width="15%">Remarks</td>
</tr>
<?php
$count =1;
$sql_communication = "select distinct c.comm_date, c.modified_by,t.emp_id as emp_id from communication_details c left join tbl_users t on t.user_id=c.modified_by ";
//echo $sql_communication;
$results_communication = @mysqli_query($conn, $sql_communication);
while ($row = @mysqli_fetch_assoc($results_communication)) {
$modified_by = $row['modified_by'];
$comm_date = $row['comm_date'];
$emp_id = $row['emp_id'];
$sql_communication_details = "select c.details,c.remarks,c.comm_date,c.communication_id,ssd.*, ss.* from communication_details c left join shift_status_details ssd on c.shift_details_id = ssd.shift_details_id left join shift_status ss on ss.shift_status_id = ssd.shift_id where c.modified_by ='" . $modified_by . "' and c.comm_date ='" . $comm_date . "' ";
$results_communication_details = @mysqli_query($conn, $sql_communication_details);
$sql_export = $sql_communication_details;
error_log("sql comm details: " . $sql_communication_details);
//$communication_info='';
$communication_info = "";
$remarks_info = "";
while ($row_details = @mysqli_fetch_assoc($results_communication_details)) {
@extract($row_details);
if (isset($row_details['details']) && $row_details['details'] != '') {
$communication_info .= '<b>' . getTableFieldValue('communication', 'com_item', 'communication_id', $row_details['communication_id']) . '</b>::' . $row_details['details'] . '<br>';
error_log("dettttttttttttttails" . $communication_info);
}
if (isset($row_details['remarks']) && $row_details['remarks'] != '') {
$remarks_info .= '<b>' . getTableFieldValue('communication', 'com_item', 'communication_id', $row_details['communication_id']) . '</b>::' . $row_details['remarks'] . '<br>';
error_log("remarks:::" . $remarks_info);
}
$status_name = $row_details['status_name'];
$start_date_time = $row_details['start_date_time'];
$end_date_time = $row_details['end_date_time'];
}
?>
<tr>
<td><?php echo $count ?></td>
<td><?php echo $status_name ?></td>
<td><?php echo $start_date_time ?></td>
<td><?php echo $end_date_time ?></td>
<td><?php echo date_format(date_create($row1['comm_date']), "d-M-Y ") ?></td>
<td><?php echo getTableFieldValue('tbl_users ', 'user_name', 'user_id', $row['modified_by']) ?></td>
<td><?php echo $communication_info ?></td>
<td><?php echo $remarks_info ?></td>
</tr>
<?php
$count++;
}
?>
</table>
</body>