{extends file="reports/report.xls.tpl"}

{block name="sheetHeader"}
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['hour']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['service']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['serviceName']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['attribute']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['departure']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['details']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['passengers']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['product']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['serviceType']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['serviceSource']}</Data></Cell>
	<Cell ss:StyleID="tableHead"><Data ss:Type="String">{$_LANG['Orders']['MiceProject']['reports']['details']['serviceDescription']}</Data></Cell>
{/block}

{block name="sheetRows"}
	{foreach $formData['reportData']['time'] as $day}

		{$OK = false}
		{foreach $formData['reportData']['services'] as $service}
			{if ($day >= $service['startTime'] && $service['endTime']>= $day && $service['endTime']) || ($day== $service['startTime'] && !$service['endTime'])}
				{$OK = true}
			{/if}
		{/foreach}

		{if $OK}
			<Row ss:StyleID="">
				<Cell ss:StyleID="colspan" ss:MergeAcross="10"><Data ss:Type="String">{strip}
					{$day|dateTimeFormat}
				{/strip}</Data></Cell>
			</Row>
		{/if}

		{foreach $formData['reportData']['services'] as $service}
			{cycle name=TR values="tableRow1,tableRow2" assign=rowClass}

			{if ($day>= $service['startTime'] && $service['endTime']>= $day && $service['endTime']) || ($day== $service['startTime'] && !$service['endTime'])}
				<Row ss:StyleID="">
					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{if $service['startTime'] and $service['endTime']}
								{$service['startTime']}-{$service['endTime']}
							{elseif $service['startTime']}
								{$service['startTime']}
							{elseif $service['endTime']}
								{$service['endTime']}
							{else}
						{/if}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{$service['serviceName']}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{if $service['productName']}
								{$service['productName']}
							{elseif $service['supplierProduct']['productName']}
								{$service['supplierProduct']['productName']}
							{else}

							{/if}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{$service['categoryReadable']}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{if $service['departureCityId'] && $service['destinationCityId']}
							{if $service['departureCountryCode']==$service['destinationCountryCode']}
								{cityLabel hideLink=1 ref=$service['departureCityId']}
								/
								{cityLabel hideLink=1 ref=$service['destinationCityId']}
								({countryLabel hideLink=1 ref=$service['destinationCountryCode']})
							{else}
								{cityLabel hideLink=1 ref=$service['departureCityId']}
								({countryLabel hideLink=1 ref=$service['departureCountryCode']})
								/
								{cityLabel ref=$service['destinationCityId']}
								({countryLabel hideLink=1 ref=$service['destinationCountryCode']})
							{/if}
						{elseif $service['departureCityId']}
							{cityLabel hideLink=1 ref=$service['departureCityId']}
							({countryLabel hideLink=1 ref=$service['departureCountryCode']})/
						{elseif $service['destinationCityId']}
							/{cityLabel hideLink=1 ref=$service['destinationCityId']}
							({countryLabel hideLink=1 ref=$service['destinationCountryCode']})
						{else}

							-
						{/if}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{$service['multiplierReadable']}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{$service['pax']}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{if $service['idSupplier'] && $service['idSupplierProduct']}
							{supplierProductLabel hideLink=1 ref=$service['idSupplierProduct']}
							/
							{supplierLabel hideLink=1 ref=$service['idSupplier']}
						{elseif $service['idSupplier']}
							{supplierLabel hideLink=1 ref=$service['idSupplier']}
						{else}
							-
						{/if}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{if $service['productTypeCode']}
							{$service['productTypeReadable']}
						{/if}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{$service['serviceSourceReadable']}
					{/strip}</Data></Cell>

					<Cell ss:StyleID="{$rowClass|default:"tableCell"}"><Data ss:Type="String">{strip}
						{$service['description']}
					{/strip}</Data></Cell>
				</Row>
			{/if}
		{/foreach}
	{/foreach}
{/block}