/*************************
*功能：工资预提管理维护
*创建人：张振华
*时间：2010-08-16
*备注：此时间是加注释时间
*************************/

var strTableP050901 = "TP050901";
var strDivP050901 = "divP050901";
var strOptrTypeP050901; //保存标志位
var objRecordsP050901;  //修改数据
var RulesList = { Type: "0", CumToTotal: true, Rules: [] }; //type:0按数量，1按金额


//判断是否选择了预提方式
function checkYtfs() {
    if (!$("#ytfs", "#" + strDivP050901).combobox('getValue')) {
        window.parent.cihoAlert(msg.gz.ytTypeNoSel);
        return false;
    }
    return true;
}

//修改状态
function dataChangeStateP050901(bState) {
    $("#" + strDivP050901 + "_divform").data("change", bState);
}

//释放内存
function freeMemory_P050901() {
    strOptrTypeP050901 = null;
    objRecordsP050901 = null;
    //RulesList = null;
}

//弹出层
//1:新增，2:修改，3:查看，4:该规则产生了单据的修改
function showDialogP050901(strType) {
    try {

        //隐藏浮动层
        $(".operate").hide();

        //保存标志位
        strOptrTypeP050901 = strType;

        //数据库返回结果
        var objResult;

        //弹出空层
        if (strType == "3") {
            //查看的时候没有按钮
            creatDiv_ShowDialog(strDivP050901, "提成规则设置", false, false, strTableP050901, "400");
        }
        else {
            creatDiv_ShowDialog(strDivP050901, "提成规则设置", false, true, strTableP050901, "400");
        }

        //往弹出层里添加内容
        if (strOptrTypeP050901 == "1") {
            addContentP050901("");
        }
        else if (strOptrTypeP050901 == "2") {
            objResult = ParseData(window.external.DoOptions(strTableP050901, "GetSingle", "{\"gzguid\":\"" + objSelRowP0509.gzguid + "\"}"));
            if (objResult.flag == "4") {
                strOptrTypeP050901 = objResult.flag;
            }
            addContentP050901();
        }
        else if (strOptrTypeP050901 == "3") {
            addContentP050901();
        }

        $('#' + strDivP050901 + "_content").css("margin-top", "-100px");

        //关闭窗口时，清空窗口中的内容
        //$("#" + strDivP050901).unbind("dialogclose").bind("dialogclose", function () { freeMemory_P050901(); $(this).empty(); });
        setTimeout(function () { $("#gzname", "#" + strDivP050901).focus(); }, 100);
    }
    catch (e) {
        proceError("P050901", e.ToString());
    }
}

//添加弹出层内容
function addContentP050901(strBh) {

    //常用变量
    var objGrid = $("#" + strTableP0509);

    //列显示名称，列配置
    var objNames = objGrid.jqGrid('getGridParam', "colNames");
    var objIndexs = objGrid.jqGrid('getGridParam', "colModel");

    //费用科目，预提方式，预提时间，费用经受人，客户，药品，职员
    var objFykm = [{ "dm": "1", "mc": "工资提成", "selected": true}];
    var objYtType = [{ "dm": "0", "mc": "按销售预提" }, { "dm": "1", "mc": "按回款预提"}];
    var objYtTime = [{ "dm": "1", "mc": "每月末" }, { "dm": "0", "mc": "每笔业务" }, { "dm": "2", "mc": "每季度末" }, { "dm": "3", "mc": "每年末"}];
    var objkh = getComboboxData("Tkhxx1");
    objkh.push({ "mc": "<font color='red'>添加客户</font>", "dm": "-1" });
    var objSp = getComboboxData("Tspxx");
    objSp.push({ "mc": "<font color='red'>添加商品</font>", "dm": "-1" });
    var objZy = getComboboxData("TZyxx");
    objZy.push({ "mc": "<font color='red'>添加职员</font>", "dm": "-1" });

    //其他变量
    var i = 0;
    var strForm = "";
    var sign = "";
    var item;

    //填空弹出层样式
    strForm += "<ul>"
    for (i = 0; i < objIndexs.length; i++) {

        item = objIndexs[i];
        if (item.name == "rn" || item.name == "dx" ||
         item.name == "id" || item.name == "gzguid") {
            continue;
        }

        //判断是否必填，加样式
        if (item.editrules.required == true) {
            sign = "<font color='red'>*</font>";
        }
        else {
            sign = "";
        }

        if (item.edittype == "text") {
            if (item.name == "gz") {
                strForm += "<li>";
                strForm += sign;
                strForm += objNames[i] + "：";
                strForm += "<a href='#' onclick=\"if(checkYtfs()){ showDialogP050902('1');};return false;\" style='; color:red; text-decoration:none;'>设置</a>（详细的计算方式、区间设置）";
                strForm += "</li>";
            }
            else if (item.name == "a1") {
                strForm += "<li>";
                strForm += sign;
                strForm += objNames[i] + "：";
                strForm += "<input type='text'  value=''  name='" + item.name + "'";
                strForm += " id='" + item.name + "' "; //限制输入长度
                strForm += " />"; //限制输入，粘贴特殊字符;
                strForm += "</li>";
            }
            else {
                strForm += "<li>";
                strForm += sign;
                strForm += objNames[i] + "：";
                strForm += "<input type='text'  value=''  name='" + item.name + "'";
                strForm += " id='" + item.name + "' maxlength='50'"; //限制输入长度
                strForm += " onkeypress='return checkValidate(event)' onpaste='return validatePaste()'/>"; //限制输入，粘贴特殊字符;
                strForm += "</li>";
            }
        }
        else if (item.edittype == "select") {
            if (item.name == "spdm" || item.name == "khdm"
            || item.name == "zydm" || item.name == "jsrdm"
            || item.name == "ytsj" || item.name == "ytfs") {
                strForm += "<li>";
                strForm += sign;
                strForm += objNames[i] + "：";
                strForm += "<select name='" + item.name + "' id='" + item.name + "'";
                strForm += " class='easyui-combobox' >";
                strForm += "</select>";
                strForm += "</li>";
            }
        }
        else if (item.edittype == "checkbox") {
            if (item.name == "zt") {
                strForm += "<li>";
                strForm += sign;
                strForm += "立即启用：";
                strForm += "<input  id='" + item.name + "' type='checkbox'/>";
                strForm += "</li>";
            }
        }
    }
    strForm += "</ul>"

    //向弹出层里添加内容
    $("#" + strDivP050901 + "_divform").append(strForm);

    //费用科目
    $("#fykmdm", "#" + strDivP050901).combobox({
        width: _iWidth190,
        panelHeight: 62,
        textField: "mc",
        valueField: "dm"
    });
    $("#fykmdm", "#" + strDivP050901).combobox("loadData", objFykm);
    $("#fykmdm", "#" + strDivP050901).combobox("disable");

    //预提方式
    $("#ytfs", "#" + strDivP050901).combobox({
        width: _iWidth190,
        panelHeight: 42,
        textField: "mc",
        valueField: "dm",
        editable: false,
        onChange: function (newValue, oldValue) {
            dataChangeStateP050901(true);
        },
        onSelect: function (Record) {
            if (Record.dm == "1") {
                RulesList.Type = "1";
            }
            else {
                RulesList.Type = "0";
            }
            RulesList.CumToTotal = true;
            RulesList.Rules = [];
        }
    });
    $("#ytfs", "#" + strDivP050901).combobox("loadData", objYtType);

    //预提时间
    $("#ytsj", "#" + strDivP050901).combobox({
        width: _iWidth190,
        panelHeight: 82,
        textField: "mc",
        valueField: "dm",
        editable: false,
        onChange: function (newValue, oldValue) {
            dataChangeStateP050901(true);
        }
    });
    $("#ytsj", "#" + strDivP050901).combobox("loadData", objYtTime);

    //经手人代码
    $("#jsrdm", "#" + strDivP050901).combobox({
        width: _iWidth190,
        listWidth: _iWidth190,
        textField: "mc",
        valueField: "dm",
        onChange: function (newValue, oldValue) {
            dataChangeStateP050901(true);
        },
        afterChange: function (newValue, newText) {
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "经手人", table: "Tflxx" }, { jquery: $("#jsrdm", "#" + strDivP050901), model: "TZyxx", other: $("#zydm", "#" + strDivP050901) });
                ciho.showTypeDialog();
            }
        }
    });
    $("#jsrdm", "#" + strDivP050901).combobox("loadData", objZy);

    //客户代码
    $("#khdm", "#" + strDivP050901).combobox({
        width: _iWidth190,
        listWidth: _iWidth190,
        textField: "mc",
        valueField: "dm",
        onChange: function (newValue, oldValue) {
            dataChangeStateP050901(true);
        },
        afterChange: function (newValue, newText) {
            $(this).combobox("setText", newText.replace(/&nbsp;/g, ""));
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "客户", table: "Tflxx" }, { jquery: $("#khdm", "#" + strDivP050901), model: "Tkhxx" });
                ciho.showTypeDialog();
            }
        }
    });
    $("#khdm", "#" + strDivP050901).combobox("loadData", objkh);

    //商品代码
    $("#spdm", "#" + strDivP050901).combobox({
        width: _iWidth190,
        listWidth: _iWidth190,
        textField: "mc",
        valueField: "dm",
        onChange: function (newValue, oldValue) {
            dataChangeStateP050901(true);
        },
        afterChange: function (newValue, newText) {
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "药品", table: "Tflxx" }, { jquery: $("#spdm", "#" + strDivP050901), model: "Tspxx" });
                ciho.showTypeDialog();
            }
        }
    });
    $("#spdm", "#" + strDivP050901).combobox("loadData", objSp);

    //职员代码
    $("#zydm", "#" + strDivP050901).combobox({
        width: _iWidth190,
        listWidth: _iWidth190,
        textField: "mc",
        valueField: "dm",
        onChange: function (newValue, oldValue) {
            dataChangeStateP050901(true);
        },
        afterChange: function (newValue, newText) {
            if (newValue == "-1") {
                ciho.IniData({ id: "divAddType", title: "职员", table: "Tflxx" }, { jquery: $("#zydm", "#" + strDivP050901), model: "TZyxx", other: $("#jsrdm", "#" + strDivP050901) });
                ciho.showTypeDialog();
            }
        }
    });
    $("#zydm", "#" + strDivP050901).combobox("loadData", objZy);

    //结束时间
    inputAndBindData("edate");
    $("#edate", "#" + strDivP050901).blur(function () {
        $("#" + strDivP050901 + "_divform").data("change", true);
    });
    $("#edate", "#" + strDivP050901).val(getNowDate());

    //开始时间
    inputAndBindData("sdate");
    $("#sdate", "#" + strDivP050901).blur(function () {
        $("#" + strDivP050901 + "_divform").data("change", true);
    });
    $("#sdate", "#" + strDivP050901).val(getNowDate());

    //备注
    $("#a1", "#" + strDivP050901).focus(function () { this.select(); });

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

    //加载修改数据
    if (strOptrTypeP050901 != "1") {
        RulesList.Type = objSelRowP0509.slje;
        RulesList.CumToTotal = objSelRowP0509.celj;
        $("#gzname", "#" + strDivP050901).val(objSelRowP0509.gzname);

        $("#ytfs", "#" + strDivP050901).combobox('setValue', objSelRowP0509.ytfs);

        $("#khdm", "#" + strDivP050901).combobox('setValue', objSelRowP0509.khdm);
        if ($("#khdm", "#" + strDivP050901).combobox('getText') == objSelRowP0509.khdm) {
            $("#khdm", "#" + strDivP050901).combobox('setText', objSelRowP0509.khmc);
        }

        $("#spdm", "#" + strDivP050901).combobox('setValue', objSelRowP0509.spdm);
        if ($("#spdm", "#" + strDivP050901).combobox('getText') == objSelRowP0509.spdm) {
            $("#spdm", "#" + strDivP050901).combobox('setText', objSelRowP0509.spmc);
        }

        $("#zydm", "#" + strDivP050901).combobox('setValue', objSelRowP0509.zydm);
        if ($("#zydm", "#" + strDivP050901).combobox('getText') == objSelRowP0509.zydm) {
            $("#zydm", "#" + strDivP050901).combobox('setText', objSelRowP0509.zymc);
        }

        $("#jsrdm", "#" + strDivP050901).combobox('setValue', objSelRowP0509.jsrdm);
        if ($("#jsrdm", "#" + strDivP050901).combobox('getText') == objSelRowP0509.jsrdm) {
            $("#jsrdm", "#" + strDivP050901).combobox('setText', objSelRowP0509.jsrmc);
        }
        $("#ytsj", "#" + strDivP050901).combobox('setValue', objSelRowP0509.ytsj);

        $("#sdate", "#" + strDivP050901).val(objSelRowP0509.sdate);
        $("#edate", "#" + strDivP050901).val(objSelRowP0509.edate);
        $("#a1", "#" + strDivP050901).val(escape(objSelRowP0509.a1));
        if (objSelRowP0509.zt == "已停用") {
            $("#zt", "#" + strDivP050901)[0].checked = false;
        }
        else {
            $("#zt", "#" + strDivP050901)[0].checked = true;
        }
    }

    // 查看的情况
    if (strOptrTypeP050901 == "3" || strOptrTypeP050901 == "4") {
        $("#gzname", "#" + strDivP050901).attr("disabled", true);
        $("#ytfs", "#" + strDivP050901).combobox('disable');
        $("#khdm", "#" + strDivP050901).combobox('disable');
        $("#spdm", "#" + strDivP050901).combobox('disable');
        $("#zydm", "#" + strDivP050901).combobox('disable');
        $("#jsrdm", "#" + strDivP050901).combobox('disable');
        $("#ytsj", "#" + strDivP050901).combobox('disable');
        $("#gzname", "#" + strDivP050901).attr("disabled", true);
    }
    if (strOptrTypeP050901 == "3") {
        $("#sdate", "#" + strDivP050901).attr("disabled", true);
        $("#edate", "#" + strDivP050901).attr("disabled", true);
        $("#a1", "#" + strDivP050901).attr("disabled", true);
        $("#zt", "#" + strDivP050901).attr("disabled", true);
    }
    if (strOptrTypeP050901 == "4") {
        $("#gzname", "#" + strDivP050901).attr("disabled", false);
    }

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


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

//验证
function checkFormP050901(strDialog, strType) {

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

    //验证规则名称
    var strGzName = trim($("#gzname", "#" + strDivP050901).val());

    if (strGzName == "") {
        window.parent.cihoAlert(msg.gz.gzSameNoEmpty, null, function () {
            $("#gzname", "#" + strDivP050901).focus();
        });
        return false;
    }

    //验证规则名称重复
    var arrIds = objTable.getDataIDs();
    if (strOptrTypeP050901 == "1") {
        //新增时判断
        for (var i = 0; i < arrIds.length; i++) {
            var objTr = objTable.getRowData(arrIds[i]);
            if (objTr.gzname == strGzName) {
                window.parent.cihoAlert(msg.gz.gzSameName, null, function () {
                    $("#gzname", "#" + strDivP050901).select();
                });
                return false;
            }
        }
    }
    else {
        //修改的时候的判断
        for (var i = 0; i < arrIds.length; i++) {
            var objTr = objTable.getRowData(arrIds[i]);

            if (objSelRowP0509 != null && objSelRowP0509.gzguid != objTr.gzguid && objTr.gzname == strGzName) {
                window.parent.cihoAlert(msg.gz.gzSameName, null, function () {
                    $("#gzname", "#" + strDivP050901).select();
                });
                return false;
            }
        }
    }

    //预提方式
    var strYtType = $("#ytfs", "#" + strDivP050901).combobox('getValue');
    if (!strYtType) {
        window.parent.cihoAlert(msg.gz.ytTypeNoEmpty, null, function () {
            $("#ytfs", "#" + strDivP050901).combobox('focus');
        });
        return false;
    }

    //费用经手人
    var strJsr = $("#jsrdm", "#" + strDivP050901).combobox('getValue');
    if (strJsr == undefined) {
        window.parent.cihoAlert(msg.gz.jsrNoEmpty, null, function () {
            $("#jsrdm", "#" + strDivP050901).combobox('focus');
        });
        return false;
    }

    //开始时间
    var strTime = $("#ytsj", "#" + strDivP050901).combobox('getValue');
    if (!strTime) {
        window.parent.cihoAlert(msg.gz.ytsjNoEmpty, null, function () {
            $("#ytsj", "#" + strDivP050901).combobox('focus');
        });
        return false;
    }

    //开始时间
    var strSTime = $("#sdate", "#" + strDivP050901).val();
    //时间不能为空
    if (strSTime == "") {
        window.parent.cihoAlert(msg.gz.STimeNoEmpty, null, function () {
            $("#sdate", "#" + strDivP050901).focus();
        });
        return false;
    }
    //验证格式
    if (checkDatePattern(strSTime) == false) {
        window.parent.cihoAlert(msg.dt.dtTypeErr, null, function () {
            $("#sdate", "#" + strDivP050901).select();
        });
        return false;
    }

    //验证早于起始时间
    if (strSTime.replace(/-/g, "/") < window.parent._startDate) {
        window.parent.cihoAlert(msg.other.djrqExtent, null, function () {
            $("#sdate", "#" + strDivP050901).select();
        });
        return false;
    }

    //结束时间
    var strETime = $("#edate", "#" + strDivP050901).val();
    //时间不能为空
    if (strETime == "") {
        window.parent.cihoAlert(msg.gz.ETimeNoEmpty, null, function () {
            $("#edate", "#" + strDivP050901).focus();
        });
        return false;
    }
    //验证格式
    if (checkDatePattern(strETime) == false) {
        window.parent.cihoAlert(msg.dt.dtTypeErr, null, function () {
            $("#edate", "#" + strDivP050901).select();
        });
        return false;
    }

    //验证早于起始时间
    if (strETime.replace(/-/g, "/") < window.parent._startDate) {
        window.parent.cihoAlert(msg.other.djrqExtent, null, function () {
            $("#edate", "#" + strDivP050901).select();
        });
        return false;
    }

    //结束时间必须大于开始时间
    strSTime = strSTime.replace(/-/g, "/");
    strETime = strETime.replace(/-/g, "/");
    if (strETime < strSTime) {
        window.parent.cihoAlert(msg.dt.dtStOverEd, null, function () {
            $("#sdate", "#" + strDivP050901).select();
        });
        return false;
    }

    //预提规则
    if (strOptrTypeP050901 == "1" && RulesList.Rules.length == 0) {
        window.parent.cihoAlert(msg.gz.gzSetNoEmpty);
        return false;
    }

    //客户药品职员至少选择一个
    var strKh = $("#khdm", "#" + strDivP050901).combobox('getValue');
    var strYp = $("#spdm", "#" + strDivP050901).combobox('getValue');
    var strZy = $("#zydm", "#" + strDivP050901).combobox('getValue');

    if (!strKh && !strYp && !strZy) {
        window.parent.cihoAlert(msg.gz.KhYpZySelOne, null, function () {
            $("#khdm", "#" + strDivP050901).combobox('focus');
        });
        return false;
    }

    //修改的时候，如果规则是按数量，
    //预提对象选择按销售回款的问题。
    if ((strOptrTypeP050901 == "2" || strOptrTypeP050901 == "4") && $("#ytfs", "#" + strDivP050901).combobox("getValue") == "1" && RulesList.Rules.length == 0 && objSelRowP0509.slje == "0") {
        window.parent.cihoAlert("预提规则是按数量，此时预提方式只能是按销售回款", null, function () { $("#ytfs", "#" + strDivP050901).combobox("focus"); });
        return false;
    }

    //释放内存
    objTable = null;

}

//保存到数据库
function saveToDbP050901(strDialog, strType) {

    //客户，药品，职员
    var strKhdm = $("#khdm", "#" + strDivP050901).combobox('getValue');
    var strSpdm = $("#spdm", "#" + strDivP050901).combobox('getValue');
    var strZydm = $("#zydm", "#" + strDivP050901).combobox('getValue');

    //数据库返回结果
    var objResult;

    //拼接字符串
    var strData = "{";
    strData += "\"gzname\":\"" + trim($("#gzname", "#" + strDivP050901).val()) + "\"";
    strData += ",\"ytfs\":\"" + $("#ytfs", "#" + strDivP050901).combobox('getValue') + "\"";
    if (strKhdm == undefined) {
        strKhdm = "";
    }
    if (strSpdm == undefined) {
        strSpdm = "";
    }
    if (strZydm == undefined) {
        strZydm = "";
    }
    strData += ",\"khdm\":\"" + strKhdm + "\"";
    strData += ",\"spdm\":\"" + strSpdm + "\"";
    strData += ",\"zydm\":\"" + strZydm + "\"";
    strData += ",\"jsrdm\":\"" + $("#jsrdm", "#" + strDivP050901).combobox('getValue') + "\"";
    strData += ",\"ytsj\":\"" + $("#ytsj", "#" + strDivP050901).combobox('getValue') + "\"";
    strData += ",\"sdate\":\"" + $("#sdate", "#" + strDivP050901).val() + "\"";
    strData += ",\"edate\":\"" + $("#edate", "#" + strDivP050901).val() + "\"";
    strData += ",\"a1\":\"" + trim($("#a1", "#" + strDivP050901).val()) + "\"";
    strData += ",\"zt\":\"" + $("#zt", "#" + strDivP050901)[0].checked + "\"";
    if (strOptrTypeP050901 == "2" || strOptrTypeP050901 == "4") {
        strData += ",\"gzguid\":\"" + objSelRowP0509.gzguid + "\"";
    }
    strData += ",\"slje\":\"" + RulesList.Type + "\"";
    strData += ",\"celj\":\"" + RulesList.CumToTotal + "\"";
    strData += ",\"Records\":["

    //组预提取区间
    for (var i = 0; i < RulesList.Rules.length; i++) {
        if (i != 0) {
            strData += ",";
        }
        strData += "{";
        strData += "\"start\":\"" + RulesList.Rules[i].sData + "\"";
        strData += ",\"end\":\"" + RulesList.Rules[i].eData + "\"";
        strData += ",\"ytbl\":\"" + RulesList.Rules[i].rate + "\"";
        strData += "}";
    }
    strData += "]";
    strData += "}";

    //数据库操作
    if (strOptrTypeP050901 == "1") {
        //新增
        objResult = ParseData(window.external.DoOptions(strTableP050901, "Add", strData));
    }
    else if (strOptrTypeP050901 == "2") {
        //修改
        objResult = ParseData(window.external.DoOptions(strTableP050901, "Edit", strData));
    }
    else if (strOptrTypeP050901 == "4") {
        //修改
        objResult = ParseData(window.external.DoOptions(strTableP050901, "Edit", strData));
    }

    //数据库操作失败弹出提示
    if (objResult.ReturnCode != 0) {
        window.parent.cihoAlert(strRet.MSG);
        return;
    }

    //保存新增
    if (strType == "2") {
        $(":input", $("#" + strDivP050901)).val("");
        $("#ytfs", "#" + strDivP050901).combobox('setValue', '');
        $("#fykmdm", "#" + strDivP050901).combobox('setValue', '1');
        $("#khdm", "#" + strDivP050901).combobox('setValue', '');
        $("#spdm", "#" + strDivP050901).combobox('setValue', '');
        $("#zydm", "#" + strDivP050901).combobox('setValue', '');
        $("#jsrdm", "#" + strDivP050901).combobox('setValue', '');
        $("#ytsj", "#" + strDivP050901).combobox('setValue', '');
        $("#edate", "#" + strDivP050901).val(getNowDate());
        $("#sdate", "#" + strDivP050901).val(getNowDate());
        setTimeout(function () { $("#gzname", "#" + strDivP050901).focus(); }, 100);


        $("#fykmdm", "#" + strDivP050901).combobox('enable');
        $("#ytfs", "#" + strDivP050901).combobox('enable');
        $("#khdm", "#" + strDivP050901).combobox('enable');
        $("#spdm", "#" + strDivP050901).combobox('enable');
        $("#zydm", "#" + strDivP050901).combobox('enable');
        $("#jsrdm", "#" + strDivP050901).combobox('enable');
        $("#ytsj", "#" + strDivP050901).combobox('enable');

    }
    else {
        cihoDlgClose(strDialog);
    }

    //清除修改数据
    strOptrTypeP050901 = "1";
    RulesList.Rules = [];
    objRecordsP050901 = null;

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

    //设定状态
    $("#" + strDivP050901 + "_divform").data("change", false);

}

//保存数据
function saveDataP050901(strDialog, strType) {

    //验证
    if (checkFormP050901(strDialog, strType) == false) {
        return;
    }

    //验证通过保存
    saveToDbP050901(strDialog, strType);
}
