=== modified file 'dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java' --- dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java 2010-12-30 05:17:07 +0000 +++ dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java 2011-01-17 06:56:53 +0000 @@ -64,6 +64,8 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.period.PeriodType; +import org.hisp.dhis.period.WeeklyPeriodType; +import org.hisp.dhis.period.YearlyPeriodType; import org.hisp.dhis.source.Source; import org.hisp.dhis.user.User; import org.hisp.dhis.user.UserCredentials; @@ -210,24 +212,30 @@ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" ); - List monthlyPeriods = null; + List periods = null; PeriodType pt = null; if ( periodType.equals( "3" ) ) { pt = new MonthlyPeriodType(); - monthlyPeriods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - - } - else - { - if ( periodType.equals( "1" ) ) - { - pt = new DailyPeriodType(); - monthlyPeriods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } - } - - for ( Period period : monthlyPeriods ) + periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); + } + else if ( periodType.equals( "1" ) ) + { + pt = new DailyPeriodType(); + periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); + } + else if( periodType.equals( "6" ) ) + { + pt = new YearlyPeriodType(); + periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); + } + else if( periodType.equals( "2" ) ) + { + pt = new WeeklyPeriodType(); + periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); + } + + for ( Period period : periods ) { String tempDate = dateFormat.format( period.getStartDate() ); if ( tempDate.equalsIgnoreCase( startDate ) ) === added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportTargetDataToExcelAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportTargetDataToExcelAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportTargetDataToExcelAction.java 2011-01-17 06:56:53 +0000 @@ -0,0 +1,257 @@ +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.List; +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.survey.Survey; + +import com.keypoint.PngEncoder; +import com.opensymphony.xwork2.Action; +import com.opensymphony.xwork2.ActionContext; + +public class ExportTargetDataToExcelAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private ConfigurationService configurationService; + + public void setConfigurationService( ConfigurationService configurationService ) + { + this.configurationService = configurationService; + } + + // ------------------------------------------------------------------------- + // Input & output + // ------------------------------------------------------------------------- + + double[][] data1; + + double[][] numDataArray; + + double[][] denumDataArray; + + double[][] data2; + + String[] series1; + + String[] series2; + + String[] categories1; + + String[] categories2; + + List surveyList; + + + private InputStream inputStream; + + public InputStream getInputStream() + { + return inputStream; + } + + private String fileName; + + public String getFileName() + { + return fileName; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + int tempCol1 = 0; + int tempRow1 = 1; + + 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[][] 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 ); + + if( objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null ) + System.out.println("Session Objects are null"); + else + System.out.println("Session Objects are not null"); + + data1 = convertDoubleTodouble( objData1 ); + + data2 = convertDoubleTodouble( objData2 ); + + String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue() + + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls"; + + WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File(outputReportFile) ); + WritableSheet sheet0 = outputReportWorkbook.createSheet( "TargetChartOutput", 0 ); + + WritableImage writableImage = new WritableImage(0,1,10,23,encoderBytes); + sheet0.addImage( writableImage ); + tempRow1 = 24; + + tempCol1 = 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.setVerticalAlignment( VerticalAlignment.CENTRE ); + wcf.setWrap( true ); + + sheet0.addCell( new Label( tempCol1, tempRow1, "DataElement", wCellformat2) ); + + 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.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) ); + + int temColValue = 0; + + int tempValueCol = temColValue; + + tempValueCol = tempValueCol+1; + + for( int k=0; k< categories1.length; k++ ) + { + sheet0.addCell( new Number( tempValueCol, tempRow1, data1[j][k], wcf ) ); + tempValueCol++; + } + tempRow1++; + } + + tempRow1++; + + for(int j=0; j< series2.length; j++) + { + tempCol1 = 0; + sheet0.addCell( new Label( tempCol1, tempRow1, series2[j], wCellformat2) ); + + int tempValueCol = 1; + + for( int k=0; k< categories1.length; k++ ) + { + sheet0.addCell( new Number( tempValueCol, tempRow1, data2[j][k], wcf ) ); + tempValueCol++; + } + + tempRow1++; + } + + + outputReportWorkbook.write(); + outputReportWorkbook.close(); + + fileName = "Target_ChartOutput.xls"; + + inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) ); + + return SUCCESS; + } + + + public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S) + { + 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 < series2S.length; i++) + { + series2[i] = series2S[i]; + } + for(i = 0; i < categories1S.length; i++) + { + categories1[i] = categories1S[i]; + } + for(i = 0; i < categories2S.length; i++) + { + categories2[i] = categories2S[i]; + } + } + + public double[][] convertDoubleTodouble( Double[][] objData ) + { + 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(); + } + } + + return data; + }// convertDoubleTodouble end + +} === added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.java 2011-01-17 06:56:53 +0000 @@ -0,0 +1,372 @@ +package org.hisp.dhis.dataanalyser.tr.action; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.amplecode.quick.StatementManager; +import org.apache.struts2.ServletActionContext; +import org.apache.velocity.tools.generic.ListTool; +import org.hisp.dhis.aggregation.AggregationService; +import org.hisp.dhis.dataanalyser.util.SurveyChartResult; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementCategoryService; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.detarget.DeTarget; +import org.hisp.dhis.detarget.DeTargetMember; +import org.hisp.dhis.detarget.DeTargetService; +import org.hisp.dhis.detargetdatavalue.DeTargetDataValueService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.period.MonthlyPeriodType; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodService; +import org.hisp.dhis.period.YearlyPeriodType; + +import com.opensymphony.xwork2.Action; +import com.opensymphony.xwork2.ActionContext; + +public class GenerateTargetAnalysisDataAction implements Action +{ + // --------------------------------------------------------------- + // Dependencies + // --------------------------------------------------------------- + + private StatementManager statementManager; + + public void setStatementManager( StatementManager statementManager ) + { + this.statementManager = statementManager; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private DataElementCategoryService dataElementCategoryService; + + public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService ) + { + this.dataElementCategoryService = dataElementCategoryService; + } + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + private AggregationService aggregationService; + + public void setAggregationService( AggregationService aggregationService ) + { + this.aggregationService = aggregationService; + } + + private PeriodService periodService; + + public void setPeriodService( PeriodService periodService ) + { + this.periodService = periodService; + } + + private DeTargetService deTargetService; + + public void setDeTargetService( DeTargetService deTargetService ) + { + this.deTargetService = deTargetService; + } + + private DeTargetDataValueService deTargetDataValueService; + + public void setDeTargetDataValueService( DeTargetDataValueService deTargetDataValueService ) + { + this.deTargetDataValueService = deTargetDataValueService; + } + + private OrganisationUnitGroupService organisationUnitGroupService; + + public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService ) + { + this.organisationUnitGroupService = organisationUnitGroupService; + } + + // --------------------------------------------------------------- + // Input & Output + // --------------------------------------------------------------- + + private SurveyChartResult surveyChartResult; + + public SurveyChartResult getSurveyChartResult() + { + return surveyChartResult; + } + + + private ListTool listTool; + + public ListTool getListTool() + { + return listTool; + } + + private String availableDataElements; + + public void setAvailableDataElements( String availableDataElements ) + { + this.availableDataElements = availableDataElements; + } + + private int ouIDTB; + + public void setOuIDTB( int ouIDTB ) + { + this.ouIDTB = ouIDTB; + } + + private int sDateLB; + + public void setSDateLB( int dateLB ) + { + sDateLB = dateLB; + } + + private int eDateLB; + + public void setEDateLB( int dateLB ) + { + eDateLB = dateLB; + } + + private String ougGroupSetCB; + + public void setOugGroupSetCB( String ougGroupSetCB ) + { + this.ougGroupSetCB = ougGroupSetCB; + } + + private Integer orgUnitGroupList; + + public void setOrgUnitGroupList( Integer orgUnitGroupList ) + { + this.orgUnitGroupList = orgUnitGroupList; + } + + private String selButton; + + public void setSelButton( String selButton ) + { + this.selButton = selButton; + } + + private List deTargetMemberList; + + private List monthlyPeriods; + + private OrganisationUnit selectedOrgUnit; + + private DataElement selectedDataElement; + + private DataElementCategoryOptionCombo selDECOptCombo; + + private Period startPeriod; + + private Period endPeriod; + + private String[] series1; + private String[] categories1; + private String[] series2; + private String[] categories2; + String chartTitle; + String xAxis_Title; + String yAxis_Title; + Double data1[][]; + Double data2[][]; + + public String execute() + throws Exception + { + statementManager.initialise(); + + listTool = new ListTool(); + + // OrgUnit Related Info + selectedOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB ); + + // Service Related Info + String[] partsOfDEandOptionCombo = availableDataElements.split(":"); + selectedDataElement = dataElementService.getDataElement( Integer.parseInt( partsOfDEandOptionCombo[0] ) ); + selDECOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( partsOfDEandOptionCombo[1] ) ); + + chartTitle = "Facility : " + selectedOrgUnit.getShortName(); + chartTitle += "\nDataElement : " + selectedDataElement.getName() + " " + selDECOptCombo.getName(); + + deTargetMemberList = new ArrayList( deTargetService.getDeTargetsByDataElementAndCategoryOptionCombo( selectedDataElement, selDECOptCombo ) ); + + // Period Related Info + startPeriod = periodService.getPeriod( sDateLB ); + endPeriod = periodService.getPeriod( eDateLB ); + + monthlyPeriods = new ArrayList( periodService.getPeriodsBetweenDates( new MonthlyPeriodType(), startPeriod.getStartDate(), endPeriod.getEndDate() ) ); + List yearlyPeriods = new ArrayList( periodService.getIntersectingPeriodsByPeriodType( new YearlyPeriodType(), startPeriod.getStartDate(), endPeriod.getEndDate() ) ); + + data1 = getServiceValuesByPeriod(); + + xAxis_Title = "Period"; + yAxis_Title = "DataElement"; + + if( deTargetMemberList == null || deTargetMemberList.size() <= 0 ) + { + data2 = new Double[1][monthlyPeriods.size()]; + series2 = new String[1]; + for ( int i = 0; i < data2.length; i++ ) + { + series2[i] = "No Targets"; + + for ( int j = 0; j < data2[i].length; j++ ) + { + data2[i][j] = 0.0; + } + } + } + else + { + data2 = new Double[deTargetMemberList.size()][monthlyPeriods.size()]; + series2 = new String[deTargetMemberList.size()]; + for ( int i = 0; i < data2.length; i++ ) + { + DeTargetMember deTargetMember = deTargetMemberList.get( i ); + DeTarget deTarget = deTargetMember.getDetarget(); + + Double deTargetAggVal = 0.0; + for( Period period : yearlyPeriods ) + { + Double deTargetAggValue = deTargetDataValueService.getAggregatedDeTargetDataValue( selectedOrgUnit, deTarget, period, selectedDataElement, selDECOptCombo ); + + if ( deTargetAggValue != null ) + { + deTargetAggVal += deTargetAggValue; + } + } + + deTargetAggVal = deTargetAggVal/ (12 * yearlyPeriods.size()); + + series2[i] = deTarget.getName(); + + for ( int j = 0; j < data2[i].length; j++ ) + { + if( selButton.equalsIgnoreCase( "VIEWCCHART" ) ) + { + deTargetAggVal = deTargetAggVal * (j+1); + } + + data2[i][j] = deTargetAggVal; + } + } + } + + surveyChartResult = new SurveyChartResult( series1, series2,categories1, categories2, data1, data2, null, null, chartTitle, xAxis_Title, yAxis_Title ); + + ActionContext ctx = ActionContext.getContext(); + HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST ); + + HttpSession session = req.getSession(); + session.setAttribute( "data1", data1 ); + session.setAttribute( "data2", data2 ); + session.setAttribute( "series1", series1 ); + session.setAttribute( "categories1", categories1 ); + session.setAttribute( "series2", series2 ); + session.setAttribute( "categories2", categories2 ); + session.setAttribute( "chartTitle", chartTitle ); + session.setAttribute( "xAxisTitle", xAxis_Title ); + session.setAttribute( "yAxisTitle", yAxis_Title ); + + statementManager.destroy(); + + return SUCCESS; + }// execute end + + public Double[][] getServiceValuesByPeriod() + { + Double[][] serviceValues = new Double[1][monthlyPeriods.size()]; + series1 = new String[1]; + categories1 = new String[monthlyPeriods.size()]; + categories2 = new String[monthlyPeriods.size()]; + + int countForServiceList = 0; + int countForPeriodList = 0; + Double aggDataValue = 0.0; + + series1[countForServiceList] = selectedDataElement.getName(); + + List orgUnitList = null; + if( ougGroupSetCB != null ) + { + OrganisationUnitGroup orgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( orgUnitGroupList ); + orgUnitList = new ArrayList( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId()) ); + orgUnitList.retainAll( orgUnitGroup.getMembers() ); + } + + Iterator periodListIterator = monthlyPeriods.iterator(); + while ( periodListIterator.hasNext() ) + { + aggDataValue = 0.0; + Period p = (Period) periodListIterator.next(); + + if( ougGroupSetCB != null ) + { + Double tempValue = 0.0; + for( OrganisationUnit orgUnit : orgUnitList ) + { + if( selButton.equalsIgnoreCase( "VIEWCCHART" ) ) + { + tempValue = aggregationService.getAggregatedDataValue( selectedDataElement, selDECOptCombo, startPeriod.getStartDate(), p.getEndDate(), orgUnit ); + } + else + { + tempValue = aggregationService.getAggregatedDataValue( selectedDataElement, selDECOptCombo, p.getStartDate(), p.getEndDate(), orgUnit ); + } + + if( tempValue != null ) aggDataValue += tempValue; + } + } + else + { + if( selButton.equalsIgnoreCase( "VIEWCCHART" ) ) + { + aggDataValue = aggregationService.getAggregatedDataValue( selectedDataElement, selDECOptCombo, startPeriod.getStartDate(), p.getEndDate(), selectedOrgUnit ); + } + else + { + aggDataValue = aggregationService.getAggregatedDataValue( selectedDataElement, selDECOptCombo, p.getStartDate(), p.getEndDate(), selectedOrgUnit ); + } + } + + if( aggDataValue == null ) aggDataValue = 0.0; + + serviceValues[countForServiceList][countForPeriodList] = aggDataValue; + + serviceValues[countForServiceList][countForPeriodList] = Math.round( serviceValues[countForServiceList][countForPeriodList] * Math.pow( 10, 2 ) ) / Math.pow( 10, 2 ); + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); + categories1[countForPeriodList] = simpleDateFormat.format( p.getStartDate() ); + categories2[countForPeriodList] = simpleDateFormat.format( p.getStartDate() ); + + countForPeriodList++; + }// periodList loop end + + return serviceValues; + }// getServiceValues method end + +} === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisFormAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisFormAction.java 2011-01-13 09:39:35 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisFormAction.java 2011-01-17 06:56:53 +0000 @@ -7,11 +7,9 @@ import java.util.Iterator; import java.util.List; -import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementGroup; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; -import org.hisp.dhis.dataelement.comparator.DataElementNameComparator; import org.hisp.dhis.organisationunit.OrganisationUnitGroup; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.period.MonthlyPeriodType; @@ -53,13 +51,6 @@ //Input/Output //-------------------------------------------------------------------------- - private List dataElements; - - public List getDataElements() - { - return dataElements; - } - private List dataElementGroups; public List getDataElementGroups() @@ -94,21 +85,7 @@ public String execute() { - dataElements = new ArrayList( dataElementService.getAllDataElements() ); - - // take only those dataElement which are VALUE_TYPE_INT and DOMAIN_TYPE_AGGREGATE - Iterator alldeIterator = dataElements.iterator(); - while ( alldeIterator.hasNext() ) - { - DataElement dataElement = alldeIterator.next(); - if ( !dataElement.getDomainType().equalsIgnoreCase( DataElement.DOMAIN_TYPE_AGGREGATE ) ) - { - alldeIterator.remove(); - } - } - dataElementGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); - Collections.sort( dataElements, new DataElementNameComparator() ); Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); orgUnitGroups = new ArrayList ( orgUnitGroupService.getAllOrganisationUnitGroups() ); @@ -130,5 +107,4 @@ return SUCCESS; } - } === 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 2011-01-13 09:39:35 +0000 +++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2011-01-17 06:56:53 +0000 @@ -510,28 +510,36 @@ - - - - - - - - - - - + + + - - - - - + + + + + + + + + + + + + + + + + === modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml' --- local/in/dhis-web-dashboard/src/main/resources/struts.xml 2011-01-13 09:39:35 +0000 +++ local/in/dhis-web-dashboard/src/main/resources/struts.xml 2011-01-17 06:56:53 +0000 @@ -332,6 +332,22 @@ plainTextError + + /popup.vm + /dhis-web-dashboard/deTargetAnalysisResult.vm + css/StylesForTags.css + + + + + application/vnd.ms-excel + inputStream + filename="${fileName}" + 1024 + + === added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/deTargetAnalysisResult.vm' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/deTargetAnalysisResult.vm 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/deTargetAnalysisResult.vm 2011-01-17 06:56:53 +0000 @@ -0,0 +1,47 @@ + + + + +
+ + + + + #foreach($xaxisvalue in $surveyChartResult.categories ) + + #end + + #set( $series = $surveyChartResult.series ) + #set( $targetNames = $surveyChartResult.series2 ) + #set( $count1 = 0 ) + #foreach( $onedataList in $surveyChartResult.data ) + #set( $oneTargetDataList = $listTool.get( $!surveyChartResult.data2, $count1 ) ) + + + #foreach( $data in $onedataList ) + + #end + + + + #foreach( $targetData in $!oneTargetDataList ) + + #end + + #set( $count1 = $count1 + 1 ) + #end +
DataElement$xaxisvalue
$listTool.get( $series, $count1 )$data
$listTool.get( $targetNames, $count1 )$targetData
+ +
+ +
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js 2011-01-13 09:39:35 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js 2011-01-17 06:56:53 +0000 @@ -1,44 +1,29 @@ + function formValidations() { - var orgUnitListCB = document.getElementById("orgUnitListCB"); - var selOUListLength = document.tabularAnalysisForm.orgUnitListCB.options.length; + var orgUnitGroupListCB = document.getElementById("orgUnitGroupList"); - sDateIndex = document.targetAnalysisForm.sDateLB.selectedIndex; - eDateIndex = document.targetAnalysisForm.eDateLB.selectedIndex; - sDateTxt = document.targetAnalysisForm.sDateLB.options[sDateIndex].text; + sDateIndex = document.getElementById("sDateLB").selectedIndex; + eDateIndex = document.getElementById("eDateLB").selectedIndex; + sDateTxt = document.getElementById("sDateLB").options[sDateIndex].text; sDate = formatDate(new Date(getDateFromFormat(sDateTxt,"MMM-y")),"yyyy-MM-dd"); - eDateTxt = document.targetAnalysisForm.eDateLB.options[eDateIndex].text; + eDateTxt = document.getElementById("eDateLB").options[eDateIndex].text; eDate = formatDate(new Date(getDateFromFormat(eDateTxt,"MMM-y")),"yyyy-MM-dd"); if(sDateIndex < 0) {alert("Please Select Starting Period");return false;} else if(eDateIndex < 0) {alert("Please Select Ending Period");return false;} else if(sDate > eDate) {alert("Starting Date is Greater");return false;} - orgUnitListCB.disabled = false; + var sWidth = 850; + var sHeight = 650; + var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100; + var TopPosition=(screen.height)?(screen.height-sHeight)/2:100; + + window.open('','chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes'); + return true; } // formValidations Function End -function deSelectionChangeFuntion( listId1, listId2 ) -{ - var list1 = document.getElementById( listId1 ); - var list2 = document.getElementById( listId2 ); - - clearList( list1 ); - - for(var i=list2.options.length-1; i >= 0; i--) - { - option = list2.options[ i ]; - var optValue = option.value; - var partsOfOptVal = new Array(); - partsOfOptVal = optValue.split(":"); - if(partsOfOptVal[0] == "D") - { - list2.remove( i ); - } - } - - getDataElements(); -} function getDataElements() { @@ -72,7 +57,7 @@ for ( var i = 0; i < dataElements.length; i++ ) { - var id = "D:"+dataElements[ i ].getElementsByTagName("id")[0].firstChild.nodeValue; + var id = dataElements[ i ].getElementsByTagName("id")[0].firstChild.nodeValue; var dataElementName = dataElements[ i ].getElementsByTagName("name")[0].firstChild.nodeValue; var option = document.createElement("option"); === modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForTarget.vm' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForTarget.vm 2011-01-13 09:39:35 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForTarget.vm 2011-01-17 06:56:53 +0000 @@ -18,8 +18,10 @@ function orgUnitHasBeenSelected( orgUnitIds ) { + document.getElementById("ouIDTB"). value = orgUnitIds; if(orgUnitIds == null || orgUnitIds == "" ) { + document.getElementById("ouNameTB"). value = ""; return; } if( orgUnitIds != null ) === 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-29 07:47:36 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/surveyAnalysisResult.vm 2011-01-17 06:56:53 +0000 @@ -4,7 +4,6 @@ var selectedOrgUnitId = $selectedOrgId; var selctedIndicatorId = $selectedIndicatorId; - //alert( selectedOrgUnitId ); //alert( selctedIndicatorId ); === modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.vm' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.vm 2011-01-13 09:39:35 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.vm 2011-01-17 06:56:53 +0000 @@ -1,25 +1,5 @@ - -
-
-

Target Analysis Form

-
+

-
+ - - - - - - - + - + - - + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$i18n.getString( "ga_filter_by_degroup" )
+
+ $i18n.getString( "ga_filter_by_degroup" )
-
  
  
$i18n.getString( "ga_available_delist" )
- +
+ $i18n.getString( "ga_available_delist" )
+
 
 
- $i18n.getString( "ga_from" )
- -
- $i18n.getString( "ga_to" )
- -
$i18n.getString( "nr_orgunit" )
- - -
$i18n.getString( "ga_orgUnitGroups" )
- -
   
- - - -
+   + + +   + + + + + + + + + + + + + + + + + + + +
+ $i18n.getString( "ga_orgUnitGroups" )
+ +
  + $i18n.getString( "ga_from" )
+ +

+ $i18n.getString( "ga_to" )
+ +

+ $i18n.getString( "nr_orgunit" )
+ + +
   
+ + +   + +
+ + +
- + + \ No newline at end of file