use of org.kuali.kfs.coa.businessobject.SubFundGroup in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalRule method accountIsForContractsAndGrants.
protected boolean accountIsForContractsAndGrants(Account account) {
if (ObjectUtils.isNotNull(account)) {
account.refreshReferenceObject(KFSPropertyConstants.SUB_FUND_GROUP);
SubFundGroup subFundGroup = account.getSubFundGroup();
if (ObjectUtils.isNotNull(subFundGroup)) {
return getSubFundGroupService().isForContractsAndGrants(subFundGroup);
}
}
return false;
}
use of org.kuali.kfs.coa.businessobject.SubFundGroup in project cu-kfs by CU-CommunityApps.
the class CuContractsGrantsInvoiceDocumentServiceImpl method createSourceAccountingLinesByContractControlAccount.
/*
* CUMod: KFSPTS-14929
*/
@Override
protected CustomerInvoiceDetail createSourceAccountingLinesByContractControlAccount(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) {
String coaCode = null;
String accountNumber = null;
SubFundGroup subFundGroup = null;
List<InvoiceAccountDetail> accountDetails = contractsGrantsInvoiceDocument.getAccountDetails();
if (CollectionUtils.isNotEmpty(accountDetails)) {
Account contractControlAccount = determineContractControlAccount(accountDetails.get(0));
if (ObjectUtils.isNotNull(contractControlAccount)) {
coaCode = contractControlAccount.getChartOfAccountsCode();
accountNumber = contractControlAccount.getAccountNumber();
subFundGroup = contractControlAccount.getSubFundGroup();
if (ObjectUtils.isNull(subFundGroup)) {
contractControlAccount.refreshReferenceObject(KFSPropertyConstants.SUB_FUND_GROUP);
subFundGroup = contractControlAccount.getSubFundGroup();
}
}
}
return createSourceAccountingLine(contractsGrantsInvoiceDocument.getDocumentNumber(), coaCode, accountNumber, subFundGroup, getTotalAmountForInvoice(contractsGrantsInvoiceDocument), 1);
}
use of org.kuali.kfs.coa.businessobject.SubFundGroup in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceDocumentServiceImpl method createSourceAccountingLinesByContractControlAccount.
/**
* Creates source accounting lines using the contract control account to populate
*
* @param contractsGrantsInvoiceDocument the Contracts & Grants Invoice to add lines to
*/
protected CustomerInvoiceDetail createSourceAccountingLinesByContractControlAccount(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) {
String coaCode = null;
String accountNumber = null;
SubFundGroup subFundGroup = null;
List<InvoiceAccountDetail> accountDetails = contractsGrantsInvoiceDocument.getAccountDetails();
if (CollectionUtils.isNotEmpty(accountDetails)) {
InvoiceAccountDetail invoiceAccountDetail = accountDetails.get(0);
Account account = invoiceAccountDetail.getAccount();
if (ObjectUtils.isNull(account)) {
invoiceAccountDetail.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
account = invoiceAccountDetail.getAccount();
}
if (ObjectUtils.isNotNull(account)) {
Account contractControlAccount = account.getContractControlAccount();
if (ObjectUtils.isNotNull(contractControlAccount)) {
coaCode = contractControlAccount.getChartOfAccountsCode();
accountNumber = contractControlAccount.getAccountNumber();
subFundGroup = contractControlAccount.getSubFundGroup();
}
}
}
return createSourceAccountingLine(contractsGrantsInvoiceDocument.getDocumentNumber(), coaCode, accountNumber, subFundGroup, getTotalAmountForInvoice(contractsGrantsInvoiceDocument), 1);
}
use of org.kuali.kfs.coa.businessobject.SubFundGroup in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceDocumentServiceImpl method createSourceAccountingLinesByAward.
/**
* Generates the source accounting lines for a Contracts & Grants Invoice from the award accounts associated with
* an award (in the form of the pre-generated invoice account details)
*
* @param contractsGrantsInvoiceDocument the Contracts & Grants Invoice to create invoice details for
* @return a List of generated accounting lines
*/
protected List<CustomerInvoiceDetail> createSourceAccountingLinesByAward(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) {
List<CustomerInvoiceDetail> awardAccountingLines = new ArrayList<>();
if (!CollectionUtils.isEmpty(contractsGrantsInvoiceDocument.getAccountDetails())) {
final Map<String, KualiDecimal> accountExpenditureAmounts = getCategoryExpenditureAmountsForInvoiceAccountDetail(contractsGrantsInvoiceDocument);
final Map<String, KualiDecimal> accountTotalBilledAmounts = getCategoryTotalBilledAmountsForInvoiceAccountDetail(contractsGrantsInvoiceDocument);
for (InvoiceAccountDetail invAcctD : contractsGrantsInvoiceDocument.getAccountDetails()) {
final String proposalNumber = invAcctD.getProposalNumber();
final String chartOfAccountsCode = invAcctD.getChartOfAccountsCode();
final String accountNumber = invAcctD.getAccountNumber();
if (invAcctD.getAccount() == null) {
invAcctD.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
}
final SubFundGroup subFundGroup = invAcctD.getAccount().getSubFundGroup();
final Integer sequenceNumber = contractsGrantsInvoiceDocument.getAccountDetails().indexOf(invAcctD) + 1;
final String accountKey = StringUtils.join(new String[] { chartOfAccountsCode, accountNumber }, "-");
KualiDecimal totalAmount = accountExpenditureAmounts.getOrDefault(accountKey, KualiDecimal.ZERO);
if (invAcctD.getTotalPreviouslyBilled().isZero()) {
KualiDecimal previouslyBilledAmount = getPredeterminedBillingBilledToDateAmount(proposalNumber, chartOfAccountsCode, accountNumber);
previouslyBilledAmount = previouslyBilledAmount.add(getMilestonesBilledToDateAmount(proposalNumber, chartOfAccountsCode, accountNumber));
KualiDecimal totalBilledAmount = accountTotalBilledAmounts.getOrDefault(accountKey, KualiDecimal.ZERO);
previouslyBilledAmount = previouslyBilledAmount.subtract(totalBilledAmount);
if (previouslyBilledAmount.isGreaterThan(KualiDecimal.ZERO)) {
totalAmount = totalAmount.subtract(previouslyBilledAmount);
}
}
CustomerInvoiceDetail cide = createSourceAccountingLine(contractsGrantsInvoiceDocument.getDocumentNumber(), chartOfAccountsCode, accountNumber, subFundGroup, totalAmount, sequenceNumber);
awardAccountingLines.add(cide);
}
}
return awardAccountingLines;
}
use of org.kuali.kfs.coa.businessobject.SubFundGroup in project cu-kfs by CU-CommunityApps.
the class AccountGlobalPreRules method checkForDefaultSubFundGroupStatus.
protected void checkForDefaultSubFundGroupStatus() {
String restrictedStatusCode = StringUtils.EMPTY;
if (ObjectUtils.isNull(accountGlobal.getSubFundGroup()) || StringUtils.isBlank(accountGlobal.getSubFundGroupCode())) {
return;
}
SubFundGroup subFundGroup = accountGlobal.getSubFundGroup();
if (StringUtils.isNotBlank(subFundGroup.getAccountRestrictedStatusCode())) {
restrictedStatusCode = subFundGroup.getAccountRestrictedStatusCode().trim();
accountGlobal.setAccountRestrictedStatusCode(restrictedStatusCode);
}
}
Aggregations