• Jan Drommershausen
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 11
    Replies

Hello everyone!!!

 

        I am new to visualforce.  I want to pass id to page. But I am unable to find my account id.

Can anyone tell me how to find it.

 

Thanks & Regards

Phaniraj N

Hello everybody, maybe someone can help me? I stuck again with my Extension Controller / maybe with my visualforce Page too. 

I am training myself in a Developer-Edition, to understand Controllers and Visiualforce more.

 

I builded a Visualforce Page which is the Template for the Salesforce Quote Template (rendered as PDF)

My Quote line Items are sorted by a line Item Field maually by the user. All this worked out well.

 

Now i wanted push this more forward. My Goal is to sort the line items in groups so i can give out a price for every group.

 

For Example:

Group 1         Group Total Value 60 €             

#1   Line item a   10€

#2   Line item b   20€

#3   Line item c   30€

 

Group 2         Group Total Value 180 €

#4   Line item d   50€

#5   Line item e   60€

#6   Line item f    70€

 

.... and so on

 

What i did:

There is a custom Object called "QuotePhase" where Quote is the Master Object.

I have a Lookup field on the QuoteLineItems so i can reference them to the different Phases/Groups

- also set up a lookup-filter to make sure a user can only select a Phase that belongs to the quote which is the master of the Phase

- and a apex trigger which calculates values of all related Items related to the Phase (rollup is not available for lookups :-/ )

 

So here i stuck: i don't get the list to work proberbly.

I think its maybe a little detail on my controller or my List call on the visualforce. But all my try and error approaches brought me to results here.

 

Here is my Controller Extension:

public with sharing class ExtensionControllerQuote {

    public List<QuoteLineItem> QuoteLineItemsSorted {public get; private set;}
    public List<QuotePhase__c> QuotePhaseSorted {public get; private set;}
    Quote selectedQuote = new Quote();
    
    // constructor
    public ExtensionControllerQuote(ApexPages.StandardController cont)
    {
        selectedQuote = (Quote)cont.getRecord();
        QuoteLineItemsSorted = new List<QuoteLineItem>();
        QuoteLineItemsSorted =
            [Select o.New_Section_Headline__c,
                    o.Sort_Order__c,
                    o.Quantity,
                    o.Einheit__c,
                    o.PricebookEntry.Name,
                    o.PricebookEntryId,
                    o.Product_lineitem_description__c,
                    o.UnitPrice,
                    o.TotalPrice
             From QuoteLineItem o
             Where o.QuoteId =: selectedQuote.id
             ORDER BY Sort_Order__c ASC
             limit 1000
                ];
        selectedQuote = (Quote)cont.getRecord();
        QuotePhaseSorted = new List<QuotePhase__c>();
        QuotePhaseSorted =
            [Select q.Sum_of_Phases__c,
                    q.Name
             From QuotePhase__c q
             Where q.RelatedQuoteID__c =: selectedQuote.id
             ORDER BY q.Name ASC
             limit 1000
                ];

    }
}


And here Code Snippets out of my Visualforce:

<apex:page standardController="Quote" renderas="pdf" showHeader="false" extensions="ExtensionControllerQuote">

 

.... Blah blah ..... there comes the repeat:

 

<apex:repeat value="{!QuotePhaseSorted}" var="phase">
{QuotePhase_Name}
    <apex:repeat value="{!QuoteLineItemsSorted}" var="line">
       {!line.Quantity}
    </apex:repeat>
</apex:repeat>

 

</apex:page>

 

If needed i can post the whole Visualforce code here. But i guess i made an obvious error somewhere which is maybe easy to find for those who are more skilled than me. Please teach me what i do wrong here.

 

Hello,

 

i am experiencing Problems again, as line-height  don't work in my Visualforce Page which is rendered as PDF.

Do some of you had this Problem also? And how did you solve it?I tried with static resources CSS also but with no success :(

 

Here is my Page:

 

<apex:page standardController="Quote" renderas="pdf" showHeader="false" extensions="ExtensionControllerQuote">
<head>
<style>           
@page {
   font-family    : Verdana,Sans-serif;   
   font-size      : 9px;
   margin-top     : 1.9cm;
   margin-bottom  : 1.6cm;
   margin-left    : 2.2cm;
   margin-right   : 0.7cm;
   }

.OrgAdress {
   font-family    : Verdana,Sans-serif;   
   font-size      : 5pt;
   }

.OrgInfo {
   font-family    : Verdana,Sans-serif;   
   font-size      : 7pt;
   line-height    : 10%;
   }
     
.AccAdress {
   font-family    : Verdana,Sans-serif;   
   font-size      : 10pt;
   }

.Text {
   font-family    : Verdana,Sans-serif;   
   font-size      : 9pt;
   }
   
.Headlines {
   font-family    : Verdana,Sans-serif;   
   font-size      : 9pt;
   line-height    : 9pt;
   font-weight    : bold;
   }
   
</style>
</head>
<div style="page-break-after:always;">
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="Anschreiben">
<tr>
       <td ALIGN="left" VALIGN="top">
            <img src='{!URLFOR($Resource.Logo_quote)}' width="3.0cm" height="0.59cm" title="logo" />
            <br/><br/><br/><br/><br/><br/>

            <apex:outputPanel styleClass="OrgAdress" style="white-space:pre;">
            {!$Organization.Name}      {!$Organization.Street}      {!$Organization.PostalCode} {!$Organization.City}      {!$Organization.Country}
            <br/>
            </apex:outputPanel>

            <apex:outputPanel styleClass="AccAdress">
            {!Quote.Opportunity.Account.Name} <br/>
            {!Quote.Opportunity.Account.BillingStreet} <br/>
            {!Quote.Opportunity.Account.BillingPostalCode} {!Quote.Opportunity.Account.BillingCity}<br/>
            {!Quote.Opportunity.Account.BillingCountry} <br/>
            </apex:outputPanel>
      </td>
      <td ALIGN="left" VALIGN="top" height="300px" width="200px">
            <apex:outputPanel styleClass="OrgInfo">
            {!$Organization.Name}<br/>
            <br/>
            {!$Organization.Street}<br/>
            {!$Organization.PostalCode} {!$Organization.City}<br/>
            {!$Organization.Country}<br/>
            <br/>
            Phone {!$Organization.Phone}<br/>
            Fax {!$Organization.Fax}<br/>
            <br/>
            <br/>"
            </apex:outputPanel>
      </td>
</tr>
<tr>
       <td ALIGN="left" VALIGN="top">
            <apex:outputPanel styleClass="Headlines">
            <apex:OutputField value="{!Quote.Subject__c}"/>
            </apex:outputPanel>
            <apex:outputPanel styleClass="Text">
            <br/><br/>
            <apex:OutputField value="{!Quote.Covering_Letter_Text__c}"/>
            </apex:outputPanel></td>
       <td ALIGN="left" VALIGN="top"></td>
</tr>
<tr>
       <td ALIGN="left" VALIGN="top"></td>
       <td ALIGN="left" VALIGN="top"></td>
</tr>
</table>
</div>

<div style="page-break-after:always;">
<apex:outputPanel styleClass="Text">

<img src='{!URLFOR($Resource.Logo_quote)}' width="3.0cm" height="0.59cm" title="logo" /><br/><br/>
<p><strong>Angebot</strong></p>
<br/>
<table border="0" cellspacing="0" cellpadding="0" width="585px" id="tableproductsheadline">
<tr>
       <td ALIGN="left" VALIGN="top" width="35px"><strong>Pos.</strong></td>
       <td ALIGN="right" VALIGN="top" width="30px"><strong>Anz.</strong></td>
       <td ALIGN="right" VALIGN="top" width="10px"></td>
       <td ALIGN="left" VALIGN="top" width="50px"><strong>Einheit</strong></td>
       <td ALIGN="left" VALIGN="top" width="280px"><strong>Beschreibung</strong></td>
       <td ALIGN="right" VALIGN="top" width="90px"><strong>Einzelpreis</strong></td>
       <td ALIGN="right" VALIGN="top" width="90px"><strong>Gesamtpreis</strong></td>
</tr>
</table>


<apex:variable value="{!1}" var="rowNum"/>
<apex:repeat value="{!QuoteLineItemsSorted}" var="line">
       <apex:outputtext rendered="{!IF(line.New_Section_Headline__c='','false','true')}">
       <br/>
       <strong>{!line.New_Section_Headline__c}</strong>
       </apex:outputText>
        <table border="0" cellspacing="0" cellpadding="0" width="585px" id="tableproducts">
          <tr>
             <td ALIGN="left" VALIGN="top" width="35px"> <p><strong><apex:outputText value="{!FLOOR(rowNum)}"/><apex:variable var="rowNum" value="{!rowNum + 1}"/></strong></p></td>
             <td ALIGN="right" VALIGN="top" width="30px"><p>{!line.Quantity}</p></td>
             <td ALIGN="right" VALIGN="top" width="10px"></td>
             <td ALIGN="left" VALIGN="top" width="50px"> <p>{!line.Einheit__c}</p></td>             
             <td ALIGN="left" VALIGN="top" width="280px"> <p><strong>{!line.PricebookEntry.Name}</strong><br/><br/>
                                                          {!line.Product_lineitem_description__c}</p></td>
             <td ALIGN="right" VALIGN="top" width="90px"><p><apex:OutputField value="{!line.UnitPrice}"/></p></td>
             <td ALIGN="right" VALIGN="top" width="90px"><p><apex:OutputField value="{!line.TotalPrice}"/></p></td>
          </tr>
 </table>
</apex:repeat>

</apex:outputPanel>
</div>

</apex:page>

Hello,

 

i'm having fun playing around with visualforce (which is still new for me) at the moment, so i try out a few things. In the last days i gathered experience with a custom Quote Module and PDF generation, which is generated based on the Opportunity itself.

 

Today i started to build a custom Visualforce page to override the Template Editor Page, which ist kind of Stoneage.

I get stucked, because i can't find how i repeat the line Items.

 

For example: <apex:OutputField value="{!line.UnitPrice}"/> 

this did work for the Opportunity. how do i have to adress this field with a quote standart controller?

<apex:OutputField value="{!Quote.line.UnitPrice}"/> for example don't work.

 

Can anyone help me? Didn't find any resources to solve this on my own.

 

Here is my page so far (no big content, because i want to fix my Pain-points first )

 

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

<head>
<style>           
@page {
   font-family:Arial,Sans-serif;   
   font-size:9px;
   margin-top:1.9cm;
   margin-bottom:1.6cm;
   margin-left:2.2cm;
   margin-right:0.7cm;
   }

.OrgAdress {
   font-family:Arial,Sans-serif;   
   font-size:6pt;
   }
     
.AccAdress {
   font-family:Arial,Sans-serif;   
   font-size:10pt;
   }
</style>
</head>

<img src='{!URLFOR($Resource.YOUR_SL_Logo_quote)}' title="logo" />
<br/><br/><br/><br/><br/>

<apex:outputPanel styleClass="OrgAdress">
{!$Organization.Name}    {!$Organization.Street}    {!$Organization.PostalCode}    {!$Organization.City}    {!$Organization.Country}
<br/>
</apex:outputPanel>

<apex:outputPanel styleClass="AccAdress">
{!Quote.Opportunity.Account.Name} <br/>
{!Quote.Opportunity.Account.BillingStreet} <br/>
{!Quote.Opportunity.Account.BillingPostalCode} {!Quote.Opportunity.Account.BillingCity}<br/>
{!Quote.Opportunity.Account.BillingCountry} <br/>
</apex:outputPanel>

<apex:repeat var="line">
 <table border="0" cellspacing="0" cellpadding="0" width="100%" id="tableproducts">
  <tr>
   <tr>
    <td ALIGN="right" VALIGN="top" width="90px"><p><apex:OutputField value="{!line.UnitPrice}"/></p></td>
   </tr>
  </tr>
 </table>
</apex:repeat>
</apex:page>

First of all, Hello Developer Community 

 

I am new here, and to be honest, i need help. I am working with salesforce since almost two years and i am now getting more interested into visualforce. I know this is Apex Code Development, but i think you are the ones how may can help me (If the admins think i am wrong here, feel free to move this topic).

 

So here my Problem:

 

I tested the new Quotes Module, but i am not satisfied with the editor for the PDF Layout. I take a look and found this:

http://appexchange.salesforce.com/listingDetail?listingId=a0N300000017lEqEAI

I don't have Problems with customizing the Page layout, but i noticed that all Opp Line items are not inserted in the Visualforce page like they are sorted in the Opportunity (seems to be sorted by Product Name, alphabetically).

 

What i read so far is that i need a custom controller or maybe just an extension to control the sort order. I created a Custom field for Quote Product Position (Sort_order) which should be the master for sorting the line items.

 

After i tested and played around with all the Code-Examples i found in the web, nothing worked out for me. Now, after almost a week i decided to ask you for a hint, or an example which is almost (or exactly :D ) what i need. I forgot to mention i have almost no programming skills :(

 

Maybe there is also a way to use the sort order of the opportunity itself, that would be the best way, but what i read so far, this is not possible.

 

Here is my Visualforce Page, so you can see my apex:repeat element with all the fields:

 

<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.YOUR_SL_Logo_quote)}' title="logo" />
    </td>
    <td  align="right"><font face="Arial" >
    <b>Quote  for {!Opportunity.Account.Name}</b></font><br/>
    </td>
    
    
</tr>

<hr/>

</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>    <td><font face="Arial" >
        {!$Organization.Name}<br/>
        {!$Organization.Street}<br/>
        {!$Organization.PostalCode} {!$Organization.City}<br/>
        {!$Organization.Country}<br/>
        </font></td> 
        <td width="60%">&nbsp;</td>
   <td ><font face="Arial">Quote number: {!Opportunity.QuoteNumber__c}
   {!Opportunity.QuoteVersion__c}<br/>
        <br/>
        Offer valid Through:&nbsp;<apex:OutputField value="{!Opportunity.CloseDate}"/><br/>    
        Proposed by: {!Opportunity.Owner.LastName} {!Opportunity.Owner.FirstName}</font>
     </td>
</tr>
</table>
<br/>
<hr/>
<p><b><font face="Arial" color="#000080">Address Information</font></b></p>

<table border="0" width="100%" id="table2">
<tr>
       <td colspan="3">
           <font face="Arial">Account name: {!Opportunity.Account.Name} <br/><br/></font>
       </td>
</tr>
<tr>
       <td>          
           <font face="Arial">Bill To:<br/>
                             {!Opportunity.Account.BillingStreet}<br/>
                             {!Opportunity.Account.BillingPostalCode} {!Opportunity.Account.BillingCity}
           </font>
      </td>
        <td width="50%"></td>
        <td >
           <font face="Arial">Ship To:<br/>
                              {!Opportunity.Account.ShippingStreet}<br/>
                              {!Opportunity.Account.ShippingPostalCode} {!Opportunity.Account.ShippingCity}
           </font>
        </td>
</tr>    
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Products</font></b></p>
<p>&nbsp;</p>
<table border="0" width="100%" id="table4">
<tr>
       <td ALIGN="left" VALIGN="top"><font face="Arial"><strong>Pos.</strong></font></td>
       <td ALIGN="right" VALIGN="top"><font face="Arial"><strong>Anz.</strong></font></td>
       <td ALIGN="left" VALIGN="top"><font face="Arial"><strong>Einheit</strong></font></td>
       <td ALIGN="left" VALIGN="top"><font face="Arial"><strong>Beschreibung</strong></font></td>
       <td ALIGN="right" VALIGN="top"><font face="Arial"><strong>Einzelpreis</strong></font></td>
       <td ALIGN="right" VALIGN="top"><font face="Arial"><strong>Gesamtpreis</strong></font></td>
</tr>

<tr>
       
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td ALIGN="left" VALIGN="top"><strong>{!line.New_Section_on_quote__c}</strong></td>
          </tr> 
          <tr>
             <td ALIGN="left" VALIGN="top"> <p><strong>{!line.Sort_Order__c}</strong></p></td>
             <td ALIGN="right" VALIGN="top"><p>{!line.Quantity}</p></td>
             <td ALIGN="left" VALIGN="top"> <p>{!line.Einheit__c}</p></td>             
             <td ALIGN="left" VALIGN="top"> <p><strong>{!line.PricebookEntry.Name}</strong></p>
                                            <p>{!line.Product_lineitem_description__c}</p></td>
             <td ALIGN="right" VALIGN="top"><p><apex:OutputField value="{!line.UnitPrice}"/></p></td>
             <td ALIGN="right" VALIGN="top"><p><apex:OutputField value="{!line.TotalPrice}"/></p></td>
          </tr>
       </apex:repeat>  
</tr>

<tr>
       <td align="right" colspan="6">
       <font face="Arial"><b>Summe:</b>&nbsp;<apex:OutputField value="{!Opportunity.Amount}"/></font></td>
</tr>
</table>
<br/>
<hr/>
<p><b><font color="#000080" 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.QuoteBeginDate__c}"/><br/>
              Contract End date:&nbsp;<apex:OutputField value="{!Opportunity.QuoteEndDate__c}"/><br/>
            </font>
        </td>
        <td width="50%"></td>
        <td><font face="Arial">
              Payment Method:<apex:OutputField value="{!Opportunity.QuotePaymentMode__c}"/><br/>
              Payment Terms: <apex:OutputField value="{!Opportunity.QuotePaymentTime__c}"/><br/>
              Billing Frequency: <apex:OutputField value="{!Opportunity.QuoteBillingFrequency__c}"/><br/>
            </font>
       </td>
</tr>
</table>
<br/>
<p><font face="Arial">{!Opportunity.Conditions__c}</font></p>
<br/>
<hr/>
<table width="100%" id="table5">
<tr>
   <td width="50%"><b>{!$Organization.Name}</b></td>
   <td width="50%"><b>{!Opportunity.Account.Name}</b></td>
</tr>
<tr>
   <td width="50%">&nbsp;</td>
   <td width="50%">&nbsp;</td>
</tr>
<tr>
   <td width="50%">Signature<hr color="black" size="1"/></td>
   <td width="50%">Signature<hr color="black" size="1"/></td>
</tr>
<tr>
   <td width="50%">Name<hr color="black" size="1"/></td>
   <td width="50%">Name<hr color="black" size="1"/></td>
</tr>
<tr>
   <td width="50%">Title<hr color="black" size="1"/></td>
   <td width="50%">Title<hr color="black" size="1"/></td>
</tr>
<tr>
   <td width="50%">Date<hr color="black" size="1"/></td>
   <td width="50%">Date<hr color="black" size="1"/></td>
</tr>
</table>
<p>&nbsp;</p>
<hr/>
<p align="center"><font face="Arial"><i>Copyright {!$Organization.Name}.</i></font></p>
</apex:page>

 

 

 

Hello everybody, maybe someone can help me? I stuck again with my Extension Controller / maybe with my visualforce Page too. 

I am training myself in a Developer-Edition, to understand Controllers and Visiualforce more.

 

I builded a Visualforce Page which is the Template for the Salesforce Quote Template (rendered as PDF)

My Quote line Items are sorted by a line Item Field maually by the user. All this worked out well.

 

Now i wanted push this more forward. My Goal is to sort the line items in groups so i can give out a price for every group.

 

For Example:

Group 1         Group Total Value 60 €             

#1   Line item a   10€

#2   Line item b   20€

#3   Line item c   30€

 

Group 2         Group Total Value 180 €

#4   Line item d   50€

#5   Line item e   60€

#6   Line item f    70€

 

.... and so on

 

What i did:

There is a custom Object called "QuotePhase" where Quote is the Master Object.

I have a Lookup field on the QuoteLineItems so i can reference them to the different Phases/Groups

- also set up a lookup-filter to make sure a user can only select a Phase that belongs to the quote which is the master of the Phase

- and a apex trigger which calculates values of all related Items related to the Phase (rollup is not available for lookups :-/ )

 

So here i stuck: i don't get the list to work proberbly.

I think its maybe a little detail on my controller or my List call on the visualforce. But all my try and error approaches brought me to results here.

 

Here is my Controller Extension:

public with sharing class ExtensionControllerQuote {

    public List<QuoteLineItem> QuoteLineItemsSorted {public get; private set;}
    public List<QuotePhase__c> QuotePhaseSorted {public get; private set;}
    Quote selectedQuote = new Quote();
    
    // constructor
    public ExtensionControllerQuote(ApexPages.StandardController cont)
    {
        selectedQuote = (Quote)cont.getRecord();
        QuoteLineItemsSorted = new List<QuoteLineItem>();
        QuoteLineItemsSorted =
            [Select o.New_Section_Headline__c,
                    o.Sort_Order__c,
                    o.Quantity,
                    o.Einheit__c,
                    o.PricebookEntry.Name,
                    o.PricebookEntryId,
                    o.Product_lineitem_description__c,
                    o.UnitPrice,
                    o.TotalPrice
             From QuoteLineItem o
             Where o.QuoteId =: selectedQuote.id
             ORDER BY Sort_Order__c ASC
             limit 1000
                ];
        selectedQuote = (Quote)cont.getRecord();
        QuotePhaseSorted = new List<QuotePhase__c>();
        QuotePhaseSorted =
            [Select q.Sum_of_Phases__c,
                    q.Name
             From QuotePhase__c q
             Where q.RelatedQuoteID__c =: selectedQuote.id
             ORDER BY q.Name ASC
             limit 1000
                ];

    }
}


And here Code Snippets out of my Visualforce:

<apex:page standardController="Quote" renderas="pdf" showHeader="false" extensions="ExtensionControllerQuote">

 

.... Blah blah ..... there comes the repeat:

 

<apex:repeat value="{!QuotePhaseSorted}" var="phase">
{QuotePhase_Name}
    <apex:repeat value="{!QuoteLineItemsSorted}" var="line">
       {!line.Quantity}
    </apex:repeat>
</apex:repeat>

 

</apex:page>

 

If needed i can post the whole Visualforce code here. But i guess i made an obvious error somewhere which is maybe easy to find for those who are more skilled than me. Please teach me what i do wrong here.

 

Hello everyone!!!

 

        I am new to visualforce.  I want to pass id to page. But I am unable to find my account id.

Can anyone tell me how to find it.

 

Thanks & Regards

Phaniraj N

Hello,

 

i am experiencing Problems again, as line-height  don't work in my Visualforce Page which is rendered as PDF.

Do some of you had this Problem also? And how did you solve it?I tried with static resources CSS also but with no success :(

 

Here is my Page:

 

<apex:page standardController="Quote" renderas="pdf" showHeader="false" extensions="ExtensionControllerQuote">
<head>
<style>           
@page {
   font-family    : Verdana,Sans-serif;   
   font-size      : 9px;
   margin-top     : 1.9cm;
   margin-bottom  : 1.6cm;
   margin-left    : 2.2cm;
   margin-right   : 0.7cm;
   }

.OrgAdress {
   font-family    : Verdana,Sans-serif;   
   font-size      : 5pt;
   }

.OrgInfo {
   font-family    : Verdana,Sans-serif;   
   font-size      : 7pt;
   line-height    : 10%;
   }
     
.AccAdress {
   font-family    : Verdana,Sans-serif;   
   font-size      : 10pt;
   }

.Text {
   font-family    : Verdana,Sans-serif;   
   font-size      : 9pt;
   }
   
.Headlines {
   font-family    : Verdana,Sans-serif;   
   font-size      : 9pt;
   line-height    : 9pt;
   font-weight    : bold;
   }
   
</style>
</head>
<div style="page-break-after:always;">
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="Anschreiben">
<tr>
       <td ALIGN="left" VALIGN="top">
            <img src='{!URLFOR($Resource.Logo_quote)}' width="3.0cm" height="0.59cm" title="logo" />
            <br/><br/><br/><br/><br/><br/>

            <apex:outputPanel styleClass="OrgAdress" style="white-space:pre;">
            {!$Organization.Name}      {!$Organization.Street}      {!$Organization.PostalCode} {!$Organization.City}      {!$Organization.Country}
            <br/>
            </apex:outputPanel>

            <apex:outputPanel styleClass="AccAdress">
            {!Quote.Opportunity.Account.Name} <br/>
            {!Quote.Opportunity.Account.BillingStreet} <br/>
            {!Quote.Opportunity.Account.BillingPostalCode} {!Quote.Opportunity.Account.BillingCity}<br/>
            {!Quote.Opportunity.Account.BillingCountry} <br/>
            </apex:outputPanel>
      </td>
      <td ALIGN="left" VALIGN="top" height="300px" width="200px">
            <apex:outputPanel styleClass="OrgInfo">
            {!$Organization.Name}<br/>
            <br/>
            {!$Organization.Street}<br/>
            {!$Organization.PostalCode} {!$Organization.City}<br/>
            {!$Organization.Country}<br/>
            <br/>
            Phone {!$Organization.Phone}<br/>
            Fax {!$Organization.Fax}<br/>
            <br/>
            <br/>"
            </apex:outputPanel>
      </td>
</tr>
<tr>
       <td ALIGN="left" VALIGN="top">
            <apex:outputPanel styleClass="Headlines">
            <apex:OutputField value="{!Quote.Subject__c}"/>
            </apex:outputPanel>
            <apex:outputPanel styleClass="Text">
            <br/><br/>
            <apex:OutputField value="{!Quote.Covering_Letter_Text__c}"/>
            </apex:outputPanel></td>
       <td ALIGN="left" VALIGN="top"></td>
</tr>
<tr>
       <td ALIGN="left" VALIGN="top"></td>
       <td ALIGN="left" VALIGN="top"></td>
</tr>
</table>
</div>

<div style="page-break-after:always;">
<apex:outputPanel styleClass="Text">

<img src='{!URLFOR($Resource.Logo_quote)}' width="3.0cm" height="0.59cm" title="logo" /><br/><br/>
<p><strong>Angebot</strong></p>
<br/>
<table border="0" cellspacing="0" cellpadding="0" width="585px" id="tableproductsheadline">
<tr>
       <td ALIGN="left" VALIGN="top" width="35px"><strong>Pos.</strong></td>
       <td ALIGN="right" VALIGN="top" width="30px"><strong>Anz.</strong></td>
       <td ALIGN="right" VALIGN="top" width="10px"></td>
       <td ALIGN="left" VALIGN="top" width="50px"><strong>Einheit</strong></td>
       <td ALIGN="left" VALIGN="top" width="280px"><strong>Beschreibung</strong></td>
       <td ALIGN="right" VALIGN="top" width="90px"><strong>Einzelpreis</strong></td>
       <td ALIGN="right" VALIGN="top" width="90px"><strong>Gesamtpreis</strong></td>
</tr>
</table>


<apex:variable value="{!1}" var="rowNum"/>
<apex:repeat value="{!QuoteLineItemsSorted}" var="line">
       <apex:outputtext rendered="{!IF(line.New_Section_Headline__c='','false','true')}">
       <br/>
       <strong>{!line.New_Section_Headline__c}</strong>
       </apex:outputText>
        <table border="0" cellspacing="0" cellpadding="0" width="585px" id="tableproducts">
          <tr>
             <td ALIGN="left" VALIGN="top" width="35px"> <p><strong><apex:outputText value="{!FLOOR(rowNum)}"/><apex:variable var="rowNum" value="{!rowNum + 1}"/></strong></p></td>
             <td ALIGN="right" VALIGN="top" width="30px"><p>{!line.Quantity}</p></td>
             <td ALIGN="right" VALIGN="top" width="10px"></td>
             <td ALIGN="left" VALIGN="top" width="50px"> <p>{!line.Einheit__c}</p></td>             
             <td ALIGN="left" VALIGN="top" width="280px"> <p><strong>{!line.PricebookEntry.Name}</strong><br/><br/>
                                                          {!line.Product_lineitem_description__c}</p></td>
             <td ALIGN="right" VALIGN="top" width="90px"><p><apex:OutputField value="{!line.UnitPrice}"/></p></td>
             <td ALIGN="right" VALIGN="top" width="90px"><p><apex:OutputField value="{!line.TotalPrice}"/></p></td>
          </tr>
 </table>
</apex:repeat>

</apex:outputPanel>
</div>

</apex:page>

Hello,

 

i'm having fun playing around with visualforce (which is still new for me) at the moment, so i try out a few things. In the last days i gathered experience with a custom Quote Module and PDF generation, which is generated based on the Opportunity itself.

 

Today i started to build a custom Visualforce page to override the Template Editor Page, which ist kind of Stoneage.

I get stucked, because i can't find how i repeat the line Items.

 

For example: <apex:OutputField value="{!line.UnitPrice}"/> 

this did work for the Opportunity. how do i have to adress this field with a quote standart controller?

<apex:OutputField value="{!Quote.line.UnitPrice}"/> for example don't work.

 

Can anyone help me? Didn't find any resources to solve this on my own.

 

Here is my page so far (no big content, because i want to fix my Pain-points first )

 

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

<head>
<style>           
@page {
   font-family:Arial,Sans-serif;   
   font-size:9px;
   margin-top:1.9cm;
   margin-bottom:1.6cm;
   margin-left:2.2cm;
   margin-right:0.7cm;
   }

.OrgAdress {
   font-family:Arial,Sans-serif;   
   font-size:6pt;
   }
     
.AccAdress {
   font-family:Arial,Sans-serif;   
   font-size:10pt;
   }
</style>
</head>

<img src='{!URLFOR($Resource.YOUR_SL_Logo_quote)}' title="logo" />
<br/><br/><br/><br/><br/>

<apex:outputPanel styleClass="OrgAdress">
{!$Organization.Name}    {!$Organization.Street}    {!$Organization.PostalCode}    {!$Organization.City}    {!$Organization.Country}
<br/>
</apex:outputPanel>

<apex:outputPanel styleClass="AccAdress">
{!Quote.Opportunity.Account.Name} <br/>
{!Quote.Opportunity.Account.BillingStreet} <br/>
{!Quote.Opportunity.Account.BillingPostalCode} {!Quote.Opportunity.Account.BillingCity}<br/>
{!Quote.Opportunity.Account.BillingCountry} <br/>
</apex:outputPanel>

<apex:repeat var="line">
 <table border="0" cellspacing="0" cellpadding="0" width="100%" id="tableproducts">
  <tr>
   <tr>
    <td ALIGN="right" VALIGN="top" width="90px"><p><apex:OutputField value="{!line.UnitPrice}"/></p></td>
   </tr>
  </tr>
 </table>
</apex:repeat>
</apex:page>

First of all, Hello Developer Community 

 

I am new here, and to be honest, i need help. I am working with salesforce since almost two years and i am now getting more interested into visualforce. I know this is Apex Code Development, but i think you are the ones how may can help me (If the admins think i am wrong here, feel free to move this topic).

 

So here my Problem:

 

I tested the new Quotes Module, but i am not satisfied with the editor for the PDF Layout. I take a look and found this:

http://appexchange.salesforce.com/listingDetail?listingId=a0N300000017lEqEAI

I don't have Problems with customizing the Page layout, but i noticed that all Opp Line items are not inserted in the Visualforce page like they are sorted in the Opportunity (seems to be sorted by Product Name, alphabetically).

 

What i read so far is that i need a custom controller or maybe just an extension to control the sort order. I created a Custom field for Quote Product Position (Sort_order) which should be the master for sorting the line items.

 

After i tested and played around with all the Code-Examples i found in the web, nothing worked out for me. Now, after almost a week i decided to ask you for a hint, or an example which is almost (or exactly :D ) what i need. I forgot to mention i have almost no programming skills :(

 

Maybe there is also a way to use the sort order of the opportunity itself, that would be the best way, but what i read so far, this is not possible.

 

Here is my Visualforce Page, so you can see my apex:repeat element with all the fields:

 

<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.YOUR_SL_Logo_quote)}' title="logo" />
    </td>
    <td  align="right"><font face="Arial" >
    <b>Quote  for {!Opportunity.Account.Name}</b></font><br/>
    </td>
    
    
</tr>

<hr/>

</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>    <td><font face="Arial" >
        {!$Organization.Name}<br/>
        {!$Organization.Street}<br/>
        {!$Organization.PostalCode} {!$Organization.City}<br/>
        {!$Organization.Country}<br/>
        </font></td> 
        <td width="60%">&nbsp;</td>
   <td ><font face="Arial">Quote number: {!Opportunity.QuoteNumber__c}
   {!Opportunity.QuoteVersion__c}<br/>
        <br/>
        Offer valid Through:&nbsp;<apex:OutputField value="{!Opportunity.CloseDate}"/><br/>    
        Proposed by: {!Opportunity.Owner.LastName} {!Opportunity.Owner.FirstName}</font>
     </td>
</tr>
</table>
<br/>
<hr/>
<p><b><font face="Arial" color="#000080">Address Information</font></b></p>

<table border="0" width="100%" id="table2">
<tr>
       <td colspan="3">
           <font face="Arial">Account name: {!Opportunity.Account.Name} <br/><br/></font>
       </td>
</tr>
<tr>
       <td>          
           <font face="Arial">Bill To:<br/>
                             {!Opportunity.Account.BillingStreet}<br/>
                             {!Opportunity.Account.BillingPostalCode} {!Opportunity.Account.BillingCity}
           </font>
      </td>
        <td width="50%"></td>
        <td >
           <font face="Arial">Ship To:<br/>
                              {!Opportunity.Account.ShippingStreet}<br/>
                              {!Opportunity.Account.ShippingPostalCode} {!Opportunity.Account.ShippingCity}
           </font>
        </td>
</tr>    
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Products</font></b></p>
<p>&nbsp;</p>
<table border="0" width="100%" id="table4">
<tr>
       <td ALIGN="left" VALIGN="top"><font face="Arial"><strong>Pos.</strong></font></td>
       <td ALIGN="right" VALIGN="top"><font face="Arial"><strong>Anz.</strong></font></td>
       <td ALIGN="left" VALIGN="top"><font face="Arial"><strong>Einheit</strong></font></td>
       <td ALIGN="left" VALIGN="top"><font face="Arial"><strong>Beschreibung</strong></font></td>
       <td ALIGN="right" VALIGN="top"><font face="Arial"><strong>Einzelpreis</strong></font></td>
       <td ALIGN="right" VALIGN="top"><font face="Arial"><strong>Gesamtpreis</strong></font></td>
</tr>

<tr>
       
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td ALIGN="left" VALIGN="top"><strong>{!line.New_Section_on_quote__c}</strong></td>
          </tr> 
          <tr>
             <td ALIGN="left" VALIGN="top"> <p><strong>{!line.Sort_Order__c}</strong></p></td>
             <td ALIGN="right" VALIGN="top"><p>{!line.Quantity}</p></td>
             <td ALIGN="left" VALIGN="top"> <p>{!line.Einheit__c}</p></td>             
             <td ALIGN="left" VALIGN="top"> <p><strong>{!line.PricebookEntry.Name}</strong></p>
                                            <p>{!line.Product_lineitem_description__c}</p></td>
             <td ALIGN="right" VALIGN="top"><p><apex:OutputField value="{!line.UnitPrice}"/></p></td>
             <td ALIGN="right" VALIGN="top"><p><apex:OutputField value="{!line.TotalPrice}"/></p></td>
          </tr>
       </apex:repeat>  
</tr>

<tr>
       <td align="right" colspan="6">
       <font face="Arial"><b>Summe:</b>&nbsp;<apex:OutputField value="{!Opportunity.Amount}"/></font></td>
</tr>
</table>
<br/>
<hr/>
<p><b><font color="#000080" 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.QuoteBeginDate__c}"/><br/>
              Contract End date:&nbsp;<apex:OutputField value="{!Opportunity.QuoteEndDate__c}"/><br/>
            </font>
        </td>
        <td width="50%"></td>
        <td><font face="Arial">
              Payment Method:<apex:OutputField value="{!Opportunity.QuotePaymentMode__c}"/><br/>
              Payment Terms: <apex:OutputField value="{!Opportunity.QuotePaymentTime__c}"/><br/>
              Billing Frequency: <apex:OutputField value="{!Opportunity.QuoteBillingFrequency__c}"/><br/>
            </font>
       </td>
</tr>
</table>
<br/>
<p><font face="Arial">{!Opportunity.Conditions__c}</font></p>
<br/>
<hr/>
<table width="100%" id="table5">
<tr>
   <td width="50%"><b>{!$Organization.Name}</b></td>
   <td width="50%"><b>{!Opportunity.Account.Name}</b></td>
</tr>
<tr>
   <td width="50%">&nbsp;</td>
   <td width="50%">&nbsp;</td>
</tr>
<tr>
   <td width="50%">Signature<hr color="black" size="1"/></td>
   <td width="50%">Signature<hr color="black" size="1"/></td>
</tr>
<tr>
   <td width="50%">Name<hr color="black" size="1"/></td>
   <td width="50%">Name<hr color="black" size="1"/></td>
</tr>
<tr>
   <td width="50%">Title<hr color="black" size="1"/></td>
   <td width="50%">Title<hr color="black" size="1"/></td>
</tr>
<tr>
   <td width="50%">Date<hr color="black" size="1"/></td>
   <td width="50%">Date<hr color="black" size="1"/></td>
</tr>
</table>
<p>&nbsp;</p>
<hr/>
<p align="center"><font face="Arial"><i>Copyright {!$Organization.Name}.</i></font></p>
</apex:page>