
<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="bindSettleForm" action="?do=update" class="nameToBeChecked form-horizontal" >

                    <div id="printAll">
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> الموظف   </label>
                            <div class="col-lg-4">
                                <select name="employee" id="employee" data-placeholder="اختر"  class="select2 wdt100" >
                                    <option value="-1"> اختر </option>
                                    {foreach $binds as $bind}
                                    <option value="{$bind->employeeid}" {if $bind->employeeid == $bindSettlements[0]->employeeid} selected {/if}>{$bind->employeeName} </option>
                                    {/foreach}
                                </select>
                                <span id="employeeError" 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">
                                <p class="form-control-static mg-tp10" id="bindValueP">{$sumBind}</p>
                                <input class="form-control" name="bindValue" id="bindValue"   type="hidden" value="{$sumBind}"  />
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-lg-2 control-label">التسويات السابقة    </label>
                            <div class="col-lg-4">
                                <p class="form-control-static mg-tp10" id="bindSettlementValueP">{$sumSettlement}</p>
                                <input class="form-control" name="bindSettlementValue" id="bindSettlementValue"   type="hidden" value="{$sumSettlement}"  />
                            </div>
                            <label class="col-lg-2 control-label bg-yel"> الصافى   </label>
                            <div class="col-lg-1 bg-yel">
                                <p class="form-control-static mg-tp10" id="bindValueNetP">{$sumNet}</p>
                                <input class="form-control" name="bindValueNet" id="bindValueNet"   type="hidden" value="{$sumNet}"  />
                            </div>
                        </div>

                        <div class="row">
                            <hr/>
                            <div class="col-lg-6">
                                <h4></h4>
                            </div>
                            <div class="col-lg-6">
                                <button type="button" name="addNewBindS" id="addNewBindS" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button>
                            </div>
                        </div>
                        <input class="form-control" name="itr" id="itr"   type="hidden" value="{$itr}"  />
                        <div class="table-responsive bd-gr">
                            <table class="table billtable table-bordered table-black" >
                                <thead>
                                    <tr>
                                        <th>#  </th>
                                        <th>وسيلة التسوية </th>
                                        <th>تسوية من </th>
                                        <th>المشروع </th>
                                        <th>القيمة </th>
                                        <th>ملاحظات</th>
                                        <!--th class="hidden-print">حذف</th-->
                                    </tr>
                                </thead>
                                <tbody id="bindSettleTable">
                                    {assign var=i value=1}
                                    {foreach $bindSettlements as $bindSettlement }
                                    <tr>
                                        <td>
                                            {$i}
                                            <input name="bindSettleId{$i}" id="bindSettleId{$i}" type="hidden" value="{$bindSettlement->id}" />
                                        </td>
                                        <td>
                                            <select name="bindSettlement{$i}" id="bindSettlement{$i}" data-itr="{$i}" data-placeholder="اختر"  class="select2 wdt100 bindSettlement" >
                                                <option value="-1"> اختر </option>
                                                <option value="1" {if $bindSettlement->settlementway == 1} selected {/if}> خزينة </option>
                                                <option value="0" {if $bindSettlement->settlementway == 0} selected {/if}> مصروفات </option>
                                            </select>
                                            <span id="bindSettlementError{$i}" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px; display: none ;">اختر مصروف  أولا</span>

                                        </td>
                                        <td>

                                            <div id="masroufDiv{$i}" {if $bindSettlement->settlementway == 1} style="display: none;" {/if}>
                                                <select name="expensestype{$i}" id="expensestype{$i}" data-placeholder="اختر"  class="select2" >
                                                    <option value="-1"> اختر </option>
                                                    {foreach $expensesType as $expense}
                                                    <option value="{$expense->expensestypeid}" {if $expense->expensestypeid == $bindSettlement->settlementwayid} selected {/if}>{$expense->expensestypename} </option>
                                                    {/foreach}
                                                </select>
                                                <span id="expenseError{$i}" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px; display: none ;">اختر مصروف  أولا</span>


                                            </div>

                                            <div id="saveDiv{$i}" {if $bindSettlement->settlementway == 0} style="display: none;" {/if}>
                                                <select name="save{$i}" id="save{$i}" data-placeholder="اختر"  class="select2" >
                                                    <option value="-1"> اختر </option>
                                                    {foreach $saves as $save}
                                                    <option value="{$save->saveid}" {if $save->saveid == $bindSettlement->settlementwayid} selected {/if}>{$save->savename} </option>
                                                    {/foreach}
                                                </select>
                                                <span id="saveError{$i}" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px; display: none ;">اختر الخزنة  أولا</span>


                                            </div>


                                        </td>
                                        <td>
                                            <select name="project{$i}" id="project{$i}" data-placeholder="اختر"  class="select2 wdt100" >
                                                <option value="-1"> اختر </option>
                                                {foreach $projects as $project}
                                                <option value="{$project->id}" {if $project->id == $bindSettlement->projectid} selected {/if}>{$project->name} </option>
                                                {/foreach}
                                            </select>

                                        </td>
                                        <td>
                                            <input name="value{$i}" id="value{$i}" type="text"  style="display: inline;"  class="form-control wds100 positivefloat" value="{$bindSettlement->value}" />
                                            <span id="valueError{$i}" class=" alert-block alert-danger fade in" style="padding: 5px 5px 5px 5px; display: none ;"></span>
                                            <input class="form-control" name="oldValue{$i}" id="oldValue{$i}"   type="hidden" value="{$bindSettlement->value}"  />


                                        </td>
                                        <td>
                                            <textarea class="form-control" style="height: 100%;" rows="1" name="comment{$i}" id="comment{$i}"> {$bindSettlement->comment}</textarea>
                                        </td>
                                        <!--td>
                                            <button type="button" id="remove1" class="removeproduct close flt-none" aria-hidden="true">&times;</button>
                                        </td-->
                                    </tr>
                                    {capture assign=i}{$i+1}{/capture}
                                    {/foreach}
                                </tbody>
                            </table>
                        </div>








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


                    </div>




                    <div class="form-group">
                        <div class="col-lg-12">
                            <input  name="groupNo" id="groupNo"   type="hidden" value="{$bindSettlements[0]->groupno}"  />
                            <button type="button"   class="btn btn-primary pull-left saveBindSettle">حفظ  </button>
                        </div>

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

<!-- Modal -->













