{include_php file="shared_handle:company_management/reports/surveys"}
<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> 
	Select Survey and Date Range</h3>

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

	<table>
	<tr>
		<td>Survey Name:</td>
		<td colspan="3"><select name="surveyId">
			{foreach from=$surveyList key="surveyId" item="row"}
			<option value="{$surveyId}">{$row.surveyName}</option>
			{/foreach}</select>
	</tr>
	<tr>
		<td>Start Date:</td>
		<td><input type="text" name="begin" size="10" value="{$START_DATE|date_format2:"m/d/Y"}" />
		<td>End Date:</td>
		<td><input type="text" name="end" size="10" value="{$END_DATE|date_format2:"m/d/Y"}" />
	</tr>
	</table>

	<div align="center" style="clear:left;"><input type="submit" value="Load Report" /></div>	
	</form>
</div>
</div>

{if $report.surveyName}
	<hr />
	<i>Report for data between <b>{$START_DATE|date_format2:"m/d/Y"}</b> and <b>{$END_DATE|date_format2:"m/d/Y"}</b>.</i>
	<hr />

	<h2>{$report.surveyName}</h2>

	<b>{$report.totalSubmissions|default:0}</b> Taken<br /><br />

	{foreach name="qLoop" from=$report.questions item="q"}
	<b>{$smarty.qLoop.iteration}.</b>) {$q.question}
	{/foreach}
{/if}