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
brettnnycbrettnnyc 

Opportunity Products not sorting nor in order

My Quotes look somewhat good except the order of the Opportunity Products in the table. No matter the order on the Salesforce Opportunity Products page the quote puts the line items in a different order. As you can see it makes it look jumbled. I have a "Family" category (Staff, Glassware, hors d'oeuvres, liquor) but I can't make it populate to the Quote.

 

How can I sort the hors d'oeuvres from the staff from the liquor in the quote? I could use the Family field (pick-list) as the determiner as to the grouping. It would look better probably if each Family had their own table (list & price of staff; list & price of hors d'oeuvres; etc.) on the same sheet of the quote, but I have no idea how to sort based upon Family. Does anyone know?

 

Here is the code that produces the jumbled Quote that I am using without any sorting or grouping by Family:

<apex:page standardController="Opportunity" showHeader="false" renderas="pdf">

<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>
    <td>
        <img src='{!URLFOR($Resource.Logo4567687)}' title="logo" />
    </td>
    <td  align="right"><font face="Arial" >
    <b>Quote  for:&nbsp;<apex:OutputField value="{!Opportunity.Date_Taken__c}"/></b></font><br/>
        <font face="Arial" color="#3399ff">
        <span style="color:#045FB4"><b>Sloan Professional Services, LLC</b></span><br/>
        <br/>
        563 West 139th Street <br/>
        New York, New York 10031 <br/>
        (646) 678-0380 New York <br/>
                (310) 710-6668 Los Angeles <br/>
        </font>
     </td>
   
</tr>

<hr/>

</table>
<table border="0" cellspacing="0" cellpadding="0" width="115%" id="table1">
  <tr>
        <td align="center"><font face="Arial">Quote valid through:&nbsp;<apex:OutputField value="{!Opportunity.CloseDate}"/><br/>   
        Proposed by: {!Opportunity.Owner.FirstName} {!Opportunity.Owner.LastName}</font>
        </td>
 </tr>
</table>
<br/>
<hr/>
<p><b><font face="Arial" color="#000080">Client Information</font></b></p>

<table border="0" width="100%" id="table2">
<tr>
       <td align="center">
           <b><span style="color:#045FB4"><font face="Arial">        {!Opportunity.Name}'s Event<br/></font>
           <font face="Arial">&nbsp;        <apex:OutputField value="{!Opportunity.Event_Start_Date__c}"/> from {!Opportunity.Event_Start_Time__c} to {!Opportunity.Event_End_Time__c}<br/></font></span></b>
           <font face="Arial">at<br/>
           {!Opportunity.Event_Location__c}<br/><br/></font>
                   </td>
       </tr>
<tr>
       <td>         
           <font face="Arial">Bill To:<br/>
Karlie Lahm<br/>                         
  {!Opportunity.Account.Name}<br/>
                             {!Opportunity.Account.BillingStreet}<br/>
                              {!Opportunity.Account.BillingCity}, {!Opportunity.Account.BillingState} {!Opportunity.Account.BillingPostalCode}<br/>
           {!Opportunity.Account.Phone}<br/>
           </font>
        </td>
        </tr>   
</table>
<br/>
<hr/>
<p><b><font color="#ffffcc" face="Arial">Products</font></b></p>
<table border="0" width="100%" id="table4">
<tr>
       <td bgcolor="#ffffcc"><b><font face="Arial">Product</font></b></td>
       <td bgcolor="#ffffcc"><b><font face="Arial">Product</font></b></td>
       <td bgcolor="#ffffcc"><b><font face="Arial">Quantity</font></b></td>
       <td bgcolor="#ffffcc"><b><font face="Arial">Description</font></b></td>
       <td bgcolor="#ffffcc"><b><font face="Arial">Unit Price</font></b></td>
       <td bgcolor="#ffffcc"><b><font face="Arial">Total Price</font></b></td>
</tr>
<tr>
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td>{!line.PricebookEntry.Name}</td>
             <td>{!line.Quantity}</td>
             <td>{!line.Product_Description__c}</td>                       
             <td><apex:OutputField value="{!line.UnitPrice}"/></td>
             <td><apex:OutputField value="{!line.Line_Item_Total__c}"/></td>
          </tr>
       </apex:repeat> 
</tr>
<tr>
       <td bgcolor="#ffffcc" align="right" colspan="7">
       <font face="Arial"><b>Total:</b>&nbsp;<apex:OutputField value="{!Opportunity.Total_Event_Price__c}"/></font></td>
</tr>
</table>
<br/>
<hr/>
<p><b><font color="#3333ff" face="Arial">Terms and Conditions</font></b></p>
<table border="0" width="100%" id="table3">


<tr>
        <td><font face="Arial">
       
              Start date:&nbsp;<apex:OutputField value="{!Opportunity.Date_Taken__c}"/><br/>
              Contract End date:&nbsp;<apex:OutputField value="{!Opportunity.CloseDate}"/><br/>
            </font>
        </td>
        </tr>
 

<tr>
       
        <td><font face="Arial">
              Payment Method:<apex:OutputField value="{!Opportunity.Method_of_Payment__c}"/><br/>
              Remainder Due: <apex:OutputField value="{!Opportunity.Final_Payment_Due__c}"/><br/>
                          </font>
      
       </td>
     
     
</tr>
        <br/>
         <td><font face="Arial">{!Opportunity.Contract_Narrative__c}
              <br> </br>
              <br>  </br>
              To reserve staff and/or products for your event you must pay a deposit of 80%
              of the total event fee. Full payment for the staff is due no later than 24 hours
after your event. An adjusted invoice based upon actual hours and participation will be presented within 24 hours of the event end. Cancellation of the event will forfeit
              the entire deposit. Payment via credit card is also acceptable. Please make all checks out to Sloan Professional Services, LLC.
            </font>
       </td>
</table>
<p>&nbsp;</p>
<hr/>
</apex:page>

 

Thank you,
Brett