<?php 
session_start();
require_once 'config.php';
?>
<!DOCTYPE html>
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="robotofont.css" rel="stylesheet">
<link rel="stylesheet" href="assets/fonts/feather.css">
<link rel="stylesheet" href="font-awesome.min.css">

<style type="text/css">
body {
  margin-top: 0px;
  margin-left: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
}
.maintblborder {
  border: 1px solid #ffffff;
}
.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: 14px;
  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: 15px;
  font-weight: 100; 
}
.style62 {font-family: Roboto; font-size: 15px; font-style: normal; font-weight: normal; font-variant: normal; color: #333333; letter-spacing: 1px; }
.style63 {font-family: Roboto; font-size: 14px;}
.style67 {border: thin solid #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 14px;font-weight: normal; }
</style>
</head>
<body>

  <script type="text/javascript">
    window.print();
     window.onafterprint = window.close;
  </script>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

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

$sql7_1 = "SELECT * FROM tbl_consultant WHERE MrdNo='$mrd' AND VisitDate='$visitdate' AND DeleteFlag=0";
$row7 = getRecord($sql7_1);

$sql2 = "SELECT * FROM tbl_visits WHERE MrdNo='$mrd' AND VisitDate='$visitdate' AND DeleteFlag=0";
$row2 = getRecord($sql2);
  ?>
<table width="600" border="0" cellspacing="0" cellpadding="2" class="maintblborder">
  <tr>
    <td width="50%" align="left" valign="top"><table width="700" 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">
               <?php if($row7['NameUnder'] == 1) {?>
              &nbsp;<u><?php echo strtoupper($row7['PatientName']); ?></u>
            <?php } else{?>
              &nbsp;<?php echo strtoupper($row7['PatientName']); ?></td>
            <?php } ?>
            </td>
            <th width="16%" align="left" valign="top" class="style46"><span class="style62"> <?php echo $row7['MrdNo']; ?></span></th>
            <td width="2%" align="center" valign="top" ></td>
            <td width="18%" align="left" valign="middle" class="commontxtfont" >&nbsp;</td>
          </tr>
          <tr>
            <th align="left" valign="top" class="commontxtfont">Age / Gender </th>
            <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>
            <th class="style46">Date </th>
            <td >:</td>
            <td align="left" valign="middle" class="commontxtfont" >&nbsp;<?php echo date("d/m/Y", strtotime(str_replace('-', '/',$visitdate))); ?></td>
          </tr>
          <tr>
            <th align="left" valign="top" class="commontxtfont">Address </th>
            <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>
            <th class="style46">Mobile</th>
            <td >:</td>
            <td align="left" valign="middle" class="commontxtfont" >&nbsp;<?php echo $row7['Phone']; ?></td>
          </tr>

            <tr>
            <th align="left" valign="top" class="commontxtfont">OD </th>
            <td align="center" valign="top" class="commontxtfont"><span class="style42">:</span></td>
            <td align="left" valign="middle" class="commontxtfont">&nbsp;<?php echo strtoupper($row7['Relationship']); ?></td>
           
          </tr>
        
    <?php if($row7['Prognosis'] == 1 || $row7['DSH'] == 1 || $row7['Admission'] == 1 || $row7['FollowUp'] == 1 || $row7['Irregular'] == 1 || $row7['Medication'] == 1 || $row7['StrictSupervision'] == 1){?>
          <tr>
             
             <td colspan="7" align="left" valign="middle" class="commontxtfont">
              Instructions : 
              <?php if($row7['Prognosis'] == 1){?>
             - Poor Prognosis   <?php } if($row7['DSH'] == 1){?>
             - DSH Risk Informed to OD <?php } if($row7['Admission'] == 1){?>
              - Admission / Relatives not willing at present
               <?php } if($row7['FollowUp'] == 1){?>
            - Follow up with responsible relative  <?php } if($row7['Irregular'] == 1){?>
             - Irregular Treatment <?php } if($row7['Medication'] == 1){?>
              - Self Medication <?php } if($row7['StrictSupervision'] == 1){?>
      - Maintain strict supervision on patients
              <?php } ?>
             </td>
           
           
          </tr>
        <?php } ?>

        <?php if($row7['ChkBlood'] == 1 || $row7['Eeg'] == 1 || $row7['ChkCT'] == 1 || $row7['ChkMRI'] == 1 || $row7['ChkUSG'] == 1 || $row7['ChkOthers'] == 1){?>
          <tr>
             
             <td colspan="7" align="left" valign="middle" class="commontxtfont">
              Investigation : <br>
              <?php if($row7['ChkBlood'] == 1){?>
             Blood &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  <?php echo $row7['TxtBlood'];?> <br> 
              <?php } if($row7['Eeg'] == 1){?>
             EEG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- <?php echo $row7['TxtEeg'];?>  <br>
             <?php } if($row7['ChkCT'] == 1){?>
             CT Brain &nbsp;&nbsp;&nbsp;- <?php echo $row7['TxtCT'];?> <br>
             <?php } if($row7['ChkMRI'] == 1){?>
             MRI Brain &nbsp;- <?php echo $row7['TxtMRI'];?> <br>
             <?php } if($row7['ChkUSG'] == 1){?>
             USG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- <?php echo $row7['TxtUSG'];?> <br>
             <?php } if($row7['ChkOthers'] == 1){?>
             Others &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- <?php echo $row7['TxtOthers']; }?>
             </td>
           
           
          </tr>
        <?php } ?>
       
        </table></td>
        </tr>
        <?php if($row7['ChkSpecialNote'] == 1){?>
      <tr>
      <td style="font-size: 12px;">SpecialNote : &nbsp;<?php echo $row7['SpecialNote']; ?></td>
    </tr>
  <?php } ?>
    <?php if($row7['ChkDiagnosis'] == 1){?>
    <tr>
      <td style="font-size: 17px;">Diagnosis : &nbsp;<?php echo $row7['Diagnosis']; ?></td>
    </tr>
  <?php } ?>
        <?php if($row7['DM'] == 1 || $row7['HT'] == 1 || $row7['IHD'] == 1 || $row7['PILES'] == 1 || $row7['Thyroid'] == 1 || $row7['Other'] == 1){?>
          <tr>
             
             <td colspan="4" align="left" valign="middle" class="commontxtfont">
              Known case of : 
              <?php if($row7['DM'] == 1){?>
             DM   <?php } if($row7['HT'] == 1){?>
             HT <?php } if($row7['IHD'] == 1){?>
             IHD  <?php } if($row7['PILES'] == 1){?>
             PILES <?php } if($row7['Thyroid'] == 1){?>
             Thyroid <?php } if($row7['Other'] == 1){?>
              Other - <?php echo $row7['OtherTxt']; }?>
             </td>
           
           
          </tr>
        <?php } ?>
   
      <!-- <tr>
        <td align="center" valign="top"><span class="style40"><span class="style63">Treatment</span></span></td>
      </tr> -->
      
      
      <tr>
        <td height=""><table width="80%" border="0" cellspacing="0" cellpadding="10">
            <tr>
              <!-- <td width="12%" align="center" valign="top" class="style67">Type</td> -->
              <th width="20%" align="center" valign="top" class="style67" style="text-align: left;font-size: 20px;">Rx </th>
             

              <?php if($row7['Language'] == 'E'){?>
                <th width="2%" align="center" valign="top" class="style67">Mor</th>
              <th width="2%" align="center" valign="top" class="style67">Aft</th>
              <th width="2%" align="center" valign="top" class="style67">Eve</th>

              <?php } else if($row7['Language'] == 'H'){?>
              
              <th width="2%" align="center" valign="top" class="style67">सुबह</th>
              <th width="2%" align="center" valign="top" class="style67">दोपहर</th>
              <th width="2%" align="center" valign="top" class="style67">शाम</th>

              <?php } else{?>  
              <th width="2%" align="center" valign="top" class="style67">सकाळ</th>
              <th width="2%" align="center" valign="top" class="style67">दुपार</th>
              <th width="2%" align="center" valign="top" class="style67">संध्याकाळ</th>
            <?php } ?>
            </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){
              $sql88 = "SELECT * FROM tbl_freq WHERE FreqName='".$result['TreatFreq1']."'";
              $row88 = getRecord($sql88);
              $Morning = $row88['Morning'];
              $Afternoon = $row88['Afternoon'];
              $Evening = $row88['Evening'];
            ?>
            <tr>
             <!--  <td align="center" valign="top" class="style67">&nbsp;<?php echo $result['TreatType1'];?></td> -->
              <td align="left" valign="top" class="style67">&nbsp;<?php echo strtoupper($result['TreatName1']);?></td>
              <td align="center" valign="top" class="style67">&nbsp;<?php echo $Morning;?></td>
              <td align="center" valign="top" class="style67">&nbsp;<?php echo $Afternoon;?></td>
              <td align="center" valign="top" class="style67">&nbsp;<?php echo $Evening;?></td>
            </tr>
           <?php } ?>
          </table></td></tr>
        <tr><td></td></tr>
        <tr><td></td></tr>
        <tr><td></td></tr>
          <tr>
            <th style="float:right;padding-right: 175px;">X <?php echo $row7['Duration']; ?> Days</th>
          </tr>
    </table>
    <br />
   <!--  <br><br><br><br><br><br><br><br><br><br><br> -->
    <table>
      
   
       <tr>
      <td style="font-size: 17px;">&nbsp;Advice :<?php echo $row7['Remark']; ?></td>
    </tr>
          <tr>
            <th align="left" valign="top" class="commontxtfont"><strong>फेर तपासणी दिनांक : </strong><?php echo date("d/m/Y", strtotime(str_replace('-', '/',$row7['FollowUpDate']))); ?> </th>
           
           
          </tr>
          <?php if($row7['Telugu'] == 1){?>
           <tr>
            <th align="left" valign="top" class="commontxtfont">మతిస్థిమితం, నిద్రలేమి, భయాందోళన, తలనొప్పి, మూర్ఛ, లైంగిక బలహీనత, టెన్షన్‌కు చికిత్స చేస్తారు </th>
           
           
          </tr>
        <?php } ?>
          <tr>
            <th align="left" valign="top" class="commontxtfont">Note : <?php echo $row7['RefBy']; ?> </th>
           
           
          </tr>
          </table>
  </td>
  </tr>
</table>
</body>
</html>
