Search in sources :

Example 1 with PayrollPreparation

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

the class PayrollPreparationController method fillInPayrollPreparation.

public void fillInPayrollPreparation(ActionRequest request, ActionResponse response) throws AxelorException {
    PayrollPreparation payrollPreparation = request.getContext().asType(PayrollPreparation.class);
    List<PayrollLeave> payrollLeaveList = Beans.get(PayrollPreparationService.class).fillInPayrollPreparation(payrollPreparation);
    response.setValue("extraHoursLineList", payrollPreparation.getExtraHoursLineList());
    response.setValue("$payrollLeavesList", payrollLeaveList);
    response.setValue("duration", payrollPreparation.getDuration());
    response.setValue("leaveDuration", payrollPreparation.getLeaveDuration());
    response.setValue("expenseAmount", payrollPreparation.getExpenseAmount());
    response.setValue("expenseList", payrollPreparation.getExpenseList());
    response.setValue("otherCostsEmployeeSet", payrollPreparation.getEmploymentContract().getOtherCostsEmployeeSet());
    response.setValue("annualGrossSalary", payrollPreparation.getEmploymentContract().getAnnualGrossSalary());
    response.setValue("employeeBonusMgtLineList", payrollPreparation.getEmployeeBonusMgtLineList());
    response.setValue("lunchVoucherNumber", payrollPreparation.getLunchVoucherNumber());
    response.setValue("lunchVoucherMgtLineList", payrollPreparation.getLunchVoucherMgtLineList());
    response.setValue("employeeBonusAmount", payrollPreparation.getEmployeeBonusAmount());
    response.setValue("extraHoursNumber", payrollPreparation.getExtraHoursNumber());
}
Also used : PayrollPreparationService(com.axelor.apps.hr.service.PayrollPreparationService) PayrollLeave(com.axelor.apps.hr.db.PayrollLeave) PayrollPreparation(com.axelor.apps.hr.db.PayrollPreparation)

Example 2 with PayrollPreparation

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

the class BatchPayrollPreparationExport method nibelisExport.

@Transactional(rollbackOn = { Exception.class })
public MetaFile nibelisExport(List<PayrollPreparation> payrollPreparationList) throws IOException, AxelorException {
    List<String[]> list = new ArrayList<>();
    for (PayrollPreparation payrollPreparation : payrollPreparationList) {
        payrollPreparation.addBatchListItem(batch);
        payrollPreparationService.exportNibelis(payrollPreparation, list);
        total++;
    }
    String fileName = Beans.get(PayrollPreparationService.class).getPayrollPreparationExportName();
    File file = MetaFiles.createTempFile(fileName, ".csv").toFile();
    CsvTool.csvWriter(file.getParent(), file.getName(), ';', Beans.get(PayrollPreparationService.class).getPayrollPreparationMeilleurGestionExportHeader(), list);
    FileInputStream inStream = new FileInputStream(file);
    MetaFile metaFile = Beans.get(MetaFiles.class).upload(inStream, file.getName());
    return metaFile;
}
Also used : MetaFiles(com.axelor.meta.MetaFiles) ArrayList(java.util.ArrayList) PayrollPreparationService(com.axelor.apps.hr.service.PayrollPreparationService) MetaFile(com.axelor.meta.db.MetaFile) PayrollPreparation(com.axelor.apps.hr.db.PayrollPreparation) File(java.io.File) MetaFile(com.axelor.meta.db.MetaFile) FileInputStream(java.io.FileInputStream) Transactional(com.google.inject.persist.Transactional)

Example 3 with PayrollPreparation

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

the class BatchPayrollPreparationExport method standardExport.

@Transactional(rollbackOn = { Exception.class })
public MetaFile standardExport(List<PayrollPreparation> payrollPreparationList) throws IOException {
    List<String[]> list = new ArrayList<>();
    LocalDate today = Beans.get(AppBaseService.class).getTodayDate(hrBatch.getCompany());
    for (PayrollPreparation payrollPreparation : payrollPreparationList) {
        String[] item = new String[5];
        item[0] = payrollPreparation.getEmployee().getName();
        item[1] = payrollPreparation.getDuration().toString();
        item[2] = payrollPreparation.getLunchVoucherNumber().toString();
        item[3] = payrollPreparation.getEmployeeBonusAmount().toString();
        item[4] = payrollPreparation.getExtraHoursNumber().toString();
        list.add(item);
        payrollPreparation.setExported(true);
        payrollPreparation.setExportDate(today);
        payrollPreparation.setExportTypeSelect(HrBatchRepository.EXPORT_TYPE_STANDARD);
        payrollPreparation.addBatchListItem(batch);
        payrollPreparationRepository.save(payrollPreparation);
        total++;
        incrementDone();
    }
    String fileName = Beans.get(PayrollPreparationService.class).getPayrollPreparationExportName();
    File file = MetaFiles.createTempFile(fileName, ".csv").toFile();
    CsvTool.csvWriter(file.getParent(), file.getName(), ';', Beans.get(PayrollPreparationService.class).getPayrollPreparationExportHeader(), list);
    FileInputStream inStream = new FileInputStream(file);
    MetaFile metaFile = Beans.get(MetaFiles.class).upload(inStream, file.getName());
    return metaFile;
}
Also used : MetaFiles(com.axelor.meta.MetaFiles) AppBaseService(com.axelor.apps.base.service.app.AppBaseService) ArrayList(java.util.ArrayList) PayrollPreparationService(com.axelor.apps.hr.service.PayrollPreparationService) MetaFile(com.axelor.meta.db.MetaFile) LocalDate(java.time.LocalDate) PayrollPreparation(com.axelor.apps.hr.db.PayrollPreparation) File(java.io.File) MetaFile(com.axelor.meta.db.MetaFile) FileInputStream(java.io.FileInputStream) Transactional(com.google.inject.persist.Transactional)

Example 4 with PayrollPreparation

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

the class BatchPayrollPreparationExport method silaeExport.

@Transactional(rollbackOn = { Exception.class })
public MetaFile silaeExport(List<PayrollPreparation> payrollPreparationList) throws IOException, AxelorException {
    List<String[]> list = new ArrayList<>();
    for (PayrollPreparation payrollPreparation : payrollPreparationList) {
        payrollPreparation.addBatchListItem(batch);
        payrollPreparationService.exportSilae(payrollPreparation, list);
        total++;
        incrementDone();
    }
    String fileName = payrollPreparationService.getPayrollPreparationExportName();
    File file = MetaFiles.createTempFile(fileName, ".csv").toFile();
    CsvTool.csvWriter(file.getParent(), file.getName(), ';', payrollPreparationService.getPayrollPreparationSilaeExportHeader(), list);
    FileInputStream inStream = new FileInputStream(file);
    MetaFile metaFile = Beans.get(MetaFiles.class).upload(inStream, file.getName());
    return metaFile;
}
Also used : MetaFiles(com.axelor.meta.MetaFiles) ArrayList(java.util.ArrayList) MetaFile(com.axelor.meta.db.MetaFile) PayrollPreparation(com.axelor.apps.hr.db.PayrollPreparation) File(java.io.File) MetaFile(com.axelor.meta.db.MetaFile) FileInputStream(java.io.FileInputStream) Transactional(com.google.inject.persist.Transactional)

Example 5 with PayrollPreparation

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

the class PayrollPreparationController method fillInPayrollPreparationLeaves.

public void fillInPayrollPreparationLeaves(ActionRequest request, ActionResponse response) throws AxelorException {
    PayrollPreparation payrollPreparation = request.getContext().asType(PayrollPreparation.class);
    List<PayrollLeave> payrollLeaveList = Beans.get(PayrollPreparationService.class).fillInLeaves(payrollPreparation);
    response.setValue("$payrollLeavesList", payrollLeaveList);
}
Also used : PayrollPreparationService(com.axelor.apps.hr.service.PayrollPreparationService) PayrollLeave(com.axelor.apps.hr.db.PayrollLeave) PayrollPreparation(com.axelor.apps.hr.db.PayrollPreparation)

Aggregations

PayrollPreparation (com.axelor.apps.hr.db.PayrollPreparation)8 PayrollPreparationService (com.axelor.apps.hr.service.PayrollPreparationService)5 Transactional (com.google.inject.persist.Transactional)4 MetaFiles (com.axelor.meta.MetaFiles)3 MetaFile (com.axelor.meta.db.MetaFile)3 File (java.io.File)3 FileInputStream (java.io.FileInputStream)3 ArrayList (java.util.ArrayList)3 PayrollLeave (com.axelor.apps.hr.db.PayrollLeave)2 Company (com.axelor.apps.base.db.Company)1 Period (com.axelor.apps.base.db.Period)1 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)1 EmploymentContract (com.axelor.apps.hr.db.EmploymentContract)1 EmploymentContractRepository (com.axelor.apps.hr.db.repo.EmploymentContractRepository)1 PayrollPreparationRepository (com.axelor.apps.hr.db.repo.PayrollPreparationRepository)1 AxelorException (com.axelor.exception.AxelorException)1 LocalDate (java.time.LocalDate)1