ESH/fitness_certificate_pdf.php

317 lines
9.5 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php include_once('tcpdf/tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$lg = Array();
$l['a_meta_charset'] = 'UTF-8';
$l['a_meta_dir'] = 'ltr';
$l['a_meta_language'] = 'hi';
$lg['w_page'] = 'page';
// set some language-dependent strings (optional)
$pdf->setLanguageArray($lg);
// ---------------------------------------------------------
// set font
$pdf->SetFont('freesans', '', 12);
// add a page
$pdf->AddPage();
include('includes/config/config.php');
error_reporting(0);
while (ob_get_level())
ob_end_clean();
header("Content-Encoding: None", true);
$sql_for_fitness="select g.*, e.file_name,f.state, e.emp_sign as sign, e.qualification,e.registration_no,e.emp_id as sign_id, f.ohc_type_name, f.ohc_logo, f.icon_text, f.image_type from ohc_type f, sickness g left join employee_signature e on g.doctor_last_attended=e.emp_id where g.sickness_id = '".$_POST['flex_sickness_id']."' ";
//echo $sql_for_fitness;
//print_r($_POST);
$result_for_fitness= mysqli_query($conn,$sql_for_fitness);
$row_for_fitness= mysqli_fetch_assoc($result_for_fitness);
@extract($row_for_fitness);
$from_date=strtoupper(date_format(date_create($row_for_fitness['from_date']),"d-M-Y "));
$to_date=strtoupper(date_format(date_create($row_for_fitness['to_date']),"d-M-Y "));
$date_return=strtoupper(date_format(date_create($row_for_fitness['date_return']),"d-M-Y "));
$justifiable_from=strtoupper(date_format(date_create($row_for_fitness['justifiable_from']),"d-M-Y "));
$justifiable_to=strtoupper(date_format(date_create($row_for_fitness['justifiable_to']),"d-M-Y "));
$not_justifiable_from=strtoupper(date_format(date_create($row_for_fitness['not_justifiable_from']),"d-M-Y "));
$not_justifiable_to=strtoupper(date_format(date_create($row_for_fitness['not_justifiable_to']),"d-M-Y "));
$appointment_date=strtoupper(date_format(date_create($row_for_fitness['sickness_date']),"d-M-Y "));
$query_for_patient="select UPPER(a.patient_name) as patient_name,b.dept_name from patient_master a left join department b on a.dept_id=b.dept_id where a.id=$emp_id ";
//echo $query_for_patient;
$result_for_patient = @mysqli_query($conn,$query_for_patient);
$row_for_patient = @mysqli_fetch_array($result_for_patient);
// echo $row_emp_sign['modified_by'];
$query_for_company="select company_name, company_logo, image_type from company_profile ";
//echo $query_for_company;
$result_for_company = @mysqli_query($conn,$query_for_company);
if($row_for_company = @mysqli_fetch_array($result_for_company)){
@extract($row_for_company);
}
$path = 'images/';
$filename = $company_name;
$filepath = $path.$filename;
// If a physical file is not available then create it
// If the DB data is fresher than the file then make a new file
$result = file_put_contents($filepath, $company_logo);
if($result === FALSE)
{
die(__FILE__.'<br>Error - Line #'.__LINE__.': Could not create '.$filepath);
}
$pdf->setCellPaddings( $left = '2px', $top = '2px', $right = '2px', $bottom = '2px');
$pdf->Image($filepath,12, 12, 40, 30, '', '', '', false, 150, '', false, false, 0, false, false, false );
$html = <<<EOD
<style>
.tbl1{
font-size:8px;
border: 1px solid black;
border-collapse: collapse;
font-weight:1200;
}
.tbl1 td{
font-size:8px;
border: 1px solid black;
border-collapse: collapse;
font-weight:1200;
padding: 1px;
}
.tbl2{
font-size:8px;
border-collapse: collapse;
font-weight:1200;
}
.tbl2 td{
font-size:10px;
border-collapse: collapse;
font-weight:1200;
padding: 10px;
}
</style>
<table class="tbl1">
<tr>
<td rowspan="4"> </td>
<td rowspan="4" align="center"><b>MAIHAR IU</b></td>
<td><b>Department</b></td>
<td><b>OCCUPATIONAL HEALTH CENTRE</b></td>
</tr>
<tr >
<td><b>Document No.</b></td>
<td><b>RCC/MIU/OHC/OPD-04</b></td>
</tr>
<tr >
<td><b>Revision</b></td>
<td><b>0.0</b></td>
</tr>
<tr >
<td><b>Implementation Date</b></td>
<td><b>01.04.2016</b></td>
</tr>
<tr >
<td align="center" colspan="4"><b>Fitness Certificate</b></td>
</tr>
</table>
<br>
<br>
<table class="tbl2">
<tr >
<td align="center" colspan="3"><b>कार्यस्थल पर वापसी प्रश्नवाली</b></td>
</tr>
<tr >
<td align="center" colspan="3"><b>व्यावसायिक चिकित्सा विभाग</b></td>
</tr>
<hr>
<tr >
<td align="left" ><br><br>नाम :&nbsp;&nbsp; {$row_for_patient['patient_name']}</td>
<td align="center" ><br><br>पास नं :&nbsp;&nbsp; {$row_for_patient['emp_code']}</td>
<td align="right" ><br><br>डिपार्टमेंट:&nbsp; {$row_for_patient['dept_name']}</td>
</tr>
<tr >
<td align="center" colspan="3"><b>बीमारी के बाद कार्यस्थल पर आपका स्वागत है |</b></td>
</tr>
<tr >
<td align="left" colspan="2">आप कैसा महसूस कर रहे हैं ?</td>
<td align="right"> सामान्य / कमज़ोर / बीमार</td>
</tr>
<tr>
<td>आप दिनांक&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$from_date}</td>
<td>से &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$to_date} &nbsp;&nbsp;तक बीमार थे</td>
</tr>
<tr>
<td colspan="1">आपके बीमार पड़ने की क्या वजह थी?</td>
<td colspan="2">{$sickness_name}</td>
</tr>
<tr>
<td colspan="1">आपने अपना इलाज कहा करवाया?</td>
<td colspan="2">{$agency}</td>
</tr>
<tr>
<td colspan="2">आपने क्या कंपनी की डिस्पेंसरी या अपने अधिकारी को बीमारी के बारे में बताया?</td>
<td colspan="1">(हां / नहीं)</td>
</tr>
<tr>
<td align="left" colspan="1"><p><br><br><b>हस्ताक्षर कर्मचारी</b></p></td>
<td align="right" colspan="2"><p><br><br><b>हस्ताक्षर चिकित्सक</b></p></td>
</tr>
</table>
EOD;
$pdf->Ln();
$html =$html. <<<EOD
<br>
<p></p>
<hr>
<table class="tbl2" style="margin-top:20px">
<tr>
<td ><p ><br><br>Mr &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$row_for_patient['patient_name']} </p></td>
<td><p ><br><br>Per No./Gate pass No &nbsp;&nbsp;&nbsp; {$row_for_patient['emp_code']}</p></td>
</tr>
<tr>
<td><p >Dept./Contractor Name: &nbsp; {$row_for_patient['dept_name']} </p> </td>
<td><p >is fit to attend his regular</p> </td>
</tr>
<tr>
<td><p >duties from : &nbsp;&nbsp;&nbsp; {$date_return}</p></td>
<td><p >in the shift alloted to him.</p></td>
</tr>
<tr>
<td><p >Period of absence is justifiable from &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$justifiable_from}</p> </td>
<td><p >to &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$justifiable_to}</p></td>
</tr>
<tr>
<td><p >Not justifiable from : {$not_justifiable_from}</p></td>
<td><p >to &nbsp; {$not_justifiable_to}</p></td>
</tr>
<tr>
<td><p ><br><br><b>Date:&nbsp;&nbsp; {$sickness_date}</b></p></td>
<td><p ><br><br><b>Signatute of Medical Officer stamp</b></p></td>
</tr>
</table>
<table class="tbl2" style="margin-top:20px">
<tr>
<td ><p ><br><br>Mr &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$row_for_patient['patient_name']} </p></td>
<td><p ><br><br>Per No./Gate pass No &nbsp;&nbsp;&nbsp; {$row_for_patient['emp_code']}</p></td>
</tr>
<tr>
<td><p >Dept./Contractor Name: &nbsp; {$row_for_patient['dept_name']} </p> </td>
<td><p >is fit to attend his regular</p> </td>
</tr>
<tr>
<td><p >duties from : &nbsp;&nbsp;&nbsp; {$date_return}</p></td>
<td><p >in the shift alloted to him.</p></td>
</tr>
<tr>
<td><p >Period of absence is justifiable from &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$justifiable_from}</p> </td>
<td><p >to &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$justifiable_to}</p></td>
</tr>
<tr>
<td><p >Not justifiable from : {$not_justifiable_from}</p></td>
<td><p >to &nbsp; {$not_justifiable_to}</p></td>
</tr>
<tr>
<td><p ><br><br><b>Date:&nbsp;&nbsp; {$sickness_date}</b></p></td>
<td><p ><br><br><b>Signatute of Medical Officer stamp</b></p></td>
</tr>
</table>
EOD;
// $path = 'images/';
// $filename = $file_name;
// $filepath = $path.$filename;
// // If a physical file is not available then create it
// // If the DB data is fresher than the file then make a new file
// if(!is_file($filepath) || strtotime($row['last_update']) > filemtime($filepath))
// {
// $result = file_put_contents($filepath, $sign);
// if($result === FALSE)
// {
// die(__FILE__.'<br>Error - Line #'.__LINE__.': Could not create '.$filepath);
// }
// }
// $pdf->Image($filepath,150, 250, 30, 10, $file_type, '', '', false, 150, '', false, false, 0, false, false, false );
// $pdf->Image($filepath,150, 160, 30, 10, $file_type, '', '', false, 150, '', false, false, 0, false, false, false );
$pdf->WriteHTML($html, true, 0, true, 0);
$pdf->Output('fitness_Certificate.pdf', 'I');
?>