private void saveCategoryEmployee(long masterId, PayrollCategory[] categories) throws Exception {

    String sql =
        "INSERT INTO "
            + IDBConstants.TABLE_PAYROLL_CATEGORY_EMPLOYEE_HISTORY
            + "("
            + IDBConstants.ATTR_HISTORY_MASTER
            + ","
            + IDBConstants.ATTR_CATEGORY
            + ","
            + IDBConstants.ATTR_EMPLOYEE
            + ")"
            + " values (?, ?, ?)";

    for (int i = 0; i < categories.length; i++) {
      PayrollCategory payrollCategory = categories[i];

      IHRMSQL iSql = new HRMSQLSAP();
      Employee[] employees =
          iSql.getPayrollCategoryEmployee(payrollCategory.getIndex(), connection);

      for (int j = 0; j < employees.length; j++) {
        Employee emp = employees[j];

        PreparedStatement stm = connection.prepareStatement(sql);

        stm.setLong(1, masterId);
        stm.setLong(2, payrollCategory.getNewIndex());
        stm.setLong(3, emp.getIndex());

        stm.executeUpdate();
      }
    }
  }
  private void saveEmployeeComponent(long masterId, PayrollCategory[] categories) throws Exception {
    String sql =
        "INSERT INTO "
            + IDBConstants.TABLE_EMPLOYEE_PAYROLL_COMPONENT_HISTORY
            + "("
            + IDBConstants.ATTR_HISTORY_MASTER
            + ","
            + IDBConstants.ATTR_EMPLOYEE
            + ","
            + IDBConstants.ATTR_COMPONENT
            + ","
            + IDBConstants.ATTR_FORMULA
            + ","
            + IDBConstants.ATTR_FORMULA_MONTH
            + ","
            + IDBConstants.ATTR_ROUND_VALUE
            + ","
            + IDBConstants.ATTR_PRECISION
            + ")"
            + " values (?, ?, ?, ?, ?, ?, ?)";

    for (int i = 0; i < categories.length; i++) {
      PayrollCategory payrollCategory = categories[i];

      IHRMSQL iSql = new HRMSQLSAP();
      Employee[] employees =
          iSql.getPayrollCategoryEmployee(payrollCategory.getIndex(), connection);

      for (int j = 0; j < employees.length; j++) {
        Employee emp = employees[j];

        HRMBusinessLogic logic = new HRMBusinessLogic(connection);

        PayrollCategoryComponent[] components =
            logic.getAllPayrollCategoryComponent(
                sessionId,
                IDBConstants.MODUL_MASTER_DATA,
                emp.getIndex(),
                IDBConstants.TABLE_EMPLOYEE_PAYROLL_COMPONENT);

        for (int k = 0; k < components.length; k++) {
          PayrollCategoryComponent comp = components[k];

          PreparedStatement stm = connection.prepareStatement(sql);

          stm.setLong(1, masterId);
          stm.setLong(2, emp.getIndex());
          stm.setLong(3, comp.getPayrollComponent().getIndex());
          stm.setString(4, comp.getFormulaEntity().getFormulaCode());
          stm.setInt(5, (int) comp.getEveryWhichMonth());
          stm.setInt(6, (int) comp.getFormulaEntity().getNumberRounding().getRoundingMode());
          stm.setInt(7, comp.getFormulaEntity().getNumberRounding().getPrecision());

          stm.executeUpdate();
        }
      }
    }
  }
Пример #3
0
 public void getNonEmpty(/*Employee employee*/ Object objemp, String month, String bln_thn) {
   if (objemp instanceof Employee) {
     m_employee = (Employee) objemp;
   }
   // m_employee = employee;
   m_model = new DefaultTableModel();
   tableHeader(m_model);
   getParamMap(m_conn, m_sessionid, bln_thn);
   CurrentEmployementRpt currentEmployementRpt = null;
   try {
     currentEmployementRpt =
         m_hrmlogic.getCurrentEmployementRpt(m_sessionid, "", m_employee.getIndex());
   } catch (Exception e) {
     e.printStackTrace();
   }
   String StrUnit = "";
   String strOrg = "";
   String strJobTitle = "";
   if (currentEmployementRpt != null) {
     StrUnit = currentEmployementRpt.getCode() + " " + currentEmployementRpt.getDes();
     strOrg = currentEmployementRpt.getOrg();
     strJobTitle = currentEmployementRpt.getJobtitle();
   }
   SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
   m_model.addRow(
       new Object[] {
         m_employee.getFirstName()
             + " "
             + m_employee.getMidleName()
             + " "
             + m_employee.getLastName(),
         m_employee.getEmployeeNo(),
         StrUnit,
         strOrg,
         strJobTitle,
         month,
         dateFormat.format(new Date())
       });
   close();
 }