use of org.estatio.module.budget.dom.budgetitem.BudgetItem in project estatio by estatio.
the class Budget method removeAllBudgetItems.
@Action(restrictTo = RestrictTo.PROTOTYPING, semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout()
public Budget removeAllBudgetItems() {
for (BudgetItem budgetItem : this.getItems()) {
for (PartitionItem pItem : budgetItem.getPartitionItems()) {
pItem.remove();
}
getContainer().remove(budgetItem);
getContainer().flush();
}
return this;
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItem in project estatio by estatio.
the class BudgetCalculationRepository method findByBudget.
public List<BudgetCalculation> findByBudget(final Budget budget) {
List<BudgetCalculation> result = new ArrayList<>();
for (BudgetItem item : budget.getItems()) {
result.addAll(findByBudgetItemAndCalculationType(item, BudgetCalculationType.ACTUAL));
result.addAll(findByBudgetItemAndCalculationType(item, BudgetCalculationType.BUDGETED));
}
return result;
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItem in project estatio by estatio.
the class BudgetCalculationService method getAllCalculations.
public List<BudgetCalculationViewmodel> getAllCalculations(final Budget budget) {
List<BudgetCalculationViewmodel> budgetCalculationViewmodels = new ArrayList<>();
for (BudgetItem budgetItem : budget.getItems()) {
budgetCalculationViewmodels.addAll(calculate(budgetItem, BudgetCalculationType.BUDGETED));
budgetCalculationViewmodels.addAll(calculate(budgetItem, BudgetCalculationType.ACTUAL));
}
return budgetCalculationViewmodels;
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItem in project estatio by estatio.
the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem.
@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem() throws Exception {
// given
Order order = new Order();
OrderItem item1 = new OrderItem();
order.getItems().add(item1);
order.setOrderNumber("123");
order.setBuyer(new Organisation());
order.setSeller(new Organisation());
item1.setNetAmount(new BigDecimal("100"));
item1.setDescription("blah");
item1.setGrossAmount(BigDecimal.ZERO);
item1.setCharge(new Charge());
item1.setStartDate(new LocalDate());
item1.setEndDate(new LocalDate());
item1.setProperty(new Property());
// when
item1.setBudgetItem(new BudgetItem());
item1.setProject(new Project());
String result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("(on item) either project or budget item - not both required");
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItem in project estatio by estatio.
the class Order_Test method splitItem_mixin_works.
@Test
public void splitItem_mixin_works() throws Exception {
// given
Order order = new Order();
order.orderItemRepository = mockOrderItemRepository;
String description = "some description";
Tax tax = new Tax();
Charge charge = new Charge();
Property property = new Property();
Project project = new Project();
BudgetItem budgetItem = new BudgetItem();
String period = "F2018";
OrderItem itemToSplit = new OrderItem();
BigDecimal newItemNetAmount = new BigDecimal("50.00");
BigDecimal newItemVatAmount = new BigDecimal("10");
BigDecimal newItemGrossAmount = new BigDecimal("60.00");
// expect
context.checking(new Expectations() {
{
oneOf(mockOrderItemRepository).upsert(order, charge, description, newItemNetAmount, newItemVatAmount, newItemGrossAmount, tax, PeriodUtil.yearFromPeriod(period).startDate(), PeriodUtil.yearFromPeriod(period).endDate(), property, project, budgetItem);
}
});
// when
order.splitItem(itemToSplit, description, newItemNetAmount, newItemVatAmount, tax, newItemGrossAmount, charge, property, project, budgetItem, period);
}
Aggregations