
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">ايصالات دفع</a></li>
            <li><a href="#">اصافة ايصال دفع</a></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"> {literal}
                <form class="form-horizontal" action="?do=add" method="post" name="myform" novalidate>
                    <!--validate the form before checking name-->
                    {/literal}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">اسم المورد</label>
                        <div class="col-lg-4"> <span id="spryselect1">
                                <select name="supplierid" id="supplierid" data-placeholder="اختر اسم المورد:" class="select2 wdt100">
                                    <option value="-1"> اختر مورد</option>





                                    {foreach $suppliersData as $data }


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





                                    {/foreach}




                                </select>
                                <span class="selectInvalidMsg">اختر اسم المورد</span><span class="selectRequiredMsg">اختر اسم المورد.</span></span> </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">تاريخ سداد اخر عمليه</label>
                        <div class="col-lg-4">
                            <input name="lastDate" type="text" id="lastDate" readonly="readonly"  class="form-control"/>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">تاريخ السداد الحالى</label>
                        <div class="col-lg-4">
                            <input name="currentDate" id="currentDate" type="text" value="{$today}"  class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd"  //>
                        </div>
                    </div>

                    <!--==============================-->
                    <input name="suplliernegative" type="hidden" value="{$suplliernegative}"  id="suplliernegative"/>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الدين السابق</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input name="debtBefore" id="debtBefore" type="text" readonly="readonly" class="form-control"/>
                                <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">
                            <div class="input-group"> <span id="sprytextfield3">
                                    <input type="text" name="payedDept" id="payedDept"  onkeyup="populateDebtAfter();
                                            submitform();" class="numberinput form-control"  />
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل رقم</span></span> <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">
                            <div class="input-group">
                                <input type="text" name="debtAfter" id="debtAfter" class="form-control" />
                                <span class="input-group-addon">{$currency}</span> </div>
                        </div>
                    </div>

                    <!--==============================-->
                    <input type="hidden" name="Add" value="1"/>

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

                    <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" onChange="getdata();"  checked="checked" />
                                    خزنة </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="paytype" type="radio"  id="paytype2"  value="1"  onchange="getdata();"  />
                                    شيك </label>
                            </div>
                        </div>
                    </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">
                                <input type="text" name="sendBank" required id="sendBank"  class=" form-control"/>
                            </div>
                        </div>

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

                        <div class="form-group">
                            <label class="col-lg-2 control-label">إسم البنك</label>
                            <div class="col-lg-4">
                                <div id="bankdiv">
                                    <select name="ddBank" 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 name="ddlAccount" id="ddlAccount" class="select2 wdt100">
                                            <option value="0">اختر اسم الحساب</option>
                                        </select>
                                        <!--<p id="result">&nbsp;</p>-->
                                    </div>
                                </span> <span> <span class="selectInvalidMsg">يرجى إختيار حساب</span><span class="selectRequiredMsg">يرجى إختيار حساب</span></span> </div>
                        </div>

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

                        <!--===============  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 name="chckDate" id="chckDate" type="text" value="{$today}"  class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd"  //>
                            </div>
                        </div>

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

                        <div class="form-group">
                            <label for="email" class="col-lg-2 control-label">صورة الشيك</label>
                            <div class="col-lg-4">
                                <input type="file" name="logo" id="logo" class="form-control" placeholder="صورة الشيك" />
                            </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"/>
                                    <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>

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button name="btnAdd" type="submit" id="btnAdd" class="btn btn-primary pull-left">حفظ</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "real");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1"});
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real");
    var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue: "-1"});
</script>
{/literal}

{literal}
<script type="text/javascript">
    jQuery(function () {
        $("form").submit(function () {
// submit more than once return false
            $(this).submit(function () {
                return false;
            });
// submit once return true
            return true;
        });
    });
</script>
{/literal}