use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method checkSelectForCapitalAccountingLines.
/**
* checks "select" check box on capital accounting lines if there are
* corresponding capital asset records.
*
* @param calfb
*/
protected void checkSelectForCapitalAccountingLines(CapitalAccountingLinesFormBase calfb) {
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
KualiAccountingDocumentFormBase kadfb = calfb;
List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (currentCapitalAssetInformation.size() <= 0) {
capitalAccountingLine.setSelectLine(false);
} else {
CapitalAssetInformation existingCapitalAsset = getCapitalAssetCreated(capitalAccountingLine, currentCapitalAssetInformation);
if (ObjectUtils.isNotNull(existingCapitalAsset)) {
capitalAccountingLine.setSelectLine(true);
} else {
capitalAccountingLine.setSelectLine(false);
}
}
}
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method createNewCapitalAsset.
/**
* helper method to add accounting details for this new capital asset record
*
* @param capitalAccountingLines
* @param currentCapitalAssetInformation
* @param documentNumber
* @param actionType
* @param nextCapitalAssetLineNumber
*/
protected void createNewCapitalAsset(List<CapitalAccountingLines> capitalAccountingLines, List<CapitalAssetInformation> currentCapitalAssetInformation, String documentNumber, String actionType, Integer nextCapitalAssetLineNumber) {
CapitalAssetInformation capitalAsset = new CapitalAssetInformation();
capitalAsset.setCapitalAssetLineAmount(KualiDecimal.ZERO);
capitalAsset.setDocumentNumber(documentNumber);
capitalAsset.setCapitalAssetLineNumber(nextCapitalAssetLineNumber);
capitalAsset.setCapitalAssetActionIndicator(actionType);
capitalAsset.setCapitalAssetProcessedIndicator(false);
// now setup the account line information associated with this capital asset
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
capitalAsset.setDistributionAmountCode(capitalAccountingLine.getDistributionAmountCode());
createCapitalAssetAccountingLinesDetails(capitalAccountingLine, capitalAsset);
}
currentCapitalAssetInformation.add(capitalAsset);
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method getCurrentCapitalAssetInformationObject.
/**
* get the capital asset information object currently associated with the document
*/
protected List<CapitalAssetInformation> getCurrentCapitalAssetInformationObject(KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase) {
LOG.debug("getCurrentCapitalAssetInformationObject() - start");
CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) kualiAccountingDocumentFormBase.getFinancialDocument();
if (!(capitalAssetInformationDocumentBase instanceof CapitalAssetEditable)) {
return null;
}
List<CapitalAssetInformation> capitalAssetInformation = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
return capitalAssetInformation;
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method adjustAccountingLinesAmounts.
/**
* for each capital account line, compares its amounts to the accounting lines
* on capital assets and adjusts its accounting lines amounts for any variances.
*
* @param capitalAcctLine
* @param capitalAssetInformation
*/
protected void adjustAccountingLinesAmounts(CapitalAccountingLines capitalAcctLine, List<CapitalAssetInformation> capitalAssetInformation) {
CapitalAssetAccountsGroupDetails lastAcctLine = null;
KualiDecimal totalAccountsAmount = KualiDecimal.ZERO;
for (CapitalAssetInformation capitalAsset : capitalAssetInformation) {
if (capitalAsset.getCapitalAssetLineAmount().compareTo(getAccountingLinesTotalAmount(capitalAsset)) != 0) {
List<CapitalAssetAccountsGroupDetails> groupAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
for (CapitalAssetAccountsGroupDetails groupAccountLine : groupAccountLines) {
if (groupAccountLine.getCapitalAssetLineNumber().compareTo(capitalAsset.getCapitalAssetLineNumber()) == 0 && groupAccountLine.getSequenceNumber().compareTo(capitalAcctLine.getSequenceNumber()) == 0 && groupAccountLine.getFinancialDocumentLineTypeCode().equals(KFSConstants.SOURCE.equals(capitalAcctLine.getLineType()) ? KFSConstants.SOURCE_ACCT_LINE_TYPE_CODE : KFSConstants.TARGET_ACCT_LINE_TYPE_CODE) && groupAccountLine.getChartOfAccountsCode().equals(capitalAcctLine.getChartOfAccountsCode()) && groupAccountLine.getAccountNumber().equals(capitalAcctLine.getAccountNumber()) && groupAccountLine.getFinancialObjectCode().equals(capitalAcctLine.getFinancialObjectCode())) {
totalAccountsAmount = totalAccountsAmount.add(groupAccountLine.getAmount());
lastAcctLine = groupAccountLine;
}
}
}
}
KualiDecimal variance = capitalAcctLine.getAmount().subtract(totalAccountsAmount);
if (variance.isNonZero() && ObjectUtils.isNotNull(lastAcctLine)) {
lastAcctLine.setAmount(lastAcctLine.getAmount().add(variance));
}
}
use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation in project cu-kfs by CU-CommunityApps.
the class GlLineServiceImpl method setupMissingCapitalAssetInformation.
/**
* Setup shell Capital Asset Information where it doesn't already exist (for
* example for a PRNC that is in Process and has already generated some
* capital asset information in a previous processing)
*
* @param entry
*/
@Override
public void setupMissingCapitalAssetInformation(String documentNumber) {
List<CapitalAccountingLines> capitalAccountingLines;
// get all related entries and create capital asset record for each
Collection<GeneralLedgerEntry> glEntries = findAllGeneralLedgerEntry(documentNumber);
Collection<CapitalAssetInformation> allCapitalAssetInformation = findAllCapitalAssetInformation(documentNumber);
int nextCapitalAssetLineNumber = findMaximumCapitalAssetLineNumber(allCapitalAssetInformation) + 1;
for (GeneralLedgerEntry glEntry : glEntries) {
// check if it has capital Asset Info
List<CapitalAssetInformation> entryCapitalAssetInfo = findCapitalAssetInformationForGLLineMatchLineType(glEntry);
if (entryCapitalAssetInfo.isEmpty()) {
capitalAccountingLines = new ArrayList<CapitalAccountingLines>();
createCapitalAccountingLine(capitalAccountingLines, glEntry, null);
createNewCapitalAsset(capitalAccountingLines, documentNumber, null, nextCapitalAssetLineNumber);
nextCapitalAssetLineNumber++;
}
}
}
Aggregations