dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27658
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13769: PBF Quality Management
------------------------------------------------------------
revno: 13769
committer: Samta Bajpayee<samta-bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-01-18 12:25:59 +0000
message:
PBF Quality Management
added:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValue.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueService.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueStore.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultQualityMaxValueService.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/
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/LoadQualityMaxDetailsAction.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/SaveDataValueAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveQualityValueAction.java
local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/QuantityMaxValue.hbm.xml
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/jsonResponseInput.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseSuccess.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityMaxEntryForm.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityStoreEntryForm.vm
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/qualityStoreEntrySelection.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm
modified:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadTariffDetailsAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValue.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueStore.java
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/LoadDataEntryFormAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/SaveValueAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateTariffDataValueStore.java
local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/TariffDataValue.hbm.xml
local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties
local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm
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/pbfDataEntry.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/loadDataEntryForm.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/menu.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/status.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/action/AddTariffDataAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java 2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java 2014-01-18 12:25:59 +0000
@@ -72,8 +72,20 @@
private String dataElementId;
private String orgUnitUid;
-
- public void setDataElementId( String dataElementId )
+
+ private String target;
+
+ private String targetPercentage;
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public void setTargetPercentage(String targetPercentage) {
+ this.targetPercentage = targetPercentage;
+ }
+
+ public void setDataElementId( String dataElementId )
{
this.dataElementId = dataElementId;
}
@@ -128,6 +140,8 @@
tariffDataValue = new TariffDataValue();
tariffDataValue.setValue( Double.parseDouble( tariff ) );
+ tariffDataValue.setTarget(Integer.parseInt(target));
+ tariffDataValue.setTargetPercentage(Double.parseDouble(targetPercentage));
tariffDataValue.setStartDate( sDate );
tariffDataValue.setEndDate( eDate );
tariffDataValue.setTimestamp( new Date() );
@@ -137,14 +151,18 @@
tariffDataValue.setOrganisationUnit( organisationUnit );
tariffDataValueService.addTariffDataValue( tariffDataValue );
+ System.out.println("Tariff Data Added");
}
else
{
tariffDataValue.setValue( Double.parseDouble( tariff ) );
+ tariffDataValue.setTarget(Integer.parseInt(target));
+ tariffDataValue.setTargetPercentage(Double.parseDouble(targetPercentage));
tariffDataValue.setTimestamp( new Date() );
tariffDataValue.setStoredBy( currentUserService.getCurrentUsername() );
tariffDataValueService.updateTariffDataValue( tariffDataValue );
+ System.out.println("Tariff Data Updated");
}
return SUCCESS;
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadTariffDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadTariffDetailsAction.java 2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadTariffDetailsAction.java 2014-01-18 12:25:59 +0000
@@ -149,7 +149,9 @@
selecteddataElement = dataElementService.getDataElementByName( dataElementName );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
-
+
+ //organisationUnit.getParent()
+
tariffList = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( organisationUnit, selecteddataElement ) );
List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2014-01-07 12:44:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2014-01-18 12:25:59 +0000
@@ -6,6 +6,8 @@
{
public static final String DS_PBF_TYPE = "DS_PBF_TYPE";
+ public static final String DS_QUALITY_TYPE = "DS_QUALITY_TYPE";
+
public static final String OC_TARIFF = "OC_TARIFF";
public static final String QV_TARIFF = "QV_TARIFF";
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValue.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValue.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValue.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,183 @@
+package org.hisp.dhis.pbf.api;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+public class QualityMaxValue implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private OrganisationUnit organisationUnit;
+
+ private DataElement dataElement;
+
+ private DataSet dataSet;
+
+ private Date startDate;
+
+ private Date endDate;
+
+ private Double value;
+
+ private String storedBy;
+
+ private Date timestamp;
+
+ private String comment;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+ public QualityMaxValue()
+ {
+ }
+
+ public QualityMaxValue( OrganisationUnit organisationUnit, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate, Double value)
+ {
+ this.organisationUnit = organisationUnit;
+ this.dataElement = dataElement;
+ this.dataSet = dataSet;
+ this.startDate = startDate;
+ this.endDate = endDate;
+ this.value = value;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o == null )
+ {
+ return false;
+ }
+
+ if ( !(o instanceof QualityMaxValue) )
+ {
+ return false;
+ }
+
+ final QualityMaxValue other = (QualityMaxValue) o;
+
+ return dataElement.equals( other.getDataElement() ) && dataSet.equals( other.getDataSet() ) && organisationUnit.equals( other.getOrganisationUnit() );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+
+ result = result * prime + dataSet.hashCode();
+ result = result * prime + dataElement.hashCode();
+ result = result * prime + organisationUnit.hashCode();
+
+ return result;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+ this.organisationUnit = organisationUnit;
+ }
+
+ public DataElement getDataElement()
+ {
+ return dataElement;
+ }
+
+ public void setDataElement( DataElement dataElement )
+ {
+ this.dataElement = dataElement;
+ }
+
+ public Date getStartDate()
+ {
+ return startDate;
+ }
+
+ public void setStartDate( Date startDate )
+ {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate()
+ {
+ return endDate;
+ }
+
+ public void setEndDate( Date endDate )
+ {
+ this.endDate = endDate;
+ }
+
+ public Double getValue()
+ {
+ return value;
+ }
+
+ public void setValue( Double value )
+ {
+ this.value = value;
+ }
+
+ public String getStoredBy()
+ {
+ return storedBy;
+ }
+
+ public void setStoredBy( String storedBy )
+ {
+ this.storedBy = storedBy;
+ }
+
+ public Date getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp( Date timestamp )
+ {
+ this.timestamp = timestamp;
+ }
+
+ public String getComment()
+ {
+ return comment;
+ }
+
+ public void setComment( String comment )
+ {
+ this.comment = comment;
+ }
+
+ public DataSet getDataSet()
+ {
+ return dataSet;
+ }
+
+ public void setDataSet( DataSet dataSet )
+ {
+ this.dataSet = dataSet;
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueService.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,28 @@
+package org.hisp.dhis.pbf.api;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+
+public interface QualityMaxValueService
+{
+ String ID = QualityMaxValueService.class.getName();
+
+ void addQuantityMaxValue( QualityMaxValue qualityMaxValue );
+
+ void updateQuantityMaxValue( QualityMaxValue qualityMaxValue );
+
+ void deleteQuantityMaxValue( QualityMaxValue qualityMaxValue );
+
+ Collection<QualityMaxValue> getAllQuanlityMaxValues();
+
+ Collection<QualityMaxValue> getQuanlityMaxValues( OrganisationUnit organisationUnit, DataSet dataSet );
+
+ Collection<QualityMaxValue> getQuanlityMaxValues( OrganisationUnit organisationUnit, DataElement dataElement );
+
+ QualityMaxValue getQualityMaxValue( OrganisationUnit organisationUnit, DataElement dataElement, DataSet dataSet,Date startDate ,Date endDate );
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/QualityMaxValueStore.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,28 @@
+package org.hisp.dhis.pbf.api;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+
+public interface QualityMaxValueStore
+{
+ String ID = QualityMaxValueStore.class.getName();
+
+ void addQuantityMaxValue( QualityMaxValue qualityMaxValue );
+
+ void updateQuantityMaxValue( QualityMaxValue qualityMaxValue );
+
+ void deleteQuantityMaxValue( QualityMaxValue qualityMaxValue );
+
+ Collection<QualityMaxValue> getAllQuanlityMaxValues();
+
+ Collection<QualityMaxValue> getQuanlityMaxValues( OrganisationUnit organisationUnit, DataSet dataSet );
+
+ Collection<QualityMaxValue> getQuanlityMaxValues( OrganisationUnit organisationUnit, DataElement dataElement );
+
+ QualityMaxValue getQualityMaxValue( OrganisationUnit organisationUnit, DataElement dataElement, DataSet dataSet, Date startDate ,Date endDate);
+}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValue.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValue.java 2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValue.java 2014-01-18 12:25:59 +0000
@@ -28,6 +28,10 @@
private Date timestamp;
private String comment;
+
+ private Integer target;
+
+ private Double targetPercentage;
// -------------------------------------------------------------------------
// Constructors
@@ -37,7 +41,7 @@
}
- public TariffDataValue( OrganisationUnit organisationUnit, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate, Double value )
+ public TariffDataValue( OrganisationUnit organisationUnit, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate, Double value ,Integer target,Double targetPercentage)
{
this.organisationUnit = organisationUnit;
this.dataElement = dataElement;
@@ -45,6 +49,8 @@
this.startDate = startDate;
this.endDate = endDate;
this.value = value;
+ this.target = target;
+ this.targetPercentage = targetPercentage;
}
// -------------------------------------------------------------------------
@@ -181,4 +187,21 @@
this.dataSet = dataSet;
}
+ public Integer getTarget() {
+ return target;
+ }
+
+ public void setTarget(Integer target) {
+ this.target = target;
+ }
+
+ public Double getTargetPercentage() {
+ return targetPercentage;
+ }
+
+ public void setTargetPercentage(Double targetPercentage) {
+ this.targetPercentage = targetPercentage;
+ }
+
+
}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueStore.java 2014-01-07 12:44:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueStore.java 2014-01-18 12:25:59 +0000
@@ -27,5 +27,7 @@
Map<Integer, Double> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period );
- Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, DataElement dataElement );
+ Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, DataElement dataElement );
+
+
}
=== 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 2013-12-31 07:59:05 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java 2014-01-18 12:25:59 +0000
@@ -105,7 +105,7 @@
System.out.println(" dataSet ---" + dataSet.getId() +" -- " + dataSet.getName() );
}
*/
-
+ System.out.println( dataSets.size() );
if ( dataSets.size() > 0 )
{
message = organisationUnit.getName();
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 2014-01-07 17:56:19 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 2014-01-18 12:25:59 +0000
@@ -1,6 +1,7 @@
package org.hisp.dhis.pbf.dataentry;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -8,6 +9,8 @@
import java.util.Map;
import java.util.Set;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -34,6 +37,8 @@
*/
public class LoadDataEntryFormAction implements Action
{
+ private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -95,6 +100,13 @@
this.currentUserService = currentUserService;
}
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
+
// -------------------------------------------------------------------------
// Comparator
// -------------------------------------------------------------------------
@@ -219,11 +231,33 @@
dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
+ Collections.sort(dataElements);
+
optionCombos = new ArrayList<DataElementCategoryOptionCombo>();
Map<Integer, Double> tariffDataValueMap = new HashMap<Integer, Double>();
- tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( organisationUnit, dataSet, period ) );
+ // find parent
+ Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
+ int tariff_setting_authority = 0;
+ if ( tariff_authority == null )
+ {
+ tariff_setting_authority = 3;
+
+ }
+ else
+ {
+ tariff_setting_authority = (int) tariff_authority.getValue();
+
+ }
+
+ OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
+
+ if( parentOrgunit != null )
+ {
+ tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( parentOrgunit, dataSet, period ) );
+ }
+
pbfDataValueMap = new HashMap<DataElement, PBFDataValue>();
@@ -257,6 +291,7 @@
{
PBFDataValue pbfDataValue = new PBFDataValue();
+ pbfDataValue.setDataSet( dataSet );
pbfDataValue.setDataElement( de );
pbfDataValue.setPeriod( period );
pbfDataValue.setOrganisationUnit(organisationUnit);
@@ -332,6 +367,19 @@
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 );
+ }
+ }
}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/SaveValueAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/SaveValueAction.java 2014-01-07 17:56:19 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/SaveValueAction.java 2014-01-18 12:25:59 +0000
@@ -311,6 +311,7 @@
if ( value != null )
{
pbfDataValue = new PBFDataValue( );
+ pbfDataValue.setDataSet(dataSet);
pbfDataValue.setDataElement(dataElement);
pbfDataValue.setPeriod(period);
pbfDataValue.setOrganisationUnit(organisationUnit);
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultQualityMaxValueService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultQualityMaxValueService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultQualityMaxValueService.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,77 @@
+package org.hisp.dhis.pbf.impl;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.pbf.api.QualityMaxValue;
+import org.hisp.dhis.pbf.api.QualityMaxValueService;
+import org.hisp.dhis.pbf.api.QualityMaxValueStore;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class DefaultQualityMaxValueService implements QualityMaxValueService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private QualityMaxValueStore qualityMaxValueStore;
+
+ public void setQualityMaxValueStore(QualityMaxValueStore qualityMaxValueStore) {
+ this.qualityMaxValueStore = qualityMaxValueStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // QualityMaxValue
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void addQuantityMaxValue(QualityMaxValue qualityMaxValue) {
+
+ qualityMaxValueStore.addQuantityMaxValue(qualityMaxValue);
+ }
+
+ @Override
+ public void updateQuantityMaxValue(QualityMaxValue qualityMaxValue) {
+
+ qualityMaxValueStore.updateQuantityMaxValue(qualityMaxValue);
+ }
+
+ @Override
+ public void deleteQuantityMaxValue(QualityMaxValue qualityMaxValue) {
+
+ qualityMaxValueStore.deleteQuantityMaxValue(qualityMaxValue);
+ }
+
+ @Override
+ public Collection<QualityMaxValue> getAllQuanlityMaxValues() {
+
+ return qualityMaxValueStore.getAllQuanlityMaxValues();
+ }
+
+ @Override
+ public Collection<QualityMaxValue> getQuanlityMaxValues(
+ OrganisationUnit organisationUnit, DataSet dataSet) {
+
+ return qualityMaxValueStore.getQuanlityMaxValues(organisationUnit, dataSet);
+ }
+
+ @Override
+ public QualityMaxValue getQualityMaxValue(
+ OrganisationUnit organisationUnit, DataElement dataElement,
+ DataSet dataSet ,Date startDate ,Date endDate) {
+
+ return qualityMaxValueStore.getQualityMaxValue(organisationUnit, dataElement, dataSet ,startDate, endDate);
+ }
+
+ @Override
+ public Collection<QualityMaxValue> getQuanlityMaxValues(
+ OrganisationUnit organisationUnit, DataElement dataElement) {
+
+ return qualityMaxValueStore.getQuanlityMaxValues(organisationUnit, dataElement);
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,118 @@
+package org.hisp.dhis.pbf.impl;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.pbf.api.QualityMaxValue;
+import org.hisp.dhis.pbf.api.QualityMaxValueStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+public class HibernateQualityMaxValueStore implements QualityMaxValueStore
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
+ // -------------------------------------------------------------------------
+ // QualityMaxValue
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void addQuantityMaxValue(QualityMaxValue qualityMaxValue) {
+
+ Session session = sessionFactory.getCurrentSession();
+ session.save( qualityMaxValue );
+ }
+
+ @Override
+ public void updateQuantityMaxValue(QualityMaxValue qualityMaxValue) {
+
+ Session session = sessionFactory.getCurrentSession();
+ session.update( qualityMaxValue );
+ }
+
+ @Override
+ public void deleteQuantityMaxValue(QualityMaxValue qualityMaxValue) {
+
+ Session session = sessionFactory.getCurrentSession();
+ session.delete( qualityMaxValue );
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Collection<QualityMaxValue> getAllQuanlityMaxValues() {
+
+ Session session = sessionFactory.getCurrentSession();
+ Criteria criteria = session.createCriteria( QualityMaxValue.class );
+
+ return criteria.list();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Collection<QualityMaxValue> getQuanlityMaxValues(
+ OrganisationUnit organisationUnit, DataSet dataSet) {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( QualityMaxValue.class );
+ criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+ criteria.add( Restrictions.eq( "dataSet", dataSet ) );
+
+ return criteria.list();
+ }
+
+ @Override
+ public QualityMaxValue getQualityMaxValue(
+ OrganisationUnit organisationUnit, DataElement dataElement,
+ DataSet dataSet,Date startDate ,Date endDate) {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( QualityMaxValue.class );
+ criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+ criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+ criteria.add( Restrictions.eq( "dataSet", dataSet ) );
+ criteria.add( Restrictions.eq( "startDate", startDate ) );
+ criteria.add( Restrictions.eq( "endDate", endDate ) );
+
+ return (QualityMaxValue) criteria.uniqueResult();
+ }
+
+ @Override
+ public Collection<QualityMaxValue> getQuanlityMaxValues(
+ OrganisationUnit organisationUnit, DataElement dataElement) {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( QualityMaxValue.class );
+ criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+ criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+
+ return criteria.list();
+ }
+
+
+
+}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateTariffDataValueStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateTariffDataValueStore.java 2014-01-07 12:44:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateTariffDataValueStore.java 2014-01-18 12:25:59 +0000
@@ -14,6 +14,7 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.pbf.api.QualityMaxValue;
import org.hisp.dhis.pbf.api.TariffDataValue;
import org.hisp.dhis.pbf.api.TariffDataValueStore;
import org.hisp.dhis.period.Period;
@@ -149,4 +150,5 @@
return tariffDataValueMap;
}
+
}
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality'
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry'
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitAction.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,119 @@
+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/LoadQualityMaxDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityMaxDetailsAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityMaxDetailsAction.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,164 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+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 org.hisp.dhis.pbf.api.QualityMaxValue;
+import org.hisp.dhis.pbf.api.QualityMaxValueService;
+import org.hisp.dhis.pbf.api.TariffDataValue;
+import org.hisp.dhis.pbf.api.TariffDataValueService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserAuthorityGroup;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadQualityMaxDetailsAction
+ implements Action
+{
+
+ private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private QualityMaxValueService qualityMaxValueService;
+
+ public void setQualityMaxValueService(
+ QualityMaxValueService qualityMaxValueService) {
+ this.qualityMaxValueService = qualityMaxValueService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input / Output
+ // -------------------------------------------------------------------------
+
+ private String orgUnitId;
+
+ public void setOrgUnitId(String orgUnitId) {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String dataSetId;
+
+ public void setDataSetId(String dataSetId) {
+ this.dataSetId = dataSetId;
+ }
+
+ private String startDate;
+
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ private String endDate;
+
+ public void setEndDate(String endDate) {
+ this.endDate = endDate;
+ }
+
+ List<DataElement> dataElements = new ArrayList<DataElement>();
+
+ public List<DataElement> getDataElements() {
+ return dataElements;
+ }
+
+ private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
+
+ public SimpleDateFormat getSimpleDateFormat() {
+ return simpleDateFormat;
+ }
+
+ private Map<Integer,QualityMaxValue> qualityMaxValueMap = new HashMap<Integer,QualityMaxValue>();
+
+ public Map<Integer, QualityMaxValue> getQualityMaxValueMap() {
+ return qualityMaxValueMap;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+
+ Date sDate = dateFormat.parse( startDate );
+ Date eDate = dateFormat.parse( endDate );
+ Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+ DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
+
+ List<DataElement> dataElementList = new ArrayList<DataElement>(dataSet.getDataElements());
+ for( DataElement de : dataElementList )
+ {
+ Set<AttributeValue> attrValueSet = new HashSet<AttributeValue>( de.getAttributeValues() );
+ for ( AttributeValue attValue : attrValueSet )
+ {
+ if(attValue.getAttribute().getId() == qualityMaxDataElement.getValue())
+ {
+ dataElements.add(de);
+ }
+ }
+ }
+ for(DataElement dataElement : dataElements)
+ {
+ QualityMaxValue qualityMaxValue = qualityMaxValueService.getQualityMaxValue(organisationUnit, dataElement, dataSet, sDate, eDate );
+ if(qualityMaxValue != null)
+ {
+ qualityMaxValueMap.put(dataElement.getId(), qualityMaxValue);
+ System.out.println("In Quality Data Value");
+ }
+ }
+ Collections.sort(dataElements);
+ return SUCCESS;
+ }
+}
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,201 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+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 org.hisp.dhis.pbf.api.QualityMaxValue;
+import org.hisp.dhis.pbf.api.QualityMaxValueService;
+import org.hisp.dhis.pbf.api.TariffDataValue;
+import org.hisp.dhis.pbf.api.TariffDataValueService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserAuthorityGroup;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadQualityScoreDetailsAction
+ implements Action
+{
+
+ private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private QualityMaxValueService qualityMaxValueService;
+
+ public void setQualityMaxValueService(
+ QualityMaxValueService qualityMaxValueService) {
+ this.qualityMaxValueService = qualityMaxValueService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
+
+ private DataValueService dataValueService;
+
+ public void setDataValueService(DataValueService dataValueService)
+ {
+ this.dataValueService = dataValueService;
+ }
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input / Output
+ // -------------------------------------------------------------------------
+
+ private String orgUnitId;
+
+ public void setOrgUnitId(String orgUnitId) {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String dataSetId;
+
+ public void setDataSetId(String dataSetId) {
+ this.dataSetId = dataSetId;
+ }
+
+ private String selectedPeriodId;
+
+ public void setSelectedPeriodId( String selectedPeriodId )
+ {
+ this.selectedPeriodId = selectedPeriodId;
+ }
+
+ List<DataElement> dataElements = new ArrayList<DataElement>();
+
+ public List<DataElement> getDataElements() {
+ return dataElements;
+ }
+
+ private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
+
+ public SimpleDateFormat getSimpleDateFormat() {
+ return simpleDateFormat;
+ }
+
+ private Map<Integer,QualityMaxValue> qualityMaxValueMap = new HashMap<Integer,QualityMaxValue>();
+
+ public Map<Integer, QualityMaxValue> getQualityMaxValueMap() {
+ return qualityMaxValueMap;
+ }
+
+ private Map<Integer,DataValue> dataValueMap = new HashMap<Integer, DataValue>();
+
+ public Map<Integer, DataValue> getDataValueMap() {
+ return dataValueMap;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+
+ Period period = PeriodType.getPeriodFromIsoString( selectedPeriodId );
+
+ Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+ DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
+
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+
+ List<DataElement> dataElementList = new ArrayList<DataElement>(dataSet.getDataElements());
+ for( DataElement de : dataElementList )
+ {
+ Set<AttributeValue> attrValueSet = new HashSet<AttributeValue>( de.getAttributeValues() );
+ for ( AttributeValue attValue : attrValueSet )
+ {
+ if(attValue.getAttribute().getId() == qualityMaxDataElement.getValue())
+ {
+ dataElements.add(de);
+ }
+ }
+ }
+ for(DataElement dataElement : dataElements)
+ {
+ List<QualityMaxValue> qualityMaxValues = new ArrayList<QualityMaxValue>();
+
+ qualityMaxValues = new ArrayList<QualityMaxValue>(qualityMaxValueService.getQuanlityMaxValues(organisationUnit, dataElement)) ;
+ DataValue dataValue = dataValueService.getDataValue(dataElement, period, organisationUnit, optionCombo);
+ for (QualityMaxValue qualityMaxValue : qualityMaxValues)
+ {
+
+ if(qualityMaxValue.getStartDate().getTime() <= period.getStartDate().getTime() && period.getEndDate().getTime() <= qualityMaxValue.getEndDate().getTime() )
+ {
+ qualityMaxValueMap.put(dataElement.getId(), qualityMaxValue);
+ if(dataValue != null)
+ {
+ dataValueMap.put(dataElement.getId(), dataValue );
+ }
+
+ System.out.println("In Quality Data Value");
+ break;
+ }
+ }
+ }
+ Collections.sort(dataElements);
+ return SUCCESS;
+ }
+}
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,129 @@
+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.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 QualityMaxInitAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // 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;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // 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;
+ }
+
+ // -------------------------------------------------------------------------
+ // 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 );
+
+ }
+
+ 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;
+ }
+}
+
+
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveDataValueAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveDataValueAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveDataValueAction.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,240 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Samta bajpai
+ */
+public class SaveDataValueAction
+ implements Action
+{
+ private static final Log log = LogFactory.getLog( SaveDataValueAction.class );
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private DataValueService dataValueService;
+
+ public void setDataValueService( DataValueService dataValueService )
+ {
+ this.dataValueService = dataValueService;
+ }
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String value;
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+
+ private String dataElementId;
+
+ public void setDataElementId( String dataElementId )
+ {
+ this.dataElementId = dataElementId;
+ }
+
+ private String organisationUnitId;
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ private String periodIso;
+
+ public void setPeriodIso(String periodIso) {
+ this.periodIso = periodIso;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private int statusCode = 0;
+
+ public int getStatusCode()
+ {
+ return statusCode;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ Period period = PeriodType.getPeriodFromIsoString(periodIso);
+
+ if ( period == null )
+ {
+ return logError( "Illegal period identifier: " + periodIso );
+ }
+
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ if ( organisationUnit == null )
+ {
+ return logError( "Invalid organisation unit identifier: " + organisationUnitId );
+ }
+
+ DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
+
+ if ( dataElement == null )
+ {
+ return logError( "Invalid data element identifier: " + dataElementId );
+ }
+
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+
+ String storedBy = currentUserService.getCurrentUsername();
+
+ Date now = new Date();
+
+ if ( storedBy == null )
+ {
+ storedBy = "[unknown]";
+ }
+
+ if( value == null )
+ {
+ value = "";
+ }
+
+ if ( value != null )
+ {
+ value = value.trim();
+ }
+
+ // ---------------------------------------------------------------------
+ // Update data
+ // ---------------------------------------------------------------------
+
+ DataValue dataValue = dataValueService.getDataValue(dataElement, period, organisationUnit, optionCombo);
+
+ if ( dataValue == null )
+ {
+ if ( value != null && (!value.trim().equals( "" ) || !value.equalsIgnoreCase( "-1" )) )
+ {
+ dataValue = new DataValue();
+
+ dataValue.setPeriod(period);
+ dataValue.setDataElement(dataElement);
+ dataValue.setSource(organisationUnit);
+ dataValue.setCategoryOptionCombo(optionCombo);
+
+ dataValue.setValue( value.trim() );
+ dataValue.setTimestamp( now );
+ dataValue.setStoredBy( storedBy );
+
+ dataValueService.addDataValue( dataValue );
+ }
+ }
+ else
+ {
+ if( !(value.trim().equalsIgnoreCase( dataValue.getValue() )) )
+ {
+ dataValue.setValue( value.trim() );
+ dataValue.setTimestamp( now );
+ dataValue.setStoredBy( storedBy );
+ dataValueService.updateDataValue( dataValue );
+ }
+ }
+ return SUCCESS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private String logError( String message )
+ {
+ return logError( message, 1 );
+ }
+
+ private String logError( String message, int statusCode )
+ {
+ log.info( message );
+
+ this.statusCode = statusCode;
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveQualityValueAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveQualityValueAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/SaveQualityValueAction.java 2014-01-18 12:25:59 +0000
@@ -0,0 +1,273 @@
+package org.hisp.dhis.pbf.quality.dataentry;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.pbf.api.PBFDataValue;
+import org.hisp.dhis.pbf.api.PBFDataValueService;
+import org.hisp.dhis.pbf.api.QualityMaxValue;
+import org.hisp.dhis.pbf.api.QualityMaxValueService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.system.util.ValidationUtils;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Abyot Asalefew
+ */
+public class SaveQualityValueAction
+ implements Action
+{
+ private static final Log log = LogFactory.getLog( SaveQualityValueAction.class );
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private QualityMaxValueService qualityMaxValueService;
+
+ public void setQualityMaxValueService(
+ QualityMaxValueService qualityMaxValueService) {
+ this.qualityMaxValueService = qualityMaxValueService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String value;
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+
+ private String dataElementId;
+
+ public void setDataElementId( String dataElementId )
+ {
+ this.dataElementId = dataElementId;
+ }
+
+ private String organisationUnitId;
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ private String dataSetId;
+
+ public void setDataSetId(String dataSetId)
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ private String startDate ;
+
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ private String endDate ;
+
+ public void setEndDate(String endDate) {
+ this.endDate = endDate;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private int statusCode = 0;
+
+ public int getStatusCode()
+ {
+ return statusCode;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ if ( organisationUnit == null )
+ {
+ return logError( "Invalid organisation unit identifier: " + organisationUnitId );
+ }
+
+ DataElement dataElement = dataElementService.getDataElement( Integer.parseInt(dataElementId) );
+
+ if ( dataElement == null )
+ {
+ return logError( "Invalid data element identifier: " + dataElementId );
+ }
+
+ DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
+ if ( dataSet == null )
+ {
+ return logError( "Invalid dataset identifier: " + dataSetId );
+ }
+
+ String storedBy = currentUserService.getCurrentUsername();
+
+ Date now = new Date();
+
+ if ( storedBy == null )
+ {
+ storedBy = "[unknown]";
+ }
+
+ if ( value != null && value.trim().length() == 0 )
+ {
+ value = null;
+ }
+
+ if ( value != null )
+ {
+ value = value.trim();
+ }
+
+ // ---------------------------------------------------------------------
+ // Validate value according to type from data element
+ // ---------------------------------------------------------------------
+
+ String valid = ValidationUtils.dataValueIsValid( value, dataElement );
+
+ if ( valid != null )
+ {
+ return logError( valid, 3 );
+ }
+
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ Date sDate = dateFormat.parse( startDate );
+ Date eDate = dateFormat.parse( endDate );
+
+ QualityMaxValue qualityMaxValue = qualityMaxValueService.getQualityMaxValue(organisationUnit, dataElement, dataSet, sDate, eDate );
+
+ if ( qualityMaxValue == null )
+ {
+ if ( value != null )
+ {
+ qualityMaxValue = new QualityMaxValue( );
+ qualityMaxValue.setDataSet(dataSet);
+ qualityMaxValue.setDataElement(dataElement);
+ qualityMaxValue.setOrganisationUnit(organisationUnit);
+
+ qualityMaxValue.setValue(Double.parseDouble(value));
+ qualityMaxValue.setStartDate(sDate);
+ qualityMaxValue.setEndDate(eDate);
+
+ qualityMaxValue.setStoredBy(storedBy);
+ qualityMaxValue.setTimestamp(now);
+ qualityMaxValueService.addQuantityMaxValue(qualityMaxValue);
+
+ System.out.println("Value Added");
+ }
+ }
+ else
+ {
+ qualityMaxValue.setStoredBy(storedBy);
+ qualityMaxValue.setTimestamp(now);
+
+ qualityMaxValue.setValue(Double.parseDouble(value));
+
+ qualityMaxValueService.updateQuantityMaxValue(qualityMaxValue);
+ System.out.println("Value Updated");
+ }
+
+
+ return SUCCESS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private String logError( String message )
+ {
+ return logError( message, 1 );
+ }
+
+ private String logError( String message, int statusCode )
+ {
+ log.info( message );
+
+ this.statusCode = statusCode;
+
+ return SUCCESS;
+ }
+}
=== 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-07 17:56:19 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2014-01-18 12:25:59 +0000
@@ -10,6 +10,11 @@
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
+
+ <bean id="org.hisp.dhis.pbf.api.QualityMaxValueStore" class="org.hisp.dhis.pbf.impl.HibernateQualityMaxValueStore">
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
+ </bean>
<bean id="org.hisp.dhis.pbf.api.PBFDataValueStore" class="org.hisp.dhis.pbf.impl.HibernatePBFDataValueStore">
<property name="sessionFactory" ref="sessionFactory" />
@@ -20,6 +25,10 @@
<property name="tariffDataValueStore" ref="org.hisp.dhis.pbf.api.TariffDataValueStore" />
</bean>
+ <bean id="org.hisp.dhis.pbf.api.QualityMaxValueService" class="org.hisp.dhis.pbf.impl.DefaultQualityMaxValueService">
+ <property name="qualityMaxValueStore" ref="org.hisp.dhis.pbf.api.QualityMaxValueStore" />
+ </bean>
+
<bean id="org.hisp.dhis.pbf.api.PBFDataValueService" class="org.hisp.dhis.pbf.impl.DefaultPBFDataValueService">
<property name="pbfDataValueStore" ref="org.hisp.dhis.pbf.api.PBFDataValueStore" />
</bean>
@@ -148,6 +157,7 @@
<property name="tariffDataValueService" ref="org.hisp.dhis.pbf.api.TariffDataValueService"/>
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService"/>
<property name="pbfDataValueService" ref="org.hisp.dhis.pbf.api.PBFDataValueService" />
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
</bean>
<!-- Save Value -->
@@ -162,4 +172,58 @@
<property name="pbfDataValueService" ref="org.hisp.dhis.pbf.api.PBFDataValueService" />
</bean>
+ <!-- Quality Max Data Entry -->
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitAction" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitAction" 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.QualityMaxInitAction" class="org.hisp.dhis.pbf.quality.dataentry.QualityMaxInitAction" 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" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.LoadQualityMaxDetailsAction" class="org.hisp.dhis.pbf.quality.dataentry.LoadQualityMaxDetailsAction" scope="prototype">
+ <property name="qualityMaxValueService" ref="org.hisp.dhis.pbf.api.QualityMaxValueService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+ </bean>
+
+ <!-- Save Quality Data -->
+
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.SaveQualityValueAction" class="org.hisp.dhis.pbf.quality.dataentry.SaveQualityValueAction" scope="prototype">
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="qualityMaxValueService" ref="org.hisp.dhis.pbf.api.QualityMaxValueService" />
+ </bean>
+
+ <!-- Quality Score Data Entry -->
+
+ <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" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+ <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+ <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ </bean>
+
+ <!-- Save Quality Data -->
+
+ <bean id="org.hisp.dhis.pbf.quality.dataentry.SaveDataValueAction" class="org.hisp.dhis.pbf.quality.dataentry.SaveDataValueAction" scope="prototype">
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+ <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+
</beans>
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/QuantityMaxValue.hbm.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/QuantityMaxValue.hbm.xml 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/QuantityMaxValue.hbm.xml 2014-01-18 12:25:59 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.pbf.api.QualityMaxValue" table="qualitymaxvalue">
+
+ <composite-id>
+ <key-many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid" foreign-key="fk_tariffdatavalue_organisationunitid" />
+ <key-many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" column="datasetid" foreign-key="fk_tariffdatavalue_datasetid" />
+ <key-many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_tariffdatavalue_dataelementid" />
+ <key-property name="startDate" column="startdate" />
+ <key-property name="endDate" column="enddate" />
+ </composite-id>
+
+ <property name="value" />
+
+ <property name="storedBy" column="storedby" length="100" />
+
+ <property name="timestamp" column="lastupdated" type="timestamp" />
+
+ <property name="comment" length="360" />
+
+ </class>
+</hibernate-mapping>
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/TariffDataValue.hbm.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/TariffDataValue.hbm.xml 2013-12-21 05:25:33 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/TariffDataValue.hbm.xml 2014-01-18 12:25:59 +0000
@@ -15,6 +15,10 @@
</composite-id>
<property name="value" />
+
+ <property name="target" />
+
+ <property name="targetPercentage" />
<property name="storedBy" column="storedby" length="100" />
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties 2014-01-07 12:44:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties 2014-01-18 12:25:59 +0000
@@ -17,4 +17,12 @@
select = Select
period = Period
dataelement = Data Element
-total = Total
\ No newline at end of file
+total = Total
+qty_reported = Quantity Reported
+qty_validated = Quantity Validated
+tariff_amount = Tariff Amount
+quality_max_entry = Quality Max Data Entry
+quality_store_entry = Quality Store Data Entry
+quality_score = Score
+quality_max = Max
+quality_percentage = Percentage
\ No newline at end of file
=== 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-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2014-01-18 12:25:59 +0000
@@ -27,17 +27,17 @@
<param name="page">/dhis-web-maintenance-pbf/loadTariffData.vm</param>
</action>
<action name="addTariffData" class="org.hisp.dhis.pbf.action.AddTariffDataAction">
- <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/status.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/tariffStatus.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
<action name="deleteTariffData" class="org.hisp.dhis.pbf.action.DeleteTariffDataAction">
- <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/status.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/tariffStatus.vm</result>
<param name="onExceptionReturn">plainTextError</param>
<param name="requiredAuthorities">F_TARIFFDATAVALUE_UPDATE</param>
</action>
<action name="validateTariffData" class="org.hisp.dhis.pbf.action.ValidateTariffDataAction">
- <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/status.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/tariffStatus.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
@@ -81,8 +81,8 @@
<!-- Get OrganisationUnit Unit name -->
<action name="getOrganisationUnit" class="org.hisp.dhis.pbf.dataentry.GetOrganisationUnitAction">
- <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
- <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ <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>
<!-- Get Periods -->
@@ -109,7 +109,57 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
+ <!-- Quality Max Data Entry -->
+ <action name="getOrganisationUnitForQuality" class="org.hisp.dhis.pbf.quality.dataentry.GetOrganisationUnitAction">
+ <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="qualityMaxDataEntry" class="org.hisp.dhis.pbf.quality.dataentry.QualityMaxInitAction">
+ <interceptor-ref name="organisationUnitTreeStack" />
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/qualityMaxEntrySelection.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/menuDataEntry.vm</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/qualityMaxDataEntry.js</param>
+ <param name="stylesheets">css/dataentry.css</param>
+ </action>
+
+ <!-- Load DataEntry Form -->
+ <action name="loadQualityMaxForm" class="org.hisp.dhis.pbf.quality.dataentry.LoadQualityMaxDetailsAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/loadQualityMaxEntryForm.vm</param>
+ </action>
+
+ <!-- Save Quality Value -->
+ <action name="saveQualityValue"
+ class="org.hisp.dhis.pbf.quality.dataentry.SaveQualityValueAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-pbf/status.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <!-- Quality Score Data Entry -->
+ <action name="qualityScoreDataEntry" class="org.hisp.dhis.pbf.quality.dataentry.QualityMaxInitAction">
+ <interceptor-ref name="organisationUnitTreeStack" />
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/qualityStoreEntrySelection.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/menuDataEntry.vm</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/qualityScoreDataEntry.js</param>
+ <param name="stylesheets">css/dataentry.css</param>
+ </action>
+
+ <!-- Load DataEntry Form -->
+ <action name="loadQualityScoreForm" class="org.hisp.dhis.pbf.quality.dataentry.LoadQualityScoreDetailsAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/loadQualityStoreEntryForm.vm</param>
+ </action>
+
+ <!-- Save Quality Score Value -->
+ <action name="saveDataValue" class="org.hisp.dhis.pbf.quality.dataentry.SaveDataValueAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-pbf/status.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
</package>
-
-
</struts>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm 2014-01-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm 2014-01-18 12:25:59 +0000
@@ -49,7 +49,7 @@
<tr>
<td><label for="selectedPeriodId">$i18n.getString( "period" )</label></td>
<td><select id="selectedPeriodId" name="selectedPeriodId" style="width:200px" disabled="disabled" onchange="loadDataEntryForm()">
- <option value="-1">[$i18n.getString( "select" )]</option>
+ <option value="-1">[$i18n.getString( "select" )]</option>
#foreach( $period in $periods )
<option value="$period.iso">$encoder.htmlEncode( $period.name )</option>
#end
@@ -65,7 +65,7 @@
#parse( "/dhis-web-commons/loader/loader.vm" )
-<div id='dataEntryFormDiv'></div> <!-- DataEntry Form -->
+<div id='dataEntryFormDiv' style="width:70%"></div> <!-- DataEntry Form -->
<!--
<p>
=== 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-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm 2014-01-18 12:25:59 +0000
@@ -29,8 +29,8 @@
enableColumnMove: true,
enableColumnResize: true,
sortOnLoad: true,
- minWidth: 300,
- minHeight: 360,
+ width: 900,
+ height: 360,
sorters: {direction: 'ASC'}
});
@@ -181,7 +181,7 @@
<input type="button" value="Add New Bank Detail" style="float:right;" id="openAddBankDetail" />
</div>
<br/><br/>
-<table style="width:100%" id="bankDetails">
+<table style="width:100%" id="bankDetails" cellspacing="0">
<thead >
<tr >
<th >PBF Type</th>
@@ -194,7 +194,7 @@
#end
</tr>
</thead>
- <tbody id="list">
+ <tbody >
#set( $mark = false )
#foreach( $bankDetails in $bankDetailsList )
#if( $mark )
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js 2014-01-07 17:56:19 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js 2014-01-18 12:25:59 +0000
@@ -17,22 +17,32 @@
if( orgUnitIds != null && orgUnitIds != "" )
{
+ var dataSetId = $( '#dataSetId' ).val();
+ var periodId = $( '#selectedPeriodId' ).val();
$.getJSON( 'getOrganisationUnit.action', {orgUnitId:orgUnitIds[0]}
, function( json )
{
var type = json.response;
setFieldValue('orgUnitName', json.message );
- setFieldValue('selectedOrgunitName', json.message );
-
- if( type == 'success' )
+ setFieldValue('selectedOrgunitName', json.message );
+ if( type == "success" )
{
- window.location.href = "pbfDataEntry.action";
enable('dataSetId');
+
+ var options = '';
+ $.each(json.dataSets, function(i, obj){
+ options += '<option value="' + obj.id + '"'+ '>' + obj.name + '</option>';
+ });
+ $("select#dataSetId").html(options);
+
+ $("select#dataSetId option[value="+dataSetId+"]").attr('selected', 'selected');
+ $("select#selectedPeriodId option[value="+periodId+"]").attr('selected', 'selected');
+ loadPeriods();
setFieldValue('selectedOrgunitID',orgUnitIds[0])
setFieldValue('orgUnitName', json.message );
setFieldValue('selectedOrgunitName', json.message );
}
- else if( type == 'input' )
+ else if( type == "input" )
{
disable('dataSetId');
disable('selectedPeriodId');
@@ -116,8 +126,6 @@
function handleSuccess( json )
{
var code = json.c;
-
- alert(code)
if ( code == '0' || code == 0) // Value successfully saved on server
{
markValue( fieldId, COLOR_GREEN );
@@ -256,8 +264,8 @@
addOptionToList( list, json.periods[i].isoDate, json.periods[i].name );
}
} );
-
- }
+
+ }
}
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js 2014-01-18 12:25:59 +0000
@@ -0,0 +1,162 @@
+
+ var COLOR_GREEN = '#b9ffb9';
+ var COLOR_YELLOW = '#fffe8c';
+ var COLOR_RED = '#ff8a8a';
+ var COLOR_ORANGE = '#ff6600';
+ var COLOR_WHITE = '#ffffff';
+ var COLOR_GREY = '#cccccc';
+ var LocaleColor = 'black';
+
+function orgUnitHasBeenSelected( orgUnitIds )
+{
+ $( '#dataEntryFormDiv' ).html( '' );
+
+ if( orgUnitIds != null && orgUnitIds != "" )
+ {
+ var dataSetId = $( '#dataSetId' ).val();
+ $.getJSON( 'getOrganisationUnitForQuality.action', {orgUnitId:orgUnitIds[0]}
+ , function( json )
+ {
+ var type = json.response;
+ setFieldValue('orgUnitName', json.message );
+ setFieldValue('selectedOrgunitName', json.message );
+ if( type == "success" )
+ {
+ enable('dataSetId');
+
+ var options = '';
+ $.each(json.dataSets, function(i, obj){
+ options += '<option value="' + obj.id + '"'+ '>' + obj.name + '</option>';
+ });
+ $("select#dataSetId").html(options);
+
+ $("select#dataSetId option[value="+dataSetId+"]").attr('selected', 'selected');
+
+ setFieldValue('selectedOrgunitID',orgUnitIds[0])
+ setFieldValue('orgUnitName', json.message );
+ setFieldValue('selectedOrgunitName', json.message );
+ loadDataEntryForm();
+ }
+ else if( type == "input" )
+ {
+ disable('dataSetId');
+ disable('selectedPeriodId');
+ disable('prevButton');
+ disable('nextButton');
+
+ setFieldValue('orgUnitName', json.message );
+ setFieldValue('selectedOrgunitName', json.message );
+ }
+ } );
+ }
+}
+
+selection.setListenerFunction( orgUnitHasBeenSelected );
+
+
+function loadDataEntryForm()
+{
+ var orgUnitId = $( '#selectedOrgunitID' ).val();
+ var dataSetId = $( '#dataSetId' ).val();
+ $( '#dataEntryFormDiv' ).html('');
+
+ var startDate = $("#startDate").val();
+ var endDate = $("#endDate").val();
+ if(startDate != "" && endDate != "")
+ {
+ jQuery('#loaderDiv').show();
+
+ jQuery('#dataEntryFormDiv').load('loadQualityMaxForm.action',
+ {
+ orgUnitId:orgUnitId,
+ dataSetId:dataSetId,
+ startDate:startDate,
+ endDate:endDate
+ }, function()
+ {
+ showById('dataEntryFormDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+ }
+}
+
+function saveQualityDataValue( dataElementId )
+{
+ var dataSetId = $( '#dataSetId' ).val();
+ var valueId = "value_"+dataElementId;
+
+ var fieldId = "#"+valueId;
+
+ var defaultValue = document.getElementById(valueId).defaultValue;
+ var value = document.getElementById( valueId ).value;
+ var startDate = $("#startDate").val();
+ var endDate = $("#endDate").val();
+ if(startDate == "" && endDate == "")
+ {
+ alert("Please select start date and end Date");
+ return false;
+ }
+
+ if(defaultValue != value)
+ {
+ var dataValue = {
+ 'dataElementId' : dataElementId,
+ 'dataSetId' : dataSetId,
+ 'organisationUnitId' : $("#selectedOrgunitID").val(),
+ 'value' : value,
+ 'startDate' : startDate,
+ 'endDate' : endDate
+ };
+ jQuery.ajax( {
+ url: 'saveQualityValue.action',
+ data: dataValue,
+ dataType: 'json',
+ success: handleSuccess,
+ error: handleError
+ } );
+ }
+
+ function handleSuccess( json )
+ {
+ var code = json.c;
+
+ if ( code == '0' || code == 0) // Value successfully saved on server
+ {
+ markValue( fieldId, COLOR_GREEN );
+ }
+ else if ( code == 2 )
+ {
+ markValue( fieldId, COLOR_RED );
+ window.alert( i18n_saving_value_failed_dataset_is_locked );
+ }
+ else // Server error during save
+ {
+ markValue( fieldId, COLOR_RED );
+ window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+ }
+ }
+
+ function handleError( jqXHR, textStatus, errorThrown )
+ {
+ markValue( fieldId, COLOR_RED );
+ }
+
+ function markValue( fieldId, color )
+ {
+ document.getElementById(valueId).style.backgroundColor = color;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityScoreDataEntry.js 2014-01-18 12:25:59 +0000
@@ -0,0 +1,308 @@
+
+ var COLOR_GREEN = '#b9ffb9';
+ var COLOR_YELLOW = '#fffe8c';
+ var COLOR_RED = '#ff8a8a';
+ var COLOR_ORANGE = '#ff6600';
+ var COLOR_WHITE = '#ffffff';
+ var COLOR_GREY = '#cccccc';
+ var LocaleColor = 'black';
+
+function orgUnitHasBeenSelected( orgUnitIds )
+{
+ $( '#dataEntryFormDiv' ).html( '' );
+
+ //document.getElementById('selectedOrgunitID').value = orgUnitIds;
+
+ //alert( orgUnitIds );
+
+ if( orgUnitIds != null && orgUnitIds != "" )
+ {
+ var dataSetId = $( '#dataSetId' ).val();
+ var periodId = $( '#selectedPeriodId' ).val();
+ $.getJSON( 'getOrganisationUnitForQuality.action', {orgUnitId:orgUnitIds[0]}
+ , function( json )
+ {
+ var type = json.response;
+ setFieldValue('orgUnitName', json.message );
+ setFieldValue('selectedOrgunitName', json.message );
+ if( type == "success" )
+ {
+ enable('dataSetId');
+
+ var options = '';
+ $.each(json.dataSets, function(i, obj){
+ options += '<option value="' + obj.id + '"'+ '>' + obj.name + '</option>';
+ });
+ $("select#dataSetId").html(options);
+
+ $("select#dataSetId option[value="+dataSetId+"]").attr('selected', 'selected');
+ $("select#selectedPeriodId option[value="+periodId+"]").attr('selected', 'selected');
+ loadPeriods();
+ setFieldValue('selectedOrgunitID',orgUnitIds[0])
+ setFieldValue('orgUnitName', json.message );
+ setFieldValue('selectedOrgunitName', json.message );
+ }
+ else if( type == "input" )
+ {
+ disable('dataSetId');
+ disable('selectedPeriodId');
+ disable('prevButton');
+ disable('nextButton');
+
+ setFieldValue('orgUnitName', json.message );
+ setFieldValue('selectedOrgunitName', json.message );
+ }
+ } );
+ }
+}
+
+selection.setListenerFunction( orgUnitHasBeenSelected );
+
+
+function loadDataEntryForm()
+{
+ var orgUnitId = $( '#selectedOrgunitID' ).val();
+ var dataSetId = $( '#dataSetId' ).val();
+ $( '#dataEntryFormDiv' ).html('');
+
+ $( '#saveButton' ).removeAttr( 'disabled' );
+
+
+ var selectedPeriodId = $( '#selectedPeriodId' ).val();
+
+ if ( selectedPeriodId == "-1" && dataSetId == "-1" )
+ {
+ $( '#dataEntryFormDiv' ).html('');
+ document.getElementById( "saveButton" ).disabled = true;
+ return false;
+ }
+
+ else
+ {
+ jQuery('#loaderDiv').show();
+
+ jQuery('#dataEntryFormDiv').load('loadQualityScoreForm.action',
+ {
+ orgUnitId:orgUnitId,
+ dataSetId:dataSetId,
+ selectedPeriodId:selectedPeriodId
+ }, function()
+ {
+ showById('dataEntryFormDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+ }
+
+}
+
+function saveValue(dataElementId)
+{
+ var period = document.getElementById("selectedPeriodId").value;
+ var valueId = "score_"+dataElementId;
+
+ var fieldId = "#"+valueId;
+ var defaultValue = document.getElementById(valueId).defaultValue;
+ var value = document.getElementById(valueId).value;
+
+ if(defaultValue != value)
+ {
+ var dataValue = {
+ 'dataElementId' : dataElementId,
+ 'organisationUnitId' : $("#selectedOrgunitID").val(),
+ 'periodIso' : period,
+ 'value' : value
+ };
+ jQuery.ajax( {
+ url: 'saveDataValue.action',
+ data: dataValue,
+ dataType: 'json',
+ success: handleSuccess,
+ error: handleError
+ } );
+ }
+
+ function handleSuccess( json )
+ {
+ var code = json.c;
+ if ( code == '0' || code == 0) // Value successfully saved on server
+ {
+ markValue( fieldId, COLOR_GREEN );
+ }
+ else if ( code == 2 )
+ {
+ markValue( fieldId, COLOR_RED );
+ window.alert( i18n_saving_value_failed_dataset_is_locked );
+ }
+ else // Server error during save
+ {
+ markValue( fieldId, COLOR_RED );
+ window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+ }
+ }
+
+ function handleError( jqXHR, textStatus, errorThrown )
+ {
+ markValue( fieldId, COLOR_GREEN );
+ }
+
+ function markValue( fieldId, color )
+ {
+ document.getElementById(valueId).style.backgroundColor = color;
+ }
+}
+
+
+function savePBFDataValue( dataElementId, valueType )
+{
+ var period = document.getElementById("selectedPeriodId").value;
+ var dataSetId = $( '#dataSetId' ).val();
+ var valueId = "";
+ if( valueType == 1 )
+ {
+ valueId = "pbfdv_qty_reported_"+dataElementId;
+ }
+ else
+ {
+ valueId = "pbfdv_qty_validated_"+dataElementId;
+ }
+
+ var fieldId = "#"+valueId;
+ var defaultValue = document.getElementById(valueId).defaultValue;
+ var value = document.getElementById( valueId ).value;
+
+ if(defaultValue != value)
+ {
+ var dataValue = {
+ 'dataElementId' : dataElementId,
+ 'valueType' : valueType,
+ 'dataSetId' : dataSetId,
+ 'organisationUnitId' : $("#selectedOrgunitID").val(),
+ 'periodIso' : period,
+ 'value' : value
+ };
+ jQuery.ajax( {
+ url: 'saveValue.action',
+ data: dataValue,
+ dataType: 'json',
+ success: handleSuccess,
+ error: handleError
+ } );
+ }
+
+ function handleSuccess( json )
+ {
+ var code = json.c;
+
+ alert(code)
+ if ( code == '0' || code == 0) // Value successfully saved on server
+ {
+ markValue( fieldId, COLOR_GREEN );
+ }
+ else if ( code == 2 )
+ {
+ markValue( fieldId, COLOR_RED );
+ window.alert( i18n_saving_value_failed_dataset_is_locked );
+ }
+ else // Server error during save
+ {
+ markValue( fieldId, COLOR_RED );
+ window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+ }
+ }
+
+ function handleError( jqXHR, textStatus, errorThrown )
+ {
+ markValue( fieldId, COLOR_GREEN );
+ }
+
+ function markValue( fieldId, color )
+ {
+ document.getElementById(valueId).style.backgroundColor = color;
+ }
+}
+
+// load periods
+function loadPeriods()
+{
+ $( '#dataEntryFormDiv' ).html( '' );
+
+ var orgUnitId = $( '#selectedOrgunitID' ).val();
+
+ var dataSetId = $( '#dataSetId' ).val();
+
+
+ if ( dataSetId == "-1" )
+ {
+ showWarningMessage( i18n_select_dataset );
+
+ document.getElementById( "selectedPeriodId" ).disabled = true;
+ document.getElementById( "prevButton" ).disabled = true;
+ document.getElementById( "nextButton" ).disabled = true;
+ return false;
+ }
+
+ else
+ {
+
+ enable('selectedPeriodId');
+
+ enable('prevButton');
+ enable('nextButton');
+
+ var url = 'loadPeriods.action?dataSetId=' + dataSetId;
+
+ var list = document.getElementById( 'selectedPeriodId' );
+
+ clearList( list );
+
+ addOptionToList( list, '-1', '[ Select ]' );
+
+ $.getJSON( url, function( json ) {
+ for ( i in json.periods ) {
+ addOptionToList( list, json.periods[i].isoDate, json.periods[i].name );
+ }
+ } );
+
+ }
+}
+
+
+//next and pre periods
+function getAvailablePeriodsTemp( availablePeriodsId, selectedPeriodsId, year )
+{
+ $( '#dataEntryFormDiv' ).html( '' );
+
+ var dataSetId = $( '#dataSetId' ).val();
+
+ var availableList = document.getElementById( availablePeriodsId );
+ var selectedList = document.getElementById( selectedPeriodsId );
+
+ clearList( selectedList );
+
+ addOptionToList( selectedList, '-1', '[ Select ]' );
+
+ $.getJSON( "getAvailableNextPrePeriods.action", {
+ "dataSetId": dataSetId ,
+ "year": year },
+ function( json ) {
+
+ for ( i in json.periods ) {
+ addOptionToList( selectedList, json.periods[i].isoDate, json.periods[i].name );
+ }
+
+ } );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseInput.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseInput.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseInput.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,4 @@
+{
+ "response": "input",
+ "message": "$!encoder.jsonEncode( ${message} )"
+}
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseSuccess.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseSuccess.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonResponseSuccess.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,14 @@
+#set( $size = $dataSets.size() )
+{
+ "response": "success",
+ "message": "$!encoder.jsonEncode( ${message} )",
+ "dataSets": [
+#foreach( $dataSet in $dataSets )
+ {
+ "id": ${dataSet.id} ,
+ "name": "$!encoder.jsonEncode( ${dataSet.displayName} )"
+ }#if( $velocityCount < $size ),#end
+#end
+]
+ #if( $statusCode ),"status": ${statusCode}#end
+}
\ No newline at end of file
=== 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-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm 2014-01-18 12:25:59 +0000
@@ -1,21 +1,3 @@
-<style>
- .x-column-header-inner .x-column-header-text {
- white-space: normal;
- z-index:0;
- }
-
- .x-column-header-inner {
- line-height: normal;
- }
- .x-grid-row .x-grid-cell-inner {
- white-space: normal;
- }
- .x-grid-row-over .x-grid-cell-inner {
- font-weight: bold;
- white-space: normal;
- }
-
-</style>
<script >
function organisationUnitSelected( orgUnits, orgUnitNames )
=== 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-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm 2014-01-18 12:25:59 +0000
@@ -1,21 +1,3 @@
-<style>
- .x-column-header-inner .x-column-header-text {
- white-space: normal;
- z-index:0;
- }
-
- .x-column-header-inner {
- line-height: normal;
- }
- .x-grid-row .x-grid-cell-inner {
- white-space: normal;
- }
- .x-grid-row-over .x-grid-cell-inner {
- font-weight: bold;
- white-space: normal;
- }
-
-</style>
<script >
$(function() {
$("#addDataElement").button();
@@ -150,7 +132,7 @@
<input type="hidden" name="dataElementName" id="dataElementName" value="">
<table width="50%">
<tr>
- <td >Orgainsation Unit: <input type="text" id="orgUnit" name="orgUnit" readonly size="40"/></td>
+ <td >Orgainsation Unit: <input type="text" id="orgUnit" name="orgUnit" readonly size="38"/></td>
<td > </td>
</tr>
<tr >
@@ -163,5 +145,5 @@
</tr>
</table>
<br/><br/><br/>
-<div id="loadTariffDetails" style="width:90%"></div>
+<div id="loadTariffDetails" style="width:85%"></div>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm 2014-01-07 17:56:19 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm 2014-01-18 12:25:59 +0000
@@ -24,20 +24,27 @@
#set( $tabIndex = 1 )
#if ( $dataElements.size() > 0)
-<table class="formSection" id="dataEntryTable">
+<table class="formSection" id="dataEntryTable" style="width:100%">
<tr bgcolor="#CBDDEB">
- <th>$i18n.getString( "dataelement" )</th>
- <th style="text-align: center;">$i18n.getString( "qty_reported" )</th>
- <th style="text-align: center;">$i18n.getString( "qty_validated" )</th>
- <th style="text-align: center;">$i18n.getString( "tariff_amount" )</th>
- <th style="text-align: center;">$i18n.getString( "total" )</th>
+ <th style="width:35%;">$i18n.getString( "dataelement" )</th>
+ <th style="text-align: center;width:15%;">$i18n.getString( "qty_reported" )</th>
+ <th style="text-align: center;width:15%;">$i18n.getString( "qty_validated" )</th>
+ <th style="text-align: center;width:15%;">$i18n.getString( "tariff_amount" )</th>
+ <th style="text-align: center;width:15%;">$i18n.getString( "total" )</th>
</tr>
-
+ <script>
+ var allTotal = 0.0;
+ </script>
#set( $mark = false )
#foreach($dataElement in $dataElements )
- <tr #alternate($mark)>
+ #if( $mark1 )
+ #set( $mark1 = false )
+ #else
+ #set( $mark1 = true )
+ #end
+ <tr #if( $mark1 ) bgcolor = "#FFFFFF" #else bgcolor="#E0ECF8" #end>
<td><label>$dataElement.getFormNameFallback()</label></td>
- #set( $count = 1)
+ #set( $count = 0)
#set( $pbfDataValue = $!pbfDataValueMap.get( $dataElement ) )
<td>
<input onblur="savePBFDataValue('$dataElement.id', 1 )" type="text" name="pbfdv_qty_reported_$dataElement.id" id="pbfdv_qty_reported_$dataElement.id"
@@ -48,15 +55,29 @@
#elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}"
#end />
</td>
+
<td>
- <input onblur="savePBFDataValue('$dataElement.id', 2 )" type="text" name="pbfdv_qty_validated_$dataElement.id" id="pbfdv_qty_validated_$dataElement.id"
+ <input onblur="savePBFDataValue('$dataElement.id', 2 )" onkeyup="calTariffVal('$dataElement.id')" type="text" name="pbfdv_qty_validated_$dataElement.id" id="pbfdv_qty_validated_$dataElement.id"
value="$!pbfDataValue.quantityValidated" tabindex="$tabIndex" style="text-align: center;"
#if($dataElement.type =='number') class="{validate:{number:true}}"
#elseif($dataElement.type =='int') class="{validate:{integer:true}}"
#elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}"
#elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}"
- #end class="quantity$count" onkeyup="calVal()" />
+ #end class="quantity$count" />
</td>
+ <script>
+ function changeInt()
+ {
+ var tariff = 0.0;
+ if('$!pbfDataValue.tariffAmount' != '' )
+ {
+ tariff = parseFloat($pbfDataValue.tariffAmount);
+ $('#pbfdv_tariff_amt_'+$dataElement.id).val(tariff);
+ }
+
+ }
+ changeInt();
+ </script>
<td>
<input type="text" name="pbfdv_tariff_amt_$dataElement.id" id="pbfdv_tariff_amt_$dataElement.id"
value="$!pbfDataValue.tariffAmount" tabindex="$tabIndex" style="text-align: center;"
@@ -64,120 +85,98 @@
#elseif($dataElement.type =='int') class="{validate:{integer:true}}"
#elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}"
#elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}"
- #end class="tariff$count" readonly />
+ #end class="tariff$count" readonly/>
</td>
-
- <script >
- function calVal() {
- var total = 0;
- var quantity = $('.quantity'+$count).val();
- var tariff = $('.tariff'+$count).val();
-
- total = quantity * tariff;
-
- $('.row-total'+$count).val(total);
- }
-
- calVal();
-
- $('input').on('keyup', function() {
- calVal();
- });
- </script>
- #end
- #set( $count = $count + 1)
- <td >
- <input type="text" class="row-total$count"/>
- </td>
-
- </tr>
- #set( $tabIndex = $tabIndex + 1 )
- #set( $mark = !$mark)
- #end
- <tr>
- <td > </td>
- <td > </td>
- <td > </td>
- <td > </td>
- <td >
- <input type="text" class="all-total"/>
- </td>
- </tr>
-
-</table
-
-#end
-
-<!--
-#set( $tabIndex = 1 )
-#if ( $dataElements.size() > 0)
-
-<table class="formSection" id="dataEntryTable">
- <tr bgcolor="#CBDDEB">
- <th>$i18n.getString( "dataelement" )</th>
-
- #foreach($optionCombo in $optionCombos )
- <th style="text-align: center;">$encoder.htmlEncode( $optionCombo.name )</th>
- #end
- <th style="text-align: center;">$i18n.getString( "total" )</th>
- </tr>
-
- #set( $mark = false )
- #foreach($dataElement in $dataElements )
- <tr #alternate($mark)>
- <td><label>$dataElement.getFormNameFallback()</label></td>
- #set( $count = 1)
- #foreach($optionCombo in $optionCombos )
- #set( $valueMapId = $dataElement.id + ':' + $optionCombo.id )
- #set( $dataValue = "" )
- #set( $dataValue = $!dataValueMap.get( $valueMapId ) )
- <td>
- <input onblur="saveValue('$dataElement.id','$optionCombo.id')" type="text" name="dataelement$valueMapId" id="dataelement$valueMapId"
- value="$!dataValue" tabindex="$tabIndex" style="text-align: center;"
- #if($dataElement.type =='number') class="{validate:{number:true}}"
- #elseif($dataElement.type =='int') class="{validate:{integer:true}}"
- #elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}"
- #elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}"
- #end #if($tariffOptCombo.id == $optionCombo.id) class="tariff$count" readonly #elseif($qValOptCombo.id ==$optionCombo.id) class="quantity$count" onkeyup="calVal()" #end/>
- </td>
- <script >
- function calVal() {
- var total = 0;
- var quantity = $('.quantity'+$count).val();
- var tariff = $('.tariff'+$count).val();
-
- total = quantity * tariff;
-
- $('.row-total'+$count).val(total);
- }
-
- calVal();
-
- $('input').on('keyup', function() {
- calVal();
- });
- </script>
- #end
- #set( $count = $count + 1)
- <td >
- <input type="text" class="row-total$count"/>
- </td>
-
- </tr>
- #set( $tabIndex = $tabIndex + 1 )
- #set( $mark = !$mark)
- #end
- <tr>
- <td > </td>
- <td > </td>
- <td > </td>
- <td > </td>
- <td >
- <input type="text" class="all-total"/>
- </td>
- </tr>
-
-</table
-
-#end
--->
\ No newline at end of file
+ <td >
+ <input type="text" id="total_$dataElement.id" style="text-align: center;" readonly/>
+ </td>
+ <script >
+ function calVal( ) {
+ var total = 0.0;
+ var quantity = 0.0;
+ var tariff = 0.0;
+ if($('#pbfdv_tariff_amt_'+$dataElement.id).val() != '')
+ {
+ tariff = parseFloat($('#pbfdv_tariff_amt_'+$dataElement.id).val());
+ }
+ else
+ {
+ tariff = 0;
+ }
+
+ if($('#pbfdv_qty_validated_'+$dataElement.id).val() != '')
+ {
+ quantity = parseFloat($('#pbfdv_qty_validated_'+$dataElement.id).val());
+
+ }
+ else
+ {
+ quantity = 0;
+ }
+
+ total = quantity * tariff;
+
+ $('#total_'+$dataElement.id).val(total);
+
+ allTotal = allTotal + total;
+
+ $('#all-total').val(allTotal);
+ }
+
+ calVal();
+
+ $('input').on('keyup', function() {
+ calVal();
+ });
+ </script>
+
+ #end
+
+ #set( $count = $count + 1)
+ </tr>
+ #set( $tabIndex = $tabIndex + 1 )
+ #set( $mark = !$mark)
+ #end
+ <tr>
+ <td > </td>
+ <td > </td>
+ <td > </td>
+ <td > </td>
+ <td >
+ <input type="text" id="all-total" style="text-align: center;" readonly/>
+ </td>
+ </tr>
+ <script>
+ function calTariffVal( dataElementId ) {
+ var total = 0.0;
+ var quantity = 0.0;
+ var tariff = 0.0;
+ if($('#pbfdv_tariff_amt_'+dataElementId).val() != '')
+ {
+ tariff = parseFloat($('#pbfdv_tariff_amt_'+dataElementId).val());
+ }
+ else
+ {
+ tariff = 0;
+ }
+
+ if($('#pbfdv_qty_validated_'+dataElementId).val() != '')
+ {
+ quantity = parseFloat($('#pbfdv_qty_validated_'+dataElementId).val());
+
+ }
+ else
+ {
+ quantity = 0;
+ }
+
+ total = quantity * tariff;
+
+ $('#total_'+dataElementId).val(total);
+
+ allTotal = allTotal + total;
+
+ $('#all-total').val(allTotal);
+ }
+ </script>
+</table>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityMaxEntryForm.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityMaxEntryForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityMaxEntryForm.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,53 @@
+
+#macro( validate $type $require )
+ #if( $type == "NUMBER" || $type == "number" )
+ {validate:{ number:true #if($require), required:true #end }}
+
+ #elseif( $type == "int" )
+ {validate:{ integer:true #if($require), required:true #end }}
+
+ #elseif( $type == "positiveNumber" )
+ {validate:{ positive_integer:true #if($require), required:true #end }}
+
+ #elseif( $type == "negativeNumber" )
+ {validate:{ negative_integer:true #if($require), required:true #end }}
+
+
+ #elseif( $require )
+ {validate:{required:true}}
+ #end
+#end
+
+#set( $tabIndex = 1 )
+#if ( $dataElements.size() > 0)
+
+<table class="formSection" id="dataEntryTable" style="width:50%;">
+ <tr bgcolor="#CBDDEB">
+ <th style="text-align: left;width:35%;">$i18n.getString( "dataelement" )</th>
+ <th style="text-align: center;width:15%;">$i18n.getString( "quality_max" )</th>
+ </tr>
+ #set( $mark = false )
+ #foreach($dataElement in $dataElements )
+ #if( $mark1 )
+ #set( $mark1 = false )
+ #else
+ #set( $mark1 = true )
+ #end
+ <tr #if( $mark1 ) bgcolor = "#FFFFFF" #else bgcolor="#E0ECF8" #end>
+ <td><label>$dataElement.getFormNameFallback()</label></td>
+
+ #set( $qualityDataValue = $!qualityMaxValueMap.get( $dataElement.id ) )
+
+ <td>
+ <input onblur="saveQualityDataValue('$dataElement.id')" type="text" name="value_$dataElement.id" id="value_$dataElement.id"
+ value="$!qualityDataValue.value" tabindex="$tabIndex" style="text-align: center;width:100%;"
+ #if($dataElement.type =='number') class="{validate:{number:true}}"
+ #elseif($dataElement.type =='int') class="{validate:{integer:true}}"
+ #elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}"
+ #elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}"
+ #end />
+ </td>
+ </tr>
+ #end
+#end
+</table>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityStoreEntryForm.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityStoreEntryForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityStoreEntryForm.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,103 @@
+
+#macro( validate $type $require )
+ #if( $type == "NUMBER" || $type == "number" )
+ {validate:{ number:true #if($require), required:true #end }}
+
+ #elseif( $type == "int" )
+ {validate:{ integer:true #if($require), required:true #end }}
+
+ #elseif( $type == "positiveNumber" )
+ {validate:{ positive_integer:true #if($require), required:true #end }}
+
+ #elseif( $type == "negativeNumber" )
+ {validate:{ negative_integer:true #if($require), required:true #end }}
+
+
+ #elseif( $require )
+ {validate:{required:true}}
+ #end
+#end
+
+#set( $tabIndex = 1 )
+#if ( $dataElements.size() > 0)
+
+<table class="formSection" id="dataEntryTable">
+ <tr bgcolor="#CBDDEB">
+ <th style="text-align: left;">$i18n.getString( "dataelement" )</th>
+ <th style="text-align: center;">$i18n.getString( "quality_score" )</th>
+ <th style="text-align: center;">$i18n.getString( "quality_max" )</th>
+ <th style="text-align: center;">$i18n.getString( "quality_percentage" )</th>
+ </tr>
+ <script>
+ var allTotal = 0.0;
+ </script>
+
+ #set( $mark = false )
+ #set( $count = 0)
+ #foreach($dataElement in $dataElements )
+ #set( $count = $count + 1)
+ #if( $mark1 )
+ #set( $mark1 = false )
+ #else
+ #set( $mark1 = true )
+ #end
+ <tr #if( $mark1 ) bgcolor = "#FFFFFF" #else bgcolor="#E0ECF8" #end>
+ <td><label>$dataElement.getFormNameFallback()</label></td>
+
+ #set( $qualityMaxValue = $!qualityMaxValueMap.get( $dataElement.id ) )
+ #set( $dataValue = $!dataValueMap.get( $dataElement.id ) )
+ <td>
+ <input onkeyup="calPercenVal( $dataElement.id )" onblur="saveValue('$dataElement.id')" type="text" name="score_$dataElement.id" id="score_$dataElement.id"
+ value="$!dataValue.value" tabindex="$tabIndex" style="text-align: center;"
+ #if($dataElement.type =='number') class="{validate:{number:true}}"
+ #elseif($dataElement.type =='int') class="{validate:{integer:true}}"
+ #elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}"
+ #elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}"
+ #end />
+ </td>
+ <script>
+ function changeInt()
+ {
+ var percentage = 0.0;
+ if('$!dataValue.value' != '' && $!qualityMaxValue.value != '')
+ {
+ percentage = (parseFloat($dataValue.value) * 100) / parseFloat($qualityMaxValue.value);
+ $('#percentage_'+$dataElement.id).val(percentage.toFixed(2));
+ }
+
+ allTotal = (allTotal + percentage)/$count;
+
+ $('#all-total').val(allTotal.toFixed(2));
+ }
+ changeInt();
+ </script>
+ <td>
+ <input type="text" name="max_$dataElement.id" id="max_$dataElement.id" value="$!qualityMaxValue.value" tabindex="$tabIndex" style="text-align: center;" readonly/>
+ </td>
+ <td >
+ <input type="text" id="percentage_$dataElement.id" style="text-align: center;" readonly/>
+ </td>
+
+ </tr>
+ #end
+ #end
+ <tr>
+ <td colspan="3" style="text-align: right;">Overall Score ( Sum Score/Sum Max Score )</td>
+ <td >
+ <input type="text" id="all-total" style="text-align: center;" readonly size="18"/>%
+ </td>
+ </tr>
+</table>
+<script >
+ function calPercenVal( dataElementId )
+ {
+ var percentage = 0.0;
+ if($("#score_"+dataElementId).val() != '' && $("#max_"+dataElementId).val() != '')
+ {
+ percentage = (parseFloat($("#score_"+dataElementId).val()) * 100) / parseFloat($("#max_"+dataElementId).val());
+ $('#percentage_'+dataElementId).val(percentage.toFixed(2));
+ }
+ allTotal = (allTotal + percentage) / $count;
+ $('#all-total').val(allTotal.toFixed(2));
+ }
+</script>
=== 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-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm 2014-01-18 12:25:59 +0000
@@ -23,8 +23,8 @@
enableColumnMove: true,
enableColumnResize: true,
sortOnLoad: true,
- minWidth: 100,
- minHeight: 100,
+ width: 840,
+ height: 360,
sorters: {direction: 'ASC'}
});
@@ -41,7 +41,9 @@
$( "#addTariff" ).dialog( "open" );
$('#pbfType option[value=-1]').attr('selected','selected');
$("#pbfType ").removeAttr('disabled');
- $("#tariff").val('');
+ $("#tariff").val('');
+ $("#target").val('');
+ $("#targetPercentage").val('');
$("#startDate").val('');
$("#startDate ").removeAttr('disabled');
$("#endDate").val('');
@@ -102,13 +104,15 @@
}
}
- function editTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate, value )
+ function editTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate, value, target, targetPercentage )
{
validateAddTariff();
$( "#addTariff" ).dialog('option', 'title', 'Edit Tariff');
$('#pbfType option[value='+dataSetId+']').attr('selected','selected');
$('#pbfType').attr('disabled','disabled');
$('#tariff').val(value);
+ $('#target').val(target);
+ $('#targetPercentage').val(targetPercentage);
$('#startDate').val(startDate);
$('#startDate').attr('disabled','disabled');
$('#endDate').val(endDate);
@@ -147,7 +151,7 @@
}
return bValue;
}
- function handleSuccess( json )
+ function handleSuccess( json )
{
if(json.message == "true")
{
@@ -162,7 +166,9 @@
'startDate' : $("#startDate").val(),
'endDate' : $("#endDate").val(),
'orgUnitUid': $("#orgUnitUid").val(),
- 'dataElementId' : $("#dataElementId").val()
+ 'dataElementId' : $("#dataElementId").val(),
+ 'target' : $("#target").val(),
+ 'targetPercentage' : $("#targetPercentage").val(),
};
jQuery.ajax( {
url: 'addTariffData.action',
@@ -174,7 +180,8 @@
}
}
function handleError( json )
- {
+ {
+
}
function addTariffSuccess( json )
@@ -227,11 +234,13 @@
<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">
+<table style="width:100%" id="tariffDetails" name="tariffDetails" cellspacing="0">
<thead >
<tr >
<th >PBF Type</th>
<th >Tariff</th>
+ <th >Target</th>
+ <th >Target %</th>
<th >Start Date</th>
<th >End Date</th>
##if( $updateAuthority == 'Yes' )
@@ -250,6 +259,8 @@
<tr >
<td >$!tariff.dataSet.name</td>
<td >$!tariff.value</td>
+ <td >$!tariff.target</td>
+ <td >$!tariff.targetPercentage</td>
<td data-sorter="shortDate" data-date-format="yyyymmdd">$simpleDateFormat.format($!tariff.startDate)</td>
<td data-sorter="shortDate" data-date-format="yyyymmdd">$simpleDateFormat.format($!tariff.endDate)</td>
##if($updateAuthority == 'Yes')
@@ -257,8 +268,8 @@
<a href="javascript:deleteTariffDataValue('$tariff.organisationUnit.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate')">
<img src="images/delete.png" width="17px"/>
</a>
- <a href="javascript:editTariffDataValue('$tariff.organisationUnit.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate','$tariff.value')">
- <img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/>
+ <a href="javascript:editTariffDataValue('$tariff.organisationUnit.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate','$tariff.value','$!tariff.target','$!tariff.targetPercentage')">
+ <img src="../images/edit.png" alt="$i18n.getString( 'edit' )" width="17px"/>
</a>
</td>
##end
@@ -301,7 +312,20 @@
<td style="width:40%;">Tariff <b class="mandatory">*</b> </td>
<td style="width:60%;"><input type="text" id="tariff" 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: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:60%;"><input type="text" id="targetPercentage" style="width:100%;" value="" onblur="validateAddTariff()" /></td>
+ </tr>
</table>
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm 2013-12-21 09:11:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm 2014-01-18 12:25:59 +0000
@@ -6,4 +6,8 @@
<li><a href="dataElementTariffManagement.action">$i18n.getString( "dataelement_tariff_management" )</a></li>
<li><a href="bankDetailsManagement.action">$i18n.getString( "bank_details_management" )</a></li>
+
+ <li><a href="qualityMaxDataEntry.action">$i18n.getString( "quality_max_entry" )</a></li>
+
+ <li><a href="qualityScoreDataEntry.action">$i18n.getString( "quality_store_entry" )</a></li>
</ul>
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityMaxEntrySelection.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,70 @@
+<script>
+
+ jQuery(document).ready( function(){
+
+ datePicker( 'startDate');
+ datePicker( 'endDate');
+
+ currentDiv = 'qualityMaxDataEntryForm';
+
+ });
+
+</script>
+
+<h3>$i18n.getString( "quality_max_entry" )</h3>
+
+<form id="qualityMaxDataEntryForm" name="qualityMaxDataEntryForm" method="post" >
+<div>
+ <input type="hidden" id='selectedOrgunitID' name = 'selectedOrgunitID' value="$!organisationUnit.uid" />
+ <input type="hidden" id='selectedOrgunitName' name = 'selectedOrgunitName' value="$!organisationUnit.name" />
+
+</div>
+
+<div class="inputCriteria" style="width:480px;height:auto;">
+<table>
+ <tr>
+ <td><label for="orgUnitName">$i18n.getString( "organisation_unit" )</label></td>
+ <td><input type="text" id="orgUnitName" name = "orgUnitName" readonly="readonly" value="$!organisationUnit.name" style="width:352px"></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "dataset" )</label></td>
+ <td>
+ <select id="dataSetId" name = "dataSetId" style="width:354px" onchange="loadDataEntryForm()" #if( $dataSets.size() == 0 ) disabled="disabled" #end>
+ <option value="-1">$i18n.getString( "select_dataSet" )</option>
+ #foreach( $dataSet in $dataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><label>Start Date</label></td>
+ <td>
+ <input type="text" id="startDate" name="startDate" style="width:100%;" onchange="loadDataEntryForm()"/>
+ </td>
+ </tr>
+ <tr>
+ <td><label>End Date</label></td>
+ <td>
+ <input type="text" id="endDate" name="endDate" style="width:100%;" onchange="loadDataEntryForm()"/>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+#parse( "/dhis-web-commons/loader/loader.vm" )
+<div id='dataEntryFormDiv'></div> <!-- DataEntry Form -->
+
+</form>
+
+<script type="text/javascript">
+
+var i18n_select_dataset = '$encoder.jsEscape( $i18n.getString( "select_dataSet" ) , "'")';
+
+
+jQuery( document ).ready( function()
+{
+});
+</script>
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityStoreEntrySelection.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityStoreEntrySelection.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityStoreEntrySelection.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,80 @@
+<script>
+
+ jQuery(document).ready( function(){
+ currentDiv = 'pbfDataEntryForm';
+ isSubmit = true;
+ jQuery("#pbfDataEntryForm").validate({
+ meta:"validate"
+ ,errorElement:"span"
+ ,submitHandler: function(form)
+ {
+ if( isSubmit )
+ {
+ savePBFDataEntryForm();
+ }
+ }
+ });
+ });
+
+</script>
+
+<h3>Quality Score Data Entry</h3>
+
+<form id="pbfDataEntryForm" name="pbfDataEntryForm" method="post" >
+<div>
+ <input type="hidden" id='selectedOrgunitID' name = 'selectedOrgunitID' value="$!organisationUnit.uid" />
+ <input type="hidden" id='selectedOrgunitName' name = 'selectedOrgunitName' value="$!organisationUnit.name" />
+
+</div>
+
+<div class="inputCriteria" style="width:480px;height:90px;">
+<table>
+ <tr>
+ <td><label for="orgUnitName">$i18n.getString( "organisation_unit" )</label></td>
+ <td><input type="text" id="orgUnitName" name = "orgUnitName" readonly="readonly" value="$!organisationUnit.name" style="width:352px"></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "dataset" )</label></td>
+ <td>
+ <select id="dataSetId" name = "dataSetId" style="width:354px" onchange="loadPeriods();" #if( $dataSets.size() == 0 ) disabled="disabled" #end>
+ <option value="-1">$i18n.getString( "select_dataSet" )</option>
+ #foreach( $dataSet in $dataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="selectedPeriodId">$i18n.getString( "period" )</label></td>
+ <td><select id="selectedPeriodId" name="selectedPeriodId" style="width:200px" disabled="disabled" onchange="loadDataEntryForm()">
+ <option value="-1">[$i18n.getString( "select" )]</option>
+ #foreach( $period in $periods )
+ <option value="$period.iso">$encoder.htmlEncode( $period.name )</option>
+ #end
+ </select>
+ <input type="button" id="prevButton" disabled="disabled" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="getAvailablePeriodsTemp( 'selectedPeriodId', 'selectedPeriodId', '-1' )" >
+ <input type="button" id="nextButton" disabled="disabled" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="getAvailablePeriodsTemp( 'selectedPeriodId', 'selectedPeriodId', '1' )" >
+
+ </td>
+ </tr>
+
+</table>
+</div>
+
+
+#parse( "/dhis-web-commons/loader/loader.vm" )
+<div id='dataEntryFormDiv'></div> <!-- DataEntry Form -->
+
+</form>
+
+<script type="text/javascript">
+
+var i18n_select_dataset = '$encoder.jsEscape( $i18n.getString( "select_dataSet" ) , "'")';
+
+
+jQuery( document ).ready( function()
+{
+});
+</script>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/status.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/status.vm 2014-01-07 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/status.vm 2014-01-18 12:25:59 +0000
@@ -1,5 +1,3 @@
{
-"message":"${message}",
-"dataSets":${dataSets},
"c":"${statusCode}"
}
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm 2014-01-18 12:25:59 +0000
@@ -0,0 +1,3 @@
+{
+"message":"${message}"
+}
\ No newline at end of file