Sales pack - PDF template #if doesn't work for discountAmount

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SpeedBullet
    Senior Member
    • Mar 2016
    • 123

    Sales pack - PDF template #if doesn't work for discountAmount

    I have a problem with the pdf template for an invoice.
    It is the part "#if discountamount" that goes wrong. -> the discountAmount is zero but that part still displays.
    The strange thing is: "#if shippingCost" works well. -> the shippongCost is zero and that part is hidden.

    HTML Code:
    <table style="padding: 4px; text-align: right;">
        <tbody>
            <!-- {{#if discountAmount}} -->
            <tr>
                <td style="color: #666;">Amount before discount</td>
                <td>{{preDiscountedAmountCurrencySymbol}} {{preDiscountedAmount}}</td>
            </tr>
            <tr>
                <td style="color: #666;">Discount</td>
                <td>{{discountAmountCurrencySymbol}} {{discountAmount}}</td>
            </tr>
            <!-- {{/if}} -->
            <tr>
                <td style="color: #666;">Subtotal</td>
                <td>{{amountCurrencySymbol}} {{amount}}</td>
            </tr>
            <tr>
                <td style="color: #666;">VAT</td>
                <td>{{taxAmountCurrencySymbol}} {{taxAmount}}</td>
            </tr>
            <!-- {{#if shippingCost}} -->
            <tr>
                <td style="color: #666;">Shipping cost</td>
                <td>{{shippingCostCurrencySymbol}} {{shippingCost}}</td>
            </tr>
            <!-- {{/if}} -->
            <tr>
                <td style="color: #666;">Total amount</td>
                <td style="color: #006E00; font-weight: bold;">{{grandTotalAmountCurrencySymbol}} {{grandTotalAmount}}</td>
            </tr>
        </tbody>
    </table>
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    Try to check raw values. {{#if discountAmount_RAW}} You are checking string values that gives true. See: https://docs.espocrm.com/user-guide/...df/#raw-values
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • SpeedBullet
      Senior Member
      • Mar 2016
      • 123

      #3
      Thanks Yurikuzn, this works! Is it possible to have VAT / Taxes over shipping costs? Now it's taxless.

      Comment

      Working...