<style>
    .newoption {
        background-color:#CCCCCC !important;
        font-weight:bold !important;
    }
</style>


<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">الفواتير </a></li>
            <li><a href="#">فواتير </a></li>
            <li class="active">إضافة  فاتورة </li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title">إضافة  فاتورة</h3>
            </div>
            <div class="panel-body">

                <!-- end box / title -->

                <form  method="post" id="billForm" action="?do=add" class="nameToBeChecked form-horizontal" enctype="multipart/form-data">
                    <input name="isProductRequest" id="isProductRequest"  type="hidden" value="{$isProductRequest}" />
                    <input name="searchvalue" id="searchvalue"  type="hidden" value="{$Programsettingdata->searchvalue}" />
                    <input name="addview2" id="addview2"  type="hidden" value="1" />
                    {if $isProductRequest == 1 }
                    <input name="productRequestIds" id="productRequestIds"  type="hidden" value="{$productRequestIds}" />
                    {/if}


                    <div id="printAll">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">اسم العميل </label>
                            <div class="col-lg-4" id="clientDiv">

                                <input type="hidden" id="client" name="client"  class="wdt100"  data-placeholder="اختر عميل " />
                                <input type="hidden" name="nakdyOnly" id="nakdyOnly"  value="{$Programsettingdata->nakdyOnly}"/>

                                <span id="nameError" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px; display: none ;">اختر اسم العميل أولا</span>
                            </div>
                            <label class="col-lg-2 control-label">تاريخ الاستلام  </label>
                            <div class="col-lg-4">
                                <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                    <input class="form-control" size="16" type="text" value="{$now}" name="receivedate" id="receivedate" readonly="">
                                    <span class="input-group-addon "><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-2 control-label">رقم الفاتورة </label>
                            <div class="col-lg-4">
                                <input name="billno" id="billno" type="text"  class="form-control positiveNo" value="{$billNo}" />
                                <input name="createdBillNo" id="createdBillNo" type="hidden"   value="{$billNo}" />
                                <span id="billError" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px; display: none ;"></span>
                            </div>

                            <label class="col-lg-2 control-label">التعليق</label>
                            <div class="col-lg-4">
                                <textarea class="form-control" rows="2" name="comment" id="comment"></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-2 control-label">تاريخ الفاتورة   </label>
                            <div class="col-lg-4">
                                <!--input name="billdate" id="billdate" readonly=""    class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd" type="text" /-->
                                <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                    <input class="form-control" size="16" type="text" value="{$now}" name="billdate" id="billdate" readonly="">
                                    <span class="input-group-addon "><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                                </div>

                            </div>

                            <label class="col-lg-2 control-label">نوع السعر </label>
                            <div class="col-lg-4">
                                <select name="pricetype" id="pricetype" data-placeholder="اختر"  class="select2 wdt100" >
                                    <option  value="1">تجزئة</option>
                                    <option value="2">نصف جملة</option>
                                    <option value="0">جملة</option>
                                </select>
                            </div>


                        </div>

                        <input type="hidden" name="usedkashf" id="usedkashf" value="0" />

                        <div class="form-group">
                            {if $Programsettingdata->nakdyKashf == 0 && $Programsettingdata->nakdyOnly == 1}
                            {else}
                            <label class="col-lg-2 control-label">نوع الكشف </label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input value="2" class="kashftype" id="kashftype1" name="kashftype"   type="radio" checked="checked"    />

                                        كشف  </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="0" class="kashftype" id="kashftype2" name="kashftype"   type="radio"    />

                                        داخلى  </label>
                                    <input type="text" name="kashf_serial" id="kashf_serial" style="width: 65px;background-color: #dadada; display: none"/>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="kashftype" id="kashftype3" name="kashftype"  type="radio" />
                                        خارجى </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="-1"  class="kashftype" id="kashftype4" name="kashftype"  type="radio" />
                                        بدون كشف </label>
                                </div>
                                <br>
                                <span id="kashfError" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px;display: none;">لا يوجد كشوفات سابقة لهذا العميل</span>
                                <span id="kashfError2" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px;display: none;">تم استخدام هذا الكشف من قبل .</span>
                                <span id="kashfError3" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px;display: none;">لا يوجد كشف بهذا الرقم لهذا العميل  .</span>

                                <input name="kashfExist" id="kashfExist" type="hidden" value="1" />
                            </div>
                            {/if}

                            <label class="col-lg-2 control-label">الحد الأقصى للسداد </label>
                            <div class="col-lg-4">
                                <input name="allowedDays" id="allowedDays" type="text"  style="display: inline;"  class="form-control wds94 positiveNo" />
                                <span> يوم </span>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> الدين السابق للعميل  </label>


                            <div class="col-lg-4">
                                <label class="col-lg-2 control-label " id="lbl_dept" style="background-color: #c0bdaa;margin-left: 14px;">   0  </label>
                                <button type="button" class="btn " name="pay_clientdept" id="pay_clientdept"> سداد ديون عميل </button>
                            </div>
                        </div>
                        <div class="form-group">
                            {if $userdata->userstoreid  eq 0}
                            <label class="col-lg-2 control-label">المخزن </label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100" name="storeid" id="storeid">
                                    {foreach $storeData as $store}
                                    <option value="{$store->storeId}">{$store->storeName}</option>
                                    {/foreach}
                                </select>
                            </div>

                            {else}
                            <input name="storeid" id="storeid"  type="hidden" value="{$userdata->userstoreid}" />
                            {/if}


                        </div>
                        <input type="hidden" name="percentageDiscount" id="percentageDiscount" value="{$percentageDiscount}" />
                        <input type="hidden" name="discount_pres_direct" id="discount_pres_direct" value="{$Programsettingdata->discount_pres_direct}" />

                        <div class="row">
                            <hr/>
                            <div class="col-lg-6">
                                <h4></h4>
                            </div>
                            <div class="col-lg-6">
                                <h4></h4>
                            </div>
                        </div>

                        <div id="externalKashfFixed" style="display: none;">

                            <div class="form-group" >

                                <div class="col-lg-6" style="border: 1px solid #ccc;">


                                    <table class='table-black'>
                                        <tr>

                                            <td style="padding-right: 259px;padding-top: 30px;font-size: 20px;padding-bottom: 13px;" colspan="6"> <label class="sr-only">Left Eye</label> </td>

                                        </tr>
                                        <tr>

                                            <td></td>
                                            <td style="padding-right: 36px;" > <label class="sr-only">L-va</label> </td>

                                            <td style="padding-right: 36px;" > <label class="sr-only">L-prism</label> </td>

                                            <td style="padding-right: 36px;" > <label class="sr-only">L-axis</label> </td>

                                            <td style="padding-right: 22px;" > <label class="sr-only">L-cylinder</label> </td>

                                            <td style="padding-right: 22px;" >   <label class="sr-only">L-sphere</label> </td>


                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;"> <label class="sr-only">المسافة</label> </td>


                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" id="D_Lva" disabled="" readonly="" value="{$kashf->ldva}"   class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" id="D_Lprism" disabled="" readonly="" value="{$kashf->ldprism}"    class="form-control realNo" /> </td>


                                            <td style="border: 1px solid black;"> <input   required="required" type="text" id="D_Laxis"  disabled="" readonly="" value="{$kashf->ldaxis}"    class="form-control positiveNo" /> </td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" id="D_Lcylinder"  disabled="" readonly="" value="{$kashf->ldcylinder}"  class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text"  id="D_Lsphere" disabled="" readonly="" value="{$kashf->ldsphere}"  class="form-control realNo" /> </td>

                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;"> <label class="sr-only">القراءة</label> </td>




                                            <td style="border: 1px solid black;"> <input required="required"   type="text" id="N_Lva"  disabled="" readonly="" value="{$kashf->lnva}"    class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" id="N_Lprism"  disabled="" readonly="" value="{$kashf->lnprism}"   class="form-control realNo" /> </td>


                                            <td style="border: 1px solid black;"> <input  required="required"   type="text" id="N_Laxis" disabled="" readonly="" value="{$kashf->lnaxis}"    class="form-control positiveNo" /> </td>

                                            <td style="border: 1px solid black;"> <input   required="required"  type="text" id="N_Lcylinder"  disabled="" readonly="" value="{$kashf->lncylinder}"   class="form-control realNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" id="N_Lsphere"  disabled="" readonly="" value="{$kashf->lnsphere}"  class="form-control realNo" /> </td>

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


                                <div class="col-lg-6" style="border: 1px solid #ccc;">



                                    <table class='table-black'>
                                        <tr>

                                            <td  style="padding-right: 194px;padding-top: 30px;font-size: 20px;padding-bottom: 13px;" colspan="6"> <label class="sr-only">Right Eye</label>  </td>

                                        </tr>
                                        <tr>


                                            <td style="padding-right: 36px;" > <label class="sr-only">R-va</label> </td>
                                            <td style="padding-right: 36px;" > <label class="sr-only">R-prism</label> </td>

                                            <td style="padding-right: 36px;" > <label class="sr-only">R-axis</label> </td>

                                            <td style="padding-right: 22px;" > <label class="sr-only">R-cylinder</label> </td>

                                            <td style="padding-right: 22px;" > <label class="sr-only">R-sphere</label> </td>
                                            <td></td>

                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;">  <input  required="required"   type="text" id="D_Rva"  disabled="" readonly="" value="{$kashf->rdva}"   class="form-control realNo" /> </td>


                                            <td style="border: 1px solid black;"> <input required="required"  type="text" id="D_Rprism"  disabled="" readonly="" value="{$kashf->rdprism}"  class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" id="D_Raxis"  disabled="" readonly="" value="{$kashf->rdaxis}"   class="form-control positiveNo" /> </td>


                                            <td style="border: 1px solid black;">  <input required="required"  type="text" id="D_Rcylinder" disabled="" readonly="" value="{$kashf->rdcylinder}"    class="form-control realNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" id="D_Rsphere"  disabled="" readonly="" value="{$kashf->rdsphere}"  class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <label style="    margin-left: 21px;" class="sr-only">Distance</label> </td>
                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;">   <input   required="required" type="text" id="N_Rva" disabled="" readonly="" value="{$kashf->rnva}"   class="form-control realNo" /> </td>


                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" id="N_Rprism"  disabled="" readonly="" value="{$kashf->rnprism}"   class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <input required="required"  type="text" id="N_Raxis"  disabled="" readonly="" value="{$kashf->rnaxis}"   class="form-control positiveNo" /> </td>


                                            <td style="border: 1px solid black;">  <input required="required"  type="text" id="N_Rcylinder"  disabled="" readonly="" value="{$kashf->rncylinder}"  class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;">  <input   required="required"  type="text" id="N_Rsphere"   disabled="" readonly="" value="{$kashf->rnsphere}"   class="form-control realNo" /> </td>

                                            <td style="border: 1px solid black;"> <label style="    margin-right: 24px;" class="sr-only">Near</label> </td>

                                        </tr>
                                    </table>



                                </div>


                                <div class="col-lg-5" style="padding-left: 0px;">
                                    <table style="border: 1px solid black;margin-right:52px;width: 85%;">
                                        <tr>
                                            <td style="padding-right: 70px;padding-top: 10px;border: 1px solid black;" ><label class="sr-only">Add</label> </td>
                                            <td style="padding-right: 70px;padding-top: 10px;border: 1px solid black;" > <label class="sr-only">Biofocal</label> </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 1px solid black;"> <input required="required"   type="text" name="ladd"  id="ladd" disabled value="{$kashf->ladd}"   class="form-control realNo" /></td>
                                            <td style="border: 1px solid black;"> <input  required="required" type="text" name="lbiofocal" id="lbiofocal" disabled  value="{$kashf->lbiofocal}"   class="form-control realNo" /></td>
                                        </tr>
                                    </table>
                                </div>

                                <div class="col-lg-3">
                                    <table style="border: 1px solid black; margin-top: 5px;width: 100%;">
                                        <tr>
                                            <td style="border: 1px solid black;">  <input  required="required"  type="text" name="pd" id="pd" disabled value="{$kashf->pd}"   class="form-control positiveNo" /></td>
                                            <td style="border: 1px solid black;text-align: left;"> <label style="margin: 5px;" class="sr-only">PD</label> </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 1px solid black;">  <input required="required"  type="text" name="bvd" id="bvd" disabled value="{$kashf->bvd}"   class="form-control positiveNo" /></td>
                                            <td style="border: 1px solid black; text-align: left;"> <label style="margin: 5px;" class="sr-only">BVD</label> </td>
                                        </tr>
                                    </table>
                                </div>

                                <div class="col-lg-4">
                                    <table style="border: 1px solid black;margin-left: 76px;margin-right: -5px;">
                                        <tr>
                                            <td style="padding-right: 45px;padding-top: 10px;border: 1px solid black;" ><label class="sr-only">Add</label> </td>
                                            <td style="padding-right: 45px;padding-top: 10px;border: 1px solid black;" > <label class="sr-only">Biofocal</label> </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 1px solid black;"> <input required="required"   type="text" name="radd" id="radd" disabled value="{$kashf->radd}"   class="form-control realNo" /></td>
                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" name="rbiofocal" id="rbiofocal" disabled value="{$kashf->rbiofocal}"    class="form-control realNo" /></td>
                                        </tr>
                                    </table>
                                </div>

                                <div class="col-lg-12">
                                    <table style="margin-top: 5px;width: 100%;border: 1px solid black;">
                                        <tr>
                                            <td style="border: 1px solid black;"> <label style="margin: 5px;" class="sr-only">ملاحظات</label> </td>
                                            <td style="border: 1px solid black;">  <input   type="text" disabled name="notes" id="notes" value="{$kashf->notes}"    class="form-control" /></td>
                                        </tr>

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

                        <div id="externalKashf" style="display: none;">
                            <div class="form-group">
                                <label class="col-lg-2 control-label">مكان الكشف  </label>
                                <div class="col-lg-4">
                                    <input name="kashfplace" id="kashfplace" type="text"  class="form-control" value="" />
                                </div>

                                <label class="col-lg-2 control-label">تاريخ الكشف  </label>
                                <div class="col-lg-4">
                                    <input name="kashfdate" id="kashfdate" readonly="" value="{$today}"    class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd" type="text" />
                                </div>
                            </div>

                            <div class="form-group" >

                                <div class="col-lg-6" style="border: 1px solid #ccc;">


                                    <table class='table-black'>
                                        <tr>

                                            <td style="padding-right: 259px;padding-top: 30px;font-size: 20px;padding-bottom: 13px;" colspan="6"> <label class="sr-only">Left Eye</label> </td>

                                        </tr>
                                        <tr>

                                            <td></td>
                                            <td style="padding-right: 36px;" > <label class="sr-only">L-va</label> </td>

                                            <td style="padding-right: 36px;" > <label class="sr-only">L-prism</label> </td>

                                            <td style="padding-right: 36px;" > <label class="sr-only">L-axis</label> </td>

                                            <td style="padding-right: 22px;" > <label class="sr-only">L-cylinder</label> </td>

                                            <td style="padding-right: 22px;" >   <label class="sr-only">L-sphere</label> </td>


                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;"> <label class="sr-only">المسافة</label> </td>
                                            <td style="border: 1px solid black;"> <input   required="required" type="text" name="D_Lva"   class="form-control checknumintfolat realNo" /></td>
                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" name="D_Lprism"    required="required"  class="form-control  checknumintfolat realNo" /></td>
                                            <td style="border: 1px solid black;"> <input   required="required"   type="text"  required="required"  name="D_Laxis"     class="form-control  positiveNo" /></td>
                                            <td style="border: 1px solid black;"> <input  required="required"  type="text"  required="required"  name="D_Lcylinder"   class="form-control  checknumintfolat realNo" /></td>
                                            <td style="border: 1px solid black;"> <input  required="required" type="text"   required="required"  name="D_Lsphere"   class="form-control  checknumintfolat realNo" /></td>

                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;"> <label class="sr-only">القراءة</label> </td>
                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" name="N_Lva"     class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input required="required"  type="text" name="N_Lprism"    class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" name="N_Laxis"    class="form-control positiveNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" name="N_Lcylinder"    class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input required="required"  type="text" name="N_Lsphere"   class="form-control checknumintfolat realNo" /></td>

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

                                <div class="col-lg-6" style="border: 1px solid #ccc;">



                                    <table class='table-black'>
                                        <tr>

                                            <td  style="padding-right: 194px;padding-top: 30px;font-size: 20px;padding-bottom: 13px;" colspan="6"> <label class="sr-only">Right Eye</label>  </td>

                                        </tr>
                                        <tr>


                                            <td style="padding-right: 36px;" > <label class="sr-only">R-va</label> </td>
                                            <td style="padding-right: 36px;" > <label class="sr-only">R-prism</label> </td>

                                            <td style="padding-right: 36px;" > <label class="sr-only">R-axis</label> </td>

                                            <td style="padding-right: 22px;" > <label class="sr-only">R-cylinder</label> </td>

                                            <td style="padding-right: 22px;" > <label class="sr-only">R-sphere</label> </td>
                                            <td></td>

                                        </tr>
                                        <tr>


                                            <td style="border: 1px solid black;">  <input required="required"  type="text" name="D_Rva"    class="form-control  checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" name="D_Rprism"   class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" name="D_Raxis"    class="form-control positiveNo" /></td>


                                            <td style="border: 1px solid black;">  <input  required="required" type="text" name="D_Rcylinder"    class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input  required="required" type="text" name="D_Rsphere"   class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <label style="    margin-left: 21px;" class="sr-only">Distance</label> </td>
                                        </tr>
                                        <tr>

                                            <td style="border: 1px solid black;">   <input   required="required" type="text" name="N_Rva"   class="form-control  checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input required="required"  type="text" name="N_Rprism"   class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <input required="required"  type="text" name="N_Raxis"    class="form-control positiveNo" /></td>

                                            <td style="border: 1px solid black;">  <input required="required"  type="text" name="N_Rcylinder"   class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;">  <input  required="required" type="text" name="N_Rsphere"     class="form-control checknumintfolat realNo" /></td>

                                            <td style="border: 1px solid black;"> <label style="    margin-right: 24px;" class="sr-only">Near</label> </td>

                                        </tr>
                                    </table>



                                </div>


                                <div class="col-lg-5" style="padding-left: 0px;">
                                    <table style="border: 1px solid black;margin-right:52px;width: 85%;">
                                        <tr>
                                            <td style="padding-right: 70px;padding-top: 10px;border: 1px solid black;" ><label class="sr-only">Add</label> </td>
                                            <td style="padding-right: 70px;padding-top: 10px;border: 1px solid black;" > <label class="sr-only">Biofocal</label> </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 1px solid black;"> <input required="required"  type="text" name="ladd"   class="form-control  checknumintfolat realNo " /></td>
                                            <td style="border: 1px solid black;"> <input  required="required"  type="text" name="lbiofocal"    class="form-control  checknumintfolat realNo" /></td>
                                        </tr>
                                    </table>
                                </div>

                                <div class="col-lg-3">
                                    <table style="border: 1px solid black; margin-top: 5px;width: 100%;">
                                        <tr>
                                            <td style="border: 1px solid black;">  <input   required="required" type="text" name="pd"    class="form-control positiveNo " /></td>
                                            <td style="border: 1px solid black;text-align: left;"> <label style="margin: 5px;" class="sr-only  checknumintfolat">PD</label> </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 1px solid black;">  <input   required="required" type="text" name="bvd"   class="form-control positiveNo" /></td>
                                            <td style="border: 1px solid black; text-align: left;"> <label style="margin: 5px;" class="sr-only  checknumintfolat">BVD</label> </td>
                                        </tr>
                                    </table>
                                </div>

                                <div class="col-lg-4">
                                    <table style="border: 1px solid black;margin-left: 76px;margin-right: -5px;">
                                        <tr>
                                            <td style="padding-right: 45px;padding-top: 10px;border: 1px solid black;" ><label class="sr-only  checknumintfolat">Add</label> </td>
                                            <td style="padding-right: 45px;padding-top: 10px;border: 1px solid black;" > <label class="sr-only  checknumintfolat">Biofocal</label> </td>
                                        </tr>
                                        <tr>
                                            <td style="border: 1px solid black;"> <input required="required"  type="text" name="radd"   class="form-control checknumintfolat realNo" /></td>
                                            <td style="border: 1px solid black;"> <input  required="required" type="text" name="rbiofocal"    class="form-control checknumintfolat realNo" /></td>
                                        </tr>
                                    </table>
                                </div>

                                <div class="col-lg-12">
                                    <table style="margin-top: 5px;width: 100%;border: 1px solid black;">
                                        <tr>
                                            <td style="border: 1px solid black;"> <label style="margin: 5px;" class="sr-only">ملاحظات</label> </td>
                                            <td style="border: 1px solid black;">  <input   required="required" type="text" name="notes"    class="form-control" /></td>
                                        </tr>

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

                        <input type="hidden" name="payType" id="payType" value="{$payType}"/>

                        <div class="row">
                            <div class="row">
                                <hr/>
                                <div class="col-lg-6">
                                    <h4></h4>
                                </div>
                                <div class="col-lg-6">
                                    <button type="button" name="addNewPro" id="addNewPro" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button>
                                </div>
                            </div>

                            {if $isProductRequest == 1 }
                            <input name="hidden_itr" id="hidden_itr" type="hidden" value="{$billProductsCount}" />
                            {else}
                            <input name="hidden_itr" id="hidden_itr" type="hidden" value="1" />
                            {/if}



                            <!-- end of title row-->
                            <div class="table-responsive bd-gr">
                                <table class="table billtable table-bordered table-black" >
                                    <thead>
                                        <tr>
                                            {if $payType == 'ins'}
                                            <th style="width: 10%" class='ins'>كود التامين</th>
                                            {else}

                                            {/if}
                                            <th class="wdt240">الخدمة </th>
                                            <th style="width: 50%">اسم المنتج</th>
                                            <th class="wdt240">ملاحظات</th>
                                            <th class="wdt100n">العدد</th>
                                            <th class="wdt80">السعر</th>
                                            <th class="wdt80">الخصم</th>
                                            <th class="wdt100n">الاجمالى</th>
                                            <th>حذف</th>
                                        </tr>
                                    </thead>
                                    <tbody id="productsTable">
                                        {if $isProductRequest == 1 }
                                        {assign var=i value=1}
                                        {foreach $billProducts as $product}
                                        <tr>
                                            {if $payType == 'ins'}
                                            <td class='ins'>
                                                <select name="productcode{$i}" id="productcode{$i}" data-placeholder="اختر" data-itr="{$i}"  class="select2 wdt100 " >
                                                    <option value="-1"> اختر </option>
                                                    <option value="OPT001">OPT001</option>
                                                    <option value="OPT002">OPT002</option>
                                                    <option value="OPT003">OPT003</option>
                                                    <option value="OPT004">OPT004</option>
                                                    <option value="OPT005">OPT005</option>
                                                    <option value="OPT006">OPT006</option>
                                                    <option value="OPT007">OPT007</option>
                                                    <option value="OPT008">OPT008</option>
                                                    <option value="OPT008">OPT009</option>
                                                    <option value="OPT0010">OPT0010</option>
                                                    <option value="OPT0011">OPT0011</option>
                                                    <option value="OPT0012">OPT0012</option>
                                                    <option value="OPT0013">OPT0013</option>
                                                    <option value="FRM001">FRM001</option>
                                                    <option value="FRM002">FRM002</option>
                                                    <option value="FRM003">FRM003</option>
                                                    <option value="FRM004">FRM004</option>
                                                    <option value="FRM005">FRM005</option>
                                                    <option value="FRM006">FRM006</option>
                                                    <option value="FRM007">FRM007</option>
                                                    <option value="FRM008">FRM008</option>
                                                    <option value="FRM009">FRM009</option>
                                                    <option value="FRM0010">FRM0010</option>
                                                    <option value="FRM0011">FRM0011</option>
                                                    <option value="FRM0012">FRM0012</option>
                                                    <option value="FRM0013">FRM0013</option>
                                                    <option value="FRM0014">FRM0014</option>


                                                </select>

                                            </td>
                                            {/if}
                                            <td>
                                                <select name="service{$i}" id="service{$i}" data-placeholder="اختر" data-itr="{$i}"  class="select2 wdt100 opticService" >
                                                    <option value="-1"> اختر </option>
                                                    <!--option value="single vision"> single vision</option>
                                                    <option value="Hi - index">Hi - index </option>
                                                    <option value="Bi / Multi focal / Progressive">Bi / Multi focal / Progressive </option>
                                                    <option value="Contact Lenses"> Contact Lenses</option>
                                                    <option value="Frame"> Frame</option-->
                                                    <option value="Single vision">Single vision</option>
                                                    <option value="polycarbonate">polycarbonate</option>
                                                    <option value="Hi index">Hi index</option>
                                                    <option value="Contact lenses Plano">Contact lenses Plano</option>
                                                    <option value="Contact lenses power">Contact lenses power</option>
                                                    <option value="Sunglasses">Sunglasses</option>
                                                    <option value="Medical frame">Medical frame</option>
                                                    <option value="Reading">Reading</option>
                                                    <option value="Accessories">Accessories</option>
                                                    <option value="Bifocal">Bifocal</option>
                                                    <option value="Multifocal/Progressive">Multifocal/Progressive</option>
                                                </select>

                                            </td>
                                            <td>
                                                <div id="productdiv{$i}">
                                                    <input type="hidden" id="product{$i}" name="product{$i}"  class="productchange wdt100" data-newR="1"  data-itr="{$i}"  data-placeholder="اختر منتج"  tabindex="7" />
                                                    <input name="productId{$i}" id="productId{$i}" type="hidden" value="{$product->productid}" />
                                                    <input name="billProductText{$i}" id="billProductText{$i}" type="hidden" value="{$product->productName}" />
                                                </div>
                                            </td>


                                            <td>
                                                <textarea class="form-control txt-nonraduis" rows="1" name="note{$i}" id="note{$i}"  tabindex="7"></textarea>
                                            </td>

                                            <td>
                                                <input name="pronum{$i}" id="pronum{$i}" value="{$product->productnoaccept}"  data-itr="{$i}"  class="form-control txt-nonraduis proNumChange changePrice positivefloat" placeholder="العدد" type="text" tabindex="7" />
                                                <input name="pronumOld{$i}" id="pronumOld{$i}" type="hidden" value="0" />
                                            </td>
                                            <td>
                                                <input name="proprice{$i}" id="proprice{$i}" placeholder="السعر"  data-itr="{$i}" value="0" class="form-control txt-nonraduis positivefloat changePrice" type="text"   tabindex="7"/>
                                            </td>
                                            <td>
                                                <input name="discount{$i}" id="discount{$i}" placeholder="الخصم" value="0" data-itr="{$i}" class="form-control positivefloat  txt-nonraduis change_discount" type="text"   tabindex="7"/>
                                            </td>
                                            <td class="aw_totalprice">
                                                <div  class="aw_mt form-control-static"><span id="prototal{$i}"> 0</span> <span> {$currency}</span></div>
                                                <input name="totalProductPrice{$i}" id="totalProductPrice{$i}" type="hidden" value="0" />
                                            </td>
                                            <td>
                                                <button type="button" id="remove{$i}" class="removeproduct close flt-none" aria-hidden="true">&times;</button>
                                            </td>
                                        </tr>
                                        {capture assign=i}{$i+1}{/capture}
                                        {/foreach}
                                        {else}

                                        <tr>
                                            {if $payType == 'ins'}
                                            <td>
                                                <select name="productcode1" id="productcode1" data-placeholder="اختر" data-itr="1"  class="select2 wdt100 " >
                                                    <option value="-1"> اختر </option>
                                                    <option value="OPT001">OPT001</option>
                                                    <option value="OPT002">OPT002</option>
                                                    <option value="OPT003">OPT003</option>
                                                    <option value="OPT004">OPT004</option>
                                                    <option value="OPT005">OPT005</option>
                                                    <option value="OPT006">OPT006</option>
                                                    <option value="OPT007">OPT007</option>
                                                    <option value="OPT008">OPT008</option>
                                                    <option value="OPT008">OPT009</option>
                                                    <option value="OPT0010">OPT0010</option>
                                                    <option value="OPT0011">OPT0011</option>
                                                    <option value="OPT0012">OPT0012</option>
                                                    <option value="OPT0013">OPT0013</option>
                                                    <option value="FRM001">FRM001</option>
                                                    <option value="FRM002">FRM002</option>
                                                    <option value="FRM003">FRM003</option>
                                                    <option value="FRM004">FRM004</option>
                                                    <option value="FRM005">FRM005</option>
                                                    <option value="FRM006">FRM006</option>
                                                    <option value="FRM007">FRM007</option>
                                                    <option value="FRM008">FRM008</option>
                                                    <option value="FRM009">FRM009</option>
                                                    <option value="FRM0010">FRM0010</option>
                                                    <option value="FRM0011">FRM0011</option>
                                                    <option value="FRM0012">FRM0012</option>
                                                    <option value="FRM0013">FRM0013</option>
                                                    <option value="FRM0014">FRM0014</option>


                                                </select>

                                            </td>
                                            {/if}
                                            <td>
                                                <select name="service1" id="service1" data-placeholder="اختر" data-itr="1"  class="select2 wdt100 opticService" >
                                                    <option value="-1"> اختر </option>
                                                    <!--option value="single vision"> single vision</option>
                                                    <option value="Hi - index">Hi - index </option>
                                                    <option value="Bi / Multi focal / Progressive">Bi / Multi focal / Progressive </option>
                                                    <option value="Contact Lenses"> Contact Lenses</option>
                                                    <option value="Frame"> Frame</option-->
                                                    <option value="Single vision">Single vision</option>
                                                    <option value="polycarbonate">polycarbonate</option>
                                                    <option value="Hi index">Hi index</option>
                                                    <option value="Contact lenses Plano">Contact lenses Plano</option>
                                                    <option value="Contact lenses power">Contact lenses power</option>
                                                    <option value="Sunglasses">Sunglasses</option>
                                                    <option value="Medical frame">Medical frame</option>
                                                    <option value="Reading">Reading</option>
                                                    <option value="Accessories">Accessories</option>
                                                    <option value="Bifocal">Bifocal</option>
                                                    <option value="Multifocal/Progressive">Multifocal/Progressive</option>
                                                </select>

                                            </td>

                                            <td>
                                                <div style="display: inline">
                                                    <select class="select2 productCat productCat1" style="width:30%;display: inline" data-level="0" data-itr ="1" name="productCatId0_1" id="productCatId0_1" >
                                                        <option value="-1">اختر تصنيف</option>
                                                        {foreach $catDataReport as $data}
                                                        <option value="{$data->productCatId}">{$data->productCatName}</option>
                                                        {/foreach}
                                                    </select>
                                                </div>
                                                <input type="hidden" id="level_1" data-itr ="1" name="level_1" value="0">
                                                <div id="manyParents_1"  data-itr ="1" style="display: inline">

                                                </div>
                                                <!--div id="productdiv1">
                                                    <input type="hidden" id="product1" name="product1"  class="productchange wdt100" data-newR="0"  data-itr="1"  data-placeholder="اختر منتج"  tabindex="7" />
                                                </div-->
                                            </td>


                                            <td>
                                                <textarea class="form-control txt-nonraduis" rows="1" name="note1" id="note1"  tabindex="7"></textarea>
                                            </td>

                                            <td>
                                                <input name="pronum1" id="pronum1" value="1"  data-itr="1"  class="form-control txt-nonraduis proNumChange changePrice positivefloat" placeholder="العدد" type="text" tabindex="7" />
                                                <input name="pronumOld1" id="pronumOld1" type="hidden" value="0" />
                                            </td>
                                            <td>
                                                <input name="proprice1" id="proprice1" placeholder="السعر"  data-itr="1" value="0" class="form-control txt-nonraduis positivefloat changePrice" type="text"   tabindex="7"/>
                                            </td>
                                            <td>
                                                <input name="discount1" id="discount1" placeholder="الخصم" value="0" data-itr="1" class="form-control positivefloat  txt-nonraduis change_discount" type="text"   tabindex="7"/>
                                            </td>
                                            <td class="aw_totalprice">
                                                <div  class="aw_mt form-control-static"><span id="prototal1"> 0</span> <span> {$currency}</span></div>
                                                <input name="totalProductPrice1" id="totalProductPrice1" type="hidden" value="0" />
                                            </td>
                                            <td>
                                                <button type="button" id="remove1" class="removeproduct close flt-none" aria-hidden="true">&times;</button>
                                            </td>
                                        </tr>
                                        {/if}
                                    </tbody>
                                </table>
                            </div>
                            <button type="button" class="btn btn-primary pull-left ft-nor"> إجمالي المشتريات <span class="badge wht-clo">
                                    <div id="buyBillTotal">0</div>
                                </span></button>

                            <input name="totalBillPrice" id="totalBillPrice" type="hidden" value="0" />

                        </div>

                        <div class="row">
                            <div class="col-lg-12" {if $Programsettingdata->general_discount eq 0} style = "display:none"  {/if}>
                                <div class="form-group">

                                    <label class="col-lg-2 control-label">قيمة الكشف </label>
                                    <div class="col-lg-2">
                                        <p class="form-control-static mg-tp10" id="kashfValueP">0</p>
                                        <input class="form-control" name="kashfValue" id="kashfValue"   type="hidden" value="0"  />
                                    </div>
                                    <label class="col-lg-2 control-label"> الخصم</label>
                                    <div class="col-lg-2">
                                        <p class="form-control-static mg-tp10" id="kashDiscValueP">0</p>
                                        <input name="kashDiscValue" id="kashDiscValue"  class="form-control" type="hidden" value="0" />
                                    </div>
                                </div>

                                <div class="form-group ">
                                    <label class="col-lg-2 control-label bg-total">الاجمالى  </label>
                                    <div class="col-lg-6 bg-yel bg-total">
                                        <p class="form-control-static mg-tp10" id="netBillValueP">0</p>
                                        <input class="form-control" name="netBillValue" id="netBillValue"   type="hidden" value="0"  />
                                    </div>
                                </div>

                            </div>

                            <div class="col-lg-12" {if $payType == "ins" || $payType == "cash"}style="display: none"{/if}>
                                 <div class="form-group">
                                    <label class="col-lg-2 control-label">نوع الخصم </label>
                                    <div class="col-lg-2">
                                        <select id="discType" name="discType"  class="select2 wdt100 changeDiscount">
                                            <option  value="1">مباشر</option>
                                            <option  value="2">نسبة</option>
                                        </select>
                                    </div>

                                    <label class="col-lg-2 control-label">قيمة الخصم</label>
                                    <div class="col-lg-2">
                                        <input name="discValue" id="discValue"  class="form-control changeDiscount" type="text" value="0" />
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <label class="col-lg-2 control-label bg-yel bg-total">الصافى </label>
                                    <div class="col-lg-6 bg-yel bg-total">
                                        <p class="form-control-static mg-tp10" id="netValueP">0</p>
                                        <input class="form-control" name="netValue" id="netValue"   type="hidden" value="0"  />
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-12">

                                <div class="form-group" {if $payType == "cash"  }style="display: none"{/if}>
                                     <label class="col-lg-2 control-label"> طريقة الدفع   </label>
                                    <div class="col-lg-1">
                                        <h6 class="inline-st"><label>
                                                <input type="checkbox" name="paymentamethods[]" data-id1="insuranceCompanies" data-id2="insuranceValue"  id="insuranceChecked"  class="choosenItem productItem changePayment" value="insurance"/>
                                                تأمين
                                            </label></h6>
                                    </div>
                                    <div class="col-lg-7 wds43">
                                        <select name="insuranceCompanies" disabled="disabled" id="insuranceCompanies" data-placeholder="اختر" data-itr="1"  class="select2" >
                                            <option value="-1"> اختر </option>
                                            {foreach $insuranceCompanies as $company}
                                            <option value="{$company->id}">{$company->name} </option>
                                            {/foreach}
                                        </select>

                                        <span id="insuranceError" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px;display: none;">اختر شركة التأمين</span>

                                    </div>
                                    <div class="col-lg-1"><span id="insuranceInst" class="questionicon" style="display: none;" ></span>
                                    </div>

                                </div>

                                <div class="form-group" {if $payType == "cash"  }style="display: none"{/if}>
                                     <label class="col-lg-3 control-label">  </label>
                                    <label class="col-lg-1 control-label wds13">نسبة  العميل (%)   </label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat calClientCarry" name="clientPercent" id="clientPercent" disabled="disabled"    type="text"  value="0"/>
                                    </div>
                                    <label class="col-lg-1 control-label wds13">بحد  أقصى   </label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat  calClientCarry" name="clientMax" id="clientMax" disabled="disabled"    type="text" value="0" />
                                    </div>
                                    <label class="col-lg-1 control-label wds13">يتحمل  العميل   </label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat calcInsValue" name="clientCarry" id="clientCarry" disabled="disabled"   type="text" value="0" />
                                    </div>
                                </div>

                                <div class="form-group" {if $payType == "cash" }style="display: none"{/if}>
                                     <label class="col-lg-3 control-label">  </label>
                                    <label class="col-lg-1 control-label wds13">موافقة شركة التأمين   </label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat calcInsValue" name="insAccept" id="insAccept" disabled="disabled"    type="text" value="0" />
                                    </div>
                                    <label class="col-lg-1 control-label wds13">تتحمل  شركة التأمين</label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat calcBillRest" name="insuranceValue" id="insuranceValue" disabled="disabled"   type="text" value="0"/>
                                    </div>

                                    <label class="col-lg-1 control-label wds13">رقم الموافقة </label>
                                    <div class="col-lg-1">
                                        <input class="form-control" name="approvalNo" id="approvalNo" disabled="disabled"   type="text" value=""/>
                                    </div>
                                </div>
                                <div class="form-group" {if $payType == "cash"  }style="display: none"{/if}>
                                     <label class="col-lg-3 control-label">  </label>
                                    <label class="col-lg-1 control-label wds13">ارفاق صورة</label>
                                    <div class="col-lg-4">
                                        <input type="file" id="attatch" name="attatch" disabled="disabled"/>
                                        <span id="attatchError" class=" alert-block alert-danger fade in" style="padding: 2px 5px 5px 5px;display: none;">اختر الصورة</span>
                                    </div>
                                </div>


                                <!--<div class="form-group" {if $payType == "ins"}style="display: none"{/if}>-->
                                <div class="form-group" >

                                    <label class="col-lg-2 control-label"></label>
                                    <div class="col-lg-1">
                                        <h6 class="inline-st"><label>
                                                <input type="checkbox" name="paymentamethods[]" data-id1="paymentNetworks" data-id2="cardValue" id="cardChecked"  class="choosenItem productItem changePayment" value="card"/>
                                                شبكة
                                            </label></h6>
                                    </div>
                                    <div class="col-lg-4 wds43">
                                        <select name="paymentNetworks" disabled="disabled" id="paymentNetworks" data-placeholder="اختر" data-itr="1"  class="select2 wdt100" >
                                            <option value="-1"> اختر </option>
                                            {foreach $paymentNetworks as $network}
                                            <option value="{$network->id}">{$network->name} </option>
                                            {/foreach}
                                        </select>

                                        <span id="cardError" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px;display: none;">اختر الشبكة</span>
                                    </div>


                                    <label class="col-lg-1 control-label" style="width: 12.7%;">القيمة      </label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat calcBillRest"  name="cardValue" id="cardValue" disabled="disabled"  type="text" value="0"  />
                                    </div>

                                </div>


                                <!--<div class="form-group" {if $payType == "ins"}style="display: none"{/if}>-->
                                <div class="form-group" >
                                    <label class="col-lg-2 control-label"></label>
                                    <div class="col-lg-1 wds51">
                                        <h6 class="inline-st"><label>
                                                <input type="checkbox" name="paymentamethods[]" id="cashChecked" data-id2="cashValue"  class="choosenItem productItem changePayment" value="cash"/>
                                                كاش
                                            </label></h6>
                                    </div>
                                    <label class="col-lg-1 control-label wds13">القيمة      </label>
                                    <div class="col-lg-1">
                                        <input class="form-control positivefloat calcBillRest" name="cashValue" id="cashValue" disabled="disabled"  type="text" value="0"  />
                                    </div>


                                </div>

                                <div class="form-group ">
                                    <label class="col-lg-2 control-label bg-total color-white">الأجل</label>
                                    <div class="col-lg-6 bg-yel bg-total">
                                        <p class="form-control-static mg-tp10" id="waitValueP">0</p>
                                        <input class="form-control" name="waitValue" id="waitValue"   type="hidden" value="0"  />
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <label class="col-lg-2 control-label bg-total color-white">اجمالى دين العميل</label>
                                    <div class="col-lg-6 bg-yel bg-total">
                                        <p class="form-control-static mg-tp10" id="total_dept">0</p>
                                    </div>
                                </div>


                            </div>


                        </div>

                    </div>


                    <div class="alert alert-danger"> <span class="color-white"> البضاعة المباعة لا ترد - العدسات لا ترد ولا تستبدل - المحل غير مسئول عن بقاء البضاعة لأكثر من ثلاث أشهر </span> </div>
                    <div class="form-group">
                        <div class="col-lg-12">
                            <input name="new" id="new" type="hidden" value="0" />
                            <input name="directSave" id="directSave" type="hidden" value="0" />
                            <button type="button"  data-new="1" data-direct="0" id="saveBillNew" class="btn btn-success pull-left saveBill" >تسجيل وجديد </button>
                            <button type="button"  data-new="0" data-direct="0" id="saveBillOnly" class="btn btn-primary pull-left saveBill">تسجيل  </button>
                            {if $directSave == 1}
                            <button type="button"  data-new="0" data-direct="1" id="saveBillNewDirect" class="btn btn-primary pull-left saveBill" >حفظ مباشر</button>
                            {/if}
                        </div>

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

<!-- Modal -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel2" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">تعليمات شركة التأمين </h4>
            </div>
            <div class="modal-body">
                <form id="clientInfo" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-4 control-label">اسم الشركة </label>
                        <div class="col-lg-4">
                            <p id="companyName"></p>
                        </div>
                    </div>




                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-4 control-label">التعليمات</label>
                        <div class="col-lg-4">
                            <p id="instructionP"></p>
                        </div>
                    </div>


                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">اغلاق </button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<div class="modal fade in" id="myclientModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content bg-modal">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel2" onclick="closeClientForm()" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">اضافة عميل</h4>
            </div>
            <div class="modal-body">
                <form id="clientInfomain" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="اسم العميل" id="newclientName" name="newclientName" type="text" required="required" autocomplete="off">


                            <div id="nameError"></div>
                        </div>
                    </div>




                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-2 control-label">{$Programsettingdata->clientcodname} </label>
                        <div class="col-lg-4">
                            <input class="form-control" {if $Programsettingdata->clientfieldrequired eq 1} required="required"  {/if} placeholder="{$Programsettingdata->clientcodname}" id="clientcode" name="clientcode" type="text">
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="txtAddress" class="col-lg-2 control-label">الشركة </label>
                        <div class="col-lg-4">

                            <select name="clientareaid" id="clientareaid" data-placeholder="اختر المنطقة" class="select2 wdt100 select2-offscreen" tabindex="-1">
                                <option value="0">اختر </option>
                                {foreach $clientarea as $area}

                                <option value="{$area->id}">{$area->name}</option>

                                {/foreach}
                            </select>
                            <div id="areaError"></div>

                        </div>

                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="newclientdebt" class="col-lg-2 control-label">المديونية</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="المديونية" id="newclientdebt" name="newclientdebt" type="text" required="required" value="0">
                            <div id="nameError2">

                            </div>
                        </div>

                    </div>

                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="العنوان" id="clientaddress" {if $Programsettingdata->clientfieldrequired eq 1} required="required"  {/if} name="clientaddress" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientphone" class="col-lg-2 control-label">رقم التليفون</label>
                        <div class="col-lg-4">
                            <input value="" class="form-control numberinput" placeholder="رقم التليفون" {if $Programsettingdata->clientfieldrequired eq 1} required="required"  {/if} id="clientphone" name="clientphone" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientmobile" class="col-lg-2 control-label">رقم الموبايل</label>
                        <div class="col-lg-4">
                            <input class="form-control " placeholder="رقم الموبايل"  {if $Programsettingdata->clientfieldrequired eq 1} required="required"  {/if} id="clientmobile" name="clientmobile" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientdetails" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">
                            <textarea class="form-control" rows="3" name="clientdetails" {if $Programsettingdata->clientfieldrequired eq 1} required="required"  {/if}  id="clientdetails"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2" onclick="closeClientForm()" data-dismiss="modal">لا</button>
                <button type="button" class="btn btn-primary savemodel1" >نعم</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>


{literal}
<script>

    //######################################### load kashf details on client change  #########################################
    /* $("#client").live('change', function (e) {

     //alert(111);
     val=$(this).val();
     if (val == '-2') {
     $('#myclientModal1').modal('show');

     }
     else{
     var customerId = $(this).val();
     //if (1 == 0)
     if ($('#buyoptic').length > 0 && $('#buyoptic').val() == "1")
     {
     calcTotal();
     }
     else {
     var kashfType = $('input[name=kashftype]:checked').val();
     if (kashfType == 1)
     {
     $('#externalKashf').show();
     $('#externalKashfFixed').hide();
     $('#kashfExist').val(1);
     $('#kashfError').hide();

     $('#kashfValue').val(0);
     $('#kashfValueP').html(0);

     $('#kashDiscValue').val(0);
     $('#kashDiscValueP').html(0);

     calcTotal();
     }
     else
     {
     $('#externalKashf').hide();
     $('#externalKashfFixed').hide();

     $.post('billsajax.php?do=loadkasfdetails', {customerId: customerId}, function (rslt) {
     var obj = JSON.parse(rslt);
     if (obj.lastDoctorKashfCount == 1)
     {
     $('#kashfError').hide();
     $('#kashfExist').val(1);
     fillExternalKashfFixed(obj.lastDoctorKashf);
     $('#externalKashfFixed').show();


     if (obj.kashfInBill == 1)
     {
     // add kashf to bill
     $('#kashfValue').val(obj.kashfValue);
     $('#kashfValueP').html(obj.kashfValue);
     }
     else
     {
     $('#kashfValue').val(0);
     $('#kashfValueP').html(0);

     $('#kashDiscValue').val(0);
     $('#kashDiscValueP').html(0);
     }
     }
     else
     {
     $('#kashfError').show();
     $('#kashfExist').val(0);

     $('#kashfValue').val(0);
     $('#kashfValueP').html(0);

     $('#kashDiscValue').val(0);
     $('#kashDiscValueP').html(0);
     }
     calcTotal();
     });
     }
     }
     }
     });*/
//######################################### load data in products select   #########################################

</script>

{/literal}
<!-- Back Modal -->
<div class="bootbox modal fade hidden-print" id="clientdept-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="margin-right: 162px;">
        <div class="modal-content" style="width: 871px;margin-right: 169px;">
            <div class="modal-header">
                <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title"> سداد ديون عميل</h4>
            </div>
            <div class="modal-body">
                <span> اسم العميل  : </span>
                <span id="sp_client_name"> </span><br>
                <span> مديونية العميل  : </span>
                <span id="sp_client_dept"></span><br>
                <span id="sp_client_dept"></span><br>
                <!--                <span> سداد مديونية العميل  : </span>
                                <input type="text" name="pay_client_dept" value="0" id="pay_client_dept"><br>-->

                <div id="table_container"></div>
            </div>
            <div class="modal-footer">
                <!--                <button type="button"  class="btn btn-primary update_confirm">نعم</button>-->
                <!--<button type="button"  class="btn btn-danger" data-dismiss="modal">لا</button>-->
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /#back-modal -->