function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
michaelkaelmichaelkael 

PDF template quotes lines items sorting

Hello

 

I have made an Email template with a pdf attachement to send a quotes to the customer from the Salesforce Quotes application. In this application the products can be sorted to easy the reading. That make me a trouble. Because I want to get exactly the same order as I have in the quotes in my email. Actually I get back all the products but the order seems to be random.

 

See my email template code:

 

 

<messaging:emailTemplate subject="Offre de Red Lion Controls - {!relatedTo.QuoteNumber}-{!relatedTo.Name}"
                         recipientType="Contact"
                         language="fr"
                         relatedToType="Quote">
<messaging:plaintextEmailBody >
Cher(e) {!relatedTo.Contact.Name}, 

Veuillez trouver, comme convenu, notre offre ci joint .

Pour toute question, n'hésitez pas à nous contacter.


</messaging:plaintextEmailBody>
<messaging:attachment renderAs="pdf" filename="{!relatedTo.name}">
<html>
<head>
<style>
    table {
      width:100%;
      border-collapse:collapse;
      margin-top:1px;
      margin-bottom:2px;}
      
      .letter td, .end td{
      padding-bottom:20px;
      
      }

    p, h4 {
      margin-top: 1px;
      margin-bottom:1px;
    }
      
    .footer p{
            padding:1px;
            text-align: center;
            font-size: 6pt;
            font-color:"grey";            
            
            }
            
    .productList td,.productList th{
             border-style: solid;
            border-width: 1px;
            border-color: "black";
            }
      
  
  </style>
  </head>  
<body>
    <div id="test"></div>
  <table class="letter">
      <tr>
        <td style="text-align:right;"><img src="{!$Resource.RedLionLogo}" /></td>
      </tr>
      <tr>
        <td><strong><p>{!relatedTo.Opportunity.Account.Name}</p> 
            <p>{!relatedTo.Opportunity.Account.BillingStreet}</p>
            <p>{!relatedTo.Opportunity.Account.BillingPostalCode} {!relatedTo.Opportunity.Account.BillingCity} </p>
            <p>{!relatedTo.Opportunity.Account.BillingCountry}</p></strong>
        </td>
      </tr>
      <tr>
        <td> <strong>A l'attention de:</strong> {!relatedTo.Contact.Name}</td>
      </tr>
      <tr>
        <td><strong>Date: </strong> {!DAY(today())}/{!MONTH(today())}/{!YEAR(today())}</td>
      </tr>
      <tr>  
        <td><strong>Référence de l'offre: {!relatedTo.QuoteNumber}-{!relatedTo.Name}</strong> </td>
      </tr>
      <tr>
        <td><apex:outputText escape="false" value="{!relatedTo.Quote_Notes_to_customer__c}" /></td>
      </tr>
  </table>
  <div style="page-break-after:always;"> </div>
  
  <h3>Products list:</h3>
    <table class="productList" style="margin-bottom:20px;margin-top:20px;">
        <tr>
            <th> Produit</th><th>Description</th><th>Quantité</th><th>Prix Net</th><th>Prix Total</th>
        </tr>
<apex:repeat var="kot" value="{!relatedTo.QuoteLineItems}">
           <tr>
               <td>{!kot.PriceBookEntry.name}</td>
               <td width="300px">{!kot.Product_Description_FR__c}</td>
               <td style="text-align:center;">{!ROUND(kot.Quantity,0)}</td>
               <td align="right"><apex:outputField value="{!kot.UnitPrice}"/> </td>
               <td align="right"><apex:outputField value="{!kot.TotalPrice}"/>  </td>
           </tr>
</apex:repeat>
       <tr>
           <td colspan="3" style="border:none;"></td> 
          <td style="text-align:right;"><strong>Grand total </strong></td><td style="text-align:right;"><apex:outputField value="{!relatedTo.GrandTotal}"/> </td>
      </tr>
</table>
<table class="end">
      <tr>
          <td>
          <p><strong>Offre valide jusqu'au: </strong>  <apex:outputField value="{!relatedTo.ExpirationDate}"/></p>
          <p><strong>Prix: </strong> Les prix sont en <strong>{!relatedTo.CurrencyIsoCode}</strong>. Les prix net/prix total/grand total sont donnés après remise.</p>
          <p><strong>Frais de port: </strong> <apex:outputField value="{!relatedTo.Opportunity.Account.Transportcostweeklyshipment__c}"/>.</p>
          <p><Strong>Condition de paiement (en jours): </strong> {!relatedTo.Opportunity.Account.Paymentterms__c}.  </p>
          <p><strong>Délai de livraison: </strong> 3-4 jours en moyenne départ usine (peut varier en fonction de l’état des stocks). </p>
          <p><strong>Minimum de commande (Hors frais de port): </strong> 200 {!relatedTo.CurrencyIsoCode}.</p>
          <p><strong>Toutes les commandes sont conditionnées par l'acceptation sans limite des <a name="T&C" href="http://sellmore.redlion.net/intdist/FrenchTerms16-09-2008.pdf">conditions générales de vente </a> de Red Lion.</strong></p>
          
          </td>
      </tr>
      <tr> 
          <td>En espérant que cela correspond à vos attentes.</td>
      </tr>
      <tr>
          <td> Merci d'indiquer le numéro d'offre <strong>{!relatedTo.QuoteNumber}-{!relatedTo.Name}</strong>
          avec votre commande ou tout autre correspondance relative à cette offre.</td>
        </tr>
        <tr>  
          <td>Cordialement,</td>
        </tr>
 </table>
 <table>    
      <tr>
        <td><p>{!$User.FirstName} {!$User.LastName}</p>
            <p>{!$User.Title}</p>
            <p>{!$User.CompanyName}</p></td>
      </tr>
      <tr>
          <td><p>Tel: {!$User.Phone}</p>
              <p>Mobile: {!$User.MobilePhone}</p>
              <p>Email: {!$User.Email}</p>
          </td>
      </tr>   
  </table>
 
</body>
</html>
</messaging:attachment>


</messaging:emailTemplate>

 

I hope you are going to help me, thank.

 

michaelkaelmichaelkael

Up

 

 

Nobody has a solution for that. Please!!

gonzalolgonzalol
Did you ever figure this out?
Kim GrondsmaKim Grondsma
I Have the same question, did you solve your problem?