dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29669
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15014: RBF: work in progress - Changing setting TariffData to orgunit group instead orgunit level
------------------------------------------------------------
revno: 15014
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-04-27 09:51:10 +0100
message:
RBF: work in progress - Changing setting TariffData to orgunit group instead orgunit level
modified:
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/GetDataElementforTariffAction.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.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-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java 2014-04-27 08:51:10 +0000
@@ -7,11 +7,13 @@
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.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.rbf.api.TariffDataValue;
import org.hisp.dhis.rbf.api.TariffDataValueService;
import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -57,6 +59,9 @@
this.dataSetService = dataSetService;
}
+ @Autowired
+ private OrganisationUnitGroupService orgUnitGroupService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -77,7 +82,13 @@
private String targetPercentage;
- public void setTarget(String target) {
+ private Integer orgUnitGroupId;
+
+ public void setOrgUnitGroupId(Integer orgUnitGroupId) {
+ this.orgUnitGroupId = orgUnitGroupId;
+ }
+
+ public void setTarget(String target) {
this.target = target;
}
@@ -129,11 +140,13 @@
DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+ //OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+
+ OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( pbfType ) );
- TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( organisationUnit, dataElement, dataSet, sDate, eDate );
+ TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( orgUnitGroup, dataElement, dataSet, sDate, eDate );
if ( tariffDataValue == null )
{
@@ -154,7 +167,8 @@
tariffDataValue.setStoredBy( currentUserService.getCurrentUsername() );
tariffDataValue.setDataElement( dataElement );
tariffDataValue.setDataSet( dataSet );
- tariffDataValue.setOrganisationUnit( organisationUnit );
+ //tariffDataValue.setOrganisationUnit( organisationUnit );
+ tariffDataValue.setOrgUnitGroup( orgUnitGroup );
tariffDataValueService.addTariffDataValue( tariffDataValue );
System.out.println("Tariff Data Added");
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/GetDataElementforTariffAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/GetDataElementforTariffAction.java 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/GetDataElementforTariffAction.java 2014-04-27 08:51:10 +0000
@@ -14,6 +14,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -49,13 +50,9 @@
this.organisationUnitService = organisationUnitService;
}
+ @Autowired
private OrganisationUnitGroupService orgUnitGroupService;
-
- public void setOrgUnitGroupService( OrganisationUnitGroupService orgUnitGroupService )
- {
- this.orgUnitGroupService = orgUnitGroupService;
- }
-
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java 2014-04-27 08:51:10 +0000
@@ -9,6 +9,8 @@
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.rbf.api.Lookup;
import org.hisp.dhis.rbf.api.LookupService;
@@ -17,6 +19,7 @@
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -70,9 +73,19 @@
this.dataSetService = dataSetService;
}
+ @Autowired
+ private OrganisationUnitGroupService orgUnitGroupService;
+
// -------------------------------------------------------------------------
// Input / Output
// -------------------------------------------------------------------------
+ private Integer orgUnitGroupId;
+
+ public void setOrgUnitGroupId(Integer orgUnitGroupId)
+ {
+ this.orgUnitGroupId = orgUnitGroupId;
+ }
+
private String dataElementName;
public void setDataElementName( String dataElementName )
@@ -146,11 +159,15 @@
selecteddataElement = dataElementService.getDataElementByName( dataElementName );
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+ //OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+
+ OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
//organisationUnit.getParent()
- tariffList = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( organisationUnit, selecteddataElement ) );
+ //tariffList = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( organisationUnit, selecteddataElement ) );
+
+ tariffList = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( orgUnitGroup, selecteddataElement ) );
List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java 2014-04-27 08:51:10 +0000
@@ -10,10 +10,13 @@
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.rbf.api.TariffDataValue;
import org.hisp.dhis.rbf.api.TariffDataValueService;
import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -59,6 +62,9 @@
this.dataSetService = dataSetService;
}
+ @Autowired
+ private OrganisationUnitGroupService orgUnitGroupService;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -73,7 +79,14 @@
private String orgUnitUid;
- public void setDataElementId( String dataElementId )
+ private Integer orgUnitGroupId;
+
+ public void setOrgUnitGroupId(Integer orgUnitGroupId)
+ {
+ this.orgUnitGroupId = orgUnitGroupId;
+ }
+
+ public void setDataElementId( String dataElementId )
{
this.dataElementId = dataElementId;
}
@@ -133,11 +146,13 @@
DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+ //OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+ OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
+
DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( pbfType ) );
- List<TariffDataValue> tariffDataValues = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues(organisationUnit, dataElement));
+ List<TariffDataValue> tariffDataValues = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues(orgUnitGroup, dataElement));
//boolean status = false;
for(TariffDataValue tdv : tariffDataValues)
{
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm 2014-04-27 08:51:10 +0000
@@ -52,28 +52,40 @@
});
});
-var changeOwner = function(combo, record, index) {
+
+var changeOwner = function(combo, record, index) {
var dataElementName = combo.getValue();
$('#dataElementName').val(dataElementName);
$('#loadTariffDetails').load("loadTariffDetails.action",
{
dataElementName:dataElementName,
- orgUnitUid:$("#orgUnitUid").val()
+ orgUnitGroupId : $( "#orgUnitGroupId" ).val()
}
, function( ){
});
};
+
function getTariffData()
{
$('#loadTariffDetails').load("loadTariffDetails.action",
{
- dataElementName : $('#dataElementName').val(),
- orgUnitUid : $("#orgUnitUid").val()
+ dataElementName : $('#dataElementName').val(),
+ orgUnitGroupId : $( "#orgUnitGroupId" ).val()
}
, function( ){
loadExtTariff();
});
}
+
+function orgUnitGroupChange()
+{
+ document.getElementById('simpleCombo').style.display = 'block';
+ document.getElementById('loadTariffDetails').style.display = 'block';
+ if($('#dataElementName').val() != '')
+ {
+ getTariffData();
+ }
+}
function organisationUnitSelected( orgUnits, orgUnitNames )
{
var countryTags = $levelOrgUnitIds;
@@ -145,7 +157,7 @@
<table width="60%">
<tr>
<td >Orgainsation Unit:
- <select id="orgUnitGroupId" name="orgUnitGroupId" >
+ <select id="orgUnitGroupId" name="orgUnitGroupId" onchange="javascript:orgUnitGroupChange()">
#foreach( $orgUnitGroup in $orgUnitGroups )
<option value="$!orgUnitGroup.id">$!orgUnitGroup.name</option>
#end
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm 2014-04-27 08:51:10 +0000
@@ -124,8 +124,8 @@
function deleteTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate)
{
- var dataValue = {
- 'organisationUnitId' : organisationUnitId ,
+ var dataValue = {
+ 'orgUnitGroupId' : $( "#orgUnitGroupId" ).val(),
'dataElementId' : dataElementId,
'dataSetId' : dataSetId,
'startDate' : startDate,
@@ -181,7 +181,7 @@
'pbfType' : $("#pbfType").val(),
'startDate' : $("#startDate").val(),
'endDate' : $("#endDate").val(),
- 'orgUnitUid': $("#orgUnitUid").val(),
+ 'orgUnitGroupId': $( "#orgUnitGroupId" ).val(),
'dataElementId' : $("#dataElementId").val()
};
jQuery.ajax( {
@@ -209,8 +209,8 @@
'pbfType' : $("#pbfType").val(),
'tariff' : $("#tariff").val(),
'startDate' : $("#startDate").val(),
- 'endDate' : $("#endDate").val(),
- 'orgUnitUid': $("#orgUnitUid").val(),
+ 'endDate' : $("#endDate").val(),
+ 'orgUnitGroupId': $( "#orgUnitGroupId" ).val(),
'dataElementId' : $("#dataElementId").val(),
'target' : $("#target").val(),
'targetPercentage' : $("#targetPercentage").val(),
@@ -310,10 +310,10 @@
<td data-sorter="shortDate" data-date-format="yyyymmdd">$simpleDateFormat.format($!tariff.endDate)</td>
##if($updateAuthority == 'Yes')
<td>
- <a href="javascript:deleteTariffDataValue('$tariff.organisationUnit.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate')">
+ <a href="javascript:deleteTariffDataValue('$tariff.orgUnitGroup.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','$!tariff.target','$!tariff.targetPercentage')">
+ <a href="javascript:editTariffDataValue('$tariff.orgUnitGroup.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>