<?php 
session_start();
require_once 'config.php';
require_once 'auth.php';
$MainPage="Report";
$Page = "OPD-Patient-Report";
?>
<!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" />
<title></title>
<link href="css/opdheading.css" rel="stylesheet" type="text/css" />

<style type="text/css">

.table {
border-collapse: collapse;
	font-family:Roboto;
}
.table td, th {
    border: 1px solid black;
	padding:8px;
}
.mainh1 {
	font-family: Roboto;
	font-size: 12px;
	font-style: normal;
	font-weight: bold;
	font-variant: normal;
	color: #333333;
	letter-spacing: .5mm;
}
.tblewithborder {
	border: thin solid #CCCCCC;
}
.mainh2 {
	font-family: Roboto;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	color: #333333;
	letter-spacing: .5mm;
}
.mainh1-1 {
	font-family: Roboto;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	color: #333333;
	letter-spacing: 0.25mm;
}
body {
	margin-left: 5px;
	margin-top: 1px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style21 {font-family: Roboto; font-size: 12px; font-style: normal; font-weight: bold; font-variant: normal; color: #333333; letter-spacing: .5mm; }
.style22 {	font-family: Roboto;
	font-size: 12px;
}
.style23 {
	font-family: Roboto;
	font-size: 12px;
	font-weight: bold;
}
.style37 {font-family: Roboto; font-size: 10; color: #333333; }
.style38 {font-size: 10}
.singlelinedottedtop {border-top-width: thin;
	border-top-style: dotted;
	border-top-color: #CCCCCC;
}
.style40 {font-family: Roboto; font-size: 12px; font-weight: bold; }
 




 @media print {
        @page {
            margin-top: 10px;
            margin-left: 50px;
            margin-right: 0px;
            margin-bottom: 0px;
        }

        @page :footer {
            display: none
        }

        .noPrint {
            display: none;
        }

        @page :header {
            display: none
        }
    }
</style>
</head>

<body>
<table width="700" height="712" border="1" cellpadding="1" cellspacing="0">
  <tr>
    <td height="687" align="left" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="1">
      <tr class="noPrint">
            <td style="float:right;"><button align="center" style="text-align:center;font-size: 18px;width: 100px;"
                    onclick="window.print();" class="noPrint">Print</button>
            </td>
        </tr>
      <!--<tr>
        <td align="left" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="2">
          <tr>
            <td width="42%" align="right" valign="middle"><img src="logo1.jpg" width="70" height="41" /></td>
            <td width="58%"><img src="logo2.jpg" width="168" height="56" /></td>
          </tr>
          <tr>
            <td colspan="2" align="right" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="2">
                <tr>
                  <td width="61%"><span class="style22">Takiya Ward, Nagpur Bypass Road, Bhandara, Phone No.:07184 - 251556</span></td>
                  <td width="39%"><span class="style21">Reg.No : DHB/BNHA/07/2021 </span></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
        </tr>-->
      
      <tr>
        <td align="center" valign="top" bgcolor="#CCCCCC"><span class="style23">OPD PATIENT REPORT [ DETAIL ] </span></td>
        </tr>
      <tr>
        <td align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="1" cellpadding="5">
              </table></td>
            </tr>
          </table>
          </td>
      </tr>
      

      <?php 
        if($_REQUEST['Type'] == 1){
          $Type = "OPD";
        }
        else if($_REQUEST['Type'] == 2){
          $Type = "OPD Receipt";
        }
        else{
          $Type = "All";
        }

        if($_REQUEST['FromDate'] == ''){
          $FromDate = "";
        }
        else{
          $FromDate = date("d/m/Y", strtotime(str_replace('-', '/',$_REQUEST['FromDate'])));
        }

        if($_REQUEST['ToDate'] == ''){
          $ToDate = "";
        }
        else{
          $ToDate = date("d/m/Y", strtotime(str_replace('-', '/',$_REQUEST['ToDate'])));
        }
       ?>
      <tr>
        <td align="left" valign="top" bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="2" cellpadding="4">
          <tr>
            <td width="16%" height="27" align="center" valign="top" bgcolor="#FFFFFF"><span class="mainh1">From Date : </span></td>
            <td width="16%" align="center" valign="top" bgcolor="#FFFFFF"><span class="style38"><?php echo $FromDate; ?></span></td>
            <td width="16%" align="center" valign="top" bgcolor="#FFFFFF"><span class="mainh1">To Date : </span></td>
            <td width="16%" align="center" valign="top" bgcolor="#FFFFFF"><span class="style38"><?php echo $ToDate; ?></span></td>
            <td width="16%" align="center" valign="top" bgcolor="#FFFFFF"><span class="mainh1">Type : </span></td>
            <td width="16%" align="center" valign="top" bgcolor="#FFFFFF"><span class="style38"><?php echo $Type; ?></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="1" cellpadding="4" class="tblewithborder">
            <tr>
              <td width="10%" align="center" valign="top"><span class="style40">Sr.No</span></td>
   <td align="left" valign="top"><span class="style40">MRD No</span></td>
              <td align="left" valign="top"><span class="style40">Patient Name </span></td>
              
               <td align="left" valign="top"><span class="style40">Address </span></td>
              <td width="15%" align="right" valign="top"><span class="style40">Diagnosis</span></td>
            </tr>
            <?php 
          $i=1;
          $sql3 = "SELECT MrdNo,PatientName,'400' AS Amount,'OPD' AS Procedures,CreatedDate,Diagnosis,Address FROM tbl_consultant WHERE Status=1 AND VisitDate>='".$_REQUEST['FromDate']."' AND VisitDate<='".$_REQUEST['ToDate']."'";
         
          //echo $sql3;
          $row3 = getList($sql3);
          foreach($row3 as $result){
            $TotalAmt+=$result['Amount'];
           ?> 
            <tr>
              <td align="center" valign="top" bgcolor="#FFFFFF" style="font-size: 12px;">&nbsp;<?php echo $i; ?></td>
            <!--   <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;<?php echo date("d/m/Y", strtotime(str_replace('-', '/',$result['CreatedDate'])));?></td> -->
             <td align="left" valign="top" bgcolor="#FFFFFF" style="font-size: 12px;">&nbsp;<?php echo $result['MrdNo'];?></td>
              <td align="center" valign="top" bgcolor="#FFFFFF" style="font-size: 12px;">&nbsp;<?php echo $result['PatientName'];?></td>
              <td align="left" valign="top" bgcolor="#FFFFFF" style="font-size: 12px;">&nbsp;<?php echo $result['Address'];?></td>
              <td align="right" valign="top" bgcolor="#FFFFFF" style="font-size: 12px;">&nbsp;<?php echo $result['Diagnosis'];?></td>
            </tr>
          <?php $i++;} ?>
          </table></td>
      </tr>
      <tr>
        <td align="left" valign="top">&nbsp;</td>
      </tr>
      
    </table>
      <br /></td>
  </tr>
  
</table>
</body>
</html>
