<div id="claim_response">
<?php
$service_type="(item_service='Optical Frame')";
$query_rsodest_claim_no = "select * from process_claim_no where process_claim_no='$process_claim_no'";
$rsodest_claim_no = mysql_query($query_rsodest_claim_no, $courier) or die(mysql_error());
$row_rsodest_claim_no = mysql_fetch_assoc($rsodest_claim_no);

$query_claim="select * from claims_details where process_claim_no='$process_claim_no' and (item_service='Optical Frame') order by id desc;";
$rsclaim=mysql_query($query_claim, $courier) or die(mysql_error());
$row_rsclaim = mysql_fetch_assoc($rsclaim);
$totalRows_rsclaim = mysql_num_rows($rsclaim);

$query_claim_total="select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and $service_type and mode_of_payment='cash'";
//echo $query_claim_total;
$rsclaim_total=mysql_query($query_claim_total, $courier) or die(mysql_error());
$row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
$total_cash=$row_rsclaim_total['totalprice'];

$query_claim_total="select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and $service_type and mode_of_payment<>'cash'";
$rsclaim_total=mysql_query($query_claim_total, $courier) or die(mysql_error());
$row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
$total_other=$row_rsclaim_total['totalprice'];

$rsclaim_total=mysql_query($query_claim_total, $courier) or die(mysql_error());
$row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
?>                                              
             
<div class="task-content task-list">
                                        <div class="row">
                        <div class="col-md-12">
                                <div class="portlet-body flip-scroll">
                                    <table class="table table-striped table-hover flip-content">
                                        <thead class="flip-content">
                                           <tr>
                                                    <th style="font-size: 12px;">Item</th>
                                                    <th style="font-size: 12px;">Eye</th>
                                                    <th style="font-size: 12px;">Sph</th>
                                                    <th style="font-size: 12px;">Cyl</th>
                                                    <th style="font-size: 12px;">Axis</th>
                                                    <th style="font-size: 12px;"> Add</th>
                                                    <th style="font-size: 12px;">PD</th>
                                                    <th style="font-size: 12px;">Qty</th>
                                                    <th style="font-size: 12px;">Action</th>
                                                    </tr>
                                        </thead>
                                    <tbody> 
                                                <tbody>
                                                <?php if ($totalRows_rsclaim> 0) { ?>   
                                                    <?php
                                                    do {
                                                        $i = $i + 1;
                                                        ?>
                                                      <tr>
                                                          <td><?php echo strtoupper($row_rsclaim['item']); ?></td>
                                                          <td>
                                                          <?php
                                                          if($row_rsclaim['submitted_status']!='submitted' && $row_rsclaim['action_status']==''){?>
                                                              <select name="itemopticaleyenumber<?php echo $row_rsclaim['id']; ?>" id="itemopticaleyenumber<?php echo $row_rsclaim['id']; ?>" style="width:70px;" onChange="searchItemsName('updateeyenumber_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                                                            <option value="" selected="selected"></option>
                                                            <?php 
                      $query_claim_dosage_form="select * from optical_eye";
$rsclaim_dosage_form=mysql_query($query_claim_dosage_form, $courier) or die(mysql_error());
$row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);  
                        do {  
?>
                                                            <option value="<?php echo $row_rsclaim_dosage_form['eye'];?>" <?php if($row_rsclaim['eye_optical']==$row_rsclaim_dosage_form['eye']){echo "selected";}?>><?php echo $row_rsclaim_dosage_form['eye'];?></option>
                                                            <?php
} while ($row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form));
  $rows = mysql_num_rows($rsclaim_dosage_form);
  if($rows > 0) {
      mysql_data_seek($rsclaim_dosage_form, 0);
	  $row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);
  }
         ?>
                                                          </select>
                                                              
                                                             
														<?php  
														   }else{
															   
															    echo strtoupper($row_rsclaim['toothnos']); 
															   ?>
                                                         
                                                          
                                                          <?php }?>
                                                          </td>
                                                          <td><select name="itemopticalshpere<?php echo $row_rsclaim['id']; ?>" id="itemopticalshpere<?php echo $row_rsclaim['id']; ?>" style="width:70px;" onChange="searchItemsName('updatesphere_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                                                            <option value="" selected="selected"></option>
                                                            <?php 
                      $query_claim_dosage_form="select * from optical_sphere";
$rsclaim_dosage_form=mysql_query($query_claim_dosage_form, $courier) or die(mysql_error());
$row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);  
                        do {  
?>
                                                            <option value="<?php echo $row_rsclaim_dosage_form['sph'];?>" <?php if($row_rsclaim['eye_spherical']==$row_rsclaim_dosage_form['sph']){echo "selected";}?>><?php echo $row_rsclaim_dosage_form['sph'];?></option>
                                                            <?php
} while ($row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form));
  $rows = mysql_num_rows($rsclaim_dosage_form);
  if($rows > 0) {
      mysql_data_seek($rsclaim_dosage_form, 0);
	  $row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);
  }
         ?>
                                                          </select></td>
                                                          <td><select name="itemopticalcylinder<?php echo $row_rsclaim['id']; ?>" id="itemopticalcylinder<?php echo $row_rsclaim['id']; ?>" style="width:60px;" onChange="searchItemsName('updatecylinder_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                                                            <option value="" selected="selected"></option>
                                                            <?php 
                      $query_claim_dosage_form="select * from optical_cylinder";
$rsclaim_dosage_form=mysql_query($query_claim_dosage_form, $courier) or die(mysql_error());
$row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);  
                        do {  
?>
                                                            <option value="<?php echo $row_rsclaim_dosage_form['cyl'];?>" <?php if($row_rsclaim['eye_cylindrical']==$row_rsclaim_dosage_form['cyl']){echo "selected";}?>><?php echo $row_rsclaim_dosage_form['cyl'];?></option>
                                                            <?php
} while ($row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form));
  $rows = mysql_num_rows($rsclaim_dosage_form);
  if($rows > 0) {
      mysql_data_seek($rsclaim_dosage_form, 0);
	  $row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);
  }
         ?>
                                                          </select></td>
                                                          <td><input type="text" id="itemaxis<?php echo $row_rsclaim['id']; ?>" name="itemaxis<?php echo $row_rsclaim['id']; ?>" style="width:40px;" min="0" max="180" value="<?php echo $row_rsclaim['eye_axis']; ?>" onchange="searchItemsName('updateaxis_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);" /></td>
                                                          <td><select name="itemopticaladd<?php echo $row_rsclaim['id']; ?>" id="itemopticaladd<?php echo $row_rsclaim['id']; ?>" style="width:60px;" onChange="searchItemsName('updateadd_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                                                            <option value="" selected="selected"></option>
                                                            <?php 
                      $query_claim_dosage_form="select * from optical_add";
$rsclaim_dosage_form=mysql_query($query_claim_dosage_form, $courier) or die(mysql_error());
$row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);  
                        do {  
?>
                                                            <option value="<?php echo $row_rsclaim_dosage_form['near_add'];?>" <?php if($row_rsclaim['eye_add']==$row_rsclaim_dosage_form['near_add']){echo "selected";}?>><?php echo $row_rsclaim_dosage_form['near_add'];?></option>
                                                            <?php
} while ($row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form));
  $rows = mysql_num_rows($rsclaim_dosage_form);
  if($rows > 0) {
      mysql_data_seek($rsclaim_dosage_form, 0);
	  $row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);
  }
         ?>
                                                          </select></td>
                                                          <td><select name="itemopticalpd<?php echo $row_rsclaim['id']; ?>" id="itemopticalpd<?php echo $row_rsclaim['id']; ?>" style="width:40px;" onChange="searchItemsName('updatepd_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                                                            <option value="" selected="selected"></option>
                                                            <?php 
                      $query_claim_dosage_form="select * from optical_pd";
$rsclaim_dosage_form=mysql_query($query_claim_dosage_form, $courier) or die(mysql_error());
$row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);  
                        do {  
?>
                                                            <option value="<?php echo $row_rsclaim_dosage_form['pd'];?>" <?php if($row_rsclaim['eye_pd']==$row_rsclaim_dosage_form['pd']){echo "selected";}?>><?php echo $row_rsclaim_dosage_form['pd'];?></option>
                                                            <?php
} while ($row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form));
  $rows = mysql_num_rows($rsclaim_dosage_form);
  if($rows > 0) {
      mysql_data_seek($rsclaim_dosage_form, 0);
	  $row_rsclaim_dosage_form = mysql_fetch_assoc($rsclaim_dosage_form);
  }
         ?>
                                                          </select></td>
                                                          <td>
                                                          <?php if($row_rsclaim['submitted_status']!='submitted' && $row_rsclaim['action_status']==''){?>
                                                            <input type="number" id="itemqty<?php echo $row_rsclaim['id']; ?>" name="itemqty<?php echo $row_rsclaim['id']; ?>" style="width:40px;" min="1" value="<?php echo $row_rsclaim['qty']; ?>" onChange="searchItemsName('updateqty_claim_details_spectacle','#claimsno_spectacle_prescriptions',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                                                            <?php }else{echo $row_rsclaim['qty'];}?>
                                                          </td>
                                                           <td style="color: red;text-align: center;">
                                                              <i id="trash_<?php echo $row_rsclaim['id']; ?>" class="icon-trash" onclick="delInformtion('del_claim_details_spectacle_optical','#claimsno_spectacle_prescriptions','<?php echo $row_rsclaim['id']; ?>','<?php echo strtoupper($row_rsclaim['item']); ?> ?', 'You are about to Delete <?php echo strtoupper($row_rsclaim['item']); ?> from this Patient.', '<?php echo strtoupper($row_rsclaim['item']); ?> Deleted Successfully !');" style="cursor: pointer;"></i>
                                                              <i style="display: none;" id="spin_refresh_<?php echo $row_rsclaim['id']; ?>" class="fa fa-refresh fa-spin fa-fw"></i>
                                                          </td>
                                                      </tr>
                  <?php }  while ($row_rsclaim = mysql_fetch_assoc($rsclaim)); ?>
                  <?php }else{echo '<tr><td colspan="9" style="background: linen"><div class="none">No Procedure Found.</div></td></tr>';}?>
                  </tbody>
                </table> 
</div>                                
</div>
</div>
</div>
</div>