use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method redistributeCreateCapitalAssetAmount.
/**
* @param mapping
* @param form
* @param request
* @param response
* @return actionForward
* @throws Exception
*/
public ActionForward redistributeCreateCapitalAssetAmount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("redistributeCreateCapitalAssetAmount() - start");
KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
String distributionCode = calfb.getCapitalAccountingLine().getDistributionCode();
remainingAmountToDistribute = getRemainingAmounToDistribute(selectedCapitalAccountingLines, form);
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
// run the process to redistribute the accounting line amount to the capital assets.
redistributeEqualAmountsForAccountingLineForCreateAssets(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
redistributeIndividualAmountsForAccountingLinesForCreateAssets(selectedCapitalAccountingLines, capitalAssetInformation);
// adjust any variance from capital accounting lines to the distributed accounting lines amounts....
adjustCapitalAssetsAccountingLinesAmounts(selectedCapitalAccountingLines, capitalAssetInformation);
// now perform calculations of adjusting variance when asset amounts are odd
// /// adjustVarianceOnCapitalAssets(capitalAssetInformation);
checkCapitalAccountingLinesSelected(calfb);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines 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.CapitalAccountingLines 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.CapitalAccountingLines 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));
}
}
}
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines 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