2
<%@ page import="java.sql.*,java.util.*" %>
3
<%@ page import="com.opensymphony.xwork.util.OgnlValueStack" %>
6
<%@ page session="true"%>
11
// For finding organisationunit name of selected Orgunit based on Orgunit id
15
// For finding start date of selected period based on period id
19
// For finding child orgunit ids and names based on selected orgunit id
23
// For finding child orgunit
28
String userName = "dhis";
30
String urlForConnection = "jdbc:mysql://localhost/mp_dhis2";
32
OgnlValueStack stack = (OgnlValueStack)request.getAttribute("webwork.valueStack");
34
String selectedId = (String) stack.findValue( "orgUnitId" );
35
int selectedOrgUnitID = Integer.parseInt( selectedId );
36
// int selectedOrgUnitID = 239;
38
String startingDate = (String) stack.findValue( "startingPeriod" );
39
String endingDate = (String) stack.findValue( "endingPeriod" );
41
// String startingDate = "2006-07-01";
42
// String endingDate = "2006-07-01";;
44
// String monthlyPeriodId = (String) stack.findValue( "monthlyPeriodTypeId" );
45
// int periodTypeID = Integer.parseInt( monthlyPeriodId );
48
String selectedOrgUnitName = "";
49
String selectedDataPeriodStartDate = "";
51
String monthNames[] = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September","October", "November", "December" };
53
String monthlyDataElements[] = {
54
"Data Element for Population",
56
// Cases treated at FTD, DDC
59
// Active BSC, BSE, +ve (pv + pf)
60
"MAL_DE6","MAL_DE7","MAL_DE8","MAL_DE9",
62
// Passive BSC, BSE, +ve (pv + pf)
63
"MAL_DE10","MAL_DE11","MAL_DE12","MAL_DE13",
65
// Clinically Diagnosed Deaths
72
"MAL_DE37","MAL_DE38","MAL_DE39","MAL_DE40",
74
// Positive Agewise - (0-1), (1-4), (5-14), (>15)
75
"MAL_DE28","MAL_DE29","MAL_DE30","MAL_DE31",
77
// Positive - Male, Female
78
"MAL_DE26","MAL_DE27",
81
"MAL_DE32","MAL_DE33","MAL_DE34","MAL_DE35"
85
List childOrgUnitIDs = new ArrayList();
86
List childOrgUnitNames = new ArrayList();
88
int childOrgUnitCount = 0;
91
int totPopulation = 0;
93
int tempval[] = new int[monthlyDataElements.length+5];
94
int total[] = new int[monthlyDataElements.length+5];
100
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
101
con = DriverManager.getConnection (urlForConnection, userName, password);
103
st1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
104
st2=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
105
st3=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
106
st4=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
108
//rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit WHERE id ="+selectedOrgUnitID);
109
rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit WHERE organisationunitid ="+selectedOrgUnitID);
110
if(rs1.next()) { selectedOrgUnitName = rs1.getString(1); }
111
else { selectedOrgUnitName = ""; }
113
// rs2 = st2.executeQuery("select startDate from period where id = "+selectedDataPeriodID);
114
// if(rs2.next()) { selectedDataPeriodStartDate = rs2.getDate(1).toString(); }
116
selectedDataPeriodStartDate = startingDate;
119
//rs3 = st3.executeQuery("select id,shortname from organisationunit where parent = "+selectedOrgUnitID);
120
rs3 = st3.executeQuery("select organisationunitid,shortname from organisationunit where parentid = "+selectedOrgUnitID);
123
Integer tempInt = new Integer(rs3.getInt(1));
124
childOrgUnitIDs.add(childOrgUnitCount,tempInt);
125
childOrgUnitNames.add(childOrgUnitCount,rs3.getString(2));
130
catch(Exception e) { out.println(e.getMessage()); }
132
String partsOfDataPeriodStartDate[] = selectedDataPeriodStartDate.split("-");
138
<TITLE>NAMMIS-BASE INPUT FORM </TITLE>
141
<P align="center"><FONT face="Arial" size="3"><b><u>NAMMIS-BASE INPUT FORM </u></b></font><br></p>
144
<table cellpadding="0" cellspacing="0" bgcolor="ffffff" align="center" style="border-style:solid; border-width:0; border-collapse: collapse; padding: 0; position:relative; top:10" bordercolor="#ffffff" width="100%" border="0">
145
<tr style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding: 0" bordercolor="#111111" width="100%">
146
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="23">
147
<b><font face="Arial">District</font></b><font face="Arial" size="3"><b> : <%=selectedOrgUnitName%></b></font>
149
<td width="50%" align="right" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="23">
150
<font face="Arial" size="2"><b>Month : <%=monthNames[Integer.parseInt(partsOfDataPeriodStartDate[1])]%> - <%=partsOfDataPeriodStartDate[0]%> </b></font>
161
while(count < childOrgUnitCount)
165
if(count != 0) {%></table><div align="right"><font face="Arial" size="1"><i>(page contd.)</i></font></div> <br><%}%>
167
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=3 cellPadding=3 width="100%" border=1>
169
<TD align="center" width="3%" rowspan="3"><font face="Arial" style="font-size:8pt">Sl. No.</font></TD>
170
<TD align="center" width="22%" rowspan="3"><font face="Arial" style="font-size:8pt">Name of
172
<TD align="center" width="3%" rowspan="3"><font face="Arial" style="font-size:8pt">Population</font></TD>
173
<TD align="center" width="3%" rowspan="3"><font face="Arial" style="font-size:8pt">Cases Treated at FTD</font></TD>
174
<TD align="center" width="3%" rowspan="3"><font face="Arial" style="font-size:8pt">Cases Treated at DDC</font></TD>
175
<TD align="center" width="9%" colspan="3"><font face="Arial" style="font-size:8pt">Active</font></TD>
176
<TD align="center" width="9%" colspan="3"><font face="Arial" style="font-size:8pt">Passive</font></TD>
177
<TD align="center" width="9%" colspan="3"><font face="Arial" style="font-size:8pt">Total</font></TD>
178
<TD align="center" width="3%" rowspan="3"><font face="Arial" style="font-size:8pt">Clinically Diagnosed Deaths</font></TD>
179
<TD align="center" width="6%" colspan="2"><font face="Arial" style="font-size:8pt">RT-Done</font></TD>
180
<TD align="center" width="12%" colspan="4"><font face="Arial" style="font-size:8pt">Positive Age Wise</font></TD>
181
<TD align="center" width="6%" colspan="2"><font face="Arial" style="font-size:8pt">Positive</font></TD>
182
<TD align="center" width="12%" colspan="4"><font face="Arial" style="font-size:8pt">Species</font></TD>
186
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">BSC</font></TD>
187
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">BSE</font></TD>
188
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">+ve</font></TD>
189
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">BSC</font></TD>
190
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">BSE</font></TD>
191
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">+ve</font></TD>
192
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">BSC</font></TD>
193
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">BSE</font></TD>
194
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">+ve</font></TD>
195
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">RT- within 7 Days</font></TD>
196
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">RT- given to +ves</font></TD>
197
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">0-1</font></TD>
198
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">1-4</font></TD>
199
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">5-14</font></TD>
200
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">>15</font></TD>
201
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">Male</font></TD>
202
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">Female</font></TD>
203
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">Pv</font></TD>
204
<TD align="center" width="3%" colspan="2"><font face="Arial" style="font-size:8pt">Pf</font></TD>
205
<TD align="center" width="3%" rowspan="2"><font face="Arial" style="font-size:8pt">Mix</font></TD>
209
<TD align="center" width="3%"><font face="Arial" style="font-size:8pt">R</font></TD>
210
<TD align="center" width="3%"><font face="Arial" style="font-size:8pt">Rg</font></TD>
214
Integer temp1 = (Integer) childOrgUnitIDs.get(count);
215
int currentChildID = temp1.intValue();
216
for(i=0;i<monthlyDataElements.length;i++)
218
rs4 = st4.executeQuery("SELECT sum(datavalue.value) FROM datavalue INNER JOIN dataelement ON datavalue.dataelementid = dataelement.dataelementid WHERE datavalue.periodid in (select periodid from period where startdate between '"+startingDate+"' and '"+startingDate+"') AND datavalue.sourceid in (select organisationunitid from organisationunit where organisationunitid in ( select organisationunitid from organisationunit where parentid = "+currentChildID+") or organisationunitid = "+currentChildID+") AND dataelement.code like '"+monthlyDataElements[i]+"'");
220
if(!rs4.next()) { tempval[i] = 0; }
221
else { tempval[i] = rs4.getInt(1); }
222
total[i] += tempval[i];
228
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(count+1)%>.</font></TD>
229
<TD width="22%" HEIGHT="30" align="center"><b><FONT face="Arial" style="font-size:8pt"><%=childOrgUnitNames.get(count)%></font></b></TD>
230
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[0]%></font></TD>
231
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[1]%></font></TD>
232
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[2]%></font></TD>
233
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[3]%></font></TD>
234
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[4]%></font></TD>
235
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(tempval[5]+tempval[6])%></font></TD>
236
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[7]%></font></TD>
237
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[8]%></font></TD>
238
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(tempval[9]+tempval[10])%></font></TD>
239
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(tempval[3]+tempval[7])%></font></TD>
240
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(tempval[4]+tempval[8])%></font></TD>
241
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(tempval[5]+tempval[6]+tempval[9]+tempval[10])%></font></TD>
242
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[11]%></font></TD>
243
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[12]%></font></TD>
244
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(tempval[13]+tempval[14]+tempval[15]+tempval[16])%></font></TD>
245
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[17]%></font></TD>
246
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[18]%></font></TD>
247
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[19]%></font></TD>
248
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[20]%></font></TD>
249
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[21]%></font></TD>
250
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[22]%></font></TD>
251
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[23]%></font></TD>
252
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[24]%></font></TD>
253
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[25]%></font></TD>
254
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=tempval[26]%></font></TD>
260
catch(Exception e) { out.println(e.getMessage()); }
265
if(rs1!=null) rs1.close(); if(st1!=null) st1.close();
266
if(rs2!=null) rs2.close(); if(st2!=null) st2.close();
267
if(rs3!=null) rs3.close(); if(st3!=null) st3.close();
268
if(rs4!=null) rs4.close(); if(st4!=null) st4.close();
270
if(con!=null) con.close();
272
catch(Exception e) { out.println(e.getMessage()); }
273
} // finally block end
277
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" size="1"> </font></TD>
278
<TD width="22%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><b>Total</b></font></TD>
279
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[0]%></font></TD>
280
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[1]%></font></TD>
281
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[2]%></font></TD>
282
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[3]%></font></TD>
283
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[4]%></font></TD>
284
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(total[5]+total[6])%></font></TD>
285
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[7]%></font></TD>
286
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[8]%></font></TD>
287
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(total[9]+total[10])%></font></TD>
288
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(total[3]+total[7])%></font></TD>
289
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(total[4]+total[8])%></font></TD>
290
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(total[5]+total[6]+total[9]+total[10])%></font></TD>
291
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[11]%></font></TD>
292
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[12]%></font></TD>
293
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=(total[13]+total[14]+total[15]+total[16])%></font></TD>
294
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[17]%></font></TD>
295
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[18]%></font></TD>
296
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[19]%></font></TD>
297
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[20]%></font></TD>
298
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[21]%></font></TD>
299
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[22]%></font></TD>
300
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[23]%></font></TD>
301
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[24]%></font></TD>
302
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[25]%></font></TD>
303
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" style="font-size:8pt"><%=total[26]%></font></TD>
b'\\ No newline at end of file'