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 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="ibase.dashboard.mfg.bean.*"%>
<%@page import="javax.naming.Context"%> <%@page import="javax.naming.Context"%>
<%@page import="org.w3c.dom.Node"%> <%@page import="org.w3c.dom.Node"%>
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
<%@page import="java.util.ArrayList"%> <%@page import="java.util.ArrayList"%>
<%@page errorPage="error.jsp"%> <%@page errorPage="error.jsp"%>
<%@ page import="java.io.File,ibase.utility.CommonConstants" %> <%@ page import="java.io.File,ibase.utility.CommonConstants" %>
<%@page import="java.text.SimpleDateFormat"%> <%@page import="java.text.SimpleDateFormat"%>
<jsp:useBean id="productionVsBudgetBean" scope="request" class="ibase.dashboard.mfg.bean.ProductionVsBudgetReportBean" /> <jsp:useBean id="productionVsBudgetBean" scope="request" class="ibase.dashboard.mfg.bean.ProductionVsBudgetReportBean" />
...@@ -23,25 +22,25 @@ ...@@ -23,25 +22,25 @@
NodeList childNodeList = null; NodeList childNodeList = null;
Node currDetail = null; Node currDetail = null;
ArrayList<String> chartDataList = null; ArrayList<String> chartDataList = null;
List<String> geoLocList = new ArrayList<String>(); List<String> geoLocList = null;
List<String> unitFormList = new ArrayList<String>(); List<String> unitFormList = null;
String childNodeName = ""; String childNodeName = "";
String period = ""; String period = "";
String netsales = ""; String netsales = "";
String amount = ""; String amount = "";
String fin_entity = ""; String fin_entity = "";
StringBuffer chartData = null; StringBuffer chartData = null;
String xmlDataString = "";
String selectedEntity = ""; String selectedEntity = "";
String entity = "", descr = ""; String entity = "", descr = "";
String user = "TA821"; String user = "TA821";
String rptTitle = ""; String rptTitle = "";
String srcJSPath = ""; String srcJSPath = "";
String srcImagesPath = ""; String srcImagesPath = "";
Calendar calendar = null; Calendar calendar = null;
String frmDate = ""; String frmDate = "";
String toDate = "", unitForm = ""; String toDate = "", unitForm = "";
String dayQty = "", fldValue = "", fldDescr; String dayQty = "", fldValue = "";
String fldDescr="",unitDescr="";
NodeList locationList = null; NodeList locationList = null;
NodeList detailList = null; NodeList detailList = null;
NodeList unitList = null; NodeList unitList = null;
...@@ -54,27 +53,43 @@ ...@@ -54,27 +53,43 @@
Node dayNode = null; Node dayNode = null;
Node foreCastNode = null; Node foreCastNode = null;
String date = ""; String date = "";
int lastDayOfMonth = 0; int lastDayOfMonth = 0;
int todaysDay = 0; int todaysDay = 0;
String month = ""; int month = 0;
int preyear = 0; int preyear = 0;
int year = 0; int preyearVal = 0;
int year = 0;
int curryearVal =0;
int currmonthVal =0;
String[] geo_loc = null; String[] geo_loc = null;
String[] unit_form = null; String[] unit_form = null;
String unitFrmXml = ""; String unitFrmXml = "";
String geoLocCodeXml = ""; String geoLocCodeXml = "";
String xmlDataString ="";
String checkGeoLoc = ""; String checkGeoLoc = "";
String checkUnitForm = ""; String checkUnitForm = "";
List<String> sumDayPro = new ArrayList<String>(); List<String> sumDayPro = null;
List<String> cumLstYear = new ArrayList<String>(); List<String> cumLstYear = null;
List<Double> cumuQty = new ArrayList<Double>(); List<Double> cumuQty = null;
List<String> LBEList = new ArrayList<String>(); List<String> LBEList = null;
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
Double cumulativePro = 0.0, cumuQtyInDoubl = 0.0, cumLstYearInDouble = 0.0, lbeInDouble = 0.0; Double cumulativePro = 0.0;
String cumulativeProStr = "", cumuQtyStr = "", cumLstYearStr = "", lbeValStr = ""; 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 @@ ...@@ -82,123 +97,66 @@
response.setHeader("Cache-Control", "no-store, no-cache,must-revalidate"); response.setHeader("Cache-Control", "no-store, no-cache,must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0"); response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache"); response.setHeader("Pragma", "no-cache");
%> %>
<% <%
String userAgent = request.getHeader("user-agent"); String userAgent = request.getHeader("user-agent");
System.out.println("userAgent ==" + userAgent);
if (userAgent.indexOf("Android") > 0 || userAgent.indexOf("iPhone") > 0 || userAgent.indexOf("iPad") > 0) if (userAgent.indexOf("Android") > 0 || userAgent.indexOf("iPhone") > 0 )
{
srcJSPath = "ibase/FusionChart/js/FusionCharts.js";
srcImagesPath = "ibase/FusionChart/images/MSCombi3D.swf";
} else
{ {
srcJSPath = "/ibase/FusionChart/js/FusionCharts.js"; srcJSPath = "/ibase/FusionChart/js/FusionCharts.js";
srcImagesPath = "/ibase/FusionChart/images/MSCombi3D.swf"; srcImagesPath = "/ibase/FusionChart/images/MSCombi3D.swf";
System.out.println("userAgent for iPhone==" + userAgent);
System.out.println("srcJSPath ==" + srcJSPath); deviceDisplay =1;
System.out.println("srcImagesPath ==" + srcImagesPath); 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> <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> <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> </head>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("#geo_loc").dropdownchecklist({ firstItemChecksAll: true, maxDropHeight: 100 });
$("#geo_loc").dropdownchecklist({ firstItemChecksAll: true, maxDropHeight: 100 ,emptyText: "Select ..."});
}); });
$(document).ready(function(){ $(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) //function for validation on change 27/11/2013
{
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 isLocationSelected() function isLocationSelected()
{ {
if (document.getElementById("geo_loc").selectedIndex == -1 ) if (document.getElementById("geo_loc").selectedIndex == -1 )
...@@ -206,8 +164,11 @@ function isLocationSelected() ...@@ -206,8 +164,11 @@ function isLocationSelected()
alert("Please select at least one Location code"); alert("Please select at least one Location code");
return false; return false;
} }
else if(document.getElementById("unit_form").selectedIndex==-1) else if(document.getElementById("unit_form").selectedIndex==-1)
{ {
alert("Please select at least one Unit Form"); alert("Please select at least one Unit Form");
return false; return false;
} }
...@@ -222,46 +183,94 @@ function isLocationSelected() ...@@ -222,46 +183,94 @@ function isLocationSelected()
{ {
//ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean)session.getAttribute("USER_INFO"); //ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean)session.getAttribute("USER_INFO");
simpleDateFormat = new SimpleDateFormat("dd-MMM-yy"); simpleDateFormat = new SimpleDateFormat("dd-MMM-yy");
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
preyear = calendar.get(Calendar.YEAR) - 1; preyear = calendar.get(Calendar.YEAR) - 1;
year = calendar.get(Calendar.YEAR); preyearVal = calendar.get(Calendar.YEAR) - 1;
month = new SimpleDateFormat("MMM").format(calendar.getTime()); 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()); String currDate = simpleDateFormat.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
toDate = simpleDateFormat.format(calendar.getTime()); toDate = simpleDateFormat.format(calendar.getTime());
//out.print("max day ="+calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar = Calendar.getInstance();
//out.print("min day ="+calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
frmDate = simpleDateFormat.format(calendar.getTime()); frmDate = simpleDateFormat.format(calendar.getTime());
todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
lastDayOfMonth = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH); lastDayOfMonth = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
//frmDate = "01-apr-12"; //frmDate = "01-apr-12";
//toDate = "30-apr-12"; //toDate = "30-apr-12";
rptTitle = "Production Vs Budget Report - " + currDate; //new code added by Birendra Pandey It is VIMP
unitFrmXml = productionVsBudgetBean.getUnitFormXmlData(); seclectYear = request.getParameterValues("acct_year");
geoLocCodeXml = productionVsBudgetBean.getGeoLoCodeXmlData(); 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); System.out.println("rptTitle=====" + rptTitle);
%> %>
<form method="post" action="ProductionVsBudgetReport.jsp" <form method="post" action="ProductionVsBudgetReport.jsp" name="ProductionVsBudgetReport">
name="ProductionVsBudgetReport">
<table align="center">
<tr>
<td class="title"><%=rptTitle%></td>
</tr>
</table>
<br> <br>
<table class="combox"> <table class="dropdown">
<tr> <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); dom = genericUtility.parseString(geoLocCodeXml);
if (dom != null) if (dom != null)
...@@ -287,9 +296,10 @@ function isLocationSelected() ...@@ -287,9 +296,10 @@ function isLocationSelected()
} }
} }
%> %>
</select></td> </select>
<td>Unit Form: <select id="unit_form" name="unit_form" multiple="multiple" size="5"> Product Form :
<select id="unit_form" name="unit_form" multiple="multiple" size="5">
<% <%
dom = genericUtility.parseString(unitFrmXml); dom = genericUtility.parseString(unitFrmXml);
...@@ -308,24 +318,46 @@ function isLocationSelected() ...@@ -308,24 +318,46 @@ function isLocationSelected()
if (childNodeList.getLength() > 0) if (childNodeList.getLength() > 0)
{ {
unitForm = childNodeList.item(0).getTextContent(); unitForm = childNodeList.item(0).getTextContent();
unitDescr = childNodeList.item(1).getTextContent();
%> %>
<option value="<%=unitForm%>"><%=unitForm%></option> <option value="<%=unitForm%>"><%=unitDescr%></option>
<% <%
} }
} }
} }
%> %>
</select></td> </select>
<td><input type="submit" name="showChart" value="view Report" onclick="return isLocationSelected();" /></td> 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> </tr>
</table> </table>
<br> <br>
</form>
<% <%
geo_loc = request.getParameterValues("geo_loc"); geo_loc = request.getParameterValues("geo_loc");
unit_form = request.getParameterValues("unit_form"); unit_form = request.getParameterValues("unit_form");
String geoLoc = "", unitFrm = ""; String geoLoc = "", unitFrm = "";
if (geo_loc == null) if (geo_loc == null)
{ {
...@@ -380,19 +412,30 @@ function isLocationSelected() ...@@ -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 //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); System.out.print("Final xmlDataString inside jsp= " + xmlDataString);
//parse xml //parse xml
dom = genericUtility.parseString(xmlDataString); 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) if (dom != null)
{ {
//Initilization of all variable on dated 28/10/2013
chartDataList = new ArrayList<String>(); chartDataList = new ArrayList<String>();
detailList = dom.getElementsByTagName("Detail"); 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) if (detailList.item(0).getFirstChild() != null)
{ {
...@@ -401,7 +444,7 @@ function isLocationSelected() ...@@ -401,7 +444,7 @@ function isLocationSelected()
{ {
locationNode = locationList.item(cntr); locationNode = locationList.item(cntr);
//start Labling setting 1 //start of the Lable setting 1
geoLocList.add(locationNode.getAttributes().getNamedItem("glocdescr").getNodeValue()); geoLocList.add(locationNode.getAttributes().getNamedItem("glocdescr").getNodeValue());
chartData = new StringBuffer("<chart caption='"); 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'>"); 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() ...@@ -414,7 +457,6 @@ function isLocationSelected()
//Add unit form in unitForm List //Add unit form in unitForm List
unitFormList.add(unitNode.getAttributes().getNamedItem("unitdescr").getNodeValue()); unitFormList.add(unitNode.getAttributes().getNamedItem("unitdescr").getNodeValue());
//geoLocList.add(locationNode.getAttributes().getNamedItem("glocdescr").getNodeValue()); //geoLocList.add(locationNode.getAttributes().getNamedItem("glocdescr").getNodeValue());
dateList = unitNode.getChildNodes(); dateList = unitNode.getChildNodes();
for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++) for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++)
{ {
...@@ -427,59 +469,66 @@ function isLocationSelected() ...@@ -427,59 +469,66 @@ function isLocationSelected()
chartData.append("<category label='" + "fc" + "'/>"); chartData.append("<category label='" + "fc" + "'/>");
chartData.append("</categories>"); chartData.append("</categories>");
//End of Labling setting 1 //1.End of Lable setting 1
//2. Start dataset for Forecasting
chartData.append("<dataset seriesName='Forecast' color='F5F907' >");
//2. start dataset for Day Production
chartData.append("<dataset seriesName='Day Production' color='FF8533'>");
for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++) for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++)
{ {
double cumulativeQty = 0.0;
unitNode = unitList.item(nodCtr); unitNode = unitList.item(nodCtr);
dateList = unitNode.getChildNodes(); dateList = unitNode.getChildNodes();
for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++) 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(); dayQtyList = dateNode.getChildNodes();
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
//add new code for previous report as on dated 14/11/2013
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++) if(currmonthVal==month && curryearVal==year)
{ {
dayNode = dayQtyList.item(dayCtr); if (day <= todaysDay)
foreCastList = dayNode.getChildNodes();
for (int prevCtr = 0; prevCtr < foreCastList.getLength(); prevCtr++)
{ {
foreCastNode = foreCastList.item(prevCtr); for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
if (foreCastNode.getNodeName().equals("cur_cumqty"))
{ {
//out.println("day:"+day+"--todaysDay"+todaysDay); dayNode = dayQtyList.item(dayCtr);
if (day == todaysDay) dayQty = dayNode.getAttributes().item(0).getNodeValue();
{ chartData.append("<set value='" + dayQty + "'/>");
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
{
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>"); chartData.append("</dataset>");
//2. End dataset for Forecasting //2. End dataset for Day Production
//3. Start dataset for Daily Budget Quantity //3. Start dataset for Cumulative Production
chartData.append("<dataset seriesName='Cumulative Production' color='00cc00' >"); chartData.append("<dataset seriesName='Cumulative Production' color='00cc00'>");
String curCumQtyTem = ""; String curCumQtyTem = "";
for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++) for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++)
{ {
...@@ -491,71 +540,135 @@ function isLocationSelected() ...@@ -491,71 +540,135 @@ function isLocationSelected()
dateNode = dateList.item(dateCtr); dateNode = dateList.item(dateCtr);
int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue()); int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
dayQtyList = dateNode.getChildNodes(); 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++) for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{ {
dayNode = dayQtyList.item(dayCtr); dayNode = dayQtyList.item(dayCtr);
NodeList curCumQtyList = dayNode.getChildNodes(); NodeList curCumQtyList = dayNode.getChildNodes();
for (int curCumCtr = 0; curCumCtr < curCumQtyList.getLength(); curCumCtr++) for (int curCumCtr = 0; curCumCtr < curCumQtyList.getLength(); curCumCtr++)
{ {
Node curCumQtyNode = curCumQtyList.item(curCumCtr); Node curCumQtyNode = curCumQtyList.item(curCumCtr);
if (curCumQtyNode.getNodeName().equals("cur_cumqty")) if (curCumQtyNode.getNodeName().equals("cur_cumqty"))
{ {
curCumQtyTem = curCumQtyNode.getTextContent(); curCumQtyTem = curCumQtyNode.getTextContent();
chartData.append("<set value='" + 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>"); chartData.append("</dataset>");
//3. End dataset for Daily Budget Quantity //3. End dataset for Cumulative Production
//4. start dataset for Day wise Quantity //4. Start dataset for Forecasting
chartData.append("<dataset seriesName='Day Production' color='FF8533'>"); chartData.append("<dataset seriesName='Forecast' color='F5F907' >");
for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++) for (int nodCtr = 0; nodCtr < unitList.getLength(); nodCtr++)
{ {
double cumulativeQty = 0.0;
unitNode = unitList.item(nodCtr); unitNode = unitList.item(nodCtr);
dateList = unitNode.getChildNodes(); dateList = unitNode.getChildNodes();
for (int dateCtr = 0; dateCtr < dateList.getLength(); dateCtr++) 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(); dayQtyList = dateNode.getChildNodes();
if (day <= todaysDay) int day = Integer.parseInt(dateNode.getAttributes().item(0).getNodeValue());
{
for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
{
dayNode = dayQtyList.item(dayCtr);
dayQty = dayNode.getAttributes().item(0).getNodeValue();
chartData.append("<set value='" + dayQty + "'/>"); for (int dayCtr = 0; dayCtr < dayQtyList.getLength(); dayCtr++)
}
} else
{ {
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>"); chartData.append("</dataset>");
//4. End dataset for Day wise Quantity //4. End dataset for Forecasting
//5. start dataset for Last year Quantity //5. start dataset for Last year Quantity
chartData.append("<dataset seriesName='Cumulative Last Year' color='1E86A8' renderAs='Line'>"); chartData.append("<dataset seriesName='Cumulative Last Year' color='1E86A8' renderAs='Line'>");
...@@ -582,6 +695,9 @@ function isLocationSelected() ...@@ -582,6 +695,9 @@ function isLocationSelected()
if (prevYearQtyNode.getNodeName().equals("pyr_cumqty")) if (prevYearQtyNode.getNodeName().equals("pyr_cumqty"))
{ {
prevYearQtyTemp = (prevYearQtyNode.getTextContent()); prevYearQtyTemp = (prevYearQtyNode.getTextContent());
if(prevYearQtyTemp=="")
prevYearQtyTemp="0.0";
chartData.append("<set value='" + prevYearQtyNode.getTextContent() + "'/>"); chartData.append("<set value='" + prevYearQtyNode.getTextContent() + "'/>");
} }
} }
...@@ -627,7 +743,7 @@ function isLocationSelected() ...@@ -627,7 +743,7 @@ function isLocationSelected()
chartData.append("</chart>"); chartData.append("</chart>");
chartDataList.add(chartData.toString()); 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); chartData.setLength(0);
} }
...@@ -645,18 +761,103 @@ function isLocationSelected() ...@@ -645,18 +761,103 @@ function isLocationSelected()
} }
} }
int chartDivId = 0; int chartDivId = 0;
int countChart = 0; int countChart = 0;
int tablId = 0; int tablId = 0;
Double actLBE = 0.0;
Double cumuQtyLBE = 0.0;
%> %>
<table border="1" cellspacing="1" cellpadding="2"> <script>
<% var geoLocation ="<%=this.checkGeoLoc%>";
for (String chartDatFrmList : chartDataList) 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++; chartDivId++;
%> %>
<% <%
if (tablId == 0 || (tablId % 3 == 0)) if (tablId == 0 || (tablId % deviceDisplay == 0))
{ {
%> %>
<tr> <tr>
...@@ -667,34 +868,36 @@ function isLocationSelected() ...@@ -667,34 +868,36 @@ function isLocationSelected()
<td align="left" style="font-size: 12px"><b> <%=geoLocList.get(countChart)%> <td class="chartCell">
- <%=unitFormList.get(countChart)%> </b> <div id="chartContainer<%=chartDivId%>">Chart will load here !</div>
<div id="chartContainer<%=chartDivId%>">Chart will load here !</div>
<script type="text/javascript"> <script type="text/javascript">
FusionCharts.setCurrentRenderer('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.setXMLData("<%=chartDatFrmList%>");
myChart.render("chartContainer<%=chartDivId%>"); myChart.setChartAttribute( "caption" , "<%=geoLocList.get(countChart)%>: <%=unitFormList.get(countChart)%>" );
</script> myChart.render("chartContainer<%=chartDivId%>");
</script>
<table class="headerTable" align="center">
<tr class="headerTr"> <table class="summaryTable" >
<tr class="summaryTr">
<td>Month</td> <td>Month</td>
<td>Actual</td> <td>Actual</td>
<td>LBE</td> <td>Work Plan</td>
<td>Actual/LBE</td> <td>Actual/Work Plan</td>
<td>Pace(EOM)</td> <td>Pace(EOM)</td>
<td>Pace(EOM)/LBE</td> <td>Pace(EOM)/Work Plan</td>
<td><%=preyear%>/<%=month%></td> <td><%=preyear%>/<%=monthStr%></td>
</tr> </tr>
<tr class="detailTr"> <tr class="summaryDetail">
<td><%=year%>/<%=month%></td> <td><%=year%>/<%=monthStr%></td>
<% <%
cumulativePro = Double.parseDouble(sumDayPro.get(countChart)); cumulativePro = Double.parseDouble(sumDayPro.get(countChart));
if (cumulativePro >= 1000000) if (cumulativePro >= 1000000)
{ {
...@@ -720,8 +923,7 @@ function isLocationSelected() ...@@ -720,8 +923,7 @@ function isLocationSelected()
cumuQtyStr = cumuQtyInDoubl.toString() + "K"; cumuQtyStr = cumuQtyInDoubl.toString() + "K";
} }
Double actLBE = 0.0;
Double cumuQtyLBE = 0.0;
if (Double.parseDouble(LBEList.get(countChart)) == 0.0) if (Double.parseDouble(LBEList.get(countChart)) == 0.0)
{ {
actLBE = 0.0; actLBE = 0.0;
...@@ -762,6 +964,7 @@ function isLocationSelected() ...@@ -762,6 +964,7 @@ function isLocationSelected()
lbeValStr = lbeInDouble.toString() + "K"; lbeValStr = lbeInDouble.toString() + "K";
} }
%> %>
<td><%=cumulativeProStr%></td> <td><%=cumulativeProStr%></td>
<td><%=lbeValStr%></td> <td><%=lbeValStr%></td>
...@@ -774,7 +977,7 @@ function isLocationSelected() ...@@ -774,7 +977,7 @@ function isLocationSelected()
</td> </td>
<% <%
if (tablId > 0 && tablId % 3 == 0) if (tablId > 0 && tablId % deviceDisplay == 0)
{ {
%> %>
</tr> </tr>
...@@ -783,25 +986,52 @@ function isLocationSelected() ...@@ -783,25 +986,52 @@ function isLocationSelected()
%> %>
<% <%
tablId++; tablId++;
countChart++; 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> </table>
<% <%
} catch (Exception ex) } catch (Exception ex)
{ {
System.out.println("Exception : ProductionVsBudgetReport.jsp :" + ex.getMessage()); 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> </body>
</html> </html>
...@@ -215,8 +215,7 @@ function isLocationSelected() ...@@ -215,8 +215,7 @@ function isLocationSelected()
frmDate = simpleDateFormat.format(calendar.getTime()); frmDate = simpleDateFormat.format(calendar.getTime());
todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); todaysDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
lastDayOfMonth = Calendar.getInstance().getActualMaximum(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 //new code added by Birendra Pandey It is VIMP
seclectYear = request.getParameterValues("acct_year"); seclectYear = request.getParameterValues("acct_year");
seclectMonth = request.getParameterValues("acct_month"); seclectMonth = request.getParameterValues("acct_month");
...@@ -770,6 +769,11 @@ function isLocationSelected() ...@@ -770,6 +769,11 @@ function isLocationSelected()
</td> </td>
</tr> </tr>
</table> </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() ...@@ -914,10 +918,10 @@ function isLocationSelected()
<tr class="summaryTr"> <tr class="summaryTr">
<td>Month</td> <td>Month</td>
<td>Actual</td> <td>Actual</td>
<td>LBE</td> <td>Work Plan</td>
<td>Actual/LBE</td> <td>Actual/Work Plan</td>
<td>Pace(EOM)</td> <td>Pace(EOM)</td>
<td>Pace(EOM)/LBE</td> <td>Pace(EOM)/Work Plan</td>
<td><%=preyear%>/<%=monthStr%></td> <td><%=preyear%>/<%=monthStr%></td>
</tr> </tr>
<tr class="summaryDetail"> <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