
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">ادراه الموظفين</a></li>
            <li><a href="#">الخصومات والمسحوبات</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  method="post" action="?do=add"  class="nameToBeChecked form-horizontal" id="myEmpPersonalForm" >



                    <div class="form-group">
                        <label class="col-lg-2 control-label">اسم الموظف</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <select name="empName"  id="employeeId" class="select2"  onchange="getdeptbefor();">
                                    <option value="-1">اختر </option>
                                    {foreach $allemp as $emp}

                                    <option value="{$emp->employeeId}">{$emp->employeeName}</option>
                                    {/foreach}
                                </select>
                                <span class="selectInvalidMsg">اختر موظف</span></span>

                        </div>
                    </div>



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

                    <div class="form-group" id="empValueDiv">
                        <label class="col-lg-2 control-label">قيمه المبلغ</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield1">
                                <input name="empValue" type="text"   class="form-control" />
                                <span class="textfieldRequiredMsg">*</span></span>

                        </div>
                    </div>




                    <div class="form-group">
                        <label class="col-lg-2 control-label">التاريخ</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield2">
                                <!--<input name="employeepersonneldate" type="text"   value="{$today}"  class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd H:i:s" />-->
                                <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="{$today}" name="employeepersonneldate" id="bn" data-link-field="dtp_input1">
                                    <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>
                                <span class="textfieldRequiredMsg">***.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
                        </div>
                    </div>
                    <!---------------============================---------------->




                    <div class="form-group">
                        <label class="col-lg-2 control-label">نوع العمليه</label>
                        <div class="col-lg-4">
                            <span id="spryselect2">
                                <select name="type"  id="type" class="form-control" onchange="getdeptbefor();" >
                                    <option value="-1">اختر نوع</option>
                                    <option value="1">مكافأة</option>
                                    <option value="2">خصم</option>
                                    <option value="3">سحب</option>
                                    <option value="4">سلفه</option>
                                    <option value="5">تأخير</option>
                                    <option value="6">سداد سلفه مباشره</option>
                                    <option value="7">سداد سلفه من المرتب</option>
                                    <option value="8">تعديل الدين</option>
                                    <option value="9">غياب</option>
                                    <option value="10">قبض</option>
                                    <option value="11">استئذان</option>
                                    <option value="12">جزاء فنى</option>
                                    <option value="13">وقت اضافى</option>
                                    <option value="14">انصراف</option>
                                </select>
                                <span class="selectInvalidMsg">اختر نوع العملية</span></span>

                        </div>
                    </div>

                    <div  {if $Programsettingdata->costcenter eq 0} {else} style="display:none" {/if}>
                        <div class="form-group"   id="costdiv" style="display:none">
                            <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>
                                    {foreach $allCostcenter as $myallCostcenter}



                                    <option value="{$myallCostcenter->id}">{$myallCostcenter->name}</option>

                                    {/foreach}


                                </select>


                            </div>
                        </div>

                    </div>

                    <div id="mydiv" style="display:none" >

                        <div class="form-group">
                            <label class="col-lg-2 control-label">الدين القديم</label>
                            <div class="col-lg-4">
                                <input  type="text" name="deptbefor"   readonly="readonly" class="form-control" id="deptbefor" />

                            </div>
                        </div>

                    </div>
                    <div id="mydiv2" style="display:none" >

                        <div class="form-group">
                            <label class="col-lg-2 control-label">صافى المرتب</label>
                            <div class="col-lg-4">
                                <input  type="text" name="netSalary"   readonly="readonly" class="form-control" id="netSalary" />

                            </div>
                        </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">تفاصيل اخرى</label>
                        <div class="col-lg-4">
                            <textarea name="desc" cols=""  class="form-control"  rows="">&nbsp;</textarea>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">طريقة الدفع</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0"  name="paymethod" id="PMSave" class="PMethod" checked="checked"   type="radio" />

                                    خزنة </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" name="paymethod" id="PMBank" class="PMethod" type="radio" />
                                    بنك </label>
                            </div>

                        </div>
                    </div>
                    <div id="save-div">
                        {if $userData->searchinonesave eq 0}
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الخزنة</label>
                            <div class="col-lg-4">
                                <span id="spryselect3">
                                    <select name="saveid"  id="saveid" class="form-control">
                                        <option value="-1">اختر الخزنة</option>
                                        {foreach $save as $data}
                                        <option value="{$data->saveid}" {if $userData->saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                        {/foreach}
                                    </select>
                                    <span class="selectInvalidMsg">اختر الخزنة</span></span>
                            </div>
                        </div>
                        {else}
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الخزنة</label>
                            <div class="col-lg-4">
                                <span id="spryselect3">
                                    <select name="saveid"  id="saveid" class="form-control">
                                        <option value="-1">اختر الخزنة</option>
                                        {foreach $save as $data}
                                        {if $userData->saveid == $data->saveid}
                                        <option value="{$data->saveid}" selected>{$data->savename}</option>
                                        {/if}
                                        {/foreach}
                                    </select>
                                    <span class="selectInvalidMsg">اختر الخزنة</span></span>
                            </div>
                        </div>
                        {/if}


                    </div>
                    <div id="bank-div" style="display: none">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">البنك</label>
                            <div class="col-lg-4">
                                <span id="spryselect4">
                                    <select name="bankid"  id="bankid" class="form-control">
                                        <option value="-1">اختر البنك</option>
                                        {foreach $bank as $data}
                                        <option value="{$data->bankid}">{$data->bankname}</option>
                                        {/foreach}
                                    </select>
                                    <span class="selectInvalidMsg">اختر البنك</span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الحساب</label>
                            <div class="col-lg-4">
                                <span id="spryselect5">
                                    <select name="bankaccountid"  id="bankaccountid" class="form-control">

                                    </select>
                                    <span class="selectInvalidMsg">اختر الحساب</span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">رقم الشيك</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">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button" class="btn btn-primary pull-left submitbtn" data-print="0">حفظ</button>
                            <button type="button" class="btn btn-primary pull-left submitbtn" data-print="1" style="margin-left: 5px;">حفظ و طباعة</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1", isRequired: false});
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue: "-1", isRequired: false});
    var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
    var spryselect4 = '';
    var spryselect5 = '';
    var sprytextfield3 = '';
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "date", {format: "yyyy-mm-dd H:i:s"});



    $("#type").live('change', function () {
        if ($(this).val() == "10") {
            sprytextfield1.destroy();
        } else {
            sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
        }

    });
    $(".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>
{/literal}
