补充:就写了一个js:js没有调用数据库的地方_g().parameterEl.getWidgetByName('p_dateEditor0').setValue(a);_g().parameterEl.getWidgetByName('p_dateEditor1').setValue(b);_g().parameterEl.getWidgetByName('p_numberEditor0').setValue(2);var c = _g().parameterEl.getWidgetByName('p_cx_bz').getValue();_g().parameterEl.getWidgetByName('p_cx').setValue(c);var c = _g().parameterEl.getWidgetByName('p_gys_bz').getValue();_g().parameterEl.getWidgetByName('p_gys').setValue(c);sql有好几个:但基本差不多,就是查的东西不一样,复制一个SELECT top 5 * from ( select COMPNO, sum(BQTZL) as zl, sum(BQTHSHZ) as hs from dbo.ZNMS_JIT_Z2_FXHZ_MBS WHERE BQTZL != '' and Z1STMP in (SELECT Z1STMP FROM dbo.ZNMS_JIT_Z2_FXHZ_MBS WHERE DATEPART(DW,Z1STMP)=2) ${if(p_checkBox0="true", "and COMPNO not in (SELECT MATERIAL FROM dbo.ZNMS_JIT_PCH WHERE VALID IS NULL AND SUPPLIER IS NULL AND MATERIAL IS NOT NULL) and LIFNR not in (SELECT SUPPLIER FROM dbo.ZNMS_JIT_PCH WHERE VALID IS NULL AND MATERIAL IS NULL AND SUPPLIER IS NOT NULL) and not EXISTS (select 1 from dbo.ZNMS_JIT_PCH where VALID IS NULL and supplier =dbo.ZNMS_JIT_Z2_FXHZ_MBS.lifnr and MATERIAL=dbo.ZNMS_JIT_Z2_FXHZ_MBS.compno)","")} ${if(len(p_cx)==0,"","and MATKL in ( '"+p_cx+"' )")} ${if(len(p_gys)==0,"","and LIFNR in ( '"+p_gys+"' )")} ${if(len(p_dateEditor0)==0,"","and Z1MON >= '"+p_dateEditor0+"'")} ${if(len(p_dateEditor1)==0,"","and Z1MON <= '"+p_dateEditor1+"'")} and RGMON<= REPLACE(CONVERT(varchar(7), dateadd(month,${p_numberEditor0},Z1MON+'01'), 120),'-','') group by COMPNO ) t1 ORDER BY t1.zl DESC原材料齐套分析_月 供应商.rar