Search in sources :

Example 36 with PurchaseOrderDocument

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

the class CuPaymentRequestServiceImplTest method testMarkPaid.

public void testMarkPaid() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.refreshNonUpdateableReferences();
    changeCurrentUser(UserNameFixture.mo14);
    PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    paymentRequestDocument.initiateDocument();
    paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
    paymentRequestDocument.setPaymentPaidTimestamp(null);
    paymentRequestDocument.prepareForSave();
    AccountingDocumentTestUtils.saveDocument(paymentRequestDocument, SpringContext.getBean(DocumentService.class));
    paymentRequestService.markPaid(paymentRequestDocument, SpringContext.getBean(DateTimeService.class).getCurrentSqlDate());
    assertNotNull(paymentRequestDocument.getPaymentPaidTimestamp());
}
Also used : 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 37 with PurchaseOrderDocument

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

the class CuPaymentRequestServiceImplTest method testRemoveIneligibleAdditionalCharges_WithEligibleItems.

public void testRemoveIneligibleAdditionalCharges_WithEligibleItems() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_TRADE_IN_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    changeCurrentUser(UserNameFixture.mo14);
    PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    paymentRequestDocument.initiateDocument();
    paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
    PaymentRequestItem preqItem = new PaymentRequestItem();
    preqItem.setItemTypeCode(ItemTypeCodes.ITEM_TYPE_TRADE_IN_CODE);
    preqItem.setItemDescription("test");
    preqItem.setItemUnitOfMeasureCode("EA");
    paymentRequestDocument.addItem(preqItem);
    int numberOfItems = paymentRequestDocument.getItems().size();
    paymentRequestService.removeIneligibleAdditionalCharges(paymentRequestDocument);
    assertFalse(numberOfItems == paymentRequestDocument.getItems().size());
}
Also used : PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) 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 38 with PurchaseOrderDocument

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

the class CuPaymentRequestServiceImplTest method testPopulatePaymentRequest.

public void testPopulatePaymentRequest() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.refreshNonUpdateableReferences();
    changeCurrentUser(UserNameFixture.mo14);
    CuPaymentRequestDocument paymentRequestDocument = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    paymentRequestDocument.initiateDocument();
    paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
    paymentRequestDocument.prepareForSave();
    AccountingDocumentTestUtils.saveDocument(paymentRequestDocument, SpringContext.getBean(DocumentService.class));
    paymentRequestService.populatePaymentRequest(paymentRequestDocument);
    assertNotNull(paymentRequestDocument.getBankCode());
}
Also used : CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 39 with PurchaseOrderDocument

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

the class CuPaymentRequestServiceImplTest method testClearTax.

public void testClearTax() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.refreshNonUpdateableReferences();
    changeCurrentUser(UserNameFixture.mo14);
    CuPaymentRequestDocument paymentRequestDocument = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    paymentRequestDocument.initiateDocument();
    paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
    paymentRequestDocument.setTaxClassificationCode("XX");
    paymentRequestDocument.setTaxFederalPercent(new BigDecimal(30));
    paymentRequestDocument.setTaxStatePercent(new BigDecimal(10));
    paymentRequestDocument.setTaxCountryCode("US");
    paymentRequestDocument.setTaxNQIId(null);
    paymentRequestDocument.setTaxForeignSourceIndicator(true);
    paymentRequestDocument.setTaxExemptTreatyIndicator(true);
    paymentRequestDocument.setTaxOtherExemptIndicator(true);
    paymentRequestDocument.setTaxGrossUpIndicator(true);
    paymentRequestDocument.setTaxUSAIDPerDiemIndicator(true);
    paymentRequestDocument.setTaxSpecialW4Amount(new KualiDecimal(10));
    PaymentRequestItem paymentRequestItem = new PaymentRequestItem();
    paymentRequestItem.setItemTypeCode(ItemTypeCodes.ITEM_TYPE_FEDERAL_TAX_CODE);
    paymentRequestService.clearTax(paymentRequestDocument);
    assertNull(paymentRequestDocument.getTaxClassificationCode());
    assertNull(paymentRequestDocument.getTaxFederalPercent());
    assertNull(paymentRequestDocument.getTaxStatePercent());
    assertNull(paymentRequestDocument.getTaxCountryCode());
    assertNull(paymentRequestDocument.getTaxNQIId());
    assertFalse(paymentRequestDocument.getTaxForeignSourceIndicator());
    assertFalse(paymentRequestDocument.getTaxExemptTreatyIndicator());
    assertFalse(paymentRequestDocument.getTaxOtherExemptIndicator());
    assertFalse(paymentRequestDocument.getTaxGrossUpIndicator());
    assertFalse(paymentRequestDocument.getTaxUSAIDPerDiemIndicator());
    assertNull(paymentRequestDocument.getTaxSpecialW4Amount());
}
Also used : 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) BigDecimal(java.math.BigDecimal)

Example 40 with PurchaseOrderDocument

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

the class CuPaymentRequestServiceImplTest method testRequestCancelOnPaymentRequest.

public void testRequestCancelOnPaymentRequest() throws Exception {
    changeCurrentUser(UserNameFixture.ccs1);
    PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
    po.setVendorShippingPaymentTermsCode("AL");
    po.setVendorPaymentTermsCode("00N30");
    po.refreshNonUpdateableReferences();
    changeCurrentUser(UserNameFixture.mo14);
    PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
    paymentRequestDocument.initiateDocument();
    paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
    paymentRequestDocument.prepareForSave();
    AccountingDocumentTestUtils.saveDocument(paymentRequestDocument, SpringContext.getBean(DocumentService.class));
    paymentRequestService.requestCancelOnPaymentRequest(paymentRequestDocument, "test");
    assertTrue(paymentRequestDocument.isPaymentRequestedCancelIndicator());
    assertNotNull(paymentRequestDocument.getLastActionPerformedByPersonId());
    assertNotNull(paymentRequestDocument.getAccountsPayableRequestCancelIdentifier());
}
Also used : 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)

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