dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20987
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9825: Put all param of case-based report into fields in form for downloading and Set title for grid.
------------------------------------------------------------
revno: 9825
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-18 20:12:14 +0700
message:
Put all param of case-based report into fields in form for downloading and Set title for grid.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
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/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
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/index.html
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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-02-13 15:16:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-02-18 13:12:14 +0000
@@ -91,7 +91,7 @@
Grid getTabularReport( ProgramStage programStage, List<TabularReportColumn> columns,
Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder,
- Boolean completed, Integer min, Integer max );
+ Boolean completed, Integer min, Integer max, I18n i18n );
int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
Collection<Integer> organisationUnits, int level, Boolean completed, Date startDate, Date endDate );
=== 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-02-13 15:16:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-02-18 13:12:14 +0000
@@ -84,7 +84,7 @@
Grid getTabularReport( ProgramStage programStage, Map<Integer, OrganisationUnitLevel> orgUnitLevelMap,
Collection<Integer> orgUnits, List<TabularReportColumn> columns, int level, int maxLevel, Date startDate,
- Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max );
+ Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max, I18n i18n );
int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
Collection<Integer> organisationUnits, int level, int maxLevel, Date startDate, Date endDate, Boolean completed );
=== 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-02-13 15:16:11 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2013-02-18 13:12:14 +0000
@@ -178,14 +178,14 @@
public Grid getTabularReport( ProgramStage programStage, List<TabularReportColumn> columns,
Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder,
- Boolean completed, Integer min, Integer max )
+ Boolean completed, Integer min, Integer max, I18n i18n )
{
int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
Map<Integer, OrganisationUnitLevel> orgUnitLevelMap = organisationUnitService.getOrganisationUnitLevelMap();
return programStageInstanceStore.getTabularReport( programStage, orgUnitLevelMap, organisationUnits, columns,
- level, maxLevel, startDate, endDate, descOrder, completed, min, max );
+ level, maxLevel, startDate, endDate, descOrder, completed, min, max, i18n );
}
public int getTabularReportCount( ProgramStage programStage, List<TabularReportColumn> columns,
@@ -288,8 +288,8 @@
{
Grid grid = new ListGrid();
- grid.setTitle( program.getDisplayName() + " ( " + format.formatDate( startDate ) + " - " + format.formatDate( endDate )
- + " )" );
+ grid.setTitle( program.getDisplayName() + " ( " + format.formatDate( startDate ) + " - "
+ + format.formatDate( endDate ) + " )" );
int total = programInstanceService.countProgramInstances( program, orgunitIds, startDate, endDate );
grid.setSubtitle( i18n.getString( "total_persons_enrolled" ) + ": " + total );
@@ -347,11 +347,12 @@
@Override
public Grid getAggregateReport( int position, ProgramStage programStage, Collection<Integer> orgunitIds,
- String facilityLB, Integer deGroupBy, Integer deSum, Map<Integer, Collection<String>> deFilters, List<Period> periods,
- String aggregateType, Integer limit, Boolean useCompletedEvents, I18nFormat format, I18n i18n )
+ String facilityLB, Integer deGroupBy, Integer deSum, Map<Integer, Collection<String>> deFilters,
+ List<Period> periods, String aggregateType, Integer limit, Boolean useCompletedEvents, I18nFormat format,
+ I18n i18n )
{
- return programStageInstanceStore.getAggregateReport( position, programStage, orgunitIds, facilityLB,
- deGroupBy, deSum, deFilters, periods, aggregateType, limit, useCompletedEvents, format, i18n );
+ return programStageInstanceStore.getAggregateReport( position, programStage, orgunitIds, facilityLB, deGroupBy,
+ deSum, deFilters, periods, aggregateType, limit, useCompletedEvents, format, 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-02-15 12:08:07 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-02-18 13:12:14 +0000
@@ -221,13 +221,16 @@
public Grid getTabularReport( ProgramStage programStage, Map<Integer, OrganisationUnitLevel> orgUnitLevelMap,
Collection<Integer> orgUnits, List<TabularReportColumn> columns, int level, int maxLevel, Date startDate,
- Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max )
+ Date endDate, boolean descOrder, Boolean completed, Integer min, Integer max, I18n i18n )
{
// ---------------------------------------------------------------------
// Headers cols
// ---------------------------------------------------------------------
Grid grid = new ListGrid();
+ grid.setTitle( programStage.getDisplayName() );
+ grid.setSubtitle( i18n.getString( "from" ) + " " + DateUtils.getMediumDateString( startDate ) + " "
+ + i18n.getString( "to" ) + " " + DateUtils.getMediumDateString( endDate ) );
grid.addHeader( new GridHeader( "id", true, true ) );
grid.addHeader( new GridHeader( programStage.getReportDateDescription(), false, true ) );
@@ -1127,7 +1130,7 @@
}
dataValueSql = dataValueSql.substring( 0, dataValueSql.length() - 3 );
dataValueSql += ") ORDER BY value asc";
-
+
Collection<String> deValues = new HashSet<String>();
try
{
@@ -1524,7 +1527,8 @@
}
else
{
- sql += "( SELECT " + aggregateType + "( cast( value as " + statementBuilder.getDoubleColumnType() + " ))";
+ sql += "( SELECT " + aggregateType + "( cast( value as " + statementBuilder.getDoubleColumnType()
+ + " ))";
sql += " FROM patientdatavalue where dataelementid=pdv_1.dataelementid and dataelementid="
+ deSum + " ";
}
@@ -1544,7 +1548,7 @@
{
sql += " AND psi_1.completed = true ";
}
-
+
sql += ") as \"" + periodName + "\",";
}
sql = sql.substring( 0, sql.length() - 1 );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-12-07 11:41:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2013-02-18 13:12:14 +0000
@@ -195,9 +195,9 @@
{
this.format = format;
}
-
+
private Boolean completed;
-
+
public void setCompleted( Boolean completed )
{
this.completed = completed;
@@ -267,8 +267,8 @@
for ( Integer orgunitId : orgunitIds )
{
OrganisationUnit selectedOrgunit = organisationUnitService.getOrganisationUnit( orgunitId );
- organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren(
- orgunitId) );
+ organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
+ .getChildren( orgunitId ) );
organisationUnits.remove( selectedOrgunit );
}
}
@@ -329,15 +329,15 @@
total = getNumberOfPages( totalRecords );
this.paging = createPaging( totalRecords );
-
+
grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
- startValue, endValue, !orderByOrgunitAsc, completed, getStartPos(), paging.getPageSize() );
+ startValue, endValue, !orderByOrgunitAsc, completed, getStartPos(), paging.getPageSize(), i18n );
}
else
// Download as Excel
{
grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
- startValue, endValue, !orderByOrgunitAsc, completed, null, null );
+ startValue, endValue, !orderByOrgunitAsc, completed, null, null, i18n );
}
}
catch ( SQLGrammarException ex )
=== 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-02-15 12:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-02-18 13:12:14 +0000
@@ -1486,9 +1486,10 @@
getURLParams: function( type, isSorted ){
if(Ext.getCmp('reportTypeGroup').getValue().reportType=='true')
{
- return this.caseBasedReport.getURLParams( type, isSorted );
+ this.caseBasedReport.getURLParams( type, isSorted );
+ return;
}
- return this.aggregateReport.getURLParams( type );
+ this.aggregateReport.getURLParams( type );
},
paramChanged: function() {
if(Ext.getCmp('reportTypeGroup').getValue().reportType=='true')
@@ -1510,7 +1511,10 @@
// Export to XLS
if( type)
{
- window.location.href = url + "?type=" + type + "&" + TR.state.caseBasedReport.getURLParams( isSorted );
+ TR.state.caseBasedReport.getURLParams();
+ var exportForm = document.getElementById('exportForm');
+ exportForm.action = url + "?type=" + type;
+ exportForm.submit();
}
// Show report on grid
else
@@ -1624,27 +1628,25 @@
return p;
},
getURLParams: function( isSorted ) {
- var p = "";
-
- p += "startDate=" + TR.cmp.settings.startDate.rawValue;
- p += "&endDate=" + TR.cmp.settings.endDate.rawValue;
- p += "&facilityLB=" + TR.cmp.settings.facilityLB.getValue();
- p += "&level=" + Ext.getCmp('levelCombobox').getValue();
-
- // orders
- p += "&orderByOrgunitAsc=" + this.orderByOrgunitAsc;
- p += "&orderByExecutionDateByAsc=" + this.orderByExecutionDateByAsc;
-
- p += "&programStageId=" + TR.cmp.params.programStage.getValue();
- p += "¤tPage=" + this.currentPage;
-
- // organisation unit
- for( var i=0; i<TR.state.orgunitIds.length; i++ )
- {
- p += "&orgunitIds=" + TR.state.orgunitIds[i];
+
+ document.getElementById('startDate').value = TR.cmp.settings.startDate.rawValue;
+ document.getElementById('endDate').value = TR.cmp.settings.endDate.rawValue;
+ document.getElementById('facilityLB').value = TR.cmp.settings.facilityLB.getValue();
+ document.getElementById('level').value = Ext.getCmp('levelCombobox').getValue();
+ document.getElementById('orderByOrgunitAsc').value = this.orderByOrgunitAsc;
+ document.getElementById('orderByExecutionDateByAsc').value = this.orderByExecutionDateByAsc;
+ document.getElementById('programStageId').value = TR.cmp.params.programStage.getValue();
+
+ // orgunits
+ var orgunitIdList = document.getElementById('orgunitIds');
+ TR.util.list.clearList(orgunitIdList);
+ for( var i in TR.state.orgunitIds){
+ TR.util.list.addOptionToList(orgunitIdList, TR.state.orgunitIds[i], '');
}
// Get searching values
+ var searchingValues = document.getElementById('searchingValues');
+ TR.util.list.clearList(searchingValues);
if( !TR.state.caseBasedReport.isParamChanged() || isSorted )
{
var cols = TR.datatable.datatable.columns;
@@ -1655,7 +1657,7 @@
{
var params = TR.state.getFilterValueByColumn(col.name);
for(var i in params){
- p += "&searchingValues=" + params[i];
+ TR.util.list.addOptionToList(startDateList, params[i], '');
}
}
}
@@ -1664,11 +1666,9 @@
{
// Data elements
TR.cmp.params.dataelement.selected.store.each( function(r) {
- p += "&searchingValues=" + r.data.id + '_false_';
+ TR.util.list.addOptionToList(searchingValues, r.data.id + '_false_', '');
});
}
-
- return p;
},
getFilterValueByColumn: function( colname ) {
var grid = TR.datatable.datatable;
@@ -1857,9 +1857,6 @@
}
TR.util.notification.ok();
},
- filter: function() {
-
- },
getPosition: function() {
// 1 - Rows
// 2 - Columns
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/index.html'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/index.html 2013-01-30 07:54:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/index.html 2013-02-18 13:12:14 +0000
@@ -23,6 +23,12 @@
<input type="hidden" id="useCompletedEvents" name="useCompletedEvents" >
<input type="hidden" id="deSum" name="deSum" >
<select multiple id="startDates" name="startDates" class="hidden"></select>
+ <input type="hidden" id="startDate" name="startDate" >
+ <input type="hidden" id="endDate" name="endDate" >
+ <input type="hidden" id="level" name="level" >
+ <input type="hidden" id="orderByOrgunitAsc" name="orderByOrgunitAsc" >
+ <input type="hidden" id="orderByExecutionDateByAsc" name="orderByExecutionDateByAsc" >
+ <select multiple id="searchingValues" name="searchingValues" class="hidden"></select>
</form>
<script type="text/javascript">TR = {};</script>