use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class WithdrawalAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
SavingsTrxnDetailEntity savingsTrxn = (SavingsTrxnDetailEntity) financialActivity.getAccountTrxn();
SavingsBO savings = (SavingsBO) savingsTrxn.getAccount();
FinancialActionTypeEntity finActionWithrawal = null;
if (savings.isMandatory()) {
finActionWithrawal = getFinancialAction(FinancialActionConstants.MANDATORYWITHDRAWAL);
}
if (savings.isVoluntary()) {
finActionWithrawal = getFinancialAction(FinancialActionConstants.VOLUNTARYWITHDRAWAL);
}
if (savings.getState() == AccountState.SAVINGS_CLOSED) {
handleRoundingForWithdrawal(savings, savingsTrxn);
}
addAccountEntryDetails(savingsTrxn.getWithdrawlAmount(), finActionWithrawal, savings.getSavingsOffering().getDepositGLCode(), FinancialConstants.DEBIT);
addAccountEntryDetails(savingsTrxn.getWithdrawlAmount(), finActionWithrawal, getGLcode(finActionWithrawal.getApplicableCreditCharts()), FinancialConstants.CREDIT);
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class DepositAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
SavingsTrxnDetailEntity savingsTrxn = (SavingsTrxnDetailEntity) financialActivity.getAccountTrxn();
SavingsBO savings = (SavingsBO) savingsTrxn.getAccount();
FinancialActionTypeEntity finActionDeposit = null;
if (savings.isMandatory()) {
finActionDeposit = getFinancialAction(FinancialActionConstants.MANDATORYDEPOSIT);
} else if (savings.isVoluntary()) {
finActionDeposit = getFinancialAction(FinancialActionConstants.VOLUNTARYDEPOSIT);
}
addAccountEntryDetails(savingsTrxn.getDepositAmount(), finActionDeposit, getGLcode(finActionDeposit.getApplicableDebitCharts()), FinancialConstants.DEBIT);
addAccountEntryDetails(savingsTrxn.getDepositAmount(), finActionDeposit, savings.getSavingsOffering().getDepositGLCode(), FinancialConstants.CREDIT);
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class InterestPostingAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
SavingsTrxnDetailEntity savingsTrxn = (SavingsTrxnDetailEntity) financialActivity.getAccountTrxn();
FinancialActionTypeEntity finIntPostingAction = getFinancialAction(FinancialActionConstants.SAVINGS_INTERESTPOSTING);
SavingsOfferingBO savingsOffering = ((SavingsBO) savingsTrxn.getAccount()).getSavingsOffering();
addAccountEntryDetails(savingsTrxn.getInterestAmount(), finIntPostingAction, savingsOffering.getInterestGLCode(), FinancialConstants.DEBIT);
addAccountEntryDetails(savingsTrxn.getInterestAmount(), finIntPostingAction, savingsOffering.getDepositGLCode(), FinancialConstants.CREDIT);
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsAdjustmentAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
SavingsTrxnDetailEntity savingsTrxn = (SavingsTrxnDetailEntity) financialActivity.getAccountTrxn();
SavingsBO savings = (SavingsBO) savingsTrxn.getAccount();
if (isAdjustmentForWithdrawal(savings)) {
adjustWithdrawal(savings, savingsTrxn);
} else {
adjustDeposit(savings, savingsTrxn);
}
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveClosingDetails.
@Override
public SavingsAccountClosureDto retrieveClosingDetails(Long savingsId, LocalDate closureDate) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
SavingsBO savingsAccount = this.savingsDao.findById(savingsId);
InterestScheduledEvent postingSchedule = savingsInterestScheduledEventFactory.createScheduledEventFrom(savingsAccount.getInterestPostingMeeting());
LocalDate nextPostingDate = new LocalDate(savingsAccount.getNextIntPostDate());
LocalDate startOfPostingPeriod = postingSchedule.findFirstDateOfPeriodForMatchingDate(nextPostingDate);
CalendarPeriod postingPeriodAtClosure;
if (startOfPostingPeriod.isAfter(closureDate)) {
postingPeriodAtClosure = new CalendarPeriod(closureDate, closureDate);
} else {
postingPeriodAtClosure = new CalendarPeriod(startOfPostingPeriod, closureDate);
}
List<EndOfDayDetail> allEndOfDayDetailsForAccount = savingsDao.retrieveAllEndOfDayDetailsFor(savingsAccount.getCurrency(), Long.valueOf(savingsId));
InterestPostingPeriodResult postingPeriodAtClosureResult = determinePostingPeriodResult(postingPeriodAtClosure, savingsAccount, allEndOfDayDetailsForAccount);
Money endOfAccountBalance = postingPeriodAtClosureResult.getPeriodBalance();
Money interestAmountAtClosure = postingPeriodAtClosureResult.getPeriodInterest();
List<ListElement> depositPaymentTypes = retrieveDepositPaymentTypes(userContext);
return new SavingsAccountClosureDto(new LocalDate(), endOfAccountBalance.toString(), interestAmountAtClosure.toString(), depositPaymentTypes);
}
Aggregations