<report>
<title>Industry</title> 
	<level>
		<htmlstyle>heading</htmlstyle>
		<sql>SELECT DISTINCT from_unixtime(date_orig,"%Y") as yearmonth from %%AGILE_DB_PREFIX%%account A </sql>
		<criteria>A.site_id=%%DEFAULT_SITE%%</criteria>
		<orderby>ORDER BY yearmonth ASC</orderby>
		<indent>0</indent>
		<column>
			<display>Year:</display>
			<field>yearmonth</field>
			<aggregate>true</aggregate>
			<width></width>
			<format></format>
			<group_children_by>true</group_children_by>
			<visible>true</visible>
			<hide_dups>false</hide_dups>
			<sql></sql>
			<sql_criteria></sql_criteria>
			<condition></condition>
			<total>false</total>
			<total_format></total_format>
			<link></link>
		</column>  
		<level> 
			<sql>SELECT DISTINCT UCASE(A.value) as value, count(A.id) as quan, sum(C.total_amt) as amt, from_unixtime(B.date_orig,'%Y') as yearmonth from %%AGILE_DB_PREFIX%%static_var_record A
				 INNER JOIN %%AGILE_DB_PREFIX%%account B ON ( B.site_id = %%DEFAULT_SITE%% AND A.record_id=B.id AND A.static_var_relation_id=5 )
				 LEFT JOIN %%AGILE_DB_PREFIX%%invoice C ON ( C.site_id = %%DEFAULT_SITE%% AND C.account_id=A.record_id AND C.billing_status=1 AND C.process_status=1 )
			</sql> 
			<criteria>A.site_id = %%DEFAULT_SITE%%</criteria>
			<orderby>GROUP BY A.value ORDER BY quan ASC</orderby>
			<indent>30</indent>
			<column>
				<display>Date</display>
				<field>yearmonth</field>
				<aggregate>false</aggregate>
				<visible>false</visible>  
			</column>
			<column>
				<display>Industry</display>
				<field>value</field> 
			</column>
			<column>
				<display>Accounts</display>
				<field>quan</field>
				<total>true</total>
			</column>
			<column>
				<display>Sales Volume</display>
				<field>amt</field>
				<format>dol,2</format>
				<total>true</total>
				<total_format>dol,2</total_format>
			</column>			
		 
		</level>    
	</level>	 	 
</report>