use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class GlLineServiceImpl method findCapitalAssetInformationForGLLineMatchLineType.
/**
* Finds capital asset information for a given GL entry by matching also on the accounting line type.
*
* @param entry
* @return matching capital asset info
*/
private List<CapitalAssetInformation> findCapitalAssetInformationForGLLineMatchLineType(GeneralLedgerEntry entry) {
Map<String, String> primaryKeys = new HashMap<String, String>();
primaryKeys.put(CamsPropertyConstants.CapitalAssetInformation.DOCUMENT_NUMBER, entry.getDocumentNumber());
List<CapitalAssetInformation> assetInformation = (List<CapitalAssetInformation>) businessObjectService.findMatchingOrderBy(CapitalAssetInformation.class, primaryKeys, CamsPropertyConstants.CapitalAssetInformation.ACTION_INDICATOR, true);
List<CapitalAssetInformation> matchingAssets = new ArrayList<CapitalAssetInformation>();
for (CapitalAssetInformation capitalAsset : assetInformation) {
addToCapitalAssetsMatchingLineType(matchingAssets, capitalAsset, entry);
}
return matchingAssets;
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method deleteCapitalAssetLines.
/**
* Removes any matching accounting line in capital asset records
* whenever an accounting line is removed.
*
* @param financialDocumentForm
* @param accountingLine
*/
protected void deleteCapitalAssetLines(KualiAccountingDocumentFormBase financialDocumentForm, AccountingLine accountingLine) {
CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) financialDocumentForm.getFinancialDocument();
List<CapitalAssetInformation> removalCaiList = new ArrayList<CapitalAssetInformation>();
List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
for (CapitalAssetInformation capitalAsset : capitalAssets) {
removeDistributedAccountingLine(capitalAsset, accountingLine);
if (capitalAsset.getCapitalAssetAccountsGroupDetails().size() == 0) {
capitalAsset.getCapitalAssetInformationDetails().clear();
removalCaiList.add(capitalAsset);
}
}
// if the removal list is not empty, remove these bunch of capital asset records for that accounting line.
if (ObjectUtils.isNotNull(removalCaiList)) {
capitalAssets.removeAll(removalCaiList);
}
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method clearCapitalAssetModify.
/**
* clear up the modify capital asset information. The amount field is reset to 0
* Processes any remaining capital assets so that it recalculates the system control
* and system control remaining amounts.
*
* @param mapping
* @param form
* @param request
* @param response
* @return action forward string
* @throws Exception
*/
public ActionForward clearCapitalAssetModify(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("clearCapitalAssetModify() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int clearIndex = getSelectedLine(request);
capitalAssetInformation.get(clearIndex).setCapitalAssetLineAmount(KualiDecimal.ZERO);
// zero out the amount distribute on the accounting lines...
for (CapitalAssetAccountsGroupDetails groupAccountLine : capitalAssetInformation.get(clearIndex).getCapitalAssetAccountsGroupDetails()) {
groupAccountLine.setAmount(KualiDecimal.ZERO);
}
// now process the remaining capital asset records
processRemainingCapitalAssetInfo(form, capitalAssetInformation);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method DistributeCapitalAssetAmountToGroupAccountingLines.
/**
* This method redistributes the capital asset amount to its group accounting lines
* based on the accounting line's percent. Takes each capital assets amount and
* distributes to the capital asset group accounting lines.
*
* @param kualiAccountingDocumentFormBase
*/
protected void DistributeCapitalAssetAmountToGroupAccountingLines(KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase) {
CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) kualiAccountingDocumentFormBase;
checkSelectForCapitalAccountingLines(capitalAccountingLinesFormBase);
checkCapitalAccountingLinesSelected(capitalAccountingLinesFormBase);
calculatePercentsForSelectedCapitalAccountingLines(capitalAccountingLinesFormBase);
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
String distributionAmountCode = capitalAccountingLinesFormBase.getCapitalAccountingLine().getDistributionCode();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
capitalAccountingLine.setDistributionAmountCode(distributionAmountCode);
selectedCapitalAccountingLines.add(capitalAccountingLine);
}
}
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
for (CapitalAssetInformation capitalAsset : capitalAssetInformation) {
// redistribute the capital asset modify amount to the group accounting lines based on amount.
if (!capitalAssetAmountAlreadyDistributedToGroupAccountingLines(capitalAsset)) {
redistributeToGroupAccountingLinesFromAssetsByAmounts(selectedCapitalAccountingLines, capitalAsset);
}
}
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method clearCapitalAssetInfo.
/**
* Clear the capital asset information that the user has entered
*
* @param mapping
* @param form
* @param request
* @param response
* @return action forward string
* @throws Exception
*/
public ActionForward clearCapitalAssetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("clearCapitalAssetInfo() - start");
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
if (capitalAssetInformation == null) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
int clearIndex = getSelectedLine(request);
this.resetCapitalAssetInfo(capitalAssetInformation.get(clearIndex));
// now process the remaining capital asset records
processRemainingCapitalAssetInfo(form, capitalAssetInformation);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations