<report>
<title>Companies Listed Alphabetically</title> 

	<level> 
		<htmlstyle>heading</htmlstyle> 
		<sql>SELECT UCASE(LEFT(A.company, 1)) as fnum, count(A.id) as total from %%AGILE_DB_PREFIX%%account A</sql>
		<criteria>A.site_id = %%DEFAULT_SITE%% AND A.company IS NOT NULL and A.company!='' AND A.id in (select distinct account_id from %%AGILE_DB_PREFIX%%account_group where group_id!=4 and group_id!=1001)</criteria>  
		<orderby>GROUP BY fnum ORDER BY fnum ASC</orderby>
		<indent>0</indent>
		<column>
			<display></display>
			<field>fnum</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>		
		<column>
			<display>Total Customers: </display>
			<field>total</field> 
		</column>
					
		<level> 
			<sql>SELECT UCASE(LEFT(A.company, 1)) as fnum, A.email, A.company, CONCAT(A.first_name,' ', A.last_name) as name, CONCAT(address1,' ', address1,', ', city, ' ', state, ', ', zip ) as address from %%AGILE_DB_PREFIX%%account A</sql>  
			<criteria>A.site_id = %%DEFAULT_SITE%% AND A.company IS NOT NULL AND A.company!='' AND A.id in (select distinct account_id from %%AGILE_DB_PREFIX%%account_group where group_id!=4 and group_id!=1001)</criteria>
			<orderby>ORDER BY company ASC</orderby>
			<indent>30</indent> 	
			<column>
				<display>Company</display>
				<field>company</field> 
			</column>
			<column>
				<display>Contact</display>
				<field>name</field> 
			</column>
			<column>
				<display>Address</display>
				<field>address</field> 
			</column>
			<column>
				<display>E-mail</display>
				<field>email</field>  
			</column>		
		</level> 				
	</level>		 
</report>