use of org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail in project cu-kfs by CU-CommunityApps.
the class CustomerInvoiceDetailServiceImpl method getCustomerInvoiceDocumentNumbersByAccountNumber.
@Override
public List<String> getCustomerInvoiceDocumentNumbersByAccountNumber(String accountNumber) {
Map<String, String> fieldValues = new HashMap<>();
fieldValues.put("accountNumber", accountNumber);
Collection<CustomerInvoiceDetail> customerInvoiceDetails = businessObjectService.findMatching(CustomerInvoiceDetail.class, fieldValues);
List<String> docNumbers = new ArrayList<>();
for (CustomerInvoiceDetail detail : customerInvoiceDetails) {
docNumbers.add(detail.getDocumentNumber());
}
return docNumbers;
}
use of org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceDocumentValidation method hasIncomeAndReceivableObjectCodes.
private boolean hasIncomeAndReceivableObjectCodes(AttributedDocumentEvent event) {
boolean isValid = true;
if (event instanceof AttributedRouteDocumentEvent) {
int lineCount = contractsGrantsInvoiceDocument.getSourceAccountingLines().size();
for (int idx = 0; idx < lineCount; idx++) {
CustomerInvoiceDetail cid = (CustomerInvoiceDetail) contractsGrantsInvoiceDocument.getSourceAccountingLines().get(idx);
if (cid.getFinancialObjectCode() == null || cid.getAccountsReceivableObjectCode() == null) {
isValid = false;
// remove Data Dictionary required field validation error
// the message is displaced and would show at the bottom of the screen since the accounting lines
// on CINV are not rendered
GlobalVariables.getMessageMap().removeAllErrorMessagesForProperty("document.sourceAccountingLines[" + idx + "].financialObjectCode");
}
}
if (!isValid) {
GlobalVariables.getMessageMap().putError(KFSConstants.GLOBAL_ERRORS, ArKeyConstants.ContractsGrantsInvoiceConstants.ERROR_SUBMIT_NO_MATCHING_CONTRACT_GRANTS_INVOICE_OBJECT_CODE);
}
}
return isValid;
}
use of org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail in project cu-kfs by CU-CommunityApps.
the class PaymentApplicationAction method deleteCleanupOfApplyToInvoiceDetailData.
protected void deleteCleanupOfApplyToInvoiceDetailData(PaymentApplicationInvoiceDetailApply invoiceListItemDetail, String summaryOfAppliedFundsDocumentNumberBeingDeleted, KualiDecimal summaryOfAppliedFundsAmountBeingDeleted) {
CustomerInvoiceDetail invoiceDetail = invoiceListItemDetail.getInvoiceDetail();
String invoiceDetailDocumentNumber = invoiceDetail.getDocumentNumber();
if (StringUtils.isNotBlank(invoiceDetailDocumentNumber) && ObjectUtils.isNotNull(summaryOfAppliedFundsAmountBeingDeleted) && StringUtils.equalsIgnoreCase(summaryOfAppliedFundsDocumentNumberBeingDeleted, invoiceDetailDocumentNumber)) {
if (invoiceListItemDetail.getAmountApplied().equals(invoiceListItemDetail.getAmount())) {
invoiceListItemDetail.setFullApply(false);
}
if (invoiceListItemDetail.getAmountApplied().equals(summaryOfAppliedFundsAmountBeingDeleted)) {
invoiceListItemDetail.setAmountApplied(KualiDecimal.ZERO);
}
}
}
use of org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceDocumentServiceImpl method updateInvoiceSourceAccountingLines.
protected void updateInvoiceSourceAccountingLines(List<InvoiceAccountDetail> invoiceAccountDetails, List sourceAccountingLines) {
if (sourceAccountingLines.size() > 1) {
// Invoice By Award
for (CustomerInvoiceDetail cide : (List<CustomerInvoiceDetail>) sourceAccountingLines) {
for (InvoiceAccountDetail invoiceAccountDetail : invoiceAccountDetails) {
if (cide.getAccountNumber().equals(invoiceAccountDetail.getAccountNumber())) {
cide.setInvoiceItemUnitPrice(invoiceAccountDetail.getInvoiceAmount());
cide.setAmount(invoiceAccountDetail.getInvoiceAmount());
}
}
}
} else if (sourceAccountingLines.size() == 1) {
// This would be a case where the invoice is generated by Contract Control Account or Invoice By Account.
KualiDecimal totalExpenditureAmount = KualiDecimal.ZERO;
if (invoiceAccountDetails.size() == 1) {
// Invoice By Account
// update source accounting lines
CustomerInvoiceDetail cide = (CustomerInvoiceDetail) sourceAccountingLines.get(0);
cide.setInvoiceItemUnitPrice(invoiceAccountDetails.get(0).getInvoiceAmount());
cide.setAmount(invoiceAccountDetails.get(0).getInvoiceAmount());
} else {
// Invoice By Contract Control Account
for (InvoiceAccountDetail invoiceAccountDetail : invoiceAccountDetails) {
totalExpenditureAmount = totalExpenditureAmount.add(invoiceAccountDetail.getInvoiceAmount());
}
// update source accounting lines
CustomerInvoiceDetail cide = (CustomerInvoiceDetail) sourceAccountingLines.get(0);
cide.setInvoiceItemUnitPrice(totalExpenditureAmount);
cide.setAmount(totalExpenditureAmount);
}
}
}
use of org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceDocumentServiceImpl method createSourceAccountingLines.
@Override
public void createSourceAccountingLines(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument, List<ContractsAndGrantsBillingAwardAccount> awardAccounts) {
// To check if the Source accounting lines are existing. If they are do nothing
if (CollectionUtils.isEmpty(contractsGrantsInvoiceDocument.getSourceAccountingLines())) {
ContractsAndGrantsBillingAward award = contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getAward();
if (ObjectUtils.isNotNull(award)) {
if (StringUtils.equalsIgnoreCase(award.getInvoicingOptionCode(), ArConstants.INV_ACCOUNT) || StringUtils.equalsIgnoreCase(award.getInvoicingOptionCode(), ArConstants.INV_SCHEDULE)) {
// If its bill by Account or Schedule, irrespective of it is by contract control account,
// there would be a single source accounting line with award account specified by the user.
CustomerInvoiceDetail cide = createSourceAccountingLine(contractsGrantsInvoiceDocument.getDocumentNumber(), awardAccounts.get(0).getChartOfAccountsCode(), awardAccounts.get(0).getAccountNumber(), awardAccounts.get(0).getAccount().getSubFundGroup(), getTotalAmountForInvoice(contractsGrantsInvoiceDocument), 1);
contractsGrantsInvoiceDocument.getSourceAccountingLines().add(cide);
} else if (StringUtils.equalsIgnoreCase(award.getInvoicingOptionCode(), ArConstants.INV_CONTRACT_CONTROL_ACCOUNT)) {
// by control account
// If its bill by Contract Control Account there would be a single source accounting line.
CustomerInvoiceDetail cide = createSourceAccountingLinesByContractControlAccount(contractsGrantsInvoiceDocument);
contractsGrantsInvoiceDocument.getSourceAccountingLines().add(cide);
} else {
// by award
List<CustomerInvoiceDetail> awardAccountingLines = createSourceAccountingLinesByAward(contractsGrantsInvoiceDocument);
contractsGrantsInvoiceDocument.getSourceAccountingLines().addAll(awardAccountingLines);
}
}
}
}
Aggregations