2
<%@ page contentType="text/html ; charset=UTF-8"%>
4
<%@ page import="java.sql.*,java.util.*" %>
5
<%@ page session="true"%>
7
<!-- Bean Specification -->
8
<jsp:useBean id="DataValidationAction" scope="session" class="org.hisp.gtool.action.DataValidationAction" />
9
<jsp:useBean id="DataStausAction" scope="session" class="org.hisp.gtool.action.DataStatusAction" />
10
<jsp:useBean id="GAUtilities" scope="session" class="org.hisp.gtool.utilities.GAUtilities" />
11
<jsp:useBean id="AudioAction" scope="session" class="org.hisp.gtool.action.AudioAction" />
15
String muteOpt = (String) session.getAttribute("muteOpt");
16
if(muteOpt != null && muteOpt.equals("OFF"))
18
AudioAction.stopAudio();
19
AudioAction.playAudio("t10.wav");
24
int selOrgUnitID = Integer.parseInt(request.getParameter("ouIDTB"));
25
String startingDate = request.getParameter("sDateLB");
26
String endingDate = request.getParameter("eDateLB");
27
String dVIdsList[] = request.getParameterValues("dataValidationListCB");
28
String localLang = request.getParameter("LocalLangCB");
32
int selOrgUnitLevel = 1;
33
int maxOrgUnitLevel = 1;
35
String selOrgUnitName = "";
37
// These 2 are hard coded, we need to change these
38
int periodIDs[] = new int[200];
39
String periodNames[] = new String[200];
41
int totDataSetMem = 1;
45
String dataSetName = "";
47
String monthNames[] = {"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
49
// if we want to use this Program to another state we need to give the level names of that state
50
String levelNames[] = {"","State","District","Taluk","PHC","Subcentre"};
54
String cellColor = "";
56
// String strPeriodIDs = "-1";
58
Hashtable htForChildOUTree = DataStausAction.getChildOrgUnitTree(selOrgUnitID);
59
if(htForChildOUTree == null) {out.println("<h3>No Children</h3>");return ; }
61
List liForChildOUIDs = (ArrayList) htForChildOUTree.get("childOUIDsList");
62
List liForChildOUNames = (ArrayList) htForChildOUTree.get("childOUNamesList");
63
List liForChildOULevles = (ArrayList) htForChildOUTree.get("childOULevelsList");
64
maxOrgUnitLevel = ((Integer) Collections.max(liForChildOULevles)).intValue();
65
List listForChildShortNames = (ArrayList) htForChildOUTree.get("childOUShortNamesList");
67
//Hashtable htForDataSets = DataStausAction.getSelectedDataSetMemebers(dataSetIdsList);
68
//if(htForDataSets == null) {out.println("<h3>No DataSets</h3>");return ; }
69
//Vector keysFoDataSets = new Vector(htForDataSets.keySet());
70
//Collections.sort(keysFoDataSets);
71
//Iterator keysFoDataSetsIter = keysFoDataSets.iterator();
73
List liForSelOU = (ArrayList) DataStausAction.getSelectedOUDetails(selOrgUnitID);
74
selOrgUnitName = (String) liForSelOU.get(0);
75
selOrgUnitLevel = ((Integer) liForSelOU.get(1)).intValue();
77
List liForPeriods = (ArrayList) DataStausAction.getPeriodDetails(startingDate, endingDate, 1);
78
Iterator itForPeriods = liForPeriods.iterator();
80
Hashtable htForDataValidations = DataValidationAction.getAllDataValidations();
81
Enumeration keysFordataValidations = htForDataValidations.keys();
87
<title>DataValidation</title>
88
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
89
<meta http-equiv="description" content="this is my page">
90
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
92
<link rel="stylesheet" type="text/css" href="css/StylesForTags.css" />
97
var oldLdvtbValue = 0;
98
var oldRdvtbValue = 0;
99
var leftDVVal = new Array();
100
var rightDVVal = new Array();
104
function createRequestObject()
106
if(XMLHttpRequest) request = new XMLHttpRequest();
107
else request = new ActiveXObject("Microsoft.XMLHTTP");
110
function correctionValidationFunction(evt)
113
var deid = evt.target.name;
114
var dvalue = evt.target.value;
115
//evt.target.style.background = "green";
116
curdvtbHB.value = evt.target.id;
118
createRequestObject();
119
request.onreadystatechange = displayResult;
120
request.open("GET","correctDVValues.jsp?deid="+deid+"&dvalue="+dvalue+"&ouid="+OrgID+"&periodid="+PID,true);
124
function displayResult()
127
if(request.readyState ==4)
129
if(request.status ==200)
131
var response = request.responseXML;
132
var resultValues = response.getElementsByTagName("option");
133
var statusValue = resultValues[0].firstChild.data;
135
var leftdvTB = dvLeftValHB.value;
136
var rightdvTB = dvRightValHB.value;
137
var leftdvTBValue = document.getElementById(leftdvTB).innerHTML;
138
var rightdvTBValue = document.getElementById(rightdvTB).innerHTML;
139
var curdvtb = curdvtbHB.value;
140
var curdvtbValue = document.getElementById(curdvtb).value;
143
if(statusValue < 0) {document.getElementById(curdvtb).style.background = "red";}
146
if(curdvtb.substring(-1,3)=="LTB")
148
//alert(leftdvTBValue+" "+oldLdvtbValue+" "+curdvtbValue);
149
//leftdvTBValue = parseInt(leftdvTBValue) - parseInt(oldLdvtbValue) + parseInt(curdvtbValue);
150
if(leftDVVal[curIndex] == curdvtbValue) return;
151
leftDVVal[curIndex] = curdvtbValue;
154
for(k=0;k<curLength;k++)
156
leftdvTBValue = parseInt(leftdvTBValue) + parseInt(leftDVVal[k]);
158
document.getElementById(leftdvTB).style.background = "yellow";
159
document.getElementById(leftdvTB).innerHTML = leftdvTBValue;
163
//alert(rightdvTBValue+" "+oldRdvtbValue+" "+curdvtbValue);
164
//rightdvTBValue = parseInt(rightdvTBValue) - parseInt(oldRdvtbValue) + parseInt(curdvtbValue);
165
if(rightDVVal[curIndex] == curdvtbValue) return;
166
rightDVVal[curIndex] = curdvtbValue;
169
for(k=0;k<curLength;k++)
171
rightdvTBValue = parseInt(rightdvTBValue) + parseInt(rightDVVal[k]);
173
document.getElementById(rightdvTB).style.background = "yellow";
174
document.getElementById(rightdvTB).innerHTML = rightdvTBValue;
176
document.getElementById(curdvtb).style.background = "yellow";
183
function DVDetailsFunction(leftdenames,rightdenames,leftPercent,rightPercent)
185
alert("Left % : "+leftPercent+"\nRight % : "+rightPercent+"\nLV: "+leftdenames+"\nRV: "+rightdenames);
188
function infoBoxCloseFunction()
190
infoBox.innerHTML="";
191
}//infoBoxCloseFunction
193
function DVUpdateFunction(noOfRows,ouName,period,leftdeids,leftdenames,leftdeval,rightdeids,rightdenames,rightdeval,ouID,periodID,dvleftvalHB,dvrightvalHB)
198
var ldeidList = leftdeids.split(",");
199
var ldenameList = leftdenames.split(",");
200
var ldevalList = leftdeval.split(",");
201
var rdeidList = rightdeids.split(",");
202
var rdenameList = rightdenames.split(",");
203
var rdevalList = rightdeval.split(",");
205
var tempLeftDEList = "";
206
var tempRightDEList = "";
211
dvLeftValHB.value = dvleftvalHB;
212
dvRightValHB.value = dvrightvalHB;
214
for(i=0;i<ldenameList.length-1;i++)
216
tempLeftDEList += "<br/>"+ldenameList[i]+" : <input type='text' size='4' id='LTB"+ldeidList[i]+"' name='"+ldeidList[i]+"' onblur='javascript:curIndex = "+parseInt(i)+"; javascript:curLength = "+parseInt(ldenameList.length-1)+";correctionValidationFunction(event)' value='"+ldevalList[i]+"'>";
217
leftDVVal[i] = ldevalList[i];
220
for(i=0;i<rdenameList.length-1;i++)
222
tempRightDEList += "<br/>"+rdenameList[i]+" : <input type='text' size='4' id='RTB"+rdeidList[i]+"' name='"+rdeidList[i]+"' onblur='javascript:curIndex = "+parseInt(i)+"; javascript:curLength = "+parseInt(rdenameList.length-1)+";correctionValidationFunction(event)' value='"+rdevalList[i]+"'>";
223
rightDVVal[i] = rdevalList[i];
226
for(i=1;i<noOfRows;i++)
228
noOfBreaks += "<tr height='25' class='TableHeadingCellStyles'><td class='TableHeadingCellStyles'> </td></tr>";
231
infoBox.innerHTML = "<br><br><div align='left'><font face='arial' size='2'><b> </b></font></div>"+
232
"<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='100%'> "+noOfBreaks+
233
"<tr bgcolor='#9999CC'><td align='right' class='TableHeadingCellStyles'><a href='javascript:infoBoxCloseFunction()'><img src='images/close.png' border='0'></a> </td></tr>"+
234
"<tr bgcolor='#9999CC'><td class='TableHeadingCellStyles'>"+
235
"<font face='arial' size='2'><b>"+
236
"OrgUnit : </b><br>"+ouName+"<br><br><b>Period : </b><br>"+period+"<br/><br><b>LeftValues : </b>"+
237
tempLeftDEList+"<br><br><b>RightValues : </b>"+tempRightDEList+
238
"</font></td></tr><tr bgcolor='#9999CC'><td align='right' class='TableHeadingCellStyles'> </td></tr>"+
239
"<tr bgcolor='#9999CC'><td align='right' class='TableHeadingCellStyles'> </td></tr></table>";
245
<font face="arial" size="3"><b>Data Validations</b></font>
247
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
248
<tr><td class="TableHeadingCellStyles" width="68%" valign="top">
253
//This is to get DataValidations -
254
while(count < dVIdsList.length)
256
String dvID = dVIdsList[count];
257
ArrayList liForDataValidations = (ArrayList) htForDataValidations.get(dvID);
258
String dvName = (String) liForDataValidations.get(0);
259
String dvleftdeids = (String) liForDataValidations.get(1);
260
String dvrightdeids = (String) liForDataValidations.get(2);
261
String dvoperator = (String) liForDataValidations.get(3);
262
String dvtype = (String) liForDataValidations.get(4);
263
String dvleftdesc = (String) liForDataValidations.get(5);
264
String dvrightdesc = (String) liForDataValidations.get(6);
265
String dvleftdes = (String) liForDataValidations.get(7);
266
String dvrightdes = (String) liForDataValidations.get(8);
267
double leftPercent = Double.parseDouble((String) liForDataValidations.get(9));
268
double rightPercent = Double.parseDouble((String) liForDataValidations.get(10));
271
<div align="left"><font face="arial" size="2"><b>DataValidation : <a href="javascript:DVDetailsFunction('<%=dvleftdes%>','<%=dvrightdes%>',<%=leftPercent%>,<%=rightPercent%>)"><%=dvName%></a></b></font></div>
272
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
273
<tr style="background-color:#dddddd" class="TableHeadingCellStyles" height="25" >
275
for(count1=selOrgUnitLevel+1;count1<=maxOrgUnitLevel;count1++)
278
<th class="TableHeadingCellStyles" align="center"><%=levelNames[count1]%></th>
282
<th class="TableHeadingCellStyles" align="center" >Period</th>
283
<th class="TableHeadingCellStyles" align="center" ><%=dvleftdesc%></th>
284
<th class="TableHeadingCellStyles" align="center" >Ope</th>
285
<th class="TableHeadingCellStyles" align="center" ><%=dvrightdesc%></th>
286
<th class="TableHeadingCellStyles" align="center" > </th>
289
Iterator itForChildOUIDs = liForChildOUIDs.iterator();
290
Iterator itForChildOUNames = liForChildOUNames.iterator();
291
Iterator itForChildOULevels = liForChildOULevles.iterator();
292
Iterator itForChildOUSNames = listForChildShortNames.iterator();
294
while(itForChildOUIDs.hasNext())
296
int childOUID = ((Integer)itForChildOUIDs.next()).intValue();
297
String childOUName = (String) itForChildOUNames.next();
298
int childOULevel = ((Integer) itForChildOULevels.next()).intValue();
299
List parentList = (ArrayList) DataStausAction.getParentOrgUnitTree(childOUID,localLang);
301
if(localLang != null) childOUName = (String) itForChildOUSNames.next();
303
itForPeriods = liForPeriods.iterator();
304
while(itForPeriods.hasNext())
306
List templi = (ArrayList) itForPeriods.next();
307
int periodID = ((Integer)templi.get(0)).intValue();
308
String startDate = (String)templi.get(1);
309
String monYearFormat = GAUtilities.getMonYearFormat(startDate);
311
List li = (ArrayList) DataValidationAction.getDataValidationStatus(childOUID,dvleftdeids,dvrightdeids,dvoperator,periodID,localLang,leftPercent,rightPercent);
312
String dvLeftValue = (String) li.get(0);
313
String dvRightValue = (String) li.get(1);
314
String dvStatus = (String) li.get(2);
315
String dvOpe = (String) li.get(3);
316
String strLeftDEIDs = (String) li.get(4);
317
String strLeftDENames = (String) li.get(5);
318
String strLeftDEValues = (String) li.get(6);
319
String strRightDEIDs = (String) li.get(7);
320
String strRightDENames = (String) li.get(8);
321
String strRightDEValues = (String) li.get(9);
323
if(dvStatus.equals("T")) continue;
326
String tempOUName ="";
327
String curdvLeftValID = "dvLeftValHB"+noOfRows;
328
String curdvRightValID = "dvRightValHB"+noOfRows;
334
for(count1=selOrgUnitLevel+1;count1<=maxOrgUnitLevel;count1++)
336
if(count1==childOULevel) {tempOUName = childOUName; flag=1;}
337
else if(flag==1) tempOUName=" ";
338
else tempOUName = (String) parentList.get(count1);
340
<td class="TableHeadingCellStyles"><%=tempOUName%></td>
344
<td class="TableHeadingCellStyles" align="center"><%=monYearFormat%></td>
345
<td class="TableHeadingCellStyles" align="center"><p id="<%=curdvLeftValID%>" name="<%=curdvLeftValID%>"><%=dvLeftValue%></p></td>
346
<td class="TableHeadingCellStyles" align="center"><%=dvOpe%></td>
347
<td class="TableHeadingCellStyles" align="center"><p id="<%=curdvRightValID%>" name="<%=curdvRightValID%>"><%=dvRightValue%></p></td>
348
<td class="TableHeadingCellStyles" align="center">
349
<input class="TableHeadingCellStyles" align="center" type="button" value='Update' onclick="DVUpdateFunction(<%=noOfRows%>,'<%=childOUName%>','<%=monYearFormat%>','<%=strLeftDEIDs%>','<%=strLeftDENames%>','<%=strLeftDEValues%>','<%=strRightDEIDs%>','<%=strRightDENames%>','<%=strRightDEValues%>',<%=childOUID%>,<%=periodID%>,'<%=curdvLeftValID%>','<%=curdvRightValID%>')"/>
355
}// Period While loop end
356
}// ChildOrgUnit While loop end
361
}// DataValidation While loop end
364
<td class="TableHeadingCellStyles" width="2%" valign="top"> </td>
365
<td class="TableHeadingCellStyles" width="30%" valign="top"><p id="infoBox" name="infoBox"> </p></td>
368
<input type="hidden" name="dvLeftValHB" id="dvLeftValHB" value="dvleft" />
369
<input type="hidden" name="dvRightValHB" id="dvRightValHB" value="dvright" />
370
<input type="hidden" name="curdvtbHB" id="curdvtbHB" value="curdvtb" />