use of org.estatio.module.budget.dom.partioning.Partitioning in project estatio by estatio.
the class BudgetAssignmentService method createBudgetCalculationResults.
public void createBudgetCalculationResults(final BudgetCalculationRun run) {
run.removeCalculationResults();
for (Partitioning partitioning : run.getBudget().getPartitionings()) {
for (Charge invoiceCharge : partitioning.getDistinctInvoiceCharges()) {
BudgetCalculationResult result = run.createCalculationResult(invoiceCharge);
result.calculate();
}
}
}
use of org.estatio.module.budget.dom.partioning.Partitioning in project estatio by estatio.
the class PartitioningBuilder method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
checkParam("budget", executionContext, Budget.class);
defaultParam("startDate", executionContext, budget.getStartDate());
defaultParam("endDate", executionContext, budget.getEndDate());
defaultParam("budgetCalculationType", executionContext, BudgetCalculationType.BUDGETED);
Partitioning partitioning = partitioningRepository.newPartitioning(budget, startDate, endDate, budgetCalculationType);
executionContext.addResult(this, partitioning);
for (ItemSpec spec : itemSpec) {
final Charge itemCharge = spec.itemCharge;
final BudgetItem budgetItem = budget.findByCharge(itemCharge);
PartitionItem partitionItem = partitionItemRepository.newPartitionItem(partitioning, spec.charge, spec.keyTable, budgetItem, spec.percentage);
executionContext.addResult(this, partitionItem);
}
object = partitioning;
}
use of org.estatio.module.budget.dom.partioning.Partitioning in project estatio by estatio.
the class PartitionItemImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
Property property = propertyRepository.findPropertyByReference(propertyReference);
if (property == null)
throw new ApplicationException(String.format("Property with reference [%s] not found.", propertyReference));
final Budget budget = budgetRepository.findOrCreateBudget(property, startDate, endDate);
final KeyTable keyTable = keyTableRepository.findOrCreateBudgetKeyTable(budget, keyTableName, FoundationValueType.MANUAL, KeyValueMethod.PERCENT, 6);
findOrCreateBudgetKeyItem(keyTable, unitRepository.findUnitByReference(unitReference), keyValue, sourceValue);
final Charge charge = fetchCharge(budgetChargeReference);
final BudgetItem butgetItem = findOrCreateBudgetItem(budget, charge, budgetValue);
final Charge scheduleCharge = fetchCharge(invoiceChargeReference);
final Partitioning partitioning = findOrCreatePartitioning(budget);
findOrCreatePartitionItem(partitioning, scheduleCharge, butgetItem, keyTable, percentage);
return Lists.newArrayList();
}
Aggregations