Search in sources :

Example 1 with Budget

use of com.axelor.apps.account.db.Budget in project axelor-open-suite by axelor.

the class BudgetSupplychainService method updateBudgetLinesFromPurchaseOrder.

public void updateBudgetLinesFromPurchaseOrder(PurchaseOrder purchaseOrder) {
    List<PurchaseOrderLine> purchaseOrderLineList = purchaseOrder.getPurchaseOrderLineList();
    if (purchaseOrderLineList == null) {
        return;
    }
    purchaseOrderLineList.stream().flatMap(x -> x.getBudgetDistributionList().stream()).forEach(budgetDistribution -> {
        Budget budget = budgetDistribution.getBudget();
        updateLines(budget);
        computeTotalAmountCommitted(budget);
    });
}
Also used : PurchaseOrderLine(com.axelor.apps.purchase.db.PurchaseOrderLine) PurchaseOrderLine(com.axelor.apps.purchase.db.PurchaseOrderLine) BudgetLineRepository(com.axelor.apps.account.db.repo.BudgetLineRepository) Budget(com.axelor.apps.account.db.Budget) PurchaseOrderRepository(com.axelor.apps.purchase.db.repo.PurchaseOrderRepository) BudgetDistributionRepository(com.axelor.apps.account.db.repo.BudgetDistributionRepository) Inject(com.google.inject.Inject) Invoice(com.axelor.apps.account.db.Invoice) Transactional(com.google.inject.persist.Transactional) BigDecimal(java.math.BigDecimal) BudgetService(com.axelor.apps.account.service.BudgetService) List(java.util.List) BudgetLine(com.axelor.apps.account.db.BudgetLine) InvoiceRepository(com.axelor.apps.account.db.repo.InvoiceRepository) Beans(com.axelor.inject.Beans) InvoiceLine(com.axelor.apps.account.db.InvoiceLine) BudgetRepository(com.axelor.apps.account.db.repo.BudgetRepository) PurchaseOrder(com.axelor.apps.purchase.db.PurchaseOrder) LocalDate(java.time.LocalDate) Optional(java.util.Optional) AppSupplychainService(com.axelor.apps.supplychain.service.app.AppSupplychainService) BudgetDistribution(com.axelor.apps.account.db.BudgetDistribution) DateTool(com.axelor.apps.tool.date.DateTool) Budget(com.axelor.apps.account.db.Budget)

Example 2 with Budget

use of com.axelor.apps.account.db.Budget in project axelor-open-suite by axelor.

the class BudgetController method computeTotalAmountRealized.

public void computeTotalAmountRealized(ActionRequest request, ActionResponse response) {
    try {
        Budget budget = request.getContext().asType(Budget.class);
        budget = Beans.get(BudgetRepository.class).find(budget.getId());
        response.setValue("totalAmountRealized", Beans.get(BudgetService.class).computeTotalAmountRealized(budget));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Budget(com.axelor.apps.account.db.Budget)

Example 3 with Budget

use of com.axelor.apps.account.db.Budget in project axelor-open-suite by axelor.

the class BudgetController method validate.

public void validate(ActionRequest request, ActionResponse response) {
    try {
        Budget budget = request.getContext().asType(Budget.class);
        budget = Beans.get(BudgetRepository.class).find(budget.getId());
        Beans.get(BudgetService.class).validate(budget);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Budget(com.axelor.apps.account.db.Budget) BudgetService(com.axelor.apps.account.service.BudgetService)

Example 4 with Budget

use of com.axelor.apps.account.db.Budget in project axelor-open-suite by axelor.

the class BudgetController method generatePeriods.

public void generatePeriods(ActionRequest request, ActionResponse response) {
    try {
        Budget budget = request.getContext().asType(Budget.class);
        response.setValue("budgetLineList", Beans.get(BudgetService.class).generatePeriods(budget));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Budget(com.axelor.apps.account.db.Budget)

Example 5 with Budget

use of com.axelor.apps.account.db.Budget in project axelor-open-suite by axelor.

the class BudgetController method checkSharedDates.

public void checkSharedDates(ActionRequest request, ActionResponse response) {
    try {
        Budget budget = request.getContext().asType(Budget.class);
        Beans.get(BudgetService.class).checkSharedDates(budget);
    } catch (Exception e) {
        response.setError(e.getMessage());
    }
}
Also used : Budget(com.axelor.apps.account.db.Budget) BudgetService(com.axelor.apps.account.service.BudgetService)

Aggregations

Budget (com.axelor.apps.account.db.Budget)11 BudgetService (com.axelor.apps.account.service.BudgetService)5 BudgetDistribution (com.axelor.apps.account.db.BudgetDistribution)3 BudgetLine (com.axelor.apps.account.db.BudgetLine)3 Transactional (com.google.inject.persist.Transactional)3 BigDecimal (java.math.BigDecimal)3 Invoice (com.axelor.apps.account.db.Invoice)2 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)2 BudgetDistributionRepository (com.axelor.apps.account.db.repo.BudgetDistributionRepository)2 BudgetLineRepository (com.axelor.apps.account.db.repo.BudgetLineRepository)2 BudgetRepository (com.axelor.apps.account.db.repo.BudgetRepository)2 InvoiceRepository (com.axelor.apps.account.db.repo.InvoiceRepository)2 PurchaseOrderLine (com.axelor.apps.purchase.db.PurchaseOrderLine)2 Beans (com.axelor.inject.Beans)2 Inject (com.google.inject.Inject)2 LocalDate (java.time.LocalDate)2 List (java.util.List)2 Optional (java.util.Optional)2 IExceptionMessage (com.axelor.apps.account.exception.IExceptionMessage)1 PurchaseOrder (com.axelor.apps.purchase.db.PurchaseOrder)1