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));
}
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);
}
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)));
}
}
Aggregations