1

Can any one help me out with this Error on Vf page.Any help is very much appreciated.enter image description here

When i test in my Sandbox ,it just display the a/c name .Similarly when i check in Production for one of the record i do get the a/c name + another name .

Here is My VF page Code :

<apex:page standardController="Opportunity" renderAs="pdf" applyhtmltag="false" showHeader="false" applyBodyTag="false" extensions="InvoiceController">
<head>
    <style>

    @page {
        margin: 1px 50px 225px 50px; 
        size:A4;
        Padding-top:30px;

        @top-center { 
                content : element(header);
             }

        @bottom-center {
                content : element(footer);
                height:200px;
                padding-top:10px;
             }
    } 
    body { font-family: 'Arial Unicode MS'; }
    .companyName { font: bold 30px; color: red; }  
    table {width:100%; border-spacing:0; border-collapse:collapse; border-width: 1px; border-color:#C0C0C0;border-style:solid;} 
    .header-table-data { border-width: 1px; border-color:Black;border-style:solid;background-color:#FFFFFF;
                         color:Black; font-size:14px; font-family:Verdana;
                         text-align:center;}
    .header-table-heading {border-width: 1px; border-color:Black;border-style:solid;background-color:#C0C0C0; 
                           font-weight:bold;color:Black; font-size:14px; font-family:Verdana;
                           text-align:center;}
    .header-data { border-width: 0px; border-color:Black;border-style:solid;background-color:#FFFFFF;
                   color:Black; font-size:14px; font-family:Verdana;text-align:left; padding-right: 10px;}

    .header-heading {border-width: 0px; border-color:Black;border-style:solid; 
                     font-weight:bold;color:Black; font-size:14px; font-family:Verdana;
                     text-align:left;}
</style>

</head>
<body> 

 <table>
    <tr>
        <td><img style="WIDTH:25%; HEIGHT: 25%" src='{!URLFOR($Resource.Bridgelux_New_Logo)}' />
        </td>
    </tr>
    <br/>
    <tr>
        <td><b>Commercial Invoice</b>
        </td>
    </tr>
</table><br/>

<table cellspacing="0" cellpadding="0" width="100%" border="0" >
    <tr>
       <!--- <td border="0" bgcolor="Silver">Sold To</td>-->
        <td bgcolor="Silver">Ship To:</td>
        <td bgcolor="Silver">Ship From</td>
    </tr>
    <tr>
        <!--<td style="border-width: 0px; border-color:Black;border-style:solid;background-color:#FFFFFF;" align="left" width="10%">
            <f style="color:Black; font-size:12px; font-family:Verdana;">-->
                <!-- Code starts here ********************************************************* -->
                <!-- {!showaddressonVf} -->
                <!--<apex:outputText value="{!opportunity.account.Name}"></apex:outputText><br/>-->
                <!-- Added by Sumit -->
                <!--<apex:outputText value=" {!all}" escape="false"></apex:outputText>-->
                <!--     -----------   -->
                <!--<br />
            </f>
        </td> -->     
        <td style="border-width: 0px; border-color:Black;border-style:solid;background-color:#FFFFFF;" align="left" width="10%">
        <f style="color:Black; font-size:12px; font-family:Verdana;">
            <!-- Code starts here ********************************************************* -->
            <!-- Added below line by KiranmaiKosaraju. To show Ship To Account Name If diff from Account Name or else show Account Name -->
            <apex:outputText value="{!IF ((opportunity.Ship_To_Account_Name__c = NULL),  opportunity.account.Name,opportunity.Ship_To_Account_Name__c)}"></apex:outputText><br /> 
            <!--<apex:outputText value="{!opportunity.account.Name}"></apex:outputText><br /> -->
            <!-- Added by Sumit -->
            <apex:outputText value=" {!all}" escape="false"></apex:outputText>
            <!--     -----------   -->
            <br />  
        </f>
        </td>
        <td style="border-width: 0px; border-color:Black;border-style:solid;background-color:#FFFFFF;" align="left" width="10%">
        <f style="color:Black; font-size:12px; font-family:Verdana;">
            Bridgelux Inc. C/O JSI Logistics (HK) Ltd.<br/>
            16/F Tsuen Wan International Center,<br/>
            68 Wang Lung Street, Tsuen Wan,<br/>
            Hong Kong<br/>
            Tel: (852) 3761 7080<br/>
            Fax: (852) 2750 0721<br/>
        </f>
        <f style="color:Blue; font-size:12px; font-family:Tahoma;"> Email:Info@bridgelux.com</f>
        <f style="color:Blue; font-size:10px; font-family:Trebuchet MS;"><br/> </f>
        </td>
    </tr>
</table> 

 <table border="0" cellspacing="0" cellpadding="1" width="100%" >
    <tr>
         <td class="header-heading">
            Ship Date:
         </td>
         <td class="header-data">
            <apex:outputText value="{!opportunity.Sys_today_s_date__c}"></apex:outputText><br/>
         </td>
         <td class="header-heading">
            Special Instructions:
         </td>
         <td class="header-data">                
            <apex:outputText value="{!opportunity.Special_Instructions__c}"></apex:outputText>
         </td>
    </tr>
</table> 

<table>
    <tr border="0">
        <td class="header-table-heading">CI Invoice Id</td>
        <td class="header-table-heading">Ship Date<b/></td>
        <!---<td class="header-table-heading">Sales Order#</td>-->
        <td class="header-table-heading">Opportunity Name</td>
        <td class="header-table-heading">Order Date</td>
        <!--<td class="header-table-heading">Customer#</td>-->
        <td class="header-table-heading">Customer Name</td>

    </tr>
    <tr>
        <td class="header-table-data"><apex:outputText value="{!Opportunity.Salesorder_number__c}"></apex:outputText></td>
        <td class="header-table-data"><apex:outputText value="{!opportunity.Sys_today_s_date__c}"></apex:outputText></td>
        <!--<td class="header-table-data"><apex:outputText value="{!Opportunity.Salesorder_number__c}"></apex:outputText></td>-->
         <td class="header-table-data"><apex:outputText value="{!Opportunity.Name}"></apex:outputText></td>
         <td class="header-table-data"><apex:outputText value="{!Opportunity.Sys_createddate__c}"></apex:outputText></td>
         <td class="header-table-data"><apex:outputText value="{!opportunity.account.Name}"></apex:outputText></td>
        <!--<td class="header-table-data">{!Opportunity.account.Ebs_Customer_number__c}</td>-->
    </tr>
</table>
<br/>
<table >
    <tr>
        <td class="header-table-heading">LN</td>
        <td class="header-table-heading">Item</td>
        <td class="header-table-heading">Customer Item #<b/></td>
        <td class="header-table-heading">COO</td>
        <td class="header-table-heading">ECCN #</td>
        <td class="header-table-heading">UOM</td>
        <td class="header-table-heading">Unit Price</td>
        <td class="header-table-heading">Quantity</td>
        <td class="header-table-heading">Extension</td>
    </tr>
    <tr>
        <td class="header-table-heading"></td>
        <td colspan="8" style="text-align:left"  class="header-table-heading">Description</td>
    </tr>
    <apex:repeat value="{!appointmentList}" var="line">
    <apex:outputPanel layout="none" rendered="{!if(line.pick==true, true, false)}">

    <tr>         
        <td class="header-table-data"><apex:outputText value="{!line.LineNumber}"></apex:outputText></td>
        <td class="header-table-data"><apex:outputText value="{!line.productname}"></apex:outputText></td>
        <td class="header-table-data"></td>
        <td class="header-table-data"></td>
        <td class="header-table-data">8541.40.2000</td>
        <td class="header-table-data">EA</td>
        <td class="header-table-data">$1</td>
        <td class="header-table-data"><apex:outputtext value="{!line.quantity}"></apex:outputtext></td>
        <td class="header-table-data"><apex:outputText value="{!line.extension}"></apex:outputText></td>
    </tr>
    <tr>
        <td class="header-table-data"></td>

        <td colspan="8" style="text-align:left" class="header-table-data"><b>Scheduled Ship Date:</b>
                    <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                            <apex:param value="{!line.Scheduledshipdate}"/>
                    </apex:outputText> </td>
    </tr>
    </apex:outputPanel>    
    </apex:repeat>
</table>
<br/>
<table>
    <tr>
        <td class="header-table-heading">Gross Weight</td>
        <td class="header-table-heading">Net Weight</td>
        <td class="header-table-heading">Shipped Via</td>
        <td class="header-table-heading">Tracking #</td>
        <td class="header-table-heading">Payment Terms</td>
        <td class="header-table-heading">Incoterms </td>
        <td class="header-table-heading">Currency </td>
        <td rowspan="0" class="header-table-heading">Sub Total <br/>Shipping Charges</td>
        <td rowspan="0" class="header-table-data"><apex:outputText value="{!opportunity.Pick_Total__c}"></apex:outputText>
             <br/><apex:outputText value="{!Opportunity.Shipping_Charges__c}"></apex:outputText><br/></td>

    </tr>
    <apex:repeat value="{!appointmentList1}" var="line1">
    </apex:repeat>
    <tr>
        <td class="header-table-data"><apex:outputText value="{!Opportunity.Gross_Weight__c}"></apex:outputText></td>
        <td class="header-table-data"><apex:outputText value="{!Opportunity.Net_weight__c}"></apex:outputText></td>
        <td class="header-table-data"><apex:outputText value="{!Opportunity.Shipped_Via__c}"></apex:outputText></td>
        <td class="header-table-data"><apex:outputText value="{!Opportunity.Bill_of_Lading__c}"> </apex:outputText></td>
        <td class="header-table-data">Net 30</td>
        <td class="header-table-data">EXW</td>
        <td class="header-table-data">USD</td>
        <td rowspan="0" class="header-table-heading"> Total Amount Due</td>
        <td class="header-table-data"><apex:outputText value="{!opportunity.Pick_Total__c + opportunity.Shipping_Charges__c}"></apex:outputText></td>
    </tr>
</table>

Class :

public with sharing class InvoiceController {
           List<wrapperClass> appointmentList {get;set;}
           List<wrapperClass> appointmentList1 {get;set;} 
           public list<string> addaress{get;set;}
           public string address1{get;set;}
           public string address2{get;set;}
           public string address3{get;set;}
           public string address4{get;set;}
           public string address5{get;set;}
           public string address6{get;set;}
           public string address7{get;set;}
           public  String showaddressonVf{get;set;}
           public string wholeaddress{get;set;}
   //Added by sumit
               List<String> stringList;
               public String all{get;set;}
           //------------
   public InvoiceController(){
   list<opportunity> op=[select id,Shipment_Info__c
   from opportunity where id=:apexpages.currentpage().getparameters().get('id')];
    //opportunity op=[select id,Shipment_Info__c from opportunity where id=:apexpages.currentpage().getparameters().get('id')];
       //---------------------Added by sumit----------------------
       stringList= new List<String>(); 
       if(op.size()>0)
       if(op[0].Shipment_Info__c!=NULL && op[0].Shipment_Info__c!=''){
           List<String> stringList=(op[0].Shipment_Info__c).split(',');
               for(integer i=0;i<stringList.size();i++){
                   all=all+stringList[i]+'<br/>';
               }

           all=all.remove('null');      
        }
      //------------------------------------------------------------
   }
       public Id OppId{get;set;}


       public InvoiceController(ApexPages.StandardController sc) {
       oppId=Apexpages.currentPage().getparameters().get('Id');
   }
               public List<wrapperClass> getappointmentList (){
               wrapperClass tempObj ;
               tempObj = new wrapperClass();
               List<wrapperClass> aReList = new List<wrapperClass>(); 
           List<Opportunity> opp=[select id,Name,AccountId from Opportunity where id=:oppid limit 1];
           List<opportunity> Opp1=[select id,name,CreatedDate from opportunity where id=:oppid];
           //Opportunity opp1=[select id,Name,AccountId from Opportunity where id=:oppid limit 1];
           //Opportunity Opp=[select id,name,CreatedDate from opportunity where id=:oppid ];
                          List<OpportunityLineItem> OPplineitem= [SELECT OpportunityId,Quantity,PricebookEntry.Product2.Name,Sys_total_Amount__c,LN__c,Extension__c,ListPrice
                          ,Pick__c,Schedule_Ship_date__c
                          FROM OpportunityLineItem where OpportunityId=:oppId]; 
                          system.debug('HHHHHHHHHH'+OPplineitem.size());


               for(integer i=0; i < OPplineitem.size(); i++)
               {
                 tempObj = new wrapperClass();
                 tempObj.productname= OPplineitem[i].PricebookEntry.Product2.Name;
                 tempObj.quantity=OPplineitem[i].Quantity;
                 tempObj.totalamount=OPplineitem[i].Sys_total_Amount__c;
                 tempObj.unitprice=OPplineitem[i].ListPrice;
                 tempobj.extension=OPplineitem[i].Extension__c;
                 tempobj.LineNumber=OPplineitem[i].LN__c;
                 tempobj.Pick= OPplineitem[i].Pick__c;
                 tempobj.ScheduledShipDate = Opplineitem[i].schedule_ship_date__c;

                 if(tempobj!=null){
                    aReList.add(tempObj);
                 }
                }
       return aReList;
     }



       public List<wrapperClass> getappointmentList1 (){
           wrapperClass tempObj1 ; 
           List<wrapperClass> aReList1 = new List<wrapperClass>();
                   List<Opportunity> opp=[select id,Name,AccountId,Shipment_Info__c,
                    Shipping_Address_Line1__c,
                        Shipping_Address_Line2__c,
                        Shipping_Address_Line3__c,
                        Shipping_City__c,
                        Shipping_State_Province__c,
                        Shipping_Zipcode__c,
                        Shipping_Country__c  
                        from Opportunity where id=:oppid];
           for(integer i=0; i < opp.size(); i++)
           {
             tempObj1 = new wrapperClass();
             tempObj1.billingAddress= opp[i].Shipment_Info__c;
                               }
             aReList1.add(tempObj1);        

             /* Below code commented by Kiranmai as Shipment Info field is split into multiple fields

             //------- Added by Sumit-----------  
             stringList= new List<String>(); 

             if(aReList1[0].billingAddress!=NULL && aReList1[0].billingAddress!=''){
                List<String> stringList=(aReList1[0].billingAddress).split(',');
                for(integer i=0;i<stringList.size();i++){
                   all=all+stringList[i]+'<br/>';
                }
             } */

             all = all + opp[0].Shipping_Address_Line1__c + '<br/>';
             if(opp[0].Shipping_Address_Line2__c!=NULL && opp[0].Shipping_Address_Line2__c!=''){
                 all = all + opp[0].Shipping_Address_Line2__c + '<br/>';
             }

             if(opp[0].Shipping_Address_Line3__c!=NULL && opp[0].Shipping_Address_Line3__c!=''){
                 all = all + opp[0].Shipping_Address_Line3__c + '<br/>';
             } 

             if(opp[0].Shipping_City__c!=NULL && opp[0].Shipping_City__c!=''){
                 all = all + opp[0].Shipping_City__c + '<br/>';
             }

             if(opp[0].Shipping_State_Province__c!=NULL && opp[0].Shipping_State_Province__c!=''){
                 all = all + opp[0].Shipping_State_Province__c + '<br/>';
             }  

             if(opp[0].Shipping_Zipcode__c!=NULL && opp[0].Shipping_Zipcode__c!=''){
                 all = all + opp[0].Shipping_Zipcode__c + '<br/>';
             }

             if(opp[0].Shipping_Country__c!=NULL && opp[0].Shipping_Country__c!=''){
                 all = all + opp[0].Shipping_Country__c + '<br/>';
             }
            /* all = all + opp[0].Shipping_City__c + ', '+opp[0].Shipping_State_Province__c + ' - ' + opp[0].Shipping_Zipcode__c + '<br/>';
             all = all + opp[0].Shipping_Country__c + '<br/>';*/

             all=all.remove('null');

                /*-----------------------------------*/ 
      return aReList1;  
   }
           public class wrapperClass{
           public String productname{get;set;}
           public Decimal Quantity{get;set;}
           public Decimal totalamount{get;set;}                            
           public Decimal unitprice{get;set;}
           public date todaysdate{get;set;}
           public decimal extension{get;set;}
           public string LineNumber{get;set;}
           public string billingAddress{get;set;}
           public string splittedaddress{get;set;}
           public string wholeaddress{get;set;}
           public boolean Pick{get;set;}
           public date ScheduledShipDate{get;set;}
           public wrapperClass(){}                
       }
}

Thanks in Advance.

0

The second name is coming from your <apex:outputText value=" {!all}" escape="false"></apex:outputText> directly below. The page has Opportunity as the standard controller, however in your constructor you are fetching the same data and placing it into all.

  • :Thanks for ur reply .I didnt get u completely .Can u please explain me in detail.I do have other records in which it just displays the Account Name as per the required o/p.Only this record does not give the o/p as per the required. – nikkey Sep 20 '14 at 15:29
-1

@ScottW:In the First Line :it is the Customer Name and the Second line :is the Shipping Address Line 1.

  • Yes @Nikki, Shipping address is appearing on the second line. So the case is now clear, if you wanna display only account, comment-out the entire logic where you're appending text into "all" . – Mahmood Nov 24 '14 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.