Search in sources :

Example 1 with EmployeeBonusMgt

use of com.axelor.apps.hr.db.EmployeeBonusMgt in project axelor-open-suite by axelor.

the class EmployeeBonusController method print.

public void print(ActionRequest request, ActionResponse response) throws AxelorException {
    EmployeeBonusMgt bonus = Beans.get(EmployeeBonusMgtRepository.class).find(request.getContext().asType(EmployeeBonusMgt.class).getId());
    String name = I18n.get("Employee bonus management") + " :  " + bonus.getEmployeeBonusType().getLabel();
    String fileLink = ReportFactory.createReport(IReport.EMPLOYEE_BONUS_MANAGEMENT, name).addParam("EmployeeBonusMgtId", bonus.getId()).addParam("Timezone", bonus.getCompany() != null ? bonus.getCompany().getTimezone() : null).addParam("Locale", ReportSettings.getPrintingLocale(null)).toAttach(bonus).generate().getFileLink();
    response.setView(ActionView.define(name).add("html", fileLink).map());
}
Also used : EmployeeBonusMgt(com.axelor.apps.hr.db.EmployeeBonusMgt) EmployeeBonusMgtRepository(com.axelor.apps.hr.db.repo.EmployeeBonusMgtRepository)

Example 2 with EmployeeBonusMgt

use of com.axelor.apps.hr.db.EmployeeBonusMgt in project axelor-open-suite by axelor.

the class EmployeeBonusController method compute.

public void compute(ActionRequest request, ActionResponse response) {
    EmployeeBonusMgt employeeBonusMgt = request.getContext().asType(EmployeeBonusMgt.class);
    PeriodService periodService = Beans.get(PeriodService.class);
    try {
        employeeBonusMgt = Beans.get(EmployeeBonusMgtRepository.class).find(employeeBonusMgt.getId());
        Beans.get(EmployeeBonusService.class).compute(employeeBonusMgt);
        response.setReload(true);
        periodService.checkPeriod(employeeBonusMgt.getPayPeriod());
        periodService.checkPeriod(employeeBonusMgt.getLeavePeriod());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : EmployeeBonusMgt(com.axelor.apps.hr.db.EmployeeBonusMgt) EmployeeBonusService(com.axelor.apps.hr.service.EmployeeBonusService) PeriodService(com.axelor.apps.base.service.PeriodService) AxelorException(com.axelor.exception.AxelorException)

Aggregations

EmployeeBonusMgt (com.axelor.apps.hr.db.EmployeeBonusMgt)2 PeriodService (com.axelor.apps.base.service.PeriodService)1 EmployeeBonusMgtRepository (com.axelor.apps.hr.db.repo.EmployeeBonusMgtRepository)1 EmployeeBonusService (com.axelor.apps.hr.service.EmployeeBonusService)1 AxelorException (com.axelor.exception.AxelorException)1