=== 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> numDataList; public List> getNumDataList() { return numDataList; } - //17/12/2010 for denum data + List> denumDataList; public List> getDenumDataList() { return denumDataList; } - +*/ Double numServiceValues[][]; public Double[][] getNumServiceValues() @@ -198,13 +213,12 @@ return denumServiceValues; } - - List> dataList; public List> getDataList() { return dataList; } + List xseriesList; public List getXseriesList() { @@ -227,13 +241,16 @@ private List annualPeriodsListCB; private List 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>(); - numDataList = new ArrayList>(); - denumDataList = new ArrayList>(); + //numDataList = new ArrayList>(); + //denumDataList = new ArrayList>(); xseriesList = new ArrayList(); yseriesList = new ArrayList(); @@ -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 dataValues = new ArrayList(); - List numDataValue = new ArrayList(); - List denumDataValue = new ArrayList(); + //List numDataValue = new ArrayList(); + //List denumDataValue = new ArrayList(); 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 periodTypes = periodService.getAllPeriodTypes(); PeriodType periodType = null; Iterator 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) && (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 surveyList = (List)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( 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 indicators; public List getIndicators() { return indicators; } + + private String surveyExist; + + public void setSurveyExist( String surveyExist ) + { + this.surveyExist = surveyExist; + } // ------------------------------------------------------------------------- // Action implementation @@ -138,20 +148,44 @@ indicators = new ArrayList(); } } - + + // To Filter the indicators that are assigned to any survey - + /* if( surveyflag != null && surveyflag.equalsIgnoreCase( "yes" ) ) { List surveyIndicators = new ArrayList( 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 allIndicatorIterator = indicators.iterator(); + while ( allIndicatorIterator.hasNext() ) + { + Indicator indicator = allIndicatorIterator.next(); + Collection 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 selOUGroupMemberList = new ArrayList(); + List numDataElements; + + public List getNumDataElements() + { + return numDataElements; + } + + List denumDataElements; + + public List getDenumDataElements() + { + return denumDataElements; + } // ------------------------------------------------------------------------- // Action Implementation // ------------------------------------------------------------------------- @@ -335,7 +356,9 @@ numeratorDEList = new ArrayList(); denominatorDEList = new ArrayList(); - + + numDataElements = new ArrayList(); + denumDataElements = new ArrayList(); // ouChildCountMap = new HashMap(); // 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( surveyService.getSurveysByIndicator( selectedIndicator ) ); + + // Map> orgUnitGroupMap = new HashMap>(); // Map surveyValues = new HashMap(); //surveyDataValueList = new ArrayList(); @@ -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>(); 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 surveyList; + public String execute() throws Exception { @@ -167,8 +170,26 @@ /* Indicators and Groups */ //indicators = indicatorService.getAllIndicators(); indicatorGroups = indicatorService.getAllIndicatorGroups(); + //indicators = new ArrayList( indicatorService.getAllIndicators()); + indicators = surveyService.getAllSurveyIndicators(); - + /* + // filter all the indicators which have not any survey + Iterator 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( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) ); Iterator 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 @@ + + @@ -285,8 +291,24 @@ + + + + + + + + + + + + + + + + === 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 @@ css/StylesForTags.css - + + + + + application/vnd.ms-excel + inputStream + filename="${fileName}" + 1024 + + + + -
+
+ + - - + + + + +
Export To Excel +
+


-#if($riRadio.equals("indicatorsRadio")) +#if( $riRadio.equals("indicatorsRadio") ) @@ -107,10 +154,26 @@ #end
Year
-
-
- -
+
+
+ +
+ + + + + + + + + + + + + + + +
Indicator NamesFormulaNumerator DataElementsDenominator DataElements
$selectedIndicator.getName()$selectedIndicator.getNumeratorDescription()
$selectedIndicator.getDenominatorDescription()
 X $selectedIndicator.getIndicatorType().getFactor()$numDataElement$denumDataElement
#else === 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 @@
$i18n.getString( "ga_viewby" )
- @@ -157,7 +157,7 @@
      $i18n.getString( "periodType" )
- #foreach ( $periodType in $periodTypes ) #end @@ -189,7 +189,7 @@
$i18n.getString( "year" )
- #foreach($periodName in $periodNameList) #end @@ -199,7 +199,7 @@
      $i18n.getString( "period" )
-

=== 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 @@
$i18n.getString( "ga_viewby" )
- @@ -153,7 +153,7 @@
      $i18n.getString( "periodType" )
- #foreach ( $periodType in $periodTypes ) #end @@ -185,7 +185,7 @@
$i18n.getString( "year" )
- #foreach($periodName in $periodNameList) #end @@ -195,7 +195,7 @@
      $i18n.getString( "period" )
-

=== 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 - +
@@ -237,8 +237,10 @@ - - + + + #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 $i18n.getString( -#parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) +##parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) +#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
Indicator Names Formula$service.getName() $service.getNumeratorDescription()
$service.getDenominatorDescription()
 X $service.getIndicatorType().getFactor()$numeratorDEList.get($count1)$denominatorDEList.get($count1)$numDataElements.get($count1)$denumDataElements.get($count1)