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;
}
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.
}
}
<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>