<?php

$optical_info = mysql_fetch_assoc(mysql_query("SELECT * FROM optical_examination WHERE process_claim_no ='$process_claim_no'", $courier));

$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);

$totalRows_rsodest_claim_no = mysql_num_rows($rsodest_claim_no);

$mode_of_payment = $row_rsodest_claim_no['mode_of_payment'];

$patient_no = $row_rsodest_claim_no['patient_no'];

 /////////////////////////////Get Patient No ////////////////////////////////////////////////////
 //echo"SELECT * FROM patient_information WHERE card_number ='$patient_no'";
$patient_info = mysql_fetch_assoc(mysql_query("SELECT * FROM patient_information WHERE card_number ='$patient_no'", $courier));
$patientID = $patient_info['id'];
$patientDOB = $patient_info['dateofbirth'];
$occupation = $patient_info['occupation'];
$pdob = strtotime($patientDOB);
// if (!$pdob || $pdob < 0 ) {
//     echo "empty";
// }else{
//     echo $pdob;
// }
?>
<input type="hidden" name="hiddenDOB" id="hiddenDOB" value="<?php echo $pdob ?>">
<input type="hidden" name="hiddenID" id="hiddenID" value="<?php echo $patientID ?>">
<input type="hidden" name="occupation" id="occupation" value="<?php echo $occupation ?>">
<div id="success_error_info_display_dob"></div>
<div class="portlet light bordered">

    <div class="portlet-title">

        <div style="cursor:pointer;" class="caption" onclick="$('#click_show_symptoms').trigger('click');">

            <i class="fa fa-bolt font-blue-hoki"></i>

            <span class="caption-subject bold font-blue-hoki"> Optical Examination </span>

        </div>

        <div class="tools">

            <a id="click_show_symptoms" href="" class="collapse" data-original-title="" title=""> </a>

        </div>

    </div>

    <div class="portlet-body">

        <div class="row">

            <div class="col-md-12 ">

                <div class="portlet light bordered">

<!--            <div class="portlet-title">

                <div class="caption">

                    <i class="fa fa-bolt font-blue-hoki"></i>

                    <span class="caption-subject bold font-blue-hoki"> Client Presenting Complaints (PC) </span>

                </div>

                <div class="portlet-body">

                    <input type="hidden" name="process_claim_no" id="process_claim_no" value="<?php echo $process_claim_no; ?>">

                    <textarea style="min-height:125px" name="patients_complaint" id="patients_complaint" class="form-control"><?php echo $optical_info['patient_complaints']; ?></textarea>

                </div>

            </div>-->



            <div class="portlet-title">

                <div style="cursor:pointer;" class="caption" onclick="$('#click_show_drawing').trigger('click');$('#paint_toggler').trigger('click');$('#paint_toggler').trigger('click');">

                    <span class="caption-subject bold font-blue-hoki"> Medical/Consultation Note </span>

                </div>

                <div class="tools">

                    <a id="click_show_drawing" href="" class="collapse" data-original-title="" title=""> </a>

                </div>

            </div>

            <div class="portlet-body" style="display: block;">

                <input type="hidden" name="process_claim_no" id="process_claim_no" value="<?php echo $process_claim_no; ?>">

                <i style="display:none;" id="paint_toggler" onclick="$('#wPaint').wPaint('menuOrientation', $('#wPaint').wPaint('menuOrientation') === 'vertical' ? 'horizontal' : 'vertical');"></i>

                <div class="row">

                    <div class="col-md-12" style="">

                        <div id="wPaint" style="position:relative;height:450px; background-color:#7a7a7a; margin:0px auto 20px auto;"></div>

                    </div>

                    <div class="col-md-12" id="consultation_drawing_wrapper">

                        <!--<input placeholder="Enter A Name/Tag for This Drawing" class="form-control" type="text" name="drawing_name" id="drawing_name"> <br>-->

                        <div class="demo-gallery">

                            <ul id="lightgallery" class="list-unstyled row">

                                <?php

                                $all_drawings = mysql_query("SELECT * FROM consultation_drawings WHERE process_claim_no = '$process_claim_no' AND type='consultation' ORDER BY id ASC", $courier);

                                $i = 1;

                                while ($row = mysql_fetch_assoc($all_drawings)) {

                                    ?>

                                    <li class="col-xs-6 col-sm-4 col-md-3" data-responsive="consultation/<?php echo $row['drawing_name']; ?> 375, consultation/<?php echo $row['drawing_name']; ?> 480, consultation/<?php echo $row['drawing_name']; ?> 800" data-src="consultation/<?php echo $row['drawing_name']; ?>" data-sub-html="<h4>Consultation Note <?php echo $i; ?></h4><p>Attached Consultation Note</p>">

                                        <a href="">

                                            <img style="height:120px" class="img-responsive" src="consultation/<?php echo $row['drawing_name']; ?>">

                                        </a>

                                    </li>

                                    <?php $i++;

                                }

                                ?>

                            </ul>

                        </div>

                    </div>

                    <textarea name="medical_consulation_type" id="medical_consulation_type" class="form-control" row="3" style="height:150px;" placeholder="Medical/Consultation Note"><?php echo $row_rsodest_claim_no['medical_consultation_note']; ?></textarea>

                </div>    

            </div>



        </div>

    </div> 

    <div class="col-md-12 ">

        <div class="portlet light bordered">

            <div class="portlet-title">

                <div class="caption">

                    <i class="fa fa-bolt font-blue-hoki"></i>

                    <span class="caption-subject bold font-blue-hoki"> VA WoRx & VA WRx/PH </span>

                </div>

                <div class="portlet-body">

                    <table class="table table-bordered">

                        <thead>

                            <tr>

                                <th style="width:40%;"> OD (RIGHT EYE) </th>

                                <th style="width:20%;"> &nbsp; </th>

                                <th style="width:40%;"> OS (LEFT EYE) </th>

                            </tr>

                        </thead>



                        <tbody>

                            <tr>

                                <td> <input type="text" name="od_worx" id="od_worx" class="form-control" value="<?php echo $optical_info['od_worx']; ?>"> </td>

                                <td style="font-weight: bold;text-align: center;"> VA WoRx </td>

                                <td> <input type="text" name="os_worx" id="os_worx" class="form-control" value="<?php echo $optical_info['os_worx']; ?>"> </td>

                            </tr>



                            <tr>

                                <td> <input type="text" name="od_wrx" id="od_wrx" class="form-control" value="<?php echo $optical_info['od_wrx']; ?>"> </td>

                                <td style="font-weight: bold;text-align: center;"> VA WRx/PH </td>

                                <td> <input type="text" name="os_wrx" id="os_wrx" class="form-control" value="<?php echo $optical_info['os_wrx']; ?>"> </td>

                            </tr>

                        </tbody>

                    </table>

                </div>

            </div>

        </div>

    </div> 

    <div class="col-md-12 ">

        <div class="portlet light bordered">

            <div class="portlet-title">

                <div class="caption">

                    <i class="fa fa-bolt font-blue-hoki"></i>

                    <span class="caption-subject bold font-blue-hoki"> Eye Examination </span>

                </div>

                <div class="portlet-body">

                  <table class="table table-bordered">

                    <thead>

                        <tr>

                            <th style="width:40%;"> OD (RIGHT EYE) </th>

                            <th style="width:20%;"> &nbsp; </th>

                            <th style="width:40%;"> OS (LEFT EYE) </th>

                        </tr>

                    </thead>



                    <tbody>

                        <tr>

                            <td> <input type="text" name="od_lids" id="od_lids" class="form-control" value="<?php echo $optical_info['od_lids']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> LIDS </td>

                            <td> <input type="text" name="os_lids" id="os_lids" class="form-control" value="<?php echo $optical_info['os_lids']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_conjunctiva" id="od_conjunctiva" class="form-control" value="<?php echo $optical_info['od_conjunctiva']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> CONJUNCTIVA </td>

                            <td> <input type="text" name="os_conjunctiva" id="os_conjunctiva" class="form-control" value="<?php echo $optical_info['os_conjunctiva']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_cornea" id="od_cornea" class="form-control" value="<?php echo $optical_info['od_cornea']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> CORNEA </td>

                            <td> <input type="text" name="os_cornea" id="os_cornea" class="form-control" value="<?php echo $optical_info['os_cornea']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_ac" id="od_ac" class="form-control" value="<?php echo $optical_info['od_ac']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> A/C </td>

                            <td> <input type="text" name="os_ac" id="os_ac" class="form-control" value="<?php echo $optical_info['os_ac']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_iris" id="od_iris" class="form-control" value="<?php echo $optical_info['od_iris']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> IRIS </td>

                            <td> <input type="text" name="os_iris" id="os_iris" class="form-control" value="<?php echo $optical_info['os_iris']; ?>"> </td>

                        </tr>

                        <tr>
                            <td> <input type="text" name="od_pupil" id="od_pupil" class="form-control" value="<?php echo $optical_info['od_pupil']; ?>"> </td>
                            <td style="font-weight: bold;text-align: center;"> PUPILS </td>
                            <td> <input type="text" name="os_pupil" id="os_pupil" class="form-control" value="<?php echo $optical_info['os_pupil']; ?>"> </td>
                        </tr>


                        <tr>

                            <td> <input type="text" name="od_lens" id="od_lens" class="form-control" value="<?php echo $optical_info['od_lens']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> LENS </td>

                            <td> <input type="text" name="os_lens" id="os_lens" class="form-control" value="<?php echo $optical_info['os_lens']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_vireous" id="od_vireous" class="form-control" value="<?php echo $optical_info['od_vireous']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> VITREOUS </td>

                            <td> <input type="text" name="os_vireous" id="os_vireous" class="form-control" value="<?php echo $optical_info['os_vireous']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_fundus" id="od_fundus" class="form-control" value="<?php echo $optical_info['od_fundus']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> FUNDUS </td>

                            <td> <input type="text" name="os_fundus" id="os_fundus" class="form-control" value="<?php echo $optical_info['os_fundus']; ?>"> </td>

                        </tr>



                        <tr>

                            <td> <input type="text" name="od_disc" id="od_disc" class="form-control" value="<?php echo $optical_info['od_disc']; ?>"> </td>

                            <td style="font-weight: bold;text-align: center;"> DISC </td>

                            <td> <input type="text" name="os_disc" id="os_disc" class="form-control" value="<?php echo $optical_info['os_disc']; ?>"> </td>

                        </tr>



                        <tr>
                            <td> 
                                <select name="od_cd_ratio" id="od_cd_ratio" class="form-control">
                                    <option value="">Select</option>
                                    <?php for($ii=0.1;$ii<=1.0;$ii+=0.1){ ?>
                                        <option <?php if($optical_info['od_cd_ratio']==$ii){echo 'selected';} ?> value="<?php echo number_format($ii,1); ?>"><?php echo number_format($ii,1); ?></option>
                                    <?php } ?>
                                    <select>
                                    </td>
                                    <td style="font-weight: bold;text-align: center;"> CD/RATIO </td>
                                    <td> 
                                        <select name="os_cd_ratio" id="os_cd_ratio" class="form-control">
                                            <option value="">Select</option>
                                            <?php for($ii=0.1;$ii<=1.0;$ii+=0.1){ ?>
                                                <option <?php if($optical_info['os_cd_ratio']==$ii){echo 'selected';} ?> value="<?php echo number_format($ii,1); ?>"><?php echo number_format($ii,1); ?></option>
                                            <?php } ?>
                                        </select>
                                    </td>
                                </tr>



                                <tr>

                                    <td> <input type="text" name="od_vessels" id="od_vessels" class="form-control" value="<?php echo $optical_info['od_vessels']; ?>"> </td>

                                    <td style="font-weight: bold;text-align: center;"> VESSELS </td>

                                    <td> <input type="text" name="os_vessels" id="os_vessels" class="form-control" value="<?php echo $optical_info['os_vessels']; ?>"> </td>

                                </tr>

                                <tr>

                                    <td> <input type="text" name="od_iop" id="od_iop" class="form-control" value="<?php echo $optical_info['od_iop']; ?>"> </td>

                                    <td style="font-weight: bold;text-align: center;"> INTRAOCULAR PRESSURE (IOP) </td>

                                    <td> <input type="text" name="os_iop" id="os_iop" class="form-control" value="<?php echo $optical_info['os_iop']; ?>"> </td>

                                </tr>

                            </tbody>

                        </table>

                    </div>

                </div>

            </div>

        </div> 



        <div class="col-md-12 ">

<!--        <div class="portlet light bordered">

            <div class="portlet-title">

                <div class="caption">

                    <i class="fa fa-bolt font-blue-hoki"></i>

                    <span class="caption-subject bold font-blue-hoki"> Plan / Treatment </span>

                </div>

                <div class="portlet-body">

                   <textarea style="min-height:125px" name="plan_treatment" id="plan_treatment" class="form-control"><?php echo $optical_info['plan_treatment']; ?></textarea>

                </div>

            </div>

        </div>-->



    </div>

</div>

</div>

</div>


<div class="modal fade bs-modal-sm" id="DonateModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div id="group_data"></div>
</div>



<script type="text/javascript">

    function getoccupation(){
        var occupation = $('#occupation').val();
        var hiddenID = $('#hiddenID').val();
        if (occupation == '') {
            $.ajax({
                url:'consultation/getModal.php',
                method:'post',
                data:{
                    hiddenID:hiddenID,
                    act:'occupation'
                },
                success:function(data){
                    $('#group_data').html(data);
                    $('#DonateModal').modal('show');
                }
            });
        }
    }

    function getdateofbirth(){
        var patientDOB = $('#hiddenDOB').val();
        var hiddenID = $('#hiddenID').val();
        if (patientDOB == '') {
            $.ajax({
                url:'consultation/getModal.php',
                method:'post',
                data:{
                    hiddenID:hiddenID,
                    act:'dob'
                },
                success:function(data){
                    $('#group_data').html(data);
                    $('#DonateModal').modal('show');
                }
            });
        }
    }

    function getdateofbirthandoccupation(){
        var occupation = $('#occupation').val();
        var patientDOB = $('#hiddenDOB').val();
        var hiddenID = $('#hiddenID').val();
        if (patientDOB == '' && occupation == '') {
            $.ajax({
                url:'consultation/getModal.php',
                method:'post',
                data:{
                    hiddenID:hiddenID,
                    act:'dobandoccupation'
                },
                success:function(data){
                    $('#group_data').html(data);
                    $('#DonateModal').modal('show');
                }
            });
        }
    }


   $(document).ready(function(){
       var patientDOB = $('#hiddenDOB').val();
       var occupation = $('#occupation').val();

       if (occupation == '' && patientDOB == ''){
           getdateofbirthandoccupation();
       }else if(occupation == '' && patientDOB != ''){
           getoccupation();
       }else if (patientDOB == '' && occupation != ''){
           getdateofbirth();
       }






    $('#lightgallery').lightGallery({

       cssEasing: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)'

   });



    $('#lightgallery2').lightGallery({

       cssEasing: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)'

   });

});



   var images = [

   'uploads/wPaint.png',

   ];



   function saveImg(image) {

      var _this = this;

      var tag = $('#drawing_name').val();

      $.ajax({

        type: 'POST',

        url: 'getstep.php',

        data: {image: image,act: 'save_drawing',tag: tag,type: 'consultation',patient_details: '<?php echo $medical_note_id . '@@@' . $process_claim_no; ?>'},

        success: function (msg) {

          _this._displayStatus('<span style="color:#000000;font-size:15px">Medical Note Successfully Saved <span>');

          $('#consultation_drawing_wrapper').html(msg);

      }

  });

  }



  function saveImg2(image) {

      var _this = this;

      var tag = $('#drawing_name').val();

      $.ajax({

        type: 'POST',

        url: 'getstep.php',

        data: {image: image,act: 'save_drawing2',tag: tag,type: 'additional_comment',patient_details: '<?php echo $medical_note_id . '@@@' . $process_claim_no; ?>'},

        success: function (msg) {

          _this._displayStatus('<span style="color:#000000;font-size:15px"> Successfully Saved <span>');

          $('#consultation_drawing_wrapper2').html(msg);

      }

  });

  }



        // init wPaint

        $('#wPaint').wPaint({

          menuOffsetLeft: 130,

          menuOffsetTop: 0,

          bg: '#FFFFFF',

          lineWidth:   '1',

          strokeStyle: '#000000',

          saveImg: saveImg

      });

        

        $('#wPaint2').wPaint({

          menuOffsetLeft: 130,

          menuOffsetTop: 0,

          bg: '#FFFFFF',

          lineWidth:   '1',

          strokeStyle: '#000000',

          saveImg: saveImg2

      });

  </script>

