=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java 2013-01-22 06:42:20 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java 2013-01-29 14:45:08 +0000 @@ -70,6 +70,9 @@ public static final int POSITION_ROW_DATA_COLUMN_ORGUNIT = 10; // PIVOT FROM // 7 + public static final String AGGREGATE_TYPE_SUM = "sum"; + public static final String AGGREGATE_TYPE_AVG = "avg"; + public static final String SEPARATE_FILTER = "_"; private ProgramStage programStage; === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-01-26 07:07:27 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-01-29 14:45:08 +0000 @@ -722,7 +722,7 @@ { periodName = startDate + " -> " + endDate; } - + sql += " ( SELECT " + aggregateType + "(*) "; sql += "FROM programstageinstance psi_1 "; sql += " JOIN patientdatavalue pdv_1 "; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-01-29 14:13:32 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-01-29 14:45:08 +0000 @@ -128,6 +128,10 @@ element.replaceWith( searchTextBox ); autocompletedFilterField( container + " [id=searchText]" , jQuery(this_).val() ); } + else if( valueType== 'username' ) + { + autocompletedUsernameField(jQuery(this).attr('id')); + } else{ element.replaceWith( searchTextBox ); } @@ -195,6 +199,94 @@ }); } +function autocompletedUsernameField( idField ) +{ + var input = jQuery( "#" + idField ); + input.parent().width( input.width() + 200 ); + var dataElementId = input.attr('id').split('-')[1]; + + input.autocomplete({ + delay: 0, + minLength: 0, + source: function( request, response ){ + $.ajax({ + url: "getUsernameList.action?query=" + input.val(), + dataType: "json", + cache: true, + success: function(data) { + response($.map(data.usernames, function(item) { + return { + label: item.u, + id: item.u + }; + })); + } + }); + }, + minLength: 0, + select: function( event, ui ) { + var fieldValue = ui.item.value; + + if ( !dhis2.trigger.invoke( "caseentry-value-selected", [dataElementId, fieldValue] ) ) { + input.val( "" ); + return false; + } + + input.val( fieldValue ); + if ( !unSave ) { + saveVal( dataElementId ); + } + input.autocomplete( "close" ); + }, + change: function( event, ui ) { + if ( !ui.item ) { + var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ), + valid = false; + if ( !valid ) { + $( this ).val( "" ); + if(!unSave) + saveVal( dataElementId ); + input.data( "autocomplete" ).term = ""; + return false; + } + } + } + }) + .addClass( "ui-widget" ); + + input.data( "autocomplete" )._renderItem = function( ul, item ) { + return $( "
  • " ) + .data( "item.autocomplete", item ) + .append( "" + item.label + "" ) + .appendTo( ul ); + }; + + var wrapper = this.wrapper = $( "" ) + .addClass( "ui-combobox" ) + .insertAfter( input ); + + var button = $( "" ) + .attr( "tabIndex", -1 ) + .attr( "title", i18n_show_all_items ) + .appendTo( wrapper ) + .button({ + icons: { + primary: "ui-icon-triangle-1-s" + }, + text: false + }) + .addClass('small-button') + .click(function() { + if ( input.autocomplete( "widget" ).is( ":visible" ) ) { + input.autocomplete( "close" ); + return; + } + $( this ).blur(); + input.autocomplete( "search", "" ); + input.focus(); + }); +} + function removeAllAttributeOption() { jQuery( '#advancedSearchTB tbody tr' ).each( function( i, item ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-01-24 04:15:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-01-29 14:45:08 +0000 @@ -164,12 +164,12 @@ else if ( dataElementType == "username" ) { var displayName = dataElementName; - htmlCode = ""; + htmlCode = ""; } else { var displayName = dataElementName; - htmlCode += ""; + htmlCode = ""; } if( checkExisted( id ) )