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
lizmijohnlizmijohn 

Visual force for list button

Hi,

 

I have designed a VF page and placed a list button (Generate invoice) on Opportunity list view. On selecting required Opportunities from list & clicking on "Generate Invoice" button should display a VF page with Opportunity & Opportunity line item details.

 

Note: Placing the button on Detail page layout works fine. But I need this to be generated for more than 1 opportunity at a time using List button.

 

My VF code is as follows:

 

<apex:page standardController="Opportunity" showHeader="false" renderAs="pdf" standardstylesheets="false">
<head>
<style type="text/css">
body {font-family: "Arial" "Sans-Serif"; font-size:11px; }
@page {
@top-center {
content: element(header);
}
@bottom-center{
content: element(footer);
}
}

div.header {
padding: 5px;
position: static(header);
}
div.footer {

padding: 2px;
position: running(footer);
}


.pagenumber:before {
content: counter(page);
}
.pagecount:before {
content: counter(pages);
}
</style>
</head>

<div class="header">
<apex:image id="theImage" value="{!$Resource.AGT_Logo}" width="300" height="75"/>
</div>

<apex:form >
<h2 style="text-align:left;color:black;font-size:20px"> Salary Invoice Sales </h2>


<BR></BR>
<BR></BR>

<apex:pageBlock >

<apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" var="Oppdt" border="1" cellspacing="10" cellpadding="9" columnClasses="red,green,blue">
<apex:column headervalue="Contract"><apex:outputfield value="{!Oppdt.Contract_Ref_No__c}"/></apex:column>
<apex:column headervalue="Basket Type"><apex:outputfield value="{!Oppdt.PriceBookEntry.name}"/></apex:column>
<apex:column headervalue="Quantity"><apex:outputfield value="{!Oppdt.Quantity}"/></apex:column>
<apex:column headervalue="Cost Per Basket"><apex:outputfield value="{!Oppdt.UnitPrice}"/></apex:column>
<apex:column headervalue="Total"><apex:outputfield value="{!Oppdt.TotalPrice}"/></apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
<BR></BR>
<BR></BR>
<BR></BR>

</apex:form>
</apex:page>

 

Please help.

 

Thanks,

Liz