

<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#"> صرف مصروف</a></li>
            <li><a href="expenseexchange.php?do=show">عرض صرف مصروف </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">
                <input type="hidden" name="expenseexchange" id="expenseexchange" value="1"/>
                <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                <input type="hidden" name="path" id="path" value="{$path}"/>

                {literal}
                <form class="nameToBeChecked form-horizontal" role="form" id="projectoperation_form" action="expenseexchange.php?do=add" method="post"  enctype="multipart/form-data"  >

                    {/literal}


                    <div class="row">
                        <div class="col-lg-8">
                            <div class="form-group">
                                <label class="col-lg-3 control-label">رقم التسلسل</label>
                                <div class="col-lg-4">
                                    <input type="text" name="serialno" id="serialno" class="form-control" placeholder="رقم التسلسل" value="{$serialno}" readonly="" >
                                </div>
                            </div>

                        </div>


                        <div class="col-lg-4">
                            <div class="form-group mg-bt5">
                                <label for="clientname" class="col-lg-4 control-label">اسم  المشروع</label>
                                <div class="col-lg-8">
                                    <input type="text" name="projectname" id="project_id"   class="select2product wdt100"  data-placeholder="اختر مشروع" required tabindex="301"/>
                                    <input type="hidden" id="edit_hiddenprojectId" name="edit_hiddenprojectId" value=""  />
                                    <input type="hidden" id="edit_hiddenprojectName" name="edit_hiddenprojectName" value=""  />
                                    <input type="hidden" name="supervision_type" id="supervision_type" value="2"/>
                                    <input type="hidden" name="supervision_amount" id="supervision_amount" value="0"/>

                                </div>
                            </div>
                            <!-- end of form-group-->

                        </div>

                        
                        <div class="col-lg-8">
                            <div class="form-group">
                                <label class="col-lg-3 control-label"> المورد </label>
                                <div class="col-lg-4">
                                    <select class="select2 wdt100" name="supplierid" id="supplierid" >
                                        {foreach $supplierData as $supplier}
                                        <option value="{$supplier->supplierid}">{$supplier->suppliername}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                        </div>


                        <div class="col-lg-4">
                            <div class="form-group mg-bt5" >
                                <label class="col-lg-4 control-label">التعليق   </label>
                                <div class="col-lg-8" id="commentproject">
                                </div>
                            </div>
                        </div>




                        <div class="col-lg-8">
                            <div class="form-group">
                                <label class="col-lg-3 control-label">صرف من</label>
                                <div class="col-lg-4">
                                    <div class="radio-inline">
                                        <label>
                                            <input value="0" class="expensefrom" name="expensefrom" type="radio" >

                                            خزينة  </label>
                                    </div>
                                    <div class="radio-inline">
                                        <label>
                                            <input value="1" class="expensefrom" name="expensefrom" type="radio">
                                            بنك </label>
                                    </div>
                                    <div class="radio-inline">
                                        <label>
                                            <input value="2" class="expensefrom" name="expensefrom" type="radio" checked="checked">
                                            أجل </label>
                                    </div>
                                </div>
                            </div>

                        </div>


                        <div class="col-lg-4">
                            <div class="form-group mg-bt5" >
                                <label class="col-lg-4 control-label">مركز التكلفة</label>
                                <div class="col-lg-8">
                                    <input type="text" class="form-control" value="" name="costcenterid" id="costcenterid" disabled>
                                </div>
                            </div>
                        </div>

                        <div class="col-lg-8">
                            <!--اختر خزنة-->
                           <!--  <div id="saveDiv">
                                <div class="form-group mg-bt5">
                                    <label class="col-lg-3 control-label">الخزنة</label>
                                    <div class="col-lg-4">
                                        <select class="select2 wdt100" name="saveid" id="saveid" required>
                                            <option value=""></option>
                                            {foreach $saves as $data}
                                            <option value="{$data->saveid}">{$data->savename}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div> -->

                            {if $searchinonesave == 1}
                            <input type="hidden" name="saveid" id="saveid" value="{$saves}" />
                            {else}
                            <div id="saveDiv" style="display: none">
                                <div class="form-group mg-bt5">
                                        <label class="col-lg-3 control-label">الخزنة</label>
                                    <div class="col-lg-4">
                                        <select name="saveid" id="saveid" class="select2 wdt100">
                                            <option value=""></option>
                                            {foreach $saves as $data}
                                            <option value="{$data->saveid}" {if $saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div>
                            {/if}

                            <!--اختر بنك-->
                            <div id="bankDiv" style="display: none">
                                <div class="form-group mg-bt5">
                                    <label class="col-lg-3 control-label">البنك</label>
                                    <div class="col-lg-4">
                                        <select class="select2 wdt100" name="bankid" id="bankid" required>
                                            <option value=""></option>
                                            {foreach $banks as $data}
                                            <option value="{$data->bankid}">{$data->bankname}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <!--اختر عهد-->
                            <!--div id="ohadDiv" style="display: none">
                                <div class="form-group mg-bt5">
                                    <label class="col-lg-3 control-label">العهد</label>
                                    <div class="col-lg-4">
                                        <select class="select2 wdt100" name="ohadid" id="ohadid" required>
                                            <option value=""></option>
                                            {foreach $binds as $data}
                                            <option value="{$data->id}">{$data->employeeid}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div-->
                        </div>

                        <div class="col-lg-4">
                            <div class="form-group">
                                <label class="col-lg-4 control-label">نوع المصروف</label>
                                <div class="col-lg-8">
                                    <input type="text" name="expensetype"  class="wdt100" id="expensetype" placeholder="اختر" />
                                </div>
                            </div>
                        </div>

                       <!--  <div class="col-lg-4">
                            <div class="form-group mg-bt5">
                                <label class="col-lg-4 control-label">نوع المصروف</label>
                                <div class="col-lg-8">
                                    <select class="select2 wdt100" name="expensetype" id="expensetype" required>
                                        <option value=""></option>
                                        {foreach $expenseType as $data}
                                        <option value="{$data->expensestypeid}">{$data->expensestypename}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>

                        </div> -->
                        <div class="col-lg-8">
                            <!--اختر حساب بنكى-->
                            <div id="bankaccountDiv" style="display: none">
                                <div class="form-group mg-bt5">
                                    <label class="col-lg-3 control-label">الحساب</label>
                                    <div class="col-lg-4">
                                        <select class="select2 wdt100" name="bankaccountid" id="bankaccountid" required>
                                            <option value=""></option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                       
                        <div class="col-lg-8">
                            <div class="form-group">
                                <label class="col-lg-3 control-label">القيمة</label>
                                <div class="col-lg-4">
                                    <input type="text" name="thevalue" id="thevalue" class="form-control expenseexchangevalue positiveNo" placeholder="القيمة" value="" required>
                                </div>
                            </div>

                        </div>

                        <div class="col-lg-4">
                            <div class="form-group" >
                                <label class="col-lg-4 control-label"> الاشراف</label>
                                <div class="col-lg-8">
                                    <input type="text" class="form-control positiveNo"  placeholder=" " required value="" name="finalsupervision" id="finalsupervision">
                                </div>
                            </div>


                        </div>

                        <div class="col-lg-8">
                            <div class="form-group" >
                                <label class="col-lg-3 control-label">تاريخ الصرف</label>
                                <div class="col-lg-4">
                                    <input type="text" class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd" placeholder="تاريخ الصرف" required value="{$today}" name="expensedate" id="expensedate">
                                </div>
                            </div>


                        </div>
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for="owner_name" class="col-lg-4 control-label">الصور</label>
                                <div class="col-lg-8">
                                    <input type="file" name="images[]" multiple="" class="form-control" />
                                </div>
                            </div>    
                        </div>



                        <div class="col-lg-12">
                            <div class="form-group" >
                                <label class="col-lg-2 control-label">التعليق </label>
                                <div class="col-lg-10">
                                    <textarea class="form-control" rows="2" name="expenseexcomment"></textarea>
                                </div>
                            </div>
                        </div>
                        
                    </div>


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

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <input type="submit"   id="offerprice_save" class="btn btn-primary pull-left" value="صرف">

                        </div>
                    </div>


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




    </div>
</div>



{literal}

<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);
            }
        });
    });    
  //  var name = new Spry.Widget.ValidationTextField("name");
 //var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
</script>

{/literal}

