Search in sources :

Example 1 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderAmendmentDocument method isSeparationOfDutiesReviewRequired.

protected boolean isSeparationOfDutiesReviewRequired() {
    try {
        Set<Person> priorApprovers = getAllPriorApprovers();
        // then no need for separation of duties
        if (priorApprovers.size() > 0) {
            return false;
        }
    } catch (WorkflowException we) {
        LOG.error("Exception while attempting to retrieve all prior approvers from workflow: " + we);
    }
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    KualiDecimal maxAllowedAmount = new KualiDecimal(parameterService.getParameterValueAsString(RequisitionDocument.class, PurapParameterConstants.SEPARATION_OF_DUTIES_DOLLAR_AMOUNT));
    // if app param amount is greater than or equal to documentTotalAmount... no need for separation of duties
    KualiDecimal totalAmount = getFinancialSystemDocumentHeader().getFinancialDocumentTotalAmount();
    if (ObjectUtils.isNotNull(maxAllowedAmount) && ObjectUtils.isNotNull(totalAmount) && (maxAllowedAmount.compareTo(totalAmount) >= 0)) {
        return false;
    } else {
        return true;
    }
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Person(org.kuali.rice.kim.api.identity.Person)

Example 2 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocument method isAwardReviewRequired.

protected boolean isAwardReviewRequired() {
    boolean requiresAwardReview = false;
    this.getAccountsForRouting();
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    // If the award amount is less than the threshold, then there's no reason to review the object codes, return false
    if (!isAwardAmountGreaterThanThreshold()) {
        return requiresAwardReview;
    }
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            requiresAwardReview = isObjectCodeAllowedForAwardRouting(accountingLine, parameterService);
            // level.
            if (requiresAwardReview) {
                return requiresAwardReview;
            }
        }
    }
    return requiresAwardReview;
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocument method isAwardAmountGreaterThanThreshold.

protected boolean isAwardAmountGreaterThanThreshold() {
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    String dollarThreshold = parameterService.getParameterValueAsString("KFS-PURAP", "Requisition", DOLLAR_THRESHOLD_REQUIRING_AWARD_REVIEW);
    KualiDecimal dollarThresholdDecimal = new KualiDecimal(dollarThreshold);
    if (this.getTotalPreTaxDollarAmount().isGreaterEqual(dollarThresholdDecimal)) {
        return true;
    }
    return false;
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 4 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuLaborPendingEntryGenerator method generateBenefitPendingEntries.

public static List<LaborLedgerPendingEntry> generateBenefitPendingEntries(LaborLedgerPostingDocument document, ExpenseTransferAccountingLine accountingLine, GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
    accountingLine.refreshReferenceObject(KFSPropertyConstants.LABOR_OBJECT);
    if (ObjectUtils.isNull(accountingLine.getLaborObject())) {
        return null;
    }
    String FringeOrSalaryCode = accountingLine.getLaborObject().getFinancialObjectFringeOrSalaryCode();
    if (!LaborConstants.SalaryExpenseTransfer.LABOR_LEDGER_SALARY_CODE.equals(FringeOrSalaryCode)) {
        return null;
    }
    Integer payrollFiscalyear = accountingLine.getPayrollEndDateFiscalYear();
    String chartOfAccountsCode = accountingLine.getChartOfAccountsCode();
    String objectCode = accountingLine.getFinancialObjectCode();
    Collection<PositionObjectBenefit> positionObjectBenefits = SpringContext.getBean(LaborPositionObjectBenefitService.class).getActivePositionObjectBenefits(payrollFiscalyear, chartOfAccountsCode, objectCode);
    List<LaborLedgerPendingEntry> benefitPendingEntries = new ArrayList<LaborLedgerPendingEntry>();
    for (PositionObjectBenefit positionObjectBenefit : positionObjectBenefits) {
        positionObjectBenefit.setLaborBenefitRateCategoryCode(accountingLine.getAccount().getLaborBenefitRateCategoryCode());
        String fringeBenefitObjectCode = retrieveFringeBenefitObjectCode(accountingLine, chartOfAccountsCode);
        KualiDecimal benefitAmount = SpringContext.getBean(LaborBenefitsCalculationService.class).calculateFringeBenefit(positionObjectBenefit, accountingLine.getAmount(), accountingLine.getAccountNumber(), accountingLine.getSubAccountNumber());
        if (benefitAmount.isNonZero() && positionObjectBenefit.getBenefitsCalculation().isActive()) {
            ParameterService parameterService = SpringContext.getBean(ParameterService.class);
            Boolean enableFringeBenefitCalculationByBenefitRate = parameterService.getParameterValueAsBoolean(KfsParameterConstants.FINANCIAL_SYSTEM_ALL.class, LaborConstants.BenefitCalculation.ENABLE_FRINGE_BENEFIT_CALC_BY_BENEFIT_RATE_CATEGORY_PARAMETER);
            // If fringeBenefitObjectCode is empty and its enable to use calculation by benefit rate
            if (StringUtils.isEmpty(fringeBenefitObjectCode) && enableFringeBenefitCalculationByBenefitRate) {
                String laborBenefitRateCategoryCode = positionObjectBenefit.getLaborBenefitRateCategoryCode();
                // Use parameter default if labor benefit rate category code is blank
                if (StringUtils.isBlank(laborBenefitRateCategoryCode)) {
                    laborBenefitRateCategoryCode = parameterService.getParameterValueAsString(Account.class, LaborConstants.BenefitCalculation.DEFAULT_BENEFIT_RATE_CATEGORY_CODE_PARAMETER);
                }
                // create a  map for the search criteria to lookup the fringe benefit percentage
                Map<String, Object> fieldValues = new HashMap<String, Object>();
                fieldValues.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, positionObjectBenefit.getUniversityFiscalYear());
                fieldValues.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, positionObjectBenefit.getChartOfAccountsCode());
                fieldValues.put(LaborPropertyConstants.POSITION_BENEFIT_TYPE_CODE, positionObjectBenefit.getFinancialObjectBenefitsTypeCode());
                fieldValues.put(LaborPropertyConstants.LABOR_BENEFIT_RATE_CATEGORY_CODE, laborBenefitRateCategoryCode);
                BenefitsCalculation bc = (BenefitsCalculation) SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(BenefitsCalculation.class, fieldValues);
                fringeBenefitObjectCode = bc.getPositionFringeBenefitObjectCode();
            }
            List<LaborLedgerPendingEntry> pendingEntries = generateBenefitPendingEntries(document, accountingLine, sequenceHelper, benefitAmount, fringeBenefitObjectCode);
            benefitPendingEntries.addAll(pendingEntries);
        }
    }
    return benefitPendingEntries;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) BenefitsCalculation(org.kuali.kfs.module.ld.businessobject.BenefitsCalculation) LaborBenefitsCalculationService(org.kuali.kfs.module.ld.service.LaborBenefitsCalculationService) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) KfsParameterConstants(org.kuali.kfs.sys.service.impl.KfsParameterConstants) PositionObjectBenefit(org.kuali.kfs.module.ld.businessobject.PositionObjectBenefit) LaborLedgerPendingEntry(org.kuali.kfs.module.ld.businessobject.LaborLedgerPendingEntry) LaborPositionObjectBenefitService(org.kuali.kfs.module.ld.service.LaborPositionObjectBenefitService) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 5 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocument method isAwardReviewRequired.

protected boolean isAwardReviewRequired() {
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    boolean objectCodeAllowed = true;
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            objectCodeAllowed = isObjectCodeAllowedForAwardRouting(accountingLine, parameterService);
            // level.
            if (objectCodeAllowed) {
                return objectCodeAllowed;
            }
        }
    }
    return objectCodeAllowed;
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)29 ArrayList (java.util.ArrayList)9 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)9 List (java.util.List)4 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)4 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)4 ParameterEvaluator (org.kuali.rice.core.api.parameter.ParameterEvaluator)4 ParameterEvaluatorService (org.kuali.rice.core.api.parameter.ParameterEvaluatorService)4 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)3 HashMap (java.util.HashMap)3 Account (org.kuali.kfs.coa.businessobject.Account)3 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)3 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)3 KfsParameterConstants (org.kuali.kfs.sys.service.impl.KfsParameterConstants)3 EntityAddress (org.kuali.rice.kim.api.identity.address.EntityAddress)3 Date (java.sql.Date)2 ParseException (java.text.ParseException)2 Calendar (java.util.Calendar)2 BenefitsCalculation (org.kuali.kfs.module.ld.businessobject.BenefitsCalculation)2 PreEncumbranceSourceAccountingLine (edu.cornell.kfs.fp.businessobject.PreEncumbranceSourceAccountingLine)1