<script>
    $(document).ready(function (e) {

        $("#challredio").change(function () {
            if ($(this).is(':checked')) {
                // alert(1);
                document.getElementById("Hourlyrate").value = 0;
                //	$(".radioR").prop("checked", true);
            }
            else {

                // alert(0);
                /*$(".radioR").prop("checked", false);
                 $(".noradioR").prop("checked", true);*/
            }
        });
        $('.calcCost').live('keyup', function () {
            //
            var empSalary = Number($("#empSalary").val());
            var houseAllowance = Number($("#houseAllowance").val());
            var transportationAllowance = Number($("#transportationAllowance").val());
            //
            var noOfWorkDaysPerMonth = Number($("#noOfWorkDaysPerMonth").val());
            var noOfWorkHoursDaysPerDay = Number($("#noOfWorkHoursDaysPerDay").val());
            var noOfDistountDaysWhenAbsences = Number($("#noOfDistountDaysWhenAbsences").val());
            //##
            var Bsat = empSalary + houseAllowance + transportationAllowance;
            var makam1 = noOfWorkDaysPerMonth * noOfWorkHoursDaysPerDay * 60;
            var makam2 = noOfWorkDaysPerMonth * noOfDistountDaysWhenAbsences;

            var miniteLateCost = 0;
            if (makam1 != 0) {
                miniteLateCost = (Bsat / makam1).toFixed(3);
            }
            var dayAbsenseCost = 0;
            if (makam2 != 0) {
                dayAbsenseCost = (Bsat / makam2).toFixed(3);
            }
            $('#miniteLateCost').html(miniteLateCost);
            $('#dayAbsenseCost').html(dayAbsenseCost);
        });
    });


</script>
<script src="{$path}/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="{$path}/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />

<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <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>
                <a href="{$youtubes[176]->url}" target="_blank" class="hidden-print"><img
                        src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube"
                        style="width: 2%;"></a>
            </div>
            <div class="panel-body">

                <!-- end box / title -->

                <form class="form-inline hidden-print" method="post" action="marchSalaReport.php?do=show">
                    <!-- id="search_Me">-->
                    <div style="margin-right: 20px;" class="row">
                        <div class="col-lg-2 form-group">
                            <label class="sr-only"> اسم الموظف</label>
                            <select class="select2" name="chooseEmp" id="chooseEmp">
                                <option value="-1">اختر موظف</option>
                                {foreach $allemployee as $data}
                                {if $empid eq $data->employeeId}
                                <option value="{$data->employeeId}" selected="selected">{$data->employeeName}</option>
                                {else}
                                <option value="{$data->employeeId}">{$data->employeeName}</option>

                                {/if}
                                {/foreach}
                            </select>
                        </div>
                        <div class="form-group col-lg-2">
                            <label class="sr-only">من التاريخ</label>
                            <input type="text" class="form-control awdatepicker" autocomplete="off"
                                data-date-format="yyyy-mm-dd" name="fromdate" value="{$fromdate}">
                        </div>
                        <div class="form-group col-lg-2">
                            <label class="sr-only">إلى التاريخ</label>
                            <input type="text" class="form-control awdatepicker" autocomplete="off"
                                data-date-format="yyyy-mm-dd" name="todate" value="{$todate}">
                        </div>
                        <div class="form-group col-lg-2">
                            <input type="submit" class="btn btn-primary" style="margin-top: 15px;" value="بحث" />
                        </div>
                    </div>

                </form>

                <hr />

                <form method="post" action="?do=editprint" class="nameToBeChecked form-horizontal"
                    enctype="multipart/form-data">

                    <input type="hidden" name="emplId" value="{$empid}" />
                    <input type="hidden" name="fromdate" value="{$fromdate}" />
                    <input type="hidden" name="todate" value="{$todate}" />

                    <div class="col-lg-6">
                        <div style="margin-right: 195px;font-size: 19px;font-weight: bold;color: orangered;margin-bottom: 12px;"
                            class="form-group">
                            <span>الايرادات</span>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label"> المرتب الاساسى </label>
                            <div class="col-lg-8">
                                <span id="sprytextfield2">
                                    <input name="empSalary" readonly="readonly" value="{$employeeData->employeeSalary}"
                                        id="empSalary" type="text" class="form-control" />
                            </div>
                        </div>

                        <!--                         <div class="form-group">
                                                    <label class="col-lg-4 control-label"> الحوافز </label>
                                                    <div class="col-lg-8">
                                                        <span id="sprytextfield2">
                                                            <input name="incentives" readonly="readonly"   id="incentives" type="text"  class="form-control" />
                                                    </div>
                                                </div>-->

                        <div class="form-group">
                            <label class="col-lg-4 control-label"> المكافأت </label>
                            <div class="col-lg-8">
                                <span id="sprytextfield2">
                                    <input name="bonuses" readonly="readonly" value="{$salary[0]}" id="bonuses"
                                        type="text" class="form-control" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label">بدل سكن </label>
                            <div class="col-lg-8">
                                <input name="houseAllowance" readonly="readonly" value="{$employeeData->houseAllowance}"
                                    id="houseAllowance" type="text" value="" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label">دفع السلف </label>
                            <div class="col-lg-8">
                                <input name="payAdvances" readonly="readonly" value="{$salary[5]}" id="payAdvances"
                                    type="text" value="" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label">بدل مواصلات </label>
                            <div class="col-lg-8">
                                <input name="transportationAllowance" readonly="readonly"
                                    value="{$employeeData->transportationAllowance}" id="transportationAllowance"
                                    type="text" value="" class="form-control calcCost" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-4 control-label">بدلات اخرى{$employeeData->otherAllowance}</label>
                            <div class="col-lg-8">
                                <input name="otherAllowance" type="text" readonly="readonly" id="otherAllowance"
                                    value="{$employeeData->otherAllowance}" class="form-control" />
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6">

                        <div style="margin-right: 195px;font-size: 19px;font-weight: bold;color: orangered;margin-bottom: 12px;"
                            class="form-group">
                            <span>الخصومات</span>
                        </div>


                        <div class="form-group">
                            <label class="col-lg-4 control-label"> الغياب - تأخير </label>
                            <div class="col-lg-8">
                                <input name="absence_delay" readonly="readonly" value="{$salary[4]}" id="absence_delay"
                                    type="text" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label">الخصومات</label>
                            <div class="col-lg-8">
                                <input name="discounts" readonly="readonly" value="{$salary[1]}" id="discounts"
                                    type="text" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label">المسحوبات </label>
                            <div class="col-lg-8">
                                <input name="withdrawals" readonly="readonly" value="{$salary[2]}" id="withdrawals"
                                    type="text" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label">السلف </label>
                            <div class="col-lg-8">
                                <input name="predecessor" readonly="readonly" value="{$salary[3]}" id="predecessor"
                                    type="text" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label"> الاستئذان </label>
                            <div class="col-lg-8">
                                <input name="permission" readonly="readonly" value="{$salary[6]}" id="permission"
                                    type="text" class="form-control calcCost" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-4 control-label"> الانصراف </label>
                            <div class="col-lg-8">
                                <input name="leave" readonly="readonly" value="{$salary[7]}" id="leave"
                                    type="text" class="form-control calcCost" />
                            </div>
                        </div>


                    </div>


                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">

                            <h4 class="text-center">صافى الراتب <span id="miniteLateCost">0</span> {$currency}</h4>

                        </div>

                    </div>


                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-8">
                            <button type="submit" class="btn btn-primary pull-left">طباعة</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "real");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", { isRequired: false, invalidValue: "0" });
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");

</script>
{/literal}