Search in sources :

Example 16 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestServiceImplTest method testAmountAnalysisForNonQuantityOrderBelowLimit.

public void testAmountAnalysisForNonQuantityOrderBelowLimit() throws Exception {
    CuPaymentRequestDocument paymentRequestDocument = createPaymentRequestForTestingPOAmountLimit(PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_NON_QTY_ITEM_BELOW_5K);
    assertTrue("Payment should have passed the within-amount-limit check, due to non-quantity order with amount below the threshold", ((CuPaymentRequestService) paymentRequestService).purchaseOrderForPaymentRequestIsWithinAutoApproveAmountLimit(paymentRequestDocument));
}
Also used : CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)

Example 17 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestServiceImplTest method createPaymentRequestForTestingPOAmountLimit.

protected CuPaymentRequestDocument createPaymentRequestForTestingPOAmountLimit(PurchaseOrderFixture poFixture) throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = poFixture.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    changeCurrentUser(UserNameFixture.mo14);
    PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    paymentRequestDocument.initiateDocument();
    paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
    return (CuPaymentRequestDocument) paymentRequestDocument;
}
Also used : CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 18 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPurapGeneralLedgerServiceImplTest method testGenerateEntriesPaymentRequest.

public void testGenerateEntriesPaymentRequest() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.refreshNonUpdateableReferences();
    changeCurrentUser(UserNameFixture.mo14);
    CuPaymentRequestDocument preq = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    preq.initiateDocument();
    preq.populatePaymentRequestFromPurchaseOrder(po);
    preq.setPaymentMethodCode("F");
    preq.setApplicationDocumentStatus(PurapConstants.PaymentRequestStatuses.APPDOC_AWAITING_ACCOUNTS_PAYABLE_REVIEW);
    ((PaymentRequestItem) (preq.getItems().get(0))).setExtendedPrice(new KualiDecimal(1));
    AccountingDocumentTestUtils.saveDocument(preq, SpringContext.getBean(DocumentService.class));
    List<SummaryAccount> summaryAccounts = purapAccountingService.generateSummaryAccountsWithNoZeroTotalsNoUseTax(preq);
    cuPurapGeneralLedgerServiceImpl.generateEntriesPaymentRequest(preq, null, summaryAccounts, "create");
    boolean noBankOffsetGenerated = true;
    for (GeneralLedgerPendingEntry pe : preq.getGeneralLedgerPendingEntries()) {
        if (KFSKeyConstants.Bank.DESCRIPTION_GLPE_BANK_OFFSET.equalsIgnoreCase(pe.getTransactionLedgerEntryDescription())) {
            noBankOffsetGenerated = false;
            break;
        }
    }
    assertEquals(2, preq.getGeneralLedgerPendingEntries().size());
    assertTrue(noBankOffsetGenerated);
}
Also used : SummaryAccount(org.kuali.kfs.module.purap.util.SummaryAccount) PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 19 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPurapGeneralLedgerServiceImplTest method testReencumberEncumbrance.

public void testReencumberEncumbrance() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.getItem(0).setItemQuantity(new KualiDecimal(6));
    ((PurchaseOrderItem) po.getItem(0)).setItemInvoicedTotalQuantity(new KualiDecimal(4));
    po.refreshNonUpdateableReferences();
    AccountingDocumentTestUtils.saveDocument(po, SpringContext.getBean(DocumentService.class));
    changeCurrentUser(UserNameFixture.mo14);
    CuPaymentRequestDocument preq = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    preq.initiateDocument();
    preq.populatePaymentRequestFromPurchaseOrder(po);
    preq.setPaymentMethodCode("F");
    preq.setApplicationDocumentStatus(PurapConstants.PaymentRequestStatuses.APPDOC_AWAITING_ACCOUNTS_PAYABLE_REVIEW);
    ((PaymentRequestItem) (preq.getItems().get(0))).setExtendedPrice(KualiDecimal.ZERO);
    ((PaymentRequestItem) (preq.getItems().get(0))).setItemUnitPrice(BigDecimal.ZERO);
    ((PaymentRequestItem) (preq.getItems().get(0))).setItemQuantity(new KualiDecimal(2));
    AccountingDocumentTestUtils.saveDocument(preq, SpringContext.getBean(DocumentService.class));
    cuPurapGeneralLedgerServiceImpl.reencumberEncumbrance(preq);
    PurchaseOrderDocument po2 = purchaseOrderService.getCurrentPurchaseOrder(preq.getPurchaseOrderIdentifier());
    assertEquals(new KualiDecimal(2), ((PurchaseOrderItem) po2.getItem(0)).getItemInvoicedTotalQuantity());
}
Also used : PurchaseOrderItem(org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem) PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 20 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestServiceImpl method populatePaymentRequest.

@Override
@NonTransactional
public void populatePaymentRequest(PaymentRequestDocument paymentRequestDocument) {
    super.populatePaymentRequest(paymentRequestDocument);
    // KFSUPGRADE-779
    // reset bank code
    paymentRequestDocument.setBankCode(null);
    paymentRequestDocument.setBank(null);
    // set bank code to default bank code in the system parameter
    Bank defaultBank = null;
    if (StringUtils.equals(PaymentMethod.PM_CODE_WIRE, ((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode()) || StringUtils.equals(PaymentMethod.PM_CODE_FOREIGN_DRAFT, ((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode())) {
        defaultBank = SpringContext.getBean(CUBankService.class).getDefaultBankByDocType(CuPaymentRequestDocument.DOCUMENT_TYPE_NON_CHECK);
    } else if (!StringUtils.equals(PaymentMethod.PM_CODE_INTERNAL_BILLING, ((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode())) {
        defaultBank = SpringContext.getBean(BankService.class).getDefaultBankByDocType(PaymentRequestDocument.class);
    }
    if (defaultBank != null) {
        paymentRequestDocument.setBankCode(defaultBank.getBankCode());
        paymentRequestDocument.setBank(defaultBank);
    }
}
Also used : CUBankService(edu.cornell.kfs.sys.service.CUBankService) BankService(org.kuali.kfs.sys.service.BankService) Bank(org.kuali.kfs.sys.businessobject.Bank) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Aggregations

CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)23 DocumentService (org.kuali.kfs.krad.service.DocumentService)7 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)7 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)6 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)5 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)4 HashMap (java.util.HashMap)3 PaymentRequestWireTransfer (edu.cornell.kfs.module.purap.businessobject.PaymentRequestWireTransfer)2 ArrayList (java.util.ArrayList)2 MessageMap (org.kuali.kfs.krad.util.MessageMap)2 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)2 Bank (org.kuali.kfs.sys.businessobject.Bank)2 GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)2 CUPaymentMethodGeneralLedgerPendingEntryService (edu.cornell.kfs.fp.service.CUPaymentMethodGeneralLedgerPendingEntryService)1 CuPaymentRequestItemExtension (edu.cornell.kfs.module.purap.businessobject.CuPaymentRequestItemExtension)1 CuVendorCreditMemoDocument (edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument)1 CUBankService (edu.cornell.kfs.sys.service.CUBankService)1 VendorDetailExtension (edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1