Search in sources :

Example 1 with CuDistributionOfIncomeAndExpenseDocument

use of edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument in project cu-kfs by CU-CommunityApps.

the class CuDistributionOfIncomeAndExpenseForm method getTripID.

/**
 * @return
 */
public String getTripID() {
    CuDistributionOfIncomeAndExpenseDocument did = (CuDistributionOfIncomeAndExpenseDocument) this.getDocument();
    boolean isAssociated = SpringContext.getBean(CULegacyTravelService.class).isCULegacyTravelIntegrationInterfaceAssociatedWithTrip(did);
    if (isAssociated) {
        return did.getTripId();
    } else {
        return StringUtils.EMPTY;
    }
}
Also used : CULegacyTravelService(edu.cornell.kfs.fp.document.service.CULegacyTravelService) CuDistributionOfIncomeAndExpenseDocument(edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument)

Example 2 with CuDistributionOfIncomeAndExpenseDocument

use of edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument in project cu-kfs by CU-CommunityApps.

the class AmazonWebServicesBillingServiceImpl method buidAndRouteDistributionOfIncomeDocument.

private void buidAndRouteDistributionOfIncomeDocument(AmazonAccountDetail amazonAccountDetail, AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO, AmazonBillResultsDTO resultsDTO) throws WorkflowException {
    CuDistributionOfIncomeAndExpenseDocument diDocument = createDistributionOfIncomeDocument(amazonAccountDetail, transactionDTO);
    getDocumentService().routeDocument(diDocument, CuFPConstants.AmazonWebServiceBillingConstants.DI_ROUTE_ANNOTATION, null);
    LOG.info("buidAndRouteDistributionOfIncomeDocument() Created DI document " + diDocument.getDocumentNumber() + " for AWS account " + amazonAccountDetail.getAwsAccount() + " with a Cornell acount of " + transactionDTO.getAccountNumber() + " for a value of " + transactionDTO.getAmount().doubleValue());
    resultsDTO.diCreationCount++;
}
Also used : CuDistributionOfIncomeAndExpenseDocument(edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument)

Example 3 with CuDistributionOfIncomeAndExpenseDocument

use of edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument in project cu-kfs by CU-CommunityApps.

the class AmazonWebServicesBillingServiceImpl method createDistributionOfIncomeDocument.

private CuDistributionOfIncomeAndExpenseDocument createDistributionOfIncomeDocument(AmazonAccountDetail amazonAccountDetail, AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO) throws WorkflowException {
    CuDistributionOfIncomeAndExpenseDocument diDocument = (CuDistributionOfIncomeAndExpenseDocument) getDocumentService().getNewDocument(CuDistributionOfIncomeAndExpenseDocument.class);
    diDocument.getDocumentHeader().setDocumentDescription(buildDocumentDescription(amazonAccountDetail.getBusinessPurpose()));
    diDocument.getDocumentHeader().setExplanation(buildDocumentExplanation(amazonAccountDetail.getAwsAccount()));
    diDocument.getNotes().add(buildDINote());
    diDocument.getTargetAccountingLines().add((buildToAccountingLine(diDocument.getDocumentNumber(), transactionDTO)));
    diDocument.getSourceAccountingLines().add(buildFromAccountLine(diDocument.getDocumentNumber(), transactionDTO.getAmount()));
    diDocument.setTripAssociationStatusCode(CULegacyTravelServiceImpl.TRIP_ASSOCIATIONS.IS_NOT_TRIP_DOC);
    return diDocument;
}
Also used : CuDistributionOfIncomeAndExpenseDocument(edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument)

Example 4 with CuDistributionOfIncomeAndExpenseDocument

use of edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument in project cu-kfs by CU-CommunityApps.

the class SubmitTripWebServiceImpl method buildDistributionIncomeExpenseDocument.

/**
 * @param diDescription
 * @param diExplanation
 * @param tripNumber
 * @param initiatorNetId
 * @return
 * @throws Exception
 */
private String buildDistributionIncomeExpenseDocument(String diDescription, String diExplanation, String tripNumber, String initiatorNetId) throws Exception {
    try {
        if (!isValidDocumentInitiator(initiatorNetId, DISTRIBUTION_INCOME_EXPENSE)) {
            throw new RuntimeException("Initiator identified does not have permission to create a DI.");
        }
    } catch (Exception ex) {
        throw new RuntimeException("Initiator identified does not have permission to create a DI.", ex);
    }
    // create and route doc as system user
    GlobalVariables.setUserSession(new UserSession(initiatorNetId));
    MessageMap documentErrorMap = new MessageMap();
    GlobalVariables.setMessageMap(documentErrorMap);
    // Create document with description provided
    CuDistributionOfIncomeAndExpenseDocument diDoc = null;
    try {
        diDoc = (CuDistributionOfIncomeAndExpenseDocument) SpringContext.getBean(DocumentService.class).getNewDocument(DistributionOfIncomeAndExpenseDocument.class);
    } catch (WorkflowException e) {
        throw new RuntimeException("Error creating new disbursement voucher document: " + e.getMessage(), e);
    }
    if (diDoc != null) {
        diDoc.getDocumentHeader().setDocumentDescription(diDescription);
        diDoc.getDocumentHeader().setExplanation(diExplanation);
        diDoc.getDocumentHeader().setOrganizationDocumentNumber(tripNumber);
        diDoc.setTripAssociationStatusCode(CULegacyTravelServiceImpl.TRIP_ASSOCIATIONS.IS_TRIP_DOC);
        diDoc.setTripId(tripNumber);
        // Persist document
        SpringContext.getBean(DocumentService.class).saveDocument(diDoc);
        return diDoc.getDocumentNumber();
    } else {
        return "";
    }
}
Also used : UserSession(org.kuali.kfs.krad.UserSession) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) MessageMap(org.kuali.kfs.krad.util.MessageMap) DocumentService(org.kuali.kfs.krad.service.DocumentService) CuDistributionOfIncomeAndExpenseDocument(edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument)

Example 5 with CuDistributionOfIncomeAndExpenseDocument

use of edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument in project cu-kfs by CU-CommunityApps.

the class CuDistributionOfIncomeAndExpenseForm method getCanViewTrip.

/**
 * determines if the DI document is a travel DI and therefore should display the associated Trip #
 *
 * @return true if the DI document is a travel DI; otherwise, return false
 */
public boolean getCanViewTrip() {
    CuDistributionOfIncomeAndExpenseDocument disbursementVoucherDocument = (CuDistributionOfIncomeAndExpenseDocument) this.getDocument();
    boolean canViewTrip = SpringContext.getBean(CULegacyTravelService.class).isCULegacyTravelIntegrationInterfaceAssociatedWithTrip(disbursementVoucherDocument);
    return canViewTrip;
}
Also used : CULegacyTravelService(edu.cornell.kfs.fp.document.service.CULegacyTravelService) CuDistributionOfIncomeAndExpenseDocument(edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument)

Aggregations

CuDistributionOfIncomeAndExpenseDocument (edu.cornell.kfs.fp.document.CuDistributionOfIncomeAndExpenseDocument)5 CULegacyTravelService (edu.cornell.kfs.fp.document.service.CULegacyTravelService)2 UserSession (org.kuali.kfs.krad.UserSession)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1 MessageMap (org.kuali.kfs.krad.util.MessageMap)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1