<?php 
session_start();
require_once 'config.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<link rel="stylesheet" href="assets/fonts/feather.css">
<style type="text/css">
body {
  margin-top: 0px;
  margin-left: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
}
.maintblborder {
  border: 1px solid #CCCCCC;
}
.singlelinedottedtop {
  border-top-width: thin;
  border-top-style: dotted;
  border-top-color: #CCCCCC;
}
.style40 {
  font-size: 14px;
  font-family: Roboto;
  font-weight: bold;
}
.tblewithborder {
  border: thin solid #CCCCCC;
}
.singlestraightline {
  border-left-width: .50px;
  border-left-style: solid;
  border-left-color: #CCCCCC;
}
.commontxtfont {
  font-family: Roboto;
  font-size: 12px;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  color: #333333;
  letter-spacing: 1px;
}
.style42 {font-size: 12px}
.style46 {
  border-left-width: .50px;
  border-left-style: solid;
  border-left-color: #CCCCCC;
  font-family: Roboto;
  font-size: 12px;
}
.style62 {font-family: Roboto; font-size: 12px; font-style: normal; font-weight: bold; font-variant: normal; color: #333333; letter-spacing: 1px; }
.style63 {font-family: Roboto; font-size: 14px;}
.style65 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}
</style>
</head>

<body>
  <?php 
$id = $_REQUEST['id'];
$mrd = $_REQUEST['mrd'];


$sql7_1 = "SELECT * FROM tbl_consultant WHERE MrdNo='$mrd' AND DeleteFlag=0";
$row7_1 = getList($sql7_1);
foreach($row7_1 as $row7){
  $visitdate = $row7['VisitDate'];
$sql2 = "SELECT * FROM tbl_visits WHERE MrdNo='$mrd' AND VisitDate='$visitdate'";
$row2 = getRecord($sql2);
  ?>
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="maintblborder">
  <tr>
    <td width="50%" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="3">
      <tr>
        <td align="center" valign="top" bgcolor="#CCCCCC"><span class="style40">          OPD REPORT </span></td>
      </tr>
      <tr>
        <td><table width="700" border="0" cellspacing="0" cellpadding="4">
          <tr>
            <td width="15%" align="left" valign="top" class="style62">Name</td>
            <td width="3%" align="center" valign="top" class="commontxtfont"><span class="style42">:</span></td>
            <td width="46%" align="left" valign="middle" class="commontxtfont">&nbsp;<?php echo strtoupper($row7['PatientName']); ?></td>
            <td width="16%" align="left" valign="top" class="style46"><span class="style62">Mrd No / Visit </span></td>
            <td width="2%" align="center" valign="top" >:</td>
            <td width="18%" align="left" valign="middle" class="commontxtfont" >&nbsp;<?php echo $row7['MrdNo']."/".$row2['VisitNo']; ?></td>
          </tr>
          <tr>
            <td align="left" valign="top" class="commontxtfont">Age / Gender </td>
            <td align="center" valign="top" class="commontxtfont"><span class="style42">:</span></td>
            <td align="left" valign="middle" class="commontxtfont">&nbsp;<?php echo $row7['Age']."/".strtoupper($row7['Gender']); ?></td>
            <td class="style46">Date </td>
            <td >:</td>
            <td align="left" valign="middle" class="commontxtfont" >&nbsp;<?php echo date("d/m/Y", strtotime(str_replace('-', '/',$visitdate))); ?></td>
          </tr>
          <tr>
            <td align="left" valign="top" class="commontxtfont">Address </td>
            <td align="center" valign="top" class="commontxtfont"><span class="style42">:</span></td>
            <td align="left" valign="middle" class="commontxtfont">&nbsp;<?php echo strtoupper($row7['Address']); ?></td>
            <td class="style46">Mobile</td>
            <td >:</td>
            <td align="left" valign="middle" class="commontxtfont" >&nbsp;<?php echo $row7['Phone']; ?></td>
          </tr>
        </table></td>
        </tr>
      
      <tr>
        <td align="center" valign="top" bgcolor="#CCCCCC"><span class="style40"><span class="style63">Other Findings </span></span></td>
      </tr>
      
      
      <tr>
        <td height=""><table width="100%" border="0" cellspacing="3" cellpadding="4">
          
          <tr>
            <td width="29%" align="left" valign="top">&nbsp;
              <input type="checkbox" name="checkbox" value="checkbox" <?php if($row7['Prognosis'] == 1){?> checked <?php } ?>/>
              <span class="style65">Poor Prognosis </span></td>
            <td width="36%" align="left" valign="top"><input type="checkbox" name="checkbox2" value="checkbox" <?php if($row7['DSH'] == 1){?> checked <?php } ?>/>
              <span class="style65">DSH Risk unformed to OD </span></td>
          
            <td width="35%" align="left" valign="top"><input type="checkbox" name="checkbox3" value="checkbox" <?php if($row7['Admission'] == 1){?> checked <?php } ?>/>
              <span class="style65">Admission / Relatives not Willing at present </span></td>
          </tr>
         
          <tr>
            <td align="left" valign="top">&nbsp;
              <input type="checkbox" name="checkbox4" value="checkbox" <?php if($row7['FollowUp'] == 1){?> checked <?php } ?>/>
              <span class="style65">Follow up with responsible relative </span></td>
            <td align="left" valign="top"><input type="checkbox" name="checkbox5" value="checkbox" <?php if($row7['Irregular'] == 1){?> checked <?php } ?> />
              <span class="style65">Irregular Treatment </span></td>
            <td align="left" valign="top"><input type="checkbox" name="checkbox6" value="checkbox" <?php if($row7['Medication'] == 1){?> checked <?php } ?>/>
              <span class="style65">Self Medication </span></td>
          </tr>
        
        </table>

          <table width="100%" border="0">
            <tr>
              <td width="0" height="0" class="singlelinedottedtop"></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="3" cellpadding="4">
            <tr>
              <td align="left" valign="top"><input type="checkbox" name="checkbox7" value="checkbox"  <?php if($row7['NotoriousChk'] == 1){?> checked <?php } ?>/>
                <span class="style65">Notorious Patient </span></td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td align="left" valign="top" style="text-align:justify;"><?php echo $row7['Notorious'];?> </td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
          </table>
          
          <table width="100%" border="0" cellspacing="3" cellpadding="4">
            <tr>
              <td align="left" valign="top" bgcolor="#CCCCCC"><div align="center"><span class="style40">Remark</span></div></td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td height="27" colspan="2" align="left" valign="top" style="text-align:justify;">&nbsp;<?php echo $row7['Remark'];?></td>
              </tr>
          </table>
        
          <br /></td>
      </tr>
    </table>
    <br /></td>
    <td width="50%" align="left" valign="top">
      
      <table width="100%" border="0" cellspacing="3" cellpadding="4">
 
      <tr>
        <td align="center" valign="top" bgcolor="#CCCCCC"><span class="style40">Detail Notes </span></td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top">&nbsp;<?php echo $row7['Notes'];?></td>
      </tr>
  
      <tr>
        <td align="center" valign="top" bgcolor="#CCCCCC"><span class="style40">Treatment</span></td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="4" class="tblewithborder">
                <tr>
                  <td width="12%" align="center" valign="top" class="tblewithborder">Type</td>
                  <td width="37%" align="center" valign="top" class="tblewithborder">Drug Name </td>
                  <td width="14%" align="center" valign="top" class="tblewithborder">Dose</td>
                  <td width="17%" align="center" valign="top" class="tblewithborder">Freq.</td>
                  <td width="20%" align="center" valign="top" class="tblewithborder">Duration</td>
                </tr>
                <?php  
            $sql7_2 = "SELECT * FROM tbl_consultant_treatments WHERE MrdNo='$mrd' AND VisitDate='$visitdate'";
            $row7_2 = getList($sql7_2);
            foreach($row7_2 as $result){
            ?>
                <tr>
                  <td align="center" valign="top" class="tblewithborder">&nbsp;<?php echo $result['TreatType1'];?></td>
                  <td align="center" valign="top" class="tblewithborder">&nbsp;<?php echo $result['TreatName1'];?></td>
                  <td align="center" valign="top" class="tblewithborder">&nbsp;<?php echo $result['TreatDose1'];?></td>
                  <td align="center" valign="top" class="tblewithborder">&nbsp;<?php echo $result['TreatFreq1'];?></td>
                  <td align="center" valign="top" class="tblewithborder">&nbsp;<?php echo $result['TreatDur1'];?></td>
                </tr>
                 <?php } ?>
              </table></td>
      </tr>
      
      <tr>
        <td align="left" valign="top" bgcolor="#CCCCCC"><div align="center"><span class="style40">Special Notes </span></div></td>
      </tr>
      <tr>
        <td align="left" valign="top">&nbsp;<?php echo $row7['SpecialNote'];?></td>
      </tr>
      <tr>
        <td align="left" valign="top" bordercolor="#F0F0F0" bgcolor="#CCCCCC"><div align="center"><span class="style40">Follow Up Date </span></div></td>
      </tr>
      <tr>
        <td align="left" valign="top" bordercolor="#F0F0F0" bgcolor="#FFFFFF">&nbsp;
          <?php echo date("d/m/Y", strtotime(str_replace('-', '/',$row7['FollowUpDate']))); ?></td>
      </tr>
    
    </table>
    <br /></td>
  </tr>
</table>
<hr>
<?php } ?>
</body>
</html>
