<?php include('accesscheck2.php'); 
require_once('Connections/courier.php');

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_courier, $courier);
if(!isset($id)){
list($id,$process_claim_no,$patient_no,$pull_type) = explode("@@@", $_POST['id']);
}

$query_rsodest_patient = "SELECT *, DATE_FORMAT(dateofbirth, '%D %b %Y') as datenew, (DATE_FORMAT(current_date, '%Y') - DATE_FORMAT(dateofbirth, '%Y') - (DATE_FORMAT(current_date, '00-%m-%d') < DATE_FORMAT(dateofbirth, '00-%m-%d'))) AS age FROM patient_information where id='$id'";
$rsodest_patient = mysql_query($query_rsodest_patient, $courier) or die(mysql_error());
$row_rsodest_patient = mysql_fetch_assoc($rsodest_patient);

$MEMBERSHIPID=$row_rsodest_patient['id'];
$patient_no=$row_rsodest_patient['card_number'];
$PROVIDERID=$_SESSION['provider_id'];
$type_of_client=$row_rsodest_patient['type_of_client'];
$_SESSION['client_type']=$type_of_client;

$query_rsodest_claim = "select *, DATE_FORMAT(datetimeadded, '%e %b %Y') as dateprocessing from process_claim_no where patient_no='$patient_no' and provider_id='$PROVIDERID' and status='In Use'";
	$rsodest_claim = mysql_query($query_rsodest_claim, $courier) or die(mysql_error());
	$row_rsodest_claim = mysql_fetch_assoc($rsodest_claim);
	$totalRows_rsodest_claim = mysql_num_rows($rsodest_claim);
	$process_claim_no = $row_rsodest_claim['process_claim_no'];
	
?>
<form name="form" id="form" method="POST">
<div class="row">
    <div class="col-md-12 col-sm-12" id="patient_sub_page">
        <div class="portlet light tasks-widget bordered" style="min-height: 400px;">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark hide"></i>
                    <span class="caption-subject font-dark bold uppercase"> <span class="badge badge-default"> <i class="fa fa-bolt"></i> </span> Patient Diagnostics </span>
                </div>
                <div class="actions">
                    <div class="btn-group">
                        <a class="btn green btn-circle btn-sm" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true"> Actions
                            <i class="fa fa-angle-down"></i>
                        </a>
                        <?php include 'patient_sub_menus.php'; ?>
                    </div>
                </div>
            </div>
            <div class="portlet-body">
                   <div class="row">
                                    <div class="col-md-5 ">
                            <div class="portlet light bordered">
                                <div class="portlet-title">
                                    <div class="caption">
                                       <i class="fa fa-eyedropper font-blue-hoki"></i>
                                       <span class="caption-subject bold font-blue-hoki"> Diagnostics </span>
                                   </div>
                                    <div class="actions">
                                        <div class="portlet-input input-inline">
                                            <div class="input-icon right">
                                                <i class="icon-magnifier"></i>
                                                 <input type="hidden" name="pull_type" id="pull_type" value="<?php echo $pull_type;?>">
                                                <input type="hidden" name="process_claim_no" id="process_claim_no" value="<?php echo $process_claim_no;?>">
                                                <input type="text" name="searchtext_invoice_diagnostic" id="searchtext_invoice_diagnostic" placeholder="Search" onkeyup="javascript: var params = [ 'searchtext_invoice_diagnostic' ]; getstep_new('view_items_popup_diagnostics_2','view_items_response_diagnostic','','','document.getElementById(params[0]).focus();'); " class="form-control input-circle" placeholder="Symptoms">
                                        </div>
                                    </div>
                                </div>
                                </div>
                                <div class="portlet-body" id="">
                                    <div class="slimScrollDiv" style="height: 200px;overflow-y: scroll;overflow-x: hidden;">
                                       <?php include 'view_items_diagnostics.php'; ?>                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                       
                       
                       
                       <div class="col-md-7 ">
                           <div class="portlet light bordered" style="min-height:94px;">
                               <div class="portlet-title">
                                   <div class="caption">
                                       <i class="fa fa-bolt font-blue-hoki"></i>
                                       <span class="caption-subject bold font-blue-hoki"> Diagnostics Added </span>
                                   </div>
                                   <div class="actions">
                                        <div class="btn-group btn-group-devided" data-toggle="buttons">
                                            <label onClick="getclaimno('reload_medical_claim_diagnostic','claimsno_diagnostic','<?php echo $process_claim_no; ?>');" class="btn green btn-outline btn-circle btn-sm active">
                                                <input type="radio" name="options" class="toggle" id="option1">Refresh <i class="fa fa-refresh"></i>
                                            </label>
                                            <label onClick="getclaimno('forward_to_lab','claimsno_diagnostic','<?php echo $process_claim_no; ?>');" class="btn  green btn-outline btn-circle btn-sm">
                                                <input type="radio" name="options" class="toggle" id="option2">Forward to Laboratory <i class="fa fa-forward"></i>
                                            </label>
                                        </div>
                                    </div>
                               </div>
                               <div class="portlet-body">
                                   <div id="claimsno_diagnostic" class="slimScrollDiv" style="height: 205px;overflow-y: scroll;overflow-x: hidden;">
                                         <?php include 'view_items_claims_diagnostics.php'; ?>  
                                   </div>
                               </div>
                           </div>
                       </div>
        </div> 
            </div>
        </div>

    </div>
</div>
</form>
                       