Search in sources :

Example 1 with PayrollPreparationService

use of com.axelor.apps.hr.service.PayrollPreparationService in project axelor-open-suite by axelor.

the class PayrollPreparationController method exportPayrollPreparation.

public void exportPayrollPreparation(ActionRequest request, ActionResponse response) throws IOException, AxelorException {
    PayrollPreparationService payrollPreparationService = Beans.get(PayrollPreparationService.class);
    PayrollPreparation payrollPreparation = Beans.get(PayrollPreparationRepository.class).find(request.getContext().asType(PayrollPreparation.class).getId());
    String file = payrollPreparationService.exportPayrollPreparation(payrollPreparation);
    if (file != null) {
        String[] filePath = file.split("/");
        response.setExportFile(filePath[filePath.length - 1]);
    }
    payrollPreparationService.closePayPeriodIfExported(payrollPreparation);
    response.setReload(true);
}
Also used : PayrollPreparationRepository(com.axelor.apps.hr.db.repo.PayrollPreparationRepository) PayrollPreparationService(com.axelor.apps.hr.service.PayrollPreparationService) PayrollPreparation(com.axelor.apps.hr.db.PayrollPreparation)

Aggregations

PayrollPreparation (com.axelor.apps.hr.db.PayrollPreparation)1 PayrollPreparationRepository (com.axelor.apps.hr.db.repo.PayrollPreparationRepository)1 PayrollPreparationService (com.axelor.apps.hr.service.PayrollPreparationService)1