dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27741
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13808: PBF: QualityMaxScore, QualityScore Fixes
------------------------------------------------------------
revno: 13808
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-22 11:42:11 +0000
message:
PBF: QualityMaxScore, QualityScore Fixes
added:
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityScoreEntryForm.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityScoreEntrySelection.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/webapp/dhis-web-maintenance-pbf/loadQualityScoreEntryForm.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityScoreEntryForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadQualityScoreEntryForm.vm 2014-01-22 11:42:11 +0000
@@ -0,0 +1,129 @@
+
+#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;
+ var allScore = 0.0;
+ var allMax = 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($("#score_"+$dataElement.id).val() != '' && $("#max_"+$dataElement.id).val() != '')
+ {
+ percentage = (parseFloat($dataValue.value) * 100) / parseFloat($qualityMaxValue.value);
+ $('#percentage_'+$dataElement.id).val(percentage.toFixed(2));
+ }
+
+ if( $("#score_"+$dataElement.id).val() != '')
+ {
+ allScore = allScore + parseFloat($("#score_"+$dataElement.id).val());
+ }
+ if( $("#max_"+$dataElement.id).val() != '')
+ {
+ allMax = allMax + parseFloat($("#max_"+$dataElement.id).val());
+ }
+ if(allMax != 0.0)
+ {
+ allTotal = (allScore / allMax ) * 100;
+ }
+
+ $('#all-total').val(allTotal.toFixed(2));
+ }
+ changeInt();
+ </script>
+ <td>
+ <input type="text" class="max" 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;
+
+ var score = 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));
+ }
+ #foreach($dataElement in $dataElements )
+ if( $("#score_"+$dataElement.id).val() != '')
+ {
+ score = score + parseFloat($("#score_"+$dataElement.id).val());
+ }
+ #end
+ if(allMax != 0.0)
+ {
+ allTotal = (score / allMax ) * 100;
+ }
+
+ $('#all-total').val(allTotal.toFixed(2));
+ }
+</script>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityScoreEntrySelection.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityScoreEntrySelection.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/qualityScoreEntrySelection.vm 2014-01-22 11:42:11 +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