157 lines
5.1 KiB
PHP
157 lines
5.1 KiB
PHP
<?php //include('pdf_header_reverse.php');
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
//include('pop_up_top.php');
|
|
header("Content-type:application/octet-stream");
|
|
|
|
header("Content-type: application/x-msdownload");
|
|
header("Content-Disposition: attachment; filename=training_report_excel.xls");
|
|
header("Pragma: no-cache");
|
|
header("Expires: 0");
|
|
|
|
$training=$_REQUEST['training_id'];
|
|
$training_dept_type=$_REQUEST['training_dept_type'];
|
|
$training=explode("-", $training);
|
|
$assign_id=$training[0];
|
|
$schedule_id=$training[1];
|
|
|
|
$from_date = date('Y-m-d', strtotime($_POST['trainingDate1']));
|
|
$to_date = date('Y-m-d', strtotime($_POST['trainingDate2']));
|
|
|
|
$dept_sql='';
|
|
if ($training_dept_type=='ALL'||$training_dept_type==''){
|
|
$dept_sql='';
|
|
}
|
|
else{
|
|
$dept_sql='and b.dept_id="'.$training_dept_type.'"';
|
|
}
|
|
?>
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
<style>
|
|
@page {
|
|
margin: 15px;
|
|
}
|
|
|
|
.btn {
|
|
background-color: #4CAF50;
|
|
border-radius: 5%;
|
|
/* Green */
|
|
border: none;
|
|
color: white;
|
|
padding: 5px 8px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 12px;
|
|
margin: 4px 2px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
@media print {
|
|
#printPageButton {
|
|
display: none;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<?php include('pdf_ohc_header.php'); ?>
|
|
<table width="100%">
|
|
<tr>
|
|
|
|
<td colspan="2" style="font-size: 15px;" align="center"><strong>Wellness and Training Programs
|
|
Report</strong></td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td align="left" style="font-size: 12px"><strong>From Date:
|
|
<? echo date("d-M-Y", strtotime($from_date))." "; ?>To:
|
|
<? echo date("d-M-Y", strtotime($to_date))." "; ?>
|
|
</strong></td>
|
|
<td align="right" style="font-size: 15px"><button align="center" id="printPageButton" class="btn btn-success"
|
|
onClick="window.print();">Print</button></td>
|
|
</tr>
|
|
|
|
</table>
|
|
<br>
|
|
|
|
<?php
|
|
$sqll = "SELECT count(*) as total FROM `training_status` a JOIN patient_master b on a.emp_id=b.id WHERE a.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and training_status='1' and assign_training_id='".$assign_id."' and training_date BETWEEN '$from_date' AND '$to_date' $dept_sql";
|
|
|
|
$result_sqll = mysqli_query($conn, $sqll);
|
|
$num_rows = mysqli_num_rows($result_sqll);
|
|
$row0 = mysqli_fetch_assoc($result_sqll);
|
|
error_log("total:" . $sqll);
|
|
|
|
$sql = "SELECT DATE_FORMAT(a.training_date, '%d-%m-%y') as date,a.*,b.* FROM `training_status` a JOIN patient_master b on a.emp_id=b.id WHERE a.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and training_status='1' and assign_training_id='".$assign_id."' and training_date BETWEEN '$from_date' AND '$to_date' $dept_sql order by b.patient_name ASC ";
|
|
error_log($sql);
|
|
|
|
$result = mysqli_query($conn, $sql);
|
|
|
|
?>
|
|
<h5 align="center">
|
|
<?= getTableFieldValue("training_master","training_name","training_master_id",getTableFieldValue("training_schedule","training_id","schedule_id",$schedule_id))?>
|
|
</h5>
|
|
<table border="1" width="100%" cellspacing="0">
|
|
<strong>
|
|
<tr bgcolor="#eeeeee">
|
|
<td align="left" width="2%">Sr.</td>
|
|
<td align="left" width="3%">Date</td>
|
|
<td valign="top" align="left" width="8%">Name</td>
|
|
<td valign="top" align="left" width="8%">EMP CODE</td>
|
|
<td valign="top" align="left" width="2%">Age</td>
|
|
<td valign="top" align="left" width="2%">Sex</td>
|
|
<td valign="top" align="left" width="5%">Mobile No.</td>
|
|
|
|
<td valign="top" align="left" width="3%">Trained By</td>
|
|
|
|
<td valign="top" align="left" width="5%">Remarks</td>
|
|
</tr>
|
|
|
|
<?php
|
|
$count = 1;
|
|
while ($row1 = mysqli_fetch_assoc($result)) {
|
|
extract($row1);
|
|
|
|
// error_log($row1['employer_contractor_id']);
|
|
|
|
?>
|
|
|
|
<tr>
|
|
<td><?php echo $count ?></td>
|
|
<td><?php echo date("d/M/Y H:i ", strtotime($row1['training_date'])) ?></td>
|
|
|
|
|
|
<td><?php echo $row1['patient_name'] ?></td>
|
|
<td><?php echo $row1['emp_code'] ?></td>
|
|
<td><?php
|
|
|
|
$from = new DateTime($row1['dob']);
|
|
|
|
$to = new DateTime('today');
|
|
|
|
echo $from->diff($to)->y;
|
|
|
|
?></td>
|
|
<td><?php if ($row1['gender'] == 'M') {
|
|
echo 'Male';
|
|
} else {
|
|
echo 'Female';
|
|
} ?></td>
|
|
|
|
<td><?php echo $row1['primary_phone'] ?></td>
|
|
<td><?php echo getTableFieldValue("patient_master","patient_name","id",getTableFieldValue('tbl_users', 'emp_id', 'user_id', $row1['modified_by'])); ?>
|
|
</td>
|
|
<td><?php echo $row1['training_remarks'] ?></td>
|
|
|
|
|
|
|
|
</tr>
|
|
<?php
|
|
$count++;
|
|
}
|
|
?>
|
|
<tr Height="10px">
|
|
<td colspan="25"><b>TOTAL: <?php echo $row0['total'] ?></b></td>
|
|
</tr>
|
|
</table>
|
|
</body>
|