{include_php file="shared_handle:company_management/reports/general"}
<h1>{$page.title}</h1>
<h2>{$smarty.session.company.companyName}</h2>

<hr />

<div style="width:400px;">
<h3 class="withBG">
	<div class="topRight hideShow">
		<a href="javascript:toggle('configure', '', 'showHide');"><img id="configure_img" src="./img/blank.gif" class="showHide_off" alt="show/hide" border="0" /></a></div> 
	Configure</h3>

<div id="configure" style="display:none; margin-left:20px;">
	<form method="get" action="index.php" style="margin:0px;">
	<input type="hidden" name="pg" value="{$page.name}" />

	<div style="float:right;">Testing out possible instructions.</div>

	<table>
	<tr>
		<td>Weight Range Size:</td>
		<td><input type="text" name="wrs" size="4" value="{$WEIGHT_RANGE_STEP}" style="text-align:right;" />
	</tr>
	<tr>
		<td>Weight Range Offset:</td>
		<td><input type="text" name="wro" size="4" value="{$WEIGHT_RANGE_OFFSET}" style="text-align:right;" />
	</tr>
	<tr>
		<td>BMI Range Size:</td>
		<td><input type="text" name="brs" size="4" value="{$BMI_RANGE_STEP}" style="text-align:right;" />
	</tr>
	<tr>
		<td>BMI Range Offset:</td>
		<td><input type="text" name="bro" size="4" value="{$BMI_RANGE_OFFSET}" style="text-align:right;" />
	</tr>
	<tr>
		<td>Age Range Size:</td>
		<td><input type="text" name="ars" size="4" value="{$AGE_RANGE_STEP}" style="text-align:right;" />
	</tr>
	<tr>
		<td>Age Range Offset:</td>
		<td><input type="text" name="aro" size="4" value="{$AGE_RANGE_OFFSET}" style="text-align:right;" />
	</tr>
	</table>

	<div align="right" style="clear:left;"><input type="submit" value="Submit" /></div>
	
	</form>
</div>
</div>

<table width="400">
{foreach from=$report key="sectionName" item="sectionData"}
	<tr>
		<td colspan="3"><h2 class="withBG">{$sectionName|niceText}</h2></td>
	</tr>
	{foreach from=$sectionData key="field" item="value"}
	{if $value|@is_array}
	<tr>
		<td width="25">&nbsp;</td>
		<td colspan="2">
			<h3 class="withBG">
				<div class="topRight hideShow">
					<a href="javascript:toggle('{$field}', '', 'showHide');"><img id="{$field}_img" src="./img/blank.gif" class="showHide_off" alt="show/hide" border="0" /></a></div> 
				{$field|niceText}</h3>
		</td>
	</tr>
	<tr>
		<td width="25">&nbsp;</td>
		<td colspan="2" bgcolor="#DDDDDD">
			<div id="{$field}" style="display:none;">
			<table border="0" width="99%">
			{foreach from=$value key="subField" item="subValue"}
			<tr>
				<td width="50%" align="right">
					{if $field|regex_match:"/Age/" and $subField neq "unknown"}
						{$subField} to {$subField+$AGE_RANGE_STEP-1} yrs.
					{elseif $field|regex_match:"/Weight/"}
						{$subField} to {$subField+$WEIGHT_RANGE_STEP-1} lbs.
					{elseif $field|regex_match:"/Bmi/"}
						{$subField} to {$subField+$BMI_RANGE_STEP-1}
					{elseif $field|regex_match:"/Exercise/"}
						{$subField|niceText}
					{else}
						{$subField|niceText}
					{/if}
				</td>
				<td width="50%" align="right">{$subValue}{if $subField|regex_match:"/percent/i"} %{/if}</td>
			</tr>
			{/foreach}
			</table>
			</div>
		</td>
	</tr>
	{else}
	<tr>
		<td width="25">&nbsp;</td>
		<td>{$field|niceText}</td>
		<td align="right">{if $value|regex_match:"/\.\d\d/"}{$value|number_format:2}{elseif $value|regex_match:"/\.\d/"}{$value|number_format:1}{else}{$value|number_format:0}{/if}{if $field|regex_match:"/percent/i"} %{/if}</td>
	</tr>
	{/if}
	{/foreach}
{/foreach}
</table>
