Announcement

Collapse
No announcement yet.

Print to PDF access parent value from each section

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Print to PDF access parent value from each section

    Hi,
    I am having some trouble setting up conditional logic in my PDF template.
    I want a column in the table to only be printed if the parent entity has a taxType of 'Taxed' this works for the header row but I can not seem to get the right syntax from inside the {{#each Item}} section to do this check. Is this possible?


    HTML Code:
    <table border="0.1pt" cellpadding="2" class="table table-bordered">
        <tbody>
            <tr>
                <td>Item</td>
                <!-- {{#ifEqual taxType 'Taxed'}} -->
                    <td align="right">Tax</td>
                <!-- {{/ifEqual}} -->
                <td align="right">Total</td>
            </tr>
            <!-- {{#each Item}} -->
            <tr>
                <td>{{ItemName}}</td>
                <!-- {{#ifEqual this ../taxType 'Taxed'}} -->
                    <td align="right">{{totalTax}}</td>
                <!-- {{/ifEqual}} -->
                <td align="right">{{total}}</td>
            </tr>
            <!-- {{/each}} -->
        </tbody>
    </table>




  • #2
    Hi Kyle,


    Code:
    {{../taxType}}

    Comment


    • #3
      Thank you. this worked.

      Comment


      • #4
        I'm saving this info for future use, but where would you use that code specifically?

        Is it like this?


        Code:
        <!-- {{#ifEqual {{../taxType}} 'Taxed'}} -->

        Comment


        • #5
          Hi not quite here is the syntax from my template
          HTML Code:
          <table border="0.1pt" cellpadding="2" class="table table-bordered">
              <tbody>
                  <tr>
                      <!-- {{#ifEqual taxType "Taxed"}} -->
                          <td align="right">Tax</td>
                      <!-- {{/ifEqual}} -->
                      <td align="right">Total</td>
                  </tr>
                  <!-- {{#each lineItem}} -->
                  <tr>
                      <td align="right">{{totalTaxCurrencySymbol}}{{discount Amt}}</td>
                      <!-- {{#ifEqual ../taxType "Taxed"}} -->
                          <td align="right">{{totalTaxCurrencySymbol}}{{totalTax }}</td>
                      <!-- {{/ifEqual}} -->
                      <td align="right">{{totalTaxCurrencySymbol}}{{total}}</td>
                  </tr>
                  <!-- {{/each}} -->
              </tbody>
          </table>

          Comment


          • #6
            Originally posted by Kyle View Post
            Hi not quite here is the syntax from my template
            Thank Kyle, good to see. Also you should probably use the [code] instead of HTML.

            Comment

            Working...
            X