• Kim Grondsma
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have created a visualforce page to render a good looking qoute PDF 
This work, all the styling is exactly what I want. 
However when rendering the PDF the Quote line items appear in a different sort order than they are sorted on the qoute detail page in the related list. 
How can I have the PDF display the same order? 
Because the styling is the main reason I reverted to PDF I would like t stick with the code for the table, just add something to control the sorting

This is my visualforce page code: 
  <td style="width: 13%; text-align: center; font-size: 10pt;"><apex:outputText value="{0, number, integer}">
    <apex:param value="{!line.Quantity}"/> </apex:outputText></td>
           <td style="width: 44%; font-weight:bold; font-size: 10pt;"><apex:outputField value="{!line.Product2.Name}" /></td>

             <td style="width: 20%; text-align: right; font-size: 10pt;"><apex:outputField value="{!line.UnitPrice}" /></td>

             <td style="width: 20%; text-align: right; font-weight:bold; font-size: 10pt;"><apex:outputField value="{!line.TotalPrice}" /></td>

              <td></td> 

         </tr>
         <tr>
         <td></td>
         <td font-size=" 10pt" margin-right= "0.5cm" ><apex:outputField value="{!line.Product_description__c}" /></td>
         </tr>
         <tr>
         <td colspan="5" class="bottomborder"> </td> </tr>

         </apex:repeat>  

My users order quote line items on quotes using the sort button on the related list.

 

When I query the quote line items using Apex, I'm not sure what field to use in my order by clause to reproduce the order they specifies using the sort button on the related list. Is there a way to re-produce the user specified sort order in Apex code?

 

 

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.

 

Hi Experts,

Does anyone know of a way to attach files, to an e-mail, from notes and attachments? Instead of downloading the attachement to the hard drive and uploading to the e-mail.

Any help would be greatly appreciated, thank-you.

v/r
Shane Quiring