dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09358
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2463: Cleaning Code: Feedback Reports; Fixed bug in OrgunitwiseProgress, BenificiaryInfo Reports
------------------------------------------------------------
revno: 2463
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-05 11:01:43 +0530
message:
Cleaning Code: Feedback Reports; Fixed bug in OrgunitwiseProgress, BenificiaryInfo Reports
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java
local/in/dhis-in-services/dhis-in-service-reports/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-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsFormAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserFormAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.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/resources/META-INF/dhis/beans.xml
local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties
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/feedbackReportAnalysisFront.vm
local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js
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/menuWithTreeForDataSetLockReports.vm
local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForFeedback.vm
local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForRoutineReport.vm
local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.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 '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 2010-12-03 13:29:28 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java 2011-01-05 05:31:43 +0000
@@ -121,4 +121,5 @@
List<OrganisationUnit> getDataNotSentOrgUnits( DataSet dataSet, Period period, OrganisationUnit rootOrgunit );
+ String getResultSurveyValue( String formula, OrganisationUnit organisationUnit );
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/pom.xml 2010-12-29 06:38:03 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/pom.xml 2011-01-05 05:31:43 +0000
@@ -44,6 +44,11 @@
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-support-system</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-service-reporting</artifactId>
+ </dependency>
+
<!-- Other -->
=== 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-31 07:16:18 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2011-01-05 05:31:43 +0000
@@ -34,6 +34,10 @@
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.source.Source;
+import org.hisp.dhis.survey.Survey;
+import org.hisp.dhis.survey.SurveyService;
+import org.hisp.dhis.surveydatavalue.SurveyDataValue;
+import org.hisp.dhis.surveydatavalue.SurveyDataValueService;
import org.hisp.dhis.system.util.MathUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
@@ -130,6 +134,20 @@
this.organisationUnitService = organisationUnitService;
}
+ private SurveyService surveyService;
+
+ public void setSurveyService( SurveyService surveyService )
+ {
+ this.surveyService = surveyService;
+ }
+
+ private SurveyDataValueService surveyDataValueService;
+
+ public void setSurveyDataValueService( SurveyDataValueService surveyDataValueService )
+ {
+ this.surveyDataValueService = surveyDataValueService;
+ }
+
// -------------------------------------------------------------------------
// Report_in
// -------------------------------------------------------------------------
@@ -1485,4 +1503,277 @@
return deInfo.toString();
}
+
+ public String getResultSurveyValue( String formula, OrganisationUnit organisationUnit )
+ {
+ try
+ {
+ int deFlag1 = 0;
+ int deFlag2 = 0;
+ Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
+
+ Matcher matcher = pattern.matcher( formula );
+ StringBuffer buffer = new StringBuffer();
+
+ while ( matcher.find() )
+ {
+ String replaceString = matcher.group();
+
+ replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
+
+ String surveyIdString = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString.length() );
+
+ replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
+
+ int indicatorId = Integer.parseInt( replaceString );
+
+ int surveyId = Integer.parseInt( surveyIdString );
+
+ Indicator indicator = indicatorService.getIndicator( indicatorId );
+
+ Survey survey = surveyService.getSurvey( surveyId );
+
+ if ( indicator == null || survey == null)
+ {
+ replaceString = "";
+ matcher.appendReplacement( buffer, replaceString );
+ continue;
+ }
+
+ SurveyDataValue surveyDataValue = new SurveyDataValue();
+
+ surveyDataValue = surveyDataValueService.getSurveyDataValue(organisationUnit, survey, indicator);
+
+ if ( surveyDataValue == null )
+ {
+ replaceString = "";
+ matcher.appendReplacement( buffer, replaceString );
+ continue;
+ }
+
+ Double surveyValue = Double.valueOf( surveyDataValue.getValue() );
+
+ if ( surveyValue == null )
+ {
+ replaceString = NULL_REPLACEMENT;
+ }
+ else
+ {
+ replaceString = String.valueOf( surveyValue );
+ deFlag2 = 1;
+ }
+
+ matcher.appendReplacement( buffer, replaceString );
+ }
+
+ matcher.appendTail( buffer );
+
+ String resultValue = "";
+ if ( deFlag1 == 0 )
+ {
+ double d = 0.0;
+ try
+ {
+ d = MathUtils.calculateExpression( buffer.toString() );
+ }
+ catch ( Exception e )
+ {
+ d = 0.0;
+ }
+ if ( d == -1 )
+ d = 0.0;
+ else
+ {
+ d = Math.round( d * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
+ resultValue = "" + d;
+ }
+
+ if ( deFlag2 == 0 )
+ {
+ resultValue = " ";
+ }
+ }
+ else
+ {
+ resultValue = buffer.toString();
+ }
+ //System.out.println("Result in Survey : "+ resultValue);
+ return resultValue;
+ }
+ catch ( NumberFormatException ex )
+ {
+ throw new RuntimeException( "Illegal Indicator and survey id", ex );
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ // Get Aggregated Result for dataelement expression from ReportTable
+ // -------------------------------------------------------------------------
+ public String getResultDataValueFromReportTable( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB )
+ {
+ int deFlag1 = 0;
+ int isAggregated = 0;
+
+ try
+ {
+ Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
+
+ Matcher matcher = pattern.matcher( formula );
+ StringBuffer buffer = new StringBuffer();
+
+ String resultValue = "";
+
+ while ( matcher.find() )
+ {
+ String replaceString = matcher.group();
+
+ replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
+ .length() );
+
+ replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
+
+ int dataElementId = Integer.parseInt( replaceString );
+ int optionComboId = Integer.parseInt( optionComboIdStr );
+
+ DataElement dataElement = dataElementService.getDataElement( dataElementId );
+ DataElementCategoryOptionCombo optionCombo = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( optionComboId );
+
+ if ( dataElement == null || optionCombo == null )
+ {
+ replaceString = "";
+ matcher.appendReplacement( buffer, replaceString );
+ continue;
+ }
+ if ( dataElement.getType().equalsIgnoreCase( "int" ) )
+ {
+ Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo,
+ startDate, endDate, organisationUnit );
+ if ( aggregatedValue == null )
+ {
+ replaceString = NULL_REPLACEMENT;
+ }
+ else
+ {
+ replaceString = String.valueOf( aggregatedValue );
+
+ isAggregated = 1;
+ }
+ }
+ else
+ {
+ deFlag1 = 1;
+ PeriodType dePeriodType = getDataElementPeriodType( dataElement );
+ //List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType( dePeriodType, startDate, endDate ) );
+ List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( dePeriodType, startDate, endDate ) );
+ Period tempPeriod = new Period();
+ if ( periodList == null || periodList.isEmpty() )
+ {
+ replaceString = "";
+ matcher.appendReplacement( buffer, replaceString );
+ continue;
+ }
+ else
+ {
+ tempPeriod = (Period) periodList.get( 0 );
+ }
+
+ DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
+ optionCombo );
+
+ if ( dataValue != null && dataValue.getValue() != null )
+ {
+ replaceString = dataValue.getValue();
+ }
+ else
+ {
+ replaceString = "";
+ }
+
+ if ( replaceString == null )
+ {
+ replaceString = "";
+ }
+ }
+ matcher.appendReplacement( buffer, replaceString );
+
+ resultValue = replaceString;
+ }
+
+ matcher.appendTail( buffer );
+
+ if ( deFlag1 == 0 )
+ {
+ double d = 0.0;
+ try
+ {
+ d = MathUtils.calculateExpression( buffer.toString() );
+ }
+ catch ( Exception e )
+ {
+ d = 0.0;
+ resultValue = "";
+ }
+ if ( d == -1 )
+ {
+ d = 0.0;
+ resultValue = "";
+ }
+ else
+ {
+ // This is to display financial data as it is like 2.1476838
+ resultValue = "" + d;
+
+ // These lines are to display financial data that do not
+ // have decimals
+ d = d * 10;
+ if ( d % 10 == 0 )
+ {
+ resultValue = "" + (int) d / 10;
+ }
+
+ d = d / 10;
+
+ // These line are to display non financial data that do not
+ // require decimals
+ if ( !(reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" )) )
+ {
+ resultValue = "" + (int) d;
+ }
+ }
+
+ }
+ else
+ {
+ resultValue = buffer.toString();
+ }
+
+ if( isAggregated == 0 )
+ {
+ resultValue = " ";
+ }
+
+ if ( resultValue.equalsIgnoreCase( "" ) )
+ {
+ resultValue = " ";
+ }
+
+ return resultValue;
+ }
+ catch ( NumberFormatException ex )
+ {
+ throw new RuntimeException( "Illegal DataElement id", ex );
+ }
+ }
+
+ Double getAggregatedDataValueFromReportTable( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate, OrganisationUnit organisationUnit )
+ {
+ Double aggValue = null;
+ List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( startDate, endDate ) );
+ Period tempPeriod = new Period();
+
+
+
+ return aggValue;
+ }
}
=== 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 2010-12-03 13:29:28 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml 2011-01-05 05:31:43 +0000
@@ -27,6 +27,8 @@
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="surveyService" ref="org.hisp.dhis.survey.SurveyService" />
+ <property name="surveyDataValueService" ref="org.hisp.dhis.surveydatavalue.SurveyDataValueService" />
</bean>
<!-- DeletionHandlers -->
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java 2010-12-22 07:29:08 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java 2011-01-05 05:31:43 +0000
@@ -60,19 +60,11 @@
private String reportType;
-
public void setReportType( String reportType )
{
this.reportType = reportType;
}
-/*
- private String reportTypeName;
- public void setReportTypeName( String reportTypeName )
- {
- this.reportTypeName = reportTypeName;
- }
-*/
private List<Report_in> reportList;
public List<Report_in> getReportList()
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsFormAction.java 2010-09-29 02:04:14 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsFormAction.java 2011-01-05 05:31:43 +0000
@@ -1,18 +1,13 @@
package org.hisp.dhis.reports.benificiaryinfo.action;
import java.io.File;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.hisp.dhis.period.MonthlyPeriodType;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.reports.ReportService;
-import org.hisp.dhis.reports.Report_in;
import org.hisp.dhis.reports.util.Report;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -26,7 +21,6 @@
public class BenificiaryInfoReportsFormAction
implements Action
{
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -38,13 +32,6 @@
this.reportService = reportService;
}
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
// -------------------------------------------------------------------------
// Getter & Setter
// -------------------------------------------------------------------------
@@ -56,20 +43,6 @@
return reportList;
}
- private List<Period> periodList;
-
- public List<Period> getPeriodList()
- {
- return periodList;
- }
-
- private SimpleDateFormat simpleDateFormat;
-
- public SimpleDateFormat getSimpleDateFormat()
- {
- return simpleDateFormat;
- }
-
private String raFolderName;
// -------------------------------------------------------------------------
@@ -82,14 +55,8 @@
{
raFolderName = reportService.getRAFolderName();
- periodList = new ArrayList<Period>( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) );
-
reportList = new ArrayList<Report>();
- simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
-
- System.out.println( "periodList.size " + periodList.size() );
-
getSelectedReportList();
return SUCCESS;
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2010-12-29 16:17:28 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2011-01-05 05:31:43 +0000
@@ -3,7 +3,6 @@
//@23-06-2010 - Date from and to is solved.
//Todo merging of cells for same village
-// <editor-fold defaultstate="collapsed" desc="imports">
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -12,6 +11,7 @@
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;
@@ -27,8 +27,10 @@
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
import jxl.format.VerticalAlignment;
-import jxl.format.Font;
+import jxl.write.Label;
+import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
@@ -37,11 +39,16 @@
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.period.Period;
import org.hisp.dhis.period.PeriodService;
@@ -51,6 +58,7 @@
import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.relationship.RelationshipTypeService;
import org.hisp.dhis.reports.ReportService;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -60,27 +68,14 @@
import org.xml.sax.SAXParseException;
import com.opensymphony.xwork2.Action;
-import java.util.Collections;
-import jxl.format.Colour;
-import jxl.write.Label;
-import jxl.write.WritableCell;
-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.relationship.RelationshipTypeService;
-// </editor-fold>
public class BenificiaryInfoReportsResultAction
implements Action
{
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
- // <editor-fold defaultstate="collapsed" desc="dependencies">
RelationshipTypeService relationshipTypeService;
public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
@@ -177,11 +172,10 @@
this.format = format;
}
- // </editor-fold>
// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
- // <editor-fold defaultstate="collapsed" desc="Properties">
+
private Map<Patient, Set<ProgramStageInstance>> visitsByPatients = new HashMap<Patient, Set<ProgramStageInstance>>();
public Map<Patient, Set<ProgramStageInstance>> getVisitsByPatients()
@@ -316,9 +310,6 @@
private int rowCount;
- // </editor-fold>
- // private String orgUnitInfo = "-1";
- // private String aggDataTableName;
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -331,7 +322,7 @@
// Initialization
simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
deCodesXMLFileName = reportList + "DECodes.xml";
- // System.out.println( "reportList = " + reportList );
+
deCodeType = new ArrayList<String>();
serviceType = new ArrayList<String>();
@@ -340,18 +331,15 @@
colList = new ArrayList<Integer>();
if ( includePeriod != null )
{
- // System.out.println( "startDate = " + startDate + " endDate = " +
- // endDate + " reportname = " + reportFileNameTB +
- // " includePeriod = " + includePeriod );
Calendar c = Calendar.getInstance();
c.setTime( format.parseDate( startDate ) );
c.add( Calendar.DATE, -1 ); // number of days to add
- startDate = format.formatDate( c.getTime() ); // dt is now the new
- // date
+ startDate = format.formatDate( c.getTime() );
+
c.setTime( format.parseDate( endDate ) );
c.add( Calendar.DATE, 1 ); // number of days to add
- endDate = format.formatDate( c.getTime() ); // dt is now the new
- // date
+ endDate = format.formatDate( c.getTime() );
+
sDate = format.parseDate( startDate );
eDate = format.parseDate( endDate );
}
@@ -366,8 +354,6 @@
return SUCCESS;
}
- // <editor-fold defaultstate="collapsed"
- // desc="generatFeedbackReport Method">
public void generatFeedbackReport()
throws Exception
{
@@ -375,7 +361,7 @@
WritableWorkbook outputReportWorkbook = Workbook
.createWorkbook( new File( outputReportPath ), templateWorkbook );
- // System.out.println( "outputReportWorkbook = "+outputReportWorkbook );
+
// Cell formatting
WritableCellFormat wCellformat = new WritableCellFormat();
wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
@@ -392,26 +378,21 @@
// OrgUnit Related Info
selectedOrgUnit = new OrganisationUnit();
- // System.out.println( "______________ " + reportLevelTB );
selectedOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- // Collection<PatientIdentifier> patientIdentifiers =
- // patientIdentifierService.getPatientIdentifiersByOrgUnit(
- // selectedOrgUnit );
-
Collection<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>();
+
// Getting Programs
rowCount = 0;
List<String> deCodesList = getDECodes( deCodesXMLFileName );
Program curProgram = programService.getProgram( Integer.parseInt( reportLevelTB ) );
- // /System.out.println( "curProgram = " + curProgram.getName() );
+
String tempStr = "";
Map<OrganisationUnit, Integer> ouAndLevel = new HashMap<OrganisationUnit, Integer>();
if ( curProgram != null )
{
-
WritableSheet sheet0 = outputReportWorkbook.getSheet( 0 );
- // System.out.println( "curProgram = " + curProgram.getName() );
+
int count1 = 0;
int rowStart = 0;
@@ -420,48 +401,29 @@
orgUnitList = getChildOrgUnitTree( selectedOrgUnit );
List<Integer> levelsList = new ArrayList<Integer>();
- // <editor-fold defaultstate="collapsed" desc="for loop for ou">
+
for ( OrganisationUnit ou : orgUnitList )
{
- // <editor-fold defaultstate="collapsed"
- // desc="saving level of ou in map and list">
int level = organisationUnitService.getLevelOfOrganisationUnit( ou );
ouAndLevel.put( ou, level );
if ( !levelsList.contains( level ) )
{
- // System.out.println("ou "+ou.getName() +
- // " level = "+level);
levelsList.add( level );
}
- // </editor-fold>
+
List<Patient> patientListByOuProgram = new ArrayList<Patient>();
List<Patient> patientListByOu = new ArrayList<Patient>();
- // <editor-fold defaultstate="collapsed"
- // desc="getting patientlist for ou and taking pi">
- patientListByOu.addAll( patientService.getPatients( ou ) );// getting
- // all
- // the
- // patients
- // by
- // ou
+ patientListByOu.addAll( patientService.getPatients( ou ) );
+
Iterator<Patient> patientIterator = patientListByOu.iterator();
while ( patientIterator.hasNext() )
{
- Patient patient = patientIterator.next();// taking patient
- // from
- // patientListByChild
- Set<Program> patientProgramList = patient.getPrograms(); // getting
- // enrolled
- // programs
- // of
- // patient
- // checking if patient is enrolled to curprog then adding
- // them in one list
+ Patient patient = patientIterator.next();
+ Set<Program> patientProgramList = patient.getPrograms();
Collection<ProgramInstance> programInstances = new ArrayList<ProgramInstance>();
programInstances = programInstanceService.getProgramInstances( patient, curProgram );
- // System.out.println( "pi size = "+programInstances.size()
- // );
+
for ( ProgramInstance pi : programInstances )
{
if ( patientProgramList != null )
@@ -486,33 +448,25 @@
}
}
}
- // System.out.println(
- // "patientListByOuProgram = "+patientListByOuProgram.size() );
+
if ( patientListByOuProgram.size() > 0 )
{
ouList.add( ou );
ouPatientList.put( ou.getName(), patientListByOuProgram );
- // System.out.println( "ou = " + ou.getName() +
- // " patientssise = " + patientListByOuProgram.size() );
}
- // </editor-fold>
}
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="getting rowStart">
for ( String deCodeString : deCodesList )
{
- String sType = (String) serviceType.get( count1 );//
+ String sType = (String) serviceType.get( count1 );
if ( sType.equalsIgnoreCase( "rowStart" ) )
{
rowStart = Integer.parseInt( deCodeString );
}
count1++;
}
- // </editor-fold>
+
int lastColNo = colList.get( colList.size() - 1 );
- // <editor-fold defaultstate="collapsed"
- // desc="adding oulevelname in report as column name">
for ( int i = levelsList.size() - 1; i >= 0; i-- )
{
int level = levelsList.get( i );
@@ -520,27 +474,21 @@
sheet0.addCell( new Label( lastColNo, rowStart - 1, organisationUnitService
.getOrganisationUnitLevelByLevel( level ).getName(), deWCellformat ) );
}
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="for loop for ouList">
for ( OrganisationUnit ou : ouList )
{
List<Patient> patientsList = ouPatientList.get( ou.getName() );
- // <editor-fold defaultstate="collapsed"
- // desc="for loop for patientsList">
for ( Patient patient : patientsList )
{
int colNo = 0;
int rowNo = rowStart + rowCount;
count1 = 0;
- // <editor-fold defaultstate="collapsed"
- // desc="for loop for deCodesList">
+
for ( String deCodeString : deCodesList )
{
tempStr = "";
String sType = (String) serviceType.get( count1 );
- // <editor-fold defaultstate="collapsed"
- // desc="stype = caseProperty">
+
if ( sType.equalsIgnoreCase( "caseProperty" ) )
{
if ( deCodeString.equalsIgnoreCase( "Name" ) )
@@ -580,9 +528,6 @@
}
}
}
- // </editor-fold>
- // <editor-fold defaultstate="collapsed"
- // desc="stype = caseAttribute">
else if ( sType.equalsIgnoreCase( "caseAttribute" ) )
{
int deCodeInt = Integer.parseInt( deCodeString );
@@ -599,14 +544,9 @@
tempStr = " ";
}
}
- // </editor-fold>
- // <editor-fold defaultstate="collapsed"
- // desc="stype = identifiertype">
else if ( sType.equalsIgnoreCase( "identifiertype" ) )
{
int deCodeInt = Integer.parseInt( deCodeString );
- // _______________________Id.
- // no._______________________
PatientIdentifierType patientIdentifierType = patientIdentifierTypeService
.getPatientIdentifierType( deCodeInt );
if ( patientIdentifierType != null )
@@ -623,51 +563,31 @@
}
}
}
- // </editor-fold>
- // <editor-fold defaultstate="collapsed"
- // desc="stype = srno">
else if ( sType.equalsIgnoreCase( "srno" ) )
{
int tempNum = 1 + rowCount;
tempStr = String.valueOf( tempNum );
}
- // </editor-fold>
- // <editor-fold defaultstate="collapsed"
- // desc="stype = rowStart">
if ( !sType.equalsIgnoreCase( "rowStart" ) && !sType.equalsIgnoreCase( "reportProperty" ) )
{
int tempColNo = colList.get( count1 );
int sheetNo = sheetList.get( count1 );
sheet0 = outputReportWorkbook.getSheet( sheetNo );
WritableCell cell = sheet0.getWritableCell( tempColNo, rowNo );
- // System.out.println(
- // "_______________________ count = "
- // +count1+"tempColNo = " + tempColNo + " rowNo = "
- // + rowNo + " value = " + tempStr );
sheet0.addCell( new Label( tempColNo, rowNo, tempStr, wCellformat ) );
colNo = tempColNo;
}
- // </editor-fold>
count1++;
}// end of decodelist for loop
- // </editor-fold>
- // <editor-fold defaultstate="collapsed"
- // desc="adding ou in report at the end column">
OrganisationUnit ouname = ou;
for ( int i = levelsList.size() - 1; i >= 0; i-- )
{
colNo++;
int level = organisationUnitService.getLevelOfOrganisationUnit( ouname );
- // System.out.println(
- // "___________i = "+i+" levelsList.get( i ) = "
- // +levelsList.get( i ) + " level = "+level +
- // " ou = "+ouname.getName() );
if ( levelsList.get( i ) == level )
{
sheet0.addCell( new Label( colNo, rowNo, ouname.getName(), wCellformat ) );
- // System.out.println( colNo+" "+ rowNo+" "+
- // ou.getName()+" "+ wCellformat );
}
ouname = ouname.getParent();
}
@@ -675,10 +595,7 @@
rowCount++;
rowNo++;
}// end of patientlist
- // </editor-fold>
}// end of oulist
- // </editor-fold>
-
}// end of if program not null loop
outputReportWorkbook.write();
@@ -686,8 +603,6 @@
fileName = reportFileNameTB.replace( ".xls", "" );
fileName += "_" + selectedOrgUnit.getShortName() + ".xls";
- // System.out.println( "fileName = " + fileName + " outputReportPath = "
- // + outputReportPath );
File outputReportFile = new File( outputReportPath );
@@ -696,12 +611,10 @@
outputReportFile.deleteOnExit();
}
- // </editor-fold>
/*
* Returns a list which contains the DataElementCodes
*/
- // <editor-fold defaultstate="collapsed" desc="getChildOrgUnitTree method">
public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
{
List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
@@ -717,9 +630,7 @@
return orgUnitTree;
}// getChildOrgUnitTree end
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="getDECodes method">
public List<String> getDECodes( String fileName )
{
List<String> deCodes = new ArrayList<String>();
@@ -782,9 +693,6 @@
return deCodes;
}
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="getPreviousPeriod method">
public Period getPreviousPeriod( Date sDate )
{
Period period = new Period();
@@ -806,9 +714,6 @@
return period;
}
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="getNextPeriod method">
public Period getNextPeriod( Date sDate )
{
Period period = new Period();
@@ -830,9 +735,6 @@
return period;
}
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="getPeriodByMonth method">
public Period getPeriodByMonth( int month, int year, PeriodType periodType )
{
int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
@@ -867,10 +769,6 @@
return newPeriod;
}
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed"
- // desc="getStartingEndingPeriods method">
public List<Calendar> getStartingEndingPeriods( String deType, Date sDate, Date eDate )
{
@@ -931,5 +829,4 @@
return calendarList;
}
- // </editor-fold>
}
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserFormAction.java 2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserFormAction.java 2011-01-05 05:31:43 +0000
@@ -1,12 +1,8 @@
package org.hisp.dhis.reports.feedback.action;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.reports.ReportType;
@@ -16,7 +12,6 @@
public class GenerateFeedbackReportAnalyserFormAction
implements Action
{
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -28,56 +23,10 @@
this.periodService = periodService;
}
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- public OrganisationUnitService getOrganisationUnitService()
- {
- return organisationUnitService;
- }
-/*
- private ReportService reportService;
-
- public void setReportService( ReportService reportService )
- {
- this.reportService = reportService;
- }
-*/
- // -------------------------------------------------------------------------
- // Constants
- // -------------------------------------------------------------------------
-
- private final int ALL = 0;
-
- public int getALL()
- {
- return ALL;
- }
-
-// private String raFolderName;
-
// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
- private Collection<OrganisationUnit> organisationUnits;
-
- public Collection<OrganisationUnit> getOrganisationUnits()
- {
- return organisationUnits;
- }
-
- private Collection<Period> periods = new ArrayList<Period>();
-
- public Collection<Period> getPeriods()
- {
- return periods;
- }
-
private Collection<PeriodType> periodTypes;
public Collection<PeriodType> getPeriodTypes()
@@ -101,19 +50,16 @@
{
reportTypeName = ReportType.RT_FEEDBACK;
- //raFolderName = reportService.getRAFolderName();
/* Period Info */
periodTypes = periodService.getAllPeriodTypes();
-
Iterator<PeriodType> alldeIterator = periodTypes.iterator();
while ( alldeIterator.hasNext() )
{
PeriodType type = alldeIterator.next();
if (type.getName().equalsIgnoreCase("Monthly") || type.getName().equalsIgnoreCase("quarterly") || type.getName().equalsIgnoreCase("yearly"))
{
- periods.addAll(periodService.getPeriodsByPeriodType(type));
}
else
{
@@ -123,5 +69,4 @@
return SUCCESS;
}
-
}
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java 2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java 2011-01-05 05:31:43 +0000
@@ -7,17 +7,11 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import jxl.CellType;
import jxl.Workbook;
@@ -28,25 +22,14 @@
import jxl.format.VerticalAlignment;
import jxl.write.Blank;
import jxl.write.Label;
+import jxl.write.Number;
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.aggregation.AggregationService;
-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.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
@@ -55,25 +38,13 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.reports.ReportService;
import org.hisp.dhis.reports.Report_in;
-import org.hisp.dhis.survey.Survey;
-import org.hisp.dhis.survey.SurveyService;
-import org.hisp.dhis.surveydatavalue.SurveyDataValue;
-import org.hisp.dhis.surveydatavalue.SurveyDataValueService;
-import org.hisp.dhis.system.util.MathUtils;
-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 org.hisp.dhis.reports.Report_inDesign;
import com.opensymphony.xwork2.Action;
public class GenerateFeedbackReportAnalyserResultAction
implements Action
{
- private static final String NULL_REPLACEMENT = "0";
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -84,13 +55,6 @@
this.statementManager = statementManager;
}
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
private ReportService reportService;
public void setReportService( ReportService reportService )
@@ -105,13 +69,6 @@
this.periodService = periodService;
}
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
private OrganisationUnitService organisationUnitService;
public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -119,63 +76,6 @@
this.organisationUnitService = organisationUnitService;
}
- public OrganisationUnitService getOrganisationUnitService()
- {
- return organisationUnitService;
- }
-
- private AggregationService aggregationService;
-
- public void setAggregationService( AggregationService aggregationService )
- {
- this.aggregationService = aggregationService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private DataValueService dataValueService;
-
- public void setDataValueService( DataValueService dataValueService )
- {
- this.dataValueService = dataValueService;
- }
-
- private DataElementCategoryService dataElementCategoryOptionComboService;
-
- public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
- {
- this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
- }
-
-
-/*
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
-
- public void setDataElementCategoryOptionComboService(
- DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
- {
- this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
- }
-*/
- private SurveyService surveyService;
-
- public void setSurveyService( SurveyService surveyService )
- {
- this.surveyService = surveyService;
- }
-
- private SurveyDataValueService surveyDataValueService;
-
- public void setSurveyDataValueService( SurveyDataValueService surveyDataValueService )
- {
- this.surveyDataValueService = surveyDataValueService;
- }
-
private I18nFormat format;
public void setFormat( I18nFormat format )
@@ -186,14 +86,7 @@
// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
-/*
- private PeriodStore periodStore;
- public void setPeriodStore( PeriodStore periodStore )
- {
- this.periodStore = periodStore;
- }
-*/
private InputStream inputStream;
public InputStream getInputStream()
@@ -201,15 +94,6 @@
return inputStream;
}
- /*
- private String contentType;
-
- public String getContentType()
- {
- return contentType;
- }
- */
-
private String fileName;
public String getFileName()
@@ -217,145 +101,13 @@
return fileName;
}
- /*
- private int bufferSize;
-
- public int getBufferSize()
- {
- return bufferSize;
- }
- */
-
- private MathTool mathTool;
-
- public MathTool getMathTool()
- {
- return mathTool;
- }
-
- // private OrganisationUnit selectedOrgUnit;
-
- // public OrganisationUnit getSelectedOrgUnit()
- // {
- // return selectedOrgUnit;
- // }
-
- private List<OrganisationUnit> orgUnitList;
-
- public List<OrganisationUnit> getOrgUnitList()
- {
- return orgUnitList;
- }
-
- private Period selectedPeriod;
-
- public Period getSelectedPeriod()
- {
- return selectedPeriod;
- }
-
- private List<String> dataValueList;
-
- public List<String> getDataValueList()
- {
- return dataValueList;
- }
-
- private List<String> services;
-
- public List<String> getServices()
- {
- return services;
- }
-
- private List<String> slNos;
-
- public List<String> getSlNos()
- {
- return slNos;
- }
-
- private SimpleDateFormat simpleDateFormat;
-
- public SimpleDateFormat getSimpleDateFormat()
- {
- return simpleDateFormat;
- }
-
- private SimpleDateFormat monthFormat;
-
- public SimpleDateFormat getMonthFormat()
- {
- return monthFormat;
- }
-
- private SimpleDateFormat simpleMonthFormat;
-
- public SimpleDateFormat getSimpleMonthFormat()
- {
- return simpleMonthFormat;
- }
-
- private SimpleDateFormat yearFormat;
-
- public SimpleDateFormat getYearFormat()
- {
- return yearFormat;
- }
-
- private SimpleDateFormat simpleYearFormat;
-
- public SimpleDateFormat getSimpleYearFormat()
- {
- return simpleYearFormat;
- }
-
- private List<String> deCodeType;
-
- private List<String> serviceType;
-
- private String reportFileNameTB;
-/*
- public void setReportFileNameTB( String reportFileNameTB )
- {
- this.reportFileNameTB = reportFileNameTB;
- }
-*/
- private String reportModelTB;
-/*
- public void setReportModelTB( String reportModelTB )
- {
- this.reportModelTB = reportModelTB;
- }
-*/
private String reportList;
public void setReportList( String reportList )
{
this.reportList = reportList;
}
-/*
- private String startDate;
-
- public void setStartDate( String startDate )
- {
- this.startDate = startDate;
- }
-
- private String endDate;
-
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
- private List<String> orgUnitListCB;
-
- public void setOrgUnitListCB( List<String> orgUnitListCB )
- {
- this.orgUnitListCB = orgUnitListCB;
- }
-*/
+
private int ouIDTB;
public void setOuIDTB( int ouIDTB )
@@ -377,13 +129,23 @@
this.aggCB = aggCB;
}
-// private Hashtable<String, String> serviceList;
-
- private List<Integer> sheetList;
-
- private List<Integer> rowList;
-
- private List<Integer> colList;
+ private List<OrganisationUnit> orgUnitList;
+
+ private Period selectedPeriod;
+
+ private SimpleDateFormat simpleDateFormat;
+
+ private SimpleDateFormat monthFormat;
+
+ private SimpleDateFormat simpleMonthFormat;
+
+ private SimpleDateFormat yearFormat;
+
+ private SimpleDateFormat simpleYearFormat;
+
+ private String reportFileNameTB;
+
+ private String reportModelTB;
private Date sDate;
@@ -395,29 +157,10 @@
private PeriodType periodType;
- public PeriodType getPeriodType()
- {
- return periodType;
- }
-
- private List<Period> periods;
-
- public List<Period> getPeriods()
- {
- return periods;
- }
-
-// private List<Integer> totalOrgUnitsCountList;
-
private String raFolderName;
private List<OrganisationUnit> childOrgUnits;
- public List<OrganisationUnit> getChildOrgUnits()
- {
- return childOrgUnits;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -425,26 +168,17 @@
public String execute()
throws Exception
{
-
statementManager.initialise();
+
// Initialization
raFolderName = reportService.getRAFolderName();
- mathTool = new MathTool();
- services = new ArrayList<String>();
- slNos = new ArrayList<String>();
- deCodeType = new ArrayList<String>();
- serviceType = new ArrayList<String>();
-// totalOrgUnitsCountList = new ArrayList<Integer>();
String deCodesXMLFileName = "";
simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
monthFormat = new SimpleDateFormat( "MMMM" );
simpleMonthFormat = new SimpleDateFormat( "MMM" );
yearFormat = new SimpleDateFormat( "yyyy" );
simpleYearFormat = new SimpleDateFormat( "yy" );
- //deCodesXMLFileName = reportList + "DECodes.xml";
-
-// String surveyType = "";
//getting Reports Details
Report_in selReportObj = reportService.getReport( Integer.parseInt( reportList ) );
@@ -452,77 +186,49 @@
deCodesXMLFileName = selReportObj.getXmlTemplateName();
reportModelTB = selReportObj.getModel();
reportFileNameTB = selReportObj.getExcelTemplateName();
-
- System.out.println( reportModelTB + " : " + reportFileNameTB + " : " + deCodesXMLFileName + " : " + ouIDTB );
-
- System.out.println( "Report Generation Start Time is : \t" + new Date() );
String parentUnit = "";
- sheetList = new ArrayList<Integer>();
- rowList = new ArrayList<Integer>();
- colList = new ArrayList<Integer>();
-
- 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";
+ OrganisationUnit selOrgUnit = null;
+
+ if( reportModelTB.equalsIgnoreCase( "STATIC" ) )
+ {
+ orgUnitList = new ArrayList<OrganisationUnit>();
+ selOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+ orgUnitList.add( selOrgUnit );
+ }
+ else if( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
+ {
+ selOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+ orgUnitList = new ArrayList<OrganisationUnit>();
+ orgUnitList.add( selOrgUnit );
+ }
+ else if( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" ) )
+ {
+ selOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+ orgUnitList = new ArrayList<OrganisationUnit>();
+ orgUnitList.addAll( selOrgUnit.getChildren() );
+ Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
+ orgUnitList.add( 0, selOrgUnit );
+ }
+ else if( reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
+ {
+ selOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+ orgUnitList = new ArrayList<OrganisationUnit>();
+ orgUnitList.addAll( selOrgUnit.getChildren() );
+ Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
+ orgUnitList.add( 0, selOrgUnit );
+ }
+
+ System.out.println( selOrgUnit.getName()+ " : " + selReportObj.getName()+" : Report Generation Start Time is : " + new Date() );
+
+ 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";
Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
- WritableWorkbook outputReportWorkbook = Workbook
- .createWorkbook( new File( outputReportPath ), templateWorkbook );
-
- if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
- {
- orgUnitList = new ArrayList<OrganisationUnit>();
- OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- orgUnitList.add( orgUnit );
-
- }
-
- if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
- {
- OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-// OrganisationUnit parent = orgUnit.getParent();
- orgUnitList = new ArrayList<OrganisationUnit>();
-
- Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
-
- // orgUnitList.add( 0, parent );
-
- orgUnitList.add( orgUnit );
-
- }
- else if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" ) )
- {
- OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-
- orgUnitList = new ArrayList<OrganisationUnit>();
-
- orgUnitList.addAll( orgUnit.getChildren() );
-
- Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
-
- orgUnitList.add( 0, orgUnit );
- }
-
- else if ( reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
- {
- OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-
- orgUnitList = new ArrayList<OrganisationUnit>();
-
- orgUnitList.addAll( orgUnit.getChildren() );
-
- Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
-
- orgUnitList.add( 0, orgUnit );
- }
- else
- {
-
- }
-
+ WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+
+
selectedPeriod = periodService.getPeriod( availablePeriods );
sDate = format.parseDate( String.valueOf( selectedPeriod.getStartDate() ) );
@@ -532,12 +238,10 @@
simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
// Getting DataValues
- dataValueList = new ArrayList<String>();
- List<String> deCodesList = getDECodes( deCodesXMLFileName );
+ List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
Iterator<OrganisationUnit> it = orgUnitList.iterator();
int orgUnitCount = 0;
- int orgUnitGroupCount = 0;
int rowCounter = 0;
@@ -565,27 +269,21 @@
if ( children == 0 )
{
- // int quarterPeriod = 0;
-
OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
-
- Iterator<String> it1 = deCodesList.iterator();
int count1 = 0;
- while ( it1.hasNext() )
+ Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
+ while ( reportDesignIterator.hasNext() )
{
- String deCodeString = (String) it1.next();
+ Report_inDesign report_inDesign = (Report_inDesign) reportDesignIterator.next();
- String deType = (String) deCodeType.get( count1 );
-// String sType = (String) serviceType.get( count1 );
-// int count = 0;
-// double sum = 0.0;
-// int flag1 = 0;
+ String deCodeString = report_inDesign.getExpression();
+ String deType = report_inDesign.getPtype();
String tempStr = "";
Calendar tempStartDate = Calendar.getInstance();
Calendar tempEndDate = Calendar.getInstance();
- List<Calendar> calendarList = new ArrayList<Calendar>( getStartingEndingPeriods( deType ) );
+ List<Calendar> calendarList = new ArrayList<Calendar>( reportService.getStartingEndingPeriods( deType, selectedPeriod ) );
if ( calendarList == null || calendarList.isEmpty() )
{
tempStartDate.setTime( selectedPeriod.getStartDate() );
@@ -598,66 +296,30 @@
tempEndDate = calendarList.get( 1 );
}
- if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
+ if( deCodeString.equalsIgnoreCase( "FACILITY" ) )
{
tempStr = "";
-
}
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ else if( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
{
tempStr = currentOrgUnit.getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- tempStr = orgUnitP.getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- orgUnitPP = orgUnitP.getParent();
-
- tempStr = orgUnitPP.getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPPP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- orgUnitPP = orgUnitP.getParent();
-
- orgUnitPPP = orgUnitPP.getParent();
-
- tempStr = orgUnitPPP.getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
+ }
+ else if( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+ tempStr = currentOrgUnit.getParent().getName();
+ }
+ else if( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+ tempStr = currentOrgUnit.getParent().getParent().getName();
+ }
+ else if( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+ tempStr = currentOrgUnit.getParent().getParent().getParent().getName();
+ }
+ else if( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
{
tempStr = monthFormat.format( sDate );
-
}
-
else if ( deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
{
@@ -716,10 +378,16 @@
wCellformat.setWrap( true );
wCellformat.setAlignment( Alignment.CENTRE );
+ /*
int tempRowNo = rowList.get( count1 );
int tempColNo = colList.get( count1 );
int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
+ */
+ int tempRowNo = report_inDesign.getRowno();
+ int tempColNo = report_inDesign.getColno();
+ int sheetNo = report_inDesign.getSheetno();
+ WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
if ( tempStr == null || tempStr.equals( " " ) )
{
@@ -733,40 +401,33 @@
}
- // ---------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------
// Feedback without orgunit END
- // ---------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------
- // ---------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------
// All other reports START
- // ---------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------
while ( it.hasNext() && children != 0 )
{
-
- // int quarterPeriod = 0;
-
OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
- Iterator<String> it1 = deCodesList.iterator();
int count1 = 0;
- while ( it1.hasNext() )
+
+ Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
+ while ( reportDesignIterator.hasNext() && children != 0 )
{
- String deCodeString = (String) it1.next();
-
- //System.out.println(deCodeString);
-
- String deType = (String) deCodeType.get( count1 );
- String sType = (String) serviceType.get( count1 );
- //System.out.println(sType);
-// int count = 0;
-// double sum = 0.0;
-// int flag1 = 0;
+ Report_inDesign report_inDesign = (Report_inDesign) reportDesignIterator.next();
+
+ String deType = report_inDesign.getPtype();
+ String sType = report_inDesign.getStype();
+ String deCodeString = report_inDesign.getExpression();
String tempStr = "";
Calendar tempStartDate = Calendar.getInstance();
Calendar tempEndDate = Calendar.getInstance();
- List<Calendar> calendarList = new ArrayList<Calendar>( getStartingEndingPeriods( deType ) );
+ List<Calendar> calendarList = new ArrayList<Calendar>( reportService.getStartingEndingPeriods( deType, selectedPeriod ) );
if ( calendarList == null || calendarList.isEmpty() )
{
tempStartDate.setTime( selectedPeriod.getStartDate() );
@@ -782,7 +443,6 @@
if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
{
tempStr = currentOrgUnit.getName();
-
}
else if ( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
{
@@ -791,88 +451,47 @@
else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
{
tempStr = currentOrgUnit.getParent().getName();
-
}
-
else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
{
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- tempStr = orgUnitP.getParent().getName();
-
+ tempStr = currentOrgUnit.getParent().getParent().getName();
}
-
else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
{
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- orgUnitPP = orgUnitP.getParent();
-
- tempStr = orgUnitPP.getParent().getName();
-
+ tempStr = currentOrgUnit.getParent().getParent().getParent().getName();
}
-
else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
{
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPPP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- orgUnitPP = orgUnitP.getParent();
-
- orgUnitPPP = orgUnitPP.getParent();
-
- tempStr = orgUnitPPP.getParent().getName();
-
+ tempStr = currentOrgUnit.getParent().getParent().getParent().getParent().getName();
}
-
else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
|| deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) )
{
tempStr = simpleDateFormat.format( sDate );
-
}
else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
{
tempStr = monthFormat.format( sDate );
-
}
else if ( deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) )
{
tempStr = simpleMonthFormat.format( sDate );
-
}
else if ( deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) )
{
tempStr = simpleMonthFormat.format( eDate );
-
}
-
else if ( deCodeString.equalsIgnoreCase( "MONTH-START" ) )
{
tempStr = monthFormat.format( sDate );
-
}
else if ( deCodeString.equalsIgnoreCase( "MONTH-END" ) )
{
tempStr = monthFormat.format( eDate );
-
}
-
else if ( deCodeString.equalsIgnoreCase( "PERIOD-WEEK" ) )
{
tempStr = String.valueOf( tempStartDate.get( Calendar.WEEK_OF_MONTH ) );
-
}
else if ( deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" ) )
{
@@ -884,7 +503,6 @@
{
tempStr = "Quarter I";
}
-
else if ( startMonth.equalsIgnoreCase( "July" ) )
{
tempStr = "Quarter II";
@@ -893,16 +511,11 @@
{
tempStr = "Quarter III";
}
-
else
{
tempStr = "Quarter IV";
-
- // quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) )
{
String startMonth = "";
@@ -913,7 +526,6 @@
{
tempStr = "Q1";
}
-
else if ( startMonth.equalsIgnoreCase( "July" ) )
{
tempStr = "Q2";
@@ -922,16 +534,11 @@
{
tempStr = "Q3";
}
-
else
{
tempStr = "Q4";
-
- // quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) )
{
String startMonth = "";
@@ -942,7 +549,6 @@
{
tempStr = "Apr - Jun";
}
-
else if ( startMonth.equalsIgnoreCase( "July" ) )
{
tempStr = "Jul - Sep";
@@ -951,16 +557,11 @@
{
tempStr = "Oct - Dec";
}
-
else
{
tempStr = "Jan - Mar";
-
- // quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) )
{
String startMonth = "";
@@ -971,7 +572,6 @@
{
tempStr = "April - June";
}
-
else if ( startMonth.equalsIgnoreCase( "July" ) )
{
tempStr = "July - September";
@@ -980,16 +580,11 @@
{
tempStr = "October - December";
}
-
else
{
tempStr = "January - March";
-
- // quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) )
{
String startMonth = "";
@@ -1000,7 +595,6 @@
{
tempStr = "Apr";
}
-
else if ( startMonth.equalsIgnoreCase( "July" ) )
{
tempStr = "Jul";
@@ -1009,16 +603,11 @@
{
tempStr = "Oct";
}
-
else
{
tempStr = "Jan";
-
- // quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "QUARTER-START" ) )
{
String startMonth = "";
@@ -1029,7 +618,6 @@
{
tempStr = "April";
}
-
else if ( startMonth.equalsIgnoreCase( "July" ) )
{
tempStr = "July";
@@ -1038,16 +626,11 @@
{
tempStr = "October";
}
-
else
{
tempStr = "January";
-
- // quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) )
{
String endMonth = "";
@@ -1058,7 +641,6 @@
{
tempStr = "Jun";
}
-
else if ( endMonth.equalsIgnoreCase( "September" ) )
{
tempStr = "Sep";
@@ -1067,16 +649,11 @@
{
tempStr = "Dec";
}
-
else
{
tempStr = "Mar";
-
- //quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "QUARTER-END" ) )
{
String endMonth = "";
@@ -1087,7 +664,6 @@
{
tempStr = "June";
}
-
else if ( endMonth.equalsIgnoreCase( "September" ) )
{
tempStr = "September";
@@ -1096,16 +672,11 @@
{
tempStr = "December";
}
-
else
{
tempStr = "March";
-
- //quarterPeriod = 1;
-
}
}
-
else if ( deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) )
{
sDateTemp = sDate;
@@ -1124,7 +695,6 @@
{
sDateTemp = sDate;
}
-
else
{
if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
@@ -1140,7 +710,6 @@
tempStr = yearFormat.format( sDateTemp );
}
-
else if ( deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) )
{
sDateTemp = sDate;
@@ -1159,7 +728,6 @@
{
sDateTemp = sDate;
}
-
else
{
if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
@@ -1175,10 +743,8 @@
tempStr = simpleYearFormat.format( sDateTemp );
}
-
else if ( deCodeString.equalsIgnoreCase( "YEAR-END" ) )
{
-
sDateTemp = sDate;
Calendar tempQuarterYear = Calendar.getInstance();
@@ -1275,7 +841,6 @@
tempStr = startYear + " - " + endYear;
}
-
else if ( deCodeString.equalsIgnoreCase( "SLNO" ) )
{
tempStr = "" + (orgUnitCount + 1);
@@ -1288,68 +853,77 @@
{
rowCounter += 1;
- if ( sType.equalsIgnoreCase( "dataelement" ) )
+ if( sType.equalsIgnoreCase( "dataelement" ) )
{
if ( aggCB == null )
{
- tempStr = getIndividualResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate
- .getTime(), currentOrgUnit );
+ //tempStr = getIndividualResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+ tempStr = reportService.getIndividualResultDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
}
else
{
- tempStr = getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(),
- currentOrgUnit );
+ //tempStr = getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+ tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
}
}
else if ( sType.equalsIgnoreCase( "indicator-parent" ) )
{
if ( aggCB == null )
{
- tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit.getParent() );
+ //tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
+ tempStr = reportService.getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
}
else
{
- tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate
- .getTime(), currentOrgUnit.getParent() );
+ //tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
+ tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
}
}
else if ( sType.equalsIgnoreCase( "survey" ) )
{
- tempStr = getResultSurveyValue( deCodeString, currentOrgUnit );
+ //tempStr = getResultSurveyValue( deCodeString, currentOrgUnit );
+ tempStr = reportService.getResultSurveyValue( deCodeString, currentOrgUnit );
}
-
else if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
{
if ( aggCB == null )
{
- tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit );
+ //tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+ tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
}
else
{
- tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit );
+ //tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+ tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
}
}
else
{
if ( aggCB == null )
{
- tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit );
+ //tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+ tempStr = reportService.getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
}
else
{
- tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate
- .getTime(), currentOrgUnit );
+ //tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+ tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
}
}
}
+
+ int tempRowNo = report_inDesign.getRowno();
+ int tempColNo = report_inDesign.getColno();
+ int sheetNo = report_inDesign.getSheetno();
+ WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
+
+ /*
int tempRowNo = rowList.get( count1 );
int tempColNo = colList.get( count1 );
int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
+ */
+
if ( tempStr == null || tempStr.equals( " " ) )
{
tempColNo += orgUnitCount;
@@ -1363,58 +937,8 @@
}
else
{
-
- if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
+ if ( reportModelTB.equalsIgnoreCase( "STATIC" ) || reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
{
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
- else
- {
- // tempColNo +=
- // orgUnitCount;
- }
-
WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
CellFormat cellFormat = cell.getCellFormat();
@@ -1434,101 +958,15 @@
sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
}
}
-
- else if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
- {
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
- else
- {
- // tempColNo +=
- // (orgUnitCount * 2);
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setAlignment( Alignment.CENTRE );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
-
else if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" )
|| reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
{
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) || deCodeString.equalsIgnoreCase( "FACILITYPP" )
+ || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
|| deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
|| deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
@@ -1558,46 +996,38 @@
}
WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
+
CellFormat cellFormat = cell.getCellFormat();
WritableCellFormat wCellformat = new WritableCellFormat();
-
wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
wCellformat.setWrap( true );
wCellformat.setAlignment( Alignment.CENTRE );
wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
-
+
if ( cell.getType() == CellType.LABEL )
{
Label l = (Label) cell;
l.setString( tempStr );
l.setCellFormat( cellFormat );
- }
+ }
else
{
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ try
+ {
+ sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+ }
+ catch( Exception e )
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
}
}
- else
- {
-
- }
-
- // }
}
count1++;
}// inner while loop end
orgUnitCount++;
}// outer while loop end
- /*
- * ActionContext ctx = ActionContext.getContext(); HttpServletResponse
- * res = (HttpServletResponse) ctx.get(
- * ServletActionContext.HTTP_RESPONSE );
- *
- * res.setContentType("application/vnd.ms-excel");
- */
-
outputReportWorkbook.write();
outputReportWorkbook.close();
@@ -1607,7 +1037,7 @@
File outputReportFile = new File( outputReportPath );
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
- System.out.println( "Report Generation End Time is : \t" + new Date() );
+ System.out.println( selOrgUnit.getName()+ " : " + selReportObj.getName()+" : Report Generation Start Time is : " + new Date() );
outputReportFile.deleteOnExit();
@@ -1616,1065 +1046,6 @@
return SUCCESS;
}
- public List<Calendar> getStartingEndingPeriods( String deType )
- {
-
- List<Calendar> calendarList = new ArrayList<Calendar>();
-
- Calendar tempStartDate = Calendar.getInstance();
- Calendar tempEndDate = Calendar.getInstance();
-
- Period previousPeriod = new Period();
- previousPeriod = getPreviousPeriod();
-
- if ( deType.equalsIgnoreCase( "ccmcy" ) )
- {
- tempStartDate.setTime( selectedPeriod.getStartDate() );
- if ( tempStartDate.get( Calendar.MONTH ) < Calendar.APRIL )
- {
- tempStartDate.roll( Calendar.YEAR, -1 );
- }
- tempStartDate.set( Calendar.MONTH, Calendar.APRIL );
- tempEndDate.setTime( selectedPeriod.getEndDate() );
- // //System.out.println("CCMCY : "+ String.valueOf(
- // tempStartDate.getTime()) +" ------ "+String.valueOf(
- // tempEndDate.getTime()));
- }
- else if ( deType.equalsIgnoreCase( "cpmcy" ) )
- {
- tempStartDate.setTime( previousPeriod.getStartDate() );
- if ( tempStartDate.get( Calendar.MONTH ) < Calendar.APRIL )
- {
- tempStartDate.roll( Calendar.YEAR, -1 );
- }
- tempStartDate.set( Calendar.MONTH, Calendar.APRIL );
- tempEndDate.setTime( previousPeriod.getEndDate() );
- }
- else if ( deType.equalsIgnoreCase( "cmpy" ) )
- {
- tempStartDate.setTime( selectedPeriod.getStartDate() );
- tempEndDate.setTime( selectedPeriod.getEndDate() );
-
- tempStartDate.roll( Calendar.YEAR, -1 );
- tempEndDate.roll( Calendar.YEAR, -1 );
- }
- else if ( deType.equalsIgnoreCase( "ccmpy" ) )
- {
- tempStartDate.setTime( selectedPeriod.getStartDate() );
- tempEndDate.setTime( selectedPeriod.getEndDate() );
-
- tempStartDate.roll( Calendar.YEAR, -1 );
- tempEndDate.roll( Calendar.YEAR, -1 );
-
- if ( tempStartDate.get( Calendar.MONTH ) < Calendar.APRIL )
- {
- tempStartDate.roll( Calendar.YEAR, -1 );
- }
- tempStartDate.set( Calendar.MONTH, Calendar.APRIL );
-
- }
- else if ( deType.equalsIgnoreCase( "pmcy" ) )
- {
- tempStartDate.setTime( previousPeriod.getStartDate() );
- tempEndDate.setTime( previousPeriod.getEndDate() );
-
- }
-
- else
- {
-
- tempStartDate.setTime( selectedPeriod.getStartDate() );
- tempEndDate.setTime( selectedPeriod.getEndDate() );
- }
-
- // //System.out.print(deType+" -- ");
- calendarList.add( tempStartDate );
- calendarList.add( tempEndDate );
-
- return calendarList;
- }
-
- public Period getPreviousPeriod()
- {
- Period period = new Period();
- Calendar tempDate = Calendar.getInstance();
- tempDate.setTime( selectedPeriod.getStartDate() );
- if ( tempDate.get( Calendar.MONTH ) == Calendar.JANUARY )
- {
- tempDate.set( Calendar.MONTH, Calendar.DECEMBER );
- tempDate.roll( Calendar.YEAR, -1 );
-
- }
- else
- {
- tempDate.roll( Calendar.MONTH, -1 );
- }
- PeriodType periodType = getPeriodTypeObject( "monthly" );
- period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
-
- return period;
- }
-
- public Period getPeriodByMonth( int month, int year, PeriodType periodType )
- {
- int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
- Calendar cal = Calendar.getInstance();
- cal.set( year, month, 1, 0, 0, 0 );
- Date firstDay = new Date( cal.getTimeInMillis() );
-
- if ( periodType.getName().equals( "Monthly" ) )
- {
- cal.set( year, month, 1, 0, 0, 0 );
- if ( year % 4 == 0 )
- {
- cal.set( Calendar.DAY_OF_MONTH, monthDays[month] + 1 );
- }
- else
- {
- cal.set( Calendar.DAY_OF_MONTH, monthDays[month] );
- }
- }
- else if ( periodType.getName().equals( "Yearly" ) )
- {
- cal.set( year, Calendar.DECEMBER, 31 );
- }
-
- Date lastDay = new Date( cal.getTimeInMillis() );
-
- Period newPeriod = new Period();
-
- newPeriod.setStartDate( firstDay );
- newPeriod.setEndDate( lastDay );
- newPeriod.setPeriodType( periodType );
-
- return newPeriod;
- }
-
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection<PeriodType> periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator<PeriodType> iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
-
- break;
- }
- }
- if ( periodType == null )
- {
- //System.out.println( "No Such PeriodType" );
- return null;
- }
- return periodType;
- }
-
- public List<String> getDECodes( String fileName )
- {
- List<String> deCodes = new ArrayList<String>();
- String path = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + raFolderName
- + File.separator + fileName;
- try
- {
- String newpath = System.getenv( "DHIS2_HOME" );
- if ( newpath != null )
- {
- path = newpath + File.separator + raFolderName + File.separator + fileName;
- }
- }
- catch ( NullPointerException npe )
- {
- // 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( "There is no DECodes related XML file in
- // the user home" );
- return null;
- }
-
- NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
- int totalDEcodes = listOfDECodes.getLength();
-
- for ( int s = 0; s < totalDEcodes; s++ )
- {
- Element deCodeElement = (Element) listOfDECodes.item( s );
- NodeList textDECodeList = deCodeElement.getChildNodes();
- deCodes.add( ((Node) textDECodeList.item( 0 )).getNodeValue().trim() );
- serviceType.add( deCodeElement.getAttribute( "stype" ) );
- deCodeType.add( deCodeElement.getAttribute( "type" ) );
- sheetList.add( new Integer( deCodeElement.getAttribute( "sheetno" ) ) );
- rowList.add( new Integer( deCodeElement.getAttribute( "rowno" ) ) );
- colList.add( new Integer( deCodeElement.getAttribute( "colno" ) ) );
-
- }// 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 deCodes;
- }// getDECodes end
-
- /*
- * Returns the PeriodType Object for selected DataElement, If no PeriodType
- * is found then by default returns Monthly Period type
- */
- public PeriodType getDataElementPeriodType( DataElement de )
- {
- List<DataSet> dataSetList = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
- Iterator<DataSet> it = dataSetList.iterator();
- while ( it.hasNext() )
- {
- DataSet ds = (DataSet) it.next();
- List<DataElement> dataElementList = new ArrayList<DataElement>( ds.getDataElements() );
- if ( dataElementList.contains( de ) )
- {
- return ds.getPeriodType();
- }
- }
-
- return null;
-
- } // getDataElementPeriodType end
-
- /**
- * Converts an expression on the form<br>
- * [34] + [23], where the numbers are IDs of DataElements, to the form<br>
- * 200 + 450, where the numbers are the values of the DataValues registered
- * for the Period and source.
- *
- * @return The generated expression
- */
- private String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit )
- {
- try
- {
- // //System.out.println( "expression : " + formula + " ***** " +
- // String.valueOf( startDate ) + " **** "
- // + String.valueOf( endDate ) );
-
- int deFlag1 = 0;
- // int deFlag2 = 0;
- Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
-
- Matcher matcher = pattern.matcher( formula );
- StringBuffer buffer = new StringBuffer();
-
- String resultValue = "";
-
- while ( matcher.find() )
- {
- String replaceString = matcher.group();
-
- replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
-
- replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
-
- int dataElementId = Integer.parseInt( replaceString );
- int optionComboId = Integer.parseInt( optionComboIdStr );
-
- DataElement dataElement = dataElementService.getDataElement( dataElementId );
- DataElementCategoryOptionCombo optionCombo = dataElementCategoryOptionComboService
- .getDataElementCategoryOptionCombo( optionComboId );
-
- if ( dataElement == null || optionCombo == null )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
- if ( dataElement.getType().equalsIgnoreCase( "int" ) )
- {
- Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo,
- startDate, endDate, organisationUnit );
- if ( aggregatedValue == null )
- {
- replaceString = NULL_REPLACEMENT;
- }
- else
- {
- replaceString = String.valueOf( aggregatedValue );
-
- // deFlag2 = 1;
- }
-
- }
- else
- {
- deFlag1 = 1;
- PeriodType dePeriodType = getDataElementPeriodType( dataElement );
- List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType(
- dePeriodType, startDate, endDate ) );
- Period tempPeriod = new Period();
- if ( periodList == null || periodList.isEmpty() )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
- else
- {
- tempPeriod = (Period) periodList.get( 0 );
- }
-
- DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
- optionCombo );
-
- if ( dataValue != null )
- {
- // Works for both text and boolean data types
-
- replaceString = dataValue.getValue();
- }
-
- else
- replaceString = "";
-
- if ( replaceString == null )
- replaceString = "";
- }
- matcher.appendReplacement( buffer, replaceString );
-
- resultValue = replaceString;
- }
-
- matcher.appendTail( buffer );
-
- if ( deFlag1 == 0 )
- {
-
- double d = 0.0;
- try
- {
- d = MathUtils.calculateExpression( buffer.toString() );
- }
- catch ( Exception e )
- {
- d = 0.0;
- resultValue = "";
- }
- if ( d == -1 )
- {
- d = 0.0;
- resultValue = "";
- }
- else
- {
-
- // This is to display financial data as it is like 2.1476838
- resultValue = "" + d;
-
- // These lines are to display financial data that do not
- // have decimals
- d = d * 10;
-
- if ( d % 10 == 0 )
- {
- resultValue = "" + (int) d / 10;
- }
-
- d = d / 10;
-
- // These line are to display non financial data that do not
- // require decimals
- if ( !(reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" )) )
- resultValue = "" + (int) d;
-
- // if ( resultValue.equalsIgnoreCase( "0" ) )
- // {
- // resultValue = "";
- // }
- }
-
- }
- else
- {
- resultValue = buffer.toString();
- }
-
- if ( resultValue.equalsIgnoreCase( "" ) )
- resultValue = " ";
-
- return resultValue;
- }
- catch ( NumberFormatException ex )
- {
- throw new RuntimeException( "Illegal DataElement id", ex );
- }
- }
-
- private String getIndividualResultDataValue( String formula, Date startDate, Date endDate,
- OrganisationUnit organisationUnit )
- {
- try
- {
- int deFlag1 = 0;
- // int deFlag2 = 0;
- Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
-
- Matcher matcher = pattern.matcher( formula );
- StringBuffer buffer = new StringBuffer();
-
- String resultValue = "";
- boolean valueDoesNotExist = true;
-
- while ( matcher.find() )
- {
-
- String replaceString = matcher.group();
-
- replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
-
- replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
-
- int dataElementId = Integer.parseInt( replaceString );
- int optionComboId = Integer.parseInt( optionComboIdStr );
-
- DataElement dataElement = dataElementService.getDataElement( dataElementId );
- DataElementCategoryOptionCombo optionCombo = dataElementCategoryOptionComboService
- .getDataElementCategoryOptionCombo( optionComboId );
-
- if ( dataElement == null || optionCombo == null )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
- if ( dataElement.getType().equalsIgnoreCase( "int" ) )
- {
-
- PeriodType dePeriodType = getDataElementPeriodType( dataElement );
- List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType(
- dePeriodType, startDate, endDate ) );
-
- if ( periodList == null || periodList.isEmpty() )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
- else
- {
-
- double aggregatedValue = 0.0;
- for ( Period tempPeriod : periodList )
- {
- DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement,
- tempPeriod, optionCombo );
-
- if ( dataValue != null )
- {
- aggregatedValue += Double.parseDouble( dataValue.getValue() );
-
- valueDoesNotExist = false;
- }
- }
-
- replaceString = String.valueOf( aggregatedValue );
-
- // deFlag2 = 1;
- }
-
- }
- else
- {
- deFlag1 = 1;
- PeriodType dePeriodType = getDataElementPeriodType( dataElement );
- List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType(
- dePeriodType, startDate, endDate ) );
- Period tempPeriod = new Period();
- if ( periodList == null || periodList.isEmpty() )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
- else
- {
- tempPeriod = (Period) periodList.get( 0 );
- }
-
- DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
- optionCombo );
-
- if ( dataValue != null )
- {
- // Works for both text and boolean data types
-
- replaceString = dataValue.getValue();
- valueDoesNotExist = false;
- }
-
- else
- replaceString = "";
-
- if ( replaceString == null )
- replaceString = "";
- }
- matcher.appendReplacement( buffer, replaceString );
-
- resultValue = replaceString;
- }
-
- matcher.appendTail( buffer );
-
- if ( deFlag1 == 0 )
- {
- double d = 0.0;
- try
- {
- d = MathUtils.calculateExpression( buffer.toString() );
- }
- catch ( Exception e )
- {
- d = 0.0;
-
- resultValue = "";
- }
- if ( d == -1 )
- {
- d = 0.0;
-
- resultValue = "";
- }
- else
- {
- // This is to display financial data as it is like 2.1476838
- resultValue = "" + d;
-
- // These lines are to display financial data that do not
- // have decimals
- d = d * 10;
-
- if ( d % 10 == 0 )
- {
- resultValue = "" + (int) d / 10;
- }
-
- d = d / 10;
-
- // These line are to display non financial data that do not
- // require decimals
- if ( !(reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" )) )
- resultValue = "" + (int) d;
-
- // if ( resultValue.equalsIgnoreCase( "0" ) )
- // {
- // resultValue = "";
- // }
- }
- }
- else
- {
- resultValue = buffer.toString();
- }
-
- if ( valueDoesNotExist )
- resultValue = " ";
-
- if ( resultValue.equalsIgnoreCase( "" ) )
- resultValue = " ";
-
- return resultValue;
- }
- catch ( NumberFormatException ex )
- {
- throw new RuntimeException( "Illegal DataElement id", ex );
- }
- }
-
- private String getBooleanDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit )
- {
- try
- {
- int deFlag1 = 0;
- int deFlag2 = 0;
- Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
-
- Matcher matcher = pattern.matcher( formula );
- StringBuffer buffer = new StringBuffer();
-
- while ( matcher.find() )
- {
- String replaceString = matcher.group();
-
- replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
-
- replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
-
- int dataElementId = Integer.parseInt( replaceString );
- int optionComboId = Integer.parseInt( optionComboIdStr );
-
- DataElement dataElement = dataElementService.getDataElement( dataElementId );
- DataElementCategoryOptionCombo optionCombo = dataElementCategoryOptionComboService
- .getDataElementCategoryOptionCombo( optionComboId );
-
- if ( dataElement == null || optionCombo == null )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
-
- if ( dataElement.getType().equalsIgnoreCase( "bool" ) )
- {
- deFlag1 = 1;
- PeriodType dePeriodType = getDataElementPeriodType( dataElement );
- List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType(
- dePeriodType, startDate, endDate ) );
- Period tempPeriod = new Period();
- if ( periodList == null || periodList.isEmpty() )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
- }
- else
- {
- tempPeriod = (Period) periodList.get( 0 );
- }
-
- DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
- optionCombo );
-
- if ( dataValue != null )
- {
- // Works for both text and boolean data types
-
- if ( dataValue.getValue().equalsIgnoreCase( "true" ) )
- {
- replaceString = "Yes";
- }
- else if ( dataValue.getValue().equalsIgnoreCase( "false" ) )
- {
- replaceString = "No";
- }
- else
- {
- replaceString = dataValue.getValue();
- }
- }
-
- else
- {
- replaceString = "";
- }
-
- }
- else
- {
- Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo,
- startDate, endDate, organisationUnit );
- if ( aggregatedValue == null )
- {
- replaceString = NULL_REPLACEMENT;
- }
- else
- {
- replaceString = String.valueOf( aggregatedValue );
-
- deFlag2 = 1;
- }
- }
- matcher.appendReplacement( buffer, replaceString );
- }
-
- matcher.appendTail( buffer );
-
- String resultValue = "";
- if ( deFlag1 == 0 )
- {
- double d = 0.0;
- try
- {
- d = MathUtils.calculateExpression( buffer.toString() );
- }
- catch ( Exception e )
- {
- d = 0.0;
- }
- if ( d == -1 )
- {
- d = 0.0;
- }
- else
- {
- d = Math.round( d * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
- resultValue = "" + (int) d;
- }
-
- if ( deFlag2 == 0 )
- {
- resultValue = " ";
- }
- }
- else
- {
- resultValue = buffer.toString();
- }
- return resultValue;
- }
- catch ( NumberFormatException ex )
- {
- throw new RuntimeException( "Illegal DataElement id", ex );
- }
- }
-
- private String getResultIndicatorValue( String formula, Date startDate, Date endDate,
- OrganisationUnit organisationUnit )
- {
- try
- {
-
- int deFlag1 = 0;
- int deFlag2 = 0;
- Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
-
- Matcher matcher = pattern.matcher( formula );
- StringBuffer buffer = new StringBuffer();
-
- while ( matcher.find() )
- {
- String replaceString = matcher.group();
-
- replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
-
- replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
-
- int indicatorId = Integer.parseInt( replaceString );
-
- Indicator indicator = indicatorService.getIndicator( indicatorId );
-
- if ( indicator == null )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
-
- }
-
- Double aggregatedValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate,
- organisationUnit );
-
- if ( aggregatedValue == null )
- {
- replaceString = NULL_REPLACEMENT;
- }
- else
- {
- replaceString = String.valueOf( aggregatedValue );
- deFlag2 = 1;
- }
- matcher.appendReplacement( buffer, replaceString );
- }
-
- matcher.appendTail( buffer );
-
- String resultValue = "";
- if ( deFlag1 == 0 )
- {
- double d = 0.0;
- try
- {
- d = MathUtils.calculateExpression( buffer.toString() );
- }
- catch ( Exception e )
- {
- d = 0.0;
- }
- if ( d == -1 )
- d = 0.0;
- else
- {
- d = Math.round( d * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
- resultValue = "" + d;
- }
-
- if ( deFlag2 == 0 )
- {
- resultValue = " ";
- }
- }
- else
- {
- resultValue = buffer.toString();
- }
- return resultValue;
- }
- catch ( NumberFormatException ex )
- {
- throw new RuntimeException( "Illegal DataElement id", ex );
- }
- }
-
- private String getIndividualResultIndicatorValue( String formula, Date startDate, Date endDate,
- OrganisationUnit organisationUnit )
- {
- try
- {
-
- int deFlag1 = 0;
- int deFlag2 = 0;
- Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
-
- Matcher matcher = pattern.matcher( formula );
- StringBuffer buffer = new StringBuffer();
-
- while ( matcher.find() )
- {
- String replaceString = matcher.group();
-
- replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
-
- replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
-
- int indicatorId = Integer.parseInt( replaceString );
-
- Indicator indicator = indicatorService.getIndicator( indicatorId );
-
- if ( indicator == null )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
-
- }
-
- String numeratorExp = indicator.getNumerator();
- String denominatorExp = indicator.getDenominator();
- int indicatorFactor = indicator.getIndicatorType().getFactor();
- String numeratorVal = getIndividualResultDataValue( numeratorExp, startDate, endDate, organisationUnit );
- String denominatorVal = getIndividualResultDataValue( denominatorExp, startDate, endDate,
- organisationUnit );
-
- double numeratorValue;
- try
- {
- numeratorValue = Double.parseDouble( numeratorVal );
- }
- catch ( Exception e )
- {
- //System.out.println( "Exception while getting Numerator : " + numeratorExp + " for Indicaotr " + indicator.getName() );
- numeratorValue = 0.0;
- }
-
- double denominatorValue;
- try
- {
- denominatorValue = Double.parseDouble( denominatorVal );
- }
- catch ( Exception e )
- {
- //System.out.println( "Exception while getting Deniminator : " + denominatorExp + " for Indicaotr " + indicator.getName() );
- denominatorValue = 1.0;
- }
-
- double aggregatedValue;
- try
- {
- aggregatedValue = (numeratorValue / denominatorValue) * indicatorFactor;
- }
- catch ( Exception e )
- {
- //System.out.println( "Exception while calculating Indicator value for Indicaotr " + indicator.getName() );
- aggregatedValue = 0.0;
- }
-
- replaceString = String.valueOf( aggregatedValue );
- deFlag2 = 1;
-
- matcher.appendReplacement( buffer, replaceString );
- }
-
- matcher.appendTail( buffer );
-
- String resultValue = "";
- if ( deFlag1 == 0 )
- {
- double d = 0.0;
- try
- {
- d = MathUtils.calculateExpression( buffer.toString() );
- }
- catch ( Exception e )
- {
- d = 0.0;
- }
- if ( d == -1 )
- d = 0.0;
- else
- {
- d = Math.round( d * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
- resultValue = "" + d;
- }
-
- if ( deFlag2 == 0 )
- {
- resultValue = " ";
- }
- }
- else
- {
- resultValue = buffer.toString();
- }
- return resultValue;
- }
- catch ( NumberFormatException ex )
- {
- throw new RuntimeException( "Illegal DataElement id", ex );
- }
- }
-
- private String getResultSurveyValue( String formula, OrganisationUnit organisationUnit )
- {
- //System.out.println("Inside SurveyValue method : "+ formula + " : " + organisationUnit.getName());
- try
- {
-
- int deFlag1 = 0;
- int deFlag2 = 0;
- Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
-
- Matcher matcher = pattern.matcher( formula );
- StringBuffer buffer = new StringBuffer();
-
- while ( matcher.find() )
- {
-
- String replaceString = matcher.group();
-
- replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
-
- String surveyIdString = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
-
- replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
-
-
-
- int indicatorId = Integer.parseInt( replaceString );
-
- int surveyId = Integer.parseInt( surveyIdString );
-
- Indicator indicator = indicatorService.getIndicator( indicatorId );
-
- Survey survey = surveyService.getSurvey( surveyId );
-
- //System.out.println(surveyId + " : " + indicatorId + " ----1 ");
-
- if ( indicator == null || survey == null)
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
-
- }
-
- //System.out.println(survey.getName() + " : " + indicator.getName() + " ----2 ");
-
- //double aggregatedValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate,
- // organisationUnit );
-
- SurveyDataValue surveyDataValue = new SurveyDataValue();
-
- surveyDataValue = surveyDataValueService.getSurveyDataValue(organisationUnit, survey, indicator);
-
- if ( surveyDataValue == null )
- {
- replaceString = "";
- matcher.appendReplacement( buffer, replaceString );
- continue;
-
- }
-
-
- Double surveyValue = Double.valueOf( surveyDataValue.getValue() );
-
- //System.out.println(survey.getName() + " : " + indicator.getName() + " : " + surveyValue );
-
- if ( surveyValue == null )
- {
- replaceString = NULL_REPLACEMENT;
- }
- else
- {
- replaceString = String.valueOf( surveyValue );
- deFlag2 = 1;
- }
-
- matcher.appendReplacement( buffer, replaceString );
- }
-
- matcher.appendTail( buffer );
-
- String resultValue = "";
- if ( deFlag1 == 0 )
- {
- double d = 0.0;
- try
- {
- d = MathUtils.calculateExpression( buffer.toString() );
- }
- catch ( Exception e )
- {
- d = 0.0;
- }
- if ( d == -1 )
- d = 0.0;
- else
- {
- d = Math.round( d * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
- resultValue = "" + d;
- }
-
- if ( deFlag2 == 0 )
- {
- resultValue = " ";
- }
- }
- else
- {
- resultValue = buffer.toString();
- }
- //System.out.println("Result in Survey : "+ resultValue);
- return resultValue;
- }
- catch ( NumberFormatException ex )
- {
- throw new RuntimeException( "Illegal Indicator and survey id", ex );
- }
- }
-
-
}
=== 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 2010-12-31 07:16:18 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java 2011-01-05 05:31:43 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.reports.ReportService;
@@ -942,9 +943,11 @@
throws Exception
{
OrganisationUnit rootOrgUnit = organisationUnitService.getRootOrganisationUnits().iterator().next();
+ OrganisationUnitHierarchy organisationUnitHierarchy = organisationUnitService.getOrganisationUnitHierarchy();
+ //organisationUnitHierarchy.
- List<OrganisationUnit> OrganisitionUnitList = new ArrayList<OrganisationUnit>(
- getChildOrgUnitTree( rootOrgUnit ) );
+ //List<OrganisationUnit> OrganisitionUnitList = new ArrayList<OrganisationUnit>( getChildOrgUnitTree( rootOrgUnit ) );
+ 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";
@@ -964,25 +967,18 @@
// Heading
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart, "OrgUnitID",
- // getCellFormat1() ) );
- // 30/06/2010
-
- // for printing all attributes heading in Excel Sheet 30/06/2010
if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "OrgUnitID", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 1, rowStart, "organisationUnitName", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 2, rowStart, "organisationUnitShortName", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 3, rowStart, "organisationUnitOpeningDate", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 4, rowStart, "organisationUnitClosedDate", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 5, rowStart, "organisationUnitParentName", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 6, rowStart, "organisationUnitCode", getCellFormat1() ) );
- sheet0.addCell( new Label( colStart + 7, rowStart, "organisationUnitUrl", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 1, rowStart, "OrganisationUnitName", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 2, rowStart, "OrganisationUnitShortName", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, "OrganisationUnitOpeningDate", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 4, rowStart, "OrganisationUnitClosedDate", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 5, rowStart, "OrganisationUnitParentName", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 6, rowStart, "OrganisationUnitCode", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 7, rowStart, "OrganisationUnitUrl", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 8, rowStart, "Last Updated", getCellFormat1() ) );
-
}
-
else if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "OrgUnitID", getCellFormat1() ) );
@@ -994,15 +990,12 @@
}
else
{
- // sheet0.addCell( new Label( colStart, rowStart, "OrgUnitID",
- // getCellFormat1() ) );
int maxLevels = organisationUnitService.getNumberOfOrganisationalLevels();
for ( int i = 1; i <= maxLevels; i++ )
{
sheet0.addCell( new Label( colStart + i, rowStart, "Level-" + i, getCellFormat1() ) );
}
}
-
}
rowStart++;
=== 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 2010-12-31 07:16:18 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java 2011-01-05 05:31:43 +0000
@@ -143,7 +143,8 @@
// Initialization
raFolderName = reportService.getRAFolderName();
- simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ simpleDateFormat = new SimpleDateFormat( "MMM-dd" );
+ SimpleDateFormat dayFormat = new SimpleDateFormat( "yyyy-MM-dd" );
// Getting Report Details
String deCodesXMLFileName = "";
@@ -201,6 +202,22 @@
{
tempStr = currentOrgUnit.getName();
}
+ else if( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ {
+ tempStr = selectedOrgUnit.getParent().getName();
+ }
+ else if( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+ tempStr = selectedOrgUnit.getParent().getParent().getName();
+ }
+ else if ( deCodeString.equalsIgnoreCase( "DATE-FROM" ) )
+ {
+ tempStr = dayFormat.format( sDate );
+ }
+ else if ( deCodeString.equalsIgnoreCase( "DATE-TO" ) )
+ {
+ tempStr = dayFormat.format( eDate );
+ }
else if ( deCodeString.equalsIgnoreCase( "MONTH-FROM" ) )
{
tempStr = simpleDateFormat.format( sDate );
@@ -221,62 +238,50 @@
}
}
- int tempColNo = 0;
int tempRowNo = report_inDesign.getRowno();
- if ( tempRowNo > 6 )
- {
- tempColNo = report_inDesign.getColno() + orgUnitCount;
- }
- else
- {
- tempColNo = report_inDesign.getColno();
- }
+ int tempColNo = report_inDesign.getColno();
int sheetNo = report_inDesign.getSheetno();
WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
- if ( tempStr == null || tempStr.equals( " " ) )
+ if ( reportModelTB.equalsIgnoreCase( "PROGRESSIVE-ORGUNIT" ) )
{
- WritableCellFormat wCellformat = new WritableCellFormat();
-
+ if( deCodeString.equalsIgnoreCase( "FACILITY" ) || deCodeString.equalsIgnoreCase( "FACILITYP" ) || deCodeString.equalsIgnoreCase( "FACILITYPP" )
+ || deCodeString.equalsIgnoreCase( "MONTH-FROM" ) || deCodeString.equalsIgnoreCase( "MONTH-TO" )
+ || deCodeString.equalsIgnoreCase( "DATE-FROM" ) || deCodeString.equalsIgnoreCase( "DATE-TO" ) )
+ {
+ }
+ else
+ {
+ tempColNo += orgUnitCount;
+ }
+
+ WritableCellFormat wCellformat;
+
+ if( orgUnitCount == orgUnitList.size()-1 )
+ {
+ wCellformat = new WritableCellFormat( arialBold );
+ }
+ else
+ {
+ wCellformat = new WritableCellFormat();
+ }
+
wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setAlignment( Alignment.CENTRE );
wCellformat.setWrap( true );
- wCellformat.setAlignment( Alignment.CENTRE );
-
- sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
- }
- else
- {
- if ( reportModelTB.equalsIgnoreCase( "PROGRESSIVE-ORGUNIT" ) )
- {
- if( deCodeString.equalsIgnoreCase( "FACILITY" ) || deCodeString.equalsIgnoreCase( "MONTH-FROM" ) || deCodeString.equalsIgnoreCase( "MONTH-TO" ) )
- {
- }
-
- WritableCellFormat wCellformat;
-
- if( orgUnitCount == orgUnitList.size()-1 )
- {
- wCellformat = new WritableCellFormat( arialBold );
- }
- else
- {
- wCellformat = new WritableCellFormat();
- }
-
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setAlignment( Alignment.CENTRE );
- wCellformat.setWrap( true );
-
- try
- {
- sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
- }
- catch( Exception e )
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
- }
+
+ System.out.println( tempColNo + " : " + tempRowNo + " : " + tempStr );
+
+ try
+ {
+ sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+ }
+ catch( Exception e )
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+
count1++;
}// inner while loop end
orgUnitCount++;
=== 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 2010-12-31 07:16:18 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2011-01-05 05:31:43 +0000
@@ -278,60 +278,18 @@
<bean
id="org.hisp.dhis.reports.feedback.action.GenerateFeedbackReportAnalyserFormAction"
class="org.hisp.dhis.reports.feedback.action.GenerateFeedbackReportAnalyserFormAction"
- scope="prototype">
-
- <property name="periodService">
- <ref bean="org.hisp.dhis.period.PeriodService"/>
- </property>
- <property name="organisationUnitService">
- <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
- </property>
+ scope="prototype">
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
<bean
id="org.hisp.dhis.reports.feedback.action.GenerateFeedbackReportAnalyserResultAction"
class="org.hisp.dhis.reports.feedback.action.GenerateFeedbackReportAnalyserResultAction"
scope="prototype">
-
<property name="statementManager" ref="statementManager"/>
- <property name="periodService">
- <ref bean="org.hisp.dhis.period.PeriodService"/>
- </property>
- <property name="organisationUnitService">
- <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
- </property>
- <property name="dataElementService">
- <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
- </property>
- <property name="indicatorService">
- <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
- </property>
- <property name="dataSetService">
- <ref bean="org.hisp.dhis.dataset.DataSetService"/>
- </property>
- <property name="aggregationService">
- <ref bean="org.hisp.dhis.aggregation.AggregationService"/>
- </property>
- <property name="dataValueService">
- <ref bean="org.hisp.dhis.datavalue.DataValueService"/>
- </property>
-
- <!-- added report service 23/08/2010-->
- <property name="reportService" ref="org.hisp.dhis.reports.ReportService">
- </property>
- <property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
- </property>
- <!-- <property name="reportService">
- <ref bean="org.hisp.dhis.reports.util.ReportService"/>
- </property>-->
- <property name="surveyService">
- <ref bean="org.hisp.dhis.survey.SurveyService"/>
- </property>
- <property name="surveyDataValueService">
- <ref bean="org.hisp.dhis.surveydatavalue.SurveyDataValueService"/>
- </property>
-
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
</bean>
<!-- Upward / GOI Reports -->
@@ -1203,15 +1161,7 @@
id="org.hisp.dhis.reports.benificiaryinfo.action.BenificiaryInfoReportsFormAction"
class="org.hisp.dhis.reports.benificiaryinfo.action.BenificiaryInfoReportsFormAction"
scope="prototype">
- <!-- added report service 21/08/2010-->
- <property name="reportService" ref="org.hisp.dhis.reports.ReportService">
- </property>
- <!-- <property name="reportService">
- <ref bean="org.hisp.dhis.reports.util.ReportService"/>
- </property>-->
- <property name="periodService">
- <ref bean="org.hisp.dhis.period.PeriodService"/>
- </property>
+ <property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
</bean>
<bean
@@ -1220,13 +1170,8 @@
scope="prototype">
<property name="statementManager" ref="statementManager"/>
- <!-- added report service 21/08/2010-->
<property name="reportService" ref="org.hisp.dhis.reports.ReportService">
</property>
-
- <!-- <property name="reportService">
- <ref bean="org.hisp.dhis.reports.util.ReportService"/>
- </property>-->
<property name="organisationUnitService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
</property>
=== modified file 'local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties'
--- local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties 2010-12-31 07:16:18 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties 2011-01-05 05:31:43 +0000
@@ -4,6 +4,7 @@
periodwise_progress_ra = PeriodWise Progress Report Analyser
orgunitwise_progress_ra = OrganisationunitWise Progress Report Analyser
aggregation_ra = Aggregation Reports Analyser
+feedback_ra = Feedback Report Analyser
periodtype = PeriodType
organisationunit = OrganisationUnit
select_periodtype = Select PeriodType
=== 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 2010-12-22 07:29:08 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/benificiaryInfoReportsForm.vm 2011-01-05 05:31:43 +0000
@@ -1,151 +1,153 @@
- <script>
-
- 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 Report Analyser</h1><hr /><br />
-
- <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><input type="checkbox" name="includePeriod" onChange="return showOrHideDates()" id="includePeriod" checked>Report With Specified Period</td>
- </tr>
- <tr>
- <td class="NormalB">
- Program :<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> </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> </td>
- </tr>
-
- <tr>
-
- </tr>
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td> </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>
+
+ 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("#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 Report Analyser</h1>
+<hr /><br />
+
+<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> </td>
+ </tr>
+ <tr>
+ <td class="NormalB">
+ Program :<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" disabled="disabled" style="width:175px">
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </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> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </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' style="width:200px" />
+ <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>
-
-
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/feedbackReportAnalysisFront.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/feedbackReportAnalysisFront.vm 2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/feedbackReportAnalysisFront.vm 2011-01-05 05:31:43 +0000
@@ -1,109 +1,77 @@
- <script>
- //Global Variables
-
- var reportModels = new HashTable();
- var reportFileNames = new HashTable();
-
- // 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 periodIndex = document.reportForm.availablePeriods.selectedIndex;
- var orgunitIdValue = document.reportForm.ouIDTB.value;
-
- if(orgunitIdValue == null || orgunitIdValue=="" || orgunitIdValue==" ") {alert("Please Select OrganisationUnit"); return false;}
- else if(document.reportForm.availablePeriods.options[periodIndex].text == null || document.reportForm.availablePeriods.options[periodIndex].text== "") {alert("Please Select Period"); return false;}
- else if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); 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);
-
- return true;
- }
- </script>
-
- <h1>Feedback Report Analyser</h1>
- <hr />
- <br />
- <form id="reportForm" name="reportForm" action="generateFeebackReport.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">
- PeriodType : <br />
- <select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
- <option value="NA">[ Select PeriodType ]</option>
- #foreach ( $type in $periodTypes )
- <option value="$type.name">$type.name</option>
- #end
- </select>
- </td>
- <td class="NormalB">
- OrganisationUnit : <br />
- <input type="text" name="ouNameTB" id="ouNameTB" size="20" disabled>
- </td>
-
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td class="NormalB">
- Periods : <br />
- <select id="availablePeriods" name="availablePeriods" style="width:200px">
- <option value="EMPTY_PLACEHOLDER_VALUE"></option>
- </select>
- <select multiple id="selectedPeriods" name="selectedPeriods" style="display:none; width:200px; height:0px">
- <option value="EMPTY_PLACEHOLDER_VALUE"></option>
- </select>
- </td>
- <td class="NormalB">
- Reports :<br />
- <select id="reportList" name="reportList" style="width:200px"></select>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <input type="checkbox" id="aggCB" name="aggCB" checked> Aggregated Data
- <br><br>
- <input type="submit" name="generate" value="Generate Report" disabled="disabled"/>
- <input type="hidden" name="autogen" id="autogen" value="0" >
- <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="reportListFileNameTB" id="reportListFileNameTB" value="feedbackReportsList.xml">-->
- <input type="hidden" name="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">
- </td>
- </tr>
- </table>
- </form>
-
-
\ No newline at end of file
+<script>
+
+ function formValidations()
+ {
+ var reportListIndex = document.reportForm.reportList.selectedIndex;
+ var periodIndex = document.reportForm.availablePeriods.selectedIndex;
+ var orgunitIdValue = document.reportForm.ouIDTB.value;
+
+ if(orgunitIdValue == null || orgunitIdValue=="" || orgunitIdValue==" ") {alert("Please Select OrganisationUnit"); return false;}
+ else if(document.reportForm.availablePeriods.options[periodIndex].text == null || document.reportForm.availablePeriods.options[periodIndex].text== "") {alert("Please Select Period"); return false;}
+ else if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
+
+ return true;
+ }
+
+</script>
+
+<h1>$i18n.getString( "feedback_ra" )</h1>
+<hr /><br />
+
+<form id="reportForm" name="reportForm" action="generateFeebackReport.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">
+ 1. $i18n.getString( "periodtype" ) :<br />
+ <select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
+ <option value="NA">[ Select PeriodType ]</option>
+ #foreach ( $type in $periodTypes )
+ <option value="$type.name">$type.name</option>
+ #end
+ </select>
+ </td>
+ <td class="NormalB">
+ 3. $i18n.getString( "organisationunit" ) :<br />
+ <input type="text" name="ouNameTB" id="ouNameTB" size="20" disabled>
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td class="NormalB">
+ 2. $i18n.getString( "periods" ) :<br />
+ <select id="availablePeriods" name="availablePeriods" style="width:200px"></select>
+ </td>
+ <td class="NormalB">
+ 4. $i18n.getString( "reports" ) :<br />
+ <select id="reportList" name="reportList" style="width:200px"></select>
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td>
+ <input type="checkbox" id="aggCB" name="aggCB" checked> $i18n.getString( "aggregated_data" )
+ <br><br>
+ <input type="submit" name="generate" value='$i18n.getString( "generate_report" )' disabled="disabled"/>
+ <input type="hidden" name="autogen" id="autogen" value="0" >
+ <input type="hidden" name="ouIDTB" id="ouIDTB">
+ <input type="hidden" name="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">
+ </td>
+ </tr>
+ </table>
+</form>
\ No newline at end of file
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js 2010-10-31 08:01:14 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js 2011-01-05 05:31:43 +0000
@@ -1,4 +1,22 @@
+
+function getSelectedOrgUnit( orgUnitIds )
+{
+ jQuery.postJSON("getOrgUnitName.action",{
+ id : orgUnitIds[0]
+ }, function( json ){
+ setFieldValue( "ouNameTB",json.organisationUnit.name );
+ });
+}
+
+function responseGetSelectedOrgUnitName( orgunit )
+{
+ var element = dataelement.getElementsByTagName("orgunit");
+ var orgUnitname = element[0].getElementsByTagName("OugUnitName")[0].firstChild.nodeValue;
+ document.reportForm.ouNameTB.value = orgUnitname;
+}
+
+
function checkStartDate( dtStr )
{
=== 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 2010-08-11 10:36:52 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm 2011-01-05 05:31:43 +0000
@@ -7,33 +7,34 @@
</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 == "" )
+ function orgUnitHasBeenSelected( orgUnitIds )
{
- return;
- }
-
- if(orgUnitIds !=null)
- {
- getOUDetails(orgUnitIds);
- }
-
- }
-
-selection.setListenerFunction( orgUnitHasBeenSelected );
+ document.reportForm.ouIDTB.value = orgUnitIds;
+
+ if(orgUnitIds == null || orgUnitIds == "" )
+ {
+ 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/menuWithTreeForDataSetLockReports.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForDataSetLockReports.vm 2010-12-22 07:29:08 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForDataSetLockReports.vm 2011-01-05 05:31:43 +0000
@@ -7,29 +7,23 @@
</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/orgunittreesearch.vm" )
+
<!-- The script that registeres selctions in the orgunit tree -->
<script type="text/javascript">
+
function orgUnitHasBeenSelected( orgUnitIds )
{
document.reportForm.ouIDTB.value = orgUnitIds;
- //reportListFileName = document.reportForm.reportListFileNameTB.value;
-
- // call orgUnit selection function
- //alert( orgUnitIds );
getSelectedOrgUnit( orgUnitIds );
-
- /*if(orgUnitIds != null && orgUnitIds != "" )
- {
- getReports(orgUnitIds, reportListFileName)
- }*/
}
selection.setListenerFunction( orgUnitHasBeenSelected );
+
</script>
-
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForFeedback.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForFeedback.vm 2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForFeedback.vm 2011-01-05 05:31:43 +0000
@@ -1,34 +1,33 @@
+
<h2>Report Analyser</h2>
<ul>
<li>Report Analysis</li>
<ul>
- <li>
- Feedback Reports
- </li>
+ <li>Feedback 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" )
<!-- The script that registeres selctions in the orgunit tree -->
<script type="text/javascript">
-function orgUnitHasBeenSelected( orgUnitIds )
-{
- document.reportForm.ouIDTB.value = orgUnitIds;
-
- reportTypeName = document.reportForm.reportTypeNameTB.value;
-
- if(orgUnitIds != null && orgUnitIds != "" )
+ function orgUnitHasBeenSelected( orgUnitIds )
{
- getReports(orgUnitIds, reportTypeName)
+ document.reportForm.ouIDTB.value = orgUnitIds;
+
+ reportTypeName = document.reportForm.reportTypeNameTB.value;
+
+ if(orgUnitIds != null && orgUnitIds != "" )
+ {
+ getReports(orgUnitIds, reportTypeName)
+ }
}
-}
-selection.setListenerFunction( orgUnitHasBeenSelected );
+ selection.setListenerFunction( orgUnitHasBeenSelected );
</script>
-
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForRoutineReport.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForRoutineReport.vm 2010-12-22 07:29:08 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForRoutineReport.vm 2011-01-05 05:31:43 +0000
@@ -8,29 +8,27 @@
</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/orgunittreesearch.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;
-
- reportTypeName = document.reportForm.reportTypeNameTB.value;
-
- if(orgUnitIds != null && orgUnitIds != "" )
+ function orgUnitHasBeenSelected( orgUnitIds )
{
- //alert( reportTypeName + "," + orgUnitIds );
- getReports(orgUnitIds, reportTypeName)
+ document.reportForm.ouIDTB.value = orgUnitIds;
+
+ reportTypeName = document.reportForm.reportTypeNameTB.value;
+
+ if(orgUnitIds != null && orgUnitIds != "" )
+ {
+ getReports(orgUnitIds, reportTypeName)
+ }
}
-}
-
-selection.setListenerFunction( orgUnitHasBeenSelected );
+
+ selection.setListenerFunction( orgUnitHasBeenSelected );
</script>
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm 2010-11-08 06:10:18 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm 2011-01-05 05:31:43 +0000
@@ -35,7 +35,7 @@
<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
<tr>
<td class="NormalB">
- 1. $i18n.getString( "periodtype" ) : <br />
+ 1. $i18n.getString( "periodtype" ) :<br />
<select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
<option value="NA">[ $i18n.getString( "select_periodtype" ) ]</option>
#foreach ( $type in $periodTypes )
@@ -44,7 +44,7 @@
</select>
</td>
<td class="NormalB">
- 3. $i18n.getString( "organisationunit" ) : <br />
+ 3. $i18n.getString( "organisationunit" ) :<br />
<input type="text" name="ouNameTB" id="ouNameTB" style="width:200px" disabled>
</td>
</tr>
@@ -58,7 +58,7 @@
</tr>
<tr>
<td class="NormalB">
- 2. $i18n.getString( "periods" ) : <br />
+ 2. $i18n.getString( "periods" ) :<br />
<select id="availablePeriods" name="availablePeriods" style="width:200px"></select>
</td>
<td class="NormalB">