Search in sources :

Example 6 with CustomerInvoiceDetail

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AccountsReceivableCustomerInvoiceDetail(org.kuali.kfs.integration.ar.AccountsReceivableCustomerInvoiceDetail) CustomerInvoiceDetail(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail)

Example 7 with CustomerInvoiceDetail

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;
}
Also used : AttributedRouteDocumentEvent(org.kuali.kfs.sys.document.validation.event.AttributedRouteDocumentEvent) CustomerInvoiceDetail(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail)

Example 8 with CustomerInvoiceDetail

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);
        }
    }
}
Also used : CustomerInvoiceDetail(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail)

Example 9 with CustomerInvoiceDetail

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);
        }
    }
}
Also used : CustomerInvoiceDetail(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail) AbstractKualiDecimal(org.kuali.kfs.core.api.util.type.AbstractKualiDecimal) KualiDecimal(org.kuali.kfs.core.api.util.type.KualiDecimal) ArrayList(java.util.ArrayList) List(java.util.List) InvoiceAccountDetail(org.kuali.kfs.module.ar.businessobject.InvoiceAccountDetail)

Example 10 with CustomerInvoiceDetail

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);
            }
        }
    }
}
Also used : ContractsAndGrantsBillingAward(org.kuali.kfs.integration.cg.ContractsAndGrantsBillingAward) CustomerInvoiceDetail(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

CustomerInvoiceDetail (org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail)11 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 AccountsReceivableCustomerInvoiceDetail (org.kuali.kfs.integration.ar.AccountsReceivableCustomerInvoiceDetail)4 AbstractKualiDecimal (org.kuali.kfs.core.api.util.type.AbstractKualiDecimal)3 List (java.util.List)2 InvoiceAccountDetail (org.kuali.kfs.module.ar.businessobject.InvoiceAccountDetail)2 BigDecimal (java.math.BigDecimal)1 SubFundGroup (org.kuali.kfs.coa.businessobject.SubFundGroup)1 ContractsAndGrantsBillingAward (org.kuali.kfs.integration.cg.ContractsAndGrantsBillingAward)1 ContractsGrantsInvoiceObjectCode (org.kuali.kfs.module.ar.businessobject.ContractsGrantsInvoiceObjectCode)1 CustomerInvoiceItemCode (org.kuali.kfs.module.ar.businessobject.CustomerInvoiceItemCode)1 OrganizationAccountingDefault (org.kuali.kfs.module.ar.businessobject.OrganizationAccountingDefault)1 SystemInformation (org.kuali.kfs.module.ar.businessobject.SystemInformation)1 AttributedRouteDocumentEvent (org.kuali.kfs.sys.document.validation.event.AttributedRouteDocumentEvent)1