select ((SELECT MAIN_OUTPUT FROM ZL_REPORT_FORM twhere 1=1${if(len(WORK)=0,"","and substr(t.ACCOUNT_YEAR_MONTH,1,4) = '"+left(WORK,4)+"'")}AND ITEM_CODE = 'ZL006')*10000) TCBBCKfrom ZL_REPORT_FORM WHERE ITEM_CODE = 'ZL006'
SELECT sum(MAIN_OUTPUT*1000) as TCBBCK
FROM ZL_REPORT_FORM t
where 1=1
${if(len(WORK)=0,"","and substr(t.ACCOUNT_YEAR_MONTH,1,4) = '"+left(WORK,4)+"'")}
${if(len(WORK)=0,"","and substr(t.ACCOUNT_YEAR_MONTH,6,2) <= '"+right(WORK,2)+"'")}
AND ITEM_CODE = 'ZL006'
在单元格用公式生成一个日期填充序列,然后扩展
${if(len(WORK)=0,"","and t.ACCOUNT_YEAR_MONTH between '"+concatenate(WORK,"-01")+"' and '"+concatenate(WORK,"-",format(today(),"MM"))+"'")}