dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13776
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4507: Merge From 2.3 to Trunk Work in Progress
------------------------------------------------------------
revno: 4507
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-09-03 11:18:23 +0530
message:
Merge From 2.3 to Trunk Work in Progress
modified:
dhis-2/dhis-web/dhis-web-portal/india-pom.xml
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/resources/META-INF/dhis/beans.xml
local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/EDReportResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.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/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java
local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml
--
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 2011-04-28 13:07:21 +0000
+++ dhis-2/dhis-web/dhis-web-portal/india-pom.xml 2011-09-03 05:48:23 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
</parent>
<artifactId>dhis-web-india-portal</artifactId>
=== 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-06-15 05:50:55 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2011-09-03 05:48:23 +0000
@@ -43,6 +43,8 @@
import org.hisp.dhis.survey.SurveyService;
import org.hisp.dhis.surveydatavalue.SurveyDataValue;
import org.hisp.dhis.surveydatavalue.SurveyDataValueService;
+import org.hisp.dhis.system.database.DatabaseInfo;
+import org.hisp.dhis.system.database.DatabaseInfoProvider;
import org.hisp.dhis.system.util.MathUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
@@ -160,6 +162,13 @@
this.aggregatedDataValueService = aggregatedDataValueService;
}
+ private DatabaseInfoProvider databaseInfoProvider;
+
+ public void setDatabaseInfoProvider( DatabaseInfoProvider databaseInfoProvider )
+ {
+ this.databaseInfoProvider = databaseInfoProvider;
+ }
+
// -------------------------------------------------------------------------
// Report_in
// -------------------------------------------------------------------------
@@ -1775,12 +1784,24 @@
public Map<String, String> getResultDataValueFromAggregateTable( Integer orgunitId, String dataElmentIdsByComma, String periodIdsByComma )
{
Map<String, String> aggDeMap = new HashMap<String, String>();
+ DatabaseInfo dataBaseInfo = databaseInfoProvider.getDatabaseInfo();
try
{
- String query = "SELECT dataelementid,categoryoptioncomboid, SUM(value) FROM aggregateddatavalue" +
- " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
- " organisationunitid = "+ orgunitId +" AND "+
- " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid";
+ String query = "";
+ if( dataBaseInfo.getType().equalsIgnoreCase( "postgresql" ) )
+ {
+ query = "SELECT dataelementid,categoryoptioncomboid, SUM( cast( value as numeric) ) FROM aggregateddatavalue" +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " organisationunitid = "+ orgunitId +" AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid";
+ }
+ else if( dataBaseInfo.getType().equalsIgnoreCase( "mysql" ) )
+ {
+ query = "SELECT dataelementid,categoryoptioncomboid, SUM( value ) FROM aggregateddatavalue" +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " organisationunitid = "+ orgunitId +" AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid";
+ }
SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
@@ -1806,14 +1827,27 @@
public Map<String, String> getResultDataValueFromAggregateTableByPeriodAgg( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma )
{
Map<String, String> aggDataMap = new HashMap<String, String>();
+ DatabaseInfo dataBaseInfo = databaseInfoProvider.getDatabaseInfo();
try
{
- String query = "SELECT organisationunitid, dataelementid,categoryoptioncomboid, SUM(value) FROM aggregateddatavalue" +
+ String query = "";
+ if( dataBaseInfo.getType().equalsIgnoreCase( "postgresql" ) )
+ {
+ query = "SELECT organisationunitid, dataelementid,categoryoptioncomboid, SUM( cast( value as numeric) ) FROM aggregateddatavalue" +
" WHERE dataelementid IN (" + dataElmentIdsByComma + ") AND "+
" organisationunitid IN ("+ orgUnitIdsByComma +") AND "+
" periodid IN (" + periodIdsByComma +") " +
" GROUP BY organisationunitid,dataelementid,categoryoptioncomboid";
-
+ }
+ else if( dataBaseInfo.getType().equalsIgnoreCase( "mysql" ) )
+ {
+ query = "SELECT organisationunitid, dataelementid,categoryoptioncomboid, SUM(value) FROM aggregateddatavalue" +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + ") AND "+
+ " organisationunitid IN ("+ orgUnitIdsByComma +") AND "+
+ " periodid IN (" + periodIdsByComma +") " +
+ " GROUP BY organisationunitid,dataelementid,categoryoptioncomboid";
+ }
+
SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
while ( rs.next() )
@@ -1874,13 +1908,24 @@
public Map<String, String> getAggDataFromDataValueTable( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma )
{
Map<String, String> aggDeMap = new HashMap<String, String>();
+ DatabaseInfo dataBaseInfo = databaseInfoProvider.getDatabaseInfo();
try
{
- String query = "SELECT dataelementid,categoryoptioncomboid, SUM(value) FROM datavalue " +
+ String query = "";
+ if( dataBaseInfo.getType().equalsIgnoreCase( "postgresql" ) )
+ {
+ query = "SELECT dataelementid,categoryoptioncomboid, SUM( cast( value as numeric) ) FROM datavalue " +
" WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
" sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
" periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid";
-
+ }
+ else if( dataBaseInfo.getType().equalsIgnoreCase( "mysql" ) )
+ {
+ query = "SELECT dataelementid,categoryoptioncomboid, SUM(value) FROM datavalue " +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid";
+ }
SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
while ( rs.next() )
@@ -1905,12 +1950,24 @@
public Map<String, String> getAggDataFromDataValueTableByDeAndPeriodwise( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma )
{
Map<String, String> aggDataMap = new HashMap<String, String>();
+ DatabaseInfo dataBaseInfo = databaseInfoProvider.getDatabaseInfo();
try
{
- String query = "SELECT dataelementid,categoryoptioncomboid,periodid,SUM(value) FROM datavalue " +
- " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
- " sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
- " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid,periodid";
+ String query = "";
+ if( dataBaseInfo.getType().equalsIgnoreCase( "postgresql" ) )
+ {
+ query = "SELECT dataelementid,categoryoptioncomboid,periodid,SUM( cast( value as numeric) ) FROM datavalue " +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid,periodid";
+ }
+ else if( dataBaseInfo.getType().equalsIgnoreCase( "mysql" ) )
+ {
+ query = "SELECT dataelementid,categoryoptioncomboid,periodid,SUM( value ) FROM datavalue " +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid,periodid";
+ }
SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
@@ -1937,13 +1994,25 @@
public Map<String, String> getDataFromDataValueTableByPeriodAgg( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma )
{
Map<String, String> aggDataMap = new HashMap<String, String>();
+ DatabaseInfo dataBaseInfo = databaseInfoProvider.getDatabaseInfo();
try
{
- String query = "SELECT sourceid,dataelementid,categoryoptioncomboid, SUM(value) FROM datavalue " +
+ String query = "";
+ if( dataBaseInfo.getType().equalsIgnoreCase( "postgresql" ) )
+ {
+ query = "SELECT sourceid,dataelementid,categoryoptioncomboid, SUM( cast( value as numeric) ) FROM datavalue " +
" WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
" sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
" periodid IN (" + periodIdsByComma +") GROUP BY sourceid,dataelementid,categoryoptioncomboid";
-
+ }
+ else if( dataBaseInfo.getType().equalsIgnoreCase( "mysql" ) )
+ {
+ query = "SELECT sourceid,dataelementid,categoryoptioncomboid, SUM(value) FROM datavalue " +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY sourceid,dataelementid,categoryoptioncomboid";
+ }
+
SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
while ( rs.next() )
@@ -2002,6 +2071,9 @@
public String getResultDataValueFromAggregateTable( String formula, String periodIdsByComma, Integer orgunitId )
{
+ DatabaseInfo dataBaseInfo = databaseInfoProvider.getDatabaseInfo();
+ String query = "";
+
try
{
Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
@@ -2024,11 +2096,21 @@
int dataElementId = Integer.parseInt( replaceString );
int optionComboId = Integer.parseInt( optionComboIdStr );
- String query = "SELECT SUM(value) FROM aggregateddatavalue WHERE dataelementid = " + dataElementId +
- " AND categoryoptioncomboid = "+optionComboId +
- " AND periodid IN ("+ periodIdsByComma +")"+
- " AND organisationunitid = "+ orgunitId;
-
+ if( dataBaseInfo.getType().equalsIgnoreCase( "postgresql" ) )
+ {
+ query = "SELECT SUM( cast( value as numeric) ) FROM aggregateddatavalue WHERE dataelementid = " + dataElementId +
+ " AND categoryoptioncomboid = "+optionComboId +
+ " AND periodid IN ("+ periodIdsByComma +")"+
+ " AND organisationunitid = "+ orgunitId;
+ }
+ else if( dataBaseInfo.getType().equalsIgnoreCase( "mysql" ) )
+ {
+ query = "SELECT SUM(value) FROM aggregateddatavalue WHERE dataelementid = " + dataElementId +
+ " AND categoryoptioncomboid = "+optionComboId +
+ " AND periodid IN ("+ periodIdsByComma +")"+
+ " AND organisationunitid = "+ orgunitId;
+ }
+
SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
Double aggregatedValue = null;
=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml 2011-01-11 16:58:18 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml 2011-09-03 05:48:23 +0000
@@ -29,6 +29,8 @@
<property name="surveyService" ref="org.hisp.dhis.survey.SurveyService" />
<property name="surveyDataValueService" ref="org.hisp.dhis.surveydatavalue.SurveyDataValueService" />
<property name="aggregatedDataValueService" ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
+ <property name="databaseInfoProvider" ref="databaseInfoProvider" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
<!-- DeletionHandlers -->
=== modified file 'local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java'
--- local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java 2011-04-29 13:45:23 +0000
+++ local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java 2011-09-03 05:48:23 +0000
@@ -117,7 +117,6 @@
this.dataSetService = dataSetService;
}
-
private I18nFormat format;
public void setFormat( I18nFormat format )
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/EDReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/EDReportResultAction.java 2011-07-07 10:56:12 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/EDReportResultAction.java 2011-09-03 05:48:23 +0000
@@ -18,9 +18,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
@@ -34,37 +31,29 @@
import jxl.write.WritableWorkbook;
import org.amplecode.quick.StatementManager;
-import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.config.Configuration_IN;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.reports.ReportService;
import org.hisp.dhis.user.CurrentUserService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
import com.opensymphony.xwork2.Action;
public class EDReportResultAction
implements Action
{
-
private final String GENERATEAGGDATA = "generateaggdata";
private final String USEEXISTINGAGGDATA = "useexistingaggdata";
private final String USECAPTUREDDATA = "usecaptureddata";
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -89,13 +78,6 @@
this.indicatorService = indicatorService;
}
- private AggregationService aggregationService;
-
- public void setAggregationService( AggregationService aggregationService )
- {
- this.aggregationService = aggregationService;
- }
-
private ReportService reportService;
public void setReportService( ReportService reportService )
@@ -110,6 +92,13 @@
this.currentUserService = currentUserService;
}
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
// -------------------------------------------------------------------------
// Getter & Setter
// -------------------------------------------------------------------------
@@ -148,8 +137,6 @@
this.indicatorGroupId = indicatorGroupId;
}
- private String raFolderName;
-
private String aggData;
public void setAggData( String aggData )
@@ -158,6 +145,7 @@
}
private List<OrganisationUnit> orgUnitList;
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -168,11 +156,8 @@
statementManager.initialise();
orgUnitList = new ArrayList<OrganisationUnit>();
- raFolderName = reportService.getRAFolderName();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yy" );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
if( !newdir.exists() )
@@ -298,7 +283,19 @@
{
aggDeMap.putAll( reportService.getResultDataValueFromAggregateTable( ou.getId(), dataElmentIdsByComma, periodIdsByComma ) );
}
-
+ else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
+ {
+ List<OrganisationUnit> childOrgUnitTree = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( ou.getId() ) );
+ List<Integer> childOrgUnitTreeIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, childOrgUnitTree ) );
+ String childOrgUnitsByComma = getCommaDelimitedString( childOrgUnitTreeIds );
+
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( childOrgUnitsByComma, dataElmentIdsByComma, periodIdsByComma ) );
+ }
+ else if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
+ {
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( ""+ou.getId(), dataElmentIdsByComma, periodIdsByComma ) );
+ }
+
if ( slno != orgUnitList.size() )
{
sheet0.addCell( new Number( colCount++, rowCount, slno, getCellFormat2() ) );
@@ -315,13 +312,15 @@
Double denValue = 0.0;
Double indValue = 0.0;
+ /*
if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
{
numValue = aggregationService.getAggregatedNumeratorValue( indicator, selectedStartPeriod.getStartDate(), selectedEndPeriod.getEndDate(), ou );
denValue = aggregationService.getAggregatedDenominatorValue( indicator, selectedStartPeriod.getStartDate(), selectedEndPeriod.getEndDate(), ou );
indValue = aggregationService.getAggregatedIndicatorValue( indicator, selectedStartPeriod.getStartDate(), selectedEndPeriod.getEndDate(), ou );
}
- else if ( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
+
+ if ( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
{
indValue = reportService.getIndividualIndicatorValue( indicator, ou, selectedStartPeriod.getStartDate(), selectedEndPeriod.getEndDate() );
@@ -347,42 +346,40 @@
denValue = 0.0;
}
}
- else if ( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
- {
- try
- {
- numValue = Double.parseDouble( reportService.getAggVal( indicator.getNumerator(), aggDeMap ) );
- }
- catch( Exception e )
- {
- numValue = 0.0;
- }
-
- try
- {
- denValue = Double.parseDouble( reportService.getAggVal( indicator.getDenominator(), aggDeMap ) );
- }
- catch( Exception e )
- {
- denValue = 0.0;
- }
+ */
+ try
+ {
+ numValue = Double.parseDouble( reportService.getAggVal( indicator.getNumerator(), aggDeMap ) );
+ }
+ catch( Exception e )
+ {
+ numValue = 0.0;
+ }
+
+ try
+ {
+ denValue = Double.parseDouble( reportService.getAggVal( indicator.getDenominator(), aggDeMap ) );
+ }
+ catch( Exception e )
+ {
+ denValue = 0.0;
+ }
- try
+ try
+ {
+ if( denValue != 0.0 )
{
- if( denValue != 0.0 )
- {
- indValue = ( numValue / denValue ) * indicator.getIndicatorType().getFactor();
- }
- else
- {
- indValue = 0.0;
- }
+ indValue = ( numValue / denValue ) * indicator.getIndicatorType().getFactor();
}
- catch( Exception e )
+ else
{
indValue = 0.0;
}
}
+ catch( Exception e )
+ {
+ indValue = 0.0;
+ }
if ( indValue == null )
indValue = 0.0;
@@ -456,81 +453,6 @@
return SUCCESS;
}
- public List<Integer> getInfoFromXMLForEDReport()
- {
- String fileName = "edReportInfo.xml";
- String path = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + raFolderName
- + File.separator + fileName;
-
- List<Integer> headerInfo = new ArrayList<Integer>();
- try
- {
- String newpath = System.getenv( "DHIS2_HOME" );
- if ( newpath != null )
- {
- path = newpath + File.separator + raFolderName + File.separator + fileName;
- }
- }
- catch ( NullPointerException npe )
- {
- System.out.println( "DHIS2 HOME is not set" );
- // do nothing, but we might be using this somewhere without
- // USER_HOME set, which will throw a NPE
- }
-
- try
- {
- DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
- Document doc = docBuilder.parse( new File( path ) );
- if ( doc == null )
- {
- System.out.println( "XML File Not Found at user home" );
- return null;
- }
-
- NodeList listOfReports = doc.getElementsByTagName( "report" );
- int totalReports = listOfReports.getLength();
- for ( int s = 0; s < totalReports; s++ )
- {
- Node reportNode = listOfReports.item( s );
- if ( reportNode.getNodeType() == Node.ELEMENT_NODE )
- {
- Element reportElement = (Element) reportNode;
-
- NodeList orgUnitList = reportElement.getElementsByTagName( "orgunit" );
- Element orgUnitElement = (Element) orgUnitList.item( 0 );
- NodeList textOrgUnitList = orgUnitElement.getChildNodes();
- String orgUnitIdStr = ((Node) textOrgUnitList.item( 0 )).getNodeValue().trim();
-
- headerInfo.add( Integer.parseInt( orgUnitIdStr ) );
-
- NodeList indicatorGroupList = reportElement.getElementsByTagName( "indicatorgroup" );
- Element indicatorGroupElement = (Element) indicatorGroupList.item( 0 );
- NodeList textindicatorGroupList = indicatorGroupElement.getChildNodes();
- String indicatorGroupIdStr = ((Node) textindicatorGroupList.item( 0 )).getNodeValue().trim();
-
- headerInfo.add( Integer.parseInt( indicatorGroupIdStr ) );
- }
- }// end of for loop with s var
- }// try block end
- catch ( SAXParseException err )
- {
- System.out.println( "** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId() );
- System.out.println( " " + err.getMessage() );
- }
- catch ( SAXException e )
- {
- Exception x = e.getException();
- ((x == null) ? e : x).printStackTrace();
- }
- catch ( Throwable t )
- {
- t.printStackTrace();
- }
-
- return headerInfo;
- }
public WritableCellFormat getCellFormat1()
throws Exception
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java 2011-07-07 10:56:12 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java 2011-09-03 05:48:23 +0000
@@ -316,7 +316,8 @@
// Coding For Printing MetaData
// ----------------------------------------------------------------------
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -325,7 +326,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "Summary Report", 0 );
@@ -434,7 +435,8 @@
List<DataElement> dataElementList = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
Collections.sort( dataElementList, new DataElementNameComparator() );
- // String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -443,7 +445,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "DataElements", 0 );
@@ -576,7 +578,8 @@
List<DataElementGroup> dataElementGroupList = new ArrayList<DataElementGroup>( dataElementService
.getAllDataElementGroups() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -585,7 +588,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "DataElementsGroupWiseList", 0 );
@@ -744,7 +747,8 @@
{
List<OrganisationUnitGroup> orgUnitGroupList = new ArrayList<OrganisationUnitGroup>(
organisationUnitgroupService.getAllOrganisationUnitGroups() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -753,7 +757,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "OrganisationUnitGroupWiseList", 0 );
@@ -978,7 +982,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "OrganisationUnit", 0 );
@@ -1070,6 +1074,7 @@
List<OrganisationUnit> OrganisitionUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( rootOrgUnit.getId() ) );
//String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
if( !newdir.exists() )
@@ -1077,7 +1082,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "OrganisationUnit", 0 );
@@ -1281,8 +1286,6 @@
List<Indicator> indicatorList = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
Collections.sort( indicatorList, new IndicatorNameComparator() );
- // String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
if( !newdir.exists() )
@@ -1290,7 +1293,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "Indicators", 0 );
@@ -1309,6 +1312,9 @@
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "IndicatorID", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 1, rowStart, "IndicatorName", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 2, rowStart, "IndicatorNumerator", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, "IndicatorDenominator", getCellFormat1() ) );
}
else if ( incID.equalsIgnoreCase( PRINT ) )
{
@@ -1329,12 +1335,14 @@
sheet0.addCell( new Label( colStart + 11, rowStart, "IndicatorShortName", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 12, rowStart, "IndicatorUrl", getCellFormat1() ) );
}
+ else
+ {
+ sheet0.addCell( new Label( colStart + 1, rowStart, "IndicatorName", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 2, rowStart, "IndicatorNumerator", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, "IndicatorDenominator", getCellFormat1() ) );
+ }
}
- sheet0.addCell( new Label( colStart + 1, rowStart, "IndicatorName", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 2, rowStart, "IndicatorNumerator", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 3, rowStart, "IndicatorDenominator", getCellFormat1() ) );
-
rowStart++;
for ( Indicator indicator : indicatorList )
@@ -1344,6 +1352,11 @@
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, indicator.getId(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 1, rowStart, indicator.getName(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 2, rowStart, expressionService.getExpressionDescription( indicator
+ .getNumerator() ), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, expressionService.getExpressionDescription( indicator
+ .getDenominator() ), wCellformat ) );
}
else if ( incID.equalsIgnoreCase( PRINT ) )
{
@@ -1367,14 +1380,16 @@
sheet0.addCell( new Label( colStart + 11, rowStart, indicator.getShortName(), wCellformat ) );
sheet0.addCell( new Label( colStart + 12, rowStart, indicator.getUrl(), wCellformat ) );
}
+ else
+ {
+ sheet0.addCell( new Label( colStart + 1, rowStart, indicator.getName(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 2, rowStart, expressionService.getExpressionDescription( indicator
+ .getNumerator() ), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, expressionService.getExpressionDescription( indicator
+ .getDenominator() ), wCellformat ) );
+ }
}
- sheet0.addCell( new Label( colStart + 1, rowStart, indicator.getName(), wCellformat ) );
- sheet0.addCell( new Label( colStart + 3, rowStart, expressionService.getExpressionDescription( indicator
- .getNumerator() ), wCellformat ) );
- sheet0.addCell( new Label( colStart + 2, rowStart, expressionService.getExpressionDescription( indicator
- .getDenominator() ), wCellformat ) );
-
rowStart++;
}
@@ -1398,8 +1413,9 @@
List<IndicatorGroup> indicatorGroupList = new ArrayList<IndicatorGroup>( indicatorService
.getAllIndicatorGroups() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
if( !newdir.exists() )
@@ -1407,7 +1423,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "IndicatorGroupWiseList", 0 );
@@ -1537,7 +1553,8 @@
List<DataSet> datasetList = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
Collections.sort( datasetList, new DataSetNameComparator() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -1546,7 +1563,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "DataSets", 0 );
@@ -1626,7 +1643,8 @@
.getAllValidationRules() );
Collections.sort( validationRuleList, new ValidationRuleNameComparator() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -1635,7 +1653,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "ValidationRule", 0 );
@@ -1735,7 +1753,8 @@
List<ValidationRuleGroup> validationRuleGroupList = new ArrayList<ValidationRuleGroup>( validationRuleService
.getAllValidationRuleGroups() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -1744,7 +1763,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "ValidationRuleGroupWiseList", 0 );
@@ -1867,7 +1886,8 @@
{
List<User> userList = new ArrayList<User>( userStore.getAllUsers() );
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ // + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
@@ -1876,7 +1896,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "UserInfo", 0 );
=== 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-07-07 10:56:12 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java 2011-09-03 05:48:23 +0000
@@ -36,9 +36,7 @@
import org.amplecode.quick.StatementManager;
import org.hisp.dhis.config.Configuration_IN;
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -242,7 +240,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
@@ -252,7 +250,8 @@
wCellformat.setAlignment( Alignment.CENTRE );
wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
wCellformat.setWrap( true );
-
+
+ /*
String dataSetIds = selReportObj.getDataSetIds();
Collection<Integer> dataElementIdList = new ArrayList<Integer>();
if( dataSetIds != null && !dataSetIds.trim().equalsIgnoreCase( "" ) )
@@ -268,10 +267,10 @@
{
dataElementIdList.addAll( getIdentifiers( DataElement.class, dataElementService.getAggregateableDataElements() ) );
}
-
+
String dataElmentIdsByComma = getCommaDelimitedString( dataElementIdList );
+ */
-
// Period Info
sDate = format.parseDate( startDate );
eDate = format.parseDate( endDate );
@@ -284,8 +283,10 @@
// Getting DataValues
List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
+
+ String dataElmentIdsByComma = reportService.getDataelementIds( reportDesignList );
+
int orgUnitCount = 0;
-
Iterator<OrganisationUnit> it = orgUnitList.iterator();
while ( it.hasNext() )
{
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java 2011-07-07 10:56:12 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java 2011-09-03 05:48:23 +0000
@@ -36,9 +36,7 @@
import org.amplecode.quick.StatementManager;
import org.hisp.dhis.config.Configuration_IN;
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -272,6 +270,7 @@
}
// To get Aggregation Data
+ /*
String dataSetIds = selReportObj.getDataSetIds();
Collection<Integer> dataElementIdList = new ArrayList<Integer>();
if( dataSetIds != null && !dataSetIds.trim().equalsIgnoreCase( "" ) )
@@ -289,9 +288,12 @@
}
String dataElmentIdsByComma = getCommaDelimitedString( dataElementIdList );
+ */
List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
+ String dataElmentIdsByComma = reportService.getDataelementIds( reportDesignList );
+
int colCount = 0;
for( Period period : periodList )
{
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2011-07-07 10:56:12 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2011-09-03 05:48:23 +0000
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -29,33 +28,24 @@
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
-import jxl.write.Label;
-import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.amplecode.quick.StatementManager;
+import org.apache.velocity.tools.generic.MathTool;
import org.hisp.dhis.config.Configuration_IN;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientIdentifier;
import org.hisp.dhis.patient.PatientIdentifierService;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.patient.PatientIdentifierTypeService;
import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
@@ -77,6 +67,17 @@
import org.xml.sax.SAXParseException;
import com.opensymphony.xwork2.Action;
+import java.util.Collections;
+import jxl.write.Label;
+import jxl.write.WritableCell;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
public class PortalReportsResultAction implements Action
{
@@ -368,8 +369,7 @@
simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
//outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-
- String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
+ outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
if( !newdir.exists() )
{
@@ -377,10 +377,10 @@
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
- System.out.println( " reportList " + reportList );
+ System.out.println( inputTemplatePath );
generatPortalReport();
+
statementManager.destroy();
return SUCCESS;
@@ -390,6 +390,15 @@
public void generatPortalReport() throws Exception
{
Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+ if( templateWorkbook == null )
+ {
+ System.out.println( "template work book is null");
+ }
+ else
+ {
+ System.out.println( outputReportPath );
+ }
+
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
// Cell formatting
@@ -780,7 +789,7 @@
String str = patientDataValue.getValue();
if ( str != null )
{
- SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
Date doseDate = simpleLmpDateFormat.parse( str );
if ( includePeriod != null )
{
@@ -833,15 +842,21 @@
else if ( deCodeString.equalsIgnoreCase( "DOB" ) )
{
Date patientDate = patient.getBirthDate();
- SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "dd/MM/yyyy" );
tempStr = simpleDateFormat1.format( patientDate );
}
else if ( deCodeString.equalsIgnoreCase( "LMP" ) )
{
Date lmpDate = programInstance.getDateOfIncident();
- SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
tempStr = simpleLmpDateFormat.format( lmpDate );
- }
+ }
+ else if( deCodeString.equalsIgnoreCase( "PROGRAM_ENROLLMENT" ) )
+ {
+ Date enrollmentDate = programInstance.getEnrollmentDate();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
+ tempStr = simpleDateFormat.format( enrollmentDate );
+ }
else if ( deCodeString.equalsIgnoreCase( "PNCCheck" ) )
{
ProgramStage ps = programStageService.getProgramStage( 7 );
@@ -914,7 +929,7 @@
String str = patientDataValue.getValue();
if ( str != null )
{
- SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
Date doseDate = simpleLmpDateFormat.parse( str );
if ( includePeriod != null )
{
@@ -962,7 +977,7 @@
if ( patientDataValue1 != null )
{
ifaCount = Integer.parseInt( patientDataValue1.getValue() ) + ifaCount;
- SimpleDateFormat simpleIfaDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleIfaDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
if ( ifaCount >= 100 )
{
tempStr = simpleIfaDateFormat.format( programStageInstance.getExecutionDate() );
@@ -1466,7 +1481,7 @@
String str = patientDataValue.getValue();
if ( str != null )
{
- SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
Date doseDate = simpleLmpDateFormat.parse( str );
if ( includePeriod != null )
{
@@ -1519,15 +1534,21 @@
else if ( deCodeString.equalsIgnoreCase( "DOB" ) )
{
Date patientDate = patient.getBirthDate();
- SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "dd/MM/yyyy" );
tempStr = simpleDateFormat1.format( patientDate );
}
else if ( deCodeString.equalsIgnoreCase( "LMP" ) )
{
Date lmpDate = programInstance.getDateOfIncident();
- SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
tempStr = simpleLmpDateFormat.format( lmpDate );
}
+ else if ( deCodeString.equalsIgnoreCase( "PROGRAM_ENROLLMENT" ) )
+ {
+ Date enrollDate = programInstance.getEnrollmentDate();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
+ tempStr = simpleDateFormat.format( enrollDate );
+ }
else if ( deCodeString.equalsIgnoreCase( "PNCCheck" ) )
{
ProgramStage ps = programStageService.getProgramStage( 7 );
@@ -1600,7 +1621,7 @@
String str = patientDataValue.getValue();
if ( str != null )
{
- SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleLmpDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
Date doseDate = simpleLmpDateFormat.parse( str );
if ( includePeriod != null )
{
@@ -1648,7 +1669,7 @@
if ( patientDataValue1 != null )
{
ifaCount = Integer.parseInt( patientDataValue1.getValue() ) + ifaCount;
- SimpleDateFormat simpleIfaDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat simpleIfaDateFormat = new SimpleDateFormat( "dd/MM/yyyy" );
if ( ifaCount >= 100 )
{
tempStr = simpleIfaDateFormat.format( programStageInstance.getExecutionDate() );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java 2011-07-07 10:56:12 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java 2011-09-03 05:48:23 +0000
@@ -209,8 +209,6 @@
reportFileNameTB = selReportObj.getExcelTemplateName();
String inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
- //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
File newdir = new File( outputReportPath );
if( !newdir.exists() )
@@ -218,7 +216,7 @@
newdir.mkdirs();
}
outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-
+
if( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
{
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
@@ -288,9 +286,7 @@
else
{
ouList.addAll( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
-
excludeOrgUnits.retainAll( ouList );
-
ouList.retainAll( orgGroupMembers );
}
=== modified file 'local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2011-06-17 10:53:09 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2011-09-03 05:48:23 +0000
@@ -183,10 +183,9 @@
<property name="statementManager" ref="statementManager"/>
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService" />
<property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
<!-- Auto Reports -->