=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetOrgUnitsAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetOrgUnitsAction.java 2010-11-03 09:17:15 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetOrgUnitsAction.java 2010-12-06 05:36:08 +0000 @@ -67,11 +67,15 @@ throws Exception { /* OrganisationUnit */ + + // System.out.println("org Id is : " + orgUnitId ); + if ( orgUnitId != null ) { orgUnit = organisationUnitService.getOrganisationUnit( orgUnitId ); } - + + System.out.println(" orgUnit Id is : " + orgUnit.getId() + " , orgUnit Name is : " + orgUnit.getName() ); orgUnitLevel = organisationUnitService.getLevelOfOrganisationUnit( orgUnit ); maxOrgUnitLevel = organisationUnitService.getNumberOfOrganisationalLevels(); === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java 2010-12-03 11:30:11 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java 2010-12-06 05:36:08 +0000 @@ -200,6 +200,21 @@ /* DataElements and Groups */ dataElements = new ArrayList( dataElementService.getAllDataElements() ); + + System.out.println(" dataElements size = "+dataElements.size()); + // take only those dataElement which are VALUE_TYPE_INT and DOMAIN_TYPE_AGGREGATE + Iterator alldeIterator = dataElements.iterator(); + while ( alldeIterator.hasNext() ) + { + DataElement de1 = alldeIterator.next(); + if ( !de1.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) && !de1.getType().equalsIgnoreCase( DataElement.DOMAIN_TYPE_AGGREGATE ) ) + { + alldeIterator.remove(); + } + } + System.out.println(" dataElements size = "+dataElements.size()); + // Collections.sort( dataElements, dataElementComparator ); + dataElementGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); Collections.sort( dataElements, new DataElementNameComparator() ); Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java 2010-12-03 11:30:11 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java 2010-12-06 05:36:08 +0000 @@ -626,6 +626,7 @@ } } + //Collections.sort( dataElementList, dataElementComparator ); selectedServiceList = new ArrayList( dataElementList ); @@ -848,9 +849,30 @@ int serviceCount = 0; + for( DataElement dataElement : dataElementList ) { DataElementCategoryOptionCombo decoc; + /* + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) && dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + System.out.println( " inside value type : - INT and Number Type : - INT" ); + System.out.println( " DataElementName : "+ dataElement.getName() ); + } + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) && !dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + System.out.println( " inside value type : - INT and Number Type : - other than INT" ); + System.out.println( " DataElementName : "+ dataElement.getName() ); + } + */ + // if( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + // { + // System.out.println( " DataElement VALUE_TYPE_INT is : " + DataElement.VALUE_TYPE_INT ); + // } + //else + // { + // System.out.println( " DataElementName : "+ dataElement.getName() +" , DataElement Value Type is : " + dataElement.getType() + ", DataElement Number Type is : " + dataElement.getNumberType() ); + // } if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) ) @@ -906,6 +928,17 @@ data[serviceCount][periodCount] = aggDataValue; + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 ); + } + else + { + data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 ); + } + } periodCount++; } @@ -966,7 +999,6 @@ int childCount = 0; for( OrganisationUnit orgChild : childOrgUnitList ) { - categories[childCount] = orgChild.getName(); Double aggDataValue = 0.0; @@ -980,7 +1012,6 @@ for( Period period : periods ) { - if( aggDataCB != null ) { Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgChild ); @@ -991,25 +1022,35 @@ } else { - DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc ); + DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc ); + + try + { + aggDataValue += Double.parseDouble( dataValue.getValue() ); + } + catch( Exception e ) + { - try - { - aggDataValue += Double.parseDouble( dataValue.getValue() ); - } - catch( Exception e ) - { - - } - + } } } periodCount++; } data[serviceCount][childCount] = aggDataValue; + + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 ); + } + else + { + data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 ); + } + } childCount++; - } serviceCount++; @@ -1081,7 +1122,6 @@ for( Period period : periods ) { - if( aggDataCB != null ) { Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgunit ); @@ -1092,24 +1132,34 @@ } else { - - DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period, decoc ); + DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period, decoc ); + + try + { + aggDataValue += Double.parseDouble( dataValue.getValue() ); + } + catch( Exception e ) + { - try - { - aggDataValue += Double.parseDouble( dataValue.getValue() ); - } - catch( Exception e ) - { - - } - + } } } periodCount++; } data[serviceCount][orgUnitCount] = aggDataValue; + + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 ); + } + else + { + data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 ); + } + } orgUnitCount++; } @@ -1191,26 +1241,35 @@ } else { - - DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc ); + DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc ); + + try + { + aggDataValue += Double.parseDouble( dataValue.getValue() ); + } + catch( Exception e ) + { - try - { - aggDataValue += Double.parseDouble( dataValue.getValue() ); - } - catch( Exception e ) - { - - } - + } } orgGroupCount++; } - } data[serviceCount][periodCount] = aggDataValue; + + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 ); + } + else + { + data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 ); + } + } periodCount++; } @@ -1300,7 +1359,6 @@ for( Period period : periods ) { - if( aggDataCB != null ) { Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgUnit ); @@ -1311,25 +1369,34 @@ } else { - DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc ); + DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc ); + + try + { + aggDataValue += Double.parseDouble( dataValue.getValue() ); + } + catch( Exception e ) + { - try - { - aggDataValue += Double.parseDouble( dataValue.getValue() ); - } - catch( Exception e ) - { - - } + } } - } periodCount++; } - } - data[serviceCount][orgGroupCount] = aggDataValue; + + if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) ) + { + data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 ); + } + else + { + data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 ); + } + } orgGroupCount++; } === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-12-03 11:30:11 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-12-06 05:36:08 +0000 @@ -766,13 +766,15 @@ } } + // rounding indicator value ,Numenetor,denumenetor data[serviceCount][periodCount] = aggIndicatorValue; - data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) ) - / Math.pow( 10, 1 ); + data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); numDataArray[serviceCount][periodCount] = aggIndicatorNumValue; + numDataArray[serviceCount][periodCount] = Math.round( numDataArray[serviceCount][periodCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + denumDataArray[serviceCount][periodCount] = aggIndicatorDenumValue; - + denumDataArray[serviceCount][periodCount] = Math.round( denumDataArray[serviceCount][periodCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); // numeratorValueList.add( aggIndicatorNumValue ); // denumeratorValueList.add( aggIndicatorDenumValue ); @@ -785,8 +787,7 @@ serviceCount++; } - indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray, - chartTitle, xAxis_Title, yAxis_Title ); + indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,chartTitle, xAxis_Title, yAxis_Title ); return indicatorChartResult; } @@ -914,13 +915,15 @@ { aggIndicatorValue = 0.0; } - + // rounding indicator value ,Numenetor,denumenetor data[serviceCount][childCount] = aggIndicatorValue; - data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 1 ) ) - / Math.pow( 10, 1 ); + data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); numDataArray[serviceCount][childCount] = aggIndicatorNumValue; + numDataArray[serviceCount][childCount] = Math.round( numDataArray[serviceCount][childCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + denumDataArray[serviceCount][childCount] = aggIndicatorDenumValue; + denumDataArray[serviceCount][childCount] = Math.round( denumDataArray[serviceCount][childCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); // data[serviceCount][childCount] = aggDataValue; childCount++; } @@ -928,8 +931,7 @@ serviceCount++; } - indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray, - chartTitle, xAxis_Title, yAxis_Title ); + indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray,chartTitle, xAxis_Title, yAxis_Title ); return indicatorChartResult; } @@ -1061,13 +1063,15 @@ { aggIndicatorValue = 0.0; } - + // rounding indicator value ,Numenetor,denumenetor data[serviceCount][orgUnitCount] = aggIndicatorValue; - data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) ) - / Math.pow( 10, 1 ); + data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); numDataArray[serviceCount][orgUnitCount] = aggIndicatorNumValue; + numDataArray[serviceCount][orgUnitCount] = Math.round( numDataArray[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + denumDataArray[serviceCount][orgUnitCount] = aggIndicatorDenumValue; + denumDataArray[serviceCount][orgUnitCount] = Math.round( denumDataArray[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); // data[serviceCount][orgUnitCount] = aggDataValue; orgUnitCount++; @@ -1077,8 +1081,7 @@ serviceCount++; } - indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray, - chartTitle, xAxis_Title, yAxis_Title ); + indicatorChartResult = new IndicatorChartResult( series, categories, data, numDataArray, denumDataArray, chartTitle, xAxis_Title, yAxis_Title ); return indicatorChartResult; } @@ -1210,13 +1213,16 @@ { aggIndicatorValue = 0.0; } - + // rounding indicator value ,Numenetor,denumenetor data[serviceCount][periodCount] = aggIndicatorValue; - data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) ) - / Math.pow( 10, 1 ); + data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); numDataArray[serviceCount][periodCount] = aggIndicatorNumValue; + numDataArray[serviceCount][periodCount] = Math.round( numDataArray[serviceCount][periodCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + denumDataArray[serviceCount][periodCount] = aggIndicatorDenumValue; + denumDataArray[serviceCount][periodCount] = Math.round( denumDataArray[serviceCount][periodCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + periodCount++; } @@ -1379,23 +1385,16 @@ { aggIndicatorValue = 0.0; } - + // rounding indicator value ,Numenetor,denumenetor data[serviceCount][orgGroupCount] = aggIndicatorValue; - - // System.out.println( - // " \nAgg Indicator Value Before Rounding : " + - // data[serviceCount][orgGroupCount] ); - - data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) ) - / Math.pow( 10, 1 ); - - // System.out.println( - // " \nAgg Indicator Value After Rounding : " + - // data[serviceCount][orgGroupCount] ); + data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); numDataArray[serviceCount][orgGroupCount] = aggIndicatorNumValue; + numDataArray[serviceCount][orgGroupCount] = Math.round( numDataArray[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + denumDataArray[serviceCount][orgGroupCount] = aggIndicatorDenumValue; - + denumDataArray[serviceCount][orgGroupCount] = Math.round( denumDataArray[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) )/ Math.pow( 10, 1 ); + orgGroupCount++; } === 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-03 11:30:11 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-12-06 05:36:08 +0000 @@ -1,8 +1,17 @@ -function getOUDeatilsForGADataElements(orgUnitIds) +function getOUDeatilsForGADataElements( orgUnitIds ) { + //alert( orgUnitIds ); document.getElementById( "ougGroupSetCB" ).disabled = false; document.getElementById( "orgUnitGroupList" ).disabled = false; + + var request = new Request(); + request.setResponseTypeXML( 'orgunit' ); + request.setCallbackSuccess( getOUDetailsForGARecevied ); + request.send( 'getOrgUnitDetails.action?orgUnitId=' + orgUnitIds ); + + + /* $.post("getOrgUnitDetails.action", { orgUnitId:orgUnitIds @@ -10,7 +19,7 @@ function (data) { getOUDetailsForGARecevied(data); - },'xml'); + },'xml');*/ } function getOUDetailsForGARecevied(xmlObject) @@ -32,7 +41,7 @@ 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" ) { index = document.ChartGenerationForm.orgUnitListCB.options.length; === modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.vm' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.vm 2010-11-02 11:35:05 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGADataElement.vm 2010-12-06 05:36:08 +0000 @@ -11,13 +11,15 @@ $i18n.getString( -#parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) - + +#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )