/*************************
*功能：应收维护
*创建人：张振华
*时间：2010-08-16
*备注：
*************************/

//往弹出层里添加内容
function tableYsqcForm(strId) {

    //table对象
    var objTable = $("#" + strTableNameP060701);

    //列配置
    var objNames = objTable.jqGrid('getGridParam', "colNames");
    var objIndexs = objTable.jqGrid('getGridParam', "colModel");

    //客户，商品，职员，开票单位
    var objKh = getComboboxData('Tkhxx1');
    var objSp = getComboboxData('Tspxx');
    var objZy = getComboboxData('TZyxx');
    var objKpdw = getComboboxData('Tkpdwxx');

    objKh.push({ "dm": "-1", "mc": "<font color='red'>添加客户</font>" });
    objSp.push({ "dm": "-1", "mc": "<font color='red'>添加药品</font>" });
    objZy.push({ "dm": "-1", "mc": "<font color='red'>添加销售员</font>" });
    objKpdw.push({ "dm": "-1", "mc": "<font color='red'>添加开票单位</font>" });

    //其他变量
    var sign = "";
    var inputtype = "";
    var strForm = "";
    var strAppendTmp = "";

    //生成动态html
    strForm += "<ul>";
    for (var i = 1; i < objNames.length; i++) {
        if (objIndexs[i]["name"] == "c2" || objIndexs[i]["name"] == "kpsl" || objIndexs[i]["name"] == "b3" || objIndexs[i]["name"] == "b2" || objIndexs[i]["name"] == "id"
            || objIndexs[i]["name"] == "b1" || objIndexs[i]["name"] == "c1" || objIndexs[i]["name"] == "jldm"
           || objIndexs[i]["name"] == "cz" || objIndexs[i]["name"] == "b2" || objIndexs[i]["name"] == "c4" || objIndexs[i]["name"] == "d1" || objIndexs[i]["name"] == "kpdwmc") {
            continue;
        }
        //判断是否必填，加样式
        if (objIndexs[i]["editrules"] != null) {
            if (objIndexs[i]["editrules"].required == true) {
                sign = "<font color='red'>*</font>";
            }
            else {
                sign = "";
            }
        }
        if (objIndexs[i]["edittype"] == "text") {
            if (objIndexs[i]["index"] == "a2") {
                strAppendTmp += "<li>";
                strAppendTmp += sign;
                strAppendTmp += objNames[i] + "：";
                strAppendTmp += "<input type='text'  value=''  name='" + objIndexs[i]["name"] + "'";
                strAppendTmp += " id='" + objIndexs[i]["name"] + "' "; //限制输入长度
                strAppendTmp += " onkeypress='return checkValidate(event)' onpaste='return validatePaste()'/>"; //限制输入，粘贴特殊字符
                strAppendTmp += "</li>";
            }
            else {
                strAppendTmp += "<li>";
                strAppendTmp += sign;
                strAppendTmp += objNames[i] + "：";
                strAppendTmp += "<input type='text'  value=''  name='" + objIndexs[i]["name"] + "'";
                strAppendTmp += " id='" + objIndexs[i]["name"] + "' maxlength='30'"; //限制输入长度
                strAppendTmp += " onkeypress='return checkValidate(event)' onpaste='return validatePaste()'/>"; //限制输入，粘贴特殊字符
                strAppendTmp += "</li>";
            }
        }
        if (objIndexs[i]["edittype"] == "checkbox") {
            strAppendTmp += "<li class=\"unline dedk\">";
            strAppendTmp += sign;
            strAppendTmp += objNames[i] + "：";
            strAppendTmp += "<input type='checkbox'  value=''  name='" + objIndexs[i]["name"] + "'";
            strAppendTmp += " id='" + objIndexs[i]["name"] + "' maxlength='50'"; //限制输入长度
            strAppendTmp += " onkeypress='return checkValidate(event)' onpaste='return validatePaste()'/>"; //限制输入，粘贴特殊字符
            strAppendTmp += "</li>";
        }
        if (objIndexs[i]["edittype"] == "select") {
            strAppendTmp += "<li>";
            strAppendTmp += sign + objNames[i] + "：";
            strAppendTmp += "<select name='" + objIndexs[i]["name"] + "' id='" + objIndexs[i]["name"] + "'";
            strAppendTmp += " class='easyui-combobox'>";
            strAppendTmp += "</select>";
            strAppendTmp += "</li>";
        }
    }
    strForm += strAppendTmp;
    strForm += "</ul>";

    //添加到层里
    $("#" + strDialogP060701 + "_divform").append(strForm);

    //客户代码
    $("#khdm", "#" + strDialogP060701).combobox({
        textField: "mc",
        valueField: "dm",
        editable: true,
        afterChange: function (newValue, newText) {
            $(this).combobox("setText", newText.replace(/&nbsp;/g, ""));
            $("#" + strDialogP060701 + "_divform").data("change", true);
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "客户", table: "Tflxx", page: "p0607" }, { jquery: $("#khdm", "#" + strDialogP060701), model: "Tkhxx" });
                ciho.showTypeDialog();
            }
        }
    });
    if (objKh != "{}") {
        $("#khdm", "#" + strDialogP060701).combobox("loadData", objKh);
    }

    //商品代码
    $('#spdm', "#" + strDialogP060701).combobox({
        textField: "mc",
        valueField: "dm",
        editable: true,
        onChange: function (newValue, oldValue) {
            $("#" + strDialogP060701 + "_divform").data("change", true);
        },
        onSelect: function (strRecord) {
            //            var strValue = strRecord.dm;
            //            if (objSp != "{}") {
            //                for (var j = 0; j < objSp.length; j++) {
            //                    if (objSp[j].dm == strValue) {
            //                        var strData = parseFloat(objSp[j].a13);
            //                        if (!isNaN(strData)) {
            //                            $("#a4", "#" + strDialogP060701).val(strData.toFixed(window.parent.strPricePlace));
            //                        }
            //                    }
            //                }
            //            }
        },
        afterChange: function (newValue, newText) {
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "药品", table: "Tflxx", page: "p0607" }, { jquery: $("#spdm", "#" + strDialogP060701), model: "Tspxx" });
                ciho.showTypeDialog();
            }
        }
    });
    if (objSp != "{}") {
        $("#spdm", "#" + strDialogP060701).combobox("loadData", objSp);
    }

    //职员代码
    $("#zydm", "#" + strDialogP060701).combobox({
        textField: "mc",
        valueField: "dm",
        editable: true,
        onChange: function (newValue, oldValue) {
            $("#" + strDialogP060701 + "_divform").data("change", true);
        },
        afterChange: function (newValue, newText) {
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "销售员", table: "Tflxx", page: "p0607" }, { jquery: $("#zydm", "#" + strDialogP060701), model: "TZyxx" });
                ciho.showTypeDialog();
            }
        }
    });
    if (objZy != "{}") {

        $("#zydm", "#" + strDialogP060701).combobox("loadData", objZy);
    }

    //开票单位
    $("#kpdwdm", "#" + strDialogP060701).combobox({
        textField: "mc",
        valueField: "dm",
        //editable: false,
        onChange: function (newValue, oldValue) {
            $("#" + strDialogP060701 + "_divform").data("change", true);
        },
        afterChange: function (newValue, newText) {
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "开票单位", table: "Tflxx", page: "p0607" }, { jquery: $("#kpdwdm", "#" + strDialogP060701), model: "Tkpdwxx" });
                ciho.showTypeDialog();
            }
        }
    });
    if (objKpdw != "{}") {
        $("#kpdwdm", "#" + strDialogP060701).combobox("loadData", objKpdw);
    }

    //绑定控件
    $("#a4", "#" + strDialogP060701).autoNumeric({ mDec: window.parent.strPricePlace, aSep: "", aNeg: '-' }).focus(function () { this.select(); }).css("ime-mode", "disabled");
    $("#a5", "#" + strDialogP060701).autoNumeric({ mDec: window.parent.strCountPlace, aSep: "", aNeg: '-' }).focus(function () { this.select(); }).css("ime-mode", "disabled");
    $("#a8", "#" + strDialogP060701).autoNumeric({ mDec: window.parent.strCountPlace, aSep: "", aNeg: '-' }).focus(function () { this.select(); }).css("ime-mode", "disabled");
    $("#a9", "#" + strDialogP060701).autoNumeric({ mDec: window.parent.strPricePlace, aSep: "", aNeg: '-' }).focus(function () { this.select(); }).css("ime-mode", "disabled");

    $("#a4", "#" + strDialogP060701).blur(function () {
        var strA4 = parseFloat($(this).val());
        var strA5 = parseFloat($("#a5", "#" + strDialogP060701).val());
        if (!isNaN(strA4) && !isNaN(strA5)) {
            $("#a10", "#" + strDialogP060701).val(parseFloat(strA4 * strA5).toFixed(window.parent.strMoneyPlace));
        } else {
            $("#a10", "#" + strDialogP060701).val("");
        }
    });
    $("#a5", "#" + strDialogP060701).blur(function () {
        var strA5 = parseFloat($(this).val());
        var strA4 = parseFloat($("#a4", "#" + strDialogP060701).val());
        if (!isNaN(strA5) && !isNaN(strA4)) {
            $("#a10", "#" + strDialogP060701).val(parseFloat(strA4 * strA5).toFixed(window.parent.strMoneyPlace));
        }
        else {
            $("#a10", "#" + strDialogP060701).val("");
        }
    });
    $("#a7", "#" + strDialogP060701).change(function () {
        if (true == $(this)[0].checked) {
            $("#a8", "#" + strDialogP060701).attr("disabled", false);
            $("#a9", "#" + strDialogP060701).attr("disabled", false);
            $("#kpdwdm", "#" + strDialogP060701).combobox("enable");

            //带出以上数据
            if ($("#a8", "#" + strDialogP060701).val() == "") {
                $("#a8", "#" + strDialogP060701).val($("#a5", "#" + strDialogP060701).val());
            }
            if ($("#a9", "#" + strDialogP060701).val() == "") {
                $("#a9", "#" + strDialogP060701).val($("#a4", "#" + strDialogP060701).val());
            }
            if ($("#a11", "#" + strDialogP060701).val() == "") {
                $("#a11", "#" + strDialogP060701).val($("#a10", "#" + strDialogP060701).val());
            }
        }
        else {
            $("#a8", "#" + strDialogP060701).val("");
            $("#a9", "#" + strDialogP060701).val("");
            $("#a11", "#" + strDialogP060701).val("");
            $("#kpdwdm", "#" + strDialogP060701).combobox("setValue", "");
            $("#a8", "#" + strDialogP060701).attr("disabled", true);
            $("#a9", "#" + strDialogP060701).attr("disabled", true);
            $("#kpdwdm", "#" + strDialogP060701).combobox("disable");
        }
    });
    $("#a8", "#" + strDialogP060701).blur(function () {
        var strA8 = parseFloat($(this).val());
        var strA9 = parseFloat($("#a9").val());
        if (!isNaN(strA8) && !isNaN(strA9)) {
            $("#a11", "#" + strDialogP060701).val(parseFloat(strA8 * strA9).toFixed(window.parent.strMoneyPlace));
        }
        else {
            $("#a11", "#" + strDialogP060701).val("");
        }
    });
    $("#a9", "#" + strDialogP060701).blur(function () {
        var strA9 = parseFloat($(this).val());
        var strA8 = parseFloat($("#a8", "#" + strDialogP060701).val());
        if (!isNaN(strA9) && !isNaN(strA8)) {
            $("#a11", "#" + strDialogP060701).val(parseFloat(strA8 * strA9).toFixed(window.parent.strMoneyPlace));
        }
        else {
            $("#a11", "#" + strDialogP060701).val("");
        }
    });

    //时间控件
    inputAndBindData("a6", false, "#" + strDialogP060701);
    $("#a6", "#" + strDialogP060701).blur(function () {
        $("#" + strDialogP060701 + "_divform").data("change", true);
    });

    //修改时，加载value
    if (strSaveSign == '2') {
        for (var i = 0; i < objIndexs.length; i++) {
            var objTr = objTable.getRowData(strId);
            objRecordsP060702 = objTr;                  //存放一下当前修改的数据集
            if (objIndexs[i].name == "spdm" && objTr.spdm != undefined) {
                $("#spdm", "#" + strDialogP060701).combobox("setValue", objTr.spdm);
                if ($("#spdm", "#" + strDialogP060701).combobox("getValue") == objTr.spdm) {
                    $("#spdm", "#" + strDialogP060701).combobox("setText", objTr.c1);
                }
            }
            else if (objIndexs[i].name == "khdm" && objTr.khdm != undefined) {
                $("#khdm", "#" + strDialogP060701).combobox("setValue", objTr.khdm);
                if ($("#khdm", "#" + strDialogP060701).combobox("getValue") == objTr.khdm) {
                    $("#khdm", "#" + strDialogP060701).combobox("setText", objTr.b1);
                }
            }
            else if (objIndexs[i].name == "zydm" && objTr.zydm != undefined) {
                $("#zydm", "#" + strDialogP060701).combobox("setValue", objTr.zydm);
                if ($("#zydm", "#" + strDialogP060701).combobox("getValue") == objTr.zydm) {
                    $("#zydm", "#" + strDialogP060701).combobox("setText", objTr.d1);
                }
            }
            else if (objIndexs[i].name == "kpdwdm" && objTr.kpdwdm != undefined) {
                $("#kpdwdm", "#" + strDialogP060701).combobox("setValue", objTr.kpdwdm);
                if ($("#kpdwdm", "#" + strDialogP060701).combobox("getValue") == objTr.kpdwdm) {
                    $("#kpdwdm", "#" + strDialogP060701).combobox("setText", objTr.kpdwmc);
                }
            }
            else if (objIndexs[i].name == "a7" && objTr.a7 != undefined) {

                if (objTr.a7 == "1") {
                    $("#a7", "#" + strDialogP060701)[0].checked = true;
                }
                else {
                    $("#a7", "#" + strDialogP060701)[0].checked = false;
                }
            }
            else {
                $('#' + objIndexs[i].name, "#" + strDialogP060701 + "_divform").val(objTr[objIndexs[i].name]);
            }
        }
    }

    //是否带票选否的时候
    if ($("#a7", "#" + strDialogP060701)[0].checked == false) {
        $("#a10", "#" + strDialogP060701).attr("disabled", true);
        $("#a11", "#" + strDialogP060701).attr("disabled", true);
        $("#a8", "#" + strDialogP060701).attr("disabled", true);
        $("#a9", "#" + strDialogP060701).attr("disabled", true);
        $("#kpdwdm", "#" + strDialogP060701).combobox("disable");
    }

    //制单人时间不可编辑
    $("#a6", "#" + strDialogP060701).val(strStateDate);
    $("#a6", "#" + strDialogP060701).attr("disabled", true);
    $("#a10", "#" + strDialogP060701).attr("disabled", true);
    $("#a11", "#" + strDialogP060701).attr("disabled", true);

    //层 change设定
    $(":input", "#" + strDialogP060701 + "_divform").change(function () {
        $("#" + strDialogP060701 + "_divform").data("change", true);
    });
    $("#" + strDialogP060701 + "_divform").data("change", false);

    //设置层序
    $(".layoutpanel").css("z-index", "50000009");

    setTimeout(function () { $("#a2", "#" + strDialogP060701).focus(); }, 100);

    //释放内存
    objTable = null;
    objNames = null;
    objIndexs = null;
}

//验证表单
function formDataValidate_Ysqc() {
    //客户不能为空
    if (!$("#khdm", "#" + strDialogP060701).combobox('getValue')) {
        //修改时，验证数据是否是停用的数据
        if (strSaveSign == "2" && $("#khdm", $("#" + strDialogP060701 + "_divform")).combobox('getText') == objRecordsP060702.b1) {
            $("#khdm", $("#" + strDialogP060701 + "_divform")).combobox("setValue", objRecordsP060702.khdm);
            $("#khdm", $("#" + strDialogP060701 + "_divform")).combobox("setText", objRecordsP060702.b1);
        }
        else {
            window.parent.cihoAlert(msg.sz.kh.empOrNotExit, null, function () { $("#khdm", "#" + strDialogP060701).combobox("focus"); });
            return false;
        }
    }

    //药品不能为空
    if (!$("#spdm", "#" + strDialogP060701).combobox('getValue')) {
        //修改时，验证数据是否是停用的数据
        if (strSaveSign == "2" && $("#spdm", $("#" + strDialogP060701 + "_divform")).combobox('getText') == objRecordsP060702.c1) {
            $("#spdm", $("#" + strDialogP060701 + "_divform")).combobox("setValue", objRecordsP060702.spdm);
            $("#spdm", $("#" + strDialogP060701 + "_divform")).combobox("setText", objRecordsP060702.c1);
        }
        else {
            window.parent.cihoAlert(msg.sz.yp.empOrNotExit, null, function () { $("#spdm", "#" + strDialogP060701).combobox("focus"); });
            return false;
        }
    }

    //验证必填项
    if (false == dataRequired(strTableNameP060701, strDialogP060701)) {
        return false;
    }

    //验证日期
    if (checkDatePattern($("#a6", "#" + strDialogP060701).val()) == false) {
        window.parent.cihoAlert(msg.dt.dtTypeErr, msgBox.dlgBtn.Ok, function () { $("#a6", "#" + strDialogP060701).focus(); });
        return false;
    }

    // 职员不能为空
    if ($("#zydm", "#" + strDialogP060701).combobox('getText')) {
        if (!$("#zydm", "#" + strDialogP060701).combobox('getValue')) {
            //修改时，验证数据是否是停用的数据
            if (strSaveSign == "2" && $("#zydm", $("#" + strDialogP060701 + "_divform")).combobox('getText') == objRecordsP060702.d1) {
                $("#zydm", $("#" + strDialogP060701 + "_divform")).combobox("setValue", objRecordsP060702.zydm);
                $("#zydm", $("#" + strDialogP060701 + "_divform")).combobox("setText", objRecordsP060702.d1);
            }
            else {
                window.parent.cihoAlert(msg.skd.xsyNot, null, function () { $("#zydm", "#" + strDialogP060701).combobox("focus"); });
                return false;
            }
        }
    }

    //计算金额和带票金额
    var strA4 = parseFloat($("#a4", "#" + strDialogP060701).val());
    var strA5 = parseFloat($("#a5", "#" + strDialogP060701).val());
    var strA8 = parseFloat($("#a8", "#" + strDialogP060701).val());
    var strA9 = parseFloat($("#a9", "#" + strDialogP060701).val());

    //判断单价是否是非数字
    if (isNaN(strA5)) {
        window.parent.cihoAlert(msg.other.slNoEffecTiveNum, null, function () { $("#a5", "#" + strDialogP060701).focus(); });
        return false;
    }

    $("#a10", "#" + strDialogP060701).val(strA4 * strA5);
    if (!isNaN(strA8) && !isNaN(strA9)) {
        $("#a11", "#" + strDialogP060701).val(strA8 * strA9);
    }

    /// 合计数过大
    var strA10 = parseFloat($("#a10", "#" + strDialogP060701).val());
    if (!isNaN(strA10)) {
        if (strA10 > window.parent._MaxPerBill) {
            window.parent.cihoAlert(msg.other.moneyOversize, null, function () {
                if (strA4 == 0) {
                    $("#a4", "#" + strDialogP060701).focus();
                }
                else {
                    $("#a5", "#" + strDialogP060701).focus();
                }
            });
            return false;
        }
    }

    //是否带票 || 
    if ($("#a7", "#" + strDialogP060701)[0].checked == true) {

        //未开数量为空时
        if ($("#a8").val() == "") {
            window.parent.cihoAlert(msg.sz.qc.isDaiPiaoCount, null, function () { $("#a8", "#" + strDialogP060701).focus(); });
            return false;
        }

        //未开数量不是有效的数字
        if (isNaN(strA8)) {
            window.parent.cihoAlert(msg.other.wkslNoEffecTiveNum, null, function () { $("#a8", "#" + strDialogP060701).focus(); });
            return false;
        }

        //未开单价为空时
        if ($("#a9").val() == "") {
            window.parent.cihoAlert(msg.sz.qc.isDaiPiaoPrice, null, function () { $("#a9", "#" + strDialogP060701).focus(); });
            return false;
        }

        //合计数不能过大
        var strA11 = parseFloat($("#a11", "#" + strDialogP060701).val());
        if (!isNaN(strA11)) {
            if (strA11 > window.parent._MaxPerBill) {
                window.parent.cihoAlert(msg.other.moneyOversize, null, function () { $("#a8", "#" + strDialogP060701).focus(); });
                return false;
            }
        }

        //判断开票单位不能为空
        if (!$("#kpdwdm").combobox('getValue')) {
            //修改时，验证数据是否是停用的数据
            if (strSaveSign == "2" && $("#kpdwdm", $("#" + strDialogP060701 + "_divform")).combobox('getText') == objRecordsP060702.kpdwmc && objRecordsP060702.kpdwmc != "") {
                $("#kpdwdm", $("#" + strDialogP060701 + "_divform")).combobox("setValue", objRecordsP060702.kpdwdm);
                $("#kpdwdm", $("#" + strDialogP060701 + "_divform")).combobox("setText", objRecordsP060702.kpdwmc);
            }
            else {
                window.parent.cihoAlert(msg.sz.kp.empOrNotExit, null, function () { $("#kpdwdm", "#" + strDialogP060701).combobox("focus"); });
                return false;
            }
        }

        //未开金额不能等于零
        if (strA8 * strA9 == 0) {
            window.parent.cihoAlert(msg.other.wkMoneyOrNotExit, null, function () {
                if (strA8 == 0) {
                    $("#a8", "#" + strDialogP060701).focus();
                }
                else {
                    $("#a9", "#" + strDialogP060701).focus();
                }
            });
            return false;
        }
    }

    return true;
}

//组数据库保存字符串
function GetSaveStr_Ysqc() {

    //input框的字符串
    var strJsonString = getSaveDataInfo(strDialogP060701);

    //其他控件
    var MyStr = ",\"khdm\":" + "\"" + $("#khdm", "#" + strDialogP060701).combobox('getValue') + "\"";
    MyStr += ",\"spdm\":" + "\"" + $("#spdm", "#" + strDialogP060701).combobox('getValue') + "\"";
    var strZydm = $("#zydm", "#" + strDialogP060701).combobox('getValue');
    if (strZydm) {
        MyStr += ",\"zydm\":" + "\"" + $("#zydm", "#" + strDialogP060701).combobox('getValue') + "\"";
    }
    var strKpdwdm = $("#kpdwdm", "#" + strDialogP060701).combobox('getValue');
    if (strKpdwdm != undefined) {
        var objKpdw = window.parent._arrCmbKpdw.Records;
        MyStr += ",\"kpdwdm\":" + "\"" + strKpdwdm + "\"";
        for (var i = 0; i < objKpdw.length; i++) {
            if (objKpdw[i].dm == strKpdwdm) {
                MyStr += ",\"kpsl\":" + "\"" + objKpdw[i].kpsl + "\"";
            }
        }

    }

    strJsonString = strJsonString.replace("}", MyStr);
    strJsonString += ",\"kmdm\":\"" + strKmdmP0607 + "\"";

    if (strSaveSign == "2") {
        var objRow = $("#" + strTableNameP060701).getRowData(strSelRowIdP060701);
        strJsonString += ",\"jldm\":\"" + objRow.jldm + "\"";
    }
    strJsonString += "}"
    return strJsonString;
}

//保存应付期初
function SaveYsqc(saveType) {

    //验证
    if (false == formDataValidate_Ysqc()) {
        return;
    }

    //获取要保存的字符串
    var strRecord = GetSaveStr_Ysqc();
    var objRecord = ParseData(strRecord);

    //保存数据库
    var objResult = saveData(strTableNameP060701, strRecord, strSaveSign);

    //保存失败
    if (objResult.ReturnCode != "0") {
        window.parent.cihoAlert(objResult.MSG);
        return;
    }

    //重新加载表格数据
    searchDataP060701();

    //添加操作按钮
    //addCzHtmlP060701();

    strSaveSign = "1";

    if (saveType == "2") {
        //保存新增
        $(":input", "#" + strDialogP060701 + "_divform").val("");
        $("#khdm", "#" + strDialogP060701).combobox('setValue', "")
        $("#spdm", "#" + strDialogP060701).combobox('setValue', "")
        $("#zydm", "#" + strDialogP060701).combobox('setValue', "")

        $("#a6", "#" + strDialogP060701).val(strStateDate);
        $("#a7", "#" + strDialogP060701)[0].checked = false;
        if ($("#a7", "#" + strDialogP060701)[0].checked == false) {
            $("#a10", "#" + strDialogP060701).attr("disabled", true);
            $("#a11", "#" + strDialogP060701).attr("disabled", true);
            $("#a8", "#" + strDialogP060701).attr("disabled", true);
            $("#a9", "#" + strDialogP060701).attr("disabled", true);
            $("#kpdwdm", "#" + strDialogP060701).combobox("disable");
        }
        setTimeout(function () { $("#a2", "#" + strDialogP060701).focus(); }, 100);
    }
    else {
        cihoDlgClose(strDialogP060701);
    }

    //改变层的change状态
    $("#" + strDialogP060701 + "_divform").data("change", false);

    //释放内存
    strRecord = null;
    strTable = null;
    objTable = null;

}

//删除
function deleteYsqcRow(rowId) {

    //取得要删除数据的名称
    var objCurrent = $("#" + strTableNameP060701).getRowData(rowId);

    window.parent.cihoAlert(msg.del.delConfirm, msgBox.dlgBtn.YesNo, function (result) {
        if (result == msgBox.dlgRst.Yes) {

            var objTr = $("#" + strTableNameP060701).getRowData(rowId);

            //要删除的数据
            var strJsonData = "{\"kmdm\":\"" + strKmdmP0607 + "\",\"jldm\":\"" + objTr.jldm + "\"}";

            //数据库删除
            var objResult = ParseData(window.external.DoOptions(strTableNameP060701, 'Delete', strJsonData));

            //保存失败时弹出提示信息
            if (objResult == null || objResult.ReturnCode == undefined) {
                window.parent.cihoAlert(msg.del.delFail);
                return;
            }
            if (objResult.ReturnCode != 0) {
                window.parent.cihoAlert(objResult.MSG);
                return;
            }

            //前台的处理
            //$("#" + strTableNameP060701).jqGrid("delRowData", rowId);

            //设置标志位
            objPageParamP060701.flag = 2;

            //重新加载数据
            searchDataP060701();

            //清除浮动层的内容
            $(".operate").remove();

        }
    });
}