/*
 * MosP - Mind Open Source Project         http://www.mosp.jp/
 * Copyright (C) 1987-2009 MIND Co., Ltd.  http://www.e-mind.co.jp/
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package jp.mosp.kintai.vo;

import javax.servlet.http.HttpServletRequest;

import jp.mosp.common.CommonConst;
import jp.mosp.common.MosPVo;

import jp.mosp.kintai.dto.MYukyuDto;

public class PaidHolidayCardVo extends MosPVo {

	private static final long serialVersionUID = 4422751719733412912L;

	// URL
	private static final String RETURN_URL = "/jsp/kintai/paidHolidayCard.jsp";
	private static final String EXTRA_JS   = "/pub/kintai/js/paidHolidayCard.js";
	private static final String EXTRA_CSS  = "/pub/kintai/css/paidHolidayCard.css";

	// 画面サブタイトル
	public final String SUB_TITLE = CommonConst.TTL_PAID_HOLIDAY_CHECK;

	// 定数
	public static final int MODE_UPDATE = 1;

	// パラメータ名
	public static final String PRM_LBL_ATTENDANCE_CALC_Y 		= "lblAttendanceCalcY"	;//勤怠計算年
	public static final String PRM_LBL_ATTENDANCE_CALC_M 		= "lblAttendanceCalcM"	;//勤怠計算月
	public static final String PRM_LBL_PAIDHOLIDAY_LY 		= "lblPaidHolidayLY"	;//当月利用可能数（前年）
	public static final String PRM_LBL_PAIDHOLIDAY_TY 		= "lblPaidHolidayTY"	;//当月利用可能数（当年）
	public static final String PRM_LBL_REMAIN_APPROVED 		= "lblRemainApproved"	;//申請中
	public static final String PRM_LBL_APPROVED 				= "lblApproved"			;//承認済み
	public static final String PRM_LBL_THIS_M_GET 			= "lblThisMGet"			;//追加予定
	public static final String PRM_LBL_THIS_M_DISPOSE 		= "lblThisMDispose"		;//廃棄予定
	public static final String PRM_LBL_THIS_M_REST_LY 		= "lblThisMRestLY"		;//来月利用可能数（前年）
	public static final String PRM_LBL_THIS_M_REST_TY 		= "lblThisMRestTY"		;//来月利用可能数（当年）

	// フィールド
	private String lblAttendanceCalcY;
	private String lblAttendanceCalcM;
	private String lblPaidHolidayTY;
	private String lblPaidHolidayLY;
	private String lblRemainApproved;
	private String lblApproved;
	private String lblThisMGet;
	private String lblThisMDispose;
	private String lblThisMRestLY;
	private String lblThisMRestTY;

	// モード(1：更新)
	private int mode;

	// フィールド名及び制限
	public static final String NAM_PAYROLL_CALC		= CommonConst.NAM_CONFIRM_PAYMENT + CommonConst.NAM_PROVIDED_YEAR_MONTH;
	public static final String NAM_LAST_M_REST 		= CommonConst.NAM_CUT_OFF_MONTH_THIS + CommonConst.NAM_POSSIBLE_AMOUNT;
	public static final String NAM_THIS_M_GET			= CommonConst.NAM_GET_SCHEDULE;
	public static final String NAM_THIS_M_DISPOSE		= CommonConst.NAM_DISPOSE_SCHEDULE;
	public static final String NAM_THIS_M_REST		= CommonConst.NAM_CUT_OFF_MONTH_AFTER + CommonConst.NAM_POSSIBLE_SCHEDULE;
	public static final String NAM_USE 				= CommonConst.NAM_USE;
	public static final String NAM_REMAIN_APPROVED 	= CommonConst.NAM_APPROVAL_REQUEST;
	public static final String NAM_APPROVED			= CommonConst.NAM_ALREADY_APPROVED + CommonConst.NAM_PAID_HOLIDAY_AMOUNT;
	public static final String NAM_THIS_YEAR 			= CommonConst.NAM_YEAR_THIS;
	public static final String NAM_LAST_YEAR 			= CommonConst.NAM_YEAR_FORMER;

	/**
	 * コンストラクタ
	 */
	public PaidHolidayCardVo() {
		super();
		mode = 0;
		setExtraCss(EXTRA_CSS);
		addExtraJs(EXTRA_JS);
		setRetUrl(RETURN_URL);
	}

	/**
	 * 初期値設定
	 */	
	public void setDefaultValues(){
		setLblAttendanceCalcY("");
		setLblAttendanceCalcM("");
		setLblPaidHolidayLY("0");
		setLblPaidHolidayTY("0");
		setLblRemainApproved("0");
		setLblApproved("0");
		setLblThisMGet("0");
		setLblThisMDispose("0");
		setLblThisMRestLY("0");
		setLblThisMRestTY("0");
	}

	/**
	 * パラメータ設定
	 */
	public void setParams(HttpServletRequest request) {
		lblAttendanceCalcY 	= request.getParameter(PRM_LBL_ATTENDANCE_CALC_Y	); //勤怠計算年
		lblAttendanceCalcM 	= request.getParameter(PRM_LBL_ATTENDANCE_CALC_M	); //勤怠計算月
		lblPaidHolidayTY 	= request.getParameter(PRM_LBL_PAIDHOLIDAY_TY		); //当月利用可能数（当年）
		lblPaidHolidayLY 	= request.getParameter(PRM_LBL_PAIDHOLIDAY_LY		); //当月利用可能数（前年）
		lblRemainApproved 	= request.getParameter(PRM_LBL_REMAIN_APPROVED		); //申請中
		lblApproved 		= request.getParameter(PRM_LBL_APPROVED				); //承認済み
		lblThisMGet 		= request.getParameter(PRM_LBL_THIS_M_GET			); //追加予定
		lblThisMDispose 	= request.getParameter(PRM_LBL_THIS_M_DISPOSE		); //廃棄予定
		lblThisMRestLY 		= request.getParameter(PRM_LBL_THIS_M_REST_LY		); //来月利用可能数（前年）
		lblThisMRestTY 		= request.getParameter(PRM_LBL_THIS_M_REST_TY		); //来月利用可能数（当年）
	}

	/**
	 * フィールド設定
	 * @param dto 
	 */
	public void setFields(MYukyuDto dto) {
		lblPaidHolidayTY 	= String.valueOf(dto.getTZanT());
		lblPaidHolidayLY 	= String.valueOf(dto.getTZanZ());
	}

	/**
	 * JavaScript設定
	 * @param cls 情報取得クラス
	 * @throws IllegalAccessException
	 */
	@Override
	public String getDirectJs(Class cls) throws IllegalAccessException {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDirectJs(cls));
		sb.append("var MODE = ");
		sb.append(mode);
		sb.append(";");
		return sb.toString();
	}

	// アクセサメソッド	
	public String getLblAttendanceCalcY		() { return	 lblAttendanceCalcY			; } 	//勤怠計算年
	public String getLblAttendanceCalcM 	() { return	 lblAttendanceCalcM			; } 	//勤怠計算月
	public String getLblPaidHolidayTY		() { return	 lblPaidHolidayTY 			; } 	//当月利用可能数（当年）
	public String getLblPaidHolidayLY		() { return	 lblPaidHolidayLY			; } 	//当月利用可能数（前年）
	public String getLblRemainApproved		() { return	 lblRemainApproved			; } 	//申請中
	public String getLblApproved         	() { return	 lblApproved                ; } 	//承認
	public String getLblThisMGet			() { return	 lblThisMGet				; } 	//追加予定
	public String getLblThisMDispose		() { return	 lblThisMDispose			; } 	//廃棄予定
	public String getLblThisMRestTY			() { return	 lblThisMRestTY				; } 	//来月利用可能数（当年）
	public String getLblThisMRestLY			() { return	 lblThisMRestLY				; } 	//来月利用可能数（前年）

	public String getEscLblAttendanceCalcY	() { return	 escapeHTML(lblAttendanceCalcY)	; } 	//勤怠計算年
	public String getEscLblAttendanceCalcM	() { return	 escapeHTML(lblAttendanceCalcM)	; } 	//勤怠計算月
	public String getEscLblPaidHolidayTY	() { return	 escapeHTML(lblPaidHolidayTY)	; } 	//当月利用可能数（当年）
	public String getEscLblPaidHolidayLY	() { return	 escapeHTML(lblPaidHolidayLY)	; } 	//当月利用可能数（前年）
	public String getEscLblRemainApproved  	() { return	 escapeHTML(lblRemainApproved)	; } 	//申請中
	public String getEscLblApproved	    	() { return	 escapeHTML(lblApproved )       ; } 	//承認
	public String getEscLblThisMGet			() { return	 escapeHTML(lblThisMGet)		; } 	//追加予定
	public String getEscLblThisMDispose		() { return	 escapeHTML(lblThisMDispose)	; } 	//廃棄予定
	public String getEscLblThisMRestLY		() { return	 escapeHTML(lblThisMRestLY)		; } 	//来月利用可能数（前年）
	public String getEscLblThisMRestTY		() { return	 escapeHTML(lblThisMRestTY)		; } 	//来月利用可能数（当年）

	public void setLblAttendanceCalcY 	(String	lblAttendanceCalcY 	) { this.lblAttendanceCalcY	= lblAttendanceCalcY; } //勤怠計算年
	public void setLblAttendanceCalcM 	(String	lblAttendanceCalcM 	) { this.lblAttendanceCalcM	= lblAttendanceCalcM; } //勤怠計算月
	public void setLblPaidHolidayTY	(String	lblPaidHolidayTY   	) { this.lblPaidHolidayTY	= lblPaidHolidayTY	; } //当月利用可能数（当年）
	public void setLblPaidHolidayLY 	(String	lblPaidHolidayLY   	) { this.lblPaidHolidayLY 	= lblPaidHolidayLY	; } //当月利用可能数（前年）
	public void setLblRemainApproved	(String	lblRemainApproved  	) { this.lblRemainApproved 	= lblRemainApproved ; } //申請中
	public void setLblApproved      	(String lblApproved        	) { this.lblApproved       	= lblApproved      	; } //承認
	public void setLblThisMGet	 	 	(String	lblThisMGet			) { this.lblThisMGet	 	= lblThisMGet		; } //追加予定
	public void setLblThisMDispose	 	(String	lblThisMDispose		) { this.lblThisMDispose	= lblThisMDispose	; } //廃棄予定
	public void setLblThisMRestTY	 	(String	lblThisMRestTY		) { this.lblThisMRestTY	 	= lblThisMRestTY	; } //来月利用可能数（当年）
	public void setLblThisMRestLY	 	(String	lblThisMRestLY		) { this.lblThisMRestLY	 	= lblThisMRestLY	; } //来月利用可能数（前年）

	public void setMode(int mode) { this.mode = mode; }
	public int getMode() { return mode; }

}
