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;
}
}
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++;
}
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;
}
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 "";
}
}
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;
}
Aggregations