<script src="{$path}/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="{$path}/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">

<div class="row">

    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#"> الشيكات المؤجله </a></li>

            <li class="active"> تسديد شيك </li>
        </ol>


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

            <div class="panel-heading">
                <h3 class="panel-title">تسديد شيك </h3>
            </div>


            <div class="panel-body">

                <form id="pay-form" class="form-horizontal nameToBeChecked" action="datedCheckedController.php?do=payment" method="post">
                    <input type="hidden" name="id" id="id" value="{$idPost}"/>

                    <!-- اسم العميل  -->
                    <div class="form-group mg-bt5" id="productdiv_re1">
                        <label class="col-lg-2 control-label">  اسم العميل   </label>
                        <div class="col-lg-4">
                            <label class="col-lg-4 control-label">  {$clName} </label>
                        </div>
                    </div>
                    <input type="hidden" name="clientNum" id="clientNum" value="{$row->clientNum}"/>
                    <input type="hidden" name="supplierid" id="supplierid" value="{$supplierid}"/>

                    <!-- رقم حساب العميل -->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label">  رقم حساب العميل  </label>
                        <div class="col-lg-4">
                            <label class="col-lg-4 control-label">  {$row->accountNo}</label>
                        </div>

                    </div>


                    <!-- قيمه الشيك -->
                    <div class="form-group"  >
                        <label class="col-lg-2 control-label">قيمه الشيك</label>
                        <div class="col-lg-4">
                            <label class="col-lg-4 control-label">{$row->checkValue}</label>
                        </div>

                    </div>
                    <input type="hidden" name="checkValue" id="checkValue" value="{$row->checkValue}"/>


                    <!--  رقم الشيك -->
                    <div class="form-group"  >
                        <label class="col-lg-2 control-label">  رقم الشيك</label>
                        <div class="col-lg-4">
                            <label class="col-lg-4 control-label">{$row->checkNo}</label>
                        </div>
                    </div>
                    <input type="hidden" name="checkdepositnumber" id="checkdepositnumber" value="{$row->checkNo}"/>

                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label">   تاريخ اضافة الشيك</label>
                        <div class="col-lg-4">
                            <label class="col-lg-4 control-label">{$row->checkdate}</label>
                        </div>
                    </div>
                    <!--  تاريخ الاستحقاق-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label">   تاريخ الاستحقاق</label>
                        <div class="col-lg-4">
                            <label class="col-lg-4 control-label">{$row->dueDate}</label>
                        </div>
                    </div>

                    <!-- نوع الصرف -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">نوع الصرف</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="paytype" type="radio" id="paytype1" value="0" checked="checked" onChange="getdata();"/>
                                    خزنة </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="paytype" type="radio"  id="paytype2"  value="1"  onchange="getdata();"  />
                                    بنك </label>
                            </div>

                            <!-- <div class="radio-inline">
                               <label>
                                 <input name="paytype" type="radio"  id="paytype3"  value="2"  onchange="getdata();" />
                                  بيع الشيك لمورد </label>
                             </div>-->

                        </div>
                    </div>

                    <hr>
                    <hr>


                    <!--===============  Start save div  ===============    -->
                    <div id="savedata">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">إسم الخزنة</label>
                            <div class="col-lg-4">
                                <select name="ddlsave" id="ddlsave" class="select2 wdt100">
                                    <option value="-1"> اختر اسم الخزنة </option>
                                    {foreach $allSave as $b}
                                    <option value="{$b->saveid}">{$b->savename}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                    </div>
                    <!--===============  End save div  ===============-->
                    <!--===============  Start checkdata div  ===============    -->
                    <div id="checkdata" style="display:none">


                        <div class="form-group">
                            <label class="col-lg-2 control-label">إسم البنك</label>
                            <div class="col-lg-4">
                                <div id="bankdiv">
                                    <select name="ddlBank" id="ddlBank" onChange="load1();"  class="select2 wdt100">
                                        <option value="-1"> اختر اسم البنك </option>
                                        {foreach $bank as $b}

                                        <option value="{$b->bankid}">{$b->bankname}</option>

                                        {/foreach}


                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--==============================-->

                        <div class="form-group">
                            <label class="col-lg-2 control-label">إسم الحساب </label>
                            <div class="col-lg-4"> <span id="spryselect3">
                                    <div id="sss">
                                        <label for="ddlAccount"></label>

                                        <select id="accountid" class="select2 wdt100" onchange="load2();" name="accountid">
                                            <option value="-1"> اختر اسم الحساب </option>
                                        </select>

                                        <p id="result">&nbsp;</p>
                                    </div>
                                </span> <span> <span class="selectInvalidMsg">يرجى إختيار حساب</span><span class="selectRequiredMsg">يرجى إختيار حساب</span></span>
                            </div>
                        </div>

                        <!--==============================-->
                        <input type="hidden" name="accountid1" id="accountid1" value=""/>
                        <!--===============  Start ddd div  ===============-->
                        <div id="ddd">

                            <div class="form-group">
                                <label class="col-lg-2 control-label">رقم الحساب</label>
                                <div class="col-lg-4">
                                    <input type="text" name="accountnumberDis" id="accountnumberDis"  class=" form-control" readonly="readonly"/>
                                    <input type="hidden" name="accountnumber" id="accountnumber"/>
                                </div>
                            </div>

                            <!--==============================-->
                            <div class="form-group">
                                <label class="col-lg-2 control-label">رصيد سابق</label>
                                <div class="col-lg-4">
                                    <div class="input-group">
                                        <input type="text" name="accountbeginingbalanceDis" id="accountbeginingbalanceDis" class=" form-control" value="0" readonly/>
                                        <span class="input-group-addon">{$currency}</span>
                                        <input type="hidden" name="accountbeginingbalance" id="accountbeginingbalance"/>

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

                            <!--==============================-->

                        </div>
                        <!--===============  End ddd div  ===============-->

                        <!-- <div class="form-group">
                           <label class="col-lg-2 control-label">رقم الشيك</label>
                           <div class="col-lg-4"> <span id="sprytextfield5">
                             <input type="text" name="txtcheckNum" id="txtcheckNum" onKeyUp="submitform();"  class=" form-control"/>
                             <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">يرجى إدخال قيمة صحيحة</span></span> </div>
                         </div>-->

                        <!--==============================-->

                        <!--            <div class="form-group">
                                      <label class="col-lg-2 control-label">إسم المستفيد</label>
                                      <div class="col-lg-4">
                                        <input type="text" name="txtUser" id="txtUser"  class=" form-control"/>
                                      </div>
                                    </div>
                        -->
                        <!--==============================-->

                        <div class="form-group">
                            <label class="col-lg-2 control-label">المبلغ المدفوع</label>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <input type="text" readonly name="txtAmount" id="txtAmount"  class=" form-control" value="{$row->checkValue}"/>
                                    <span class="input-group-addon">{$currency}</span> </div>
                            </div>
                        </div>

                        <!--==============================-->

                        <div class="form-group">
                            <label class="col-lg-2 control-label">تفاصيل أخرى</label>
                            <div class="col-lg-4">
                                <textarea name="textNote" id="textNote" class=" form-control" cols="45" rows="5"></textarea>
                            </div>
                        </div>

                        <!--==============================-->

                    </div>
                    <!--===============  End checkdata div  ===============-->



                    <!--===============  Start Supplier  div  ===============   -->
                    <!--   <div id="supData" style="display:none">

                       <div class="form-group">
                          <label class="col-lg-2 control-label">إسم المورد</label>
                          <div class="col-lg-4">

                            <div id="supDiv	">

                              <select name="supplierid" id="supplierid"   class="select2 wdt100" onchange="supplierDept(this.value);">

                    {foreach $allSupplier as $sup}

                                <option value="{$sup -> supplierid}">{$sup -> suppliername}</option>

                      {/foreach}


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

                        <input type="hidden" name="suplierID" id="suplierID" value="" />
                    <!--==============================-->


                    <!--   <div class="form-group">
                         <label class="col-lg-2 control-label">رصيد سابق</label>
                         <div class="col-lg-4">
                           <div class="input-group">
                             <input type="text" name="suppliercurrentDebt" id="suppliercurrentDebt" class=" form-control" value="0" readonly  onchange="getsuppliercurrentDebt();" />
                              <span class="input-group-addon">{$currency}</span>
                              <input type="hidden" name="suppliercurrentDebt" id="suppliercurrentDebt"/>

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

                    <!--============================-->


                    <!--   <div class="form-group">
                         <label class="col-lg-2 control-label">المبلغ المدفوع</label>
                         <div class="col-lg-4">
                           <div class="input-group">
                             <input type="text" readonly name="txtAmount" id="txtAmount"  class=" form-control" value="{$row->checkValue}"/>
                                  <span class="input-group-addon">{$currency}</span> </div>
                              </div>
                       </div>

                    <!--==============================-->

                    <!--   <div class="form-group">
                         <label class="col-lg-2 control-label">تفاصيل أخرى</label>
                         <div class="col-lg-4">
                           <textarea name="textNote" id="textNote" class=" form-control" cols="45" rows="5"></textarea>
                         </div>
                       </div>

                    <!--==============================-->


                    <!-- </div> -->







                    <!--===============  end    ===============   -->
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <input name="type" type="hidden" value="{$type}" />
                            <button type="submit" class="btn btn-primary pull-left">إضافة</button>
                        </div>
                    </div>
                    <div class="clearfix"></div>









                </form>



            </div> <!-- end of panel-body-->

        </div>  <!-- end of panel panel-default-->

    </div> <!-- end of container-->

</div>  <!-- end of row-->


<script>
    function isNumberKey(evt)
    {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

        return true;
    }
</script>

