Search in sources :

Example 11 with CollectionSheetEntryGridDto

use of org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto in project head by mifos.

the class CollectionSheetServiceFacadeWebTier method previewCollectionSheetEntry.

@Override
public CollectionSheetEntryGridDto previewCollectionSheetEntry(final CollectionSheetEntryGridDto previousCollectionSheetEntryDto, final CollectionSheetDataDto dataView) {
    CollectionSheetEntryGridDto newCollectionSheetEntryGridDto = null;
    final CollectionSheetEntryDto bulkEntryParent = previousCollectionSheetEntryDto.getBulkEntryParent();
    switch(CustomerLevel.getLevel(bulkEntryParent.getCustomerDetail().getCustomerLevelId())) {
        case CENTER:
            newCollectionSheetEntryGridDto = new CollectionSheetEntryGridDtoTranslator().translateAsCenter(previousCollectionSheetEntryDto, dataView);
            break;
        case GROUP:
        case CLIENT:
            newCollectionSheetEntryGridDto = new CollectionSheetEntryGridDtoTranslator().translateAsGroup(previousCollectionSheetEntryDto, dataView);
            break;
    }
    return newCollectionSheetEntryGridDto;
}
Also used : CollectionSheetEntryDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Example 12 with CollectionSheetEntryGridDto

use of org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto in project head by mifos.

the class ProductDtoComparator method toLegacyDto.

@Override
public CollectionSheetEntryGridDto toLegacyDto(final CollectionSheetDto collectionSheet, final CollectionSheetFormEnteredDataDto formEnteredDataDto, final List<CustomValueListElementDto> attendanceTypesList, final MifosCurrency currency) {
    final CollectionSheetEntryDto collectionSheetEntryViewHierarchy = createEntryViewHierarchyFromCollectionSheetData(collectionSheet.getCollectionSheetCustomer(), currency);
    final PersonnelDto loanOfficer = formEnteredDataDto.getLoanOfficer();
    final OfficeDetailsDto office = formEnteredDataDto.getOffice();
    final ListItem<Short> paymentType = formEnteredDataDto.getPaymentType();
    final Date meetingDate = formEnteredDataDto.getMeetingDate();
    final String receiptId = formEnteredDataDto.getReceiptId();
    final Date receiptDate = formEnteredDataDto.getReceiptDate();
    final List<ProductDto> loanProductDtos = createListOfLoanProducts(collectionSheet.getCollectionSheetCustomer());
    final List<ProductDto> savingProductDtos = createListOfSavingProducts(collectionSheet.getCollectionSheetCustomer());
    final CollectionSheetEntryGridDto translatedGridDto = new CollectionSheetEntryGridDto(collectionSheetEntryViewHierarchy, loanOfficer, office, paymentType, meetingDate, receiptId, receiptDate, loanProductDtos, savingProductDtos, attendanceTypesList);
    return translatedGridDto;
}
Also used : PersonnelDto(org.mifos.dto.domain.PersonnelDto) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) CollectionSheetEntryDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryDto) Date(java.util.Date) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Example 13 with CollectionSheetEntryGridDto

use of org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto in project head by mifos.

the class BulkEntryTag method doStartTag.

@SuppressWarnings("unchecked")
@Override
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    JspWriter out = pageContext.getOut();
    StringBuilder builder = new StringBuilder();
    CollectionSheetEntryGridDto bulkEntry = null;
    try {
        bulkEntry = (CollectionSheetEntryGridDto) SessionUtils.getAttribute(CollectionSheetEntryConstants.BULKENTRY, request);
    } catch (PageExpiredException e) {
        logger.error("Page expired getting BulkEntryBO.");
    }
    if (null != bulkEntry) {
        List<ProductDto> loanProducts = bulkEntry.getLoanProducts();
        List<ProductDto> savingsProducts = bulkEntry.getSavingProducts();
        try {
            final List<CustomValueListElementDto> custAttTypes = (List<CustomValueListElementDto>) SessionUtils.getAttribute(CollectionSheetEntryConstants.CUSTOMERATTENDANCETYPES, request);
            String method = request.getParameter(CollectionSheetEntryConstants.METHOD);
            generateTagData(bulkEntry, loanProducts, savingsProducts, custAttTypes, method, builder);
        } catch (ApplicationException ae) {
            throw new JspException(ae);
        } catch (SystemException se) {
            throw new JspException(se);
        }
    }
    try {
        out.write(builder.toString());
    } catch (IOException ioe) {
        throw new JspException(ioe);
    }
    return SKIP_BODY;
}
Also used : CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter) HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) SystemException(org.mifos.framework.exceptions.SystemException) List(java.util.List) ProductDto(org.mifos.application.servicefacade.ProductDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Example 14 with CollectionSheetEntryGridDto

use of org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto in project head by mifos.

the class CollectionSheetEntryAction method get.

/**
     * This method is called once the search criteria have been entered by the user to generate the bulk entry details
     * for a particular customer It retrieves the loan officer office, and parent customer that was selected and sets
     * them into the bulk entry business object. The list of attendance types and product list associated with the
     * center, and its children are also retrieved
     */
@TransactionDemarcate(joinToken = true)
public ActionForward get(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    logTrackingInfo("get", request, form);
    final BulkEntryActionForm collectionSheetEntryActionForm = (BulkEntryActionForm) form;
    final CollectionSheetEntryFormDto previousCollectionSheetEntryFormDto = retrieveFromRequestCollectionSheetEntryFormDto(request);
    final CollectionSheetEntryFormDtoDecorator dtoDecorator = new CollectionSheetEntryFormDtoDecorator(previousCollectionSheetEntryFormDto);
    final CollectionSheetFormEnteredDataDto formEnteredDataDto = new FormEnteredDataAssembler(collectionSheetEntryActionForm, dtoDecorator).toDto();
    final MifosCurrency currency = Configuration.getInstance().getSystemConfig().getCurrency();
    final CollectionSheetEntryGridDto collectionSheetEntry = collectionSheetServiceFacade.generateCollectionSheetEntryGridView(formEnteredDataDto, currency);
    storeOnRequestCollectionSheetEntryDto(request, collectionSheetEntry);
    return mapping.findForward(CollectionSheetEntryConstants.GETSUCCESS);
}
Also used : BulkEntryActionForm(org.mifos.application.collectionsheet.struts.actionforms.BulkEntryActionForm) FormEnteredDataAssembler(org.mifos.application.servicefacade.FormEnteredDataAssembler) CollectionSheetFormEnteredDataDto(org.mifos.application.servicefacade.CollectionSheetFormEnteredDataDto) CollectionSheetEntryFormDtoDecorator(org.mifos.application.servicefacade.CollectionSheetEntryFormDtoDecorator) MifosCurrency(org.mifos.application.master.business.MifosCurrency) CollectionSheetEntryFormDto(org.mifos.application.servicefacade.CollectionSheetEntryFormDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 15 with CollectionSheetEntryGridDto

use of org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto in project head by mifos.

the class BulkEntryActionStrutsTest method testSuccessfulPreview.

@Test
public void testSuccessfulPreview() throws Exception {
    CollectionSheetEntryGridDto bulkEntry = getSuccessfulBulkEntry();
    Calendar meetinDateCalendar = new GregorianCalendar();
    int year = meetinDateCalendar.get(Calendar.YEAR);
    int month = meetinDateCalendar.get(Calendar.MONTH);
    int day = meetinDateCalendar.get(Calendar.DAY_OF_MONTH);
    meetinDateCalendar = new GregorianCalendar(year, month, day);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CollectionSheetEntryConstants.BULKENTRY, bulkEntry, request);
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("method", "preview");
    addRequestParameter("attendanceSelected[0]", "1");
    addRequestParameter("enteredAmount[0][0]", "212.0");
    addRequestParameter("enteredAmount[1][1]", "212.0");
    addRequestParameter("enteredAmount[0][1]", "212.0");
    addRequestParameter("enteredAmount[1][0]", "212.0");
    addRequestParameter("withDrawalAmountEntered[2][2]", "100.0");
    addRequestParameter("depositAmountEntered[2][2]", "100.0");
    addRequestParameter("withDrawalAmountEntered[0][0]", "100.0");
    addRequestParameter("depositAmountEntered[0][0]", "100.0");
    addRequestDateParameter("transactionDate", day + "/" + (month + 1) + "/" + year);
    performNoErrors();
    verifyForward("preview_success");
    groupAccount = TestObjectFactory.getObject(LoanBO.class, groupAccount.getAccountId());
    clientAccount = TestObjectFactory.getObject(LoanBO.class, clientAccount.getAccountId());
    centerSavingsAccount = TestObjectFactory.getObject(SavingsBO.class, centerSavingsAccount.getAccountId());
    clientSavingsAccount = TestObjectFactory.getObject(SavingsBO.class, clientSavingsAccount.getAccountId());
    groupSavingsAccount = TestObjectFactory.getObject(SavingsBO.class, groupSavingsAccount.getAccountId());
    center = TestObjectFactory.getCustomer(center.getCustomerId());
    group = TestObjectFactory.getCustomer(group.getCustomerId());
    client = TestObjectFactory.getClient(client.getCustomerId());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) LoanBO(org.mifos.accounts.loan.business.LoanBO) GregorianCalendar(java.util.GregorianCalendar) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto) Test(org.junit.Test)

Aggregations

CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)19 Test (org.junit.Test)9 CollectionSheetEntryDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryDto)6 CustomValueListElementDto (org.mifos.application.master.business.CustomValueListElementDto)6 Date (java.util.Date)5 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)5 PersonnelDto (org.mifos.dto.domain.PersonnelDto)5 ArrayList (java.util.ArrayList)4 ProductDto (org.mifos.application.servicefacade.ProductDto)4 LoanAccountDto (org.mifos.accounts.loan.util.helpers.LoanAccountDto)3 LoanAccountsProductDto (org.mifos.accounts.loan.util.helpers.LoanAccountsProductDto)3 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 SavingsAccountDto (org.mifos.accounts.savings.util.helpers.SavingsAccountDto)3 MeetingBO (org.mifos.application.meeting.business.MeetingBO)3 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 LoanBO (org.mifos.accounts.loan.business.LoanBO)2 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)2