← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2501: Changed String Perioddis to Collection of Integer Periodids in aggregatedDataValueService; Fixed ...

 

------------------------------------------------------------
revno: 2501
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-01-10 13:28:36 +0530
message:
  Changed String Perioddis to Collection of Integer Periodids in aggregatedDataValueService; Fixed Calendar Bug in NBITS Reports
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/benificiaryInfoReportsForm.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForActivePlan.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPortalReport.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2011-01-08 15:48:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2011-01-10 07:58:36 +0000
@@ -84,7 +84,7 @@
      * @param organisationUnit The OrganisationUnit identifier.
      * @return the aggregated value.
      */
-    Double getAggregatedValue( int dataElement, int categoryOptionCombo, String periodIds, int organisationUnit );
+    Double getAggregatedValue( int dataElement, int categoryOptionCombo, Collection<Integer> periodIds, int organisationUnit );
     
     
     /**

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2011-01-08 15:48:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2011-01-10 07:58:36 +0000
@@ -61,7 +61,7 @@
      * @param organisationUnit The OrganisationUnit identifier.
      * @return the aggregated value.
      */
-    Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, String periodIds, int organisationUnit );
+    Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, Collection<Integer> periodIds, int organisationUnit );
     
     /**
      * Gets a collection of AggregatedDataValues.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2011-01-08 15:48:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2011-01-10 07:58:36 +0000
@@ -53,7 +53,7 @@
         return aggregatedDataValueStore.getAggregatedDataValue( dataElement.getId(), categoryOptionCombo.getId(), period.getId(), organisationUnit.getId() );
     }
 
-    public Double getAggregatedValue( int dataElement, int categoryOptionCombo, String periodIds, int organisationUnit )
+    public Double getAggregatedValue( int dataElement, int categoryOptionCombo, Collection<Integer> periodIds, int organisationUnit )
     {
         return aggregatedDataValueStore.getAggregatedDataValue( dataElement, categoryOptionCombo, periodIds, organisationUnit );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-01-08 15:48:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-01-10 07:58:36 +0000
@@ -90,16 +90,14 @@
         return statementManager.getHolder().queryForDouble( sql );
     }
 
-    public Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, String periodIds, int organisationUnit )
+    public Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, Collection<Integer> periodIds, int organisationUnit )
     {
-        //String periidIds = getCommaDelimitedString( getIdentifiers( Period.class, periods ) );
-        
         final String sql =
             "SELECT SUM(value) " +
             "FROM aggregateddatavalue " +
             "WHERE dataelementid = " + dataElement + " " +
             "AND categoryoptioncomboid = " + categoryOptionCombo + " " +
-            "AND periodid IN ( " + periodIds + " ) " +
+            "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
             "AND organisationunitid = " + organisationUnit;
         
         return statementManager.getHolder().queryForDouble( sql );

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java	2011-01-08 05:58:26 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java	2011-01-10 07:58:36 +0000
@@ -123,5 +123,5 @@
 
     String getResultSurveyValue( String formula, OrganisationUnit organisationUnit );
     
-    String getResultDataValueFromAggregateTable( String formula, String periodIds, OrganisationUnit organisationUnit , String reportModelTB );
+    String getResultDataValueFromAggregateTable( String formula, Collection<Integer> periodIds, OrganisationUnit organisationUnit , String reportModelTB );
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2011-01-08 05:58:26 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2011-01-10 07:58:36 +0000
@@ -1617,7 +1617,7 @@
     // -------------------------------------------------------------------------
     // Get Aggregated Result for dataelement expression from Aggregated Table
     // -------------------------------------------------------------------------
-    public String getResultDataValueFromAggregateTable( String formula, String periodIds, OrganisationUnit organisationUnit , String reportModelTB )
+    public String getResultDataValueFromAggregateTable( String formula, Collection<Integer> periodIds, OrganisationUnit organisationUnit , String reportModelTB )
     {
         int deFlag1 = 0;
         int isAggregated = 0;
@@ -1695,23 +1695,20 @@
                     //periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( dePeriodType, startDate, endDate ) );
                     //Period tempPeriod = new Period();
                     
-                    
                     Period tempPeriod = new Period();
-                    tempPeriod = periodService.getPeriod( Integer.parseInt( periodIds.split( "," )[0] ) );
+                    //tempPeriod = periodService.getPeriod( Integer.parseInt( periodIds.split( "," )[0] ) );
                     
-                    //if ( periodList == null || periodList.isEmpty() )
-                    if ( tempPeriod == null )
+                    if ( periodIds == null || periodIds.isEmpty() )
+                    //if ( tempPeriod == null )
                     {
                         replaceString = "";
                         matcher.appendReplacement( buffer, replaceString );
                         continue;
                     }
-                    /*
                     else
                     {
-                        tempPeriod = (Period) periodList.get( 0 );
+                        tempPeriod = periodService.getPeriod( periodIds.iterator().next() );
                     }
-                    */
 
                     DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
                         optionCombo );

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java	2011-01-08 05:58:26 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java	2011-01-10 07:58:36 +0000
@@ -2,7 +2,6 @@
 package org.hisp.dhis.reports.ouwiseprogress.action;
 
 import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
 
 import java.io.BufferedInputStream;
 import java.io.File;
@@ -10,6 +9,7 @@
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
@@ -199,7 +199,9 @@
         
         List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( sDate, eDate ) );
         
-        String periodids = getCommaDelimitedString( getIdentifiers(Period.class, periodList ));
+        Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
+        
+        //String periodids = getCommaDelimitedString( getIdentifiers(Period.class, periodList ));
 
         // Getting DataValues
         List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
@@ -262,7 +264,7 @@
                         }
                         else
                         {
-                            tempStr = reportService.getResultDataValueFromAggregateTable( deCodeString, periodids, currentOrgUnit, reportModelTB );
+                            tempStr = reportService.getResultDataValueFromAggregateTable( deCodeString, periodIds, currentOrgUnit, reportModelTB );
                         }
                     }
                 }

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm	2010-07-06 09:34:47 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm	2011-01-10 07:58:36 +0000
@@ -1,126 +1,99 @@
 
-		<script>
-			//Global Variables
-		            
-			var reportModels = new HashTable();
-			var reportFileNames = new HashTable();
-			var reportLevels = new HashTable();
-						
-		    // Report ids and its Models
-			#foreach($report in $reportList)
-				var reportId = ""+"$report.id";
-			    reportModels.put(reportId,"$report.model");
-				reportFileNames.put(reportId,"$report.fileName");
-				reportLevels.put(reportId,"$report.level");
-			#end
-
-			 // OrganisationUnit ids and its Names
-			var orgUnits = new HashTable();
-			#foreach($orgUnit in $organisationUnits)
-				var orgUnitId = ""+$orgUnit.getId();
-			    orgUnits.put(orgUnitId,"$orgUnit.getShortName()");
-			#end
-			            
-			// OrganisationUnit ids and its Level
-			var orgUnitLevels = new HashTable();
-			#foreach($orgUnit in $organisationUnits)
-				var orgUnitId = ""+$orgUnit.getId();
-			    orgUnitLevels.put(orgUnitId,"$organisationUnitService.getLevelOfOrganisationUnit( $orgUnit )");
-			#end
-			            					
-			function formValidations()
-			{			            
-				var reportListIndex = document.reportForm.reportList.selectedIndex;
-				var orgunitIdValue = document.reportForm.ouIDTB.value;
-                var startDateValue = document.reportForm.startDate.value;
-                var endDateValue = document.reportForm.endDate.value;
-			               			            
-			    if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
-				else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
-                else if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="") {alert("Please Select Start Date And End Date"); return false;}
-                else if(startDateValue > endDateValue) {alert("Starte Date Is Greater Than End Date"); return false;}
-
-				document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
-				document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
-				
-				document.reportForm.reportLevelTB.value = reportLevels.get(document.reportForm.reportList.options[reportListIndex].value);
-			    return true;
-			}			
-		</script>
-		<h1>NBITS Report Analyser</h1><hr /><br />
-	        
-		<form id="reportForm" name="reportForm" action="generateActivePlanReport.action" method="post" onsubmit="return formValidations()" target="_blank">
-            <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>		                
-				<tr>
-					<td class="NormalB">
-						Reports :<br />
-                    	<select id="reportList" name="reportList" style="width:200px">
-							#foreach($report in $reportList)
-								<option value="$report.id">$report.name</option>
-							#end
-                        </select>
-    			    </td>
-                    <td class="NormalB">
-                        OrganisationUnit : <br />
-                        <input type="text" name="ouNameTB" id="ouNameTB" size="20" disabled="disabled">
-                    </td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>                    
-                </tr>
-                <tr>
-                        <td class="NormalB">
-                                <label for="startDate">$i18n.getString( 'start_date' ) ($i18n.getString( "format.date.label" ))</label><br/>
-                                <input type="text" id="startDate" name="startDate" style="width:20em">
-                                <img src="../images/calendar_icon.gif" width="16" height="16" id="getStartDate" cursor: pointer;" title="$i18n.getString( "date_selector" )" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''">
-                        </td>
-                        <td class="NormalB">
-                                <label for="endDate">$i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label><br />
-                                <input type="text" id="endDate" name="endDate" style="width:20em">
-                                <img src="../images/calendar_icon.gif" width="16" height="16" id="getEndDate" cursor: pointer;" title="$i18n.getString( "date_selector" )" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''">
-                        </td>
-                  
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>                    
-                </tr>
-                			
-                <tr>
-					
-                </tr>
-				<tr>
-                <td>&nbsp;</td>                
-            </tr>
-            <tr>
-                <td>&nbsp;</td>
-                
-            </tr>
-   	            <tr>
-                
-                <td>
-                        <input type="submit" name="generate" value='Generate Report'/>
-                        <input type="hidden" name="ouIDTB" id="ouIDTB">
-                        <input type="hidden" name="ouLevelTB" id="ouLevelTB">
-                        <input type="hidden" name="reportModelTB" id="reportModelTB">
-                        <input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
-                        <input type="hidden" name="reportLevelTB" id="reportLevelTB">
-                    </td>
-                </tr>
-            </table>
-		</form>
+<script>
+
+	//Global Variables
+
+	var reportModels = new HashTable();
+	var reportFileNames = new HashTable();
+	var reportLevels = new HashTable();
+
+	// Report ids and its Models
+	#foreach($report in $reportList)
+		var reportId = ""+"$report.id";
+		reportModels.put(reportId,"$report.model");
+		reportFileNames.put(reportId,"$report.fileName");
+		reportLevels.put(reportId,"$report.level");
+	#end
+
+	function formValidations()
+	{
+		var reportListIndex = document.reportForm.reportList.selectedIndex;
+		var orgunitIdValue = document.reportForm.ouIDTB.value;
+		var startDateValue = document.reportForm.startDate.value;
+		var endDateValue = document.reportForm.endDate.value;
+
+		if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
+		else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
+		else if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="") {alert("Please Select Start Date And End Date"); return false;}
+		else if(startDateValue > endDateValue) {alert("Starte Date Is Greater Than End Date"); return false;}
+
+		document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
+		document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
+		document.reportForm.reportLevelTB.value = reportLevels.get(document.reportForm.reportList.options[reportListIndex].value);
+
+		return true;
+	}
+
+</script>
+
+<h1>NBITS Report Analyser</h1><hr /><br />
+
+<form id="reportForm" name="reportForm" action="generateActivePlanReport.action" method="post" onsubmit="return formValidations()" target="_blank">
+	<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
+		<tr>
+			<td class="NormalB">
+				Reports :<br />
+                <select id="reportList" name="reportList" style="width:200px">
+				#foreach($report in $reportList)
+					<option value="$report.id">$report.name</option>
+				#end
+                </select>
+    		</td>
+            <td class="NormalB">
+				OrganisationUnit : <br />
+                <input type="text" name="ouNameTB" id="ouNameTB" style="width:175px" disabled="disabled">
+			</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+            <td>&nbsp;</td>
+		</tr>
+        <tr id="periodTR">
+            <td class="NormalB">
+                <label for="startDate" id="lblStartDate">$i18n.getString( 'start_date' ) ($i18n.getString( "format.date.label" ))</label>
+                <br/>
+                <input type="text" id="startDate" name="startDate" style="width:175px">
+            </td>
+            <td class="NormalB">
+                <label for="endDate" id="lblEndDate">$i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label>
+                <br />
+                <input type="text" id="endDate" name="endDate" style="width:175px">
+            </td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+	        <td>
+				<input type="submit" name="generate" value='Generate Report'/>
+				<input type="hidden" name="ouIDTB" id="ouIDTB">
+				<input type="hidden" name="ouLevelTB" id="ouLevelTB">
+				<input type="hidden" name="reportModelTB" id="reportModelTB">
+				<input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
+				<input type="hidden" name="reportLevelTB" id="reportLevelTB">
+			</td>
+		</tr>
+	</table>
+</form>
+
 <script type="text/javascript">
-
-    Calendar.setup({
-        inputField     :    "startDate",      // id of the input field
-        ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
-        button         :    "getStartDate"   // trigger for the calendar (button ID)
-    });
-
-    Calendar.setup({
-        inputField     :    "endDate",      // id of the input field
-        ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
-        button         :    "getEndDate"   // trigger for the calendar (button ID)
+    jQuery( function(){
+            datePickerInRange( "startDate", "endDate", false, false );
     });
 </script>
-
-

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/benificiaryInfoReportsForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/benificiaryInfoReportsForm.vm	2011-01-05 05:31:43 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/benificiaryInfoReportsForm.vm	2011-01-10 07:58:36 +0000
@@ -13,20 +13,6 @@
 		reportLevels.put(reportId,"$report.level");
 	#end
 
-	// OrganisationUnit ids and its Names
-	var orgUnits = new HashTable();
-	#foreach($orgUnit in $organisationUnits)
-		var orgUnitId = ""+$orgUnit.getId();
-		orgUnits.put(orgUnitId,"$orgUnit.getShortName()");
-	#end
-
-	// OrganisationUnit ids and its Level
-	var orgUnitLevels = new HashTable();
-	#foreach($orgUnit in $organisationUnits)
-		var orgUnitId = ""+$orgUnit.getId();
-		orgUnitLevels.put(orgUnitId,"$organisationUnitService.getLevelOfOrganisationUnit( $orgUnit )");
-	#end
-
 	function showOrHideDates()
 	{
 		var includePeriodChecked = document.getElementById( "includePeriod" ).checked;
@@ -87,11 +73,6 @@
 
 <form id="reportForm" name="reportForm" action="generateBenificiaryInfoReport.action" method="post" onsubmit="return formValidations()" target="_blank">
 	<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
-		<tr>
-			<td>
-			</td>
-            <td>&nbsp;</td>
-        </tr>
         <tr>
 			<td class="NormalB">
 				Program :<br />

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForActivePlan.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForActivePlan.vm	2010-06-15 11:26:37 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForActivePlan.vm	2011-01-10 07:58:36 +0000
@@ -1,39 +1,40 @@
 <h2>Report Analyser</h2>
 <ul>
-    <li>Report Analysis</li>
+    <li>NameBased Reports</li>
     <ul>
     	<li>
             NBITS Reports
         </li>
     </ul>
 </ul>
+
 <div style=" float:right; font-size:6pt; cursor:pointer; margin-top:-15px; ">
-        <a href="index.action">
-          <img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
+	<a href="index.action"><img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
 </div>
-#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+
+##parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
 
 <!-- The script that registeres selctions in the orgunit tree -->
 <script type="text/javascript">
 
-function orgUnitHasBeenSelected( orgUnitIds )
-{    
-
-    document.reportForm.ouIDTB.value = orgUnitIds;
-	
-	if(orgUnitIds == null || orgUnitIds == "" )
-	{
-		return;
-	}
-	
-    if(orgUnitIds !=null)
-	   {
-	     getOUDetails(orgUnitIds);
-	   }
-	
-	}
-
-selection.setListenerFunction( orgUnitHasBeenSelected );
+    function orgUnitHasBeenSelected( orgUnitIds )
+    {
+        document.reportForm.ouIDTB.value = orgUnitIds;
+
+        if(orgUnitIds == null || orgUnitIds == "" )
+        {
+			document.reportForm.ouNameTB.value = "";
+            return;
+        }
+
+        if( orgUnitIds != null )
+        {
+            //getOUDetails(orgUnitIds);
+            getSelectedOrgUnit( orgUnitIds );
+        }
+    }
+
+    selection.setListenerFunction( orgUnitHasBeenSelected );
 
 </script>
-

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm	2011-01-05 05:31:43 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm	2011-01-10 07:58:36 +0000
@@ -1,6 +1,6 @@
 <h2>Report Analyser</h2>
 <ul>
-    <li>Report Analysis</li>
+    <li>NameBased Reports</li>
     <ul>
     	<li>
             NBITS Benificiary Info
@@ -24,6 +24,7 @@
 
 		if(orgUnitIds == null || orgUnitIds == "" )
 		{
+			document.reportForm.ouNameTB.value = "";
 			return;
 		}
 

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPortalReport.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPortalReport.vm	2010-06-15 11:26:37 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPortalReport.vm	2011-01-10 07:58:36 +0000
@@ -1,39 +1,40 @@
 <h2>Report Analyser</h2>
 <ul>
-    <li>Report Analysis</li>
+    <li>NameBased Reports</li>
     <ul>
     	<li>
             NBITS Portal Reports
         </li>
     </ul>
 </ul>
+
 <div style=" float:right; font-size:6pt; cursor:pointer; margin-top:-15px; ">
-        <a href="index.action">
-          <img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
+	<a href="index.action"><img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
 </div>
-#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+
+##parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
 
 <!-- The script that registeres selctions in the orgunit tree -->
 <script type="text/javascript">
 
-function orgUnitHasBeenSelected( orgUnitIds )
-{    
-
-    document.reportForm.ouIDTB.value = orgUnitIds;
-	
-	if(orgUnitIds == null || orgUnitIds == "" )
-	{
-		return;
-	}
-	
-    if(orgUnitIds !=null)
-	   {
-	     getOUDetails(orgUnitIds);
-	   }
-	
-	}
-
-selection.setListenerFunction( orgUnitHasBeenSelected );
+    function orgUnitHasBeenSelected( orgUnitIds )
+    {
+        document.reportForm.ouIDTB.value = orgUnitIds;
+
+        if(orgUnitIds == null || orgUnitIds == "" )
+        {
+			document.reportForm.ouNameTB.value = "";
+            return;
+        }
+
+        if( orgUnitIds != null )
+        {
+            //getOUDetails(orgUnitIds);
+            getSelectedOrgUnit( orgUnitIds );
+        }
+    }
+
+    selection.setListenerFunction( orgUnitHasBeenSelected );
 
 </script>
-

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm	2010-12-09 10:23:58 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm	2011-01-10 07:58:36 +0000
@@ -1,143 +1,120 @@
 
-		<script>
-			//Global Variables
-		            
-			var reportModels = new HashTable();
-			var reportFileNames = new HashTable();
-			var reportLevels = new HashTable();
-						
-		    // Report ids and its Models
-			#foreach($report in $reportList)
-				var reportId = ""+"$report.id";
-			    reportModels.put(reportId,"$report.model");
-				reportFileNames.put(reportId,"$report.fileName");
-				reportLevels.put(reportId,"$report.level");
-			#end
-
-			 // OrganisationUnit ids and its Names
-			var orgUnits = new HashTable();
-			#foreach($orgUnit in $organisationUnits)
-				var orgUnitId = ""+$orgUnit.getId();
-			    orgUnits.put(orgUnitId,"$orgUnit.getShortName()");
-			#end
-			            
-			// OrganisationUnit ids and its Level
-			var orgUnitLevels = new HashTable();
-			#foreach($orgUnit in $organisationUnits)
-				var orgUnitId = ""+$orgUnit.getId();
-			    orgUnitLevels.put(orgUnitId,"$organisationUnitService.getLevelOfOrganisationUnit( $orgUnit )");
-			#end
-
-                        function showOrHideDates()
-                        {
-                            var includePeriodChecked = document.getElementById( "includePeriod" ).checked
-                            if(includePeriodChecked==true)
-                            {
-                                jQuery("#lblStartDate").show();
-                                jQuery("#startDate").show();
-                                jQuery("#getStartDate").show();
-                                jQuery("#lblEndDate").show();
-                                jQuery("#endDate").show();
-                                jQuery("#getEndDate").show();
-                            }
-                            else
-                            {
-                                jQuery("#lblStartDate").hide();
-                                jQuery("#startDate").hide();
-                                jQuery("#getStartDate").hide();
-                                jQuery("#lblEndDate").hide();
-                                jQuery("#endDate").hide();
-                                jQuery("#getEndDate").hide();
-                            }
-                        }
-			function formValidations()
-			{
-                                var includePeriodChecked = document.getElementById( "includePeriod" ).checked
-				var reportListIndex = document.reportForm.reportList.selectedIndex;
-				var orgunitIdValue = document.reportForm.ouIDTB.value;
-			    var startDateValue = document.reportForm.startDate.value;
-                            var endDateValue = document.reportForm.endDate.value;
-           			            
-			    if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
-                            else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
-                            else if(includePeriodChecked==true)
-                            {
-                                if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="")
-                                {   alert("Please Select Start Date And End Date"); return false;}
-                                else if(startDateValue > endDateValue)
-                                {   alert("Start Date Is Greater Than End Date"); return false;}
-                            }
-                            document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
-                            document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
-                            document.reportForm.reportLevelTB.value = reportLevels.get(document.reportForm.reportList.options[reportListIndex].value);
-                
-			    return true;
-			}			
-		</script>
-		<h1>NBITS GOI Report Analyser</h1><hr /><br />
-	        
-		<form id="reportForm" name="reportForm" action="generatePortalReport.action" method="post" onsubmit="return formValidations()" target="_blank">
-                    <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
-                        <tr>
-                            <td><input type="checkbox" name="includePeriod" onChange="return showOrHideDates()" id="includePeriod" checked>Report With Specified Period</td>
-                        </tr>
-                        <tr>
-                           
-                            <td class="NormalB">
-                                Reports :<br />
-                                <select id="reportList" name="reportList" style="width:200px">
-                                    #foreach($report in $reportList)
-                                        <option value="$report.id">$report.name</option>
-                                    #end
-                                </select>
-                            </td>
-                            <td class="NormalB">
-                            OrganisationUnit : <br />
-                                <input type="text" name="ouNameTB" id="ouNameTB" size="20" disabled = "disabled">
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>&nbsp;</td>
-                        </tr>
-                        <tr>
-                            <td class="NormalB">
-                                <label for="startDate" id="lblStartDate">$i18n.getString( 'start_date' ) ($i18n.getString( "format.date.label" ))</label><br/>
-                                <input type="text" id="startDate" name="startDate" style="width:20em">
-                                
-                            </td>
-                            <td class="NormalB">
-                                <label for="endDate" id="lblEndDate">$i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label><br />
-                                <input type="text" id="endDate" name="endDate" style="width:20em">
-                               
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>&nbsp;</td>
-                        </tr>
-                        <tr>
-                            <td>&nbsp;</td>
-                        </tr>
-                        <tr>
-                            <td>&nbsp;</td>
-                        </tr>
-                        <tr>
-                
-                            <td>
-                                <input type="submit" name="generate" value='Generate Report'/>
-                                <input type="hidden" name="ouIDTB" id="ouIDTB">
-                                <input type="hidden" name="ouLevelTB" id="ouLevelTB">
-                                <input type="hidden" name="reportModelTB" id="reportModelTB">
-                                <input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
-                                <input type="hidden" name="reportLevelTB" id="reportLevelTB">
-                            </td>
-                        </tr>
-                    </table>
-		</form>
+<script>
+
+	//Global Variables
+
+	var reportModels = new HashTable();
+	var reportFileNames = new HashTable();
+	var reportLevels = new HashTable();
+
+	// Report ids and its Models
+	#foreach($report in $reportList)
+		var reportId = ""+"$report.id";
+		reportModels.put(reportId,"$report.model");
+		reportFileNames.put(reportId,"$report.fileName");
+		reportLevels.put(reportId,"$report.level");
+	#end
+
+    function showOrHideDates()
+    {
+        var includePeriodChecked = document.getElementById( "includePeriod" ).checked;
+
+        if( includePeriodChecked == true )
+        {
+            jQuery("#periodTR").show();
+        }
+        else
+        {
+            jQuery("#periodTR").hide();
+        }
+    }
+
+	function formValidations()
+	{
+		var includePeriodChecked = document.getElementById( "includePeriod" ).checked;
+		var reportListIndex = document.reportForm.reportList.selectedIndex;
+		var orgunitIdValue = document.reportForm.ouIDTB.value;
+		var startDateValue = document.reportForm.startDate.value;
+		var endDateValue = document.reportForm.endDate.value;
+
+		if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
+		else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
+		else if(includePeriodChecked==true)
+		{
+			if( startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="" ) { alert("Please Select Start Date And End Date"); return false; }
+			else if( startDateValue > endDateValue ) { alert("Start Date Is Greater Than End Date"); return false; }
+		}
+
+		document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
+		document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
+		document.reportForm.reportLevelTB.value = reportLevels.get(document.reportForm.reportList.options[reportListIndex].value);
+
+		return true;
+	}
+
+</script>
+
+<h1>NBITS GOI Report Analyser</h1>
+<hr /><br />
+
+<form id="reportForm" name="reportForm" action="generatePortalReport.action" method="post" onsubmit="return formValidations()" target="_blank">
+	<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
+		<tr>
+			<td class="NormalB">
+				Reports :<br />
+				<select id="reportList" name="reportList" style="width:200px">
+				#foreach($report in $reportList)
+					<option value="$report.id">$report.name</option>
+				#end
+				</select>
+			</td>
+			<td class="NormalB">
+				OrganisationUnit : <br />
+				<input type="text" name="ouNameTB" id="ouNameTB" style="width:175px" disabled = "disabled">
+			</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+            <td>&nbsp;</td>
+		</tr>
+		<tr id="periodTR">
+			<td class="NormalB">
+				<label for="startDate" id="lblStartDate">$i18n.getString( 'start_date' ) ($i18n.getString( "format.date.label" ))</label><br/>
+				<input type="text" id="startDate" name="startDate" style="width:175px">
+			</td>
+			<td class="NormalB">
+				<label for="endDate" id="lblEndDate">$i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label><br />
+				<input type="text" id="endDate" name="endDate" style="width:175px">
+			</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+			<td>
+                <input type="checkbox" name="includePeriod" onChange="return showOrHideDates()" id="includePeriod" checked>Report With Specified Period
+                <br/><br/>
+				<input type="submit" name="generate" value='Generate Report'/>
+				<input type="hidden" name="ouIDTB" id="ouIDTB">
+				<input type="hidden" name="ouLevelTB" id="ouLevelTB">
+				<input type="hidden" name="reportModelTB" id="reportModelTB">
+				<input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
+				<input type="hidden" name="reportLevelTB" id="reportLevelTB">
+			</td>
+		</tr>
+	</table>
+</form>
 
 <script type="text/javascript">
 	jQuery( function(){
 			datePickerInRange( "startDate", "endDate", false, false );
-	});		
+	});
 </script>