use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class ClientBoTest method testAddClientAttendance.
@Test
public void testAddClientAttendance() {
Assert.assertEquals("Expecting no attendance entries on a new object", 0, client.getClientAttendances().size());
DateTime meetingDate = new DateTimeService().getCurrentDateTime();
client.addClientAttendance(buildClientAttendance(meetingDate.toDate()));
Assert.assertEquals("Expecting one attendance entry", 1, client.getClientAttendances().size());
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class ClientBoTest method getDateOffset.
private DateMidnight getDateOffset(final int numberOfDays) {
DateMidnight currentDate = new DateTimeService().getCurrentDateMidnight();
currentDate = currentDate.minusDays(numberOfDays);
return currentDate;
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class TestObjectFactory method getNewWeeklyMeeting.
/**
* Return a new meeting object with a meeting occurring on the day of the week that the test is run. Creating a new
* method to fix issues with meeting creation without breaking existing tests that may depend on it.
*
* @param recurAfter 1 means every day/week/month, 2 means every second day/week/month...
*/
public static MeetingBO getNewWeeklyMeeting(final short recurAfter) {
Calendar calendar = new GregorianCalendar();
MeetingBO meeting;
try {
meeting = new MeetingBO(WeekDay.getWeekDay((short) calendar.get(Calendar.DAY_OF_WEEK)), recurAfter, new DateTimeService().getCurrentJavaDateTime(), CUSTOMER_MEETING, "meetingPlace");
} catch (Exception e) {
throw new RuntimeException(e);
}
return meeting;
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class TestObjectFactory method createClient.
public static ClientBO createClient(final String customerName, final MeetingBO meeting, final CustomerStatus status) {
ClientBO client;
try {
PersonnelBO systemUser = getPersonnel(PersonnelConstants.SYSTEM_USER);
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
clientNameDetailDto.setNames(ClientRules.getNameSequence());
ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
client = new ClientBO(TestUtils.makeUserWithLocales(), clientNameDetailDto.getDisplayName(), status, null, null, null, null, getFees(), null, systemUser, new OfficePersistence().getOffice(SAMPLE_BRANCH_OFFICE), meeting, systemUser, new DateTimeService().getCurrentJavaDateTime(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
ApplicationContextProvider.getBean(LegacyClientDao.class).saveClient(client);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
return client;
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class LoanBO method applyOneTimeFee.
private void applyOneTimeFee(final FeeBO fee, final Double charge, final AccountActionDateEntity accountActionDateEntity) throws AccountException {
LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
AccountFeesEntity accountFee = new AccountFeesEntity(this, fee, charge, FeeStatus.ACTIVE.getValue(), new DateTimeService().getCurrentJavaDateTime(), null);
Set<AccountFeesEntity> accountFeeSet = new HashSet<AccountFeesEntity>();
accountFeeSet.add(accountFee);
populateAccountFeeAmount(accountFeeSet, loanSummary.getOriginalInterest());
List<AccountActionDateEntity> loanScheduleEntityList = new ArrayList<AccountActionDateEntity>();
loanScheduleEntityList.add(loanScheduleEntity);
List<InstallmentDate> installmentDates = new ArrayList<InstallmentDate>();
installmentDates.add(new InstallmentDate(accountActionDateEntity.getInstallmentId(), accountActionDateEntity.getActionDate()));
List<FeeInstallment> feeInstallmentList = new ArrayList<FeeInstallment>();
feeInstallmentList.add(handleOneTime(accountFee, installmentDates));
Money totalFeeAmountApplied = applyFeeToInstallments(feeInstallmentList, loanScheduleEntityList);
filterTimeOfDisbursementFees(loanScheduleEntity, fee);
updateLoanSummary(fee.getFeeId(), totalFeeAmountApplied);
updateLoanActivity(fee.getFeeId(), totalFeeAmountApplied, fee.getFeeName() + AccountConstants.APPLIED);
}
Aggregations