Skip to content

Instantly share code, notes, and snippets.

@rfjolnisson
Created July 30, 2015 11:33
Show Gist options
  • Save rfjolnisson/861cf4c96e77712866cb to your computer and use it in GitHub Desktop.
Save rfjolnisson/861cf4c96e77712866cb to your computer and use it in GitHub Desktop.
<!--
Name: VoucherTemplate.page
Copyright © 2015 Kaptio ehf.
======================================================
======================================================
Purpose:
-------
A Visualforce template for vouchers within Kaptio Travel.
Can be used to create custom voucher outputs.
======================================================
======================================================
-->
<apex:page controller="KaptioTravel.VoucherOutputDto" showHeader="false" sidebar="false" applyBodyTag="false" renderAs="pdf">
<head>
<apex:stylesheet value="{!URLFOR($Resource.KaptioTravel__assets, '/static-css/print.css')}" />
</head>
<body>
<apex:repeat value="{!vouchers}" var="v">
<div class="container">
<div class="row">
<div class="col-12">
<div class="invoice-title">
<h2><apex:outputText value="Voucher" /></h2>
<h3 class="pull-right">
<apex:outputPanel rendered="{!v.header.KaptioTravel__Voucher_Reference_No__c != null}">
# <apex:outputField value="{!v.header.KaptioTravel__Voucher_Reference_No__c}" />
</apex:outputPanel>
</h3>
</div>
<hr />
<div class="row">
<div class="col-6">
<address>
<strong><apex:outputText value="Customer" /></strong>
<br /> <apex:outputField value="{!v.header.KaptioTravel__Itinerary__r.KaptioTravel__Name_On_Booking__c}" />
</address>
</div>
<div class="col-6 text-right">
<address>
<strong><apex:outputText value="Issued By" /></strong>
<br /> <apex:outputField value="{!channel.KaptioTravel__Brand__r.Name}" />
<br /> <apex:outputField value="{!channel.KaptioTravel__Brand__r.KaptioTravel__BrandEmail__c}" />
<br /> <apex:outputField value="{!channel.KaptioTravel__Brand__r.KaptioTravel__BrandPhone__c}" />
</address>
</div>
</div>
<div class="row">
<div class="col-6">
<address>
<strong><apex:outputText value="Supplier" /></strong>
<br /> <apex:outputField value="{!v.header.KaptioTravel__Supplier__r.Name}" />
<br /> <apex:outputField value="{!v.header.KaptioTravel__Supplier__r.Phone}" />
<br /> <apex:outputField value="{!v.header.KaptioTravel__Supplier__r.ShippingStreet}" />
<br /> <apex:outputField value="{!v.header.KaptioTravel__Supplier__r.ShippingPostalCode}" />&nbsp;
<apex:outputField value="{!v.header.KaptioTravel__Supplier__r.ShippingCity}" />
</address>
</div>
<div class="col-6 text-right">
<address>
<strong><apex:outputText value="Issue Date" /></strong>
<br />
<apex:outputText value="{0,date,dd MMM YYYY}">
<apex:param value="{!TODAY()}" />
</apex:outputText>
<br /> <span style="font-size:0.8em;">(<apex:outputField value="{!v.header.KaptioTravel__Booking_No__c}" />)</span>
</address>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><strong><apex:outputText value="Bookings" /></strong></h3>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<td>
<strong>
<apex:outputText value="{!$ObjectType.KaptioTravel__Itinerary_Item__c.fields.KaptioTravel__ItemName__c.Label}" />
</strong>
</td>
<td class="text-center">
<strong>
<apex:outputText value="{!$ObjectType.KaptioTravel__Itinerary_Item__c.fields.KaptioTravel__DatesPretty__c.Label}" />
</strong>
</td>
<td class="text-center">
<strong>
<apex:outputText value="{!$ObjectType.KaptioTravel__Itinerary_Item__c.fields.KaptioTravel__Quantity__c.Label}" />
</strong>
</td>
<td class="text-right"><strong></strong></td>
</tr>
</thead>
<tbody>
<apex:repeat value="{!v.lines}" var="l">
<tr>
<td><apex:outputField value="{!l.KaptioTravel__VoucherTitle__c}"/></td>
<td class="text-center">
<apex:outputField value="{!l.KaptioTravel__DatesPretty__c}"/>
</td>
<td class="text-center">
<apex:outputField value="{!l.KaptioTravel__Quantity__c}"/>&nbsp;
<apex:outputField value="{!l.KaptioTravel__Unit_Type__c}"/>
</td>
<td class="text-right"><apex:outputField value="{!l.KaptioTravel__Voucher_Notes__c}"/></td>
</tr>
</apex:repeat>
<apex:repeat value="{!v.addons}" var="l">
<tr>
<td><apex:outputField value="{!l.KaptioTravel__ItemName__c}"/></td>
<td class="text-center">
<apex:outputField value="{!l.KaptioTravel__DatesPretty__c}"/>
</td>
<td class="text-center">
<apex:outputField value="{!l.KaptioTravel__Quantity__c}"/>&nbsp;
<apex:outputField value="{!l.KaptioTravel__Unit_Type__c}"/>
</td>
<td class="text-right"><apex:outputField value="{!l.KaptioTravel__Voucher_Notes__c}"/></td>
</tr>
</apex:repeat>
</tbody>
</table>
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-md-12">
<apex:outputText value="{!v.header.KaptioTravel__Item__r.KaptioTravel__VoucherMessage__c}" escape="false"
rendered="{!v.header.KaptioTravel__Item__r.KaptioTravel__VoucherMessage__c != ''}"/>
<apex:variable value="{!v.header.KaptioTravel__Item__r.KaptioTravel__GeoTag__Longitude__s != null}" var="hasGeolocation" />
</div>
</div>
<apex:outputPanel rendered="{!hasGeolocation}">
<div class="row">
<div class="col-md-12">
<div class="qr-code">
<apex:image value="https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=
https://www.google.com/maps?ll={!v.header.KaptioTravel__Item__r.KaptioTravel__GeoTag__Latitude__s},
{!v.header.KaptioTravel__Item__r.KaptioTravel__GeoTag__Longitude__s}" />
</div>
<div class="qr-code-text">
<h3><apex:outputText value="Need Directions?" /></h3>
<p><apex:outputText value="Please scan this QR code to see the location of this booking." /></p>
</div>
</div>
</div>
</apex:outputPanel>
</div>
</div>
</div>
<apex:outputPanel rendered="{!v.index < vouchers.size}">
<div class="break">&nbsp;</div>
</apex:outputPanel>
</apex:repeat>
</body>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment