org.kuali.kfs.fp.document.service.impl
Class DisbursementVoucherTravelServiceImpl

java.lang.Object
  extended by org.kuali.kfs.fp.document.service.impl.DisbursementVoucherTravelServiceImpl
All Implemented Interfaces:
DisbursementVoucherTravelService

public class DisbursementVoucherTravelServiceImpl
extends Object
implements DisbursementVoucherTravelService

This is the default implementation of the DisbursementVoucherTravelService interface. Performs calculations of travel per diem and mileage amounts.


Constructor Summary
DisbursementVoucherTravelServiceImpl()
           
 
Method Summary
 org.kuali.rice.kns.util.KualiDecimal calculateMileageAmount(Integer totalMileage, Timestamp travelStartDate)
          This method calculates the mileage amount based on the total mileage traveled and the using the reimbursement rate applicable to when the trip started.
 org.kuali.rice.kns.util.KualiDecimal calculatePerDiemAmount(Timestamp startDateTime, Timestamp endDateTime, org.kuali.rice.kns.util.KualiDecimal rate)
          This method calculates the per diem amount for a given period of time at the rate provided.
 org.kuali.rice.kns.service.DateTimeService getDateTimeService()
          Gets the dateTimeService attribute.
 TravelMileageRateDao getTravelMileageRateDao()
          Gets the travelMileageRateDao attribute.
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
          Sets the dateTimeService attribute.
 void setTravelMileageRateDao(TravelMileageRateDao travelMileageRateDao)
          Sets the travelMileageRateDao attribute.
protected  boolean timeInPerDiemPeriod(Calendar cal, int periodStartHour, int periodStartMinute, int periodEndHour, int periodEndMinute)
          Checks whether the date is in a per diem period given by the start hour and end hour and minutes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisbursementVoucherTravelServiceImpl

public DisbursementVoucherTravelServiceImpl()
Method Detail

calculatePerDiemAmount

public org.kuali.rice.kns.util.KualiDecimal calculatePerDiemAmount(Timestamp startDateTime,
                                                                   Timestamp endDateTime,
                                                                   org.kuali.rice.kns.util.KualiDecimal rate)
This method calculates the per diem amount for a given period of time at the rate provided. The per diem amount is calculated as described below. For same day trips: - Per diem is equal to 1/2 of the per diem rate provided if the difference in time between the start and end time is greater than 12 hours. An additional 1/4 of a day is added back to the amount if the trip lasted past 7:00pm. - If the same day trip is less than 12 hours, the per diem amount will be zero. For multiple day trips: - Per diem amount is equal to the full rate times the number of full days of travel. A full day is equal to any day during the trip that is not the first day or last day of the trip. - For the first day of the trip, if the travel starts before noon, you receive a full day per diem, if the travel starts between noon and 5:59pm, you get a half day per diem, if the travel starts after 6:00pm, you only receive a quarter day per diem - For the last day of the trip, if the travel ends before 6:00am, you only receive a quarter day per diem, if the travel ends between 6:00am and noon, you receive a half day per diem, if the travel ends after noon, you receive a full day per diem

Specified by:
calculatePerDiemAmount in interface DisbursementVoucherTravelService
Parameters:
stateDateTime - The starting date and time of the period the per diem amount is calculated for.
endDateTime - The ending date and time of the period the per diema mount is calculated for.
rate - The per diem rate used to calculate the per diem amount.
Returns:
The per diem amount for the period specified, at the rate given.
See Also:
org.kuali.kfs.fp.document.service.DisbursementVoucherTravelService#calculatePerDiemAmount(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeTravel)

timeInPerDiemPeriod

protected boolean timeInPerDiemPeriod(Calendar cal,
                                      int periodStartHour,
                                      int periodStartMinute,
                                      int periodEndHour,
                                      int periodEndMinute)
Checks whether the date is in a per diem period given by the start hour and end hour and minutes.

Parameters:
cal - The date being checked to see if it occurred within the defined travel per diem period.
periodStartHour - The starting hour of the per diem period.
periodStartMinute - The starting minute of the per diem period.
periodEndHour - The ending hour of the per diem period.
periodEndMinute - The ending minute of the per diem period.
Returns:
True if the date passed in occurred within the period defined by the given parameters, false otherwise.

calculateMileageAmount

public org.kuali.rice.kns.util.KualiDecimal calculateMileageAmount(Integer totalMileage,
                                                                   Timestamp travelStartDate)
This method calculates the mileage amount based on the total mileage traveled and the using the reimbursement rate applicable to when the trip started. For this method, a collection of mileage rates is retrieved, where each mileage rate is defined by a mileage limit. This collection is iterated over to determine which mileage rate will be used for calculating the total mileage amount due.

Specified by:
calculateMileageAmount in interface DisbursementVoucherTravelService
Parameters:
totalMileage - The total mileage traveled that will be reimbursed for.
travelStartDate - The start date of the travel, which will be used to retrieve the mileage reimbursement rate.
Returns:
The total reimbursement due to the traveler for the mileage traveled.
See Also:
org.kuali.kfs.fp.document.service.DisbursementVoucherTravelService#calculateMileageAmount(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeTravel)

getTravelMileageRateDao

public TravelMileageRateDao getTravelMileageRateDao()
Gets the travelMileageRateDao attribute.

Returns:
Returns the travelMileageRateDao.

setTravelMileageRateDao

public void setTravelMileageRateDao(TravelMileageRateDao travelMileageRateDao)
Sets the travelMileageRateDao attribute.

Parameters:
travelMileageRateDao - The travelMileageRateDao to set.

getDateTimeService

public org.kuali.rice.kns.service.DateTimeService getDateTimeService()
Gets the dateTimeService attribute.

Returns:
Returns the dateTimeService.

setDateTimeService

public void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
Sets the dateTimeService attribute.

Parameters:
dateTimeService - The dateTimeService to set.


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.