
<div class="page-content-wrapper">
    <div class="page-content all">

        <div class="row">
            <div class="col-md-12" style="padding-right: 0px; padding-left: 0px;">
                <div class="portlet box blue">
                    <div class="portlet-title" style="height: 5px">
                        <div class="caption">
                            <div class="caption">
                                {if $programesetting->programview == 1} GYNA {/if}
                            </div>
                        </div>

                    </div>
                    <div class="portlet-body">


                        <table class="table table-striped table-hover table-bordered">
                            <thead>
                                <tr>

                                    <th class="col-md-12">
                                        Notes
                                    </th>

                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <textarea class="form-control txtc updateElement" rows="1" data-id="{$main_Obj->id}" data-colName="notes" data-tableName="maingyna" placeholder="Enter more text"
                                                  data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="{$main_Obj->notes}">{$main_Obj->notes}</textarea>
                                    </td>

                                </tr>
                                <tr>
                                    <td>
                                        <textarea class="form-control txtc updateElement" rows="1" data-id="{$main_Obj->id}" data-colName="plan" data-tableName="maingyna" placeholder="Plan"
                                                  data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="{$main_Obj->plan}">{$main_Obj->plan}</textarea>
                                    </td>

                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>


        <div class="row ">
            <div class="col-md-12" style="padding-right: 0px; padding-left: 0px;">
                <div class="portlet box blue">
                    <div class="portlet-title" style="height: 5px">
                        <div class="caption">
                            All visits
                        </div>
                        <div class="actions">
                            <a href="javascript:;" class="btn btn-default btn-sm" id="gyna_add">
                                Add New</a>
                        </div>
                        <div class="actions">
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" href="javascript:;" data-toggle="dropdown">
                                    TTT <i class="fa fa-angle-down"></i>
                                </a>
                                <ul class="dropdown-menu pull-right">
                                    <li>
                                        <a href="javascript:;" id="addDrug"  data-date="{$presDate}" data-controller="gyna">
                                            Add </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" id="showDrugs" data-controller="gyna">
                                            Show </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" id="preparedTTT"  data-date="{$presDate}" data-controller="gyna">
                                            Prepared TTT </a>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="actions">
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" href="javascript:;" data-toggle="dropdown">
                                    Lab <i class="fa fa-angle-down"></i>
                                </a>
                                <ul class="dropdown-menu pull-right">
                                    <li>
                                        <a href="javascript:;" id="addInv">
                                            Add </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" id="showInv" data-controller="gyna">
                                            Show </a>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="actions">
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" href="javascript:;" data-toggle="dropdown">
                                    Ray <i class="fa fa-angle-down"></i>
                                </a>
                                <ul class="dropdown-menu pull-right">
                                    <li>
                                        <a href="javascript:;" id="addRay">
                                            Add </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" id="showRay" data-controller="gyna">
                                            Show </a>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        {if $ProgramesettingData->system_lang == 2}
                        <div class="actions">
                            <a href="javascript:;" class="btn btn-default btn-sm" id="addNextVisit">
                                &nbsp;&nbsp;
                                Next Visit
                                &nbsp;&nbsp;&nbsp;
                            </a>
                        </div>
                        {else}
                        <div class="actions">
                            <a href="javascript:;" class="btn btn-default btn-sm" id="addUS">
                                &nbsp;&nbsp;
                                US
                                &nbsp;&nbsp;&nbsp;
                            </a>
                        </div>
                        {/if}

                        {if $ProgramesettingData->infertility == 1}
                        <div class="actions">
                            <a href="javascript:;" class="btn btn-default btn-sm" id="addInf">
                                Infertility
                            </a>
                        </div>

                        {/if}

                    </div>
                    <div class="portlet-body check_heigt_and_make_new_class" id="justfordrugs" >
                        <div class="table-toolbar">

                        </div>
                        <table class="table table-striped table-hover table-bordered" id="gyna">
                            <thead>
                                {if $ProgramesettingData->diagnosshow eq 0}
                                <tr>
                                    <th class="col-md-2" style="width: 100px;">
                                        Date
                                    </th>
                                    {if $ProgramesettingData->gynalmp eq 1}
                                    <th class="col-md-2 wds12">
                                        LMP
                                    </th>
                                    <th style="width: 26%;">
                                        Complaint
                                    </th>
                                    <th style="width: 26%;">
                                        Diagnosis
                                    </th>

                                    <th>
                                        Notes
                                    </th>

                                    {else}
                                    <th style="width: 29%;">
                                        Complaint
                                    </th>
                                    <th style="width: 29%;">
                                        Diagnosis
                                    </th>

                                    <th>
                                        Notes
                                    </th>

                                    {/if}
                                    <th style="width: 5px;">

                                    </th>
                                </tr>

                                {else}
                                <tr>
                                    <th class="col-md-2" style="width: 100px;">
                                        Date
                                    </th>
                                    {if $ProgramesettingData->gynalmp eq 1}
                                    <th class="col-md-2 wds12">
                                        LMP
                                    </th>
                                    <th style="width: 29%;">
                                        Complaint
                                    </th>
                                    <th>
                                        Notes
                                    </th>
                                    {else}
                                    <th style="width: 29%;">
                                        Complaint
                                    </th>
                                    <th>
                                        Notes
                                    </th>

                                    {/if}
                                    <th style="width: 5px;">

                                    </th>
                                </tr>

                                {/if}

                            </thead>
                            <tbody>
                                {foreach $allgyna as $gyna_obj}
                                <tr>
                                    <td>
                                        <input type="text" class="form-control {if $currentUser == $gyna_obj->doctorid}  datepicker   {/if}" data-id="{$gyna_obj->id}" data-colName="gynadate" data-tableName="gyna" value="{$gyna_obj->gynadate}" readonly />
                                    </td>
                                    {if $ProgramesettingData->gynalmp eq 1}
                                    <td>
                                        <input type="text" class="form-control {if $currentUser == $gyna_obj->doctorid}  datepicker   {/if}" data-id="{$gyna_obj->id}" data-colName="gynalmp" data-tableName="gyna" value="{$gyna_obj->gynalmp}" readonly/>
                                    </td>
                                    {/if}
                                    {if $ProgramesettingData->diagnosshow eq 0}
                                    <td>
                                        <!--     -->
                                        <!--select2me complaint-->

                                        <select multiple="" size="1" class="form-control select2me complaint updateDiagnosis" 
                                                id="complaint{$gyna_obj->id}" data-id="{$gyna_obj->id}" data-colName="complaintid" 
                                                data-tableName="gyna"  {if $currentUser != $gyna_obj->doctorid}  disabled   {/if}>
                                            <option value="">choose</option>

                                            {foreach $allcomplaint as $comp}
                                            <option value="{$comp->id}" {if $comp->id|in_array:$gyna_obj->compselect}selected="selected"{/if}>{$comp->name}</option>
                                            {/foreach}
                                            <option value="-1" class="addDiagnosis">Add</option>
                                            <option value="-2" class="deleteoptincompo">Delete</option>
                                        </select>

                                    </td>
                                    <td>
                                        <!--     -->
                                        <!--select2me diagnosis-->

                                        <select multiple="" size="1" class="form-control select2me diagnosis updateDiagnosis" 
                                                id="diagnosis{$gyna_obj->id}" data-id="{$gyna_obj->id}" data-colName="diagnosisid" 
                                                data-tableName="gyna"  {if $currentUser != $gyna_obj->doctorid}  disabled   {/if}>
                                            <option value="">choose</option>

                                            {foreach $alldiagnosis as $mydiagnosis}
                                            <option value="{$mydiagnosis->id}" {if $mydiagnosis->id|in_array:$gyna_obj->select}selected="selected"{/if}>{$mydiagnosis->name}</option>
                                            {/foreach}
                                            <option value="-1" class="addDiagnosis">Add</option>
                                            <option value="-2" class="deleteoptincompo">Delete</option>
                                        </select>
                                    </td>
                                    {else}


                                    <td>
                                        {if $currentUser != $gyna_obj->doctorid}  
                                        {$gyna_obj->complaint}
                                        {else}

                                        <input type="text" class="form-control updateElement" data-id="{$gyna_obj->id}" 
                                               data-colName="complaint" data-tableName="gyna" value="{$gyna_obj->complaint}" 
                                               data-toggle="popover" data-trigger="hover" data-placement="bottom" 
                                               data-content="{$gyna_obj->complaint}"  />
                                        {/if}

                                    </td>
                                    {/if}
                                    <td>
                                        {if $currentUser != $gyna_obj->doctorid}  
                                        {$gyna_obj->notes}
                                        {else}
                                        <textarea class="form-control updateElement txtc" rows="1" data-id="{$gyna_obj->id}" 
                                                  data-colName="notes" data-tableName="gyna" placeholder="Enter more text" 
                                                  data-toggle="popover" data-trigger="hover" data-placement="bottom" 
                                                  data-content="{$gyna_obj->notes}" 
                                                  >{$gyna_obj->notes}</textarea>
                                        {/if}
                                    </td>
                                    <td>
                                        {if $currentUser == $gyna_obj->doctorid}     
                                        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$gyna_obj->id}" style=" float: left;" href="#" data-link="gyna" data-fn="del">
                                            <i class="fa fa-close"></i>
                                        </a>
                                        {else}
                                        {$gyna_obj->doctorName}
                                        {/if}
                                    </td>
                                </tr>
                                {/foreach}
                            </tbody>
                        </table>



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

</div>
<input type="hidden" id="patientId" value="{$patientid}"/>
<input type="hidden" id="controllName" value="gyna"/>
<input type="hidden" id="iDsArray" value="{$iDsArray}"/>
<input type="hidden" id="ultrasoundForm" value="{$ultrasoundForm}"/>
<!----#########################################################################  model ##############################################################################################################--->
<div class="all">
    <!--------------------------------------------------------------------------- simple form Ultrasound Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="SimplePatientUS" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">

                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-cogs"></i> Ultrasound
                                        </div>
                                        <div class="actions">
                                            <a href="javascript:;" class="btn btn-default btn-sm addRowH" data-type="ussimple">
                                                <i class="fa fa-plus"></i> Add </a>

                                            <a href="javascript:;" class="btn btn-default btn-sm printUsRows" data-type="usgyna">
                                                <i class="fa fa-print"></i> print </a>

                                        </div>
                                    </div>
                                    <div class="portlet-body scroll_y showNumGyna">

                                        <table class="table table-striped table-hover table-bordered" >

                                            <thead>
                                                <tr>
                                                    <th rowspan="2">
                                                        <!--<input type="checkbox" id="usPrintAll">-->
                                                    </th>
                                                    <th rowspan="2" class="cent" style=" width: 100px; ">
                                                        Date
                                                    </th>
                                                    <th rowspan="2" class="cent" style=" width: 60px; ">
                                                        Day
                                                    </th>
                                                    <th colspan="2" class="cent">
                                                        Right Ovary
                                                    </th>

                                                    <th colspan="2" class="cent">
                                                        Left Ovary
                                                    </th>
                                                    <th rowspan="2" class="cent" style=" width: 60px; ">
                                                        Endo
                                                    </th>

                                                    <th rowspan="2" class="cent">
                                                        Notes
                                                    </th>
                                                    <th rowspan="2" class="cent">
                                                        Delete
                                                    </th>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <th rowspan="2">
                                                        Doctor
                                                    </th>
                                                    {/if}
                                                </tr>
                                                <tr>
                                                    <th style=" width: 60px; background: #c6d7f2;">
                                                        No
                                                    </th>

                                                    <th style="background: #c6d7f2;">
                                                        Size
                                                    </th>
                                                    <th style=" width: 60px; background: #c6d7f2;">
                                                        No
                                                    </th>

                                                    <th style="background: #c6d7f2;">
                                                        Size
                                                    </th>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}                                                    {/if}

                                                </tr>
                                            </thead>


                                            <tbody id="ussimple">
                                                {assign var=i value=1}
                                                {foreach $allgynaUS  as $gUs }
                                                <tr>
                                                    <td>
                                                        <input type="checkbox" class="usPrint" id="usPrint{$gUs->id}"  name="pic[]"  value="{$gUs->id}"/>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control datepicker updateElement" readonly="" placeholder="Date" data-colName="date" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->date}"/>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="Day" data-colName="day" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->day}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="R.No" data-colName="ovraylno" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovraylno}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="R.size" data-colName="ovraylsize" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovraylsize}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="L.No" data-colName="ovrayrno" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovrayrno}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="L.size" data-colName="ovrayrsize" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovrayrsize}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="Endo" data-colName="endo" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->endo}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="Notes" data-colName="notes" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->notes}">
                                                    </td>

                                                    <td>
                                                        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$gUs->id}" style=" float: left;" href="#" data-link="gyna" data-fn="delgynaus">
                                                            <i class="fa fa-close"></i>
                                                        </a>
                                                    </td>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <td class="bold">
                                                        {$gUs->doctorname}
                                                    </td>
                                                    {/if}
                                                </tr>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}
                                            </tbody>
                                        </table>
                                        <input type="hidden" id="ussimpleItr" value="{$i}"/>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">

                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

        </div>
    </div>

    <!--------------------------------------------------------------------------- complete form Ultrasound Model-------------------------------------------------------------------------------------->
    <div class="modal fade " tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="completePatientUS" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">

                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-cogs"></i> Ultrasound
                                        </div>
                                        <div class="actions">
                                            <a href="javascript:;" class="btn btn-default btn-sm addRowH" data-type="uscomplete">
                                                <i class="fa fa-plus"></i> Add </a>

                                            <a href="javascript:;" class="btn btn-default btn-sm printUsRows" data-type="usgyna">
                                                <i class="fa fa-print"></i> print </a>

                                        </div>
                                    </div>
                                    <div class="portlet-body scroll_y showNumGyna">

                                        <table class="table table-striped table-hover table-bordered" >
                                            <thead>
                                                <tr>
                                                    <th>
                                                        <input type="checkbox" id="usPrintAll">
                                                    </th>
                                                    <th class="cent">
                                                        #
                                                    </th>
                                                    <th class="cent">
                                                        Date
                                                    </th>
                                                    <th class="cent">
                                                        Day
                                                    </th>
                                                    <th class="cent">
                                                        Endo
                                                    </th>

                                                    <th colspan="3" class="cent">
                                                        UTERUS
                                                    </th>

                                                    <th colspan="3" class="cent">
                                                        CERVIX
                                                    </th>

                                                    <th colspan="3" class="cent">
                                                        OVARY Lt
                                                    </th>

                                                    <th colspan="3" class="cent">
                                                        OVARY Rt
                                                    </th>


                                                    <th class="cent">
                                                        LTovary
                                                    </th>
                                                    <th class="cent">
                                                        Rtovary
                                                    </th>
                                                    <th class="cent">
                                                        Delete
                                                    </th>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <th>
                                                        Doctor
                                                    </th>
                                                    {/if}

                                                </tr>
                                                <tr>
                                                    <th>

                                                    </th>
                                                    <th>

                                                    </th>
                                                    <th class="col-md-1">

                                                    </th>
                                                    <th>

                                                    </th>
                                                    <th>

                                                    </th>
                                                    <th  >
                                                        L
                                                    </th>

                                                    <th >
                                                        W
                                                    </th>
                                                    <th >
                                                        V
                                                    </th>

                                                    <th >
                                                        L
                                                    </th>

                                                    <th >
                                                        W
                                                    </th>
                                                    <th >
                                                        V
                                                    </th>
                                                    <th >
                                                        L
                                                    </th>

                                                    <th >
                                                        W
                                                    </th>
                                                    <th >
                                                        V
                                                    </th>
                                                    <th >
                                                        L
                                                    </th>

                                                    <th >
                                                        W
                                                    </th>
                                                    <th >
                                                        V
                                                    </th>
                                                    <th>

                                                    </th>
                                                    <th>

                                                    </th>
                                                    <th>

                                                    </th>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <th>

                                                    </th>
                                                    {/if}



                                                </tr>
                                            </thead>
                                            <tbody id="uscomplete">
                                                {assign var=j value=1}
                                                {foreach $allgynaUS  as $gUs }
                                                <tr>
                                                    <td>
                                                        <input type="checkbox" class="usPrint" id="usPrint{$gUs->id}"  name="pic[]"  value="{$gUs->id}"/>
                                                    </td>
                                                    <td>
                                                        {$j}
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control datepicker updateElement" readonly="" placeholder="Date" data-colName="date" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->date}"/>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="Day" data-colName="day" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->day}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="Endo" data-colName="endo" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->endo}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="L" data-colName="uterusl" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->uterusl}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="W" data-colName="uterusw" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->uterusw}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="V" data-colName="uterusv" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->uterusv}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="L" data-colName="cervixl" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->cervixl}">
                                                    </td>

                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="W" data-colName="cervixw" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->cervixw}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="V" data-colName="cervixv" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->cervixv}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="L" data-colName="ovrayll" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovrayll}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="W" data-colName="ovraylw" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovraylw}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="V" data-colName="ovraylv" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovraylv}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="L" data-colName="ovrayrl" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovrayrl}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="W" data-colName="ovrayrw" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovrayrw}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="V" data-colName="ovrayrv" data-id="{$gUs->id}"  data-tableName="gynaus" value="{$gUs->ovrayrv}">
                                                    </td>
                                                    <td>
                                                        {if $gUs->lfolliclesno == 0}
                                                        <a href="#"  class="btn green btn-block btn-xs addLTovary" id="addLTovary{$gUs->id}" data-type="add" data-id="{$gUs->id}"> ADD </a>
                                                        {else}
                                                        <a href="#"  class="btn green btn-block btn-xs addLTovary" data-type="show" data-id="{$gUs->id}"> Show </a>
                                                        {/if}
                                                    </td>
                                                    <td>
                                                        {if $gUs->rfolliclesno == 0}
                                                        <a href="#"  class="btn green btn-block btn-xs addRtovary" id="addRtovary{$gUs->id}" data-type="add" data-id="{$gUs->id}"> ADD </a>
                                                        {else}
                                                        <a href="#"  class="btn green btn-block btn-xs addRtovary" data-type="show" data-id="{$gUs->id}"> Show </a>
                                                        {/if}

                                                    </td>

                                                    <td>
                                                        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$gUs->id}" style=" float: left;" href="#" data-link="gyna" data-fn="delgynaus">
                                                            <i class="fa fa-close"></i>
                                                        </a>
                                                    </td>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <td class="bold">
                                                        {$gUs->doctorname}
                                                    </td>
                                                    {/if}
                                                </tr>

                                                {capture assign=j}{$j+1}{/capture}
                                                {/foreach}
                                            </tbody>
                                        </table>
                                        <input type="hidden" id="uscompleteItr" value="{$j}"/>
                                        <input type="hidden" id="currentBtnId" value=""/>

                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                            </div>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
            </div>
        </div>


    </div>


    <!---------------------------------------------------------------------------add Drugs Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientDrugs" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close closeDrug" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form class="form-horizontal" role="form" action="" method="post" id="gynaDrugs" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="portlet blue-hoki box">
                                        <div class="portlet-title" >
                                            <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Today <input type="text" class="form-control datepicker " id="presDate" name="presDate" value="{$presDate}" data-controller="gyna"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
                                            <div class="actions">
                                                <a href="javascript:;" class="btn btn-default btn-sm" id="addNewDrugRow" data-tableName="gynadrugs">
                                                    <i class="fa fa-plus"></i> Add </a>
                                                <a href="javascript:;" class="btn btn-default btn-sm" id="addNewDrugInTable">
                                                    <i class="fa fa-plus"></i> Add New Drug </a>
                                            </div>
                                            <div id="husbandFor">
                                                <label class="bold" style="font-size: 16px;">Husband <input type="checkbox" id="forHusband" name="forHusband"  value="1" data-controller="gyna"></label>
                                            </div>
                                            <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Print Date <input type="text" class="form-control datepicker " data-controller="antenalvisit"  id="printDate" name="printDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
                                        </div>

                                        <div class="portlet-body  scroll_y showNum isheight">

                                            <table class="table table-striped table-hover table-bordered" id="pre_table" >
                                                <thead>
                                                    <tr>
                                                        <th class="col-md-2">
                                                            Group
                                                        </th>
                                                        <th class="col-md-2">
                                                            Drug
                                                        </th>
                                                        <th class="col-md-2">
                                                            Form
                                                        </th>
                                                        <th class="col-md-5">
                                                            Use
                                                        </th>
                                                        {if $ProgramesettingData->presquantity eq 1}
                                                        <th >
                                                            Q
                                                        </th>
                                                        {/if}

                                                        <th >
                                                            Delete
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody id="drugContent">

                                                    <tr style="display: none"><td colspan="5" ><input type="hidden" id="drugItr" value="{$preItr}" name="drugItr"/></td></tr>
                                                    {assign var=itr value=1}
                                                    {foreach $PatientPresByDate as $pre}
                                                    <tr>
                                                        <td>
                                                            <select class="form-control xx dcat select2me" id="dcat{$itr}" name="dcat{$itr}"  data-itr="{$itr}"  data-placeholder="Select..."  >
                                                                <option value="" {if $pre->drugcat == ""}selected{/if}>Choose Category</option>
                                                                {foreach $allDrugcats as $cat}
                                                                <option value="{$cat['drugcat']}" {if $pre->drugcat == $cat['drugcat'] }selected{/if}>{$cat['drugcat']}</option>
                                                                {/foreach}
                                                                <option value="" {if $pre->drugcat == ""}selected{/if}>Choose Category</option>
                                                            </select>
                                                        </td>
                                                        <td>
                                                            <select class="form-control xx dname select2me updateElement" id="dname{$itr}" data-id="{$pre->id}" data-colName="drugid" data-tableName="gynadrugs" data-itr="{$itr}" data-placeholder="Select..."  >
                                                                <option value="" {if $pre->drugid == ""}selected{/if}>Choose Drug</option>
                                                                {foreach $drugs as $drug}
                                                                <option value="{$drug['id']}" {if $pre->drugid == $drug['id'] }selected{/if}>{$drug['drugname']} {if $ProgramesettingData->visitsform eq 3}(left {$drug['currentbalance']}){/if}</option>
                                                                {/foreach}
                                                                <option value="" {if $pre->drugid == ""}selected{/if}>Choose Drug</option>
                                                            </select>

                                                        </td>
                                                        <td>
                                                            <select class="form-control xx dtype select2me updateElement" id="dtype{$itr}" data-id="{$pre->id}" data-colName="drugtype" data-tableName="gynadrugs" data-itr="{$itr}" data-placeholder="Select..."  >
                                                                <option value="" {if $pre->drugtype == ""}selected{/if}>Choose Form</option>
                                                                {foreach $allDrugTypes as $type}
                                                                <option value="{$type['drugtype']}" {if $pre->drugtype == $type['drugtype'] }selected{/if}>{$type['drugtype']}</option>
                                                                {/foreach}
                                                                <option value="" {if $pre->drugtype == ""}selected{/if}>Choose Form</option>
                                                            </select>
                                                        </td>
                                                        <td>
                                                            <select class="form-control xx select2me updateElement" id="ddos{$itr}" data-id="{$pre->id}" data-colName="drugdos" data-tableName="gynadrugs" data-itr="{$itr}" data-placeholder="Select..."  >
                                                                <option value="" {if $pre->drugdos == ""}selected{/if}>choose dose </option>
                                                                {foreach $allDrugDoses as $dos}
                                                                <option value="{$dos['drugdos']}" {if $pre->drugdos == $dos['drugdos'] }selected{/if}>{$dos['drugdos']}</option>
                                                                {/foreach}
                                                                <option value="" {if $pre->drugdos == ""}selected{/if}>choose dose </option>
                                                            </select>
                                                        </td>
                                                        {if $ProgramesettingData->presquantity eq 1}
                                                        <td id="drugQuantity{$itr}">
                                                            -                                                            
                                                        </td>
                                                        {/if}

                                                        <td>
                                                            <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$pre->id}" style=" float: left;" href="#" data-link="gyna" data-fn="addprescription">
                                                                <i class="fa fa-close"></i>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                    {capture assign=itr}{$itr+1}{/capture}
                                                    {/foreach}

                                                </tbody>
                                            </table>
                                            <!--<div class="md-checkbox" id="husbandFor">
                                                <input type="checkbox" id="forHusband" name="forHusband"  class="md-check" value="1" data-controller="gyna">
                                                <label for="forHusband" class="bold">
                                                    <span></span>
                                                    <span class="check"></span>
                                                    <span class="box"></span>
                                                    Make this for Husband </label>
                                            </div>-->

                                            <input type="hidden" id="pId" value="" name="patientId"/>
                                            <input type="hidden" id="preType" value="" name="preType"/>
                                            <input type="hidden" id="preFor" value="" name="preFor"/>

                                            <div id="drugPrint">

                                            </div>

                                        </div>

                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <img src="{$hosturl}/../upload/loading.gif" id="sendLoading" style="display: none;width: 3%;">
                                    <span><i class="fa fa-check green" id="sendDone" 
                                             style="display: none;    font-size: xx-large; color: green;"></i></span>
                                    <i class="fa fa-exclamation-triangle red" id="sendError" 
                                       style="display: none;    font-size: xx-large; color: red;"></i>

                                    <button type="button" class="btn green-haze sendPre" data-itr="" data-for=""  data-type="add"  data-controller="gyna"> Send  </button>
                                    <button type="button" class="btn green printPre"  data-type="add" data-controller="gyna"> Print  </button>
                                    <button type="button" class="btn default closeDrug" id="closemodel" data-dismiss="modal"> Close</button>

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

    <!---------------------------------------------------------------------------show Drugs Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showPatientDrugs" style="min-width:1000px;z-index: 10049;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title" >
                                        <div class="caption"> Prescriptions </div>
                                    </div>
                                    <div class="portlet-body" id="showPrescriptions">

                                        <table class="table table-striped table-hover table-bordered">
                                            <thead>
                                                <tr>
                                                    <th> Date </th>
                                                    <th> Drug Name </th>
                                                    <th>  Edit</th>
                                                    <th>  Print </th>
                                                    <th>  Send  </th>
                                                    <th> {if $ProgramesettingData->displaydoctorname eq 1} Doctor{/if}</th>
                                                </tr>
                                            </thead>

                                        </table>

                                    </div>
                                    <div id="drugPrintShow">

                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">

                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

    <!--------------------------------------------------------------------------- add diagnosis Model-------------------------------------------------------------------------------------->
    <div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"  id="add_model">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title"> Add New </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form action="" id="" method="post" class="form-horizontal  emptyform" >
                            <div class="form-body">
                                <!------===========================================------->
                                <div class="form-group">
                                    <div class="col-md-1"></div>
                                    <label class="col-md-3 control-label txtl"> Name </label>
                                    <div class="col-md-8">
                                        <input type="text" class="addDiagnosisName wds95" id="diagnosisName" data-select="" data-tablename="" data-id="" value="">
                                    </div>
                                </div>

                                <!------===========================================------->
                                <div class="modal-footer">
                                    <button type="button" id="amountcloseinput"   class="btn default" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>
    </div>
    <!--------------------------------------------------------------------------- edit diagnosis Model-------------------------------------------------------------------------------------->
    <div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"  id="edit_model">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title"> Edit </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form action="" id="" method="post" class="form-horizontal  emptyform" >
                            <div class="form-body">
                                <!------===========================================------->
                                <div class="form-group">
                                    <label class="col-md-1 control-label"> </label>
                                    <div class="col-md-10">
                                        <div id="alldatadiv" class="" > </div>
                                    </div>
                                    <label class="col-md-1 control-label"> </label>
                                </div>

                                <!------===========================================------->
                                <div class="modal-footer">
                                    <button type="button" id="amountcloseinput"   class="btn default" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>
    </div>

    <!--------------------------------------------------------------------------- antenatal form Ultrasound gynaRTovary-------------------------------------------------------------------------------------->

    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="gynaRTovary" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title" >
                                        <div class="caption"> Follicles </div>
                                    </div>
                                    <div class="portlet-body form">
                                        <form class="form-horizontal" role="form" action="" method="post" id="Rfocildata" enctype="multipart/form-data">
                                            <div class="form-group form-md-line-input rr">
                                                <label class="col-md-2 control-label bold" for="folliclesNumbers">Follicles Numbers : </label>
                                                <div class="col-md-2">
                                                    <input type="text" class="form-control positiveNo" id="RfolliclesNumbers" name="RfolliclesNumbers" data-type="rightTovary" placeholder="Follicles Numbers">
                                                    <div class="form-control-focus">
                                                    </div>
                                                </div>
                                            </div>

                                            </br>

                                            <table class="table table-striped table-hover table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>
                                                            Name
                                                        </th>
                                                        <th>
                                                            Length
                                                        </th>
                                                        <th>
                                                            Width
                                                        </th>
                                                        <th>
                                                            Volume
                                                        </th>

                                                    </tr>
                                                </thead>
                                                <tbody id="rTovary">

                                                </tbody>
                                            </table>
                                            <input type="hidden" class="form-control" id="rgynaUsId" name="rgynaUsId" value="" >
                                            <input type="hidden" class="form-control" id="tovaryTypeR" name="tovaryType" value="right" >
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default saveFocil rr" data-type="right"  data-controller="gyna"> Save  </button>
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

    <!--------------------------------------------------------------------------- antenatal form Ultrasound gynaLTovary-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="gynaLTovary" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title" >
                                        <div class="caption"> Follicles </div>
                                    </div>
                                    <div class="portlet-body form">
                                        <form class="form-horizontal" role="form" action="" method="post" id="focildata" enctype="multipart/form-data">
                                            <div class="form-group form-md-line-input ff" >
                                                <label class="col-md-2 control-label bold" for="folliclesNumbers">Follicles Numbers : </label>
                                                <div class="col-md-2">
                                                    <input type="text" class="form-control positiveNo" id="folliclesNumbers" name="folliclesNumbers" data-type="leftTovary" placeholder="Follicles Numbers">
                                                    <div class="form-control-focus">
                                                    </div>
                                                </div>
                                            </div>

                                            </br>

                                            <table class="table table-striped table-hover table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>
                                                            Name
                                                        </th>
                                                        <th>
                                                            Length
                                                        </th>
                                                        <th>
                                                            Width
                                                        </th>
                                                        <th>
                                                            Volume
                                                        </th>

                                                    </tr>
                                                </thead>
                                                <tbody id="Tovary">

                                                </tbody>
                                            </table>
                                            <input type="hidden" class="form-control " id="lgynaUsId" name="lgynaUsId" value="" >
                                            <input type="hidden" class="form-control" id="tovaryTypeL" name="tovaryType" value="left" >
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default saveFocil ff" data-type="left" data-controller="gyna"> Save  </button>
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

    <!--------------------------------------------------------------------------- add Investigation Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientInvestigation" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds95" style="max-width: 90%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form class="form-horizontal" role="form" action="" method="post" id="gynaInvest" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="portlet blue-hoki box">
                                        <div class="portlet-title">
                                            <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Today <input type="text" class="form-control datepicker " id="invDate" name="invDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline; width: 62%"> </div>
                                            <div class="actions">
                                                <button type="button" class="btn default printInvestigation" data-print ="0" data-controller="gyna"> Save </button>
                                                <button type="button" class="btn default printInvestigation" data-print ="1" data-controller="gyna"> Save and Print  </button>
                                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                            </div>
                                            <label class="husbandx">
                                                <span>  Husband
                                                    <input type="checkbox" id="forHusbandInv" name="forHusband"  value="1" style="padding: 4px 10px;">
                                                </span>
                                            </label>
                                            <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Print Date <input type="text" class="form-control datepicker " data-controller="antenalvisit"  id="printInvDate" name="printInvDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>

                                        </div>
                                        <div class="portlet-body">
                                            <input type="hidden" id="pId1" value="" name="patientId"/>
                                            <div class="row" style="padding-left: 9px;padding-top:5px;overflow-y: scroll;">
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group1 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group2 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group3 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}


                                                </div>

                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group4 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" id="" class="iiin {if $cat->name == 'Male(Husband)'}husbandCheck{/if} {$cat->id}Check" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}

                                                    {assign var=i value=1}
                                                    {foreach $others  as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="{$cat->id}Check iiin" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>

                                                <div class="wds20 fleft">
                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Favorites
                                                        <span>
                                                            <input type="checkbox" data-gClass="favoriteCheck" class="iiin checkGroup">
                                                        </span>

                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $favorites as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="favoriteCheck iiin" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>


                                                    <!---   lab offers ------>

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Offers
                                                        <span>
                                                            <input type="checkbox" data-gClass="offersCheck" class="iiin checkGroup">
                                                        </span>

                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $invoffers as $offer}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="offersCheck iiin" id="" value="{$offer->id}" name="offersCheck[]"  data-name="{$offer->name}" data-price="{$offer->price}">
                                                            </span> {$offer->name} ( {$offer->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>

                                                </div>
                                            </div>


                                            <div  id="inv_div">

                                            </div>



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

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


        </div>
    </div>


    <!--------------------------------------------------------------------------- show Investigation Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showPatientInvestigation" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds80">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title">
                                        <div class="caption"> Investigations  </div>
                                    </div>
                                    <div class="portlet-body all">
                                        <div  id="showInvs">
                                            <table class="table table-striped table-hover table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th> <div align="center">Date </div></th>
                                                        <th colspan="3"> <div align="center">Investigations </div></th>
                                                    </tr>
                                                </thead>

                                            </table>
                                        </div>
                                        <div  id="inv_divShow">

                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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



</div>

<div id="newDrugTableDiv"></div>



<!--------------------------------------------------------------------------- add rays Model-------------------------------------------------------------------------------------->
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientRays" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds95">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">  </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <form class="form-horizontal" role="form" action="" method="post" id="gynaRay" enctype="multipart/form-data">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title">
                                        <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Today <input type="text" class="form-control datepicker " id="rayDate" name="rayDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline; width: 62%"> </div>
                                        <div class="actions">
                                            <button type="button" class="btn default printRay" data-print ="0" data-controller="gyna"> Save </button>
                                            <button type="button" class="btn default printRay" data-print ="1" data-controller="gyna"> Save and Print  </button>
                                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                        </div>

                                        <label class="husbandx">
                                            <span> Husband
                                                <input type="checkbox" id="forHusbandRay" name="forHusbandRay"  value="1" style="padding: 4px 10px;">
                                            </span>
                                        </label>
                                        <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Print Date <input type="text" class="form-control datepicker " data-controller="antenalvisit"  id="printrayDate" name="printrayDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
                                    </div>

                                    <div class="portlet-body">
                                        <input type="hidden" id="pId11" value="" name="patientId"/>
                                        <input type="hidden" id="mainId11" value="" name="mainId"/>
                                        <div class="row" style="padding-left: 9px;padding-top:5px;overflow-y: scroll;">
                                            <div class="wds33 fleft">
                                                {assign var=i value=1}
                                                {foreach $allRayCats1 as $cat}

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                    <span>
                                                        <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $cat->rays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}

                                                {assign var=i value=1}
                                                {foreach $allRayCats3 as $cat}

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                    <span>
                                                        <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $cat->rays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" id="" class="iiin {$cat->id}Check"  value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}


                                            </div>
                                            <div class="wds33 fleft">
                                                {assign var=i value=1}
                                                {foreach $allRayCats2 as $cat}

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                    <span>
                                                        <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $cat->rays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}

                                                {assign var=i value=1}
                                                {foreach $allRayCats4 as $cat}

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                    <span>
                                                        <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $cat->rays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" id="" class="iiin {if $cat->name == 'Male(Husband)'}husbandCheck{/if} {$cat->id}Check" value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}


                                            </div>



                                            <div class="wds34 fleft">
                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Favorites
                                                    <span>
                                                        <input type="checkbox" data-gClass="favoriteCheck" class="iiin checkGroup">
                                                    </span>

                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $favoritesRays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="favoriteCheck iiin" id="" value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>

                                                {foreach $otherRays  as $cat}

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                    <span>
                                                        <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $cat->rays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="{$cat->id}Check iiin" id="" value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}

                                                {assign var=i value=1}
                                                {foreach $allRayCats5 as $cat}

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                    <span>
                                                        <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    {assign var=j value=1}
                                                    {foreach $cat->rays as $inv}
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="rayCheck[]">
                                                        </span> {$inv->name}
                                                    </label>

                                                    {capture assign=j}{$j+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}
                                            </div>
                                        </div>

                                        <div  id="ray_div">

                                        </div>




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

                        </div>


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

<!--------------------------------------------------------------------------- show Rays Model-------------------------------------------------------------------------------------->
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showPatientRays" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds90">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">  </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="portlet blue-hoki box">
                                <div class="portlet-title">
                                    <div class="caption"> Rays  </div>
                                </div>
                                <div class="portlet-body">
                                    <div  id="showRays">
                                        <table class="table table-striped table-hover table-bordered">
                                            <thead>
                                                <tr>
                                                    <th> <div align="center">Date </div></th>
                                                    <th colspan="3"> <div align="center">Rays </div></th>
                                                </tr>
                                            </thead>

                                        </table>
                                    </div>
                                    <div  id="ray_divShow">

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

<!--------------------------------------------------------------------------- next visit  Model-------------------------------------------------------------------------------------->
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" 
     data-keyboard="false"   id="nextVisitModal" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds90">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">  </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="portlet blue-hoki box">
                                <div class="portlet-title">
                                    <div class="caption">       Next Visit  </div>
                                </div>
                                <div class="portlet-body">
                                    <div class="row">
                                        <table class="table table-striped table-hover table-bordered">
                                            <tbody>
                                                <tr>
                                                    <th class="wds15"> Date </th>
                                                    <td >
                                                        <input type="text" class="form-control notPop datepicker" id="nextVisitDate" 
                                                               value="{$smarty.now|date_format:"%Y/%m/%d"}" />
                                                    </td>
                                                    <!--th> Time </th>
                                                    <td>
                                                        <input type="text" class="form-control notPop timepicker timepicker-24" 
                                                               id="nextVisitTime" value="07:00" />
                                                    </td-->
                                                    <th  class="wds11">  Services</th>
                                                    <td class="wds55">
                                                        <select class="form-control select2me" id="nextVisitService"  data-placeholder="Select...">
                                                            <option value=""></option>
                                                            {foreach $services as $service}
                                                            <option value="{$service->id}">{$service->title}</option>
                                                            {/foreach}
                                                        </select>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <th>  Notes</th>
                                                    <td colspan="3">
                                                        <textarea class="form-control txtc" rows="1" placeholder="Notes"   id="nextVisitNotes"></textarea> 
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <th>  Notes Redirect To</th>
                                                    <td colspan="3">
                                                        <div class="col-md-11">
                                                            <select class="form-control select2me" id="redirectTo"  
                                                                    data-placeholder="Select..." multiple>
                                                                <option value="" > </option>
                                                                {foreach $redirect_users as $user}
                                                                <option value="{$user.user_id}">{$user.name}</option>
                                                                {/foreach}
                                                            </select>
                                                        </div>
                                                        <div class="col-md-1">
                                                            <button type="button" class="btn green" id="saveNextVisit"> Save</button>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>

                                    <div class="row" id="nextVisitsDiv">
                                        <table class="table table-striped table-hover table-bordered">
                                            <thead>
                                                <tr>
                                                    <th>Date</th>
                                                    <th>Service</th>
                                                    <th>Notes</th>
                                                    <th>Redirect To</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {foreach $nextVisits as $nextVisit }
                                                <tr>
                                                    <td>{$nextVisit.visitdate}</td>
                                                    <td>{$nextVisit.serviceName}</td>
                                                    <td>{$nextVisit.redirect_note}</td>
                                                    <td>{$nextVisit.redirectTo}</td>
                                                </tr>
                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!------------------##############################-------------------- End of Models -----------------------#########################################-------------->
<div id="tempModels"></div>

<div id="modalShow"></div>

<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" id="infertilityModal" style="min-width:1000px;">

</div>

<div class="modal fade" id="editModal" tabindex="-1" role="basic" aria-hidden="true">
</div>