Search in sources :

Example 41 with PurchaseOrderDocument

use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument 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 42 with PurchaseOrderDocument

use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderServiceImplTest method testCompletePurchaseOrderAmendment_NonB2B.

/**
 * Tests that the PurchaseOrderService would do the completePurchaseOrder
 * for non B2B purchase orders.
 *
 * @throws Exception
 */
public void testCompletePurchaseOrderAmendment_NonB2B() throws Exception {
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_IN_PROCESS.createPurchaseOrderdDocument(documentService);
    purchaseOrderService.completePurchaseOrderAmendment(po);
    assertTrue(po.isPurchaseOrderCurrentIndicator());
    assertFalse(po.isPendingActionIndicator());
}
Also used : PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument)

Example 43 with PurchaseOrderDocument

use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderServiceImplTest method testPerformPurchaseOrderFirstTransmitViaPrinting.

public void testPerformPurchaseOrderFirstTransmitViaPrinting() throws Exception {
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(documentService);
    try {
        purchaseOrderService.performPurchaseOrderFirstTransmitViaPrinting(po);
        assertTrue(po.getPurchaseOrderFirstTransmissionTimestamp() != null);
        assertTrue(po.getPurchaseOrderLastTransmitTimestamp() != null);
    } catch (ValidationException e) {
        LOG.warn("Caught ValidationException while trying to retransmit PO with doc id " + po.getDocumentNumber());
    }
}
Also used : ValidationException(org.kuali.kfs.krad.exception.ValidationException) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument)

Example 44 with PurchaseOrderDocument

use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument 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 45 with PurchaseOrderDocument

use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument 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)

Aggregations

PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)52 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)17 DocumentService (org.kuali.kfs.krad.service.DocumentService)16 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)14 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)12 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)9 ArrayList (java.util.ArrayList)6 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)6 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)5 PurchaseOrderService (org.kuali.kfs.module.purap.document.service.PurchaseOrderService)5 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)4 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)4 MessageMap (org.kuali.kfs.krad.util.MessageMap)4 PurchaseOrderAmendmentDocument (org.kuali.kfs.module.purap.document.PurchaseOrderAmendmentDocument)4 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)4 File (java.io.File)3 BigDecimal (java.math.BigDecimal)3 Iterator (java.util.Iterator)3