dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27358
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13611: PBF Modification
------------------------------------------------------------
revno: 13611
committer: Samta Bajpayee<samta-bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-07 12:44:16 +0000
message:
PBF Modification
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/java/org/hisp/dhis/pbf/api/TariffDataValueService.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/LoadDataEntryFormAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultTariffDataValueService.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/org/hisp/dhis/pbf/i18n_module.properties
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.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/api/Lookup.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2014-01-07 11:54:34 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2014-01-07 12:44:16 +0000
@@ -6,7 +6,10 @@
{
public static final String DS_PBF_TYPE = "DS_PBF_TYPE";
- public static final String OC_TARIFF = "OC_TARIFF";
+ public static final String OC_TARIFF = "OC_TARIFF";
+
+ public static final String QV_TARIFF = "QV_TARIFF";
+
public static final String BANK = "BANK";
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueService.java 2014-01-07 11:54:34 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueService.java 2014-01-07 12:44:16 +0000
@@ -25,7 +25,7 @@
Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet );
- Map<Integer, Integer> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period );
+ Map<Integer, Double> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period );
Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, DataElement dataElement );
}
=== 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 11:54:34 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/TariffDataValueStore.java 2014-01-07 12:44:16 +0000
@@ -25,7 +25,7 @@
Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet );
- Map<Integer, Integer> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period );
+ Map<Integer, Double> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period );
Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, DataElement dataElement );
}
=== 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 11:54:34 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 2014-01-07 12:44:16 +0000
@@ -168,19 +168,30 @@
return tariffOptCombo;
}
+ private DataElementCategoryOptionCombo qValOptCombo;
+
+ public DataElementCategoryOptionCombo getqValOptCombo() {
+ return qValOptCombo;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute()
- {
-
+
+
+ public String execute()
+ {
dataValueMap = new HashMap<String, String>();
Lookup lookup = lookupService.getLookupByName( Lookup.OC_TARIFF );
+
+ Lookup lookup2 = lookupService.getLookupByName( Lookup.QV_TARIFF );
+
+ tariffOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
- DataElementCategoryOptionCombo tariffOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
+ qValOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
@@ -192,7 +203,7 @@
optionCombos = new ArrayList<DataElementCategoryOptionCombo>();
- Map<Integer, Integer> tariffDataValueMap = new HashMap<Integer, Integer>();
+ Map<Integer, Double> tariffDataValueMap = new HashMap<Integer, Double>();
tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( organisationUnit, dataSet, period ) );
@@ -221,7 +232,7 @@
{
if( decombo.getId() == tariffOptCombo.getId() )
{
- Integer tariffValue = tariffDataValueMap.get( dataElement.getId() );
+ Double tariffValue = tariffDataValueMap.get( dataElement.getId() );
if( tariffValue != null )
{
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultTariffDataValueService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultTariffDataValueService.java 2014-01-07 11:54:34 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultTariffDataValueService.java 2014-01-07 12:44:16 +0000
@@ -73,7 +73,7 @@
return tariffDataValueStore.getTariffDataValues( organisationUnit, dataElement );
}
- public Map<Integer, Integer> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
+ public Map<Integer, Double> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
{
return tariffDataValueStore.getTariffDataValues( organisationUnit, dataSet, period );
}
=== 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 11:54:34 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateTariffDataValueStore.java 2014-01-07 12:44:16 +0000
@@ -118,9 +118,9 @@
return criteria.list();
}
- public Map<Integer, Integer> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
+ public Map<Integer, Double> getTariffDataValues( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
{
- Map<Integer, Integer> tariffDataValueMap = new HashMap<Integer, Integer>();
+ Map<Integer, Double> tariffDataValueMap = new HashMap<Integer, Double>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String curPeriod = simpleDateFormat.format( period.getEndDate() );
@@ -138,7 +138,7 @@
while ( rs.next() )
{
Integer dataElementId = rs.getInt( 1 );
- Integer value = rs.getInt( 2 );
+ Double value = rs.getDouble( 2 );
tariffDataValueMap.put( dataElementId, value );
}
}
=== 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 2013-12-31 07:59:05 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties 2014-01-07 12:44:16 +0000
@@ -16,5 +16,5 @@
later_periods = Later periods
select = Select
period = Period
-
-dataelement = Data Element
\ No newline at end of file
+dataelement = Data Element
+total = Total
\ 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 10:10:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm 2014-01-07 12:44:16 +0000
@@ -1,4 +1,7 @@
+
+
## Macro for generating the jQuery validation rules
+
#macro( validate $type $require )
#if( $type == "NUMBER" || $type == "number" )
{validate:{ number:true #if($require), required:true #end }}
@@ -22,39 +25,70 @@
#set( $tabIndex = 1 )
#if ( $dataElements.size() > 0)
-<table class="formSection">
+<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"
+ <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 />
+ #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