use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase 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.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method getNextCapitalAssetLineNumber.
/**
* @param kualiAccountingDocumentFormBase
* @return
*/
protected Integer getNextCapitalAssetLineNumber(KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase) {
int nextCapitalAssetLineNumber = 1;
CapitalAssetInformationDocumentBase caidb = (CapitalAssetInformationDocumentBase) kualiAccountingDocumentFormBase.getFinancialDocument();
nextCapitalAssetLineNumber = caidb.getNextCapitalAssetLineNumber();
caidb.setNextCapitalAssetLineNumber(nextCapitalAssetLineNumber + 1);
return nextCapitalAssetLineNumber;
}
use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method checkCreateAssetsExist.
/**
* @param capitalAccountingLinesFormBase
* @return true if a capital asset with capital asset action indicator = 'C' else false;
*/
protected boolean checkCreateAssetsExist(CapitalAccountingLinesFormBase capitalAccountingLinesFormBase) {
boolean exists = false;
CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
for (CapitalAssetInformation capitalAsset : capitalAssets) {
if (KFSConstants.CapitalAssets.CAPITAL_ASSET_CREATE_ACTION_INDICATOR.equals(capitalAsset.getCapitalAssetActionIndicator())) {
return true;
}
}
return exists;
}
use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method checkModifyAssetsExist.
/**
* @param capitalAccountingLinesFormBase
* @return true if a capital asset with capital asset action indicator = 'C' else false;
*/
protected boolean checkModifyAssetsExist(CapitalAccountingLinesFormBase capitalAccountingLinesFormBase) {
boolean exists = false;
CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
for (CapitalAssetInformation capitalAsset : capitalAssets) {
if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equals(capitalAsset.getCapitalAssetActionIndicator())) {
return true;
}
}
return exists;
}
use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method getRemainingAmounToDistribute.
/**
* Calculates the remaining amount to distribute by taking selecte capital accounting lines
* and subtracting the allocated capital asset accounting lines amounts totals.
*
* @param selectedCapitalAccountingLines
* @param form
* @return remainingAmountToDistribute
*/
protected KualiDecimal getRemainingAmounToDistribute(List<CapitalAccountingLines> selectedCapitalAccountingLines, ActionForm form) {
KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
KualiDecimal capitalAccountsAmountToDistribute = KualiDecimal.ZERO;
KualiDecimal capitalAssetsAllocatedAmount = KualiDecimal.ZERO;
CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) calfb.getFinancialDocument();
List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
selectedCapitalAccountingLines.add(capitalAccountingLine);
capitalAccountsAmountToDistribute = capitalAccountsAmountToDistribute.add(capitalAccountingLine.getAmount());
capitalAssetsAllocatedAmount = capitalAssetsAllocatedAmount.add(getCapitalAssetsAmountAllocated(capitalAssets, capitalAccountingLine));
}
}
remainingAmountToDistribute = capitalAccountsAmountToDistribute.subtract(capitalAssetsAllocatedAmount);
return remainingAmountToDistribute;
}
Aggregations