dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26973
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13363: PBF: Added API for Bank Details
------------------------------------------------------------
revno: 13363
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-12-21 09:11:48 +0000
message:
PBF: Added API for Bank Details
added:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetails.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsService.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsStore.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultBankDetailsService.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateBankDetailsStore.java
local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/BankDetails.hbm.xml
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm
modified:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java
local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.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
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java 2013-12-21 09:11:48 +0000
@@ -0,0 +1,110 @@
+package org.hisp.dhis.pbf.action;
+
+import java.util.ArrayList;
+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.BankDetails;
+import org.hisp.dhis.pbf.api.BankDetailsService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadBankDetailsAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private BankDetailsService bankDetailsService;
+
+ public void setBankDetailsService( BankDetailsService bankDetailsService )
+ {
+ this.bankDetailsService = bankDetailsService;
+ }
+
+ 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 orgUnitUid;
+
+ public void setOrgUnitUid( String orgUnitUid )
+ {
+ this.orgUnitUid = orgUnitUid;
+ }
+
+ private List<DataSet> dataSets = new ArrayList<DataSet>();
+
+ public List<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+
+ private List<String> banks = new ArrayList<String>();
+
+ public List<String> getBanks()
+ {
+ return banks;
+ }
+
+ private List<BankDetails> bankDetailsList = new ArrayList<BankDetails>();
+
+ public List<BankDetails> getBankDetailsList()
+ {
+ return bankDetailsList;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ {
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+
+ bankDetailsList.addAll( bankDetailsService.getBankDetails( organisationUnit ) );
+
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
+ for( Lookup lookup : lookups )
+ {
+ Integer dataSetId = Integer.parseInt( lookup.getValue() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ dataSets.add( dataSet );
+ }
+
+ lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.BANK ) );
+ for( Lookup lookup : lookups )
+ {
+ banks.add( lookup.getValue() );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetails.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetails.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetails.java 2013-12-21 09:11:48 +0000
@@ -0,0 +1,142 @@
+package org.hisp.dhis.pbf.api;
+
+import java.io.Serializable;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+public class BankDetails implements Serializable
+{
+ private OrganisationUnit organisationUnit;
+
+ private DataSet dataSet;
+
+ private String bank;
+
+ private String branchName;
+
+ private String accountName;
+
+ private String accountNumber;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+ public BankDetails()
+ {
+
+ }
+
+ public BankDetails( OrganisationUnit organisationUnit, DataSet dataSet, String bank, String branchName, String accountName, String accountNumber )
+ {
+ this.organisationUnit = organisationUnit;
+ this.dataSet = dataSet;
+ this.bank = bank;
+ this.branchName = branchName;
+ this.accountName = accountName;
+ this.accountNumber = accountNumber;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o == null )
+ {
+ return false;
+ }
+
+ if ( !(o instanceof BankDetails) )
+ {
+ return false;
+ }
+
+ final BankDetails other = (BankDetails) o;
+
+ return 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 + organisationUnit.hashCode();
+
+ return result;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+ this.organisationUnit = organisationUnit;
+ }
+
+ public DataSet getDataSet()
+ {
+ return dataSet;
+ }
+
+ public void setDataSet( DataSet dataSet )
+ {
+ this.dataSet = dataSet;
+ }
+
+ public String getBank()
+ {
+ return bank;
+ }
+
+ public void setBank( String bank )
+ {
+ this.bank = bank;
+ }
+
+ public String getBranchName()
+ {
+ return branchName;
+ }
+
+ public void setBranchName( String branchName )
+ {
+ this.branchName = branchName;
+ }
+
+ public String getAccountName()
+ {
+ return accountName;
+ }
+
+ public void setAccountName( String accountName )
+ {
+ this.accountName = accountName;
+ }
+
+ public String getAccountNumber()
+ {
+ return accountNumber;
+ }
+
+ public void setAccountNumber( String accountNumber )
+ {
+ this.accountNumber = accountNumber;
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsService.java 2013-12-21 09:11:48 +0000
@@ -0,0 +1,23 @@
+package org.hisp.dhis.pbf.api;
+
+import java.util.Collection;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+public interface BankDetailsService
+{
+ String ID = BankDetailsService.class.getName();
+
+ void addBankDetails( BankDetails bankDetails );
+
+ void updateBankDetails( BankDetails bankDetails );
+
+ void deleteBankDetails( BankDetails bankDetails );
+
+ BankDetails getBankDetails( OrganisationUnit organisationUnit, DataSet dataSet );
+
+ Collection<BankDetails> getAllBankDetails();
+
+ Collection<BankDetails> getBankDetails( OrganisationUnit organisationUnit );
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/BankDetailsStore.java 2013-12-21 09:11:48 +0000
@@ -0,0 +1,24 @@
+package org.hisp.dhis.pbf.api;
+
+import java.util.Collection;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+public interface BankDetailsStore
+{
+ String ID = BankDetailsStore.class.getName();
+
+ void addBankDetails( BankDetails bankDetails );
+
+ void updateBankDetails( BankDetails bankDetails );
+
+ void deleteBankDetails( BankDetails bankDetails );
+
+ BankDetails getBankDetails( OrganisationUnit organisationUnit, DataSet dataSet );
+
+ Collection<BankDetails> getAllBankDetails();
+
+ Collection<BankDetails> getBankDetails( OrganisationUnit organisationUnit );
+
+}
=== 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 2013-12-21 05:25:33 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2013-12-21 09:11:48 +0000
@@ -6,6 +6,8 @@
{
public static final String DS_PBF_TYPE = "DS_PBF_TYPE";
+ public static final String BANK = "BANK";
+
private String type;
private String value;
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultBankDetailsService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultBankDetailsService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultBankDetailsService.java 2013-12-21 09:11:48 +0000
@@ -0,0 +1,66 @@
+package org.hisp.dhis.pbf.impl;
+
+import java.util.Collection;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.pbf.api.BankDetails;
+import org.hisp.dhis.pbf.api.BankDetailsService;
+import org.hisp.dhis.pbf.api.BankDetailsStore;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class DefaultBankDetailsService implements BankDetailsService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private BankDetailsStore bankDetailsStore;
+
+ public void setBankDetailsStore( BankDetailsStore bankDetailsStore )
+ {
+ this.bankDetailsStore = bankDetailsStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // BankDetails
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void addBankDetails( BankDetails bankDetails )
+ {
+ bankDetailsStore.addBankDetails( bankDetails );
+ }
+
+ @Override
+ public void updateBankDetails( BankDetails bankDetails )
+ {
+ bankDetailsStore.updateBankDetails( bankDetails );
+ }
+
+ @Override
+ public void deleteBankDetails( BankDetails bankDetails )
+ {
+ bankDetailsStore.deleteBankDetails( bankDetails );
+ }
+
+ @Override
+ public BankDetails getBankDetails( OrganisationUnit organisationUnit, DataSet dataSet )
+ {
+ return bankDetailsStore.getBankDetails( organisationUnit, dataSet );
+ }
+
+ @Override
+ public Collection<BankDetails> getAllBankDetails()
+ {
+ return bankDetailsStore.getAllBankDetails();
+ }
+
+ @Override
+ public Collection<BankDetails> getBankDetails( OrganisationUnit organisationUnit )
+ {
+ return bankDetailsStore.getBankDetails( organisationUnit );
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateBankDetailsStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateBankDetailsStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateBankDetailsStore.java 2013-12-21 09:11:48 +0000
@@ -0,0 +1,88 @@
+package org.hisp.dhis.pbf.impl;
+
+import java.util.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.pbf.api.BankDetails;
+import org.hisp.dhis.pbf.api.BankDetailsStore;
+
+public class HibernateBankDetailsStore implements BankDetailsStore
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+ // -------------------------------------------------------------------------
+ // BankDetails
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void addBankDetails( BankDetails bankDetails )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.save( bankDetails );
+ }
+
+ @Override
+ public void updateBankDetails( BankDetails bankDetails )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.update( bankDetails );
+ }
+
+ @Override
+ public void deleteBankDetails( BankDetails bankDetails )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete( bankDetails );
+ }
+
+ @Override
+ public BankDetails getBankDetails( OrganisationUnit organisationUnit, DataSet dataSet )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( BankDetails.class );
+ criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+ criteria.add( Restrictions.eq( "dataSet", dataSet ) );
+
+ return (BankDetails) criteria.uniqueResult();
+ }
+
+ @Override
+ public Collection<BankDetails> getAllBankDetails()
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( BankDetails.class );
+
+ return criteria.list();
+ }
+
+ @Override
+ public Collection<BankDetails> getBankDetails( OrganisationUnit organisationUnit )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( BankDetails.class );
+ criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+
+ return criteria.list();
+ }
+
+}
=== 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 2013-12-21 05:25:33 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2013-12-21 09:11:48 +0000
@@ -22,6 +22,14 @@
<bean id="org.hisp.dhis.pbf.api.LookupService" class="org.hisp.dhis.pbf.impl.DefaultLookupService">
<property name="lookupStore" ref="org.hisp.dhis.pbf.api.LookupStore" />
</bean>
+
+ <bean id="org.hisp.dhis.pbf.api.BankDetailsStore" class="org.hisp.dhis.pbf.impl.HibernateBankDetailsStore">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.api.BankDetailsService" class="org.hisp.dhis.pbf.impl.DefaultBankDetailsService">
+ <property name="bankDetailsStore" ref="org.hisp.dhis.pbf.api.BankDetailsStore" />
+ </bean>
<!-- Home page -->
<bean id="org.hisp.dhis.pbf.action.NoAction" class="org.hisp.dhis.pbf.action.NoAction" scope="prototype">
@@ -60,5 +68,13 @@
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
</bean>
+
+ <!-- Load Bank Details -->
+ <bean id="org.hisp.dhis.pbf.action.LoadBankDetailsAction" class="org.hisp.dhis.pbf.action.LoadBankDetailsAction" scope="prototype">
+ <property name="bankDetailsService" ref="org.hisp.dhis.pbf.api.BankDetailsService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ </bean>
</beans>
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/BankDetails.hbm.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/BankDetails.hbm.xml 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/hibernate/BankDetails.hbm.xml 2013-12-21 09:11:48 +0000
@@ -0,0 +1,23 @@
+<?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.BankDetails" table="bankdetails">
+
+ <composite-id>
+ <key-many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid" foreign-key="fk_bankdetails_organisationunitid" />
+ <key-many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" column="datasetid" foreign-key="fk_bankdetails_datasetid" />
+ </composite-id>
+
+ <property name="bank" column="bank" length="100" />
+
+ <property name="branchName" column="branch" length="100" />
+
+ <property name="accountName" column="accountname" length="100" />
+
+ <property name="accountNumber" column="accountnumber" length="100" />
+
+ </class>
+</hibernate-mapping>
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2013-12-11 12:08:01 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2013-12-21 09:11:48 +0000
@@ -18,7 +18,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm</param>
<param name="menu">/dhis-web-maintenance-pbf/tariffMenu.vm</param>
- <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
</action>
<action name="loadTariffDetails" class="org.hisp.dhis.pbf.action.LoadTariffDetailsAction">
<result name="success" type="velocity">/content.vm</result>
@@ -33,6 +33,15 @@
<param name="onExceptionReturn">plainTextError</param>
<param name="requiredAuthorities">F_TARIFFDATAVALUE_UPDATE</param>
</action>
+
+ <!-- Load Bank Details -->
+ <action name="bankDetailsManagement" class="org.hisp.dhis.pbf.action.LoadBankDetailsAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/loadBankData.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/tariffMenu.vm</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
+ </action>
+
</package>
</struts>
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm 2013-12-21 09:11:48 +0000
@@ -0,0 +1,205 @@
+<script >
+$(function() {
+
+$("#openAddTariff").button()
+ .click(function() {
+ $( "#addTariff" ).dialog( "open" );
+ $('#pbfType option[value=-1]').attr('selected','selected');
+ $('#bank option[value=-1]').attr('selected','selected');
+ $("#branchName").val('');
+ $("#accountName").val('');
+ $("#accountNumber").val('');
+});
+
+
+$( "#addTariff" ).dialog({
+ width: 320,
+ autoOpen: false,
+ modal: true,
+ buttons: {
+ "Save": function() {
+ var date1 = Date.parse($("#startDate").val());
+ var date2 = Date.parse($("#endDate").val());
+ if (date1 > date2) {
+ alert ("Please enter correct date");
+ }
+ else{
+ var dataValue = {
+ 'pbfType' : $("#pbfType").val(),
+ 'tariff' : $("#tariff").val(),
+ 'startDate' : $("#startDate").val(),
+ 'endDate' : $("#endDate").val(),
+ 'orgUnitUid': $("#orgUnitUid").val(),
+ 'dataElementId' : $("#dataElementId").val()
+ };
+ jQuery.ajax( {
+ url: 'addTariffData.action',
+ data: dataValue,
+ dataType: 'json',
+ success: handleSuccess,
+ error: handleError
+ } );
+ }
+
+ },
+ Cancel: function() {
+ $( this ).dialog( "close" );
+ }
+ },
+ close: function() {
+ }
+ });
+ function handleSuccess( json )
+ {
+ $('#pbfType option[value=-1]').attr('selected','selected');
+ $("#pbfType ").removeAttr('disabled');
+ $("#tariff").val('');
+ $("#startDate").val('');
+ $("#startDate ").removeAttr('disabled');
+ $("#endDate").val('');
+ $("#endDate ").removeAttr('disabled');
+
+ getTariffData();
+ $( "#addTariff" ).dialog( "close" );
+ }
+ function handleError( json )
+ {
+ $('#pbfType option[value=-1]').attr('selected','selected');
+ $("#pbfType ").removeAttr('disabled');
+ $("#tariff").val('');
+ $("#startDate").val('');
+ $("#startDate ").removeAttr('disabled');
+ $("#endDate").val('');
+ $("#endDate ").removeAttr('disabled');
+ getTariffData();
+ $( "#addTariff" ).dialog( "close" );
+ }
+});
+
+ function deleteTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate)
+ {
+ var dataValue = {
+ 'organisationUnitId' : organisationUnitId ,
+ 'dataElementId' : dataElementId,
+ 'dataSetId' : dataSetId,
+ 'startDate' : startDate,
+ 'endDate' : endDate
+ };
+
+ jQuery.ajax( {
+ url: 'deleteTariffData.action',
+ data: dataValue,
+ dataType: 'json',
+ success: handleSuccess,
+ error: handleError
+ } );
+ function handleSuccess( json )
+ {
+ getTariffData();
+ }
+ function handleError( json )
+ {
+ getTariffData();
+ }
+ }
+
+ function editTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate, value )
+ {
+ $( "#addTariff" ).attr('selected','Edit Tariff')
+ $('#pbfType option[value='+organisationUnitGroupId+']').attr('selected','selected');
+ $('#pbfType').attr('disabled','disabled');
+ $('#tariff').val(value);
+ $('#startDate').val(startDate);
+ $('#startDate').attr('disabled','disabled');
+ $('#endDate').val(endDate);
+ $('#endDate').attr('disabled','disabled');
+
+ $( "#addTariff" ).dialog( "open" );
+ }
+</script>
+
+<div style="width:100%">
+ <input type="button" value="Add New Tariff" style="float:right;" id="openAddTariff"/>
+</div>
+<br/><br/>
+
+<table style="width:100%" class="mainPageTable">
+ <thead >
+ <tr >
+ <th >PBF Type</th>
+ <th >Bank</th>
+ <th >Branch Name</th>
+ <th >Account Name</th>
+ <th >Account Number</th>
+ #if( $updateAuthority == 'Yes' )
+ <th >Operations</th>
+ #end
+ </tr>
+ </thead>
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $bankDetails in $bankDetailsList )
+ #if( $mark )
+ #set( $mark = false )
+ #else
+ #set( $mark = true )
+ #end
+ <tr #if( $mark ) bgcolor = "#FFFFFF" #else bgcolor="#E0ECF8" #end>
+ <td >$!bankDetails.dataSet.name</td>
+ <td >$!bankDetails.bank</td>
+ <td >$!bankDetails.branchName</td>
+ <td >$!bankDetails.accountName</td>
+ <td >$!bankDetails.accountNumber</td>
+ #if($updateAuthority == 'Yes')
+ <td>
+ <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>
+ </td>
+ #end
+ </tr>
+ #end
+ </tbody>
+</table>
+
+<div id="addTariff" title="Add New Tariff">
+ <table style="width:100%;table-layout:fixed;">
+ <tr >
+ <td style="width:40%;">PBF Type</td>
+ <td style="width:60%;">
+ <select id="pbfType" style="width:100%;">
+ <option value="-1">Select PBF Type</option>
+ #foreach( $dataSet in $dataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr >
+ <td style="width:40%;">Bank</td>
+ <td style="width:60%;">
+ <select id="bank" style="width:100%;">
+ <option value="-1">Select Bank</option>
+ #foreach( $bank in $banks )
+ <option value="$bank">$bank</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr >
+ <td style="width:40%;">Branch Name</td>
+ <td style="width:60%;"><input type="text" id="branchName" style="width:100%;"/></td>
+ </tr>
+ <tr >
+ <td style="width:40%;">Account Name</td>
+ <td style="width:60%;"><input type="text" id="accountName" style="width:100%;"/></td>
+ </tr>
+ <tr >
+ <td style="width:40%;">Account Number</td>
+ <td style="width:60%;"><input type="text" id="accountNumber" style="width:100%;"/></td>
+ </tr>
+ </table>
+</div>
\ No newline at end of file
=== 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-07 09:10:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm 2013-12-21 09:11:48 +0000
@@ -1,6 +1,9 @@
<h2>$i18n.getString( "pbf_setup" )</h2>
-<ul>
+<ul>
+ <li><a href="pbfDataEntry.action">$i18n.getString( "dataentry" )</a></li>
+
<li><a href="dataElementTariffManagement.action">$i18n.getString( "dataelement_tariff_management" )</a></li>
+
+ <li><a href="bankDetailsManagement.action">$i18n.getString( "bank_details_management" )</a></li>
</ul>
-