Exemplo n.º 1
0
 private void saveattapprove() {
   serviceAttendanceProcess.updateapproveAtt_proc(
       attProcId, "Approved", null, userName, "ATT_PROC");
   serviceAttendanceProcess.updateapproveAtt_proc(
       attProcId, "Approved", null, userName, "ATT_ATTEN");
   serviceAttendanceProcess.procAttendenceApprove(
       companyId, (String) attProcId.toString(), userName);
   loadSrchRslt();
 }
Exemplo n.º 2
0
 /*
  * loadStartandEndDates()-->this function is used for load the start and end date
  */
 private void loadStartandEndDates() {
   try {
     SessionFactory sf = serviceAttendanceProcess.getConnection();
     Session session = sf.openSession();
     session.beginTransaction();
     session.doWork(
         new Work() {
           @Override
           public void execute(Connection connection) throws SQLException {
             // TODO Auto-generated method stub
             statement = connection.prepareCall("{ call PROC_DATE_CALC (?,?,?) }");
             statement.setLong(1, payPeriodId);
             statement.registerOutParameter(2, Types.VARCHAR);
             statement.registerOutParameter(3, Types.VARCHAR);
             statement.execute();
             startDate = statement.getString(2);
             endDate = statement.getString(3);
             connection.close();
           }
         });
     tfProcessPeriod.setReadOnly(false);
     tfProcessPeriod.setValue(" " + startDate + " to " + endDate);
     tfProcessPeriod.setReadOnly(true);
   } catch (Exception e) {
     logger.info("Load Start and end Date Using Procedure" + e);
   } finally {
     try {
       statement.close();
     } catch (SQLException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       logger.info("Load Start and end Date Using Procedure" + e);
     }
   }
 }
Exemplo n.º 3
0
 private void loadSrchRslt() {
   try {
     tblMstScrSrchRslt.removeAllItems();
     listAttendProc =
         serviceAttendanceProcess.getAttendenceProc(null, null, null, null, "Pending", "F");
     recordCnt = listAttendProc.size();
     beanAttendenceProcDM = new BeanItemContainer<AttendenceProcDM>(AttendenceProcDM.class);
     beanAttendenceProcDM.addAll(listAttendProc);
     tblMstScrSrchRslt.setContainerDataSource(beanAttendenceProcDM);
     tblMstScrSrchRslt.setVisibleColumns(
         new Object[] {"attProcId", "payperiodName", "allStDt", "allEndDt", "status"});
     tblMstScrSrchRslt.setColumnHeaders(
         new String[] {"Ref.Id", "Pay Period Name", "Start Dt", "End Dt", "Status"});
     tblMstScrSrchRslt.setColumnAlignment("attProcId", Align.RIGHT);
     tblMstScrSrchRslt.setColumnFooter("processedDt", "No.of Records : " + recordCnt);
   } catch (Exception e) {
     logger.info(e.getMessage());
   }
 }
Exemplo n.º 4
0
 private void loadAttendenceProcess() {
   try {
     SessionFactory sf = serviceAttendanceProcess.getConnection();
     Session session = sf.openSession();
     session.beginTransaction();
     session.doWork(
         new Work() {
           @Override
           public void execute(Connection connection) throws SQLException {
             // TODO Auto-generated method stub
             try {
               SimpleDateFormat format1 = new SimpleDateFormat("dd-MM-yy");
               SimpleDateFormat format2 = new SimpleDateFormat("dd-MMM-yyyy");
               Date date = null;
               Date enddt = null;
               try {
                 date = format2.parse(startDate);
                 enddt = format2.parse(endDate);
               } catch (java.text.ParseException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
               }
               statement =
                   connection.prepareCall(
                       "{ ? = call pkg_hcm_core.fn_calc_staff_attend (?,?,?,?,?,?,?,?) }");
               statement.registerOutParameter(1, Types.VARCHAR);
               statement.setLong(2, payPeriodId);
               statement.setLong(3, (Long) cbEmployeeName.getValue());
               statement.setLong(4, (Long) cbBranch.getValue());
               statement.setString(5, format1.format(date));
               statement.setString(6, format1.format(enddt));
               statement.setLong(7, companyId);
               statement.setString(8, userName);
               statement.registerOutParameter(9, Types.VARCHAR);
               statement.execute();
               funationStatus = statement.getString(1);
               errorMsg = statement.getString(9);
               System.out.println("funationStatus-->" + funationStatus);
               System.out.println("errorMsg-->" + errorMsg);
               connection.close();
             } catch (Exception e) {
               SimpleDateFormat format1 = new SimpleDateFormat("dd-MMM-yy");
               SimpleDateFormat format2 = new SimpleDateFormat("dd-MMM-yyyy");
               Date date = null;
               Date enddt = null;
               try {
                 date = format2.parse(startDate);
                 enddt = format2.parse(endDate);
               } catch (java.text.ParseException e1) {
                 // TODO Auto-generated catch block
                 e1.printStackTrace();
               }
               statement =
                   connection.prepareCall(
                       "{ ? = call pkg_hcm_core.fn_calc_staff_attend (?,?,?,?,?,?,?,?) }");
               statement.registerOutParameter(1, Types.VARCHAR);
               statement.setLong(2, payPeriodId);
               statement.setLong(3, (Long) cbEmployeeName.getValue());
               statement.setLong(4, (Long) cbBranch.getValue());
               statement.setString(5, format1.format(date));
               statement.setString(6, format1.format(enddt));
               statement.setLong(7, companyId);
               statement.setString(8, userName);
               statement.registerOutParameter(9, Types.VARCHAR);
               statement.execute();
               funationStatus = statement.getString(1);
               errorMsg = statement.getString(9);
               System.out.println("funationStatus-->" + funationStatus);
               System.out.println("errorMsg-->" + errorMsg);
               connection.close();
               e.printStackTrace();
               logger.info(e.getMessage());
             }
           }
         });
     cbPayPeried.setComponentError(null);
     cbBranch.setComponentError(null);
     loadSrchRslt();
     resetFields();
   } catch (Exception e) {
     if (payPeriodId == null) {
       cbPayPeried.setComponentError(new UserError("Please Select Pay Period"));
     }
     if (cbBranch.getValue() == null) {
       cbBranch.setComponentError(new UserError("Please Select Branch "));
     }
     logger.info("Employee Attendance Process Function call" + e);
   } finally {
     try {
       statement.close();
     } catch (SQLException e) {
       // TODO Auto-generated catch block
       logger.info("Employee Attendance Process Function call" + e);
     }
   }
 }