/*
 * MosP - Mind Open Source Project    http://www.mosp.jp/
 * Copyright (C) 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.payroll.vo;

import javax.servlet.http.HttpServletRequest;

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

/**
 * @author nakamura
 *
 */
public class PaidHolidayExportCardVo extends MosPVo {
	
	private static final long	serialVersionUID			= -6872979060768701207L;
	
	// パラメータ名
	/**
	 * 所属
	 */
	public static final String	PRM_PLT_SECTION				= "pltSection";
	/**
	 * 社員コード
	 */
	public static final String	PRM_TXT_K_CODE				= "txtKCode";
	/**
	 * 開始年
	 */
	public static final String	PRM_PLT_START_YEAR			= "pltStartYear";
	/**
	 * 開始月
	 */
	public static final String	PRM_PLT_START_MONTH			= "pltStartMonth";
	/**
	 * 終了年
	 */
	public static final String	PRM_PLT_END_YEAR			= "pltEndYear";
	/**
	 * 終了月
	 */
	public static final String	PRM_PLT_END_MONTH			= "pltEndMonth";
	/**
	 * 有給休暇テーブル
	 */
	public static final String	PRM_PLT_PAID_HOLIDAY_TABLE	= "pltPaidHolidayTable";
	
	// フィールド
	private String				pltSection;
	private String				txtKCode;
	private String				pltStartYear;
	private String				pltStartMonth;
	private String				pltEndYear;
	private String				pltEndMonth;
	private String				pltPaidHolidayTable;
	
	// プルダウンリスト
	/**
	 * 所属(配列)
	 */
	public String[][]			aryPltSection;
	/**
	 * 開始年(配列)
	 */
	public String[][]			aryPltYear;
	/**
	 * 開始月(配列)
	 */
	public String[][]			aryPltMonth;
	/**
	 * 有給休暇テーブル(配列)
	 */
	public String[][]			aryPltPaidHolidayTable;
	/**
	 * 開始年(配列)旧有給休暇テーブル選択時
	 */
	public String[][]			aryOldYear;
	/**
	 * 開始年(配列)新有給休暇テーブル選択時
	 */
	public String[][]			aryNewYear;
	/**
	 * 開始月(配列)旧有給休暇テーブル選択時
	 */
	public String[][]			aryOldMonth;
	/**
	 * 開始月(配列)新有給休暇テーブル選択時
	 */
	public String[][]			aryNewMonth;
	
	// フィールド名及び制限	
	/**
	 * 社員コード
	 */
	public String				NAM_K_CODE;
	/**
	 * 所属
	 */
	public String				NAM_SECTION;
	/**
	 * 開始年月
	 */
	public String				NAM_START_DATE;
	/**
	 * 終了年月
	 */
	public String				NAM_END_DATE;
	/**
	 * 有給休暇テーブル
	 */
	public String				NAM_PAID_HOLIDAY_TABLE;
	/**
	 * 社員コード(項目長)
	 */
	public int					LEN_K_CODE;
	

	/**
	 * コンストラクター
	 */
	public PaidHolidayExportCardVo() {
		super();
		setViewPath(getClassName());
		aryPltYear = new String[0][0];
		aryPltMonth = new String[0][0];
		pltSection = "";
		txtKCode = "";
	}
	
	@Override
	protected void setSubTitle() {
		subTitle = "有給休暇情報エクスポート";
		createAryMenu(CMD_MENU_PAYROLL, MosPMenuConst.getMenuPaidHolidayManagement());
	}
	
	@Override
	protected void setFieldsName() {
		NAM_K_CODE = CommonConst.NAM_K_CODE;
		NAM_SECTION = CommonConst.NAM_STATION;
		NAM_START_DATE = CommonConst.NAM_START + CommonConst.NAM_YEAR + CommonConst.NAM_MONTH;
		NAM_END_DATE = CommonConst.NAM_END + CommonConst.NAM_YEAR + CommonConst.NAM_MONTH;
		NAM_PAID_HOLIDAY_TABLE = CommonConst.NAM_COMMON_OUTPUT + CommonConst.NAM_COMMON_TARGET;
		LEN_K_CODE = CommonConst.LEN_K_CODE;
	}
	
	@Override
	public void setParams(HttpServletRequest request) {
		pltSection = request.getParameter(PRM_PLT_SECTION);
		txtKCode = request.getParameter(PRM_TXT_K_CODE);
		pltStartYear = request.getParameter(PRM_PLT_START_YEAR);
		pltStartMonth = request.getParameter(PRM_PLT_START_MONTH);
		pltEndYear = request.getParameter(PRM_PLT_END_YEAR);
		pltEndMonth = request.getParameter(PRM_PLT_END_MONTH);
		pltPaidHolidayTable = request.getParameter(PRM_PLT_PAID_HOLIDAY_TABLE);
	}
	
	/**
	 * フィールドの妥当性確認
	 * @throws MospException	MosP例外処理が発生した場合
	 */
	public void validate() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		// 文字列長確認
		checkLength(txtKCode, LEN_K_CODE, NAM_K_CODE, PRM_TXT_K_CODE);
		// 妥当性確認終了時処理
		endValidation();
	}
	
	@Override
	public String getDirectJs(Class<?> cls, Object obj) throws IllegalAccessException {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDirectJs(cls, obj));
		sb.append(getArrayCodeJs("ARY_OLD_YEAR", aryOldYear));
		sb.append(getArrayCodeJs("ARY_NEW_YEAR", aryNewYear));
		sb.append(getArrayCodeJs("ARY_OLD_MONTH", aryOldMonth));
		sb.append(getArrayCodeJs("ARY_NEW_MONTH", aryNewMonth));
		sb.append(getArrayCodeJs("ARY_PLT_MONTH", aryPltMonth));
		return sb.toString();
	}
	
	// アクセサメソッド	
	/**
	 * @return		社員コード(HTMLエスケープ)
	 */
	public String getEscTxtKCode() {
		return escapeHTML(txtKCode);
	}
	
	/**
	 * @return		所属
	 */
	public String getPltSection() {
		return pltSection;
	}
	
	/**
	 * @return		社員コード
	 */
	public String getTxtKCode() {
		return txtKCode;
	}
	
	/**
	 * @return		開始年
	 */
	public String getPltStartYear() {
		return pltStartYear;
	}
	
	/**
	 * @return		開始月
	 */
	public String getPltStartMonth() {
		return pltStartMonth;
	}
	
	/**
	 * @return		終了年
	 */
	public String getPltEndYear() {
		return pltEndYear;
	}
	
	/**
	 * @return		終了月
	 */
	public String getPltEndMonth() {
		return pltEndMonth;
	}
	
	/**
	 * @return		有給休暇テーブル
	 */
	public String getPltPaidHolidayTable() {
		return pltPaidHolidayTable;
	}
	
	/**
	 * @param pltSection		所属
	 */
	public void setPltSection(String pltSection) {
		this.pltSection = pltSection;
	}
	
	/**
	 * @param txtKCode			社員コード
	 */
	public void setTxtKCode(String txtKCode) {
		this.txtKCode = txtKCode;
	}
	
	/**
	 * @param pltStartYear		開始年
	 */
	public void setPltStartYear(String pltStartYear) {
		this.pltStartYear = pltStartYear;
	}
	
	/**
	 * @param pltStartMonth		開始月
	 */
	public void setPltStartMonth(String pltStartMonth) {
		this.pltStartMonth = pltStartMonth;
	}
	
	/**
	 * @param pltEndYear		終了年
	 */
	public void setPltEndYear(String pltEndYear) {
		this.pltEndYear = pltEndYear;
	}
	
	/**
	 * @param pltEndMonth		終了月
	 */
	public void setPltEndMonth(String pltEndMonth) {
		this.pltEndMonth = pltEndMonth;
	}
	
	/**
	 * @param pltPaidHolidayTable	有給休暇テーブル
	 */
	public void setPltPaidHolidayTable(String pltPaidHolidayTable) {
		this.pltPaidHolidayTable = pltPaidHolidayTable;
	}
}
