ESH/lab_report_pdf.php

1192 lines
56 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
/* Font Include */
@media print {
footer {
page-break-after: always;
}
}
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@600&display=swap');
/* * {
font-size: medium !important;
font-family: 'Rajdhani', sans-serif !important;
} */
table,
tr,
td {
border: none !important;
}
/* .tbl1 {
border-collapse: collapse;
} */
/* th {
background-color: #e1e1e1;
font-size: 12px;
font-style: bold;
vertical-align: top;
}
td {
text-align: left;
font-size: 12px;
vertical-align: top;
padding: 8px !important;
} */
/* tr {
border: 1px solid black;
} */
</style>
<style>
body {
font-family: Calibri;
}
@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;
}
}
#myTable td {
border: groove;
}
</style>
<?php
// include autoloader;
include('includes/config/config.php');
include('log_entry.php');
include_once("includes/functions.php");
$checkup_id = $_REQUEST['checkup_id'];
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
$query = "select * from ohc_type where ohc_type_id = '" . $_SESSION['current_ohcttype'] . "'";
error_log("query: 27: " . $query);
// echo $query;
$result = mysqli_query($conn, $query);
$row_company = mysqli_fetch_array($result);
@extract($row_company);
//Code for loading the Check up Sections List for the given Checkup page case
$sql_patient = "select * from checkup_form where checkup_id = '$checkup_id'";
$result_p = mysqli_query($conn, $sql_patient);
$row_p = mysqli_fetch_array($result_p);
@extract($row_p);
$queryc = "select * from company_profile ";
$resultc = mysqli_query($conn, $queryc);
$row_company = mysqli_fetch_array($resultc);
@extract($row_company);
?>
</head>
<?php
if($row_p['checkup_type_id']=='48' || $row_checkup['checkup_type_id']==48){
?>
<body style='margin-right: 0px;margin-left: 0px;'>
<form id="employeeDetailsFormPdf" action="" method="POST">
<input type="hidden" name="htmlText" id="htmlText" />
</form>
<form name="checkup_form_employee" id="checkup_form_employee" method="POST">
<div id="preexam_form_div" class="page">
<!--section header-->
<table width="100%" style="background-color: #ffff0080;">
<tr>
<td width="75%" align="left">
<div style="margin-left: 20px;">
<h3 style=" color: blue;margin-bottom: 0px;text-align: left;"> G.H.C.L. -
SUTRAPADA
</h3>
<h3 style=" color: blue;margin-bottom: 0px;margin-top: 0px;text-align: left;"> HEALTH
CENTRE -
ANURAGNAGAR
</h3>
<h3 style=" color: blue;margin-bottom: 0px;margin-top: 0px;text-align: left;">
<?php
$sql_param = "select a.*,b.* from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
$result_param = mysqli_query($conn, $sql_param);
$header='PATHOLOGY LABORATORY';
while ($row_param = mysqli_fetch_assoc($result_param)) {
$param_type = (explode(',', $row_param['checkup_type_ids']));
$param_type = array_unique($param_type);
for($i=0;$i<count($param_type);$i++){
$tital=getTableFieldValue('checkup_type','checkup_type_code','checkup_type_id',$param_type[$i]);
if($tital!='LAB_TEST'){
$header=getTableFieldValue('checkup_type','checkup_type_name','checkup_type_id',$param_type[$i]);
}
}
}
echo $header;
?>
</h3>
<h3 style="color: blue;margin-bottom: 0px;margin-top: 0px; text-align: left;"> Phone
No.:(02876)(26)5303
</h3>
</div>
</td>
<?php if (isset($row_company['right_com_logo']) && $row_company['right_com_logo'] != null) { ?>
<td width="25%" align="right"><img
src="data:<?php echo $row_company['right_image_type'] ?>;base64,<?php echo base64_encode($row_company['right_com_logo']) ?>"
style="width: 105px; height: 60px; margin:0px; padding: 0px;">
</td>
<?php } ?>
</tr>
<tr>
<td colspan="3" align="center">
<button align="center" id="printPageButton" class="btn btn-success"
onClick="window.print();">Print</button>
</td>
</tr>
</table>
<hr>
<input type="hidden" id="checkup_section_ids" name="checkup_section_ids[]">
<div class="mainPanel">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading" id="panel-heading1">
<b class="panel-title" id="panel-title1"
style="font-size: 15px;display: block; height: 12px;text-decoration: none;font-family: 'Source Sans Pro', 'Helvetica Neue',Helvetica, Arial, sans-serif;">
<center style="font-size: 12px;">PATIENT DETAILS</center>
</b>
</div>
<div class="panel-body">
<div class="row">
<?php
// $emp_id ='5504';
$sql_employee = "select * from patient_master where id=(select emp_id from checkup_form where checkup_id='$checkup_id' )";
$result = mysqli_query($conn, $sql_employee);
//$checkup_id = $_REQUEST['flex_checkup_id'];
// $sql_checkup = "select * from checkup_form where checkup_id='$checkup_id'";
//echo $sql_checkup;
$checkup_result = mysqli_query($conn, $sql_employee);
$row_checkup = mysqli_fetch_assoc($checkup_result);
while ($row_employee = mysqli_fetch_assoc($result)) {
$patient = $row_employee['patient_name'];
$gender = $row_employee['gender'] == 'm' || $row_employee['gender'] == 'M' ? 'MALE' : 'FEMALE';
$age = "";
if (!empty($row_employee['dob'])) {
$dob = $row_employee['dob'];
$age = (date('Y') - date('Y', strtotime($dob)));
}
?>
<table border="0"
style="border-style: groove;background-color: #ffff0060;margin-top:10px"
width="100%">
<tr>
<td width="50%" style="font-size:15px; ">
<b>NAME :</b>
<?php echo $row_employee['patient_name'] ?>
</td>
<td width="30%" style="font-size:15px;">
<b>Date:</b>
<?php echo date_format(date_create($row_p['checkup_date']), "d-M-Y") ?>
</td>
<!-- <td width="30%" style="font-size:12px; ">
<b>DOB:</b>
<?= !empty($row_employee['dob']) ? date_format(date_create($row_employee['dob']), "d-M-Y") : '' ?>
</td> -->
</tr>
<tr>
<td width="20%" style="font-size:15px; ">
<b>Age</b>
<?php echo $age ?>
</td>
<td width="30%" style="font-size:15px; ">
<b>GENDER:</b>
<?php echo $row_employee['gender'] == 'm' || $row_employee['gender'] == 'M' ? 'MALE' : 'FEMALE' ?>
</td>
</tr>
<tr>
<td width="30%" style="font-size:15px;">
<b>Referred By:</b>
<?php echo getFieldFromTable('doctor_name', 'doctors_master', 'doctor_id', $row_p['referred_by']) ?>
</td>
<td width="30%" style="font-size:15px;">
<b>Lab.Ref.No.</b>
<?php echo $row_p['ticket_no'] ?>
</td>
</tr>
<!-- <tr>
<td width="50%" style="font-size:12px;">
<b>TRADE</b>
<?php echo $row_employee['doj'] ?>
</td>
<td width="50%" style="font-size:12px;">
<b>EMPLOYEE ID</b>
<?php echo $row_employee['emp_code'] ?>
</td>
</tr> -->
<?php } ?>
</table>
<?php
$checkup_section_ids = $row_p['checkup_section_ids'];
$param_present = (explode(',', $row_p['checkup_section_ids']));
$param_present = array_unique($param_present);
//for each Section enabled for the checkup case
// print_r($param_present);
foreach ($param_present as $x => $val) {
$notes='';
$comments='';
$notes .= getTableFieldValue( 'checkup_form_section','notes', 'section_id', $val);
$comments.=(getTableFieldValue( 'checkup_form_section','comments', 'section_id', $val));
?>
<b height=''
style="font-size: 15px; font-family: 'Source Sans Pro', 'Helvetica Neue',Helvetica, Arial, sans-serif;margin-top:10px">
<center>
<?php $test_name=getFieldFromTable('section_name', 'checkup_form_section', 'section_id', $val);
echo $test_name;
?>
</b>
</div>
<table width="100%" style="margin-top: 10px;">
<tr>
<td>
<b> Test Names </b>
</td>
<td>
<b>Result</b>
</td>
<td><b>
Unit</b>
</td>
<td><b>
Ref Range</b>
</td>
</tr>
<?php
//query to load fields for each section
$sql_param = "select a.*,b.* from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
error_log("//query to load fields for each section@@@@@@@!!!!" . $sql_param);
$result_param = mysqli_query($conn, $sql_param);
$param_name = array();
$param_ranges = array();
$param_value = array();
$param_unit = array();
$min= array();
$max= array();
while ($row_param = mysqli_fetch_assoc($result_param)) {
array_push($param_name, $row_param['parameter_name']);
array_push($min, $row_param['starting_range']);
array_push($max, $row_param['ending_range']);
array_push($param_ranges, $row_param['ref_ranges']);
array_push($param_unit, getFieldFromTable('unit_name', 'checkup_parameter_unit_master', 'unit_id', $row_param['unit']));
if ($row_param['input_type'] == 'select') {
array_push($param_value, getFieldFromTable('parameter_value_name', 'checkup_parameter_value', 'parameter_value_id', $row_param['checkup_form_value']));
} else if ($row_param['input_type'] == 'multiselect') {
array_push($param_value, getCommaSeperatedValuesForInClause("select parameter_value_name from checkup_parameter_value", 'parameter_value_id', $row_param['checkup_form_value']));
} else {
array_push($param_value, $row_param['checkup_form_value']);
}
} ?>
<?php
$sql_group_ids = "select count(distinct(a.group_id)) as field_value from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
$result_grp = mysqli_query($conn, $sql_group_ids);
$row_grp = mysqli_fetch_assoc($result_grp);
$total_group_ids = $row_grp['field_value'];
//echo 'hellooooooooooooooooooo';
error_log("total group ids:" . $total_group_ids);
$group_ids = array();
for ($i = 1; $i <= $total_group_ids; $i++) {
$group_id = "select count(group_id) from checkup_parameter where group_id = '$i' and enabled!='N' and checkup_form_section_id = '$val'";
error_log("group id len query:" . $group_id);
$result_group_id = mysqli_query($conn, $group_id);
$row_group_id = mysqli_fetch_array($result_group_id);
array_push($group_ids, $row_group_id['0']);
}
$max_len = max($group_ids);
error_log("max len :" . $max_len);
error_log(" group ids : " . print_r($group_ids, true));
$k = 0;
for ($i = 0; $i < $total_group_ids; $i++) {
$grp=$i+1;
$grp_tital=getTableFieldValue('checkup_parameter_group','group_tital','group_section',$val,'group_no',$grp);
?>
<tr>
<td colspan="<?=$rows_no_groups[$h]?>">
<b
style=" font-size: 15px; font-weight: 600;"><?php if(($grp_tital!='' && $grp_tital!=null )&&($param_value[$k]!=0 && $param_value[$k]!=null && $param_value[$k]!='' )) { echo $grp_tital;}?></b>
</td>
</tr>
<?php $value = $group_ids[$i];
$value2 = $max_len - $value;
while ($value != 0) {
if($param_value[$k]!=0 || $param_value[$k]!=null || $param_value[$k]!='' ){
?>
<tr>
<td width="25%">
<?= $param_name[$k] ?>
</td>
<td width="2%"
style="font-size: 15px;color:<?php if(number_format($param_value[$k])!='' && number_format($param_value[$k])!=null){ if($param_value[$k]<$min[$k]) echo 'blue'; elseif($param_value[$k]>$max[$k]) echo 'red'; else echo 'black'; }
else if( $param_value[$k]='present+' || $param_value[$k]='present++' ||$param_value[$k]='present+++' ||$param_value[$k]='present++++' || $param_value[$k]='Present+' || $param_value[$k]='Present++' ||$param_value[$k]='Present+++' ||$param_value[$k]='Present++++' || $param_value[$k]='PRESENT+' || $param_value[$k]='PRESENT++' ||$param_value[$k]='PRESENT+++' ||$param_value[$k]='PRESENT++++')echo 'red'; ?> ">
<b>
<?php
echo number_format($param_value[$k]) ;
?>
</b>
</td>
<td width="5%"
style="font-size: 15px;;color:<?php if(number_format($param_value[$k])!='' && number_format($param_value[$k])!=null){ if($param_value[$k]<$min[$k]) echo 'blue'; elseif($param_value[$k]>$max[$k]) echo 'red'; else echo 'black'; }
else if( $param_value[$k]='present+' || $param_value[$k]='present++' ||$param_value[$k]='present+++' ||$param_value[$k]='present++++' || $param_value[$k]='Present+' || $param_value[$k]='Present++' ||$param_value[$k]='Present+++' ||$param_value[$k]='Present++++' || $param_value[$k]='PRESENT+' || $param_value[$k]='PRESENT++' ||$param_value[$k]='PRESENT+++' ||$param_value[$k]='PRESENT++++')echo 'red'; ?> ">
<?php
if(is_numeric($param_value[$k])==1){
echo $param_unit[$k];
}else{
echo $param_unit[$k];
}
?>
</td>
<!-- <td width="25%" style="font-size:7px;">Ref Ranges</td> -->
<td width="25%">
<!-- <?= $param_ranges[$k] ?> -->
<?php
$rangs=explode('$', $param_ranges[$k]);
for($r=0;$r<count($rangs);$r++){
if($rangs!=null && $rangs!=''){
echo '<p>'.$rangs[$r].'</p>';}
}
?>
</td>
<?php }$k++;
$value--; ?>
<?php } ?>
<?php while ($value2 != 0) { ?>
<!-- <td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td> -->
</tr>
<?php
$value2--; ?>
<?php } ?>
<?php }?>
</table>
<?php
}
//end of foreach - section header loop
?>
<!-- interpretation -->
<?php
$intep_head='"'.$test_name.'"';
$interp_id=getTableFieldValue('interpretation_master','id','interpretation_header',$intep_head);
if($interp_id!='' && $interp_id!=null){
?>
<b style="font-size: 12px;"> Interpretations:</b>
<?php
$interp_q="select * from interpretation_detail where interpretation_id= '".$interp_id."' ";
$result_interp = mysqli_query($conn, $interp_q);
$p_count=0;
while($row_interp = mysqli_fetch_array($result_interp)){
$interp_values=$row_interp["interpretation_value"];
$interp_values=explode('$',$interp_values);
error_log("interp_values :".print_r($interp_values,true));
?>
<table style="font-size: 12px">
<tr width="10%">
<td width="200px" style="border-style:groove !important;">
<?php if($p_count==0){ echo "<b>".$row_interp['interpretation_key'].'</b>';}
else{
echo $p_count.'. '.$row_interp['interpretation_key'];
}
?>
</td>
<?php
for($p=0;$p<count($interp_values);$p++){
?>
<td width="200px" style="border-style:groove !important;">
<?php if($p_count==0){ echo "<b>".$interp_values[$p].'</b>';}
else{
echo $interp_values[$p];
}
?>
</td>
<?php } ?>
</tr>
</table>
<?php
$p_count++;
}
}
?>
<?php $checkup_id = $_REQUEST['checkup_id'];
$query = "select * from checkup_form where checkup_id=$checkup_id";
error_log("Facts :" . $query);
$result = mysqli_query($conn, $query);
$Facts = mysqli_fetch_array($result);
$query = "select e.emp_sign,e.image_type from employee_signature e left join checkup_form b on e.emp_id = b.doc_attend where b.checkup_id ='" . $checkup_id . "'";
error_log("Signatures :" . $query);
$result1 = mysqli_query($conn, $query);
$sign_row = mysqli_fetch_array($result1);
extract($sign_row);
?>
<table width="90%">
<?php if($comments !=null || $comments !='') {?>
<tr>
<td>
<table
style="font-size: 10px; padding: 6px;background-color: var(--white);display: inline-block;">
<tr>
<td><b style="font-size: 12px;"> Comments:</b></td>
<tr>
<?php
$c=explode('$', $comments);
for($i=0;$i<count($c);$i++){
if($c!=null || $c!=''){
echo '<tr><td>'.$c[$i].'</td></tr>';}
?>
<?php }?>
</table>
</td>
</tr>
<?php } ?>
<tr>
<td style="width: 50%;" align="right"><img id='sign'
style=" width:150px; height:50px;" class="card-img-bottm"
src="data:<?= $sign_row['image_type']; ?>;base64,<?= base64_encode($sign_row['emp_sign']) ?>">
</td>
</tr>
</table>
<?php if ($notes != null || $notes != "") { ?>
<hr style=" border-top: 2px dashed var(--darkWhite);">
<footer width="90%"
style="top:auto;bottom: 0;font-size: small; background-color: blanchedalmond;page-break-after: always;">
<table
style="font-size: 10px;text-transform: none; padding: 6px;background-color: var(--white);display: inline-block;">
<tr>
<td><b style="font-size: 12px;">Note
:</b></td>
</tr>
<?php $n=explode('$', ($notes));
for($i=0;$i<count($n);$i++){
if($n!=null || $n!=''){
echo '<tr><td>'.$n[$i].'</td></tr>';}
?>
<?php }?>
</table>
</footer>
<?php
}
?>
</div>
</div>
<!-- </table> -->
</form>
</body>
<?php
}else{
?>
<body style='margin-right: 0px;margin-left: 0px;'>
<form id="employeeDetailsFormPdf" action="" method="POST">
<input type="hidden" name="htmlText" id="htmlText" />
</form>
<form name="checkup_form_employee" id="checkup_form_employee" method="POST">
<div id="preexam_form_div" class="page">
<?php
$checkup_section_ids = $row_p['checkup_section_ids'];
$param_present = (explode(',', $row_p['checkup_section_ids']));
$param_present = array_unique($param_present);
//for each Section enabled for the checkup case
// print_r($param_present);
foreach ($param_present as $x => $val) {
$notes='';
$comments='';
$notes .= getTableFieldValue( 'checkup_form_section','notes', 'section_id', $val);
$comments.=(getTableFieldValue( 'checkup_form_section','comments', 'section_id', $val));
?>
<!--section header-->
<table width="100%" style="background-color: #ffff0080;">
<tr>
<td width="75%" align="left">
<div style="margin-left: 20px;">
<h3 style=" color: blue;margin-bottom: 0px;text-align: left;"> G.H.C.L. -
SUTRAPADA
</h3>
<h3 style=" color: blue;margin-bottom: 0px;margin-top: 0px;text-align: left;"> HEALTH
CENTRE -
ANURAGNAGAR
</h3>
<h3 style=" color: blue;margin-bottom: 0px;margin-top: 0px;text-align: left;">
<?php
$sql_param = "select a.*,b.* from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
$result_param = mysqli_query($conn, $sql_param);
$header='PATHOLOGY LABORATORY';
while ($row_param = mysqli_fetch_assoc($result_param)) {
$param_type = (explode(',', $row_param['checkup_type_ids']));
$param_type = array_unique($param_type);
for($i=0;$i<count($param_type);$i++){
$tital=getTableFieldValue('checkup_type','checkup_type_code','checkup_type_id',$param_type[$i]);
if($tital!='LAB_TEST'){
$header=getTableFieldValue('checkup_type','checkup_type_name','checkup_type_id',$param_type[$i]);
}
}
}
echo $header;
?>
</h3>
<h3 style="color: blue;margin-bottom: 0px;margin-top: 0px; text-align: left;"> Phone
No.:(02876)(26)5303
</h3>
</div>
</td>
<?php if (isset($row_company['right_com_logo']) && $row_company['right_com_logo'] != null) { ?>
<td width="25%" align="right"><img
src="data:<?php echo $row_company['right_image_type'] ?>;base64,<?php echo base64_encode($row_company['right_com_logo']) ?>"
style="width: 105px; height: 60px; margin:0px; padding: 0px;">
</td>
<?php } ?>
</tr>
<tr>
<td colspan="3" align="center">
<button align="center" id="printPageButton" class="btn btn-success"
onClick="window.print();">Print</button>
</td>
</tr>
</table>
<hr>
<input type="hidden" id="checkup_section_ids" name="checkup_section_ids[]">
<div class="mainPanel">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading" id="panel-heading1">
<b class="panel-title" id="panel-title1"
style="font-size: 15px;display: block; height: 12px;text-decoration: none;font-family: 'Source Sans Pro', 'Helvetica Neue',Helvetica, Arial, sans-serif;">
<center style="font-size: 15px;">PATIENT DETAILS</center>
</b>
</div>
<div class="panel-body">
<div class="row">
<?php
// $emp_id ='5504';
$sql_employee = "select * from patient_master where id=(select emp_id from checkup_form where checkup_id='$checkup_id' )";
$result = mysqli_query($conn, $sql_employee);
//$checkup_id = $_REQUEST['flex_checkup_id'];
// $sql_checkup = "select * from checkup_form where checkup_id='$checkup_id'";
//echo $sql_checkup;
$checkup_result = mysqli_query($conn, $sql_employee);
$row_checkup = mysqli_fetch_assoc($checkup_result);
while ($row_employee = mysqli_fetch_assoc($result)) {
$patient = $row_employee['patient_name'];
$gender = $row_employee['gender'] == 'm' || $row_employee['gender'] == 'M' ? 'MALE' : 'FEMALE';
$age = "";
if (!empty($row_employee['dob'])) {
$dob = $row_employee['dob'];
$age = (date('Y') - date('Y', strtotime($dob)));
}
?>
<table border="0"
style="border-style: groove;background-color: #ffff0060;margin-top:10px"
width="100%">
<tr>
<td width="50%" style="font-size:15px; ">
<b>NAME :</b>
<?php echo $row_employee['patient_name'] ?>
</td>
<td width="30%" style="font-size:15px;">
<b>Date:</b>
<?php echo date_format(date_create($row_p['checkup_date']), "d-M-Y") ?>
</td>
<!-- <td width="30%" style="font-size:12px; ">
<b>DOB:</b>
<?= !empty($row_employee['dob']) ? date_format(date_create($row_employee['dob']), "d-M-Y") : '' ?>
</td> -->
</tr>
<tr>
<td width="20%" style="font-size:15px; ">
<b>Age</b>
<?php echo $age ?>
</td>
<td width="30%" style="font-size:15px; ">
<b>GENDER:</b>
<?php echo $row_employee['gender'] == 'm' || $row_employee['gender'] == 'M' ? 'MALE' : 'FEMALE' ?>
</td>
</tr>
<tr>
<td width="30%" style="font-size:15px;">
<b>Referred By:</b>
<?php echo getFieldFromTable('doctor_name', 'doctors_master', 'doctor_id', $row_p['referred_by']) ?>
</td>
<td width="30%" style="font-size:15px;">
<b>Lab.Ref.No.</b>
<?php echo $row_p['ticket_no'] ?>
</td>
</tr>
<!-- <tr>
<td width="50%" style="font-size:12px;">
<b>TRADE</b>
<?php echo $row_employee['doj'] ?>
</td>
<td width="50%" style="font-size:12px;">
<b>EMPLOYEE ID</b>
<?php echo $row_employee['emp_code'] ?>
</td>
</tr> -->
<?php } ?>
</table>
<b
style="font-size: 15px; font-family: 'Source Sans Pro', 'Helvetica Neue',Helvetica, Arial, sans-serif;margin-top:10px">
<center>
<?php $test_name=getFieldFromTable('section_name', 'checkup_form_section', 'section_id', $val);
echo $test_name;
?>
</b>
</div>
<table width="100%" style="margin-top:10px">
<tr>
<td>
<b> Test Names </b>
</td>
<td>
<b>Result</b>
</td>
<td>
<b> Unit</b>
</td>
<td>
<b> Ref Range</b>
</td>
</tr>
<?php
$space="&nbsp;&nbsp;&nbsp;";
//query to load fields for each section
$sql_param = "select a.*,b.* from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
error_log("//query to load fields for each section@@@@@@@!!!!" . $sql_param);
$result_param = mysqli_query($conn, $sql_param);
$param_name = array();
$param_ranges = array();
$param_value = array();
$param_unit = array();
$min= array();
$max= array();
while ($row_param = mysqli_fetch_assoc($result_param)) {
array_push($param_name, $row_param['parameter_name']);
array_push($min, $row_param['starting_range']);
array_push($max, $row_param['ending_range']);
array_push($param_ranges, $row_param['ref_ranges']);
array_push($param_unit, getFieldFromTable('unit_name', 'checkup_parameter_unit_master', 'unit_id', $row_param['unit']));
if ($row_param['input_type'] == 'select') {
array_push($param_value, getFieldFromTable('parameter_value_name', 'checkup_parameter_value', 'parameter_value_id', $row_param['checkup_form_value']));
} else if ($row_param['input_type'] == 'multiselect') {
array_push($param_value, getCommaSeperatedValuesForInClause("select parameter_value_name from checkup_parameter_value", 'parameter_value_id', $row_param['checkup_form_value']));
} else {
array_push($param_value, $row_param['checkup_form_value']);
}
} ?>
<?php
$sql_group_ids = "select count(distinct(a.group_id)) as field_value from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
$result_grp = mysqli_query($conn, $sql_group_ids);
$row_grp = mysqli_fetch_assoc($result_grp);
$total_group_ids = $row_grp['field_value'];
//echo 'hellooooooooooooooooooo';
error_log("total group ids:" . $total_group_ids);
$group_ids = array();
for ($i = 1; $i <= $total_group_ids; $i++) {
$group_id = "select count(group_id) from checkup_parameter where group_id = '$i' and enabled!='N' and checkup_form_section_id = '$val'";
error_log("group id len query:" . $group_id);
$result_group_id = mysqli_query($conn, $group_id);
$row_group_id = mysqli_fetch_array($result_group_id);
array_push($group_ids, $row_group_id['0']);
}
$max_len = max($group_ids);
error_log("max len :" . $max_len);
error_log(" group ids : " . print_r($group_ids, true));
$k = 0;
for ($i = 0; $i < $total_group_ids; $i++) {
$grp=$i+1;
$grp_tital=getTableFieldValue('checkup_parameter_group','group_tital','group_section',$val,'group_no',$grp);
?>
<tr>
<td colspan="<?=$rows_no_groups[$h]?>">
<?php ?>
<b
style=" font-size: 15px; font-weight: 600;"><?php if(($grp_tital!='' && $grp_tital!=null )&&($param_value[$k]!=0 && $param_value[$k]!=null && $param_value[$k]!='' )) { echo $grp_tital;}?></b>
</td>
</tr>
<?php $value = $group_ids[$i];
$value2 = $max_len - $value;
while ($value != 0) {
if($param_value[$k]!=0 || $param_value[$k]!=null || $param_value[$k]!='' ){
?>
<tr>
<td width="25%">
<?= $param_name[$k] ?>
</td>
<td width="2%"
style="font-size: 15px;;color:<?php if(number_format($param_value[$k])!='' && number_format($param_value[$k])!=null){ if($param_value[$k]<$min[$k]) echo 'blue'; elseif($param_value[$k]>$max[$k]) echo 'red'; else echo 'black'; }
else if( $param_value[$k]='present+' || $param_value[$k]='present++' ||$param_value[$k]='present+++' ||$param_value[$k]='present++++' || $param_value[$k]='Present+' || $param_value[$k]='Present++' ||$param_value[$k]='Present+++' ||$param_value[$k]='Present++++' || $param_value[$k]='PRESENT+' || $param_value[$k]='PRESENT++' ||$param_value[$k]='PRESENT+++' ||$param_value[$k]='PRESENT++++')echo 'red'; ?> ">
<b>
<?php
echo number_format($param_value[$k]) ;
?>
<b>
</td>
<td width="5%"
style="font-size: 15px;;color:<?php if(number_format($param_value[$k])!='' && number_format($param_value[$k])!=null){ if($param_value[$k]<$min[$k]) echo 'blue'; elseif($param_value[$k]>$max[$k]) echo 'red'; else echo 'black'; }
else if( $param_value[$k]='present+' || $param_value[$k]='present++' ||$param_value[$k]='present+++' ||$param_value[$k]='present++++' || $param_value[$k]='Present+' || $param_value[$k]='Present++' ||$param_value[$k]='Present+++' ||$param_value[$k]='Present++++' || $param_value[$k]='PRESENT+' || $param_value[$k]='PRESENT++' ||$param_value[$k]='PRESENT+++' ||$param_value[$k]='PRESENT++++')echo 'red'; ?> ">
<?php
if(is_numeric($param_value[$k])==1){
echo $param_unit[$k];
}else{
echo $param_unit[$k];
}
?>
</td>
<!-- <td width="25%" style="font-size:7px;">Ref Ranges</td> -->
<td width="25%" style="font-size: 9px;">
<!-- <?= $param_ranges[$k] ?> -->
<?php
$rangs=explode('$', $param_ranges[$k]);
for($r=0;$r<count($rangs);$r++){
if($rangs!=null && $rangs!=''){
echo '<p>'.$rangs[$r].'</p>';}
}
?>
</td>
<?php }$k++;
$value--; ?>
<?php } ?>
<?php while ($value2 != 0) { ?>
<!-- <td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td>
<td width="6%" style="font-size: 12px;">&nbsp;</td> -->
</tr>
<?php
$value2--; ?>
<?php } ?>
<?php }?>
</table>
<!-- interpretation -->
<?php
$intep_head='"'.$test_name.'"';
$interp_id=getTableFieldValue('interpretation_master','id','interpretation_header',$intep_head);
if($interp_id!='' && $interp_id!=null){
?>
<b style="font-size: 15px;"> Interpretations:</b>
<?php
$interp_q="select * from interpretation_detail where interpretation_id= '".$interp_id."' ";
$result_interp = mysqli_query($conn, $interp_q);
$p_count=0;
while($row_interp = mysqli_fetch_array($result_interp)){
$interp_values=$row_interp["interpretation_value"];
$interp_values=explode('$',$interp_values);
error_log("interp_values :".print_r($interp_values,true));
?>
<table style="font-size: 15px" width="60%">
<tr>
<td width="200px" style="border-style:groove !important;">
<?php if($p_count==0){ echo "<b>".$row_interp['interpretation_key'].'</b>';}
else{
echo $p_count.'. '.$row_interp['interpretation_key'];
}
?>
</td>
<?php
for($p=0;$p<count($interp_values);$p++){
?>
<td width="200px" style="border-style:groove !important;">
<?php if($p_count==0){ echo "<b>".$interp_values[$p].'</b>';}
else{
echo $interp_values[$p];
}
?>
</td>
<?php } ?>
</tr>
</table>
<?php
$p_count++;
}
}
?>
<?php $checkup_id = $_REQUEST['checkup_id'];
$query = "select * from checkup_form where checkup_id=$checkup_id";
error_log("Facts :" . $query);
$result = mysqli_query($conn, $query);
$Facts = mysqli_fetch_array($result);
$query = "select e.emp_sign,e.image_type from employee_signature e left join checkup_form b on e.emp_id = b.doc_attend where b.checkup_id ='" . $checkup_id . "'";
error_log("Signatures :" . $query);
$result1 = mysqli_query($conn, $query);
$sign_row = mysqli_fetch_array($result1);
extract($sign_row);
?>
<table width="90%">
<?php if($comments !=null || $comments !='') {?>
<tr>
<td>
<table
style="font-size: 10px; padding: 6px;background-color: var(--white);display: inline-block;">
<tr>
<td><b style="font-size: 12px;"> Comments:</b></td>
<tr>
<?php
$c=explode('$', $comments);
for($i=0;$i<count($c);$i++){
if($c!=null || $c!=''){
echo '<tr><td>'.$c[$i].'</td></tr>';}
?>
<?php }?>
</table>
</td>
</tr>
<?php } ?>
<tr>
<td style="width: 50%;" align="right"><img id='sign'
style=" width:150px; height:50px;" class="card-img-bottm"
src="data:<?= $sign_row['image_type']; ?>;base64,<?= base64_encode($sign_row['emp_sign']) ?>">
</td>
</tr>
</table>
<?php if ($notes != null || $notes != "") { ?>
<hr style=" border-top: 2px dashed var(--darkWhite);">
<footer width="90%"
style="top:auto;bottom: 0;font-size: small; background-color: blanchedalmond;page-break-after: always;">
<table
style="font-size: 10px;text-transform: none; padding: 6px;background-color: var(--white);display: inline-block;">
<tr>
<td><b style="font-size: 12px;">Note
:</b></td>
</tr>
<?php $n=explode('$', ($notes));
for($i=0;$i<count($n);$i++){
if($n!=null || $n!=''){
echo '<tr><td>'.$n[$i].'</td></tr>';}
?>
<?php }?>
</table>
</footer>
<?php
}
?>
</div>
</div>
<?php
}
//end of foreach - section header loop
?>
<!-- </table> -->
</form>
</body>
<?php } ?>
<script>
// $(document).ready(function() {
// window.print();
// });
// function formSubmit() {
// $("#htmlText").val($("#checkup_form_employee").html());
// document.forms['employeeDetailsFormPdf'].action = "pdf_dynamic.php";
// document.forms['employeeDetailsFormPdf'].method = "post";
// document.forms['employeeDetailsFormPdf'].submit();
// }
</script>