<script>

</script>
<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" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;"> عرض المرتبات</h3>
                <a href="salaryReportController.php" class="hidden-print"><input type="button" id="submit"
                        class="btn btn-primary pull-left " value="إضافة جديد" /></a>
            </div>
            <div class="panel-body">
                <form action="?" method="post" class="form-inline hidden-print">

                    <table class="table table-black">


                        <tr>

                            <td><span style="float: right;font-size: 16px;font-weight: bold;">شهر</span></td>
                            <td colspan="2">
                                <div class="datepicker"><input type="text" name="from" id="from"
                                        value="{if !empty($salarymonthdate)}{$salarymonthdate}{else}{$today}{/if}"
                                        class="form-control awdatepicker" autocomplete="off" data-date-format="yyyy-mm">
                                </div>
                            </td>



                            <td align="center" colspan="5"><input name="" type="submit" value="بحث" style="width:80px;"
                                    type="button"></td>
                        </tr>
                        <tr {if $Programsettingdata->costcenter eq 0} {else} style="display:none" {/if}>
                            <td colspan="12"> <label class="col-lg-4 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>
                            </td>
                        </tr>
                </form>
                <form method="post" action="?do=Receipt" id="receiptFrm">
                    <tr>
                        <td colspan="2">نوع الصرف</td>
                        <td colspan="13">
                            <div class="col-lg-4">
                                <input type="radio" name="paytype" id="savePay" value="1" checked="checked" /> خزنة
                                <input type="radio" name="paytype" id="bankPay" value="2" /> بنك
                            </div>
                        </td>
                    </tr>
                    {if isset($userSave)}
                    <input type="hidden" name="saveid" value="{$userSave->saveid}" />
                    {else}
                    <tr>
                        <td colspan="15"> 
                            <div id="saveCls">
                                <label class="col-lg-4 control-label">الخزنة</label>
                                <div class="col-lg-4">
                                    <select class="select2 wdt100" name="saveid" id="saveid">
                                        {foreach $userSaves as $save}
                                        <option value="{$save->saveid}" {if $smarty.session.saveid eq $save->
                                            saveid}selected{/if}>{$save->savename}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div id="bankCls" style="display: none;">
                                <div class="form-group col-lg-12">
                                    <label class="col-lg-2 control-label">البنك</label>
                                    <div class="col-lg-4">
                                        <span id="spryselect4">
                                            <select name="bankid"  id="bankid" class="select2">
                                                <option value="-1">اختر البنك</option>
                                                {foreach $banks as $data}
                                                <option value="{$data.bankid}">{$data.bankname}</option>
                                                {/foreach}
                                            </select>
                                            <span class="selectInvalidMsg">اختر البنك</span></span>
                                    </div>
                                </div>
                                <div class="form-group col-lg-12">
                                    <label class="col-lg-2 control-label">الحساب</label>
                                    <div class="col-lg-4">
                                        <span id="spryselect5">
                                            <select name="bankaccountid"  id="bankaccountid" class="select2">

                                            </select>
                                            <span class="selectInvalidMsg">اختر الحساب</span></span>
                                    </div>
                                </div>
                                <div class="form-group col-lg-12">
                                    <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>
                        </td>
                    </tr>
                    {/if}
                    <tr>
                        <td>اختر</td>
                        <td>رقم الموظف</td>
                        <td>اسم الموظف </td>
                        <td>المرتب الاساسى</td>
                        <td>الحوافز</td>
                        <td>المكافاه - وقت اضافى</td>
                        <td>الخصومات</td>
                        <td>المسحوبات</td>

                        <td>الغياب - تأخير</td>
                        <td>استئذان</td>
                        <td>انصراف</td>
                        <td>دفع سلفه</td>
                        <td>صافي قبض الشهر الحالي</td>
                        <td>باقي القبض السابق</td>
                        <td>صافى المرتب</td>
                        <td>الدين الحالى</td>

                    </tr>



                    <input name="salarymonthdate" type="hidden" value="{$salarymonthdate}" />
                    {foreach $allEmpsalary as $emp}

                    <tr>
                        <td><input name="empid[]" type="checkbox" value="{$emp[0]}" /></td>

                        <td>{$emp[0]}</td>
                        <td>{$emp[1]}</td>
                        <td>{$emp[2]}</td>
                        <td>{$emp[3]}</td>
                        <td>{$emp[4]}</td>
                        <td>{$emp[5]}</td>
                        <td>{$emp[6]}</td>
                        <td>{$emp[7]}</td>
                        <td>{$emp[12]}</td>
                        <td>{$emp[13]}</td>
                        <td>{$emp[9]}</td>
                        <td>{$emp[14]}</td>
                        <td>{$emp[11]}</td>
                        <td>{$emp[8]}</td>
                        <td>{$emp[10]}</td>


                    </tr>

                    {/foreach}
                    <tr>
                        <td colspan="15" align="center"><input name="Receipt" value="قبض" style="width:80px;"
                                type="submit" id="receiptBtn" /></td>
                    </tr>
                    </table>




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



        {literal}
        <script>
            var spryselect4 = '';
            var spryselect5 = '';
            var sprytextfield3 = '';

            $(document).ready(function () {
                $('#bankPay').on('click', function () {
                    $('#bankCls').show();
                    $('#saveCls').hide();
                    spryselect3.destroy();
                    spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {invalidValue: "-1", isRequired: false});
                    spryselect5 = new Spry.Widget.ValidationSelect("spryselect5");
                    sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
                });
                $('#savePay').on('click', function () {
                    $('#saveCls').show();
                    $('#bankCls').hide();
                    spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
                    spryselect4.destroy();
                    spryselect5.destroy();
                    sprytextfield3.destroy();
                });
            });

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

            $('#receiptFrm').on('submit', function () {
                $('#receiptBtn').attr('disabled', 'disabled');
            });
        </script>
        {/literal}