///<reference path="/Scripts/ExtPB_Net.js" />
///<reference path="/Scripts/MyExtPB.js" />
///<reference path="/Scripts/ExtPB_Dll_Pb_Http.js" />
///<reference path="/Scripts/MyExtPb_Input.js" />

function W_LYJS_SPMX() {

    var self = this;
    this.Instance = null;
    var requestor = new PBWindow();
    var cbx_kh = new CheckBox(requestor);
    var cbx_bm = new CheckBox(requestor);
    var cbx_pzh = new CheckBox(requestor);
    var cbx_rq = new CheckBox(requestor);
    var ddlb_1 = new DropDownListBox(requestor);
    var cb_5 = new CommandButton(requestor);
    var sle_gys = new SingleLineEdit(requestor);
    var cb_4 = new CommandButton(requestor);
    var sle_jj = new SingleLineEdit(requestor);
    var cb_3 = new CommandButton(requestor);
    var sle_pp = new SingleLineEdit(requestor);
    var cb_2 = new CommandButton(requestor);
    var cb_1 = new CommandButton(requestor);
    var dp_2 = new DatePicker(requestor);
    var dp_1 = new DatePicker(requestor);
    var sle_spkh = new SingleLineEdit(requestor);
    var sle_pzh = new SingleLineEdit(requestor);
    var sle_bm = new SingleLineEdit(requestor);
    var dw_list = new DataWindow(requestor);
    var tb_1 = new ToolStrip(requestor);

    if (typeof (this.bind) == "function") var baseBind = this.bind;
    this.bind = function (win) {
        self.Instance = win;
        if (typeof (baseBind) == "function") baseBind(win);

        if (requestor == null) requestor = new PBWindow();
        requestor.Attach(win);
        if (cbx_kh == null) cbx_kh = new CheckBox(requestor);
        cbx_kh.Attach(win.Control("cbx_kh"));
        if (cbx_bm == null) cbx_bm = new CheckBox(requestor);
        cbx_bm.Attach(win.Control("cbx_bm"));
        if (cbx_pzh == null) cbx_pzh = new CheckBox(requestor);
        cbx_pzh.Attach(win.Control("cbx_pzh"));
        if (cbx_rq == null) cbx_rq = new CheckBox(requestor);
        cbx_rq.Attach(win.Control("cbx_rq"));
        if (ddlb_1 == null) ddlb_1 = new DropDownListBox(requestor);
        ddlb_1.Attach(win.Control("ddlb_1"));
        if (cb_5 == null) cb_5 = new CommandButton(requestor);
        cb_5.Attach(win.Control("cb_5"));
        if (sle_gys == null) sle_gys = new SingleLineEdit(requestor);
        sle_gys.Attach(win.Control("sle_gys"));
        if (cb_4 == null) cb_4 = new CommandButton(requestor);
        cb_4.Attach(win.Control("cb_4"));
        if (sle_jj == null) sle_jj = new SingleLineEdit(requestor);
        sle_jj.Attach(win.Control("sle_jj"));
        if (cb_3 == null) cb_3 = new CommandButton(requestor);
        cb_3.Attach(win.Control("cb_3"));
        if (sle_pp == null) sle_pp = new SingleLineEdit(requestor);
        sle_pp.Attach(win.Control("sle_pp"));
        if (cb_2 == null) cb_2 = new CommandButton(requestor);
        cb_2.Attach(win.Control("cb_2"));
        if (cb_1 == null) cb_1 = new CommandButton(requestor);
        cb_1.Attach(win.Control("cb_1"));
        if (dp_2 == null) dp_2 = new DatePicker(requestor);
        dp_2.Attach(win.Control("dp_2"));
        if (dp_1 == null) dp_1 = new DatePicker(requestor);
        dp_1.Attach(win.Control("dp_1"));
        if (sle_spkh == null) sle_spkh = new SingleLineEdit(requestor);
        sle_spkh.Attach(win.Control("sle_spkh"));
        if (sle_pzh == null) sle_pzh = new SingleLineEdit(requestor);
        sle_pzh.Attach(win.Control("sle_pzh"));
        if (sle_bm == null) sle_bm = new SingleLineEdit(requestor);
        sle_bm.Attach(win.Control("sle_bm"));
        if (dw_list == null) dw_list = new DataWindow(requestor);
        dw_list.Attach(win.Control("dw_list"));
        if (tb_1 == null) tb_1 = new ToolStrip(requestor);
        tb_1.Attach(win.Control("tb_1"));

        if (typeof (self.ChangeGongYingShang) == "function")
            win.AttachEvent("cb_5", "Clicked", self.ChangeGongYingShang);

        if (typeof (self.ChangeJiJie) == "function")
            win.AttachEvent("cb_4", "Clicked", self.ChangeJiJie);

        if (typeof (self.ChangePinPai) == "function")
            win.AttachEvent("cb_3", "Clicked", self.ChangePinPai);

        if (typeof (self.ChangeSpkh) == "function")
            win.AttachEvent("cb_2", "Clicked", self.ChangeSpkh);

        if (typeof (self.khchanges) == "function")
            win.AttachEvent("cb_1", "Clicked", self.khchanges);

        if (typeof (self.Qyery) == "function")
            win.AttachEvent("btn_1", "Clicked", self.Qyery);

        if (typeof (self.Exit) == "function")
            win.AttachEvent("btn_4", "Clicked", self.Exit);

    }

    if (typeof (this.unbind) == "function") var baseUnBind = this.unbind;
    this.unbind = function () {
        self.Instance = null;
        if (typeof (this.Release) == "function") this.Release();
        if (typeof (baseUnBind) == "function") baseUnBind();

        cbx_kh.Detach(); cbx_kh = null;
        cbx_bm.Detach(); cbx_bm = null;
        cbx_pzh.Detach(); cbx_pzh = null;
        cbx_rq.Detach(); cbx_rq = null;
        ddlb_1.Detach(); ddlb_1 = null;
        cb_5.Detach(); cb_5 = null;
        sle_gys.Detach(); sle_gys = null;
        cb_4.Detach(); cb_4 = null;
        sle_jj.Detach(); sle_jj = null;
        cb_3.Detach(); cb_3 = null;
        sle_pp.Detach(); sle_pp = null;
        cb_2.Detach(); cb_2 = null;
        cb_1.Detach(); cb_1 = null;
        dp_2.Detach(); dp_2 = null;
        dp_1.Detach(); dp_1 = null;
        sle_spkh.Detach(); sle_spkh = null;
        sle_pzh.Detach(); sle_pzh = null;
        sle_bm.Detach(); sle_bm = null;
        dw_list.Detach(); dw_list = null;
        tb_1.Detach(); tb_1 = null;
        requestor.Detach(); requestor = null;

        setTimeout(CollectGarbage, 100);
    }

    //以上代码由设计器自动生成,请不要手工修改
    //ExtPB.Net JavaScript End  设计器查找标志,请不要删除或修改
    webReq = new WebRequestor();
    webReq.SetWebServiceUrl("/Service/ServiceForDwSyndax.ashx");
    var curW_OPEN_BMDA_NEW = new OpenWindowQueryNewBase();
    var curW_OPEN_BMDA_URL = "OpenWindowQueryNewBase";
    var curW_OPEN_SIMPLE_CHOSE = new OpenWindowSimpleChoseBase();
    this.Qyery = function () {
        var beginTime = UtcDateFormatToString(dp_1.GetValue());
        var endTime = UtcDateFormatToString(dp_2.GetValue());
        var orderSql = "";
        var groupSql = "";
        var SqlWhere = "  AND CONVERT(DATE,rq,120) BETWEEN '" + beginTime + "' AND '" + endTime + "' ";

        var khbh = sle_bm.GetText();
        var pzh = sle_pzh.GetText();
        var spkh = sle_spkh.GetText();
        var pp = sle_pp.GetText();
        var jj = sle_jj.GetText();
        var nf = ddlb_1.GetText();
        var gys = sle_gys.GetText();
        if (khbh != "") {
            SqlWhere += " and mx.bmbh in(" + khbh + ")";
        }
        if (pzh != "") {
            SqlWhere += " and mx.pzh like '%" + pzh + "%'";
        }
        if (spkh != "") {
            SqlWhere += " and da.spkh in(" + spkh + ")";
        }
        if (pp != "") {
            SqlWhere += " and da.jypp in(" + pp + ")";
        }
        if (jj != "") {
            SqlWhere += " and da.spjj in(" + jj + ")";
        }
        if (nf != "") {
            SqlWhere += " and da.spnf ='" + nf + "'";
        }
        if (gys != "") {
            SqlWhere += " and da.gysbh in(" + gys + ")";
        }

        dw_list.SetRedraw(false);
        var sql = "SELECT  ";
        if (cbx_rq.GetChecked()) {
            sql += " CONVERT(DATE, rq, 120) RQ ,";
            orderSql += " CONVERT(DATE, rq, 120) DESC,"
            groupSql += " ,CONVERT(DATE, rq, 120)";
        }
        if (cbx_pzh.GetChecked()) {
            sql += " pzh ,";
            orderSql += " pzh DESC,"
            groupSql += " ,pzh "
        }
        if (cbx_bm.GetChecked()) {
            sql += " MX.bmbh bmbh,BM.bmmc bmmc,";
            orderSql += " MX.bmbh DESC,"
            groupSql += " ,MX.bmbh ,BM.bmmc "

        }
        if (cbx_kh.GetChecked()) {
            sql += " MX.spkh spkh,DA.ksmc ksmc,jldw,";
            orderSql += " MX.spkh DESC,"
            groupSql += "  ,MX.spkh ,DA.ksmc ,jldw"
        }
        if (orderSql != "") {
            orderSql = orderSql.substring(0, orderSql.length - 1);
        }
        sql += " SUM(sl) SL , ";
        sql += "  MAX(lsj) LSJ , ";
        sql += " SUM(lsj*sl) LSJE , ";
        sql += " CAST(( CASE SUM(sl) ";
        sql += "    WHEN 0 THEN 0 ";
        sql += " ELSE CASE '0' ";
        sql += "  WHEN MX.qjfs THEN SUM(MX.zjje) / SUM(sl) ";
        sql += " ELSE SUM(MX.pfze) / SUM(sl) ";
        sql += "  END ";
        sql += "  END ) AS DECIMAL(30, 2)) DANJIA , ";
        sql += "   CASE '0' ";
        sql += "      WHEN MX.QJFS THEN SUM(MX.zjje) ";
        sql += "      ELSE SUM(MX.PFZE) ";
        sql += "     END JSZE  ";
//        sql += "     MAX(cbj) CBJ , ";
//        sql += "     sum(cbj*sl) CBJE  ";



//        sql += "    ( CASE '0' ";
//        sql += "         WHEN MX.QJFS THEN SUM(MX.zjje) ";
//        sql += "         ELSE SUM(MX.PFZE) ";
//        sql += "       END ) - ( sum(cbj*sl) ) ml , ";




//        sql += "    CAST(CASE ( CASE SUM(sl) ";
//        sql += "                  WHEN 0 THEN 0 ";
//        sql += "                  ELSE CASE '0' ";
//        sql += "                        WHEN MX.qjfs THEN SUM(MX.zjje) / SUM(sl) ";
//        sql += "                        ELSE SUM(MX.pfze) / SUM(sl) ";
//        sql += "                      END ";
//        sql += "               END ) ";
//        sql += "          WHEN 0 THEN 1 ";
//        sql += "         ELSE ( ( CASE '0' ";
//        sql += "                     WHEN MX.QJFS THEN SUM(MX.zjje) ";
//        sql += "                     ELSE SUM(MX.PFZE) ";
//        sql += "                   END ) - ( sum(cbj*sl) ) ) ";
//        sql += "               / ( CASE '0' ";
//        sql += "                    WHEN MX.QJFS THEN SUM(MX.zjje) ";
//        sql += "                   ELSE SUM(MX.PFZE) ";
//        sql += "                   END ) ";
//        sql += "          END AS DECIMAL(5, 2)) mlv ";
        sql += " FROM    dbo.yw_pos_mx_spkh MX ,dbo.da_sp_spda DA ,dbo.da_bmda BM  ";
        sql += " WHERE   MX.spkh = DA.spkh AND MX.bmbh = BM.bmbh   " + SqlWhere;
        sql += " GROUP BY MX.QJFS  " + groupSql;
        if (orderSql != "") {
            sql += " ORDER BY  " + orderSql;
        }
        webReq.Invoke("GetSnataxAndDataFromSql", "sql=" + sql);
        if (webReq.StatusCode() == 200) {

            dw_list.SetFullState(webReq.ResponseText());
            var colCount = dw_list.Describe("DataWindow.Column.Count");

            self.Set_Width_DW(colCount);
            self.SetSummary();
            A8erp_Report.ReportDataWindowHeaderColor(dw_list);
            dw_list.SetRedraw(true);
            dw_list.SetRowSelection(1);
        } else {

            alert("error!");
        }
    }

    this.Set_Width_DW = function (colCount) {
        dw_list.Modify("DataWindow.header.Height=76");
        dw_list.Modify("DataWindow.detail.Height=90");

        var ls_columntitle = "";
        for (var li_loop1 = 1; li_loop1 <= colCount; li_loop1++) {

            var ls_columnname = dw_list.Describe('#' + String(li_loop1) + '.name');

            //alert("ls_columnname" + ls_columnname)
            switch (ls_columnname) {
                case "pzh":
                    ls_columntitle = "凭证号"

                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 800 + "'");

                    break;
                case "rq":
                    ls_columntitle = "日期"

                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 500 + "'");

                    break;

                case "yw_pos_mx_spkh_bmbh":
                    ls_columntitle = "部门编号"
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");

                    break;
                case "jldw":
                    ls_columntitle = "单位"
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 120 + "'");

                    break;

                case "da_bmda_bmmc":
                    ls_columntitle = "部门名称";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");

                    break;

                case "yw_pos_mx_spkh_spkh":
                    ls_columntitle = "商品款式";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");

                    break;
                case "da_sp_spda_ksmc":
                    ls_columntitle = "款式名称";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");

                    break;

                case "sl":
                    ls_columntitle = "数量";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".edit.name='#####' " + ls_columnname + ".editmask.mask='###########0' ")
                    dw_list.Modify(ls_columnname + ".width = '" + 300 + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0' ")

                    break;
                case "lsj":
                    ls_columntitle = "零售价";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")
                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "lsje":
                    ls_columntitle = "零售金额";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "danjia":
                    ls_columntitle = "结算价";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "jsze":
                    ls_columntitle = "结算金额";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "cbj":
                    ls_columntitle = "成本价";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "cbje":
                    ls_columntitle = "成本金额";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "ml":
                    ls_columntitle = "毛利";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
                case "mlv":
                    ls_columntitle = "毛利率";
                    dw_list.Modify(ls_columnname + "_t.text='" + ls_columntitle + "'");
                    dw_list.Modify(ls_columnname + ".format='###########0.00' ")

                    dw_list.Modify(ls_columnname + ".width = '" + 400 + "'");
                    break;
            }

        }
        dw_list.Modify("create compute(band=detail alignment='2' expression='getrow()'border='0' color='33554432' x='0' y='4' height='76' width='183' format='[GENERAL]' html.valueishtml='0'  name=xh visible='1'  font.face='Tahoma' font.height='-9' font.weight='400'  font.family='2' font.pitch='2' font.charset='0' background.mode='2' background.color='1073741824' background.transparency='0' background.gradient.color='8421504' background.gradient.transparency='0' background.gradient.angle='0' background.brushmode='0' background.gradient.repetition.mode='0' background.gradient.repetition.count='0' background.gradient.repetition.length='100' background.gradient.focus='0' background.gradient.scale='100' background.gradient.spread='100' tooltip.backcolor='134217752' tooltip.delay.initial='0' tooltip.delay.visible='32000' tooltip.enabled='0' tooltip.hasclosebutton='0' tooltip.icon='0' tooltip.isbubble='0' tooltip.maxwidth='0' tooltip.textcolor='134217751' tooltip.transparency='0' transparency='0' )")
        dw_list.Modify("create text(band=header alignment='2' text='序号' border='0' color='33554432' x='0' y='0' height='56' width='183' html.valueishtml='0'  name=xh_t visible='1'  font.face='Tahoma' font.height='-9' font.weight='400'  font.family='2' font.pitch='2' font.charset='0' background.mode='2' background.color='536870912' background.transparency='0' background.gradient.color='8421504' background.gradient.transparency='0' background.gradient.angle='0' background.brushmode='0' background.gradient.repetition.mode='0' background.gradient.repetition.count='0' background.gradient.repetition.length='100' background.gradient.focus='0' background.gradient.scale='100' background.gradient.spread='100' tooltip.backcolor='134217752' tooltip.delay.initial='0' tooltip.delay.visible='32000' tooltip.enabled='0' tooltip.hasclosebutton='0' tooltip.icon='0' tooltip.isbubble='0' tooltip.maxwidth='0' tooltip.textcolor='134217751' tooltip.transparency='0' transparency='0' )");
    }

    //#region 合计列
    this.SetSummary = function () {

        var ls_slx = dw_list.Describe("sl.x")
        var ls_slwidth = dw_list.Describe("sl.width")

        var ls_lsjex = dw_list.Describe("lsje.x")
        var ls_lsjewidth = dw_list.Describe("lsje.width")


        var ls_jsjelx = dw_list.Describe("jsze.x")
        var ls_jsjewidth = dw_list.Describe("jsze.width")

        var ls_cbjex = dw_list.Describe("cbje.x")
        var ls_cbjewidth = dw_list.Describe("cbje.width")

        var ls_mlx = dw_list.Describe("ml.x")
        var ls_mlwidth = dw_list.Describe("ml.width")


        ls_syntax = dw_list.Modify("DataWindow.summary.Height=90");

        ls_syntax = ls_syntax + " create compute(band=summary alignment='1' expression='sum(sl  for all)' border='0' color='128' x='" + ls_slx + "' y='8' height='52' width='" + ls_slwidth + "' name=dj_sum  visible='1' font.face='Arial' font.height='-9' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='1' background.color='536870912' format='0')"

        ls_syntax = ls_syntax + " create compute(band=summary alignment='1' expression='sum(lsje  for all)' border='0' color='128' x='" + ls_lsjex + "' y='8' height='52' width='" + ls_lsjewidth + "' name=dj_sum  visible='1' font.face='Arial' font.height='-9' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='1' background.color='536870912' format='0.00')"

        ls_syntax = ls_syntax + " create compute(band=summary alignment='1' expression='sum(jsze  for all)' border='0' color='128' x='" + ls_jsjelx + "' y='8' height='52' width='" + ls_lsjewidth + "' name=dj_sum  visible='1' font.face='Arial' font.height='-9' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='1' background.color='536870912' format='0.00')"

        ls_syntax = ls_syntax + " create compute(band=summary alignment='1' expression='sum(cbje  for all)' border='0' color='128' x='" + ls_cbjex + "' y='8' height='52' width='" + ls_cbjewidth + "' name=dj_sum  visible='1' font.face='Arial' font.height='-9' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='1' background.color='536870912' format='0.00')"

        ls_syntax = ls_syntax + " create compute(band=summary alignment='1' expression='sum(ml  for all)' border='0' color='128' x='" + ls_mlx + "' y='8' height='52' width='" + ls_mlwidth + "' name=dj_sum  visible='1' font.face='Arial' font.height='-9' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='1' background.color='536870912' format='0.00')"

        dw_list.Modify(ls_syntax);

    }
    //#endregion
    var dwoName = "";
    this.khchanges = function (x, y, row, dwoName) {
        dwoName = "bmbh";
        curW_OPEN_BMDA_NEW.SetDataWindow(W_LYJS_SPMX, "bmbh", "bmmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base." + curW_OPEN_BMDA_URL + "&treeDw=dw_da_bmda_fl_tree&listDw=dw_pub_list_bmda&treeRootLabel=部门分类&treeData=flbh&treeLabel=flmc&treeParentData=fflbh&treeLeave=islast&selectStyle=multiple&curQxlx=cwcx"), curW_OPEN_BMDA_NEW, null);
    }
    this.ChangeSpkh = function (x, y, row, dwoName) {
        dwoName = "spkh";

        curW_OPEN_BMDA_NEW.SetDataWindow(W_LYJS_SPMX, "spkh", "ksmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base." + curW_OPEN_BMDA_URL + "&treeDw=dw_da_sp_lbda_tree&listDw=dw_da_sp_spda_1&treeRootLabel=商品分类&treeData=lbbh&treeLabel=lbmc&treeParentData=flbbh&treeLeave=islast&selectStyle=multiple&curQxlx=all"), curW_OPEN_BMDA_NEW, null);

    }
    this.ChangePinPai = function (x, y, row, dwoName) {
        dwoName = "ppbm";
        curW_OPEN_SIMPLE_CHOSE.SetDataWindow(W_LYJS_SPMX, "ppbm", "ppmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base.OpenWindowSimpleChoseBase&listDw=dw_sp_sppp_by_yhbh&selectStyle=multiple&flag=ywcx"), curW_OPEN_SIMPLE_CHOSE, null);
    }
    this.ChangeJiJie = function (x, y, row, dwoName) {
        dwoName = "jjbm";
        curW_OPEN_SIMPLE_CHOSE.SetDataWindow(W_LYJS_SPMX, "jjbm", "jjmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base.OpenWindowSimpleChoseBase&listDw=dw_da_sp_jjda_list&selectStyle=multiple"), curW_OPEN_SIMPLE_CHOSE, null);
    }
    this.ChangeGongYingShang = function (x, y, row, dwoName) {
        dwoName = "gysbh";
        curW_OPEN_BMDA_NEW.SetDataWindow(W_LYJS_SPMX, "gysbh", "gysmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base." + curW_OPEN_BMDA_URL + "&treeDw=dw_da_gysda_fl_tree&listDw=dw_pub_list_gysda&treeRootLabel=供应商分类&treeData=flbh&treeLabel=flmc&treeParentData=fflbh&treeLeave=islast&selectStyle=multiple"), curW_OPEN_BMDA_NEW, null);
    }
    this.SetSleValue = function (difBh, val) {

        if ("''" == val)
            val = "";
        else if ("bmbh" == difBh)
            sle_bm.SetText(val);
        else if ("gysbh" == difBh)
            sle_gys.SetText(val);
        else if ("ppbm" == difBh)
            sle_pp.SetText(val);
        else if ("jjbm" == difBh)
            sle_jj.SetText(val);
        else if ("spkh" == difBh)
            sle_spkh.SetText(val);



    }
    this.Exit = function () {
        setTimeout("window.close();", 100);
    }
}