<?php /* Smarty version Smarty-3.1.11, created on 2024-08-19 11:57:57
         compiled from "../views/obgy/visits/add.html" */ ?>
<?php /*%%SmartyHeaderCode:56368035266c30915d1b7d2-64662135%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'e64c9a59adea449146c7f8e1b7b387554d3cd0cd' => 
    array (
      0 => '../views/obgy/visits/add.html',
      1 => 1702454368,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '56368035266c30915d1b7d2-64662135',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'hosturl' => 0,
    'controllname' => 0,
    'rolePastVisits' => 0,
    'programesetting' => 0,
    'cardVisitId' => 0,
    'cardVisitPatient' => 0,
    'cardVisitTime' => 0,
    'statusNo' => 0,
    'allDetections' => 0,
    'i' => 0,
    'row' => 0,
    'k' => 0,
    'showBrancheSelect' => 0,
    'today' => 0,
    'py_all_departs' => 0,
    'sub_regions' => 0,
    'sub_region' => 0,
    'lastpatient' => 0,
    'refer' => 0,
    'data' => 0,
    'py_all_doc' => 0,
    'branches' => 0,
    'selectedBranch' => 0,
    'organizations' => 0,
    'found' => 0,
    'allBranches' => 0,
    'allRayCats1' => 0,
    'cat' => 0,
    'inv' => 0,
    'j' => 0,
    'allRayCats3' => 0,
    'allRayCats2' => 0,
    'allRayCats4' => 0,
    'favoritesRays' => 0,
    'otherRays' => 0,
    'allRayCats5' => 0,
    'group1' => 0,
    'group2' => 0,
    'group3' => 0,
    'group4' => 0,
    'others' => 0,
    'favorites' => 0,
    'invoffers' => 0,
    'offer' => 0,
    'group5' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_66c30916001d79_22287018',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_66c30916001d79_22287018')) {function content_66c30916001d79_22287018($_smarty_tpl) {?><meta charset="utf8">
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">

            <div class="col-md-12 ">
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption fright">

                            الزيارات
                        </div>
                        <div class="tools fleft">
                            <a href="#" class="collapse" title="تصغير / تكبير"></a>
                            <!--a class="fff bold" href="<?php echo $_smarty_tpl->tpl_vars['hosturl']->value;?>
/controllers/<?php echo $_smarty_tpl->tpl_vars['controllname']->value;?>
.php?ac=show">عرض جميع  الزيارات</a-->
                        </div>
                    </div>

                    <input type="hidden" id="controllName" value="visits"/>
                    <input type="hidden"    id="addVisit"  value="1">
                    <input type="hidden"    id="past_visits"  value="<?php echo $_smarty_tpl->tpl_vars['rolePastVisits']->value;?>
">
                    <input type="hidden"    id="shareVersion"  value="<?php echo $_smarty_tpl->tpl_vars['programesetting']->value->system_type;?>
">
                    <input type="hidden"    id="cardVisitId"  value="<?php echo $_smarty_tpl->tpl_vars['cardVisitId']->value;?>
">
                    <input type="hidden"    id="past_search"  value="<?php echo $_smarty_tpl->tpl_vars['programesetting']->value->past_search;?>
">
                    <input type="hidden"    id="orgDiscountType"  value="<?php echo $_smarty_tpl->tpl_vars['programesetting']->value->organizations;?>
">
                    <input type="hidden"    id="past_search_check"  value="1">
                    <input type="hidden"    id="printserial"  value="<?php echo $_smarty_tpl->tpl_vars['programesetting']->value->printserial;?>
">
                    <input type="hidden"    id="activeBranches"  value="<?php echo $_smarty_tpl->tpl_vars['programesetting']->value->branches;?>
">
                    <input type="hidden"    id="regions"  value="<?php echo $_smarty_tpl->tpl_vars['programesetting']->value->regions;?>
">



                    <div class="portlet-body form">
                        <div class="form-body">
                            <div class="clinick rtl">
                                <div class="row">
                                    <form action="#" id="myvisitform" method="post" class="awval">
                                        <input type="hidden"    id="cardVisitPatient"
                                               name="cardVisitPatient"   value="<?php echo $_smarty_tpl->tpl_vars['cardVisitPatient']->value;?>
">
                                        <input type="hidden"    id="cardVisitTime"
                                               name="cardVisitTime"   value="<?php echo $_smarty_tpl->tpl_vars['cardVisitTime']->value;?>
">
                                        <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->branches!=1){?>
                                        <input type="hidden"  id="branch_id"  name="branch_id"  value="1"> 
                                        <?php }?>
                                        <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                            <tr>
                                                <th style="width: 10%;">رقم الحالة </th>
                                                <th style="width: 35%;">اسم الحالة </th>
                                                <th style="width: 15%;">نوع الكشف</th>
                                                <th style="width: 40%;" colspan="4">قيمة الكشف</th>
                                                <th>الصيدلية</th>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input type="text"  id="statusNoRemoteLab"   value="<?php echo $_smarty_tpl->tpl_vars['statusNo']->value;?>
"
                                                           class="form-control  txtc searchPatRemoteLab positiveNo " >
                                                </td>
                                                <td>
                                                    <input type="hidden" class="form-control"    id="patientvisitid" name="patientid"  >
                                                    <div class="txtc ltr" id="phonesContainer"></div>
                                                </td>

                                                <td>
                                                    <input type="hidden"    id="min_paid_in"  value="0">
                                                    <input type="hidden"    id="units_no_in"  value="0">
                                                    <select  class="form-control " name="detectionid" id="detectionid" placeholder="اختر نوع الكشف " required select-tableName="visits" data-tableName="visits" data-maintable = "detections" data-colName="detectionid" data-id="0">
                                                        <option value=""></option>
                                                        <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                        <?php  $_smarty_tpl->tpl_vars['row'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['row']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allDetections']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['row']->key => $_smarty_tpl->tpl_vars['row']->value){
$_smarty_tpl->tpl_vars['row']->_loop = true;
?>
                                                        <?php if ($_smarty_tpl->tpl_vars['i']->value==1){?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['row']->value->detectionval;?>
<?php $_tmp1=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['k'] = new Smarty_variable($_tmp1, null, 0);?><?php }?>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['row']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['i']->value==1){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['row']->value->title;?>
</option>
                                                        <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                        <?php } ?>
                                                        <option value="-1">إضافة كشف</option>
                                                        <?php if ($_SESSION['role_id']!=3){?><option value="0" class="deleteoptincompo">حذف</option><?php }?>
                                                    </select>
                                                </td>
                                                <td>
                                                    <label class="control-label bold" style=" text-align: center !important;">الإجمالى  </label>
                                                    <input  class="form-control digitsOnly detectionvalue"  type="text"  id="totaldetectionvalue" value="<?php echo $_smarty_tpl->tpl_vars['k']->value;?>
" name="totaldetectionvalue" required="required">
                                                </td>
                                                <td>
                                                    <label class="control-label bold" style=" text-align: center !important;">الخصم   </label>
                                                    <input  class="form-control digitsOnly detectionvalue"  type="text"  id="discount" value="0" name="discount" required="required">
                                                </td>
                                                <td>
                                                    <div class="col-md-6">
                                                        <label class="control-label bold" style=" text-align: center !important;">كاش </label>
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="detectionvalue_cash" value="<?php echo $_smarty_tpl->tpl_vars['k']->value;?>
" name="detectionvalue_cash" required="required">
                                                    </div>
                                                    <div class="col-md-6">
                                                        <label class="control-label bold" style=" text-align: center !important;">فيزا </label>
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="detectionvalue_visa" value="0" name="detectionvalue_visa" required="required">
                                                    </div>
                                                </td>
                                                <td>
                                                    <label class="control-label bold" style=" text-align: center !important;">المتبقى   </label>
                                                    <input  class="form-control digitsOnly"  type="text"  id="restdetectionvalue" value="0" name="restdetectionvalue" required="required" readonly="">
                                                </td>
                                                <td>
                                                    <label class="control-label bold" style=" text-align: center !important;"></label>
                                                    <a id="searchNotPayedBillsERP">
                                                        <i class="fa fa-info-circle"></i>  </a>
                                                </td>
                                            </tr>
                                        </table>

                                        <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                            <tr>
                                                <th style="width: 10%;"> تاريخ الزيارة </th>
                                                <th style="width: 7%;"> وقت  الزيارة </th>
                                                <th style="width: 18%;">القسم</th>
                                                <th id="invTypeHead" style="display: none; width: 10%;">النوع</th>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->regions==1){?>  <th style=" width: 10%;">المنطقة </th><?php }?> 
                                                <th id="doctors_containers_head" style="display: none; width: 20%;">الاطباء</th>
                                                <th id="time_containers_head" style="display: none; width: 8%;">وقت العمليه</th>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->refer_doctor==1){?> <th  style="width: 15%;">الطبيب المحول </th>  <?php }?> 
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->branches==1){?> 
                                                <th  <?php if ($_smarty_tpl->tpl_vars['showBrancheSelect']->value==1){?> style="width: 10%;" <?php }else{ ?> style="display: none;width: 10%;" <?php }?>>الفرع   </th> 
                                                <?php }?> 
                                                <th>ملاحظات </th>
                                                <th class="wds7" <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->system_type!=3){?> style="display: none;"   <?php }?>  >الوحدات ( - ) </th>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input class="form-control patientvisitidCheckDate   edited" readonly  
                                                           type="text"  id="visitdate" name="visitdate" required value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
">
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control notPop"
                                                           name="visit_time" id="visit_time">
                                                </td>
                                                <td>
                                                    <input type="hidden"    id="oldOperation_main_id"  value="0">
                                                    <input type="hidden"    id="oldVisitDoctor"  value="0">
                                                    <input type="hidden"    id="oldVisitHours"  value="-1">


                                                    <select class="form-control" style="width: 75%;"  name="fordepartment" id="fordepartment" placeholder="اختر القسم " required >
                                                        <?php  $_smarty_tpl->tpl_vars['row'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['row']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['py_all_departs']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['row']->key => $_smarty_tpl->tpl_vars['row']->value){
$_smarty_tpl->tpl_vars['row']->_loop = true;
?>
                                                        <?php if ($_SESSION['role_id']==12){?>
                                                        <?php if ($_smarty_tpl->tpl_vars['row']->value->id==12){?>
                                                        <option value=""></option>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['row']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['row']->value->name;?>
</option>
                                                        <?php }?>
                                                        <?php }elseif($_SESSION['role_id']==5){?>
                                                        <?php if ($_smarty_tpl->tpl_vars['row']->value->id==5){?>
                                                        <option value=""></option>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['row']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['row']->value->name;?>
</option>
                                                        <?php }?>
                                                        <?php }else{ ?>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['row']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['row']->value->name;?>
</option>
                                                        <?php }?>
                                                        <?php } ?>
                                                    </select>
                                                </td>
                                                <td id="invTypeDiv" style="display: none;">
                                                    <input type="hidden"  name="roleId"  id="roleId"  value="<?php echo $_SESSION['role_id'];?>
">
                                                    <select  class="form-control" name="invType" id="invType" placeholder="اختر نوع " required>
                                                        <option value="0"   <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->visittype==0){?> selected  <?php }?>>خارجى</option>
                                                        <option value="1"  <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->visittype==1){?> selected  <?php }?>>داخلى</option>
                                                    </select>
                                                </td>

                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->regions==1){?>
                                                <td>
                                                    <select class="form-control select2h" id="subRegionId"  name="subRegionId" >
                                                        <option value=""></option>
                                                        <?php  $_smarty_tpl->tpl_vars['sub_region'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['sub_region']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sub_regions']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['sub_region']->key => $_smarty_tpl->tpl_vars['sub_region']->value){
$_smarty_tpl->tpl_vars['sub_region']->_loop = true;
?>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['sub_region']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['sub_region']->value['name'];?>
</option>
                                                        <?php } ?>
                                                    </select>
                                                </td>
                                                <?php }?> 


                                                <td id="doctors_containers" style="display: none;">
                                                    <select  class="form-control" name="for_doctor" id="for_doctor" placeholder="اختر طبيب " required>

                                                    </select>
                                                    <span id="drExist" style="color:red;" > </span>
                                                    <span id="visitCountDiv" style="color:brown;" >    </span>
                                                </td>


                                                <td id="time_containers" style="display: none;">
                                                    <!--input type="text" class="form-control timepicker timepicker-24"
                                                           name="operation_time" id="operation_time"-->
                                                    <select class="form-control select2h " id="reserveId" name="reserveId"  data-placeholder="Select..." >
                                                        <option></option>
                                                    </select>
                                                </td>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->refer_doctor==1){?>
                                                <td>
                                                    <select class="form-control  refer_doctor editData"     name="refer_doctor"
                                                            id="refer_doctor" data-ptname="refer_doctor" >
                                                        <option value=""></option>
                                                        <option value="-1" <?php if ($_smarty_tpl->tpl_vars['lastpatient']->value->refer_doctor==-1){?>selected<?php }?>>لا يوجد</option>
                                                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['refer']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['lastpatient']->value->refer_doctor==$_smarty_tpl->tpl_vars['data']->value->id&&$_smarty_tpl->tpl_vars['lastpatient']->value->refer_doctor_tb==0){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                        <?php } ?>

                                                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['py_all_doc']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                        <option value="*<?php echo $_smarty_tpl->tpl_vars['data']->value['user_id'];?>
" <?php if ($_smarty_tpl->tpl_vars['lastpatient']->value->refer_doctor==$_smarty_tpl->tpl_vars['data']->value['user_id']&&$_smarty_tpl->tpl_vars['lastpatient']->value->refer_doctor_tb==1){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value['name'];?>
</option>
                                                        <?php } ?>


                                                        <?php if ($_SESSION['role_id']!=3){?>
                                                        <option value="0" class="deleteoptincompo">حذف</option>
                                                        <?php }?>
                                                    </select>
                                                </td>
                                                <?php }?> 

                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->branches==1){?> 
                                                <td <?php if ($_smarty_tpl->tpl_vars['showBrancheSelect']->value!=1){?> style="display: none;" <?php }?> >
                                                    <select class="form-control select2h" id="branch_id"  name="branch_id" >
                                                        <option value=""></option>
                                                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['branches']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['selectedBranch']->value==$_smarty_tpl->tpl_vars['data']->value->id){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                        <?php } ?>
                                                    </select>
                                                </td>
                                                <?php }?> 


                                                <td>
                                                    <input type="text" name="notes" id="notes"    class="form-control txtc ">
                                                </td>

                                                <td  <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->system_type!=3){?> style="display: none;"   <?php }?> >
                                                    <input type="text" name="unitsConsumed" id="unitsConsumed"
                                                           class="form-control txtc digitsOnly " value="0">
                                                </td>

                                            </tr>
                                        </table>

                                        <table class="table table-bordered  table-hover rtl" style="margin-bottom: 5px;">
                                            <tr>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->system_lang==1){?>
                                                <th style="width: 20%;">  صاحب  الزيارة  </th>
                                                <th style="width: 15%; display: none" id="childHead">الطفل</th>
                                                <?php }?>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->organizations!=1){?>
                                                <th style="width: 15%;"> تابع ل  </th>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->organizations==3){?><th style="width: 5%;">  سعر التعاقد   </th>     <?php }?>
                                                <th style="width: 5%;"> الخصم   </th>
                                                <?php }?>
                                                <th>   </th>
                                            </tr>
                                            <tr>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->system_lang==1){?>
                                                <td>

                                                    <div class="md-radio-inline">
                                                        <div class="md-radio">
                                                            <input type="radio" id="for_husband0" name="for_husband"
                                                                   class="md-radiobtn for_husband"       value="0" checked>
                                                            <label for="for_husband0">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                الزوجة       </label>
                                                        </div>

                                                        <div class="md-radio">
                                                            <input type="radio" id="for_husband_1" name="for_husband"
                                                                   class="md-radiobtn for_husband"     value="1"  >
                                                            <label for="for_husband_1">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                الزوج  </label>
                                                        </div>

                                                        <div class="md-radio">
                                                            <input type="radio" id="for_husband2" name="for_husband"
                                                                   class="md-radiobtn for_husband"       value="2">
                                                            <label for="for_husband2">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                طفل        </label>
                                                        </div>
                                                    </div>

                                                </td>
                                                <td style="display: none; width: 15%;"  id="childContain">

                                                    <select  class="form-control select2h" name="child" id="childFor" placeholder="اختر طفل " >
                                                        <option value=""></option>
                                                    </select>

                                                </td>
                                                <?php }?>

                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->organizations!=1){?>
                                                <td style="width: 15%;">
                                                    <select  class="form-control select2h" name="organizations" id="organizations"
                                                             placeholder="اختر  " required="required" select-tableName="visits"
                                                             data-tableName="visits" data-maintable = "organizations"
                                                             data-colName="organization_id" data-id="0" >
                                                        <option value="" selected>لا يوجد </option>
                                                        <?php  $_smarty_tpl->tpl_vars['row'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['row']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['organizations']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['row']->key => $_smarty_tpl->tpl_vars['row']->value){
$_smarty_tpl->tpl_vars['row']->_loop = true;
?>
                                                        <option value="<?php echo $_smarty_tpl->tpl_vars['row']->value->id;?>
" ><?php echo $_smarty_tpl->tpl_vars['row']->value->organization_name;?>
</option>
                                                        <?php } ?>
                                                        <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->organizations==2){?>
                                                        <option value="-1" class="deleteoptincompo">تعديل </option>
                                                        <?php }?>
                                                    </select>
                                                </td>
                                                <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->organizations==3){?> 
                                                <td>
                                                    <input type="text" name="contractPrice" id="contractPrice"
                                                           class="form-control txtc " value="0" readonly>

                                                    <input type="hidden" name="patient_hold" id="patient_hold" value="0">
                                                </td>
                                                <?php }?>
                                                <td>
                                                    <input type="text" name="discountRatio" id="discountRatio"
                                                           class="form-control txtc " value="0" readonly>
                                                    <input type="hidden" name="discountRatioType" id="discountRatioType" value="0">
                                                </td>
                                                <?php }?>


                                                <td style="width: 15%;" >
                                                    <input type="submit" name="submit" id="visitaddsubmit"
                                                           class="btn blue btnsve addbtnvisit wds100" value="إضافة"
                                                           <?php if ($_smarty_tpl->tpl_vars['found']->value==1){?>disabled="disabled"<?php }?>   />


                                                    <a class=" bg-green btn  saveEditVisit wds43" id="saveEditVisit" data-visitId="0" style="display: none;">حفظ </a>
                                                    <a class=" bg-red btn  cancelEditVisit wds43" id="cancelEditVisit" data-visitId="0" style="display: none;">إلغاء</a>


                                                    <a class=" bg-green btn  savePackVisit wds43" id="savePackVisit"
                                                       data-visitId="0" style="display: none;">حفظ </a>
                                                    <a class=" bg-red btn  cancelPackVisit wds43" id="cancelPackVisit"
                                                       data-visitId="0" style="display: none;">إلغاء</a>


                                                    <span id="minPaidOk" style="color:red; display: block;" > </span>
                                                    <span id="unitsNoOk" style="color:red;" > </span>


                                                </td>
                                            </tr>
                                        </table>
                                        <span id="packVisitError" style="color:red;float: left;" >  </span>

                                        <div class="col-md-12" id="selectedFromModel"> </div>
                                        <div  id="lastVisitDetails"> </div>
                                        <div  id="restDiv"> </div>

                                        <div  id="operationDiv"> </div>


                                        <input type="hidden"  name="editView"  id="editView"  value="0">
                                        <input type="hidden"  name="mVisitId"  id="mVisitId"  value="0">



                                        <div class="clearfix"></div>
                                        <span id="checkvisitbefore" <?php if ($_smarty_tpl->tpl_vars['found']->value!=1){?>style="display: none; " <?php }?>>عفواً,لقد تمت الزيارة من قبل لهذه الحالة </span>





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



                </div>
            </div>
            <div class="col-md-12 ">
                <div class="todayvisit" >
                    <div class="portlet box blue">
                        <div class="portlet-title">
                            <div class="caption fright">
                                عرض الزيارات
                            </div>
                            <div class="tools fleft">
                                <a href="#" class="collapse" title="تصغير / تكبير"></a>
                                <!--a class="fff bold" href="<?php echo $_smarty_tpl->tpl_vars['hosturl']->value;?>
/controllers/<?php echo $_smarty_tpl->tpl_vars['controllname']->value;?>
.php?ac=getalldepts">تفريغ  الزيارات</a-->
                            </div>
                        </div>
                        <div class="portlet-body form">

                            <div class="table-toolbar">
                                <div class="row rtl">

                                    <div class="col-md-2 wds9">
                                        <div class="form-group">
                                            <label class="control-label ls2">رقم  الحالة  </label>
                                            <input type="text"  id="statusNoRemote"
                                                   class="form-control  txtc searchPatRemote positiveNo " >
                                        </div>
                                    </div>

                                    <div class="col-md-4 wds26">
                                        <div class="form-group">
                                            <label class="control-label ls2">اسم الحالة  </label>
                                            <input type="hidden" class="form-control"    id="patientIdRemote"  >
                                        </div>
                                    </div>

                                    <div class="col-md-3 wds19">
                                        <div class="form-group">
                                            <label class="control-label ls2">اسم الطبيب   </label>
                                            <input type="hidden" class="form-control"    id="doctorIdRemote"  >
                                        </div>
                                    </div>

                                    <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->branches==1&&$_smarty_tpl->tpl_vars['showBrancheSelect']->value){?> 
                                    <div class="col-md-2 wds15">
                                        <div class="form-group">
                                            <label class="control-label ls2">الفرع    </label>
                                            <select class="form-control select2h" id="branchSearch" >
                                                <option value="">All</option>
                                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allBranches']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                    <?php }?>

                                    <div class="col-md-2 wds8">
                                        <div class="form-group">
                                            <label class="control-label ls2">التاريخ من  </label>
                                            <input type="text"  id="date_from" value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
" readonly
                                                   class=" form-control  pastSearchDate" placeholder="التاريخ من "/>
                                        </div>
                                    </div>

                                    <div class="col-md-2 wds8">
                                        <div class="form-group">
                                            <label class="control-label ls2">التاريخ الى </label>
                                            <input type="text"  id="date_to" value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
" readonly
                                                   class=" form-control  datepicker" placeholder="التاريخ إلى"/>
                                        </div>
                                    </div>



                                    <div class="col-md-2 wds9">
                                        <div class="form-group" style="margin-top: 15%;" >
                                            <label style="    color: black;font-weight:bold; " for="form_control_1"> All
                                                <span>
                                                    <input type="checkbox" id="ignoreDate" class="checkGroup" value="1">
                                                </span>
                                            </label>
                                            <a class="btn btn-primary btn-sm" id="searchvisitIndexBtn" 
                                               style="margin-right: 7%;" >
                                                <i class="fa fa-search"></i>  </a>
                                            <label class="col-md-3 control-label txtr">  </label>
                                        </div>
                                    </div>

                                    <div class="col-md-2 wds4">
                                        <div class="form-group">
                                            <a class="btn btn-success btn-sm" id="sendGroupSmsBtn" 
                                               style="margin-top: 35%; " > SMS </a>
                                            <label class="col-md-3 control-label txtr">  </label>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <div id="visitNew"></div>
                        </div>
                    </div>
                </div>
            </div>


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

<!-- END CONTENT -->
<?php if ($_SESSION['role_id']==12){?>

<style>
    .not_lab{
        display: none;
    }
</style>

<?php }?>
<?php if ($_SESSION['role_id']==5){?>

<style>
    .not_ray_lab{
        display: none;
    }
</style>

<?php }?>












<!--------------------------------------------------------------------------- internal Investigation Model-------------------------------------------------------------------------------------->
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="internalShow" 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">   </div>
                                </div>
                                <div class="portlet-body all">
                                    <div  id="divShow">

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

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




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

</div>-->
<div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"  id="edit_detectionforview">
    <div class="modal-dialog   <?php if ($_smarty_tpl->tpl_vars['programesetting']->value->system_type==3){?>wds70 <?php }else{ ?> wds50<?php }?>">
        <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>
                                <div id="detectionforview" class=""> </div>
                            </div>


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

<div class="modal fade" id="detectionadd" tabindex="-1" role="basic" aria-hidden="true">
    <meta charset="utf8"/>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button style="float: left;" type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title txtr bold"> إضافة كشف </h4>
                <span id="sucssmsg" style="display: none;">لقد تم إضافة كشف جديد</span>
            </div>
            <div class="modal-body modtbl"  style="margin: 15px;">
                <from  id="form_add_detection" action="" method="post">
                    <table class="table table-bordered table-striped table-hover">
                        <thead>
                        <th>نوع الكشف</th>
                        <th class="wds20">قيمة الكشف</th>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <div class="input-group wds100" >
                                        <input type="text" class="form-control" name="detectiontp" id="detectiontp" placeholder="ادخل نوع الكشف">
                                    </div>
                                </td>
                                <td>
                                    <div class="input-group">
                                        <input type="text" class="form-control positivefloat" name="detectionvl"  id="detectionvl" placeholder="ادخل قيمة الكشف">
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </from>

                <div class="modal-footer">
                    <button type="button" class="btn default" data-dismiss="modal">إغلاق</button>
                    <button type="button" class="btn blue" id="detectionadd_submit" >حفظ</button>

                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</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="actions">
                                            <button type="button" class="btn default"  id="addVisitRays"> Save </button>
                                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                        </div>
                                    </div>

                                    <div class="portlet-body">
                                        <input type="hidden" id="pId11" value="" name="patientId"/>
                                        <div class="row" style="padding-left: 9px;padding-top:5px;overflow-y: scroll;">
                                            <div class="wds33 fleft">
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allRayCats1']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->rays; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>

                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allRayCats3']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->rays; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" id="" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check"  value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>


                                            </div>
                                            <div class="wds33 fleft">
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allRayCats2']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->rays; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>

                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allRayCats4']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->rays; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" id="" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="iiin <?php if ($_smarty_tpl->tpl_vars['cat']->value->name=='Male(Husband)'){?>husbandCheck<?php }?> <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>


                                            </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">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['favoritesRays']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="favoriteCheck iiin" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>

                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['otherRays']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->rays; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check iiin" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>

                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allRayCats5']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->rays; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
"  data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
"  class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="rayCheck[]">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>

                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>
                                            </div>
                                        </div>

                                        <div  id="ray_div">

                                        </div>




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

                        </div>


                </div>
                </form>
            </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">
        <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="actions">
                                            <button type="button" class="btn default" id="addVisitInvs"> Save </button>
                                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                        </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">
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['group1']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->invests; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>
                                            </div>
                                            <div class="wds20 fleft">
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['group2']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->invests; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>
                                            </div>
                                            <div class="wds20 fleft">
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['group3']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->invests; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="iiin <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>


                                            </div>

                                            <div class="wds20 fleft">
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['group4']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->invests; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" id="" class="iiin <?php if ($_smarty_tpl->tpl_vars['cat']->value->name=='Male(Husband)'){?>husbandCheck<?php }?> <?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>

                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['others']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->invests; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check iiin" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>
                                            </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">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['favorites']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="favoriteCheck iiin" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </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">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['offer'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['offer']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['invoffers']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['offer']->key => $_smarty_tpl->tpl_vars['offer']->value){
$_smarty_tpl->tpl_vars['offer']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="offersCheck iiin" id="" value="<?php echo $_smarty_tpl->tpl_vars['offer']->value->id;?>
" name="offersCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['offer']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['offer']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['offer']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['offer']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>


                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['group5']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>

                                                <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> <?php echo $_smarty_tpl->tpl_vars['cat']->value->name;?>

                                                    <span>
                                                        <input type="checkbox" data-gClass="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check" class="iiin checkGroup">
                                                    </span>
                                                </label>
                                                <div class="checkbox-list">
                                                    <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['inv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['inv']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['cat']->value->invests; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['inv']->key => $_smarty_tpl->tpl_vars['inv']->value){
$_smarty_tpl->tpl_vars['inv']->_loop = true;
?>
                                                    <label>
                                                        <span>
                                                            <input type="checkbox" class="<?php echo $_smarty_tpl->tpl_vars['cat']->value->id;?>
Check iiin" id="" value="<?php echo $_smarty_tpl->tpl_vars['inv']->value->id;?>
" name="invCheck[]"  data-name="<?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
" data-price="<?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
">
                                                        </span> <?php echo $_smarty_tpl->tpl_vars['inv']->value->name;?>
 ( <?php echo $_smarty_tpl->tpl_vars['inv']->value->price;?>
 )
                                                    </label>

                                                    <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                    <?php } ?>
                                                </div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>



                                            </div>
                                        </div>


                                        <div  id="inv_div">

                                        </div>



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

                        </div>
                </div>
                </form>
            </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="notPayedERPBillsModal" 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="notPayedERPBillsForm" enctype="multipart/form-data">
                        <input type="hidden" name="clientIdForERP" id="clientIdForERP" value="">
                        <input type="hidden" name="billsItr" id="billsItr" value="">
                        <input type="hidden" name="billsItrRet" id="billsRetItr" value="">
                        <input type="hidden"  id="ErpBillBranchId"  name="ErpBillBranchId"  value="1"> 
                        <div class="row">
                            <h3 class="pull-right" style="margin-right: 40px;font-weight: bold;">فواتير مبيعات</h3>
                            <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                <thead>
                                    <tr>
                                        <th> رقم الفاتورة</th>
                                        <th> تاريخ الفاتورة</th>
                                        <th>اجمالى الفاتورة </th>
                                        <th>المتبقى </th>
                                        <th>عمر الدين </th>
                                        <th style="widt:40%"> سداد على الفاتورة</th>
                                    </tr>
                                </thead>
                                <tbody id="notPayedERPBillsTbody">

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


                        <div class="row">
                            <h3 class="pull-right" style="margin-right: 40px;font-weight: bold;">فواتير مردود</h3>
                            <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                <thead>
                                    <tr>
                                        <th> رقم الفاتورة</th>
                                        <th> تاريخ الفاتورة</th>
                                        <th>اجمالى الفاتورة </th>
                                        <th>المدفوع </th>
                                        <th>عمر الدين </th>
                                        <th style="widt:40%"> استرجاع على الفاتورة</th>
                                    </tr>
                                </thead>
                                <tbody id="notPayedERPBillsRetTbody">

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

                    </form>
                    <div class="modal-footer">
                        <button type="button" class="btn default" data-dismiss="modal">إغلاق</button>
                        <button type="button" class="btn blue" id="payERPBills" >حفظ</button>

                    </div>
                </div>

            </div>
        </div>


    </div>
</div>






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


<style>
    #time_containers .popover{
        display: none !important;
    }
</style>








<?php }} ?>