use of org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase 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.document.CapitalAccountingLinesDocumentBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method setTabStatesForCapitalAssets.
/**
* sets the capital assets screens for create and modify and accounting lines
* for capitalization screen as open. If accounting lines for capitalizataion list is
* not empty then set "Accounting Lines for Capitalization" tab to open else set to close.
* If capital asset with capital asset action indicator = 'C' then set "Create Capital Asset"
* tab to open else set to close
* If capital asset with capital asset action indicator = 'M' then set "Modify Capital Asset"
* tab to open else set to close
*
* @param form
*/
protected void setTabStatesForCapitalAssets(ActionForm form) {
KualiForm kualiForm = (KualiForm) form;
CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
Map<String, String> tabStates = kualiForm.getTabStates();
Map<String, String> newTabStates = new HashMap<String, String>();
CapitalAssetInformationFormBase capitalAssetInformationFormBase = (CapitalAssetInformationFormBase) form;
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAssetInformationFormBase.getFinancialDocument();
// generated tab key for the three tabs
String tabIdForAccountingLinesForCapitalization = WebUtils.generateTabKey(KFSConstants.CapitalAssets.ACCOUNTING_LINES_FOR_CAPITALIZATION_TAB_TITLE);
String tabIdForCreateCapitalAsset = WebUtils.generateTabKey(KFSConstants.CapitalAssets.CREATE_CAPITAL_ASSETS_TAB_TITLE);
String tabIdForModifyCapitalAsset = WebUtils.generateTabKey(KFSConstants.CapitalAssets.MODIFY_CAPITAL_ASSETS_TAB_TITLE);
tabStates.remove(tabIdForAccountingLinesForCapitalization);
tabStates.remove(tabIdForCreateCapitalAsset);
tabStates.remove(tabIdForModifyCapitalAsset);
// if there are any capital accounting lines for capitalization exists then
if (caldb.getCapitalAccountingLines().size() > 0 || caldb.isCapitalAccountingLinesExist()) {
tabStates.put(tabIdForAccountingLinesForCapitalization, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_OPEN);
} else {
tabStates.put(tabIdForAccountingLinesForCapitalization, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_CLOSE);
}
if (checkCreateAssetsExist(capitalAccountingLinesFormBase)) {
tabStates.put(tabIdForCreateCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_OPEN);
} else {
tabStates.put(tabIdForCreateCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_CLOSE);
}
if (checkModifyAssetsExist(capitalAccountingLinesFormBase)) {
tabStates.put(tabIdForModifyCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_OPEN);
} else {
tabStates.put(tabIdForModifyCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_CLOSE);
}
kualiForm.setTabStates(tabStates);
}
use of org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method calculatePercentsForSelectedCapitalAccountingLines.
/**
* calculates the percents for the selected capital accounting lines only
*
* @param calfb
*/
protected void calculatePercentsForSelectedCapitalAccountingLines(CapitalAccountingLinesFormBase calfb) {
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
KualiDecimal totalCapitalLinesSelectedAmount = (calculateTotalCapitalLinesSelectedAmount(capitalAccountingLines)).abs();
if (totalCapitalLinesSelectedAmount.isNonZero()) {
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
capitalAccountingLine.setAccountLinePercent(capitalAccountingLine.getAmount().abs().divide(totalCapitalLinesSelectedAmount).multiply(new KualiDecimal(100), true));
}
}
}
}
Aggregations