<?php session_start();

include('includes/config/config.php');
include_once("includes/functions.php");
include_once("log_entry.php");
mysqli_query($conn, 'SET character_set_results=utf8');
error_reporting(0);

$query = "select * from company_profile where company_id = 5";
$result = mysqli_query($conn, $query);
$row_for_company = mysqli_fetch_array($result);
@extract($row_for_company);
?>



<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <title>Experience Certificate</title>
    <style>
    .print {
        position: absolute;
        right: 11%;
    }

    body {
        height: 100%;
        /* background-color: black; */
        width: auto;
    }

    @media print {
        #printPageButton {
            display: none;
        }
    }

    body {
        font-family: Arial, Helvetica, sans-serif
    }

    table {
        border-collapse: collapse;
    }

    .canteen {
        background-color: #27AE60;
        /* position: relative; */
        left: 20%;
        text-align: center;
        padding-left: 10%;
        padding-right: 10%;
        color: white;
        font-weight: bold;
    }

    .leftalign {
        text-align: left;
    }

    .rightalign {
        text-align: right;
    }

    .subTitle {
        text-align: center;
        font-size: medium;
        font-weight: bold;
    }

    p {
        font-size: medium;
    }

    .center {
        padding: 20px;

        width: 100%;
        word-wrap: break-word;
        font-weight: bold;
    }
    </style>
</head>

<body>

    <center>
        <table>
            <tr>
                <td>

                    <div class="container">
                        <div class="container">
                            <div class="container">

                                <?php
                            include "pdf_ohc_header.php";
                            ?>
                                <button id="printPageButton" class="btn btn-success print"
                                    onClick="window.print();">Print</button>

                                <br>
                                <hr>
                                <br>
                                <?php 
													 error_reporting(E_ERROR | E_PARSE);
                                                     $id =$_REQUEST['flex_sickness_id'];
                                                     
                                                         
                                                     
                                                     //echo $id;
                                                     
                                                     $query = "select s.*, e.patient_name,e.dob,e.doj,e.designation_id from sickness s, patient_master e where s.emp_id=e.id and s.sickness_id = '".$id."' ";
                                                     //echo $query;
                                                     $existingAilmentList ="";
                                                     $ailment=array();
                                                     if (!$result = @mysqli_query($conn,$query)) {
                                                                 exit(mysqli_error($conn));
                                                             
                                                     } else{
                                                             $row=@mysqli_fetch_array($result);
                                                             @extract($row);
                                                             $ailment= explode(',',$row['ailment_name']);
                                                     for($i=0;$i<count($ailment);$i++){
                                                        if($i==(count($ailment)-1)){ $existingAilmentList.=getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment[$i]);}
                                                        else{
                                                        $existingAilmentList.=getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment[$i]).",";}
                                                     }

error_log('ailment'.$existingAilmentList);

                                                     }
                                                     
                                                      ?>


                                <h4 class="canteen">Experience Certificate</h4>
                                <h4 class="subTitle">TO WHOM IT MAY CONCERN</h4>

                                <br>

                                <h6 class="rightalign">DATE :
                                    <?php echo date("d-M-Y", strtotime($row['approval_date'])) ?> </h6>

                                <br><br>
                                <div class="center">
                                    <span>This is to certify that
                                        Mr./Mrs./Shri/Miss</span><span><u><?='&nbsp;&nbsp;&nbsp;'.$row['patient_name']." &nbsp;&nbsp;&nbsp; "?></u></span>
                                    <span>Age</span><span><u><?='&nbsp;&nbsp;&nbsp;'.(date('Y') - date('Y',strtotime($row['dob'])))." &nbsp;&nbsp;&nbsp; "?></u></span>
                                    <span>years, has working as a
                                    </span><span><u><?='&nbsp;&nbsp;&nbsp;'.getTableFieldValue("designation","designation_name","designation_id",$row['designation_id'])." &nbsp;&nbsp;&nbsp; "?></u></span>
                                    <span>at our hospital since
                                        last</span><span><?php if($row['doj']!='' ||$row['doj']!=null) echo '&nbsp;&nbsp;&nbsp;'.(date('Y') - date('Y',strtotime($row['doj'])))." &nbsp;&nbsp;&nbsp; ";  else echo "____"?></u></span>
                                    <span>years</span>
                                    <br>
                                    <br>

                                    <span>He/She is very sincere, intelligent, heard working & dedicated enthusiastic
                                        during his professional carrier.</span>

                                    <br>

                                    <br>
                                    <span>
                                        During this period, his services are found to be satisfactory in carrying out
                                        the job duties, his responsibilities are to:
                                    </span>
                                    <br>
                                    <br>
                                    <span>
                                        Direct employee health services of industrial organization, Interpret plant and
                                        departmental health policies & regulations to paramedical staff
                                        employees.Coordinate activities of personnel rendering assistance to physician
                                        nursing care to employees.
                                    </span>
                                    <br>
                                    <br>
                                    <span>
                                        Demonstrates accountability to professional development that improves the
                                        quality of professional practice the quality of patient care.
                                        Apply the nursing process within the framework of relationship based care to
                                        create a healing environment.

                                    </span>
                                    <br>
                                    <br>
                                    <span>
                                        We heartily appreciate his presence in our hospital and wish his good future and
                                        professional growth in his future life.
                                    </span>
                                    <br>

                                    <br><br><br>



                                    <div class="leftalign">
                                        <span>Sincerely,</span>
                                        <br><br>

                                        <?php $query = "select e.emp_sign,e.image_type,p.patient_name from employee_signature e left join sickness b on  e.emp_id = b.doctor_last_attended left join patient_master p on  p.id = b.doctor_last_attended where b.sickness_id ='" . $row['sickness_id'] . "'";
                            // error_log("Signatures :" . $query);

                            $result1 = mysqli_query($conn, $query);

                            $sign_row = mysqli_fetch_array($result1);

                            extract($sign_row);
 ?>

                                        <div class="row">
                                            <div style="width: 50%;" class="leftailgn">
                                                <?php if(!empty($sign_row['emp_sign'])) {?>
                                                <img id='sign' style="text-align:center; width:150px; height:80px;"
                                                    class="card-img-bottm"
                                                    src="data:<?= $sign_row['image_type']; ?>;base64,<?= base64_encode($sign_row['emp_sign']) ?>">
                                                <?php } ?>
                                            </div>
                                            <div style="width: 50%;" align="right">

                                            </div>
                                        </div>
                                        <!-- <div class="row">
                                            <div style="width: 50%;" class="center">

                                                <span><?= $sign_row["patient_name"]?></span>
                                            </div>
                                            <div style="width: 50%;" align="right">

                                            </div>
                                        </div> -->



                                        <div class="row">
                                            <div style="width: 50%;" class="leftailgn">

                                                <span>(SIGNATURE OF DOCTOR)</span>
                                            </div>
                                            <div style="width: 50%;" align="right">

                                            </div>
                                        </div>

                                    </div>



                                </div>



                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </center>





    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
        integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
    </script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
        integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
    </script>
</body>

</html>