<?php
include('../config/config.php');
include('../classes/classDiagnostic.php');
/*echo '<pre>';
print_r($_POST);
print_r($_SESSION);
echo '</pre>';
exit;*/
if(isset($_GET['dellabtest'])&&$_GET['dellabtest']!='')
{
	try
	{
		$labtest_id = base64_decode($_GET['dellabtest']);
		
		$delTestFromGroupOB = new classDiagnostic;
		$delTestFromGroupOB->setLabTestID($labtest_id);
		$delTestFromGroupOB->setLabTestGroupID("0");
		$delTestFromGroupOB->updateGroupIDInLabtest();
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}

if(isset($_GET['dellabtestgroup'])&&$_GET['dellabtestgroup']!='')
{
	try
	{
		$group_id = base64_decode($_GET['dellabtestgroup']);
		
		$delTestGroupOB = new classDiagnostic;
		$delTestGroupOB->updateLabTestGroupsActiveOrInactive($group_id,0);
		
		header("Location:mgmttestgroups.php");
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}

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

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

?>
<!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" -->LIST OF BLOOD TEST GROUPS<!-- 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>
                      <th width="25%" align="left">Group Name</th>
                      <th width="55%" align="left">Blood Tests Included</th>
                      <th width="10%" align="right">Group Cost</th>
                    </tr>
                    
                  </thead>
                  
                  <tbody>
                   <?php
					if(isset($group_array[0]['group_id'])&&$group_array[0]['group_id']!='')
					{
						for($g=0;$g<count($group_array);$g++)
						{
							
								if($g%2==0){$class='gradeX';}else{$class='gradeC';}
								
								$labtestOb = new classDiagnostic;
								$labtestOb->setLabTestGroupID($group_array[$g]['group_id']);
								$group_tests = $labtestOb->retrieveLabTestByGroupID();
								
								$table = '';
								$group_test_cost = '0';
								for($gt=0;$gt<count($group_tests);$gt++)
								{
									$labtest_id = base64_encode($group_tests[$gt]['labtest_id']);
									$delTest = "";
									
									$labtest_name = $group_tests[$gt]['labtest_name'];
									
                                    $table .= "$labtest_name $delTest<br>";
									
									$group_test_cost += $group_tests[$gt]['labtest_cost'];
                                    
									
								}
								?>
								<tr class="<?php echo $class;?>">
                                
                                    
                                    
                                    <td align="left"><?php echo strtoupper($group_array[$g]['group_name']);?></td>
                                    
                                    <td align="left">
                                
                                    <table><?php echo $table;?></table>
                                    </td>
                                    
                                    <td align="left">Rs. <?php echo number_format($group_test_cost,2);?></td>
                                    
                                    
                                    
								</tr>
                                
                                
                                
                                <?php
						}
					}
					else
					{
						?>
                        <tr>
                            <table>
                            	<tr><td>No Entries Fround!</td></tr>
                            </table>
                        </tr>
                        <?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>