<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
	<head>
		{include file="{$smarty.const.APP_REAL_PATH}_templates/engine/head.tpl"}

		<style type="text/css">
			@import url('_css/startReport.css');
			@import url('{$MODULE_REL_PATH}_css/reportStatus.css');
		</style>

		<script language="javascript" src="{$MODULE_REL_PATH}_js/application/reports.js"></script>
		<script language="javascript" src="{$MODULE_REL_PATH}_js/application/dateDurationValidation.js"></script>
		<script language="javascript" src="_js/startReport.js"></script>

	</head>

	<body class="popup"
		onload="
			{if $reportIsGenerating}
				// start refresh report status
				refreshReportStatus('displayReportStatus', '{$idReportGenerating}', '');
				// refresh parent page reports
				window.parent.opener.ajaxIframeReload('reportsListDiv', 'reportsList.php');
			{/if}
		"
	>

		<div class="popupContent">

			<div class="popupTitle">{$reportDetails.name}</div>

			{showMessage}

			{if $reportDetails.description}
				<div class="reportDescription">{$reportDetails.description}</div>
			{/if}

			{if !$reportIsGenerating}

				<form method="post" action="./" id="reportForm">

					{if $reportFilters or $reportCustomFilters}
						<fieldset>

							<legend class="reportSubtitle">{$_LANG.reportsGeneration.startReport.tpl.filtersLegend}</legend>

							{include file="index_reportFilters.tpl"}

						</fieldset>
					{/if}


					{if $reportColumns}
						<fieldset>

							<legend class="reportSubtitle">{$_LANG.reportsGeneration.startReport.tpl.columnsLegend}</legend>

							{include file="index_reportColumns.tpl"}

						</fieldset>
					{/if}


					<fieldset>
						<legend class="reportSubtitle">{$_LANG.reportsGeneration.startReport.tpl.sortingLegend}</legend>

						{include file="index_reportSorting.tpl"}

					</fieldset>


					{if $pivotTables}
						<fieldset>

							<legend class="reportSubtitle">{$_LANG.reportsGeneration.startReport.tpl.pivotsLegend}</legend>

							{include file="index_pivotTables.tpl"}

						</fieldset>
					{/if}


					<fieldset>

						<legend class="reportSubtitle">{$_LANG.reportsGeneration.startReport.tpl.optionsLegend}</legend>

						{include file="index_reportOptions.tpl"}

					</fieldset>

					<input type="hidden" name="idReport" value="{$idReport}" />
					<input type="hidden" name="generateReport" value="1" />

				</form>

			{/if} {* if report is not generating *}

			{* report is generating *}
			{if $reportIsGenerating}
				{include file="index_reportIsGenerating.tpl"}
			{/if}

			<div style="height:15px;">&nbsp;</div>

		</div>

		<div id="engine_statusBar">

			<button type="button" id="cancel" style="float:left">{$_LANG.close}</button>

			{if !$reportIsGenerating}
				<button type="button" style="float:right"
					onclick="$('reportForm').submit();"
				>{$_LANG.reportsGeneration.startReport.tpl.generateButton}</button>
			{/if}

		</div>

	</body>
</html>