/*
 * 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.dto;

import jp.mosp.common.common.BaseDto;

public class ResideTransferFBDataDto extends BaseDto {
	
	private static final long	serialVersionUID	= 3322927888185971287L;
	
	// 僼傿乕儖僪
	private String				cityCode;									// 巗挰懞僐乕僪
	private String				cityKana;									// 巗挰懞僇僫
	private String				designatedNumber;							// 巜掕斣崋
	private int					paymentCount;								// 媼梌審悢
	private String				paymentTax;								// 媼梌惻妟
	private int					retireTax;									// 戅怑惻妟
	private int					retireCount;								// 戅怑恖堳
	private int					totalCount;								// 崌寁審悢
	private int					totalTax;									// 崌寁惻妟
	private String				cityChanges;								// 堎摦桳柍
	private long				cityPayAmount;								// 巟暐嬥妟
	private int					cityTax;									// 巗挰懞惻
	private int					prefectureTax;								// 摴晎導惻
																			
	
	/**
	 * 僐儞僗僩儔僋僞
	 */
	public ResideTransferFBDataDto() {
		super();
	}
	
	/**
	 * 僐儞僗僩儔僋僞
	 */
	public ResideTransferFBDataDto(ResideTransferFBDataDto resideTransferFBDataDto, CmCityDto cmCityDto,
			CtRetireDetailDto ctRetireDetailDto) {
		if (resideTransferFBDataDto != null) {
			paymentCount = resideTransferFBDataDto.getPaymentCount();
			paymentTax = resideTransferFBDataDto.getPaymentTax();
		}
		if (cmCityDto != null) {
			cityCode = cmCityDto.getCityCode();
			cityKana = cmCityDto.getCityKana();
			designatedNumber = cmCityDto.getDesignatedNumber();
		}
		
		if (ctRetireDetailDto != null) {
			cityChanges = getStringParam(ctRetireDetailDto.getCityChanges());
			retireCount = ctRetireDetailDto.getRetireCount();
			cityPayAmount = ctRetireDetailDto.getCityPayAmount();
			cityTax = ctRetireDetailDto.getCityTax();
			prefectureTax = ctRetireDetailDto.getPrefectureTax();
		} else {
			cityChanges = "";
			retireCount = 0;
			cityPayAmount = 0;
			cityTax = 0;
			prefectureTax = 0;
		}
		cityChanges = "";
		retireCount = 0;
		cityPayAmount = 0;
		cityTax = 0;
		prefectureTax = 0;
		
		// 戅怑惻妟庢摼
		calcRetireTax();
		// 崌寁愝掕
		calcTotal();
	}
	
	/**
	 * 戅怑惻妟庢摼
	 *
	 */
	private void calcRetireTax() {
		retireTax = cityTax + prefectureTax;
		
	}
	
	/**
	 * 崌寁庢摼
	 *
	 */
	private void calcTotal() {
		if (paymentTax == null) {
			paymentTax = "0";
			
		}
		totalCount = retireCount + paymentCount;
		totalTax = retireTax + Integer.parseInt(paymentTax);
	}
	
	/**
	 * 暥帤楍愝掕
	 * @param strTarget
	 * @return
	 */
	
	private String getStringParam(String strTarget) {
		// NULL偺応崌嬻傪愝掕
		if (strTarget == null) {
			return "";
		}
		return strTarget;
		
	}
	
	// 傾僋僙僒儊僜僢僪
	public String getCityCode() {
		return cityCode;
	} // 巗挰懞僐乕僪
	
	public String getCityKana() {
		return cityKana;
	} // 巗挰懞僇僫
	
	public String getDesignatedNumber() {
		return designatedNumber;
	} // 巜掕斣崋
	
	public int getPaymentCount() {
		return paymentCount;
	} // 媼梌審悢
	
	public String getPaymentTax() {
		return paymentTax;
	} // 媼梌惻妟
	
	public int getRetireTax() {
		return retireTax;
	} // 戅怑惻妟
	
	public int getTotalCount() {
		return totalCount;
	} // 崌寁審悢
	
	public int getTotalTax() {
		return totalTax;
	} // 崌寁惻妟
	
	public String getCityChanges() {
		return cityChanges;
	} // 堎摦桳柍
	
	public int getRetireCount() {
		return retireCount;
	} // 戅怑恖堳
	
	public long getCityPayAmount() {
		return cityPayAmount;
	} // 巟暐嬥妟
	
	public int getCityTax() {
		return cityTax;
	} // 巗挰懞惻
	
	public int getPrefectureTax() {
		return prefectureTax;
	} // 摴晎導惻
	
	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	} // 巗挰懞僐乕僪
	
	public void setCityKana(String cityKana) {
		this.cityKana = cityKana;
	} // 巗挰懞僇僫
	
	public void setDesignatedNumber(String designatedNumber) {
		this.designatedNumber = designatedNumber;
	} // 巜掕斣崋
	
	public void setPaymentCount(int paymentCount) {
		this.paymentCount = paymentCount;
	} // 媼梌審悢
	
	public void setPaymentTax(String paymentTax) {
		this.paymentTax = paymentTax;
	} // 媼梌惻妟
	
	public void setRetireTax(int retireTax) {
		this.retireTax = retireTax;
	} // 戅怑惻妟
	
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	} // 崌寁審悢
	
	public void setTotalTax(int totalTax) {
		this.totalTax = totalTax;
	} // 崌寁惻妟
	
	public void setCityChanges(String cityChanges) {
		this.cityChanges = cityChanges;
	} // 堎摦桳柍
	
	public void setRetireCount(int retireCount) {
		this.retireCount = retireCount;
	} // 戅怑恖堳
	
	public void setCityPayAmount(int cityPayAmount) {
		this.cityPayAmount = cityPayAmount;
	} // 巟暐嬥妟
	
	public void setCityTax(int cityTax) {
		this.cityTax = cityTax;
	} // 巗挰懞惻
	
	public void setPrefectureTax(int prefectureTax) {
		this.prefectureTax = prefectureTax;
	} // 摴晎導惻	
	
}
