##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}
<tr>
<td class=header_##@g.nGroupOrder## colspan=##eval Fields[bReportPage].len-@TABLE.arrReportGroupFields.len##>
##Fields[strName==@g.strGroupField].strLabel h##:&nbsp;
<font style="font-weight:900">{$##@g.strGroupField g##_grval}</font></td>
</tr>
##if @last##
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
<td class=blackshade>##@f.strLabel h##</td>
	##endfor##
</tr>
##endif##
{END ##@g.strGroupField g##_newgroup}
##endfor##
##if @TABLE.bReportShowDetails##
<!-------------------------------------  data ----------------------------------------->
{BEGIN row_data}
<tr>
	##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>
	##foreach Fields as @f filter @f.strName=@g.strGroupField##
	<td class=group_##@g.nGroupOrder## colspan=##eval Fields[bReportPage].len-@TABLE.arrReportGroupFields.len## >
	##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 && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=group_##@g.nGroupOrder##>
		##if @first##
		##message SUM##
		##endif##
		&nbsp;
		##if @f.bSum##
		{$group##@g.strGroupField g##_total##@f.strName g##_sum}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bAvg].len##
<!--  Avg -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=group_##@g.nGroupOrder##>
		##if @first##
		##message AVERAGE##
		##endif##
		&nbsp;
		##if @f.bAvg##
		{$group##@g.strGroupField g##_total##@f.strName g##_avg}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMin].len##
<!--  Min -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=group_##@g.nGroupOrder##>
		##if @first##
		##message MIN##
		##endif##
		&nbsp;
		##if @f.bMin##
		{$group##@g.strGroupField g##_total##@f.strName g##_min}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMax].len##
<!--  Max -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=group_##@g.nGroupOrder##>
		##if @first##
		##message MAX##
		##endif##
		&nbsp;
		##if @f.bMax##
		{$group##@g.strGroupField g##_total##@f.strName g##_max}
		##endif##
	</td>
	##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 && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
<td class=blackshade>##@f.strLabel h##</td>
	##endfor##
</tr>
##endif##
##if @TABLE.bReportPageSummary##
<!--------------------------------------page summary-------------------------------------------->
<tr>
	<td class=pagesummary colspan=##eval Fields[bReportPage].len-@TABLE.arrReportGroupFields.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 && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
		##message SUM##
		##endif##
		&nbsp;
		##if @f.bSum##
		{$page_total##@f.strName g##_sum}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bAvg].len##
<!--  Avg -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
		##message AVERAGE##
		##endif##
		&nbsp;
		##if @f.bAvg##
		{$page_total##@f.strName g##_avg}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMin].len##
<!--  Min -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
		##message MIN##
		##endif##
		&nbsp;
		##if @f.bMin##
		{$page_total##@f.strName g##_min}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMax].len##
<!--  Max -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=pagesummary>
		##if @first##
		##message MAX##
		##endif##
		&nbsp;
		##if @f.bMax##
		{$page_total##@f.strName g##_max}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##endif##
##if @TABLE.bReportGlobalSummary##
<!--------------------------------------global summary-------------------------------------------->
<tr>
	<td class=globalsummary colspan=##eval Fields[bReportPage].len-@TABLE.arrReportGroupFields.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 && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
		##message SUM##
		##endif##
		&nbsp;
		##if @f.bSum##
		{$global_total##@f.strName g##_sum}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bAvg].len##
<!--  Avg -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
		##message AVERAGE##
		##endif##
		&nbsp;
		##if @f.bAvg##
		{$global_total##@f.strName g##_avg}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMin].len##
<!--  Min -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
		##message MIN##
		##endif##
		&nbsp;
		##if @f.bMin##
		{$global_total##@f.strName g##_min}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##if Fields[bReportPage && bMax].len##
<!--  Max -->
<tr>
	##foreach Fields as @f filter @f.bReportPage && @TABLE.arrReportGroupFields[strGroupField==@f.strName].len==0 order nReportPageOrder##
	<td class=globalsummary>
		##if @first##
		##message MAX##
		##endif##
		&nbsp;
		##if @f.bMax##
		{$global_total##@f.strName g##_max}
		##endif##
	</td>
	##endfor##
</tr>	
##endif##
##endif##
</table>
##include templates\rfooter.htm##