Search in sources :

Example 11 with Employee

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

the class EmployeeController method printEmployeeReport.

public void printEmployeeReport(ActionRequest request, ActionResponse response) throws AxelorException {
    Employee employee = request.getContext().asType(Employee.class);
    String name = I18n.get("Employee");
    String fileLink = ReportFactory.createReport(IReport.EMPLOYEE, name + "-${date}").addParam("EmployeeId", employee.getId()).addParam("Timezone", getTimezone(employee.getUser())).addParam("Locale", ReportSettings.getPrintingLocale(null)).generate().getFileLink();
    LOG.debug("Printing " + name);
    response.setView(ActionView.define(name).add("html", fileLink).map());
}
Also used : Employee(com.axelor.apps.hr.db.Employee)

Example 12 with Employee

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

the class EmployeeController method generateNewDPAE.

public void generateNewDPAE(ActionRequest request, ActionResponse response) {
    Employee employee = request.getContext().asType(Employee.class);
    employee = Beans.get(EmployeeRepository.class).find(employee.getId());
    try {
        Long dpaeId = Beans.get(EmployeeService.class).generateNewDPAE(employee);
        ActionViewBuilder builder = ActionView.define(I18n.get("DPAE")).model(DPAE.class.getName()).add("grid", "dpae-grid").add("form", "dpae-form").param("search-filters", "dpae-filters").context("_showRecord", dpaeId);
        response.setView(builder.map());
    } catch (AxelorException e) {
        TraceBackService.trace(response, e);
    }
    response.setReload(true);
}
Also used : DPAE(com.axelor.apps.hr.db.DPAE) AxelorException(com.axelor.exception.AxelorException) Employee(com.axelor.apps.hr.db.Employee) EmployeeService(com.axelor.apps.hr.service.employee.EmployeeService) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 13 with Employee

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

the class TimesheetController method historicTimesheetLine.

public void historicTimesheetLine(ActionRequest request, ActionResponse response) {
    User user = AuthUtils.getUser();
    Employee employee = user.getEmployee();
    ActionViewBuilder actionView = ActionView.define(I18n.get("See timesheet lines")).model(TimesheetLine.class.getName()).add("grid", "timesheet-line-grid").add("form", "timesheet-line-form");
    actionView.domain("self.timesheet.company = :_activeCompany AND (self.timesheet.statusSelect = 3 OR self.timesheet.statusSelect = 4)").context("_activeCompany", user.getActiveCompany());
    if (employee == null || !employee.getHrManager()) {
        actionView.domain(actionView.get().getDomain() + " AND self.timesheet.user.employee.managerUser = :_user").context("_user", user);
    }
    response.setView(actionView.map());
}
Also used : User(com.axelor.auth.db.User) Employee(com.axelor.apps.hr.db.Employee) TimesheetLine(com.axelor.apps.hr.db.TimesheetLine) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 14 with Employee

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

the class ExtraHoursController method validateExtraHours.

public void validateExtraHours(ActionRequest request, ActionResponse response) throws AxelorException {
    User user = AuthUtils.getUser();
    Employee employee = user.getEmployee();
    ActionViewBuilder actionView = ActionView.define(I18n.get("Extra hours to Validate")).model(ExtraHours.class.getName()).add("grid", "extra-hours-validate-grid").add("form", "extra-hours-form").param("search-filters", "extra-hours-filters");
    Beans.get(HRMenuValidateService.class).createValidateDomain(user, employee, actionView);
    response.setView(actionView.map());
}
Also used : User(com.axelor.auth.db.User) Employee(com.axelor.apps.hr.db.Employee) HRMenuValidateService(com.axelor.apps.hr.service.HRMenuValidateService) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 15 with Employee

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

the class LeaveController method historicLeave.

public void historicLeave(ActionRequest request, ActionResponse response) {
    try {
        User user = AuthUtils.getUser();
        Employee employee = user.getEmployee();
        ActionViewBuilder actionView = ActionView.define(I18n.get("Colleague Leave Requests")).model(LeaveRequest.class.getName()).add("grid", "leave-request-grid").add("form", "leave-request-form").param("search-filters", "leave-request-filters");
        actionView.domain("(self.statusSelect = 3 OR self.statusSelect = 4)");
        if (employee == null || !employee.getHrManager()) {
            actionView.domain(actionView.get().getDomain() + " AND self.user.employee.managerUser = :_user").context("_user", user);
        }
        response.setView(actionView.map());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : User(com.axelor.auth.db.User) Employee(com.axelor.apps.hr.db.Employee) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder) AxelorException(com.axelor.exception.AxelorException)

Aggregations

Employee (com.axelor.apps.hr.db.Employee)71 AxelorException (com.axelor.exception.AxelorException)34 User (com.axelor.auth.db.User)28 Transactional (com.google.inject.persist.Transactional)21 BigDecimal (java.math.BigDecimal)18 ActionViewBuilder (com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)14 LocalDate (java.time.LocalDate)13 TimesheetLine (com.axelor.apps.hr.db.TimesheetLine)9 EmployeeRepository (com.axelor.apps.hr.db.repo.EmployeeRepository)9 WeeklyPlanning (com.axelor.apps.base.db.WeeklyPlanning)8 Message (com.axelor.apps.message.db.Message)8 LeaveRequest (com.axelor.apps.hr.db.LeaveRequest)7 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 DayPlanning (com.axelor.apps.base.db.DayPlanning)6 LeaveLine (com.axelor.apps.hr.db.LeaveLine)6 LeaveService (com.axelor.apps.hr.service.leave.LeaveService)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 Company (com.axelor.apps.base.db.Company)5