Commit c0f43ede authored by bpandey's avatar bpandey

Change the lable as work Plane


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96299 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 65e9c5a2
<%@page contentType="text/html"%>
<%@page import="javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.DocumentBuilder,org.w3c.dom.*"%>
<%@page import="javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.DocumentBuilder,org.w3c.dom.*"%>
<%@page import="ibase.dashboard.mfg.bean.*"%>
<%@page import="javax.naming.Context"%>
<%@page import="org.w3c.dom.Node"%>
......@@ -11,7 +11,6 @@
<%@page import="java.util.ArrayList"%>
<%@page errorPage="error.jsp"%>
<%@ page import="java.io.File,ibase.utility.CommonConstants" %>
<%@page import="java.text.SimpleDateFormat"%>
<jsp:useBean id="productionVsBudgetBean" scope="request" class="ibase.dashboard.mfg.bean.ProductionVsBudgetReportBean" />
......@@ -23,25 +22,25 @@
NodeList childNodeList = null;
Node currDetail = null;
ArrayList<String> chartDataList = null;
List<String> geoLocList = new ArrayList<String>();
List<String> unitFormList = new ArrayList<String>();
List<String> geoLocList = null;
List<String> unitFormList = null;
String childNodeName = "";
String period = "";
String netsales = "";
String amount = "";
String fin_entity = "";
StringBuffer chartData = null;
String xmlDataString = "";
String selectedEntity = "";
String entity = "", descr = "";
String user = "TA821";
String rptTitle = "";
String srcJSPath = "";
String srcImagesPath = "";
String srcImagesPath = "";
Calendar calendar = null;
String frmDate = "";
String toDate = "", unitForm = "";
String dayQty = "", fldValue = "", fldDescr;
String dayQty = "", fldValue = "";
String fldDescr="",unitDescr="";
NodeList locationList = null;
NodeList detailList = null;
NodeList unitList = null;
......@@ -54,27 +53,43 @@
Node dayNode = null;
Node foreCastNode = null;
String date = "";
int lastDayOfMonth = 0;
int lastDayOfMonth = 0;
int todaysDay = 0;
String month = "";
int preyear = 0;
int year = 0;
int month = 0;
int preyear = 0;
int preyearVal = 0;
int year = 0;
int curryearVal =0;
int currmonthVal =0;
String[] geo_loc = null;
String[] unit_form = null;
String unitFrmXml = "";
String geoLocCodeXml = "";
String xmlDataString ="";
String checkGeoLoc = "";
String checkUnitForm = "";
List<String> sumDayPro = new ArrayList<String>();
List<String> cumLstYear = new ArrayList<String>();
List<Double> cumuQty = new ArrayList<Double>();
List<String> LBEList = new ArrayList<String>();
List<String> sumDayPro = null;
List<String> cumLstYear = null;
List<Double> cumuQty = null;
List<String> LBEList = null;
SimpleDateFormat simpleDateFormat = null;
Double cumulativePro = 0.0, cumuQtyInDoubl = 0.0, cumLstYearInDouble = 0.0, lbeInDouble = 0.0;
String cumulativeProStr = "", cumuQtyStr = "", cumLstYearStr = "", lbeValStr = "";
Double cumulativePro = 0.0;
Double cumuQtyInDoubl = 0.0;
Double cumLstYearInDouble = 0.0;
Double lbeInDouble = 0.0;
String cumulativeProStr = "";
String cumuQtyStr = "";
String cumLstYearStr = "";
String lbeValStr = "";
//11/11/2013
String[] seclectYear = null;
String[] seclectMonth = null;
String monthStr="";
int day=1;
//28/11/2013
int deviceDisplay=0;
int deviceFilter=0;
%>
<%
......@@ -82,123 +97,66 @@
response.setHeader("Cache-Control", "no-store, no-cache,must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
%>
<%
String userAgent = request.getHeader("user-agent");
System.out.println("userAgent ==" + userAgent);
if (userAgent.indexOf("Android") > 0 || userAgent.indexOf("iPhone") > 0 || userAgent.indexOf("iPad") > 0)
{
srcJSPath = "ibase/FusionChart/js/FusionCharts.js";
srcImagesPath = "ibase/FusionChart/images/MSCombi3D.swf";
} else
if (userAgent.indexOf("Android") > 0 || userAgent.indexOf("iPhone") > 0 )
{
srcJSPath = "/ibase/FusionChart/js/FusionCharts.js";
srcJSPath = "/ibase/FusionChart/js/FusionCharts.js";
srcImagesPath = "/ibase/FusionChart/images/MSCombi3D.swf";
System.out.println("srcJSPath ==" + srcJSPath);
System.out.println("srcImagesPath ==" + srcImagesPath);
System.out.println("userAgent for iPhone==" + userAgent);
deviceDisplay =1;
deviceFilter =3;
}
else if (userAgent.indexOf("Android") > 0 || userAgent.indexOf("iPad") > 0)
{
System.out.println("userAgent For iPad==" + userAgent);
deviceDisplay =2;
deviceFilter =3;
}
else
{
srcJSPath = "/ibase/FusionChart/js/FusionCharts.js";
srcImagesPath = "/ibase/FusionChart/images/MSCombi3D.swf";
System.out.println("userAgent for PC ==" + userAgent);
deviceDisplay =3;
deviceFilter =1;
System.out.println("srcJSPath =="+srcJSPath+"srcImagesPath==="+srcImagesPath);
}
%>
<%@page import="java.util.ArrayList"%><html>
<html>
<head>
<style type="text/css">
.tdLabel {
FONT-FAMILY: Arial;
font-size: 12pt;
}
.title {
FONT-FAMILY: Arial;
font-size: 14pt;
}
.combox {
border-radius: 5px;
width: 1000px;
align: center;
background-color: #F5F5F5;
}
.headerTable {
height: 50px;
width: 100px;
border: 1;
align: center;
}
.headerTr {
background-color: green;
height: 30px;
font-size: 7pt;
}
.detailTr {
background-color: yellow;
height: 20px;
font-size: 7pt;
}
</style>
<script type="text/javascript" src="<%=srcJSPath%>"></script>
<link rel="stylesheet" type="text/css"
href="/ibase/dashboard/mfg/css/ui.dropdownchecklist.css" />
<script type="text/javascript"
src="/ibase/dashboard/mfg/jquery/jquery.js"></script>
<script type="text/javascript"
src="/ibase/dashboard/mfg/jquery/ui.core.js"></script>
<script type="text/javascript"
src="/ibase/dashboard/mfg/jquery/ui.dropdownchecklist.js"></script>
<link rel="stylesheet" type="text/css" href="/ibase/dashboard/mfg/css/ui.dropdownchecklist.standalone.css" />
<link rel="stylesheet" type="text/css" href="/ibase/dashboard/mfg/css/mfg.css" />
<script type="text/javascript" src="/ibase/dashboard/mfg/jquery/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="/ibase/dashboard/mfg/jquery/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="/ibase/dashboard/mfg/jquery/ui.dropdownchecklist-1.4-min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
$("#geo_loc").dropdownchecklist({ firstItemChecksAll: true, maxDropHeight: 100 });
$("#geo_loc").dropdownchecklist({ firstItemChecksAll: true, maxDropHeight: 100 ,emptyText: "Select ..."});
});
$(document).ready(function(){
$("#unit_form").dropdownchecklist({ firstItemChecksAll: true, maxDropHeight: 100 });
$("#unit_form").dropdownchecklist({ firstItemChecksAll: true, maxDropHeight: 100,emptyText: "Select ..."});
});
$(document).ready(function(){
$("#acct_year").dropdownchecklist({emptyText: "For previous." });
});
$(document).ready(function(){
$("#acct_month").dropdownchecklist({emptyText: "For previous." });
});
function getData(location,unitForm)
{
var element = document.getElementById("geo_loc");
var location =location.split(",");
for(i=0;i<location.length;i++)
{
for (var j = 0; j < element.options.length; j++)
{
var checkLoc= "'"+element.options[j].value+"'";
if(checkLoc== location[i])
{
element.options[j].selected = true;
}
}
}
var elementForm = document.getElementById("unit_form");
var unitForm =unitForm.split(",");
for(k=0;k <unitForm.length;k++)
{
for (var l = 0; l < elementForm.options.length; l++)
{
var checkUnit= "'"+elementForm.options[l].value+"'";
if(checkUnit== unitForm[k])
{
elementForm.options[l].selected = true;
}
}
}
}
//function for validation on change 27/11/2013
function isLocationSelected()
{
if (document.getElementById("geo_loc").selectedIndex == -1 )
......@@ -206,8 +164,11 @@ function isLocationSelected()
alert("Please select at least one Location code");
return false;
}
else if(document.getElementById("unit_form").selectedIndex==-1)
{
{
alert("Please select at least one Unit Form");
return false;
}
......@@ -222,46 +183,94 @@ function isLocationSelected()
{
//ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean)session.getAttribute("USER_INFO");
simpleDateFormat = new SimpleDateFormat("dd-MMM-yy");
calendar = Calendar.getInstance();
preyear = calendar.get(Calendar.YEAR) - 1;
year = calendar.get(Calendar.YEAR);
month = new SimpleDateFormat("MMM").format(calendar.getTime());
calendar = Calendar.getInstance();
preyear = calendar.get(Calendar.YEAR) - 1;
preyearVal = calendar.get(Calendar.YEAR) - 1;
month = calendar.get(Calendar.MONTH)+1 ;
currmonthVal = calendar.get(Calendar.MONTH)+1;
year = calendar.get(Calendar.YEAR);
curryearVal = calendar.get(Calendar.YEAR);
//out.println("Testing Month==="+month);
String currDate = simpleDateFormat.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
toDate = simpleDateFormat.format(calendar.getTime());
//out.print("max day ="+calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
//out.print("min day ="+calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
calendar = Calendar.getInstance();
toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
frmDate = simpleDateFormat.format(calendar.getTime());
todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
lastDayOfMonth = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
frmDate = simpleDateFormat.format(calendar.getTime());
todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
lastDayOfMonth = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
//frmDate = "01-apr-12";
//toDate = "30-apr-12";
rptTitle = "Production Vs Budget Report - " + currDate;
unitFrmXml = productionVsBudgetBean.getUnitFormXmlData();
geoLocCodeXml = productionVsBudgetBean.getGeoLoCodeXmlData();
//new code added by Birendra Pandey It is VIMP
seclectYear = request.getParameterValues("acct_year");
seclectMonth = request.getParameterValues("acct_month");
if(seclectYear!=null && seclectMonth!=null)
{
year = Integer.parseInt(seclectYear[0]);
month = Integer.parseInt(seclectMonth[0]);
preyear = year - 1;
if(month==1)
monthStr="Jan";
else if(month==2)
monthStr="Feb";
else if(month==3)
monthStr="Mar";
else if(month==4)
monthStr="Apr";
else if(month==5)
monthStr="May";
else if(month==6)
monthStr="Jun";
else if(month==7)
monthStr="Jul";
else if(month==8)
monthStr="Aug";
else if(month==9)
monthStr="Sep";
else if(month==10)
monthStr="Oct";
else if(month==11)
monthStr="Nov";
else if(month==12)
monthStr="Dec";
//ADD-------1St of month and last of month
calendar =Calendar.getInstance();
calendar.set(year, month-1, day);
frmDate = simpleDateFormat.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
toDate = simpleDateFormat.format(calendar.getTime());
lastDayOfMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
//End of -------1St of month and last of month
currDate =todaysDay+"-"+monthStr+"-"+seclectYear[0];
//out.println("frmDate===="+frmDate+"To Date====="+toDate);
//out.println("lastDayOfMonth for selected "+lastDayOfMonth);
}
//End by Birendra Pandey
rptTitle = "Production Vs Budget Report For :" + currDate;
unitFrmXml = productionVsBudgetBean.getUnitFormXmlData();
geoLocCodeXml = productionVsBudgetBean.getGeoLoCodeXmlData();
System.out.println("rptTitle=====" + rptTitle);
%>
<form method="post" action="ProductionVsBudgetReport.jsp"
name="ProductionVsBudgetReport">
<table align="center">
<tr>
<td class="title"><%=rptTitle%></td>
</tr>
</table>
<form method="post" action="ProductionVsBudgetReport.jsp" name="ProductionVsBudgetReport">
<br>
<table class="combox">
<table class="dropdown">
<tr>
<td>Geo Location: <select id="geo_loc" name="geo_loc" multiple="multiple" size="5">
<%
<td class="tdLabel">
Location : <select id="geo_loc" name="geo_loc" multiple="multiple" size="5">
<%
dom = genericUtility.parseString(geoLocCodeXml);
if (dom != null)
......@@ -287,9 +296,10 @@ function isLocationSelected()
}
}
%>
</select></td>
<td>Unit Form: <select id="unit_form" name="unit_form" multiple="multiple" size="5">
</select>
Product Form :
<select id="unit_form" name="unit_form" multiple="multiple" size="5">
<%
dom = genericUtility.parseString(unitFrmXml);
......@@ -308,24 +318,46 @@ function isLocationSelected()
if (childNodeList.getLength() > 0)
{
unitForm = childNodeList.item(0).getTextContent();
unitDescr = childNodeList.item(1).getTextContent();
%>
<option value="<%=unitForm%>"><%=unitForm%></option>
<option value="<%=unitForm%>"><%=unitDescr%></option>
<%
}
}
}
%>
</select></td>
<td><input type="submit" name="showChart" value="view Report" onclick="return isLocationSelected();" /></td>
</select>
Year : <select id="acct_year" name="acct_year" size="3">
<option value="<%=curryearVal%>"><%=curryearVal%></option>
<option value="<%=preyearVal%>"><%=preyearVal%></option>
</select>
Month : <select id="acct_month" name="acct_month" size="3">
<option value="1">JAN</option>
<option value="2">FEB</option>
<option value="3">MAR</option>
<option value="4">APR</option>
<option value="5">MAY</option>
<option value="6">JUN</option>
<option value="7">JUL</option>
<option value="8">AUG</option>
<option value="9">SEP</option>
<option value="10">OCT</option>
<option value="11">NOV</option>
<option value="12">DEC</option>
</select>
<input type="submit" name="showChart" value="View" onclick="return isLocationSelected();"/>
</td>
</tr>
</table>
<br>
</form>
<%
geo_loc = request.getParameterValues("geo_loc");
unit_form = request.getParameterValues("unit_form");
geo_loc = request.getParameterValues("geo_loc");
unit_form = request.getParameterValues("unit_form");
String geoLoc = "", unitFrm = "";
if (geo_loc == null)
{
......@@ -380,19 +412,30 @@ function isLocationSelected()
}
}
// out.println("checkGeoLoc ==="+checkGeoLoc +"checkUnitForm ="+checkUnitForm );
System.out.println("checkGeoLoc ==="+checkGeoLoc +"checkUnitForm ="+checkUnitForm );
//here set selected value of geoLocation and unitForm with final utput
xmlDataString = productionVsBudgetBean.getProductionBudget(frmDate, toDate, this.checkGeoLoc, this.checkUnitForm);
if((checkGeoLoc!=null && checkGeoLoc.trim().length() != 0 ) && (checkUnitForm!=null && checkUnitForm.trim().length() != 0) ){
xmlDataString = productionVsBudgetBean.getProductionBudget(frmDate, toDate, this.checkGeoLoc, this.checkUnitForm);
}
System.out.print("Final xmlDataString inside jsp= " + xmlDataString);
//parse xml
dom = genericUtility.parseString(xmlDataString);
//End here set selected value of geoLocation and unitForm with final utput
//End here set selected value of geoLocation and unitForm with final output
if (dom != null)
{
chartDataList = new ArrayList<String>();
detailList = dom.getElementsByTagName("Detail");
//Initilization of all variable on dated 28/10/2013
chartDataList = new ArrayList<String>();
geoLocList =new ArrayList<String>();
unitFormList =new ArrayList<String>();
//***************BIrendra Pandey*************************
sumDayPro = new ArrayList<String>();
cumLstYear = new ArrayList<String>();
cumuQty = new ArrayList<Double>();
LBEList = new ArrayList<String>();
detailList = dom.getElementsByTagName("Detail");
if (detailList.item(0).getFirstChild() != null)
{
......@@ -401,7 +444,7 @@ function isLocationSelected()
{
locationNode = locationList.item(cntr);
//start Labling setting 1
//start of the Lable setting 1
geoLocList.add(locationNode.getAttributes().getNamedItem("glocdescr").getNodeValue());
chartData = new StringBuffer("<chart caption='");
chartData.append("' palette='1' showValues='0' yAxisValuesPadding='10' numberPrefix='' chartOrder='line,area,column' startAngX='8' startAngY='-32' endAngX='8' endAngY='-32' zdepth='50' zgapPlot='10' showPlotBorder='0' dynamicShading='1' showAlternateHGridColor='1' labelDisplay='Stagger' legendNumColumns='2'>");
......@@ -414,7 +457,6 @@ function isLocationSelected()
//Add unit form in unitForm List
unitFormList.add(unitNode.getAttributes().getNamedItem("unitdescr").getNodeValue());
//geoLocList.add(locationNode.getAttributes().getNamedItem("glocdescr").getNodeValue());
dateList = unitNode.getChildNodes();
for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++)
{
......@@ -427,59 +469,66 @@ function isLocationSelected()
chartData.append("<category label='" + "fc" + "'/>");
chartData.append("</categories>");
//End of Labling setting 1
//2. Start dataset for Forecasting
chartData.append("<dataset seriesName='Forecast' color='F5F907' >");
//1.End of Lable setting 1
//2. start dataset for Day Production
chartData.append("<dataset seriesName='Day Production' color='FF8533'>");
for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++)
{
double cumulativeQty = 0.0;
unitNode = unitList.item(nodCtr);
dateList = unitNode.getChildNodes();
for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++)
{
dateNode = dateList.item(dateCtr);
dateNode = dateList.item(dateCtr);
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
dayQtyList = dateNode.getChildNodes();
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
//add new code for previous report as on dated 14/11/2013
if(currmonthVal==month && curryearVal==year)
{
dayNode = dayQtyList.item(dayCtr);
foreCastList = dayNode.getChildNodes();
for (int prevCtr = 0; prevCtr < foreCastList.getLength(); prevCtr++)
if (day <= todaysDay)
{
foreCastNode = foreCastList.item(prevCtr);
if (foreCastNode.getNodeName().equals("cur_cumqty"))
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
//out.println("day:"+day+"--todaysDay"+todaysDay);
if (day == todaysDay)
{
cumulativeQty = Double.parseDouble(foreCastNode.getTextContent());
cumulativeQty = Math.round(cumulativeQty * lastDayOfMonth) / day;
cumuQty.add(cumulativeQty);
for (int dayOfMonth = 1; dayOfMonth <= lastDayOfMonth; dayOfMonth++)
{
chartData.append("<set value='0'/>");
}
chartData.append("<set value='" + cumulativeQty + "'/>");
}
dayNode = dayQtyList.item(dayCtr);
dayQty = dayNode.getAttributes().item(0).getNodeValue();
chartData.append("<set value='" + dayQty + "'/>");
}
}
else
{
for (int p = todaysDay + 1; p <= lastDayOfMonth; p++)
{
chartData.append("<set value='0'/>");
}
}
}
else
{ if (day <= lastDayOfMonth)
{
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
dayNode = dayQtyList.item(dayCtr);
dayQty = dayNode.getAttributes().item(0).getNodeValue();
chartData.append("<set value='" + dayQty + "'/>");
}
}
}
//end on dated 14/11/2013
}
}
}
chartData.append("</dataset>");
//2. End dataset for Forecasting
//3. Start dataset for Daily Budget Quantity
chartData.append("<dataset seriesName='Cumulative Production' color='00cc00' >");
//2. End dataset for Day Production
//3. Start dataset for Cumulative Production
chartData.append("<dataset seriesName='Cumulative Production' color='00cc00'>");
String curCumQtyTem = "";
for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++)
{
......@@ -491,71 +540,135 @@ function isLocationSelected()
dateNode = dateList.item(dateCtr);
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
dayQtyList = dateNode.getChildNodes();
if (day <= todaysDay)
//add new code for previous report as on dated 14/11/2013
if(currmonthVal==month && curryearVal==year)
{
if (day <= todaysDay)
{
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
dayNode = dayQtyList.item(dayCtr);
NodeList curCumQtyList = dayNode.getChildNodes();
for (int curCumCtr = 0; curCumCtr < curCumQtyList.getLength(); curCumCtr++)
{
Node curCumQtyNode = curCumQtyList.item(curCumCtr);
if (curCumQtyNode.getNodeName().equals("cur_cumqty"))
{
curCumQtyTem = curCumQtyNode.getTextContent();
chartData.append("<set value='" + curCumQtyNode.getTextContent() + "'/>");
}
}
}
} else
{
for (int p = todaysDay + 1; p <= lastDayOfMonth; p++)
{
chartData.append("<set value='0'/>");
}
}
}
else
{
if (day <= lastDayOfMonth)
{
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
dayNode = dayQtyList.item(dayCtr);
NodeList curCumQtyList = dayNode.getChildNodes();
for (int curCumCtr = 0; curCumCtr < curCumQtyList.getLength(); curCumCtr++)
{
Node curCumQtyNode = curCumQtyList.item(curCumCtr);
if (curCumQtyNode.getNodeName().equals("cur_cumqty"))
{
curCumQtyTem = curCumQtyNode.getTextContent();
chartData.append("<set value='" + curCumQtyNode.getTextContent() + "'/>");
}
}
}
} else
{
for (int p = todaysDay + 1; p <= lastDayOfMonth; p++)
{
chartData.append("<set value='0'/>");
}
}
}
//end of previous report on dated 14/11/2013
}
}
sumDayPro.add(curCumQtyTem);
sumDayPro.add(curCumQtyTem);
chartData.append("</dataset>");
//3. End dataset for Daily Budget Quantity
//4. start dataset for Day wise Quantity
chartData.append("<dataset seriesName='Day Production' color='FF8533'>");
//3. End dataset for Cumulative Production
//4. Start dataset for Forecasting
chartData.append("<dataset seriesName='Forecast' color='F5F907' >");
for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++)
{
double cumulativeQty = 0.0;
unitNode = unitList.item(nodCtr);
dateList = unitNode.getChildNodes();
for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++)
{
dateNode = dateList.item(dateCtr);
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
dateNode = dateList.item(dateCtr);
dayQtyList = dateNode.getChildNodes();
if (day <= todaysDay)
{
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
dayNode = dayQtyList.item(dayCtr);
dayQty = dayNode.getAttributes().item(0).getNodeValue();
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
chartData.append("<set value='" + dayQty + "'/>");
}
} else
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
for (int p = todaysDay + 1; p <= lastDayOfMonth; p++)
dayNode = dayQtyList.item(dayCtr);
foreCastList = dayNode.getChildNodes();
for (int prevCtr = 0; prevCtr < foreCastList.getLength(); prevCtr++)
{
chartData.append("<set value='0'/>");
foreCastNode = foreCastList.item(prevCtr);
if (foreCastNode.getNodeName().equals("cur_cumqty"))
{
//out.println("day:"+day+"--todaysDay"+todaysDay);
if(currmonthVal==month && curryearVal==year)
{
if (day == todaysDay)
{
cumulativeQty = Double.parseDouble(foreCastNode.getTextContent());
cumulativeQty = Math.round(cumulativeQty * lastDayOfMonth) / day;
cumuQty.add(cumulativeQty);
for (int dayOfMonth = 1; dayOfMonth <= lastDayOfMonth; dayOfMonth++)
{
chartData.append("<set value='0'/>");
}
chartData.append("<set value='" + cumulativeQty + "'/>");
}
}
else
{
if(day == lastDayOfMonth)//added if condition on 16 nov2013
{
cumulativeQty = Double.parseDouble(foreCastNode.getTextContent());
cumulativeQty = Math.round(cumulativeQty * lastDayOfMonth) / day;
cumuQty.add(cumulativeQty);
for (int dayOfMonth = 1; dayOfMonth <= lastDayOfMonth; dayOfMonth++)
{
chartData.append("<set value='0'/>");
}
chartData.append("<set value='" + cumulativeQty + "'/>");
}
}
}
}
}
}
}
chartData.append("</dataset>");
//4. End dataset for Day wise Quantity
//4. End dataset for Forecasting
//5. start dataset for Last year Quantity
chartData.append("<dataset seriesName='Cumulative Last Year' color='1E86A8' renderAs='Line'>");
......@@ -582,6 +695,9 @@ function isLocationSelected()
if (prevYearQtyNode.getNodeName().equals("pyr_cumqty"))
{
prevYearQtyTemp = (prevYearQtyNode.getTextContent());
if(prevYearQtyTemp=="")
prevYearQtyTemp="0.0";
chartData.append("<set value='" + prevYearQtyNode.getTextContent() + "'/>");
}
}
......@@ -627,7 +743,7 @@ function isLocationSelected()
chartData.append("</chart>");
chartDataList.add(chartData.toString());
//System.out.println("chartData is :" + chartData.toString() + "Chart data List sizeee is =" + chartDataList.size());
//out.println(" Final chartData is==" + chartData.toString() + "Chart data List of size ==" + chartDataList.size());
chartData.setLength(0);
}
......@@ -645,18 +761,103 @@ function isLocationSelected()
}
}
int chartDivId = 0;
int countChart = 0;
int tablId = 0;
int chartDivId = 0;
int countChart = 0;
int tablId = 0;
Double actLBE = 0.0;
Double cumuQtyLBE = 0.0;
%>
<table border="1" cellspacing="1" cellpadding="2">
<%
for (String chartDatFrmList : chartDataList)
<script>
var geoLocation ="<%=this.checkGeoLoc%>";
var unitform ="<%=this.checkUnitForm%>";
var curryear ="<%=this.year%>";
var currmonth ="<%=this.month%>";
//window.onload =getData(geoLocation.trim(),unitform,curryear,currmonth);
window.onload = new function() {
//1
var element = document.getElementById("geo_loc");
var location =geoLocation.split(",");
for(i=0;i<location.length;i++)
{
for (var j = 0; j < element.options.length; j++)
{
var checkLoc= "'"+element.options[j].value+"'";
if(checkLoc== location[i])
{
element.options[j].selected = true;
}
}
}
//2
var elementForm = document.getElementById("unit_form");
var unitForm = unitform.split(",");
for(k=0;k <unitForm.length;k++)
{
for (var l = 0; l < elementForm.options.length; l++)
{
var checkUnit= "'"+elementForm.options[l].value+"'";
if(checkUnit== unitForm[k])
{
elementForm.options[l].selected = true;
}
}
}
//3
var curryearList = document.getElementById("acct_year");
// alert("curryear==="+curryear);
for (var m = 0; m < curryearList.options.length; m++)
{
var checkyear = curryearList.options[m].value;
if(checkyear==curryear)
{
curryearList.options[m].selected = true;
}
}
//4
var currmonthList = document.getElementById("acct_month");
//alert("currmonth================="+currmonth);
for (var n = 0; n < currmonthList.options.length; n++)
{
var checkmonth = currmonthList.options[n].value;
if(checkmonth==currmonth)
{
currmonthList.options[n].selected = true;
}
}
};
</script>
<table class="chartTable">
<%
String chartId="";
for (String chartDatFrmList : chartDataList)
{
chartDivId++;
%>
<%
if (tablId == 0 || (tablId % 3 == 0))
if (tablId == 0 || (tablId % deviceDisplay == 0))
{
%>
<tr>
......@@ -667,34 +868,36 @@ function isLocationSelected()
<td align="left" style="font-size: 12px"><b> <%=geoLocList.get(countChart)%>
- <%=unitFormList.get(countChart)%> </b>
<div id="chartContainer<%=chartDivId%>">Chart will load here !</div>
<td class="chartCell">
<div id="chartContainer<%=chartDivId%>">Chart will load here !</div>
<script type="text/javascript">
FusionCharts.setCurrentRenderer('javascript');
var myChart = new FusionCharts("<%=srcImagesPath%>", "myChartId", "400", "350", "0", "0");
var myChart = new FusionCharts("<%=srcImagesPath%>", "myChartId<%=chartDivId%>", "400", "350", "0", "0");
myChart.setXMLData("<%=chartDatFrmList%>");
myChart.render("chartContainer<%=chartDivId%>");
</script>
myChart.setChartAttribute( "caption" , "<%=geoLocList.get(countChart)%>: <%=unitFormList.get(countChart)%>" );
myChart.render("chartContainer<%=chartDivId%>");
</script>
<table class="headerTable" align="center">
<tr class="headerTr">
<table class="summaryTable" >
<tr class="summaryTr">
<td>Month</td>
<td>Actual</td>
<td>LBE</td>
<td>Actual/LBE</td>
<td>Work Plan</td>
<td>Actual/Work Plan</td>
<td>Pace(EOM)</td>
<td>Pace(EOM)/LBE</td>
<td><%=preyear%>/<%=month%></td>
<td>Pace(EOM)/Work Plan</td>
<td><%=preyear%>/<%=monthStr%></td>
</tr>
<tr class="detailTr">
<td><%=year%>/<%=month%></td>
<tr class="summaryDetail">
<td><%=year%>/<%=monthStr%></td>
<%
cumulativePro = Double.parseDouble(sumDayPro.get(countChart));
if (cumulativePro >= 1000000)
{
......@@ -720,8 +923,7 @@ function isLocationSelected()
cumuQtyStr = cumuQtyInDoubl.toString() + "K";
}
Double actLBE = 0.0;
Double cumuQtyLBE = 0.0;
if (Double.parseDouble(LBEList.get(countChart)) == 0.0)
{
actLBE = 0.0;
......@@ -762,6 +964,7 @@ function isLocationSelected()
lbeValStr = lbeInDouble.toString() + "K";
}
%>
<td><%=cumulativeProStr%></td>
<td><%=lbeValStr%></td>
......@@ -774,7 +977,7 @@ function isLocationSelected()
</td>
<%
if (tablId > 0 && tablId % 3 == 0)
if (tablId > 0 && tablId % deviceDisplay == 0)
{
%>
</tr>
......@@ -783,25 +986,52 @@ function isLocationSelected()
%>
<%
tablId++;
countChart++;
tablId++;
countChart++;
}
chartDataList =null;
geoLocList = null;
unitFormList = null;
//***************************Birendra Pandey
sumDayPro = null;
cumLstYear = null;
cumuQty = null;
LBEList = null;
chartDivId = 0;
countChart = 0;
tablId = 0;
unitFrmXml ="";
geoLocCodeXml ="";
xmlDataString ="";
//add on dated 28/10/2013
cumulativePro = 0.0;
cumuQtyInDoubl = 0.0;
cumLstYearInDouble = 0.0;
lbeInDouble = 0.0;
actLBE = 0.0;
cumuQtyLBE = 0.0;
cumulativeProStr = "";
cumuQtyStr = "";
cumLstYearStr = "";
lbeValStr = "";
dom = null;
%>
</table>
<%
} catch (Exception ex)
{
System.out.println("Exception : ProductionVsBudgetReport.jsp :" + ex.getMessage());
}
%>
<script>
var geoLoc ="<%=this.checkGeoLoc%>";
var unitform ="<%=this.checkUnitForm%>";
window.onload=getData(geoLoc.trim(),unitform);
</script>
</form>
</body>
</html>
......@@ -215,8 +215,7 @@ function isLocationSelected()
frmDate = simpleDateFormat.format(calendar.getTime());
todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
lastDayOfMonth = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
//frmDate = "01-jan-14";
//toDate = "30-jan-14";
//new code added by Birendra Pandey It is VIMP
seclectYear = request.getParameterValues("acct_year");
seclectMonth = request.getParameterValues("acct_month");
......@@ -770,6 +769,11 @@ function isLocationSelected()
</td>
</tr>
</table>
<script type="text/javascript">
// changes by Birendra Pandey on dated 29/03/2014 ,case when data not found
window.close();
</script>
<%
}
}
......@@ -914,10 +918,10 @@ function isLocationSelected()
<tr class="summaryTr">
<td>Month</td>
<td>Actual</td>
<td>LBE</td>
<td>Actual/LBE</td>
<td>Work Plan</td>
<td>Actual/Work Plan</td>
<td>Pace(EOM)</td>
<td>Pace(EOM)/LBE</td>
<td>Pace(EOM)/Work Plan</td>
<td><%=preyear%>/<%=monthStr%></td>
</tr>
<tr class="summaryDetail">
......
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