← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14689: PBF: work in progress - AdjustmentScreen; BIRT integration

 

------------------------------------------------------------
revno: 14689
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-04-05 13:21:33 +0100
message:
  PBF: work in progress - AdjustmentScreen; BIRT integration
added:
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/action/
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/action/PBFInvoiceReportFormAction.java
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/PBFInvoiceReportForm.vm
modified:
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java
  local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml
  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/struts.xml
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/prevNextPeriods.js
  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
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java	2014-03-14 11:22:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java	2014-04-05 12:21:33 +0000
@@ -11,6 +11,7 @@
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
 import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
 import org.hisp.dhis.system.util.FilterUtils;
 import org.hisp.dhis.util.SessionUtils;
@@ -73,6 +74,11 @@
 
     private String periodType;
     
+    public void setPeriodType( String periodType )
+    {
+        this.periodType = periodType;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -86,7 +92,10 @@
         {
             periodType = dataset.getPeriodType().getName();
         }
-        
+        else if ( periodType != null && periodType.equals( "Quarterly" ) )
+        {
+            //periodType = QuarterlyPeriodType.NAME;
+        }
         else
         {
             periodType = MonthlyPeriodType.NAME;

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java	2014-04-05 12:21:33 +0000
@@ -0,0 +1,117 @@
+package org.hisp.dhis.pbf.payment.action;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.pbf.api.LookupService;
+import org.hisp.dhis.pbf.api.QualityMaxValueService;
+import org.hisp.dhis.pbf.api.TariffDataValueService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadPaymentAdjustmentAction implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    @Autowired
+    private DataSetService dataSetService;
+
+    @Autowired
+    private OrganisationUnitService organisationUnitService;
+
+    @Autowired
+    private DataElementCategoryService categoryService;
+
+    @Autowired
+    private DataValueService dataValueService;
+
+    @Autowired
+    private TariffDataValueService tariffDataValueService;
+
+    @Autowired
+    private DataElementService dataElementService;
+
+    @Autowired
+    private ConstantService constantService;
+
+    @Autowired
+    private PeriodService periodService;
+
+    @Autowired
+    private LookupService lookupService;
+
+    @Autowired
+    private QualityMaxValueService qualityMaxValueService;
+
+    // -------------------------------------------------------------------------
+    // Input / Output
+    // -------------------------------------------------------------------------
+
+    private String orgUnitId;
+
+    public void setOrgUnitId( String orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
+
+    private String dataSetId;
+
+    public void setDataSetId( String dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    private String periodIso;
+
+    public void setPeriodIso( String periodIso )
+    {
+        this.periodIso = periodIso;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        OrganisationUnit selOrgUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+        
+        DataSet selDataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
+        
+        Period period = PeriodType.getPeriodFromIsoString( periodIso );
+        
+        
+        //----------------------------------------------
+        // Quantity Calculation
+        //----------------------------------------------
+        
+        Map<DataElement, Double> pbfQtyMap = new HashMap<DataElement, Double>();
+        
+        //-------------------------------------------------
+        // Quantity Tariff Calculation
+        //-------------------------------------------------
+        Map<DataElement, Double> pbfTariffMap = new HashMap<DataElement, Double>();
+        
+        //-------------------------------------------------
+        // 
+        //-------------------------------------------------
+        
+        return SUCCESS;
+    }
+}

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java	2014-04-02 16:32:50 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java	2014-04-05 12:21:33 +0000
@@ -35,8 +35,11 @@
 public class LoadPaymentAdjustmentDetailsAction
     implements Action
 {
-	private final static String PAYMENT_ADJUSTMENT_AMOUNT_DE = "PAYMENT_ADJUSTMENT_AMOUNT_DE";
-	private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
+    
+    private final static String PAYMENT_ADJUSTMENT_AMOUNT_DE = "PAYMENT_ADJUSTMENT_AMOUNT_DE";
+
+    private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -61,40 +64,44 @@
     {
         this.categoryService = categoryService;
     }
-    
+
     private DataValueService dataValueService;
-    
-    public void setDataValueService(DataValueService dataValueService) {
-		this.dataValueService = dataValueService;
-	}
-    
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+
     private TariffDataValueService tariffDataValueService;
 
     public void setTariffDataValueService( TariffDataValueService tariffDataValueService )
     {
         this.tariffDataValueService = tariffDataValueService;
     }
+
     private DataElementService dataElementService;
 
-	public void setDataElementService(DataElementService dataElementService) {
-		this.dataElementService = dataElementService;
-	}
-
-	private ConstantService constantService;
-
-	public void setConstantService(ConstantService constantService) {
-		this.constantService = constantService;
-	}
-	
-	@Autowired
-	private PeriodService periodService;
-	
-	@Autowired
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private ConstantService constantService;
+
+    public void setConstantService( ConstantService constantService )
+    {
+        this.constantService = constantService;
+    }
+
+    @Autowired
+    private PeriodService periodService;
+
+    @Autowired
     private LookupService lookupService;
-	
-	@Autowired
-	private QualityMaxValueService qualityMaxValueService;
-    
+
+    @Autowired
+    private QualityMaxValueService qualityMaxValueService;
+
     // -------------------------------------------------------------------------
     // Input / Output
     // -------------------------------------------------------------------------
@@ -115,11 +122,12 @@
 
     private String periodIso;
 
-    public void setPeriodIso(String periodIso) {
-		this.periodIso = periodIso;
-	}
+    public void setPeriodIso( String periodIso )
+    {
+        this.periodIso = periodIso;
+    }
 
-	List<DataElement> dataElements = new ArrayList<DataElement>();
+    List<DataElement> dataElements = new ArrayList<DataElement>();
 
     public List<DataElement> getDataElements()
     {
@@ -131,57 +139,63 @@
     public SimpleDateFormat getSimpleDateFormat()
     {
         return simpleDateFormat;
-    } 
-    
-    private Map<String,String> quantityValidatedMap = new HashMap<String, String>();
-    
-    public Map<String, String> getQuantityValidatedMap() {
-		return quantityValidatedMap;
-	}
-
-    private Map<String,String> tariffDataValueMap = new HashMap<String, String>();
-    
-    public Map<String, String> getTariffDataValueMap() {
-		return tariffDataValueMap;
-	}
-    
-    private Map<String,String> amountMap = new HashMap<String, String>();
-    
-    public Map<String, String> getAmountMap() {
-		return amountMap;
-	}
-
-	private String amountAvailable = "";
-    
-    public String getAmountAvailable() {
-		return amountAvailable;
-	}
+    }
+
+    private Map<String, String> quantityValidatedMap = new HashMap<String, String>();
+
+    public Map<String, String> getQuantityValidatedMap()
+    {
+        return quantityValidatedMap;
+    }
+
+    private Map<String, String> tariffDataValueMap = new HashMap<String, String>();
+
+    public Map<String, String> getTariffDataValueMap()
+    {
+        return tariffDataValueMap;
+    }
+
+    private Map<String, String> amountMap = new HashMap<String, String>();
+
+    public Map<String, String> getAmountMap()
+    {
+        return amountMap;
+    }
+
+    private String amountAvailable = "";
+
+    public String getAmountAvailable()
+    {
+        return amountAvailable;
+    }
+
     private String unAdjustedAmount;
-    
-    public String getUnAdjustedAmount() {
-		return unAdjustedAmount;
-	}
-    
+
+    public String getUnAdjustedAmount()
+    {
+        return unAdjustedAmount;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
-	public String execute()
+    public String execute()
         throws Exception
     {
-        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit(orgUnitId);
-        
-        DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
-        
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+
+        DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
+
         Period period = PeriodType.getPeriodFromIsoString( periodIso );
-        
-        dataElements.addAll(dataSet.getDataElements());
-        
-        Constant paymentAmount = constantService.getConstantByName(PAYMENT_ADJUSTMENT_AMOUNT_DE);
-		
-		String amountDEId = paymentAmount.getValue()+"";
-        
-		Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
+
+        dataElements.addAll( dataSet.getDataElements() );
+
+        Constant paymentAmount = constantService.getConstantByName( PAYMENT_ADJUSTMENT_AMOUNT_DE );
+
+        String amountDEId = paymentAmount.getValue() + "";
+
+        Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
         int tariff_setting_authority = 0;
         if ( tariff_authority == null )
         {
@@ -191,112 +205,118 @@
         else
         {
             tariff_setting_authority = (int) tariff_authority.getValue();
+        }
 
-        }
-        
         DataElementCategoryOptionCombo optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-        
+
         List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PAYMENT_TYPE ) );
-		
+
         Double allMax = 0.0;
         Double allScore = 0.0;
         double quantityValue = 0;
-        for( Lookup lookup : lookups )
+        for ( Lookup lookup : lookups )
         {
-			String[] lookupType = lookup.getValue().split(":");
-			//System.out.println("lookupType[0] "+lookupType[0]+" dataSetId "+dataSetId);
-			if(Integer.parseInt( lookupType[0] ) == Integer.parseInt(dataSetId))
-			{
-				DataSet lookupdataSet = dataSetService.getDataSet(Integer.parseInt(lookupType[1]));
-				for(DataElement de : lookupdataSet.getDataElements())
-					{
-					List<QualityMaxValue> qualityMaxValues = new ArrayList<QualityMaxValue>();
-		            OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
-		            if ( parentOrgunit != null )
-		            {
-		                qualityMaxValues = new ArrayList<QualityMaxValue>( qualityMaxValueService.getQuanlityMaxValues(
-		                    parentOrgunit, de ) );
-		            }
-		            List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates(period.getStartDate(), period.getEndDate()));
-		        	//System.out.println("Period Size: "+ periodList.size() );
-		            for(Period prd : periodList)		        		
-		        	{
-		            	
-		        		List<OrganisationUnit> orgList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId()));
-		        		//System.out.println("orgList Size: "+ orgList.size() );
-		        		for(OrganisationUnit ou : orgList )
-		            	{
-				            DataValue dataValue = dataValueService.getDataValue( de, prd, ou, optionCombo );
-				            for ( QualityMaxValue qualityMaxValue : qualityMaxValues )
-				            {
-				            	//System.out.println("qualityMaxValue.getValue() "+qualityMaxValue.getValue());
-				                if ( qualityMaxValue.getStartDate().getTime() <= period.getStartDate().getTime()
-				                    && period.getEndDate().getTime() <= qualityMaxValue.getEndDate().getTime() )
-				                {
-				                    if ( dataValue != null )
-				                    {
-				                    	allMax = allMax + qualityMaxValue.getValue();
-				                    	//System.out.println("dataValue.getValue() "+dataValue.getValue());
-				                        allScore = allScore + Double.parseDouble(dataValue.getValue()) ;
-				                    }
-				                    break;
-				                }
-				            }
-		            	}
-		        	}
-				}
-			}
+            String[] lookupType = lookup.getValue().split( ":" );
+            // System.out.println("lookupType[0] "+lookupType[0]+" dataSetId "+dataSetId);
+            if ( Integer.parseInt( lookupType[0] ) == Integer.parseInt( dataSetId ) )
+            {
+                DataSet lookupdataSet = dataSetService.getDataSet( Integer.parseInt( lookupType[1] ) );
+                for ( DataElement de : lookupdataSet.getDataElements() )
+                {
+                    List<QualityMaxValue> qualityMaxValues = new ArrayList<QualityMaxValue>();
+                    OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
+                    if ( parentOrgunit != null )
+                    {
+                        qualityMaxValues = new ArrayList<QualityMaxValue>( qualityMaxValueService.getQuanlityMaxValues(
+                            parentOrgunit, de ) );
+                    }
+                    
+                    List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( period.getStartDate(), period.getEndDate() ) );
+                    // System.out.println("Period Size: "+ periodList.size() );
+                    for ( Period prd : periodList )
+                    {
+
+                        List<OrganisationUnit> orgList = new ArrayList<OrganisationUnit>(
+                            organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() ) );
+                        // System.out.println("orgList Size: "+ orgList.size()
+                        // );
+                        for ( OrganisationUnit ou : orgList )
+                        {
+                            DataValue dataValue = dataValueService.getDataValue( de, prd, ou, optionCombo );
+                            for ( QualityMaxValue qualityMaxValue : qualityMaxValues )
+                            {
+                                // System.out.println("qualityMaxValue.getValue() "+qualityMaxValue.getValue());
+                                if ( qualityMaxValue.getStartDate().getTime() <= period.getStartDate().getTime()
+                                    && period.getEndDate().getTime() <= qualityMaxValue.getEndDate().getTime() )
+                                {
+                                    if ( dataValue != null )
+                                    {
+                                        allMax = allMax + qualityMaxValue.getValue();
+                                        // System.out.println("dataValue.getValue() "+dataValue.getValue());
+                                        allScore = allScore + Double.parseDouble( dataValue.getValue() );
+                                    }
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
         }
-        
-		quantityValue = Math.round(( allScore / allMax ) * 100) ;
-		System.out.println("quantityValue: "+quantityValue);
-		//quantityValue = Math.round( quantityValue );
-		double unadjusted = 0.0;
-        for(DataElement de : dataElements)
+
+        quantityValue = Math.round( (allScore / allMax) * 100 );
+        System.out.println( "quantityValue: " + quantityValue );
+        // quantityValue = Math.round( quantityValue );
+        double unadjusted = 0.0;
+        for ( DataElement de : dataElements )
         {
-        	double tariffValue = 0;
-        	List<OrganisationUnit> orgList = new ArrayList<OrganisationUnit>();
-        	OrganisationUnit parentOrgunit2 = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
+            double tariffValue = 0;
+            List<OrganisationUnit> orgList = new ArrayList<OrganisationUnit>();
+            OrganisationUnit parentOrgunit2 = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
             if ( parentOrgunit2 != null )
             {
-            	orgList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( parentOrgunit2.getId()));
+                orgList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( parentOrgunit2.getId() ) );
             }
             else
             {
-            	orgList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId()));
-            }
-        	for(OrganisationUnit ou : orgList )
-        	{
-        		List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates(period.getStartDate(), period.getEndDate()));
-	        	for(Period prd : periodList)
-	        	{       	
-		        	TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( ou , de, dataSet, prd.getStartDate(), prd.getEndDate());
-		        	
-		        	if(tariffDataValue != null)
-		        	{
-		        		System.out.println( tariffDataValue.getValue() );
-		        		tariffValue = tariffValue + tariffDataValue.getValue();
-		        	}
-	        	}
-        	}
-        	quantityValidatedMap.put(de.getUid(), quantityValue+"" );
-        	tariffDataValueMap.put(de.getUid(), tariffValue+"");
-        	double amount = ( quantityValue * tariffValue );
-        	amountMap.put(de.getUid(), amount+"" );
-        	unadjusted = unadjusted + amount;
+                orgList = new ArrayList<OrganisationUnit>(
+                    organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() ) );
+            }
+            for ( OrganisationUnit ou : orgList )
+            {
+                List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates(
+                    period.getStartDate(), period.getEndDate() ) );
+                for ( Period prd : periodList )
+                {
+                    TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( ou, de, dataSet,
+                        prd.getStartDate(), prd.getEndDate() );
+
+                    if ( tariffDataValue != null )
+                    {
+                        System.out.println( tariffDataValue.getValue() );
+                        tariffValue = tariffValue + tariffDataValue.getValue();
+                    }
+                }
+            }
+            quantityValidatedMap.put( de.getUid(), quantityValue + "" );
+            tariffDataValueMap.put( de.getUid(), tariffValue + "" );
+            double amount = (quantityValue * tariffValue);
+            amountMap.put( de.getUid(), amount + "" );
+            unadjusted = unadjusted + amount;
         }
-        unAdjustedAmount = unadjusted+"";
-        Collections.sort(dataElements);
-        DataElement dataElement = dataElementService.getDataElement((int)paymentAmount.getValue());
-        DataValue dataValue = dataValueService.getDataValue(dataElement, period, organisationUnit, optionCombo);
-        
-        if(dataValue != null)
+        unAdjustedAmount = unadjusted + "";
+        Collections.sort( dataElements );
+        DataElement dataElement = dataElementService.getDataElement( (int) paymentAmount.getValue() );
+        DataValue dataValue = dataValueService.getDataValue( dataElement, period, organisationUnit, optionCombo );
+
+        if ( dataValue != null )
         {
-        	amountAvailable = dataValue.getValue();        	
+            amountAvailable = dataValue.getValue();
         }
         return SUCCESS;
     }
-	public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
+
+    public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
     {
         Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
         if ( tariffOULevel == ouLevel )

=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report'
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/action'
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/action/PBFInvoiceReportFormAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/action/PBFInvoiceReportFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/report/action/PBFInvoiceReportFormAction.java	2014-04-05 12:21:33 +0000
@@ -0,0 +1,101 @@
+package org.hisp.dhis.pbf.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.period.QuarterlyPeriodType;
+import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+
+import com.opensymphony.xwork2.Action;
+
+public class PBFInvoiceReportFormAction
+    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;
+
+        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-pbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml	2014-04-01 18:59:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml	2014-04-05 12:21:33 +0000
@@ -262,6 +262,9 @@
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
 	</bean>
+
+    <bean id="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentAction"  class="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentAction" scope="prototype">
+    </bean>
 	
 	<!-- Save Quality Data -->
 	

=== 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	2014-04-01 18:59:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties	2014-04-05 12:21:33 +0000
@@ -51,4 +51,6 @@
 aggregation_expression=Aggregation expression
 operator=Operator
 
-update_aggregation_query_builder_detail = Update Aggregation Query Builder Detail
\ No newline at end of file
+update_aggregation_query_builder_detail = Update Aggregation Query Builder Detail
+
+quarterly_invoice_for_PBF_indicators_PMA = Quarterly invoice for PBF indicators PMA

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml	2014-04-02 16:32:50 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml	2014-04-05 12:21:33 +0000
@@ -324,6 +324,14 @@
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 
+
+    <!-- Reports -->
+    <action name="PBFInvoiceReportForm" class="org.hisp.dhis.pbf.report.action.PBFInvoiceReportFormAction">
+        <result name="success" type="velocity">/main.vm</result>
+        <param name="page">/dhis-web-maintenance-pbf/PBFInvoiceReportForm.vm</param>
+        <param name="javascripts">javascript/prevNextPeriods.js</param>
+        <param name="menu">/dhis-web-maintenance-pbf/menu.vm</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/PBFInvoiceReportForm.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/PBFInvoiceReportForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/PBFInvoiceReportForm.vm	2014-04-05 12:21:33 +0000
@@ -0,0 +1,101 @@
+<script type="text/javascript">
+
+	function formValidations()
+	{
+	   	
+	    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; 
+		}
+		
+		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; 
+        }
+		
+	    return true;
+	}
+
+    function redirectTorptDesign()
+    {
+
+	    var period = $('#selectedPeriodId').val();
+	    var year = period.substring(0,4);
+	    var quater = period.substring(4,6);
+    
+	    var reportFormat =  $('#selectedReportFormat').val();
+	    var orgunit = $('#treeSelectedId').val();
+
+	    if(quater=='Q1')
+	    {
+	        period = year+"-01-01";
+	    }
+	    else if(quater=='Q2')
+	    {
+	        period = year+"-04-01";
+	    }
+	    else if(quater=='Q3')
+	    {
+	        period = year+"-07-01";
+	    }
+	    else if(quater=='Q4')
+	    {
+	        period = year+"-10-01";
+	    }
+    
+	    window.location.href = "http://192.168.0.21:8095/birt_punjab_213/run?__report=/home/hisp/tomcat_punjab_213/webapps/birt_punjab_213/report/District%20Level%20Reports/JSY%20District%20Report.rptdesign&__format="+reportFormat+"&Date="+period+"&District="+orgunit;
+	    
+	    return false;
+    }
+
+</script>
+
+
+<h3>$i18n.getString( "quarterly_invoice_for_PBF_indicators_PMA" )</h3>
+
+<form id="generateReport"  method="Get" onsubmit="return formValidations()" >
+  
+	<table>
+		<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>
+						#end
+				</select>
+				<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>
+            <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>	
+	</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" onclick="return redirectTorptDesign()" />
+                <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-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/prevNextPeriods.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/prevNextPeriods.js	2014-03-14 11:22:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/prevNextPeriods.js	2014-04-05 12:21:33 +0000
@@ -5,13 +5,15 @@
 {	
 	var availableList = document.getElementById( availablePeriodsId );
 	var selectedList = document.getElementById( selectedPeriodsId );
+	var periodType = availablePeriodsId;
 	
 	clearList( selectedList );
 	
 	addOptionToList( selectedList, '-1', '[ Select ]' );
 	
 	$.getJSON( "getAvailableNextPrePeriods.action", {
-		"year": year },
+		"year": year,
+		"periodType":periodType},
 		function( json ) {
 			
 			for ( i in json.periods ) {

=== 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	2014-03-28 18:52:45 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm	2014-04-05 12:21:33 +0000
@@ -24,4 +24,8 @@
 <h2>$i18n.getString( "payment_adjustment" )</h2>
 <ul>
 	<li><a href="getPaymentAdjustmentDetail.action">$i18n.getString( "payment_adjustment" )</a></li>
+</ul>
+<h2>$i18n.getString( "reports" )</h2>
+<ul>
+    <li><a href="PBFInvoiceReportForm.action">$i18n.getString( "quarterly_invoice_for_PBF_indicators_PMA" )</a></li>
 </ul>
\ No newline at end of file