Announcement

Collapse
No announcement yet.

Compare quantity/amount in PDF-Templates (How to Debug)

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

  • Compare quantity/amount in PDF-Templates (How to Debug)

    I want to hide "quantity" in pdf-templates if it's zero but somehow i cant compare it.
    I tried many ways but none work.

    HTML Code:
    <td style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;">
       <span style="font-size: 10px;">
          <!-- {{#if [quantity > '0.00']}} -->{{quantity}}<!-- {{/if}} -->
       </span>
    </td>
    HTML Code:
    <td style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;">
       <span style="font-size: 10px;">
          <!-- {{#if 'quantity' [>] '0.00'}} -->{{quantity}}<!-- {{/if}} -->
       </span>
    </td>
    HTML Code:
    <td style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;">
       <span style="font-size: 10px;">
          <!-- {{#ifEqual 'quantity' '0.00'}} -->{{quantity}}<!-- {{/ifEqual}} -->
       </span>
    </td>
    HTML Code:
    <td style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;">
       <span style="font-size: 10px;">
          <!-- {{#ifEqual quantity '0.00'}} -->{{quantity}}<!-- {{/ifEqual}} -->
       </span>
    </td>
    HTML Code:
    <td style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;">
       <span style="font-size: 10px;">
          <!-- {{#ifEqual quantity 0.00}} -->{{quantity}}<!-- {{/ifEqual}} -->
       </span>
    </td>


    HTML Code:
    <td style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;">
       <span style="font-size: 10px;">
          <!-- {{#ifEqual quantity 0}} -->{{quantity}}<!-- {{/ifEqual}} -->
       </span>
    </td>


    Where am i going wrong?

  • #2
    Hi arrestthepresident,

    Please try #ifEqual without using styles. That is, use the opening tag before the style and the closing tag after using the style.

    Comment


    • #3
      It is recommended to use tags when dealing with pdf, this is how you can achieve what you need:

      PHP Code:
      {{#tableTag}}
            
      {{#trTag}}
                
      {{#ifEqual quantity "0.00"}}
                
      {{#tdTag style="background-color:#f6e7f4; border-bottom: .5px solid #CF78C3;"}}<span style="font-size: 10px;">{{quantity}}</span>{{/tdTag}}
                
      {{else}}
                {{
      #tdTag}}Whoops is not equal 0 {{/tdTag}}
                
      {{/ifEqual}}
            {{/
      trTag}}
      {{/
      tableTag}}​ 
      Rabii
      Web Dev

      Comment


      • rabii
        rabii commented
        Editing a comment
        this post has nothing to do with print to pdf

      • conceptmedical
        conceptmedical commented
        Editing a comment
        rabii, my bad I have tagged a wrong URL https://forum.espocrm.com/forum/gene...n-pdf-template Kindly check that, As suggested I have used Tcpdf
        case a) {pageAbsoluteNumber} of {totalPageNumber}
        case b) {pageNumber} of {totalPageNumber}

        These two methods are giving proper result in case on single file. I'm trying to access this from espo case. If I select it's gives an output that not matched to condition statement.

        If I select two cases, then first Page display Page 1 of 1- and second-page Display Page 2 of 1 that is wrong.

      • rabii
        rabii commented
        Editing a comment
        tbh i don't understand what you mean.

        can you explain further this part
        These two methods are giving proper result in case on single file. I'm trying to access this from espo case. If I select it's gives an output that not matched to condition statement.

        not sure what you need to achieve.
    Working...
    X