=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2013-05-19 08:24:25 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2013-05-23 16:04:26 +0000 @@ -87,6 +87,8 @@ private Boolean userOrganisationUnitChildren; private List filterValues = new ArrayList(); + + private Boolean displayOrgunitCode; // ------------------------------------------------------------------------- // Constructors @@ -225,4 +227,14 @@ this.programStage = programStage; } + public Boolean getDisplayOrgunitCode() + { + return displayOrgunitCode; + } + + public void setDisplayOrgunitCode( Boolean displayOrgunitCode ) + { + this.displayOrgunitCode = displayOrgunitCode; + } + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-04-22 06:06:16 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-05-23 16:04:26 +0000 @@ -91,11 +91,11 @@ Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, List columns, Collection organisationUnits, int level, Date startDate, Date endDate, boolean descOrder, - Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n ); + Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n ); int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage, List columns, Collection organisationUnits, int level, Boolean completed, - Date startDate, Date endDate ); + Boolean displayOrgunitCode, Date startDate, Date endDate ); List getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-04-22 06:06:16 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-05-23 16:04:26 +0000 @@ -85,11 +85,11 @@ Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, Map orgUnitLevelMap, Collection orgUnits, List columns, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder, - Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n ); + Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n ); int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage, List columns, Collection organisationUnits, int level, int maxLevel, - Date startDate, Date endDate, Boolean completed ); + Date startDate, Date endDate, Boolean completed, Boolean displayOrgunitCode ); void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit ); === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2013-04-22 06:06:16 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2013-05-23 16:04:26 +0000 @@ -178,23 +178,23 @@ public Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, List columns, Collection organisationUnits, int level, Date startDate, Date endDate, boolean descOrder, - Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n ) + Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n ) { int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels(); Map orgUnitLevelMap = organisationUnitService.getOrganisationUnitLevelMap(); return programStageInstanceStore.getTabularReport( anonynousEntryForm, programStage, orgUnitLevelMap, organisationUnits, columns, - level, maxLevel, startDate, endDate, descOrder, completed, accessPrivateInfo, min, max, i18n ); + level, maxLevel, startDate, endDate, descOrder, completed, accessPrivateInfo, displayOrgunitCode, min, max, i18n ); } public int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage, List columns, - Collection organisationUnits, int level, Boolean completed, Date startDate, Date endDate ) + Collection organisationUnits, int level, Boolean completed, Boolean displayOrgunitCode, Date startDate, Date endDate ) { int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels(); return programStageInstanceStore.getTabularReportCount( anonynousEntryForm, programStage, columns, organisationUnits, level, - maxLevel, startDate, endDate, completed ); + maxLevel, startDate, endDate, completed, displayOrgunitCode ); } public List getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n ) === 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-05-21 10:08:44 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-05-23 16:04:26 +0000 @@ -260,7 +260,7 @@ public Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, Map orgUnitLevelMap, Collection orgUnits, List columns, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder, - Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n ) + Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n ) { // --------------------------------------------------------------------- // Headers cols @@ -273,7 +273,7 @@ grid.addHeader( new GridHeader( "id", true, true ) ); grid.addHeader( new GridHeader( programStage.getReportDateDescription(), false, true ) ); - + if ( anonynousEntryForm == null || !anonynousEntryForm ) { for ( int i = level; i <= maxLevel; i++ ) @@ -282,6 +282,11 @@ grid.addHeader( new GridHeader( name, false, true ) ); } } + + if(displayOrgunitCode!=null && displayOrgunitCode) + { + grid.addHeader( new GridHeader( i18n.getString("orgunit_code"), false, true ) ); + } Collection deKeys = new HashSet(); for ( TabularReportColumn column : columns ) @@ -305,7 +310,7 @@ // --------------------------------------------------------------------- String sql = getTabularReportSql( anonynousEntryForm, false, programStage, columns, orgUnits, level, maxLevel, - startDate, endDate, descOrder, completed, accessPrivateInfo, min, max ); + startDate, endDate, descOrder, completed, accessPrivateInfo, displayOrgunitCode, min, max ); SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql ); @@ -346,10 +351,10 @@ public int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage, List columns, Collection organisationUnits, int level, int maxLevel, - Date startDate, Date endDate, Boolean completed ) + Date startDate, Date endDate, Boolean completed, Boolean displayOrgunitCode ) { String sql = getTabularReportSql( anonynousEntryForm, true, programStage, columns, organisationUnits, level, - maxLevel, startDate, endDate, false, completed, null, null, null ); + maxLevel, startDate, endDate, false, completed, null, displayOrgunitCode, null, null ); return jdbcTemplate.queryForObject( sql, Integer.class ); } @@ -883,7 +888,7 @@ private String getTabularReportSql( Boolean anonynousEntryForm, boolean count, ProgramStage programStage, List columns, Collection orgUnits, int level, int maxLevel, Date startDate, - Date endDate, boolean descOrder, Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max ) + Date endDate, boolean descOrder, Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max ) { Set deKeys = new HashSet(); String selector = count ? "count(*) " : "* "; @@ -900,7 +905,12 @@ + i + ","; } } - + + if( displayOrgunitCode!=null && displayOrgunitCode) + { + sql += "(select code from organisationunit where organisationunitid=psi.organisationunitid ) as code_,"; + } + for ( TabularReportColumn column : columns ) { if ( column.isFixedAttribute() ) === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2013-05-23 14:28:28 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2013-05-23 16:04:26 +0000 @@ -49,6 +49,8 @@ + + orgunits = new HashSet( organisationUnitService.getOrganisationUnits( orgunitIds ) ); - + ProgramStage programStage = programStageService.getProgramStage( programStageId ); // --------------------------------------------------------------------- @@ -211,6 +219,7 @@ tabularReport.setFacilityLB( facilityLB ); tabularReport.setSortedOrgunitAsc( orderByOrgunitAsc ); tabularReport.setUser( currentUserService.getCurrentUser() ); + tabularReport.setDisplayOrgunitCode( displayOrgunitCode ); if ( useCompletedEvents != null ) { @@ -226,5 +235,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-05-21 05:35:18 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-05-23 16:04:26 +0000 @@ -643,4 +643,7 @@ orgunit_group = Organisation unit group validation_rules_are_being_processed_please_wait = Validation rules are being processed please wait ... events = Events -list_events = List events \ No newline at end of file +list_events = List events +orgunit_code = Code +display_orgunit_code = Display orgunit code +hide = Hide \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-05-23 14:28:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-05-23 16:04:26 +0000 @@ -1092,6 +1092,7 @@ Ext.getCmp('userOrgunit').setValue( f.userOrganisationUnit ); Ext.getCmp('userOrgunitChildren').setValue( f.userOrganisationUnitChildren ); Ext.getCmp('completedEventsOpt').setValue(f.useCompletedEvents); + Ext.getCmp('displayOrgunitCode').setValue(f.displayOrgunitCode); // Orgunits @@ -1131,7 +1132,25 @@ storePatientProperty.load({params: {programId: f.programId}}); } } - + + // Program stage + + var storeProgramStage = TR.store.programStage; + storeProgramStage.parent = f.programStageId; + storeProgramStage.isLoadFromFavorite = true; + + TR.cmp.params.organisationunit.treepanel.getSelectionModel().deselectAll(); + + TR.store.programStage.removeAll(); + for (var i = 0; i < f.programStages.length; i++) + { + TR.store.programStage.add( + {'id': f.programStages[i].id,'name': f.programStages[i].name} + ); + } + Ext.getCmp('programStageCombobox').setValue( f.programStageId ); + + // Data element Ext.getCmp('filterPanel').removeAll(); @@ -1145,9 +1164,9 @@ var compulsory = f.dataElements[i].compulsory; var valueType = f.dataElements[i].valueType; TR.cmp.params.dataelement.objects.push({id: f.dataElements[i].id, name: name, compulsory: compulsory, valueType: valueType}); + TR.store.dataelement.selected.add({id: f.dataElements[i].id, name: name, compulsory: compulsory, valueType: valueType}); TR.util.multiselect.addFilterField( 'filterPanel', f.dataElements[i].id, name, valueType, f.dataElements[i].filter ); } - TR.store.dataelement.selected.add(TR.cmp.params.dataelement.objects); if( f.singleEvent == 'false' ) { @@ -1163,22 +1182,6 @@ } } - // Program stage - - var storeProgramStage = TR.store.programStage; - storeProgramStage.parent = f.programStageId; - storeProgramStage.isLoadFromFavorite = true; - - TR.cmp.params.organisationunit.treepanel.getSelectionModel().deselectAll(); - - TR.store.programStage.removeAll(); - for (var i = 0; i < f.programStages.length; i++) - { - TR.store.programStage.add( - {'id': f.programStages[i].id,'name': f.programStages[i].name} - ); - } - Ext.getCmp('programStageCombobox').setValue( f.programStageId ); TR.exe.execute(); @@ -1793,8 +1796,15 @@ { completedEvent = "&completedEventsOpt=true"; } + + var displayOrgunitCode=''; + if ( Ext.getCmp('displayOrgunitCode').getValue() == true ) + { + displayOrgunitCode = "&displayOrgunitCode=true"; + } + var exportForm = document.getElementById('exportForm'); - exportForm.action = url + "?type=" + type + completedEvent; + exportForm.action = url + "?type=" + type + completedEvent + displayOrgunitCode; exportForm.submit(); } // Show report on grid @@ -1864,6 +1874,11 @@ p.useCompletedEvents = Ext.getCmp('completedEventsOpt').getValue(); } + if( Ext.getCmp('displayOrgunitCode').getValue()== true ) + { + p.displayOrgunitCode = Ext.getCmp('displayOrgunitCode').getValue(); + } + // Get searching values p.filterValues = []; @@ -1975,8 +1990,8 @@ // Get searching values - var filterValues = document.getElementById('filterValues'); - TR.util.list.clearList(filterValues); + var filterValueList = document.getElementById('filterValues'); + TR.util.list.clearList(filterValueList); // Patient properties @@ -1989,11 +2004,24 @@ for(var idx=0;idx