/*-------------------------------文档信息-----------------------------------
///功能：提成单单据
///创建人: 翟新乐
///创建时间：----------------------
///修改人：------------------------
///修改时间：-----------------------
///修改原因：-----------------------
///详细说明：-----------------------
---------------------------------------------------------------------*/
//页面全局变量
var strTableP051801_tzd = "Tp051002";   //表格ID
var strDialogP051801_tzd="" ; //弹出层ID
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓**事件方法 开始**↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/

//打开单据方法
function showDialog_P051801_tzd(strDivId,strDjbh) {
    $(".operate").remove();
    $("#" + strDivId).empty();
    //弹出窗口的创建
    strDialogP051801_tzd = strDivId;
    creatDiv_ShowDialog(strDialogP051801_tzd, "提成调整单", false, false, strTableP051801_tzd, "400");

    //创建窗口元素
    $("#idMust", $("#" + strDialogP051801_tzd)).append("NO:" + strDjbh);
    creatDialogItem_P051801_tzd(strDjbh);
    //设置窗口居中显示
    $("#" + strDialogP051801_tzd).dialog("option", "position", "center");
}

//创建表单元素并加载数据
function creatDialogItem_P051801_tzd(strDjbh) {
    var config = { "pageHeader": [{ "edittype": "text", "editable": true, "index": "djdate", "hidden": false, "width": 80, "xsmc": "日&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;期", "name": "djdate", "align": "center" },
     { "edittype": "text", "editable": true, "index": "bmdm", "hidden": false, "width": 80, "xsmc": "部&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;门", "name": "bmdm", "align": "center" },
     { "edittype": "text", "editable": true, "index": "zydm", "hidden": false, "width": 80, "xsmc": "姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名", "name": "zydm", "align": "center" },
     { "edittype": "text", "editable": true, "index": "djtypedm", "hidden": false, "width": 80, "xsmc": "调整类型", "name": "djtypedm", "align": "center" },
     { "edittype": "text", "editable": true, "index": "a1", "hidden": false, "width": 80, "xsmc": "调整金额", "name": "a1", "align": "center" },
      { "edittype": "text", "editable": true, "index": "czydm", "hidden": false, "width": 80, "xsmc": "制&nbsp;&nbsp;单&nbsp;&nbsp;人", "name": "czydm", "align": "center" },
       { "edittype": "text", "editable": true, "index": "bz", "hidden": false, "width": 80, "xsmc": "备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注", "name": "bz", "align": "center" },
         { "edittype": "text", "editable": true, "index": "djtypemc", "hidden": true, "width": 80, "xsmc": "", "name": "djtypemc", "align": "center" },
          { "edittype": "text", "editable": true, "index": "czymc", "hidden": true, "width": 80, "xsmc": "", "name": "czymc", "align": "center" },
           { "edittype": "text", "editable": true, "index": "djbh", "hidden": true, "width": 80, "xsmc": "", "name": "djbh", "align": "center"}]
    };

    if (config == null) {
        window.parent.cihoAlert(msg.other.modelInfoFail);
        return;
    }
    if (strDjbh != "") {
        var objRecords = ParseData(window.external.DoOptions(strTableP051801_tzd, 'GetList', "{\"djbh\":\"" + strDjbh + "\"}"));
    }
    //创建头部
    var i = 0;
    var strForm = "";
    var Item;
    strForm += "<ul>";
    for (i = 0; i < config.pageHeader.length; i++) {

        Item = config.pageHeader[i];
        if (Item.hidden == true) {
            continue;
        }
        if (Item.edittype == "text") {
            strForm += "<li>";
            strForm += Item.xsmc + "：";
            strForm += "<input type='text'  name='" + Item.index + "' disabled ";
            strForm += " value=''  ";
            strForm += " id='" + Item.index + "'";
            strForm += " onkeypress='return checkValidate(event)' onpaste='return validatePaste()'/>";
            strForm += "</li>";
        }

    }
    strForm += "</ul>";
    $("#" + strDialogP051801_tzd + "_divform").append(strForm).append("<br/>");
    //添加按钮
    //下拉框的值
    var objBm = getComboboxData('Tbmxx');
    //bm
    $("#bmdm", $("#" + strDialogP051801_tzd + "_divform")).combobox({
        textField: "mc",
        valueField: "dm"
    });
    objBm.push({ "dm": "", "mc": "其他部门" });
    if (objBm != "{}") {
        $("#bmdm", $("#" + strDialogP051801_tzd + "_divform")).combobox("loadData", objBm);
    }
    //lx
    $("#djtypedm", $("#" + strDialogP051801_tzd + "_divform")).combobox({
        textField: "mc",
        valueField: "dm",
        panelHeight: 42
    });
    var strTzData = [{ "dm": "0", "mc": "提成增加" }, { "dm": "1", "mc": "提成减少"}];
    $("#djtypedm", $("#" + strDialogP051801_tzd + "_divform")).combobox("loadData", strTzData);
    $(".layoutpanel").css("z-index", "50000009");
    //加载数据
    $("#a1", $("#" + strDialogP051801_tzd + "_divform")).val(parseFloat(objRecords.Records[0].a1).toFixed(window.parent.strMoneyPlace));
    $("#djdate", $("#" + strDialogP051801_tzd + "_divform")).val(objRecords.Records[0].djdate);
    if (objRecords.Records[0].bmmc != "") {
        $("#bmdm", $("#" + strDialogP051801_tzd + "_divform")).combobox('setText', objRecords.Records[0].bmmc);
    }
    else {
        $("#bmdm", $("#" + strDialogP051801_tzd + "_divform")).combobox('setValue', objRecords.Records[0].bmdm);
    }
    $("#zydm", $("#" + strDialogP051801_tzd + "_divform")).val(objRecords.Records[0].zymc);
    $("#djtypedm", $("#" + strDialogP051801_tzd + "_divform")).combobox('setValue', objRecords.Records[0].tzlx);
    $("#czydm", $("#" + strDialogP051801_tzd + "_divform")).val(objRecords.Records[0].czymc);
    $("#bz", $("#" + strDialogP051801_tzd + "_divform")).val(escape(objRecords.Records[0].a2));
    config = null;
    objBm = {};
    strTzData = {};
    objRecords = {};
    strForm = null;
    Item = null;
    i = null;
}
/*↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑**自定义方法 结束**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑*/