

<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=update" class="nameToBeChecked form-horizontal" >

                    <div id="printAll">
                        <div id="billDetails">


                            <div class="row">
                                <div class="container">
                                    <div class="panel panel-default panel-m">

                                        <div class="panel-body">

                                            <!-- end box / title -->

                                            <form  method="post" id="billForm" action="?do=add" class="nameToBeChecked form-horizontal" >

                                                <div id="printAll">
                                                    <div class="form-group">
                                                        <label class="col-lg-2 control-label">اسم العميل </label>
                                                        <div class="col-lg-4">
                                                            <p class="form-control-static"> {$bill->clientname} </p>
                                                        </div>

                                                        <label class="col-lg-2 control-label">تاريخ الاستلام  </label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->receivedate} </p>            </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-lg-2 control-label">رقم الفاتورة </label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->billno} </p>            </div>

                                                        <label class="col-lg-2 control-label">التعليق</label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->comment} </p>            </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-lg-2 control-label">تاريخ الفاتورة   </label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->billdate} </p>            </div>
                                                        <label class="col-lg-2 control-label">نوع الكشف</label>
                                                        <div class="col-lg-4">              <p class="form-control-static">  {if $bill->kashftype == 1} خارجى  {elseif $bill->kashftype == 0} داخلى   {else} كشف{/if}</p>            </div>

                                                    </div>

                                                    <div class="form-group">
                                                        <label class="col-lg-2 control-label">الحد الأقصى للسداد</label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->alloweddays} </p>            </div>
                                                        <label class="col-lg-2 control-label">نوع السعر</label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {if $bill->pricetype == 1} تجزئة {else if $bill->pricetype == 2} نصف جملة  {else if $bill->kashftype == 0} جملة  {/if}</p>            </div>

                                                    </div>

                                                    {if $bill->kashftype == 1}

                                                    <div class="form-group">
                                                        <label class="col-lg-2 control-label">مكان الكشف</label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->kashfplace} </p>            </div>
                                                        <label class="col-lg-2 control-label">تاريخ الكشف</label>
                                                        <div class="col-lg-4">              <p class="form-control-static"> {$bill->kashfdate}</p>            </div>

                                                    </div>
                                                    {/if}

                                                    <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>


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



                                                    <div id="externalKashf">

                                                        <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> <label class="sr-only">المسافة</label> </td>

                                                                        <td> <input   type="text" name="D_Lva" disabled="" readonly="" value="{if $kashf->ldva >0}{/if}{$kashf->ldva}"   class="form-control" /> </td>
                                                                        <td> <input   type="text" name="D_Lprism" disabled="" readonly="" value="{if $kashf->ldprism >0}{/if}{$kashf->ldprism}"    class="form-control" /> </td>
                                                                        <td> <input   type="text" name="D_Laxis"  disabled="" readonly="" value="{$kashf->ldaxis}"    class="form-control" /> </td>

                                                                        <td> <input   type="text" name="D_Lcylinder"  disabled="" readonly="" value="{if $kashf->ldcylinder >0}{/if}{$kashf->ldcylinder}"  class="form-control" /> </td>

                                                                        <td> <input  type="text"  name="D_Lsphere" disabled="" readonly="" value="{if $kashf->ldsphere >0}{/if}{$kashf->ldsphere}"  class="form-control" /> </td>

                                                                    </tr>
                                                                    <tr>


                                                                        <td> <label class="sr-only">القراءة</label> </td>




                                                                        <td> <input   type="text" name="N_Lva"  disabled="" readonly="" value="{if $kashf->lnva >0}{/if}{$kashf->lnva}"    class="form-control" /> </td>

                                                                        <td> <input   type="text" name="N_Lprism"  disabled="" readonly="" value="{if $kashf->lnprism >0}{/if}{$kashf->lnprism}"   class="form-control" /> </td>


                                                                        <td> <input   type="text" name="N_Laxis" disabled="" readonly="" value="{$kashf->lnaxis}"    class="form-control" /> </td>

                                                                        <td> <input   type="text" name="N_Lcylinder"  disabled="" readonly="" value="{if $kashf->lncylinder >0}{/if}{$kashf->lncylinder}"   class="form-control" /></td>

                                                                        <td> <input   type="text" name="N_Lsphere"  disabled="" readonly="" value="{if $kashf->lnsphere >0}{/if}{$kashf->lnsphere}"  class="form-control" /> </td>

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


                                                        <!-- Left table -->
                                                        <div style="    margin-top: -150px;" class="form-group">

                                                            <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>  <input   type="text" name="D_Rva"  disabled="" readonly="" value="{if $kashf->rdva >0}{/if}{$kashf->rdva}"   class="form-control" /> </td>


                                                                        <td> <input   type="text" name="D_Rprism"  disabled="" readonly="" value="{if $kashf->rdprism >0}{/if}{$kashf->rdprism}"  class="form-control" /> </td>

                                                                        <td> <input   type="text" name="D_Raxis"  disabled="" readonly="" value="{$kashf->rdaxis}"   class="form-control" /> </td>

                                                                        <td>  <input   type="text" name="D_Rcylinder" disabled="" readonly="" value="{if $kashf->rdcylinder >0}{/if}{$kashf->rdcylinder}"    class="form-control" /></td>

                                                                        <td> <input   type="text" name="D_Rsphere"  disabled="" readonly="" value="{if $kashf->rdsphere >0}{/if}{$kashf->rdsphere}"  class="form-control" /> </td>

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


                                                                        <td>   <input   type="text" name="N_Rva" disabled="" readonly="" value="{if $kashf->rnva >0}{/if}{$kashf->rnva}"   class="form-control" /> </td>
                                                                        <td> <input   type="text" name="N_Rprism"  disabled="" readonly="" value="{if $kashf->rnprism >0}{/if}{$kashf->rnprism}"   class="form-control" /> </td>


                                                                        <td> <input   type="text" name="N_Raxis"  disabled="" readonly="" value="{$kashf->rnaxis}"   class="form-control" /> </td>

                                                                        <td>  <input   type="text" name="N_Rcylinder"  disabled="" readonly="" value="{if $kashf->rncylinder >0}{/if}{$kashf->rncylinder}"  class="form-control" /> </td>

                                                                        <td>  <input   type="text" name="N_Rsphere"   disabled="" readonly="" value="{if $kashf->rnsphere >0}{/if}{$kashf->rnsphere}"   class="form-control" /> </td>

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

                                                                    </tr>
                                                                </table>



                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="row">
                                                            <hr/>
                                                            <div class="col-lg-6">
                                                                <h4></h4>
                                                            </div>
                                                            <div class="col-lg-6">
                                                            </div>
                                                        </div>
                                                        <input name="hidden_itr" id="hidden_itr" type="hidden" value="{$billProductsCount}" />
                                                        <input name="billId" id="billId" type="hidden" value="{$bill->id}" />
                                                        <input name="billsReturnId" id="billsReturnId" type="hidden" value="{$billsReturn->id}" />
                                                        <!-- end of title row-->
                                                        <div class="table-responsive bd-gr">
                                                            <table class="table billtable table-bordered table-black" >
                                                                <thead>
                                                                    <tr>
                                                                        <th class="wdt400">اسم المنتج</th>
                                                                        <th class="wdt240">ملاحظات</th>
                                                                        <th class="wdt100n">العدد</th>
                                                                        <th class="wdt100n">عدد المرتجع سابقا </th>
                                                                        <th class="wdt100n">العدد الصافى </th>
                                                                        <th class="wdt80">السعر</th>
                                                                        <th class="wdt100n">الاجمالى</th>
                                                                        <th class="wdt100n">عدد المرتجع </th>
                                                                        <th class="wdt100n">اجمالى المرتجع </th>


                                                                    </tr>
                                                                </thead>
                                                                <tbody id="productsTable">
                                                                    {assign var=i value=1}
                                                                    {foreach $billProducts as $product}
                                                                    <tr>
                                                                        <td>
                                                                            <p class="form-control-static"> {$product->productName} </p>
                                                                            <input name="product{$i}" id="product{$i}" type="hidden" value="{$product->id}" />

                                                                        </td>
                                                                        <td>
                                                                            <p class="form-control-static"> {$product->note}  </p>
                                                                        </td>

                                                                        <td>
                                                                            <p class="form-control-static"> {$product->productno}  </p>
                                                                        </td>

                                                                        <td>
                                                                            <p class="form-control-static"> {$product->retproductno}  </p>
                                                                        </td>

                                                                        <td>
                                                                            <p class="form-control-static"> {$product->netproductno}  </p>
                                                                            <input name="pronum{$i}" id="pronum{$i}" type="hidden" value=" {$product->netproductno} " />
                                                                        </td>
                                                                        <td>
                                                                            <p class="form-control-static"> {$product->productprice}  </p>
                                                                            <input name="proprice{$i}" id="proprice{$i}" type="hidden" value=" {$product->productprice} " />
                                                                        </td>
                                                                        <td class="aw_totalprice">
                                                                            <div  class="aw_mt form-control-static"><span id="prototal1">{$product->producttotalprice}</span> <span> {$currency}</span></div>
                                                                        </td>

                                                                        <td>
                                                                            <input name="retnum{$i}" id="retnum{$i}" placeholder="العدد"  data-itr="{$i}" value="{$product->retno}" class="form-control txt-nonraduis positivefloat changeNum" type="text"/>
                                                                        </td>
                                                                        <td class="aw_totalprice">
                                                                            <div  class="aw_mt form-control-static"><span id="rettotal{$i}"> {$product->retprice}</span> <span> {$currency}</span></div>
                                                                            <input name="totalRetPrice{$i}" id="totalRetPrice{$i}" type="hidden" value="{$product->retprice}" />
                                                                        </td>

                                                                    </tr>
                                                                    {capture assign=i}{$i+1}{/capture}
                                                                    {/foreach}
                                                                </tbody>
                                                            </table>
                                                        </div>

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

                                                    </div>

                                                    <div class="col-lg-12">
                                                        <div class="form-group ">
                                                            <label class="col-lg-2 control-label bg-yel">اجمالى الفاتورة  </label>
                                                            <div class="col-lg-6 bg-yel">
                                                                <p class="form-control-static mg-tp10" id="oldNetP">{$bill->finalnetbillvalue}</p>
                                                                <input class="form-control" name="oldNet" id="oldNet"   type="hidden" value="{$bill->finalnetbillvalue}"  />
                                                            </div>
                                                        </div>
                                                        <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="totalRetNumP">{$billRetNo}</p>
                                                            </div>

                                                            <label class="col-lg-2 control-label">قيمة القطع المرتجعة</label>
                                                            <div class="col-lg-2">
                                                                <input name="discValue" id="discValue"  class="form-control positivefloat" type="text" value="{$billsReturn->returnedprice}" />
                                                            </div>

                                                            <label class="col-lg-2 control-label">المبلغ المرتجع للعميل </label>
                                                            <div class="col-lg-2">
                                                                <input name="clientReceiveValue" id="clientReceiveValue"  class="form-control positivefloat" type="text" value="{$billsReturn->clientreceivevalue}" />
                                                                <input name="clientReceiveValueOld" id="clientReceiveValueOld"  type="hidden" value="{$billsReturn->clientreceivevalue}" />
                                                            </div>
                                                        </div>
                                                        <div class="form-group ">
                                                            <label class="col-lg-2 control-label bg-yel">الصافى </label>
                                                            <div class="col-lg-6 bg-yel">
                                                                <p class="form-control-static mg-tp10" id="netValueP">{$bill->netbillvalue}</p>
                                                                <input class="form-control" name="netValue" id="netValue"   type="hidden" value="{$bill->netbillvalue}"  />
                                                            </div>
                                                        </div>
                                                    </div>


                                                </div>

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


                        </div></div>


            </div>





        </div>




        <div class="form-group">
            <div class="col-lg-12">
                <input name="new" id="new" type="hidden" value="1" />
                <input name="edit" id="edit" type="hidden" value="1" />
                <button type="button"   class="btn btn-primary pull-left saveBillReturn">تسجيل  </button>
            </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></div>




