• Daniel Khan 21
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

Hi all,

I've done some APEX based on an idea of Deepak Anand (https://success.salesforce.com/answers?id=90630000000hTXHAA2).

Actually everything works, but on the generated .pdf the name of the Opportunity is shown in the line of the product nameHow to remove opp name in product name line?.

I only want to have the name of the product. What am I missing?  THANKS FOR ANY ADVICE!

My APEX Class:

public class OpptyGenPDFExtension {

    public List<OpportunityLineItem > OLI {get; set;}
    
        public OpptyGenPDFExtension(ApexPages.StandardController controller) {
        String oliIDs = ApexPages.currentPage().getParameters().get('oliid');
          
           if(!String.isBlank(oliIDs)){
            Set<Id> oliIdSet = new Set<Id>();
            for(String oliId : oliIDs.split(',')){
                oliIdSet.add(oliId);
            }             
            OLI = 
                [
                  SELECT Name,ProductCode,Quantity FROM OpportunityLineItem 
                  WHERE
                        Id IN :oliIdSet ];               
}      
                                
                
        }
    }
 

My VF:

<apex:page standardController="Opportunity" extensions="OpptyGenPDFExtension" renderAs="pdf">
    <table width="100%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse;"
        cellpadding="5">
        <tr>
            <td colspan="4">
                Hardware Anforderungen für neues System
            </td>
            <td> Printed on: {!DAY(TODAY())}.{!MONTH(TODAY())}.{!YEAR(TODAY())}
            </td>
        </tr>
        <tr>
            <td colspan="4" style="font-size: x-large; font-weight: bold">
                Opportunity Name: {!Opportunity.Name}
            </td>
        </tr>
        <tr>
            <td align="left" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
            <td align="left" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Opportunity Number
            </td>
            <td style="font-weight: bold">
                {!Opportunity.Opportunity_Nummer__c}
            </td>
            
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Hardware configured by
            </td>
            <td style="font-weight: bold">
                {!Opportunity.System_konfiguriert_von__c}
            </td>
            
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Account Name
            </td>
            <td style="font-weight: bold">
                {!Opportunity.Account.Name}
            </td>
            
        </tr>
        
        
        
        <tr>
            <td colspan="4">
                &nbsp;
            </td>
        </tr>
        <tr>
           
        </tr>
        <tr>
            
            <td style="font-weight: bold">
                
            </td>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
        <tr>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
    </table>
    <br/><br/>
    
    
    <apex:outputPanel rendered="{!OLI != NULL}">
        <table width="100%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse;"
            cellpadding="5">
            <tr>
                <td colspan="6" style="font-weight: bold; border-bottom-style: solid; border-bottom-width: thick;
                    border-bottom-color: #ddb929;">
                    Line Item
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Product Name
                </td>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Product Code
                </td>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Quantity
                </td>
                
            </tr>
            <apex:repeat value="{!OLI}" var="opl">
                <tr id="{!opl.Id}">
                    <td>
                        {!opl.Name}
                    </td>
                    <td>
                        {!opl.ProductCode}
                    </td>
                 
                    <td>
                        {!opl.Quantity}
                    </td>                
                </tr>            
            </apex:repeat>
        </table>    
    </apex:outputPanel>
</apex:page>
PDF should contain Opportunity details and Opp-Products Line Items (Product, Product Code, Quantity).
There is already a similiar case which was solved by Deepak Anand, but as I have not much understanding of APEX Classes etc yet, please can someone help me? THANKS.
https://success.salesforce.com/answers?id=90630000000hTXHAA2

Hi all,

I've done some APEX based on an idea of Deepak Anand (https://success.salesforce.com/answers?id=90630000000hTXHAA2).

Actually everything works, but on the generated .pdf the name of the Opportunity is shown in the line of the product nameHow to remove opp name in product name line?.

I only want to have the name of the product. What am I missing?  THANKS FOR ANY ADVICE!

My APEX Class:

public class OpptyGenPDFExtension {

    public List<OpportunityLineItem > OLI {get; set;}
    
        public OpptyGenPDFExtension(ApexPages.StandardController controller) {
        String oliIDs = ApexPages.currentPage().getParameters().get('oliid');
          
           if(!String.isBlank(oliIDs)){
            Set<Id> oliIdSet = new Set<Id>();
            for(String oliId : oliIDs.split(',')){
                oliIdSet.add(oliId);
            }             
            OLI = 
                [
                  SELECT Name,ProductCode,Quantity FROM OpportunityLineItem 
                  WHERE
                        Id IN :oliIdSet ];               
}      
                                
                
        }
    }
 

My VF:

<apex:page standardController="Opportunity" extensions="OpptyGenPDFExtension" renderAs="pdf">
    <table width="100%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse;"
        cellpadding="5">
        <tr>
            <td colspan="4">
                Hardware Anforderungen für neues System
            </td>
            <td> Printed on: {!DAY(TODAY())}.{!MONTH(TODAY())}.{!YEAR(TODAY())}
            </td>
        </tr>
        <tr>
            <td colspan="4" style="font-size: x-large; font-weight: bold">
                Opportunity Name: {!Opportunity.Name}
            </td>
        </tr>
        <tr>
            <td align="left" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
            <td align="left" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Opportunity Number
            </td>
            <td style="font-weight: bold">
                {!Opportunity.Opportunity_Nummer__c}
            </td>
            
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Hardware configured by
            </td>
            <td style="font-weight: bold">
                {!Opportunity.System_konfiguriert_von__c}
            </td>
            
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Account Name
            </td>
            <td style="font-weight: bold">
                {!Opportunity.Account.Name}
            </td>
            
        </tr>
        
        
        
        <tr>
            <td colspan="4">
                &nbsp;
            </td>
        </tr>
        <tr>
           
        </tr>
        <tr>
            
            <td style="font-weight: bold">
                
            </td>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
        <tr>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
    </table>
    <br/><br/>
    
    
    <apex:outputPanel rendered="{!OLI != NULL}">
        <table width="100%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse;"
            cellpadding="5">
            <tr>
                <td colspan="6" style="font-weight: bold; border-bottom-style: solid; border-bottom-width: thick;
                    border-bottom-color: #ddb929;">
                    Line Item
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Product Name
                </td>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Product Code
                </td>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Quantity
                </td>
                
            </tr>
            <apex:repeat value="{!OLI}" var="opl">
                <tr id="{!opl.Id}">
                    <td>
                        {!opl.Name}
                    </td>
                    <td>
                        {!opl.ProductCode}
                    </td>
                 
                    <td>
                        {!opl.Quantity}
                    </td>                
                </tr>            
            </apex:repeat>
        </table>    
    </apex:outputPanel>
</apex:page>
PDF should contain Opportunity details and Opp-Products Line Items (Product, Product Code, Quantity).
There is already a similiar case which was solved by Deepak Anand, but as I have not much understanding of APEX Classes etc yet, please can someone help me? THANKS.
https://success.salesforce.com/answers?id=90630000000hTXHAA2

In Sweden and some other parts of Europe the week numbering is often using the ISO 8601 standard that says that the first week of the year is the first week with at least 4 days in the new year. Some consequences of this is that the final dates of one year can be week 52, 53 or even week 1( in the following year). The same goes for the first dates of a year.

 

To be able to do weekly comparison report Year-to-Year with this weeknumbering it is necessary to create custom fields for the opportunity that calculates the Year and Week number for a given close date. Here is one solution using three custom formula fields.

 

Field: Global Sales Report Weekday

Description:  Day 1 = Sunday, 2 = Monday....., 7=Saturday

Formula:  MOD( CloseDate  - DATE(1900, 1, 7), 7)+1

 

Field: Global Sales Report Week Year

Formula: YEAR(CloseDate + (MOD(8- Global_Sales_Report_Weekday__c ,7)-3))

 

Field: Global Sales Report Week

Formula:

FLOOR((CloseDate - DATE( Global_Sales_Report_Week_Year__c ,1,1) +
MOD(
(MOD( DATE(Global_Sales_Report_Week_Year__c,1,1) - DATE(1900, 1, 7), 7)+1)
+1,7)-3) / 7 + 1)

 

Hope this can be of use for anyone else

 

Peter Baeza

InfoAction AB, Sweden

 

  • March 15, 2010
  • Like
  • 3