/*
 * 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.payroll.payment.vo;

import java.util.Date;

import jp.mosp.common.common.MospUtility;
import jp.mosp.payroll.base.PayrollConst;
import jp.mosp.payroll.base.PayrollVo;

public class CalcPaymentVo extends PayrollVo {
	
	private static final long serialVersionUID = 8910443939627425248L;
	
	// フィールド
	Date calcDate;
	
	// 画面モード
	private int mode;
	
	/**
	 * {@link PayrollVo#PayrollVo()}を実行する。
	 */
	public CalcPaymentVo() {
		super();
	}
	
	/* (non-Javadoc)
	 * @see jp.mosp.payroll.base.PayrollVo#setSubTitle()
	 */
	@Override
	protected void setSubTitle() {
		super.setSubTitle();
		subTitle = getName("P_PAYROLL");
		addAryMenu("P1001", getName("P_PAYMENT") +
				getName("P_CALCULATE") + getName("C_MENU") + getName("C_TO"));
	}
	
	/* (non-Javadoc)
	 * @see jp.mosp.payroll.base.PayrollVo#getDirectJs(Class)
	 */
	@Override
	public String getDirectJs(Class<?> cls) throws IllegalAccessException {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDirectJs(cls));
		sb.append("var MODE = " + mode + ";");
		return sb.toString();
	}
	
	/**
	 * 計算年月を取得する。
	 * @return 計算年月
	 */
	public Date getCalcDate() {
		return getDateField(calcDate);
	}

	/**
	 * 計算年月を設定する。
	 * @param calcDate 設定する計算年月
	 */
	public void setCalcDate(Date calcDate) {
		this.calcDate = getDateField(calcDate);
	}

	/**
	 * 計算年月(文字列)を取得する。
	 * @return 計算年月(文字列)
	 */
	public String getStrCalcDate() {
		return MospUtility.getDateString(calcDate, PayrollConst.FORMAT_YEAR_MONTH);
	}
	
	/**
	 * 画面モードを設定する。<br><br>
	 * 0:通常、1：計算中無し
	 * @param mode 設定する画面モード
	 */
	public void setMode(int mode) {
		this.mode = mode;
	}

}
