dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11885
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3495: Merging Code from 2.1
------------------------------------------------------------
revno: 3495
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-29 19:15:23 +0530
message:
Merging Code from 2.1
added:
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Decode.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Header.java
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java
local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/db.js
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js
local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/csreview/action/GenerateCSReviewReportResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java
local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.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 2011-04-27 17:15:13 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java 2011-04-29 13:45:23 +0000
@@ -131,4 +131,6 @@
String getResultDataValueFromAggregateTable( String formula, String periodIdsByComma, Integer orgunitId );
Map<String, String> getResultDataValueFromAggregateTable( Integer orgunitId, String dataElmentIdsByComma, String periodIdsByComma );
+
+ Map<String, String> getAggDataFromDataValueTable( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodsByComma );
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2011-04-27 17:15:13 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2011-04-29 13:45:23 +0000
@@ -1803,6 +1803,37 @@
}
}
+ public Map<String, String> getAggDataFromDataValueTable( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma )
+ {
+ Map<String, String> aggDeMap = new HashMap<String, String>();
+ try
+ {
+ String query = "SELECT dataelementid,categoryoptioncomboid, SUM(value) FROM datavalue " +
+ " WHERE dataelementid IN (" + dataElmentIdsByComma + " ) AND "+
+ " sourceid IN ("+ orgUnitIdsByComma +" ) AND "+
+ " periodid IN (" + periodIdsByComma +") GROUP BY dataelementid,categoryoptioncomboid";
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+
+ while ( rs.next() )
+ {
+ Integer deId = rs.getInt( 1 );
+ Integer optionComId = rs.getInt( 2 );
+ Double aggregatedValue = rs.getDouble( 3 );
+ if( aggregatedValue != null )
+ {
+ aggDeMap.put( deId+"."+optionComId, ""+aggregatedValue );
+ }
+ }
+
+ return aggDeMap;
+ }
+ catch( Exception e )
+ {
+ throw new RuntimeException( "Illegal DataElement id", e );
+ }
+ }
+
public String getResultDataValueFromAggregateTable( String formula, String periodIdsByComma, Integer orgunitId )
{
try
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/db.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/db.js 2011-03-01 09:42:21 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/db.js 2011-04-29 13:45:23 +0000
@@ -33,6 +33,18 @@
function getOUDeatilsForGA(orgUnitIds)
{
+
+ $.post("getOrgUnitDetails.action",
+ {
+ orgUnitId : orgUnitIds[0],
+ type : 'ta'
+ },
+ function (data)
+ {
+ getOUDetailsForGARecevied(data);
+ },'xml');
+
+ /*
var request = new Request();
request.setResponseTypeXML( 'orgunit' );
request.setCallbackSuccess( getOUDetailsForGARecevied );
@@ -40,7 +52,8 @@
var requestString = "getOrgUnitDetails.action";
var params = "orgUnitId=" + orgUnitIds+"&type=ta";
request.sendAsPost( params );
- request.send( requestString );
+ request.send( requestString );
+ */
}
function getOUDetailsForGARecevied(xmlObject)
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js 2011-04-29 13:45:23 +0000
@@ -253,39 +253,27 @@
}
// formValidations Function End
-
-
-
// Getting corresponding Period List for Datasets.
function getdSetPeriods()
{
- var dataSetList = document.getElementById("selectedDataSets");
+
+ var dataSetList = document.getElementById("selectedDataSets");
var dataSetId = dataSetList.options[ dataSetList.selectedIndex].value;
-
- var request = new Request();
- request.setResponseTypeXML( 'period' );
- request.setCallbackSuccess( getdSetPeriodsReceived );
-
- var requestString = "getDataSetPeriods.action";
- var params = "id=" + dataSetId;
- request.sendAsPost( params );
- request.send( requestString );
-
- /*
+
$.post("getDataSetPeriods.action",
{
- id:dataSetId
+ id : dataSetId
},
function (data)
{
getdSetPeriodsReceived(data);
},'xml');
- */
+
}
function getdSetPeriodsReceived( xmlObject )
{
- var sDateLB = document.getElementById( "sDateLB" );
+ var sDateLB = document.getElementById( "sDateLB" );
var eDateLB = document.getElementById( "eDateLB" );
var periods = xmlObject.getElementsByTagName( "period" );
@@ -295,8 +283,8 @@
clearList( sDateLB );
clearList( eDateLB );
}
-
- for ( var i = 0; i < periods.length; i++)
+
+ for ( var i = 0; i < periods.length; i++ )
{
var periodType = periods[ i ].getElementsByTagName( "periodtype" )[0].firstChild.nodeValue;
@@ -316,7 +304,7 @@
var id = periods[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
var periodName = periods[ i ].getElementsByTagName( "periodname" )[0].firstChild.nodeValue;
-
+
var option1 = document.createElement( "option" );
option1.value = id;
option1.text = periodName;
@@ -326,7 +314,6 @@
option2.value = id;
option2.text = periodName;
eDateLB.add( option2, null);
-
}
}
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js 2011-03-01 09:42:21 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js 2011-04-29 13:45:23 +0000
@@ -563,7 +563,17 @@
function getOUDeatilsForTA( orgUnitIds )
{
showOverlay();
-
+ $.post("getOrgUnitDetails.action",
+ {
+ orgUnitId : orgUnitIds[0],
+ type : 'ta'
+ },
+ function (data)
+ {
+ getOUDetailsForTARecevied(data);
+ },'xml');
+
+ /*
var request = new Request();
request.setResponseTypeXML( 'orgunit' );
request.setCallbackSuccess( getOUDetailsForTARecevied );
@@ -571,7 +581,8 @@
var requestString = "getOrgUnitDetails.action";
var params = "orgUnitId=" + orgUnitIds+"&type=ta";
request.sendAsPost( params );
- request.send( requestString );
+ request.send( requestString );
+ */
}
function getOUDetailsForTARecevied(xmlObject)
=== modified file 'local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java'
--- local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java 2011-04-15 11:42:21 +0000
+++ local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java 2011-04-29 13:45:23 +0000
@@ -1,5 +1,7 @@
package org.hisp.dhis.excelimport.portal.action;
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -500,6 +502,7 @@
List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedBlockId ) );
OrganisationUnitGroup orgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( orgunitGroupId );
orgUnitList.retainAll( orgUnitGroup.getMembers() );
+ List<Integer> orgUnitIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, orgUnitList ) );
System.out.println( orgUnitList.size() + " : " + orgUnitGroup.getMembers().size() + " : " + orgUnitList.size() );
@@ -518,7 +521,7 @@
continue;
}
- Integer currentOrgunitId = getOrgUnitIdByComment( facility );
+ Integer currentOrgunitId = getOrgUnitIdByComment( facility, orgUnitIds );
if( currentOrgunitId != null )
{
OrganisationUnit portalOrgUnit = organisationUnitService.getOrganisationUnit( currentOrgunitId );
@@ -626,6 +629,23 @@
}
}
+ public Integer getOrgUnitIdByComment( String comment, List<Integer> orgUnitIds )
+ {
+ String query = "SELECT organisationunitid FROM organisationunit WHERE comment LIKE '"+ comment +"'";
+ SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+
+ while ( sqlResultSet.next() )
+ {
+ Integer orgUnitId = sqlResultSet.getInt( 1 );
+ if( orgUnitIds.contains( orgUnitId ) )
+ {
+ return orgUnitId;
+ }
+ }
+
+ return null;
+ }
+
public Integer getOrgUnitIdByComment( String comment )
{
String query = "SELECT organisationunitid FROM organisationunit WHERE comment LIKE '"+ comment +"'";
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2011-01-13 04:53:40 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2011-04-29 13:45:23 +0000
@@ -31,7 +31,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
-import java.sql.Connection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -60,7 +59,6 @@
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.DataElementCategoryService;
@@ -81,9 +79,7 @@
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
-import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
@@ -97,6 +93,10 @@
import org.hisp.dhis.relationship.RelationshipService;
import org.hisp.dhis.relationship.RelationshipTypeService;
import org.hisp.dhis.reports.ReportService;
+import org.hisp.dhis.reports.util.Report_Decode;
+import org.hisp.dhis.reports.util.Report_Header;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -271,6 +271,13 @@
{
this.patientDataValueService = patientDataValueService;
}
+
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
private I18nFormat format;
@@ -283,13 +290,6 @@
// Properties
// -------------------------------------------------------------------------
- private Map<Patient, Set<ProgramStageInstance>> visitsByPatients = new HashMap<Patient, Set<ProgramStageInstance>>();
-
- public Map<Patient, Set<ProgramStageInstance>> getVisitsByPatients()
- {
- return visitsByPatients;
- }
-
private InputStream inputStream;
public InputStream getInputStream()
@@ -304,13 +304,6 @@
return fileName;
}
- private MathTool mathTool;
-
- public MathTool getMathTool()
- {
- return mathTool;
- }
-
private OrganisationUnit selectedOrgUnit;
public OrganisationUnit getSelectedOrgUnit()
@@ -325,27 +318,6 @@
return orgUnitList;
}
- 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()
@@ -360,13 +332,6 @@
this.reportFileNameTB = reportFileNameTB;
}
- private String reportModelTB;
-
- public void setReportModelTB( String reportModelTB )
- {
- this.reportModelTB = reportModelTB;
- }
-
private String reportProgramTB;
public void setReportProgramTB( String reportProgramTB )
@@ -381,13 +346,6 @@
this.reportList = reportList;
}
- private Period selectedPeriod;
-
- public Period getSelectedPeriod()
- {
- return selectedPeriod;
- }
-
private int ouIDTB;
public void setOuIDTB( int ouIDTB )
@@ -395,16 +353,18 @@
this.ouIDTB = ouIDTB;
}
- private int periodList;
+ private String startDate;
- public int getPeriodList()
+ public void setStartDate( String startDate )
{
- return periodList;
+ this.startDate = startDate;
}
- public void setPeriodList( int periodList )
+ private String endDate;
+
+ public void setEndDate( String endDate )
{
- this.periodList = periodList;
+ this.endDate = endDate;
}
private List<String> serviceType;
@@ -425,20 +385,6 @@
private String deCodesXMLFileName;
- private String startDate;
-
- public void setStartDate( String startDate )
- {
- this.startDate = startDate;
- }
-
- private String endDate;
-
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
private Date sDate;
private Date eDate;
@@ -456,9 +402,6 @@
raFolderName = reportService.getRAFolderName();
// Initialization
- mathTool = new MathTool();
- services = new ArrayList<String>();
- slNos = new ArrayList<String>();
simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
deCodesXMLFileName = reportList + "DECodes.xml";
deCodeType = new ArrayList<String>();
@@ -467,6 +410,7 @@
rowList = new ArrayList<Integer>();
colList = new ArrayList<Integer>();
+ /*
Calendar c = Calendar.getInstance();
c.setTime( format.parseDate( startDate ) );
c.add( Calendar.DATE, -1 );
@@ -476,17 +420,446 @@
endDate = format.formatDate( c.getTime() );
sDate = format.parseDate( startDate );
eDate = format.parseDate( endDate );
+ */
inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
- generatFeedbackReport();
+ //generatFeedbackReport();
+ generateActivityPlanReport();
statementManager.destroy();
return SUCCESS;
}
+ public List<Report_Decode> getDataInfo( String fileName )
+ {
+ List<Report_Decode> deCodeList = new ArrayList<Report_Decode>();
+
+ 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 )
+ {
+ System.out.println("DHIS_HOME is not set");
+ }
+
+ 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 DHIS2 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();
+ String deCodeExpression = ((Node) textDeCodeList.item( 0 )).getNodeValue().trim();
+ Integer sheetNo = Integer.parseInt( deCodeElement.getAttribute( "sheetno" ) );
+ Integer rowNo = Integer.parseInt( deCodeElement.getAttribute( "rowno" ) );
+ Integer colNo = Integer.parseInt( deCodeElement.getAttribute( "colno" ) );
+ String stype = deCodeElement.getAttribute( "stype" );
+ Report_Decode report_DeCode = new Report_Decode( sheetNo, rowNo, colNo, deCodeExpression, stype );
+
+ deCodeList.add( report_DeCode );
+ }// 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 deCodeList;
+ }
+
+
+ public List<Report_Header> getHeaderInfo( String fileName )
+ {
+ List<Report_Header> report_HeaderList = new ArrayList<Report_Header>();
+
+ 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 )
+ {
+ System.out.println("DHIS_HOME is not set");
+ }
+
+ 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 DHIS2 Home" );
+ return null;
+ }
+
+ NodeList listOfHeaders = doc.getElementsByTagName( "header" );
+ int totalHeaders = listOfHeaders.getLength();
+
+ for( int s = 0; s < totalHeaders; s++ )
+ {
+ Element headerElement = (Element) listOfHeaders.item( s );
+ NodeList textHeaderList = headerElement.getChildNodes();
+ String headerExpression = ((Node) textHeaderList.item( 0 )).getNodeValue().trim();
+ Integer sheetNo = Integer.parseInt( headerElement.getAttribute( "sheetno" ) );
+ Integer rowNo = Integer.parseInt( headerElement.getAttribute( "rowno" ) );
+ Integer colNo = Integer.parseInt( headerElement.getAttribute( "colno" ) );
+ Report_Header report_Header = new Report_Header( sheetNo, rowNo, colNo, headerExpression );
+
+ report_HeaderList.add( report_Header );
+ }// 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 report_HeaderList;
+ }
+
+
+ public void generateActivityPlanReport() throws Exception
+ {
+ Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+
+ WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+
+ // Cell formatting
+ WritableCellFormat wCellformat = new WritableCellFormat();
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setAlignment( Alignment.CENTRE );
+ wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat.setWrap( true );
+
+ WritableCellFormat deWCellformat = new WritableCellFormat();
+ deWCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ deWCellformat.setAlignment( Alignment.CENTRE );
+ deWCellformat.setVerticalAlignment( VerticalAlignment.JUSTIFY );
+ deWCellformat.setWrap( true );
+
+ // OrgUnit Related Info
+ selectedOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+
+ // Getting Program
+ Program curProgram = programService.getProgram( Integer.parseInt( reportProgramTB ) );
+
+ List<Report_Header> headerInfoList = new ArrayList<Report_Header>();
+ headerInfoList = getHeaderInfo( deCodesXMLFileName );
+
+ List<Report_Decode> deCodeList = new ArrayList<Report_Decode>();
+ deCodeList = getDataInfo( deCodesXMLFileName );
+
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ int sortAttributeId = 0;
+
+ String tempStr = "";
+ for( Report_Header report_Header : headerInfoList )
+ {
+ if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_FACILITY ) )
+ {
+ tempStr = selectedOrgUnit.getName();
+ }
+ else if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_FACILITY_P ) )
+ {
+ tempStr = selectedOrgUnit.getParent().getName();
+ }
+ else if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_FACILITY_PP ) )
+ {
+ tempStr = selectedOrgUnit.getParent().getParent().getName();
+ }
+ else if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_HEALTH_WORKER ) )
+ {
+ tempStr = selectedOrgUnit.getContactPerson();
+ }
+ else if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_PERIOD_FROM ) )
+ {
+ tempStr = startDate;
+ }
+ else if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_PERIOD_TO ) )
+ {
+ tempStr = endDate;
+ }
+ else if( report_Header.getExpression().equalsIgnoreCase( Report_Header.HEADER_SORT_ATTRIBUTE ) )
+ {
+ sortAttributeId = report_Header.getRowno();
+ continue;
+ }
+
+ WritableSheet sheet0 = outputReportWorkbook.getSheet( report_Header.getSheetno() );
+ sheet0.addCell( new Label( report_Header.getColno(), report_Header.getRowno(), tempStr, wCellformat ) );
+ }
+
+ String query = "SELECT patient.patientid, programstageinstance.programstageinstanceid, programstageinstance.duedate, " +
+ " programstageinstance.programinstanceid, programstageinstance.programstageid, CONCAT(patient.firstname,' ',patient.middlename,' ',patient.lastname), patient.birthdate " +
+ " FROM patientattributevalue INNER JOIN ( (patient INNER JOIN programinstance ON patient.patientid = programinstance.patientid) "+
+ " INNER JOIN programstageinstance ON programinstance.programinstanceid = programstageinstance.programinstanceid) ON patientattributevalue.patientid = patient.patientid "+
+ " WHERE patientattributevalue.patientattributeid = "+ sortAttributeId + " AND " +
+ " programstageinstance.executiondate is null AND " +
+ " programstageinstance.duedate >= '"+ startDate +"' AND " +
+ " programstageinstance.duedate <= '"+ endDate +"' AND " +
+ " patient.organisationunitid = "+ selectedOrgUnit.getId() +" AND " +
+ " programinstance.programid = "+ reportProgramTB +" ORDER BY patientattributevalue.value,patient.firstname";
+
+ SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+ if ( sqlResultSet != null )
+ {
+ sqlResultSet.beforeFirst();
+ int rowCount = 0;
+ int slNoCount = 1;
+ while ( sqlResultSet.next() )
+ {
+ int patientId = sqlResultSet.getInt( 1 );
+ int programStageInstanceId = sqlResultSet.getInt( 2 );
+ Date programStageDueDate = sqlResultSet.getDate( 3 );
+ int programInstanceID = sqlResultSet.getInt( 4 );
+ int dueProgramStageId = sqlResultSet.getInt( 5 );
+ String patientName = sqlResultSet.getString( 6 );
+ Date patientDOB = sqlResultSet.getDate( 7 );
+
+ List<String> rowContentList = new ArrayList<String>();
+
+ for( Report_Decode report_Decode : deCodeList )
+ {
+ tempStr = report_Decode.getSheetno()+":"+report_Decode.getRowno()+":"+report_Decode.getColno()+":";
+ if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_SLNO ) )
+ {
+ tempStr += slNoCount;
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_BATTRIBUTE ) )
+ {
+ if( report_Decode.getExpression().equalsIgnoreCase( "NA" ) )
+ {
+ tempStr += "-";
+ rowContentList.add( tempStr );
+ continue;
+ }
+ query = "SELECT value FROM patientattributevalue WHERE patientid = "+ patientId +" AND patientattributeid = "+report_Decode.getExpression();
+
+ SqlRowSet sqlResultSet1 = jdbcTemplate.queryForRowSet( query );
+ if ( sqlResultSet1 != null && sqlResultSet1.next() )
+ {
+ String value = sqlResultSet1.getString( 1 );
+ if( value != null && !value.trim().equalsIgnoreCase("") )
+ {
+ tempStr += value;
+ }
+ else
+ {
+ tempStr += "-";
+ }
+ }
+ else
+ {
+ tempStr += "-";
+ }
+
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_BIDENTIFIERTYPE ) )
+ {
+ query = "SELECT identifier FROM patientidentifier WHERE patientid = "+ patientId +" AND patientidentifiertypeid = "+report_Decode.getExpression();
+ SqlRowSet sqlResultSet2 = jdbcTemplate.queryForRowSet( query );
+ if ( sqlResultSet2 != null && sqlResultSet2.next() )
+ {
+ String value = sqlResultSet2.getString( 1 );
+ if( value != null && !value.trim().equalsIgnoreCase("") )
+ {
+ tempStr += value;
+ }
+ else
+ {
+ tempStr += "-";
+ }
+ }
+ else
+ {
+ tempStr += "-";
+ }
+
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_BPROPERTY ) )
+ {
+ if( report_Decode.getExpression().equalsIgnoreCase( "Name" ) )
+ {
+ tempStr += patientName.trim();
+ }
+ else if( report_Decode.getExpression().equalsIgnoreCase( "DOB" ) )
+ {
+ String value = simpleDateFormat.format( patientDOB );
+ if( value != null && !value.trim().equalsIgnoreCase("") )
+ {
+ tempStr += value;
+ }
+ else
+ {
+ tempStr += "-";
+ }
+ }
+
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_PROGRAMSTAGEDUEDATE ) )
+ {
+ if( report_Decode.getExpression().equalsIgnoreCase( "NA" ) )
+ {
+ tempStr += simpleDateFormat.format( programStageDueDate );
+ }
+ else
+ {
+ query = "SELECT duedate FROM programstageinstance WHERE programstageid = "+ report_Decode.getExpression() +" AND programinstanceid = "+ programInstanceID;
+ SqlRowSet sqlResultSet3 = jdbcTemplate.queryForRowSet( query );
+ if ( sqlResultSet3 != null && sqlResultSet3.next() )
+ {
+ Date dueDate = sqlResultSet3.getDate( 1 );
+ String value = simpleDateFormat.format( dueDate );
+ if( value != null && !value.trim().equalsIgnoreCase("") )
+ {
+ tempStr += value;
+ }
+ else
+ {
+ tempStr += "-";
+ }
+ }
+ else
+ {
+ tempStr += "-";
+ }
+ }
+
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_PROGRAMSTAGEDUE ) )
+ {
+ query = "SELECT name FROM programstage WHERE programstageid = "+dueProgramStageId;
+ SqlRowSet sqlResultSet4 = jdbcTemplate.queryForRowSet( query );
+ if ( sqlResultSet4 != null && sqlResultSet4.next() )
+ {
+ String value = sqlResultSet4.getString( 1 );
+ if( value != null && !value.trim().equalsIgnoreCase("") )
+ {
+ tempStr += value;
+ }
+ else
+ {
+ tempStr += "-";
+ }
+ }
+ else
+ {
+ tempStr += "-";
+ }
+
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_NA ) )
+ {
+ tempStr += " ";
+
+ rowContentList.add( tempStr );
+ }
+ else if( report_Decode.getStype().equalsIgnoreCase( Report_Decode.STYPE_SERVICEDUE ) )
+ {
+ String[] str1 = report_Decode.getExpression().split( ";" );
+
+ String[] serviceList = null;
+ for( int i = 0; i < str1.length; i++ )
+ {
+ String[] str2 = str1[i].split( ":" );
+ if( dueProgramStageId == Integer.parseInt( str2[0] ) )
+ {
+ serviceList = str2[1].split( "," );
+ }
+ }
+
+ if( serviceList != null && serviceList.length > 0 )
+ {
+ for( int j=0; j < serviceList.length; j++ )
+ {
+ WritableSheet sheet0 = outputReportWorkbook.getSheet( report_Decode.getSheetno() );
+ sheet0.addCell( new Label( report_Decode.getColno(), report_Decode.getRowno()+j+rowCount, serviceList[j], wCellformat ) );
+ sheet0.addCell( new Label( report_Decode.getColno()+1, report_Decode.getRowno()+j+rowCount, " ", wCellformat ) );
+ sheet0.addCell( new Label( report_Decode.getColno()+2, report_Decode.getRowno()+j+rowCount, " ", wCellformat ) );
+ }
+
+ for( String rowContent : rowContentList )
+ {
+ String[] parts = rowContent.split( ":" );
+ WritableSheet sheet0 = outputReportWorkbook.getSheet( Integer.parseInt( parts[0] ) );
+ sheet0.mergeCells( Integer.parseInt( parts[2] ), Integer.parseInt( parts[1] )+rowCount, Integer.parseInt( parts[2] ), Integer.parseInt( parts[1] )+rowCount+serviceList.length-1 );
+ sheet0.addCell( new Label( Integer.parseInt( parts[2] ), Integer.parseInt( parts[1] )+rowCount, parts[3], wCellformat ) );
+ }
+
+ rowCount += serviceList.length;
+ slNoCount++;
+ }
+ }
+ }
+ }
+ }
+
+ outputReportWorkbook.write();
+
+ outputReportWorkbook.close();
+
+ fileName = reportFileNameTB.replace( ".xls", "" );
+ fileName += "_" + selectedOrgUnit.getShortName() + ".xls";
+
+ File outputReportFile = new File( outputReportPath );
+
+ inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+ outputReportFile.deleteOnExit();
+
+ }
+
public void generatFeedbackReport()
throws Exception
{
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/csreview/action/GenerateCSReviewReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/csreview/action/GenerateCSReviewReportResultAction.java 2011-04-15 11:39:32 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/csreview/action/GenerateCSReviewReportResultAction.java 2011-04-29 13:45:23 +0000
@@ -1,6 +1,7 @@
package org.hisp.dhis.reports.csreview.action;
import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
import java.io.BufferedInputStream;
import java.io.File;
@@ -12,15 +13,13 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
-import java.util.Iterator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
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.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
@@ -34,38 +33,24 @@
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
-import org.amplecode.quick.StatementManager;
-import org.hisp.dhis.system.util.MathUtils;
-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.amplecode.quick.StatementManager;
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.period.Period;
import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.reports.ReportService;
import org.hisp.dhis.reports.Report_in;
+import org.hisp.dhis.reports.Report_inDesign;
+import org.hisp.dhis.system.util.MathUtils;
import org.hisp.dhis.user.CurrentUserService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
+
import com.opensymphony.xwork2.Action;
public class GenerateCSReviewReportResultAction
implements Action
{
- private static final String NULL_REPLACEMENT = "0";
private final String GENERATEAGGDATA = "generateaggdata";
@@ -104,57 +89,25 @@
{
this.currentUserService = currentUserService;
}
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private DataValueService dataValueService;
-
- public void setDataValueService( DataValueService dataValueService )
- {
- this.dataValueService = dataValueService;
- }
-
- private AggregationService aggregationService;
-
- public void setAggregationService( AggregationService aggregationService )
- {
- this.aggregationService = aggregationService;
- }
-
- private DataElementCategoryService dataElementCategoryOptionComboService;
-
- public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
- {
- this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
- }
-
-/*
- private DataElementCategoryService dataElementCategoryOptionComboService;
-
- public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
- {
- this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
- }
- */
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
// -------------------------------------------------------------------------
// Input & output
// -------------------------------------------------------------------------
-
-
private String reportList;
public void setReportList( String reportList )
@@ -176,6 +129,13 @@
this.endDate = endDate;
}
+ private String aggData;
+
+ public void setAggData( String aggData )
+ {
+ this.aggData = aggData;
+ }
+
private InputStream inputStream;
public InputStream getInputStream()
@@ -190,66 +150,24 @@
return fileName;
}
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- private SimpleDateFormat simpleDateFormat;
-
- public SimpleDateFormat getSimpleDateFormat()
- {
- return simpleDateFormat;
- }
-
- private SimpleDateFormat yearFormat;
-
- public SimpleDateFormat getYearFormat()
- {
- return yearFormat;
- }
private List<OrganisationUnit> orgUnitList;
- private List<String> deCodeType;
-
- private List<String> serviceType;
-
private String raFolderName;
private String reportModelTB;
private String reportFileNameTB;
- private List<Integer> sheetList;
-
- private List<Integer> rowList;
-
- private List<Integer> colList;
-
private Date sDate;
private Date eDate;
- // private Date sDateTemp;
-
- // private Date eDateTemp;
private Integer monthCount;
- int isAggregated = 0;
-
- int deFlag2;
-
- int deFlag1;
-
- private String aggData;
-
- public void setAggData( String aggData )
- {
- this.aggData = aggData;
- }
+ private SimpleDateFormat simpleDateFormat;
+
+ private SimpleDateFormat yearFormat;
// -------------------------------------------------------------------------
// Action implementation
@@ -261,11 +179,6 @@
// Intialisation
statementManager.initialise();
- deCodeType = new ArrayList<String>();
- serviceType = new ArrayList<String>();
- sheetList = new ArrayList<Integer>();
- rowList = new ArrayList<Integer>();
- colList = new ArrayList<Integer>();
orgUnitList = new ArrayList<OrganisationUnit>();
String deCodesXMLFileName = "";
raFolderName = reportService.getRAFolderName();
@@ -282,12 +195,8 @@
String tempFromDate = simpleDateFormat.format( sDate );
String tempToDate = simpleDateFormat.format( eDate );
- //System.out.println( "Starting:" + tempFromDate + "Ending: " + tempToDate );
-
String startTargetYear = yearFormat.format( sDate );
- // System.out.println( "StartTargetYear:" + startTargetYear );
-
Calendar tempStartDate = Calendar.getInstance();
Calendar tempEndDate = Calendar.getInstance();
@@ -300,7 +209,6 @@
int startMonth = tempStartDate.get( Calendar.MONTH );
monthCount = ((endYear - startYear) * 12) - startMonth + endMonth + 1;
- // System.out.println( "MonthCount : " + monthCount );
tempStr = monthCount.toString();
@@ -316,8 +224,7 @@
System.out.println( "Report Generation Start Time is : \t" + new Date() );
// Getting Orgunit Details
- List<OrganisationUnit> curUserRootOrgUnitList = new ArrayList<OrganisationUnit>( currentUserService
- .getCurrentUser().getOrganisationUnits() );
+ List<OrganisationUnit> curUserRootOrgUnitList = new ArrayList<OrganisationUnit>( currentUserService.getCurrentUser().getOrganisationUnits() );
if ( curUserRootOrgUnitList != null && curUserRootOrgUnitList.size() != 0 )
{
for ( OrganisationUnit orgUnit : curUserRootOrgUnitList )
@@ -325,30 +232,22 @@
List<OrganisationUnit> childOrgList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
Collections.sort( childOrgList, new OrganisationUnitNameComparator() );
orgUnitList.addAll( childOrgList );
- // Collections.sort( orgUnitList, new
- // OrganisationUnitNameComparator() );
orgUnitList.add( orgUnit );
-
}
}
- System.out.println( "OrgUnitSize:" + orgUnitList.size() );
// Getting DeCodes
- List<String> deCodesList = getDECodes( deCodesXMLFileName );
+ List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
+ String dataElmentIdsByComma = getDataelementIds( reportDesignList );
+ //List<String> deCodesList = getDECodes( deCodesXMLFileName );
// Getting Exel Template
- String inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
- + "template" + File.separator + reportFileNameTB;
- String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
- + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ String 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 );
- WritableWorkbook outputReportWorkbook = Workbook
- .createWorkbook( new File( outputReportPath ), templateWorkbook );
- // WritableSheet sheet0 = outputReportWorkbook.createSheet(
- // selReportObj.getName(), 0 );
- // int rowStart = 0;
- // int colStart = 0;
WritableCellFormat wCellformat = new WritableCellFormat();
wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
wCellformat.setWrap( true );
@@ -360,50 +259,43 @@
sheet0.addCell( new Label( 3, 4, startTargetYear, getCellFormat2() ) );
sheet0.addCell( new Label( 5, 3, "Achievement for : " + tempFromDate + " - " + tempToDate, getCellFormat2() ) );
- // Period selPeriod = periodService.getPeriod( sDate, eDate, new
- // YearlyPeriodType() );
- /*
- * if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) ) {
- * OrganisationUnit orgUnit =
- * organisationUnitService.getOrganisationUnit( ouIDTB ); orgUnitList =
- * new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
- * Collections.sort( orgUnitList, new OrganisationUnitNameComparator()
- * ); orgUnitList.add( orgUnit );
- *
- * parentUnit = orgUnit.getName(); }
- */
+ List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriods( tempStartDate.getTime(), tempEndDate.getTime() ) );
+ Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
+ String periodIdsByComma = getCommaDelimitedString( periodIds );
int rowCount = 1;
int rowIncr = 0;
+
// Getting DataValues
for ( OrganisationUnit curOrgUnit : orgUnitList )
{
+ Map<String, String> aggDeMap = new HashMap<String, String>();
+ if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
+ {
+ aggDeMap.putAll( reportService.getResultDataValueFromAggregateTable( curOrgUnit.getId(), dataElmentIdsByComma, periodIdsByComma ) );
+ }
+ else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
+ {
+ List<OrganisationUnit> childOrgUnitTree = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( curOrgUnit.getId() ) );
+ List<Integer> childOrgUnitTreeIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, childOrgUnitTree ) );
+ String childOrgUnitsByComma = getCommaDelimitedString( childOrgUnitTreeIds );
+
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( childOrgUnitsByComma, dataElmentIdsByComma, periodIdsByComma ) );
+ }
+ else if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
+ {
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( ""+curOrgUnit.getId(), dataElmentIdsByComma, periodIdsByComma ) );
+ }
+
int count1 = 0;
- for ( String deCode : deCodesList )
+ for ( Report_inDesign report_inDesign : reportDesignList )
{
- int tempRowNo = rowList.get( count1 ) + rowIncr;
- int tempColNo = colList.get( count1 );
- int sheetNo = sheetList.get( count1 );
-
- // String deType = (String) deCodeType.get( count1 );
- String sType = (String) serviceType.get( count1 );
-
- /*
- * Calendar tempStartDate1 = Calendar.getInstance(); Calendar
- * tempEndDate1 = Calendar.getInstance();
- *
- * tempStartDate1.setTime( sDate ); tempEndDate1.setTime( eDate
- * );
- */
- /*
- * List<Calendar> calendarList = new ArrayList<Calendar>(
- * getStartingEndingPeriods( deType ) ); if ( calendarList ==
- * null || calendarList.isEmpty() ) { tempStartDate1.setTime(
- * selPeriod.getStartDate() ); tempEndDate1.setTime(
- * selPeriod.getEndDate() ); return SUCCESS; } else {
- * tempStartDate1 = calendarList.get( 0 ); tempEndDate1 =
- * calendarList.get( 1 ); }
- */
+ int tempRowNo = report_inDesign.getRowno() + rowIncr;
+ int tempColNo = report_inDesign.getColno();
+ int sheetNo = report_inDesign.getSheetno();
+ String sType = report_inDesign.getStype();
+ String deCode = report_inDesign.getExpression();
+
if ( deCode.equalsIgnoreCase( "[0.0]" ) )
{
tempStr = " ";
@@ -427,40 +319,28 @@
{
tempStr = deCode.replace( "?", "" + (tempRowNo + 1) );
tempStr = tempStr.replace( "MONTHCOUNT", "" + monthCount );
- // float f = Float.parseFloat(tempStr);
- // int tempStrRound = Math.round(f);
}
else
{
if ( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
{
- tempStr = reportService.getIndividualResultDataValue(deCode, tempStartDate.getTime(), tempEndDate.getTime(), curOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCode, aggDeMap );
+ //tempStr = reportService.getIndividualResultDataValue(deCode, tempStartDate.getTime(), tempEndDate.getTime(), curOrgUnit, reportModelTB );
}
else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
{
- tempStr = getResultDataValue( deCode, tempStartDate.getTime(), tempEndDate.getTime(), curOrgUnit );
- //tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCode, aggDeMap );
+ //tempStr = getResultDataValue( deCode, tempStartDate.getTime(), tempEndDate.getTime(), curOrgUnit );
+ //tempStr = reportService.getResultDataValue( deCode, tempStartDate.getTime(), tempEndDate.getTime(), curOrgUnit, " " );
}
else if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
{
- List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( tempStartDate.getTime(), tempEndDate.getTime() ) );
- Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
- tempStr = reportService.getResultDataValueFromAggregateTable( deCode, periodIds, curOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCode, aggDeMap );
+ //tempStr = reportService.getResultDataValueFromAggregateTable( deCode, periodIds, curOrgUnit, reportModelTB );
}
- //tempStr = getResultDataValue( deCode, tempStartDate.getTime(), tempEndDate.getTime(), curOrgUnit );
}
System.out.println( "DECode : " + deCode + " TempStr : " + tempStr );
- // System.out.println( "TempStr: " + tempStr );
sheet0 = outputReportWorkbook.getSheet( sheetNo );
- // sheet0.addCell( new Label( colStart, rowStart,
- // selReportObj.getName(), getCellFormat1() ) );
-
- /*
- * WritableCellFormat wCellformat = new WritableCellFormat();
- * wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- * wCellformat.setWrap( true ); wCellformat.setAlignment(
- * Alignment.CENTRE );
- */
if ( tempStr == null || tempStr.equals( " " ) )
{
sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
@@ -469,21 +349,15 @@
{
if ( sType.equalsIgnoreCase( "formula" ) )
{
-
sheet0.addCell( new Formula( tempColNo, tempRowNo, tempStr, wCellformat ) );
- // float f = Float.parseFloat(tempStr);
- // int tempStrRound = Math.round(f);
- // System.out.println("Round value :" +tempStrRound);
}
else
{
sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
}
}
- // System.out.println("Temp Data value : " + tempStr );
count1++;
}
- // System.out.println( "Name og OrgUnit :" + curOrgUnit.getName() );
rowCount++;
rowIncr++;
}
@@ -492,7 +366,6 @@
outputReportWorkbook.close();
- //fileName = reportFileNameTB.replace( ".xls", "" );
fileName = reportFileNameTB;
File outputReportFile = new File( outputReportPath );
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
@@ -508,83 +381,13 @@
// Supportive Methods
// -------------------------------------------------------------------------
- // for EXL file
-
- 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
-
- // Function for get data Value
-
- private String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit )
- {
- isAggregated = 0;
-
+ private String getAggVal( String expression, Map<String, String> aggDeMap )
+ {
try
{
Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
- Matcher matcher = pattern.matcher( formula );
+ Matcher matcher = pattern.matcher( expression );
StringBuffer buffer = new StringBuffer();
String resultValue = "";
@@ -594,152 +397,33 @@
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;
- deFlag2 = 0;
-
- }
- else
- {
- replaceString = String.valueOf( aggregatedValue );
-
- deFlag2 = 1;
-
- isAggregated = 1;
- }
-
- }
- else
- {
- deFlag1 = 1;
- deFlag2 = 0;
- 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 = "";
- }
- }
+
+ replaceString = aggDeMap.get( replaceString );
+
+ if( replaceString == null )
+ {
+ replaceString = "0";
+ }
+
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
- {
- deFlag2 = 0;
- resultValue = buffer.toString();
- }
-
- if ( isAggregated == 0 )
- {
- resultValue = " ";
- }
-
- if ( resultValue.equalsIgnoreCase( "" ) )
- {
- resultValue = " ";
- }
+
+ double d = 0.0;
+ try
+ {
+ d = MathUtils.calculateExpression( buffer.toString() );
+ }
+ catch ( Exception e )
+ {
+ d = 0.0;
+ resultValue = "";
+ }
+
+ resultValue = "" + (double) d;
return resultValue;
}
@@ -747,51 +431,45 @@
{
throw new RuntimeException( "Illegal DataElement id", ex );
}
- }// end data valu function
+ }
- /*
- * Returns the PeriodType Object for selected DataElement, If no PeriodType
- * is found then by default returns Monthly Period type
- */
- public PeriodType getDataElementPeriodType( DataElement de )
+ public String getDataelementIds( List<Report_inDesign> reportDesignList )
{
- List<DataSet> dataSetList = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
- Iterator<DataSet> it = dataSetList.iterator();
- // Iterator it = dataSetList.iterator();
- while ( it.hasNext() )
+ String dataElmentIdsByComma = "-1";
+ for( Report_inDesign report_inDesign : reportDesignList )
{
- DataSet ds = (DataSet) it.next();
- List<DataElement> dataElementList = new ArrayList<DataElement>( ds.getDataElements() );
- if ( dataElementList.contains( de ) )
- {
- return ds.getPeriodType();
+ String formula = report_inDesign.getExpression();
+ try
+ {
+ 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 dataElementId = Integer.parseInt( replaceString );
+ dataElmentIdsByComma += "," + dataElementId;
+ replaceString = "";
+ matcher.appendReplacement( buffer, replaceString );
+ }
+ }
+ catch( Exception e )
+ {
+
}
}
-
- return null;
-
- } // getDataElementPeriodType end
-
- // getStartEndDateFunction
- /*
- * public List<Calendar> getStartingEndingPeriods( String deType ) {
- *
- * List<Calendar> calendarList = new ArrayList<Calendar>();
- *
- * Calendar tempStartDate1 = Calendar.getInstance(); Calendar tempEndDate1 =
- * Calendar.getInstance();
- *
- * //tempStartDate1.setTime( selPeriod.getStartDate() ); //
- * tempEndDate1.setTime( selPeriod.getEndDate() );
- *
- *
- * calendarList.add( tempStartDate1 ); calendarList.add( tempEndDate1 );
- *
- *
- *
- * return calendarList; }
- */
-
+
+ System.out.println("DataElementIdsByComma : "+ dataElmentIdsByComma );
+
+ return dataElmentIdsByComma;
+ }
+
// Excel sheet format function
public WritableCellFormat getCellFormat1()
throws Exception
@@ -815,7 +493,6 @@
wCellformat.setAlignment( Alignment.CENTRE );
wCellformat.setBackground( Colour.GRAY_50 );
wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
- // wCellformat.
wCellformat.setWrap( true );
return wCellformat;
} // end getCellFormat1() function
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java 2011-04-19 07:43:37 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java 2011-04-29 13:45:23 +0000
@@ -241,7 +241,7 @@
String dataSetIds = selReportObj.getDataSetIds();
Collection<Integer> dataElementIdList = new ArrayList<Integer>();
- if( dataSetIds != null )
+ if( dataSetIds != null && !dataSetIds.trim().equalsIgnoreCase( "" ) )
{
String[] partsOfDataSetIds = dataSetIds.split( "," );
for( int i = 0; i < partsOfDataSetIds.length; i++ )
@@ -262,7 +262,7 @@
sDate = format.parseDate( startDate );
eDate = format.parseDate( endDate );
- List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( sDate, eDate ) );
+ List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriods( sDate, eDate ) );
Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
@@ -282,6 +282,18 @@
{
aggDeMap.putAll( reportService.getResultDataValueFromAggregateTable( currentOrgUnit.getId(), dataElmentIdsByComma, periodIdsByComma ) );
}
+ else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
+ {
+ List<OrganisationUnit> childOrgUnitTree = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ List<Integer> childOrgUnitTreeIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, childOrgUnitTree ) );
+ String childOrgUnitsByComma = getCommaDelimitedString( childOrgUnitTreeIds );
+
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( childOrgUnitsByComma, dataElmentIdsByComma, periodIdsByComma ) );
+ }
+ else if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
+ {
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( ""+currentOrgUnit.getId(), dataElmentIdsByComma, periodIdsByComma ) );
+ }
int count1 = 0;
Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
@@ -335,11 +347,13 @@
{
if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
{
- tempStr = reportService.getIndividualResultDataValue( deCodeString, sDate, eDate, currentOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCodeString, aggDeMap );
+ //tempStr = reportService.getIndividualResultDataValue( deCodeString, sDate, eDate, currentOrgUnit, reportModelTB );
}
else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
{
- tempStr = reportService.getResultDataValue( deCodeString, sDate, eDate, currentOrgUnit, reportModelTB );
+ //tempStr = reportService.getResultDataValue( deCodeString, sDate, eDate, currentOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCodeString, aggDeMap );
}
else if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
{
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java 2011-04-19 07:43:37 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/periodwiseprogress/action/GeneratePeriodWiseProgressAnalyserResultAction.java 2011-04-29 13:45:23 +0000
@@ -213,9 +213,13 @@
// OrgUnit Info
OrganisationUnit currentOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-
+
System.out.println( currentOrgUnit.getName()+ " : " + selReportObj.getName()+" : Report Generation Start Time is : " + new Date() );
+ List<OrganisationUnit> childOrgUnitTree = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( ouIDTB ) );
+ List<Integer> childOrgUnitTreeIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, childOrgUnitTree ) );
+ String childOrgUnitsByComma = getCommaDelimitedString( childOrgUnitTreeIds );
+
// Report Info
String deCodesXMLFileName = selReportObj.getXmlTemplateName();
String reportModelTB = selReportObj.getModel();
@@ -241,6 +245,7 @@
PeriodType periodType = periodService.getPeriodTypeByName( periodTypeId );
List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( periodType, sDate, eDate ) );
+ //List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriods( sDate, eDate ) );
Collections.sort( periodList, new PeriodStartDateComparator() );
if( periodTypeId.equalsIgnoreCase( "monthly" ) )
@@ -259,7 +264,7 @@
// To get Aggregation Data
String dataSetIds = selReportObj.getDataSetIds();
Collection<Integer> dataElementIdList = new ArrayList<Integer>();
- if( dataSetIds != null )
+ if( dataSetIds != null && !dataSetIds.trim().equalsIgnoreCase( "" ) )
{
String[] partsOfDataSetIds = dataSetIds.split( "," );
for( int i = 0; i < partsOfDataSetIds.length; i++ )
@@ -281,7 +286,7 @@
for( Period period : periodList )
{
- Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodService.getPeriodsBetweenDates( period.getStartDate(), period.getEndDate() ) ) );
+ Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodService.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ) ) );
String periodsByComma = getCommaDelimitedString( periodIds );
Map<String, String> aggDeMap = new HashMap<String, String>();
@@ -289,6 +294,15 @@
{
aggDeMap.putAll( reportService.getResultDataValueFromAggregateTable( currentOrgUnit.getId(), dataElmentIdsByComma, periodsByComma ) );
}
+ else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
+ {
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( childOrgUnitsByComma, dataElmentIdsByComma, periodsByComma ) );
+ }
+ else if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
+ {
+ aggDeMap.putAll( reportService.getAggDataFromDataValueTable( ""+currentOrgUnit.getId(), dataElmentIdsByComma, periodsByComma ) );
+ }
+
Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
while ( reportDesignIterator.hasNext() )
@@ -325,11 +339,13 @@
{
if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
{
- tempStr = reportService.getIndividualResultDataValue( deCodeString, period.getStartDate(), period.getEndDate(), currentOrgUnit, reportModelTB );
+ //tempStr = reportService.getIndividualResultDataValue( deCodeString, period.getStartDate(), period.getEndDate(), currentOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCodeString, aggDeMap );
}
else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
{
- tempStr = reportService.getResultDataValue( deCodeString, period.getStartDate(), period.getEndDate(), currentOrgUnit, reportModelTB );
+ //tempStr = reportService.getResultDataValue( deCodeString, period.getStartDate(), period.getEndDate(), currentOrgUnit, reportModelTB );
+ tempStr = getAggVal( deCodeString, aggDeMap );
}
else if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
{
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java 2011-04-15 11:39:32 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java 2011-04-29 13:45:23 +0000
@@ -257,6 +257,13 @@
Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+ OrganisationUnitGroup excludeOrgUnitGroup = selReportObj.getOrgunitGroup();
+ List<OrganisationUnit> excludeOrgUnits = new ArrayList<OrganisationUnit>();
+ if( excludeOrgUnitGroup != null )
+ {
+ excludeOrgUnits.addAll( excludeOrgUnitGroup.getMembers() );
+ }
+
// Getting DataValues
List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
int orgUnitCount = 0;
@@ -265,7 +272,21 @@
while ( it.hasNext() )
{
OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
-
+ List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>();
+
+ if ( organisationUnitGroupId.equalsIgnoreCase( "ALL" ) || organisationUnitGroupId.equalsIgnoreCase( "Selected_Only" ) || organisationUnitGroupId.equalsIgnoreCase( "useexistingaggdata" ) )
+ {
+ excludeOrgUnits.retainAll( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ }
+ else
+ {
+ ouList.addAll( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+
+ excludeOrgUnits.retainAll( ouList );
+
+ ouList.retainAll( orgGroupMembers );
+ }
+
Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
while ( reportDesignIterator.hasNext() )
{
@@ -739,26 +760,113 @@
if ( organisationUnitGroupId.equalsIgnoreCase( "ALL" ) )
{
tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
+
+ if( excludeOrgUnits != null && excludeOrgUnits.size() != 0 )
+ {
+ double tempExcludeAggVal = 0.0;
+ double value = 0.0;
+ for ( OrganisationUnit unit : excludeOrgUnits )
+ {
+ String tempStr1 = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
+
+ try
+ {
+ value = Double.valueOf( tempStr1 );
+ }
+ catch ( Exception e )
+ {
+ value = 0.0;
+ }
+ tempExcludeAggVal += value;
+ }
+
+ try
+ {
+ value = Double.parseDouble( tempStr ) - tempExcludeAggVal;
+ tempStr = ""+value;
+ }
+ catch( Exception e )
+ {
+ }
+ }
}
else if ( organisationUnitGroupId.equalsIgnoreCase( "Selected_Only" ) )
{
tempStr = reportService.getIndividualResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
+
+ if( excludeOrgUnits != null && excludeOrgUnits.size() != 0 )
+ {
+ double tempExcludeAggVal = 0.0;
+ double value = 0.0;
+ for ( OrganisationUnit unit : excludeOrgUnits )
+ {
+ String tempStr1 = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
+
+ try
+ {
+ value = Double.valueOf( tempStr1 );
+ }
+ catch ( Exception e )
+ {
+ value = 0.0;
+ }
+ tempExcludeAggVal += value;
+ }
+
+ try
+ {
+ value = Double.parseDouble( tempStr ) - tempExcludeAggVal;
+ tempStr = ""+value;
+ }
+ catch( Exception e )
+ {
+ }
+ }
}
else if ( organisationUnitGroupId.equalsIgnoreCase( "useexistingaggdata" ) )
{
List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( tempStartDate.getTime(), tempEndDate.getTime() ) );
Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
tempStr = reportService.getResultDataValueFromAggregateTable( deCodeString, periodIds, currentOrgUnit, reportModelTB );
+
+ if( excludeOrgUnits != null && excludeOrgUnits.size() != 0 )
+ {
+ double tempExcludeAggVal = 0.0;
+ double value = 0.0;
+ for ( OrganisationUnit unit : excludeOrgUnits )
+ {
+ String tempStr1 = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
+
+ try
+ {
+ value = Double.valueOf( tempStr1 );
+ }
+ catch ( Exception e )
+ {
+ value = 0.0;
+ }
+ tempExcludeAggVal += value;
+ }
+
+ try
+ {
+ value = Double.parseDouble( tempStr ) - tempExcludeAggVal;
+ tempStr = ""+value;
+ }
+ catch( Exception e )
+ {
+ }
+ }
}
else
{
- List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ //List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
- orgUnitList.retainAll( orgGroupMembers );
+ //ouList.retainAll( orgGroupMembers );
double temp = 0.0;
double value = 0.0;
- for ( OrganisationUnit unit : orgUnitList )
+ for ( OrganisationUnit unit : ouList )
{
tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
@@ -769,13 +877,41 @@
catch ( Exception e )
{
value = 0.0;
- System.out.println( e );
}
temp += value;
}
tempNum = temp;
tempStr = String.valueOf( (int) temp );
+
+ if( excludeOrgUnits != null && excludeOrgUnits.size() != 0 )
+ {
+ double tempExcludeAggVal = 0.0;
+ value = 0.0;
+ for ( OrganisationUnit unit : excludeOrgUnits )
+ {
+ String tempStr1 = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
+
+ try
+ {
+ value = Double.valueOf( tempStr1 );
+ }
+ catch ( Exception e )
+ {
+ value = 0.0;
+ }
+ tempExcludeAggVal += value;
+ }
+
+ try
+ {
+ value = Double.parseDouble( tempStr ) - tempExcludeAggVal;
+ tempStr = ""+value;
+ }
+ catch( Exception e )
+ {
+ }
+ }
}
}
else if ( sType.equalsIgnoreCase( "de-text-agg" ) )
@@ -790,13 +926,13 @@
}
else
{
- List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ //List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
- orgUnitList.retainAll( orgGroupMembers );
+ //ouList.retainAll( orgGroupMembers );
double temp = 0.0;
double value = 0.0;
- for ( OrganisationUnit unit : orgUnitList )
+ for ( OrganisationUnit unit : ouList )
{
tempStr = reportService.getAggCountForTextData( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit );
@@ -832,12 +968,12 @@
}
else
{
- List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
- orgUnitList.retainAll( orgGroupMembers );
+ //List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ //ouList.retainAll( orgGroupMembers );
double temp = 0.0;
double value = 0.0;
- for ( OrganisationUnit unit : orgUnitList )
+ for ( OrganisationUnit unit : ouList )
{
tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
try
@@ -877,12 +1013,12 @@
}
else
{
- List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
- orgUnitList.retainAll( orgGroupMembers );
+ //List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ //ouList.retainAll( orgGroupMembers );
double temp = 0.0;
double value = 0.0;
- for ( OrganisationUnit unit : orgUnitList )
+ for ( OrganisationUnit unit : ouList )
{
tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit, reportModelTB );
try
@@ -931,12 +1067,12 @@
}
else
{
- List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
- orgUnitList.retainAll( orgGroupMembers );
+ //List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( currentOrgUnit.getId() ) );
+ //ouList.retainAll( orgGroupMembers );
double temp = 0.0;
double value = 0.0;
- for ( OrganisationUnit unit : orgUnitList )
+ for ( OrganisationUnit unit : ouList )
{
tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), unit );
=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Decode.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Decode.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Decode.java 2011-04-29 13:45:23 +0000
@@ -0,0 +1,109 @@
+package org.hisp.dhis.reports.util;
+
+import java.io.Serializable;
+
+public class Report_Decode implements Serializable
+{
+ public static final String STYPE_SLNO = "SLNO";
+ public static final String STYPE_BATTRIBUTE = "B-ATTRIBUTE";
+ public static final String STYPE_BIDENTIFIERTYPE = "B-IDENTIFIERTYPE";
+ public static final String STYPE_BPROPERTY = "B-PROPERTY";
+ public static final String STYPE_PROGRAMSTAGEDUEDATE = "PROGRAMSTAGE-DUEDATE";
+ public static final String STYPE_PROGRAMSTAGEDUE = "PROGRAMSTAGE-DUE";
+ public static final String STYPE_SERVICEDUE = "SERVICE-DUE";
+ public static final String STYPE_NA = "NA";
+
+ /**
+ * Sheet number
+ */
+ private int sheetno;
+
+ /**
+ * Row number
+ */
+ private int rowno;
+
+ /**
+ * Column number
+ */
+ private int colno;
+
+ /**
+ * Formula to calculate the values.
+ */
+ private String expression;
+
+ private String stype;
+
+ // -------------------------------------------------------------------------
+ // Contructors
+ // -------------------------------------------------------------------------
+ public Report_Decode()
+ {
+
+ }
+
+ public Report_Decode( int sheetno, int rowno, int colno, String expression, String stype )
+ {
+ this.sheetno = sheetno;
+ this.rowno = rowno;
+ this.colno = colno;
+ this.expression = expression;
+ this.stype = stype;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public int getSheetno()
+ {
+ return sheetno;
+ }
+
+ public void setSheetno( int sheetno )
+ {
+ this.sheetno = sheetno;
+ }
+
+ public int getRowno()
+ {
+ return rowno;
+ }
+
+ public void setRowno( int rowno )
+ {
+ this.rowno = rowno;
+ }
+
+ public int getColno()
+ {
+ return colno;
+ }
+
+ public void setColno( int colno )
+ {
+ this.colno = colno;
+ }
+
+ public String getExpression()
+ {
+ return expression;
+ }
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
+ public String getStype()
+ {
+ return stype;
+ }
+
+ public void setStype( String stype )
+ {
+ this.stype = stype;
+ }
+
+}
=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Header.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Header.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report_Header.java 2011-04-29 13:45:23 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.reports.util;
+
+import java.io.Serializable;
+
+public class Report_Header implements Serializable
+{
+ public static final String HEADER_FACILITY = "FACILITY";
+ public static final String HEADER_HEALTH_WORKER = "HEALTH_WORKER";
+ public static final String HEADER_FACILITY_P = "FACILITY_P";
+ public static final String HEADER_PERIOD_FROM = "PERIOD_FROM";
+ public static final String HEADER_FACILITY_PP = "FACILITY_PP";
+ public static final String HEADER_PERIOD_TO = "PERIOD_TO";
+ public static final String HEADER_SORT_ATTRIBUTE = "SORT_ATTRIBUTE";
+
+ /**
+ * Sheet number
+ */
+ private int sheetno;
+
+ /**
+ * Row number
+ */
+ private int rowno;
+
+ /**
+ * Column number
+ */
+ private int colno;
+
+ /**
+ * Formula to calculate the values.
+ */
+ private String expression;
+
+ // -------------------------------------------------------------------------
+ // Contructors
+ // -------------------------------------------------------------------------
+ public Report_Header()
+ {
+
+ }
+
+ public Report_Header( int sheetno, int rowno, int colno, String expression )
+ {
+ this.sheetno = sheetno;
+ this.rowno = rowno;
+ this.colno = colno;
+ this.expression = expression;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public int getSheetno()
+ {
+ return sheetno;
+ }
+
+ public void setSheetno( int sheetno )
+ {
+ this.sheetno = sheetno;
+ }
+
+ public int getRowno()
+ {
+ return rowno;
+ }
+
+ public void setRowno( int rowno )
+ {
+ this.rowno = rowno;
+ }
+
+ public int getColno()
+ {
+ return colno;
+ }
+
+ public void setColno( int colno )
+ {
+ this.colno = colno;
+ }
+
+ public String getExpression()
+ {
+ return expression;
+ }
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
+}
=== modified file 'local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2011-04-19 07:43:37 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2011-04-29 13:45:23 +0000
@@ -1088,25 +1088,11 @@
id="org.hisp.dhis.reports.csreview.action.GenerateCSReviewReportResultAction"
class="org.hisp.dhis.reports.csreview.action.GenerateCSReviewReportResultAction"
scope="prototype">
- <property name="reportService" ref="org.hisp.dhis.reports.ReportService">
- </property>
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService">
- </property>
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService">
- </property>
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService">
- </property>
- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService">
- </property>
- <property name="statementManager" ref="statementManager">
- </property>
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService">
- </property>
- <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService">
- </property>
- <property name="dataElementCategoryOptionComboService"
- ref ="org.hisp.dhis.dataelement.DataElementCategoryService">
- </property>
+ <property name="statementManager" ref="statementManager" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
<!-- NBITS Reports Section -->
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm 2011-03-01 08:37:19 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm 2011-04-29 13:45:23 +0000
@@ -1,71 +1,71 @@
<script>
- //Global Variables
-
- var reportModels = new HashTable();
- var reportFileNames = new HashTable();
- var reportPrograms = 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");
- reportPrograms.put(reportId,"$report.program");
- #end
-
- function formValidations()
- {
- var reportListIndex = document.reportForm.reportList.selectedIndex;
- var orgunitIdValue = document.reportForm.ouIDTB.value;
- var startDateValue = document.reportForm.startDate.value;
- var endDateValue = document.reportForm.endDate.value;
-
- if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
- else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
- else if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="") {alert("Please Select Start Date And End Date"); return false;}
- else if(startDateValue > endDateValue) {alert("Starte Date Is Greater Than End Date"); return false;}
-
- document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
- document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
- document.reportForm.reportProgramTB.value = reportPrograms.get(document.reportForm.reportList.options[reportListIndex].value);
-
- return true;
- }
+ //Global Variables
+
+ var reportModels = new HashTable();
+ var reportFileNames = new HashTable();
+ var reportPrograms = 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");
+ reportPrograms.put(reportId,"$report.program");
+ #end
+
+ function formValidations()
+ {
+ var reportListIndex = document.reportForm.reportList.selectedIndex;
+ var orgunitIdValue = document.reportForm.ouIDTB.value;
+ var startDateValue = document.reportForm.startDate.value;
+ var endDateValue = document.reportForm.endDate.value;
+
+ if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
+ else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
+ else if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="") {alert("Please Select Start Date And End Date"); return false;}
+ else if(startDateValue > endDateValue) {alert("Starte Date Is Greater Than End Date"); return false;}
+
+ document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
+ document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
+ document.reportForm.reportProgramTB.value = reportPrograms.get(document.reportForm.reportList.options[reportListIndex].value);
+
+ return true;
+ }
</script>
-<h3>NBITS ActivityPlan</h3><hr /><br />
+<h3>Activity Plan</h3><hr /><br />
<form id="reportForm" name="reportForm" action="generateActivePlanReport.action" method="post" onsubmit="return formValidations()" target="_blank">
- <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
- <tr>
- <td class="NormalB">
- ActivityPlan Reports :<br />
+ <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="550" border=0>
+ <tr>
+ <td class="NormalB">
+ 1. ActivityPlan Reports :<br />
<select id="reportList" name="reportList" style="width:200px">
- #foreach($report in $reportList)
- <option value="$report.id">$report.name</option>
- #end
+ #foreach($report in $reportList)
+ <option value="$report.id">$report.name</option>
+ #end
</select>
- </td>
- <td class="NormalB">
- OrganisationUnit : <br />
- <input type="text" name="ouNameTB" id="ouNameTB" style="width:175px" disabled="disabled">
- </td>
- </tr>
- <tr>
- <td> </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>
+ </td>
+ <td class="NormalB">
+ <label for="startDate" id="lblStartDate">3. $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>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr id="periodTR">
+ <td class="NormalB">
+ 2. OrganisationUnit : <br />
+ <input type="text" name="ouNameTB" id="ouNameTB" style="width:200px" disabled="disabled">
+ </td>
+ <td class="NormalB">
+ <label for="endDate" id="lblEndDate">4. $i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label>
<br />
<input type="text" id="endDate" name="endDate" style="width:175px">
</td>
@@ -80,16 +80,16 @@
</tr>
<tr>
<td> </td>
- <td>
- <input type="submit" name="generate" value='Generate Report'/>
- <input type="hidden" name="ouIDTB" id="ouIDTB">
- <input type="hidden" name="ouLevelTB" id="ouLevelTB">
- <input type="hidden" name="reportModelTB" id="reportModelTB">
- <input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
- <input type="hidden" name="reportProgramTB" id="reportProgramTB">
- </td>
- </tr>
- </table>
+ <td>
+ <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="reportProgramTB" id="reportProgramTB">
+ </td>
+ </tr>
+ </table>
</form>
<script type="text/javascript">