use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPurchasingAccountsPayableModuleServiceImpl method handlePurchasingBatchCancels.
/**
* @see org.kuali.kfs.integration.pdp.service.PurchasingAccountsPayableModuleService#handlePurchasingBatchCancels(java.lang.String)
*/
public void handlePurchasingBatchCancels(String documentNumber, String documentTypeCode, boolean primaryCancel, boolean disbursedPayment, boolean crCancel) {
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
PaymentRequestService paymentRequestService = SpringContext.getBean(PaymentRequestService.class);
CreditMemoService creditMemoService = SpringContext.getBean(CreditMemoService.class);
String preqCancelNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_CANCEL_NOTE);
String preqResetNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_RESET_NOTE);
String cmCancelNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_CANCEL_NOTE);
String cmResetNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_RESET_NOTE);
if (PurapConstants.PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT.equals(documentTypeCode)) {
PaymentRequestDocument pr = paymentRequestService.getPaymentRequestByDocumentNumber(documentNumber);
if (pr != null) {
if (disbursedPayment || primaryCancel || crCancel) {
if (!crCancel) {
paymentRequestService.cancelExtractedPaymentRequest(pr, preqCancelNote);
}
} else {
paymentRequestService.resetExtractedPaymentRequest(pr, preqResetNote);
}
} else {
LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Payment Request with doc type of " + documentTypeCode + " with id " + documentNumber);
}
} else if (PurapConstants.PurapDocTypeCodes.CREDIT_MEMO_DOCUMENT.equals(documentTypeCode)) {
VendorCreditMemoDocument cm = creditMemoService.getCreditMemoByDocumentNumber(documentNumber);
if (cm != null) {
if (disbursedPayment || primaryCancel || crCancel) {
if (!crCancel) {
creditMemoService.cancelExtractedCreditMemo(cm, cmCancelNote);
}
} else {
creditMemoService.resetExtractedCreditMemo(cm, cmResetNote);
}
} else {
LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Credit Memo with doc type of " + documentTypeCode + " with id " + documentNumber);
}
}
}
use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method customCalculate.
@Override
protected void customCalculate(PurchasingAccountsPayableDocument apDoc) {
super.customCalculate(apDoc);
PaymentRequestDocument preqDoc = (PaymentRequestDocument) apDoc;
// KFSPTS-2578
if (PaymentRequestStatuses.APPDOC_PAYMENT_METHOD_REVIEW.equalsIgnoreCase(preqDoc.getApplicationDocumentStatus()) && StringUtils.isNotBlank(preqDoc.getTaxClassificationCode()) && !StringUtils.equalsIgnoreCase(preqDoc.getTaxClassificationCode(), "N")) {
SpringContext.getBean(PaymentRequestService.class).calculateTaxArea(preqDoc);
return;
}
}
use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method clearTaxInfo.
/**
* Calls service to clear tax info.
*/
public ActionForward clearTaxInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PaymentRequestForm prForm = (PaymentRequestForm) form;
PaymentRequestDocument document = (PaymentRequestDocument) prForm.getDocument();
PaymentRequestService taxService = SpringContext.getBean(PaymentRequestService.class);
/* call service to clear previous lines */
taxService.clearTax(document);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method docHandler.
@Override
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = super.docHandler(mapping, form, request, response);
PaymentRequestForm preqForm = (PaymentRequestForm) form;
PaymentRequestDocument document = (PaymentRequestDocument) preqForm.getDocument();
if (CollectionUtils.isNotEmpty(document.getItems())) {
Collections.sort(document.getItems(), new Comparator() {
public int compare(Object o1, Object o2) {
PaymentRequestItem item1 = (PaymentRequestItem) o1;
PaymentRequestItem item2 = (PaymentRequestItem) o2;
Integer inv1 = ((CuPaymentRequestItemExtension) item1.getExtension()).getInvLineNumber();
Integer inv2 = ((CuPaymentRequestItemExtension) item2.getExtension()).getInvLineNumber();
if (inv1 == null) {
if (inv2 == null) {
return -1;
} else {
return 1;
}
} else {
if (inv2 == null) {
return -1;
} else {
return inv1.compareTo(inv2);
}
}
}
});
}
return forward;
}
use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class PaymentRequestForeignDraftValidation method validate.
/**
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("validate start");
}
boolean isValid = true;
PaymentRequestDocument document = (PaymentRequestDocument) accountingDocumentForValidation;
if (!PaymentMethod.PM_CODE_FOREIGN_DRAFT.equals(((CuPaymentRequestDocument) document).getPaymentMethodCode())) {
return true;
}
MessageMap errors = GlobalVariables.getMessageMap();
errors.addToErrorPath(KFSPropertyConstants.DOCUMENT);
errors.addToErrorPath(CUPurapPropertyConstants.PREQ_WIRE_TRANSFER);
/* currency type code required */
if (StringUtils.isBlank(((CuPaymentRequestDocument) document).getPreqWireTransfer().getPreqForeignCurrencyTypeCode())) {
errors.putError(CUPurapPropertyConstants.PREQ_FD_CURRENCY_TYPE_CODE, KFSKeyConstants.ERROR_PAYMENT_SOURCE_CURRENCY_TYPE_CODE);
isValid = false;
}
/* currency type name required */
if (StringUtils.isBlank(((CuPaymentRequestDocument) document).getPreqWireTransfer().getPreqForeignCurrencyTypeName())) {
errors.putError(CUPurapPropertyConstants.PREQ_FD_CURRENCY_TYPE_NAME, KFSKeyConstants.ERROR_PAYMENT_SOURCE_CURRENCY_TYPE_NAME);
isValid = false;
}
errors.removeFromErrorPath(CUPurapPropertyConstants.PREQ_WIRE_TRANSFER);
errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
return isValid;
}
Aggregations