Examples of Loan


Examples of monashbook.models.Loan

            loginController.setErrorMessage("Please login to make a loan.");
        }else {
            DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
            Date date = new Date();
            String currentDate = dateFormat.format(date);
            Loan loan = new Loan();
            loan.setPatron(patron);
            loan.setBook(book);
            loan.setLoanDate(currentDate);
            loan.setDueDate(currentDate);
            loan.setStatus("In Progress...");
            book.getLoans().add(loan);
            book.setAvailability(false);
            loginController.getPatronLoans().add(loan);
            //bookService.addLoan(loan);
            bookService.addBook(book);
View Full Code Here

Examples of net.datacrow.core.objects.Loan

    public static Loan getCurrentLoan(String parentID) {
        DataFilter df = new DataFilter(DcModules._LOAN);
        df.addEntry(new DataFilterEntry(DcModules._LOAN, Loan._B_ENDDATE, Operator.IS_EMPTY, null));
        df.addEntry(new DataFilterEntry(DcModules._LOAN, Loan._D_OBJECTID, Operator.EQUAL_TO, parentID));
        List<DcObject> items = get(df);
        return items.size() > 0 ? (Loan) items.get(0) : new Loan();
    }
View Full Code Here

Examples of net.datacrow.core.objects.Loan

     * Creates a new instance of a loan.
     * @see Loan
     */
    @Override
    public DcObject createItem() {
        return new Loan();
    }
View Full Code Here

Examples of net.datacrow.core.objects.Loan

        this.objects = new ArrayList<DcObject>(objects);
        this.owner = owner;
       
        int counter = 0;
        Boolean available = null;
        Loan l = (Loan) DcModules.get(DcModules._LOAN).getItem();
        boolean currentStatus;
        for (DcObject o : objects) {
            dco = counter == 0 ? o : dco;
            currentStatus = l.isAvailable(o.getID());
            available = available == null ? currentStatus : available;
           
            if (available.booleanValue() != currentStatus) {
                DcSwingUtilities.displayWarningMessage("msgNotSameState");
                throw new Exception(DcResources.getText("msgNotSameState"));
View Full Code Here

Examples of net.datacrow.core.objects.Loan

        if (endDate == null) {
            DcSwingUtilities.displayWarningMessage("msgEnterReturnDate");
            return;
        }
       
        Loan currentLoan;
        Date startDate;
        for (DcObject o : objects) {
            currentLoan = DataManager.getCurrentLoan(o.getID());
            startDate = (Date) currentLoan.getValue(Loan._A_STARTDATE);
            if (startDate.compareTo(endDate) > 0) {
                DcSwingUtilities.displayWarningMessage("msgEndDateMustBeAfterStartDate");
                return;
            }
        }
       
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    int i = 0;
                    Loan currentLoan;
                    for (DcObject o : objects) {
                        currentLoan = DataManager.getCurrentLoan(o.getID());
                        if (currentLoan.getID() != null) {
                            currentLoan.setValue(Loan._D_OBJECTID, o.getID());
                            currentLoan.setValue(Loan._B_ENDDATE, endDate);
                            currentLoan.setValue(Loan._E_DUEDATE, null);
                           
                            if (owner != null && i == objects.size()  - 1) // last item
                                currentLoan.addRequest(new CloseWindowRequest(owner));
                            else if (owner == null)
                                setLoanInformation(currentLoan);
                           
                            dco.setLoanInformation(currentLoan);

                            currentLoan.saveUpdate(false, false);
                            i++;
                        }
                       
                        try {
                            wait(10);
View Full Code Here

Examples of net.datacrow.core.objects.Loan

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    int i = 0;
                    Loan currentLoan;
                    for (DcObject o : objects) {
                        currentLoan = DataManager.getCurrentLoan(o.getID());
                        currentLoan.setValue(Loan._D_OBJECTID, o.getID());
                        currentLoan.setValue(Loan._A_STARTDATE, startDate);
                        currentLoan.setValue(Loan._C_CONTACTPERSONID, contactPersonID);
                        currentLoan.setValue(Loan._E_DUEDATE, dueDate);
                       
                        if (owner != null && i == objects.size() - 1) // last item
                            currentLoan.addRequest(new CloseWindowRequest(owner));
                        else if (owner == null)
                            setLoanInformation(currentLoan);                       
       
                        o.setLoanInformation(currentLoan);
                       
                        if (currentLoan.getID() != null)
                          currentLoan.saveUpdate(true);
                        else
                            currentLoan.saveNew(true);
                       
                        try {
                            wait(100);
                        } catch (Exception ignore) {}
                       
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.Loan

        final Staff fromLoanOfficer = this.loanAssembler.findLoanOfficerByIdIfProvided(fromLoanOfficerId);
        final Staff toLoanOfficer = this.loanAssembler.findLoanOfficerByIdIfProvided(toLoanOfficerId);

        for (final String loanIdString : loanIds) {
            final Long loanId = Long.valueOf(loanIdString);
            final Loan loan = this.loanAssembler.assembleFrom(loanId);
            checkClientOrGroupActive(loan);

            if (!loan.hasLoanOfficer(fromLoanOfficer)) { throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); }

            loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment);
            saveLoanWithDataIntegrityViolationChecks(loan);
        }
        this.loanRepository.flush();

        return new CommandProcessingResultBuilder() //
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.Loan

        loanUpdateCommand.validate();

        final LocalDate dateOfLoanOfficerunAssigned = command.localDateValueOfParameterNamed("unassignedDate");

        final Loan loan = this.loanAssembler.assembleFrom(loanId);
        checkClientOrGroupActive(loan);

        if (loan.getLoanOfficer() == null) { throw new LoanOfficerUnassignmentException(loanId); }

        loan.removeLoanOfficer(dateOfLoanOfficerunAssigned);

        saveLoanWithDataIntegrityViolationChecks(loan);

        return new CommandProcessingResultBuilder() //
                .withCommandId(command.commandId()) //
                .withEntityId(loanId) //
                .withOfficeId(loan.getOfficeId()) //
                .withClientId(loan.getClientId()) //
                .withGroupId(loan.getGroupId()) //
                .withLoanId(loanId) //
                .build();
    }
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.Loan

    }

    @Transactional
    public void applyOverdueChargesForLoan(final Long loanId, Collection<OverdueLoanScheduleData> overdueLoanScheduleDatas) {

        Loan loan = null;
        final List<Long> existingTransactionIds = new ArrayList<>();
        final List<Long> existingReversedTransactionIds = new ArrayList<>();
        boolean runInterestRecalculation = false;
        for (final OverdueLoanScheduleData overdueInstallment : overdueLoanScheduleDatas) {

            final JsonElement parsedCommand = this.fromApiJsonHelper.parse(overdueInstallment.toString());
            final JsonCommand command = JsonCommand.from(overdueInstallment.toString(), parsedCommand, this.fromApiJsonHelper, null, null,
                    null, null, null, loanId, null, null, null, null);
            LoanOverdueDTO overdueDTO = applyChargeToOverdueLoanInstallment(loanId, overdueInstallment.getChargeId(),
                    overdueInstallment.getPeriodNumber(), command, loan, existingTransactionIds, existingReversedTransactionIds);
            loan = overdueDTO.getLoan();
            runInterestRecalculation = runInterestRecalculation || overdueDTO.isRunInterestRecalculation();
        }
        if (loan != null) {
            if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
                if (runInterestRecalculation && loan.isFeeCompoundingEnabledForInterestRecalculation()) {
                    runScheduleRecalculation(loan);
                }
                updateOriginalSchedule(loan);
            }

            postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);

            if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled() && runInterestRecalculation
                    && loan.isFeeCompoundingEnabledForInterestRecalculation()) {
                this.loanAccountDomainService.recalculateAccruals(loan);
            }
        }
    }
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.Loan

        return new LoanOverdueDTO(loan, runInterestRecalculation);
    }

    @Override
    public CommandProcessingResult undoWriteOff(Long loanId) {
        final Loan loan = this.loanAssembler.assembleFrom(loanId);
        checkClientOrGroupActive(loan);
        final List<Long> existingTransactionIds = new ArrayList<>();
        final List<Long> existingReversedTransactionIds = new ArrayList<>();
        if (!loan.isClosedWrittenOff()) { throw new PlatformServiceUnavailableException(
                "error.msg.loan.status.not.written.off.update.not.allowed", "Loan :" + loanId
                        + " update not allowed as loan status is not written off", loanId); }
        CalendarInstance restCalendarInstance = null;
        ApplicationCurrency applicationCurrency = null;
        LocalDate calculatedRepaymentsStartingFromDate = null;
        List<Holiday> holidays = null;
        boolean isHolidayEnabled = false;
        WorkingDays workingDays = null;
        LocalDate recalculateFrom = null;
        Long overdurPenaltyWaitPeriod = null;
        LocalDate lastTransactionDate = null;

        if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
            restCalendarInstance = calendarInstanceRepository.findCalendarInstaneByEntityId(loan.loanInterestRecalculationDetailId(),
                    CalendarEntityType.LOAN_RECALCULATION_DETAIL.getValue());

            final MonetaryCurrency currency = loan.getCurrency();
            applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency);
            final CalendarInstance calendarInstance = this.calendarInstanceRepository.findCalendarInstaneByEntityId(loan.getId(),
                    CalendarEntityType.LOANS.getValue());
            calculatedRepaymentsStartingFromDate = this.loanAccountDomainService.getCalculatedRepaymentsStartingFromDate(
                    loan.getDisbursementDate(), loan, calendarInstance);

            isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
            holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(), loan.getDisbursementDate().toDate());
            workingDays = this.workingDaysRepository.findOne();
            overdurPenaltyWaitPeriod = this.configurationDomainService.retrievePenaltyWaitPeriod();
        }

        HolidayDetailDTO holidayDetailDTO = new HolidayDetailDTO(isHolidayEnabled, holidays, workingDays);
        ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency,
                calculatedRepaymentsStartingFromDate, holidayDetailDTO, restCalendarInstance, recalculateFrom, overdurPenaltyWaitPeriod,
                lastTransactionDate);

        ChangedTransactionDetail changedTransactionDetail = loan.undoWrittenOff(existingTransactionIds, existingReversedTransactionIds,
                scheduleGeneratorDTO);
        if (changedTransactionDetail != null) {
            for (final Map.Entry<Long, LoanTransaction> mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) {
                this.loanTransactionRepository.save(mapEntry.getValue());
                this.accountTransfersWritePlatformService.updateLoanTransaction(mapEntry.getKey(), mapEntry.getValue());
            }
        }
        saveLoanWithDataIntegrityViolationChecks(loan);

        postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
        this.loanAccountDomainService.recalculateAccruals(loan);
        return new CommandProcessingResultBuilder() //
                .withOfficeId(loan.getOfficeId()) //
                .withClientId(loan.getClientId()) //
                .withGroupId(loan.getGroupId()) //
                .withLoanId(loanId) //
                .build();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.