wabacus 显示 求和 日期查询 sum

<?xml version="1.0" encoding="UTF-8"?>
<applications xmlns="http://www.wabacus.com"
			   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			   xsi:schemaLocation="http://www.wabacus.com ../xsd/wabacus.applications.xsd">
	<page id="chmonitorReportPage">
		<report id="chmonitorReport" title="渠道监控报表" pagesize="20" scrollstyle="image" scrollheight="300px" width="1100px" dataexport="richexcel">
			
		    <interceptor>
			      <imports>
			       <import>com.wabacus.util</import>
			       <import>java.util</import>
			       <import>java.text</import>
			      </imports>
			      <preaction>
			         <![CDATA[
 					        String deptid = rrequest.getStringAttribute("txtdeptid",""); 
 					        String tcreatetimebegin=rrequest.getStringAttribute("tcreatetimebegin","");
  					        String tcreatetimeend=rrequest.getStringAttribute("tcreatetimeend",""); 
  					        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  					        Date d = new Date();  
  					        String date1 = sdf.format(d);
							int m = d.getMonth();  
							int y = d.getYear();  
							Date from = new Date(y,m,1);  
							String date = sdf.format(from);
  					        if(tcreatetimebegin.equals("")){
  					        	tcreatetimebegin=date;
  					        }
  					        if(tcreatetimeend.equals("")){
  					        	tcreatetimeend=date1;
  					        }
 					        if(deptid.equals("")){   
 					           deptid = "001002";// 默认台州市  
  					        } 
  					        rrequest.setAttribute("txtdeptid",deptid);
  					        rrequest.setAttribute("tcreatetimebegin",tcreatetimebegin);
  					        rrequest.setAttribute("tcreatetimeend",tcreatetimeend);
  			         ]]>  
			      </preaction>
		    </interceptor>
			
			<display colselect="false">
				<col column="statdate" label="日期"  width="110px" rowgroup="true"/>
				 
				<col column="{sequence:1}" label="序号" width="30px"/>
				<col column="deptid" label="组织机构ID" displaytype="hidden"  />
				<col column="deptname" label="组织机构"  width="80px"   />
				<col column="MONTHCOUNT" label="月铺货" clickorderby="true" width="50px"/>
				<col column="NETCARDNUM" label="网聊卡数量"  displaytype="hidden" />
				<col column="NETCARDPERCENT" label="网聊卡占比" clickorderby="true" width="50px"/>
				<!--  活动预埋情况 -->
				<group label="活动预埋情况" labelstyleproperty="width:400px;">
					<col column="C20D60NUM" label="20得60预埋" />
					<group label="风险1:低首充预埋" labelstyleproperty="width:200px;">
					    <col column="F50NUM" label="首充50以上预埋" />
					    <col column="donotnum" label="不符合规定预埋" />
					</group>
					<group label="风险2:与带4预缴同时预埋" labelstyleproperty="width:200px;">
					    <col column="CONTAIN430NUM" label="带4送30预埋" />
					    <col column="F2060AND430NUM" label="20得60和带4送30同时预埋" />
					</group>
				</group>
				<!--  提醒短信预埋情况 -->
				<group label="提醒短信预埋情况" labelstyleproperty="width:400px;">
					<group label="二次充值短信" labelstyleproperty="width:200px;">
					    <col column="SDCOUNT" label="神州行+动感地带铺货" />
					    <col column="F100G200NUM" label="其中100得120优惠短信预埋" />
					    <col column="SDPERCENT" label="占比" />
					</group>
					<group label="带" labelstyleproperty="width:200px;">
					    <col column="CONTAIN4COUNT" label="带4铺货" />
					    <col column="CONTAIN430MSGNUM" label="带4送30优惠短信预埋" />
					    <col column="MSG430PERCENT" label="占比" />
					</group>
				</group>
				<!--  流量包 -->
				<group label="流量包" labelstyleproperty="width:400px;">
					    <col column="SZXCOUNT" label="神州行指定套餐铺货" />
					    <col column="NETPACKNUM" label="流量包预埋" />
				</group>
			</display>
			   
			 <subdisplay>
					    <statitems>
					          <statitem property="item1" value="sum(MONTHCOUNT)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item2" value="sum(C20D60NUM)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item3" value="sum(F50NUM)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item4" value="sum(donotnum)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item5" value="sum(CONTAIN430NUM)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item6" value="sum(F2060AND430NUM)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item7" value="sum(SDCOUNT)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item8" value="sum(F100G200NUM)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item9" value="sum(CONTAIN4COUNT)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item10" value="sum(CONTAIN430MSGNUM)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item11" value="sum(SZXCOUNT)" datatype="int" statiscope="page|report"></statitem>
					          <statitem property="item12" value="sum(NETPACKNUM)" datatype="int" statiscope="page|report"></statitem>
					          
					          <statitem property="item13" value="sum(NETCARDNUM)" datatype="int" statiscope="page|report"></statitem>
					          
					    
					    </statitems>
					      <subrow displaytype="page">
						     <subcol property="sprop1" colspan="3" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop2" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop3" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop4" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop5" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop6" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop7" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop8" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop9" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop10" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop11" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop12" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop13" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop14" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop15" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
						     <subcol property="sprop16" colspan="1" valuestyleproperty="bgcolor='#CCFAFF' align='center'"></subcol>
					    </subrow>
					     <format>
						     <imports>
							      <import>com.wabacus.system.format.*</import>
							      <import>cn.zonesea.jkd.util</import> 
							      <import>com.wabacus.util</import>
					    	      <import>com.wabacus</import>
						     </imports>
						     <value>
						<![CDATA[
							sprop1 = "合计";
							sprop2 =  FormatTools.formatDouble(String.valueOf(item1),"#,###0");
							Double  MONTHCOUNT = FormatTools.formatDouble(rrequest.getStringAttribute("MONTHCOUNT",""),"#,###0");
							
							//这里得到的是该区域在全市的占比 对于该报表无意义
							sprop3 = WabacusMath.operation(item13,item1,"/");
							sprop3 = WabacusMath.operation(sprop3,"100","*");
							sprop3 = "<font style='color:red;'>"+sprop3+"%</font>";
							
							sprop4 =  FormatTools.formatDouble(String.valueOf(item2),"#,###0");
							sprop5 =  FormatTools.formatDouble(String.valueOf(item3),"#,###0");
							sprop6 =  FormatTools.formatDouble(String.valueOf(item4),"#,###0");
							sprop7 =  FormatTools.formatDouble(String.valueOf(item5),"#,###0");
							sprop8 =  FormatTools.formatDouble(String.valueOf(item6),"#,###0");
							sprop9 =  FormatTools.formatDouble(String.valueOf(item7),"#,###0");
							sprop10 =  FormatTools.formatDouble(String.valueOf(item8),"#,###0");
							
							sprop11 = WabacusMath.operation(item8,item7,"/");
							sprop11 = WabacusMath.operation(sprop11,"100","*");
							sprop11 = "<font style='color:red;'>"+sprop11+"%</font>";
							
							sprop12 =  FormatTools.formatDouble(String.valueOf(item9),"#,###0");
							sprop13 =  FormatTools.formatDouble(String.valueOf(item10),"#,###0");
							
							sprop14 = WabacusMath.operation(item10,item9,"/");
							sprop14 = WabacusMath.operation(sprop14,"100","*");
							sprop14 = "<font style='color:red;'>"+sprop14+"%</font>";
							
							sprop15 =  FormatTools.formatDouble(String.valueOf(item11),"#,###0");
							sprop16 =  FormatTools.formatDouble(String.valueOf(item12),"#,###0");
							
						]]>
						</value>
					    </format>
			  </subdisplay> 
			
			<sql>
				<value>
                   <![CDATA[
				    SELECT  
				    		 '0' as statdate,
							 t.deptid,d.deptname,
							 sum(t.monthcount) monthcount,
							 sum(t.SDPERCENT) SDPERCENT,
							 '0' NETCARDPERCENT,
							 sum(t.MSG430PERCENT) MSG430PERCENT,
							 sum(t.c20d60num) c20d60num,
							 sum(t.f50num) as f50num,
							 sum(t.netcardnum) netcardnum,
							 sum(t.donotnum) donotnum,
							 sum(t.contain430num) contain430num,
							 sum(t.f2060and430num) f2060and430num,
							 sum(t.sdcount) sdcount,
							 sum(t.f100g200num) f100g200num,
							 sum(t.contain4count) contain4count,
							 sum(t.contain430msgnum) contain430msgnum,
							 sum(t.szxcount) szxcount,
							 sum(t.netpacknum) netpacknum
							FROM JKD_REPORT_CHMONITOR t 
							LEFT OUTER JOIN EADEPT d ON d.DEPTID=t.DEPTID 
							WHERE  {#condition#}
							AND t.statdate BETWEEN to_date('#tcreatetimebegin#','yyyy-mm-dd') 
										   AND to_date('#tcreatetimeend#','yyyy-mm-dd')
							GROUP BY 
							t.DEPTID,d.DEPTNAME  
						 	order by t.deptid 
				   ]]>
                </value>
				<condition name="txtdeptid"  label="部门id" hidden="true" >
					<value>
						<![CDATA[( d.parentid = '#data#' )]]>
					</value>
				</condition>
				
				<condition name="tcreatetimebegin" type="date" label="开始时间">
					<inputbox type="datepicker"></inputbox>
				 
				</condition>
				<condition name="tcreatetimeend" type="date" label="结束时间">
					<inputbox type="datepicker"></inputbox>
				 
				</condition>
			</sql>
			 
			<format>
				     <imports>
					    <import>com.wabacus.util</import>
					    <import>com.wabacus</import>
					    <import>cn.zonesea.jkd.util</import> 
				     </imports>
				     <value>
					  	<![CDATA[
					  			
					  			NETCARDPERCENT = WabacusMath.operation(NETCARDNUM,MONTHCOUNT,"/");
							 	NETCARDPERCENT = WabacusMath.operation(NETCARDPERCENT,"100","*");
							 	NETCARDPERCENT = "<font style='color:red;'>"+NETCARDPERCENT+"%</font>";
					  			
							 	SDPERCENT = WabacusMath.operation(F100G200NUM,SDCOUNT,"/");
							 	SDPERCENT = WabacusMath.operation(SDPERCENT,"100","*");
							 	SDPERCENT = "<font style='color:red;'>"+SDPERCENT+"%</font>";
							 	
							 	MSG430PERCENT = WabacusMath.operation(CONTAIN430MSGNUM,CONTAIN4COUNT,"/");
							 	MSG430PERCENT = WabacusMath.operation(MSG430PERCENT,"100","*");
							 	MSG430PERCENT = "<font style='color:red;'>"+MSG430PERCENT+"%</font>";
							 	
							 	
							 	String tcreatetimebegin=rrequest.getStringAttribute("tcreatetimebegin","");
  					            String tcreatetimeend=rrequest.getStringAttribute("tcreatetimeend",""); 
							 	statdate =  tcreatetimebegin.substring(5) + "~" + tcreatetimeend.substring(5);
								
								if(rrequest.getShowtype() == Consts.DISPLAY_ON_PAGE){  	
								 	deptname ="<a href=\"#\" onclick=\""+rrequest.forwardPageWithBack("ShowReport.go?PAGEID=chmonitorReportPage&txtdeptid="
							           + deptid)+ "\" title =\"点击查看详细\">"+deptname+"</a>";
							    }
						]]>
				     </value>
			</format>
		</report>
	</page>
</applications>

你可能感兴趣的:(wabacus)