Search in sources :

Example 1 with GeneralLedgerPendingEntrySourceDetail

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail in project cu-kfs by CU-CommunityApps.

the class DebitDeterminerServiceImplTest method test.

public void test() {
    CuDisbursementVoucherDocument dv = null;
    try {
        dv = (CuDisbursementVoucherDocument) SpringContext.getBean(DocumentService.class).getNewDocument(DisbursementVoucherDocument.class);
    } catch (WorkflowException e) {
        throw new RuntimeException("Error creating new disbursement voucher document: " + e.getMessage(), e);
    }
    if (dv != null) {
        dv.getDocumentHeader().setDocumentDescription("Test Document Description");
        dv.getDocumentHeader().setExplanation("Stuff");
        dv.initiateDocument();
        VendorDetail vendor = SpringContext.getBean(VendorService.class).getVendorDetail("13366-0");
        VendorAddress vendoraddress = SpringContext.getBean(VendorService.class).getVendorDefaultAddress(vendor.getVendorHeaderGeneratedIdentifier(), vendor.getVendorDetailAssignedIdentifier(), "RM", "");
        System.out.println(vendoraddress.getVendorCityName() + "\n");
        dv.templateVendor(vendor, vendoraddress);
        dv.setPayeeAssigned(true);
        dv.getDvPayeeDetail().setDisbVchrPaymentReasonCode("S");
        dv.setDisbVchrCheckTotalAmount(new KualiDecimal(86.00));
        dv.setDisbVchrPaymentMethodCode("P");
        dv.setDisbVchrCheckStubText("check text");
        SourceAccountingLine accountingLine = new SourceAccountingLine();
        accountingLine.setChartOfAccountsCode("IT");
        accountingLine.setAccountNumber("G081040");
        accountingLine.setFinancialObjectCode("2045");
        accountingLine.setAmount((new KualiDecimal(-14.00)));
        accountingLine.setPostingYear(dv.getPostingYear());
        accountingLine.setDocumentNumber(dv.getDocumentNumber());
        dv.addSourceAccountingLine(accountingLine);
        SourceAccountingLine accountingLine2 = new SourceAccountingLine();
        accountingLine2.setChartOfAccountsCode("IT");
        accountingLine2.setAccountNumber("1453611");
        accountingLine2.setFinancialObjectCode("8462");
        accountingLine2.setAmount((new KualiDecimal(100.00)));
        accountingLine2.setPostingYear(dv.getPostingYear());
        accountingLine2.setDocumentNumber(dv.getDocumentNumber());
        dv.addSourceAccountingLine(accountingLine2);
        try {
            documentService.saveDocument(dv);
        } catch (WorkflowException e) {
            throw new RuntimeException("Error saving new disbursement voucher document: " + e.getMessage(), e);
        }
    }
    List<GeneralLedgerPendingEntrySourceDetail> glpeS = dv.getGeneralLedgerPendingEntrySourceDetails();
    GeneralLedgerPendingEntrySourceDetail postable = glpeS.get(0);
    System.out.println("GL Detail" + postable.toString() + "\n");
    assertFalse(debitDeterminerService.isDebitConsideringNothingPositiveOnly(dv, postable));
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorService(org.kuali.kfs.vnd.document.service.VendorService) CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) GeneralLedgerPendingEntrySourceDetail(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 2 with GeneralLedgerPendingEntrySourceDetail

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail in project cu-kfs by CU-CommunityApps.

the class CuUserFavoriteAccountServiceImplTest method testPopulatedNewAccountNull.

@Test
public void testPopulatedNewAccountNull() {
    GeneralLedgerPendingEntrySourceDetail acct = userFavoriteAccountService.getPopulatedNewAccount(null, PurchaseOrderAccount.class);
    Assert.assertNull("Account should not be populated", acct);
}
Also used : GeneralLedgerPendingEntrySourceDetail(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail) Test(org.junit.Test)

Example 3 with GeneralLedgerPendingEntrySourceDetail

use of org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail in project cu-kfs by CU-CommunityApps.

the class CuUserFavoriteAccountServiceImplTest method validateAccount.

private void validateAccount(String accountType, Class accountClass) {
    final FavoriteAccount favoriteAccount = FavoriteAccountFixture.FAVORITE_ACCOUNT_1.createFavoriteAccount();
    final GeneralLedgerPendingEntrySourceDetail acct = userFavoriteAccountService.getPopulatedNewAccount(favoriteAccount, accountClass);
    Assert.assertNotNull("Account should be populated", acct);
    Assert.assertTrue("Account should be " + accountType + " Account", accountClass.isInstance(acct));
    Assert.assertEquals("Account Number should be populated", favoriteAccount.getAccountNumber(), acct.getAccountNumber());
    Assert.assertEquals("Object Code should be populated", favoriteAccount.getFinancialObjectCode(), acct.getFinancialObjectCode());
    if (acct instanceof IWantAccount) {
        final KualiDecimal accountLinePercent = ((IWantAccount) acct).getAmountOrPercent();
        Assert.assertEquals("Incorrect percentage (comparison against 100% should have been zero)", 0, accountLinePercent.compareTo(new KualiDecimal(100)));
        Assert.assertEquals("Amount-or-Percent indicator should be Percent", CUPurapConstants.PERCENT, ((IWantAccount) acct).getUseAmountOrPercent());
    } else {
        final BigDecimal accountLinePercent = ((PurApAccountingLineBase) acct).getAccountLinePercent();
        Assert.assertEquals("Incorrect percentage (comparison against 100% should have been zero)", 0, accountLinePercent.compareTo(new BigDecimal(100)));
    }
}
Also used : FavoriteAccount(edu.cornell.kfs.sys.businessobject.FavoriteAccount) GeneralLedgerPendingEntrySourceDetail(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail) IWantAccount(edu.cornell.kfs.module.purap.businessobject.IWantAccount) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) PurApAccountingLineBase(org.kuali.kfs.module.purap.businessobject.PurApAccountingLineBase) BigDecimal(java.math.BigDecimal)

Aggregations

GeneralLedgerPendingEntrySourceDetail (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)3 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)1 IWantAccount (edu.cornell.kfs.module.purap.businessobject.IWantAccount)1 FavoriteAccount (edu.cornell.kfs.sys.businessobject.FavoriteAccount)1 BigDecimal (java.math.BigDecimal)1 Test (org.junit.Test)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1 PurApAccountingLineBase (org.kuali.kfs.module.purap.businessobject.PurApAccountingLineBase)1 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)1 VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)1 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)1 VendorService (org.kuali.kfs.vnd.document.service.VendorService)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1