Commit 0e55d9bd authored by vvengurlekar's avatar vvengurlekar

Changed business logic as per requirement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@43479 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 634ff7bb
...@@ -47,7 +47,8 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi ...@@ -47,7 +47,8 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi
connDriver = new ConnDriver(); connDriver = new ConnDriver();
conn = connDriver.getConnectDB(dataSourceName); conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; connDriver = null;
df = new DecimalFormat("#.##"); //df = new DecimalFormat("#.##");
df = new DecimalFormat("#.#");
toDate = checkNull(toDate); toDate = checkNull(toDate);
fromDate = checkNull(fromDate); fromDate = checkNull(fromDate);
zonewiseDataMap = new LinkedHashMap<String, StringBuffer>(); zonewiseDataMap = new LinkedHashMap<String, StringBuffer>();
...@@ -125,20 +126,20 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi ...@@ -125,20 +126,20 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi
monthValSumArray[0] = Double.parseDouble(monthlyCount); monthValSumArray[0] = Double.parseDouble(monthlyCount);
monthValSumArray[1] = Double.parseDouble(coachDaysPerc); monthValSumArray[1] = Double.parseDouble(coachDaysPerc);
monthDataMap.put(monthName, monthValSumArray); monthDataMap.put(monthName, monthValSumArray);
monthBuffer.append("<td class='cardSalesPersonTitlehtml' align='center' width='14%' colspan = '2'>"+monthName+"' "+ytdYear+"</td>"); monthBuffer.append("<td class='cardSalesPersonTitlehtml' align='center' width='14%' colspan = '2'>"+monthName+" ' "+ytdYear+"</td>");
headingBuffer.append(coachDayAndTimeHeading); headingBuffer.append(coachDayAndTimeHeading);
} }
if (zonewiseDataMap.containsKey(zoneName)) if (zonewiseDataMap.containsKey(zoneName))
{ {
zoneValueBuffer = zonewiseDataMap.get(zoneName); zoneValueBuffer = zonewiseDataMap.get(zoneName);
zoneValueBuffer.append("<td align='right' width='7%' style='padding-right: 5px;'>"+monthlyCount+"</td>"+"<td width='7%' style = 'padding-left: 0px;'>"+getcolorDotFromValue(Double.parseDouble(coachDaysPerc),df)+"</td>"); zoneValueBuffer.append("<td align='right' width='7%' style='padding-right: 5px;'>"+dfFormatter(Double.parseDouble(monthlyCount))+"</td>"+"<td width='7%' style = 'padding-left: 0px;'>"+getcolorDotFromValue(Double.parseDouble(coachDaysPerc),df)+"</td>");
zonewiseDataMap.put(zoneName, zoneValueBuffer); zonewiseDataMap.put(zoneName, zoneValueBuffer);
} }
else else
{ {
zoneValueBuffer = new StringBuffer(); zoneValueBuffer = new StringBuffer();
zoneValueBuffer.append("<td align='right' width='7%' style='padding-right: 5px;'>"+monthlyCount+"</td>"+"<td width='7%' style = 'padding-left: 0px;'>"+getcolorDotFromValue(Double.parseDouble(coachDaysPerc),df)+"</td>"); zoneValueBuffer.append("<td align='right' width='7%' style='padding-right: 5px;'>"+dfFormatter(Double.parseDouble(monthlyCount))+"</td>"+"<td width='7%' style = 'padding-left: 0px;'>"+getcolorDotFromValue(Double.parseDouble(coachDaysPerc),df)+"</td>");
zonewiseDataMap.put(zoneName, zoneValueBuffer); zonewiseDataMap.put(zoneName, zoneValueBuffer);
} }
noOfRows++; noOfRows++;
...@@ -146,7 +147,7 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi ...@@ -146,7 +147,7 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi
if(noOfRows > 0){ if(noOfRows > 0){
finalBuffer.append("<tr><td class='cardSalesPersonTitlehtml' rowspan = '2' width='15%'>ZONE</td>"+monthBuffer.toString()+" <td class='cardSalesPersonTitlehtml' align='center' width='14%' colspan = '2'>"+"YTD "+"' "+ytdYear+"</td></tr>"); finalBuffer.append("<tr><td class='cardSalesPersonTitlehtml' rowspan = '2' width='15%'>ZONE</td>"+monthBuffer.toString()+" <td class='cardSalesPersonTitlehtml' align='center' width='14%' colspan = '2'>"+"YTD "+" ' "+ytdYear+"</td></tr>");
finalBuffer.append("<tr>"+headingBuffer.toString()+coachDayAndTimeHeading+"</tr>"); finalBuffer.append("<tr>"+headingBuffer.toString()+coachDayAndTimeHeading+"</tr>");
for (String key : zonewiseDataMap.keySet()) for (String key : zonewiseDataMap.keySet())
...@@ -173,7 +174,7 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi ...@@ -173,7 +174,7 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi
monthAvgValBuffer.append("<td class='cardHtmlTableBodyAlignRgt' width='7%' background-color='antiquewhite' style='padding-right: 5px;'>"+monthAvg+"</td><td width='7%'style = 'padding-left: 0px;'>"+getcolorDotFromValue(Double.parseDouble(monthPercAvg),df)+"</td>"); monthAvgValBuffer.append("<td class='cardHtmlTableBodyAlignRgt' width='7%' background-color='antiquewhite' style='padding-right: 5px;'>"+monthAvg+"</td><td width='7%'style = 'padding-left: 0px;'>"+getcolorDotFromValue(Double.parseDouble(monthPercAvg),df)+"</td>");
} }
finalBuffer.append("<tr><td class='cardSalesPersonTitlehtml' width='15%'>ALL INDIA</td>"+monthAvgValBuffer.toString()+"<td class='cardHtmlTableBodyAlignRgt' width='7%' style='padding-right: 5px;'>"+df.format(allIndiaYtdSum/monthDataMap.size())+"</td><td width='7%' style = 'padding-left: 0px;'>"+getcolorDotFromValue(allIndiaYtdPercSum/monthDataMap.size(),df)+"</td></tr>"); finalBuffer.append("<tr><td class='cardSalesPersonTitlehtml' width='15%'>ALL INDIA</td>"+monthAvgValBuffer.toString()+"<td class='cardHtmlTableBodyAlignRgt' width='7%' style='padding-right: 5px;'>"+dfFormatter(allIndiaYtdSum/monthDataMap.size())+"</td><td width='7%' style = 'padding-left: 0px;'>"+getcolorDotFromValue(allIndiaYtdPercSum/monthDataMap.size(),df)+"</td></tr>");
rowData = new JSONObject(); rowData = new JSONObject();
rowDataZonewiseCoachingJson = new JSONObject(); rowDataZonewiseCoachingJson = new JSONObject();
...@@ -233,7 +234,7 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi ...@@ -233,7 +234,7 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi
} }
else { else {
double couchingDaysPerc = (daysInFieldVal/avlDayInFieldVal)*100; double couchingDaysPerc = (daysInFieldVal/avlDayInFieldVal)*100;
couchingDaysPercStr = df.format(couchingDaysPerc) ; couchingDaysPercStr = dfFormatter(couchingDaysPerc) ;
} }
return couchingDaysPercStr; return couchingDaysPercStr;
} }
...@@ -286,16 +287,38 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi ...@@ -286,16 +287,38 @@ public class ZonewiseCoachingDays extends ValidatorEJB implements ZonewiseCoachi
String valueWithImage = ""; String valueWithImage = "";
if(columnValue >= 70) if(columnValue >= 70)
{ {
valueWithImage = "<table width = '100%'><tbody><tr><td align=' center' style=' width: 40%; border-style: hidden; '>"+"<img src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/green.png'/></td><td align='right' style=' width: 56%; border-style: hidden; '>"+" "+df.format(columnValue)+"</td></tr></tbody></table>"; valueWithImage = "<table width = '100%'><tbody><tr><td align=' center' style=' width: 40%; border-style: hidden; '>"+"<img src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/green.png'/></td><td align='right' style=' width: 56%; border-style: hidden; '>"+" "+dfFormatter(columnValue)+"</td></tr></tbody></table>";
} }
else if(columnValue < 70 && columnValue >= 60) else if(columnValue < 70 && columnValue >= 60)
{ {
valueWithImage = "<table width = '100%'><tbody><tr><td align=' center' style=' width: 40%; border-style: hidden; '>"+"<img src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/yellow.png'/></td><td align='right' style=' width: 56%; border-style: hidden; '>"+" "+df.format(columnValue)+"</td></tr></tbody></table>"; valueWithImage = "<table width = '100%'><tbody><tr><td align=' center' style=' width: 40%; border-style: hidden; '>"+"<img src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/yellow.png'/></td><td align='right' style=' width: 56%; border-style: hidden; '>"+" "+dfFormatter(columnValue)+"</td></tr></tbody></table>";
} }
else if(columnValue < 60) else if(columnValue < 60)
{ {
valueWithImage = "<table width = '100%'><tbody><tr><td align=' center' style=' width: 40%; border-style: hidden; '>"+"<img src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/red.png'/></td><td align='right' style=' width: 56%; border-style: hidden; '>"+" "+df.format(columnValue)+"</td></tr></tbody></table>"; valueWithImage = "<table width = '100%'><tbody><tr><td align=' center' style=' width: 40%; border-style: hidden; '>"+"<img src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/red.png'/></td><td align='right' style=' width: 56%; border-style: hidden; '>"+" "+dfFormatter(columnValue)+"</td></tr></tbody></table>";
} }
return valueWithImage; return valueWithImage;
} }
private String dfFormatter(double columnValue)
{
DecimalFormat df1 =new DecimalFormat("#.0");
String average="";
if(columnValue>0)
{
if(columnValue>1)
{
average=df1.format(columnValue);
}
else
{
average = "0"+df1.format(columnValue);
}
}
else
{
average=columnValue+"";
}
return average;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment