use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImpl method addTaxItem.
@Override
protected PurApItem addTaxItem(PaymentRequestDocument preq, String itemTypeCode, BigDecimal taxableAmount) {
PurApItem item = super.addTaxItem(preq, itemTypeCode, taxableAmount);
PurApAccountingLine taxLine = item.getSourceAccountingLines().get(0);
// KFSPTS-1891. added to fix validation required field error. especially after calculate tax
if (taxLine.getAccountLinePercent() == null) {
taxLine.setAccountLinePercent(BigDecimal.ZERO);
}
return item;
}
use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuRequisitionDocument method getAccountsForAwardRouting.
public List<Account> getAccountsForAwardRouting() {
List<Account> accounts = new ArrayList<Account>();
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
for (PurApItem item : (List<PurApItem>) this.getItems()) {
for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
if (isObjectCodeAllowedForAwardRouting(accountingLine, parameterService)) {
if (ObjectUtils.isNull(accountingLine.getAccount())) {
accountingLine.refreshReferenceObject("account");
}
if (accountingLine.getAccount() != null && !accounts.contains(accountingLine.getAccount())) {
accounts.add(accountingLine.getAccount());
}
}
}
}
return accounts;
}
use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAmendmentDocumentPresentationController method getEditModes.
@Override
public Set<String> getEditModes(Document document) {
Set<String> editModes = super.getEditModes(document);
PurchaseOrderDocument poDocument = (PurchaseOrderDocument) document;
if (PurapConstants.PurchaseOrderStatuses.APPDOC_CHANGE_IN_PROCESS.equals(poDocument.getApplicationDocumentStatus())) {
WorkflowDocument workflowDocument = poDocument.getFinancialSystemDocumentHeader().getWorkflowDocument();
// amendment doc needs to lock its field for initiator while enroute
if (workflowDocument.isInitiated() || workflowDocument.isSaved() || workflowDocument.isCompletionRequested()) {
editModes.add(PurchaseOrderEditMode.AMENDMENT_ENTRY);
}
}
// KFSUPGRADE-339
if (PurchaseOrderStatuses.APPDOC_AWAITING_FISCAL_REVIEW.equals(((PurchaseOrderDocument) document).getApplicationDocumentStatus())) {
editModes.add(PurchaseOrderEditMode.AMENDMENT_ENTRY);
}
if (SpringContext.getBean(PurapService.class).isDocumentStoppedInRouteNode((PurchasingAccountsPayableDocument) document, "New Unordered Items")) {
editModes.add(PurchaseOrderEditMode.UNORDERED_ITEM_ACCOUNT_ENTRY);
}
boolean showDisableRemoveAccounts = true;
PurchaseOrderAmendmentDocument purchaseOrderAmendmentDocument = (PurchaseOrderAmendmentDocument) document;
List<PurApItem> aboveTheLinePOItems = PurApItemUtils.getAboveTheLineOnly(purchaseOrderAmendmentDocument.getItems());
PurchaseOrderDocument po = (PurchaseOrderDocument) document;
boolean containsUnpaidPaymentRequestsOrCreditMemos = po.getContainsUnpaidPaymentRequestsOrCreditMemos();
ItemLoop: for (PurApItem poItem : aboveTheLinePOItems) {
boolean acctLinesEditable = allowAccountingLinesAreEditable((PurchaseOrderItem) poItem, containsUnpaidPaymentRequestsOrCreditMemos);
for (PurApAccountingLine poAccoutingLine : poItem.getSourceAccountingLines()) {
if (!acctLinesEditable) {
showDisableRemoveAccounts = false;
break ItemLoop;
}
}
}
if (!showDisableRemoveAccounts) {
editModes.add(PurchaseOrderEditMode.DISABLE_REMOVE_ACCTS);
}
// KFSPTS-985
if (document instanceof PurchaseOrderDocument && !editModes.contains(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION) && !hasEmptyAcctline((PurchaseOrderDocument) document)) {
editModes.add(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION);
}
return editModes;
}
use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class IWantDocumentServiceImpl method copyIWantDocAccountingLinesToReqDoc.
/**
* Copies the accounting lines from the I Want document to the Requisition document
*
* @param requisitionDocument
* @param iWantDocument
* @param requisitionForm
*/
private void copyIWantDocAccountingLinesToReqDoc(RequisitionDocument requisitionDocument, IWantDocument iWantDocument, RequisitionForm requisitionForm) {
int itemsSize = iWantDocument.getItems() != null ? iWantDocument.getItems().size() : 0;
int accountsSize = iWantDocument.getAccounts() != null ? iWantDocument.getAccounts().size() : 0;
// we only add accounts information if there or only one item or there is only one account, otherwise ignore
if (itemsSize == 1 || accountsSize == 1) {
for (IWantAccount iWantAccount : iWantDocument.getAccounts()) {
PurApAccountingLine requisitionAccount = requisitionForm.getAccountDistributionnewSourceLine();
requisitionAccount.setChartOfAccountsCode(iWantAccount.getChartOfAccountsCode());
requisitionAccount.setAccountNumber(iWantAccount.getAccountNumber());
requisitionAccount.setSubAccountNumber(iWantAccount.getSubAccountNumber());
requisitionAccount.setFinancialObjectCode(iWantAccount.getFinancialObjectCode());
requisitionAccount.setFinancialSubObjectCode(iWantAccount.getFinancialSubObjectCode());
requisitionAccount.setProjectCode(iWantAccount.getProjectCode());
requisitionAccount.setOrganizationReferenceId(iWantAccount.getOrganizationReferenceId());
if (CUPurapConstants.PERCENT.equalsIgnoreCase(iWantAccount.getUseAmountOrPercent())) {
requisitionAccount.setAccountLinePercent(iWantAccount.getAmountOrPercent().bigDecimalValue().setScale(0, RoundingMode.HALF_UP));
} else {
// compute amount based on percent
BigDecimal requisitionAccountPercent = BigDecimal.ZERO;
KualiDecimal iWantDocTotalDollarAmount = iWantDocument.getTotalDollarAmount();
if (iWantDocTotalDollarAmount != null && iWantAccount.getAmountOrPercent() != null && iWantDocTotalDollarAmount.isNonZero() && iWantAccount.getAmountOrPercent().isNonZero()) {
requisitionAccountPercent = (iWantAccount.getAmountOrPercent().divide(iWantDocTotalDollarAmount).bigDecimalValue()).multiply(new BigDecimal("100"));
requisitionAccountPercent = requisitionAccountPercent.setScale(0, RoundingMode.HALF_UP);
}
requisitionAccount.setAccountLinePercent(requisitionAccountPercent);
}
requisitionForm.addAccountDistributionsourceAccountingLine(requisitionAccount);
}
}
}
use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderForm method populateItemAccountingLines.
// end KFSUPGRADE-411
/**
* Overridden to properly increment the local "itemCount" loop counter when processing POA documents,
* but otherwise has the same code as in the superclass.
*
* @see org.kuali.kfs.module.purap.document.web.struts.PurchasingAccountsPayableFormBase#populateItemAccountingLines(java.util.Map)
*/
@SuppressWarnings("rawtypes")
@Override
protected void populateItemAccountingLines(Map parameterMap) {
if (!(getDocument() instanceof PurchaseOrderAmendmentDocument)) {
super.populateItemAccountingLines(parameterMap);
return;
}
int itemCount = 0;
for (PurApItem item : ((PurchasingAccountsPayableDocument) getDocument()).getItems()) {
populateAccountingLine(item.getNewSourceLine(), KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.ITEM + "[" + itemCount + "]." + KFSPropertyConstants.NEW_SOURCE_LINE, parameterMap);
int sourceLineCount = 0;
for (PurApAccountingLine purApLine : item.getSourceAccountingLines()) {
populateAccountingLine(purApLine, KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.ITEM + "[" + itemCount + "]." + KFSPropertyConstants.SOURCE_ACCOUNTING_LINE + "[" + sourceLineCount + "]", parameterMap);
sourceLineCount += 1;
}
itemCount += 1;
}
}
Aggregations