##include templates\rheader.htm##
<TABLE class=report WIDTH="auto" CELLPADDING=1 CELLSPACING=0 BORDER=0 align=center style="border: solid; border-width: 1px; border-color: black;">
{BEGIN grid_row}
<!-------------------------------------  group headers ----------------------------------------->
##foreach @TABLE.arrReportGroupFields as @g##
{BEGIN ##@g.strGroupField g##_newgroup}
##if @first##
<tr>
##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
<td class=blackshade>##@f.strLabel h##</td>
##endfor##
</tr>
##endif##
<tr>
	##foreach @TABLE.arrReportGroupFields as @gg##
		##if @g.strGroupField==@gg.strGroupField##
<td colspan=##eval Fields[bReportPage].len-@g.nGroupOrder+1## class=header_##@g.nGroupOrder##><font style="font-weight:900">{$##@g.strGroupField g##_grval}</font></td>
		##elseif @gg.nGroupOrder<@g.nGroupOrder##
<td class="noborder group_##@gg.nGroupOrder##" style="border-style:none;">&nbsp;</td>
		##endif##
	##endfor##
</tr>
{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="noborder group_##@index##" style="border-style:none; border-right:solid 1px">&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## style="border-style:none"></td>
	##endrepeat##
	##foreach Fields as @f filter @f.strName=@g.strGroupField##
	<td style="border-top: none" class="noborder group_##@g.nGroupOrder##" 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##</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## style="border-left: solid #cccccc 1px;">##message SUM##</td>
		##elseif @f.bSum##
	<td class=group_##@g.nGroupOrder##>{$group##@g.strGroupField g##_total##@f.strName g##_sum}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index## style="border-style:none">&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##>&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##>##message AVERAGE##</td>
		##elseif @f.bAvg##
	<td class=group_##@g.nGroupOrder##>{$group##@g.strGroupField g##_total##@f.strName g##_avg}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index## style="border-style:none">&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##>&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##>##message MIN##</td>
		##elseif @f.bMin##
	<td class=group_##@g.nGroupOrder##>{$group##@g.strGroupField g##_total##@f.strName g##_min}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index## style="border-style:none">&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##>&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##>##message MAX##</td>
		##elseif @f.bMax##
	<td class=group_##@g.nGroupOrder##>{$group##@g.strGroupField g##_total##@f.strName g##_max}</td>
		##elseif @index<@g.nGroupOrder##
	<td class=group_##@index## style="border-style:none">&nbsp;</td>
		##else##
	<td class=group_##@g.nGroupOrder##>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
{END ##@g.strGroupField g##_endgroup}
##endif##
##endfor##
{END grid_row}
##if @TABLE.bReportPageSummary || @TABLE.bReportGlobalSummary##
<tr>
##foreach Fields as @f filter @f.bReportPage order nReportPageOrder##
<td class=blackshade>##@f.strLabel h##</td>
##endfor##
</tr>
##endif##
##if @TABLE.bReportPageSummary##
<!--------------------------------------page summary-------------------------------------------->
<tr>
	<td class=pagesummary 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##
		##if @g.strGroupField==@f.strName##
	<td class=pagesummary>##message SUM##</td>
		##elseif @f.bSum##
	<td class=pagesummary>{$page_total##@f.strName g##_sum}</td>
		##else##
	<td class=pagesummary>&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=pagesummary>##message AVERAGE##</td>
		##elseif @f.bAvg##
	<td class=pagesummary>{$page_total##@f.strName g##_avg}</td>
		##else##
	<td class=pagesummary>&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=pagesummary>##message MIN##</td>
		##elseif @f.bMin##
	<td class=pagesummary>{$page_total##@f.strName g##_min}</td>
		##else##
	<td class=pagesummary>&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=pagesummary>##message MAX##</td>
		##elseif @f.bMax##
	<td class=pagesummary>{$page_total##@f.strName g##_max}</td>
		##else##
	<td class=pagesummary>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
##endif##
##if @TABLE.bReportGlobalSummary##
<!--------------------------------------global summary-------------------------------------------->
<tr>
	<td class=globalsummary 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##
		##if @g.strGroupField==@f.strName##
	<td class=globalsummary>##message SUM##</td>
		##elseif @f.bSum##
	<td class=globalsummary>{$global_total##@f.strName g##_sum}</td>
		##else##
	<td class=globalsummary>&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=globalsummary>##message AVERAGE##</td>
		##elseif @f.bAvg##
	<td class=globalsummary>{$global_total##@f.strName g##_avg}</td>
		##else##
	<td class=globalsummary>&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=globalsummary>##message MIN##</td>
		##elseif @f.bMin##
	<td class=globalsummary>{$global_total##@f.strName g##_min}</td>
		##else##
	<td class=globalsummary>&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=globalsummary>##message MAX##</td>
		##elseif @f.bMax##
	<td class=globalsummary>{$global_total##@f.strName g##_max}</td>
		##else##
	<td class=globalsummary>&nbsp;</td>
		##endif##
	##endfor##
</tr>	
##endif##
##endif##
</table>
##include templates\rfooter.htm##