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();
        }
      }
    }
  }
Example #2
0
  void find() {
    String query = "";
    try {
      query = m_table.getCriterion();
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage());
      return;
    }

    try {
      HRMBusinessLogic logic = new HRMBusinessLogic(m_conn);
      m_panel.reset(
          logic.getEmployeeByCriteria(m_sessionid, IDBConstants.MODUL_MASTER_DATA, query));
      if (m_panel.m_panel_rptEmployeProfile != null)
        m_panel.m_panel_rptEmployeProfile.m_employee = null;
      else if (m_panel.m_panel_rptPaycheq != null) m_panel.m_panel_rptPaycheq.m_employee = null;
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage(), "Warning", JOptionPane.WARNING_MESSAGE);
    }
  }
 public void onClick$btnSavePermissionType() {
   try {
     PermitionType permitionType =
         new PermitionType(code.getValue(), description.getValue(), days.getValue(), true);
     HRMBusinessLogic.getInstance(ConnectionUtil.getInstance().getConn())
         .createPermitionType(0, IDBConstants.MODUL_MASTER_DATA, permitionType);
     parent.prepareList();
     closeWindow();
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
Example #4
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();
 }