dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30556
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15516: local/in RBF work in progress
------------------------------------------------------------
revno: 15516
committer: Mithilesh Kumar Thakur <mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-02 12:30:23 +0100
message:
local/in RBF work in progress
added:
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFReportFormAction.java
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/pbfReportForm.vm
modified:
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveDataValueAction.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/qualityscorepayment/action/GetQualityScorePaymentAction.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFInvoiceReportFormAction.java
local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties
local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/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
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveDataValueAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveDataValueAction.java 2014-05-31 13:40:53 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveDataValueAction.java 2014-06-02 11:30:23 +0000
@@ -122,14 +122,28 @@
public void setPeriodIso(String periodIso)
{
- this.periodIso = periodIso;
- }
+ this.periodIso = periodIso;
+ }
+
+ private String overAllScoreValue;
+
+ public void setOverAllScoreValue( String overAllScoreValue )
+ {
+ this.overAllScoreValue = overAllScoreValue;
+ }
+
+ private String overAllScoreDeId;
+
+ public void setOverAllScoreDeId( String overAllScoreDeId )
+ {
+ this.overAllScoreDeId = overAllScoreDeId;
+ }
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
- private int statusCode = 0;
+ private int statusCode = 0;
public int getStatusCode()
{
@@ -188,7 +202,7 @@
// Update data
// ---------------------------------------------------------------------
- DataValue dataValue = dataValueService.getDataValue(dataElement, period, organisationUnit, optionCombo);
+ DataValue dataValue = dataValueService.getDataValue( dataElement, period, organisationUnit, optionCombo);
if ( dataValue == null )
{
@@ -210,14 +224,62 @@
}
else
{
- if( !(value.trim().equalsIgnoreCase( dataValue.getValue() )) )
+ if( !(value.trim().equalsIgnoreCase( dataValue.getValue() ) ) )
{
dataValue.setValue( value.trim() );
dataValue.setTimestamp( now );
dataValue.setStoredBy( storedBy );
dataValueService.updateDataValue( dataValue );
}
- }
+ }
+
+ // for saving Over All Score
+
+ if ( overAllScoreValue != null && overAllScoreDeId != null )
+ {
+ overAllScoreValue = overAllScoreValue.trim();
+
+ DataElement overAllScoreDataElement = dataElementService.getDataElement( Integer.parseInt( overAllScoreDeId ) );
+
+ if ( overAllScoreDataElement == null )
+ {
+ return logError( "Invalid dataelement identifier: " + overAllScoreDeId );
+ }
+
+ DataValue overAllScoreDataValue = dataValueService.getDataValue( overAllScoreDataElement, period, organisationUnit, optionCombo );
+
+ if ( overAllScoreDataValue == null )
+ {
+ if ( overAllScoreValue != null && (!overAllScoreValue.trim().equals( "" ) ) )
+ {
+ overAllScoreDataValue = new DataValue();
+
+ overAllScoreDataValue.setPeriod( period );
+ overAllScoreDataValue.setDataElement( overAllScoreDataElement );
+ overAllScoreDataValue.setSource(organisationUnit);
+ overAllScoreDataValue.setCategoryOptionCombo( optionCombo );
+
+ overAllScoreDataValue.setValue( overAllScoreValue.trim() );
+ overAllScoreDataValue.setTimestamp( now );
+ overAllScoreDataValue.setStoredBy( storedBy );
+
+ dataValueService.addDataValue( overAllScoreDataValue );
+ }
+ }
+ else
+ {
+ if( !(overAllScoreValue.trim().equalsIgnoreCase( overAllScoreDataValue.getValue() ) ) )
+ {
+ overAllScoreDataValue.setValue( overAllScoreValue.trim() );
+ overAllScoreDataValue.setTimestamp( now );
+ overAllScoreDataValue.setStoredBy( storedBy );
+ dataValueService.updateDataValue( overAllScoreDataValue );
+ }
+ }
+
+ }
+
+
return SUCCESS;
}
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/qualityscorepayment/action/GetQualityScorePaymentAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/qualityscorepayment/action/GetQualityScorePaymentAction.java 2014-05-09 05:53:05 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/qualityscorepayment/action/GetQualityScorePaymentAction.java 2014-06-02 11:30:23 +0000
@@ -54,10 +54,11 @@
{
qualityscorepayment = qualityScorePaymentService.getQualityScorePayment( id );
-
+ /*
System.out.println( qualityscorepayment.getStartRange() );
System.out.println( qualityscorepayment.getEndRange() );
System.out.println( qualityscorepayment.getAddQtyPayment() );
+ */
return SUCCESS;
}
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFInvoiceReportFormAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFInvoiceReportFormAction.java 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFInvoiceReportFormAction.java 2014-06-02 11:30:23 +0000
@@ -93,6 +93,7 @@
for ( Period period : periods )
{
period.setName( format.formatPeriod( period ) );
+
}
return SUCCESS;
=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFReportFormAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFReportFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/report/action/PBFReportFormAction.java 2014-06-02 11:30:23 +0000
@@ -0,0 +1,104 @@
+package org.hisp.dhis.rbf.report.action;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.CalendarPeriodType;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class PBFReportFormAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<Period> periods = new ArrayList<Period>();
+
+ public Collection<Period> getPeriods()
+ {
+ return periods;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ private String periodTypeName;
+
+ public String getPeriodTypeName()
+ {
+ return periodTypeName;
+ }
+
+ public void setPeriodTypeName( String periodTypeName )
+ {
+ this.periodTypeName = periodTypeName;
+ }
+
+ private String birtPath;
+
+ public String getBirtPath()
+ {
+ return birtPath;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ birtPath = System.getenv( "DHIS2_HOME" );
+
+ birtPath += File.separator + "birtreports" + File.separator + "PBFInvoice.rptdesign";
+
+ //periodTypeName = QuarterlyPeriodType.NAME;
+
+ periodTypeName = MonthlyPeriodType.NAME;
+
+ CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodTypeName );
+
+ Calendar cal = PeriodType.createCalendarInstance();
+
+ periods = _periodType.generatePeriods( cal.getTime() );
+
+ // periods = new ArrayList<Period>(
+ // periodService.getPeriodsByPeriodType( periodType ) );
+
+ FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
+
+ Collections.reverse( periods );
+ // Collections.sort( periods );
+ for ( Period period : periods )
+ {
+ period.setName( format.formatPeriod( period ) );
+ }
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml 2014-05-09 05:53:05 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml 2014-06-02 11:30:23 +0000
@@ -463,4 +463,9 @@
scope="prototype">
<property name="lookupService" ref="org.hisp.dhis.rbf.api.LookupService" />
</bean>
+
+
+
+
+
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties 2014-05-09 05:53:05 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties 2014-06-02 11:30:23 +0000
@@ -78,4 +78,10 @@
additional_quality_payment = Additional Quality Payment
add_quality_score_payment_details = Add Quality Score Payment Details
-quality_score_payment_details = Quality Score Payment Details
\ No newline at end of file
+quality_score_payment_details = Quality Score Payment Details
+
+pbf_report = PBF Report
+pbf_report_management = PBF Report Management
+report = Report
+outputFormat = Output Format
+generate = Generate
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-05-31 13:40:53 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-06-02 11:30:23 +0000
@@ -393,5 +393,18 @@
<param name="menu">/dhis-web-maintenance-rbf/menu.vm</param>
</action>
+
+ <!-- PBF Reports -->
+ <action name="pbfReportForm" class="org.hisp.dhis.rbf.report.action.PBFReportFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-rbf/pbfReportForm.vm</param>
+ <param name="javascripts">javascript/prevNextPeriods.js</param>
+ <param name="menu">/dhis-web-maintenance-rbf/menu.vm</param>
+ </action>
+
+
+
+
+
</package>
</struts>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js 2014-06-02 11:30:23 +0000
@@ -101,6 +101,12 @@
var period = document.getElementById("selectedPeriodId").value;
var valueId = "score_"+dataElementId;
+ var overAllScoreValue = document.getElementById("all-total").value;
+
+ var overAllScoreDeId = "126";
+
+ var overAllScorefieldId = "#"+overAllScoreDeId;
+
var fieldId = "#"+valueId;
var defaultValue = document.getElementById(valueId).defaultValue;
var value = document.getElementById(valueId).value;
@@ -111,7 +117,9 @@
'dataElementId' : dataElementId,
'organisationUnitId' : $("#selectedOrgunitID").val(),
'periodIso' : period,
- 'value' : value
+ 'value' : value,
+ 'overAllScoreValue' : overAllScoreValue,
+ 'overAllScoreDeId' : overAllScoreDeId
};
jQuery.ajax( {
url: 'saveDataValue.action',
@@ -128,15 +136,19 @@
if ( code == '0' || code == 0) // Value successfully saved on server
{
markValue( fieldId, COLOR_GREEN );
+ markValue( overAllScorefieldId, COLOR_GREEN );
+
}
else if ( code == 2 )
{
markValue( fieldId, COLOR_RED );
+ markValue( overAllScorefieldId, COLOR_RED );
window.alert( i18n_saving_value_failed_dataset_is_locked );
}
else // Server error during save
{
markValue( fieldId, COLOR_RED );
+ markValue( overAllScorefieldId, COLOR_RED );
window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
}
}
@@ -148,7 +160,8 @@
function markValue( fieldId, color )
{
- document.getElementById(valueId).style.backgroundColor = color;
+ document.getElementById(valueId).style.backgroundColor = color;
+ document.getElementById("all-total").style.backgroundColor = color;
}
}
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm 2014-05-31 13:40:53 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm 2014-06-02 11:30:23 +0000
@@ -18,13 +18,18 @@
</ul>
-
-
<h2>$i18n.getString( "aggregation_builder" )</h2>
<ul>
<li><a href="aggregationQueryList.action">$i18n.getString( "aggregation_query_list" )</a></li>
<li><a href="runAggregationQueryForm.action">$i18n.getString( "manual_aggregation" )</a></li>
</ul>
+
+<h2>$i18n.getString( "pbf_report" )</h2>
+<ul>
+ <li><a href="pbfReportForm.action">$i18n.getString( "pbf_report" )</a></li>
+</ul>
+
+
<h2>$i18n.getString( "Lookup" )</h2>
<ul>
<li><a href="getAllLookups.action">$i18n.getString( "Lookup" )</a></li>
=== added file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/pbfReportForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/pbfReportForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/pbfReportForm.vm 2014-06-02 11:30:23 +0000
@@ -0,0 +1,152 @@
+
+<script type="text/javascript">
+
+ function formValidations()
+ {
+
+ var reportList = document.getElementById("selectedReportId");
+ var reportIndex = reportList.selectedIndex;
+ if( reportList.options[reportIndex].value == null || reportList.options[reportIndex].value== "-1" )
+ {
+ showWarningMessage( "Please Select Report" );
+ return false;
+ }
+
+ var reportFormatList = document.getElementById("selectedReportFormat");
+ var reportFormatIndex = reportFormatList.selectedIndex;
+ if( reportFormatList.options[reportFormatIndex].value == null || reportFormatList.options[reportFormatIndex].value== "-1" )
+ {
+ showWarningMessage( "Please Select Report Format" );
+ return false;
+ }
+
+ var startPeriodList = document.getElementById("selectedPeriodId");
+ var startPeriodIndex = startPeriodList.selectedIndex;
+
+ if( startPeriodList.options[startPeriodIndex].value == null || startPeriodList.options[startPeriodIndex].value== "-1" )
+ {
+ showWarningMessage( "Please Select Period" );
+ return false;
+ }
+
+
+ return redirectTorptDesign();
+ }
+
+
+ function redirectTorptDesign()
+ {
+
+ var reportList = document.getElementById("selectedReportId");
+ var reportIndex = reportList.selectedIndex;
+
+ var reportFormat = $('#selectedReportFormat').val();
+
+ var rprDesign = reportList.options[reportIndex].value;
+
+ var orgunit = $('#treeSelectedId').val();
+
+ var orgUnitId = selectionTreeSelection.getSelectedUid()[0];
+
+ //alert( orgunit + "--" + orgUnitId )
+
+ //alert( rprDesign )
+
+ var period = $('#selectedPeriodId').val();
+
+ var startPeriod = period.split(":")[0];
+ var endPeriod = period.split(":")[1];
+
+ //alert( startPeriod + " : " + endPeriod + " : " + rprDesign + " : " + orgUnitId );
+
+ var birtReportURL = "http://178.79.144.205:8989/birt/run?__report=/home/dqa/tomcat_pbf_laos/webapps/birt/report/"+rprDesign+"&__format="+reportFormat+"&startDate="+startPeriod+"&endDate="+endPeriod+"&District="+orgUnitId;
+
+ //alert( birtReportURL );
+ window.location.href = birtReportURL;
+
+ /*
+
+ alert( startPeriod + " : " + endPeriod );
+
+ var url = "../birt/run?__report=C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/birt/report/"+rprDesign+"&__format="+reportFormat+"&startDate="+startPeriod+"&endDate="+endPeriod+"&District="+orgUnitId;
+
+ alert( url );
+ window.open('url', '_blank');
+
+ window.location.href = "http://localhost:8090/birt/run?__report=C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/birt/report/"+rprDesign+"&__format="+reportFormat+"&startDate="+startPeriod+"&endDate="+endPeriod+"&District="+orgunit;
+
+
+ //window.location.href = "http://localhost:8090/birt/run?__report=C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/birt/report/PBF_Payment_Voucher.rptdesign&__format="+reportFormat+"&startDate="+startPeriod+"&endDate="+endPeriod+"&District="+orgunit;
+
+ */
+
+ return true;
+ }
+
+</script>
+
+
+
+
+<h3>$i18n.getString( "pbf_report_management" )</h3>
+
+<form id="generateReport" method="Get" action="#" onsubmit="return formValidations()" >
+ <table>
+ <tr>
+ <td><label for="report">$i18n.getString( "report" )</label></td>
+ <td>
+ <select id="selectedReportId" name="selectedReportId" style="width:220px" >
+ <option value="-1">[$i18n.getString( "select" )]</option>
+ <option value="MATERNAL_HEALTH_HC.rptdesign" >Maternal Health HC</option>
+ <option value="Mathealth_DH.rptdesign" >Maternal Health DH</option>
+ <option value="Mathealth_PH.rptdesign" >Maternal Health PH</option>
+ </select>
+ </td>
+ </tr>
+
+
+ </tr>
+ <td><label for="outputFormat">$i18n.getString( "outputFormat" )</label></td>
+ <td>
+ <select id="selectedReportFormat" name="selectedReportFormat" style="width:220px" >
+ <option value="-1">[$i18n.getString( "select" )]</option>
+ <option value="pdf">PDF</option>
+ <option value="xls_spudsoft">XLS</option>
+ </select>
+ </td>
+ </tr>
+
+
+
+ <tr>
+ <td><label for="selectedPeriodId">$i18n.getString( "period" )</label></td>
+ <td><select id="selectedPeriodId" name="selectedPeriodId" style="width:220px" >
+ <option value="-1">[$i18n.getString( "select" )]</option>
+ #foreach( $period in $periods )
+ <!--<option value="$period.isoDate">$encoder.htmlEncode( $period.name )</option>-->
+ #set( $periodId = $period.getStartDateString() + ':' + $period.getEndDateString() )
+ <option value="$periodId">$encoder.htmlEncode( $period.name )</option>
+ #end
+ </select>
+ <br>
+ <input type="button" id="prevButton" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="getAvailablePeriodsTemp('$periodTypeName', 'selectedPeriodId', '-1' )" >
+ <input type="button" id="nextButton" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="getAvailablePeriodsTemp( '$periodTypeName', 'selectedPeriodId', '1' )" >
+ </td>
+ </tr>
+ </table>
+
+ <table id="selectionTable">
+ <tr>
+ <td>
+ #organisationUnitSelectionTree( false, false, false )
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" id="submitButton" value="$i18n.getString( 'generate' )" style="width:10em" />
+ <input type="text" id="birtpath" name="birtpath" value="$birtPath" />
+ </td>
+ </tr>
+ </table>
+
+</form>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/qualityScoreEntrySelection.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/qualityScoreEntrySelection.vm 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/qualityScoreEntrySelection.vm 2014-06-02 11:30:23 +0000
@@ -1,3 +1,4 @@
+
<script>
jQuery(document).ready( function(){
@@ -19,7 +20,6 @@
</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" />