<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="{$hosturl}/controllers/{$controllname}.php?ac=show">عرض جميع  الزيارات</a>
                        </div>
                    </div>

                    <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="shareVersion"  value="{$programesetting->system_type}">
                                        <input type="hidden"    id="addVisit"  value="1">
                                        <input type="hidden" id="controllName" value="visits"/>


                                        <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                            <tr>
                                                <th style="width: 10%;"> تاريخ الزيارة </th>
                                                <th style="width: 10%;">رقم المريض</th>
                                                <th style="width: 35%;">اسم المريض</th>
                                                {if $programesetting->organizations  != 1}
                                                <th style="width: 20%;">تابع ل  </th>
                                                <th style="width: 5%;">الخصم </th>
                                                {/if}
                                                <th>ملاحظات </th>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input class="form-control patientvisitidCheckDate  datepicker edited showRDetails" 
                                                           type="text"  id="visitdate" name="visitdate" required value="{$today}" readonly>
                                                </td>
                                                <td>
                                                    <input type="text"  id="statusNoRemoteLab"   value="{$statusNo}"
                                                           class="form-control  txtc searchPatRemoteLab positiveNo " >
                                                </td>
                                                <td>
                                                    <input type="hidden" class="form-control"    id="patientvisitid" name="patientid"  >
                                                </td>
                                                {if $programesetting->organizations  != 1}
                                                <td>
                                                    <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>
                                                        {foreach $organizations as $row}
                                                        <option value="{$row->id}" >{$row->organization_name}</option>
                                                        {/foreach}
                                                        <option value="-1" class="deleteoptincompo">تعديل </option>
                                                    </select>
                                                </td>
                                                <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>
                                                {/if}
                                                <td>
                                                    <input type="text" name="notes" id="notes"    class="form-control txtc ">
                                                </td>
                                            </tr>
                                        </table>

                                        <table class="table table-bordered  table-hover rtl">
                                            <tr>

                                                <th style="width: 18%;">القسم</th>
                                                <th id="invTypeHead" style="display: none; width: 10%;">النوع</th>
                                                <th id="doctors_containers_head" style="display: none; width: 20%;">الاطباء</th>
                                                <th style="width: 15%;">نوع الكشف</th>
                                                <th style="width: 40%;" colspan="4">قيمة الكشف</th>
                                                <th style="width: 5%;">الصيدلية</th>
                                                <th id="time_containers_head" style="display: none; width: 8%;">وقت العمليه</th>


                                                <th style="width: 10%;"></th>
                                            </tr>
                                            <tr>

                                                <td>
                                                    <input type="hidden"    id="oldVisitDoctor"  value="0">
                                                    <input type="hidden"    id="oldVisitHours"  value="-1">
                                                    <input type="hidden"    id="oldDetectionId"  value="0">
                                                    <select class="form-control" style="width: 75%;margin-top: 20px;"  name="fordepartment" id="fordepartment" placeholder="اختر القسم " required >
                                                        <option value=""></option>
                                                        {foreach $py_all_departs as $row}
                                                        {if $smarty.session.role_id eq 12}
                                                        {if $row->id eq 12}
                                                        <option value=""></option>
                                                        <option value="{$row->id}">{$row->name}</option>
                                                        {/if}
                                                        {elseif $smarty.session.role_id eq 5}
                                                        {if $row->id eq 5}
                                                        <option value=""></option>
                                                        <option value="{$row->id}">{$row->name}</option>
                                                        {/if}
                                                        {else}
                                                        <option value="{$row->id}">{$row->name}</option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </td>
                                                <td id="invTypeDiv" style="display: none;">
                                                    <input type="hidden"  name="roleId"  id="roleId"  value="{$smarty.session.role_id}">
                                                    <select  class="form-control" name="invType" id="invType" placeholder="اختر نوع " required>
                                                        <option value="0"   {if $programesetting->visittype  == 0} selected  {/if}>خارجى</option>
                                                        <option value="1"  {if $programesetting->visittype  == 1} selected  {/if}>داخلى</option>
                                                    </select>
                                                </td>
                                                <td id="doctors_containers" style="display: none;">
                                                    <select  style="margin-top: 20px;" class="form-control showRDetails" 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="detectionContainer">
                                                    <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" style="margin-top: 20px;">
                                                        <option value=""></option>
                                                        <option value="-1">إضافة كشف</option>
                                                        {if $smarty.session.role_id neq 3}<option value="0" class="deleteoptincompo">حذف</option>{/if}

                                                    </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="0" 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="0" 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>


                                                <td id="time_containers" style="display: none;">
                                                    <input type="text" class="form-control timepicker timepicker-24"  name="operation_time" id="operation_time">
                                                </td>


                                                <td>
                                                    <input type="submit" name="submit" id="visitaddsubmit" class="btn blue btnsve addbtnvisit wds100"  value="إضافة"   {if $found == 1}disabled="disabled"{/if}   />
                                                    <a class=" bg-green btn  saveEditVisit " id="saveEditVisit" data-visitId="0" style="display: none;">حفظ </a>
                                                    <a class=" bg-red btn  cancelEditVisit " id="cancelEditVisit" data-visitId="0" style="display: none;">إلغاء</a>
                                                </td>
                                            </tr>
                                        </table>
                                        <div class="col-md-12" id="selectedFromModel"> </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" {if $found != 1}style="display: none; " {/if}>عفواً,لقد تمت الزيارة من قبل لهذه المريض </span>

                                        <span id="reserveDetails" style="display: none; "></span>
                                        <span id="weekDates" style="display: none; "></span>
                                        <div  id="lastVisitDetails"> </div>
                                        <div  id="restDiv"> </div>
                                        <div  id="operationDiv"> </div>


                                    </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="{$hosturl}/controllers/{$controllname}.php?ac=getalldepts">تفريغ  الزيارات</a-->
                            </div>
                        </div>
                        <div class="portlet-body form">

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

                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <div class="col-md-6">
                                                <input type="text"  id="date_to" value="{$today}" class="searchvisitIndex form-control input-medium datepicker" placeholder="التاريخ إلى"/>

                                            </div>
                                            <label class="col-md-3 control-label txtr">التاريخ الى </label>
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <div class="col-md-6">
                                                <input type="text"  id="date_from" value="{$today}" class="searchvisitIndex form-control input-medium datepicker" placeholder="التاريخ من "/>

                                            </div>
                                            <label class="col-md-3 control-label txtr">التاريخ من  </label>
                                        </div>
                                    </div>

                                </div>
                            </div>

                            <div id="visitNew">
                                <table class="table table-bordered table-striped table-hover rtl dataTable">
                                    <thead>
                                        <tr>
                                            <th class="wds3 txtc">م</th>
                                            <th class="txtc">اسم المريض</th>
                                            <th class="wds5 txtc">رقم الحالة</th>
                                            <th class="txtc"> اسم الزوج </th>
                                            <th class="txtc"> العنوان </th>
                                            <th class="txtc"> نوع الكشف </th>
                                            <th class="txtc"> التاريخ </th>
                                            <th class="txtc"> القسم </th>
                                            <th class="txtc"> الوقت  </th>
                                            <th class="txtc"> المستخدم  </th>
                                            <th class="wds3 txtc"> الايصال </th>
                                            {if $allowEditVisit  == 1}  <th class="wds3 txtc"> تعديل</th> {/if}
                                            {if $allowDeleteVisit  == 1} <th class="wds3 txtc"> حذف</th>{/if}
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {assign var=i value=1}
                                        {foreach $allvisit as $row}
                                        <tr class="{if $row->for_department eq 12}is_lab{else}not_lab{/if} {if $row->for_department eq 5}is_ray_lab{else}not_ray_lab{/if}"     {if $row->detectionid == 9999}style="background-color: #efc9cc;"  {/if} >
                                            <td> {$i}</td>
                                            <td> {$row->patientName}</td>
                                            <td> {$row->patientstatusno}</td>
                                            <td> {$row->husbandname}</td>
                                            <td> {$row->address}</td>
                                            <td>{$row->detection}</td>
                                            <td> {$row->visitdate}</td>
                                            <td>
                                                {$row->for_department_name} {if !empty($row->operation_time) }({$row->operation_time}){/if}
                                                {if $row->for_department eq 12}
                                                <a class=" bg-green dltbtn  printLR" data-visitId="{$row->id}"><i class="fa fa-print"></i></a>
                                                {/if}
                                            </td>
                                            <td> {$row->visitHour}</td>
                                            <td> {$row->user_name}</td>
                                            <td>
                                                {if $row->printserial > 0}
                                                <a class="label  label-success printVisitRecept"  data-visitId="{$row->id}" ><i class="fa fa-print"></i></a>
                                                {/if}
                                            </td>


                                            {if $allowEditVisit  == 1}

                                            {if $row->detectionid == 9999}
                                            <td><a class=" bg-green dltbtn  editRefundVisit" data-visitId="{$row->id}" id="editvisit{$row->id}">
                                                    <i class="fa fa-pencil"></i>
                                                </a>
                                            </td>
                                            {else if $row->detectionid == 999}
                                            <td><a class=" bg-green dltbtn  editPayValVisit" data-visitId="{$row->id}" id="editvisit{$row->id}">
                                                    <i class="fa fa-pencil"></i>
                                                </a>
                                            </td>
                                            {else}
                                            <td><a class=" bg-green dltbtn  editVisit" data-visitId="{$row->id}" id="editvisit{$row->id}">
                                                    <i class="fa fa-pencil"></i>
                                                </a>
                                            </td>
                                            {/if}
                                            {/if}


                                            {if $allowDeleteVisit  == 1}
                                            <td>
                                                <a class=" bg-red dltbtn deletevisitAjax"  data-today="0" id="deletevisit{$row->id}" data-id="{$row->id}" data-link="visits" data-fn="del">
                                                    <i class="fa fa-close"></i>
                                                </a>
                                            </td>
                                            {/if}
                                        </tr>
                                        {capture assign=i}{$i+1}{/capture}
                                        {/foreach}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


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

<!-- END CONTENT -->
{if $smarty.session.role_id eq 12}
{literal}
<style>
    .not_lab{
        display: none;
    }
</style>
{/literal}
{/if}
{if $smarty.session.role_id eq 5}
{literal}
<style>
    .not_ray_lab{
        display: none;
    }
</style>
{/literal}
{/if}












<!--------------------------------------------------------------------------- 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">
        <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  <span id="doctorName2"></span></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">  إضافة كشف  <span id="doctorName"></span></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">
                                                {assign var=i value=1}
                                                {foreach $allRayCats1 as $cat}

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

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

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

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

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


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

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

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

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

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

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


                                            </div>



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

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

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

                                                {foreach $otherRays  as $cat}

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

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

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

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

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

                                        <div  id="ray_div">

                                        </div>




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

                        </div>


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


<!--------------------------------------------------------------------------- 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">
                                                {assign var=i value=1}
                                                {foreach $group1 as $cat}

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

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

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

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

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

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


                                            </div>

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

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



                                            </div>
                                        </div>


                                        <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="">
                        <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 id="printRDiv"></div>
<div id="editDiv"></div>
<div id="printingDiv"></div>
<div id="residDiv"></div>

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







