<?php
require_once 'functions/functions.php';
$query_rsodest = "SELECT
a.*,b.title,b.occupation,b.surname, b.othernames,b.sex,b.marital_status,b.tel ,b.id as patient_id,b.type_of_client,b.insurance_company1,b.dateofbirth AS pdob, (DATE_FORMAT(current_date, '%Y') - DATE_FORMAT(b.dateofbirth, '%Y') - (DATE_FORMAT(current_date, '00-%m-%d') < DATE_FORMAT(b.dateofbirth, '00-%m-%d'))) AS age,
DATE_FORMAT(
a.datetimeadded,
'%e %b %Y %r'
) AS datenew
FROM process_claim_no a INNER JOIN patient_information b ON a.patient_no = b.card_number WHERE a.patient_no = '$patient_no' ORDER BY a.datetimeadded DESC";
$rsodest = mysql_query($query_rsodest, $courier) or die(mysql_error());
$totalRows_rsodest = mysql_num_rows($rsodest);
$row_rsodest = mysql_fetch_assoc($rsodest);
$clientType = $row_rsodest['type_of_client'];
if ($clientType == 'cash') {
    $clientType = 'Private';
    $insCom = 'N/A';
}else if ($clientType == 'insurance') {
    $clientType = 'Insuance';
    $insCom = ucwords(getInsuranceCompany($row_rsodest['insurance_company1']));
}else if ($clientType == 'company') {
    $clientType = 'Corporate';
    $insCom = ucwords(getInsuranceCompany($row_rsodest['insurance_company1']));
}


list($row_rsodest['picpath'], $row_rsodest['insurance_no1'], $row_rsodest['insurance_company1']) = patient_sub_info($row_rsodest['patient_no'], $courier);
$picpath="../".FOLDER_NAME.$row_rsodest['picpath']; 
if(!$picpath){ 
   if($row_rsodest['insurance_no1']){
       $inspicpath=getpicpath($row_rsodest['insurance_company1']);
       if($inspicpath){
           $member_id=preg_replace("/[^0-9]/","",$row_rsodest['insurance_no1']);
           $picpath="../".FOLDER_NAME.$inspicpath."/".ltrim($member_id,0).".jpg";
       }else{
           $picpath="../".FOLDER_NAME."images/profile.gif";		
       }
   }else{
       $picpath="../".FOLDER_NAME."images/profile.gif";	
   }
}

?> 




<div id="img_patient" style="cursor: pointer;" class="row" onclick="$(this).hide();$('#img_patient_2').show();">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="mt-widget-1" style="background-color: #FFF;">
            <div class="mt-img" style="margin-top: -20px;">
                <img style="height:80px;width: 80px;" src="<?php echo $picpath;?>"> 
            </div>
            <div class="mt-body" style="margin-top: -25px;">
                <h3 class="mt-username"><?php echo strtoupper($row_rsodest['title']." ".$row_rsodest['surname']." ".$row_rsodest['othernames']); ?> | <?php echo $row_rsodest['age']; ?> Yrs | <?php echo $row_rsodest['occupation']; ?></h3>
                <p class="mt-user-title"> Gender: <?php echo $row_rsodest['sex'];?> | Marital Status: <?php echo $row_rsodest['marital_status'];?> | Tel: <?php echo $row_rsodest['tel']; ?> | Client Type: <?php echo "$clientType";?> | Company: <?php echo $insCom; ?></p>
            </div>
        </div>
    </div>
</div>

<div id="img_patient_2" style="cursor: pointer;display: none;" class="row" onclick="$(this).hide();$('#img_patient').show();">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="mt-widget-1" style="background-color: #FFF;">
            <div class="mt-body">
                <h3 class="mt-username"><?php echo strtoupper($row_rsodest['title']." ".$row_rsodest['surname']." ".$row_rsodest['othernames']); ?> | <?php echo $row_rsodest['age']; ?> Yrs | <?php echo $row_rsodest['occupation']; ?></h3>
                <p class="mt-user-title"> Gender: <?php echo $row_rsodest['sex'];?> | Marital Status: <?php echo $row_rsodest['marital_status'];?> | Tel: <?php echo $row_rsodest['tel']; ?>  | Client Type: <?php echo "$clientType";?> | Company: <?php echo $insCom; ?> </p>
            </div>
        </div>
    </div>
</div>
<br>
