dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09321
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2438: Adding export to excel option in Annual and Survey Analysis in Dashboard
------------------------------------------------------------
revno: 2438
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-12-29 13:17:36 +0530
message:
Adding export to excel option in Annual and Survey Analysis in Dashboard
added:
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java
modified:
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportIndicatorToExcelAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetIndicatorsAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartIndicatorAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateChartSurveyAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateSurveyAnalysisFormAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/SurveyChartResult.java
local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-dashboard/src/main/resources/struts.xml
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm
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/gadataelement.js
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForSA.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/surveyAnalysisResult.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-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java 2010-12-29 07:47:36 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -97,11 +98,25 @@
{
this.aggregationService = aggregationService;
}
+
+ private ExpressionService expressionService;
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
+
/* Parameters */
private OrganisationUnit selectedOrgUnit;
private DataElement selectedDataElement;
+
private Indicator selectedIndicator;
+
+ public Indicator getSelectedIndicator()
+ {
+ return selectedIndicator;
+ }
private PeriodType monthlyPeriodType;
private String[] series1;
@@ -169,21 +184,21 @@
return data2;
}
- //17/12/2010 for num data
+ /*
List<List<Double>> numDataList;
public List<List<Double>> getNumDataList()
{
return numDataList;
}
- //17/12/2010 for denum data
+
List<List<Double>> denumDataList;
public List<List<Double>> getDenumDataList()
{
return denumDataList;
}
-
+*/
Double numServiceValues[][];
public Double[][] getNumServiceValues()
@@ -198,13 +213,12 @@
return denumServiceValues;
}
-
-
List<List<Double>> dataList;
public List<List<Double>> getDataList() {
return dataList;
}
+
List<String> xseriesList;
public List<String> getXseriesList() {
@@ -227,13 +241,16 @@
private List<String> annualPeriodsListCB;
private List<String> monthlyPeriodsListCB;
private int ouIDTB;
+
private String riRadio;
- public String getRiRadio() {
+ public String getRiRadio()
+ {
return riRadio;
}
- public void setRiRadio(String riRadio) {
+ public void setRiRadio(String riRadio)
+ {
this.riRadio = riRadio;
}
@@ -264,11 +281,32 @@
return listTool;
}
- public String execute()
- throws Exception {
+ private String numDataElement;
+
+ public String getNumDataElement()
+ {
+ return numDataElement;
+ }
+
+ private String denumDataElement;
+
+ public String getDenumDataElement()
+ {
+ return denumDataElement;
+ }
+
+ private Integer selectedIndicatorId;
+
+ public Integer getSelectedIndicatorId()
+ {
+ return selectedIndicatorId;
+ }
+
+ public String execute() throws Exception
+ {
dataList = new ArrayList<List<Double>>();
- numDataList = new ArrayList<List<Double>>();
- denumDataList = new ArrayList<List<Double>>();
+ //numDataList = new ArrayList<List<Double>>();
+ //denumDataList = new ArrayList<List<Double>>();
xseriesList = new ArrayList<String>();
yseriesList = new ArrayList<String>();
@@ -280,20 +318,35 @@
selectedOrgUnit = new OrganisationUnit();
selectedOrgUnit = organisationUnitService.getOrganisationUnit(ouIDTB);
chartTitle = "Facility : " + selectedOrgUnit.getShortName();
-
+
+ numDataElement = new String();
+ denumDataElement = new String();
+ //selectedIndicator = new Indicator();
+ //selectedIndicator = indicatorService.getIndicator( availableIndicators );
+ //selectedIndicatorId = selectedIndicator.getId();
+
// Service Related Info
- if (riRadio.equals("indicatorsRadio")) {
+ if ( riRadio.equals("indicatorsRadio"))
+ {
selectedIndicator = new Indicator();
- selectedIndicator = indicatorService.getIndicator(availableIndicators);
+ selectedIndicator = indicatorService.getIndicator( availableIndicators );
chartTitle += "\n Indicator : " + selectedIndicator.getName();
+ selectedIndicatorId = selectedIndicator.getId();
+ // for numeratorDataElement,denominatorDataElement
+ numDataElement = expressionService.getExpressionDescription( selectedIndicator.getNumerator());
+ denumDataElement = expressionService.getExpressionDescription( selectedIndicator.getDenominator());
- } else {
+ }
+ else
+ {
selectedDataElement = new DataElement();
selectedDataElement = dataElementService.getDataElement(availableDataElements);
- if (selectedDataElement.getAlternativeName() != null) {
+ if (selectedDataElement.getAlternativeName() != null)
+ {
chartTitle += "\n DataElement : " + selectedDataElement.getAlternativeName();
- } else {
+ }
+ else {
chartTitle += "\n DataElement : " + selectedDataElement.getName();
}
}
@@ -306,7 +359,8 @@
yAxis_Title = "Facilty";
int count1 = 0;
- while (count1 != categories1.length) {
+ while (count1 != categories1.length)
+ {
xseriesList.add(categories1[count1]);
count1++;
}
@@ -316,8 +370,8 @@
HttpSession session = req.getSession();
session.setAttribute("data1", data1);
- session.setAttribute("numDataList", numDataList);
- session.setAttribute("denumDataList", denumDataList);
+ session.setAttribute("numServiceValues", numServiceValues);
+ session.setAttribute("denumServiceValues", denumServiceValues);
session.setAttribute("data2", data2);
session.setAttribute("series1", series1);
@@ -338,7 +392,8 @@
* orgunit and selected service
*/
@SuppressWarnings("unchecked")
- public Double[][] getServiceValuesByPeriod() {
+ public Double[][] getServiceValuesByPeriod()
+ {
// DecimalFormat decFormat = new DecimalFormat("0.0");
Double[][] serviceValues = new Double[annualPeriodsListCB.size()][monthlyPeriodsListCB.size()];
@@ -359,10 +414,11 @@
categories1 = new String[monthlyPeriodsListCB.size()];
categories2 = new String[monthlyPeriodsListCB.size()];
Iterator iterator1 = annualPeriodsListCB.iterator();
- while (iterator1.hasNext()) {
+ while (iterator1.hasNext())
+ {
List<Double> dataValues = new ArrayList<Double>();
- List<Double> numDataValue = new ArrayList<Double>();
- List<Double> denumDataValue = new ArrayList<Double>();
+ //List<Double> numDataValue = new ArrayList<Double>();
+ //List<Double> denumDataValue = new ArrayList<Double>();
int tempYear = Integer.parseInt((String) iterator1.next());
//series1[count1] = "" + tempYear + "-" + (tempYear + 1);
@@ -373,11 +429,12 @@
Iterator iterator2 = monthlyPeriodsListCB.iterator();
count2 = 0;
- while (iterator2.hasNext())
+ while ( iterator2.hasNext() )
{
int tempMonth = Integer.parseInt((String) iterator2.next());
p = dashBoardService.getPeriodByMonth(tempMonth, tempYear, monthlyPeriodType);
- if (p == null) {
+ if (p == null)
+ {
serviceValues[count1][count2] = 0.0;
numServiceValues[count1][count2] = 0.0;
denumServiceValues[count1][count2] = 0.0;
@@ -419,7 +476,8 @@
aggDataValue = aggregationService.getAggregatedDataValue(selectedDataElement, decoc, p.getStartDate(), p.getEndDate(), selectedOrgUnit);
//System.out.println("selectedDataElement = "+selectedDataElement + " "+ p.getStartDate()+ " "+ p.getEndDate());
- if (aggDataValue == null) {
+ if (aggDataValue == null)
+ {
aggDataValue = 0.0;
}
serviceValues[count1][count2] += aggDataValue;
@@ -456,35 +514,42 @@
data2[count1][count2] = 0.0;
dataValues.add(serviceValues[count1][count2]);
- numDataValue.add( numServiceValues[count1][count2] );
- denumDataValue.add( denumServiceValues[count1][count2] );
+ // numDataValue.add( numServiceValues[count1][count2] );
+ //denumDataValue.add( denumServiceValues[count1][count2] );
count2++;
}// Monthly PeriodList loop end
dataList.add(dataValues);
- numDataList.add( numDataValue );
- denumDataList.add( denumDataValue );
+ // numDataList.add( numDataValue );
+ // denumDataList.add( denumDataValue );
count1++;
} // Annual PeriodList loop end
return serviceValues;
}// getServiceValues method end
- public Period getPeriodByMonth(int month, int year, PeriodType periodType) {
+ 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());
+ cal.set( year, month, 1, 0, 0, 0 );
+ Date firstDay = new Date( cal.getTimeInMillis() );
- if (periodType.getName().equalsIgnoreCase("Monthly")) {
+ if (periodType.getName().equalsIgnoreCase("Monthly"))
+ {
cal.set(year, month, 1, 0, 0, 0);
- if (year % 4 == 0 && month == 1) {
+ if (year % 4 == 0 && month == 1)
+ {
cal.set(Calendar.DAY_OF_MONTH, monthDays[month] + 1);
- } else {
+ }
+ else
+ {
cal.set(Calendar.DAY_OF_MONTH, monthDays[month]);
}
- } else if (periodType.getName().equalsIgnoreCase("Yearly")) {
+ }
+ else if (periodType.getName().equalsIgnoreCase("Yearly"))
+ {
cal.set(year, Calendar.DECEMBER, 31);
}
@@ -501,18 +566,22 @@
* we pass name as Monthly then it returns the PeriodType Object for Monthly
* PeriodType If there is no such PeriodType returns null
*/
- public PeriodType getPeriodTypeObject(String periodTypeName) {
+ public PeriodType getPeriodTypeObject( String periodTypeName )
+ {
Collection<PeriodType> periodTypes = periodService.getAllPeriodTypes();
PeriodType periodType = null;
Iterator<PeriodType> iter = periodTypes.iterator();
- while (iter.hasNext()) {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if (tempPeriodType.getName().trim().equalsIgnoreCase(periodTypeName)) {
+ while ( iter.hasNext() )
+ {
+ PeriodType tempPeriodType = ( PeriodType ) iter.next();
+ if ( tempPeriodType.getName().trim().equalsIgnoreCase( periodTypeName ) )
+ {
periodType = tempPeriodType;
break;
}
}
- if (periodType == null) {
+ if ( periodType == null )
+ {
return null;
}
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java 2010-12-29 07:47:36 +0000
@@ -0,0 +1,725 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dataanalyser.action;
+
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import jxl.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
+import jxl.format.VerticalAlignment;
+import jxl.write.Label;
+import jxl.write.Number;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableFont;
+import jxl.write.WritableImage;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.config.ConfigurationService;
+import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+
+import com.keypoint.PngEncoder;
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version ExportAnnualDataToExcelAction.java Dec 24, 2010 5:10:42 PM
+ */
+public class ExportAnnualDataToExcelAction implements Action
+{
+
+ private ConfigurationService configurationService;
+
+ public void setConfigurationService( ConfigurationService configurationService )
+ {
+ this.configurationService = configurationService;
+ }
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & output
+ // -------------------------------------------------------------------------
+
+ double[][] data1;
+
+ double[][] numDataArray;
+
+ double[][] denumDataArray;
+
+ String[] series1;
+
+ // String[] denumDataArray;
+
+ String[] categories1;
+
+ // String[] categories2;
+
+
+ private InputStream inputStream;
+
+ public InputStream getInputStream()
+ {
+ return inputStream;
+ }
+
+ /*
+ private String contentType;
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+ */
+
+ private String fileName;
+
+ public String getFileName()
+ {
+ return fileName;
+ }
+
+ /*
+ private int bufferSize;
+
+ public int getBufferSize()
+ {
+ return bufferSize;
+ }
+ */
+
+ private String viewSummary;
+
+ public void setViewSummary( String viewSummary )
+ {
+ this.viewSummary = viewSummary;
+ }
+
+ private String chartDisplayOption;
+
+ public void setChartDisplayOption( String chartDisplayOption )
+ {
+ this.chartDisplayOption = chartDisplayOption;
+ }
+
+ private String radioButtonValue;
+
+ public void setRadioButtonValue( String radioButtonValue )
+ {
+ this.radioButtonValue = radioButtonValue;
+ }
+
+ private Integer selctedIndicatorId;
+
+ public void setSelctedIndicatorId( Integer selctedIndicatorId )
+ {
+ this.selctedIndicatorId = selctedIndicatorId;
+ }
+
+ //private Indicator selectedIndicator;
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ int tempCol1 = 0;
+ int tempRow1 = 1;
+ // int tempCol2 = 0;
+
+ if( radioButtonValue.equals( "indicator" ) )
+ {
+ System.out.println( "indicator" );
+ }
+ else
+ {
+ System.out.println( "dataelement" );
+ }
+ // System.out.println("Complete path is :" + radioButtonValue.equals( "indicator" ) );
+
+ ActionContext ctx = ActionContext.getContext();
+ HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+ HttpSession session = req.getSession();
+ BufferedImage chartImage = (BufferedImage) session.getAttribute("chartImage");
+ PngEncoder encoder = new PngEncoder(chartImage, false, 0, 9);
+
+ byte[] encoderBytes = encoder.pngEncode();
+ Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
+
+ Double[][] objnumData1 = (Double[][]) session.getAttribute( "numServiceValues" );
+ Double[][] objdenumData1 = (Double[][]) session.getAttribute( "denumServiceValues" );
+ //Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
+
+ String[] series1S = (String[]) session.getAttribute( "series1" );
+ //String[] series2S = (String[]) session.getAttribute( "series2" );
+ String[] categories1S = (String[]) session.getAttribute( "categories1" );
+ // String[] categories2S = (String[]) session.getAttribute( "categories2" );
+
+
+ // initialzeAllLists(series1S, series2S, categories1S, categories2S);
+ initialzeAllLists(series1S, categories1S );
+
+ //if(objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null )
+ if( objData1 == null || series1 == null || categories1 == null || objnumData1 == null || objdenumData1 == null )
+ System.out.println("Session Objects are null");
+ else
+ System.out.println("Session Objects are not null");
+
+ data1 = convertDoubleTodouble( objData1 );
+
+ numDataArray = convertDoubleTodouble( objnumData1 );
+ denumDataArray = convertDoubleTodouble( objdenumData1 );
+
+ //System.out.println(" Selected Indicator Id is : " + selctedIndicatorId + " ,selected Indicator :" + selectedIndicator );
+
+ //selectedIndicator = new Indicator();
+ //selectedIndicator = indicatorService.getIndicator( selctedIndicatorId );
+ //String IndicatorName = selectedIndicator.getName();
+
+ // System.out.println(" Selected Indicator Id is : " + selctedIndicatorId + " ,selected Indicator :" + selectedIndicator );
+
+ // data2 = convertDoubleTodouble( objData2 );
+
+ if(chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
+ //else if(chartDisplayOption.equalsIgnoreCase("ascend")) { sortByAscending(); }
+ // else if(chartDisplayOption.equalsIgnoreCase("desend")) { sortByDesscending(); }
+ // else if(chartDisplayOption.equalsIgnoreCase("alphabet")) { sortByAlphabet(); }
+
+ //File outputReportFile = locationManager.getFileForWriting( UUID.randomUUID().toString() + ".xls", "db", "output" );
+
+
+ // String outputReportFile = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+ // + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+ String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+ + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+
+ // System.out.println("Env Variable is :" + System.getenv( "DHIS2_HOME" ) );
+ // System.out.println("Complete path is :" + outputReportFile );
+
+ WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File(outputReportFile) );
+ WritableSheet sheet0 = outputReportWorkbook.createSheet( "ChartOutput", 0 );
+
+ if( viewSummary.equals( "no" ))
+ {
+ WritableImage writableImage = new WritableImage(0,1,10,23,encoderBytes);
+ sheet0.addImage( writableImage );
+ tempRow1 = 24;
+ }
+ else
+ {
+ // tempRow1 -= objData1.length;
+ tempRow1 = 0;
+ }
+ tempCol1 = 0;
+ //tempCol2 = 0;
+ tempRow1++;
+
+
+ WritableCellFormat wCellformat1 = new WritableCellFormat();
+ wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat1.setAlignment( Alignment.CENTRE );
+ wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat1.setWrap( true );
+
+ WritableCellFormat wCellformat2 = new WritableCellFormat();
+ wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat2.setAlignment( Alignment.CENTRE );
+ wCellformat2.setVerticalAlignment( VerticalAlignment.TOP);
+ wCellformat2.setBackground( Colour.GRAY_25 );
+ wCellformat2.setWrap( true );
+
+ /*
+ WritableCellFormat wCellformat3 = new WritableCellFormat();
+ wCellformat3.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat3.setAlignment( Alignment.CENTRE );
+ wCellformat3.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat3.setBackground( Colour.BLACK );
+ wCellformat3.setWrap( true );
+ // wCellformat3.setFont( WritableFont.BOLD );
+ //wCellformat3.WritableFont();
+ */
+
+ WritableFont wfobj2 = new WritableFont( WritableFont.ARIAL, 10, WritableFont.BOLD );
+ WritableCellFormat wcf = new WritableCellFormat( wfobj2 );
+ wcf.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wcf.setAlignment( Alignment.CENTRE );
+ //wcf.setShrinkToFit(true);
+ wcf.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wcf.setWrap( true );
+
+ if( radioButtonValue.equals( "indicator" ) )
+ {
+ System.out.println( "in excel indicator" );
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Years", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
+
+ tempCol1++;
+
+ //for time display
+ for(int i=0; i< categories1.length; i++)
+ {
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+ tempCol1++;
+ }
+
+ tempRow1 = tempRow1+1;
+
+ int tempRowValue = 0;
+ for( int j=0; j< series1.length; j++ )
+ {
+ tempCol1 = 0;
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+ int tempNumCol = 1;
+
+ sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2) );
+ tempNumCol = tempNumCol+1;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ // tempCol1 = 0;
+ sheet0.addCell( new Number( tempNumCol, tempRow1, numDataArray[j][k], wCellformat1 ) );
+ tempNumCol++;
+ }
+ int tempDenumCol = 1;
+
+ sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den", wCellformat2) );
+
+ tempDenumCol = tempDenumCol+1;
+
+ for( int k=0;k<categories1.length;k++ )
+ {
+ // tempRow1 = 0;
+ sheet0.addCell( new Number( tempDenumCol, tempRow1+1, denumDataArray[j][k], wCellformat1 ) );
+ tempDenumCol++;
+ }
+ int tempValueCol = 1;
+
+ sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val", wCellformat2) );
+ tempValueCol = tempValueCol+1;
+
+ for( int k=0;k<categories1.length;k++ )
+ {
+ //tempRow1 = 0;
+ sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k], wcf ) );
+ tempValueCol++;
+ }
+
+ tempRow1 = tempRow1+3;
+ tempRow1++;
+ tempRowValue = tempRow1++;
+ }
+
+ tempRow1 = tempRowValue;
+
+ tempRow1 = tempRow1+2;
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators Names", wCellformat2) );
+
+ sheet0.mergeCells( tempCol1+1 , tempRow1, tempCol1 + 2, tempRow1 );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "Formula", wCellformat2) );
+
+ sheet0.addCell( new Label( tempCol1+3, tempRow1, "Numerator DataElements", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+4, tempRow1, "Denominator DataElements", wCellformat2) );
+
+ tempRow1 = tempRow1+1;
+
+ // for(int j=0; j< series1.length; j++)
+ // {
+ Indicator indicator = indicatorService.getIndicator( selctedIndicatorId );
+
+ //Indicator indicator = indicatorService.getIndicatorByName( IndicatorName );
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, indicator.getName(), wCellformat1 ) );
+ String formula = indicator.getNumeratorDescription() + "/" + indicator.getDenominatorDescription();
+
+ sheet0.addCell( new Label( tempCol1+1, tempRow1,formula , wCellformat1 ) );
+ String factor = "X" + indicator.getIndicatorType().getFactor();
+
+ sheet0.addCell( new Label( tempCol1+2, tempRow1, factor, wCellformat1) );
+ sheet0.addCell( new Label( tempCol1+3, tempRow1, expressionService.getExpressionDescription( indicator.getNumerator()), wCellformat1 ) );
+ sheet0.addCell( new Label( tempCol1+4, tempRow1, expressionService.getExpressionDescription( indicator.getDenominator() ), wCellformat1 ) );
+
+ tempRow1++;
+ //}
+ }
+
+ else
+ {
+ System.out.println( "in DataElements Excel sheet" );
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Years", wCellformat2) );
+ //tempCol1++;
+
+ //for time display
+ for(int i=0; i< categories1.length; i++)
+ {
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+ tempCol1++;
+ }
+
+ tempRow1 = tempRow1+1;
+
+ for(int j=0; j< series1.length; j++)
+ {
+ tempCol1 = 0;
+ //sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+ tempCol1++;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
+ tempCol1++;
+ }
+
+ tempRow1++;
+ }
+
+ }
+
+ /*
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
+
+ // System.out.println(tempCol1);
+ tempCol1++;
+
+ //System.out.println(tempCol1);
+ for(int i=0; i< categories1.length; i++)
+ {
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+ tempCol1++;
+ }
+
+ tempRow1 = tempRow1+1;
+ for(int j=0; j< series1.length; j++)
+ {
+ tempCol1 = 0;
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+ int tempNumCol = 1;
+
+ sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2) );
+ tempNumCol = tempNumCol+1;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ // tempCol1 = 0;
+ sheet0.addCell( new Number( tempNumCol, tempRow1, numDataArray[j][k], wCellformat1 ) );
+ tempNumCol++;
+ }
+ int tempDenumCol = 1;
+
+ sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den", wCellformat2) );
+
+ tempDenumCol = tempDenumCol+1;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ // tempRow1 = 0;
+ sheet0.addCell( new Number( tempDenumCol, tempRow1+1, denumDataArray[j][k], wCellformat1 ) );
+ tempDenumCol++;
+ }
+ int tempValueCol = 1;
+
+
+ sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val", wCellformat2) );
+ tempValueCol = tempValueCol+1;
+
+ for( int k=0;k<categories1.length;k++ )
+ {
+ //tempRow1 = 0;
+ sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k], wcf ) );
+ tempValueCol++;
+ }
+
+ tempRow1 = tempRow1+3;
+ tempRow1++;
+
+ }
+
+ */
+
+ /*
+
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+1 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
+ tempCol1++;
+ tempCol2++;
+ // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
+ for(int i=0; i< categories1.length; i++)
+ {
+ //cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ // cellFormat1 = cell1.getCellFormat();
+
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 2, tempRow1 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i], wCellformat2) );
+
+ // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
+ sheet0.addCell( new Label( tempCol1, tempRow1+1, "Num", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1+1, "Den", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+2, tempRow1+1, "Val", wCellformat2) );
+
+ tempCol1 = tempCol1+3;
+ //tempCol2++;
+ }
+ tempRow1 = tempRow1+2;
+ // tempCol1 = 1;
+
+ tempCol1 = 0;
+ for(int j=0; j< series1.length; j++)
+ {
+ tempCol1 = 0;
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+
+ tempCol1++;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ //sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+ sheet0.addCell( new Number( tempCol1, tempRow1, numDataArray[j][k], wCellformat1 ) );
+ sheet0.addCell( new Number( tempCol1+1, tempRow1, denumDataArray[j][k], wCellformat1 ) );
+ sheet0.addCell( new Number( tempCol1+2, tempRow1, data1[j][k], wCellformat1 ) );
+
+ tempCol1 = tempCol1+3;
+ }
+
+ tempRow1++;
+ }
+
+ */
+// 23/12/2010
+
+ // tempCol1++;
+
+ //cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ //cellFormat1 = cell1.getCellFormat();
+
+ // sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
+ //sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k], wCellformat1) );
+
+ // tempCol1++;
+
+
+
+
+
+/*
+ int count1 = 0;
+ int count2 = 0;
+ int flag1 = 0;
+ while(count1 <= categories1.length)
+ {
+ for(int j=0;j<data1.length;j++)
+ {
+ tempCol1 = 1;
+ tempRow1++;
+ WritableCellFormat wCellformat1 = new WritableCellFormat();
+ wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat1.setWrap( true );
+
+ WritableCellFormat wCellformat2 = new WritableCellFormat();
+ wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat2.setAlignment( Alignment.CENTRE );
+ wCellformat2.setBackground( Colour.GRAY_25 );
+ wCellformat2.setWrap( true );
+
+
+ WritableCell cell1;
+ CellFormat cellFormat1;
+
+ for(int k=count2;k<count1;k++)
+ {
+ if(k==count2 && j==0)
+ {
+ tempCol1 = 0;
+ tempRow1++;
+ cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ cellFormat1 = cell1.getCellFormat();
+
+
+ if (cell1.getType() == CellType.LABEL)
+ {
+ Label l = (Label) cell1;
+ l.setString("Service");
+ l.setCellFormat( cellFormat1 );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
+ }
+ tempCol1++;
+
+ for(int i=count2; i< count1; i++)
+ {
+ cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ cellFormat1 = cell1.getCellFormat();
+ if (cell1.getType() == CellType.LABEL)
+ {
+ Label l = (Label) cell1;
+ l.setString(categories1[i]);
+ l.setCellFormat( cellFormat1 );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i], wCellformat2) );
+ }
+ tempCol1++;
+ }
+ tempRow1++;
+ tempCol1 = 1;
+ }
+
+
+ if(k==count2)
+ {
+ tempCol1 = 0;
+ cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ cellFormat1 = cell1.getCellFormat();
+
+ if (cell1.getType() == CellType.LABEL)
+ {
+ Label l = (Label) cell1;
+ l.setString(series1[j]);
+ l.setCellFormat( cellFormat1 );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+ }
+ tempCol1++;
+ }
+ cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+ cellFormat1 = cell1.getCellFormat();
+
+ if (cell1.getType() == CellType.LABEL)
+ {
+ Label l = (Label) cell1;
+ l.setString(""+data1[j][k]);
+ l.setCellFormat( cellFormat1 );
+ }
+ else
+ {
+ sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
+ //sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k], wCellformat1) );
+ }
+ tempCol1++;
+ }
+ }
+ if(flag1 == 1) break;
+ count2 = count1;
+ if( (count1+10 > categories1.length) && (categories1.length - count1 <= 10))
+ {
+ count1 += categories1.length - count1;
+ flag1 = 1;
+ }
+ else
+ count1 += 10;
+ }
+*/
+ outputReportWorkbook.write();
+ outputReportWorkbook.close();
+
+ fileName = "Chart Output.xls";
+
+ inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+
+ return SUCCESS;
+ }
+
+
+// public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
+ public void initialzeAllLists(String[]series1S, String[] categories1S)
+ {
+ int i;
+ series1 = new String[series1S.length];
+ // series2 = new String[series2S.length];
+ categories1 = new String[categories1S.length];
+ // categories2 = new String[categories2S.length];
+
+ for(i = 0; i < series1S.length; i++)
+ {
+ series1[i] = series1S[i];
+ }
+
+ for(i = 0; i < categories1S.length; i++)
+ {
+ categories1[i] = categories1S[i];
+ }
+
+ }
+
+ public double[][] convertDoubleTodouble( Double[][] objData )
+ {
+ //System.out.println("Before Sorting : ");
+ double[][] data = new double[objData.length][objData[0].length];
+ for ( int i = 0; i < objData.length; i++ )
+ {
+ for ( int j = 0; j < objData[0].length; j++ )
+ {
+ data[i][j] = objData[i][j].doubleValue();
+ //System.out.print(categories1[j]+": "+data[i][j]+", ");
+ }
+ //System.out.println("");
+ }
+
+ return data;
+ }// convertDoubleTodouble end
+
+
+}// class end
+
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportIndicatorToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportIndicatorToExcelAction.java 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportIndicatorToExcelAction.java 2010-12-29 07:47:36 +0000
@@ -45,6 +45,7 @@
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
+import jxl.write.WritableFont;
import jxl.write.WritableImage;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
@@ -52,6 +53,9 @@
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.config.ConfigurationService;
import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
import com.keypoint.PngEncoder;
import com.opensymphony.xwork2.Action;
@@ -64,6 +68,10 @@
*/
public class ExportIndicatorToExcelAction implements Action
{
+ //private static final FontRecord FontRecord = null;
+
+ // private static final FontRecord Font = null;
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -82,6 +90,20 @@
this.configurationService = configurationService;
}
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
// -------------------------------------------------------------------------
// Input & output
// -------------------------------------------------------------------------
@@ -156,7 +178,7 @@
{
int tempCol1 = 0;
int tempRow1 = 1;
- int tempCol2 = 0;
+ // int tempCol2 = 0;
ActionContext ctx = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
@@ -224,7 +246,7 @@
tempRow1 = 0;
}
tempCol1 = 0;
- tempCol2 = 0;
+ //tempCol2 = 0;
tempRow1++;
WritableCellFormat wCellformat1 = new WritableCellFormat();
wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
@@ -235,10 +257,128 @@
WritableCellFormat wCellformat2 = new WritableCellFormat();
wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
wCellformat2.setAlignment( Alignment.CENTRE );
- wCellformat2.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat2.setVerticalAlignment( VerticalAlignment.TOP);
wCellformat2.setBackground( Colour.GRAY_25 );
wCellformat2.setWrap( true );
+ /*
+ WritableCellFormat wCellformat3 = new WritableCellFormat();
+ wCellformat3.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat3.setAlignment( Alignment.CENTRE );
+ wCellformat3.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat3.setBackground( Colour.BLACK );
+ wCellformat3.setWrap( true );
+ // wCellformat3.setFont( WritableFont.BOLD );
+ //wCellformat3.WritableFont();
+ */
+
+ WritableFont wfobj2 = new WritableFont( WritableFont.ARIAL, 10, WritableFont.BOLD );
+ WritableCellFormat wcf = new WritableCellFormat( wfobj2 );
+ wcf.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wcf.setAlignment( Alignment.CENTRE );
+ //wcf.setShrinkToFit(true);
+ wcf.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wcf.setWrap( true );
+
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
+
+ // System.out.println(tempCol1);
+ tempCol1++;
+
+ //System.out.println(tempCol1);
+ for(int i=0; i< categories1.length; i++)
+ {
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+ tempCol1++;
+ }
+
+ tempRow1 = tempRow1+1;
+ int tempRowValue = 0;
+ for(int j=0; j< series1.length; j++)
+ {
+ //int temp =0;
+ tempCol1 = 0;
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+ int tempNumCol = 1;
+
+ sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2) );
+ tempNumCol = tempNumCol+1;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ // tempCol1 = 0;
+ sheet0.addCell( new Number( tempNumCol, tempRow1, numDataArray[j][k], wCellformat1 ) );
+ tempNumCol++;
+ }
+ int tempDenumCol = 1;
+
+ sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den", wCellformat2) );
+
+ tempDenumCol = tempDenumCol+1;
+ for( int k=0;k<categories1.length;k++ )
+ {
+ // tempRow1 = 0;
+ sheet0.addCell( new Number( tempDenumCol, tempRow1+1, denumDataArray[j][k], wCellformat1 ) );
+ tempDenumCol++;
+ }
+ int tempValueCol = 1;
+
+
+ sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val", wCellformat2) );
+ tempValueCol = tempValueCol+1;
+
+ for( int k=0;k<categories1.length;k++ )
+ {
+ //tempRow1 = 0;
+ sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k], wcf ) );
+ tempValueCol++;
+ }
+
+ tempRow1 = tempRow1+3;
+ tempRow1++;
+ tempRowValue = tempRow1++;
+ //temp = tempRowValue;
+ // System.out.println( "Row Count inside loop : " + tempRowValue );
+
+ }
+ tempRow1 = tempRowValue;
+
+ //tempRow1 = temp;
+ //System.out.println( "Row Count outSide Loop : " + tempRow1 );
+ tempRow1 = tempRow1+2;
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators Names", wCellformat2) );
+
+ sheet0.mergeCells( tempCol1+1 , tempRow1, tempCol1 + 2, tempRow1 );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "Formula", wCellformat2) );
+
+ sheet0.addCell( new Label( tempCol1+3, tempRow1, "Numerator DataElements", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+4, tempRow1, "Denominator DataElements", wCellformat2) );
+
+ tempRow1 = tempRow1+1;
+
+ for(int j=0; j< series1.length; j++)
+ {
+ Indicator indicator = indicatorService.getIndicatorByName( series1[j] );
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, indicator.getName(), wCellformat1 ) );
+ String formula = indicator.getNumeratorDescription() + "/" + indicator.getDenominatorDescription();
+
+ sheet0.addCell( new Label( tempCol1+1, tempRow1,formula , wCellformat1 ) );
+ String factor = "X" + indicator.getIndicatorType().getFactor();
+
+ sheet0.addCell( new Label( tempCol1+2, tempRow1, factor, wCellformat1) );
+ sheet0.addCell( new Label( tempCol1+3, tempRow1, expressionService.getExpressionDescription( indicator.getNumerator()), wCellformat1 ) );
+ sheet0.addCell( new Label( tempCol1+4, tempRow1, expressionService.getExpressionDescription( indicator.getDenominator() ), wCellformat1 ) );
+
+ tempRow1++;
+ }
+
+
+ /*
+
sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+1 );
sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
tempCol1++;
@@ -283,7 +423,10 @@
tempRow1++;
}
-
+
+ */
+// 23/12/2010
+
// tempCol1++;
//cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java 2010-12-29 07:47:36 +0000
@@ -31,23 +31,23 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import jxl.CellType;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
-import jxl.format.CellFormat;
import jxl.format.Colour;
+import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.Number;
-import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;
+import jxl.write.WritableFont;
import jxl.write.WritableImage;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
@@ -55,7 +55,15 @@
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.config.ConfigurationService;
import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.survey.Survey;
+import org.hisp.dhis.survey.SurveyService;
+import org.hisp.dhis.surveydatavalue.SurveyDataValue;
+import org.hisp.dhis.surveydatavalue.SurveyDataValueService;
import com.keypoint.PngEncoder;
import com.opensymphony.xwork2.Action;
@@ -86,12 +94,50 @@
this.configurationService = configurationService;
}
+ private SurveyService surveyService;
+
+ public void setSurveyService( SurveyService surveyService )
+ {
+ this.surveyService = surveyService;
+ }
+
+ private SurveyDataValueService surveyDataValueService;
+
+ public void setSurveyDataValueService( SurveyDataValueService surveyDataValueService )
+ {
+ this.surveyDataValueService = surveyDataValueService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
// -------------------------------------------------------------------------
// Input & output
// -------------------------------------------------------------------------
double[][] data1;
+ double[][] numDataArray;
+
+ double[][] denumDataArray;
+
double[][] data2;
String[] series1;
@@ -151,6 +197,26 @@
this.chartDisplayOption = chartDisplayOption;
}
+ private Integer selectedOrgUnitId;
+
+ public void setSelectedOrgUnitId( Integer selectedOrgUnitId )
+ {
+ this.selectedOrgUnitId = selectedOrgUnitId;
+ }
+
+ private Integer selctedIndicatorId;
+
+ public void setSelctedIndicatorId( Integer selctedIndicatorId )
+ {
+ this.selctedIndicatorId = selctedIndicatorId;
+ }
+
+
+ private OrganisationUnit selectedOrgUnit;
+
+ private Indicator selectedIndicator;
+
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -161,7 +227,7 @@
int tempCol1 = 0;
int tempRow1 = 1;
- System.out.println( "Export to Excel" );
+ System.out.println( "Export Survey Data to Excel" );
ActionContext ctx = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
@@ -172,6 +238,9 @@
byte[] encoderBytes = encoder.pngEncode();
Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
+ Double[][] objnumData1 = (Double[][]) session.getAttribute( "numDataArray" );
+ Double[][] objdenumData1 = (Double[][]) session.getAttribute( "denumDataArray" );
+
String[] series1S = (String[]) session.getAttribute( "series1" );
String[] series2S = (String[]) session.getAttribute( "series2" );
@@ -181,18 +250,35 @@
//List<Survey> surveyList = (List<Survey>)session.getAttribute( "surveyList" );
System.out.println( "Survey List size is " + series2S.length );
- initialzeAllLists(series1S, series2S, categories1S, categories2S);
+ initialzeAllLists( series1S, series2S, categories1S, categories2S );
// initialzeAllLists(series1S, series2S, categories1S, categories2S, surveyList );
- if(objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null || surveyList == null )
- System.out.println("Session Objects are null");
+ //System.out.println( objData1 + " : " + objData2 + " : " + series1 + " : " + series2 + " : " + categories1 + " : " + categories2 + " : " + objnumData1 + " : " + objdenumData1 );
+ if( objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null || objnumData1 == null || objdenumData1 == null )
+ System.out.println("Session Objects are null");
else
- System.out.println("Session Objects are not null");
-
- data1 = convertDoubleTodouble( objData1 );
- data2 = convertDoubleTodouble( objData2 );
-
- if(chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
+ System.out.println("Session Objects are not null");
+
+ data1 = convertDoubleTodouble( objData1 );//Indicator value
+ numDataArray = convertDoubleTodouble( objnumData1 );//Num data
+ denumDataArray = convertDoubleTodouble( objdenumData1 );//Denum data
+
+ data2 = convertDoubleTodouble( objData2 );//survey value
+ /*
+ System.out.println( data1.length );
+ System.out.println( numDataArray.length );
+ System.out.println( denumDataArray.length );
+ System.out.println( data2.length );
+ */
+
+ selectedOrgUnit = new OrganisationUnit();
+ selectedOrgUnit = organisationUnitService.getOrganisationUnit( selectedOrgUnitId );
+
+ selectedIndicator = new Indicator();
+ selectedIndicator = indicatorService.getIndicator( selctedIndicatorId );
+
+
+ if( chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
// else if(chartDisplayOption.equalsIgnoreCase("ascend")) { sortByAscending(); }
// else if(chartDisplayOption.equalsIgnoreCase("desend")) { sortByDesscending(); }
// else if(chartDisplayOption.equalsIgnoreCase("alphabet")) { sortByAlphabet(); }
@@ -209,7 +295,7 @@
// System.out.println("Complete path is :" + outputReportFile );
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File(outputReportFile) );
- WritableSheet sheet0 = outputReportWorkbook.createSheet( "ChartOutput", 0 );
+ WritableSheet sheet0 = outputReportWorkbook.createSheet( "SurveyChartOutput", 0 );
if(viewSummary.equals( "no" ))
{
@@ -219,10 +305,188 @@
}
else
{
- tempRow1 -= objData1.length;
+ //tempRow1 -= objData1.length;
+ tempRow1 = 0;
}
-
-
+
+ tempCol1 = 0;
+ //tempCol2 = 0;
+ tempRow1++;
+ WritableCellFormat wCellformat1 = new WritableCellFormat();
+ wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat1.setAlignment( Alignment.CENTRE );
+ wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat1.setWrap( true );
+
+ WritableCellFormat wCellformat2 = new WritableCellFormat();
+ wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat2.setAlignment( Alignment.CENTRE );
+ wCellformat2.setVerticalAlignment( VerticalAlignment.TOP);
+ wCellformat2.setBackground( Colour.GRAY_25 );
+ wCellformat2.setWrap( true );
+
+ WritableFont wfobj2 = new WritableFont( WritableFont.ARIAL, 10, WritableFont.BOLD );
+ WritableCellFormat wcf = new WritableCellFormat( wfobj2 );
+ wcf.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wcf.setAlignment( Alignment.CENTRE );
+ //wcf.setShrinkToFit(true);
+ wcf.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wcf.setWrap( true );
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicator", wCellformat2) );
+
+ // sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
+
+ // System.out.println(tempCol1);
+ // tempCol1++;
+
+ //System.out.println(tempCol1);
+ //for survey value Display
+ for(int i=0; i< series2.length; i++)
+ {
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, series2[i], wCellformat2) );
+ tempCol1++;
+ }
+
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
+
+ tempCol1++;
+ //for time display
+ for(int i=0; i< categories1.length; i++)
+ {
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+ tempCol1++;
+ }
+
+ tempRow1 = tempRow1+1;
+
+ int tempRowValue = 0;
+
+ for(int j=0; j< series1.length; j++)
+ {
+ tempCol1 = 0;
+ sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 );
+ sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
+
+ int tempSurveyValueCol = 1;
+ int temColValue = 0;
+
+ //sheet0.addCell( new Label( tempSurveyValueCol, tempRow1, "Num", wCellformat2) );
+ //tempSurveyValueCol = tempSurveyValueCol+1;
+ //String indicator = selectedIndicator.getName();
+ //indicator = series1[j];
+
+ for( int k=0; k< series2.length; k++ )
+ {
+ tempCol1 = 0;
+ surveyList = new ArrayList<Survey>( surveyService.getSurveysByIndicator( selectedIndicator ) );
+ Survey survey = surveyList.get( k );
+
+ Double tempSurveyDataValue = 0.0;
+ SurveyDataValue surveyDataValue = surveyDataValueService.getSurveyDataValue( selectedOrgUnit, survey, selectedIndicator );
+
+ // surveyDataValueService.
+ //String surveyDataValue = surveyDataValueService.getSurveyDataValue( selectedOrgUnit, survey,selectedIndicator );
+
+ //tempSurveyDataValue = Double.parseDouble( surveyDataValue.getValue() );
+
+ if ( surveyDataValue != null )
+ {
+ tempSurveyDataValue = Double.parseDouble( surveyDataValue.getValue() );
+ }
+ else
+ {
+ tempSurveyDataValue = 0.0;
+ }
+ sheet0.addCell( new Number( tempSurveyValueCol, tempRow1, tempSurveyDataValue, wCellformat1 ) );
+
+ tempSurveyValueCol++;
+ temColValue = tempSurveyValueCol;
+ }
+ /*
+ for( int k=0; k< series2.length; k++ )
+ {
+ // tempCol1 = 0;
+ sheet0.addCell( new Number( tempSurveyValueCol, tempRow1, data2[j][k], wCellformat1 ) );
+ System.out.println( "Outer loop Count: " + j + " inner Loop Count " + k );
+ System.out.println( series2[k] + " : " + data2[j][k] );
+ tempSurveyValueCol++;
+ temColValue = tempSurveyValueCol;
+ //System.out.println( series2[k] + " : " + data2[j][k] );
+ }
+ */
+ int tempNumCol = temColValue;
+
+ sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2) );
+ tempNumCol = tempNumCol+1;
+
+
+ for( int k=0; k< categories1.length; k++ )
+ {
+ // tempCol1 = 0;
+ sheet0.addCell( new Number( tempNumCol, tempRow1, numDataArray[j][k], wCellformat1 ) );
+ tempNumCol++;
+ }
+ int tempDenumCol = temColValue;
+
+ sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den", wCellformat2) );
+
+ tempDenumCol = tempDenumCol+1;
+ for( int k=0; k<categories1.length; k++ )
+ {
+ // tempRow1 = 0;
+ sheet0.addCell( new Number( tempDenumCol, tempRow1+1, denumDataArray[j][k], wCellformat1 ) );
+ tempDenumCol++;
+ }
+
+ int tempValueCol = temColValue;
+
+
+ sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val", wCellformat2) );
+ tempValueCol = tempValueCol+1;
+
+ for( int k=0; k< categories1.length; k++ )
+ {
+ //tempRow1 = 0;
+ sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k], wcf ) );
+ tempValueCol++;
+ }
+
+ tempRow1 = tempRow1+3;
+ tempRow1++;
+ tempRowValue = tempRow1++;
+ }
+ tempRow1 = tempRowValue;
+
+ tempRow1 = tempRow1+2;
+ sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators Names", wCellformat2) );
+
+ sheet0.mergeCells( tempCol1+1 , tempRow1, tempCol1 + 2, tempRow1 );
+ sheet0.addCell( new Label( tempCol1+1, tempRow1, "Formula", wCellformat2) );
+
+ sheet0.addCell( new Label( tempCol1+3, tempRow1, "Numerator DataElements", wCellformat2) );
+ sheet0.addCell( new Label( tempCol1+4, tempRow1, "Denominator DataElements", wCellformat2) );
+
+ tempRow1 = tempRow1+1;
+
+ for(int j=0; j< series1.length; j++)
+ {
+ Indicator indicator = indicatorService.getIndicatorByName( series1[j] );
+
+ sheet0.addCell( new Label( tempCol1, tempRow1, indicator.getName(), wCellformat1 ) );
+ String formula = indicator.getNumeratorDescription() + "/" + indicator.getDenominatorDescription();
+
+ sheet0.addCell( new Label( tempCol1+1, tempRow1,formula , wCellformat1 ) );
+ String factor = "X" + indicator.getIndicatorType().getFactor();
+
+ sheet0.addCell( new Label( tempCol1+2, tempRow1, factor, wCellformat1) );
+ sheet0.addCell( new Label( tempCol1+3, tempRow1, expressionService.getExpressionDescription( indicator.getNumerator()), wCellformat1 ) );
+ sheet0.addCell( new Label( tempCol1+4, tempRow1, expressionService.getExpressionDescription( indicator.getDenominator() ), wCellformat1 ) );
+
+ tempRow1++;
+ }
+
+ /*
int count1 = 0;
int count2 = 0;
int flag1 = 0;
@@ -339,10 +603,12 @@
else
count1 += 10;
}
+
+ */
outputReportWorkbook.write();
outputReportWorkbook.close();
- fileName = "chartOutput.xls";
+ fileName = "Survey Chart Output.xls";
inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
@@ -385,14 +651,16 @@
{
//System.out.println("Before Sorting : ");
double[][] data = new double[objData.length][objData[0].length];
+ // System.out.println(objData.length + ":" + objData[0].length );
+
for ( int i = 0; i < objData.length; i++ )
{
for ( int j = 0; j < objData[0].length; j++ )
{
data[i][j] = objData[i][j].doubleValue();
- //System.out.print(categories1[j]+": "+data[i][j]+", ");
+ // System.out.print(categories1[j]+": "+data[i][j]+", ");
}
- //System.out.println("");
+ // System.out.println("");
}
return data;
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetIndicatorsAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetIndicatorsAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/GetIndicatorsAction.java 2010-12-29 07:47:36 +0000
@@ -28,14 +28,17 @@
*/
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Iterator;
import java.util.List;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.survey.Survey;
import org.hisp.dhis.survey.SurveyService;
import com.opensymphony.xwork2.Action;
@@ -99,20 +102,27 @@
{
this.id = id;
}
-
+/*
private String surveyflag;
public void setSurveyflag( String surveyflag )
{
this.surveyflag = surveyflag;
}
-
+*/
private List<Indicator> indicators;
public List<Indicator> getIndicators()
{
return indicators;
}
+
+ private String surveyExist;
+
+ public void setSurveyExist( String surveyExist )
+ {
+ this.surveyExist = surveyExist;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -138,20 +148,44 @@
indicators = new ArrayList<Indicator>();
}
}
-
+
+
// To Filter the indicators that are assigned to any survey
-
+ /*
if( surveyflag != null && surveyflag.equalsIgnoreCase( "yes" ) )
{
List<Indicator> surveyIndicators = new ArrayList<Indicator>( surveyService.getAllSurveyIndicators() );
indicators.retainAll( surveyIndicators );
}
-
- Collections.sort( indicators, indicatorComparator );
-
- displayPropertyHandler.handle( indicators );
-
- return SUCCESS;
+ System.out.println( "id = "+id + " indicator size = "+ indicators.size() );
+ */
+
+ // filter all the indicators which have not any survey
+ if( surveyExist != null && surveyExist.equalsIgnoreCase( "yes" ) )
+ {
+ System.out.println( "surveyExist" + surveyExist );
+ Iterator<Indicator> allIndicatorIterator = indicators.iterator();
+ while ( allIndicatorIterator.hasNext() )
+ {
+ Indicator indicator = allIndicatorIterator.next();
+ Collection<Survey> surveyList = surveyService.getSurveysByIndicator( indicator );
+ //surveyList = surveyService.getSurveysByIndicator( indicator );
+
+ if ( surveyList == null || surveyList.size()<=0 )
+ {
+ allIndicatorIterator.remove();
+ }
+
+ }
+ }
+
+ System.out.println("id = "+id + " indicator final size = "+ indicators.size());
+
+ Collections.sort( indicators, indicatorComparator );
+
+ displayPropertyHandler.handle( indicators );
+
+ return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction.java 2010-12-29 07:47:36 +0000
@@ -209,8 +209,7 @@
selChart = new SurveyChart();
}
- chart = selChart.getChartViewer( data1, series1, categories1, data2, series2, categories2, chartTitle, xAxis_Title,
- yAxis_Title );
+ chart = selChart.getChartViewer( data1, series1, categories1, data2, series2, categories2, chartTitle, xAxis_Title, yAxis_Title );
// Saving chart into Session
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartIndicatorAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartIndicatorAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartIndicatorAction.java 2010-12-29 07:47:36 +0000
@@ -44,6 +44,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataanalyser.util.DashBoardService;
import org.hisp.dhis.dataanalyser.util.IndicatorChartResult;
+import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
@@ -138,7 +139,14 @@
{
this.format = format;
}
+
+ private ExpressionService expressionService;
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
// --------------------------------------------------------------------------
// Parameters
// --------------------------------------------------------------------------
@@ -299,6 +307,19 @@
private List<OrganisationUnit> selOUGroupMemberList = new ArrayList<OrganisationUnit>();
+ List<String> numDataElements;
+
+ public List<String> getNumDataElements()
+ {
+ return numDataElements;
+ }
+
+ List<String> denumDataElements;
+
+ public List<String> getDenumDataElements()
+ {
+ return denumDataElements;
+ }
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -335,7 +356,9 @@
numeratorDEList = new ArrayList<String>();
denominatorDEList = new ArrayList<String>();
-
+
+ numDataElements = new ArrayList<String>();
+ denumDataElements = new ArrayList<String>();
// ouChildCountMap = new HashMap<OrganisationUnit, Integer>();
// String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" };
@@ -508,7 +531,14 @@
// String indicatorId = (String) deIterator.next();
int serviceID = Integer.parseInt( (String) deIterator.next() );
Indicator indicator = indicatorService.getIndicator( serviceID );
-
+
+ // for numeratorDataElement,denominatorDataElement
+ String numeratorDataElement = expressionService.getExpressionDescription( indicator.getNumerator());
+ String denominatorDataElement = expressionService.getExpressionDescription( indicator.getDenominator());
+
+ numDataElements.add( numeratorDataElement );
+ denumDataElements.add( denominatorDataElement );
+
indicatorList.add( indicator );
}
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateChartSurveyAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateChartSurveyAction.java 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateChartSurveyAction.java 2010-12-29 07:47:36 +0000
@@ -40,6 +40,7 @@
import org.apache.velocity.tools.generic.ListTool;
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataanalyser.util.SurveyChartResult;
+import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -114,6 +115,13 @@
{
this.periodService = periodService;
}
+
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
// ---------------------------------------------------------------
// Input & Output
@@ -137,6 +145,11 @@
private Indicator selectedIndicator;
+ public Indicator getSelectedIndicator()
+ {
+ return selectedIndicator;
+ }
+
private String[] series1;
public String[] getSeries1()
@@ -284,6 +297,36 @@
return surveyDataValueList;
}
+ private Integer selectedIndicatorId;
+
+ public Integer getSelectedIndicatorId()
+ {
+ return selectedIndicatorId;
+ }
+
+ private Integer selectedOrgId;
+
+ public Integer getSelectedOrgId()
+ {
+ return selectedOrgId;
+ }
+
+ private String numDataElement;
+
+ public String getNumDataElement()
+ {
+ return numDataElement;
+ }
+
+ private String denumDataElement;
+
+ public String getDenumDataElement()
+ {
+ return denumDataElement;
+ }
+
+
+
public String execute()throws Exception
{
statementManager.initialise();
@@ -305,9 +348,22 @@
selectedIndicator = new Indicator();
selectedIndicator = indicatorService.getIndicator( availableIndicators );
chartTitle += "\n Indicator : " + selectedIndicator.getName();
-
+
+ // for numeratorDataElement,denominatorDataElement
+ numDataElement = new String();
+ denumDataElement = new String();
+ numDataElement = expressionService.getExpressionDescription( selectedIndicator.getNumerator());
+ denumDataElement = expressionService.getExpressionDescription( selectedIndicator.getDenominator());
+
+
+
+ selectedIndicatorId = selectedIndicator.getId();
+ selectedOrgId = selectedOrgUnit.getId();
+
surveyList = new ArrayList<Survey>( surveyService.getSurveysByIndicator( selectedIndicator ) );
+
+
// Map<OrganisationUnitGroup, List<OrganisationUnit>> orgUnitGroupMap = new HashMap<OrganisationUnitGroup, List<OrganisationUnit>>();
// Map<Survey, Double> surveyValues = new HashMap<Survey, Double>();
//surveyDataValueList = new ArrayList<SurveyDataValue>();
@@ -341,7 +397,7 @@
session.setAttribute( "chartTitle", surveyChartResult.getChartTitle() );
session.setAttribute( "xAxisTitle", surveyChartResult.getXAxis_Title() );
session.setAttribute( "yAxisTitle", surveyChartResult.getYAxis_Title() );
- session.setAttribute( "categories2", categories2 );
+ session.setAttribute( "categories2", surveyChartResult.getCategories2() );
statementManager.destroy();
System.out.println( "Chart Generation End Time is : \t" + new Date() );
@@ -363,7 +419,10 @@
String[] series = new String[1];
String[] categories = new String[monthlyPeriods.size()];
Double[][] data = new Double[1][monthlyPeriods.size()];
-
+
+ Double[][] data2 = new Double[surveyList.size()][monthlyPeriods.size()];
+
+ // Double[][] data2 = new Double[surveyList.size()][surveyList.size()];
Double[][] numDataArray = new Double[1][monthlyPeriods.size()];
Double[][] denumDataArray = new Double[1][monthlyPeriods.size()];
@@ -397,6 +456,7 @@
// List<Double>>();
String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName();
+ chartTitle += "\n Indicator : " + selectedIndicator.getName();
String xAxis_Title = "Period";
String yAxis_Title = "Indicator";
@@ -405,6 +465,7 @@
data2 = new Double[surveyList.size()][monthlyPeriods.size()];
+ // data2 = new Double[surveyList.size()][surveyList.size()];
series2 = new String[surveyList.size()];
for ( int i = 0; i < data2.length; i++ )
@@ -426,7 +487,9 @@
{
data2[i][j] = 0.0;
}
+ //System.out.println( data2[i][j]);
}
+
}
int countForServiceList = 0;
@@ -477,7 +540,7 @@
countForServiceList++;
- surveyChartResult = new SurveyChartResult( series, series2,categories, data, data2, numDataArray, denumDataArray, chartTitle, xAxis_Title, yAxis_Title );
+ surveyChartResult = new SurveyChartResult( series, series2,categories, categories2, data, data2, numDataArray, denumDataArray, chartTitle, xAxis_Title, yAxis_Title );
return surveyChartResult;
}
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateSurveyAnalysisFormAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateSurveyAnalysisFormAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/sa/action/GenerateSurveyAnalysisFormAction.java 2010-12-29 07:47:36 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.comparator.PeriodComparator;
+import org.hisp.dhis.survey.Survey;
import org.hisp.dhis.survey.SurveyService;
import com.opensymphony.xwork2.Action;
@@ -153,7 +154,9 @@
{
return simpleDateFormat;
}
-
+
+ Collection<Survey> surveyList;
+
public String execute()
throws Exception
{
@@ -167,8 +170,26 @@
/* Indicators and Groups */
//indicators = indicatorService.getAllIndicators();
indicatorGroups = indicatorService.getAllIndicatorGroups();
+ //indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators());
+
indicators = surveyService.getAllSurveyIndicators();
-
+ /*
+ // filter all the indicators which have not any survey
+ Iterator<Indicator> allIndicatorIterator = indicators.iterator();
+ while ( allIndicatorIterator.hasNext() )
+ {
+ Indicator indicator = allIndicatorIterator.next();
+ surveyList = surveyService.getSurveysByIndicator( indicator );
+
+ if ( surveyList == null || surveyList.size()<=0 )
+ {
+ allIndicatorIterator.remove();
+ }
+
+ }
+
+ Collections.sort( indicators, new IndicatorNameComparator() );
+ */
/* Monthly Periods */
monthlyPeriods = new ArrayList<Period>( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) );
Iterator<Period> periodIterator = monthlyPeriods.iterator();
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/SurveyChartResult.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/SurveyChartResult.java 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/SurveyChartResult.java 2010-12-29 07:47:36 +0000
@@ -45,11 +45,12 @@
}
- public SurveyChartResult( String[] series, String[] series2, String[] categories, Double data[][], Double data2[][], Double numDataArray[][],Double denumDataArray[][],String chartTitle,String xAxis_Title,String yAxis_Title )
+ public SurveyChartResult( String[] series, String[] series2, String[] categories, String[] categories2, Double data[][], Double data2[][], Double numDataArray[][],Double denumDataArray[][],String chartTitle,String xAxis_Title,String yAxis_Title )
{
this.series = series; // Y-axis
this.series2 = series2; // for Survey name
this.categories = categories; // X-axis
+ this.categories2 = categories2;
this.data = data;
this.data2 = data2; // for survey value
this.numDataArray = numDataArray;
@@ -103,6 +104,19 @@
this.categories = categories;
}
+ private String[] categories2;
+
+ public String[] getCategories2()
+ {
+ return categories2;
+ }
+
+ public void setCategories2( String[] categories2 )
+ {
+ this.categories2 = categories2;
+ }
+
+
Double data[][];
public Double[][] getData()
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-12-29 07:47:36 +0000
@@ -121,6 +121,8 @@
</property>
<property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService">
</property>
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService">
+ </property>
<!-- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService">
</property>-->
<!-- <property name="periodService" ref="org.hisp.dhis.period.PeriodService">
@@ -138,6 +140,10 @@
<property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
</property>
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService">
+ </property>
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService">
+ </property>
</bean>
<!-- Graphical Analyser Indicators End-->
@@ -285,8 +291,24 @@
<property name="organisationUnitService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
</property>
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService">
+ </property>
</bean>
+<!-- Export Annual Data to Excel -->
+ <bean id="org.hisp.dhis.dataanalyser.action.ExportAnnualDataToExcelAction"
+ class="org.hisp.dhis.dataanalyser.action.ExportAnnualDataToExcelAction"
+ scope="prototype">
+
+ <property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
+ </property>
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService">
+ </property>
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService">
+ </property>
+ </bean>
+
+
<!-- Motion Chart -->
<bean id="org.hisp.dhis.dataanalyser.mchart.action.MotionChartFormAction"
@@ -376,6 +398,8 @@
<property name="surveyDataValueService">
<ref bean="org.hisp.dhis.surveydatavalue.SurveyDataValueService"/>
</property>
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService">
+ </property>
</bean>
<!--
@@ -436,6 +460,16 @@
<property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
</property>
+ <property name="surveyService" ref="org.hisp.dhis.survey.SurveyService">
+ </property>
+ <property name="surveyDataValueService" ref="org.hisp.dhis.surveydatavalue.SurveyDataValueService">
+ </property>
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+ </property>
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService">
+ </property>
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService">
+ </property>
</bean>
<!-- DataStatus -->
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml 2010-12-29 07:47:36 +0000
@@ -192,7 +192,19 @@
<param name="stylesheets">css/StylesForTags.css</param>
<interceptor-ref name="organisationUnitTreeStack"/>
</action>
-
+
+<!-- Export Annual data to Excel -->
+ <action name="exportAnnualDataToExcel"
+ class="org.hisp.dhis.dataanalyser.action.ExportAnnualDataToExcelAction">
+ <result name="success" type="stream">
+ <param name="contentType">application/vnd.ms-excel</param>
+ <param name="inputName">inputStream</param>
+ <param name="contentDisposition">filename="${fileName}"</param>
+ <param name="bufferSize">1024</param>
+ </result>
+ </action>
+
+
<!-- Motion Chart -->
<action name="motionChartForm"
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/annualAnalysisResult.vm 2010-12-29 07:47:36 +0000
@@ -9,6 +9,22 @@
chartNamesToView[0] = new Array("Nothing");
chartNamesToView[1] = new Array("Vertical3DBarChart","Horizontal3DBarChart","LineChart","LineAndBarChart","DualAxisChart","AreaChart","PieChart3D");
chartNamesToView[2] = new Array("Vertical3DBarChart","Horizontal3DBarChart","LineChart","LineAndBarChart","DualAxisChart","AreaChart");
+
+ //var selctedIndicatorId = $selectedIndicatorId;
+ if( $riRadio.equals("indicatorsRadio") )
+ {
+ var radioValue = "indicator";
+ var selctedIndicatorId = $selectedIndicatorId;
+
+ }
+ else
+ {
+ var radioValue = "dataelement";
+ }
+
+ //alert( radioValue );
+
+ //var indicator = $riRadio.equals("indicatorsRadio")
function nextCharttoView()
{
@@ -45,22 +61,53 @@
iframeForChart.location.href = "generateChart.action?currentChart="+chartTypeOptionValue;
}
+//for export into excel
+function exportToExcelFunction1( summaryOption )
+{
+ //alert("inside import excel");
+ //alert(radioValue);
+ // var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+ // var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+
+ if( radioValue == "indicator" )
+ {
+ document.getElementById("exportExcelAnchor1").href="exportAnnualDataToExcel.action?radioButtonValue="+radioValue+"&selctedIndicatorId="+selctedIndicatorId+"&viewSummary="+summaryOption+"&chartDisplayOption=none";
+ }
+ else
+ {
+ document.getElementById("exportExcelAnchor1").href="exportAnnualDataToExcel.action?radioButtonValue="+radioValue+"&viewSummary="+summaryOption+"&chartDisplayOption=none";
+ }
+}
+function exportDataStatusResultToWorkBook()
+{
+ document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;
+
+ return true;
+}
+
</script>
</head>
<body >
- <div align="right">
+<div align="right">
+<table>
+
<!-- <input type="button" name="prevChartButton" id="prevChartButton" style="width: 40; height: 35; background-image: url('images/moveLeft.gif'); background-repeat: no-repeat; background-position: center; " onClick="prevCharttoView()" title="Previous">
<input type="button" name="nextChartButton" id="nextChartButton" style="width: 40; height: 35; background-image: url('images/moveRight.gif'); background-repeat: no-repeat; background-position: center;" onClick="nextCharttoView()" title="Next"> -->
- <select id="chartTypeOption" name="chartTypeOption" onchange="chartTypeOptionChange(event)">
- <option value="Vertical3DBarChart">Vertical 3D BarChart</option>
- <option value="Horizontal3DBarChart">Horizontal 3D BarChart</option>
- <option value="LineChart">Line Chart</option>
- <option value="LineAndBarChart">Line And BarChart</option>
- <option value="AreaChart" >Area Chart</option>
- </select>
- </div>
+ <tr>
+ <td class="NormalB"><a id="exportExcelAnchor1" name="exportExcelAnchor1" href="#" onclick="javascript:exportToExcelFunction1('no')" target="_blank">Export To Excel</a></td>
+ <td class="NormalB"><select id="chartTypeOption" name="chartTypeOption" onchange="chartTypeOptionChange(event)">
+ <option value="Vertical3DBarChart">Vertical 3D BarChart</option>
+ <option value="Horizontal3DBarChart">Horizontal 3D BarChart</option>
+ <option value="LineChart">Line Chart</option>
+ <option value="LineAndBarChart">Line And BarChart</option>
+ <option value="AreaChart" >Area Chart</option>
+ </select>
+ </td>
+ </tr>
+</table>
+</div>
<br /><br />
-#if($riRadio.equals("indicatorsRadio"))
+#if( $riRadio.equals("indicatorsRadio") )
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">
<tr>
<td class="TableHeadingCellStyles" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Year</strong></td>
@@ -107,10 +154,26 @@
#end
</table>
- <br />
- <div align="center">
- <iframe name="iframeForChart" id="iframeForChart" src="generateChart.action?currentChart=Vertical3DBarChart" width="850px" height="550px" scrolling=auto frameborder="0"></iframe>
- </div>
+<br />
+<div align="center">
+ <iframe name="iframeForChart" id="iframeForChart" src="generateChart.action?currentChart=Vertical3DBarChart" width="850px" height="550px" scrolling=auto frameborder="0"></iframe>
+</div>
+
+<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%" WRAP="HARD">
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Indicator Names</strong></td>
+ <td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" colspan="2" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Formula</strong></td>
+ <td class="TableHeadingCellStyles" width="20%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Numerator DataElements</strong></td>
+ <td class="TableHeadingCellStyles" width="20%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Denominator DataElements</strong></td>
+ </tr>
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$selectedIndicator.getName()</td>
+ <td class="TableHeadingCellStyles" width="25%" align="center" style="border-left-style:dotted; border-left-width:1; border-right-width:0; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><u>$selectedIndicator.getNumeratorDescription()</u><br>$selectedIndicator.getDenominatorDescription()</td>
+ <td class="TableHeadingCellStyles" width="5%" align="left" style="border-left-style:dotted; border-left-width:0; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"> X $selectedIndicator.getIndicatorType().getFactor()</td>
+ <td class="TableCellDataWrapStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1" >$numDataElement</td>
+ <td class="TableCellDataWrapStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1" >$denumDataElement</td>
+ </tr>
+</table>
#else
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">
<tr>
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css 2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/css/StylesForTags.css 2010-12-29 07:47:36 +0000
@@ -83,5 +83,11 @@
white-space: nowrap;
cursor: default;
}
-
+.TableCellDataWrapStyles {
+ font-family: arial, georgia, tahoma;
+ font-size: 11px;
+ white-space: wrap;
+ cursor: default;
+ border:1px dotted #C0C0C0;
+}
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm 2010-12-03 11:30:11 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm 2010-12-29 07:47:36 +0000
@@ -147,7 +147,7 @@
<table>
<tr>
<td class="NormalB"> $i18n.getString( "ga_viewby" )<br>
- <select id="categoryLB" name="categoryLB" onChange="categoryChangeFunction1(event)">
+ <select id="categoryLB" name="categoryLB" onChange="categoryChangeFunction1(event)" disabled="true">
<option value="period">Period Wise</option>
<option value="children">Children</option>
<option value="random">Selected</option>
@@ -157,7 +157,7 @@
</td>
<td> </td>
<td align="left" class="NormalB"> $i18n.getString( "periodType" )<br>
- <select id="periodTypeLB" name="periodTypeLB" onchange="getPeriods()" style="width: 150px;">
+ <select id="periodTypeLB" name="periodTypeLB" onchange="getPeriods()" style="width: 150px;" disabled="true">
#foreach ( $periodType in $periodTypes )
<option value="$periodType.name" #if($periodType.name==$monthlyPeriodTypeName) selected #end>$periodType.name</option>
#end
@@ -189,7 +189,7 @@
<table>
<tr>
<td class="NormalB"> $i18n.getString( "year" )<br>
- <select id="yearLB" name="yearLB" onchange="getWeeklyPeriod()" size="5" multiple style="width: 150px;">
+ <select id="yearLB" name="yearLB" onchange="getWeeklyPeriod()" size="5" multiple style="width: 150px;" disabled="true">
#foreach($periodName in $periodNameList)
<option value="$periodName">$periodName</option>
#end
@@ -199,7 +199,7 @@
</td>
<td> </td>
<td class="NormalB"> $i18n.getString( "period" )<br>
- <select id="periodLB" name="periodLB" size="5" multiple style="width: 175px;">
+ <select id="periodLB" name="periodLB" size="5" multiple style="width: 175px;" disabled="true">
</select>
<br />
<br />
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-12-03 11:30:11 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-12-29 07:47:36 +0000
@@ -16,8 +16,8 @@
// var maxOrgUnitLevels = $maxOrgUnitLevels;
var orgUnitIds="NONE";
- var currentOrgUnitId;
- var currentOrgUnitName;
+ var currentOrgUnitId = "";
+ var currentOrgUnitName = "";
var monthDays = new Array(31,29,31,30,31,30,31,31,30,31,30,31); // for daily Period
var days = new Array();
@@ -143,7 +143,7 @@
<table>
<tr>
<td class="NormalB"> $i18n.getString( "ga_viewby" )<br>
- <select id="categoryLB" name="categoryLB" onChange="categoryChangeFunction1(event)">
+ <select id="categoryLB" name="categoryLB" onChange="categoryChangeFunction1(event)" disabled="true">
<option value="period">Period Wise</option>
<option value="children">Children</option>
<option value="random">Selected</option>
@@ -153,7 +153,7 @@
</td>
<td> </td>
<td align="left" class="NormalB"> $i18n.getString( "periodType" )<br>
- <select id="periodTypeLB" name="periodTypeLB" onchange="getPeriods()" style="width: 150px;">
+ <select id="periodTypeLB" name="periodTypeLB" onchange="getPeriods()" style="width: 150px;" disabled="true">
#foreach ( $periodType in $periodTypes )
<option value="$periodType.name" #if($periodType.name==$monthlyPeriodTypeName) selected #end>$periodType.name</option>
#end
@@ -185,7 +185,7 @@
<table>
<tr>
<td class="NormalB"> $i18n.getString( "year" )<br>
- <select id="yearLB" name="yearLB" onchange="getWeeklyPeriod()" size="5" multiple style="width: 150px;">
+ <select id="yearLB" name="yearLB" onchange="getWeeklyPeriod()" size="5" multiple style="width: 150px;" disabled="true">
#foreach($periodName in $periodNameList)
<option value="$periodName">$periodName</option>
#end
@@ -195,7 +195,7 @@
</td>
<td> </td>
<td class="NormalB"> $i18n.getString( "period" )<br>
- <select id="periodLB" name="periodLB" size="5" multiple style="width: 175px;">
+ <select id="periodLB" name="periodLB" size="5" multiple style="width: 175px;" disabled="true">
</select>
<br />
<br />
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm 2010-12-29 07:47:36 +0000
@@ -224,7 +224,7 @@
#end
</div>
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">
+ <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%" WRAP="HARD">
<tr>
<td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Indicator Names</strong></td>
<td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" colspan="2" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Formula</strong></td>
@@ -237,8 +237,10 @@
<td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$service.getName()</td>
<td class="TableHeadingCellStyles" width="25%" align="center" style="border-left-style:dotted; border-left-width:1; border-right-width:0; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><u>$service.getNumeratorDescription()</u><br>$service.getDenominatorDescription()</td>
<td class="TableHeadingCellStyles" width="5%" align="left" style="border-left-style:dotted; border-left-width:0; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"> X $service.getIndicatorType().getFactor()</td>
- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$numeratorDEList.get($count1)</td>
- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$denominatorDEList.get($count1)</td>
+ <!-- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$numeratorDEList.get($count1)</td>
+ <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$denominatorDEList.get($count1)</td>-->
+ <td class="TableCellDataWrapStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1" >$numDataElements.get($count1)</td>
+ <td class="TableCellDataWrapStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1" >$denumDataElements.get($count1)</td>
</tr>
#set($count1 = $count1 + 1)
#end
=== 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 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/db.js 2010-12-29 07:47:36 +0000
@@ -380,18 +380,27 @@
{
var indicatorGroupList = document.getElementById( "indicatorGroupId" );
var indicatorGroupId = indicatorGroupList.options[ indicatorGroupList.selectedIndex ].value;
-
+ var surveyExist = "yes";
if ( indicatorGroupId != null )
{
- $.post("getIndicators.action",
+ /*
+ var url = "getIndicators.action?id=" + indicatorGroupId + "&surveyExist=" + surveyExist;
+ var request = new Request();
+ request.setResponseTypeXML('indicator');
+ request.setCallbackSuccess(getIndicatorsReceived);
+ request.send(url);
+ */
+ $.post("getIndicators.action",
{
- id:indicatorGroupId
+ id : indicatorGroupId,
+ surveyExist : surveyExist
},
function (data)
{
getIndicatorsReceived(data);
},'xml');
+
}
}
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-12-06 05:36:08 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-12-29 07:47:36 +0000
@@ -5,6 +5,11 @@
document.getElementById( "ougGroupSetCB" ).disabled = false;
document.getElementById( "orgUnitGroupList" ).disabled = false;
+ document.getElementById( "categoryLB" ).disabled = false;
+ document.getElementById( "periodTypeLB" ).disabled = false;
+ document.getElementById( "yearLB" ).disabled = false;
+ document.getElementById( "periodLB" ).disabled = false;
+
var request = new Request();
request.setResponseTypeXML( 'orgunit' );
request.setCallbackSuccess( getOUDetailsForGARecevied );
@@ -36,11 +41,14 @@
for ( var i = 0; i < orgUnits.length; i++ )
{
+ //var currentOrgUnitName = "";
+ //var currentOrgUnitId = "";
var id = orgUnits[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;
- var orgUnitName = orgUnits[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
+ var orgUnitName = orgUnits[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
- currentOrgUnitId = id;
- currentOrgUnitName = orgUnitName;
+
+ currentOrgUnitId = id;
+ currentOrgUnitName = orgUnitName;
// alert("orgUnit Id is : " + id + ", name is :" + orgUnitName );
if(document.ChartGenerationForm.categoryLB.options[categoryIndex].value == "period" || document.ChartGenerationForm.categoryLB.options[categoryIndex].value == "children" )
{
@@ -49,19 +57,19 @@
{
document.ChartGenerationForm.orgUnitListCB.options[0] = null;
}
- document.ChartGenerationForm.orgUnitListCB.options[0] = new Option(orgUnitName,id,false,false);
+ document.ChartGenerationForm.orgUnitListCB.options[0] = new Option( orgUnitName,id,false,false );
}
//22/10/2010
else if( document.ChartGenerationForm.categoryLB.options[categoryIndex].value == "random" && document.getElementById( 'ougGroupSetCB' ).checked )
{
- //ouListCDId.options[ouListCDId.options.length] = new Option(orgUnitName,id,false,false);
+ //ouListCDId.options[ouListCDId.options.length] = new Option(orgUnitName,id,false,false);
index = document.ChartGenerationForm.orgUnitListCB.options.length;
for(i=0;i<index;i++)
{
document.ChartGenerationForm.orgUnitListCB.options[0] = null;
}
- document.ChartGenerationForm.orgUnitListCB.options[0] = new Option(orgUnitName,id,false,false);
+ document.ChartGenerationForm.orgUnitListCB.options[0] = new Option( orgUnitName,id,false,false );
}
else
@@ -258,18 +266,20 @@
function categoryChangeFunction1(evt)
{
selCategory = $("select#categoryLB").val();
-
+
+ // var currentOrgUnitName = "";
+ //var currentOrgUnitId = "";
if(selCategory == "period" || selCategory == "children" )
{
clearListById('orgUnitListCB');
- document.ChartGenerationForm.orgUnitListCB.options[0] = new Option(currentOrgUnitName,currentOrgUnitId,false,false);
+ document.ChartGenerationForm.orgUnitListCB.options[0] = new Option( currentOrgUnitName,currentOrgUnitId,false,false);
}
else
{
// $('#facilityLB').removeAttr('disabled');
}
}
- // categoryChangeFunction end
+// categoryChangeFunction end
//Removes slected orgunits from the Organisation List
function remOUFunction()
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForSA.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForSA.vm 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForSA.vm 2010-12-29 07:47:36 +0000
@@ -9,7 +9,8 @@
<a href="index.action">
<img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
</div>
-#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+##parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
<!-- The script that registeres selctions in the orgunit tree -->
<script type="text/javascript">
@@ -21,7 +22,7 @@
return;
}
- if(orgUnitIds != null)
+ if( orgUnitIds != null )
{
getOUDeatilsForAA(orgUnitIds);
}
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/surveyAnalysisResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/surveyAnalysisResult.vm 2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/surveyAnalysisResult.vm 2010-12-29 07:47:36 +0000
@@ -1,6 +1,13 @@
<script>
-
+
+ var selectedOrgUnitId = $selectedOrgId;
+ var selctedIndicatorId = $selectedIndicatorId;
+
+ //alert( selectedOrgUnitId );
+
+ //alert( selctedIndicatorId );
+
function chartDisplayOptionChange(evt)
{
var chartType = 0;
@@ -20,10 +27,11 @@
function exportToExcelFunction1( summaryOption )
{
+ //alert( "inside export excel function" );
//var chartDisplayOptionList = document.getElementById("chartDisplayOption");
//var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
- document.getElementById("exportExcelAnchor1").href="exportSurveyDataToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption=none";
+ document.getElementById("exportExcelAnchor1").href="exportSurveyDataToExcel.action?viewSummary="+summaryOption+"&selectedOrgUnitId="+selectedOrgUnitId+"&selctedIndicatorId="+selctedIndicatorId+"&chartDisplayOption=none";
//document.getElementById("exportExcelAnchor1").href="exportToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption=none";
@@ -64,25 +72,24 @@
#set($count1 = 0)
#set( $surveyDataValueResult = $surveyChartResult.data2 )
#foreach($onedataList in $surveyChartResult.data )
- <tr>
- #set( $numValCimpleteResult = $surveyChartResult.numDataArray )
- #set( $denumValCimpleteResult = $surveyChartResult.denumDataArray )
-
- #set( $numValList = $listTool.get($numValCimpleteResult, $count1) )
- #set( $denumValList = $listTool.get($denumValCimpleteResult, $count1) )
- #set( $count2 = 0 )
-
- <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1" rowspan="3" >$yseriesList.get($count1)</td>
- #foreach( $surveyDV in $surveyDataValueList )
- <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" rowspan="3" >$!surveyDV.value</td>
- #end
-
- <td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Num</strong></td>
- #foreach($data in $onedataList)
- <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$listTool.get($numValList, $count2)</td>
- #set( $count2 = $count2 + 1 )
- #end
- </tr>
+ <tr>
+ #set( $numValCimpleteResult = $surveyChartResult.numDataArray )
+ #set( $denumValCimpleteResult = $surveyChartResult.denumDataArray )
+
+ #set( $numValList = $listTool.get($numValCimpleteResult, $count1) )
+ #set( $denumValList = $listTool.get($denumValCimpleteResult, $count1) )
+ #set( $count2 = 0 )
+
+ <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1" rowspan="3" >$yseriesList.get($count1)</td>
+ #foreach( $surveyDV in $surveyDataValueList )
+ <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" rowspan="3" >$!surveyDV.value</td>
+ #end
+ <td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Num</strong></td>
+ #foreach($data in $onedataList)
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$listTool.get($numValList, $count2)</td>
+ #set( $count2 = $count2 + 1 )
+ #end
+ </tr>
<tr>
<td class="TableHeadingCellStyles" align="center" bgcolor="#C0C0C0" style="border-style: dotted; border-width: 1" ><strong>Den</strong></td>
#set( $count2 = 0 )
@@ -107,8 +114,26 @@
<iframe name="iframeForChart" id="iframeForChart" src="generateChart.action?currentChart=SurveyChart" width="850px" height="550px" scrolling=auto frameborder="0"></iframe>
</div>
<br>
+</div>
+<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%" WRAP="HARD">
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Indicator Names</strong></td>
+ <td class="TableHeadingCellStyles" width="30%" align="center" bgcolor="#C0C0C0" colspan="2" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Formula</strong></td>
+ <td class="TableHeadingCellStyles" width="20%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Numerator DataElements</strong></td>
+ <td class="TableHeadingCellStyles" width="20%" align="center" bgcolor="#C0C0C0" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><strong>Denominator DataElements</strong></td>
+ </tr>
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$selectedIndicator.getName()</td>
+ <td class="TableHeadingCellStyles" width="25%" align="center" style="border-left-style:dotted; border-left-width:1; border-right-width:0; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><u>$selectedIndicator.getNumeratorDescription()</u><br>$selectedIndicator.getDenominatorDescription()</td>
+ <td class="TableHeadingCellStyles" width="5%" align="left" style="border-left-style:dotted; border-left-width:0; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"> X $selectedIndicator.getIndicatorType().getFactor()</td>
+ <td class="TableCellDataWrapStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1" >$numDataElement</td>
+ <td class="TableCellDataWrapStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1" >$denumDataElement</td>
+ </tr>
+</table>
-</div>
-<textarea id="testId" rows="10" cols="70" style="display:none"> </textarea>
+<textarea id="testId" rows="10" cols="70" style="display:none"> </textarea>
+ <input type="hidden" name="selectedOrganisationUnit" id="selectedOrganisationUnit" value="">
+ <input type="hidden" name="selectedIndicatorId" id="selectedIndicatorId" value="">
+
</form>
</body>