Search in sources :

Example 1 with Partitioning

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();
        }
    }
}
Also used : Partitioning(org.estatio.module.budget.dom.partioning.Partitioning) LeaseTermForServiceCharge(org.estatio.module.lease.dom.LeaseTermForServiceCharge) Charge(org.estatio.module.charge.dom.Charge) BudgetCalculationResult(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResult)

Example 2 with Partitioning

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;
}
Also used : Partitioning(org.estatio.module.budget.dom.partioning.Partitioning) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) Charge(org.estatio.module.charge.dom.Charge) PartitionItem(org.estatio.module.budget.dom.partioning.PartitionItem)

Example 3 with 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();
}
Also used : ApplicationException(org.apache.isis.applib.ApplicationException) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) Partitioning(org.estatio.module.budget.dom.partioning.Partitioning) Charge(org.estatio.module.charge.dom.Charge) Budget(org.estatio.module.budget.dom.budget.Budget) KeyTable(org.estatio.module.budget.dom.keytable.KeyTable) Property(org.estatio.module.asset.dom.Property) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

Partitioning (org.estatio.module.budget.dom.partioning.Partitioning)3 Charge (org.estatio.module.charge.dom.Charge)3 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)2 ApplicationException (org.apache.isis.applib.ApplicationException)1 Programmatic (org.apache.isis.applib.annotation.Programmatic)1 Property (org.estatio.module.asset.dom.Property)1 Budget (org.estatio.module.budget.dom.budget.Budget)1 KeyTable (org.estatio.module.budget.dom.keytable.KeyTable)1 PartitionItem (org.estatio.module.budget.dom.partioning.PartitionItem)1 BudgetCalculationResult (org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResult)1 LeaseTermForServiceCharge (org.estatio.module.lease.dom.LeaseTermForServiceCharge)1