///<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_TZD_JQDCM() {

    var self = this;
    var requestor = new PBWindow();
    var dw_Zx = new DataWindow(requestor);
    var dw_Hx = new DataWindow(requestor);
    var mle_ShowSqlInf = new MultiLineEdit(requestor);
    var dw_Host = new DataWindow(requestor);
    var rb_zx = new RadioButton(requestor);
    var cbx_splb = new CheckBox(requestor);
    var sle_bxbh = new SingleLineEdit(requestor);
    var rb_hx = new RadioButton(requestor);
    var sle_cgfs = new SingleLineEdit(requestor);
    var sle_jjbm = new SingleLineEdit(requestor);
    var cbx_hbzxx = new CheckBox(requestor);
    var cbx_fs = new CheckBox(requestor);
    var cbx_gys = new CheckBox(requestor);
    var cbx_bm = new CheckBox(requestor);
    var cbx_pzh = new CheckBox(requestor);
    var cbx_rq = new CheckBox(requestor);
    var sle_gysbh = new SingleLineEdit(requestor);
    var sle_bmbh = new SingleLineEdit(requestor);
    var sle_ppbm = new SingleLineEdit(requestor);
    var sle_lbbh = new SingleLineEdit(requestor);
    var sle_pzh = new SingleLineEdit(requestor);
    var sle_spkh = new SingleLineEdit(requestor);
    var dp_2 = new DatePicker(requestor);
    var dp_1 = new DatePicker(requestor);
    var tb_1 = new ToolStrip(requestor);

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

        if (requestor == null) requestor = new PBWindow();
        requestor.Attach(win);
        if (dw_Zx == null) dw_Zx = new DataWindow(requestor);
        dw_Zx.Attach(win.Control("dw_Zx"));
        if (dw_Hx == null) dw_Hx = new DataWindow(requestor);
        dw_Hx.Attach(win.Control("dw_Hx"));
        if (mle_ShowSqlInf == null) mle_ShowSqlInf = new MultiLineEdit(requestor);
        mle_ShowSqlInf.Attach(win.Control("mle_ShowSqlInf"));
        if (dw_Host == null) dw_Host = new DataWindow(requestor);
        dw_Host.Attach(win.Control("dw_Host"));
        if (rb_zx == null) rb_zx = new RadioButton(requestor);
        rb_zx.Attach(win.Control("rb_zx"));
        if (cbx_splb == null) cbx_splb = new CheckBox(requestor);
        cbx_splb.Attach(win.Control("cbx_splb"));
        if (sle_bxbh == null) sle_bxbh = new SingleLineEdit(requestor);
        sle_bxbh.Attach(win.Control("sle_bxbh"));
        if (rb_hx == null) rb_hx = new RadioButton(requestor);
        rb_hx.Attach(win.Control("rb_hx"));
        if (sle_cgfs == null) sle_cgfs = new SingleLineEdit(requestor);
        sle_cgfs.Attach(win.Control("sle_cgfs"));
        if (sle_jjbm == null) sle_jjbm = new SingleLineEdit(requestor);
        sle_jjbm.Attach(win.Control("sle_jjbm"));
        if (cbx_hbzxx == null) cbx_hbzxx = new CheckBox(requestor);
        cbx_hbzxx.Attach(win.Control("cbx_hbzxx"));
        if (cbx_fs == null) cbx_fs = new CheckBox(requestor);
        cbx_fs.Attach(win.Control("cbx_fs"));
        if (cbx_gys == null) cbx_gys = new CheckBox(requestor);
        cbx_gys.Attach(win.Control("cbx_gys"));
        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 (sle_gysbh == null) sle_gysbh = new SingleLineEdit(requestor);
        sle_gysbh.Attach(win.Control("sle_gysbh"));
        if (sle_bmbh == null) sle_bmbh = new SingleLineEdit(requestor);
        sle_bmbh.Attach(win.Control("sle_bmbh"));
        if (sle_ppbm == null) sle_ppbm = new SingleLineEdit(requestor);
        sle_ppbm.Attach(win.Control("sle_ppbm"));
        if (sle_lbbh == null) sle_lbbh = new SingleLineEdit(requestor);
        sle_lbbh.Attach(win.Control("sle_lbbh"));
        if (sle_pzh == null) sle_pzh = new SingleLineEdit(requestor);
        sle_pzh.Attach(win.Control("sle_pzh"));
        if (sle_spkh == null) sle_spkh = new SingleLineEdit(requestor);
        sle_spkh.Attach(win.Control("sle_spkh"));
        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 (tb_1 == null) tb_1 = new ToolStrip(requestor);
        tb_1.Attach(win.Control("tb_1"));

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

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_splb", "Clicked", self.CheckBoxClicked);

        if (typeof (self.ChangeKuanXing) == "function")
            win.AttachEvent("cb_7", "Clicked", self.ChangeKuanXing);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_bxbh", "EditChanged", self.FilterChanges);

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

        if (typeof (self.ChangeFangShi) == "function")
            win.AttachEvent("cb_6", "Clicked", self.ChangeFangShi);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_cgfs", "EditChanged", self.FilterChanges);

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

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_jjbm", "EditChanged", self.FilterChanges);

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

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

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

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

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_hbzxx", "Clicked", self.CheckBoxClicked);

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_fs", "Clicked", self.CheckBoxClicked);

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_gys", "Clicked", self.CheckBoxClicked);

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_bm", "Clicked", self.CheckBoxClicked);

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_pzh", "Clicked", self.CheckBoxClicked);

        if (typeof (self.CheckBoxClicked) == "function")
            win.AttachEvent("cbx_rq", "Clicked", self.CheckBoxClicked);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_gysbh", "EditChanged", self.FilterChanges);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_bmbh", "EditChanged", self.FilterChanges);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_ppbm", "EditChanged", self.FilterChanges);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_lbbh", "EditChanged", self.FilterChanges);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_pzh", "LoseFocus", self.FilterChanges);

        if (typeof (self.FilterChanges) == "function")
            win.AttachEvent("sle_spkh", "LoseFocus", self.FilterChanges);

        if (typeof (self.Query) == "function")
            win.AttachEvent("btn_Qurey", "Clicked", self.Query);

    }

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

        dw_Zx.Detach(); dw_Zx = null;
        dw_Hx.Detach(); dw_Hx = null;
        mle_ShowSqlInf.Detach(); mle_ShowSqlInf = null;
        dw_Host.Detach(); dw_Host = null;
        rb_zx.Detach(); rb_zx = null;
        cbx_splb.Detach(); cbx_splb = null;
        sle_bxbh.Detach(); sle_bxbh = null;
        rb_hx.Detach(); rb_hx = null;
        sle_cgfs.Detach(); sle_cgfs = null;
        sle_jjbm.Detach(); sle_jjbm = null;
        cbx_hbzxx.Detach(); cbx_hbzxx = null;
        cbx_fs.Detach(); cbx_fs = null;
        cbx_gys.Detach(); cbx_gys = null;
        cbx_bm.Detach(); cbx_bm = null;
        cbx_pzh.Detach(); cbx_pzh = null;
        cbx_rq.Detach(); cbx_rq = null;
        sle_gysbh.Detach(); sle_gysbh = null;
        sle_bmbh.Detach(); sle_bmbh = null;
        sle_ppbm.Detach(); sle_ppbm = null;
        sle_lbbh.Detach(); sle_lbbh = null;
        sle_pzh.Detach(); sle_pzh = null;
        sle_spkh.Detach(); sle_spkh = null;
        dp_2.Detach(); dp_2 = null;
        dp_1.Detach(); dp_1 = null;
        tb_1.Detach(); tb_1 = null;
        requestor.Detach(); requestor = null;

        setTimeout(CollectGarbage, 100);
    }

    //以上代码由设计器自动生成,请不要手工修改
    //ExtPB.Net JavaScript End  设计器查找标志,请不要删除或修改


    //#region 变量声明部分
    var curW_OPEN_BMDA = new OpenWindowQueryBase();
    var curW_OPEN_SIMPLE_CHOSE = new OpenWindowSimpleChoseBase();

    var curW_OPEN_BMDA_NEW = new OpenWindowQueryNewBase();
    var curW_OPEN_BMDA_URL = "OpenWindowQueryNewBase";
    var curOtherWidht = 1080;
    var curOtherHeight = 760;

    var curOpenWindowDoubleRowsChooseBase = new OpenWindowDoubleRowsChooseBase();


    webReq = new WebRequestor();
    webReq.SetWebServiceUrl("/Service/ServiceForDwSyndax.ashx");
    //#endregion


    //#region Function Qurey
    this.Query = function () {

        if (rb_hx.GetChecked())

            self.QueryForHx();
        else
            self.QueryForZx();

    }
    //#endregion 


    //#region Function ControlWhere
    this.ControlWhere = function () {

        var temArr = new Array();

        var beginDate = UtcDateFormatToString(dp_1.GetValue());
        var endDate = UtcDateFormatToString(dp_2.GetValue());
        var curPzh = sle_pzh.GetText();
        var curKh = sle_spkh.GetText();
        var curBm = sle_bmbh.GetText();
        var curPp = sle_ppbm.GetText();
        var curGys = sle_gysbh.GetText();
        var curLb = sle_lbbh.GetText();
        var curJj = sle_jjbm.GetText();
        var curFs = sle_cgfs.GetText();
        var curBx = sle_bxbh.GetText();

        temArr.push("and ( cgrq between '" + beginDate + "' and '" + endDate + "')");

        if (!(curPzh == 0))
            temArr.push(" pzh = '" + curPzh + "'");

        if (!(curBm == 0)) {
            curBm = self.DealWords(curBm);
            temArr.push(" bmbh in (" + curBm + ")");
        }

        if (!(curBx == 0)) {
            curBx = self.DealWords(curBx);
            temArr.push(" bxbh in (" + curBx + ")");
        }

        if (!(curFs == 0)) {
            curFs = self.DealWords(curFs);
            temArr.push(" cgfsbh in (" + curFs + ")");
        }

        if (!(curGys == 0)) {
            curGys = self.DealWords(curGys);
            temArr.push(" gysbh in (" + curGys + ")");
        }

        if (!(curJj == 0)) {
            curJj = self.DealWords(curJj);
            temArr.push(" spjjbh in (" + curJj + ")");
        }

        if (!(curKh == 0))
            temArr.push(" spkh = '" + curKh + "'");

        if (!(curLb == 0)) {
            curLb = self.DealWords(curLb);
            temArr.push(" splbbh in (" + curLb + " )");
        }

        if (!(curPp == 0)) {
            curPp = self.DealWords(curPp);
            temArr.push(" spppbh in (" + curPp + " )");
        }
        
        return temArr.join(" and ").toString();
    }
    //#endregion


    //#region Function ControlShowDataField
    this.ControlShowDataField = function (temArr) {

        var showColumnArr = new Array();

        if (!cbx_pzh.GetChecked())
            temArr.push("'pzh' pzh");
        else {
            showColumnArr.push("pzh");
            temArr.push("pzh");
        }

        if (!cbx_bm.GetChecked())
            temArr.push("'bmbh' bmbh,'bmmc' bmmc");
        else {
            showColumnArr.push("bmbh");
            showColumnArr.push("bmmc");
            temArr.push("bmbh,bmmc");
        }

        if (!cbx_fs.GetChecked())
            temArr.push("'cgfsbh' cgfsbh,'cgfsmc' cgfsmc");
        else {
            temArr.push("cgfsbh,cgfsmc");
            showColumnArr.push("cgfsbh");
            showColumnArr.push("cgfsmc");
        }

        if (!(cbx_gys.GetChecked()))
            temArr.push("'gysbh' gysbh,'gysmc' gysmc");
        else {
            showColumnArr.push("gysbh");
            showColumnArr.push("gysmc");
            temArr.push("gysbh,gysmc");
        }

        if (!(cbx_hbzxx.GetChecked()))
            temArr.push("'hbzxx' hbzxx");
        else {
            showColumnArr.push("hbzxx");
            temArr.push("hbzxx");
        }

        if (!(cbx_rq.GetChecked()))
            temArr.push("'cgrq' cgrq");
        else {
            showColumnArr.push("cgrq");
            temArr.push("cgrq");
        }

        if (!(cbx_splb.GetChecked()))
            temArr.push("'splbbh' splbbh,'splbmc' splbmc");
        else {
            showColumnArr.push("splbbh");
            showColumnArr.push("splbmc");
            temArr.push("splbbh,splbmc");
        }

        return showColumnArr;
    }
    //#endregion


    //#region Function rb_hx(点击横向RadioButton触发事件)
    this.rb_hx = function () {

        self.Query();
    }
    //#endregion


    //#region Function rb_zx(点击纵向RadioButton触发事件)
    this.rb_zx = function () {

        self.Query();
    }
    //#endregion


    //#region  弹出数据窗口的按钮的函数

    //#region Function ChangeBmbh
    this.ChangeBmbh = function () {

        curW_OPEN_BMDA_NEW.SetDataWindow(W_TZD_JQDCM, "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"), curW_OPEN_BMDA_NEW, null);

    }
    //#endregion 

    //#region Function ChangePinPai
    this.ChangePinPai = function () {

        curW_OPEN_SIMPLE_CHOSE.SetDataWindow(W_TZD_JQDCM, "ppbm", "ppmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base.OpenWindowSimpleChoseBase&listDw=dw_da_sp_ppda_list&selectStyle=multiple"), curW_OPEN_SIMPLE_CHOSE, null);

    }
    //#endregion 

    //#region Function ChangeGongYingShang
    this.ChangeGongYingShang = function () {

        curW_OPEN_BMDA_NEW.SetDataWindow(W_TZD_JQDCM, "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);

    }
    //#endregion 

    //#region Function ChangeLeiBie
    this.ChangeLeiBie = function () {

        curW_OPEN_BMDA_NEW.SetDataWindow(W_TZD_JQDCM, "lbbh", "lbmc", "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_lbda_list&treeRootLabel=商品分类&treeData=lbbh&treeLabel=lbmc&treeParentData=flbbh&treeLeave=islast&selectStyle=multiple"), curW_OPEN_BMDA_NEW, null);

    }
    //#endregion 

    //#region Function ChangeFangShi
    this.ChangeFangShi = function () {

        curW_OPEN_SIMPLE_CHOSE.SetDataWindow(W_TZD_JQDCM, "csbh", "csmc", "M", self)  // 这个用来给子窗口Set当前数据窗口
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base.OpenWindowSimpleChoseBase&listDw=dw_da_qj_csb_cgfs_list&selectStyle=multiple"), curW_OPEN_SIMPLE_CHOSE, null);

    }
    //#endregion 

    //#region Function ChangeKuanXing
    this.ChangeKuanXing = function () {

        curW_OPEN_BMDA.SetDataWindow(W_TZD_JQDCM, "bxbh", "bxmc", "M", self);
        requestor.Open(encodeURI("/Service/LoadWindow.ashx?WinName=A8ERP.DangAn.Base.OpenWindowQueryBase&treeDw=dw_da_sp_bxlb_tree&listDw=dw_da_sp_bxda_list&treeRootLabel=版型类别&treeData=lbbh&treeLabel=lbmc&treeParentData=flbbh&treeLeave=islast&selectStyle=multiple"), curW_OPEN_BMDA, null);

    }
    //#endregion 

    //#region Function ChangeJiJie
    this.ChangeJiJie = function () {

        curW_OPEN_SIMPLE_CHOSE.SetDataWindow(W_TZD_JQDCM, "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);

    }
    //#endregion

    //#region Function SetSleValue(选中后赋值给text文本域)
    this.SetSleValue = function (difBh, val) {
        if ("''" == val)
            val = "";

        if ("bmbh" == difBh)
            sle_bmbh.SetText(val);
        else if ("gysbh" == difBh)
            sle_gysbh.SetText(val);
        else if ("lbbh" == difBh)
            sle_lbbh.SetText(val);
        else if ("ppbm" == difBh)
            sle_ppbm.SetText(val);
        else if ("jjbm" == difBh)
            sle_jjbm.SetText(val);
        else if ("csbh" == difBh)
            sle_csbh.SetText(val);
        else if ("bxbh" == difBh)
            sle_bxbh.SetText(val);
    }
    //#endregion 

    //#endregion 


    //#region Funtion QueryForHx 横向查找
    this.QueryForHx = function () {

        var dynamicShowStr = self.DynamicShowStr();

        var doneWithDynamicShowStr = self.DoneWithDynamicShowStr(dynamicShowStr);

        var finishSql = "select " + dynamicShowStr + "sessionId,spkh,ksmc,jldw,ysbh,ysmc,bxmc," +
                                "cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,cm11,cm12,cm13,cm14,cm15,cm16,cm17,cm18," +
                                "cm19,cm20,cm21,cm22,cm23,cm24,cm25,cm26,cm27,cm28,cm29,cm30,cm31,cm32,cm33,cm34,cm35," +
                                "SUM(ISNULL(sl,0)) as sl,max(ISNULL(lsj,0)) as lsj,max(ISNULL(jj,0)) as jj,SUM(ISNULL(sl,0))*max(ISNULL(lsj,0)) as lsjze,SUM(ISNULL(sl,0))*max(ISNULL(jj,0)) as jjze, " +
                                "zkl,spppmc,spjjmc,nf,sx1,sx2,sx3,sx4,cmzbh " +
                                "from ls_cg_cgtzd_jqdcm_mx where (1 = 1) " + self.ControlWhere() +
                                " group by " +
                                " sessionId,spkh,ksmc,jldw,ysbh,ysmc,bxmc," +
                                "cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,cm11,cm12,cm13,cm14,cm15,cm16,cm17,cm18," +
                                "cm19,cm20,cm21,cm22,cm23,cm24,cm25,cm26,cm27,cm28,cm29,cm30,cm31,cm32,cm33,cm34,cm35," +
                                "zkl,spppmc,spjjmc,nf,sx1,sx2,sx3,sx4,cmzbh " + doneWithDynamicShowStr;

        self.DrawDataWindow(finishSql);
        var curCm = dw_Host.GetStringData1();
        Set35ColTitel(dw_Host, false, curCm);

    }
    //#endregion 


    //#region Function QueryForZx 纵向查找
    this.QueryForZx = function () {

        var dynamicShowStr = self.DynamicShowStr();

        var doneWithDynamicShowStr = self.DoneWithDynamicShowStr(dynamicShowStr);

        var finishSql = " select " + dynamicShowStr +
                        " spkh,ksmc,jldw,ysbh,ysmc,'01' as cmid,cmmc,spsl,jj,lsj,SUM(sl*jj)as jjze,SUM(sl*lsj)as lsjze,spppbh,spppmc,spjjmc,nf,sx1,sx2,sx3,sx4 from " +
                        " ls_cg_cgtzd_jqdcm_mx" +
                        " unpivot(" +
                        " spsl for cmmc in(" +
                        "[cm1],[cm2],[cm3],[cm4],[cm5],[cm6],[cm7],[cm8],[cm9],[cm10],[cm11],[cm12],[cm13],[cm14],[cm15],[cm16]," +
                        "[cm17],[cm18],[cm19],[cm20],[cm21],[cm22],[cm23],[cm24],[cm25],[cm26],[cm27],[cm28],[cm29],[cm30],[cm31],[cm32],[cm33],[cm34],[cm35]" +
                        ")) as newCmZx " +
                        " where (1 = 1) " + self.ControlWhere() +
                        " group by spkh,ksmc,jldw,ysbh,ysmc,cmmc,spsl,jj,lsj,spppbh,spppmc,spjjmc,nf,sx1,sx2,sx3,sx4 " + doneWithDynamicShowStr;

        self.DrawDataWindow(finishSql);

    }
    //#endregion


    //#region Function FilterChanges
    self.FilterChanges = function () {
        if (rb_hx.GetChecked())
            self.QueryForHx();
        else
            self.QueryForZx();
    }
    //#endregion 


    //#region Function CheckBoxClicked
    this.CheckBoxClicked = function () {
        if (rb_hx.GetChecked())
            self.QueryForHx();
        else
            self.QueryForZx();
    }
    //#endregion 


    //#region Fucntion DrawDataWindow
    this.DrawDataWindow = function (sql) {

        webReq.Invoke("dealDwSyndax", "sql=" + sql);
        if (webReq.StatusCode() == 200) {

            dw_Host.Create(webReq.ResponseText());
            dw_Host.Refresh();

        } else {

            alert("error!");
        }
    }
    //#endregion


    //#region Function DynamicShowStr
    this.DynamicShowStr = function () {

        var dynamicShowStr = "";

        if (cbx_bm.GetChecked())
            dynamicShowStr += "bmbh,bmmc,";
        if (cbx_gys.GetChecked())
            dynamicShowStr += "gysbh,gysmc,";
        if (cbx_pzh.GetChecked())
            dynamicShowStr += "pzh,";
        if (cbx_rq.GetChecked())
            dynamicShowStr += "cgrq,";
        if (cbx_splb.GetChecked())
            dynamicShowStr += "splbbh,splbmc,";
        if (cbx_fs.GetChecked())
            dynamicShowStr += "cgfsbh,cgfsmc,";
        if (cbx_hbzxx.GetChecked())
            dynamicShowStr += "hbzxx,";

        return dynamicShowStr;
    }
    //#endregion


    //#region Function DoneWithDynamicShowStr
    this.DoneWithDynamicShowStr = function (dynamicShowStr) {

        var doneWithDynamicShowStr = "";
        if (!(dynamicShowStr == ""))
            doneWithDynamicShowStr += "," + dynamicShowStr.substring(0, dynamicShowStr.length - 1);

        return doneWithDynamicShowStr;
    }
    //#endregion


    //#region Function DealWords
    this.DealWords = function (words) {

        if (!(words.charAt(0) == "'"))
            words = "'" + words + "'";
        return words;
    }
    //#endregion


}