$(function () {
    $(".amount").inputmask({ 'mask': "9{0,9}[.9{0,2}]", greedy: false });
});

function SaveBasicInfo() {
    ClearErrorMsg("tab_1");

    if (checkRequired('tab_1', 'error-msg') == false) {
        return;
    }

    if ($("#InsuranceBaseType").val() == "2") {
        if ($("#InsuranceBase").val() == "") {
            SetErrorMsg("请填写社会保险缴存基数值", 'tab_1');
            $("#InsuranceBase").addClass("redBorder");
            return;
        }
    }

    if ($("#HouseFundBaseType").val() == "2") {
        if ($("#HouseFundBase").val() == "") {
            SetErrorMsg("请填写公积金缴存基数值", 'tab_1');
            $("#HouseFundBase").addClass("redBorder");
            return;
        }
    }


    var data = {};

    data.YangLao1 = $("#YangLao1").val();
    data.YangLao2 = $("#YangLao2").val();
    data.Insurance13 = $("#Insurance13").val();
    data.Insurance14 = $("#Insurance14").val();

    data.YiLiao1 = $("#YiLiao1").val();
    data.YiLiao2 = $('#YiLiao2').val();
    data.Insurance23 = $("#Insurance23").val();
    data.Insurance24 = $('#Insurance24').val();

    data.ShengYu1 = $("#ShengYu1").val();
    data.ShengYu2 = $("#ShengYu2").val();
    data.Insurance33 = $("#Insurance33").val();
    data.Insurance34 = $("#Insurance34").val();

    data.GongShang1 = $("#GongShang1").val();
    data.GongShang2 = $("#GongShang2").val();
    data.Insurance43 = $("#Insurance43").val();
    data.Insurance44 = $("#Insurance44").val();

    data.ShiYe1 = $("#ShiYe1").val();
    data.ShiYe2 = $("#ShiYe2").val();
    data.Insurance53 = $("#Insurance53").val();
    data.Insurance54 = $("#Insurance54").val();

    data.HouseFund1 = $("#HouseFund1").val();
    data.HouseFund2 = $("#HouseFund2").val();
    data.HouseFund13 = $("#HouseFund13").val();
    data.HouseFund14 = $("#HouseFund14").val();



    if (!confirm("确定保存吗？")) {
        return;
    }

    $.ajax({
        url: "/HR/SaveSalaryBasicInfo",
        type: 'POST',
        cache: false,
        data: data,
        success: function (result) {

            if (result.code == 0) {
                SetInfoMsg("保存成功！");
            }
            else {
                SetErrorMsg("保存失败，请稍后再试", "tab_1");
            }

        },
        error: function (e) {
            etErrorMsg("保存失败，请稍后再试", "tab_1");
        }
    });



}
