<html {$html_attrs}>
<head>
<title>##@TABLE.strCaption h##</title>
{BEGIN stylesheetlink}
<link REL="stylesheet" href="include/style.css" type="text/css">
<!--[if IE]>
<link REL="stylesheet" href="include/styleIE.css" type="text/css">
<![endif]-->
{END stylesheetlink}
<style>
.grid_block {  
margin-top:5px;
border-collapse: collapse;
align:center;
width:95%;
border: solid black 1px;
} 
.grid_block td { 
 padding: 5px; 
 margin: 0px; 
 border: solid #cccccc 1px;
}
.grid_block .gridspacing {width:20px;border-top-color:white; border-bottom-color:white;background-color:white}
@media print 
{
	a.pdf {display:none}
}
.printpage {page-break-after:always}
.pagesummary
{
background-color:#ffffbb;
}
.globalsummary
{
background-color:#ffe0b0;
}

{$cssdata}
##if @TABLE.arrReportGroupFields.len##

##foreach @TABLE.arrReportGroupFields as @f##
.group_##@index##
{
background-color: ###@f.strColor##;
}
##endfor##


##foreach @TABLE.arrReportGroupFields as @f##
.nbgroup_##@index##
{
background-color: ###@f.strColor##;
border-style:none;
}
##endfor##


##foreach @TABLE.arrReportGroupFields as @f##
.header_##@index##
{
background-color: ###@f.strHeaderColor##;
}
##endfor##

##endif##
</style> 
</head>
<body topmargin=5 style="background:white">
{BEGIN body}
{$header}
{BEGIN page}
<div>

<h1>##@TABLE.strCaption h##</h1>

##if @BUILDER.bViewPDF##
{BEGIN pdf_block}
{BEGIN pdflink_block}
<a href=# class=pdf {$pdflink_attrs}>##message PDF_VIEW##</a>
{END pdflink_block}
{END pdf_block}
##endif##

{BEGIN grid_block}
<table align="center" cellpadding=5 class="grid_block">
{BEGIN grid_row}
<!-------------------------------------  group headers ----------------------------------------->
##foreach @TABLE.arrReportGroupFields as @g##
{BEGIN ##@g.strGroupField g##_newgroup}
<tr>
	##foreach @TABLE.arrReportGroupFields as @gg filter @gg.nGroupOrder<@g.nGroupOrder##
<td class=group_##@gg.nGroupOrder##>&nbsp;</td>
	##endfor##
<td class=header_##@g.nGroupOrder## colspan=##eval Fields[bReportPage].len-@g.nGroupOrder+1##>
##Fields[strName==@g.strGroupField].strLabel h##:&nbsp;
<font style="font-weight:900">{$##@g.strGroupField g##_grval}</font></td>
</tr>
##if @last##
<tr>
	##foreach @TABLE.arrReportGroupFields as @gg##
<td class=group_##@gg.nGroupOrder##>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
	##endfor##
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
<td class=blackshade><b>##@f.strLabel h##</b></td>
	##endfor##
</tr>
##endif##
{END ##@g.strGroupField g##_newgroup}
##endfor##
##if @TABLE.bReportShowDetails##
<!-------------------------------------  data ----------------------------------------->
{BEGIN row_data}
<tr>
	##foreach @TABLE.arrReportGroupFields as @g##
		##if @g.nGroupInterval##
	<td class=group_##@index##>{$##@g.strGroupField g##_value}</td>
		##else##
	<td class=group_##@index##>&nbsp;</td>
		##endif##
	##endfor##
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=data>{$##@f.strName g##_value}</td>
	##endfor##
</tr>
{END row_data}
##endif##
<!-------------------------------------  group summary ----------------------------------------->
##foreach @TABLE.arrReportGroupFields as @g order desc##
##if @g.bShowGroupSummary##
{BEGIN ##@g.strGroupField g##_endgroup}
<tr>
	##repeat @TABLE.arrReportGroupFields.len-@index##
	<td class=group_##@index##>&nbsp;</td>
	##endrepeat##
	##foreach Fields as @f filter @f.strName=@g.strGroupField##
	<td ##eval @first## class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && (bSum || bAvg || bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	colspan=##eval Fields[bReportPage].len-@g.nGroupOrder+1## >
	##message SUMMARY_FOR## ##@f.strLabel h## {$##@g.strGroupField g##_grval}
	 - {$group##@g.strGroupField g##_total_cnt} ##message RECORDS_TOTAL##</div></td>
	##endfor##
</tr>
##if Fields[bReportPage && bSum].len##
<!--  Sum -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
		##if @g.strGroupField==@f.strName##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && (bAvg || bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>##message SUM##</td>
		##elseif @f.bSum##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && (bAvg || bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>{$group##@g.strGroupField g##_total##@f.strName g##_sum}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index##>&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && (bAvg || bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bAvg].len##
<!--  Avg -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
		##if @g.strGroupField==@f.strName##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && ( bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>##message AVERAGE##</td>
		##elseif @f.bAvg##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && ( bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>{$group##@g.strGroupField g##_total##@f.strName g##_avg}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index##>&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && ( bMin|| bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMin].len##
<!--  Min -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
		##if @g.strGroupField==@f.strName##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && ( bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>##message MIN##</td>
		##elseif @f.bMin##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && ( bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>{$group##@g.strGroupField g##_total##@f.strName g##_min}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index##>&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len && !Fields[bReportPage && ( bMax)].len##
	style="border-bottom: solid black 2px"
	##endif##
	>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMax].len##
<!--  Max -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
		##if @g.strGroupField==@f.strName##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len##
	style="border-bottom: solid black 2px"
	##endif##
	>##message MAX##</td>
		##elseif @f.bMax##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len##
	style="border-bottom: solid black 2px"
	##endif##
	>{$group##@g.strGroupField g##_total##@f.strName g##_max}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index##>&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##
	##if @g.nGroupOrder<@TABLE.arrReportGroupFields.len##
	style="border-bottom: solid black 2px"
	##endif##
	>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
{END ##@g.strGroupField g##_endgroup}
##endif##
##endfor##
{END grid_row}
##if @TABLE.bReportPageSummary##
{BEGIN page_summary}
<!--------------------------------------page summary-------------------------------------------->
<tr>
	<td class=pagesummary
	style=" border-top: solid black 2px;"
	colspan=##Fields[bReportPage].len##>##message PAGE_SUMMARY## 
	 {$page_total_cnt} - ##message RECORDS_TOTAL##</td>
</tr>
##if Fields[bReportPage && bSum].len##
<!--  Sum -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
	##message SUM##&nbsp;
		##endif##
		##if @f.bSum##
	{$page_total##@f.strName g##_sum}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bAvg].len##
<!--  Avg -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
	##message AVERAGE##&nbsp;
		##endif##
		##if @f.bAvg##
	{$page_total##@f.strName g##_avg}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMin].len##
<!--  Min -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
	##message MIN##&nbsp;
		##endif##
		##if @f.bMin##
	{$page_total##@f.strName g##_min}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
##endif##
##if Fields[bReportPage && bMax].len##
<!--  Max -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
	##message MAX##&nbsp;
		##endif##
		##if @f.bMax##
	{$page_total##@f.strName g##_max}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
</tr>
{END page_summary}
##endif##
##if @TABLE.bReportGlobalSummary##
{BEGIN global_summary}
<!--------------------------------------global summary-------------------------------------------->
<tr>
	<td class=globalsummary style="border-top: solid black 2px" colspan=##Fields[bReportPage].len##>##message GLOBAL_SUMMARY## 
	 {$global_total_cnt} - ##message RECORDS_TOTAL##</td>
</tr>
##if Fields[bReportPage && bSum].len##
<!--  Sum -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
	##message SUM##&nbsp;
		##endif##
		##if @f.bSum##
	{$global_total##@f.strName g##_sum}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bAvg].len##
<!--  Avg -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
	##message AVERAGE##&nbsp;
		##endif##
		##if @f.bAvg##
	{$global_total##@f.strName g##_avg}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMin].len##
<!--  Min -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
	##message MIN##&nbsp;
		##endif##
		##if @f.bMin##
	{$global_total##@f.strName g##_min}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMax].len##
<!--  Max -->
<tr>
	##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
	##message MAX##&nbsp;
		##endif##
		##if @f.bMax##
	{$global_total##@f.strName g##_max}
		##else##
	&nbsp;
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
{END global_summary}
##endif##
</table>
{END grid_block}
</div>
{END page}
{$footer}
{END body}
</body>
</html>