use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class ObjectCodeServiceImpl method getObjectCodeNamesByCharts.
@Override
public String getObjectCodeNamesByCharts(Integer universityFiscalYear, String[] chartOfAccountCodes, String financialObjectCode) {
String onlyObjectCodeName = "";
SortedSet<String> objectCodeNames = new TreeSet<>();
for (String chartOfAccountsCode : chartOfAccountCodes) {
ObjectCode objCode = this.getByPrimaryId(universityFiscalYear, chartOfAccountsCode, financialObjectCode);
if (objCode != null) {
onlyObjectCodeName = objCode.getFinancialObjectCodeName();
objectCodeNames.add(objCode.getFinancialObjectCodeName());
} else {
onlyObjectCodeName = "Not Found";
}
}
if (objectCodeNames.size() > 1) {
return StringUtils.join(objectCodeNames.toArray(), ", ");
} else {
return onlyObjectCodeName;
}
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class AssetGlobalServiceImpl method setupAsset.
/**
* Creates a new Asset appropriate for either create new or separate. This does not create the payments for this
* asset.
*
* @param assetGlobal containing data for the asset to be created
* @param assetGlobalDetail containing data for the asset to be created
* @param separate indicating whether this is a separate and asset or not
* @return set of assets appropriate for this creation without payments
*/
protected Asset setupAsset(AssetGlobal assetGlobal, AssetGlobalDetail assetGlobalDetail, boolean separate) {
Asset asset = new Asset(assetGlobal, assetGlobalDetail, separate);
// set financialObjectSubTypeCode per first payment entry if one exists
if (!assetGlobal.getAssetPaymentDetails().isEmpty() && ObjectUtils.isNotNull(assetGlobal.getAssetPaymentDetails().get(0).getObjectCode())) {
AssetPaymentDetail assetPaymentDetail = assetGlobal.getAssetPaymentDetails().get(0);
ObjectCode objectCode = objectCodeService.getByPrimaryIdForCurrentYear(assetPaymentDetail.getChartOfAccountsCode(), assetPaymentDetail.getFinancialObjectCode());
asset.setFinancialObjectSubTypeCode(objectCode.getFinancialObjectSubTypeCode());
}
// create off campus location for each asset only if it was filled in
boolean offCampus = StringUtils.isNotBlank(assetGlobalDetail.getOffCampusName()) || StringUtils.isNotBlank(assetGlobalDetail.getOffCampusAddress()) || StringUtils.isNotBlank(assetGlobalDetail.getOffCampusCityName()) || StringUtils.isNotBlank(assetGlobalDetail.getOffCampusStateCode()) || StringUtils.isNotBlank(assetGlobalDetail.getOffCampusZipCode()) || StringUtils.isNotBlank(assetGlobalDetail.getOffCampusCountryCode());
if (offCampus) {
setupAssetLocationOffCampus(assetGlobalDetail, asset);
}
// set specific values for new assets if document is Asset Separate
if (separate) {
KualiDecimal divisor = assetGlobal.getSeparateSourceCapitalAsset().getTotalCostAmount();
if (divisor.isZero()) {
asset.setSalvageAmount(KualiDecimal.ZERO);
asset.setReplacementAmount(KualiDecimal.ZERO);
asset.setFabricationEstimatedTotalAmount(KualiDecimal.ZERO);
} else {
double separateRatio = assetGlobalDetail.getSeparateSourceAmount().doubleValue() / divisor.doubleValue();
asset.setSalvageAmount(KualiDecimalUtils.safeMultiply(assetGlobal.getSeparateSourceCapitalAsset().getSalvageAmount(), separateRatio));
asset.setReplacementAmount(KualiDecimalUtils.safeMultiply(assetGlobal.getSeparateSourceCapitalAsset().getReplacementAmount(), separateRatio));
asset.setFabricationEstimatedTotalAmount(KualiDecimalUtils.safeMultiply(assetGlobal.getSeparateSourceCapitalAsset().getFabricationEstimatedTotalAmount(), separateRatio));
}
Date lastInventoryDate = assetGlobal.getLastInventoryDate();
if (lastInventoryDate != null) {
asset.setLastInventoryDate(new Timestamp(lastInventoryDate.getTime()));
}
}
return asset;
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class AssetGlobalServiceImpl method setupCreateNewAssetPayment.
/**
* Creates a payment for an asset in create new mode.
*
* @param capitalAssetNumber to use for the payment
* @param acquisitionTypeCode for logic in determining how dates are to be set
* @param assetGlobalDetailsSize for logic in determining depreciation amounts (if asset is depreciable)
* @param assetGlobalDetailsIndex for logic in determining depreciation amounts (if asset is depreciable)
* @param assetPaymentDetail containing data for the payment
* @return payment for an asset in create new
*/
protected AssetPayment setupCreateNewAssetPayment(Long capitalAssetNumber, String acquisitionTypeCode, int assetGlobalDetailsSize, int assetGlobalDetailsIndex, AssetPaymentDetail assetPaymentDetail) {
AssetPayment assetPayment = new AssetPayment(assetPaymentDetail, acquisitionTypeCode);
assetPayment.setCapitalAssetNumber(capitalAssetNumber);
assetPayment.setPaymentSequenceNumber(assetPaymentDetail.getSequenceNumber());
assetPayment.setTransferPaymentCode(CamsConstants.AssetPayment.TRANSFER_PAYMENT_CODE_N);
// Running this every time of the loop is inefficient, could be put into HashMap
KualiDecimal[] amountBuckets = KualiDecimalUtils.allocateByQuantity(assetPaymentDetail.getAmount(), assetGlobalDetailsSize);
assetPayment.setAccountChargeAmount(amountBuckets[assetGlobalDetailsIndex]);
ObjectCode objectCode = objectCodeService.getByPrimaryIdForCurrentYear(assetPayment.getChartOfAccountsCode(), assetPayment.getFinancialObjectCode());
boolean isDepreciablePayment = ObjectUtils.isNotNull(assetPaymentDetail.getObjectCode()) && !Arrays.asList(parameterService.getParameterValueAsString(AssetDepreciationStep.class, CamsParameterConstants.NON_DEPRECIABLE_FEDERALLY_OWNED_OBJECT_SUB_TYPES).split(";")).contains(objectCode.getFinancialObjectSubTypeCode());
if (isDepreciablePayment) {
assetPayment.setPrimaryDepreciationBaseAmount(amountBuckets[assetGlobalDetailsIndex]);
} else {
assetPayment.setPrimaryDepreciationBaseAmount(KualiDecimal.ZERO);
}
return assetPayment;
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class LaborPendingEntryGenerator method refreshObjectCodeNonUpdateableReferences.
/**
* refreshes labor ledger pending entry's object codes.
*
* @param llpes
*/
public static void refreshObjectCodeNonUpdateableReferences(List<LaborLedgerPendingEntry> llpes) {
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
// refresh nonupdateable references for financial object...
Map<String, String> primaryKeys = new HashMap<>();
for (LaborLedgerPendingEntry llpe : llpes) {
primaryKeys.put("financialObjectCode", llpe.getFinancialObjectCode());
ObjectCode objectCode = bos.findByPrimaryKey(ObjectCode.class, primaryKeys);
llpe.setFinancialObject(objectCode);
}
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class MockObjectCodeService method getByPrimaryIdForCurrentYear.
@Override
public ObjectCode getByPrimaryIdForCurrentYear(String chartOfAccountsCode, String financialObjectCode) {
ObjectCode objectCode = null;
if (ConcurAccountValidationTestConstants.VALID_CHART.equalsIgnoreCase(chartOfAccountsCode) && ConcurAccountValidationTestConstants.VALID_OBJ_CD.equalsIgnoreCase(financialObjectCode)) {
objectCode = createObjectCode(chartOfAccountsCode, financialObjectCode);
objectCode.setActive(true);
}
if (ConcurAccountValidationTestConstants.VALID_CHART.equalsIgnoreCase(chartOfAccountsCode) && ConcurAccountValidationTestConstants.INACTIVE_OBJ_CD.equalsIgnoreCase(financialObjectCode)) {
objectCode = createObjectCode(chartOfAccountsCode, financialObjectCode);
objectCode.setActive(false);
}
return objectCode;
}
Aggregations