<?php
$query_rsodest_claims_invoice = "select *, DATE_FORMAT(datetimeadded, '%e %b %Y') as datenew from process_claim_no where patient_id='$id' order by id desc";
$rsodest_claims_invoice = mysql_query($query_rsodest_claims_invoice, $courier) or die(mysql_error());
$row_rsodest_claims_invoice = mysql_fetch_assoc($rsodest_claims_invoice);	
$totalRows_claims_invoice = mysql_num_rows($rsodest_claims_invoice);
?>

<div class="portlet light bordered">
    <div class="portlet-title">
        <div style="cursor:pointer;" class="caption" onclick="$('#click_show_history_page').trigger('click');">
            <i class="fa fa-bolt font-blue-hoki"></i>
            <span class="caption-subject bold font-blue-hoki"> Patient Medical History </span>
        </div>
        <div class="tools">
            <a id="click_show_history_page" href="" class="collapse" data-original-title="" title=""> </a>
        </div>
    </div>
    <div class="portlet-body">
        <div class="row">
            <div class="col-md-12 ">

                   <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="table table-hover table-striped table-bordered">
                  <thead>
                    <tr>
                      <th class="count">&nbsp;</th>
                      <th>Date of Visit</th>
                      <th>Visit No</th>
                      <th>Attending Officer</th>
                      <th>Area</th>
                      <th style="text-align: center;">Status</th>
                      <th style="text-align: center;">Action</th>
                </tr>
              </thead>
                  <tbody>  <?php if ($totalRows_claims_invoice> 0) { ?>
                    <?php do {
                                                        $start_row=$start_row+1;?>
							<tr>
                                                      <td height="23" valign="top" class="count"><span><?php echo $start_row; ?></span></td>
                                                      <td href="#basic2" data-toggle="modal" valign="top" style="cursor: pointer;" onclick="getMedicalHistoryDetails('get_medical_history_details_optical','<?php echo $row_rsodest_claims_invoice['process_claim_no']; ?>','<?php echo $row_rsodest_claims_invoice['id'].'@@@'.$row_rsodest_claims_invoice['patient_id']; ?>');"><?php if($checkstatus==''){$checkstatus=$row_rsodest_claims_invoice['patient_status'];}echo date('jS F, Y g:ia', strtotime($row_rsodest_claims_invoice['datetimeadded'])); ?></td>
                                                      <td href="#basic2" data-toggle="modal" valign="top" onclick="getMedicalHistoryDetails('get_medical_history_details_optical','<?php echo $row_rsodest_claims_invoice['process_claim_no']; ?>','<?php echo $row_rsodest_claims_invoice['id'].'@@@'.$row_rsodest_claims_invoice['patient_id']; ?>');" style="cursor: pointer;"><?php echo $row_rsodest_claims_invoice['process_claim_no']; ?></td>
                                                      <td href="#basic2" data-toggle="modal" valign="top" onclick="getMedicalHistoryDetails('get_medical_history_details_optical','<?php echo $row_rsodest_claims_invoice['process_claim_no']; ?>','<?php echo $row_rsodest_claims_invoice['id'].'@@@'.$row_rsodest_claims_invoice['patient_id']; ?>');" style="cursor: pointer;"><?php echo $row_rsodest_claims_invoice['attending_officer']; ?></td>
                                                      <td href="#basic2" data-toggle="modal" valign="top" onclick="getMedicalHistoryDetails('get_medical_history_details_optical','<?php echo $row_rsodest_claims_invoice['process_claim_no']; ?>','<?php echo $row_rsodest_claims_invoice['id'].'@@@'.$row_rsodest_claims_invoice['patient_id']; ?>');" style="cursor: pointer;"><?php echo $row_rsodest_claims_invoice['area_specialisation'];?></td>
                                                      <td href="#basic2" data-toggle="modal" valign="top" style="cursor: pointer;text-align: center;" onclick="getMedicalHistoryDetails('get_medical_history_details_optical','<?php echo $row_rsodest_claims_invoice['process_claim_no']; ?>','<?php echo $row_rsodest_claims_invoice['id'].'@@@'.$row_rsodest_claims_invoice['patient_id']; ?>');">
                                                      <?php if($row_rsodest_claims_invoice['patient_status']=='In Use'){$statuscolor='green';}
                                                      if($row_rsodest_claims_invoice['patient_status']=='Done'){$statuscolor='red';}
                                                      echo "<span style='color:$statuscolor; font-weight:bold;'>".$row_rsodest_claims_invoice['patient_status']."</span>";?>
                                                      </td>
                                                      <td href="#basic2" data-toggle="modal" valign="top" onclick="getMedicalHistoryDetails('get_medical_history_details_optical','<?php echo $row_rsodest_claims_invoice['process_claim_no']; ?>','<?php echo $row_rsodest_claims_invoice['id'].'@@@'.$row_rsodest_claims_invoice['patient_id']; ?>');" style="cursor: pointer;text-align: center;"> View Details </td>
									        </tr>
										    
										    <?php } while ($row_rsodest_claims_invoice = mysql_fetch_assoc($rsodest_claims_invoice)); ?>
											
											<?php }else{?>
                                            <tr>
										      <td height="23" colspan="10" valign="top" class="count">Sorry, No Patient Visits Recorded Yet.</td>
									        </tr>
                                            
                                            <?php }?>
									      </tbody>
								    </table>
            </div> 

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


<div class="modal fade" id="basic2" tabindex="-1" role="basic" aria-hidden="true">
    <div class="modal-dialog modal-full">
        <div style="display:none" id="success_message" style="top:-60px;">Processing. Please Wait...</div>
        <div id="hidden_id_wrapper"></div>
        <div class="modal-content" style="border-radius: 0px;background-color: #fff;min-height: 500px" id="details_div_wrapper">


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