<?php /* Smarty version Smarty-3.1.11, created on 2025-01-19 17:49:55
         compiled from "../views/default/expensesview/add.html" */ ?>
<?php /*%%SmartyHeaderCode:979096769678d1f23b2c833-00519548%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '8a7563493fcadc6397da2286a8b8bda359417129' => 
    array (
      0 => '../views/default/expensesview/add.html',
      1 => 1698089766,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '979096769678d1f23b2c833-00519548',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'lang_code' => 0,
    'searchinonesave' => 0,
    'allSave' => 0,
    'data' => 0,
    'saveid' => 0,
    'userData' => 0,
    'bank' => 0,
    'allParents' => 0,
    'Programsettingdata' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'suppliersData' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_678d1f23c8cba2_03356747',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_678d1f23c8cba2_03356747')) {function content_678d1f23c8cba2_03356747($_smarty_tpl) {?>
<div class="row">
    <div class="container <?php if ($_smarty_tpl->tpl_vars['lang_code']->value=='en'){?> gt4-ltr<?php }?>">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo @EXPENSES_REVENUE;?>
</a></li>
            <li><a href="#"><?php echo @EXPENSES;?>
</a></li>
            <li class="active"><?php echo @ADD_EXPENSES;?>
</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title"><?php echo @ADD_EXPENSES;?>
</h3>
            </div>
            <div class="panel-body">
                <!-- tree >
                <div class="col-lg-4 ">
                    <div class="row">
                        <div class="container">
                            <div class="panel panel-default panel-m">
                                <div class="panel-heading">
                                    <div class="caption"><i class="icon-comments"></i>شجرة المصروفات</div>
                                    <div class="actions"> <a href="javascript:;" id="tree_expense_collapse" class="btn btn-success"> اغلاق الكل</a> <a href="javascript:;" id="tree_expense_expand" class="btn btn-warning"> فتح الكل</a> </div>
                                </div>
                                <div class="panel-body" style="overflow-x:auto;  overflow-y:auto; height:400px;">
                                    <div class=" portlet-body fuelux">
                                        <ul class="tree" id="tree_expense">
                                            <li> <a href="#" data-role="branch" class="tree-toggle" data-toggle="branch" data-value="التصنيفات"> التصنيفات </a>
                                                <ul class="branch in">
                                                    
                                                </ul>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div><!----col-lg-4-->
                <!-- tree end -->

                <div class="col-lg-12">
                    <input name="selectedId" id="selectedId" type="hidden" value="" />
                    <input name="selectedClass" id="selectedClass" type="hidden" value="" />
                    <input name="addParent" id="addParent" type="button"  onclick="addParent();" style="display:none;" class="btn btn-primary conformdel"  value="<?php echo @ADD_EXPENSES;?>
"/>&nbsp;&nbsp;
                    <input name="addExpense" id="addExpense" type="button" onclick="addExpense();" style="display:none;" class="btn btn-primary" value="<?php echo @ADD_EXPENSES;?>
"  />
                    <!------------    Start  expensesTypeformDiv  --------------------------->
                    <div id="expensesTypeformDiv" style="display:none">

                    </div>
                    <!------------    End  expensesTypeformDiv  --------------------------->

                    <div class="clearfix"></div>

                    <div id="expensesEdit"></div>
                    <div class="clearfix"></div>

                    <!------------    Start  expensesformDiv  --------------------------->
                    <div id="expensesformDiv" >
                        <form  action="expensesController.php?do=add"  method="post" class=" form-horizontal" id="submitnew" name="myExpenseForm" enctype="multipart/form-data">


                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo @EXPENSES_PAYMENT_METHOD;?>
</label>
                                <div class="col-lg-4">
                                    <div class="radio-inline">
                                        <label>
                                            <input value="0"  name="paymethod" id="PMSave" class="PMethod" checked="checked"   type="radio" />

                                            <?php echo @EXPENSES_SAFE;?>
 </label>
                                    </div>
                                    <div class="radio-inline">
                                        <label>
                                            <input value="1" name="paymethod" id="PMBank" class="PMethod" type="radio" />
                                            <?php echo @EXPENSES_BANK;?>
 </label>
                                    </div>

                                </div>
                            </div>
                          
                            
                              <div id="save-div">

                                 <?php if ($_smarty_tpl->tpl_vars['searchinonesave']->value==1){?>
                                <input type="hidden" name="saveid" id="saveid" value="<?php echo $_smarty_tpl->tpl_vars['allSave']->value;?>
" />
                                <?php }else{ ?>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_SAFE;?>
</label>
                                    <div class="col-lg-4">
                                        <select name="saveid" id="saveid" class="select2">
                                            <option value="-1"><?php echo @EXPENSES_CHOOSE_SAFE;?>
</option>
                                            <?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;?>
" <?php if ($_smarty_tpl->tpl_vars['saveid']->value==$_smarty_tpl->tpl_vars['data']->value->saveid){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                                <?php }?>

                                <!-- <?php if ($_smarty_tpl->tpl_vars['userData']->value->searchinonesave==0){?>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_SAFE;?>
</label>
                                    <div class="col-lg-4">
                                        <span id="spryselect3">
                                            <select name="saveid"  id="saveid" class="select2">
                                                <option value="-1"><?php echo @EXPENSES_CHOOSE_SAFE;?>
</option>
                                                <?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;?>
" <?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;?>
</option>
                                                <?php } ?>
                                            </select>
                                            <span class="selectInvalidMsg"><?php echo @EXPENSES_CHOOSE_SAFE;?>
</span></span>
                                    </div>
                                </div>
                                <?php }else{ ?>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_SAFE;?>
</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 }?>
                                        <input type="hidden" name="saveid" id="saveid" value="<?php echo $_smarty_tpl->tpl_vars['userData']->value->saveid;?>
"/>
                                        <?php } ?>
                                    </div>
                                </div>
                                <?php }?> -->

                            </div>

                            <div id="bank-div" style="display: none">
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_ELBANK;?>
</label>
                                    <div class="col-lg-4">
                                        <span id="spryselect4">
                                            <select name="bankid"  id="bankid" class="select2">
                                                <option value="-1"><?php echo @EXPENSES_CHOOSE_ELBANK;?>
</option>
                                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_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['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->bankid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->bankname;?>
</option>
                                                <?php } ?>
                                            </select>
                                            <span class="selectInvalidMsg"><?php echo @EXPENSES_CHOOSE_ELBANK;?>
</span></span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_ACCOUNT;?>
</label>
                                    <div class="col-lg-4">
                                        <span id="spryselect5">
                                            <select name="bankaccountid"  id="bankaccountid" class="">

                                            </select>
                                            <span class="selectInvalidMsg"><?php echo @EXPENSES_CHOOSE_ACCOUNT;?>
</span></span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_CHECK_NUMBER;?>
</label>
                                    <div class="col-lg-4">
                                        <span id="sprytextfield3">
                                            <input name="checkNo" id="checkNo" type="text"   class="form-control" />
                                            <span class="textfieldRequiredMsg">*</span></span>
                                    </div>
                                </div>
                            </div>



                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE;?>
</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expensetype"  class="wdt100" id="expensetype" data-placeholder="<?php echo @EXPENSES_CHOOSE_TYPE;?>
 " />
                                </div>
                            </div>

                          <!--   <div class="form-group"   >
                                <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE;?>
</label>
                                <div class="col-lg-4">
                                    <select class="select2 wdt100" required="" data-placeholder="<?php echo @EXPENSES_CHOOSE_TYPE;?>
"  name="expensetype" id="expensetype" >
                                        <option value=""></option>
                                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allParents']->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->expensestypeid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->expensestypename;?>
</option>
                                        <?php } ?>
                                    </select>
                                    <div id="expensetypeError" style="display:none;"></div>
                                </div>
                            </div> -->
                            <div class="form-group"   <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesproduct==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                                <label class="col-lg-2 control-label"><?php echo @EXPENSES_PRODUCTS;?>
</label>
                                <div class="col-lg-4">
                                    <input type="hidden" name="searchvalue" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->searchvalue;?>
"/>
                                    <input type="text" name="productid" id="productid" class="select2product wdt100 clas_offerproduct" data-itr='1'  data-placeholder="<?php echo @EXPENSES_CHOOSE_PRODUCT;?>
" tabindex="301"/>
                                </div>
                            </div>
                            <div  <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter!=0&&$_smarty_tpl->tpl_vars['Programsettingdata']->value->realestatedev!=0){?> style="display:none" <?php }?>>
                                <div class="form-group"   >
                                    <label class="col-lg-2 control-label"><?php echo @EXPENSES_COST_CENTER;?>
</label>
                                    <div class="col-lg-4">
                                        <select class="select2 wdt100" name="Costcenterid" id="Costcenterid" >
                                            <option value="-1"><?php echo @EXPENSES_CHOOSE_COST_CENTER;?>
</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 echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            

                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_NAME;?>
</label>
                                <div class="col-lg-4">
                                    <!--<input type="text" name="expensesname" id="expensesname"   ocnhange="checkExpenseName(this.value);"class="form-control" placeholder="إسم المصروف">-->
                                    <input type="text" name="expensesname" id="expensesname" class="form-control" placeholder="<?php echo @EXPENSES_NAME;?>
" required="">

                                    <div id="nameError" style="display:none;"></div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_VALUE;?>
</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expensevalue" id="expensevalue"   class="form-control positivefloat calcExpensevalueAfterTax"  placeholder="<?php echo @EXPENSES_VALUE;?>
">
                                    <div id="valueError" style="display:none;"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label">يوجد قيمة مضافة</label>
                                <div class="col-lg-4">
                                    <input type="hidden" id="vatValue_Setting_h" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->vatValue;?>
">
                                    <input type="checkbox" name="taxExist" class="calcExpensevalueAfterTax" id="taxExist" value="1">
                                </div>
                            </div>
                            <div class="form-group vatDiv" style="display: none">
                                <label for="inputEmail1" class="col-lg-2 control-label">  ضريبه القيمة المضافة</label>
                                <div class="col-lg-4">
                                    <div class="input-group">
                                        <input type="text" name="tax" class="form-control numberinput positiveNo calcExpensevalueAfterTax" id="tax" value="0">
                                        <span class="input-group-addon">%</span>
                                    </div>
                                    <div class="input-group" style="padding-top: 1px;">
                                        <input type="text" name="taxVal" class="form-control numberinput positivefloat" id="taxVal" value="0" readonly="">
                                        <span class="input-group-addon">جنيه</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group vatDiv" style="display: none">
                                <label for="inputEmail1" class="col-lg-2 control-label">قيمة المصروف بعد الضريبة</label>
                                <div class="col-lg-4">
                                    <div class="input-group" style="padding-top: 1px;">
                                        <input type="text" name="expensevalueAfterTax" id="expensevalueAfterTax"   class="form-control positivefloat"  value="0" readonly="">
                                        <span class="input-group-addon">جنيه</span>
                                    </div>
                                </div>
                            </div>

                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesupplier==1){?>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">المورد</label>
                                <div class="col-lg-4">
                                    <select class="select2 wdt100" name="supplier" id="supplier" >
                                        <option value="0"></option>
                                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['suppliersData']->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->supplierid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->suppliername;?>
</option>
                                        <?php } ?>
                                    </select>
                                    <div id="supplierError" style="display:none;"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label">المتبقى على المورد</label>
                                <div class="col-lg-4">
                                    <input type="text" name="suppRemainingVal" id="suppRemainingVal"   class="form-control positivefloat">
                                    <div id="valueError" style="display:none;"></div>
                                </div>
                            </div>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->specialexpenses==0){?>
                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_NUMBER;?>
</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expensenumbrt" id="expensenumbrt"   class="form-control positivefloat"  placeholder="<?php echo @EXPENSES_NUMBER;?>
">
                                    <div id="valueError" style="display:none;"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_PRICE;?>
</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expenseprice" id="expenseprice"   class="form-control positivefloat"  placeholder="<?php echo @EXPENSES_PRICE;?>
">
                                    <div id="valueError" style="display:none;"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_TOTALN;?>
</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expensetotaln" id="expensetotaln"  readonly class="form-control positivefloat"  placeholder="<?php echo @EXPENSES_TOTALN;?>
">
                                    <div id="valueError" style="display:none;"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_SHORTFALLS;?>
</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expenseshortfalls"  id="expenseshortfalls"   class="form-control positivefloat"  placeholder="<?php echo @EXPENSES_SHORTFALLS;?>
">
                                    <div id="valueError" style="display:none;"></div>
                                </div>
                            </div>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientsell==1){?>
                            <div class="form-group">
                                <label for="txtName" class="col-lg-2 control-label">العملاء</label>
                                <div class="col-lg-4">
                                    <input type="text" name="clientid" class="wdt100" id="select2client" data-placeholder="اختر " />
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="txtName" class="col-lg-2 control-label">الفواتير </label>
                                <div class="col-lg-4">
                                    <input type="text" name="sellbillid" class="wdt100" id="select2sellbill" data-placeholder="اختر " />
                                </div>
                            </div>
                            <?php }?>

                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->realestateunits==1){?>
                            <div class="form-group">
                                <label for="txtName" class="col-lg-2 control-label">العقارات</label>
                                <div class="col-lg-4">
                                    <input type="text" name="realestateid" class="wdt100" id="select2realestates" data-placeholder="اختر " />
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="txtName" class="col-lg-2 control-label">الوحدات </label>
                                <div class="col-lg-4">
                                    <input type="text" name="realestateunitid" class="wdt100" id="select2realestatesunits" data-placeholder="اختر " />
                                </div>
                            </div>
                            <?php }?>



                            <div class="form-group">
                                <label for="inputEmail1" class="col-lg-2 control-label"><?php echo @EXPENSES_COMMENT;?>
</label>
                                <div class="col-lg-4">
                                    <textarea name="expensecomment" class="form-control "></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">الملف</label>
                                <div class="col-lg-4">
                                    <input type="file" name="file" id="file"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-4">
                                    <input type="button" id="" name="ss" class="btn btn-primary pull-left submitnew" value="<?php echo @EXPENSES_SAVE;?>
"/>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!------------    End  expensesformDiv  --------------------------->
                    <div class="clearfix"></div>

                </div><!----col-lg-8-->
                <div class="clearfix"></div>


                <!-- Modal -->
                <div class="modal fade" id="catModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content bg-modal">
                            <div class="modal-header">
                                <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4 class="modal-title"><?php echo @EXPENSES_ADD_TYPE;?>
</h4>
                            </div>
                            <div class="modal-body">

                                <form class="nameToBeChecked2 form-horizontal" action="expensesControllerajex.php?do=addCat"  id="catForm" name="catForm" method="post" enctype="multipart/form-data">


                                    <input name="parent" id="parent" type="hidden" value="" />
                                    <div class="form-group">
                                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE_NAME;?>
</label>
                                        <div class="col-lg-4">
                                            <input type="text" name="name" id="name" required="required" class="form-control" />
                                            <div id="nameError" class="alert alert-block alert-danger fade in" style="display:none">
                                                <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                                                <h4><?php echo @EXPENSES_WRONG_MESSAGE;?>
</h4>
                                                <p><?php echo @EXPENSES_NAME_ALREADY_TAKEN;?>
</p>
                                                <div class="clearfix"></div>
                                            </div>
                                        </div>
                                    </div>

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

                                    <div class="form-group">
                                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_OTHER_DETAILS;?>
</label>
                                        <div class="col-lg-4">

                                            <textarea   name="descripe" id="descripe" class="form-control" cols="45" rows="5" ></textarea>
                                        </div>
                                    </div>

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

                                    <div class="form-group">
                                        <div class="col-lg-offset-2 col-lg-4">
                                            
                                            <input type="button"  id="ww" name="ww" class="btn btn-primary pull-left" value="{$smarty.const.EXPENSES_ADD}" onclick="if (Spry.Widget.Form.validate(this)) {
                                                        checkCatName(event, 'expensestype', 'name');
                                                        return true;
                                                    } else {
                                                        return false;
                                                    }"/>
                                            
                                            <!--validate the form before checking name-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <!--              <button type="reset" class="btn btn-default" data-dismiss="modal">اغلاق</button>
                                -->              <!--<button type="submit" class="btn btn-primary savemodel">حفظ</button>-->
                            </div>
                        </div>

                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
            <!--------=====================================================================---->

        </div>
        <div class="clearfix"></div>
    </div>
</div>


<script type="text/javascript">
    var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
    var spryselect4 = '';
    var spryselect5 = '';
    var sprytextfield3 = '';

    $(".PMethod").live('change', function () {
        var whatis = $(this).val();
        if (whatis == 0) {
            $('#save-div').show();
            $('#bank-div').hide();
            spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
            spryselect4.destroy();
            spryselect5.destroy();
            sprytextfield3.destroy();
        } else if (whatis == 1) {
            $('#save-div').hide();
            $('#bank-div').show();
            spryselect3.destroy();
            spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {invalidValue: "-1", isRequired: false});
            spryselect5 = new Spry.Widget.ValidationSelect("spryselect5");
            sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
        }

    });
    $("#bankid").live('change', function () {
        var id = $(this).val();
        $.post("projectControllerAjax.php?do=getbankaccount", {id: id}, function (data) {
            $("#bankaccountid").html(data);
        });
    });

</script>
<script type="text/javascript">

    $(document).ready(function () {


        var formatResult;
        formatResult = function (data) {
            return  data.text;
        }


        $("#expensetype").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "expensesControllerajex.php?do=expensetypesave",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    var saveid = Number($('#saveid').val());
                    if (!saveid) {
                        alert('يجب اختيار الخزنه اولا');
                        return false;
                    }
                    return {
                        searchTerm: term,
                        saveid: saveid,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });


        $("#select2client").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "executors.php?do=select2client",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        searchTerm: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });



        $("#select2realestates").select2({
            placeholder: "العقار",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "realestateunits.php?do=select2realestates",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    $('#select2realestatesunits').val("").trigger("change");
                    return {
                        searchTerm: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });



        $("#select2realestatesunits").select2({
            placeholder: "الوحده",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "realestateunits.php?do=select2realestatesunits",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    var select2realestates = Number($('#select2realestates').val());
                    if (!select2realestates) {
                        alert('يجب اختيار العقار اولا');
                        return false;
                    }
                    return {
                        searchTerm: term,
                        realestateid: select2realestates,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });



        $('body').on('change', '#select2realestates', function () {
            var id = $(this).val();
            var thisinput = $(this);
            $.post('realestateunits.php?do=getexpenstype', {id: id}, function (result) {
                if (result) {
                    $('#expensetype').val(result.trim()).trigger('change');
                }
            });

        });




        $("#select2sellbill").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "executors.php?do=select2sellbill",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    var select2client = Number($('#select2client').val());
                    if (!select2client) {
                        alert('يجب اختيار العميل اولا');
                        return false;
                    }
                    return {
                        searchTerm: term,
                        clientid: select2client,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });

        $("#expenseprice,#expensenumbrt").live('change', function () {
            var expensenumbrt = $('#expensenumbrt').val();
            var expenseprice = $('#expenseprice').val();
            $('#expensetotaln').val(expensenumbrt * expenseprice);
        });

        $(".positiveNo").forcepositiveNum();
        var formatResult;
        formatResult = function (data) {

            return  data.text;
        }
        $("#productid").select2({
            placeholder: "إسم المنتج",
            width: '100%',
            minimumInputLength: document.getElementById("searchvalue").value,
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "sellbillAjaxController.php?do=getProductsexpenses",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        term: term, //search term
                        page_limit: 10,

                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });

    });
</script>
<?php }} ?>