use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class GlLineServiceImpl method createNewCapitalAsset.
/**
* helper method to add accounting details for this new capital asset record
*
* @param capitalAccountingLines
* @param currentCapitalAssetInformation
* @param documentNumber
* @param actionType
* @param nextCapitalAssetLineNumnber
*/
protected void createNewCapitalAsset(List<CapitalAccountingLines> capitalAccountingLines, 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);
KualiDecimal capitalAssetLineAmount = KualiDecimal.ZERO;
// now setup the account line information associated with this capital asset
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
capitalAsset.setDistributionAmountCode(capitalAccountingLine.getDistributionAmountCode());
createCapitalAssetAccountingLinesDetails(capitalAccountingLine, capitalAsset);
capitalAssetLineAmount = capitalAssetLineAmount.add(capitalAccountingLine.getAmount());
}
capitalAsset.setCapitalAssetLineAmount(capitalAssetLineAmount);
businessObjectService.save(capitalAsset);
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class GlLineServiceImpl method addCapitalAccountingLine.
/**
* convenience method to add a new capital accounting line to the collection of capital
* accounting lines.
*
* @param capitalAccountingLines
* @param entry
* @return
*/
protected CapitalAccountingLines addCapitalAccountingLine(List<CapitalAccountingLines> capitalAccountingLines, GeneralLedgerEntry entry) {
CapitalAccountingLines cal = new CapitalAccountingLines();
String capitalAssetLineType = KFSConstants.GL_CREDIT_CODE.equals(entry.getTransactionDebitCreditCode()) ? KFSConstants.SOURCE : KFSConstants.TARGET;
cal.setLineType(capitalAssetLineType);
cal.setSequenceNumber(entry.getTransactionLedgerEntrySequenceNumber());
cal.setChartOfAccountsCode(entry.getChartOfAccountsCode());
cal.setAccountNumber(entry.getAccountNumber());
cal.setSubAccountNumber(entry.getSubAccountNumber());
cal.setFinancialObjectCode(entry.getFinancialObjectCode());
cal.setFinancialSubObjectCode(entry.getFinancialSubObjectCode());
cal.setProjectCode(entry.getProjectCode());
cal.setOrganizationReferenceId(entry.getOrganizationReferenceId());
cal.setFinancialDocumentLineDescription(entry.getTransactionLedgerEntryDescription());
cal.setAmount(entry.getAmount());
cal.setAccountLinePercent(null);
cal.setSelectLine(false);
return cal;
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method accountingLinesAmountDistributed.
/**
* @param capitalAccountingLines
* @param existingCapitalAsset
* @return true if accounting line amount equals to capital asset amount, else false.
*/
protected boolean accountingLinesAmountDistributed(List<CapitalAccountingLines> capitalAccountingLines, CapitalAssetInformation existingCapitalAsset) {
KualiDecimal accountingLineAmount = KualiDecimal.ZERO;
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
accountingLineAmount = accountingLineAmount.add(capitalAccountingLine.getAmount().abs());
}
KualiDecimal capitalAssetsAmount = existingCapitalAsset.getCapitalAssetLineAmount();
return accountingLineAmount.equals(capitalAssetsAmount);
}
use of org.kuali.kfs.fp.businessobject.CapitalAccountingLines 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.CapitalAccountingLines in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method copy.
/**
* Overridden to guarantee that form of copied document is set to whatever the entry mode of the document is
*
* @see org.kuali.rice.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
;
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
List<CapitalAccountingLines> copiedCapitalAccountingLines = new ArrayList<>();
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
copiedCapitalAccountingLines.add(capitalAccountingLine);
}
capitalAccountingLines.clear();
ActionForward forward = super.copy(mapping, form, request, response);
caldb.setCapitalAccountingLines(copiedCapitalAccountingLines);
// if the copied document has capital asset collection, remove the collection
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
AccountingDocument document = kualiAccountingDocumentFormBase.getFinancialDocument();
if (document instanceof CapitalAssetEditable) {
CapitalAssetEditable capitalAssetEditable = (CapitalAssetEditable) document;
List<CapitalAssetInformation> capitalAssets = capitalAssetEditable.getCapitalAssetInformation();
for (CapitalAssetInformation capitalAsset : capitalAssets) {
Long capitalAssetNumber = capitalAsset.getCapitalAssetNumber();
resetCapitalAssetInfo(capitalAsset);
// because resetCapitalAssetInfo cleared the value.
if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equalsIgnoreCase(capitalAsset.getCapitalAssetActionIndicator())) {
capitalAsset.setCapitalAssetNumber(capitalAssetNumber);
}
capitalAsset.setCapitalAssetProcessedIndicator(false);
}
}
// setup the initial next sequence number column..
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
setupIntialNextCapitalAssetLineNumber(kualiDocumentFormBase);
checkCapitalAccountingLinesSelected(capitalAccountingLinesFormBase);
return forward;
}
Aggregations