use of java.sql.Date in project head by mifos.
the class SavingsOverDueDepositsTag method buildUI.
StringBuilder buildUI(List<AccountActionDateEntity> installmentsInArrears, Locale locale) {
StringBuilder builder = new StringBuilder();
SavingsScheduleEntity installment = null;
Date actionDate = null;
Collections.sort(installmentsInArrears, new Comparator<AccountActionDateEntity>() {
@Override
public int compare(AccountActionDateEntity actionDate1, AccountActionDateEntity actionDate2) {
return actionDate1.getActionDate().compareTo(actionDate2.getActionDate());
}
});
for (int i = 0; i < installmentsInArrears.size(); ) {
actionDate = installmentsInArrears.get(i).getActionDate();
Money totalAmount = new Money(installmentsInArrears.get(i).getAccount().getCurrency());
do {
installment = (SavingsScheduleEntity) installmentsInArrears.get(i);
if (!(installment.getCustomer().getCustomerLevel().getId().equals(CustomerLevel.CLIENT.getValue()) && installment.getCustomer().getStatus().equals(CustomerStatus.CLIENT_CLOSED))) {
totalAmount = totalAmount.add(installment.getTotalDepositDue());
}
i++;
} while (i < installmentsInArrears.size() && actionDate.equals(installmentsInArrears.get(i).getActionDate()));
if (totalAmount.isGreaterThanZero()) {
builder.append(buildDepositDueUIRow(locale, actionDate, totalAmount));
}
}
return builder;
}
use of java.sql.Date in project head by mifos.
the class AccountApplyPaymentActionForm method setTransactionDate.
public void setTransactionDate(String receiptDate) throws InvalidDateException {
if (StringUtils.isBlank(receiptDate)) {
transactionDateDD = null;
transactionDateMM = null;
transactionDateYY = null;
} else {
Calendar cal = new GregorianCalendar();
java.sql.Date date = getDateAsSentFromBrowser(receiptDate);
cal.setTime(date);
transactionDateDD = Integer.toString(cal.get(Calendar.DAY_OF_MONTH));
transactionDateMM = Integer.toString(cal.get(Calendar.MONTH) + 1);
transactionDateYY = Integer.toString(cal.get(Calendar.YEAR));
}
}
use of java.sql.Date in project head by mifos.
the class LegacyLoanDaoIntegrationTest method getBadAccount.
private LoanBO getBadAccount() {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanabcd", "abcd", ApplicableTo.CLIENTS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
return TestObjectFactory.createLoanAccount("42423142323", group, AccountState.LOAN_ACTIVE_IN_BAD_STANDING, startDate, loanOffering);
}
use of java.sql.Date in project head by mifos.
the class LegacyLoanDaoIntegrationTest method testSaveAndGetOriginalLoanScheduleEntityWithFees.
@Test
public void testSaveAndGetOriginalLoanScheduleEntityWithFees() throws PersistenceException {
ArrayList<OriginalLoanScheduleEntity> originalLoanScheduleEntities = new ArrayList<OriginalLoanScheduleEntity>();
Date date = new Date(new java.util.Date().getTime());
Short installmentId = new Short("1");
FeeBO upfrontFee = TestObjectFactory.createOneTimeRateFee("Upfront Fee", FeeCategory.LOAN, Double.valueOf("20"), FeeFormula.AMOUNT, FeePayment.UPFRONT, null);
AccountFeesEntity accountUpfrontFee = new AccountFeesEntity(goodAccount, upfrontFee, new Double("20.0"), FeeStatus.ACTIVE.getValue(), null, date);
AccountTestUtils.addAccountFees(accountUpfrontFee, goodAccount);
TestObjectFactory.updateObject(goodAccount);
goodAccount = (LoanBO) TestObjectFactory.getObject(AccountBO.class, goodAccount.getAccountId());
LoanScheduleEntity loanScheduleEntity = new LoanScheduleEntity(goodAccount, group, installmentId, date, PaymentStatus.UNPAID, Money.zero(), Money.zero());
LoanFeeScheduleEntity feesEntity = new LoanFeeScheduleEntity(loanScheduleEntity, upfrontFee, accountUpfrontFee, Money.zero());
loanScheduleEntity.addAccountFeesAction(feesEntity);
OriginalLoanScheduleEntity originalLoanScheduleEntity = new OriginalLoanScheduleEntity(loanScheduleEntity);
OriginalLoanFeeScheduleEntity scheduleEntityFee = new OriginalLoanFeeScheduleEntity(feesEntity, originalLoanScheduleEntity);
originalLoanScheduleEntities.add(originalLoanScheduleEntity);
legacyLoanDao.saveOriginalSchedule(originalLoanScheduleEntities);
List<OriginalLoanScheduleEntity> actual = legacyLoanDao.getOriginalLoanScheduleEntity(goodAccount.getAccountId());
List<OriginalLoanFeeScheduleEntity> fees = new ArrayList<OriginalLoanFeeScheduleEntity>(actual.get(0).getAccountFeesActionDetails());
Assert.assertEquals(1, actual.size());
Assert.assertEquals(1, fees.size());
assertThat(actual, is(new OriginalLoanScheduleEntitiesMatcher(originalLoanScheduleEntities)));
assertThat(fees.get(0), is(new OriginalLoanFeeScheduleEntityMatcher(scheduleEntityFee)));
}
use of java.sql.Date in project head by mifos.
the class LegacyLoanDaoIntegrationTest method getGoodAccount.
private LoanBO getGoodAccount() {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanabf", "abf", ApplicableTo.CLIENTS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
return TestObjectFactory.createLoanAccount("42423142342", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
Aggregations