/***************
Ceated By : Mohit Dwivedi( KVP Business Solution Pvt Ltd) .
Created Date :
Purpose : This controller is for Lead Age Report.
***************/
public class leadReportController{
public Date fromDate {get; set;}
public Date toDate {get; set;}
public Boolean showHideTable{get;set;}
public List<wrapLead> wrapList{get;set;}
public Integer openCountRecord{get;set;}
public Integer CallBackCountRecord{get;set;}
public Integer ContactedCountRecord{get;set;}
public Integer FirmCountRecord{get;set;}
public Integer LostCountRecord{get;set;}
public Integer NotIntrestedCountRecord{get; set;}
public Integer OthersCountRecord{get;set;}
public Integer QualifiedCountRecord{get;set;}
public Integer UnqualifiedCountRecord{get; set;}
public Decimal openCountWrap {get;set;}
public Decimal CallBackCountWrap {get;set;}
public Decimal ContactedCountWrap {get;set;}
public Decimal FirmCountWrap {get;set;}
public Decimal LostCountWrap {get;set;}
public Decimal NotIntrestedCountWrap {get; set;}
public Decimal OthersCountWrap {get;set;}
public Decimal QualifiedCountWrap {get;set;}
public Decimal UnqualifiedCountWrap {get;set; }
public boolean showhidetable2{get;set;}
public boolean Flag{get; set;}
public List<SelectOption> LeadJunList{get;set;}
public String selectedSource{get;set;}
public list<Wrapperclass> wrapperlistdata;
public string AllstagesData{get;set;}
public boolean showhide{ get;set;}
public String stagenames{ get;set;}
public leadReportController(){
showHideTable2=false;
showhide=false;
showHideTable = false;
wrapList = new list< wrapLead>();
wrapperlistdata =new list<Wrapperclass>();
Set<String> sourceSet = new Set<String>();
LeadJunList = new List<SelectOption>();
Schema. DescribeFieldResult fieldResult = Lead.LeadSource. getDescribe();
List<Schema. PicklistEntry> ple = fieldResult.getPicklistValues( );
// displayLeadTable();
for( Schema. PicklistEntry f : ple)
{
sourceSet.add(f. getLabel());
}
system.debug('-------- ----sourceSet----------'+ sourceSet);
LeadJunList.add(new SelectOption('-None-', '-None- '));
//LeadJunList.add(new SelectOption('All', 'All'));
for(String Source : sourceSet){
LeadJunList.add( new SelectOption(Source, Source));
}
}
public void displayLeadTable() {
showHideTable2=true;
showhide=true;
map<String,double> stagenamesmap=new map<String, decimal>{'open'=>0,'CallBack'= >0,'Contacted'=>0,'Firm Enquiry'=>0,'Lost'=>0,'Not Interested'=>0,'Others'=>0,' Qualified'=>0,'Unqualified'=> 0};
map<String,double> mapofstageswithdata =new map< String,decimal>();
map<String,double> mapofStatuscount = new map< String,decimal>();
list<Decimal> statuscountlist = new list< Decimal>();
list<Decimal> stagenameslist =new list< Decimal>();
wrapperlistdata.clear( );
if(wrapList.size() >0) {
wrapList.clear();
}
wrapList = new list< wrapLead>();
wrapperlistdata =new list<Wrapperclass>();
List<Lead_Junction__c> ljList = new list<Lead_ Junction__c>();
Integer openCount = 0;
Integer CallBackCount = 0;
Integer ContactedCount = 0;
Integer FirmCount = 0;
Integer LostCount = 0;
Integer NotIntrestedCount = 0;
Integer OthersCount = 0;
Integer QualifiedCount = 0;
Integer UnqualifiedCount = 0;
Decimal TotalOpenCount = 0;
Decimal TotalCallBackCount = 0;
Decimal TotalContactedCount = 0;
Decimal TotalFirmCount = 0;
Decimal TotalLostCount = 0;
Decimal TotalNotIntrestedCount = 0;
Decimal TotalOthersCount = 0;
Decimal TotalQualifiedCount = 0;
Decimal TotalUnqualifiedCount = 0;
system.debug('-------- --fromDate--------'+fromDate);
system.debug('-------- --toDate--------'+toDate);
if(fromDate ==null && toDate == null){
showHideTable = False;
flag = showHideTable ;
}else if(fromDate != null && toDate != null){
ljList = [SELECT Name,Lead_Current_Status__c, LeadPrevious_Status__c,lead_ sources__c,Total_Days_in_same_ Status__c FROM Lead_Junction__ c WHERE Total_Days_in_same_ Status__c!= null AND DAY_ONLY( convertTimezone(CreatedDate)) >= : fromDate AND DAY_ONLY( convertTimezone(CreatedDate)) <= : toDate AND lead_sources__ c =: selectedSource ];
system.debug('---- ------ljList(else)--------'+ ljList);
}
if(test.isRunningTest( )){
ljList = [SELECT Name,Lead_Current_Status__c, LeadPrevious_Status__c,lead_ sources__c,Total_Days_in_same_ Status__c FROM Lead_Junction__ c limit 100];
}
for(Lead_Junction__c lj : ljList){
if(lj. LeadPrevious_Status__c == ' Open' && lj.Total_Days_in_ same_Status__c != null && lj. lead_sources__c == selectedSource ){
openCount = openCount + 1;
TotalOpenCount = TotalOpenCount + lj.Total_ Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' CallBack' && lj.Total_Days_in_ same_Status__c != null && lj. lead_sources__c == selectedSource ){
CallBackCount = CallBackCount + 1;
TotalCallBackCount = TotalCallBackCount + lj.Total_ Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Contacted' && lj.Total_Days_ in_same_Status__c != null && lj.lead_sources__c == selectedSource ){
ContactedCount = ContactedCount + 1;
TotalContactedCount = TotalContactedCount + lj. Total_Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Firm Enquiry' && lj.Total_ Days_in_same_Status__c != null && lj.lead_sources__c == selectedSource ){
FirmCount = FirmCount + 1;
TotalFirmCount = TotalFirmCount + lj.Total_ Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Lost' && lj.Total_Days_in_ same_Status__c != null && lj. lead_sources__c == selectedSource ){
LostCount = LostCount + 1;
TotalLostCount = TotalLostCount + lj.Total_ Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Not Interested' && lj.Total_ Days_in_same_Status__c != null && lj.lead_sources__c == selectedSource ){
NotIntrestedCount = NotIntrestedCount + 1;
TotalNotIntrestedCount = TotalNotIntrestedCount + lj. Total_Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Others' && lj.Total_Days_in_ same_Status__c != null && lj. lead_sources__c == selectedSource ){
OthersCount = OthersCount + 1;
TotalOthersCount = TotalOthersCount + lj.Total_ Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Qualified' && lj.Total_Days_ in_same_Status__c != null && lj.lead_sources__c == selectedSource ){
QualifiedCount = QualifiedCount + 1;
TotalQualifiedCount = TotalQualifiedCount + lj. Total_Days_in_same_Status__c;
}
if(lj. LeadPrevious_Status__c == ' Unqualified' && lj.Total_Days_ in_same_Status__c != null && lj.lead_sources__c == selectedSource ){
UnqualifiedCount = UnqualifiedCount + 1;
TotalUnqualifiedCount = TotalUnqualifiedCount + lj. Total_Days_in_same_Status__c;
}
wrapLead wl = new wrapLead();
wl.LeadName = lj. Name;
wl.prevStatus = lj.LeadPrevious_Status__c;
wl.CurrStatus =lj. Lead_Current_Status__c;
wl.leadsource = lj.lead_sources__c;
wl.totalDays = lj. Total_Days_in_same_Status__c;
wrapList.add(wl);
}
if(wrapList.size() > 0){
if(showHideTable== false){
showHideTable = true;
}else if( showHideTable == true){
showHideTable= false;
}
}
if(openCount!=0){
openCountRecord = openCount;
}else{
openCountRecord = 0;
}
if(CallBackCount!=0){
CallBackCountRecord = CallBackCount;
}else{
CallBackCountRecord = 0;
}
if(ContactedCount!=0){
ContactedCountRecord = ContactedCount;
}else{
ContactedCountRecord = 0;
}
if(FirmCount!=0){
FirmCountRecord = FirmCount;
}else{
FirmCountRecord = 0;
}
if(LostCount!=0){
LostCountRecord = LostCount;
}else{
LostCountRecord = 0;
}
if(NotIntrestedCount!= 0){
NotIntrestedCountRecord = NotIntrestedCount;
}else{
NotIntrestedCountRecord =0;
}
if(OthersCount!=0){
OthersCountRecord = OthersCount;
}else{
OthersCountRecord = 0;
}
if(QualifiedCount!=0){
QualifiedCountRecord = QualifiedCount;
}else{
QualifiedCountRecord = 0;
}
if(UnqualifiedCount!= 0){
UnqualifiedCountRecord = UnqualifiedCount;
}else{
UnqualifiedCountRecord = 0;
}
if(TotalOpenCount != 0 && openCount !=0){
openCountWrap = ( TotalOpenCount/openCount). setScale(2);
// stagenameslist. add(openCountWrap);
mapofstageswithdata.put('open' ,openCountWrap);
mapofStatuscount. put('open',openCount);
system.debug(' inside open openCountWrap'+ openCountWrap);
}else{
openCountWrap = 0;
}
if(TotalCallBackCount != 0 && CallBackCount !=0){
CallBackCountWrap = (TotalCallBackCount/ CallBackCount).setScale(2);
// stagenameslist. add(CallBackCountWrap );
mapofstageswithdata.put(' CallBack',CallBackCountWrap );
mapofStatuscount. put('CallBack',CallBackCount);
}else{
CallBackCountWrap = 0;
}
if( TotalContactedCount != 0 && ContactedCount !=0){
ContactedCountWrap = ( TotalContactedCount/ ContactedCount).setScale(2);
// stagenameslist. add(ContactedCountWrap );
mapofstageswithdata.put(' Contacted',ContactedCountWrap );
mapofStatuscount. put('Contacted', ContactedCount );
}else{
ContactedCountWrap = 0;
}
if(TotalFirmCount != 0 && FirmCount !=0){
FirmCountWrap = ( TotalFirmCount/FirmCount). setScale(2);
// stagenameslist. add(FirmCountWrap );
mapofstageswithdata.put('Firm Enquiry',FirmCountWrap );
mapofStatuscount. put('Firm Enquiry',FirmCount);
}else{
FirmCountWrap = 0;
}
if(TotalLostCount != 0 && LostCount !=0){
LostCountWrap = ( TotalLostCount/LostCount). setScale(2);
// stagenameslist. add(LostCountWrap );
mapofstageswithdata.put('Lost' ,LostCountWrap );
mapofStatuscount. put('Lost',LostCount);
}else{
LostCountWrap = 0;
}
if( TotalNotIntrestedCount != 0 && NotIntrestedCount !=0){
NotIntrestedCountWrap = ( TotalNotIntrestedCount/ NotIntrestedCount).setScale(2) ;
// stagenameslist. add(NotIntrestedCountWrap );
mapofstageswithdata.put('Not Interested', NotIntrestedCountWrap );
mapofStatuscount. put('Not Interested', NotIntrestedCount);
}else{
NotIntrestedCountWrap = 0;
}
if(TotalOthersCount != 0 && OthersCount !=0){
OthersCountWrap = (TotalOthersCount/OthersCount) .setScale(2);
// stagenameslist. add(OthersCountWrap );
mapofstageswithdata.put(' Others',OthersCountWrap );
mapofStatuscount. put('Others',OthersCount);
}else{
OthersCountWrap = 0;
}
if( TotalQualifiedCount != 0 && QualifiedCount !=0){
QualifiedCountWrap = ( TotalQualifiedCount/ QualifiedCount).setScale(2);
// stagenameslist. add(QualifiedCountWrap );
mapofstageswithdata.put(' Qualified',QualifiedCountWrap );
mapofStatuscount. put('Qualified', QualifiedCount);
}else{
QualifiedCountWrap = 0;
}
if( TotalUnqualifiedCount != 0 && UnqualifiedCount !=0){
UnqualifiedCountWrap = ( TotalUnqualifiedCount/ UnqualifiedCount).setScale(2);
mapofstageswithdata.put(' Unqualified', UnqualifiedCountWrap );
mapofStatuscount. put('Unqualified', UnqualifiedCount);
}else{
UnqualifiedCountWrap = 0;
}
for(String mapid: stagenamesmap.keyset()){
if( mapofstageswithdata. containskey(mapid)){
stagenameslist.add( mapofstageswithdata.get(mapid) );
}
else{
stagenameslist.add(null);
}
}
for(String mapid: stagenamesmap.keyset()){
if( mapofStatuscount.containskey( mapid)){
statuscountlist.add( mapofStatuscount.get(mapid));
system.debug(' ---------statuscountlist-----' +statuscountlist);
}
else{
statuscountlist.add(null);
system.debug(' ---------statuscountlist-----' +statuscountlist);
}
}
Wrapperclass w1=new Wrapperclass();
// w1.Name='Open count' +' '+String.valueof(openCount) ;
w1.data= stagenameslist;
wrapperlistdata.add( w1);
Wrapperclass w2=new Wrapperclass();
w2.Name='count'+' '+ String.valueof(openCount);
w2.data= statuscountlist;
wrapperlistdata.add( w2);
system.debug(' UnqualifiedCountWrap ------'+ UnqualifiedCountWrap );
stagenames=JSON. serializepretty( stagenameslist);
AllstagesData=JSON. serializepretty( wrapperlistdata);
system.debug(' AllstagesData***'+ AllstagesData);
}
public class wrapLead{
public String LeadName{get;set;}
public String prevStatus{get;set;}
public String CurrStatus{get;set;}
public String leadsource{get;set;}
public Decimal totalDays{get;set;}
public Decimal Avg{ get;set;}
}
public class Wrapperclass{
public list<decimal> data;
public String Name;
public String Name2;
public String callBackName;
public Wrapperclass(){
data=new list< decimal>();
Name='';
Name2='';
callBackName = '';
}
}
integer i = 0;
integer j = 1;
integer k = 0;
integer l = 1;
integer m = 0;
integer n = 1;
integer o = 0;
integer p = 1;
integer q = 0;
integer r = 1;
integer s = 0;
integer t = 1;
integer u = 0;
integer v = 1;
integer w = 0;
integer x = 1;
integer a = 0;
integer b = 1;
integer c = 0;
integer d = 0;
integer e = 0;
integer f = 1;
integer g = 1;
integer av = 2;
integer ad = 2;
integer ga = 1;
integer avd = 2;
integer ada = 2;
integer gd = 1;
integer adv = 2;
integer afd = 2;
integer gf = 1;
integer avg = 2;
integer adh = 2;
integer gt = 1;
integer arv = 2;
integer adw = 2;
}
Ceated By : Mohit Dwivedi(
Created Date :
Purpose : This
***************/
public class
public Date fromDate {get;
public Date toDate {get;
public Boolean
public List<wrapLead>
public Integer
public Integer
public Integer
public Integer
public Integer
public Integer
public Integer
public Integer
public Integer
public Decimal
public Decimal
public Decimal
public Decimal
public Decimal
public Decimal
public Decimal
public Decimal
public Decimal
public boolean
public boolean Flag{get;
public List<SelectOption>
public String
public list<Wrapperclass>
public string
public boolean showhide{
public String stagenames{
public
showHideTable2=false;
showhide=false;
showHideTable = false;
wrapList = new list<
wrapperlistdata =new
Set<String> sourceSet
LeadJunList = new
Schema.
List<Schema.
// displayLeadTable();
for( Schema.
{
sourceSet.add(f.
}
system.debug('--------
LeadJunList.add(new
//LeadJunList.add(new
for(String Source :
LeadJunList.add(
}
}
public void
showHideTable2=true;
showhide=true;
map<String,double>
map<String,double>
map<String,double>
list<Decimal>
list<Decimal>
wrapperlistdata.clear(
if(wrapList.size() >0)
wrapList.clear();
}
wrapList = new list<
wrapperlistdata =new
List<Lead_Junction__c>
Integer openCount = 0;
Integer CallBackCount
Integer
Integer FirmCount = 0;
Integer LostCount = 0;
Integer
Integer OthersCount =
Integer
Integer
Decimal
Decimal
Decimal
Decimal
Decimal
Decimal
Decimal
Decimal
Decimal
system.debug('--------
system.debug('--------
if(fromDate ==null &&
showHideTable =
flag =
}else if(fromDate !=
ljList = [SELECT
system.debug('----
}
if(test.isRunningTest(
ljList = [SELECT
}
for(Lead_Junction__c
if(lj.
openCount =
}
if(lj.
CallBackCount
}
if(lj.
}
if(lj.
FirmCount =
}
if(lj.
LostCount =
}
if(lj.
}
if(lj.
OthersCount =
}
if(lj.
}
if(lj.
}
wrapLead wl = new
wl.LeadName = lj.
wl.prevStatus =
wl.CurrStatus =lj.
wl.leadsource =
wl.totalDays = lj.
wrapList.add(wl);
}
if(wrapList.size() >
if(showHideTable==
showHideTable =
}else if(
}
}
if(openCount!=0){
openCountRecord =
}else{
openCountRecord =
}
if(CallBackCount!=0){
}else{
}
if(ContactedCount!=0){
}else{
}
if(FirmCount!=0){
FirmCountRecord =
}else{
FirmCountRecord =
}
if(LostCount!=0){
LostCountRecord =
}else{
LostCountRecord =
}
if(NotIntrestedCount!=
}else{
}
if(OthersCount!=0){
OthersCountRecord
}else{
OthersCountRecord
}
if(QualifiedCount!=0){
QualifiedCountRecord =
}else{
}
if(UnqualifiedCount!=
}else{
}
if(TotalOpenCount !=
openCountWrap = (
// stagenameslist.
mapofStatuscount.
system.debug('
}else{
openCountWrap = 0;
}
if(TotalCallBackCount
CallBackCountWrap
// stagenameslist.
mapofStatuscount.
}else{
CallBackCountWrap
}
if(
// stagenameslist.
mapofStatuscount.
}else{
}
if(TotalFirmCount !=
FirmCountWrap = (
// stagenameslist.
mapofStatuscount.
}else{
FirmCountWrap = 0;
}
if(TotalLostCount !=
LostCountWrap = (
// stagenameslist.
mapofStatuscount.
}else{
LostCountWrap = 0;
}
if(
// stagenameslist.
mapofStatuscount.
}else{
}
if(TotalOthersCount !=
OthersCountWrap =
// stagenameslist.
mapofStatuscount.
}else{
OthersCountWrap =
}
if(
// stagenameslist.
mapofStatuscount.
}else{
}
if(
mapofStatuscount.
}else{
}
for(String mapid:
if(
}
else{
}
}
for(String mapid:
if(
system.debug('
}
else{
system.debug('
}
}
Wrapperclass w1=new
// w1.Name='Open count'
w1.data=
wrapperlistdata.add(
Wrapperclass w2=new
w2.Name='count'+' '+
w2.data=
wrapperlistdata.add(
system.debug('
stagenames=JSON.
AllstagesData=JSON.
system.debug('
}
public class wrapLead{
public String
public String
public String
public String
public Decimal
public Decimal Avg{
}
public class Wrapperclass{
public list<decimal>
public String Name;
public String Name2;
public String
public Wrapperclass(){
data=new list<
Name='';
Name2='';
callBackName = '';
}
}
integer i = 0;
integer j = 1;
integer k = 0;
integer l = 1;
integer m = 0;
integer n = 1;
integer o = 0;
integer p = 1;
integer q = 0;
integer r = 1;
integer s = 0;
integer t = 1;
integer u = 0;
integer v = 1;
integer w = 0;
integer x = 1;
integer a = 0;
integer b = 1;
integer c = 0;
integer d = 0;
integer e = 0;
integer f = 1;
integer g = 1;
integer av = 2;
integer ad = 2;
integer ga = 1;
integer avd = 2;
integer ada = 2;
integer gd = 1;
integer adv = 2;
integer afd = 2;
integer gf = 1;
integer avg = 2;
integer adh = 2;
integer gt = 1;
integer arv = 2;
integer adw = 2;
}
============================== ======
test class:-
@isTest
private class leadReportController_Test{
@testSetup
static void setupTestData(){
test.startTest();
Lead lead_Obj = new Lead( LastName = 'LastName437', Company = 'Company787', Status = 'CallBack', IsConverted = false, IsUnreadByOwner = false, Is_ Neox_Lead__c = false, Function__c = 'Managing Director', Department__c = ' Purchasing', Contact_Source__ c = 'info email id');
Insert lead_Obj;
Lead_Junction__c lead_ junction_Obj = new Lead_ Junction__c(Name = 'Name381', CurrencyIsoCode = 'INR', Lead_ Name__c = lead_Obj.id, LeadPrevious_Status__c = ' Open', Lead_Current_Status__c = 'CallBack', Total_Days_in_ same_Status__c = 16, lead_ sources__c = 'Advertisement');
Insert lead_junction_Obj;
test.stopTest();
}
static testMethod void test_ displayLeadTable_UseCase1(){
List<Lead_Junction__c> lead_junction_Obj = [SELECT Id,Name,CurrencyIsoCode, CreatedDate,CreatedById,Lead_ Name__c,LeadPrevious_Status__ c,Lead_Current_Status__c, Total_Days_in_same_Status__c, lead_sources__c from Lead_ Junction__c];
System.assertEquals(true, lead_junction_Obj.size()>0);
List<Lead> lead_Obj = [ SELECT Company,Status, IsConverted,IsUnreadByOwner, Is_Neox_Lead__c,Function__c, Department__c,Contact_Source__ c from Lead];
System.assertEquals(true, lead_Obj.size()>0);
test.startTest();
leadReportController obj01 = new leadReportController();
obj01.fromDate = Date. today();
obj01.toDate = Date.today( ).addDays(3);
obj01.showHideTable = false;
obj01.wrapList = new List< leadReportController.wrapLead> ();
obj01.openCountRecord = 10;
obj01.CallBackCountRecord = 10;
obj01. ContactedCountRecord = 10;
obj01.FirmCountRecord = 10;
obj01.LostCountRecord = 10;
obj01. NotIntrestedCountRecord = 10;
obj01.OthersCountRecord = 10;
obj01. QualifiedCountRecord = 10;
obj01. UnqualifiedCountRecord = 10;
obj01.openCountWrap = 10;
obj01.CallBackCountWrap = 10;
obj01.ContactedCountWrap = 10;
obj01.FirmCountWrap = 10;
obj01.LostCountWrap = 10;
obj01. NotIntrestedCountWrap = 10;
obj01.OthersCountWrap = 10;
obj01.QualifiedCountWrap = 10;
obj01. UnqualifiedCountWrap = 10;
obj01.showhidetable2 = false;
obj01.Flag = false;
obj01.LeadJunList = new List<SelectOption>();
obj01.selectedSource = ' test data';
obj01.AllstagesData = ' test data';
obj01.showhide = false;
obj01.displayLeadTable();
leadReportController. wrapLead obj321 = new leadReportController.wrapLead( );
test.stopTest();
}
static testMethod void test_Wrapperclass(){
List<Lead_Junction__c> lead_junction_Obj = [SELECT Id,Name,CurrencyIsoCode, CreatedDate,CreatedById,Lead_ Name__c,LeadPrevious_Status__ c,Lead_Current_Status__c, Total_Days_in_same_Status__c, lead_sources__c from Lead_ Junction__c];
System.assertEquals(true, lead_junction_Obj.size()>0);
List<Lead> lead_Obj = [ SELECT Company,Status, IsConverted,IsUnreadByOwner, Is_Neox_Lead__c,Function__c, Department__c,Contact_Source__ c from Lead];
System.assertEquals(true, lead_Obj.size()>0);
leadReportController obj01 = new leadReportController();
obj01.fromDate = Date. today();
obj01.toDate = Date.today( );
obj01.showHideTable = false;
obj01.wrapList = new List< leadReportController.wrapLead> ();
obj01.openCountRecord = 10;
obj01.CallBackCountRecord = 10;
obj01. ContactedCountRecord = 10;
obj01.FirmCountRecord = 10;
obj01.LostCountRecord = 10;
obj01. NotIntrestedCountRecord = 10;
obj01.OthersCountRecord = 10;
obj01. QualifiedCountRecord = 10;
obj01. UnqualifiedCountRecord = 10;
obj01.openCountWrap = 10;
obj01.CallBackCountWrap = 10;
obj01.ContactedCountWrap = 10;
obj01.FirmCountWrap = 10;
obj01.LostCountWrap = 10;
obj01. NotIntrestedCountWrap = 10;
obj01.OthersCountWrap = 10;
obj01.QualifiedCountWrap = 10;
obj01. UnqualifiedCountWrap = 10;
obj01.showhidetable2 = false;
obj01.Flag = false;
obj01.LeadJunList = new List<SelectOption>();
obj01.selectedSource = ' test data';
obj01.AllstagesData = ' test data';
obj01.showhide = false;
leadReportController. Wrapperclass obj391 = new leadReportController. Wrapperclass();
}
}
private class
@testSetup
static void setupTestData(){
test.startTest();
Lead lead_Obj = new Lead(
Insert lead_Obj;
Lead_Junction__c lead_
Insert lead_junction_Obj;
test.stopTest();
}
static testMethod void test_
List<Lead_Junction__c>
System.assertEquals(true,
List<Lead> lead_Obj = [
System.assertEquals(true,
test.startTest();
leadReportController
obj01.fromDate = Date.
obj01.toDate = Date.today(
obj01.showHideTable =
obj01.wrapList = new List<
obj01.openCountRecord =
obj01.CallBackCountRecord
obj01.
obj01.FirmCountRecord =
obj01.LostCountRecord =
obj01.
obj01.OthersCountRecord =
obj01.
obj01.
obj01.openCountWrap = 10;
obj01.CallBackCountWrap =
obj01.ContactedCountWrap =
obj01.FirmCountWrap = 10;
obj01.LostCountWrap = 10;
obj01.
obj01.OthersCountWrap =
obj01.QualifiedCountWrap =
obj01.
obj01.showhidetable2 =
obj01.Flag = false;
obj01.LeadJunList = new
obj01.selectedSource = '
obj01.AllstagesData = '
obj01.showhide = false;
obj01.displayLeadTable();
leadReportController.
test.stopTest();
}
static testMethod void
List<Lead_Junction__c>
System.assertEquals(true,
List<Lead> lead_Obj = [
System.assertEquals(true,
leadReportController
obj01.fromDate = Date.
obj01.toDate = Date.today(
obj01.showHideTable =
obj01.wrapList = new List<
obj01.openCountRecord =
obj01.CallBackCountRecord
obj01.
obj01.FirmCountRecord =
obj01.LostCountRecord =
obj01.
obj01.OthersCountRecord =
obj01.
obj01.
obj01.openCountWrap = 10;
obj01.CallBackCountWrap =
obj01.ContactedCountWrap =
obj01.FirmCountWrap = 10;
obj01.LostCountWrap = 10;
obj01.
obj01.OthersCountWrap =
obj01.QualifiedCountWrap =
obj01.
obj01.showhidetable2 =
obj01.Flag = false;
obj01.LeadJunList = new
obj01.selectedSource = '
obj01.AllstagesData = '
obj01.showhide = false;
leadReportController.
}
}
============================== ============
Vf Page:-
<apex:page controller="leadReportController" showHeader="false" docType="HTML-5.0"> <head> <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style> <title></title> <link rel="stylesheet" href="https://kendo.cdn. telerik.com/2018.1.221/styles/ kendo.common-material.min.css" /> <link rel="stylesheet" href="https://kendo.cdn. telerik.com/2018.1.221/styles/ kendo.material.min.css" /> <link rel="stylesheet" href="https://kendo.cdn. telerik.com/2018.1.221/styles/ kendo.material.mobile.min.css" /> <script src="https://kendo.cdn. telerik.com/2018.1.221/js/ jquery.min.js"></script> <script src="https://kendo.cdn. telerik.com/2018.1.221/js/ kendo.all.min.js"></script> </head> <style> .table_design { margin-bottom: 41px; } .table_design td{ white-space: nowrap; } .graph_design { margin:auto; } .table_design { border-collapse: collapse; } .table_design th, .table_design td { border: 1px solid #ddd; padding: 8px; } .table_design tr:nth-child(even){background- color: #f2f2f2;} .table_design tr:hover {background-color: #ddd;} .table_design th { padding-top: 12px; padding-bottom: 12px; text-align: left; background-color: #e28702; color: white; } .table_design1 { border-collapse:collapse; border:none; font-size:14px; background-color: #e28702; margin-bottom:30px; } .table_design1 td { border:none; padding:20px; text-align:left; background-color: #e28702; color:white; } .table_design1 input, .table_design1 select { padding: 4px 7px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } .table_design1 .btn { background-color: white; border:1px solid #e28702; color: #e28702; padding: 6px 20px; margin: 8px 0; border: none; border-radius: 4px; cursor: pointer; } .orange_btn { background:#FF8939; border:none; } .green_btn { background:#B2B831; border:none; } .ali_center { margin:auto; width: 223px; margin-top: 20px; margin-bottom:20px; } .ml3 { margin-left:8px; font-size:14px; } </style> <apex:form id="myForm" > <table class="table_design1" border="1" align="center" width="80%" > <tr align="center"> <td><b>From Date</b> <apex:input type="date" id="fromDates" value="{!fromDate}" > <apex:actionSupport event="onchange" reRender="TableRecordId, TableRecordId2" /> </apex:input> </td> <td ><b>To Date</b> <apex:input type="date" id="toDates" value="{!toDate}" > <apex:actionSupport event="onchange" reRender="TableRecordId, TableRecordId2" /> </apex:input> </td> <td><b>Lead Source</b> <apex:selectList value="{!selectedSource}" size="1"> <apex:actionSupport event="onchange" reRender="TableRecordId, TableRecordId2"/> <apex:selectOptions value="{!LeadJunList}"/> </apex:selectList> </td> <td > <apex:commandButton value="Run Report" action="{!displayLeadTable}" oncomplete="createChart();" reRender="TableRecordId, TableRecordId2,kendochartid"/> </td> <td> <apex:commandButton value="Show/Hide Detail" action="{!displayLeadTable}" reRender="TableRecordId, TableRecordId2"/></td> </tr> </table> <!-- <table class="table_design1" border="0" align="center" width="100" style=""> <tr align="center"> <td colspan="3"> <apex:commandButton value="Run Report" action="{!displayLeadTable}" oncomplete="createChart();" reRender="TableRecordId, TableRecordId2,kendochartid"/> </td> </tr> </table>--> <apex:outputPanel id="TableRecordId" > <apex:outputPanel id="innerTableDataId" rendered="{!showHideTable}" > <table class="table_design" width="80%" border="1" cellspacing="0" cellpadding="1" align="center" style=" border-bottom-style: none;font-family:Arial, Helvetica,sans-serif;font- size:10pt;color:#F08080;"> <tr > <th ><apex:outputText value="Previous Status" /></th> <th ><apex:outputText value="Current Status" /></th> <th ><apex:outputText value="Lead Source" /></th> <th ><apex:outputText value="Days to Change" /></th> </tr> <apex:repeat value="{!wrapList}" var="leadValue"> <tr > <td><apex:outputText value="{!leadValue.prevStatus} " /></td> <td><apex:outputText value="{!leadValue.CurrStatus} " /></td> <td><apex:outputText value="{!leadValue.leadsource} " /></td> <td><apex:outputText value="{!leadValue.totalDays}" /></td> </tr> </apex:repeat> </table> </apex:outputPanel> </apex:outputPanel> <apex:outputPanel id="TableRecordId2" > <apex:outputPanel rendered="{!showHideTable2 }" > <table class="table_design" width="80%" border="1" cellspacing="0" cellpadding="1" align="center" style=" border-bottom-style: none;font-family:Arial, Helvetica,sans-serif;font- size:10pt;color:#F08080;" > <tr > <th ><apex:outputText value="Previous Status" /></th> <th ><apex:outputText value="Average Days" /></th> <th ><apex:outputText value="Total Record Count" /></th> </tr> <tr > <td><apex:outputText value="Open" /></td> <td><apex:outputText value="{!openCountWrap}" /></td> <td><apex:outputText value="{!openCountRecord}" /></td> </tr> <tr> <td><apex:outputText value="CallBack" /></td> <td><apex:outputText value="{!CallBackCountWrap}" /></td> <td><apex:outputText value="{!CallBackCountRecord}" /></td> </tr> <tr > <td><apex:outputText value="Contacted" /></td> <td><apex:outputText value="{!ContactedCountWrap}" /></td> <td><apex:outputText value="{!ContactedCountRecord} " /></td> </tr> <tr> <td><apex:outputText value="Firm Enquiry" /></td> <td><apex:outputText value="{!FirmCountWrap}" /></td> <td><apex:outputText value="{!FirmCountRecord}" /></td> </tr> <tr > <td><apex:outputText value="Lost" /></td> <td><apex:outputText value="{!LostCountWrap}" /></td> <td><apex:outputText value="{!LostCountRecord}" /></td> </tr> <tr> <td><apex:outputText value="Not Interested" /></td> <td><apex:outputText value="{! NotIntrestedCountWrap}" /></td> <td><apex:outputText value="{! NotIntrestedCountRecord}" /></td> </tr> <tr > <td><apex:outputText value="Others" /></td> <td><apex:outputText value="{!OthersCountWrap}" /></td> <td><apex:outputText value="{!OthersCountRecord}" /></td> </tr> <tr > <td><apex:outputText value="Qualified" /></td> <td><apex:outputText value="{!QualifiedCountWrap}" /></td> <td><apex:outputText value="{!QualifiedCountRecord} " /></td> </tr> <tr > <td><apex:outputText value="Unqualified" /></td> <td><apex:outputText value="{!UnqualifiedCountWrap} " /></td> <td><apex:outputText value="{! UnqualifiedCountRecord}" /></td> </tr> </table> </apex:outputPanel> </apex:outputPanel> <apex:outputPanel id="kendochartid"> <apex:outputPanel rendered="{!showhide}" > <!-- AllstagesData:{!AllstagesData} showhide {!showhide} --> <script> function createChart() { //alert('enetered'); $("#chart").kendoChart({ title: { text: "Lead Age Report" }, seriesDefaults: { type: "column", labels: { visible: true, background: "transparent", position: "top", } }, legend: { visible: true, position: "right" }, series:{!AllstagesData}, valueAxis: { // max: 50, line: { visible: false }, minorGridLines: { visible: false }, labels: { rotation: "auto" } }, categoryAxis: { categories: ["Open","CallBack","Contacted" , "Firm Enquiry", "Lost", "Not Interested", "Others", "Qualified", "Unqualified"], majorGridLines: { visible: true } }, tooltip: { // visible: true, // template: "#= series.callBackName#:#= series.Name#" } }); } $(document).bind("kendo: skinChange", createChart); </script> <div id="chart" align="center" style="width: 1000px; height: 400px" class="graph_design"> </div> <div class="ali_center"> <input type="button" class="orange_btn"/><span class="ml3">Average Age</span> <input type="button" class="green_btn"/><span class="ml3">Record Count</span> </div> </apex:outputPanel> </apex:outputPanel> </apex:form> </apex:page>