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;
39
// String selectedPeriodId = (String) stack.findValue( "periodSelect" );
40
// int selectedDataPeriodID = Integer.parseInt( selectedPeriodId );
42
String startingDate = (String) stack.findValue( "startingPeriod" );
43
String endingDate = (String) stack.findValue( "endingPeriod" );
45
// String startingDate = "2006-05-01";
46
// String endingDate = "2006-05-01";
49
// String monthlyPeriodId = (String) stack.findValue( "monthlyPeriodTypeId" );
50
// int periodTypeID = Integer.parseInt( monthlyPeriodId );
53
String selectedOrgUnitName = "";
54
String selectedDataPeriodStartDate = "";
56
String monthNames[] = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September","October", "November", "December" };
58
String monthlyDataElements[] = {
59
// Annual Target - Pregnent Women, Infant
62
// BCG ( Male + Female )
63
"Form6_DE44","Form6_DE45",
65
// DPT - 1 (Male + Female)
66
"Form6_DE46","Form6_DE47",
68
// DPT - 2 (Male + Female)
69
"Form6_DE48","Form6_DE49",
71
// DPT - 3 (Male + Female)
72
"Form6_DE50","Form6_DE51",
74
// DPT - Booster (Male + Female)
75
"Form6_DE64","Form6_DE65",
77
// OPV - 1 (Male + Female)
78
"Form6_DE54","Form6_DE55",
80
// OPV - 2 (Male + Female)
81
"Form6_DE56","Form6_DE57",
83
// OPV - 3 (Male + Female)
84
"Form6_DE58","Form6_DE59",
86
// Measles (Male + Female)
87
"Form6_DE60","Form6_DE61",
90
"Form6_DE5","Form6_DE6","Form6_DE7"
94
List childOrgUnitIDs = new ArrayList();
95
List childOrgUnitNames = new ArrayList();
97
int childOrgUnitCount = 0;
100
int totPopulation = 0;
102
int tempval[] = new int[monthlyDataElements.length+5];
103
int total[] = new int[monthlyDataElements.length+5];
109
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
110
con = DriverManager.getConnection (urlForConnection, userName, password);
112
st1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
113
st2=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
114
st3=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
115
st4=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
117
//rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit WHERE id ="+selectedOrgUnitID);
118
rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit WHERE organisationunitid ="+selectedOrgUnitID);
119
if(rs1.next()) { selectedOrgUnitName = rs1.getString(1); }
120
else { selectedOrgUnitName = ""; }
122
// rs2 = st2.executeQuery("select startDate from period where id = "+selectedDataPeriodID);
123
// if(rs2.next()) { selectedDataPeriodStartDate = rs2.getDate(1).toString(); }
125
selectedDataPeriodStartDate = startingDate;
128
//rs3 = st3.executeQuery("select id,shortname from organisationunit where parent = "+selectedOrgUnitID);
129
rs3 = st3.executeQuery("select organisationunitid,shortname from organisationunit where parentid = "+selectedOrgUnitID);
132
Integer tempInt = new Integer(rs3.getInt(1));
133
childOrgUnitIDs.add(childOrgUnitCount,tempInt);
134
childOrgUnitNames.add(childOrgUnitCount,rs3.getString(2));
139
catch(Exception e) { out.println(e.getMessage()); }
141
String partsOfDataPeriodStartDate[] = selectedDataPeriodStartDate.split("-");
142
int lyear = Integer.parseInt(partsOfDataPeriodStartDate[0]) - 1;
148
<TITLE>UNIVERSAL IMMUNIZATION PROGRAMME</TITLE>
151
<P align="center"><FONT face="Arial" size="3"><b>UNIVERSAL IMMUNIZATION PROGRAMME<BR>
152
PERFORMANCE OF THE YEAR <%=lyear%> - <%=partsOfDataPeriodStartDate[0]%></b></font><br></p>
154
<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">
155
<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%">
156
<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">
157
<font face="Arial" size="2"><b>District : <%=selectedOrgUnitName%></b></font>
159
<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">
160
<font face="Arial" size="2"><b>Month : <%=monthNames[Integer.parseInt(partsOfDataPeriodStartDate[1])]%> - <%=partsOfDataPeriodStartDate[0]%> </b></font>
170
while(count < childOrgUnitCount)
174
if(count != 0) {%></table><div align="right"><font face="Arial" size="1"><i>(page contd.)</i></font></div> <br><%}%>
176
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=3 cellPadding=3 width="100%" border=1>
178
<TD align="center" width="3%" rowSpan=2><b>
179
<font face="Arial" size="2">Sl.No</font></b></TD>
180
<TD align="center" width="41%" rowSpan=2><b>
181
<font face="Arial" size="2">CHC Name</font></b></TD>
182
<TD align="center" width="8%" colspan="2"><b><font face="Arial" size="2">ANNUAL TARGET</font></b></TD>
183
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">B.C.G.</font></b></TD>
184
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">DPT-1</font></b></TD>
185
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">DPT-2</font></b></TD>
186
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">DPT-3</font></b></TD>
187
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">DPT-B</font></b></TD>
188
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">OPV-1</font></b></TD>
189
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">OPV-2</font></b></TD>
190
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">OPV-3</font></b></TD>
191
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">Measles</font></b></TD>
192
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">T.T-1</font></b></TD>
193
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">T.T-2</font></b></TD>
194
<TD align="center" width="4%" rowspan="2"><b><font face="Arial" size="2">T.T-3</font></b></TD>
197
<TD align="center" width="4%"><b><font face="Arial" size="2">P.Women</font></b></TD>
198
<TD align="center" width="4%"><b><font face="Arial" size="2">Infant</font></b></TD>
201
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><i><b>1</b></i></FONT></TD>
202
<TD width="41%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><i><b>2</b></i></FONT></TD>
203
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><i><b>3</b></i></FONT></TD>
204
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">4</font></i></b></TD>
205
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">5</font></i></b></TD>
206
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">6</font></i></b></TD>
207
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">7</font></i></b></TD>
208
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">8</font></i></b></TD>
209
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">9</font></i></b></TD>
210
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">10</font></i></b></TD>
211
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">11</font></i></b></TD>
212
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">12</font></i></b></TD>
213
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">13</font></i></b></TD>
214
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">14</font></i></b></TD>
215
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">15</font></i></b></TD>
216
<TD width="4%" HEIGHT="30" align="center"><b><i><font face="Arial" size="2">16</font></i></b></TD>
219
Integer temp1 = (Integer) childOrgUnitIDs.get(count);
220
int currentChildID = temp1.intValue();
221
for(i=0;i<monthlyDataElements.length;i++)
223
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+")) AND dataelement.code like '"+monthlyDataElements[i]+"'");
225
if(!rs4.next()) { tempval[i] = 0; }
226
else { tempval[i] = rs4.getInt(1); }
227
total[i] += tempval[i];
233
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(count+1)%></font></TD>
234
<TD width="41%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=childOrgUnitNames.get(count)%></font></TD>
235
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=tempval[0]%></font></TD>
236
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=tempval[1]%></font></TD>
237
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[2]+tempval[3])%></font></TD>
238
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[4]+tempval[5])%></font></TD>
239
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[6]+tempval[7])%></font></TD>
240
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[8]+tempval[9])%></font></TD>
241
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[10]+tempval[11])%></font></TD>
242
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[12]+tempval[13])%></font></TD>
243
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[14]+tempval[15])%></font></TD>
244
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[16]+tempval[17])%></font></TD>
245
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=(tempval[18]+tempval[19])%></font></TD>
246
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=tempval[20]%></font></TD>
247
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=tempval[21]%></font></TD>
248
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="2"><%=tempval[22]%></font></TD>
254
catch(Exception e) { out.println(e.getMessage()); }
259
if(rs1!=null) rs1.close(); if(st1!=null) st1.close();
260
if(rs2!=null) rs2.close(); if(st2!=null) st2.close();
261
if(rs3!=null) rs3.close(); if(st3!=null) st3.close();
262
if(rs4!=null) rs4.close(); if(st4!=null) st4.close();
264
if(con!=null) con.close();
266
catch(Exception e) { out.println(e.getMessage()); }
267
} // finally block end
271
<TD width="3%" HEIGHT="30" align="center"><FONT face="Arial" size="1"> </font></TD>
272
<TD width="41%" HEIGHT="30" align="center"><b>
273
<font face="Arial" size="2">Total</font></b></TD>
274
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=total[0]%></font></TD>
275
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=total[1]%></font></TD>
276
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[2]+total[3])%></font></TD>
277
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[4]+total[5])%></font></TD>
278
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[6]+total[7])%></font></TD>
279
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[8]+total[9])%></font></TD>
280
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[10]+total[11])%></font></TD>
281
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[12]+total[13])%></font></TD>
282
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[14]+total[15])%></font></TD>
283
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[16]+total[17])%></font></TD>
284
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=(total[18]+total[19])%></font></TD>
285
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=total[20]%></font></TD>
286
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=total[21]%></font></TD>
287
<TD width="4%" HEIGHT="30" align="center"><FONT face="Arial" size="1"><%=total[22]%></font></TD>
b'\\ No newline at end of file'