← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7701: Modification in CCEM Report

 

------------------------------------------------------------
revno: 7701
committer: Samta <samta-bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-07-25 13:56:23 +0100
message:
  Modification in CCEM Report
modified:
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java


--
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 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java	2012-07-25 07:07:44 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java	2012-07-25 12:56:23 +0000
@@ -582,7 +582,7 @@
             Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
             periodIdsByComma = getCommaDelimitedString( periodIds );
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yy" );
-            System.out.println(simpleDateFormat.format( sDate) +" : "+ simpleDateFormat.format( eDate ) );
+            
             
             String dataElementIdsByComma = "-1";
             String optComboIdsByComma = "-1";
@@ -654,16 +654,24 @@
             }
            for(int j=0;j<=tableSubHeadings.size()-1;j++)
             { 
+               int increment=0;
+               
                 for(int k=0; k<=tableSubHeadings.get( j ).size()-1;k++)
                 {
+                   
                     if(tableSubHeadings.get( j ).get( k )==" ")
                     {                                    
                     }
                     else
-                    {   
+                    { 
+                        if(tableSubHeadings.get( j ).get( k ).contains( tableSubHeadings.get( j ).get( k ) ))
+                        {
+                            increment++;
+                        }
+                        
                         frb.addColumn(tableSubHeadings.get( j ).get( k ),
-                            tableSubHeadings.get( j ).get( k ), String.class.getName(), 50, true);   
-                        content.add( tableSubHeadings.get( j ).get( k ) );                        
+                            tableSubHeadings.get( j ).get( k )+ " "+ increment , String.class.getName(), 50, true);   
+                        content.add( tableSubHeadings.get( j ).get( k )+ " "+increment );                        
                             count++;
                     }
                 }             
@@ -688,7 +696,7 @@
             
             for( OrganisationUnit orgUnit : orgUnitList )
             {
-                Map numberOfData=new HashMap();
+                Map<String, String> numberOfData=new HashMap<String, String>();
                 List<String> oneTableDataRow = new ArrayList<String>();
                 String orgUnitBranch = "";
                 if( orgUnit.getParent() != null )
@@ -702,25 +710,27 @@
                 
                 numberOfData.put( content.get( 0 ), orgUnitBranch );
                 numberOfData.put( content.get( 1 ), orgUnit.getName() );
+                int i=2;
                 for( CCEMReportDesign ccemReportDesign1 :  reportDesignList )
                 {                
                     String ccemCellContent1 = ccemSettingsMap.get( ccemReportDesign1.getContent() );
                     Integer dataElementId = Integer.parseInt( ccemCellContent1.split( ":" )[0] );
                     Integer optComboId = Integer.parseInt( ccemCellContent1.split( ":" )[1] );
                     
-                    for(int i=0;i<=periodList.size()-1;i++)
-                    {
-                        Period period=new Period();
+                    for(Period period : periodList)
+                    { 
                         Integer temp = equipmentDataValueMap.get( orgUnit.getId()+":"+dataElementId+":"+period.getId() );
                         if( temp == null )
                         {                            
-                            numberOfData.put(content.get( i+2 ), " " );
+                            numberOfData.put(content.get( i ), " " );                            
                         }
                         else
-                        {                            
-                            numberOfData.put(content.get( i+2 ), temp );
+                        {                       
+                            numberOfData.put(content.get( i ) , temp+"" );
                         }
-                    }                    
+                        i++; 
+                    }  
+                    
                 }                
                 tableData.add( numberOfData );
             }
@@ -737,6 +747,7 @@
             jr = DynamicJasperHelper.generateJasperReport( dynamicReport, new ClassicLayoutManager(), hash );
             jasperPrint = JasperFillManager.fillReport( jr, hash, ds );
         }
+        
         ServletOutputStream ouputStream = response.getOutputStream();
         JRExporter exporter = null;
         if ( "pdf".equalsIgnoreCase( type ) )