This article explains how to customize the sales quotes PDF that is generated by Raley.


First, you should prepare a sales quote in your Jira ticket with at least one row. This can contain any meaningful data, just keep in mind that you will  be fine-tuning your PDF printout using this.

For example, it could look like this:

Make a note of the ticket key - you'll need it later.

Using top Jira menu navigate to Apps → Raley Sales Quotes and Purchase Orders → PDF Templates → Sales Quotes. The screen looks like this:


As a user, you can customize the filename of the generated PDF as well as the content. We'll start with the file customization.


PDF Filename customization


The PDF filename pattern is a template for generating name of the Sales Quote PDF file. By default it is empty.

The template for PDF filename can contain placeholders which will be dynamically resolved at the time when PDF generation is happening. You can use the following placeholders:

PlaceholderDescriptionExample
Unknown macro: {customer.displayName}
Display name of the reporter of this JSM ticket
Unknown macro: {customer.displayName}

- quote.pdf


Unknown macro: {company.name}


Name of your Company as specified in Raley config panel → Company → Company Name


quote by

Unknown macro: {company.name}

.pdf



Unknown macro: {DATE_PATTERN}


A Java date format that will be resolved to current date at the moment of PDF generation{customer.displayName} - sale quote by {company.name} - {yyyy-MMM-dd}.pdf



PDF Template customization



Raley is relying on PDF generator from HTML with value placeholders expressed in Thymeleaf templating language. Below you can find an example of a template and a generated PDF file:

       


You can find more templates in our Sales Quotes Template Store. Feel free to use them!

We recommend that you start with the simplest possible template, test drive it on a Sales Quote ticket that you have created (see beginning of this article) and then adjust it per your needs.


When you make changes to SQ PDF template, you can test them on a particular Jira ticket, simply putting it into the text box to the right from template and clicking on Preview PDF button. The system

will collect data from Raley Sales Quote, Jira ticket and attempt to generate a PDF based on that. If it encounter any errors in process, they will be rendered above the PDF template text area.

Otherwise, a PDF will be generated with a predefined file name and downloaded to your browser.


If you really screw it up, then you can always click on "Reset template" link and it will revert the PDF Template to the default.


NB! Note, that your changes to the template will not have effect on the way PDF is generated before you hit the button SAVE.


The following table shows all available properties of a Raley Sales Quotes that you can reference in your template:


Purchase Order template variables

PropertyDescription
${logo}
path to your company logo as added on Company tab
${number}
Purchase order number
${date}
The date when this PDF was generated in format 
yyyy-MM-dd
${customer}current ticket's reporter.displayName
${contactPerson}The value of input "Contact Person" in SQ screen
${address}The value of "Address" in SQ screen
${quote}A sales quote object
${quote.jiraIssueKey}Issue key of the sales quote
${quote.netAmount}quote net amount as java.math.BigDecimal 
${quote.taxAmount}quote tax amount as java.math.BigDecimal 
${quote.grossAmount}quote gross amount as java.math.BigDecimal
${quote.supplier}Sales Quote supplier object
${quote.supplier.PROPERTY}The following properties are available in quote.supplier: id, name, phone, email, address, notes, paymentDetails, taxNo, contact, terms
${order.quoteLine}java.util.List of objects. Every object is representing a separate sales quote line 
${quoteLine.unitPrice}quote line unit price as java.math.BigDecimal
${quoteLine.quantity}quote line quantity as java.math.BigDecimal
${quoteLine.total}quote line total as java.math.BigDecimal
${quoteLine.taxRate.PROPERTY}

tax rate that applies for this sales quote line. You can access these properties:

  • name - represents tax name
  • value - tax rate value as java.lang.Double
${quoteLine.product.PROPERTY}

product referenced in this quote line. You can access these properties:

  • sku - SKU identifier
  • description - Name of the product
  • unitPrice - price of the product unit as java.lang.Double. This is the default price taken from products registry and it may differ from the ${quoteLine.unitPrice} value
  • id - internal identifier of the product
${quote.discountName}

Name of the discount as used in this quote line

${quote.discount}

value of discount as java.math.BigDecimal

${companyAddress}Company address as specified in Company tab
${currencyCode}3-letter currency code as specified for your company
${numDecimals}

How many decimals should be used when rendering amounts. By default, 2. If you need a different precision, then 

contact us via helpdesk

${createdByName}

User's displayName who created this purchase request ticket in Jira

${notes}

Issue description field

${notesHTML}

Rich text issue description. Please note, that you'll need to use th:utext attribute to properly render it. For example:

<div th:utext="'Notes ' + ${notesHTML}" style="width: 100%; border: solid 1px gray;"></div>


Once you're satisfied with the result, click on SAVE button below and from now on your quote PDFs will be generated as you've specified in your template.


Adding a scripted-font name signature


You can add a scripted font signature into PDF generated by Raley. Below is an example of such a signature:


To create such a signature, you can use the following template fragment:

<tr>
        <td>Requested by</td>
        <td><span style="font-family: 'Brush Script MT', cursive;" th:text="${createdByName}"></span></td> 
        <td colspan="2"></td>
</td>


Show values from quote-line custom fields


To show the values from all custom fields of your quote  line you can use the following code fragment (line 2):

<td class="text-left" th:text="${quoteLine.product.description}"></td>
<td class="text-left" th:each="cfI,index : ${quoteLine.customFieldsDto}" th:text="${cfI.value}" th:class="${index.count % 2 > 0}? 'odd'"></td>


Our you can show individual fields, using this technique (lines 2 and 3):

<td class="text-left" th:text="${quoteLine.product.description}"></td>
<td class="text-left" th:text="${quoteLine.customfield_1}"></td>
<td class="text-left" th:text="${quoteLine.customfield_3}"></td>


In the example above, we're outputting the values for GL code (customfield_1) and URL link (customfield_3)


Showing values from Jira standard and custom fields

You can also render the value of any Jira standard or custom field from the current ticket. Here's the example how to show summary of the ticket:

<div th:text="${jiraFieldHeaders['summary']} + ' ' + ${jiraFieldValues['summary']}" style="width: 100%; height: 40px; border: solid 1px gray;"></div>


And this is how you can show a custom field - both, name and the value:

<div th:text="${jiraFieldHeaders['customfield_10057']} + ' ' + ${jiraFieldValues['customfield_10057']}" style="width: 100%; height: 40px; border: solid 1px gray;"></div>