← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2440: Minor changes in reportModel api

 

------------------------------------------------------------
revno: 2440
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-12-29 13:27:25 +0530
message:
  Minor changes in reportModel api
modified:
  dhis-2/dhis-web/dhis-web-portal/india-pom.xml
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.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/webapp/dhis-web-reports/javascript/reportManagement.js


--
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-web/dhis-web-portal/india-pom.xml'
--- dhis-2/dhis-web/dhis-web-portal/india-pom.xml	2010-12-08 07:24:10 +0000
+++ dhis-2/dhis-web/dhis-web-portal/india-pom.xml	2010-12-29 07:57:25 +0000
@@ -111,14 +111,15 @@
       <artifactId>dhis-web-reporting</artifactId>
       <version>${version}</version>
       <type>war</type>
-    </dependency>-->	
+    </dependency>-->
+<!--	
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-dashboard-integration</artifactId>
       <version>${version}</version>
       <type>war</type>
     </dependency>
-
+-->
 <!--
     <dependency>
       <groupId>org.hisp.dhis</groupId>
@@ -187,14 +188,14 @@
     </dependency>
 
 <!-- SMS Mobile application -->
-<!--
+
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-mobile</artifactId>
       <version>${version}</version>
       <type>war</type>
     </dependency>
--->
+
 	
 <!--
     <dependency>

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java	2010-08-19 10:40:50 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java	2010-12-29 07:57:25 +0000
@@ -35,7 +35,7 @@
 
     public final static String RM_STATIC = "static";
         
-    public final static String RM_DYNAMIC_WITH_ROOT = "dynamicwithroot";
+    public final static String RM_DYNAMIC_WITH_ROOT = "dynamicwithrootfacility";
         
     public final static String RM_DYNAMIC_WITHOUT_ROOT = "dynamicwithoutroot";
     

=== 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	2010-12-03 13:29:28 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2010-12-29 07:57:25 +0000
@@ -130,6 +130,7 @@
         this.organisationUnitService = organisationUnitService;
     }
     
+    int deFlag2;
     // -------------------------------------------------------------------------
     // Report_in
     // -------------------------------------------------------------------------
@@ -559,8 +560,9 @@
     public String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB )
     {
         int deFlag1 = 0;
+        //int deFlag2 = 0;
         int isAggregated = 0;
-
+       
         try
         {
             Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
@@ -592,24 +594,31 @@
                     matcher.appendReplacement( buffer, replaceString );
                     continue;
                 }
-                if ( dataElement.getType().equalsIgnoreCase( "int" ) )
+               // if ( dataElement.getType().equalsIgnoreCase( "int" ) )
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )   
                 {
-                    Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo,
-                        startDate, endDate, organisationUnit );
+                    Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit );
+                   
+                    //System.out.println( "dataelement id is : " + dataElementId + ", option combo id is : " + optionComboId  );
+                    //System.out.println( "Start date is  : " + startDate + ", end date is  : " + endDate + ", orgunit is : " + organisationUnit.getName() + ", aggvalue is : " + aggregatedValue );
                     if ( aggregatedValue == null )
                     {
+                        //System.out.println( "Aggregated value is null" );
                         replaceString = NULL_REPLACEMENT;
+                        deFlag2 = 0;
                     }
                     else
                     {
                         replaceString = String.valueOf( aggregatedValue );
-
+                       // System.out.println( " Aggregated value is not null : "  + replaceString );
+                        deFlag2 = 1;
                         isAggregated = 1;
                     }
                 }
                 else
                 {
                     deFlag1 = 1;
+                    deFlag2 = 0;
                     PeriodType dePeriodType = getDataElementPeriodType( dataElement );
                     List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType(
                         dePeriodType, startDate, endDate ) );
@@ -683,15 +692,17 @@
 
                     // These line are to display non financial data that do not
                     // require decimals
-                    if ( !(reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" )) )
+                    
+                   if ( !(reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" )) )
                     {
-                        resultValue = "" + (int) d;
-                    }
+                       resultValue = "" + (int) d;
+                   }
                 }
 
             }
             else
             {
+                deFlag2 = 0;
                 resultValue = buffer.toString();
             }
 
@@ -705,6 +716,7 @@
                 resultValue = " ";
             }
 
+            //System.out.println( "result value is : " + resultValue );
             return resultValue;
         }
         catch ( NumberFormatException ex )
@@ -748,11 +760,12 @@
 
                 if ( dataElement == null || optionCombo == null )
                 {
+                    //System.out.println( "dataelement id is : " + dataElementId + ", option combo id is : " + optionComboId );
                     replaceString = "";
                     matcher.appendReplacement( buffer, replaceString );
                     continue;
                 }
-                if ( dataElement.getType().equalsIgnoreCase( "int" ) )
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
                 {
 
                     PeriodType dePeriodType = getDataElementPeriodType( dataElement );
@@ -880,7 +893,7 @@
             {
                 resultValue = " ";
             }
-
+           // System.out.println( resultValue );
             return resultValue;
         }
         catch ( NumberFormatException ex )

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reportManagement.js'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reportManagement.js	2010-12-22 07:29:08 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reportManagement.js	2010-12-29 07:57:25 +0000
@@ -372,8 +372,6 @@
  
 }
 
-
-
 // ----------------------------------------------------------------------
 // Get Reports
 // ----------------------------------------------------------------------