Search in sources :

Example 96 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class CuCreditMemoServiceImplTest method setupVendorCreditMemoDocument.

private CuVendorCreditMemoDocument setupVendorCreditMemoDocument() {
    ArrayList<String> methodNames = new ArrayList<>();
    for (Method method : VendorCreditMemoDocument.class.getMethods()) {
        if (!Modifier.isFinal(method.getModifiers()) && !method.getName().startsWith("set") && !method.getName().startsWith("get") && !method.getName().startsWith("is")) {
            methodNames.add(method.getName());
        }
    }
    IMockBuilder<CuVendorCreditMemoDocument> builder = EasyMock.createMockBuilder(CuVendorCreditMemoDocument.class).addMockedMethods(methodNames.toArray(new String[0]));
    creditMemoDocument = builder.createNiceMock();
    creditMemoDocument.setDocumentHeader(new MockFinancialSystemDocumentHeader());
    creditMemoDocument.getDocumentHeader().setDocumentDescription("Description");
    creditMemoDocument.setVendorDetailAssignedIdentifier(0);
    creditMemoDocument.setVendorHeaderGeneratedIdentifier(4291);
    creditMemoDocument.setCreditMemoNumber("12345");
    creditMemoDocument.setCreditMemoDate(dateTimeService.getCurrentSqlDate());
    creditMemoDocument.setCreditMemoAmount(new KualiDecimal(100));
    return creditMemoDocument;
}
Also used : CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Method(java.lang.reflect.Method)

Example 97 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class CuLaborPendingEntryConverterServiceImplTest method testGetBenefitClearingPendingEntry.

public void testGetBenefitClearingPendingEntry() throws IllegalAccessException, InstantiationException, WorkflowException {
    CuSalaryExpenseTransferDocument document = CuSalaryExpenseTransferDocumentFixture.GOOD_ST.createSalaryExpenseDocument();
    AccountingDocumentTestUtils.saveDocument(document, documentService);
    GeneralLedgerPendingEntrySequenceHelper sequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();
    LaborLedgerPendingEntry laborLedgerPendingEntry = ((CuLaborPendingEntryConverterServiceImpl) laborPendingEntryConverterService).getBenefitClearingPendingEntry(document, sequenceHelper, "R704750", "IT", "MX", new KualiDecimal(6916.68), "5200");
    assertEquals("1", laborLedgerPendingEntry.getEmplid());
}
Also used : CuSalaryExpenseTransferDocument(edu.cornell.kfs.module.ld.document.CuSalaryExpenseTransferDocument) LaborLedgerPendingEntry(org.kuali.kfs.module.ld.businessobject.LaborLedgerPendingEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) GeneralLedgerPendingEntrySequenceHelper(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper)

Example 98 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDocumentIntegrationTest method testToCopy.

@Test
public void testToCopy() throws WorkflowException {
    String payeeidNumber = cuDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeIdNumber();
    cuDisbursementVoucherDocument.toCopy();
    assertEquals("Test Document Description", cuDisbursementVoucherDocument.getDocumentHeader().getDocumentDescription());
    assertEquals("Salino, Catherine C.", cuDisbursementVoucherDocument.getDisbVchrContactPersonName());
    assertEquals("IT", cuDisbursementVoucherDocument.getCampusCode());
    Calendar calendar = dateTimeService.getCurrentCalendar();
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    assertEquals(new Date(calendar.getTimeInMillis()), cuDisbursementVoucherDocument.getDisbursementVoucherDueDate());
    assertEquals("O", cuDisbursementVoucherDocument.getDisbursementVoucherDocumentationLocationCode());
    assertEquals("DISB", cuDisbursementVoucherDocument.getDisbVchrBankCode());
    assertEquals("607-255-9466", cuDisbursementVoucherDocument.getDisbVchrContactPhoneNumber());
    assertEquals("ccs1@cornell.edu", cuDisbursementVoucherDocument.getDisbVchrContactEmailId());
    assertEquals(StringUtils.EMPTY, cuDisbursementVoucherDocument.getDisbVchrPayeeTaxControlCode());
    assertEquals(new KualiDecimal(86.00), cuDisbursementVoucherDocument.getDisbVchrCheckTotalAmount());
    DisbursementVoucherNonResidentAlienTax disbursementVoucherNonResidentAlienTax = cuDisbursementVoucherDocument.getDvNonResidentAlienTax();
    assertNull(disbursementVoucherNonResidentAlienTax.getDocumentNumber());
    assertNull(disbursementVoucherNonResidentAlienTax.getFederalIncomeTaxPercent());
    assertNull(disbursementVoucherNonResidentAlienTax.getStateIncomeTaxPercent());
    assertNull(disbursementVoucherNonResidentAlienTax.getIncomeClassCode());
    assertNull(disbursementVoucherNonResidentAlienTax.getPostalCountryCode());
    assertFalse(disbursementVoucherNonResidentAlienTax.isIncomeTaxTreatyExemptCode());
    assertFalse(disbursementVoucherNonResidentAlienTax.isForeignSourceIncomeCode());
    assertFalse(disbursementVoucherNonResidentAlienTax.isIncomeTaxGrossUpCode());
    assertNull(disbursementVoucherNonResidentAlienTax.getReferenceFinancialSystemOriginationCode());
    assertNull(disbursementVoucherNonResidentAlienTax.getReferenceFinancialDocumentNumber());
    assertNull(disbursementVoucherNonResidentAlienTax.getFinancialDocumentAccountingLineText());
    assertNull(disbursementVoucherNonResidentAlienTax.getTaxNQIId());
    assertFalse(disbursementVoucherNonResidentAlienTax.isTaxOtherExemptIndicator());
    assertFalse(disbursementVoucherNonResidentAlienTax.isTaxUSAIDPerDiemIndicator());
    assertNull(disbursementVoucherNonResidentAlienTax.getTaxSpecialW4Amount());
    assertNull(disbursementVoucherNonResidentAlienTax.getIncomeClass());
    assertFalse(cuDisbursementVoucherDocument.getWireTransfer().isWireTransferFeeWaiverIndicator());
    assertNull(cuDisbursementVoucherDocument.getExtractDate());
    assertNull(cuDisbursementVoucherDocument.getPaidDate());
    assertNull(cuDisbursementVoucherDocument.getCancelDate());
    assertEquals(KFSConstants.DocumentStatusCodes.INITIATED, cuDisbursementVoucherDocument.getFinancialSystemDocumentHeader().getFinancialDocumentStatusCode());
    assertEquals(0, KNSGlobalVariables.getMessageList().size());
    assertEquals(payeeidNumber, cuDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeIdNumber());
}
Also used : Calendar(java.util.Calendar) DisbursementVoucherNonResidentAlienTax(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonResidentAlienTax) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Date(java.sql.Date) Test(org.junit.Test)

Example 99 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class ezraUpdateAwardImplTest method testUpdateAwards.

public void testUpdateAwards() {
    Map fields = new HashMap();
    String awardProjectTitle = "ezraUpdateTest";
    String awardProjectTitleAfter = "";
    Date today = SpringContext.getBean(DateTimeService.class).getCurrentSqlDate();
    Date sqlDate = today;
    Date budgetStartDate = generateYear1970StartDate();
    Date budgetEndDate = generateDateOneDayLater(budgetStartDate);
    Date budgetStartDateAfter = generateDateOneDayLater(budgetEndDate);
    Date budgetEndDateAfter = generateDateOneDayLater(budgetStartDateAfter);
    KualiDecimal budgetTotal = new KualiDecimal(-1);
    KualiDecimal budgetTotalAfter = new KualiDecimal(-2);
    EzraProposalAward ezraAward = null;
    List<EzraProposalAward> awards = ezraAwardProposalDao.getAwardsUpdatedSince(sqlDate);
    int count = 0;
    if (awards.isEmpty()) {
        do {
            count--;
            Calendar c = Calendar.getInstance();
            c.setTime(today);
            c.add(Calendar.DATE, count);
            sqlDate = new java.sql.Date(c.getTimeInMillis());
            awards = ezraAwardProposalDao.getAwardsUpdatedSince(sqlDate);
            if (!awards.isEmpty()) {
                count = -12;
            }
        } while (count > -11);
    }
    LOG.info("The Sql Date is " + sqlDate);
    awards = ezraAwardProposalDao.getAwardsUpdatedSince(sqlDate);
    if (!awards.isEmpty()) {
        ezraAward = awards.get(0);
        fields.clear();
        fields.put("proposalNumber", ezraAward.getProjectId());
        Award award = (CuAward) businessObjectService.findByPrimaryKey(CuAward.class, fields);
        award.setAwardProjectTitle(awardProjectTitle);
        getAwardExtension(award).setBudgetBeginningDate(new Date(budgetStartDate.getTime()));
        getAwardExtension(award).setBudgetEndingDate(new Date(budgetEndDate.getTime()));
        getAwardExtension(award).setBudgetTotalAmount(budgetTotal);
        businessObjectService.save(award);
        assertTrue(ezraService.updateAwardsSince(sqlDate));
        Award awardAfter = (CuAward) businessObjectService.findByPrimaryKey(CuAward.class, fields);
        awardProjectTitleAfter = awardAfter.getAwardProjectTitle();
        budgetStartDateAfter = getAwardExtension(awardAfter).getBudgetBeginningDate();
        budgetEndDateAfter = getAwardExtension(awardAfter).getBudgetEndingDate();
        budgetTotalAfter = getAwardExtension(awardAfter).getBudgetTotalAmount();
        LOG.info("Project Title before update " + awardProjectTitle + " Project Title after update " + awardProjectTitleAfter);
    }
    if (awardProjectTitle.equalsIgnoreCase(awardProjectTitleAfter)) {
        fail("Ezra failed to update Award");
    }
    assertNotEquals("Ezra failed to update Award Budget Start Date", budgetStartDate, budgetStartDateAfter);
    assertNotEquals("Ezra failed to update Award Budget Stop Date", budgetEndDate, budgetEndDateAfter);
    assertNotEquals("Ezra failed to update Award Budget Total Amount", budgetTotal, budgetTotalAfter);
}
Also used : HashMap(java.util.HashMap) Calendar(java.util.Calendar) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) Date(java.sql.Date) Date(java.sql.Date) Award(org.kuali.kfs.module.cg.businessobject.Award) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) HashMap(java.util.HashMap) Map(java.util.Map) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward)

Example 100 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class RemovePlusSignKualiDecimalFormatterTest method convertEmptyString.

@Test
public void convertEmptyString() {
    KualiDecimal expected = null;
    KualiDecimal actual = (KualiDecimal) kualiDecimalFormatter.convertToObject("");
    assertEquals(ASSERT_SHOULD_EQUAL_MESSAGE, expected, actual);
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Test(org.junit.Test)

Aggregations

KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)209 ArrayList (java.util.ArrayList)37 HashMap (java.util.HashMap)19 Test (org.junit.Test)19 List (java.util.List)15 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)15 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)14 BigDecimal (java.math.BigDecimal)13 Date (java.sql.Date)13 Iterator (java.util.Iterator)12 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)12 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)12 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)11 IOException (java.io.IOException)10 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)10 Map (java.util.Map)9 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)9 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)9 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)9 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)8