<?php /* Smarty version Smarty-3.1.11, created on 2024-07-15 17:36:44
         compiled from "..\views\default\supplierPayedDeptview\add.html" */ ?>
<?php /*%%SmartyHeaderCode:233566695420c7880d9-76249116%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '55be882e9506c4cffba89e1f606f80039a0de8b4' => 
    array (
      0 => '..\\views\\default\\supplierPayedDeptview\\add.html',
      1 => 1706771847,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '233566695420c7880d9-76249116',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'clientsData' => 0,
    'data' => 0,
    'Programsettingdata' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'projectid' => 0,
    'userData' => 0,
    'allSave' => 0,
    'todayx' => 0,
    'today' => 0,
    'suplliernegative' => 0,
    'currency' => 0,
    'allCurrency' => 0,
    'sellers' => 0,
    'bank' => 0,
    'b' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6695420c8e8075_76167176',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6695420c8e8075_76167176')) {function content_6695420c8e8075_76167176($_smarty_tpl) {?><script>

    function checkserail() {
        var serail = document.getElementById("voucher").value;
        //alert(serail);
        //alert('clientPayedDeptControllerAjax.php.php?do=checkserail&serail='+serail);

        $.ajax({
            url: 'supplierPayedDeptControllerAjax.php?do=checkserail&serail=' + serail,
            success: function (x) {
                //alert(x);

                if (x == '1') {

                    alert('عفوا هذا الرقم موجود من قبل');
                    document.getElementById("voucher").value = document.getElementById("oldvoucher").value;
                    //document.getElementById("subbtn").style.display='none';

                } else {
                    //document.getElementById("subbtn").style.display='block'
                }

            }
        });

    }



</script>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="supplierPayedDeptController.php">خصائص عامة</a></li>
            <li><a href="supplierPayedDeptController.php?do=show">الموردين</a> </li>
            <!--<li><a href="clientPayedDeptController.php?do=show">العملاء</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"> 
                <form id="mySupPayForm" class="form-horizontal" action="supplierPayedDeptController.php?do=add"
                    method="post">
                    <!--validate the form before checking name-->
                    
                    <div class="form-group" style="display:none">
                        <label class="col-lg-2 control-label">اختر عميل اومورد </label>
                        <div class="col-lg-4">
                            <input type="radio" class="clientorsupplier" id="supplier" name="clientorsupplier" value="1"
                                checked>
                            <label for="supplier">مورد</label>
                            <input type="radio" class="clientorsupplier" id="client" name="clientorsupplier" value="2">
                            <label for="client">عميل </label>

                        </div>
                    </div>
                    <div class="form-group supplierform">
                        <label class="col-lg-2 control-label">اسم المورد</label>
                        <div class="col-lg-4">
                            <span id="spryselect2">
                                <input type="hidden" id="suppliersearchvalue" value="2" />
                                <div id="supplierDiv">
                                    <input type="hidden" name="supplierid" id="clientid" class="select2Supplier wdt100" />
                                    <input type="hidden" id="oldsupplierid" />
                                    <input type="hidden" id="oldsuppliername" />
                                </div>
                                <span class="selectInvalidMsg">*</span>
                            </span>
                        </div>
                    </div>
                    <div class="form-group clientform" style="display: none;">
                        <label for="partnerid" class="col-lg-2 control-label">العميل</label>
                        <div class="col-lg-4">
                            <select class="select2Supp wdt100" name="clientid" id="clientid">
                                <option value="-1">اختر عميل</option>
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clientsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->clientid;?>
" data-mobile="<?php echo $_smarty_tpl->tpl_vars['data']->value->clientmobile;?>
">
                                    <?php echo $_smarty_tpl->tpl_vars['data']->value->clientname;?>
</option>
                                <?php } ?>
                            </select>
                            <div id="clientError" style="display:none;"></div>

                        </div>

                    </div>
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter!=0&&$_smarty_tpl->tpl_vars['Programsettingdata']->value->realestatedev!=0){?> style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label">مركز التكلفه</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100" name="Costcenterid" id="Costcenterid">
                                <option value="-1">اختر مركز التكلفه</option>
                                <?php  $_smarty_tpl->tpl_vars['myallCostcenter'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallCostcenter']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCostcenter']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallCostcenter']->key => $_smarty_tpl->tpl_vars['myallCostcenter']->value){
$_smarty_tpl->tpl_vars['myallCostcenter']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['myallCostcenter']->value->id==$_smarty_tpl->tpl_vars['projectid']->value){?>selected=""<?php }?>><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>

                    <div class="form-group saveorbankform">
                        <label class="col-lg-2 control-label">اختر خزنه او بنك </label>
                        <div class="col-lg-4">
                            <input type="radio" class="saveorbank" name="saveorbank" value="1" checked>
                            <label for="client">خزنه</label>
                            <input type="radio" class="saveorbank" name="saveorbank" value="2">
                            <label for="supplier">بنك</label>
                        </div>
                    </div>

                    <div class="saveshow">
                        <?php if ($_smarty_tpl->tpl_vars['userData']->value->searchinonesave==0){?>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الخزنة</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100" name="saveid" id="saveid">
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSave']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->saveid;?>
" data-curr="<?php echo $_smarty_tpl->tpl_vars['data']->value->currencyId;?>
" <?php if ($_smarty_tpl->tpl_vars['userData']->value->saveid==$_smarty_tpl->tpl_vars['data']->value->saveid){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
 <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency==1){?>- <?php echo $_smarty_tpl->tpl_vars['data']->value->currencyName;?>
<?php }?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <?php }else{ ?>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">الخزنة</label>
                            <div class="col-lg-4">
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSave']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                <?php if ($_smarty_tpl->tpl_vars['userData']->value->saveid==$_smarty_tpl->tpl_vars['data']->value->saveid){?><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
 <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency==1){?>- <?php echo $_smarty_tpl->tpl_vars['data']->value->currencyName;?>
<?php }?><?php }?>
                                <input type="hidden" name="saveid" id="saveid" value="<?php echo $_smarty_tpl->tpl_vars['userData']->value->saveid;?>
" />
                                <?php } ?>

                            </div>
                        </div>
                        <?php }?>
                        <div class="form-group">
                            <label for="lastDate" class="col-lg-2 control-label">رقم الايصال </label>
                            <div class="col-lg-4">
                                <input type="text" name="voucher" id="voucher" readonly="" onkeyup="checkserail();"
                                    value="<?php echo $_smarty_tpl->tpl_vars['todayx']->value;?>
" class="form-control" />
                                <div id="voucherError" style="display:none;"></div>
                            </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="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
"  class="form-control <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit!=1){?>awdatepicker<?php }?>" autocomplete="off"  <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit==1){?>readonly="readonly"<?php }?> data-date-format="yyyy-mm-dd"  //>-->
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit!=1){?>
                                <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="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
"
                                        name="currentDate" id="currentDate" 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>
                                <?php }else{ ?>
                                <input name="currentDate" id="currentDate" type="text" value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
"
                                    class="form-control" autocomplete="off" readonly="readonly" />
                                <?php }?>
                            </div>
                        </div>

                        <!--==============================-->
                        <input name="suplliernegative" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['suplliernegative']->value;?>
"
                            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"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                </div>
                            </div>
                        </div>

                        <!--==============================-->
                        <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                            <label class="col-lg-2 control-label">العملة</label>
                            <div class="col-lg-4">
                                <span id="spryselect1">
                                    <select class="select2" name="currencyId" id="currencyId">
                                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCurrency']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" data-cfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->conversionFactor;?>
"
                                            data-othercfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->otherconversionFactor;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                        <?php } ?>
                                    </select>
                                    <span class="selectRequiredMsg">*</span></span>
                            </div>
                        </div>
                        <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                            <label class="col-lg-2 control-label">معامل التحويل</label>
                            <div class="col-lg-4">
                                <input type="text" name="cFactor" id="cFactor"
                                    class="form-control positivefloat calcOther" onkeyup="populateDebtAfter();"
                                    style="display: inline-block;width: 35%" />
                                =
                                <div class="input-group" style="display: inline;">
                                    <input type="text" name="otherCFactor" id="otherCFactor"
                                        class="form-control positivefloat calcOther"
                                        style="display: inline-block;width: 35%" />
                                    <span class="input-group-addon"
                                        style="display: inline-block;width: 24%"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</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="payedDeptCurr" id="payedDeptCurr"
                                        onkeyup="populateDebtAfter('payedDeptCurr');"
                                        class="<?php if ($_smarty_tpl->tpl_vars['suplliernegative']->value==1){?>numberinput<?php }else{ ?>positivefloat<?php }?> form-control" />
                                    <span class="input-group-addon" id="currencyText"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                </div>
                                <div id="valueError" style="display:none;"></div>
                            </div>
                        </div>
                        <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                            <label class="col-lg-2 control-label">المدفوع بالعملة الرئيسية</label>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <input type="text" name="payedDept" id="payedDept"
                                        onkeyup="populateDebtAfter('payedDept');"
                                        class="<?php if ($_smarty_tpl->tpl_vars['suplliernegative']->value==1){?>numberinput<?php }else{ ?>positivefloat<?php }?> form-control" />
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</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" disabled id="debtAfter" class="form-control" />
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                </div>
                            </div>
                        </div>

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


                        <div class="form-group clientform" style="display:none;">
                            <label class="col-lg-2 control-label">المندوب</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100" name="seller" id="seller">
                                    <option value=""></option>
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellers']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->userid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->employeename;?>
</option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>

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


                        <div class="form-group">
                            <label for="debtAfter" class="col-lg-2 control-label">التعليق</label>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <textarea style="width: 358px;" name="comment" cols="50" rows="5"
                                        class="form-control"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--end Save-->

                    <!--bank-->
                    <div class="bankshow" style="display: none;">
                        <div class="form-group">
                            <label for="ddlBank" class="col-lg-2 control-label">البنك</label>

                            <div class="col-lg-4">

                                <select class="select2 wdt100" name="ddlBank" id="ddlBank"
                                    onchange="loadAccount(this.value);">
                                    <option value="-1">اختر بنك</option>

                                    <?php  $_smarty_tpl->tpl_vars['b'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['b']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['bank']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['b']->key => $_smarty_tpl->tpl_vars['b']->value){
$_smarty_tpl->tpl_vars['b']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['b']->value->bankid;?>
"><?php echo $_smarty_tpl->tpl_vars['b']->value->bankname;?>
</option>
                                    <?php } ?>

                                </select>
                                <div id="bankerror">

                                </div>
                            </div>
                            <div class="col-lg-1">
                                <span class="requiredField">*</span>
                            </div>
                        </div>

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


                        <div class="form-group">
                            <label for="accountbeginingbalanceDis" class="col-lg-2 control-label">دين المورد</label>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <input type="text" name="debtBeforebank" id="debtBeforebank"
                                        class="form-control numberinput" readonly="readonly" value="0"
                                        placeholder="دين المورد" />

                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                </div>
                            </div>
                        </div>
                        <!-- =================================================   -->


                        <div class="form-group">
                            <label for="accountid" class="col-lg-2 control-label">اسم الحساب</label>

                            <div class="col-lg-4">
                                <div id="accountName">

                                    <select class="select2 wdt100" name="accountid" id="accountid">
                                        <option value="-1">اختر حساب</option>

                                    </select>

                                </div>

                                <div id="counterror">

                                </div>
                            </div>
                            <div class="col-lg-1">
                                <span class="requiredField">*</span>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-lg-2 control-label">التاريخ </label>
                            <div class="col-lg-4"> <span id="sprydate">
                                    <input type="text" class="form-control awdatepicker" autocomplete="off"
                                        data-date-format="yyyy-mm-dd" placeholder="التاريخ" value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
"
                                        name="checkdate" id="bn">
                                    <span class="textfieldRequiredMsg">*</span></span>
                            </div>
                            <div class="col-lg-1">
                                <span class="requiredField">*</span>
                            </div>
                        </div>

                        <div id="accountnumber">
                            <!-- =================================================   -->


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

                                    <input type="hidden" name="accountnumber" id="accountnumber" />

                                </div>
                            </div>

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

                            <div class="form-group">
                                <label for="accountbeginingbalanceDis" 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 numberinput"
                                            readonly="readonly" value="0" placeholder="رصيد سابق" />

                                        <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                    </div>

                                    <input type="hidden" name="accountbeginingbalance" id="accountbeginingbalance" />
                                </div>
                            </div>

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

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


                        <div class="form-group">
                            <label for="txtAmount" class="col-lg-2 control-label">قيمة السحب</label>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <input type="text" name="txtAmount" id="txtAmountxx"
                                        class="form-control <?php if ($_smarty_tpl->tpl_vars['suplliernegative']->value==1){?>numberinput<?php }else{ ?>positivefloat<?php }?>"
                                        placeholder="قيمة السحب" />
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                    <div id="chekamount">

                                    </div>
                                </div>
                                <div id="chekamountError">

                                </div>

                            </div>
                            <div class="col-lg-1">
                                <span class="requiredField">*</span>
                            </div>
                        </div>
                        <!--==============================-->
                        <div class="form-group">
                            <label for="txtcheckNum" class="col-lg-2 control-label">رقم عملية السحب</label>
                            <div class="col-lg-4">

                                <input type="text" name="txtcheckNum" id="txtcheckNum"
                                    class="form-control numberinput positivefloat" placeholder="رقم عملية السحب" />
                                <div id="chekerror">

                                </div>
                                <div id="chekerror2">

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

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


                        <div class="form-group">
                            <label for="txtUser" class="col-lg-2 control-label">اسم المستفيد</label>
                            <div class="col-lg-4">

                                <input type="text" name="txtUser" id="txtUser" class="form-control "
                                    placeholder="اسم المستفيد" />

                                <div id="userdiv">

                                </div>

                            </div>
                        </div>


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


                        <div class="form-group">
                            <label for="textNote" class="col-lg-2 control-label">تفاصيل اخرى</label>
                            <div class="col-lg-4">

                                <textarea class="form-control" rows="3" id="textNote" name="textNote"></textarea>

                            </div>
                        </div>

                    </div>
                    <!--end Bank-->



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

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button name="saveSupPayBtn" type="button" id="saveSupPayBtn"
                                class="btn btn-primary ">حفظ</button>
                            <button type="button" id="add_print_btn" class="btn btn-success">حفظ وطباعة</button>

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

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



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



<script type="text/javascript">
    jQuery(document).ready(function () {

        $(".select2Supplier").select2({
            placeholder: "المورد",
            minimumInputLength: document.getElementById("suppliersearchvalue").value,
            inimumInputLength: 0,
            quietMillis: 100,
            formatInputTooShort: function (input, min) {
                var n = min - input.length;
                $lenMsg = '<ul class="select2-results">';
                // if (supplierWithAddOption == 1)
                // $lenMsg += '<li class="select2-results-dept-0 select2-result select2-result-selectable" onclick="newOptionAtInputTooShort();"><div class="select2-result-label newoption"><span class="newoption">اضافة عميل جديد</span></div></li>';
                $lenMsg += '</ul><div class="select2-result-label"><span>من فضلك أدخل ' + n + ' حروف أكثر</span></div>';
                // Append it to the select
                return $lenMsg;
            },
            ajax: {
                url: "supplierAjaxController.php?do=select2supplier",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        term: term, //search term
                        page_limit: 7, // page size
                        withAddOption: 0,
                        withNakdi: 1,
                    };
                },
                results: function (data) {
                    return { results: data };
                }
            },
            formatResult: function (data) {
                if (Number(data.id) == -2) {
                    return '<span class="newoption">' + data.text + '</span >';
                } else {
                    return '<span>' + data.text + '</span >';
                }
            },
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = { id: item[0], text: item[1], mobile: item[6] };
                callback(data);
            },
            //dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
        }).on('select2-loaded', function (e) {// not "select2-open" nor "select2-opening" //http://mkurz.github.io/select2/index.html
            $('.newoption').parent().addClass('newoption');
        }).on("select2-selecting", function (e) {
            // the class to make diffrence of change from select2 itself "choose another option" ,it wont exist for triggering change
            $('#supplierid').addClass('selectingClass');
        })
        //this is needed for ajax =>to obtain id from it  and use in ajax
        $('#supplierid').select2('data', { id: $('#oldsupplierid').val(), text: $('#oldsuppliername').val() });
        setTimeout(function () {
            //this is needed as we need html to end drawing then put value => without it text will be undefined
            $('#supplierid').select2('data', { id: $('#oldsupplierid').val(), text: $('#oldsuppliername').val() });
        }, 0);
    });
</script>
<?php }} ?>