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

//import java.util.ArrayList;
/*import org.apache.commons.fileupload.FileItem;
import jp.mosp.common.common.MospUtility;
import jp.mosp.common.common.ValidateUtility;
import jp.mosp.common.common.FileUploadUtility;
import jp.mosp.common.common.MospConst;*/

import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import jp.mosp.common.common.MospException;
import jp.mosp.legal.LegalReportUtility;
import jp.mosp.payroll.base.PayrollVo;
import jp.mosp.payroll.dto.CmBankDto;
import jp.mosp.payroll.dto.CmBranchDto;

/**
 * @author koike
 *
 */
public class CompanyBankBranchEditVo extends PayrollVo {
	
	private static final long	serialVersionUID			= -7291794568091285524L;
	
	public static final int		MODE_INSERT					= 0;
	public static final int		MODE_UPDATE					= 1;
	
	// パラメータ名
	public static final String	PRM_TXT_BANK_CODE			= "txtBankCode";
	public static final String	PRM_TXT_BANK_NAME			= "txtBankName";
	public static final String	PRM_TXT_BANK_KANA			= "txtBankKana";
	public static final String	PRM_TXT_BRANCH_CODE			= "txtBranchCode";
	public static final String	PRM_TXT_BRANCH_NAME			= "txtBranchName";
	public static final String	PRM_TXT_BRANCH_KANA			= "txtBranchKana";
	
	public static final String	PRM_TXT_SEARCH_BANK_CODE	= "txtSearchBankCode";
	public static final String	PRM_TXT_SEARCH_BANK_KANA	= "txtSearchBankKana";
	public static final String	PRM_TXT_SEARCH_BRANCH_CODE	= "txtSearchBranchCode";
	public static final String	PRM_TXT_SEARCH_BRANCH_KANA	= "txtSearchBranchKana";
	
	public static final String	PRM_FIL_UPLOAD_FILE			= "filUploadFile";
	public static final String	PRM_FIL_UPLOAD_BRANCH_FILE	= "filUploadBranchFile";
	
	// フィールド
	private String[]			aryBankCode;
	private String[]			aryBankName;
	private String[]			aryBankKana;
	private String[]			aryBranchCode;
	private String[]			aryBranchName;
	private String[]			aryBranchKana;
	
	private String				txtBankCode;
	private String				txtBankName;
	private String				txtBankKana;
	private String				txtBranchCode;
	private String				txtBranchName;
	private String				txtBranchKana;
	
	private String				txtSearchBankCode;
	private String				txtSearchBankKana;
	private String				txtSearchBranchCode;
	private String				txtSearchBranchKana;
	
	/*private FileItem filUploadFile ;
	private FileItem filUploadBranchFile;*/

	private int					idxBankCode;
	private int					idxBranchCode;
	//private int idxCalcDate  ;
	private String				bankCode;
	private String				branchCode;
	private Date				calcDate;
	
	/**
	 * 
	 */
	public int					aryBankItemNo;
	/**
	 * 
	 */
	public int[]				aryBankNameItemNo			= { 1, 2 };
	
	/**
	 * 
	 */
	public int					aryBranchItemNo;
	/**
	 * 
	 */
	public int[]				aryBranchNameItemNo			= { 1, 2 };
	
	// フィールド名及び制限
	public static final String	NAM_BANK_CODE				= "銀行コード";
	public static final String	NAM_BRANCH_CODE				= "支店コード";
	public static final String	NAM_BANK_NAME				= "銀行名";
	public static final String	NAM_BRANCH_NAME				= "支店名";
	public static final String	NAM_BANK_KANA				= "銀行フリガナ";
	public static final String	NAM_BRANCH_KANA				= "支店フリガナ";
	public static final String	NAM_CSV_KEY					= "銀行コード";
	public static final String	NAM_CSV_KEY2				= "支店コード";
	
	public static final int		LEN_BANK_CODE				= 4;
	public static final int		LEN_BRANCH_CODE				= 3;
	public static final int		LEN_BANK_NAME				= 20;
	public static final int		LEN_BRANCH_NAME				= 20;
	public static final int		LEN_BANK_KANA				= 15;
	public static final int		LEN_BRANCH_KANA				= 15;
	
	// ソートキー
	public final String			KEY_BANK_CODE				= "keyBankCode";
	public final String			KEY_BRANCH_CODE				= "keyBranchCode";
	public final String			KEY_BANK_NAME				= "keyBankName";
	public final String			KEY_BRANCH_NAME				= "keyBranchName";
	public final String			KEY_BANK_KANA				= "keyBankKana";
	public final String			KEY_BRANCH_KANA				= "keyBranchKana";
	
	// モード(0：登録、1：更新)
	private int					mode;
	

	/**
	 * コンストラクタ
	 */
	public CompanyBankBranchEditVo() {
		super();
		txtBankCode = "";
		txtBankName = "";
		txtBankKana = "";
		txtBranchCode = "";
		txtBranchName = "";
		txtBranchKana = "";
		aryBankCode = new String[0];
		aryBankName = new String[0];
		aryBankKana = new String[0];
		aryBranchCode = new String[0];
		aryBranchName = new String[0];
		aryBranchKana = new String[0];
		setFormerKey(KEY_BANK_CODE);
	}
	
	/* (non-Javadoc)
	 * @see jp.mosp.payroll.base.PayrollVo#setSubTitle()
	 */
	@Override
	protected void setSubTitle() {
		super.setSubTitle();
		subTitle = getName("P_BANK") + getName("P_BRANCH") + getName("C_MASTER") + getName("P_MAINTENANCE");
		addAryMenu("P1002", getName("P_PAYROLL") + getName("C_MASTER") + getName("C_MENU") + getName("C_TO"));
	}
	
	/**
	 * パラメータ設定
	 * @param request リクエスト
	 */
	public void setParams(HttpServletRequest request) {
		txtBankCode = request.getParameter(PRM_TXT_BANK_CODE);
		txtBankName = request.getParameter(PRM_TXT_BANK_NAME);
		txtBankKana = request.getParameter(PRM_TXT_BANK_KANA);
	}
	
	/**
	 * パラメータ設定
	 * @param request リクエスト
	 */
	public void setParams2(HttpServletRequest request) {
		txtBankCode = request.getParameter(PRM_TXT_BANK_CODE);
		txtBranchCode = request.getParameter(PRM_TXT_BRANCH_CODE);
		txtBranchName = request.getParameter(PRM_TXT_BRANCH_NAME);
		txtBranchKana = request.getParameter(PRM_TXT_BRANCH_KANA);
	}
	
	/**
	 * パラメータ設定
	 * @param request リクエスト
	 */
	public void setParamsSearch(HttpServletRequest request) {
		txtSearchBankCode = request.getParameter(PRM_TXT_SEARCH_BANK_CODE);
		txtSearchBankKana = request.getParameter(PRM_TXT_SEARCH_BANK_KANA);
		txtSearchBranchCode = request.getParameter(PRM_TXT_SEARCH_BRANCH_CODE);
		txtSearchBranchKana = request.getParameter(PRM_TXT_SEARCH_BRANCH_KANA);
	}
	
	/**
	 * パラメータ設定
	 * @param list リクエストリスト
	 */
	/*public void setUploadFile(List list)  throws Exception {
		filUploadFile = FileUploadUtility.getMultipartFile(list, PRM_FIL_UPLOAD_FILE);
	}

	public void setUploadBranchFile(List list) throws Exception {
		filUploadBranchFile = FileUploadUtility.getMultipartFile(list, PRM_FIL_UPLOAD_BRANCH_FILE);
	}*/

	/**
	 * フィールド設定
	 * @param dto 
	 */
	public void setFields(CmBankDto dto) {
		txtBankCode = dto.getBankCode();
		txtBankName = dto.getBankName();
		txtBankKana = dto.getBankKana();
	}
	
	/**
	 * フィールド設定
	 * @param dto
	 */
	public void setFields2(CmBranchDto dto) {
		txtBankCode = dto.getBankCode();
		txtBranchCode = dto.getBranchCode();
		txtBranchName = dto.getBranchName();
		txtBranchKana = dto.getBranchKana();
	}
	
	/**
	 * フィールド設定
	 * @param listCmBank 銀行マスタリスト
	 * @throws MospException
	 */
	public void setFields(List<CmBankDto> listCmBank) {
		// リストの設定
		list = listCmBank;
		// データ総数の取得
		count = listCmBank.size();
		// 配列の初期化
		aryBankCode = new String[count];
		aryBankName = new String[count];
		aryBankKana = new String[count];
		// データの設定
		int i = 0;
		String[] bankZero;
		bankZero = new String[LEN_BANK_CODE];
		Iterator it = listCmBank.iterator();
		while (it.hasNext()) {
			CmBankDto dto = (CmBankDto)it.next();
			aryBankCode[i] = "";
			if (dto.getBankCode() == null) {
				//aryBankCode[i] = null;
			} else if (LEN_BANK_CODE != dto.getBankCode().length()) {
				for (int j = 0; j < LEN_BANK_CODE - dto.getBankCode().length(); j++) {
					bankZero[j] = "0";
					aryBankCode[i] += bankZero[j];
				}
				aryBankCode[i] += dto.getBankCode();
			} else if (LEN_BANK_CODE == dto.getBankCode().length()) {
				aryBankCode[i] = escapeHTML(dto.getBankCode());
			}
			aryBankName[i] = escapeHTML(dto.getBankName());
			aryBankKana[i] = escapeHTML(dto.getBankKana());
			i++;
		}
		
	}
	
	/**
	 * フィールド設定
	 * @param listCmBranch マスタリスト
	 * @throws MospException
	 */
	public void setFields2(List<CmBranchDto> listCmBranch) {
		// リストの設定
		list = listCmBranch;
		// データ総数の取得
		count = listCmBranch.size();
		// 配列の初期化
		aryBankCode = new String[count];
		aryBankName = new String[count];
		aryBankKana = new String[count];
		aryBranchCode = new String[count];
		aryBranchName = new String[count];
		aryBranchKana = new String[count];
		
		// データの設定
		int i = 0;
		String[] bankZero;
		String[] branchZero;
		bankZero = new String[LEN_BANK_CODE];
		branchZero = new String[LEN_BRANCH_CODE];
		Iterator it = listCmBranch.iterator();
		while (it.hasNext()) {
			CmBranchDto dto = (CmBranchDto)it.next();
			aryBankCode[i] = "";
			if (dto.getBankCode() == null) {
				//aryBankCode[i] = null;
			} else if (LEN_BANK_CODE != dto.getBankCode().length()) {
				for (int j = 0; j < LEN_BANK_CODE - dto.getBankCode().length(); j++) {
					bankZero[j] = "0";
					aryBankCode[i] += bankZero[j];
				}
				aryBankCode[i] += dto.getBankCode();
			} else if (LEN_BANK_CODE == dto.getBankCode().length()) {
				aryBankCode[i] = escapeHTML(dto.getBankCode());
			}
			aryBranchCode[i] = "";
			if (dto.getBranchCode() == null) {
				//aryBranchCode[i] = null;
			} else if (LEN_BRANCH_CODE != dto.getBranchCode().length()) {
				for (int j = 0; j < LEN_BRANCH_CODE - dto.getBranchCode().length(); j++) {
					branchZero[j] = "0";
					aryBranchCode[i] += branchZero[j];
				}
				aryBranchCode[i] += dto.getBranchCode();
			} else if (LEN_BRANCH_CODE == dto.getBranchCode().length()) {
				aryBranchCode[i] = escapeHTML(dto.getBranchCode());
			}
			aryBranchName[i] = escapeHTML(dto.getBranchName());
			aryBranchKana[i] = escapeHTML(dto.getBranchKana());
			i++;
		}
	}
	
	/**
	 * 検索時銀行名取得
	 * @param cmBankDto
	 * @param idx 
	 */
	public void setSearchOfBankName(CmBankDto cmBankDto, int idx) {
		if (cmBankDto == null) {
			return;
		}
		if (aryBankCode.length == 0) {
			return;
		}
		aryBankName[idx] = escapeHTML(cmBankDto.getBankName());
		aryBankKana[idx] = escapeHTML(cmBankDto.getBankKana());
	}
	
	/**
	 * 前ゼロ付与
	 * @param targetNo 対象文字列
	 * @param targetLength 項目長
	 * @return
	 */
	private String setBeforeZero(String targetNo, int targetLength) {
		// 設定準備
		String retString = "";
		// 対象が空じゃなければ前ゼロ設定
		if (!targetNo.equals("")) {
			retString = LegalReportUtility.getZero(targetNo, targetLength);
		}
		return retString;
	}
	
	/**
	 * ヘッダーNO取得(銀行)
	 * @throws Exception
	 */
	/*public String getHeadNo(String code,String[][] aryHeadItem,int idx) throws Exception {
		String retString = "";
		for (int i = 0; i < aryHeadItem.length; i++) {
			if (code.equals("BANK_CODE")) {
				setIdxBankCode(idx);
			}
			if (code.equals(aryHeadItem[i][1])) {
				retString = aryHeadItem[i][0];
				return retString;
			}
		}
		return "";
	}
	
	*//**
		* ヘッダーNO取得(支店)
		* @throws Exception
		*/
	/*
	public String getHeadNo2(String code,String[][] aryHeadItem,int idx,int idx2) throws Exception {
	String retString = "";
	for (int i = 0; i < aryHeadItem.length; i++) {
		if (code.equals("BANK_CODE")) {
			setIdxBankCode(idx);
		}
		if (code.equals("BRANCH_CODE")) {
			setIdxBranchCode(idx2);
		}
		if (code.equals(aryHeadItem[i][1])) {
			retString = aryHeadItem[i][0];
			return retString;
		}
	}
	return "";
	}
	
	
	*//**
		* ヘッダーデータ妥当性チェック(銀行)
		* @throws Exception
		*/
	/*
	public boolean checkHeadData(String code,String[][] aryHeadItem) throws Exception {
	for (int i = 0; i < aryHeadItem.length; i++) {
		if (code.equals(aryHeadItem[i][1])) {
			return true;
		}
		if (i != aryHeadItem.length -1) {
			continue;
		}
		return false;
	}
	return true;
	}
	
	*//**
		* csvデータの妥当性確認(銀行)
		* @throws MospException
		*/
	/*
	public boolean validateBank(String value, int headerNo, String[][] aryHeaderName,  int csvRowCount, boolean isAddRegsit) throws MospException {
	isValid = isAddRegsit;
	int rowCount = csvRowCount;
	rowCount += 1;
	String errReplace = aryHeaderName[headerNo]+","+ String.valueOf(rowCount);
	if (headerNo-1 == idxBankCode) {
		checkRequired(value, NAM_CSV_KEY,  "");
	} else if (	headerNo-1 == aryBankItemNo) {
		if (headerNo == idxBankCode) {
			checkCsvNumeric(value, errReplace, "");
			checkCsvLength(value, LEN_BANK_CODE, aryHeaderName[headerNo][1], rowCount);
		}
	} else if (	headerNo == aryBankNameItemNo[0]){
		// 長さ確認
		checkCsvLength(value, LEN_BANK_NAME, aryHeaderName[headerNo][1], rowCount);
	} else {
		// 長さ確認
		checkCsvLength(value, LEN_BANK_KANA, aryHeaderName[headerNo][1], rowCount);
	}
	return isValid;
	
	}
	
	*//**
		* csvデータの妥当性確認(支店)
		* @throws MospException
		*/
	/*
	public boolean validateBranch(String value, int headerNo, String[][] aryHeaderName,  int csvRowCount, boolean isAddRegsit) throws MospException {
	isValid = isAddRegsit;
	int rowCount = csvRowCount;
	rowCount += 1;
	String errReplace = aryHeaderName[headerNo]+","+ String.valueOf(rowCount);
	if (headerNo == idxBankCode ) {
		checkRequired(value, NAM_CSV_KEY,  "");
	} else if (	headerNo == aryBankItemNo && headerNo == aryBranchItemNo) {
		if (headerNo == idxBankCode) {
			checkCsvNumeric(value, errReplace, "");
			checkCsvLength(value, LEN_BANK_CODE, aryHeaderName[headerNo][1], rowCount);
		}
		if (headerNo == idxBranchCode) {
			checkCsvNumeric(value, errReplace, "");
			checkCsvLength(value, LEN_BRANCH_CODE, aryHeaderName[headerNo][1], rowCount);
		}
	} else if (	headerNo == aryBranchNameItemNo[0]){
		// 長さ確認
		checkCsvLength(value, LEN_BRANCH_NAME, aryHeaderName[headerNo][1], rowCount);
	} else {
		// 長さ確認
		checkCsvLength(value, LEN_BRANCH_KANA, aryHeaderName[headerNo][1], rowCount);
	}
	return isValid;
	}
	
	
	*//**
		* 文字列タイプ確認(数値：double)
		* @param value 確認対象文字列
		* @param name  確認対象名称
		* @param id    確認対象フィールドID
		* @throws MospException
		*/
	/*
	protected void checkCsvNumeric(String value, String name, String id) throws MospException {
	if (!ValidateUtility.chkNumeric(value)) {
		String errMsg = MospUtility.getMessage(msg, "WC0022", name);
		addErrMessage(errMsg);
		addErrField(id);
		isValid = false;
	}
	}
	
	*//**
		* 文字列長確認(最大文字数)
		* @param value     確認対象文字列
		* @param maxLength 最大文字数
		* @param name      確認対象名称
		* @param id        確認対象フィールドID
		* @throws MospException
		*/
	/*
	protected void checkCsvLength(String value, int maxLength, String name, int idx) throws MospException {
	String regex = ".{0," + String.valueOf(maxLength) + "}";
	if (!ValidateUtility.chkRegex(regex, value)) {
		String errMsg = MospUtility.getMessage(msg, "WC0021", name + MospConst.DATA_SEPARATOR + String.valueOf(maxLength) + MospConst.DATA_SEPARATOR + idx);
		addErrMessage(errMsg);
		addErrField("");
		isValid = false;
	}
	}
	
	*//**
		* csvキーデータ取得
		*/
	/*
	public void setKeyData(String value,int idx) throws MospException {
	if (idx == getIdxBankCode()) {
		setBankCode(value);
	}
	}*/

	/**
	 * フィールドの妥当性確認
	 * @throws MospException
	 */
	public void validate() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		String bankCode = setBeforeZero(txtBankCode, LEN_BANK_CODE);
		txtBankCode = bankCode;
		// 必須確認
		checkRequired(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		// 文字タイプ確認
		checkCode(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		// 文字列長確認
		checkLength(txtBankCode, LEN_BANK_CODE, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkLength(txtBankName, LEN_BANK_NAME, NAM_BANK_NAME, PRM_TXT_BANK_NAME);
		checkLength(txtBankKana, LEN_BANK_KANA, NAM_BANK_KANA, PRM_TXT_BANK_KANA);
		// 数字確認
		checkNumeric(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		// 妥当性確認終了時処理
		endValidation();
	}
	
	/**
	 * フィールドの妥当性確認
	 * @throws MospException
	 */
	public void validate2() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		String bankCode = setBeforeZero(txtBankCode, LEN_BANK_CODE);
		txtBankCode = bankCode;
		// 必須確認
		checkRequired(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		// 文字タイプ確認
		checkCode(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		// 文字列長確認
		checkLength(txtBankCode, LEN_BANK_CODE, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkLength(txtBankName, LEN_BANK_NAME, NAM_BANK_NAME, PRM_TXT_BANK_NAME);
		checkLength(txtBankKana, LEN_BANK_KANA, NAM_BANK_KANA, PRM_TXT_BANK_KANA);
		// 数字確認
		checkNumeric(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		// 妥当性確認終了時処理
		endValidation();
	}
	
	/**
	 * フィールドの妥当性確認
	 * @throws MospException
	 */
	public void validate3() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		String bankCode = setBeforeZero(txtBankCode, LEN_BANK_CODE);
		String branchCode = setBeforeZero(txtBranchCode, LEN_BRANCH_CODE);
		txtBankCode = bankCode;
		txtBranchCode = branchCode;
		// 必須確認
		checkRequired(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		
		checkRequired(txtBranchCode, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		// 文字タイプ確認
		checkCode(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkCode(txtBranchCode, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		
		// 文字列長確認
		checkLength(txtBankCode, LEN_BANK_CODE, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkLength(txtBranchCode, LEN_BRANCH_CODE, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		checkLength(txtBranchName, LEN_BRANCH_NAME, NAM_BRANCH_NAME, PRM_TXT_BRANCH_NAME);
		checkLength(txtBranchKana, LEN_BRANCH_KANA, NAM_BRANCH_KANA, PRM_TXT_BRANCH_KANA);
		// 数字確認
		checkNumeric(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkNumeric(txtBranchCode, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		// 妥当性確認終了時処理
		endValidation();
	}
	
	/**
	 * フィールドの妥当性確認
	 * @throws MospException
	 */
	public void validate4() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		String bankCode = setBeforeZero(txtBankCode, LEN_BANK_CODE);
		String branchCode = setBeforeZero(txtBranchCode, LEN_BRANCH_CODE);
		txtBankCode = bankCode;
		txtBranchCode = branchCode;
		// 必須確認
		checkRequired(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		
		checkRequired(txtBranchCode, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		// 文字タイプ確認
		checkCode(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkCode(txtBranchCode, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		
		// 文字列長確認
		checkLength(txtBankCode, LEN_BANK_CODE, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkLength(txtBranchCode, LEN_BRANCH_CODE, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		checkLength(txtBranchName, LEN_BRANCH_NAME, NAM_BRANCH_NAME, PRM_TXT_BRANCH_NAME);
		checkLength(txtBranchKana, LEN_BRANCH_KANA, NAM_BRANCH_KANA, PRM_TXT_BRANCH_KANA);
		// 数字確認
		checkNumeric(txtBankCode, NAM_BANK_CODE, PRM_TXT_BANK_CODE);
		checkNumeric(txtBranchCode, NAM_BRANCH_CODE, PRM_TXT_BRANCH_CODE);
		// 妥当性確認終了時処理
		endValidation();
	}
	
	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	/*public void setDtoFields2(
			CmBankDto dto,
			String bankName,
			String bankKana
	) {
		dto.setBankCode (txtBankCode);
		dto.setBankName (txtBankName);
		dto.setBankKana (txtBankKana);
	}*/

	/**
	 * 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();
	}
	
	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFields(CmBankDto dto) {
		dto.setBankCode(txtBankCode);
		dto.setBankName(txtBankName);
		dto.setBankKana(txtBankKana);
//		 前ゼロ設定項目
		// 振込銀行、振込支店、口座番号は空以外、指定文字になるまで前を「0」で埋める。
		String bankCode = setBeforeZero(txtBankCode, LEN_BANK_CODE);
		dto.setBankCode(bankCode);
	}
	
	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFields(CmBranchDto dto) {
		dto.setBankCode(txtBankCode);
		dto.setBranchCode(txtBranchCode);
		dto.setBranchName(txtBranchName);
		dto.setBranchKana(txtBranchKana);
		String bankCode = setBeforeZero(txtBankCode, LEN_BANK_CODE);
		dto.setBankCode(bankCode);
		String branchCode = setBeforeZero(txtBranchCode, LEN_BRANCH_CODE);
		dto.setBranchCode(branchCode);
	}
	
	// アクセサメソッド
	public void setTxtBankCode(String txtBankCode) {
		this.txtBankCode = txtBankCode;
	}
	
	public void setTxtBankName(String txtBankName) {
		this.txtBankName = txtBankName;
	}
	
	public void setTxtBankKana(String txtBankKana) {
		this.txtBankKana = txtBankKana;
	}
	
	public void setTxtBranchCode(String txtBranchCode) {
		this.txtBranchCode = txtBranchCode;
	}
	
	public void setTxtBranchName(String txtBranchName) {
		this.txtBranchName = txtBranchName;
	}
	
	public void setTxtBranchKana(String txtBranchKana) {
		this.txtBranchKana = txtBranchKana;
	}
	
	public void setTxtSearchBankCode(String txtSearchBankCode) {
		this.txtSearchBankCode = txtSearchBankCode;
	}
	
	public void setTxtSearchBankKana(String txtSearchBankKana) {
		this.txtSearchBankKana = txtSearchBankKana;
	}
	
	public void setTxtSearchBranchCode(String txtSearchBranchCode) {
		this.txtSearchBranchCode = txtSearchBranchCode;
	}
	
	public void setTxtSearchBranchKana(String txtSearchBranchKana) {
		this.txtSearchBranchKana = txtSearchBranchKana;
	}
	
	public void setMode(int mode) {
		this.mode = mode;
	}
	
	/*public FileItem getFilUploadFile  () { return filUploadFile ; }
	public FileItem getFilUploadBranchFile  () { return filUploadBranchFile ;}*/

	public String[] getEscAryBankCode() {
		return aryBankCode.clone();
	}
	
	public String[] getEscAryBankName() {
		return aryBankName.clone();
	}
	
	public String[] getEscAryBankKana() {
		return aryBankKana.clone();
	}
	
	public String[] getEscAryBranchCode() {
		return aryBranchCode.clone();
	}
	
	public String[] getEscAryBranchName() {
		return aryBranchName.clone();
	}
	
	public String[] getEscAryBranchKana() {
		return aryBranchKana.clone();
	}
	
	public String getTxtBankCode() {
		return txtBankCode;
	}
	
	public String getTxtBankName() {
		return txtBankName;
	}
	
	public String getTxtBankKana() {
		return txtBankKana;
	}
	
	public String getTxtBranchCode() {
		return txtBranchCode;
	}
	
	public String getTxtBranchName() {
		return txtBranchName;
	}
	
	public String getTxtBranchKana() {
		return txtBranchKana;
	}
	
	public String getTxtSearchBankCode() {
		return txtSearchBankCode;
	}
	
	public String getTxtSearchBankKana() {
		return txtSearchBankKana;
	}
	
	public String getTxtSearchBranchCode() {
		return txtSearchBranchCode;
	}
	
	public String getTxtSearchBranchKana() {
		return txtSearchBranchKana;
	}
	
	public String getEscTxtBankCode() {
		return escapeHTML(txtBankCode);
	}
	
	public String getEscTxtBankName() {
		return escapeHTML(txtBankName);
	}
	
	public String getEscTxtBankKana() {
		return escapeHTML(txtBankKana);
	}
	
	public String getEscTxtBranchCode() {
		return escapeHTML(txtBranchCode);
	}
	
	public String getEscTxtBranchName() {
		return escapeHTML(txtBranchName);
	}
	
	public String getEscTxtBranchKana() {
		return escapeHTML(txtBranchKana);
	}
	
	public String getEscTxtSearchBankCode() {
		return escapeHTML(txtSearchBankCode);
	}
	
	public String getEscTxtSearchBankKana() {
		return escapeHTML(txtSearchBankKana);
	}
	
	public String getEscTxtSearchBranchCode() {
		return escapeHTML(txtSearchBranchCode);
	}
	
	public String getEscTxtSearchBranchKana() {
		return escapeHTML(txtSearchBranchKana);
	}
	
	public int getMode() {
		return mode;
	}
	
	public void setIdxBankCode(int idxBankcode) {
		idxBankCode = idxBankcode;
	}
	
	public int getIdxBankCode() {
		return idxBankCode;
	}
	
	public void setIdxBranchCode(int idxBranchCode) {
		this.idxBranchCode = idxBranchCode;
	}
	
	public int getIdxBranchCode() {
		return idxBranchCode;
	}
	
	public void setBankCode(String bankCode) {
		this.bankCode = bankCode;
	}
	
	public void setBranchCode(String branchCode) {
		this.branchCode = branchCode;
	}
	
	public void setCalcDate(Date calcDate) {
		calcDate = getDateField(calcDate);
	}
	
	public Date getCalcDate() {
		return getDateField(calcDate);
	}
	
	public String getBankCode() {
		return escapeHTML(bankCode);
	}
	
	public String getBranchCode() {
		return escapeHTML(branchCode);
	}
	
}
