use of org.kuali.kfs.sys.businessobject.SourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherExtractionHelperServiceImplTest 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");
dv.setCampusCode("IT");
SourceAccountingLine accountingLine = new SourceAccountingLine();
accountingLine.setChartOfAccountsCode("IT");
accountingLine.setAccountNumber("G081040");
accountingLine.setFinancialObjectCode("2045");
accountingLine.setAmount((new KualiDecimal(86.00)));
accountingLine.setPostingYear(dv.getPostingYear());
accountingLine.setDocumentNumber(dv.getDocumentNumber());
dv.addSourceAccountingLine(accountingLine);
try {
documentService.saveDocument(dv);
} catch (WorkflowException e) {
throw new RuntimeException("Error saving new disbursement voucher document: " + e.getMessage(), e);
}
}
Date transactionTimestamp = new Date(SpringContext.getBean(DateTimeService.class).getCurrentDate().getTime());
Date processRunDate = new java.sql.Date(transactionTimestamp.getTime());
PaymentGroup pg = cuDisbursementVoucherExtractionHelperService.createPaymentGroup(dv, processRunDate);
assertTrue(pg.getPaymentDetails().get(0).getCustPaymentDocNbr().equalsIgnoreCase(dv.getDocumentNumber()));
}
use of org.kuali.kfs.sys.businessobject.SourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocumentIntegrationTest method setupCuDisbursementVoucherDocument.
private CuDisbursementVoucherDocument setupCuDisbursementVoucherDocument() throws WorkflowException {
CuDisbursementVoucherDocument dv = (CuDisbursementVoucherDocument) SpringContext.getBean(DocumentService.class).getNewDocument(DisbursementVoucherDocument.class);
dv.getDocumentHeader().setDocumentDescription("Test Document Description");
dv.getDocumentHeader().setExplanation("Stuff");
dv.initiateDocument();
VendorDetail vendor = vendorService.getVendorDetail("13366-0");
VendorAddress vendoraddress = vendorService.getVendorDefaultAddress(vendor.getVendorHeaderGeneratedIdentifier(), vendor.getVendorDetailAssignedIdentifier(), "RM", "");
dv.templateVendor(vendor, vendoraddress);
dv.setPayeeAssigned(true);
dv.getDvPayeeDetail().setDisbVchrPaymentReasonCode("S");
dv.setDisbVchrCheckTotalAmount(new KualiDecimal(86.00));
dv.setDisbVchrPaymentMethodCode("P");
dv.setDisbVchrCheckStubText("check text");
dv.setCampusCode("IT");
SourceAccountingLine accountingLine = new SourceAccountingLine();
accountingLine.setChartOfAccountsCode("IT");
accountingLine.setAccountNumber("G081040");
accountingLine.setFinancialObjectCode("2045");
accountingLine.setAmount((new KualiDecimal(86.00)));
accountingLine.setPostingYear(dv.getPostingYear());
accountingLine.setDocumentNumber(dv.getDocumentNumber());
dv.addSourceAccountingLine(accountingLine);
documentService.saveDocument(dv);
return dv;
}
use of org.kuali.kfs.sys.businessobject.SourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class IWantDocumentServiceImpl method copyIWantDocAccountingLinesToDVDoc.
/**
* Copies the accounting lines from the I Want document to the Requisition document
*
* @param requisitionDocument
* @param iWantDocument
* @param requisitionForm
*/
private void copyIWantDocAccountingLinesToDVDoc(DisbursementVoucherDocument disbursementVoucherDocument, IWantDocument iWantDocument, DisbursementVoucherForm disbursementVoucherForm) {
int accountsSize = iWantDocument.getAccounts() != null ? iWantDocument.getAccounts().size() : 0;
if (accountsSize > 0) {
for (IWantAccount iWantAccount : iWantDocument.getAccounts()) {
SourceAccountingLine dvAccount = disbursementVoucherForm.getNewSourceLine();
dvAccount.setChartOfAccountsCode(iWantAccount.getChartOfAccountsCode());
dvAccount.setAccountNumber(iWantAccount.getAccountNumber());
dvAccount.setSubAccountNumber(iWantAccount.getSubAccountNumber());
dvAccount.setFinancialObjectCode(iWantAccount.getFinancialObjectCode());
dvAccount.setFinancialSubObjectCode(iWantAccount.getFinancialSubObjectCode());
dvAccount.setProjectCode(iWantAccount.getProjectCode());
dvAccount.setOrganizationReferenceId(iWantAccount.getOrganizationReferenceId());
if (CUPurapConstants.PERCENT.equalsIgnoreCase(iWantAccount.getUseAmountOrPercent()) && iWantAccount.getAmountOrPercent() != null) {
// compute amount
KualiDecimal lineAmount = iWantAccount.getAmountOrPercent().multiply(iWantDocument.getTotalDollarAmount());
if (lineAmount.isNonZero()) {
lineAmount = lineAmount.divide(new KualiDecimal(100));
}
dvAccount.setAmount(lineAmount);
} else {
dvAccount.setAmount(iWantAccount.getAmountOrPercent());
}
disbursementVoucherDocument.addSourceAccountingLine(dvAccount);
disbursementVoucherForm.setNewSourceLine(null);
}
}
}
Aggregations