<?php session_start(); ?> <!-- session start -->
<?php include("../include/config.php"); ?> <!-- database connection -->
<?php include("../include/connect_url.php"); ?> <!-- connection url/link folder -->
<?php include("../include/date_time.php"); ?> <!-- date & time format -->
<?php include("../database/account.php"); ?> <!-- query database account -->
<?php include("../include/lang.php"); ?> <!-- language -->
<?php include("../include/session_login.php"); ?> <!-- session login -->

<!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=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, patient-scalable=0" />
<title><?php include("../template/title.php"); ?></title>

<link rel="shortcut icon" href="<?php echo $connect_url_data; ?>/favicon.ico" />

<link href="<?php echo $connect_url_data; ?>/css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="<?php echo $connect_url_data; ?>/css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->
<link rel="stylesheet" href="<?php echo $connect_url_data; ?>/font/font-awesome-4.3.0/css/font-awesome.min.css">

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/download/jquery183.js"></script> 
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/download/jquery192.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/excanvas.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.pie.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.sparkline.min.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/tables/jquery.sortable.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/tables/jquery.resizable.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.autosize.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.uniform.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.inputlimiter.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.autotab.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.select2.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.dualListBox.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.cleditor.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.ibutton.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.validationEngine.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/globalize/globalize.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/globalize/globalize.culture.de-DE.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/globalize/globalize.culture.ja-JP.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/plupload.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/plupload.html4.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/plupload.html5.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/jquery.plupload.queue.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/wizards/jquery.form.wizard.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/wizards/jquery.form.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.breadcrumbs.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.tipsy.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.progress.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.colorpicker.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.jgrowl.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.fileTree.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.sourcerer.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/others/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/others/jquery.elfinder.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.mousewheel.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/files/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/files/functions.js"></script>

</head>

<body>

<?php    
$query_patient2 = mysql_query("SELECT * FROM tbl_patient WHERE id='$_GET[patient_id]'"); 
while($row= mysql_fetch_assoc($query_patient2))
{
    $db_patient2_id = $row['id'];
    $db_patient2_patient_no = $row['patient_no'];
    $db_patient2_image = $row['image'];
    $db_patient2_firstname = $row['firstname'];
    $db_patient2_middlename = $row['middlename'];
    $db_patient2_lastname = $row['lastname'];
    $db_patient2_birth_date = $row['birth_date'];
    $db_patient2_gender = $row['gender'];
    $db_patient2_civil_status_id = $row['civil_status_id'];
    $db_patient2_nationality_id = $row['nationality_id'];
    $db_patient2_address = $row['address'];
    $db_patient2_phone_no = $row['phone_no'];
    $db_patient2_mobile_no = $row['mobile_no'];
    $db_patient2_email = $row['email'];
    $db_patient2_ref_name = $row['ref_name'];
    $db_patient2_ref_relationship_id = $row['ref_relationship_id'];
    $db_patient2_ref_address = $row['ref_address'];
    $db_patient2_ref_phone_no = $row['ref_phone_no'];
    $db_patient2_ref_mobile_no = $row['ref_mobile_no'];
    $db_patient2_date = $row['date'];
    $db_patient2_time = $row['time'];
    $db_patient2_a_status = $row['a_status'];
}
?>

<?php
$query_civil_status2 = mysql_query("SELECT * FROM tbl_civil_status WHERE id='$db_patient2_civil_status_id'");
while($row= mysql_fetch_assoc($query_civil_status2))
{
    $db_civil_status2_id = $row['id'];
    $db_civil_status2_civil_status = $row['civil_status'];
}
?>

<?php
$query_nationality2 = mysql_query("SELECT * FROM tbl_nationality WHERE id='$db_patient2_nationality_id'");
while($row= mysql_fetch_assoc($query_nationality2))
{
    $db_nationality2_id = $row['id'];
    $db_nationality2_nationality = $row['nationality'];
}
?>

<?php
$query_relationship2 = mysql_query("SELECT * FROM tbl_relationship WHERE id='$db_patient2_ref_relationship_id'");
while($row= mysql_fetch_assoc($query_relationship2))
{
    $db_relationship2_id = $row['id'];
    $db_relationship2_relationship = $row['relationship'];
}
?>

<?php
if($_POST)
{
$query_patient1= mysql_query("SELECT * FROM tbl_patient");
while($row= mysql_fetch_assoc($query_patient1))
{
    $db_patient1_id= $row['id'];
}
    $db_patient1_id_add = $db_patient1_id + 1;
    $db_patient1_id_add_comp = "$date_year$db_patient1_id_add";


$image_extension_allowed = array('jpg','gif','png','');
$image_name = strtolower($_FILES['image']['name']);
$image_extension = strtolower(end(explode('.', $image_name)));
$image_tmp_name  = $_FILES['image']['tmp_name'];
$image_size = $_FILES['image']['size'];
$image_type = $_FILES['image']['type'];


$firstname =mysql_real_escape_string(ucwords($_POST['firstname']));
$middlename =mysql_real_escape_string(ucwords($_POST['middlename']));
$lastname =mysql_real_escape_string(ucwords($_POST['lastname']));
$birth_date =$_POST['birth_date'];
$gender =$_POST['gender'];
$nationality=$_POST['nationality'];
$civil_status =$_POST['civil_status'];
$address =mysql_real_escape_string($_POST['address']);
$phone_no =mysql_real_escape_string($_POST['phone_no']);
$mobile_no =mysql_real_escape_string($_POST['mobile_no']);
$email =mysql_real_escape_string($_POST['email']);
$ref_name =mysql_real_escape_string(ucwords($_POST['ref_name']));
$ref_relationship=$_POST['ref_relationship'];
$ref_address =mysql_real_escape_string($_POST['ref_address']);
$ref_phone_no =mysql_real_escape_string($_POST['ref_phone_no']);
$ref_mobile_no =mysql_real_escape_string($_POST['ref_mobile_no']);
$a_status = $_POST['a_status'];

if($image_name)
{

if(in_array($image_extension, $image_extension_allowed)=== false){ 	 
die ("<script>  
alert('File extension for image is not allowed.');
window.location.href='javascript:history.back();';
</script>");
}     

if(!get_magic_quotes_gpc())
	{
		$image_name =addslashes($image_name);
	}
        
if($image_name=="")
{
die("<script>	
alert('ERROR: Please select file.'); 
window.location.href='javascript:history.back();';		
</script> ");
}

$rand_number = rand(1, 1000000);
$file_image_generate = "$db_patient1_id_add_comp$rand_number-$image_name";

if (move_uploaded_file($image_tmp_name, "../images/patient/".$file_image_generate)){
}

$sql = "UPDATE tbl_patient SET image= '$file_image_generate'  WHERE id = '$db_patient2_id'";
$result = mysql_query($sql) or die("Error: Failed to Update!");

}
//end if image



if($firstname==""){
die ("<script> alert('Please fill firstname.');
window.location.href='javascript:history.back();';		
</script> ");
}


$sql = "UPDATE tbl_patient SET  firstname='$firstname', middlename='$middlename', lastname='$lastname', birth_date='$birth_date', gender='$gender', civil_status_id = '$civil_status', nationality_id='$nationality', address='$address', phone_no='$phone_no', mobile_no='$mobile_no', email='$email', ref_name='$ref_name', ref_relationship_id='$ref_relationship', ref_address='$ref_address', ref_phone_no= '$ref_phone_no', ref_mobile_no='$ref_mobile_no', a_status='$a_status' WHERE  id ='$db_patient2_id '";
$result = mysql_query($sql) or die("Error: Failed to Update!");

die ("<script> alert('Saved.');
window.close();		
</script> ");
}
?>


	

  <form name="form" id="form" action="<?php echo $connect_url_data; ?>/patient/e/<?php echo $db_patient2_id; ?>" class="main" method="POST"  enctype="multipart/form-data">
            <fieldset style="margin-top:-35px;">
                <div class="widget fluid">
                    <div class="whead"><h6><span class="fa fa-edit" style="margin-top:-2px;"></span>&nbsp; <?php echo $lang['Edit Patient']; ?></h6></div>
                    
		    <!-- Tabs -->
		<div class="fluid" >
                <div class="widget grid12" style="margin-top:-0px;">       
                    <div class="tabs">
                        <ul>
                            <li><a href="#tabs-1"><?php echo $lang['Patient Information']; ?></a></li>
                            <li><a href="#tabs-2"><?php echo $lang['Transaction Records']; ?></a></li>
                        </ul>
			
			
			
                <div id="tabs-1">
		    
		    <?php if($db_patient2_image){?>
		    <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Preview']; ?>:</label> </div>
                            <div class="grid10">
                                <img src="<?php echo $connect_url_data; ?>/images/patient/<?php echo $db_patient2_image; ?>" width="100" height="100">
                            </div>
                     </div>
		    <?php } ?>
		    
		    <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Profile Picture']; ?>:</label> </div>
                            <div class="grid10">
                                <input type="file" class="styled" name="image" id="image" /> (file format: jpg, png, gif)
                            </div>
                     </div>
		    
		    <div class="formRow">
                        <div class="grid2"><label><?php echo $lang['Firstname']; ?>:</label></div>
                        <div class="grid10"><input type="text" name="firstname" id="firstname" value="<?php echo $db_patient2_firstname; ?>"/></div>
                    </div>
		    
		    <div class="formRow">
                        <div class="grid2"><label><?php echo $lang['Middlename']; ?>:</label></div>
                        <div class="grid10"><input type="text" name="middlename" id="middlename" value="<?php echo $db_patient2_middlename; ?>"/></div>
                    </div>
		    
		     <div class="formRow">
                        <div class="grid2"><label><?php echo $lang['Lastname']; ?>:</label></div>
                        <div class="grid10"><input type="text" name="lastname" id="lastname" value="<?php echo $db_patient2_lastname; ?>"/></div>
                    </div>
		    
		    <div class="formRow">
                    <div class="grid2"><label><?php echo $lang['Birth Date']; ?>:</label></div>
                    <div class="grid10"><input class="span12" type="date" name="birth_date" id="birth_date" value="<?php echo $db_patient2_birth_date; ?>"/></div>
                    </div>
		    
		    <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Gender']; ?>:</label></div>
                            <div class="grid10">
				<select name="gender" id="gender"  data-placeholder="Choose" class="select" tabindex="2" style="width:100%;">
				<?php if($db_patient2_gender=="Male"){
			        echo "<option value='Male'>Male</option>
				<option value='Female'>Female</option>";
				}?>
			        <?php if($db_patient2_gender=="Female"){
			        echo "<option value='Female'>Female</option>
				<option value='Male'>Male</option>
				";
				}?>
				</select>
                            </div>             
                    </div>
		    
		     <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Civil Status']; ?>:</label></div>
                            <div class="grid10">
                               <?php
				$query_civil_status1=mysql_query("SELECT * FROM tbl_civil_status WHERE id!='$db_civil_status2_id' ORDER BY civil_status ASC");
				$option_civil_status1="";
				while($row=mysql_fetch_array($query_civil_status1)) {
				$option_civil_status1 .= "<option value='$row[id]'";
				$option_civil_status1 .= ">". $row['civil_status'] ."</option>";  }
				?>    
				<select name="civil_status" id="civil_status"  data-placeholder="Choose" class="select" tabindex="2" style="width:100%;">
                                <?php if($db_patient2_civil_status_id!=0){echo "<option value='$db_civil_status2_id'>$db_civil_status2_civil_status</option>"; }else{echo"<option value=''></option> ";}?>
				<?php echo $option_civil_status1; ?>
				</select>
                            </div>             
                    </div>
		    
		    <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Nationality']; ?>:</label></div>
                            <div class="grid10">
                               <?php
				$query_nationality1=mysql_query("SELECT * FROM tbl_nationality WHERE id!='$db_nationality2_id' ORDER BY nationality ASC");
				$option_nationality1="";
				while($row=mysql_fetch_array($query_nationality1)) {
				$option_nationality1 .= "<option value='$row[id]'";
				$option_nationality1 .= ">". $row['nationality'] ."</option>";  }
				?>    
				<select name="nationality" id="nationality"  data-placeholder="Choose" class="select" tabindex="2" style="width:100%;">
                                <?php if($db_patient2_nationality_id!=0){echo "<option value='$db_nationality2_id'>$db_nationality2_nationality</option>"; }else{echo"<option value=''></option> ";}?>
				<?php echo $option_nationality1; ?>
				</select>
                            </div>             
                    </div>
		    
		    <div class="formRow">
                        <div class="grid2"><label><?php echo $lang['Address']; ?>:</label></div>
                        <div class="grid10">
                            <textarea rows="8" cols="" name="address" id="address" class="auto lim"><?php echo $db_patient2_address; ?></textarea>
                            <span class="note" id="limitingtext">Field limited to 100 characters.</span>
                        </div>
                    </div>
		      
		    <div class="formRow">
                    <div class="grid2"><label><?php echo $lang['Phone No']; ?>:</label></div>
                    <div class="grid10"><input class="span12" type="number" name="phone_no" id="phone_no" value="<?php echo $db_patient2_phone_no; ?>"/></div>
                    </div>
		    
		    <div class="formRow">
                    <div class="grid2"><label><?php echo $lang['Mobile No']; ?>:</label></div>
                    <div class="grid10"><input class="span12" type="number" name="mobile_no" id="mobile_no" value="<?php echo $db_patient2_mobile_no; ?>"/></div>
                    </div>
		         
		    <div class="formRow">
                    <div class="grid2"><label><?php echo $lang['Email']; ?>:</label></div>
                    <div class="grid10"><input class="span12" type="email" name="email" id="email" value="<?php echo $db_patient2_email; ?>"/></div>
		    </div>
		       
		       
		   <div class="formRow">
                        <div class="grid2"><label><?php echo $lang['Ref. Name']; ?>:</label></div>
                        <div class="grid10"><input type="text" name="ref_name" id="ref_name" value="<?php echo $db_patient2_ref_name; ?>"/></div>
                    </div>
		    
		    
		    <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Ref. Relationship']; ?>:</label></div>
                            <div class="grid10">
                               <?php
				$query_relationship1=mysql_query("SELECT * FROM tbl_relationship WHERE id!='$db_patient2_ref_relationship_id' ORDER BY relationship ASC");
				$option_relationship1="";
				while($row=mysql_fetch_array($query_relationship1)) {
				$option_relationship1 .= "<option value='$row[id]'";
				$option_relationship1 .= ">". $row['relationship'] ."</option>";  }
				?>    
				<select name="ref_relationship" id="ref_relationship"  data-placeholder="Choose" class="select" tabindex="2" style="width:100%;">
                                <?php if($db_patient2_ref_relationship_id!=0){echo "<option value='$db_relationship2_id'>$db_relationship2_relationship</option>"; }else{echo"<option value=''></option> ";}?>
				<?php echo $option_relationship1; ?>
				</select>
                            </div>             
                    </div>
		    
		    <div class="formRow">
                        <div class="grid2"><label><?php echo $lang['Transaction']; ?>Ref. Address:</label></div>
                        <div class="grid10">
                            <textarea rows="8" cols="" name="ref_address" id="ref_address" class="auto lim"><?php echo $db_patient2_ref_address; ?></textarea>
                            <span class="note" id="limitingtext">Field limited to 100 characters.</span>
                        </div>
                    </div>
		      
		    <div class="formRow">
                    <div class="grid2"><label><?php echo $lang['Ref. Phone No']; ?>:</label></div>
                    <div class="grid10"><input class="span12" type="number" name="ref_phone_no" id="ref_phone_no" value="<?php echo $db_patient2_ref_phone_no; ?>"/></div>
                    </div>
		    
		    <div class="formRow">
                    <div class="grid2"><label><?php echo $lang['Ref. Mobile No']; ?>:</label></div>
                    <div class="grid10"><input class="span12" type="number" name="ref_mobile_no" id="ref_mobile_no" value="<?php echo $db_patient2_ref_mobile_no; ?>"/></div>
                    </div>
		    
		     <div class="formRow">
                            <div class="grid2"><label><?php echo $lang['Status']; ?>:</label></div>
                            <div class="grid10">
                               <select name="a_status" id="a_status" class="select" tabindex="2" style="width:100%;">
				<?php
				if($db_patient2_a_status==1){
				echo "
				<option value='1' SELECTED>Active</option>
				<option value='2'>Inactive</option>
				";
				}
				if($db_patient2_a_status==2){
				echo "
				<option value='2' SELECTED>Inactive</option>
				<option value='1'>Active</option>
				";
				}							
				
				?>
				</select>
                            </div>             
                    </div>
		    
		
		    
	     </div>
	    <!-- end tabs 1 -->
	    
             <div id="tabs-2">
                <div class="shownpars">					
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dTable" id="item-datatable">
<thead>
    <tr>
	<th width="3%"></th>
	<th width="10%"><?php echo $lang['Transaction No']; ?>:</th>
	<th width="33%"><?php echo $lang['Patient Name']; ?></th>
	<th width="16%"><?php echo $lang['Patient Type']; ?></th>
	<th width="16%"><?php echo $lang['Date & Time Created']; ?></th>
	<th width="16%"><?php echo $lang['Account Status']; ?></th>
        <th width="8%"></th>
    </tr>	
</thead>
<tbody>
<?php
$query_transaction2 = mysql_query("SELECT * FROM tbl_transaction WHERE patient_id='$db_patient2_id'");
while($row= mysql_fetch_assoc($query_transaction2))
{
    $db_transaction2_id = $row['id'];
    $db_transaction2_transaction_no = $row['transaction_no'];
    $db_transaction2_patient_id = $row['patient_id'];
    $db_transaction2_pt_type_id = $row['pt_type_id'];
    $db_transaction2_remark = $row['remark'];
    $db_transaction2_patient_id = $row['patient_id'];
    $db_transaction2_date = $row['date'];
    $db_transaction2_time = $row['time'];
    $db_transaction2_a_status = $row['a_status'];
    
$query_patient2 = mysql_query("SELECT * FROM tbl_patient WHERE id='$db_transaction2_patient_id'");
while($row= mysql_fetch_assoc($query_patient2))
{
    $db_patient2_id = $row['id'];
    $db_patient2_firstname = $row['firstname'];
    $db_patient2_middlename = $row['middlename'];
    $db_patient2_middlename_sub =  substr($db_patient2_middlename,0,1);
    $db_patient2_lastname = $row['lastname'];
}

$query_patient_type2 = mysql_query("SELECT * FROM tbl_patient_type WHERE id='$db_transaction2_pt_type_id'");
while($row= mysql_fetch_assoc($query_patient_type2))
{
    $db_patient_type2_id = $row['id'];
    $db_patient_type2_patient_type = $row['patient_type'];
    $db_patient_type2_patient_type_strl = strtolower($db_patient_type2_patient_type);
}

$query_transaction_type2 = mysql_query("SELECT * FROM tbl_transaction_type WHERE id='$db_transaction2_a_status'");
while($row= mysql_fetch_assoc($query_transaction_type2))
{
    $db_transaction_type2_id = $row['id'];
    $db_transaction_type2_transaction_type = $row['transaction_type'];
    $db_transaction_type2_color = $row['color'];
}
?>
<tr>
    <td><span class="fa fa-file"></span></td>
    <td><?php echo $db_transaction2_transaction_no; ?></td>
    <td><?php echo "$db_patient2_firstname $db_patient2_middlename_sub. $db_patient2_lastname"; ?></td>
    <td><?php echo $db_patient_type2_patient_type; ?></td>
    <td><?php echo "$db_transaction2_date $db_transaction2_time "; ?></td>
    <td><a href='#' class='tablectrl_small b<?php echo $db_transaction_type2_color; ?> tipS' title='Options' style='color:#fff;'><i class='fa fa-info-circle'></i> <?php echo $db_transaction_type2_transaction_type; ?></a></td>
   <td style="text-align:center;"><a href="#" onclick="window.open('<?php echo $connect_url_data; ?>/<?php echo $db_patient_type2_patient_type_strl; ?>/e/<?php echo $db_transaction2_id; ?>', 'viewRecord',  'status,menubar=0,scrollbars=1,resizable=0,top=50,left=50,width=1220,height=550')"><span class="fa fa-edit"></span> View</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
                
             </div>
            
	    
</div>
</div>	    
<!-- end tabs body -->
                  
                </div>
            </fieldset>
	    
    <div class="formRow">
                    <div class="grid2"></div>
                    <div class="grid10">
			<a href="#" class="buttonM bBlue" onclick="document.getElementById('form').submit();"><span class="fa fa-save"></span><span><?php echo $lang['Save']; ?></span></a>
		        <a href="#" class="buttonM bBlue" onclick="window.close();"><span class="fa fa-times-circle"></span><span><?php echo $lang['Cancel']; ?></span></a>
		    </div>
		    
		    </div>
             
</body>
</html>
