<?php
include('../config/config.php');
include('../classes/classDiagnostic.php');
include('../classes/classDiagnosticLiquids.php');

try
{
	$labtestOb = new classDiagnostic;
	$labtestOb->setOrganizationID($_SESSION['security']['org_id']);
	$labtest_dropdown = $labtestOb->retrieveLabTests();
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}

try
{
	$retrieveliquidsOb = new classDiagnosticLiquids;
	$retrieveliquidsOb->setLocationID($_SESSION['security']['location_id']);
	$liquid_array = $retrieveliquidsOb->retrieveLiquidAllDetail();
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg(); 
}

/*echo '<pre>';
print_r($liquid_array);
echo '</pre>';
exit;
*/
?>
<!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"><!-- InstanceBegin template="/Templates/print.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="shortcut icon" href="../images/favicon.png">
    <title>Med2TEC Hospital Management Information System</title> 
    <link href="../css/print.css" rel="stylesheet">
    <link href="../datepicker/jquery-ui.css" rel="stylesheet" >  
    <script type="text/javascript" src="../datepicker/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="../datepicker/jquery-ui.js"></script> 
</head>

<body> 
<div align="right"> 
 <SCRIPT LANGUAGE="JavaScript">  
if (window.print) {
document.write('<form class="no-print"><input type=button name=print value="Print" onClick="window.print()"></form>');
}
</script></div>

<section class="wrapper">
<div style="background:#FFF; padding:0px 0px 0; height:auto;">
  <table cellspacing="0" cellpadding="0" width="100%" border="0" style="font-size:11px;">
    <tbody>
      <tr>
        <td align="left" style="background:#fff;"><img alt="" src="../images/org_print_logos/<?php echo $_SESSION['security']['org_id']?>.png" style="width:100%;"></td>
      </tr>
    </tbody>
  </table>
  
</br>

</div>

<div class="row">
          <section class="panel">
            <header class="panel-heading">
              <h2><!-- InstanceBeginEditable name="title" -->MANAGE TESTING LIQUIDS<!-- InstanceEndEditable --></h2>
            </header>

  <br />
  
<!-- InstanceBeginEditable name="main" -->
  <!-- page start-->
  <div class="panel-body">
              <div class="adv-table">
              
                <table class="bottomBorder" cellpadding="0" cellspacing="0" width="100%">
                
                  <thead>
                  
                    <tr>
						<?php
                        if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==9)
                        {
                        	?><?php	
                        }
                        ?>
                      
                        <th width="5%" align="center">ID</th>
                        <th width="15%">Testing Liquid</th>
                        <th width="10%">Liquid per Test</th>
                        <th width="15%">Report From</th>
                        <th width="10%">No. of Bottles Received</th>
                        <th width="10%">No. of Tests Done</th>
                        <th width="10%">Price</th>
                        <th width="10%">Current Stock (ml)</th>
                        <th width="10%">Current Stock (Bottles)</th>
                        
                      	<?php
						if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==9)
						{
							?><?php	
						}
						?>
                    </tr>
                    
                  </thead>
                  
                  <tbody>
                   <?php
					if(isset($liquid_array[0]['liquid_id'])&&$liquid_array[0]['liquid_id']!='')
					{
						$total_price = 0;
						for($l=0;$l<count($liquid_array);$l++)
						{
							
								$total_price += $liquid_array[$l]['total_price'];
								
								if($l%2==0){$class='gradeX';}else{$class='gradeC';}
								
								?>
								<tr class="<?php echo $class;?>">
                                <?php
									if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==9)
									{
										?>
										
										<?php	
									}
									?>
                                    
                                    <td align="center"><?php echo $liquid_array[$l]['liquid_id'];?></td>
                                    <td align="left"><?php echo strtoupper($liquid_array[$l]['liquid_name']);?> (<?php echo $liquid_array[$l]['amount_per_bottle'].' ml';?>)<br>
                                    <span style="font-size:10px; color:grey;">used in:</span><br>
                                    <?php echo @$liquid_array[$l]['labtest_names'];?>
                                    </td>
                                    <td align="right"><?php echo @number_format($liquid_array[$l]['liq_req_per_test'],2).' ml';?></td>
                                    <td align="left"><?php if(isset($liquid_array[$l]['reset_date'])){echo date('d M Y h:i:s A',$liquid_array[$l]['reset_date']);}?></td>
                                    <td align="right"><?php echo @$liquid_array[$l]['no_of_bottle_rec'];?></td>
                                    <td align="right"><?php echo @$liquid_array[$l]['no_of_test_performed'];?></td>
                                    <td align="right"><?php echo @number_format($liquid_array[$l]['total_price'],2);?></td>
                                    <td align="right"><?php echo @number_format($liquid_array[$l]['remaining_stock_liquid'],2).' ml';?></td>
                                    <td align="right"><?php echo @number_format($liquid_array[$l]['remaining_stock_bottle'],2);?></td>
                                    
                                     
                                  
                                     <?php
									 if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==9)
									 {
										  ?><?php	
									 }
			  						?>
                                    
								</tr>
                                
                                
                                
                                <?php
						}
						
						?>
                        <tr>
                           
                             		<td colspan="12" align="right"><strong>Total: <?php echo 'Rs. '.number_format($total_price,2);?></strong></td>
                                 </tr>
                        <?php
					}
					else
					{
						?>
                        
                        <?php
					}
					?>

                  </tbody>
                  
                </table>
                
              
                
              </div>
            </div>
  <!-- page end-->

<!--<p align="center" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; margin-top:260px;"><strong>For Appointment Call at 042-35151666 (bring your Patient ID Card)</strong>317 A-1, Nursery Stop, Township, Lahore 042-35151666 (Not Valid for Court or any Legal Purpose)</p>
--><!-- InstanceEndEditable -->
</section>
</div>

<!--<p align="center" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; margin-top:260px;"><strong><!--317 A-1, Nursery Stop, Township, Lahore. 
Ph: 042-35151666</strong><br />
For Appointment call at 042-35151666 (bring your Patient ID Card) </p>-->

   <div class="sidepop" style="float:right;">
    <div class="sidepopbutton stemp"><div style="color: rgb(0, 0, 0); text-align: right; font-size: 10px; margin-top: 4px; position: absolute; right: 180px;">© Software by Softusion Inc. 0322 6155 219</div>   
    </div>
</div>

<!--<div class="sidepop" style="float:right;">
    <div class="sidepopbutton stemp"><div style="color:#000; text-align:right; font-size:9px;">© Software designed by Softusion Inc. Contact us at 0322 6155 219</div>   
    </div>
</div>-->


          
</body>
<!-- InstanceEnd --></html>