
var layer_index;
function addUser(title, id) {
    $("#jswintitle").html(title);
    layer_index = layer.open({
        type: 1,
        title: false,
        closeBtn: 0,
        shift: false,
        content: $("#jsAddUser"),
    });
    $("#id").val(id);
}

//关闭弹出
function cansleAdd() {
    layer.close(layer_index);
    clearWin();
}
//清除窗体中内容
function clearWin() {
    $("#jsAddUser").find("input").each(function () {
        $(this).val("");
    });
}


function checkSubmit() {
    if ($("#act").val() == "") {
        layer.msg("页面错误！", {
            icon: 2, btn: ['确定']
        }, function () {
        });
        return false;
    }
    else if ($("#id").val() == "") {
        layer.msg("页面错误id！", {
            icon: 2, btn: ['确定']
        }, function () {
        });
        return false;
    }
    else if ($("#fvhpmc").val() == "") {
        layer.msg("请选择货品名称", {
            icon: 2, btn: ['确定']
        }, function () {
            $("#fvhpmc").focus();
        });
        return false;
    }
    else if (!(/(^[1-9]\d*$)/.test($("#firksl").val()))) {
        layer.msg("数量必为正整数", {
            icon: 2, btn: ['确定']
        }, function () {
            $("#firksl").select();
            $("#firksl").focus();
        });
        return false;
    }
    else if ((!(/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test($("#fdjhjz").val())))) {
        layer.msg("进价必为货币型", {
            icon: 2, btn: ['确定']
        }, function () {
            $("#fdjhjz").select();
            $("#fdjhjz").focus();
        });
        return false;
    }
    else if (isDate($("#ftyxrq").val(), "yyyy-MM-dd") == false) {
        layer.msg("有效期必为日期", {
            icon: 2, btn: ['确定']
        }, function () {
            $("#ftyxrq").select();
            $("#ftyxrq").focus();
        });
        return false;
    }
    else if ($("#fvbzsm").val() == "") {
        layer.msg("备注说明不能为空（可写无）", {
            icon: 2, btn: ['确定']
        }, function () {
            $("#fvbzsm").select();
            $("#fvbzsm").focus();
        });
        return false;
    }
    else
        var1 = "beduajax.aspx?act=" + $("#act").val() + "&id=" + $("#id").val() + "&fizrst=" + $("#fizrst").val() + "&fvhpmc=" + $("#fvhpmc").val() + "&firksl=" + $("#firksl").val() + "&fdjhjz=" + $("#fdjhjz").val() + "&ftyxrq=" + FormatDate($("#ftyxrq").val()) + "&fvbzsm=" + $("#fvbzsm").val();
    XSENDAJAX(var1);
}

//发送AJAX
function Zsend(var1) {
    temptext = var1;
    layer.msg(temptext, { icon: 1, btn: ['确定'] }, function () {
        if (temptext.indexOf("成功") > -1) {
            window.location.reload();
        }
        return true;
    });
}

function ZALLRZ()
{// 全部记录
    window.location.href = "erkcz.aspx";
}

function ZJLCX()
{// 条件查询
    var fvrkbm1 = "";
    var fvrkbm2 = "";
    var fvcode = "";
    var fvhplb = "";
    var fvghsm = "";
    var fvscsm = "";
    var firkid = "";
    if ($("#fvcode2").val() != "")
    { fvcode = $("#fvcode2").val(); }
    if ($("#firkid2").val() != "")
    { firkid = $("#firkid2").val(); }
    if ($("#fvhplb2").val() != "")
    { fvhplb = $("#fvhplb2").val(); }
    if ($("#fvghsm2").val() != "")
    { fvghsm = $("#fvghsm2").val(); }
    if ($("#fvscsm2").val() != "")
    { fvscsm = $("#fvscsm2").val(); }
    if ($("#fvscsm2").val() != "")
    { fvscsm = $("#fvscsm2").val(); }
    if ($("#fvrkbm1").val() != "")
    { fvrkbm1 = FormatDate($("#fvrkbm1").val()); }
    if ($("#fvrkbm2").val() != "")
    { fvrkbm2 = FormatDate($("#fvrkbm2").val()); }
window.location.href = "erkcz.aspx?fvcode=" + fvcode + "&fvhplb=" + fvhplb + "&fvghsm=" + fvghsm + "&firkid=" + firkid + "&fvscsm=" + fvscsm + "&fvrkbm1=" + fvrkbm1 + "&fvrkbm2=" + fvrkbm2;
}

function NODELE() {
    layer.msg("此货品已有出库，不得删除", { icon: 1, btn: ['确定'] }, function () {
        return true;
    });
}
function ZDELESELE(id6,id7) {
    layer.confirm('确认要删除吗？', {
        icon: 3, btn: ['确定', '取消'] //按钮
    }, function () {
        temp = ZQDdele(id6, id7);
    });
}

function ZQDdele(id6, id7) {//删除
    var1 = "beduajax.aspx?ACT=96EE73B8D11434D8A64D50AFAF2FD592&id6=" + id6 + "&id7=" + id7;
    var temptext = "";
    var1 = encodeURI((var1));
    $.ajax({
        type: "Post",
        url: var1,
        data: { data1: '13D17C93EDB', },
        cache: false,
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        success: function (temptext) {
            layer.msg(temptext, { icon: 1, btn: ['确定'] }, function () {
                if (temptext.indexOf("成功删除入库货品") > -1) {
                    window.location.reload();
                }
                return true;
            });
        }
    });
}


