use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuVendorCreditMemoDocumentPresentationController method getEditModes.
@Override
public Set<String> getEditModes(Document document) {
Set<String> editModes = super.getEditModes(document);
// KFSPTS-1891
editModes.add(KfsAuthorizationConstants.TransactionalEditMode.FRN_ENTRY);
editModes.add(KfsAuthorizationConstants.TransactionalEditMode.WIRE_ENTRY);
VendorCreditMemoDocument vendorCreditMemoDocument = (VendorCreditMemoDocument) document;
// KFSPTS-1891, KFSPTS-2851
if (canApprove(vendorCreditMemoDocument) && canEditAmount(vendorCreditMemoDocument)) {
editModes.add(CUPaymentRequestEditMode.EDIT_AMOUNT);
}
if (vendorCreditMemoDocument.isDocumentStoppedInRouteNode(PurapConstants.PaymentRequestStatuses.NODE_PAYMENT_METHOD_REVIEW)) {
editModes.add(CUPaymentRequestEditMode.WAIVE_WIRE_FEE_EDITABLE);
}
return editModes;
}
use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuPurapAccountingServiceImpl method updateAccountAmounts.
/**
* @see org.kuali.kfs.module.purap.service.PurapAccountingService#updateAccountAmounts(org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument)
*/
@Override
public void updateAccountAmounts(PurchasingAccountsPayableDocument document) {
PurchasingAccountsPayableDocumentBase purApDocument = (PurchasingAccountsPayableDocumentBase) document;
String accountDistributionMethod = purApDocument.getAccountDistributionMethod();
KualiRuleService kualiRuleService = SpringContext.getBean(KualiRuleService.class);
WorkflowDocument workflowDocument = purApDocument.getDocumentHeader().getWorkflowDocument();
Set<String> nodeNames = workflowDocument.getCurrentNodeNames();
// don't update if past the AP review level
if ((document instanceof PaymentRequestDocument) && purapService.isFullDocumentEntryCompleted(document)) {
if (nodeNames.contains(PaymentRequestStatuses.NODE_PAYMENT_METHOD_REVIEW)) {
// CU needs this update because the customization allows Treasury Manager to change unit/extended price and 'calculate'
for (PurApItem item : document.getItems()) {
updatePreqItemAccountAmountsOnly(item);
}
} else {
convertMoneyToPercent((PaymentRequestDocument) document);
}
return;
}
document.fixItemReferences();
// if distribution method is sequential and document is PREQ or VCM then...
if (((document instanceof PaymentRequestDocument) || (document instanceof VendorCreditMemoDocument)) && PurapConstants.AccountDistributionMethodCodes.SEQUENTIAL_CODE.equalsIgnoreCase(accountDistributionMethod)) {
if (document instanceof VendorCreditMemoDocument) {
VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) document;
cmDocument.updateExtendedPriceOnItems();
for (PurApItem item : document.getItems()) {
for (PurApAccountingLine account : item.getSourceAccountingLines()) {
account.setAmount(KualiDecimal.ZERO);
}
}
}
// update the accounts amounts for PREQ and distribution method = sequential
for (PurApItem item : document.getItems()) {
updatePreqItemAccountAmounts(item);
}
return;
}
// if distribution method is proportional and document is PREQ or VCM then...
if (((document instanceof PaymentRequestDocument) || (document instanceof VendorCreditMemoDocument)) && PurapConstants.AccountDistributionMethodCodes.PROPORTIONAL_CODE.equalsIgnoreCase(accountDistributionMethod)) {
// update the accounts amounts for PREQ and distribution method = sequential
if (document instanceof VendorCreditMemoDocument) {
VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) document;
cmDocument.updateExtendedPriceOnItems();
for (PurApItem item : document.getItems()) {
for (PurApAccountingLine account : item.getSourceAccountingLines()) {
account.setAmount(KualiDecimal.ZERO);
}
}
}
for (PurApItem item : document.getItems()) {
boolean rulePassed = true;
// check any business rules
rulePassed &= kualiRuleService.applyRules(new PurchasingAccountsPayableItemPreCalculateEvent(document, item));
if (rulePassed) {
updatePreqProportionalItemAccountAmounts(item);
}
}
return;
}
// No recalculate if the account distribution method code is equal to "S" sequential ON REQ or POs..
if (PurapConstants.AccountDistributionMethodCodes.SEQUENTIAL_CODE.equalsIgnoreCase(accountDistributionMethod)) {
for (PurApItem item : document.getItems()) {
boolean rulePassed = true;
// check any business rules
rulePassed &= kualiRuleService.applyRules(new PurchasingAccountsPayableItemPreCalculateEvent(document, item));
return;
}
}
// do recalculate only if the account distribution method code is not equal to "S" sequential method.
if (!PurapConstants.AccountDistributionMethodCodes.SEQUENTIAL_CODE.equalsIgnoreCase(accountDistributionMethod)) {
for (PurApItem item : document.getItems()) {
boolean rulePassed = true;
// check any business rules
rulePassed &= kualiRuleService.applyRules(new PurchasingAccountsPayableItemPreCalculateEvent(document, item));
if (rulePassed) {
updateItemAccountAmounts(item);
}
}
}
}
use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuPurchasingAccountsPayableModuleServiceImplTest method testHandlePurchasingBatchCancels_CRCancel.
public void testHandlePurchasingBatchCancels_CRCancel() throws WorkflowException {
VendorCreditMemoDocument creditMemoDocument = VendorCreditMemoDocumentFixture.VENDOR_CREDIT_MEMO.createVendorCreditMemoDocument();
accountsPayableModuleServiceImpl.handlePurchasingBatchCancels(creditMemoDocument.getDocumentNumber(), creditMemoDocument.getDocumentType(), true, false, true);
assertFalse(PurapConstants.CreditMemoStatuses.CANCELLED_STATUSES.contains(creditMemoDocument.getApplicationDocumentStatus()));
}
use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuCreditMemoServiceImpl method removeHoldOnCreditMemo.
/**
* @see org.kuali.kfs.module.purap.document.service.CreditMemoService#removeHoldOnCreditMemo(org.kuali.kfs.module.purap.document.CreditMemoDocument,
* java.lang.String)
*/
@Override
public VendorCreditMemoDocument removeHoldOnCreditMemo(VendorCreditMemoDocument cmDocument, String note) throws Exception {
// save the note
Note noteObj = documentService.createNoteFromDocument(cmDocument, note);
cmDocument.addNote(noteObj);
noteService.save(noteObj);
// retrieve and save with hold indicator set to false
VendorCreditMemoDocument cmDoc = getCreditMemoDocumentById(cmDocument.getPurapDocumentIdentifier());
cmDoc.setHoldIndicator(false);
cmDoc.setLastActionPerformedByPersonId(null);
purapService.saveDocumentNoValidation(cmDoc);
// force reindexing
reIndexDocument(cmDoc);
// must also save it on the incoming document
cmDocument.setHoldIndicator(false);
cmDocument.setLastActionPerformedByPersonId(null);
// force reindexing
reIndexDocument(cmDocument);
return cmDoc;
}
use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuCreditMemoServiceImpl method addHoldOnCreditMemo.
@Override
public VendorCreditMemoDocument addHoldOnCreditMemo(VendorCreditMemoDocument cmDocument, String note) throws Exception {
// save the note
Note noteObj = documentService.createNoteFromDocument(cmDocument, note);
cmDocument.addNote(noteObj);
noteService.save(noteObj);
// retrieve and save with hold indicator set to true
VendorCreditMemoDocument cmDoc = getCreditMemoDocumentById(cmDocument.getPurapDocumentIdentifier());
cmDoc.setHoldIndicator(true);
cmDoc.setLastActionPerformedByPersonId(GlobalVariables.getUserSession().getPerson().getPrincipalId());
purapService.saveDocumentNoValidation(cmDoc);
// force reindexing
reIndexDocument(cmDoc);
// must also save it on the incoming document
cmDocument.setHoldIndicator(true);
cmDocument.setLastActionPerformedByPersonId(GlobalVariables.getUserSession().getPerson().getPrincipalId());
// force reindexing
reIndexDocument(cmDocument);
return cmDoc;
}
Aggregations