/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kr.co.kihyun.service.vo;

import java.util.Date;

/**
 *
 * @author Kts
 */
public class TotDocVO {
    //테이블컬럼변수
    private Long id               ;        //집계문서 ID       
    private Long acptLimit        ;        //문서종료방법ID    
    private Integer accAuth       ;        //열람 권한         
    private Integer appendType    ;        //복사양식형태      
    private Date endDate          ;        //집계 종료일       
    private String execCode       ;        //시행번호          
    private Integer fixNum        ;        //순번              
    private String form           ;        //서식 정의         
    private Long group            ;        //서식종류 구분     
    private String handyName      ;        //핸디 이름         
    private String delType        ;        //삭제 유형(Y/N)    
    private String deptId         ;        //부서 ID           
    private String userId         ;        //사용자 ID         
    private String repDeptId      ;        //상위문서 부서ID   
    private Long repId            ;        //상위문서 ID       
    private String name           ;        //입력 자료명       
    private Date regDate          ;        //등록일            
    private Date startDate        ;        //시작일            
    private Integer totRange      ;        //서식공유범위      
    private Integer groupId       ;        //서식종류 구분ID   
    private String mngCode        ;        //문서관리 번호     
    private String ownerEmail     ;        //집계자 E-mail 주소
    private String ownerName      ;        //집계자 성명       
    private String ownerPhone     ;        //집계자 전화번호   
    private String periodicalDocYn;        //정기집계 여부(Y/N)
    private String autoRtnYn      ;        //자동회수 여부(Y/N)
    
    //추가적인 변수 선언
    //private String completeYn;              //집계완료여부
    private String acptType;                  //집계종료방법
    private Integer prss;                     //집계진행상태
    private Integer completeReportCount;      //집계자료의 완료된 제출자료 갯수
    private Integer submitLimitCnt;           //제출부서 카운트
    
    //2014.09.24 Add by KWON,HAN : 추가적인 변수 선언
    private String sndCnt;                 //제출완료수
    private String allCnt;                 //제출대상전체수
    private String noteCnt;                //회수요청수
    private String deptName;               //부서명    
    private String shareDocRegId;          //집계자료의 등록자 ID   
    private Integer shareUserCount;        //집계자료의 사용자 공유수       
    private String shareUserId;            //집계자료의 공유자 ID
    private Long rowNo;                    //레코드행번호
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getAcptLimit() {
        return acptLimit;
    }

    public void setAcptLimit(Long acptLimit) {
        this.acptLimit = acptLimit;
    }

    public Integer getAccAuth() {
        return accAuth;
    }

    public void setAccAuth(Integer accAuth) {
        this.accAuth = accAuth;
    }

    public Integer getAppendType() {
        return appendType;
    }

    public void setAppendType(Integer appendType) {
        this.appendType = appendType;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getExecCode() {
        return execCode;
    }

    public void setExecCode(String execCode) {
        this.execCode = execCode;
    }

    public Integer getFixNum() {
        return fixNum;
    }

    public void setFixNum(Integer fixNum) {
        this.fixNum = fixNum;
    }

    public String getForm() {
        return form;
    }

    public void setForm(String form) {
        this.form = form;
    }

    public Long getGroup() {
        return group;
    }

    public void setGroup(Long group) {
        this.group = group;
    }

    public String getHandyName() {
        return handyName;
    }

    public void setHandyName(String handyName) {
        this.handyName = handyName;
    }

    public String getDelType() {
        return delType;
    }

    public void setDelType(String delType) {
        this.delType = delType;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getRepDeptId() {
        return repDeptId;
    }

    public void setRepDeptId(String repDeptId) {
        this.repDeptId = repDeptId;
    }

    public Long getRepId() {
        return repId;
    }

    public void setRepId(Long repId) {
        this.repId = repId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getRegDate() {
        return regDate;
    }

    public void setRegDate(Date regDate) {
        this.regDate = regDate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Integer getTotRange() {
        return totRange;
    }

    public void setTotRange(Integer totRange) {
        this.totRange = totRange;
    }

    public Integer getGroupId() {
        return groupId;
    }

    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    public String getMngCode() {
        return mngCode;
    }

    public void setMngCode(String mngCode) {
        this.mngCode = mngCode;
    }

    public String getOwnerEmail() {
        return ownerEmail;
    }

    public void setOwnerEmail(String ownerEmail) {
        this.ownerEmail = ownerEmail;
    }

    public String getOwnerName() {
        return ownerName;
    }

    public void setOwnerName(String ownerName) {
        this.ownerName = ownerName;
    }

    public String getOwnerPhone() {
        return ownerPhone;
    }

    public void setOwnerPhone(String ownerPhone) {
        this.ownerPhone = ownerPhone;
    }

    public String getPeriodicalDocYn() {
        return periodicalDocYn;
    }

    public void setPeriodicalDocYn(String periodicalDocYn) {
        this.periodicalDocYn = periodicalDocYn;
    }

    public String getAutoRtnYn() {
        return autoRtnYn;
    }

    public void setAutoRtnYn(String autoRtnYn) {
        this.autoRtnYn = autoRtnYn;
    }

//    public String getCompleteYn() {
//        return completeYn;
//    }
//
//    public void setCompleteYn(String completeYn) {
//        this.completeYn = completeYn;
//    }

    public String getAcptType() {
        return acptType;
    }

    public void setAcptType(String acptType) {
        this.acptType = acptType;
    }

    public Integer getPrss() {
        return prss;
    }

    public void setPrss(Integer prss) {
        this.prss = prss;
    }

    public Integer getCompleteReportCount() {
        return completeReportCount;
    }

    public void setCompleteReportCount(Integer completeReportCount) {
        this.completeReportCount = completeReportCount;
    }

    public Integer getSubmitLimitCnt() {
        return submitLimitCnt;
    }

    public void setSubmitLimitCnt(Integer submitLimitCnt) {
        this.submitLimitCnt = submitLimitCnt;
    }
    
    public boolean isPeriodicalDoc() {
        return this.getPeriodicalDocYn().equals("Y");
    }
    
    public boolean isDocCollection() {
        //0.서식+파일, 1.파일, 2.서식함활용, 3.서식복사(시스템서식)
        return this.getAppendType() == 0 || this.getAppendType() == 2 || this.getAppendType() == 3;
    }
    
    /**
     * 집계자료에 대한 완료여부를 반환하는 메소드
     * @return boolean
     */
    public boolean isComplete() {
        return TotDocVO.chkDocComplete(this.acptType, this.prss, this.endDate, this.submitLimitCnt, this.completeReportCount);
    }
    
    /**
     * 집계자료에 대한 완료여부를 반환하는 정적메소드
     * @param acptType  - 집계종료방법
     * @param prss - 집계진행상태
     * @param endDate - 집계종료일
     * @param submitLimitCnt - 제출부서갯수
     * @param completeReportCount - 제출완료갯수(6.제출완료)
     * @return 
     */
    public static boolean chkDocComplete(String acptType
            , Integer prss
            , Date endDate
            , Integer submitLimitCnt
            , Integer completeReportCount) {
        boolean isComplete = false;
        if( acptType.equals("DEADLINE") ) {             /* 기한종료 */
            if( prss == 4 || endDate.before(new Date()) ) {
                isComplete = true;
            }
        }else if( acptType.equals("SUBMIT_DATE") ) {    /* 선착순종료 */
            if( prss == 4 || endDate.before(new Date()) || submitLimitCnt <= completeReportCount) {
                isComplete = true;
            }
        }else if( acptType.equals("UNLIMIT") ) {        /* 수동종료 */
            if( prss == 4 || endDate.before(new Date()) ) {
                isComplete = true;
            }
        }
        return isComplete;
    }
    
    public String getSndCnt() {
        return sndCnt;
    }

    public void setSndCnt(String sndCnt) {
        this.sndCnt = sndCnt;
    }

    public String getAllCnt() {
        return allCnt;
    }

    public void setAllCnt(String allCnt) {
        this.allCnt = allCnt;
    }

    public String getNoteCnt() {
        return noteCnt;
    }

    public void setNoteCnt(String noteCnt) {
        this.noteCnt = noteCnt;
    }
    
    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getShareDocRegId() {
        return shareDocRegId;
    }

    public void setShareDocRegId(String shareDocRegId) {
        this.shareDocRegId = shareDocRegId;
    }

    public Integer getShareUserCount() {
        return shareUserCount;
    }

    public void setShareUserCount(Integer shareUserCount) {
        this.shareUserCount = shareUserCount;
    }

    public String getShareUserId() {
        return shareUserId;
    }

    public void setShareUserId(String shareUserId) {
        this.shareUserId = shareUserId;
    }    

    public Long getRowNo() {
        return rowNo;
    }

    public void setRowNo(Long rowNo) {
        this.rowNo = rowNo;
    }
    
}
