| Current Path : /var/www/html/mmishra/erp/views/ |
| Current File : /var/www/html/mmishra/erp/views/ihc_view.php |
<?php
//if (!class_exists($erpView)) {
require_once __DIR__."/erp_view.php";
//}
class ihcView extends erpView {
var $controller;
var $model;
public function __construct($controller, $model) {
error_reporting(E_ALL);
$this->controller = $controller; // instantiate controller
$this->model = $model; // instantiate model
$this->controller->filterText = $_POST['filterText'];
}
public function __destruct() {
if ($this->controller->app == '/' || $this->controller->app == 'about' || $this->controller->app == 'upload' || $this->controller->app == 'logout') {
} else if ($this->controller->menu == 'upload' || $this->controller->menu == 'nodeficit') {
} else {
print(":|:" .$this->erpXupdate($this->controller->loginID, $this->controller->menu). ":|:" .$this->erpError(). ":|:" .$this->erpClock());
}
}
//public function ihcDashboard($action, $tupleID) {
//}
public function ihcDoctor($action, $doctorID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$doctorID = $this->controller->manageDoctor($action, $doctorID);
$doctors = $this->model->listDoctors();
$toolbar = $this->erpToolbar();
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "<table width='100%' class='interface'>
<tr><th width='5%'>#</th><th width='20%'>DoctorName</th><th width='20%'>Designation</th><th width='20%'>Specilization</th><th width='15%'>ContactNo</th><th width='20%'>Email</th></tr>";
if (!$doctorID) {
$str .= "<tr><td>New</td><td><input type='text' name='doctorName' size='30' value=''></td>
<td><input type='text' name='designation' size='30' value='Medical Officer'></td>
<td><input type='text' name='specialization' size='30' value='Physician'></td>
<td><input type='text' name='contactNo' size='30' value=''></td>
<td><input type='text' name='email' size='30' value='@iiita.ac.in'></td>
</tr>";
}
foreach($doctors as $doctor) {
$no++;
$str .= "<tr><td>$no</td>";
if ($doctor['doctorID'] == $doctorID) {
$str .= "<td><input type='text' name='doctorName' size='30' value='" .$doctor['doctorName']. "'></td>
<td><input type='text' name='designation' size='30' value='" .$doctor['designation']. "'></td>
<td><input type='text' name='specialization' size='30' value='" .$doctor['specialization']. "'></td>
<td><input type='text' name='contactNo' size='30' value='" .$doctor['contactNo']. "'></td>
<td><input type='text' name='email' size='30' value='" .$doctor['email']. "'></td>";
} else {
$str .= "<td><a href='' onclick=\"inner('$app/$menu/open/" .$doctor['doctorID']. "'); return false;\">" .$doctor['doctorName']. "</a></td><td>" .$doctor['designation']. "</td><td>" .$doctor['specialization']. "</td><td>" .$doctor['contactNo']. "</td><td>" .$doctor['email']. "</td>";
}
$str .= "</tr>";
}
$str .= "</table>";
return $str;
}
public function ihcStaff($action, $staffID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$staffID = $this->controller->manageStaff($action, $staffID);
$staffs = $this->model->listStaffs();
$toolbar = $this->erpToolbar();
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "<table width='100%' class='interface'>
<tr><th width='5%'>#</th><th width='20%'>StaffName</th><th width='20%'>Designation</th><th width='20%'>Specilization</th><th width='15%'>ContactNo</th><th width='20%'>Email</th></tr>";
if (!$staffID) {
$str .= "<tr><td>New</td><td><input type='text' name='staffName' size='30' value=''></td>
<td><input type='text' name='designation' size='30' value='Nurse'></td>
<td><input type='text' name='specialization' size='30' value='Nursing'></td>
<td><input type='text' name='contactNo' size='30' value=''></td>
<td><input type='text' name='email' size='30' value='@iiita.ac.in'></td>
</tr>";
} else {
$str .= "<tr><td colspan='6'><a href='' onclick=\"inner('$app/$menu/new/0'); return false;\">New</a></td></tr>";
}
foreach($staffs as $staff) {
$no++;
$str .= "<tr><td>$no</td>";
if ($staff['staffID'] == $staffID) {
$str .= "<td><input type='text' name='staffName' size='30' value='" .$staff['staffName']. "'></td>
<td><input type='text' name='designation' size='30' value='" .$staff['designation']. "'></td>
<td><input type='text' name='specialization' size='30' value='" .$staff['specialization']. "'></td>
<td><input type='text' name='contactNo' size='30' value='" .$staff['contactNo']. "'></td>
<td><input type='text' name='email' size='30' value='" .$staff['email']. "'></td>";
} else {
$str .= "<td><a href='' onclick=\"inner('$app/$menu/open/" .$staff['staffID']. "'); return false;\">" .$staff['staffName']. "</a></td><td>" .$staff['designation']. "</td><td>" .$staff['specialization']. "</td><td>" .$staff['contactNo']. "</td><td>" .$staff['email']. "</td>";
}
$str .= "</tr>";
}
$str .= "</table>";
return $str;
}
public function ihcMedicine($action, $medicineID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$medicineID = $this->controller->manageMedicine($action, $medicineID);
$medicines = $this->model->listMedicines();
$data = $this->model->getMedicine($medicineID);
$toolbar = $this->erpToolbar();
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "<table width='100%'>
<tr><th>Medicine #{$medicineID} Detail</td><th>Medicine List</th></tr>
<tr valign='top'><td>
<table class='interface'>
<tr><td>Medicine Name</td><td><input type='text' name='medicineName' size='50' value='" .$data['medicineName']. "'></td></tr>
<tr><td>Expiry Date</td><td><input type='text' name='dateExpity' size='15' value='" .$data['dateExpiry']. "'></td></tr>
<tr><td>Unit Rate</td><td><input type='text' name='unitRate' size='15' value='" .$data['unitRate']. "'></td></tr>
<tr><td>Opening Stock</td><td><input type='text' name='openingStock' size='15' value='" .$data['openingStock']. "'></td></tr>
<tr><td>Received Quantity</td><td><input type='text' name='qtyReceipt' size='15' value='" .$data['qtyReceipt']. "'></td></tr>
<tr><td>Inhand Quantity</td><td><input type='text' name='qtyInhand' size='15' value='" .$data['qtyInhand']. "'></td></tr>
<tr><td>Critical Quantity</td><td><input type='text' name='qtyCritical' size='15' value='" .$data['qtyCritical']. "'></td></tr>
<tr><td>Used Quantity</td><td><input type='text' name='qtyUsed' size='15' value='" .$data['qtyUsed']. "'></td></tr>
<tr><td>Expired Quantity</td><td><input type='text' name='qtyExpired' size='15' value='" .$data['qtyExpired']. "'></td></tr>
</table>
</td><td>
<ol class='listbar'>";
foreach($medicines as $medicine) {
$no++;
$str .= "<li>" .($medicine['medicineID'] == $medicineID ? "<b>" .$medicine['medicineName']. "</b>" : "<a href='' onclick=\"inner('$app/$menu/open/" .$medicine['medicineID']. "'); return false;\">" .$medicine['medicineName']. "</a>"). ' (' .$medicine['status']. ")</li>";
}
$str .= "</ol></td></tr>
</table>
</td></tr>
</table>";
return $str;
}
public function ihcLabtest($action, $testID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$testID = $this->controller->manageLabtest($action, $testID);
$toolbar = $this->erpToolbar('', 1);
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "<table width='100%' class='interface'>
<tr>";
$col = count($this->controller->testGroups);
foreach($this->controller->testGroups as $key => $value) {
$str .= "<th width='" .number_format(100/$col, 2). "%'>$value</th>";
}
$str .= "</tr><tr valign='top'>";
foreach($this->controller->testGroups as $key => $value) {
$labtests = $this->model->listLabtests($key);
$str .= "<td><table width='100%'>
<tr><th width='5%'>#</th><th width='60%'>Test Name</th><th width='35%'>Normal Value</th></tr>
<tr>";
if (!$testID && $key == $testGroup) {
$str .= "<td>New</td>
<td><input type='text' name='testName' size='30' value=''></td>
<td><input type='text' name='normalValue' size='20' value=''></td>";
} else {
$str .= "<td colspan='3'><a href='' onclick=\"inner('$app/$menu/new/0/$key'); return false;\">New</a></td>";
}
$str .= "</tr>";
$no = 0;
foreach($labtests as $labtest) {
$no++;
$clas = $no % 2 ? '' : 'evenlabtest';
$str .= "<tr class='$clas'><td>$no</td>";
if ($labtest['testID'] == $testID) {
$str .= "<td><input type='text' name='testName' size='30' value='" .$labtest['testName']. "'></td>
<td><input type='text' name='normalValue' size='20' value='" .$labtest['normalValue']. "'></td>";
$testGroup = $labtest['testGroup'];
} else {
$str .= "<td><a href='' onclick=\"inner('$app/$menu/open/" .$labtest['testID']. "'); return false;\">" .$labtest['testName']. "</a></td><td>" .$labtest['normalValue']. "</td>";
}
$str .= "</tr>";
}
$str .= "</table></td>";
}
$str .= "</tr></table><input type='hidden' name='testGroup' value='$testGroup'>";
return $str;
}
public function ihcRegistration($action, $opdID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$patientGroup = $this->controller->params[0];
if (!$patientGroup) $patientGroup = 2; //'Student';
$opdID = $this->controller->manageRegistration($action, $opdID);
$patients = $this->model->selectPatient($this->controller->patientGroups[$patientGroup]);
$doctors = $this->model->selectDoctor();
$registrations = $this->model->listRegistrations();
$toolbar = $this->erpToolbar();
$findbar = "<span class='findbar'>";
foreach ($this->controller->patientGroups as $key => $value) {
$findbar .= "<input type='radio' name='patientGroup' value='$key'" .($patientGroup == $key ? ' checked' : ''). " onchange=\"inner('$app/$menu/new/0/'+this.value); return false;\"> $value ";
}
$findbar .= "</span>";
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "<table width='100%' class='interface'>
<tr><th width='5%'>#</th><th width='10%'>OPD No.</th><th width='10%'>Date Time</th><th width='50%'>Patient Detail</th><th>Doctor</th><th width='5%'>Staff</th></tr>";
if ($opdID) {
$str .= "<tr><td colspan='6'><a href='' onclick=\"inner('$app/$menu/new/0'); return false;\">New</a></td></tr>";
} else {
$str .= "<tr><td>New</td><td>Auto generated</td><td>" .date("Y-m-d H:i:s"). "</td>
<td>";
if ($patients) {
$str .= "<select name='patientID' style='width: 176px'>
<option value='0'>Select</option>";
foreach($patients as $key => $value) {
$str .= "<option value='" .$key . "'>$value ($key@iiita.ac.in)</option>";
}
$str .= "</select>";
} else {
$str .= "<input type='text' name='patientID' size='30' value=''>";
}
$str .= " (Dependent Name <input type='text' name='dependent' size='30' value=''>)</td>
<td><select name='doctorID' style='width: 150px'>
<option value='0'>Select</option>";
foreach($doctors as $doctor) {
$str .= "<option value='" .$doctor['doctorID'] . "'>" .$doctor['doctorName']. "</option>";
}
$str .= "</select></td><td>" .$_SESSION['loginID']. "</td></tr>";
}
foreach($registrations as $registration) {
$no++;
$clas = $no % 2 ? '' : 'evenrow';
$str .= "<tr class='$clas'><td>$no</td>";
if ($registration['opdID'] == $opdID) {
$str .= "<td>$opdID</td><td>" .$registration['dateOPD']. "</td>
<td>$findbar<br>";
if ($patients) {
$str .= "<select name='patientID' style='width: 176px'>
<option value='0'>Select</option>";
foreach($patients as $key => $value) {
$str .= "<option value='" .$key . "'" .($registration['patientID'] == $key ? ' selected' : ''). ">$value ($key@iiita.ac.in)</option>";
}
$str .= "</select>";
} else {
$str .= "<input type='text' name='patientID' size='30' value='" .$registration['patientID']. "'>";
}
$str .= " (Dependent Name <input type='text' name='dependent' size='30' value='" .$registration['dependent']. "'>)</td>
<td><select name='doctorID' style='width: 150px'>
<option value='0'>Select</option>";
foreach($doctors as $doctor) {
$str .= "<option value='" .$doctor['doctorID'] . "'" .($doctor['doctorID'] == $row['doctorID'] ? ' selected' : ''). ">" .$doctor['doctorName']. "</option>";
}
$str .= "</select></td><td>" .$_SESSION['loginID']. "</td>";
} else {
$doctor = $this->model->getDoctor($registration['doctorID']);
$str .= "<td><a href='' onclick=\"inner('$app/$menu/new/" .$registration['opdID']. "/" .$registration['patientGroup']. "'); return false;\">OPD#" .$registration['opdID']. "</a></td>
<td>" .$registration['dateOPD']. "</td><td>" .$this->controller->patientGroups[$registration['patientGroup']]. '<br>' .$this->model->getPatientName($registration['patientID']). "</td>
<td>" .$doctor['doctorName']. '<br>' .$doctor['specialization']. "</td>
<td>" .$registration['loginID']. "</td>";
}
$str .= "</tr>";
}
$str .= "</table>";
return $str;
}
public function ihcMedication($action, $opdID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$dateOPD = $this->controller->params[0];
$medicationID = $this->controller->params[1];
if (!$dateOPD) $dateOPD = date("Y-m-d");
//$opdID = $this->controller->manageLabreport($action, $opdID);
$registrations = $this->model->listRegistrations($dateOPD);
$medications = $this->model->listMedications($opdID);
$medicines = $this->model->selectMedicine();
$datePrev = date('Y-m-d', strtotime($dateOPD .' -1 day'));
$dateNext = date('Y-m-d', strtotime($dateOPD .' +1 day'));
$toolbar = "<a href='' onclick=\"inner('$app/testreport/print/$opdID/$dateOPD'); return false;\" title='Print Page'><span class='button'><i class='fas fa-print'></i></span></a>";
$toolbar = $this->erpToolbar($toolbar);
$findbar = "<span class='findbar'>
OPD Date [<a href='' onclick=\"inner('$app/$menu/edit/$opdID/$datePrev'); return false;\" title='Previous Date'><span class='button'><i class='fas fa-angle-double-left'></i></span></a>
$dateOPD" .($dateOPD == date("Y-m-d") ? "<span class='button'><i class='fas fa-angle-double-right'></i></span>" : "<a href='' onclick=\"inner('$app/$menu/edit/$opdID/$dateNext'); return false;\" title='Next Date'><span class='button'><i class='fas fa-angle-double-right'></i></span></a>"). "
]
Patient <select name='opdID' style='width: 200px' onchange=\"inner('$app/$menu/edit/'+this.value+'/$dateOPD'); return false;\" title='Select patient'>
<option value='0'>Select</option>";
foreach ($registrations as $registration) {
$findbar .= "<option value='" .$registration['opdID'] . "'" .($registration['opdID'] == $opdID ? self::SL : ''). ">" .$registration['patientName']. "</option>";
}
$findbar .= "</select></span>";
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "<table width='100%'>
<tr><th>Patient #{$opdID} Detail</th><th>Medication Detail<?th></tr>
<tr valign='top'><td>" .$this->patientDetail($opdID). "</td>
<td><table class='interface'>
<tr><th width='5%'>#</th><th>Medicine Name</th><th>Quantity</th><th>Dated</th><th>Staff</th></tr>";
foreach ($medications as $medication) {
$no++;
$str .= "<tr><td>$no</td>";
if ($medicationID == $medication['medicationID']) {
$str .= "<td><select name='medicineID' style='width: 200px'>";
foreach ($medicines as $medicine) {
$str .= "<option value='" .$medicine['medicineID']. "'" .($medicineID == $medicine['medicineID'] ? self::SL : ''). ">" .$medicine['medicineName']. "</option>";
}
$str .= "</td><td><input type='text' name='qty_out[]' value='" .$medicine['qtyOut']. "' size='5'></td><td nowrap>" .date("Y-m-d H:i:s"). "</td><td>" .date("Y-m-d H:M:s"). "</td><td nowrap>" .$_SESSION['loginID']. "</td>";
} else {
$medicine = $this->model->getMedicine($medication['medicineID']);
$str .= "<td> onchange=\"inner('$app/$menu/edit/$opdID/$dateOPD/" .$medication['medicineID']. "'); return false;\" title='Edit medication'>" .$medicine['medicineName']. "</a></td>
<td>" .$medication['qtyOut']. "</td><td nowrap>" .$medication['dateMedication']. "</td><td>" .$medication['loginID']. "</td>";
}
$str .= "</tr>";
}
if (!$medicationID) {
$str .= "<tr><td>$no</td><td><select name='medicineID'>";
foreach ($medicines as $medicine) {
$str .= "<option value='" .$medicine['medicineID']. "'" .($medicineID == $medicine['medicineID'] ? self::SL : ''). ">" .$medicine['medicineName']. "</option>";
}
$str .= "</td><td><input type='text' name='qty_out[]' value='" .$medicine['qtyOut']. "' size='5'></td><td>" .date("Y-m-d H:i:s"). "</td><td nowrap>" .$_SESSION['loginID']. "</td></tr>";
}
$str .= "</tr></table>
<span class='rightbar'>By: " .$_SESSION['loginID']. "</span></td></tr>
</table>";
return $str;
}
public function ihcLabreport($action, $opdID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$dateOPD = $this->controller->params[0];
if (!$dateOPD) $dateOPD = date("Y-m-d");
$opdID = $this->controller->manageLabreport($action, $opdID);
if ($opdID) {
$registration = $this->model->getRegistration($opdID);
$doctor = $this->model->getDoctor($registration['doctorID']);
$dateOPD = substr($registration['dateOPD'], 0, 10);
$patient = "<h4 align='center'>OPD No.: " .$registration['opdID']. ", Date: " .$dateOPD. str_repeat(' ', 20). "
Patient: " .$this->model->getPatientName($registration['patientID']). ' (' .$this->controller->patientGroups[$registration['patientGroup']]. "), Doctor: " .$doctor['doctorName']. ' (' .$doctor['specialization']. ")</h4>";
}
$registrations = $this->model->listRegistrations($dateOPD);
$datePrev = date('Y-m-d', strtotime($dateOPD .' -1 day'));
$dateNext = date('Y-m-d', strtotime($dateOPD .' +1 day'));
$toolbar = "<span class='toolbar'>
<a href='' onclick=\"inner('$app/$menu/edit/$opdID'); return false;\" title='Refresh Page'><span class='button'><i class='fas fa-sync-alt'></i></span></a>
<a href='' onclick=\"inner('$app/$menu/save/$opdID'); return false;\" title='Save Registration'><span class='button'><i class='far fa-save'></i></span></a>
<a href='' onclick=\"inner('$app/testreport/print/$opdID/$dateOPD'); return false;\" title='Print Page'><span class='button'><i class='fas fa-print'></i></span></a>
</span>";
$findbar = "<span class='findbar'>
OPD Date [<a href='' onclick=\"inner('$app/$menu/edit/$opdID/$datePrev'); return false;\" title='Previous Date'><span class='button'><i class='fas fa-angle-double-left'></i></span></a>
$dateOPD" .($dateOPD == date("Y-m-d") ? "<span class='button'><i class='fas fa-angle-double-right'></i></span>" : "<a href='' onclick=\"inner('$app/$menu/edit/$opdID/$dateNext'); return false;\" title='Next Date'><span class='button'><i class='fas fa-angle-double-right'></i></span></a>"). "
] Patient <select name='opdID' style='width: 176px' onchange=\"inner('$app/$menu/edit/'+this.value+'/$dateOPD'); return false;\" title='Select patient'>
<option value='0'>Select</option>";
foreach($registrations as $registration) {
$findbar .= "<option value='" .$registration['opdID'] . "'" .($registration['opdID'] == $opdID ? ' selected' : ''). ">" .$registration['patientID']. "</option>";
}
$findbar .= "</select></span>";
$str = $this->pageTitle($menu, $findbar, $toolbar);
$str .= "$patient
<table width='100%' class='interface'>
<tr>";
foreach($this->controller->testGroups as $key => $value) {
$str .= "<th>$value</th>";
}
$str .= "</tr><tr valign='top'>";
foreach($this->controller->testGroups as $key => $value) {
$no = 0;
$str .= "<td><table width='100%' class='interface'>
<tr><th width='5%'>#</th><th width='50%'>TestName</th><th width='25%'>NormalValue</th><th width='20%'>TestValue</th></tr>";
$labtests = $this->model->listLabtests($key);
foreach ($labtests as $test) {
$no++;
$labreport = $this->model->getLabreport($opdID, $test['testID']);
$str .= "<tr><td>$no</td>
<td>" .$test['testName']. "<input type='hidden' name='testID[]' value='" .$test['testID']. "'></td>
<td>" .$test['normalValue']. "</td>
<td><input type='text' name='testValue[]' size='10' value='". $labreport['testValue']. "'></td>
</tr>";
}
$str .= "</table></td>";
//$loginID = $registration['loginID'];
}
$str .= "</tr></table>By: " .($loginID ? $loginID : $_SESSION['loginID']) . ' [ Dated: ' .$dateTest. ' ]';
return $str;
}
public function ihcTestreport($action, $opdID) {
$app = $this->controller->app;
$menu = $this->controller->menu;
$institute = $this->model->getInstitute(1);
if ($opdID) {
$registration = $this->model->getRegistration($opdID);
$doctor = $this->model->getDoctor($registration['doctorID']);
$dateOPD = substr($registration['dateOPD'], 0, 10);
}
$toolbar = "<span class='toolbar'>
<a href='' onclick=\"inner('$app/labreport/open/$opdID/$dateOPD'); return false;\" title='Go Back'><span class='button'><i class='fas fa-arrow-circle-left'></i></span></a>
</span>";
$str = $this->pageTitle($menu, $findbar, $toolbar);
if ($opdID) {
$pdf = new ihcReport($institute, 'L', 'mm', 'A4');
$pdf->SetDisplayMode(real, 'default');
// create first page
$pdf->AddPage();
$pdf->SetTitle('ERP PDF Generator');
$pdf->SetAuthor('IIIT-A');
$pdf->SetAutoPageBreak(0);
$pdf->SetFont('Times', 'BU', 13);
$pdf->Cell(0, -5, 'Health Center - Pathology Test Report', 0, 1, 'C');
$pdf->SetFont('Times', 'I', 10);
$pdf->Cell(0, 12, 'Date: ' .date("d-m-Y"), 0, 1, 'R');
$pdf->Ln(2);
$pdf->SetFont('Times', '', 10);
$y = 62;
$pdf->SetXY(20, $y);
$pdf->Cell(30, 5, 'OPD No.', 1, 0, 'L');
$pdf->SetXY(50, $y);
$pdf->Cell(100, 5, $registration['opdID'], 1, 0, 'L');
$pdf->SetXY(150, $y);
$pdf->Cell(30, 5, 'OPD Date', 1, 0, 'L');
$pdf->SetXY(180, $y);
$pdf->Cell(100, 5, $dateOPD, 1, 1, 'L');
$y += 5;
$pdf->SetXY(20, $y);
$pdf->Cell(30, 5, 'Patient Name', 1, 0, 'L');
$pdf->SetXY(50, $y);
$pdf->Cell(100, 5, $this->model->getPatientName($registration['patientID']). ' (' .$this->controller->patientGroups[$registration['patientGroup']]. ')', 1, 0, 'L');
$pdf->SetXY(150, $y);
$pdf->Cell(30, 5, 'Doctor Name', 1, 0, 'L');
$pdf->SetXY(180, $y);
$pdf->Cell(100, 5, $doctor['doctorName']. ' (' .$doctor['specialization']. ')', 1, 1, 'L');
$x = 14;
$y += 10;
$pdf->SetFont('Times', 'B', 10);
foreach($this->controller->testGroups as $key => $value) {
$pdf->SetXY($x, $y);
$pdf->Cell(90, 5, $value, 1, 0, 'C');
$x += 90;
}
$x = 14;
$y1 = $y;
foreach($this->controller->testGroups as $key => $value) {
$x1 = $x;
$y1 += 5;
$pdf->SetFont('Times', 'B', 9);
$pdf->SetXY($x1, $y1);
$pdf->Cell(47, 5, 'Test Name', 1, 0, 'L');
$x1 += 47;
$pdf->SetXY($x1, $y1);
$pdf->Cell(28, 5, 'Normal', 1, 0, 'L');
$x1 += 28;
$pdf->SetXY($x1, $y1);
$pdf->Cell(15, 5, 'Value', 1, 0, 'C');
$pdf->SetFont('Times', '', 8);
$labtests = $this->model->listLabtests($key);
foreach ($labtests as $test) {
$x1 = $x;
$y1 += 5;
$labreport = $this->model->getLabreport($opdID, $test['testID']);
$pdf->SetXY($x1, $y1);
$pdf->Cell(47, 5, $test['testName'], 1, 0, 'L');
$x1 += 47;
$pdf->SetXY($x1, $y1);
$pdf->Cell(28, 5, $test['normalValue'], 1, 0, 'L');
$x1 += 28;
$pdf->SetXY($x1, $y1);
$pdf->Cell(15, 5, $labreport['testValue'], 1, 0, 'C');
}
$x += 90;
$y1 = $y;
}
$pdf->SetFont('Times', 'B', 10);
$y = 185;
$pdf->SetXY(10, $y);
$pdf->Cell(0, 5, '[ Seal & Signatures ]', 0, 1, 'C');
$y += 5;
$pdf->Line(0, $y, 0, $y);
$pdf->SetFont('Helvetica', 'B', 9);
$y += 6;
$pdf->SetXY(20, $y);
$pdf->Write(5, '(Patient)');
$pdf->SetXY(140, $y);
$pdf->Write(5, '(Doctor)');
$pdf->SetXY(265, $y);
$pdf->Write(5, '(Staff)');
$y += 6;
$pdf->Line(0, $y, 310, $y);
$pdf->SetFont('Helvetica', 'I', 6.5);
$y += 1;
$pdf->SetXY(150, $y);
$pdf->Cell(0, 5, 'Processed by: ' .str_repeat('.', 35). ' (dated: ..../..../..........)', 0, 1, 'R');
$outFile = __DIR__ ."/../uploads/report-" .$opdID. ".pdf";
$str = $this->showPDF('reports', $outFile);
}
return $str;
}
public function patientDetail($opdID) {
if ($opdID) {
$registration = $this->model->getRegistration($opdID);
$doctorID = $registration['doctorID'];
$patientID = $registration['patientID'];
$doctor = $this->model->getDoctor($doctorID);
$patientName = $this->model->getPatientName($patientID);
$str = "<h4 align='center'>OPD No.: $opdID, Date: " .$registration['dateOPD']. str_repeat(' ', 20). "
Patient: " .$patientName. ' (' .$this->controller->patientGroups[$registration['patientGroup']]. "), Doctor: " .$doctor['doctorName']. ' (' .$doctor['specialization']. ")</h4>";
}
return $str;
}
}
?>