<?xml version="1.0" encoding="UTF-8"?>
{{script}}
	from reportlab import xrange
    import datetime
    now = datetime.datetime.now()
    fdate = now.strftime('%d/%m/%Y')
    flight = data.tickets.airTicket.trip.flight
    _FLIGHTS =data.tickets.airTicket.trip._namedChildren('flight')


    outflight2 = len(_FLIGHTS)>1 and _FLIGHTS[1] or None
    _TRIPS = data.tickets.airTicket._namedChildren('trip')
    inbound = len(_TRIPS)>1 and _TRIPS[1] or None

    if inbound:
        _INFLIGHTS = inbound._namedChildren('flight') or None
        inflight2 = len(_INFLIGHTS)>1 and _INFLIGHTS[1] or None

    flightRowHeight = 32
    rowHeights = [16, flightRowHeight]
    if outflight2:
        rowHeights.append(flightRowHeight)
    if inbound:
        rowHeights.append(flightRowHeight)
        if inflight2:
            rowHeights.append(flightRowHeight)

    from reportlab.pdfbase.ttfonts import TTFont
    from reportlab.pdfbase.pdfmetrics import registerFont, EmbeddedType1Face, registerTypeFace, Font
    from reportlab.lib import fonts
    from formatting import formatDate, getTripLength

    faceNormal = EmbeddedType1Face('res/LTe50136.afm','res/LTe50136.pfb')
    registerTypeFace(faceNormal)
    registerFont(Font('UniversLT-Light', 'UniversLT-Light', 'WinAnsiEncoding'))

    faceBold = EmbeddedType1Face('res/LTe50140.afm','res/LTe50140.pfb')
    registerTypeFace(faceBold)
    registerFont(Font('UniversLT-Bold', 'UniversLT-Bold', 'WinAnsiEncoding'))

    #create the family - italic fonts are not specified yet
    import reportlab.lib.fonts
    reportlab.lib.fonts.addMapping('UniversLT', 0, 0, 'UniversLT-Light')
    reportlab.lib.fonts.addMapping('UniversLT', 1, 0, 'UniversLT-Bold')
    reportlab.lib.fonts.addMapping('UniversLT', 0, 1, 'UniversLT-Light')
    reportlab.lib.fonts.addMapping('UniversLT', 1, 1, 'UniversLT-Bold')

    hotelbodyFontName = 'UniversLT-Light'
    hotelHeadingFontName = 'UniversLT-Bold'
    GREY = '0x6C6E71'
    STRONG_GREY = '0x494949'
    PURPLE ='0x49326C'
    LIGHT_BLUE = '0xEDF4FE'
    STRONG_BLUE = '0x141477'
    BLUE = '0xC2DAFC'
    YELLOW = '0xFFCC66'
    ORANGE ='0xF58D1B'

    import travel
    cities = travel.getCities()
    hotels = travel.getHotels()
    fares = travel.getFlightFares()

    if outflight2 is None:
        destinationCity = flight.arrive.city
    else:
        destinationCity = outflight2.arrive.city
{{endscript}}
<!DOCTYPE document SYSTEM "..\..\rml2pdf\rml.dtd">
<document filename="demo2.pdf">
	<docinit>
		<registerTTFont faceName="StoolReg" fileName="res/Stoorg__.ttf"/>
		<registerTTFont faceName="StoolLightBold" fileName="res/Stoob___.ttf"/>
		<registerTTFont faceName="StoolLightReg" fileName="res/Stool___.ttf"/>
		<registerTTFont faceName="StoolLightSmallCaps" fileName="res/Stoolsc_.ttf"/>
		<registerTTFont faceName="StoolLightItalic" fileName="res/Stooli__.ttf"/>
		<registerTTFont faceName="BodoniBlack" fileName="res/BOD_BLAR.ttf"/>
	</docinit>
	<template pageSize="595,842" leftMargin="0" rightMargin="0" showBoundary="1">
		<pageTemplate id="pageOne">
			<pageGraphics>
				<saveState/>
				<fill color="#F2F2F7"/>
				<stroke color="#5F659E" width="2"/>
				<lineMode width="1"/>
				<lines >60 35 525 35</lines>
				<setFont name="UniversLT-Light" size="8"/>
				<fill color="#5F659E"/>
				<drawString x="80" y="20">For more information about ReportLab e-brochure Capabilities, visit</drawString>
				<setFont name="UniversLT-Bold" size="9"/>
				<drawString x="320" y="20">www.reportlab.com/case_hilton_ebro.html</drawString> 
				<restoreState/>
				{{script}}
					if outflight2 is None:
						y = 500, 486, 474, 462, 450
						uline = 391, 498, 478, 498
						dline = 385, 430, 385, 503
					else:
						y = 450, 436, 424, 412, 400
						uline = 391, 448, 478, 448
						dline = 385, 380, 385, 463
				{{endscript}}
				<setFont name="StoolLightBold" size="11"/>
				<drawString x="390" y="{{y[0]}}">Important information:</drawString>
				<setFont name="StoolLightReg" size="10"/>
				<drawString x="394" y="{{y[1]}}">&#187;  Allow at least 30 minutes for check in.</drawString>
				<drawString x="394" y="{{y[2]}}">&#187;  Your Sky Travel booking reference(s)</drawString>
				<drawString x="394" y="{{y[3]}}">&#187;  Bring your passport and ID</drawString>
				<drawString x="394" y="{{y[4]}}">&#187;  Baggage Allowance: 30kg/per person </drawString>
				<lineMode width="0.5"/>
				<lines>
					{{for i in xrange(4)}}
						{{uline[i]}} 
					{{endfor}}
				</lines>
				<fill color="red"/>
				<lineMode width="0.8" dash="1,2"/>
				<lines>
					{{for i in xrange(4)}}
						{{dline[i]}} 
					{{endfor}}
				</lines> 
				<image file="rsrc/bluebg.jpg" x="1" y="743" width="594"/>
				<image file="rsrc/white_airplane.jpg" x="445" y="760" height="80" width="150"/>
				<fill color="#A30000"/>
				<setFont name="BodoniBlack" size="19"/>
				<drawString x="458" y="813">Sky Travel</drawString>

			</pageGraphics>
			<frame id="pageOneFrameTwo" x1="50" y1="355" width="495" height="420"/>
			<frame id="pageOneFrameOne" x1="50" y1="50" width="495" height="300"/>
		</pageTemplate>
		<pageTemplate id="pageTwo">
			<pageGraphics>
				<saveState/>
				<fill color="#F2F2F7"/>
				<stroke color="#5F659E" width="2"/>
				<lineMode width="1"/>
				<lines >60 35 525 35</lines>
				<setFont name="UniversLT-Light" size="8"/>
				<fill color="#5F659E"/>
				<drawString x="80" y="20">For more information about ReportLab e-brochure Capabilities, visit</drawString>
				<setFont name="UniversLT-Bold" size="9"/>
				<drawString x="320" y="20">www.reportlab.com/travel.html</drawString> 
				<restoreState/>
				<image file="rsrc/bluebg.jpg" x="1" y="743" width="594"/>
				<image file="rsrc/white_airplane.jpg" x="445" y="760" height="80" width="150"/>
				<fill color="#A30000"/>
				<setFont name="BodoniBlack" size="19"/>
				<drawString x="458" y="813">Sky Travel</drawString>
			</pageGraphics>
			<frame id="pageTwoFrameOne" x1="50" y1="50" width="495" height="710"/>
		</pageTemplate>

		<pageTemplate id="wtg_two_col">
			<pageGraphics>
				<saveState/>
				<fill color="#F2F2F7"/>
				<stroke color="#5F659E" width="2"/>
				<lineMode width="1"/>
				<lines >60 35 525 35</lines>
				<setFont name="UniversLT-Light" size="8"/>
				<fill color="#5F659E"/>
				<drawString x="80" y="20">For more information about ReportLab e-brochure Capabilities, visit</drawString>
				<setFont name="UniversLT-Bold" size="9"/>
				<drawString x="320" y="20">www.reportlab.com/travel.html</drawString> 
				<restoreState/>
				<image file="rsrc/bluebg.jpg" x="1" y="743" width="594"/>
				<image file="rsrc/white_airplane.jpg" x="445" y="760" height="80" width="150"/>
				<fill color="#A30000"/>
				<setFont name="BodoniBlack" size="19"/>
				<drawString x="458" y="813">Sky Travel</drawString>

                <image x="10" y="780" width="119" height="56" file="rsrc/wtg.jpg"/>
				<drawString x="140" y="813">Personalised Travel Guide</drawString>


			</pageGraphics>
			<frame id="wtgFrameOne" x1="10%" y1="10%" width="38%" height="80%"/>
			<frame id="wtgFrameTwo" x1="50%" y1="10%" width="38%" height="80%"/>
		</pageTemplate>


	</template>

	<stylesheet>
		<paraStyle name="h1" fontName="UniversLT-Bold" fontSize="17" leading="20.4" textColor="{{PURPLE}}"/>
		<paraStyle name="h2" fontName="StoolLightBold" fontSize="15" leading="16" textColor="{{ORANGE}}"/>
		<paraStyle name="h3" fontName="StoolLightReg" fontSize="11" leading="10" textColor="{{GREY}}"/>
		<paraStyle name="roomTableDetails" fontName="Helvetica-Bold" fontSize="9"/>
		<paraStyle name="bold" fontName="StoolReg" fontSize="10" leading="11"/>
		<paraStyle name="bodyFont" fontName="{{hotelbodyFontName}}" fontSize="8" leading="9.6" textColor="{{GREY}}"/>
		<paraStyle name="flightBodyFont" fontName="{{hotelbodyFontName}}" fontSize="8" leading="9.6" textColor="{{GREY}}"/>
		<paraStyle name="flightBodyFontBold" parent="flightBodyFont" fontName="{{hotelHeadingFontName}}" textColor="{{STRONG_GREY}}"/>
		<paraStyle name="bodyFontBold" parent="bodyFont" textColor="{{STRONG_GREY}}"/>
		<paraStyle name="hot_heading" fontName="{{hotelHeadingFontName}}" fontSize="11" leading="13.2" textColor="{{STRONG_BLUE}}"/>
		<paraStyle name="room_prices_heading" fontName="StoolLightBold" fontSize="10" leading="11"/>


	<paraStyle name="wtg_normal" fontName="Helvetica" fontSize="10" spaceBefore = "5" />

	<paraStyle name="wtg_section" parent="wtg_normal" fontName="Helvetica-Bold" fontSize="18" leading="24"
	spaceBefore = "36" textColor="ReportLabBlue" backColor = "silver" alignment="CENTER" keepWithNext="1" />

	<paraStyle name="wtg_data_title" parent="wtg_normal" fontName="Helvetica-Bold" fontSize="10" spaceBefore = "12" />

	<paraStyle name="wtg_warning" parent="wtg_normal" textColor="red"/>




		<blockTableStyle id="red">
			<!--lineStyle kind="GRID" colorName="red"/-->
			<blockLeftPadding length="0" start="0,0" stop="-1,-1"/>
			<blockRightPadding length="0" start="0,0" stop="-1,-1"/>
			<blockTopPadding length="0" start="0,0"	stop="-1,-1"/>
			<blockBottomPadding length="0" start="0,0" stop="-1,-1"/>
		</blockTableStyle>

		<blockTableStyle id="blue" parent="red">
			<!--lineStyle kind="GRID" colorName="blue"/-->
			<blockBackground colorName="{{BLUE}}" start="0,0" stop="-1,0"/>
			<blockBackground colorName="{{LIGHT_BLUE}}" start="0,1" stop="-1,1"/>
			<blockLeftPadding length="6" start="0,0" stop="3,-1"/>
			<blockValign value="middle" start="0,0" stop="3,-1"/>
			<blockValign value="top" start="0,2" stop="-1,-1"/>
		</blockTableStyle>

		<blockTableStyle id="black" parent="red">
			<!--lineStyle kind="GRID" colorName="black"/-->
		</blockTableStyle>
		
		<blockTableStyle id="blackSpan" parent="red">
			<lineStyle kind="GRID" colorName="blue"/>
			<!--blockLeftPadding length="0" start="0,0" stop="-1,-1"/-->
		</blockTableStyle>

		<blockTableStyle id="hotels">
			<blockSpan start="0,0" stop="0,1"/>									<!-- span 2 rows for hotel picture 1 -->
			<blockSpan start="0,2" stop="0,4"/>									<!-- span 3 rows for hotel picture 2 -->
			<blockSpan start="1,1" stop="2,1"/>									<!-- span 2 cols for hotel description -->
			<blockSpan start="1,2" stop="1,3"/>									<!-- span 2 rows for room description --> 
			<blockSpan start="2,2" stop="2,4"/>									<!-- span 3 rows for room prices table -->
			<blockBottomPadding length="0" start="1,4" stop="1,4"/>				<!-- no bottom padding for icons -->
			<blockBottomPadding length="0" start="1,0" stop="-1,0"/>			<!-- no bottom padding for hotel name & ratings -->
			<blockBottomPadding length="0" start="1,2" stop="1,3"/>				<!-- no bottom padding for room description cell -->
			<blockLeftPadding length="0" start="1,0" stop="1,-1"/>				<!-- not left padding for text data in column 2 -->
			<blockLeftPadding length="4" start="0,0" stop="0,-1"/>				<!-- adjust pictures left padding -->
			<blockLeftPadding length="0" start="2,2" stop="2,-1"/>				<!-- remove left padding for room prices table cell -->
			<blockRightPadding length="-3" start="2,0" stop="2,0"/>				<!-- reduce rating stars right padding -->
			<blockTopPadding length="0" start="1,1" stop="1,1"/>				<!-- no top padding for hotel descriptions cell -->
			<blockTopPadding length="0" start="1,4" stop="1,4"/>				<!-- no top padding for cell containing icons -->
			<blockTopPadding length="4" start="1,2" stop="1,2"/>				<!-- adjust top padding for room description cell-->
			<blockValign value="middle" start="0,0" stop="0,-1"/>				<!-- middle vertical align for cells pictures -->
			<blockValign value="top" start="1,1" stop="1,-1"/>					<!-- top vertical align for icons cell -->
			<blockAlignment value="right" start="2,0" stop="2,0"/>				<!-- align rating stars on the right -->
			<lineStyle kind="BOX" thickness="0.5" colorName="#FFCC66" start="0,0" stop="-1,-1"/>	<!-- add fancy background -->
			<blockBackground colorName="#FFFFF0" start="0,0" stop="-1,-1"/>		<!-- add fancy table outline -->
		</blockTableStyle>

		<blockTableStyle id="room_prices">
			<blockAlignment value="right" start="1,0" stop="-1, -1"/>
			<blockAlignment value="left" start="0,0" stop="0, -1"/>
			<blockBackground colorName="#F2F9FF" start="0,0" stop="-1,-1"/>
			<blockFont name="StoolLightBold" size="9" leading="10.8" start="0,0" stop="-1,-1"/>
			<blockFont name="StoolLightBold" size="10" leading="11" start="0,0" stop="-1,0"/>
			<blockFont name="StoolLightItalic" size="8" leading="9.6" start="0,5" stop="-1,5"/>
			<blockTextColor colorName="{{GREY}}" start="1,1" stop="-1,-1"/>
			<blockLeftPadding length="1" start="0,0" stop="0,-1"/>
			<blockRightPadding length="3" start="1,0" stop="-1,-1"/>
			<blockBottomPadding length="1" start="0,5" stop="-1,5"/>
			<blockSpan start="0,5" stop="-1,5"/>
			<lineStyle kind="LINEBELOW" colorName="#000000" thickness="0.7" start="0,0" stop="-1,0"/>
			<lineStyle kind="LINEBELOW" colorName="#000000" thickness="0.9" start="0,4" stop="-1,4"/>
		</blockTableStyle>



		<blockTableStyle id="flight">
			<lineStyle kind="GRID" colorName="red" start="0,0" stop="-1,-1"/>
			<blockFont name="UniversLT-Bold" size="9" leading="10.8" start="0,0" stop="-1,0"/>
			<blockTextColor colorName="white" start="0,0" stop="-1,0"/>
			<blockValign value="top" start="0,0" stop="-1, -1"/>
			<blockAlignment value="center" start="0,0" stop="-1, 0"/>
			<blockAlignment value="center" start="0,1" stop="0,-1"/>
			<blockLeftPadding length="10" start="4,1" stop="4,-1"/>
			<blockBackground colorName="{{GREY}}" start="1,0" stop="-1,0"/>
			<blockBackground colorName="orange" start="0,0" stop="0,0"/>
			<blockLeftPadding length="0" start="1, 1" stop="1, -1"/>
			<blockTopPadding length="8" start="0, 1" stop="0, -1"/>
			<blockValign value="middle" start="6,1" stop="6, -1"/>
			<blockValign value="middle" start="4,1" stop="4, -1"/>

		</blockTableStyle>

		<blockTableStyle id="payment">
			<!--lineStyle kind="BOX" thickness="0.5" colorName="blue" start="0,0" stop="-1, -1"/-->
			<lineStyle kind="LINEBELOW" colorName="silver" thickness="0.5" start="0,4" stop="-1, 4"/>
			<blockFont name="UniversLT-Bold" size="9" leading="10.8" start="0,0" stop="-1,0"/>
			<blockFont name="UniversLT-Bold" size="8" leading="9.6" start="0,1" stop="-1,1"/>
			<blockFont name="UniversLT-Light" size="8" leading="9.6" start="0,2" stop="-1,-1"/>
			<blockFont name="UniversLT-Bold" size="9" leading="10.8" start="3,5" stop="3,5"/>
			<blockAlignment value="center" start="1,1" stop="1, -1"/>
			<blockAlignment value="right" start="2,1" stop="-1, -1"/>
			<blockBackground colorName="{{GREY}}" start="0,0" stop="-1,0"/>
			<blockBackground colorName="#F0F0F0" start="0,1" stop="-1,1"/>
			<blockTextColor colorName="white" start="0,0" stop="-1,0"/>
		</blockTableStyle>

		<blockTableStyle id="city_intro">
			<!--lineStyle kind="GRID" colorName="blue" start="0,0" stop="-1, -1"/-->
			<lineStyle kind="LINEABOVE" colorName="{{YELLOW}}" thickness="2" cap="round" start="0,0" stop="-1, 0"/>
			<blockSpan start="0,0" stop="1,0"/>
			<blockSpan start="0,1" stop="1,1"/>
			<blockTopPadding length="10" start="0,0" stop="-1, 0"/>
			<blockTopPadding length="15" start="0,0" stop="0, 0"/>
			<blockLeftPadding length="0" start="2,0" stop="2,0"/>
			<blockLeftPadding length="-60" start="2,1" stop="2,1"/>
			<blockValign  value="center" start="2,1" stop="2, 1"/>
		</blockTableStyle>
	</stylesheet>

	<story>
		
		<blockTable style="red" colWidths="100%">	<!-- Main Table acting as a container for other tables -->
			<tr>
				<td>
					<para><font face="StoolLightBold" size="16"><u>Booking Confirmation:</u></font></para>
					<spacer length="10"/>
					<para><font face="StoolReg" size="11">Dear Mr Anthony Smith,</font></para>
					<spacer length="5"/>
					<para><font face="StoolReg" size="11">Thank you for choosing to travel with Sky Travel. We look forward to welcoming you on board!</font></para>
					<para><font face="StoolReg" size="11">In the meantime, please find in this e-brochure your booking confirmation details.</font></para>
					<spacer length="5"/>
					<para><font face="StoolReg" size="11">The Sky Travel team is happy to provide you with the following suggested tips for your 
{{script}}
if inbound:
    d = getTripLength(str(inbound.flight.date), str(data.tickets.airTicket.departureDate) )
    length = d.days
else:
    d = None
    length=''
{{endscript}}
					{{length}} 
					day trip to {{if outflight2 is None}}{{flight.arrive.city}}{{else}}{{outflight2.arrive.city}}{{endif}}.</font></para>
					<para><font face="StoolReg" size="11">In the e-brochure, you will discover we have selected a number of hotels that, in our opinion, offer great locations, great service and excellent value for money, the best on offer. You'll also find the brochure packed with great attractions, exciting rail and coach tours and flexible fly drive itineraries.</font></para>
					<spacer length="12"/>
					<para><font face="StoolReg" size="11">Your Booking Reference: <font face="StoolLightBold" color="black">EBNAC75</font></font></para> 
					<spacer length="15"/>
					<!-- Table holding the flight details -->
					<blockTable style="flight" rowHeights="{{', '.join(map(str, rowHeights))}}" colWidths="4%, 21%, 22%, 24%, 10%, 11%, 9%">
						<tr>
						<td></td><td>Day/Flight</td><td>Departure</td><td>Arrival</td><td>Duration</td><td>Airplane</td><td>Class</td>
						</tr>
						<tr>
							<td>
								<illustration height="14" width="17">
									<image file="rsrc/outbound.gif" x="0" y="0" height="14" width="17"/>
								</illustration>
							</td>
							<td>
								<para style="flightBodyFontBold">{{formatDate(str(data.tickets.airTicket.departureDate))}}</para>
								<para style="flightBodyFontBold">&nbsp;{{flight.id}}</para>
							</td>
							<td>
								<para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{flight.depart.time}}</font> / {{flight.depart.city}} ({{flight.depart.airport}})
								{{if flight.depart.terminal}}
									, Terminal {{flight.depart.terminal}}
								{{endif}}
								</para>
							</td>
							<td>
								<para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{flight.arrive.time}} / </font>{{flight.arrive.city}}, ({{flight.arrive.airport}})
								{{if flight.depart.terminal}}
									, Terminal {{flight.depart.terminal}}
								{{endif}}</para>
							</td>
							<td><para style="flightBodyFont">{{flight.duration}}</para></td>
							<td><para style="flightBodyFont">A321</para><para style="flightBodyFont">Non-Stop</para></td>
							<td><para style="flightBodyFont">Business</para></td>
						</tr>
						{{if outflight2 is not None}}
						<tr>
							<td></td>
							<td>
								<para style="flightBodyFontBold">{{formatDate(str(outflight2.date))}}</para>
								<para style="flightBodyFontBold">&nbsp;{{outflight2.id}}</para>
							</td>
							<td><para style="flightBodyFont">
								<font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{outflight2.depart.time}} </font>/  {{outflight2.depart.city}}, ({{outflight2.depart.airport}})								
								{{if flight.depart.terminal}}
									, Terminal {{flight.depart.terminal}}
								{{endif}}</para></td>
							<td><para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{outflight2.arrive.time}}</font> / {{outflight2.arrive.city}}, ({{outflight2.arrive.airport }})								
							{{if flight.depart.terminal}}
								, Terminal {{flight.depart.terminal}}
							{{endif}}</para></td>
							<td><para style="flightBodyFont">{{outflight2.duration}}</para></td>
							<td><para style="flightBodyFont">A321</para><para style="flightBodyFont">Non-Stop</para></td>
							<td><para style="flightBodyFont">Business</para></td>
						</tr>
						{{endif}}
						{{if inbound is not None}}
						<tr>
							<td>
								<illustration height="14" width="17">
									<image file="rsrc/inbound.gif" x="0" y="0" height="14" width="17"/>
								</illustration>
							</td>
							<td>
								<para style="flightBodyFontBold">{{formatDate(str(inbound.flight.date))}}</para>
								<para style="flightBodyFontBold">&nbsp;{{inbound.flight.id}}</para>
							</td>
							<td><para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{inbound.flight.depart.time}}</font> / {{inbound.flight.depart.city}}({{inbound.flight.depart.airport}})
							{{if inbound.flight.depart.terminal}}
								, Terminal {{inbound.flight.depart.terminal}}
							{{endif}}
							</para></td>
							<td><para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{inbound.flight.arrive.time}}</font> / {{inbound.flight.arrive.city}}({{inbound.flight.arrive.airport}})
							{{if inbound.flight.arrive.terminal}}
								, Terminal {{inbound.flight.arrive.terminal}}
							{{endif}}
							</para></td>
							<td><para style="flightBodyFont">{{inbound.flight.duration}}</para></td>
							<td><para style="flightBodyFont">A321</para><para style="flightBodyFont">Non-Stop</para></td>
							<td><para style="flightBodyFont">Business</para></td>
						</tr>
						
						{{if inflight2 is not None}}
						<tr>
							<td></td>
							<td>
								<para style="flightBodyFontBold">{{formatDate(str(inflight2.date))}}</para>
								<para style="flightBodyFontBold">&nbsp;{{inflight2.id}}</para>
							</td>
							<td><para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{inflight2.depart.time}}</font> / {{inflight2.depart.city}}({{inflight2.depart.airport}})
							{{if inflight2.depart.terminal}}
								, Terminal {{inflight2.depart.terminal}}
							{{endif}}</para></td>
							<td><para style="flightBodyFont"><font face="{{hotelHeadingFontName}}" color="{{STRONG_GREY}}">{{inflight2.arrive.time}}</font> / {{inflight2.arrive.city}}({{inflight2.arrive.airport}})
							{{if inflight2.arrive.terminal}}
								, Terminal {{inflight2.arrive.terminal}}
							{{endif}}</para></td>
							<td><para style="flightBodyFont">{{inflight2.duration}}</para></td>
							<td><para style="flightBodyFont">A321</para><para style="flightBodyFont">Non-Stop</para></td>
							<td><para style="flightBodyFont">Business</para></td>
						</tr>
						{{endif}}
						{{endif}}
					</blockTable><!-- end of flight details table -->
					<spacer length="10"/>
				</td>
			</tr>
			<tr>
				<td>
{{script}}
pricepp = float(str(data.tickets.airTicket.fare))
numOfPassengers = 2
taxpp = pricepp/10
feepp = pricepp * 0.01
total_price = numOfPassengers * pricepp
total_tax = numOfPassengers * taxpp
total_fee = numOfPassengers * feepp
total = total_price + total_tax
{{endscript}}
					<spacer length="5"/>
					<blockTable style="payment" rowHeights="17, 18, 15, 15, 15, 20" colWidths="15%, 15%, 15%, 18%">
						<tr><td>Payments Details</td><td></td><td></td><td></td></tr>
						<tr><td>Products</td><td>Quantity</td><td>Price per person</td><td>Total Price</td></tr>
						<tr><td>Adult Fare</td><td>{{numOfPassengers}}</td><td>{{"%.2f" % pricepp}}</td><td>{{"%.2f" % total_price}}</td></tr>
						<tr><td>Adult Tax</td><td>{{numOfPassengers}}</td><td>{{"%.2f" % taxpp}}</td><td>{{"%.2f" % total_tax}}</td></tr>
						<tr><td>Other Fee</td><td>{{numOfPassengers}}</td><td>{{"%.2f" % feepp}}</td><td>{{"%.2f" % total_fee}}</td></tr>
						<tr><td></td><td></td><td></td><td>Total:     £ {{"%.2f" % total}}</td></tr>
					</blockTable>
					<spacer length="5"/>
				</td>
			</tr>
		</blockTable> <!-- end of Main table -->
		
		<nextFrame/>
		<blockTable style="city_intro" colWidths="30%,29%,41%" rowHeights="220, 80">
			<tr>
				<td vAlign="top">
					<keepInFrame onOverflow="shrink" id="city_intro">
					{{if outflight2 is None}}
						<para style="h1">{{flight.arrive.city}}</para>
						<para style="h2">{{cities[str(flight.arrive.city).lower()]['intro']}}</para>
						<spacer length="5"/>
						<para style="h3">{{cities[str(flight.arrive.city).lower()]['description']}}</para>
					{{else}}
						<para style="h1">{{outflight2.arrive.city}}</para>
						<para style="h2">{{cities[str(outflight2.arrive.city).lower()]['intro']}}</para>
						<spacer length="5"/>
						<para style="h3">{{cities[str(outflight2.arrive.city).lower()]['description']}}</para>
					{{endif}}

					</keepInFrame>
				</td>
				<td></td>
				<td>
					<illustration height="209" width="204">
						{{script}}
							if outflight2 is not None:
								city = outflight2.arrive.city
							else:
								city = flight.arrive.city
						{{endscript}}

						<image file="rsrc/city_{{city}}.jpg" x="0" y="0" height="198" width="203"/>
					</illustration>
				</td>
			</tr>
			<tr>
				<td>
					<illustration height="70" width="210">
						<image file="rsrc/rainfall.gif" x="0" y="0" height="70" width="100"/>
						<image file="rsrc/temperature.gif" x="110" y="0" height="70" width="100"/>
					</illustration>
				</td>
				<td>
				</td>
				<td>
					{{if outflight2 is None}}
						<para style="h3">{{cities[str(flight.arrive.city).lower()]['weatherInfo']}}</para>
					{{else}}
						<para style="h3">{{cities[str(outflight2.arrive.city).lower()]['weatherInfo']}}</para>
					{{endif}}
				</td>
			</tr>
		</blockTable>

<!-- Start the new page with new Frame -->
		<setNextTemplate name="pageTwo"/>
		<nextFrame/>
		<para><font face="UniversLT-Bold" size="14"> {{destinationCity}} Hotels and Apartments</font></para>
		<spacer length="10"/>
		<!-- Hotel stuff -->
		<blockTable colWidths="100%" style="red">
			<tr>
				<td>
{{script}}
availableHotels = []
for h in hotels.values():
    if h['city'] == str(destinationCity).lower():
        availableHotels.append(h)
{{endscript}}
					<!-- Table holding ONE hotel -->
					{{for hotel in xrange(len(availableHotels))}}
					<blockTable style="hotels" rowHeights="15, 72,8, 60,19" colWidths="108, 239, 147">
						<tr>
							<td>
								<illustration height="81" width="101">
									<image file="rsrc/{{availableHotels[hotel]['img']}}" x="0" y="0" height="80" width="100"/>
								</illustration>
							</td>
							<td><para  style="hot_heading">{{availableHotels[hotel]['displayName']}}</para></td>
							<td>				
								<illustration height="18" width="51">
									<image file="res/rating_2stars.gif" x="0" y="0" height="13" width="45"/>
								</illustration>
							</td>
						</tr>
						<tr>
							<td></td>
							<td>
								<para style="bodyFontBold">{{availableHotels[hotel]['address']}}</para>
								<spacer length="0"/>
								<para style="bodyFontBold">Tel: {{availableHotels[hotel]['telephone']}}, Fax:{{availableHotels[hotel]['fax']}}</para>
								<spacer length="1.5"/>
								<keepInFrame onOverflow="shrink" id="room_desc">
									<para style="bodyFont">{{availableHotels[hotel]['description']}}</para>
								</keepInFrame>
							</td>
							<td></td>
						</tr>
						<tr>
							<td>
								<illustration height="81" width="101">
									<image file="rsrc/{{availableHotels[hotel]['roomImg']}}" x="0" y="0" height="80" width="100"/>
								</illustration>
							</td>
							<td>
								<keepInFrame onOverflow="shrink" id="room_desc">
									<para style="bodyFont">{{availableHotels[hotel]['roomDesc']}}</para>
								</keepInFrame>
							</td>
							<td>	
								<!--   ROOM PRICES TABLE   -->
								<blockTable style="room_prices" rowHeights="15,12,10,10,10,10" colWidths="80, 20, 20, 23">
									<tr><td>Price per room (£)</td><td>Single</td><td>Twin</td><td>Triple</td></tr>
									<tr><td>01 Apr 06 - 15 Jun 06</td><td>£120</td><td>£134</td><td>£146</td></tr>
									<tr><td>16 Jun 06 - 15 Sep 06</td><td>£145</td><td>£156</td><td>£167</td></tr>
									<tr><td>16 Sep 06 - 15 Dec 06</td><td>£115</td><td>£116</td><td>£117</td></tr>
									<tr><td>16 Dec 06 - 31 Jan 07</td><td>£126</td><td>£137</td><td>£141</td></tr>
									<tr><td>Price based on Standard Room</td><td></td><td></td><td></td></tr>
								</blockTable>
							</td>
						</tr>
						<tr><td></td><td></td><td></td></tr>
						<tr>
							<td></td>
							<td>				
								<illustration height="15" width="115">
									<image file="res/icon_pool.gif" x="0" y="1" height="14" width="15"/>
									<image file="res/icon_business_ctr.gif" x="16" y="1" height="14" width="15"/>
									<image file="res/icon_fitness.gif" x="32" y="1" height="14" width="15"/>
									<image file="res/icon_handicap.gif" x="48" y="1" height="14" width="15"/>
									<image file="res/icon_roomsrv.gif" x="64" y="1" height="14" width="15"/>
									<image file="res/icon_restaurant.gif" x="80" y="1" height="14" width="15"/>
								</illustration>
							</td>
							<td></td>
						</tr>
					</blockTable>
					<spacer length="9"/>
					{{endfor}}
				</td>
			</tr>
		</blockTable>
		<spacer length="6"/>
	<!--nextFrame/-->
    {{if len(sections)}}
    <!--include world travel guide info-->

{{script}}
import wtg
if str(destinationCity) == 'Paris':
    location = 'paris' 
else:
    location = 'thailand'
WTG = wtg.WTGLocation(location, 'res')
{{endscript}}


    <setNextTemplate name="wtg_two_col"/>
    <nextPage/>
    {{WTG.toRmlBody(sections=sections)}}


    {{endif}}




	</story>
</document>
