Tot_suspension_dwr.java 2.41 KB
Newer Older
TongZuu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
package com.csc.library.dwr;

import java.rmi.RemoteException;
import java.util.List;
import java.util.Vector;

import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;

public class Tot_suspension_dwr extends DWR_base{
    
    private DbInquiry inqAdj = null;
    
    private void chkUProfile(){
        if (this.up == null) {
            this.setUProfile();
        }        
    }
    
    private void chkAdjInq() {
        try {
            this.chkUProfile();
            if (this.inqAdj ==null) {
                this.inqAdj = new InitialInquiry(up).getDbInquiry();
                this.inqAdj.initMyTable("Tadjtime0", "", "");
            }
        } catch (Exception e) {
            MyLog.error(this, e);
        }
    }
    
    public String[] chkOTAdjust(String[] data){
        this.chkUProfile();
        String otPermission[] = null;
        Vector vPermission=new Vector();
        String filter = "";
        int i = 0;
        MyHashMap hm = new MyHashMap();
        if(data.length >= 3){
            CscCalendar startDate = new CscCalendar(data[0]);
            CscCalendar endDate = new CscCalendar(data[1]);
            String empList = data[2];
            filter = "eventgrp = 'O' and (employeeid in("+empList+") and docdate between '"+startDate.getYYYYMMDD()+"' and '"+endDate.getYYYYMMDD()+"')";
            try {
                this.chkAdjInq();
                this.inqAdj.setColumn("employeeid,companyid,docdate,eventgrp");
                this.inqAdj.setFilter(filter);
                this.inqAdj.refresh();
                String strList="";
                while(this.inqAdj.next()){
                    if(!vPermission.contains(this.inqAdj.getString("employeeid"))){
                            vPermission.add(this.inqAdj.getString("employeeid"));
                            strList=this.inqAdj.getString("employeeid")+",";
                    }
                }
                if(strList.length()>0){
                    strList=strList.substring(0,strList.length()-1);
                }
                otPermission=strList.split(",");
                
            } catch (RemoteException e) {
                MyLog.error(this, e);
            }
        }
        return otPermission;
    }
}