dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09527
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2550: Improved OrgunitTreeGeneration Report in MetaDataReportSection
------------------------------------------------------------
revno: 2550
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-13 10:23:40 +0530
message:
Improved OrgunitTreeGeneration Report in MetaDataReportSection
modified:
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsFormAction.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/meta/action/GenerateMetaDataReportResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report.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-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsFormAction.java 2010-09-29 02:04:14 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsFormAction.java 2011-01-13 04:53:40 +0000
@@ -83,7 +83,7 @@
periodList = new ArrayList<Period>( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) );
- reportList = new ArrayList<Report>();
+ reportList = new ArrayList<Report>();
simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
@@ -116,7 +116,7 @@
String reportId = "";
String reportName = "";
String reportType = "";
- String reportLevel = "";
+ Integer reportProgramId = 0;
String reportModel = "";
String reportFileName = "";
@@ -161,12 +161,12 @@
NodeList textreportFileNameList = reportFileNameElement.getChildNodes();
reportFileName = ((Node) textreportFileNameList.item( 0 )).getNodeValue().trim();
- NodeList reportLevelList = reportElement.getElementsByTagName( "level" );
+ NodeList reportLevelList = reportElement.getElementsByTagName( "program" );
Element reportLevelElement = (Element) reportLevelList.item( 0 );
NodeList textreportLevelList = reportLevelElement.getChildNodes();
- reportLevel = ((Node) textreportLevelList.item( 0 )).getNodeValue().trim();
+ reportProgramId = Integer.parseInt( ((Node) textreportLevelList.item( 0 )).getNodeValue().trim() );
- Report reportObj = new Report( reportId, reportName, reportType, reportModel, reportFileName,reportLevel );
+ Report reportObj = new Report( reportId, reportName, reportType, reportModel, reportFileName,reportProgramId );
reportList.add( reportObj );
}
=== 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 2010-12-29 16:17:28 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2011-01-13 04:53:40 +0000
@@ -367,11 +367,11 @@
this.reportModelTB = reportModelTB;
}
- private String reportLevelTB;
+ private String reportProgramTB;
- public void setReportLevelTB( String reportLevelTB )
+ public void setReportProgramTB( String reportProgramTB )
{
- this.reportLevelTB = reportLevelTB;
+ this.reportProgramTB = reportProgramTB;
}
private String reportList;
@@ -419,11 +419,6 @@
private String raFolderName;
- // private DeCodesXML deCodeTotalList;
- // private int[] monthCount = { 0, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- private Connection con = null;
-
private String inputTemplatePath;
private String outputReportPath;
@@ -450,19 +445,13 @@
private int rowCount;
- // private String orgUnitInfo = "-1";
- // private String aggDataTableName;
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute()
throws Exception
{
-
- // con = (new DBConnection()).openConnection();
-
statementManager.initialise();
- // raFolderName = "ra_uttarakhand";
raFolderName = reportService.getRAFolderName();
@@ -470,32 +459,29 @@
mathTool = new MathTool();
services = new ArrayList<String>();
slNos = new ArrayList<String>();
- simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+ simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
deCodesXMLFileName = reportList + "DECodes.xml";
- // System.out.println("reportList = " + reportList);
deCodeType = new ArrayList<String>();
serviceType = new ArrayList<String>();
-
sheetList = new ArrayList<Integer>();
rowList = new ArrayList<Integer>();
colList = new ArrayList<Integer>();
- System.out
- .println( "startDate = " + startDate + " endDate = " + endDate + " reportname = " + reportFileNameTB );
+
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
+ c.add( Calendar.DATE, -1 );
+ 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
+ c.add( Calendar.DATE, 1 );
+ 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";
+
+ 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();
+
statementManager.destroy();
return SUCCESS;
@@ -506,9 +492,8 @@
{
Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
- WritableWorkbook outputReportWorkbook = Workbook
- .createWorkbook( new File( outputReportPath ), templateWorkbook );
- // System.out.println( "outputReportWorkbook = "+outputReportWorkbook);
+ WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+
// Cell formatting
WritableCellFormat wCellformat = new WritableCellFormat();
wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
@@ -523,22 +508,15 @@
deWCellformat.setWrap( true );
// OrgUnit Related Info
- selectedOrgUnit = new OrganisationUnit();
- // System.out.println("______________ " + reportLevelTB);
selectedOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- // Collection<PatientIdentifier> patientIdentifiers =
- // patientIdentifierService.getPatientIdentifiersByOrgUnit(
- // selectedOrgUnit );
-
- Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>();
- patientListByOrgUnit.addAll( patientService.getPatients( selectedOrgUnit ) );
+ Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>( patientService.getPatients( selectedOrgUnit ) );
// Getting Programs
+ Program curProgram = programService.getProgram( Integer.parseInt( reportProgramTB ) );
+
rowCount = 0;
List<String> deCodesList = getDECodes( deCodesXMLFileName );
- Program curProgram = programService.getProgram( Integer.parseInt( reportLevelTB ) );
- // /System.out.println( "curProgram = " + curProgram.getName() );
String tempStr = "";
int villageAttrId = 0;
@@ -547,28 +525,21 @@
{
String psDeIds = "";
WritableSheet sheet0 = outputReportWorkbook.getSheet( 0 );
- System.out.println( "curProgram = " + curProgram.getName() );
int count1 = 0;
int tempRowNo = 0;
int rowStart = 0;
- // System.out.println("deCodesList size = " + deCodesList.size());
Collection<ProgramStage> programStagesList = new ArrayList<ProgramStage>();
for ( String deCodeString : deCodesList )
{
- String sType = (String) serviceType.get( count1 );//
- // System.out.println( sType );
- if ( sType.equalsIgnoreCase( "rowStart" ) )
- {
- rowStart = Integer.parseInt( deCodeString );
- }
- else if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
+ String sType = (String) serviceType.get( count1 );
+
+ if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
{
tempStr = selectedOrgUnit.getShortName();
}
else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
{
- OrganisationUnit orgUnitP = new OrganisationUnit();
- orgUnitP = selectedOrgUnit.getParent();
+ OrganisationUnit orgUnitP = selectedOrgUnit.getParent();
if ( orgUnitP != null )
{
tempStr = orgUnitP.getName();
@@ -576,12 +547,10 @@
}
else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
{
- OrganisationUnit orgUnitP = new OrganisationUnit();
- OrganisationUnit orgUnitPP = new OrganisationUnit();
- orgUnitP = selectedOrgUnit.getParent();
+ OrganisationUnit orgUnitP = selectedOrgUnit.getParent();
if ( orgUnitP != null )
{
- orgUnitPP = orgUnitP.getParent();
+ OrganisationUnit orgUnitPP = orgUnitP.getParent();
if ( orgUnitPP != null )
{
tempStr = orgUnitPP.getName();
@@ -592,12 +561,21 @@
{
tempStr = " ";
}
+ else if( deCodeString.equalsIgnoreCase( "PERIODSDED" ) )
+ {
+ tempStr = startDate + " To " + endDate;
+ }
else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
{
// sheet0.addCell(new Label(tempColNo, tempRowNo,
// simpleDateFormat.format(startDate.getStartDate()),
// wCellformat));
}
+
+ if ( sType.equalsIgnoreCase( "rowStart" ) )
+ {
+ rowStart = Integer.parseInt( deCodeString );
+ }
else if ( sType.equalsIgnoreCase( "programStages" ) )
{
String[] stages = deCodeString.split( "," );
@@ -614,34 +592,26 @@
{
villageAttrId = Integer.parseInt( deCodeString );
}
-
- if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
- {
- // sheet0.addCell( new Label( tempColNo, tempRowNo,
- // simpleDateFormat.format( sDate.getStartDate() ),
- // wCellformat ) );
- }
- else
+ else if ( sType.equalsIgnoreCase( "reportProperty" ) )
{
if ( (deCodeString.equalsIgnoreCase( "FACILITY" ))
|| (deCodeString.equalsIgnoreCase( "FACILITYP" ))
- || (deCodeString.equalsIgnoreCase( "FACILITYPP" )) || (deCodeString.equalsIgnoreCase( "NA" )) )
+ || (deCodeString.equalsIgnoreCase( "FACILITYPP" ))
+ || (deCodeString.equalsIgnoreCase( "PERIODSDED" ))
+ || (deCodeString.equalsIgnoreCase( "NA" )) )
{
tempRowNo = rowList.get( count1 );
int tempColNo = colList.get( count1 );
int sheetNo = sheetList.get( count1 );
sheet0 = outputReportWorkbook.getSheet( sheetNo );
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
- // System.out.println("tempStr "+tempStr);
sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
}
}
count1++;
}
+
Map<ProgramStage, Set<DataElement>> programStageDEs = new HashMap<ProgramStage, Set<DataElement>>();
- // Collection<ProgramStageInstance> programStageInstances = new
- // ArrayList<ProgramStageInstance>();
if ( !psDeIds.equals( "" ) )
{
String[] Ids = psDeIds.split( "," );
@@ -652,8 +622,6 @@
// reading one program stage : its dataelements
String[] allIds = Ids[i].split( ":" );
// spliting with : so getting psid and all datalements ids
- // System.out.println( "allIds = " + Ids[i] + " size = " +
- // allIds.length );
String psid = "";
if ( allIds.length >= 1 )
{
@@ -664,17 +632,15 @@
{
String deIds = allIds[1];// according to ex 80.81.82
- String[] allDeIds = deIds.split( "\\." );// spliting des
- // with .
+ String[] allDeIds = deIds.split( "\\." );// spliting des with .
+
for ( int j = 0; j < allDeIds.length; j++ )
{
- // putting des in list
dataElements.add( dataElementService.getDataElement( Integer.parseInt( allDeIds[j] ) ) );
}
}
ProgramStage programStage = programStageService.getProgramStage( Integer.parseInt( psid ) );
programStagesList.add( programStage );
- // putting ps and des in one map
programStageDEs.put( programStage, dataElements );
}
}
@@ -722,27 +688,16 @@
completedProgramStageInstances.add( programStageInstance );
continue;
}
- // System.out.println( "DueDate = " +
- // programStageInstance.getDueDate() +
- // patient.getFullName() );
- if ( programStageInstance.getDueDate().after( sDate )
- && programStageInstance.getDueDate().before( eDate ) )
+ if ( programStageInstance.getDueDate().after( sDate ) && programStageInstance.getDueDate().before( eDate ) )
{
- // System.out.println( "DueDate = " +
- // programStageInstance.getDueDate() + " " +
- // programStageInstance.getExecutionDate() +
- // " "+programStageInstance.getId());
programStageInstances.add( programStageInstance );
}
}
}
+
if ( programInstance != null && programStageInstances.size() != 0 )
{
PIPSIList.put( programInstance, programStageInstances );
- // System.out.println( "programStageInstances size = " +
- // programStageInstances.size() + " programInstance = " +
- // programInstance.getId() + " patient = " +
- // patient.getFullName() );
// putting patient and pi together
patientPIList.put( patient, programInstance );
patientList.add( patient );
@@ -770,29 +725,17 @@
ProgramInstance programInstance = patientPIList.get( patient );
Collection<ProgramStageInstance> psiList = PIPSIList.get( programInstance );
String cAPhoneNumberName = "";
- // System.out.println(
- // "______________________________ patient = " +
- // patient.getFullName() );
- // System.out.println(
- // "__________________________________________________________"
- // );
boolean valuePresent = false;
String deCollectedNames = "";
String deNotCollectedNames = "";
int ifaCount = 0;
int rowNo = rowStart + rowCount;
- // System.out.println(
- // "______________________________________________________________"
- // +patient.getFullName() );
for ( ProgramStageInstance programStageInstance : psiList )
{
- // System.out.println( "*************************"
- // +patient.getFullName() );
count1 = 0;
for ( String deCodeString : deCodesList )
{
-
tempStr = "";
String sType = (String) serviceType.get( count1 );
if ( sType.equalsIgnoreCase( "dataelement" ) )
@@ -816,52 +759,51 @@
}
else if ( sType.equalsIgnoreCase( "caseProperty" ) )
{
- // _______________________patient
- // name_______________________
if ( deCodeString.equalsIgnoreCase( "Name" ) )
{
tempStr = patient.getFullName();
}
else if ( deCodeString.equalsIgnoreCase( "DOB" ) )
{
- // _______________________DateOfBirth_______________________
Date patientDate = patient.getBirthDate();
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "yyyy-MM-dd" );
tempStr = simpleDateFormat1.format( patientDate );
-
}
else if ( deCodeString.equalsIgnoreCase( "Sex" ) )
{
- // ______________________Sex_______________________
tempStr = patient.getGender();
}
else if ( deCodeString.equalsIgnoreCase( "Age" ) )
{
- // ______________________Sex_______________________
tempStr = patient.getAge();
}
}
else if ( sType.equalsIgnoreCase( "caseAttribute" ) )
{
- int deCodeInt = Integer.parseInt( deCodeString );
-
- PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( deCodeInt );
- PatientAttributeValue patientAttributeValue = patientAttributeValueService
- .getPatientAttributeValue( patient, patientAttribute );
- if ( patientAttributeValue != null )
- {
- tempStr = patientAttributeValue.getValue();
- }
- else
+ if( deCodeString.equalsIgnoreCase( "NA" ) )
{
tempStr = " ";
}
+ else
+ {
+ int deCodeInt = Integer.parseInt( deCodeString );
+
+ PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( deCodeInt );
+ PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+ if ( patientAttributeValue != null && patientAttributeValue.getValue() != null )
+ {
+ tempStr = patientAttributeValue.getValue();
+ }
+ else
+ {
+ tempStr = " ";
+ }
+ }
}
else if ( sType.equalsIgnoreCase( "identifiertype" ) )
{
int deCodeInt = Integer.parseInt( deCodeString );
- // _______________________Id.
- // no._______________________
+
PatientIdentifierType patientIdentifierType = patientIdentifierTypeService
.getPatientIdentifierType( deCodeInt );
if ( patientIdentifierType != null )
@@ -915,9 +857,6 @@
{
husbandName = patientAttributeValue.getValue();
cAPhoneNumberName = husbandName;
- // System.out.println(
- // " cAPhoneNumberName = " +
- // cAPhoneNumberName );
}
if ( sType.equalsIgnoreCase( "caseAttributeHusband" ) )
{
@@ -940,8 +879,6 @@
{
int tempNum = 1 + rowCount;
tempStr = String.valueOf( tempNum );
- // System.out.println( "srno = " + tempNum + " " +
- // tempStr );
}
else if ( sType.equalsIgnoreCase( "dataelementTT" )
|| sType.equalsIgnoreCase( "dataelementTest" ) )
@@ -957,9 +894,6 @@
DataElement d1e = dataElementService.getDataElement( Integer.parseInt( de ) );
Collection<ProgramStageInstance> psisList = patientCompletedPSIList
.get( patient );
- // System.out.println(
- // "psisList size = " + psisList.size()
- // );
String dename = d1e.getShortName();
if ( psisList != null && psisList.size() != 0 )
{
@@ -974,9 +908,6 @@
{
valuePresent = true;
deCollectedNames = deCollectedNames + dename;
- // //System.out.println(
- // "deCollectedNames = "
- // + deCollectedNames );
}
}
}
@@ -994,14 +925,11 @@
}
}
- // System.out.println( "tempStr = " +
- // tempStr );
}
}
else
{
- DataElement d1e = dataElementService.getDataElement( Integer
- .parseInt( deCodeString ) );
+ DataElement d1e = dataElementService.getDataElement( Integer.parseInt( deCodeString ) );
Collection<ProgramStageInstance> psisList = patientCompletedPSIList.get( patient );
String dename = d1e.getShortName();
if ( psisList.size() != 0 )
@@ -1116,9 +1044,6 @@
}// end of decodelist for loop
rowCount++;
rowNo++;
- // System.out.println(
- // "______________________________________________________________"
- // );
}
count2++;
@@ -1134,12 +1059,6 @@
sheet0.mergeCells( 5, mergeRowStart, 5, mergeRowEnd );
sheet0.mergeCells( 6, mergeRowStart, 6, mergeRowEnd );
sheet0.mergeCells( 7, mergeRowStart, 7, mergeRowEnd );
-
- // System.out.println(
- // "______________________________________________________________"
- // );
- // System.out.println( "mergeRowStart = " +
- // mergeRowStart + " merge row end = " + mergeRowEnd );
}
else
{
@@ -1149,12 +1068,7 @@
sheet0.mergeCells( 4, mergeRowStart, 4, mergeRowEnd );
sheet0.mergeCells( 5, mergeRowStart, 5, mergeRowEnd );
sheet0.mergeCells( 6, mergeRowStart, 6, mergeRowEnd );
- sheet0.mergeCells( 7, mergeRowStart, 7, mergeRowEnd );
- // System.out.println(
- // "______________________________________________________________"
- // );
- // System.out.println( "mergeRowStart = " +
- // mergeRowStart + " merge row end = " + mergeRowEnd );
+ //sheet0.mergeCells( 7, mergeRowStart, 7, mergeRowEnd );
}
}
mergeRowStart = mergeRowEnd + 1;
@@ -1169,8 +1083,6 @@
fileName = reportFileNameTB.replace( ".xls", "" );
fileName += "_" + selectedOrgUnit.getShortName() + ".xls";
- // System.out.println( "fileName = " + fileName + " outputReportPath = "
- // + outputReportPath );
File outputReportFile = new File( outputReportPath );
@@ -1199,8 +1111,7 @@
}
catch ( NullPointerException npe )
{
- // do nothing, but we might be using this somewhere without
- // USER_HOME set, which will throw a NPE
+ System.out.println(" DHIS2_HOME is not Set");
}
try
@@ -1227,9 +1138,6 @@
sheetList.add( new Integer( deCodeElement.getAttribute( "sheetno" ) ) );
rowList.add( new Integer( deCodeElement.getAttribute( "rowno" ) ) );
colList.add( new Integer( deCodeElement.getAttribute( "colno" ) ) );
-
- // System.out.println(deCodes.get( s )+" : "+deCodeType.get( s
- // ));
}// end of for loop with s var
}// try block end
@@ -1251,151 +1159,4 @@
return deCodes;
}// getDECodes end
- public Period getPreviousPeriod( Date sDate )
- {
- Period period = new Period();
- Calendar tempDate = Calendar.getInstance();
- tempDate.setTime( sDate );
- 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 = PeriodType.getByNameIgnoreCase( "monthly" );
- period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
-
- return period;
- }
-
- public Period getNextPeriod( Date sDate )
- {
- Period period = new Period();
- Calendar tempDate = Calendar.getInstance();
- tempDate.setTime( sDate );
- if ( tempDate.get( Calendar.MONTH ) == Calendar.DECEMBER )
- {
- tempDate.set( Calendar.MONTH, Calendar.JANUARY );
- tempDate.roll( Calendar.YEAR, +1 );
- }
- else
- {
- tempDate.roll( Calendar.MONTH, +1 );
- }
-
- PeriodType periodType = PeriodType.getByNameIgnoreCase( "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() );
-
- return periodService.getPeriod( firstDay, lastDay, periodType );
- }
-
- public List<Calendar> getStartingEndingPeriods( String deType, Date sDate, Date eDate )
- {
-
- List<Calendar> calendarList = new ArrayList<Calendar>();
-
- Calendar tempStartDate = Calendar.getInstance();
- Calendar tempEndDate = Calendar.getInstance();
-
- Period previousPeriod = new Period();
- previousPeriod = getPreviousPeriod( sDate );
-
- 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( "ccmcy" ) )
- {
- tempStartDate.setTime( sDate );
- if ( tempStartDate.get( Calendar.MONTH ) < Calendar.APRIL )
- {
- tempStartDate.roll( Calendar.YEAR, -1 );
- }
-
- tempStartDate.set( Calendar.MONTH, Calendar.APRIL );
- tempEndDate.setTime( eDate );
- // System.out.println("We are in PT if block");
- }
- else
- {
- if ( deType.equalsIgnoreCase( "ccmpy" ) )
- {
- tempStartDate.setTime( sDate );
- tempEndDate.setTime( eDate );
-
- tempStartDate.roll( Calendar.YEAR, -1 );
- tempEndDate.roll( Calendar.YEAR, -1 );
- }
- else
- {
- if ( deType.equalsIgnoreCase( "cmpy" ) )
- {
- tempStartDate.setTime( sDate );
- tempEndDate.setTime( eDate );
-
- tempStartDate.roll( Calendar.YEAR, -1 );
- tempEndDate.roll( Calendar.YEAR, -1 );
- }
- else
- {
- tempStartDate.setTime( sDate );
- tempEndDate.setTime( eDate );
- }
-
- }
- }
- }
-
- calendarList.add( tempStartDate );
- calendarList.add( tempEndDate );
-
- return calendarList;
- }
}
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java 2011-01-08 05:58:26 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java 2011-01-13 04:53:40 +0000
@@ -39,18 +39,17 @@
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;
import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserStore;
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
import org.hisp.dhis.validation.ValidationRuleService;
import org.hisp.dhis.validation.comparator.ValidationRuleNameComparator;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
import com.opensymphony.xwork2.Action;
@@ -158,6 +157,13 @@
this.reportService = reportService;
}
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -201,7 +207,7 @@
raFolderName = reportService.getRAFolderName();
- System.out.println( "Report Generation Start Time is : \t" + new Date() );
+ System.out.println( "MetaDataReport Generation Start Time is : " + new Date() );
if ( metaDataId.equalsIgnoreCase( ORGUNIT ) )
{
@@ -254,7 +260,7 @@
statementManager.destroy();
- System.out.println( "Report Generation End Time is : \t" + new Date() );
+ System.out.println( "MetaDataReport Generation End Time is : " + new Date() );
return SUCCESS;
}
@@ -410,7 +416,7 @@
}
// -------------------------------------------------------------------------
- // Methods for getting DataElement wise List in Excel Sheet
+ // Method for getting DataElementwise List in Excel Sheet
// -------------------------------------------------------------------------
public void generateDataElementList()
@@ -439,14 +445,12 @@
{
sheet0.addCell( new Label( colStart, rowStart, "DataElementID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "DataElementID", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 1, rowStart, "DataElementName", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 2, rowStart, "DataElementAlternativeName", getCellFormat1() ) );
- sheet0
- .addCell( new Label( colStart + 3, rowStart, "DataElementAggregationOperator", getCellFormat1() ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, "DataElementAggregationOperator", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 4, rowStart, "DataElementDescription", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 5, rowStart, "DataElementCode", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 6, rowStart, "DataElementShortName", getCellFormat1() ) );
@@ -466,9 +470,7 @@
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataElement.getId(), wCellformat ) );
-
}
- // for printing all attributes data in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataElement.getId(), wCellformat ) );
@@ -491,7 +493,6 @@
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "DataElementList.xls";
@@ -499,11 +500,10 @@
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
- // Methods for getting DataElement Group wise List in Excel Sheet
+ // Method for getting DataElement Groupwise List in Excel Sheet
// -------------------------------------------------------------------------
public void generateDataElementGroupList()
@@ -529,14 +529,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart,
- // "DataElementGroupID", getCellFormat1() ) );
-
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "DataElementID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "DataElementID", getCellFormat1() ) );
@@ -563,17 +559,11 @@
if ( incID.equalsIgnoreCase( SOURCE ) || incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataElementGroup.getId(), getCellFormat1() ) );
-
}
- // sheet0.addCell( new Number( colStart,
- // rowStart,dataElementGroup.getId(), getCellFormat1() ) );
-
}
sheet0.addCell( new Label( colStart + 1, rowStart, dataElementGroup.getName(), getCellFormat1() ) );
- // for merge cell (colStart,rowStart,colEnd,rowEnd) for Printing All
- // Attributes 29/06/2010
if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.mergeCells( colStart + 1, rowStart, colStart + 8, rowStart );
@@ -589,17 +579,10 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart,
- // rowStart,dataElement.getId(), wCellformat ) );
- // 29/06/2020
-
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataElement.getId(), wCellformat ) );
}
-
- // for printing all attributes data in Excel Sheet
- // 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataElement.getId(), wCellformat ) );
@@ -613,7 +596,6 @@
sheet0.addCell( new Label( colStart + 6, rowStart, dataElement.getShortName(), wCellformat ) );
sheet0.addCell( new Label( colStart + 7, rowStart, dataElement.getType(), wCellformat ) );
sheet0.addCell( new Label( colStart + 8, rowStart, dataElement.getUrl(), wCellformat ) );
-
}
}
@@ -624,7 +606,6 @@
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "DataElementGroupWiseList.xls";
@@ -632,11 +613,10 @@
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
- // Methods for getting Organisation Unit Group wise List in Excel Sheet //
+ // Methods for getting Organisation Unit Groupwise List in Excel Sheet
// -------------------------------------------------------------------------
public void generateOrgUnitGroupList()
@@ -661,13 +641,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart,
- // "OrganisationUnitGroupID", getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "OrganisationUnitID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 30/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "OrganisationUnitID", getCellFormat1() ) );
@@ -679,7 +656,6 @@
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() ) );
-
}
}
@@ -691,27 +667,20 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // organisationUnitGroup.getId(), getCellFormat1() ) );
- // 30/06/2010
if ( incID.equalsIgnoreCase( SOURCE ) || incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, organisationUnitGroup.getId(), getCellFormat1() ) );
-
}
}
sheet0.addCell( new Label( colStart + 1, rowStart, organisationUnitGroup.getName(), getCellFormat1() ) );
- // for merge cell (colStart,rowStart,colEnd,rowEnd) for Printing All
- // Attributes 30/06/2010
if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.mergeCells( colStart + 1, rowStart, colStart + 8, rowStart );
}
rowStart++;
- // colStart++;
List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitGroup
.getMembers() );
@@ -719,47 +688,35 @@
Collections.sort( organisationUnitList, new OrganisationUnitNameComparator() );
for ( OrganisationUnit organisationUnit : organisationUnitList )
-
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // organisationUnit.getId(), wCellformat ) );
- // 30/06/2020
-
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, organisationUnit.getId(), wCellformat ) );
sheet0.addCell( new Label( colStart + 1, rowStart, organisationUnit.getName(), wCellformat ) );
}
-
- // for printing all attributes data in Excel Sheet
- // 30/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, organisationUnit.getId(), wCellformat ) );
sheet0.addCell( new Label( colStart + 1, rowStart, organisationUnit.getName(), wCellformat ) );
- sheet0
- .addCell( new Label( colStart + 2, rowStart, organisationUnit.getShortName(), wCellformat ) );
- // Null check for opening date
+ sheet0.addCell( new Label( colStart + 2, rowStart, organisationUnit.getShortName(), wCellformat ) );
+
String opendate = new String();
if ( organisationUnit.getOpeningDate() != null )
{
opendate = organisationUnit.getOpeningDate().toString();
-
}
else
{
opendate = "";
}
-
sheet0.addCell( new Label( colStart + 3, rowStart, opendate, wCellformat ) );
- // Null check for opening date
+
String closedate = new String();
if ( organisationUnit.getClosedDate() != null )
{
closedate = organisationUnit.getClosedDate().toString();
-
}
else
{
@@ -767,12 +724,10 @@
}
sheet0.addCell( new Label( colStart + 4, rowStart, closedate, wCellformat ) );
- // Null check for Parent Name
String PARENT = new String();
if ( organisationUnit.getParent() != null )
{
PARENT = organisationUnit.getParent().getName();
-
}
else
{
@@ -782,53 +737,29 @@
sheet0.addCell( new Label( colStart + 5, rowStart, PARENT, wCellformat ) );
sheet0.addCell( new Label( colStart + 6, rowStart, organisationUnit.getCode(), wCellformat ) );
sheet0.addCell( new Label( colStart + 7, rowStart, organisationUnit.getUrl(), wCellformat ) );
- // Null check for last updation
+
String lastUpdate = new String();
if ( organisationUnit.getLastUpdated() != null )
{
lastUpdate = organisationUnit.getLastUpdated().toString();
-
}
else
{
lastUpdate = "";
}
sheet0.addCell( new Label( colStart + 8, rowStart, lastUpdate, wCellformat ) );
-
}
else
{
sheet0.addCell( new Label( colStart + 1, rowStart, organisationUnit.getName(), wCellformat ) );
-
}
-
}
rowStart++;
}
-
- /*
- * // Iterator<OrganisationUnit> orgUnitIterator =
- * (Iterator<OrganisationUnit>) orgUnitGroupList.listIterator();
- * Iterator<OrganisationUnit> orgUnitIterator =
- * organisationUnitGroup. while ( orgUnitIterator.hasNext() ) {
- * OrganisationUnit ou = orgUnitIterator.next() ;
- *
- * if( incID != null ) { sheet0.addCell( new Number( colStart,
- * rowStart, ou.getId() , getCellFormat2() ) ); }
- *
- * // int ouLevel =
- * organisationUnitService.getLevelOfOrganisationUnit( ou.getId());
- *
- * sheet0.addCell( new Label( colStart+1, rowStart, ou.getName(),
- * wCellformat ) );
- *
- * rowStart++; }
- */
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "OrganisationUnitGroupWiseList.xls";
@@ -836,7 +767,6 @@
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
@@ -847,14 +777,10 @@
throws Exception
{
OrganisationUnit rootOrgUnit = organisationUnitService.getRootOrganisationUnits().iterator().next();
- // OrganisationUnit rootOrgUnit =
- // organisationUnitService.getOrganisationUnit( 551 );
-
- List<OrganisationUnit> OrganisitionUnitList = new ArrayList<OrganisationUnit>(
- getChildOrgUnitTree( rootOrgUnit ) );
-
- String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
- + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+
+ 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";
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "OrganisationUnit", 0 );
@@ -882,7 +808,6 @@
rowStart++;
- int ouListSize = OrganisitionUnitList.size();
Iterator<OrganisationUnit> orgUnitIterator = OrganisitionUnitList.iterator();
while ( orgUnitIterator.hasNext() )
{
@@ -890,34 +815,42 @@
sheet0.addCell( new Number( colStart, rowStart, ou.getId(), getCellFormat2() ) );
- int ouLevel = organisationUnitService.getLevelOfOrganisationUnit( ou.getId() );
+ int ouLevel = ou.getLevel();
sheet0.addCell( new Label( colStart + ouLevel, rowStart, ou.getName(), getCellFormat2() ) );
- Collection<User> users = userStore.getUsersByOrganisationUnit( ou );
-
+ //String query = "SELECT userid,username FROM users WHERE userid IN ( SELECT userinfoid FROM usermembership WHERE organisationunitid = "+ ou.getId() +")";
+ String query = "SELECT users.userid,users.username FROM users INNER JOIN usermembership ON users.userid = usermembership.userinfoid WHERE usermembership.organisationunitid = "+ ou.getId();
String userName = "";
String userId = "";
- for ( User user : users )
+
+ try
{
- UserCredentials userCredentials = userStore.getUserCredentials( user );
- if ( userCredentials != null )
+ SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+
+ if ( sqlResultSet != null )
{
- userId += user.getId() + ", ";
- userName += userCredentials.getUsername() + ", ";
+ sqlResultSet.beforeFirst();
+
+ while ( sqlResultSet.next() )
+ {
+ userId += sqlResultSet.getInt( 1 ) + ", ";
+ userName += sqlResultSet.getString( 2 ) + ", ";
+ }
}
-
- }
-
+ }
+ catch( Exception e )
+ {
+ System.out.println("Exception with jdbcTemplate: "+ e.getMessage() );
+ }
+
sheet0.addCell( new Label( colStart + maxLevels + 1, rowStart, userId, getCellFormat2() ) );
sheet0.addCell( new Label( colStart + maxLevels + 2, rowStart, userName, getCellFormat2() ) );
- System.out.println( "Count: " + rowStart + "out of " + ouListSize );
rowStart++;
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "OrgUnit_UserList.xls";
@@ -925,7 +858,6 @@
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
@@ -936,15 +868,10 @@
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>( organisationUnitService.getOrganisationUnitWithChildren( rootOrgUnit.getId() ) );
- String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
- + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
WritableSheet sheet0 = outputReportWorkbook.createSheet( "OrganisationUnit", 0 );
@@ -994,59 +921,43 @@
rowStart++;
Iterator<OrganisationUnit> orgUnitIterator = OrganisitionUnitList.iterator();
- while ( orgUnitIterator.hasNext() )
+ while( orgUnitIterator.hasNext() )
{
OrganisationUnit ou = orgUnitIterator.next();
if ( incID != null )
{
-
- // for printing all attributes data in Excel Sheet 30/06/2010
if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, ou.getId(), wCellformat ) );
sheet0.addCell( new Label( colStart + 1, rowStart, ou.getName(), wCellformat ) );
sheet0.addCell( new Label( colStart + 2, rowStart, ou.getShortName(), wCellformat ) );
- // sheet0.addCell( new Label(colStart + 5, rowStart,
- // organisationUnit.getClosedDate().toString(),
- // wCellformat ) );
String opendate = new String();
if ( ou.getOpeningDate() != null )
{
opendate = ou.getOpeningDate().toString();
-
}
else
{
opendate = "";
}
-
sheet0.addCell( new Label( colStart + 3, rowStart, opendate, wCellformat ) );
String closedate = new String();
if ( ou.getClosedDate() != null )
{
closedate = ou.getClosedDate().toString();
-
}
else
{
closedate = "";
}
-
sheet0.addCell( new Label( colStart + 4, rowStart, closedate, wCellformat ) );
- // sheet0.addCell( new Label( colStart + 5, rowStart,
- // ou.getType(), wCellformat ) );
- // sheet0.addCell( new Label(colStart + 7, rowStart,
- // organisationUnit.getParent().getName(), wCellformat )
- // );
-
String PARENT = new String();
if ( ou.getParent() != null )
{
PARENT = ou.getParent().getName();
-
}
else
{
@@ -1061,50 +972,30 @@
if ( ou.getLastUpdated() != null )
{
lastUpdate = ou.getLastUpdated().toString();
-
}
else
{
lastUpdate = "";
}
sheet0.addCell( new Label( colStart + 8, rowStart, lastUpdate, wCellformat ) );
-
}
-
else if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, ou.getId(), getCellFormat2() ) );
- int ouLevel = organisationUnitService.getLevelOfOrganisationUnit( ou.getId() );
+ int ouLevel = ou.getLevel();
sheet0.addCell( new Label( colStart + ouLevel, rowStart, ou.getName(), getCellFormat2() ) );
- // System.out.println("ID is : " + ou.getId() +
- // "and name is : " + ou.getName());
}
-
else
{
- int ouLevel = organisationUnitService.getLevelOfOrganisationUnit( ou.getId() );
-
+ int ouLevel = ou.getLevel();
sheet0.addCell( new Label( colStart + ouLevel, rowStart, ou.getName(), getCellFormat2() ) );
- // System.out.println("Level is : " + ouLevel);
- // System.out.println("in not ID only Name is :" +
- // ou.getName() );
}
}
- // int ouLevel = organisationUnitService.getLevelOfOrganisationUnit(
- // ou.getId() );
-
- // sheet0.addCell( new Label( colStart + ouLevel, rowStart,
- // ou.getName(), getCellFormat2() ) );
-
- // sheet0.addCell( new Label( colStart + 1, rowStart,
- // ou.getName(),getCellFormat2() ) );
-
rowStart++;
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "OrgUnitList.xls";
@@ -1112,11 +1003,10 @@
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
- // Methods for getting Indicator List in Excel Sheet
+ // Method for getting Indicator List in Excel Sheet
// -------------------------------------------------------------------------
public void generateIndicatorList()
@@ -1142,13 +1032,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart, "IndicatorID",
- // getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "IndicatorID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "IndicatorID", getCellFormat1() ) );
@@ -1167,7 +1054,6 @@
sheet0.addCell( new Label( colStart + 10, rowStart, "IndicatorDescription", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 11, rowStart, "IndicatorShortName", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 12, rowStart, "IndicatorUrl", getCellFormat1() ) );
-
}
}
@@ -1181,13 +1067,10 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // indicator.getId(), wCellformat ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, indicator.getId(), wCellformat ) );
}
- // for printing all attributes data in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, indicator.getId(), wCellformat ) );
@@ -1209,33 +1092,19 @@
sheet0.addCell( new Label( colStart + 10, rowStart, indicator.getDescription(), wCellformat ) );
sheet0.addCell( new Label( colStart + 11, rowStart, indicator.getShortName(), wCellformat ) );
sheet0.addCell( new Label( colStart + 12, rowStart, indicator.getUrl(), wCellformat ) );
-
}
}
sheet0.addCell( new Label( colStart + 1, rowStart, indicator.getName(), wCellformat ) );
-
- // expressionService.getExpressionDescription(indicator.getDenominator
- // () );
- // expressionService.getExpressionDescription(
- // indicator.getNumerator() );
sheet0.addCell( new Label( colStart + 3, rowStart, expressionService.getExpressionDescription( indicator
.getNumerator() ), wCellformat ) );
sheet0.addCell( new Label( colStart + 2, rowStart, expressionService.getExpressionDescription( indicator
.getDenominator() ), wCellformat ) );
- // sheet0.addCell( new Label( colStart + 2, rowStart,
- // indicator.getNumeratorDescription(), wCellformat ) );
- // sheet0.addCell( new Label( colStart + 3, rowStart,
- // indicator.getDenominatorDescription(), wCellformat ) );
- // for merge cell (colStart,rowStart,colEnd,rowEnd) for Printing All
- // Attributes 29/06/2010
-
rowStart++;
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "IndicatorList.xls";
@@ -1246,7 +1115,7 @@
}
// -------------------------------------------------------------------------
- // Methods for getting Indicator Group wise List in Excel Sheet
+ // Method for getting Indicator Group wise List in Excel Sheet
// -------------------------------------------------------------------------
public void generateIndicatorGroupList()
@@ -1272,13 +1141,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart,
- // "IndicatorGroupID", getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "IndicatorID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "IndicatorID", getCellFormat1() ) );
@@ -1297,7 +1163,6 @@
sheet0.addCell( new Label( colStart + 10, rowStart, "IndicatorDescription", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 11, rowStart, "IndicatorShortName", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 12, rowStart, "IndicatorUrl", getCellFormat1() ) );
-
}
}
@@ -1310,22 +1175,15 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // indicatorGroup.getId(), getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) || incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, indicatorGroup.getId(), getCellFormat1() ) );
-
}
}
sheet0.addCell( new Label( colStart + 1, rowStart, indicatorGroup.getName(), getCellFormat1() ) );
-
- // for merge cell (colStart,rowStart,colEnd,rowEnd)
sheet0.mergeCells( colStart + 1, rowStart, colStart + 3, rowStart );
- // for merge cell (colStart,rowStart,colEnd,rowEnd) for Printing All
- // Attributes 29/06/2010
if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.mergeCells( colStart + 1, rowStart, colStart + 12, rowStart );
@@ -1335,23 +1193,14 @@
List<Indicator> indicatorList = new ArrayList<Indicator>( indicatorGroup.getMembers() );
Collections.sort( indicatorList, new IndicatorNameComparator() );
-
for ( Indicator indicator : indicatorList )
{
-
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // indicator.getId(), wCellformat ) );
- // 29/06/2020
-
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, indicator.getId(), wCellformat ) );
}
-
- // for printing all attributes data in Excel Sheet
- // 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, indicator.getId(), wCellformat ) );
@@ -1374,14 +1223,10 @@
sheet0.addCell( new Label( colStart + 10, rowStart, indicator.getDescription(), wCellformat ) );
sheet0.addCell( new Label( colStart + 11, rowStart, indicator.getShortName(), wCellformat ) );
sheet0.addCell( new Label( colStart + 12, rowStart, indicator.getUrl(), wCellformat ) );
-
}
}
+
sheet0.addCell( new Label( colStart + 1, rowStart, indicator.getName(), wCellformat ) );
- // sheet0.addCell( new Label( colStart + 2, rowStart,
- // indicator.getNumeratorDescription(), wCellformat ) );
- // sheet0.addCell( new Label( colStart + 3, rowStart,
- // indicator.getDenominatorDescription(), wCellformat ) );
sheet0.addCell( new Label( colStart + 3, rowStart, expressionService
.getExpressionDescription( indicator.getNumerator() ), wCellformat ) );
sheet0.addCell( new Label( colStart + 2, rowStart, expressionService
@@ -1390,15 +1235,14 @@
rowStart++;
}
}
+
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "IndicatorGroupWiseList.xls";
File outputReportFile = new File( outputReportPath );
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
@@ -1428,13 +1272,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart, "DataSetID",
- // getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "DataSetID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "DataSetID", getCellFormat1() ) );
@@ -1443,7 +1284,6 @@
sheet0.addCell( new Label( colStart + 3, rowStart, "DataSetCode", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 4, rowStart, "DataSetAlternativeName", getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 5, rowStart, "DataSetPeriodType", getCellFormat1() ) );
-
}
}
@@ -1455,18 +1295,10 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // dataSet.getId(), wCellformat ) );
-
- // 29/06/2020
-
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataSet.getId(), wCellformat ) );
}
-
- // for printing all attributes data in Excel Sheet
- // 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, dataSet.getId(), wCellformat ) );
@@ -1476,7 +1308,6 @@
sheet0.addCell( new Label( colStart + 4, rowStart, dataSet.getAlternativeName(), wCellformat ) );
sheet0
.addCell( new Label( colStart + 5, rowStart, dataSet.getPeriodType().getName(), wCellformat ) );
-
}
}
@@ -1486,7 +1317,6 @@
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "DataSetList.xls";
@@ -1524,13 +1354,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart,
- // "ValidationRuleID", getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "ValidationRuleID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "ValidationRuleID", getCellFormat1() ) );
@@ -1544,7 +1371,6 @@
getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 7, rowStart, "ValidationRuleRightSideDescription",
getCellFormat1() ) );
-
}
}
@@ -1556,15 +1382,10 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // validationRule.getId(), wCellformat ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, validationRule.getId(), wCellformat ) );
}
-
- // for printing all attributes data in Excel Sheet
- // 29/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, validationRule.getId(), wCellformat ) );
@@ -1578,7 +1399,6 @@
wCellformat ) );
sheet0.addCell( new Label( colStart + 7, rowStart, validationRule.getRightSide().getDescription(),
wCellformat ) );
-
}
}
@@ -1588,7 +1408,6 @@
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "ValidationRuleList.xls";
@@ -1596,7 +1415,6 @@
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
outputReportFile.deleteOnExit();
-
}
// -------------------------------------------------------------------------
@@ -1605,7 +1423,6 @@
public void generateValidationGroupList()
throws Exception
-
{
List<ValidationRuleGroup> validationRuleGroupList = new ArrayList<ValidationRuleGroup>( validationRuleService
.getAllValidationRuleGroups() );
@@ -1627,13 +1444,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart,
- // "ValidationRuleGroupID", getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "ValidationRuleID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 30/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "ValidationRuleID", getCellFormat1() ) );
@@ -1647,7 +1461,6 @@
getCellFormat1() ) );
sheet0.addCell( new Label( colStart + 7, rowStart, "ValidationRuleRightSideDescription",
getCellFormat1() ) );
-
}
}
@@ -1659,20 +1472,14 @@
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // validationRuleGroup.getId(), getCellFormat1() ) );
- // 30/06/2020
if ( incID.equalsIgnoreCase( SOURCE ) || incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, validationRuleGroup.getId(), getCellFormat1() ) );
-
}
}
sheet0.addCell( new Label( colStart + 1, rowStart, validationRuleGroup.getName(), getCellFormat1() ) );
- // for merge cell (colStart,rowStart,colEnd,rowEnd) for Printing All
- // Attributes 30/06/2010
if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.mergeCells( colStart + 1, rowStart, colStart + 7, rowStart );
@@ -1681,22 +1488,15 @@
rowStart++;
List<ValidationRule> validationRuleList = new ArrayList<ValidationRule>( validationRuleGroup.getMembers() );
-
Collections.sort( validationRuleList, new ValidationRuleNameComparator() );
-
for ( ValidationRule validationRule : validationRuleList )
{
if ( incID != null )
{
- // sheet0.addCell( new Number( colStart, rowStart,
- // validationRule.getId(), wCellformat ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Number( colStart, rowStart, validationRule.getId(), wCellformat ) );
}
-
- // for printing all attributes data in Excel Sheet
- // 30/06/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Number( colStart, rowStart, validationRule.getId(), wCellformat ) );
@@ -1711,7 +1511,6 @@
.getDescription(), wCellformat ) );
sheet0.addCell( new Label( colStart + 7, rowStart, validationRule.getRightSide()
.getDescription(), wCellformat ) );
-
}
}
@@ -1722,7 +1521,6 @@
}
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "ValidationRuleGroupWiseList.xls";
@@ -1734,7 +1532,7 @@
}// end generateValidationGroupList function
// -------------------------------------------------------------------------
- // Methods for getting User List in Excel Sheet
+ // Method for getting User List in Excel Sheet
// -------------------------------------------------------------------------
public void generateUserList()
@@ -1742,8 +1540,6 @@
{
List<User> userList = new ArrayList<User>( userStore.getAllUsers() );
- List<UserAuthorityGroup> userRoles = new ArrayList<UserAuthorityGroup>( userStore.getAllUserAuthorityGroups() );
-
String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ "output" + File.separator + UUID.randomUUID().toString() + ".xls";
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
@@ -1761,13 +1557,10 @@
if ( incID != null )
{
- // sheet0.addCell( new Label( colStart, rowStart, "userID",
- // getCellFormat1() ) );
if ( incID.equalsIgnoreCase( SOURCE ) )
{
sheet0.addCell( new Label( colStart, rowStart, "UserID", getCellFormat1() ) );
}
- // for printing all attributes heading in Excel Sheet 01/07/2010
else if ( incID.equalsIgnoreCase( PRINT ) )
{
sheet0.addCell( new Label( colStart, rowStart, "userID", getCellFormat1() ) );
@@ -1787,62 +1580,84 @@
for ( User user : userList )
{
- UserCredentials userCredentials = userStore.getUserCredentials( userStore.getUser( user.getId() ) );
-
- if ( userCredentials != null )
- {
- if ( incID != null )
- {
-
- if ( incID.equalsIgnoreCase( SOURCE ) )
+ String query = "SELECT username FROM users WHERE userid = "+ user.getId();
+ String userName = "";
+
+ try
+ {
+ SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+
+ if ( sqlResultSet != null )
+ {
+ sqlResultSet.beforeFirst();
+ sqlResultSet.next();
+ userName = sqlResultSet.getString( 1 );
+ }
+ }
+ catch( Exception e )
+ {
+ System.out.println("Exception with jdbcTemplate: "+ e.getMessage() );
+ }
+
+ if ( incID != null )
+ {
+ if ( incID.equalsIgnoreCase( SOURCE ) )
+ {
+ sheet0.addCell( new Number( colStart, rowStart, user.getId(), wCellformat ) );
+ }
+ else if ( incID.equalsIgnoreCase( PRINT ) )
+ {
+ sheet0.addCell( new Number( colStart, rowStart, user.getId(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 1, rowStart, userName, wCellformat ) );
+ sheet0.addCell( new Label( colStart + 2, rowStart, user.getFirstName(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 3, rowStart, user.getSurname(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 4, rowStart, user.getEmail(), wCellformat ) );
+ sheet0.addCell( new Label( colStart + 5, rowStart, user.getPhoneNumber(), wCellformat ) );
+
+ List<OrganisationUnit> userOrganisationUnitlist = new ArrayList<OrganisationUnit>( user
+ .getOrganisationUnits() );
+
+ String ouNames = "";
+ for ( OrganisationUnit organisationUnit : userOrganisationUnitlist )
{
- sheet0.addCell( new Number( colStart, rowStart, user.getId(), wCellformat ) );
+ ouNames += organisationUnit.getName() + " , ";
}
- else if ( incID.equalsIgnoreCase( PRINT ) )
+
+ sheet0.addCell( new Label( colStart + 6, rowStart, ouNames, wCellformat ) );
+
+ String userRoleName = "";
+
+ String query1 = "select userrole.name from userrole inner join userrolemembers on userrole.userroleid=userrolemembers.userroleid where userrolemembers.userid = "+ user.getId();
+
+ try
{
-
- sheet0.addCell( new Number( colStart, rowStart, user.getId(), wCellformat ) );
- sheet0
- .addCell( new Label( colStart + 1, rowStart, userCredentials.getUsername(), wCellformat ) );
- sheet0.addCell( new Label( colStart + 2, rowStart, user.getFirstName(), wCellformat ) );
- sheet0.addCell( new Label( colStart + 3, rowStart, user.getSurname(), wCellformat ) );
- sheet0.addCell( new Label( colStart + 4, rowStart, user.getEmail(), wCellformat ) );
- sheet0.addCell( new Label( colStart + 5, rowStart, user.getPhoneNumber(), wCellformat ) );
-
- List<OrganisationUnit> userOrganisationUnitlist = new ArrayList<OrganisationUnit>( user
- .getOrganisationUnits() );
-
- String ouNames = "";
- for ( OrganisationUnit organisationUnit : userOrganisationUnitlist )
- {
- ouNames += organisationUnit.getName() + " , ";
- }
-
- sheet0.addCell( new Label( colStart + 6, rowStart, ouNames, wCellformat ) );
-
- String userRoleName = "";
-
- for ( UserAuthorityGroup userRole : userRoles )
- {
-
- if ( userRole.getMembers() != null || userRole.getMembers().size() != 0 )
+ SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query1 );
+
+ if ( sqlResultSet != null )
+ {
+ sqlResultSet.beforeFirst();
+
+ while ( sqlResultSet.next() )
{
- if ( userRole.getMembers().contains( userCredentials ) )
- userRoleName += userRole.getName() + ", ";
+ userRoleName += sqlResultSet.getString( 1 ) + ", ";
}
}
- sheet0.addCell( new Label( colStart + 7, rowStart, userRoleName, wCellformat ) );
- }
+ }
+ catch( Exception e )
+ {
+ System.out.println("Exception with jdbcTemplate: "+ e.getMessage() );
+ }
+
+ sheet0.addCell( new Label( colStart + 7, rowStart, userRoleName, wCellformat ) );
}
-
- sheet0.addCell( new Label( colStart + 1, rowStart, userCredentials.getUsername(), wCellformat ) );
}
+ sheet0.addCell( new Label( colStart + 1, rowStart, userName, wCellformat ) );
+
rowStart++;
}// for loop end
outputReportWorkbook.write();
-
outputReportWorkbook.close();
fileName = "UserList.xls";
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report.java 2010-09-29 02:04:14 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/Report.java 2011-01-13 04:53:40 +0000
@@ -41,6 +41,11 @@
*/
private String level;
+ /**
+ * program is the NBITS Program id
+ */
+ private Integer program;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -59,6 +64,16 @@
this.fileName = fileName;
this.level = level;
}
+
+ public Report( String id, String name, String type, String model, String fileName, Integer program )
+ {
+ this.id = id;
+ this.name = name;
+ this.type = type;
+ this.model = model;
+ this.fileName = fileName;
+ this.program = program;
+ }
public Report( String id, String name, String type, String model, String fileName, String set, String level )
{
@@ -145,4 +160,14 @@
return level;
}
+ public Integer getProgram()
+ {
+ return program;
+ }
+
+ public void setProgram( Integer program )
+ {
+ this.program = program;
+ }
+
}
=== 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-01-11 12:10:34 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2011-01-13 04:53:40 +0000
@@ -475,6 +475,7 @@
<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
<property name="reportService" ref="org.hisp.dhis.reports.ReportService"/>
+ <property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
<!-- Advanced Reports -->
=== 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-01-10 07:58:36 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/activePlanReportsForm.vm 2011-01-13 04:53:40 +0000
@@ -5,14 +5,14 @@
var reportModels = new HashTable();
var reportFileNames = new HashTable();
- var reportLevels = 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");
- reportLevels.put(reportId,"$report.level");
+ reportPrograms.put(reportId,"$report.program");
#end
function formValidations()
@@ -29,7 +29,7 @@
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);
+ document.reportForm.reportProgramTB.value = reportPrograms.get(document.reportForm.reportList.options[reportListIndex].value);
return true;
}
@@ -86,7 +86,7 @@
<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">
+ <input type="hidden" name="reportProgramTB" id="reportProgramTB">
</td>
</tr>
</table>