<?php
session_start();
if(!$_SESSION['myusername']){
header("location:../index.php");
}
include 'globals.inc';
$a=$_SESSION['data_entry'];
if($a==1) {
}
elseif($a==0) {
header("location:http://$sname/therapydoc/noauth.php");
}
require_once "connect.inc";
include '../../classes/therapydoc/referrals/referrals.php';
if(isset($_GET['l'])){
$l=$_GET['l'];
}
else if(!isset($_GET['l'])){
$l='';
}
if(isset($_GET['f'])){
$f=$_GET['f'];
}
else if(!isset($_GET['f'])){
$f='';
}
if(isset($_GET['d'])){
$d=$_GET['d'];
}
else if(!isset($_GET['d'])){
$d='';
}
if(($l)&&($f)){
$sql="SELECT DISTINCT referral_id FROM tbl_referral_info WHERE lname like \"$l\" AND fname like \"$f\" and date like \"$d\"";
$query = $dbh->query($sql);
$result = $query->fetch(PDO::FETCH_ASSOC);
$referral_id=$result['referral_id'];
}
else{
$referral_id=$_GET['referral_id'];
}
?>
<html>
<head>
<link href="../../CSS/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../classes/calendar/calendar.js"></script>
<script language="JavaScript"
src="../../classes/therapydoc/validation/referral_form.js"></script>
<script type="text/javascript" src="../../classes/therapydoc/menu.js"></script>
</head>
<body id="main_body">
<div id="wrapper"><?php include '../../classes/therapydoc/menu.php';?>
<h1>Edit Referral Information</h1>
<form method="post" name="referral_form" action="edit_referral.php"
onClick="return checkForm();"><input type="hidden" name="referral_id"
id="referral_id" value='<?php echo $referral_id; ?>'>
<table class="forms">
<tr>
<td><label for="p_lookup">Referring Physician</label></td>
<td><?php p_lookup($dbh,$referral_id); ?></td>
<td><label for="l_lookup">Facility</label></td>
<td><?php l_lookup($dbh,$referral_id); ?></td>
</tr>
<tr>
<td><label for="referral_date">Referral Date</label></td>
<td><?php referral_date($dbh,$referral_id); ?></td>
<td><label for="discipline">Disciplines</label></td>
<td name="discipline"><?php disciplines($dbh,$referral_id); ?></td>
</tr>
<tr>
<td colspan="4" class="center"><label>Patient Information</label>
</tr>
<?php referral_data($dbh,$referral_id); ?>
<tr>
<td colspan="4" class="center"><label>Payor Information</label></td>
</tr>
<tr>
<td><label for="payor1">Primary Payor</label></td>
<td><? payor1_lookup($dbh,$referral_id); ?></td>
<td><label for="payor2">Secondary Payor</label></td>
<td><? payor2_lookup($dbh,$referral_id); ?></td>
</tr>
<tr>
<td colspan="4" class="center"><input name="submit" type="submit"
value="Update Record"></td>
</tr>
<tr>
<td colspan="4" class="center"><?php
$s="http://$sname/therapydoc/view/referrals/edit_referral.php";
if(isset($_GET['ed'])){
$ed='2';
}
else if(!isset($_GET['ed'])){
$ed='';
}
if($ed=='2'){
echo "Record successfully updated.";
}
?></td>
</tr>
</table>
</form>
<script language="JavaScript">
new validateForm(document.forms.referral_form);
</script>
</body>
</html>