<?php

include "../../myDatabase1.php";
$registrationNo = $_GET['registrationNo'];
$ro = new database1();
$ro->getPatientProfile($registrationNo);
$ro->setPatientRecord($ro->getRegistrationDetails_patientNo());
echo "\r\n<style type='text/css'>\r\n.informationLabel {\r\nfont-size:15px;\r\nfont-weight:bold;\r\n}\r\n\r\n.initialDiagnosis {\r\n\tborder: 1px solid #CCC;\r\n\tcolor: #000;\r\n\theight:80px;\r\n\twidth: 350px;\r\n\tpadding:4px 4px 4px 2px;\r\n}\r\n\r\n\r\n</style>";
$room = preg_split("/\\_/", $ro->getRegistrationDetails_room());
echo "<br>";
if ($ro->getRegistrationDetails_dateUnregistered() == "") {
    echo "<a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/discharged/discharged.php?registrationNo={$registrationNo}&protoType=Discharged&room=" . $ro->getRegistrationDetails_room() . "'><img src='http://" . $ro->getMyUrl() . "/COCONUT/myImages/unlock.jpeg'></a>&nbsp;&nbsp;<font size=2 color=red><b>" . $ro->getRegistrationDetails_type() . "</b></font><br>";
} else {
    echo "<a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/discharged/discharged.php?registrationNo={$registrationNo}&protoType=Undischarged&room='><img src='http://" . $ro->getMyUrl() . "/COCONUT/myImages/locked1.jpeg'></a>&nbsp;&nbsp;<font size=2 color=red><b>" . $ro->getRegistrationDetails_type() . "</b></font><br>";
}
echo "<font class='informationLabel'>Patient No:</font>&nbsp;" . $ro->getRegistrationDetails_patientNo();
echo "<br><font class='informationLabel'>Registration No:</font>&nbsp;" . $ro->getRegistrationDetails_registrationNo();
echo "<br><font class='informationLabel'>Age:</font>&nbsp;" . $ro->getPatientRecord_age();
echo "<br><font class='informationLabel'>Gender:</font>&nbsp;" . $ro->getPatientRecord_gender();
echo "<br><font class='informationLabel'>Civil Status:</font>&nbsp;" . $ro->getPatientRecord_civilStatus();
echo "<br><font class='informationLabel'>Birth Date:</font>&nbsp;" . $ro->getPatientRecord_Birthdate();
echo "<br><font class='informationLabel'>Contact No#:</font>&nbsp;" . $ro->getPatientRecord_contactNo();
echo "<br><font class='informationLabel'>Senior:</font>&nbsp;" . $ro->getPatientRecord_senior();
echo "<br><font class='informationLabel'>PhilHealth:</font>&nbsp;" . $ro->getPatientRecord_phic();
echo "<br><font class='informationLabel'>PhilHealth Type:</font>&nbsp;" . $ro->getPHICtype_patientRecord();
echo "<br><font class='informationLabel'>Company:</font>&nbsp;" . $ro->getRegistrationDetails_company();
echo "<br><font class='informationLabel'>Time Registered:</font>&nbsp;" . $ro->getRegistrationDetails_timeRegistered();
echo "<br><font class='informationLabel'>Date Registered:</font>&nbsp;" . $ro->getRegistrationDetails_dateRegistered();
echo "<br><font class='informationLabel'>Branch Registered:</font>&nbsp;" . $ro->getRegistrationDetails_branch();
echo "<br><font class='informationLabel'>Case Type:</font>&nbsp;<a href='#' style='text-decoration:none; color:black;'>" . $ro->getRegistrationDetails_caseType() . "</a>";
echo "<br><font class='informationLabel'>Package:</font>&nbsp;<a href='#' style='text-decoration:none; color:black;'>" . $ro->getRegistrationDetails_package() . "</a>";
echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=PROFESSIONAL FEE&username={$username}&show=&desc=' target='rightFrame'><font size=2>Doctor</font></a></li>";
echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=LABORATORY&username={$username}&show=&desc=' target='rightFrame'><font size=2>Laboratory</font></a></li>";
echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=RADIOLOGY&username={$username}&show=&desc=' target='rightFrame'><font size=2>Radiology</font></a></li>";
echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=MEDICINE&username={$username}&show=&desc=' target='rightFrame'><font size=2>Medicine</font></a></li>";
echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=SUPPLIES&username={$username}&show=&desc=' target='rightFrame'><font size=2>Supplies</font></a></li>";
echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=OTHERS&username={$username}&show=&desc=' target='rightFrame'><font size=2>Others</font></a></li>";
if ($ro->getRegistrationDetails_room() != "OPD_OPD") {
    // enable room
    echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/patientChargesTitle.php?registrationNo={$registrationNo}&title=Room And Board&username={$username}&show=&desc=' target='rightFrame'><font size=2>Room</font></a></li>";
} else {
    //disable room
    echo "";
}
echo "</ul>";
echo "<ul>";
if ($ro->getRegistrationDetails_type() == "IPD" && $ro->selectNow("reportHeading", "information", "reportName", "Credit Limit") == "Activate" && $ro->selectNow("registrationDetails", "LimitCASH", "registrationNo", $registrationNo) != "") {
    //setter pra sa allowed credit limit ng ipd
    //$ro->viewCreditLimit_setter($registrationNo,"PATIENT","cashUnpaid",$username);
    //current balance ng patient
    //$current = $ro->getCurrentCredit($registrationNo,$ro->viewCreditLimit_setter_limitTo(),$ro->viewCreditLimit_setter_limitVia()) - $ro->getCurrentPaid($registrationNo,$ro->viewCreditLimit_setter_limitTo(),$ro->viewCreditLimit_setter_limitVia());
    if ($ro->selectNow("registrationDetails", "LimitCASH", "registrationNo", $registrationNo) > $ro->may_naibayad_naba_ang_patient($registrationNo)) {
        //enable charges
        //echo "<li><a href='http://".$ro->getMyUrl()."/COCONUT/availableCharges/searchCharges.php?registrationNo=".$ro->getRegistrationDetails_registrationNo()."&username=$username&room=".$ro->getRegistrationDetails_room()."&batchNo=$batchNo' target='rightFrame'><font size=2>Add Charges</font></a></li>";
        //echo "<li><a href='http://".$ro->getMyUrl()."/COCONUT/Doctor/searchDoctor.php?registrationNo=".$ro->getRegistrationDetails_registrationNo()."&username=$username&room=".$ro->getRegistrationDetails_room()."&batchNo=$batchNo' target='rightFrame'><font size=2>Add Doctor</font></a></li>";
        //echo "<li><a href='http://".$ro->getMyUrl()."/COCONUT/availableMedicine/searchMedicine.php?registrationNo=".$ro->getRegistrationDetails_registrationNo()."&username=$username&inventoryFrom=PHARMACY&room=".$ro->getRegistrationDetails_room()."&batchNo=$batchNo' target='rightFrame'><font size=2>Add Medicine</font></a></li>";
        //echo "<li><a href='http://".$ro->getMyUrl()."/COCONUT/availableSupplies/searchSupplies.php?registrationNo=".$ro->getRegistrationDetails_registrationNo()."&username=$username&inventoryFrom=CSR&batchNo=$batchNo' target='rightFrame'><font size=2>Add Supplies</font></a></li>";
        //echo "<li><a href='http://".$ro->getMyUrl()."/COCONUT/patientProfile/ECART/cartHandler.php?registrationNo=".$ro->getRegistrationDetails_registrationNo()."&username=$username&room=".$ro->getRegistrationDetails_room()."&batchNo=$batchNo' target='rightFrame'><font size=2>Charges Cart</font></a></li>";
        echo "<li><a href='http://" . $ro->getMyUrl() . "/COCONUT/patientProfile/ECART/cartHandler.php?registrationNo=" . $ro->getRegistrationDetails_registrationNo() . "&username={$username}&room=" . $ro->getRegistrationDetails_room() . "&batchNo={$batchNo}' target='rightFrame'><font size=2>Charges Cart</font></a></li>";
    } else {
        //disable charges
        echo "<li><a href='#'><font size=1 color=red>Limit Exceeded</font> <img src='http://" . $ro->getMyUrl() . "/COCONUT/myImages/locked1.jpeg'></a></li>";
echo "<br>";
echo "<center><font size=4><b>PAGADIAN CITY MEDICAL CENTER</b></font></center>";
echo "<center><b><font size=3><b>LABORATORY DEPARTMENT</b></font></b></center>";
echo "<center><font size=3>Cabrera St., Pagadian City</font></center>";
echo "<center><font size=3>Tel No. 062-2143237</font></center>";
echo "<br><br>";
echo "<center>";
echo "<table border=0 cellspacing=0 cellpadding=1 width='100%' >";
echo "<tr>";
echo "<td>&nbsp;<b>Name:</b>&nbsp;" . $ro->getPatientRecord_lastName() . ", " . $ro->getPatientRecord_firstName() . "</td>";
echo "<td>&nbsp;<b>Age/Sex:</b>&nbsp;" . $ro->getPatientRecord_Age() . "/" . $ro->getPatientRecord_gender() . "</td>";
echo "<Td>&nbsp;<b>Date:</b>&nbsp;" . date("M d, Y") . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;<b>D.O.B:</b>&nbsp;" . $ro->getPatientRecord_birthDate() . "</td>";
echo "<Td>&nbsp;<b>WARD:</b>&nbsp;" . $ro->getRegistrationDetails_type() . "</td>";
echo "</tr>";
echo "</table>";
echo "<Br><br>";
$ro->coconutFormStart("POST", "addLabToPatient.php");
$ro->coconutHidden("registrationNo", $registrationNo);
$ro->coconutHidden("itemNo", $itemNo);
$ro->coconutHidden("chargesCode", $chargesCode);
$ro->coconutHidden("username", $username);
$ro->coconutHidden("date", date("M_d_Y"));
echo "<textarea id='result' name='result'>" . $ro->selectNow("labResultList", "template", "templateNo", $templateNo) . "</textarea>";
$ro->coconutFormStop();
?>


<script type="text/javascript">