dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27764
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13823: PBF Quality Max Validation
------------------------------------------------------------
revno: 13823
committer: Samta Bajpayee<samta-bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-23 12:25:55 +0000
message:
PBF Quality Max Validation
removed:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitAction.java
added:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForScoreAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityScoreInitAction.java
modified:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java
local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityScoreDataEntry.js
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityMaxEntrySelection.vm
--
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 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java 2014-01-23 12:25:55 +0000
@@ -77,6 +77,7 @@
public String execute() throws Exception
{
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+ //organisationUnit.get
dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
=== removed file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitAction.java 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitAction.java 1970-01-01 00:00:00 +0000
@@ -1,119 +0,0 @@
-package org.hisp.dhis.pbf.quality.dataentry;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.pbf.api.Lookup;
-import org.hisp.dhis.pbf.api.LookupService;
-
-import com.opensymphony.xwork2.Action;
-
-public class GetOrganisationUnitAction implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private LookupService lookupService;
-
- public void setLookupService( LookupService lookupService )
- {
- this.lookupService = lookupService;
- }
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
-
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
- private String orgUnitId;
-
- public String getOrgUnitId()
- {
- return orgUnitId;
- }
-
- public void setOrgUnitId( String orgUnitId )
- {
- this.orgUnitId = orgUnitId;
- }
-
- private List<DataSet> dataSets = new ArrayList<DataSet>();
-
- public List<DataSet> getDataSets()
- {
- return dataSets;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute() throws Exception
- {
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-
- dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
-
- List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
-
- List<DataSet> pbfDataSets = new ArrayList<DataSet>();
-
- for( Lookup lookup : lookups )
- {
- Integer dataSetId = Integer.parseInt( lookup.getValue() );
-
- DataSet dataSet = dataSetService.getDataSet( dataSetId );
- if( dataSet != null )
- {
- pbfDataSets.add(dataSet);
-
- }
- }
-
- dataSets.retainAll( pbfDataSets );
- Collections.sort(dataSets);
-
-
- System.out.println( dataSets.size() );
- if ( dataSets.size() > 0 )
- {
- message = organisationUnit.getName();
- return SUCCESS;
-
- }
- else
- {
- message = organisationUnit.getName();
-
- return INPUT;
- }
-
- }
-
-}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java 2014-01-23 12:25:55 +0000
@@ -0,0 +1,126 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetOrganisationUnitForMaxAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private String orgUnitId;
+
+ public String getOrgUnitId()
+ {
+ return orgUnitId;
+ }
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private List<DataSet> dataSets = new ArrayList<DataSet>();
+
+ public List<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+
+ List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren(organisationUnit.getId()) ) ;
+ for (OrganisationUnit org : organisationUnitList)
+ {
+ if(!dataSets.containsAll(org.getDataSets()))
+ {
+ dataSets.addAll(org.getDataSets());
+ }
+ }
+
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
+
+ List<DataSet> pbfDataSets = new ArrayList<DataSet>();
+
+ for( Lookup lookup : lookups )
+ {
+ Integer dataSetId = Integer.parseInt( lookup.getValue() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+ if( dataSet != null )
+ {
+ pbfDataSets.add(dataSet);
+
+ }
+ }
+
+ dataSets.retainAll( pbfDataSets );
+ Collections.sort(dataSets);
+
+
+ System.out.println( dataSets.size() );
+ if ( dataSets.size() > 0 )
+ {
+ message = organisationUnit.getName();
+ return SUCCESS;
+
+ }
+ else
+ {
+ message = organisationUnit.getName();
+
+ return INPUT;
+ }
+
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForScoreAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForScoreAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForScoreAction.java 2014-01-23 12:25:55 +0000
@@ -0,0 +1,127 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetOrganisationUnitForScoreAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private String orgUnitId;
+
+ public String getOrgUnitId()
+ {
+ return orgUnitId;
+ }
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private List<DataSet> dataSets = new ArrayList<DataSet>();
+
+ public List<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+
+ /* List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren(organisationUnit.getId()) ) ;
+ for (OrganisationUnit org : organisationUnitList)
+ {
+ if(!dataSets.containsAll(org.getDataSets()))
+ {
+ dataSets.addAll(org.getDataSets());
+ }
+ }
+ */
+ dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
+
+ List<DataSet> pbfDataSets = new ArrayList<DataSet>();
+
+ for( Lookup lookup : lookups )
+ {
+ Integer dataSetId = Integer.parseInt( lookup.getValue() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+ if( dataSet != null )
+ {
+ pbfDataSets.add(dataSet);
+
+ }
+ }
+
+ dataSets.retainAll( pbfDataSets );
+ Collections.sort(dataSets);
+
+
+ System.out.println( dataSets.size() );
+ if ( dataSets.size() > 0 )
+ {
+ message = organisationUnit.getName();
+ return SUCCESS;
+
+ }
+ else
+ {
+ message = organisationUnit.getName();
+
+ return INPUT;
+ }
+
+ }
+
+}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java 2014-01-23 12:25:55 +0000
@@ -43,7 +43,7 @@
public class LoadQualityScoreDetailsAction
implements Action
{
-
+ private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
// -------------------------------------------------------------------------
// Dependencies
@@ -154,7 +154,18 @@
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
Period period = PeriodType.getPeriodFromIsoString( selectedPeriodId );
-
+ Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
+ int tariff_setting_authority = 0;
+ if ( tariff_authority == null )
+ {
+ tariff_setting_authority = 1;
+
+ }
+ else
+ {
+ tariff_setting_authority = (int) tariff_authority.getValue();
+
+ }
Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
@@ -176,8 +187,11 @@
for(DataElement dataElement : dataElements)
{
List<QualityMaxValue> qualityMaxValues = new ArrayList<QualityMaxValue>();
-
- qualityMaxValues = new ArrayList<QualityMaxValue>(qualityMaxValueService.getQuanlityMaxValues(organisationUnit, dataElement)) ;
+ OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
+ if( parentOrgunit != null )
+ {
+ qualityMaxValues = new ArrayList<QualityMaxValue>(qualityMaxValueService.getQuanlityMaxValues(parentOrgunit, dataElement)) ;
+ }
DataValue dataValue = dataValueService.getDataValue(dataElement, period, organisationUnit, optionCombo);
for (QualityMaxValue qualityMaxValue : qualityMaxValues)
{
@@ -198,4 +212,16 @@
Collections.sort(dataElements);
return SUCCESS;
}
+ public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
+ {
+ Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
+ if( tariffOULevel == ouLevel )
+ {
+ return organisationUnit;
+ }
+ else
+ {
+ return findParentOrgunitforTariff( organisationUnit.getParent(), tariffOULevel );
+ }
+ }
}
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java 2014-01-23 12:25:55 +0000
@@ -4,6 +4,8 @@
import java.util.Collections;
import java.util.List;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -19,6 +21,7 @@
*/
public class QualityMaxInitAction implements Action
{
+ private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -51,7 +54,12 @@
this.dataSetService = dataSetService;
}
-
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
@@ -76,7 +84,19 @@
{
return dataSets;
}
-
+ private String tariff_setting_authority;
+
+ public String getTariff_setting_authority()
+ {
+ return tariff_setting_authority;
+ }
+
+ private List<String> levelOrgUnitIds = new ArrayList<String>();
+
+ public List<String> getLevelOrgUnitIds()
+ {
+ return levelOrgUnitIds;
+ }
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -84,7 +104,26 @@
public String execute() throws Exception
{
//selectionManager.clearSelectedOrganisationUnits();
-
+ Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
+
+ if ( tariff_authority == null )
+ {
+ tariff_setting_authority = "Level 1";
+ List<OrganisationUnit> allLevelOrg = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) );
+ for ( OrganisationUnit org : allLevelOrg )
+ {
+ levelOrgUnitIds.add( "\"" + org.getUid() + "\"" );
+ }
+ }
+ else
+ {
+ tariff_setting_authority = "Level " + (int) tariff_authority.getValue();
+ List<OrganisationUnit> allLevelOrg = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( (int) tariff_authority.getValue() ) );
+ for ( OrganisationUnit org : allLevelOrg )
+ {
+ levelOrgUnitIds.add( "\"" + org.getUid() + "\"" );
+ }
+ }
organisationUnit = selectionManager.getSelectedOrganisationUnit();
if( organisationUnit == null )
@@ -101,8 +140,15 @@
organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
}
-
- dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
+ List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getLeafOrganisationUnits(organisationUnit.getId()) ) ;
+ for (OrganisationUnit org : organisationUnitList)
+ {
+ if(!dataSets.containsAll(org.getDataSets()))
+ {
+ dataSets.addAll(org.getDataSets());
+ }
+ }
+ // dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityScoreInitAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityScoreInitAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityScoreInitAction.java 2014-01-23 12:25:55 +0000
@@ -0,0 +1,150 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class QualityScoreInitAction implements Action
+{
+ private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitSelectionManager selectionManager;
+
+ public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private List<DataSet> dataSets = new ArrayList<DataSet>();
+
+ public List<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+ private String tariff_setting_authority;
+
+ public String getTariff_setting_authority()
+ {
+ return tariff_setting_authority;
+ }
+
+ private List<String> levelOrgUnitIds = new ArrayList<String>();
+
+ public List<String> getLevelOrgUnitIds()
+ {
+ return levelOrgUnitIds;
+ }
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ //selectionManager.clearSelectedOrganisationUnits();
+
+ organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+ if( organisationUnit == null )
+ {
+ System.out.println("Organisationunit is null");
+ }
+ else
+ {
+ System.out.println("Organisationunit is not null ---" + organisationUnit.getId() );
+ }
+
+ if( organisationUnit == null && orgUnitId != null )
+ {
+ organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+
+ }
+ // List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getLeafOrganisationUnits(organisationUnit.getId()) ) ;
+
+ dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
+
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
+
+ List<DataSet> pbfDataSets = new ArrayList<DataSet>();
+
+ for( Lookup lookup : lookups )
+ {
+ Integer dataSetId = Integer.parseInt( lookup.getValue() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+ if( dataSet != null )
+ {
+ pbfDataSets.add(dataSet);
+
+ }
+ }
+
+ dataSets.retainAll( pbfDataSets );
+ Collections.sort(dataSets);
+ return SUCCESS;
+ }
+}
+
+
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java 2014-01-22 11:29:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java 2014-01-23 12:25:55 +0000
@@ -98,9 +98,9 @@
return qualityMaxValueMap;
}
- private String message;
+ private boolean message = false;
- public String getMessage()
+ public boolean getMessage()
{
return message;
}
@@ -123,16 +123,31 @@
qualityMaxValueService.getQuanlityMaxValues( organisationUnit, dataSet ) );
for ( QualityMaxValue qualityMaxValue : qualityMaxValues )
{
- if ( qualityMaxValue.getStartDate().getTime() <= sDate.getTime() && qualityMaxValue.getEndDate().getTime() >= eDate.getTime() )
+ if ( qualityMaxValue.getStartDate().getTime() == sDate.getTime() && qualityMaxValue.getEndDate().getTime() == eDate.getTime() )
{
- message = "true";
- break;
- }
+ message = message && false;
+ }
+ else if (qualityMaxValue.getStartDate().before(sDate) && qualityMaxValue.getEndDate().after(eDate) )
+ {
+ message = message || true;
+ //System.out.println("Start date is less and end date is greater or equal "+message);
+ }
+ else if (qualityMaxValue.getStartDate().getTime() > sDate.getTime() && qualityMaxValue.getEndDate().getTime() <= eDate.getTime() )
+ {
+ message = message || true;
+ //System.out.println("Start date is less and end date is greater or equal "+message);
+ }
+ else if (qualityMaxValue.getStartDate().getTime() <= sDate.getTime() && qualityMaxValue.getEndDate().getTime() > eDate.getTime() )
+ {
+ message = message || true;
+ //System.out.println("Start date is greater than and end date in less "+message);
+ }
else
{
- message = "false";
+ message = message && false;
}
}
+ //System.out.println("Message: "+message);
return SUCCESS;
}
}
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2014-01-22 11:29:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2014-01-23 12:25:55 +0000
@@ -180,7 +180,7 @@
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
- <bean id="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitAction" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitAction" scope="prototype">
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitForMaxAction" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitForMaxAction" scope="prototype">
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
@@ -190,7 +190,8 @@
<property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
</bean>
<bean id="org.hisp.dhis.pbf.quality.dataentry.LoadQualityMaxDetailsAction" class="org.hisp.dhis.pbf.quality.dataentry.LoadQualityMaxDetailsAction" scope="prototype">
@@ -213,6 +214,20 @@
<!-- Quality Score Data Entry -->
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitForScoreAction" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitForScoreAction" scope="prototype">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.QualityScoreInitAction" class="org.hisp.dhis.pbf.quality.dataentry.QualityScoreInitAction" scope="prototype">
+ <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+ </bean>
+
<bean id="org.hisp.dhis.pbf.quality.dataentry.LoadQualityScoreDetailsAction" class="org.hisp.dhis.pbf.quality.dataentry.LoadQualityScoreDetailsAction" scope="prototype">
<property name="qualityMaxValueService" ref="org.hisp.dhis.pbf.api.QualityMaxValueService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2014-01-22 11:29:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2014-01-23 12:25:55 +0000
@@ -116,7 +116,7 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="getOrganisationUnitForQuality" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitAction">
+ <action name="getOrganisationUnitForMax" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitForMaxAction">
<result name="success" type="velocity-json">/dhis-web-maintenance-pbf/jsonResponseSuccess.vm</result>
<result name="input" type="velocity-json">/dhis-web-maintenance-pbf/jsonResponseInput.vm</result>
</action>
@@ -145,7 +145,12 @@
</action>
<!-- Quality Score Data Entry -->
- <action name="qualityScoreDataEntry" class="org.hisp.dhis.pbf.quality.dataentry.QualityMaxInitAction">
+ <action name="getOrganisationUnitForScore" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitForScoreAction">
+ <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-maintenance-pbf/jsonResponseInput.vm</result>
+ </action>
+
+ <action name="qualityScoreDataEntry" class="org.hisp.dhis.pbf.quality.dataentry.QualityScoreInitAction">
<interceptor-ref name="organisationUnitTreeStack" />
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-pbf/qualityScoreEntrySelection.vm</param>
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm 2014-01-23 12:25:55 +0000
@@ -29,9 +29,47 @@
enableColumnMove: true,
enableColumnResize: true,
sortOnLoad: true,
- width: 900,
+ width: tableWidth,
height: 360,
- sorters: {direction: 'ASC'}
+ sorters: {direction: 'ASC'},
+ autoCreateViewPort:false,
+ renderTo: Ext.Element.get('#bankDetailTable'),
+ layout: {
+ type: 'hbox',
+ align: 'stretch'
+ },
+ columns: [
+ {
+ text : 'PBF Type',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Bank',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Branch Name',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Account Name',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Account Number',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Operations',
+ width : columnWidth,
+ sortable : false
+ }
+ ]
});
grid.render();
@@ -181,7 +219,8 @@
<input type="button" value="Add New Bank Detail" style="float:right;" id="openAddBankDetail" />
</div>
<br/><br/>
-<table style="width:100%" id="bankDetails" cellspacing="0">
+<div style="width:100%;" id="bankDetailTable">
+<table id="bankDetails" cellspacing="0">
<thead >
<tr >
<th >PBF Type</th>
@@ -222,7 +261,7 @@
#end
</tbody>
</table>
-
+</div>
<div id="addBankDetail" title="Add New Bank Detail">
<table style="width:100%;table-layout:fixed;">
<tr >
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js 2014-01-22 11:29:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js 2014-01-23 12:25:55 +0000
@@ -6,15 +6,33 @@
var COLOR_WHITE = '#ffffff';
var COLOR_GREY = '#cccccc';
var LocaleColor = 'black';
+ var countryTags;
function orgUnitHasBeenSelected( orgUnitIds )
-{
+{
$( '#dataEntryFormDiv' ).html( '' );
-
+ var bValue = false;
+ for(var i=0;i<=countryTags.length-1;i++)
+ {
+ if(countryTags[i] == orgUnitIds[0] )
+ {
+ bValue = true;
+ }
+ }
+ if(bValue == false)
+ {
+ disable('dataSetId');
+ disable('selectedPeriodId');
+ disable('startDate');
+ disable('endDate');
+ alert('Please Select Correct level OrgUnit');
+ }
+ else
+ {
if( orgUnitIds != null && orgUnitIds != "" )
{
var dataSetId = $( '#dataSetId' ).val();
- $.getJSON( 'getOrganisationUnitForQuality.action', {orgUnitId:orgUnitIds[0]}
+ $.getJSON( 'getOrganisationUnitForMax.action', {orgUnitId:orgUnitIds[0]}
, function( json )
{
var type = json.response;
@@ -23,7 +41,8 @@
if( type == "success" )
{
enable('dataSetId');
-
+ enable('startDate');
+ enable('endDate');
var options = '';
$.each(json.dataSets, function(i, obj){
options += '<option value="' + obj.id + '"'+ '>' + obj.name + '</option>';
@@ -41,14 +60,15 @@
{
disable('dataSetId');
disable('selectedPeriodId');
- disable('prevButton');
- disable('nextButton');
+ disable('startDate');
+ disable('endDate');
setFieldValue('orgUnitName', json.message );
setFieldValue('selectedOrgunitName', json.message );
}
} );
}
+ }
}
selection.setListenerFunction( orgUnitHasBeenSelected );
@@ -70,7 +90,7 @@
}
if(startDate != "" && endDate != "")
{
- /* var dataValue = {
+ var dataValue = {
'orgUnitId' : orgUnitId,
'startDate' : startDate,
'endDate' : endDate,
@@ -83,23 +103,11 @@
success: handleSuccess,
error: handleError
} );
- */
- jQuery('#loaderDiv').show();
- jQuery('#dataEntryFormDiv').load('loadQualityMaxForm.action',
- {
- orgUnitId:orgUnitId,
- dataSetId:dataSetId,
- startDate:startDate,
- endDate:endDate
- }, function()
- {
- showById('dataEntryFormDiv');
- jQuery('#loaderDiv').hide();
- });
- hideLoader();
+
+
}
-/* function handleSuccess( json )
+ function handleSuccess( json )
{
if(json.message == "true")
{
@@ -126,7 +134,7 @@
{
alert("Error!");
}
- */
+
}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityScoreDataEntry.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityScoreDataEntry.js 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityScoreDataEntry.js 2014-01-23 12:25:55 +0000
@@ -19,7 +19,7 @@
{
var dataSetId = $( '#dataSetId' ).val();
var periodId = $( '#selectedPeriodId' ).val();
- $.getJSON( 'getOrganisationUnitForQuality.action', {orgUnitId:orgUnitIds[0]}
+ $.getJSON( 'getOrganisationUnitForScore.action', {orgUnitId:orgUnitIds[0]}
, function( json )
{
var type = json.response;
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm 2014-01-23 12:25:55 +0000
@@ -1,5 +1,8 @@
<script >
-
+ var windowWidth = $(window).width();
+ var windowHeight = $(window).height();
+ var tableWidth = (parseInt( windowWidth ) * 72) / 100 ;
+ var columnWidth = (parseInt( windowWidth ) * 12) / 100 ;
function organisationUnitSelected( orgUnits, orgUnitNames )
{
setFieldValue("orgUnit", orgUnitNames[0]);
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm 2014-01-23 12:25:55 +0000
@@ -1,4 +1,8 @@
<script >
+ var windowWidth = $(window).width();
+ var windowHeight = $(window).height();
+ var tableWidth = (parseInt( windowWidth ) * 70.2) / 100 ;
+ var columnWidth = (parseInt( windowWidth ) * 10) / 100 ;
$(function() {
$("#addDataElement").button();
});
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm 2014-01-23 12:25:55 +0000
@@ -1,5 +1,6 @@
+
<script type="text/javascript" >
-
+
Ext.Loader.setConfig({
enabled: true
});
@@ -15,6 +16,7 @@
<script >
+
$(function() {
Ext.QuickTips.init();
@@ -23,9 +25,52 @@
enableColumnMove: true,
enableColumnResize: true,
sortOnLoad: true,
- width: 840,
+ width: tableWidth,
height: 360,
- sorters: {direction: 'ASC'}
+ sorters: {direction: 'ASC'},
+ autoCreateViewPort:false,
+ renderTo: Ext.Element.get('#tariffTable'),
+ layout: {
+ type: 'hbox',
+ align: 'stretch'
+ },
+ columns: [
+ {
+ text : 'PBF Type',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Tariff',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Target',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Target %',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Start Date',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'End Date',
+ width : columnWidth,
+ sortable : true
+ },
+ {
+ text : 'Operations',
+ width : columnWidth,
+ sortable : false
+ }
+ ]
});
grid.render();
@@ -233,8 +278,8 @@
</div>
<br/><br/>
<input type="hidden" id="dataElementId" name="dataElementId" value="$!selecteddataElement.id"/>
-<div style="width:100%;margin:auto;">
-<table style="width:100%" id="tariffDetails" name="tariffDetails" cellspacing="0">
+<div style="width:100%;" id="tariffTable">
+<table id="tariffDetails" name="tariffDetails" cellspacing="0">
<thead >
<tr >
<th >PBF Type</th>
@@ -277,7 +322,7 @@
#end
</tbody>
</table>
-
+</div>
<div id="addTariff" title="Add New Tariff">
<table style="width:100%;table-layout:fixed;">
<tr >
@@ -316,14 +361,14 @@
<td colspan="2"> </td>
</tr>
<tr >
- <td style="width:40%;">Target <b class="mandatory">*</b> </td>
+ <td style="width:40%;">Target </td>
<td style="width:60%;"><input type="text" id="target" style="width:100%;" value="" onblur="validateAddTariff()" /></td>
</tr>
<tr >
<td colspan="2"> </td>
</tr>
<tr >
- <td style="width:40%;">Target % <b class="mandatory">*</b> </td>
+ <td style="width:40%;">Target % </td>
<td style="width:60%;"><input type="text" id="targetPercentage" style="width:100%;" value="" onblur="validateAddTariff()" /></td>
</tr>
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityMaxEntrySelection.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityMaxEntrySelection.vm 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityMaxEntrySelection.vm 2014-01-23 12:25:55 +0000
@@ -1,7 +1,7 @@
<script>
jQuery(document).ready( function(){
-
+ countryTags = $levelOrgUnitIds;
datePicker( 'startDate');
datePicker( 'endDate');
@@ -10,7 +10,28 @@
});
</script>
-
+<style >
+ #tariffSetting {
+ width: 280px;
+ height: 50px;
+ margin: 10px 10px 10px 10px;
+ float:right;
+ padding: 10px 10px 10px 10px ;
+ font: 1.6em bold;
+ background: #ccc;
+ box-shadow: 2px 2px 2px rgba(0,0,0,0.5),
+ inset 8px 10px 10px rgba(255,255,255,0.75);
+ -webkit-box-shadow: 2px 2px 2px rgba(0,0,0,0.5),
+ inset 8px 10px 10px rgba(255,255,255,0.75);
+ -moz-box-shadow: 2px 2px 2px rgba(0,0,0,0.5),
+ inset 8px 10px 10px rgba(255,255,255,0.75);
+ }
+</style>
+<div width="100%">
+ <div id="tariffSetting">
+ Quality Max Score Level : $!tariff_setting_authority
+ </div>
+</div>
<h3>$i18n.getString( "quality_max_entry" )</h3>
<form id="qualityMaxDataEntryForm" name="qualityMaxDataEntryForm" method="post" >