• padmini ss
  • NEWBIE
  • 60 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 29
    Replies
Hi, i want  to create a calenar for the events, 
i used this link : http://www.codebycody.com/2013/06/create-calendar-view-in-salesforcecom.html
by this link , i created three static resources everything what is ther i followed, 
i am unable to see/get the output which was showed in this link,
if any one can help , i can share my credentials 

Hi , i have 2 Vf pages and 2 Apex Controllers 
from first Vf page (Controller ) i am passing 2 parameters to another Vfpage(2nd controller)
i have problem with test coverage.
pls guide me..
these are the details of  vf pages as well as Controller classes

1st Vf page name: RevenuewithDateCriteria
Controller : RevenueDatev1
and the code which shoud be coverd:

public PageReference movedatatoexcel() {
       PageReference newPage = page.RevenuewithDatecriteriainExcel;
      newPage.getParameters().put('MyVariable1', string.valueof(fDate));
       newPage.getParameters().put('MyVariable2', string.valueof(tDate) );
        return newPage ;
    }
 

2nd vf page: revenuewithdatecriteriainexcel
Controller : RevenuewithDatecriteriainExcel
and the code which shoud be coverd for this Search Function . ( Total Coverage : 70 % coverage : (  only  )
 

public  PageReference search() {
 if((Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL)
            fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1')));
   
         else   
            fDate=date.valueof('2014-08-01');
 
         if((Apexpages.currentPage().getParameters().get('MyVariable2'))!=NULL) 
            tDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2')));  
          
        else
            tDate=date.valueof('2015-3-31');  
.
.
.
.
.
.
}

And my test class is :
@isTest(SeeAllData=true)
private class TestRevenuewithDateCriteriav1 {
    static TestMethod void myUnitTestv1() {

/////// code coverage is 85% ////////////////

 PageReference pageRef = Page.RevenuewithDateCriteria;
           Test.setCurrentPage(pageRef);
            RevenueDatev1  controller = new RevenueDatev1();
             String nextPage = controller.movedatatoexcel().getUrl();
             
             ApexPages.currentPage().getParameters().put('MyVariable1', '2014-01-01');
             ApexPages.currentPage().getParameters().put('MyVariable2', '2014-12-31');
          
          RevenueDatev1 rdate = new RevenueDatev1 ();
          rdate.fDate = date.valueof('2014-01-01');
          rdate.tDate = date.valueof('2013-01-01');
          
         
         rdate.mainlogic();
         rdate.search();
         rdate.getfetchRevenueByMonth();
         rdate.appendEmptyOpportunities();
         rdate.createRevenueByMonth();
         rdate.movedatatoexcel();
--------------------------------------------------------------------------------

/////////////////////////////////////////////////////////////
This is testclass for my 2nd vf page and contrller 
ONLY 70% Coverage this is the test class
/////////////////////////////////////////////////////////////

PageReference pageRe = Page.revenuewithdatecriteriainexcel;
           Test.setCurrentPage(pageRe);
            RevenuewithDatecriteriainExcel  controller1 = new RevenuewithDatecriteriainExcel();
 revenuewithdatecriteriainexcel  r = new revenuewithdatecriteriainexcel ();
          r.fDate = date.valueof('2014-01-01');
          r.tDate = date.valueof('2013-01-01');
          
         
         r.mainlogic();
         r.search();
         r.getfetchRevenueByMonth();
         r.appendEmptyOpportunities();
         r.createRevenueByMonth();
.
.
.
.
===========================================

 
Hi I have One Problem
I wrote one trigger on Before Update.
trigger toupdateDiffDatelaps on Lead (before update) {

    if(Trigger.isBefore){

         system.debug('Its in Before Update ');

        for(lead d:[Select id,Lead_Convertion_Time__c,lap1_mdifieddate__c,IsConverted,LastViewedDate,IsUnreadByOwner from Lead where id in:trigger.newmap.keyset()]){
        if(d.IsConverted!=TRUE){
                  system.debug('Is Going to Convert ');
                   string timeduration;
                   if(d.lap1_mdifieddate__c!=null)
                          timeduration=time_calculation.duration_between_two_date_times(d.lap1_mdifieddate__c,datetime.now() );
                    else
                          timeduration='kkk';
                  system.debug('time lap is :'+timeduration);
                  d.Lead_Convertion_Time__c=timeduration;
                 system.debug('d.Lead_Convertion_Time__c '+d.Lead_Convertion_Time__c);
}
}
}


In Debug Log Its Showing the Time Stamp as :
 

d.Lead_Convertion_Time__c 2 Minutes 20 Seconds
But i am unable to REplicate this in the Vf page ,... Can any one telll me where am Overlooking please,,..!!
Hi This is my Vf page :
<apex:page showHeader="false" Sidebar="FALSE"  standardController="Order" cache="true" 
     extensions="SalesOrderReportGenerator"  action="{!SalesOrderReportData}"   contentType="Charset=UTF-8;text/octet-stream#Account.csv;">

<apex:dataTable  value="{!sapRecordListFinal }" var="w" width="1" border="1">  

<apex:column headerValue="SFDC SO No" >
<apex:outputText value="{!w.orderRecord.OrderNumber}"/>
</apex:column>



  

<apex:column headerValue="Order Type" >
<apex:outputText value="{!w.orderRecord.Type}"/>
</apex:column>

<apex:column headerValue="Sales Org " >
<apex:outputText value="{!w.orderRecord.Sales_Org__c}"/>
</apex:column>
</apex:datatable>
There are so many columns , i just showed only few columns.
While eporting to .CSV file am getting this output.
User-added image
Actual Problem is I exported as
contentType="application/csv#RenderAsTestFile.xls"

This is working fine, but our clint have problem with date fileds...like
Date format should be DD/MM/YYYY. But after extraction it is showing as single digit. for example if the date is 7/1/2015 the format should be 07/01/2015(The desired output should be like this). 

Also i want to know where i am doing the mistake , please help me, in this .CSCV file foramt, cuz i want to show the client in CSV format also 

thanks


 

Hi i want to call one apex method when an checkbox is clicked , 
My requirmnet is i have 2 vf pages and one controller.
in 1sr vf page when usere inserts 2 dates fileds and after that command button (submit) i am displaying custom report (data table).clicks exprot link i am passing the selected dates values to the same apex controller. to another vf page and i am getting correct result
now the requirmnet is after displaying the datatable there is one checkbox , when checkbox is checked in Vf page,i  want to make check in the Sobject record,(that i can do it), the main problem is i wnat to pass this check box also in the argument.
User-added image

My VF code:
 

<a href="/apex/SalesOrderSAPReportInExcel?fDate={!fDateStr}&tDate={!tDateStr}&chkbox={!StoreSelectCheckBox} " target="_blank" >
Export Here
</a>
Apex controller:in constructor
public SalesOrderReportGenerator(ApexPages.StandardController stdController) {
      
         String Dtext = System.currentPageReference().getParameters().get('Dtext');
        String fDate = System.currentPageReference().getParameters().get('fDate');
        String tDate = System.currentPageReference().getParameters().get('tDate'); 
     String chkbox=System.currentPageReference().getParameters().get('chkbox');
  
       system.debug('*************:'+ chkboxs);
       If(fDate != null && tDate != null){
       
        
            fromDate = Date.valueOf(fDate);
            toDate = Date.valueOf(tDate);
          
              
       SelectCheckBox=Boolean.valueof(chkbox);
}

Submit function method:

public pageReference SalesOrderReportData() {
    
        StoreSelectCheckBox=SelectCheckBox;
;
;
;
}
 

I can achive this only when checkbox checked and again subbmit commmad butoon called.
===

in simple words i want to call call apex command button when checkbox is check how to achive this pls tell me

this is my Vf page
 
<apex:page controller="RevenueDate" sidebar="False" docType="html-5.0" readOnly="true">           
    <apex:form id="dateren">    
   <apex:commandlink value="Export Excel" action="{!movedatatoexcel}" />
<!--<a href="/apex/RevenueByMonthInExcel2"> Export to Excel</a>-->
    <br></br>    <br></br>    <br></br>

And the Apex class
public without sharing class RevenueDate {

   public PageReference movedatatoexcel() {
       PageReference newPage = page.RevenuewithDatecriteriainExcel;
      newPage.getParameters().put('MyVariable1', string.valueof(fDate));
       newPage.getParameters().put('MyVariable2', string.valueof(tDate) );
        return newPage ;
    }

and the secod Apex class
public  PageReference search() {
                     Fjan =Tjan=jancol =FALSE;                     
                     Ffeb=Tfeb=febcol =FALSE;
                     Fmar=Tmar=marcol =FALSE; 
                     Faprl =Taprl=aprilcol =FALSE;
                     Fmay =Tmay=maycol =FALSE;
                      Fjun =Tjun=junecol =FALSE;
                     Fjul =Tjul=julycol =FALSE; 
                     Faug =Taug=augcol =FALSE;
                     Fsep=Tsep=sepcol =FALSE;
                     Foct =Toct=octcol =FALSE;
                     Fnov =Tnov=novcol =FALSE; 
                     Fdec =Tdec=deccol =FALSE;
      
         if((Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL)
            fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1')));
   
         else   
            fDate=date.valueof('2014-08-01');
 
         if((Apexpages.currentPage().getParameters().get('MyVariable2'))!=NULL) 
            tDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2')));  
          
        else
            tDate=date.valueof('2015-3-31');  
  
            // fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL?(Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1'))):(date.valueof('2014-01-01')));
            //  tDate = Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2'));

And this is my test classs
RevenuewithDatecriteriainExcel revenueexcel = new RevenuewithDatecriteriainExcel();
   
        revenueexcel.fDate  = null;
        revenueexcel.tDate = null;
         revenueexcel.mainlogic();
         revenueexcel.search();
         revenueexcel.getfetchRevenueByMonth();
         revenueexcel.appendEmptyOpportunities();
         revenueexcel.createRevenueByMonth();
         
        
       
        revenueexcel.fDate  = date.valueof('2014-01-01');
        revenueexcel.tDate = date.valueof('2014-12-31');
         revenueexcel.mainlogic();
         revenueexcel.search();
         revenueexcel.getfetchRevenueByMonth();
         revenueexcel.appendEmptyOpportunities();
         revenueexcel.createRevenueByMonth();

Now i nedd to pass the parmeters of Myvariable1, Myvariable2 in the test class to cover my test class
please help me

 
Hi This is my Test class its working fine Sandbox 93% coverage, but while moving to production 
i am getting this error 
FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (must have the same currency as the order): [PricebookEntryId] 
@isTest(seeAllData=TRUE)
    private class testSalesOrderReportGenerator {
    static testMethod void testSalesOrderReportGenerator() {
        List<OrderItem > lstoplitm= new list<OrderItem>();

  Account a = new Account(name ='testac1',BillingCity='BillingAddress',BillingCountry='India',BillingStreet='test BillingStreet',BillingPostalCode='12345',BillingState='Haryana');
        insert a;
        
        
        
Product2 prod = new Product2(Name = 'Laptop X200',Family = 'Hardware');
insert prod;

Id pricebookId = Test.getStandardPricebookId();//This is available irrespective of the state of SeeAllData.

PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prod.Id,UnitPrice = 10000, IsActive = true);
insert standardPrice;
 
PriceBook2 pb2Standard = [select Id from Pricebook2 where isStandard=true];


PricebookEntry pbe = [ SELECT Id,Product2Id,Pricebook2Id,UnitPrice FROM PricebookEntry WHERE Pricebook2Id = :pb2Standard.Id AND isActive=true LIMIT 1 ];


 Order o = new Order(name='test opp1',Status= 'Draft' ,  AccountId=a.id,CurrencyIsoCode= 'USD',EffectiveDate = Date.today(),Pricebook2Id = pb2Standard.Id);
       insert o;
    
 OrderItem op=new OrderItem (PriceBookEntryId=pbe.Id,quantity=1,Orderid=o.id,UnitPrice=pbe.UnitPrice );
      //insert op;
     lstoplitm.add(op);
     
     
     
      insert lstoplitm;
only in after this my business logic works, please kindly help me .

thanks
 
This is my trigger, 
trigger CreateOppLineItemNumber on OpportunityLineItem (after insert, before delete,after update) 
{
if(trigger.isInsert){
if(HandelRecurssiveTriggerOppLineItem.flag!=true){

createOppLineItemNumber.InsertingOppLineItems(trigger.new);
HandelRecurssiveTriggerOppLineItem.flag=true;
}
}
if(trigger.isUpdate ){
if(HandelRecurssiveTriggerOppLineItem.flag!=true){

createOppLineItemNumber.UpdatingOppLineItems(trigger.old);
HandelRecurssiveTriggerOppLineItem.flag=true;
}
}
if(trigger.isDelete){
createOppLineItemNumber.DeletingOppLineItems(trigger.old);
}
}

Apex: calss
public class createOppLineItemNumber{

map<Id,Opportunity> mapopps = new map<Id,Opportunity>();

 public static void InsertingOppLineItems( OpportunityLineItem  [] OLits){
 List <OpportunityLineItem> UpdateOli = New List <OpportunityLineItem>();
 set<id> setopids = new set<id>();
for(OpportunityLineItem oli : OLits)
  {

   if(oli.opportunityId!=null)
   Setopids.add(oli.opportunityId);
 }
  map<Id, Opportunity> mapOpp= new map<Id, Opportunity>([SELECT Id,DeletedOpplineHold__c,totlanonnullcounts__c from Opportunity Where Id IN :setopids ]);

   integer i=0;

  for(OpportunityLineItem oplin :OLits)
  {

   integer res=integer.valueof((mapopp.get(oplin.opportunityId).totlanonnullcounts__c!=null?mapopp.get(oplin.opportunityId).totlanonnullcounts__c:0)+1);
   res=res+integer.valueof((mapopp.get(oplin.opportunityId).DeletedOpplineHold__c!=null?mapopp.get(oplin.opportunityId).DeletedOpplineHold__c:0));
  System.debug('DEleted count :'+(mapopp.get(oplin.opportunityId).DeletedOpplineHold__c));
  if(oplin.Item_Number__c==null)
  {

   res+=i;
   OpportunityLineItem  op=new OpportunityLineItem (id=oplin.id,Item_Number__c=res*10);
   UpdateOli.add(op);
   i++;
  }

}

if(UpdateOli.size()>0)
update UpdateOli;
        
 }//InsertingOppLineItems CLOSED


public static void UpdatingOppLineItems( OpportunityLineItem  [] OLit){
set<id> setopids = new set<id>();
List <OpportunityLineItem> UpdateOli = New List <OpportunityLineItem>();
for(OpportunityLineItem oli : OLit)
  {
    if(oli.opportunityId!=null)
    Setopids.add(oli.opportunityId);
 }

map<Id, Opportunity> mapOpp= new map<Id, Opportunity>([SELECT Id,DeletedOpplineHold__c,totlanonnullcounts__c from Opportunity Where Id IN :Setopids]);
integer i=0;

for(OpportunityLineItem oplin :OLit)
{
  integer res=integer.valueof((mapopp.get(oplin.opportunityId).totlanonnullcounts__c !=null?mapopp.get(oplin.opportunityId).totlanonnullcounts__c :0)+1);
  res=res+integer.valueof((mapopp.get(oplin.opportunityId).DeletedOpplineHold__c!=null?mapopp.get(oplin.opportunityId).DeletedOpplineHold__c:0));
  System.debug('**********==== :' +mapopp.get(oplin.opportunityId).DeletedOpplineHold__c);

//System.debug('R E S  :' +res);
  if(oplin.Item_Number__c==null)
  {
    res+=i;
    System.debug('R E S  :' +res);
    OpportunityLineItem  op=new OpportunityLineItem (id=oplin.id,Item_Number__c=res*10);
    UpdateOli.add(op);
    i--;
  }
 }

if(UpdateOli.size()>0)
update UpdateOli;

}

     

}

i am updating the records via Workbench, its throwing an error...

but i added to a list , and after that i am updating the list, not in the loop...pls give me the reply urgent pls..
 

This is my Class to handel recurssive trigger, how to cover the TEST Coverage..??
global class HandelRecurssiveTriggerOppLineItem{
global static boolean flag=false;
}
pls help me out..
 

i can able to Query only 2 level 
these are my Sobjects and filds all are in lookup relationship
Order,OrderItem(Order_product__c), Sales_Order_Line_Item_Schedule__c

ORDER Fields 

Name,OrderNo__c
ORDERITEM (ORDER_PRODUCT__c) Fileds
Material_Code__r.Name,Quantity,ListPrice

Sales_Order_Line_Item_Schedule__c Fields
Name,Schedule_Date__c,Schedule_Quantity__c

This is my Query

SELECT Name,Schedule_Date__c,Schedule_Quantity__c,

 Order_Product__r.Material_Code__r.Name,Order_Product__r.Quantity,Order_Product__r.ListPrice, Order_Product__r.Item_Number__c

FROM Sales_Order_Line_Item_Schedule__c
 

I want to query ORDER Fields , don't know how to accomplish this task , please help me

thanks

 

i got 75% code coverage and i called all the functions unsed in the controller, still its 75%,
This is my Test class
@isTest
private class BasecorpModule1Testclass
 { 
    static testMethod void BasecorpModule1TestMethod() 
    {
             Account a = new Account( Name = 'Test Account ', BillingStreet = 'Test Street ', BillingCity = 'Test City ', BillingCountry = 'Test Country ' );        
        insert a;      
        
        City__c c = new City__c(Name = 'Test City ' );    
        insert  c;   
      
        Route__c rou = new Route__c( Name = 'Test route ', Date__c = System.today(),City__c =c.Id );        
        insert rou;     

      Route_Outlet__c routeOutlet = new Route_Outlet__c( Account__c = a.Id, Route__c = rou.Id );        
   //insert routeOutlet ; 


    Integer index = 0;        
    PageReference reference = Page.RouteOutlet_v3;        
    reference.getParameters().put('rowIndex', String.valueOf(index));     
    Test.setCurrentPage(reference);  
         

        
    ApexPages.StandardController sc = new ApexPages.StandardController(rou);    
      RouteOutlet_v3 rotout = new RouteOutlet_v3(sc);
    reference.getParameters().put('rowIndex', String.valueOf(index));
    rotout.addRouteoutlet();
    
    RouteOutlet_v3.OutletWrapper wrapObj = new RouteOutlet_v3.OutletWrapper();
    rotout.outletWrapperList.get(0).routeOutlet = routeOutlet;
    
    rotout.addPopulatedAccounttoRouteOutlet();        
    rotout.deleteRouteoutlet();        
    rotout.saveoutlet1();  
     rotout.ClearAll();
          rotout.ViewRoute();
     rotout.EditRoute();

     //rotout.saveObjects();
    Route_Outlet__c routeOutlet1 = new Route_Outlet__c( Account__c = a.Id, Route__c = rou.Id );
    RouteOutlet_v3.OutletWrapper wrapObj1 = new RouteOutlet_v3.OutletWrapper(routeOutlet1,null,null,null,null,null,null,null,null);
}
}


This is My ApexCode/Controller
public with sharing class RouteOutlet_v3{

public Integer totalCount {get;set;}
public Integer rowIndex {get;set;}
public Integer selectedDay { get; set; }
public Integer Weeklyoff{ get; set; }
public list<String> strLocation{get;set;}
public Route_Outlet__c del;
public list<Route_Outlet__c> listRouteOutlet { get; set; }
Route_Outlet__c rou= new Route_Outlet__c();  
public Route__c route{get;set;}
public list<OutletWrapper> outletWrapperList{get;set;}
public RouteOutlet_v3(ApexPages.StandardController controller) {
        route=new Route__c ();
        strLocation=new list<String>();
        outletWrapperList=new list<OutletWrapper>();
        addRouteoutlet();
}
     
public PageReference saveoutlet1(){
    if(route!=null){
       try{ 
             system.debug('&&&&&&&   '+route);
            upsert route;
            List<Route_Outlet__c> listRouteOutlet=new list<Route_Outlet__c>();
                      
            if(outletWrapperList.size()>0){
                 for(OutletWrapper olwIterator: outletWrapperList){
                   if(olwIterator.routeOutlet!=null){
                       if(olwIterator.routeOutlet.Account__c!=null){
                         Route_Outlet__c routeiterator=olwIterator.routeOutlet;
                         routeiterator.Area__c=olwIterator.outletArea;
                         routeiterator.Contact_Person__c=olwIterator.contactPerson;
                         routeiterator.Country__c=olwIterator.outletCountry;
                          routeiterator.City__c=olwIterator.outletCity;
                         routeiterator.Date__c=date.today();
                         routeiterator.Mobile_Number__c=olwIterator.outletPhone;
                         routeiterator.Pin_Code__c=olwIterator.outletPinCode;
                         routeiterator.Route__c=route.id;
                         routeiterator.State__c=olwIterator.outletState;
                         listRouteOutlet.add(routeiterator);
                       }
                   }
                 
                 }
                }
                if(listRouteOutlet.size()>0){
                         
                        system.debug('+_+_+_+_+   '+listRouteOutlet);
                        insert listRouteOutlet;
                         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Confirm,'Record Saved Successfull');
                         ApexPages.addMessage(myMsg);
                         PageReference viewpage= Page.RouteOutletViewpage1;
        viewpage.setRedirect(true);
        viewpage.getParameters().put('id',route.id); 

return viewpage;
                         
                         
                 }
                 
            }
            catch (Exception ex){
               // ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error,'Error Occurred : '+ex);
              //  ApexPages.addMessage(myMsg);
            }
        }
    else{
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error,'No appropriate Route found.');
        ApexPages.addMessage(myMsg);
    }
    
    return null;
} 
public void ClearAll(){
    if(listRouteOutlet!=null)
        listRouteOutlet.clear();
        route.Name='';
        route.Date__c=null;
        route.City__c=null;
        selectedDay=null;
        Weeklyoff=null;                       
        outletWrapperList.clear();
        ApexPages.getMessages().clear();
        route=new Route__c ();
  
}
public void fetchMapLocation(){
       strLocation=new list<String>();
       if(outletWrapperList.size()>0){
           for(OutletWrapper olwIterator: outletWrapperList){
           if(olwIterator.routeOutlet!=null){
               if(olwIterator.routeOutlet.Account__c!=null){
                     //strLocation.add(olwIterator.outletArea);
                 strLocation.add(olwIterator.outletcoordTEXT);
               }
           }
         }
       }
}
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
        OutletWrapper olwWrap=outletWrapperList.get(rowIndex);
          Account acc=[Select id,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode,Phone,coordTEXT__c from Account where Id=: olwWrap.routeOutlet.Account__c];
      olwWrap.outletArea=acc.BillingStreet;
         olwWrap.outletCity=acc.BillingCity;
        olwWrap.outletState=acc.BillingState;
        olwWrap.outletCountry=acc.BillingCountry;
        olwWrap.outletPinCode=acc.BillingPostalCode;
        olwWrap.outletcoordTEXT=acc.coordTEXT__c;
        olwWrap.outletPhone=acc.Phone;
        fetchMapLocation();
}

public void ViewRoute(){

}
public void addRouteoutlet(){
    Route_Outlet__c rOutlet=new Route_Outlet__c ();
    OutletWrapper olw=new OutletWrapper();
    olw.routeOutlet=rOutlet;
    outletWrapperList.add(olw);
}
public PageReference EditRoute(){
PageReference editpage= Page.RouteOutletEditpage1;
editpage.setRedirect(true);
        editpage.getParameters().put('id',route.id);

return editpage;
}
public void deleteRouteoutlet(){
    rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
    outletWrapperList.remove(rowIndex);
    fetchMapLocation();
}

public class OutletWrapper{
 public Route_Outlet__c routeOutlet{get;set;}
 public string outletArea{get;set;}
 public string contactPerson{get;set;}
 public string outletCountry{get;set;}
 public string outletCity{get;set;}
 public string outletState{get;set;}
 public string outletPinCode{get;set;}
 public string outletPhone{get;set;}
 public string outletcoordTEXT{get;set;}
 public OutletWrapper(){}
 
  public OutletWrapper(Route_Outlet__c routeOutlet,string outletcoordTEXT,string outletArea,string contactPerson,string outletCountry,string outletCity,string outletState,string outletPinCode,string outletPhone){
   this.routeOutlet=routeOutlet;
   this.outletArea=outletArea;
   this.outletCity=outletCity;
   this.contactPerson=contactPerson;
   this.outletCountry=outletCountry;
   this.outletState=outletState;
   this.outletPinCode=outletPinCode;
   this.outletPhone=outletPhone;
   this.outletcoordTEXT=outletcoordTEXT; 
 } 
}  

       
}

 
My Apex code:
public with sharing class RouteOutlet_v3{

public Integer totalCount {get;set;}
public Integer rowIndex {get;set;}
public Integer selectedDay { get; set; }
public Integer Weeklyoff{ get; set; }
public list<String> strLocation{get;set;}
public Route_Outlet__c del;
public list<Route_Outlet__c> listRouteOutlet { get; set; }
Route_Outlet__c rou= new Route_Outlet__c();  
public Route__c route{get;set;}
public list<OutletWrapper> outletWrapperList{get;set;}
public RouteOutlet_v3(ApexPages.StandardController controller) {
        route=new Route__c ();
        strLocation=new list<String>();
        outletWrapperList=new list<OutletWrapper>();
        addRouteoutlet();
}
     
public PageReference saveoutlet1(){
    if(route!=null){
       try{ 
             system.debug('&&&&&&&   '+route);
            upsert route;
            List<Route_Outlet__c> listRouteOutlet=new list<Route_Outlet__c>();
                      
            if(outletWrapperList.size()>0){
                 for(OutletWrapper olwIterator: outletWrapperList){
                   if(olwIterator.routeOutlet!=null){
                       if(olwIterator.routeOutlet.Account__c!=null){
                         Route_Outlet__c routeiterator=olwIterator.routeOutlet;
                         routeiterator.Area__c=olwIterator.outletArea;
                         routeiterator.Contact_Person__c=olwIterator.contactPerson;
                         routeiterator.Country__c=olwIterator.outletCountry;
                          routeiterator.City__c=olwIterator.outletCity;
                         routeiterator.Date__c=date.today();
                         routeiterator.Mobile_Number__c=olwIterator.outletPhone;
                         routeiterator.Pin_Code__c=olwIterator.outletPinCode;
                         routeiterator.Route__c=route.id;
                         routeiterator.State__c=olwIterator.outletState;
                         listRouteOutlet.add(routeiterator);
                       }
                   }
                 
                 }
                }
                if(listRouteOutlet.size()>0){
                         
                        system.debug('+_+_+_+_+   '+listRouteOutlet);
                        insert listRouteOutlet;
                         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Confirm,'Record Saved Successfull');
                         ApexPages.addMessage(myMsg);
                 }
                 
            }
            catch (Exception ex){
               // ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error,'Error Occurred : '+ex);
              //  ApexPages.addMessage(myMsg);
            }
        }
    else{
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error,'No appropriate Route found.');
        ApexPages.addMessage(myMsg);
    }
    
    return null;
} 
public void ClearAll(){
    if(listRouteOutlet!=null)
        listRouteOutlet.clear();
        route.Name='';
        route.Date__c=null;
        route.City__c=null;
        selectedDay=null;
        Weeklyoff=null;                       
        outletWrapperList.clear();
        ApexPages.getMessages().clear();
        route=new Route__c ();
  
}
public void fetchMapLocation(){
       strLocation=new list<String>();
       if(outletWrapperList.size()>0){
           for(OutletWrapper olwIterator: outletWrapperList){
           if(olwIterator.routeOutlet!=null){
               if(olwIterator.routeOutlet.Account__c!=null){
                     //strLocation.add(olwIterator.outletArea);
                  strLocation.add(olwIterator.outletCity);
               }
           }
         }
       }
}
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
        OutletWrapper olwWrap=outletWrapperList.get(rowIndex);
        Account acc=[Select id,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode,Phone from Account where Id=: olwWrap.routeOutlet.Account__c];
        olwWrap.outletArea=acc.BillingStreet;
         olwWrap.outletCity=acc.BillingCity;
        olwWrap.outletState=acc.BillingState;
        olwWrap.outletCountry=acc.BillingCountry;
        olwWrap.outletPinCode=acc.BillingPostalCode;
        olwWrap.outletPhone=acc.Phone;
        fetchMapLocation();
}
public void addRouteoutlet(){
    Route_Outlet__c rOutlet=new Route_Outlet__c ();
    OutletWrapper olw=new OutletWrapper();
    olw.routeOutlet=rOutlet;
    outletWrapperList.add(olw);
}

public void deleteRouteoutlet(){
    rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
    outletWrapperList.remove(rowIndex);
    fetchMapLocation();
}

public class OutletWrapper{
 public Route_Outlet__c routeOutlet{get;set;}
 public string outletArea{get;set;}
 public string contactPerson{get;set;}
 public string outletCountry{get;set;}
 public string outletCity{get;set;}
 public string outletState{get;set;}
 public string outletPinCode{get;set;}
 public string outletPhone{get;set;}
 public OutletWrapper(){}
 public OutletWrapper(Route_Outlet__c routeOutlet,string outletArea,string contactPerson,string outletCountry,string outletCity,string outletState,string outletPinCode,string outletPhone){
   this.routeOutlet=routeOutlet;
   this.outletArea=outletArea;
   this.outletCity=outletCity;
   this.contactPerson=contactPerson;
   this.outletCountry=outletCountry;
   this.outletState=outletState;
   this.outletPinCode=outletPinCode;
   this.outletPhone=outletPhone;
 }
}         
}
My Test class:
@isTest
private class TestRouteOutlet_v3 {
    static testMethod void runTestRoutes() {
        Account a = new Account(
            Name = 'Test Account ',
            BillingStreet = 'Test Street ',
            BillingCity = 'Test City ',
            BillingCountry = 'Test Country '
        );
        insert a;

        City__c c = new City__c(Name = 'Test City ' );
        insert  c;

        Route__c rou = new Route__c(
            Name = 'Test route ',
            Date__c = System.today(),
            City__c =c.Id
        );
        insert rou;

        Route_Outlet__c routeOutlet = new Route_Outlet__c(
            Account__c = a.Id,
            Route__c = rou.Id
        );
        insert routeOutlet ;

        Integer index = 0;

        PageReference reference = Page.RouteOutlet_v3;
        reference.getParameters().put('rowIndex', String.valueOf(index));
        Test.setCurrentPage(reference);

        ApexPages.StandardController sc = new ApexPages.StandardController(rou);
        RouteOutlet_v3 rotout = new RouteOutlet_v3(sc);

        rotout.addRouteoutlet();
        rotout.addPopulatedAccounttoRouteOutlet();
        rotout.deleteRouteoutlet();
        rotout.saveoutlet1();
    }
}

I am geting  Error, in this Function/line:
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
        OutletWrapper olwWrap=outletWrapperList.get(rowIndex);
        Account acc=[Select id,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode,Phone from Account where Id=: olwWrap.routeOutlet.Account__c];
        olwWrap.outletArea=acc.BillingStreet;
         olwWrap.outletCity=acc.BillingCity;
        olwWrap.outletState=acc.BillingState;
        olwWrap.outletCountry=acc.BillingCountry;
        olwWrap.outletPinCode=acc.BillingPostalCode;
        olwWrap.outletPhone=acc.Phone;
        fetchMapLocation();
}
The Error is:
System.QueryException: List has no rows for assignment to SObject
Class.RouteOutlet_v3.addPopulatedAccounttoRouteOutlet:
How do i increase my code to readability to the viewrs , to get repsonse. 
in a proper format (line numbers,...etc)

HI 
My Vf code:
</apex:pageblock> 
    <apex:pageBlock title="New Route outlet" id="pb">
         <apex:variable var="rowNumber" value="{!0}"/>
         <apex:pageblockSection columns="1">
                 <apex:pageBlockTable title="Account" var="lro" value="{!outletWrapperList}"> 
                        <apex:column headerValue="No." style="width:20px; text-align:center;" headerClass="centertext">
                                 <apex:outputText value="{0}" style="text-align:center;"> 
                                         <apex:param value="{!rowNumber+1}" /> 
                                 </apex:outputText>
                         <apex:facet name="footer">
                                 <apex:commandlink action="{!addRouteoutlet}" value="Add Row" reRender="pb"/>
                         </apex:facet>
                        </apex:column> 
                        <apex:column headerValue="Action" >
                                 <apex:commandLink value="Delete" action="{!deleteRouteoutlet}" reRender="pb,mapPanel,map_canvas" oncomplete="showAddress();">
                                         <apex:param name="rowIndex" value="{!rowNumber}"/>
                                 </apex:commandlink>
                                 <apex:variable var="rowNumber" value="{!rowNumber+1}"/>
                         </apex:column>   
                         
                            <apex:column headerValue="Account Name">
                                 <apex:inputField value="{!lro.routeOutlet.Account__c}">
                                 <apex:actionSupport event="onchange" action="{!addPopulatedAccounttoRouteOutlet}"  reRender="pb,mapPanel,map_canvas" oncomplete="showAddress();">
                                    <apex:param name="rowIndex" value="{!rowNumber-1}"/>
                                 </apex:actionSupport> 
                                 </apex:inputField>   
                            </apex:column>   
                         :
                         :

Apex Code:
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
      :
      :
        
}
In Test class:

ApexPages.StandardController sc=new ApexPages.StandardController(rou);
  rotout.addRouteoutlet();
rotout.addPopulatedAccounttoRouteOutlet(); 

& i am getting Error:
System.NullPointerException: Argument cannot be null.
Stack Trace Class.RouteOutlet_v3.addPopulatedAccounttoRouteOutlet:

Geeting Error in this line.
 rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));

Pls do help me to complete the test class

Hi, I have written code , its working fine
i am able to locate multiple locations on google map in visualforce page, now i want to connect all the locations. in a gogole map

Ther are 4 objects.
Route__c is a master
Route_outlet__c is Junction object for Route__c & Account.

And For Route__c there is one lookup for City__c

 

So My Requirment is,,,, While saving the Rout_outlet__c Record.
We must check the Account__r.BillingCity & route__r.City__r.name
if these two matches the rout_outlet__c record must save.

my Trigger is this

trigger AvoidCityNomatch on Route_Outlet__c (Before Insert, Before Update) {
for(Route_Outlet__c ro:Trigger.new){
if(ro.route__r.City__c!=ro.Account__r.BillingCity)
Ro.City__c.adderror('Account City & Rout City No Match');
}
}
in debug log ro.route__r.City__c showing null, pls guide me

Hi i want a basic demo, using a wrapper class,
In a Pageblock table .....In a column i want to take the input Account Name(Lookup field), From "CONTACT"
Based on that , I want to dispaly related Acoount information

Pls Help ..
Thanks

I have a requirment like in a pageblock table, in a sinlge column i want to take input value(lookup filed),
Based on that 'lookup' inputfiled, i want to display related record in the remaing columns of Table.(In a sinlge Row)
Example:
in first column, i must take inputvalue(lookup to accout),
in the remaining column, same row i want to display(outputfiled/outputtext) of name, phone, rating...etc fileds.
Can any help me,
User-added image
But this is not working, i am able to display single row, unable to hold previous values
this is my Vf page
 
<apex:page controller="RevenueDate" sidebar="False" docType="html-5.0" readOnly="true">           
    <apex:form id="dateren">    
   <apex:commandlink value="Export Excel" action="{!movedatatoexcel}" />
<!--<a href="/apex/RevenueByMonthInExcel2"> Export to Excel</a>-->
    <br></br>    <br></br>    <br></br>

And the Apex class
public without sharing class RevenueDate {

   public PageReference movedatatoexcel() {
       PageReference newPage = page.RevenuewithDatecriteriainExcel;
      newPage.getParameters().put('MyVariable1', string.valueof(fDate));
       newPage.getParameters().put('MyVariable2', string.valueof(tDate) );
        return newPage ;
    }

and the secod Apex class
public  PageReference search() {
                     Fjan =Tjan=jancol =FALSE;                     
                     Ffeb=Tfeb=febcol =FALSE;
                     Fmar=Tmar=marcol =FALSE; 
                     Faprl =Taprl=aprilcol =FALSE;
                     Fmay =Tmay=maycol =FALSE;
                      Fjun =Tjun=junecol =FALSE;
                     Fjul =Tjul=julycol =FALSE; 
                     Faug =Taug=augcol =FALSE;
                     Fsep=Tsep=sepcol =FALSE;
                     Foct =Toct=octcol =FALSE;
                     Fnov =Tnov=novcol =FALSE; 
                     Fdec =Tdec=deccol =FALSE;
      
         if((Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL)
            fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1')));
   
         else   
            fDate=date.valueof('2014-08-01');
 
         if((Apexpages.currentPage().getParameters().get('MyVariable2'))!=NULL) 
            tDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2')));  
          
        else
            tDate=date.valueof('2015-3-31');  
  
            // fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL?(Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1'))):(date.valueof('2014-01-01')));
            //  tDate = Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2'));

And this is my test classs
RevenuewithDatecriteriainExcel revenueexcel = new RevenuewithDatecriteriainExcel();
   
        revenueexcel.fDate  = null;
        revenueexcel.tDate = null;
         revenueexcel.mainlogic();
         revenueexcel.search();
         revenueexcel.getfetchRevenueByMonth();
         revenueexcel.appendEmptyOpportunities();
         revenueexcel.createRevenueByMonth();
         
        
       
        revenueexcel.fDate  = date.valueof('2014-01-01');
        revenueexcel.tDate = date.valueof('2014-12-31');
         revenueexcel.mainlogic();
         revenueexcel.search();
         revenueexcel.getfetchRevenueByMonth();
         revenueexcel.appendEmptyOpportunities();
         revenueexcel.createRevenueByMonth();

Now i nedd to pass the parmeters of Myvariable1, Myvariable2 in the test class to cover my test class
please help me

 
I have two objects  Work Order and Work Details having master detail relationship. Work Order is Parent and Work Detail is Child. 
I have written Work Flow on Work Order objects as criteria is When Work Order is Open.
In that Work Flow i have taken Email Template for displaying the Work Order and Work Order Details both.
But Work Flow is firing when Work Order is Created.
How to do this ?? Which template i have take for display the Work Order and Work Details both??
Please help me in this.

Thanks.
 
  • September 16, 2015
  • Like
  • 0
Hi This is my Vf page :
<apex:page showHeader="false" Sidebar="FALSE"  standardController="Order" cache="true" 
     extensions="SalesOrderReportGenerator"  action="{!SalesOrderReportData}"   contentType="Charset=UTF-8;text/octet-stream#Account.csv;">

<apex:dataTable  value="{!sapRecordListFinal }" var="w" width="1" border="1">  

<apex:column headerValue="SFDC SO No" >
<apex:outputText value="{!w.orderRecord.OrderNumber}"/>
</apex:column>



  

<apex:column headerValue="Order Type" >
<apex:outputText value="{!w.orderRecord.Type}"/>
</apex:column>

<apex:column headerValue="Sales Org " >
<apex:outputText value="{!w.orderRecord.Sales_Org__c}"/>
</apex:column>
</apex:datatable>
There are so many columns , i just showed only few columns.
While eporting to .CSV file am getting this output.
User-added image
Actual Problem is I exported as
contentType="application/csv#RenderAsTestFile.xls"

This is working fine, but our clint have problem with date fileds...like
Date format should be DD/MM/YYYY. But after extraction it is showing as single digit. for example if the date is 7/1/2015 the format should be 07/01/2015(The desired output should be like this). 

Also i want to know where i am doing the mistake , please help me, in this .CSCV file foramt, cuz i want to show the client in CSV format also 

thanks


 

Hi This is my Test class its working fine Sandbox 93% coverage, but while moving to production 
i am getting this error 
FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (must have the same currency as the order): [PricebookEntryId] 
@isTest(seeAllData=TRUE)
    private class testSalesOrderReportGenerator {
    static testMethod void testSalesOrderReportGenerator() {
        List<OrderItem > lstoplitm= new list<OrderItem>();

  Account a = new Account(name ='testac1',BillingCity='BillingAddress',BillingCountry='India',BillingStreet='test BillingStreet',BillingPostalCode='12345',BillingState='Haryana');
        insert a;
        
        
        
Product2 prod = new Product2(Name = 'Laptop X200',Family = 'Hardware');
insert prod;

Id pricebookId = Test.getStandardPricebookId();//This is available irrespective of the state of SeeAllData.

PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prod.Id,UnitPrice = 10000, IsActive = true);
insert standardPrice;
 
PriceBook2 pb2Standard = [select Id from Pricebook2 where isStandard=true];


PricebookEntry pbe = [ SELECT Id,Product2Id,Pricebook2Id,UnitPrice FROM PricebookEntry WHERE Pricebook2Id = :pb2Standard.Id AND isActive=true LIMIT 1 ];


 Order o = new Order(name='test opp1',Status= 'Draft' ,  AccountId=a.id,CurrencyIsoCode= 'USD',EffectiveDate = Date.today(),Pricebook2Id = pb2Standard.Id);
       insert o;
    
 OrderItem op=new OrderItem (PriceBookEntryId=pbe.Id,quantity=1,Orderid=o.id,UnitPrice=pbe.UnitPrice );
      //insert op;
     lstoplitm.add(op);
     
     
     
      insert lstoplitm;
only in after this my business logic works, please kindly help me .

thanks
 
My Apex code:
public with sharing class RouteOutlet_v3{

public Integer totalCount {get;set;}
public Integer rowIndex {get;set;}
public Integer selectedDay { get; set; }
public Integer Weeklyoff{ get; set; }
public list<String> strLocation{get;set;}
public Route_Outlet__c del;
public list<Route_Outlet__c> listRouteOutlet { get; set; }
Route_Outlet__c rou= new Route_Outlet__c();  
public Route__c route{get;set;}
public list<OutletWrapper> outletWrapperList{get;set;}
public RouteOutlet_v3(ApexPages.StandardController controller) {
        route=new Route__c ();
        strLocation=new list<String>();
        outletWrapperList=new list<OutletWrapper>();
        addRouteoutlet();
}
     
public PageReference saveoutlet1(){
    if(route!=null){
       try{ 
             system.debug('&&&&&&&   '+route);
            upsert route;
            List<Route_Outlet__c> listRouteOutlet=new list<Route_Outlet__c>();
                      
            if(outletWrapperList.size()>0){
                 for(OutletWrapper olwIterator: outletWrapperList){
                   if(olwIterator.routeOutlet!=null){
                       if(olwIterator.routeOutlet.Account__c!=null){
                         Route_Outlet__c routeiterator=olwIterator.routeOutlet;
                         routeiterator.Area__c=olwIterator.outletArea;
                         routeiterator.Contact_Person__c=olwIterator.contactPerson;
                         routeiterator.Country__c=olwIterator.outletCountry;
                          routeiterator.City__c=olwIterator.outletCity;
                         routeiterator.Date__c=date.today();
                         routeiterator.Mobile_Number__c=olwIterator.outletPhone;
                         routeiterator.Pin_Code__c=olwIterator.outletPinCode;
                         routeiterator.Route__c=route.id;
                         routeiterator.State__c=olwIterator.outletState;
                         listRouteOutlet.add(routeiterator);
                       }
                   }
                 
                 }
                }
                if(listRouteOutlet.size()>0){
                         
                        system.debug('+_+_+_+_+   '+listRouteOutlet);
                        insert listRouteOutlet;
                         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Confirm,'Record Saved Successfull');
                         ApexPages.addMessage(myMsg);
                 }
                 
            }
            catch (Exception ex){
               // ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error,'Error Occurred : '+ex);
              //  ApexPages.addMessage(myMsg);
            }
        }
    else{
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error,'No appropriate Route found.');
        ApexPages.addMessage(myMsg);
    }
    
    return null;
} 
public void ClearAll(){
    if(listRouteOutlet!=null)
        listRouteOutlet.clear();
        route.Name='';
        route.Date__c=null;
        route.City__c=null;
        selectedDay=null;
        Weeklyoff=null;                       
        outletWrapperList.clear();
        ApexPages.getMessages().clear();
        route=new Route__c ();
  
}
public void fetchMapLocation(){
       strLocation=new list<String>();
       if(outletWrapperList.size()>0){
           for(OutletWrapper olwIterator: outletWrapperList){
           if(olwIterator.routeOutlet!=null){
               if(olwIterator.routeOutlet.Account__c!=null){
                     //strLocation.add(olwIterator.outletArea);
                  strLocation.add(olwIterator.outletCity);
               }
           }
         }
       }
}
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
        OutletWrapper olwWrap=outletWrapperList.get(rowIndex);
        Account acc=[Select id,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode,Phone from Account where Id=: olwWrap.routeOutlet.Account__c];
        olwWrap.outletArea=acc.BillingStreet;
         olwWrap.outletCity=acc.BillingCity;
        olwWrap.outletState=acc.BillingState;
        olwWrap.outletCountry=acc.BillingCountry;
        olwWrap.outletPinCode=acc.BillingPostalCode;
        olwWrap.outletPhone=acc.Phone;
        fetchMapLocation();
}
public void addRouteoutlet(){
    Route_Outlet__c rOutlet=new Route_Outlet__c ();
    OutletWrapper olw=new OutletWrapper();
    olw.routeOutlet=rOutlet;
    outletWrapperList.add(olw);
}

public void deleteRouteoutlet(){
    rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
    outletWrapperList.remove(rowIndex);
    fetchMapLocation();
}

public class OutletWrapper{
 public Route_Outlet__c routeOutlet{get;set;}
 public string outletArea{get;set;}
 public string contactPerson{get;set;}
 public string outletCountry{get;set;}
 public string outletCity{get;set;}
 public string outletState{get;set;}
 public string outletPinCode{get;set;}
 public string outletPhone{get;set;}
 public OutletWrapper(){}
 public OutletWrapper(Route_Outlet__c routeOutlet,string outletArea,string contactPerson,string outletCountry,string outletCity,string outletState,string outletPinCode,string outletPhone){
   this.routeOutlet=routeOutlet;
   this.outletArea=outletArea;
   this.outletCity=outletCity;
   this.contactPerson=contactPerson;
   this.outletCountry=outletCountry;
   this.outletState=outletState;
   this.outletPinCode=outletPinCode;
   this.outletPhone=outletPhone;
 }
}         
}
My Test class:
@isTest
private class TestRouteOutlet_v3 {
    static testMethod void runTestRoutes() {
        Account a = new Account(
            Name = 'Test Account ',
            BillingStreet = 'Test Street ',
            BillingCity = 'Test City ',
            BillingCountry = 'Test Country '
        );
        insert a;

        City__c c = new City__c(Name = 'Test City ' );
        insert  c;

        Route__c rou = new Route__c(
            Name = 'Test route ',
            Date__c = System.today(),
            City__c =c.Id
        );
        insert rou;

        Route_Outlet__c routeOutlet = new Route_Outlet__c(
            Account__c = a.Id,
            Route__c = rou.Id
        );
        insert routeOutlet ;

        Integer index = 0;

        PageReference reference = Page.RouteOutlet_v3;
        reference.getParameters().put('rowIndex', String.valueOf(index));
        Test.setCurrentPage(reference);

        ApexPages.StandardController sc = new ApexPages.StandardController(rou);
        RouteOutlet_v3 rotout = new RouteOutlet_v3(sc);

        rotout.addRouteoutlet();
        rotout.addPopulatedAccounttoRouteOutlet();
        rotout.deleteRouteoutlet();
        rotout.saveoutlet1();
    }
}

I am geting  Error, in this Function/line:
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
        OutletWrapper olwWrap=outletWrapperList.get(rowIndex);
        Account acc=[Select id,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode,Phone from Account where Id=: olwWrap.routeOutlet.Account__c];
        olwWrap.outletArea=acc.BillingStreet;
         olwWrap.outletCity=acc.BillingCity;
        olwWrap.outletState=acc.BillingState;
        olwWrap.outletCountry=acc.BillingCountry;
        olwWrap.outletPinCode=acc.BillingPostalCode;
        olwWrap.outletPhone=acc.Phone;
        fetchMapLocation();
}
The Error is:
System.QueryException: List has no rows for assignment to SObject
Class.RouteOutlet_v3.addPopulatedAccounttoRouteOutlet:
How do i increase my code to readability to the viewrs , to get repsonse. 
in a proper format (line numbers,...etc)

HI 
My Vf code:
</apex:pageblock> 
    <apex:pageBlock title="New Route outlet" id="pb">
         <apex:variable var="rowNumber" value="{!0}"/>
         <apex:pageblockSection columns="1">
                 <apex:pageBlockTable title="Account" var="lro" value="{!outletWrapperList}"> 
                        <apex:column headerValue="No." style="width:20px; text-align:center;" headerClass="centertext">
                                 <apex:outputText value="{0}" style="text-align:center;"> 
                                         <apex:param value="{!rowNumber+1}" /> 
                                 </apex:outputText>
                         <apex:facet name="footer">
                                 <apex:commandlink action="{!addRouteoutlet}" value="Add Row" reRender="pb"/>
                         </apex:facet>
                        </apex:column> 
                        <apex:column headerValue="Action" >
                                 <apex:commandLink value="Delete" action="{!deleteRouteoutlet}" reRender="pb,mapPanel,map_canvas" oncomplete="showAddress();">
                                         <apex:param name="rowIndex" value="{!rowNumber}"/>
                                 </apex:commandlink>
                                 <apex:variable var="rowNumber" value="{!rowNumber+1}"/>
                         </apex:column>   
                         
                            <apex:column headerValue="Account Name">
                                 <apex:inputField value="{!lro.routeOutlet.Account__c}">
                                 <apex:actionSupport event="onchange" action="{!addPopulatedAccounttoRouteOutlet}"  reRender="pb,mapPanel,map_canvas" oncomplete="showAddress();">
                                    <apex:param name="rowIndex" value="{!rowNumber-1}"/>
                                 </apex:actionSupport> 
                                 </apex:inputField>   
                            </apex:column>   
                         :
                         :

Apex Code:
public void addPopulatedAccounttoRouteOutlet(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
      :
      :
        
}
In Test class:

ApexPages.StandardController sc=new ApexPages.StandardController(rou);
  rotout.addRouteoutlet();
rotout.addPopulatedAccounttoRouteOutlet(); 

& i am getting Error:
System.NullPointerException: Argument cannot be null.
Stack Trace Class.RouteOutlet_v3.addPopulatedAccounttoRouteOutlet:

Geeting Error in this line.
 rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));

Pls do help me to complete the test class