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

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import jp.mosp.common.MosPVo;
import jp.mosp.common.common.MospException;
import jp.mosp.common.dto.MosPConfDto;
import jp.mosp.common.utils.DateUtil;
import jp.mosp.kintai.common.dto.MKihonDto;
import jp.mosp.legal.LegalConst;
import jp.mosp.payroll.base.PayrollConst;
import jp.mosp.payroll.dto.CdAdjustmentDto;
import jp.mosp.payroll.dto.CmIncomeTaxDto;
import jp.mosp.payroll.dto.CmMidwayEnterDto;

public class AdjustmentCardVo extends MosPVo {
	
	private static final long	serialVersionUID				= 1833548315728482756L;
	
	// URL丄CSS
	private static final String	RETURN_URL						= "/jsp/payroll/common/adjustmentCard.jsp";
	private static final String	EXTRA_JS						= "/pub/payroll/common/js/adjustmentCard.js";
	private static final String	EXTRA_CSS						= "/pub/payroll/common/css/adjustmentCard.css";
	
	// 夋柺僒僽僞僀僩儖
	public final String			SUB_TITLE						= PayrollConst.TTL_ADJUSTMENT_CARD;
	
	// 僷儔儊乕僞柤
	public static final String	PRM_TXT_CHANGE_K_CODE			= "txtChangeKCode";
	public static final String	PRM_HID_ADJUST_YEAR				= "hidAdjustYear";
	public static final String	PRM_HID_K_CODE					= "hidKCode";
	public static final String	PRM_HID_FAMILY_INFO				= "hidFamilyInfo";
	
	public static final String	PRM_TXT_GENERAL_LIFE_INS		= "txtGeneralLifeIns";
	public static final String	PRM_TXT_PRIVATE_PENSION			= "txtPrivatePension";
	public static final String	PRM_TXT_LIFE_INS_DEDUCTION		= "txtLifeInsDeduction";
	public static final String	PRM_TXT_EARTHQUAKE_INS			= "txtEarthquakeIns";
	public static final String	PRM_TXT_LONG_TERM_DAMAGE_INS	= "txtLongTermDamageIns";
	public static final String	PRM_TXT_DAMAGE_INS_DEDUCTION	= "txtDamageInsDeduction";
	public static final String	PRM_TXT_SOCIAL_INS_DEDUCTION	= "txtSocialInsDeduction";
	public static final String	PRM_TXT_MUTUAL_AID_DEDUCTION	= "txtMutualAidDeduction";
	public static final String	PRM_TXT_SPOUSE_SUM_INCOME		= "txtSpouseSumIncome";
	public static final String	PRM_TXT_SPOUSE_SP_DEDUCTION		= "txtSpouseSpDeduction";
	public static final String	PRM_TXT_HOUSE_LOAN_DEDUCTION	= "txtHouseLoanDeduction";
	public static final String	PRM_TXT_ALLOWANCE_ADJUSTMENT	= "txtAllowanceAdjustment";
	public static final String	PRM_TXT_TAX_FREE_ADJUSTMENT		= "txtTaxFreeAdjustment";
	public static final String	PRM_TXT_SOC_INS_ADJUSTMENT		= "txtSocInsAdjustment";
	public static final String	PRM_TXT_TAX_INC_ADJUSTMENT		= "txtTaxIncAdjustment";
	public static final String	PRM_TXT_WITHHOLD_SLIP_NOTES		= "txtWithholdSlipNotes";
	
	public static final String	PRM_CKB_DEAD_RETIREMENT			= "ckbDeadRetirement";
	public static final String	PRM_CKB_SELF_DISASTER			= "ckbSelfDisaster";
	public static final String	PRM_CKB_FOREIGNER				= "ckbForeigner";
	
	// 僼傿乕儖僪
	private String				txtChangeKCode;
	private int					hidAdjustYear;
	private String				hidKCode;
	private String				lblKName;
	private String				lblStationCode;
	private String				lblStationName;
	private String				lblPositionCode;
	private String				lblPositionName;
	private String				lblEntranceDate;
	private String				lblAdjustStatus;
	
	private int					txtGeneralLifeIns;
	private int					txtPrivatePension;
	private int					txtLifeInsDeduction;
	private int					txtEarthquakeIns;
	private int					txtLongTermDamageIns;
	private int					txtDamageInsDeduction;
	private int					txtSocialInsDeduction;
	private int					txtMutualAidDeduction;
	private int					txtSpouseSumIncome;
	private int					txtSpouseSpDeduction;
	private int					txtHouseLoanDeduction;
	private int					txtAllowanceAdjustment;
	private int					txtTaxFreeAdjustment;
	private int					txtSocInsAdjustment;
	private int					txtTaxIncAdjustment;
	private String				txtWithholdSlipNotes;
	
	private String				ckbDeadRetirement;																// 巰朣戅怑
	private String				ckbSelfDisaster;																// 嵭奞幰
	private String				ckbForeigner;																	// 奜崙恖
																												
	private String				lblIncomeTaxType;
	private String				lblAdjustmentType;
	private String				lblSelfWidowType;
	private String				lblSelfHandicapType;
	private String				lblSelfStudentType;
	private String				lblSpouseIntendType;
	private String				lblGeneralDependent;
	private String				lblSpecificDependent;
	private String				lblElderlyDependent;
	private String				lblLiveWithEldRel;
	private String				lblLiveWithHandiGe;
	private String				lblLiveWithHandiSp;
	private String				lblLiveWithHandiEl;
	private String				lblLiveWithHandiEr;
	private String				lblGeneralHandicap;
	private String				lblSpecificHandicap;
	
	private String				lblMidwayType;
	private String				lblFormerIncome;
	private String				lblFormerInsurance;
	private String				lblFormerTax;
	
	private String				hidFamilyInfo;
	
	// 柤徧庢摼梡攝楍
	public String[][]			aryStation;
	public String[][]			aryPosition;
	public String[][]			aryEra;
	public String[][]			aryRelation;
	
	// 愝掕僥乕僽儖
	public List<MosPConfDto>	listConf;
	
	// 僼傿乕儖僪柤媦傃惂尷
	public static final String	NAM_K_CODE						= PayrollConst.NAM_M_KIHON_KCODE;
	public static final int		LEN_K_CODE						= PayrollConst.LEN_K_CODE;
	public static final int		LEN_MONEY_AMOUNT				= PayrollConst.LEN_MONEY_AMOUNT;
	public static final int		LEN_WITHHOLD_NOTES				= PayrollConst.LEN_WITHHOLD_NOTES;
	
	public static final String	NAM_GENERAL_LIFE_INS			= PayrollConst.NAM_GENERAL_LIFE_INS;
	public static final String	NAM_PRIVATE_PENSION				= PayrollConst.NAM_PRIVATE_PENSION;
	public static final String	NAM_LIFE_INS_DEDUCTION			= PayrollConst.NAM_LIFE_INS_DEDUCTION;
	public static final String	NAM_EARTHQUAKE_INS				= PayrollConst.NAM_EARTHQUAKE_INS;
	public static final String	NAM_LONG_TERM_DAMAGE_INS		= PayrollConst.NAM_LONG_TERM_DAMAGE_INS;
	public static final String	NAM_DAMAGE_INS_DEDUCTION		= PayrollConst.NAM_DAMAGE_INS_DEDUCTION;
	public static final String	NAM_SOCIAL_INS_DEDUCTION		= PayrollConst.NAM_SOCIAL_INS_DEDUCTION;
	public static final String	NAM_MUTUAL_AID_DEDUCTION		= PayrollConst.NAM_MUTUAL_AID_DEDUCTION;
	public static final String	NAM_SPOUSE_SUM_INCOME			= PayrollConst.NAM_SPOUSE_SUM_INCOME;
	public static final String	NAM_SPOUSE_SP_DEDUCTION			= PayrollConst.NAM_SPOUSE_SP_DEDUCTION;
	public static final String	NAM_HOUSE_LOAN_DEDUCTION		= PayrollConst.NAM_HOUSE_LOAN_DEDUCTION;
	public static final String	NAM_ALLOWANCE_ADJUSTMENT		= PayrollConst.NAM_ALLOWANCE_ADJUSTMENT;
	public static final String	NAM_TAX_FREE_ADJUSTMENT			= PayrollConst.NAM_TAX_FREE_ADJUSTMENT;
	public static final String	NAM_SOC_INS_ADJUSTMENT			= PayrollConst.NAM_SOC_INS_ADJUSTMENT;
	public static final String	NAM_TAX_INC_ADJUSTMENT			= PayrollConst.NAM_TAX_INC_ADJUSTMENT;
	public static final String	NAM_WITHHOLD_SLIP_NOTES			= PayrollConst.NAM_WITHHOLD_SLIP_NOTES;
	

	/**
	 * 僐儞僗僩儔僋僞
	 */
	public AdjustmentCardVo() {
		super();
		setRetUrl(RETURN_URL);
		setExtraJs(EXTRA_JS);
		setExtraCss(EXTRA_CSS);
	}
	
	/**
	 * 僷儔儊乕僞愝掕
	 * @param request 儕僋僄僗僩
	 */
	@Override
	public void setParams(HttpServletRequest request) {
		txtChangeKCode = request.getParameter(PRM_TXT_CHANGE_K_CODE);
		hidAdjustYear = getIntParam(request.getParameter(PRM_HID_ADJUST_YEAR));
		hidKCode = request.getParameter(PRM_HID_K_CODE);
	}
	
	/**
	 * 僷儔儊乕僞愝掕
	 * @param request 儕僋僄僗僩
	 */
	public void setParamsAll(HttpServletRequest request) {
		setParams(request);
		txtGeneralLifeIns = getIntParam(request.getParameter(PRM_TXT_GENERAL_LIFE_INS));
		txtPrivatePension = getIntParam(request.getParameter(PRM_TXT_PRIVATE_PENSION));
		txtLifeInsDeduction = getIntParam(request.getParameter(PRM_TXT_LIFE_INS_DEDUCTION));
		txtEarthquakeIns = getIntParam(request.getParameter(PRM_TXT_EARTHQUAKE_INS));
		txtLongTermDamageIns = getIntParam(request.getParameter(PRM_TXT_LONG_TERM_DAMAGE_INS));
		txtDamageInsDeduction = getIntParam(request.getParameter(PRM_TXT_DAMAGE_INS_DEDUCTION));
		txtSocialInsDeduction = getIntParam(request.getParameter(PRM_TXT_SOCIAL_INS_DEDUCTION));
		txtMutualAidDeduction = getIntParam(request.getParameter(PRM_TXT_MUTUAL_AID_DEDUCTION));
		txtSpouseSumIncome = getIntParam(request.getParameter(PRM_TXT_SPOUSE_SUM_INCOME));
		txtSpouseSpDeduction = getIntParam(request.getParameter(PRM_TXT_SPOUSE_SP_DEDUCTION));
		txtHouseLoanDeduction = getIntParam(request.getParameter(PRM_TXT_HOUSE_LOAN_DEDUCTION));
		txtAllowanceAdjustment = getIntParam(request.getParameter(PRM_TXT_ALLOWANCE_ADJUSTMENT));
		txtTaxFreeAdjustment = getIntParam(request.getParameter(PRM_TXT_TAX_FREE_ADJUSTMENT));
		txtSocInsAdjustment = getIntParam(request.getParameter(PRM_TXT_SOC_INS_ADJUSTMENT));
		txtTaxIncAdjustment = getIntParam(request.getParameter(PRM_TXT_TAX_INC_ADJUSTMENT));
		txtWithholdSlipNotes = request.getParameter(PRM_TXT_WITHHOLD_SLIP_NOTES);
		ckbDeadRetirement = getCheckBoxParam(request.getParameter(PRM_CKB_DEAD_RETIREMENT)); // 巰朣戅怑
		ckbSelfDisaster = getCheckBoxParam(request.getParameter(PRM_CKB_SELF_DISASTER)); // 嵭奞幰
		ckbForeigner = getCheckBoxParam(request.getParameter(PRM_CKB_FOREIGNER)); // 奜崙恖
	}
	
	/**
	 * 僼傿乕儖僪愝掕
	 * @param dto 僼傿乕儖僪庢摼懳徾DTO
	 */
	public void setFields(CdAdjustmentDto dto) {
		if (dto == null) {
			lblAdjustStatus = PayrollConst.ADJU_STATUS_NON_NAME;
			txtWithholdSlipNotes = hidFamilyInfo;
			return;
		}
		// 僨乕僞偺愝掕
		lblAdjustStatus = getCodeName(dto.getAdjustStatus(), PayrollConst.getAdjuStatusArray());
		txtGeneralLifeIns = dto.getGeneralLifeIns();
		txtPrivatePension = dto.getPrivatePension();
		txtLifeInsDeduction = dto.getLifeInsDeduction();
		txtEarthquakeIns = dto.getEarthquakeIns();
		txtLongTermDamageIns = dto.getLongTermDamageIns();
		txtDamageInsDeduction = dto.getDamageInsDeduction();
		txtSocialInsDeduction = dto.getSocialInsDeduction();
		txtMutualAidDeduction = dto.getMutualAidDeduction();
		txtSpouseSumIncome = dto.getSpouseSumIncome();
		txtSpouseSpDeduction = dto.getSpouseSpDeduction();
		txtHouseLoanDeduction = dto.getHouseLoanDeduction();
		txtAllowanceAdjustment = dto.getAllowanceAdjustment();
		txtTaxFreeAdjustment = dto.getTaxFreeAdjustment();
		txtSocInsAdjustment = dto.getSocInsAdjustment();
		txtTaxIncAdjustment = dto.getTaxIncAdjustment();
		txtWithholdSlipNotes = dto.getWithholdSlipNotes();
		ckbDeadRetirement = dto.getDeadRetirement();
		ckbSelfDisaster = dto.getSelfDisaster();
		ckbForeigner = dto.getForeigner();
	}
	
	/**
	 * 僼傿乕儖僪愝掕
	 * @param mKihonDto        僼傿乕儖僪庢摼懳徾DTO
	 * @param cmIncomeTaxDto   僼傿乕儖僪庢摼懳徾DTO
	 * @param cmMidwayEnterDto 僼傿乕儖僪庢摼懳徾DTO
	 * @param listFamily       僼傿乕儖僪庢摼懳徾儕僗僩
	 * @throws MospException 
	 */
	public void setFields(MKihonDto mKihonDto, CmIncomeTaxDto cmIncomeTaxDto, CmMidwayEnterDto cmMidwayEnterDto
//			List<CmFamilyDto> listFamily
	) throws MospException {
		// 僨乕僞偺愝掕
		if (mKihonDto != null) {
			txtChangeKCode = mKihonDto.getKCode();
			hidKCode = mKihonDto.getKCode();
			lblKName = mKihonDto.getSimei();
			lblStationCode = mKihonDto.getSCode();
			lblStationName = getCodeName(lblStationCode, aryStation);
			lblPositionCode = mKihonDto.getYCode();
			lblPositionName = getCodeName(lblPositionCode, aryPosition);
			lblEntranceDate = getDateString(listConf, aryEra, DateUtil.convIntegerDateToDate(mKihonDto.getNyDate()));
		}
		if (cmIncomeTaxDto != null) {
			lblIncomeTaxType = getCodeName(cmIncomeTaxDto.getIncomeTaxType(), LegalConst.INCOME_TAX_ARRAY);
			lblAdjustmentType = getCodeName(cmIncomeTaxDto.getAdjustmentType(), LegalConst.ADJUSTMENT_ARRAY);
			lblSelfWidowType = getCodeName(cmIncomeTaxDto.getSelfWidowType(), LegalConst.WIDOW_ARRAY);
			lblSelfHandicapType = getCodeName(cmIncomeTaxDto.getSelfHandicapType(), LegalConst.HANDICAP_ARRAY);
			lblSelfStudentType = getCodeName(cmIncomeTaxDto.getSelfStudentType(), LegalConst.STUDENT_ARRAY);
			lblSpouseIntendType = getCodeName(cmIncomeTaxDto.getSpouseIntendType(), LegalConst.SPOUSE_INTEND_ARRAY);
			lblGeneralDependent = cmIncomeTaxDto.getGeneralDependent() + PayrollConst.NAM_COMMON_CNT1;
			lblSpecificDependent = cmIncomeTaxDto.getSpecificDependent() + PayrollConst.NAM_COMMON_CNT1;
			lblElderlyDependent = cmIncomeTaxDto.getElderlyDependent() + PayrollConst.NAM_COMMON_CNT1;
			lblLiveWithEldRel = cmIncomeTaxDto.getLiveWithEldRel() + PayrollConst.NAM_COMMON_CNT1;
			lblLiveWithHandiGe = cmIncomeTaxDto.getLiveWithHandiGe() + PayrollConst.NAM_COMMON_CNT1;
			lblLiveWithHandiSp = cmIncomeTaxDto.getLiveWithHandiSp() + PayrollConst.NAM_COMMON_CNT1;
			lblLiveWithHandiEl = cmIncomeTaxDto.getLiveWithHandiEl() + PayrollConst.NAM_COMMON_CNT1;
			lblLiveWithHandiEr = cmIncomeTaxDto.getLiveWithHandiEr() + PayrollConst.NAM_COMMON_CNT1;
			lblGeneralHandicap = cmIncomeTaxDto.getGeneralHandicap() + PayrollConst.NAM_COMMON_CNT1;
			lblSpecificHandicap = cmIncomeTaxDto.getSpecificHandicap() + PayrollConst.NAM_COMMON_CNT1;
		}
		if (cmMidwayEnterDto != null) {
			lblMidwayType = getCodeName(cmMidwayEnterDto.getMidwayType(), LegalConst.MIDWAY_ENTER_ARRAY);
			lblFormerIncome = insertComma(String.valueOf(cmMidwayEnterDto.getFormerIncome()))
					+ PayrollConst.NAM_COMMON_YEN;
			lblFormerInsurance = insertComma(String.valueOf(cmMidwayEnterDto.getFormerInsurance()))
					+ PayrollConst.NAM_COMMON_YEN;
			lblFormerTax = insertComma(String.valueOf(cmMidwayEnterDto.getFormerTax())) + PayrollConst.NAM_COMMON_YEN;
		}
		
		/*
				if (listFamily != null) {
					StringBuffer sb = new StringBuffer();
					for (Iterator<CmFamilyDto> it = listFamily.iterator(); it.hasNext();) {
						CmFamilyDto cmFamilyDto = it.next();
						String familyName = cmFamilyDto.getFamilyName();
						String lastName = "";
						if (mKihonDto != null) {
							lastName = mKihonDto.getKName().split(PayrollConst.STR_BLANK)[0] + PayrollConst.STR_BLANK;
						}
						familyName = familyName.replaceFirst(lastName, "");
						sb.append(getCodeName(cmFamilyDto.getFamilyRelation(), aryRelation));
						sb.append(PayrollConst.STR_TITLE_SEPARATOR);
						sb.append(familyName);
						sb.append(PayrollConst.STR_BLANK + PayrollConst.STR_BLANK);
					}
					hidFamilyInfo = sb.toString();
				}
		*/

	}
	
	/**
	 * 僼傿乕儖僪偺懨摉惈妋擣
	 * @throws MospException
	 */
	public void validate() throws MospException {
		// 懨摉惈妋擣奐巒帪張棟
		startValidation();
		// 懨摉惈妋擣廔椆帪張棟
		endValidation();
	}
	
	/**
	 * 僼傿乕儖僪愝掕(DTO偵懳偡傞VO忣曬偺僙僢僩)
	 * @param dto        愝掕懳徾DTO
	 * @param kCode      愝掕幮堳僐乕僪
	 * @param adjustYear 愝掕挷惍擭
	 */
	public void setDtoFields(CdAdjustmentDto dto, String kCode, int adjustYear) {
		dto.setKCode(kCode); // 幮堳僐乕僪
		dto.setAdjustYear(adjustYear); // 挷惍擭
		dto.setAdjustStatus(PayrollConst.ADJU_STATUS_CRE); // 擭枛挷惍寁嶼忬懺
		dto.setGeneralLifeIns(txtGeneralLifeIns); // 堦斒偺惗柦曐尟椏
		dto.setPrivatePension(txtPrivatePension); // 屄恖擭嬥曐尟椏
		dto.setLifeInsDeduction(txtLifeInsDeduction); // 惗柦曐尟椏峊彍妟
		dto.setEarthquakeIns(txtEarthquakeIns); // 抧恔曐尟椏
		dto.setLongTermDamageIns(txtLongTermDamageIns); // 媽挿婜懝奞曐尟椏
		dto.setDamageInsDeduction(txtDamageInsDeduction); // 懝奞曐尟椏峊彍妟
		dto.setSocialInsDeduction(txtSocialInsDeduction); // 幮夛曐尟椏峊彍妟
		dto.setMutualAidDeduction(txtMutualAidDeduction); // 彫婯柾婇嬈嫟嵪摍妡嬥峊彍妟
		dto.setSpouseSumIncome(txtSpouseSumIncome); // 攝嬼幰偺杮擭拞偺崌寁強摼嬥妟偺尒愊妟
		dto.setSpouseSpDeduction(txtSpouseSpDeduction); // 攝嬼幰摿暿峊彍妟
		dto.setHouseLoanDeduction(txtHouseLoanDeduction); // 廧戭庁擖嬥摍摿暿峊彍妟
		dto.setAllowanceAdjustment(txtAllowanceAdjustment); // 巟媼挷惍妟
		dto.setTaxFreeAdjustment(txtTaxFreeAdjustment); // 旕壽惻挷惍妟
		dto.setSocInsAdjustment(txtSocInsAdjustment); // 幮夛曐尟挷惍妟
		dto.setTaxIncAdjustment(txtTaxIncAdjustment); // 強摼惻挷惍妟
		dto.setWithholdSlipNotes(txtWithholdSlipNotes); // 尮愹挜廂昜揈梫棑
		dto.setPaymentAllowance(0); // 媼梌丄庤摉摍嬥妟
		dto.setPaymentIncomeTax(0); // 媼梌丄庤摉摍惻妟
		dto.setBonusAllowance(0); // 徿梌摍嬥妟
		dto.setBonusIncomeTax(0); // 徿梌摍惻妟
		dto.setMidwayAdjustIncome(0); // 拞搑丄挷惍廂擖嬥妟
		dto.setMidwayAdjustTax(0); // 拞搑丄挷惍廂擖惻妟
		dto.setAfterDeductIncome(0); // 媼梌強摼峊彍屻偺媼梌摍偺嬥妟
		dto.setPayInsDeduction(0); // 幮夛曐尟椏摍媼梌摍偐傜偺峊彍暘
		dto.setDependentsDeduction(0); // 攝嬼幰峊彍妟丄晑梴峊彍妟丄婎慴峊彍妟媦傃忈奞幰摍偺峊彍妟偺崌寁妟
		dto.setCalcTaxedIncome(0); // 嵎堷壽惻媼梌強摼嬥妟
		dto.setCalcIncomeTax(0); // 嶼弌擭惻妟
		dto.setAdjustedIncomeTax(0); // 擭挷擭惻妟
		dto.setDeductedIncomeTax(0); // 擭挷掕棪峊彍妟惻妟
		dto.setFinalIncomeTax(0); // 擭惻妟
		dto.setDeadRetirement(ckbDeadRetirement);
		dto.setSelfDisaster(ckbSelfDisaster);
		dto.setForeigner(ckbForeigner);
		
	}
	
	/**
	 * 僼傿乕儖僪弶婜壔
	 */
	public void initAllFields() {
		txtChangeKCode = "";
		hidAdjustYear = 0;
		hidKCode = "";
		initFields();
	}
	
	/**
	 * 僼傿乕儖僪弶婜壔
	 */
	public void initFields() {
		lblKName = "";
		lblStationCode = "";
		lblStationName = "";
		lblPositionCode = "";
		lblPositionName = "";
		lblEntranceDate = "";
		lblAdjustStatus = "";
		
		txtGeneralLifeIns = 0;
		txtPrivatePension = 0;
		txtLifeInsDeduction = 0;
		txtEarthquakeIns = 0;
		txtLongTermDamageIns = 0;
		txtDamageInsDeduction = 0;
		txtSocialInsDeduction = 0;
		txtMutualAidDeduction = 0;
		txtSpouseSumIncome = 0;
		txtSpouseSpDeduction = 0;
		txtHouseLoanDeduction = 0;
		txtAllowanceAdjustment = 0;
		txtTaxFreeAdjustment = 0;
		txtSocInsAdjustment = 0;
		txtTaxIncAdjustment = 0;
		txtWithholdSlipNotes = "";
		ckbDeadRetirement = String.valueOf(PayrollConst.CHECKBOX_OFF);
		ckbSelfDisaster = String.valueOf(PayrollConst.CHECKBOX_OFF);
		ckbForeigner = String.valueOf(PayrollConst.CHECKBOX_OFF);
		
		lblIncomeTaxType = "";
		lblAdjustmentType = "";
		lblSelfWidowType = "";
		lblSelfHandicapType = "";
		lblSelfStudentType = "";
		lblSpouseIntendType = "";
		lblGeneralDependent = "";
		lblSpecificDependent = "";
		lblElderlyDependent = "";
		lblLiveWithEldRel = "";
		lblLiveWithHandiGe = "";
		lblLiveWithHandiSp = "";
		lblLiveWithHandiEl = "";
		lblLiveWithHandiEr = "";
		lblGeneralHandicap = "";
		lblSpecificHandicap = "";
		
		lblMidwayType = "";
		lblFormerIncome = "";
		lblFormerInsurance = "";
		lblFormerTax = "";
	}
	
	/**
	 * JavaScript愝掕
	 * @param cls 忣曬庢摼僋儔僗
	 * @throws IllegalAccessException
	 */
	@Override
	public String getDirectJs(Class cls) throws IllegalAccessException {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDirectJs(cls));
		return sb.toString();
	}
	
	/**
	 * 僇儞儅憓擖
	 * @param strTarget
	 * @return
	 */
	public String insertComma(String strTarget) {
		String destStr = "";
		if (strTarget == null) {
			return "";
		}
		if (strTarget.equals("")) {
			return "";
		}
		destStr = strTarget.replaceAll("(?m)(?<=\\d)(?=(?:\\d{3})+$)", ",");
		return destStr;
	}
	
	// 傾僋僙僒儊僜僢僪
	public String getTxtChangeKCode() {
		return txtChangeKCode;
	}
	
	public int getHidAdjustYear() {
		return hidAdjustYear;
	}
	
	public String getHidKCode() {
		return hidKCode;
	}
	
	public String getEscTxtChangeKCode() {
		return escapeHTML(txtChangeKCode);
	}
	
	public String getEscHidKCode() {
		return escapeHTML(hidKCode);
	}
	
	@Override
	public String getEscLblKName() {
		return escapeHTML(lblKName);
	}
	
	public String getEscLblStationCode() {
		return escapeHTML(lblStationCode);
	}
	
	public String getEscLblStationName() {
		return escapeHTML(lblStationName);
	}
	
	public String getEscLblPositionCode() {
		return escapeHTML(lblPositionCode);
	}
	
	public String getEscLblPositionName() {
		return escapeHTML(lblPositionName);
	}
	
	public String getEsclblEntranceDate() {
		return escapeHTML(lblEntranceDate);
	}
	
	public String getEscLblAdjustStatus() {
		return escapeHTML(lblAdjustStatus);
	}
	
	public void setTxtChangeKCode(String txtChangeKCode) {
		this.txtChangeKCode = txtChangeKCode;
	}
	
	public void setHidAdjustYear(int hidAdjustYear) {
		this.hidAdjustYear = hidAdjustYear;
	}
	
	public int getTxtGeneralLifeIns() {
		return txtGeneralLifeIns;
	}
	
	public int getTxtPrivatePension() {
		return txtPrivatePension;
	}
	
	public int getTxtLifeInsDeduction() {
		return txtLifeInsDeduction;
	}
	
	public int getTxtEarthquakeIns() {
		return txtEarthquakeIns;
	}
	
	public int getTxtLongTermDamageIns() {
		return txtLongTermDamageIns;
	}
	
	public int getTxtDamageInsDeduction() {
		return txtDamageInsDeduction;
	}
	
	public int getTxtSocialInsDeduction() {
		return txtSocialInsDeduction;
	}
	
	public int getTxtMutualAidDeduction() {
		return txtMutualAidDeduction;
	}
	
	public int getTxtSpouseSumIncome() {
		return txtSpouseSumIncome;
	}
	
	public int getTxtSpouseSpDeduction() {
		return txtSpouseSpDeduction;
	}
	
	public int getTxtHouseLoanDeduction() {
		return txtHouseLoanDeduction;
	}
	
	public int getTxtAllowanceAdjustment() {
		return txtAllowanceAdjustment;
	}
	
	public int getTxtTaxFreeAdjustment() {
		return txtTaxFreeAdjustment;
	}
	
	public int getTxtSocInsAdjustment() {
		return txtSocInsAdjustment;
	}
	
	public int getTxtTaxIncAdjustment() {
		return txtTaxIncAdjustment;
	}
	
	public String getTxtWithholdSlipNotes() {
		return escapeHTML(txtWithholdSlipNotes);
	}
	
	public String getCkbDeadRetirement() {
		return getCheckBoxChecked(ckbDeadRetirement);
	}
	
	public String getCkbSelfDisaster() {
		return getCheckBoxChecked(ckbSelfDisaster);
	}
	
	public String getCkbForeigner() {
		return getCheckBoxChecked(ckbForeigner);
	}
	
	public String getEscCkbDeadRetirement() {
		return getCheckBoxChecked(escapeHTML(ckbDeadRetirement));
	}
	
	public String getEscCkbSelfDisaster() {
		return getCheckBoxChecked(escapeHTML(ckbSelfDisaster));
	}
	
	public String getEscCkbForeigner() {
		return getCheckBoxChecked(escapeHTML(ckbForeigner));
	}
	
	public void setTxtGeneralLifeIns(int txtGeneralLifeIns) {
		this.txtGeneralLifeIns = txtGeneralLifeIns;
	}
	
	public void setTxtPrivatePension(int txtPrivatePension) {
		this.txtPrivatePension = txtPrivatePension;
	}
	
	public void setTxtLifeInsDeduction(int txtLifeInsDeduction) {
		this.txtLifeInsDeduction = txtLifeInsDeduction;
	}
	
	public void setTxtEarthquakeIns(int txtEarthquakeIns) {
		this.txtEarthquakeIns = txtEarthquakeIns;
	}
	
	public void setTxtLongTermDamageIns(int txtLongTermDamageIns) {
		this.txtLongTermDamageIns = txtLongTermDamageIns;
	}
	
	public void setTxtDamageInsDeduction(int txtDamageInsDeduction) {
		this.txtDamageInsDeduction = txtDamageInsDeduction;
	}
	
	public void setTxtSocialInsDeduction(int txtSocialInsDeduction) {
		this.txtSocialInsDeduction = txtSocialInsDeduction;
	}
	
	public void setTxtMutualAidDeduction(int txtMutualAidDeduction) {
		this.txtMutualAidDeduction = txtMutualAidDeduction;
	}
	
	public void setTxtSpouseSumIncome(int txtSpouseSumIncome) {
		this.txtSpouseSumIncome = txtSpouseSumIncome;
	}
	
	public void setTxtSpouseSpDeduction(int txtSpouseSpDeduction) {
		this.txtSpouseSpDeduction = txtSpouseSpDeduction;
	}
	
	public void setTxtHouseLoanDeduction(int txtHouseLoanDeduction) {
		this.txtHouseLoanDeduction = txtHouseLoanDeduction;
	}
	
	public void setTxtAllowanceAdjustment(int txtAllowanceAdjustment) {
		this.txtAllowanceAdjustment = txtAllowanceAdjustment;
	}
	
	public void setTxtTaxFreeAdjustment(int txtTaxFreeAdjustment) {
		this.txtTaxFreeAdjustment = txtTaxFreeAdjustment;
	}
	
	public void setTxtSocInsAdjustment(int txtSocInsAdjustment) {
		this.txtSocInsAdjustment = txtSocInsAdjustment;
	}
	
	public void setTxtTaxIncAdjustment(int txtTaxIncAdjustment) {
		this.txtTaxIncAdjustment = txtTaxIncAdjustment;
	}
	
	public void setTxtWithholdSlipNotes(String txtWithholdSlipNotes) {
		this.txtWithholdSlipNotes = txtWithholdSlipNotes;
	}
	
	public void setCkbDeadRetirement(String ckbDeadRetirement) {
		this.ckbDeadRetirement = ckbDeadRetirement;
	}
	
	public void setCkbSelfDisaster(String ckbSelfDisaster) {
		this.ckbSelfDisaster = ckbSelfDisaster;
	}
	
	public void setCkbForeigner(String ckbForeigner) {
		this.ckbForeigner = ckbForeigner;
	}
	
	public String getEscLblIncomeTaxType() {
		return escapeHTML(lblIncomeTaxType);
	}
	
	public String getEscLblAdjustmentType() {
		return escapeHTML(lblAdjustmentType);
	}
	
	public String getEscLblSelfWidowType() {
		return escapeHTML(lblSelfWidowType);
	}
	
	public String getEscLblSelfHandicapType() {
		return escapeHTML(lblSelfHandicapType);
	}
	
	public String getEscLblSelfStudentType() {
		return escapeHTML(lblSelfStudentType);
	}
	
	public String getEscLblSpouseIntendType() {
		return escapeHTML(lblSpouseIntendType);
	}
	
	public String getEscLblGeneralDependent() {
		return escapeHTML(lblGeneralDependent);
	}
	
	public String getEscLblSpecificDependent() {
		return escapeHTML(lblSpecificDependent);
	}
	
	public String getEscLblElderlyDependent() {
		return escapeHTML(lblElderlyDependent);
	}
	
	public String getEscLblLiveWithEldRel() {
		return escapeHTML(lblLiveWithEldRel);
	}
	
	public String getEscLblLiveWithHandiGe() {
		return escapeHTML(lblLiveWithHandiGe);
	}
	
	public String getEscLblLiveWithHandiSp() {
		return escapeHTML(lblLiveWithHandiSp);
	}
	
	public String getEscLblLiveWithHandiEl() {
		return escapeHTML(lblLiveWithHandiEl);
	}
	
	public String getEscLblLiveWithHandiEr() {
		return escapeHTML(lblLiveWithHandiEr);
	}
	
	public String getEscLblGeneralHandicap() {
		return escapeHTML(lblGeneralHandicap);
	}
	
	public String getEscLblSpecificHandicap() {
		return escapeHTML(lblSpecificHandicap);
	}
	
	public String getEscLblMidwayType() {
		return escapeHTML(lblMidwayType);
	}
	
	public String getEscLblFormerIncome() {
		return escapeHTML(lblFormerIncome);
	}
	
	public String getEscLblFormerInsurance() {
		return escapeHTML(lblFormerInsurance);
	}
	
	public String getEscLblFormerTax() {
		return escapeHTML(lblFormerTax);
	}
	
	public String getEscHidFamilyInfo() {
		return escapeHTML(hidFamilyInfo);
	}
}
