• Peter Kevin
  • NEWBIE
  • -1 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,

I have written a code for an email template using visual force where I want to display the Margin percent field upto two decimal places. Currently I am getting the table in this format: 
User-added image


Here is the code:
 <messaging:emailTemplate recipientType="User"
    subject="Quote Appoval for {!relatedTo.name}"
    relatedToType="Quote">
 
    <messaging:htmlEmailBody >
        <html>
            <body>
 
            <p>Dear {!recipient.name},</p>
            <p>Please find below details related to Quote - {!relatedTo.Name}.<br/>
            Customer - {!relatedTo.Account.Name}<br/>
            Customer Type - {!relatedTo.Account.Type}<br/>
            Total amount - ${!relatedTo.New_Total_Price__c}<br/> 
            Margin Percent- {!relatedTo.Margin_Percent__c}%<br/> 
            Approval reason : Total discount on quote exceeds {!relatedTo.Total_Discount__c} %.<br/>
            </p>
            <br/>
            <p>
            Product Information:
            <table border="2" >
                <tr>
                    <th>Product</th>
                    <th>Product quantity</th>
                    <th>Total Price</th>
                    <th>Margin Percent</th>
                    <th>Discount</th>
                    <th>Discount Reason</th>
                </tr>
                <apex:repeat var="cx" value="{!relatedTo.QuoteLineItems}">
                <tr>
                    <td>{!cx.Product2.Name}</td>
                    <td>{!cx.Quantity}</td>
                    <td>${!cx.Total_Price__c}</td>                                      
                    <td>${!cx.Margin_Percent__c}</td>                             
                </tr>
                </apex:repeat> 
            </table>
            </p>
            <br/>
        
            
            </body>
        </html>