package jp.mosp.payroll.report.action;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import jp.mosp.common.MosPVo;
import jp.mosp.common.bean.OdsBean;
import jp.mosp.common.common.MospConst;
import jp.mosp.common.common.MospException;
import jp.mosp.common.common.MospUtility;
import jp.mosp.common.common.PoiUtility;
import jp.mosp.common.dto.MosPConfDto;
import jp.mosp.common.part.DatePart;
import jp.mosp.legal.LegalConst;
import jp.mosp.payroll.base.AdjustmentAction;
import jp.mosp.payroll.base.PayrollConst;
import jp.mosp.payroll.common.vo.AdjustmentCalcVo;
import jp.mosp.payroll.common.vo.AdjustmentListVo;
import jp.mosp.payroll.common.vo.AdjustmentReferVo;
import jp.mosp.payroll.dao.CdAdjustmentDao;
import jp.mosp.payroll.dao.CmCompanyDao;
import jp.mosp.payroll.dto.CdAdjustmentDto;
import jp.mosp.payroll.report.dto.WithholdingListDto;
import jp.mosp.system.dao.MSyozokuDao;
import jp.mosp.system.dao.MYakusyokuDao;
import jp.mosp.system.dto.MSyozokuDto;
import jp.mosp.system.dto.MYakusyokuDto;

public class WithholdingListAction extends AdjustmentAction{
	
	
	// コマンド
	private static final String CMD_WITHHOLDING_LIST_ALL = "P3040";
	private static final String CMD_WITHHOLDING_LIST_ONE = "P3041";
	private static final String CMD_WITHHOLDING_LIST_ALL2= "P3042";
	
	public String[][] aryGender  ;
	// 設定テーブル
	public List<MosPConfDto> listConf;
	public String[][] aryEra;
	public String[][] aryStation ;
	public String[][] aryPltIncomeTaxType;
	public String[][] aryPltAdjustmentType;

	/**
	 * コンストラクタ
	 */
	public WithholdingListAction() {
		super();
		setNeedProcSeq(false);
	}
	
	/**
	 * アクション
	 */
	public void action() throws Exception {
		// DBコネクション取得
		getConnection();
		// DAO準備
		prepareDao();
		// 取得済確認
		if (aryStation != null) {
			return;
		}
		// 配列取得
		aryStation  = getStationArrayAll() ;
		aryPosition = getPositionArrayAll();
		aryEra      = getCodeArray(PayrollConst.TID_JAPANESE);
		// 和暦設定取得
		listConf = getConfList(PayrollConst.CONF_ID_JP_IMP_CAL);
		// 寡婦(夫) 振分用
		aryGender  = getCodeArray(PayrollConst.TID_GENDER);
		aryPltIncomeTaxType  = LegalConst.INCOME_TAX_ARRAY;
		aryPltAdjustmentType = LegalConst.ADJUSTMENT_ARRAY;
		if (cmd.equals(CMD_WITHHOLDING_LIST_ALL)) {
			// VOの取得
			AdjustmentListVo vo = (AdjustmentListVo)session.getAttribute(MospConst.ATT_FORMER_VO);
			vo.clearMessage();
			vo.clearErrField();
			vo.initVo(cfg, msg, cmd, aspUser, user);
			// パラメータ取得
			vo.setParams(request);
			adjustYear   = vo.getPltReportYear();
			startAdjDate = getStartDateOfYear(adjustYear);
			lastDate     = getLastDateOfYear(adjustYear);
			// 対象年月、対象データ設定
			setTargetData();
			Date date = vo.getDate(String.valueOf(vo.getPltReportYear()), String.valueOf(PayrollConst.TIME_ADJ_PAY_MONTH),  String.valueOf(PayrollConst.TIME_DEFAULT_DAY));
			// 給与明細データ作成
			List<WithholdingListDto> list = getWithholdingList(date, null, vo);
			// 帳票作成準備
//			String fileName = vo.getPltReportYear ()
//							+ PayrollConst.FILE_WITHHOLDING_LIST;
//			request.setAttribute(MospConst.ATT_FILE_NAME, fileName);
//			// 帳票作成及び設定
//			request.setAttribute(MospConst.ATT_FILE_OBJECT, print(
//					cfg.getProperty(MospConst.PPT_APP_DOCBASE) + template, list));
		} else if (cmd.equals(CMD_WITHHOLDING_LIST_ONE)) {
			// VOの取得
			AdjustmentReferVo vo = (AdjustmentReferVo)session.getAttribute(MospConst.ATT_FORMER_VO);
			vo.clearMessage();
			vo.clearErrField();
			vo.initVo(cfg, msg, cmd, aspUser, user);
			// パラメータ取得
			vo.setParams(request);
			adjustYear   = vo.getHidAdjustYear();
			startAdjDate = getStartDateOfYear(adjustYear);
			lastDate     = getLastDateOfYear(adjustYear);
			// 社員コードのNULL避け
			vo.setLblChangeKCode(vo.getHidKCode());
			// 対象年月、対象データ設定
			setTargetData();
			// 対象年月取得
			Date date = vo.getDate(String.valueOf(vo.getHidAdjustYear()), String.valueOf(PayrollConst.TIME_ADJ_PAY_MONTH), String.valueOf(PayrollConst.TIME_DEFAULT_DAY));
			// 給与明細データ作成
			List<WithholdingListDto> list = getWithholdingListOne(date, vo.getHidKCode(), vo);
			for(int i= 0; i < list.size(); i++){
				WithholdingListDto dto_tmp = list.get(i);
				if (cfg.getProperty(PayrollConst.PPT_PAY_USEXLS) == null) {
					report(vo, dto_tmp);
				} else {
					reportXls(vo, dto_tmp);
				}
			}
		} else if (cmd.equals(CMD_WITHHOLDING_LIST_ALL2)) {
			// VOの取得
			AdjustmentCalcVo vo = (AdjustmentCalcVo)session.getAttribute(MospConst.ATT_FORMER_VO);
			vo.clearMessage();
			vo.clearErrField();
			vo.initVo(cfg, msg, cmd, aspUser, user);
			// パラメータ取得
			vo.setParams(request);
			adjustYear   = vo.getHidAdjustYear();
			startAdjDate = getStartDateOfYear(adjustYear);
			lastDate     = getLastDateOfYear(adjustYear);
			// 対象年月、対象データ設定
			setTargetData();
			// 対象年月取得(対象年12/1)
			Date date = vo.getDate(String.valueOf(vo.getHidAdjustYear()), String.valueOf(PayrollConst.TIME_ADJ_PAY_MONTH),  String.valueOf(PayrollConst.TIME_DEFAULT_DAY));
			// 給与明細データ作成
			List<WithholdingListDto> list = getWithholdingList(date, null, vo);
			// 帳票作成準備
//			String fileName = vo.getHidAdjustYear ()
//							+ PayrollConst.FILE_WITHHOLDING_LIST;
//			request.setAttribute(MospConst.ATT_FILE_NAME, fileName);
			// 帳票作成及び設定
//			request.setAttribute(MospConst.ATT_FILE_OBJECT, print(
//					cfg.getProperty(MospConst.PPT_APP_DOCBASE) + template, list));
			
		} else {
			throw new MospException(MospConst.EX_CMD_INVALID);	
		}
	}
	
	/**
	 * 源泉徴収簿データを作成する。<br>
	 * @param targetMonth 作成対象年月
	 * @param kCode       作成対象社員コード(nullなら全件)
	 * @param vo          VO
	 * @return 給与明細データリスト
	 * @throws Exception
	 */
	private List<WithholdingListDto> getWithholdingList(
			Date targetMonth, String kCode, MosPVo vo
	) throws Exception {
		// 源泉徴収票データ取得準備
		CdAdjustmentDao   dao = new CdAdjustmentDao();
		dao.initDao(cfg, cmd, aspUser, user, conn);
		// 給与管理者権限確認
		confirmPayrollAuth();
		// 年末調整データ作成
		List<CdAdjustmentDto> listAdjustment = dao.findForWithholdVote(MospUtility.getYear(targetMonth), kCode);
		// 源泉徴収票データ作成
		List<WithholdingListDto> list = new ArrayList<WithholdingListDto>();
		// 会社データ設定
		setCompanyDataInfo();
		int j = 0;
		for (Iterator<CdAdjustmentDto> it = listAdjustment.iterator(); it.hasNext();) {
			cdAdjustmentDto = it.next();
			// 人事情報設定
			setHumanInfo(cdAdjustmentDto);
			// 給与、賞与情報取得
			setPaymentBonusInfo();
			// 年末調整データ設定
			WithholdingListDto dto = new WithholdingListDto(
					adjustYear      ,
					cdAdjustmentDto ,
					mKihonDto      ,
					mKojinDto      ,
					cmIncomeTaxDto  ,
					cmMidwayEnterDto,
					listPaymentData ,
					listBonusData   ,
					pdPayDeductionDao,
					cmCompanyDto
			);
			// 月区分設定
			setMonthType(dto);
			// 日付和暦設定
			setJapanDate(dto);
			// コード名設定
			setDtoCodeName(dto);
		
			// リストに設定
			list.add(dto);
			j++;
		}
		// 給与データ確認
		if (list.size() == 0) {
			setVo(vo);
			setUrl(vo.getRetUrl());
			String errMessage = MospUtility.getMessage(msg, PayrollConst.MSG_NO_ADJUST_REPORT, "");
			addErrMessage(errMessage);
			throw new MospException(PayrollConst.EX_NO_PAYMENT_DETAIL, errMessage);
		}
		
		return list;
	}
	
	/**
	 * 源泉徴収簿データを作成する。<br>
	 * @param targetMonth 作成対象年月
	 * @param kCode       作成対象社員コード(nullなら全件)
	 * @param vo          VO
	 * @return 給与明細データリスト
	 * @throws Exception
	 */
	private List<WithholdingListDto> getWithholdingListOne(
			Date targetMonth, String kCode, MosPVo vo
	) throws Exception {
		// 源泉徴収票データ取得準備
		CdAdjustmentDao   dao = new CdAdjustmentDao();
		dao.initDao(cfg, cmd, aspUser, user, conn);
		// 給与管理者権限確認
		confirmPayrollAuth();
		// 年末調整データ作成
		List<CdAdjustmentDto> listAdjustment = dao.findForWithholdVote(MospUtility.getYear(targetMonth), kCode);
		// 源泉徴収票データ作成
		List<WithholdingListDto> list = new ArrayList<WithholdingListDto>();
		// 会社データ設定
		setCompanyDataInfo();
		for (Iterator<CdAdjustmentDto> it = listAdjustment.iterator(); it.hasNext();) {
			cdAdjustmentDto = it.next();
		}
		// 給与データ確認
		if (listAdjustment.size() == 0) {
			// 初期化
			cdAdjustmentDto = new CdAdjustmentDto();
			cdAdjustmentDto.setKCode(kCode);
		}
		setVo(vo);
		setUrl(vo.getRetUrl());
		// 人事情報設定
		setHumanInfo(cdAdjustmentDto);
		// 給与、賞与情報取得
		setPaymentBonusInfo();
		// 年末調整データ設定
		WithholdingListDto dto = new WithholdingListDto(
				adjustYear      ,
				cdAdjustmentDto ,
				mKihonDto      ,
				mKojinDto      ,
				cmIncomeTaxDto  ,
				cmMidwayEnterDto,
				listPaymentData ,
				listBonusData   ,
				pdPayDeductionDao,
				cmCompanyDto
		);
		// 本人設定
		setWidowType(dto);
		// 月区分設定
		setMonthType(dto);
		// 日付和暦設定
		setJapanDate(dto);
		// コード名設定
		setDtoCodeName(dto);
		// リストに設定
		list.add(dto);
		
		return list;
	}
	
	/**
	 * 本人区分設定
	 * @param dto
	 */
	private void setWidowType(WithholdingListDto dto) {
		if (cmIncomeTaxDto != null) {
			String widowType   = cmIncomeTaxDto.getSelfWidowType();
			// 寡婦(夫)の場合は性別で判断して設定、設定なしの場合は一般寡婦へ
			if (widowType.equals(LegalConst.WIDOW_GENERAL)) {
				dto.setWidow(PayrollConst.ADJ_APPLICABLE);
				// DTO確認
//				if (mKojinDto != null) {
//					String gender = mKojinDto.getGender();
//					// 寡夫
//					if (gender.equals(aryGender[0][0])) {
//						dto.setWidow(PayrollConst.ADJ_APPLICABLE);
//					}
//					// 一般寡婦
//					if (gender.equals(aryGender[1][0])) {
//						dto.setGeWidow(PayrollConst.ADJ_APPLICABLE);
//					}
//				} else {
//					// 性別の設定がない場合は一般寡婦に設定
//					dto.setGeWidow(PayrollConst.ADJ_APPLICABLE);
//				}
			} else if (widowType.equals(LegalConst.WIDOW_SPECIAL)) {
				// 特別寡婦
				dto.setSpWidow(PayrollConst.ADJ_APPLICABLE);
			}
		}
	}
	
	/**
	 * 月区分設定
	 * @param dto
	 */
	private void setMonthType(WithholdingListDto dto) {
		dto.setMonthType_01("1");
		dto.setMonthType_02("2");
		dto.setMonthType_03("3");
		dto.setMonthType_04("4");
		dto.setMonthType_05("5");
		dto.setMonthType_06("6");
		dto.setMonthType_07("7");
		dto.setMonthType_08("8");
		dto.setMonthType_09("9");
		dto.setMonthType_10("10");
		dto.setMonthType_11("11");
		dto.setMonthType_12("12");
		
	}
	
	/**
	 * 給与、賞与情報取得
	 * @param vo
	 * @throws Exception 
	 */
	private void setPaymentBonusInfo() throws Exception {
		// 計算対象給与データ取得
		listPaymentData = phPaymentDao.findForConditionDate(kCode,targetBefDate, targetAffDate);
		// 計算対象賞与データ取得
		listBonusData = phBonusDao.findForConditionDate(kCode, startAdjDate, lastDate);
		// 給与データ確認
		setTargetPaymentData();
		// 対象データ所得税計算(登録なし)
		calcTargetIncomeTax(false);
	}
	
	/**
	 * 人事情報設定
	 * @param vo 設定対象VO
	 * @throws NoSuchFieldException 
	 * @throws IllegalAccessException 
	 * @throws SQLException 
	 * @throws ClassNotFoundException 
	 * @throws MospException 
	 */
	private void setHumanInfo(
			CdAdjustmentDto dto
	) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		if (dto != null) {
			// 社員コード設定
			kCode = dto.getKCode();
			// 年最終日を履歴情報取得対象月として使用
			Date targetDate = getLastDateOfYear(adjustYear);
			// 人事基本情報取得
//			mKihonDto = mKihonPayrollDao.findForDate(kCode, targetDate);
			mKihonDto = mKihonPayrollDao.findForKey(kCode);
			if (mKihonDto == null) {
				// 人事基本情報が無い場合
				String errMessage = MospUtility.getMessage(msg, PayrollConst.MSG_NO_HUMAN_DATA, "");
				addErrMessage(errMessage);
			}
			// 人事基本情報設定
			// 人事管理情報取得
			mKojinDto       = mKojinDao.findForKey(kCode);
			
			// 人事給与情報取得
			cmIncomeTaxDto   = cmIncomeTaxDao  .findForEmployeeDate(kCode, targetDate);
			cmMidwayEnterDto = cmMidwayEnterDao.findForKey         (kCode          );
		}
	}
		
	/**
	 * 会社情報設定
	 * @param dto
	 * @throws NoSuchFieldException 
	 * @throws IllegalAccessException 
	 * @throws SQLException 
	 */
	private void setCompanyDataInfo() throws SQLException, IllegalAccessException, NoSuchFieldException {
			CmCompanyDao dao = new CmCompanyDao();
			dao.initDao(cfg, cmd, aspUser, user, conn);
			cmCompanyDto = dao.findAll();
	}
	
	/**
	 * 和暦日付取得
	 * @param dto
	 * @throws MospException
	 */
	private void setJapanDate(WithholdingListDto dto) throws MospException {
		String strDate[];
		// 表示用年月取得(対象年月)
		if (targetAffDate != null) {
			strDate = getJpImperialCal(listConf, targetAffDate);
			strDate[0]       = getCodeName(strDate[0], aryEra);
			dto.setAdjustYear(strDate[0] + strDate[1]);
			dto.setAdjustYear_YY(strDate[1]);
			
		}
		if (mKojinDto != null) {
			if (mKojinDto.getSeinenbi() != 0) {
				// 生年月日
				strDate          = 
					getJpImperialCal(listConf, DatePart.convIntegerDateToDate(mKojinDto.getSeinenbi()));

				strDate[0]       = getCodeName(strDate[0], aryEra);
				dto.setBirthDate(strDate[0] + " " + strDate[1] + PayrollConst.NAM_YEAR + " " +  strDate[2]
				                 + " " + PayrollConst.NAM_MONTH + " " + strDate[3] + PayrollConst.NAM_DAY);
			} else {
				dto.setBirthDate(" " + " " + " " + PayrollConst.NAM_YEAR + " " +  " "
	                    + " " + PayrollConst.NAM_MONTH + " " + " " + PayrollConst.NAM_DAY);

			}
		}
	}
	
	/**
	 * コード名称設定
	 * @param dto
	 * @throws NoSuchFieldException 
	 * @throws IllegalAccessException 
	 * @throws SQLException 
	 */
	private void setDtoCodeName(WithholdingListDto dto) throws SQLException, IllegalAccessException, NoSuchFieldException {
		MSyozokuDto mSyozokuDto;		
		MYakusyokuDto mYakusyokuDto;
		String PositionName;
		String StationName;

		// 使用DTOの準備
		MSyozokuDao mSyozokuDao = new MSyozokuDao();		
		mSyozokuDao.initDao(cfg, cmd, aspUser, user, conn);
		MYakusyokuDao mYakusyokuDao = new MYakusyokuDao(); 
		mYakusyokuDao.initDao(cfg, cmd, aspUser, user, conn);
		
		mSyozokuDto = mSyozokuDao.findForKey(dto.getStationCode());
		if(mSyozokuDto != null){
			StationName  = mSyozokuDto.getSName();
		}else{
			StationName  = "";
		}

		mYakusyokuDto = mYakusyokuDao.findForKey(dto.getPositionCode(), dto.getTouKyu());
		if(mYakusyokuDto != null){
			PositionName  = mYakusyokuDto.getYName();
			}else{
			PositionName  = "";
		}
		
		if (cmIncomeTaxDto != null) {
			// 課税区分
			dto.setIncomeTaxType(getCodeName(dto.getIncomeTaxType(), aryPltIncomeTaxType));
			// 年調区分
			dto.setAdjustmentType(getCodeName(dto.getAdjustmentType(), aryPltAdjustmentType));
		}
		if (mKihonDto != null ) {
			// 所属コード
			String stationCode = dto.getPositionCode() + " - " + dto.getStationCode();
			// 所属
			dto.setStationCode(stationCode);
			//dto.setPositionCode("");
			dto.setStationName(StationName);
			dto.setPositionName(PositionName);

		
		}
	}


	/**
	 * 帳票出力処理を行う。(Excel)<br><br>
	 * @throws Exception 
	 */
	private void reportXls(AdjustmentReferVo vo , WithholdingListDto dto) throws Exception {
		int Line;
		int Column;
		int Sum_tmp;
		// コネクション取得
		getConnection();
		// 帳票作成
		PoiUtility poi = new PoiUtility();
		poi.crtNewDocR(0, cfg.getProperty(MospConst.PPT_APP_DOCBASE) + PayrollConst.TEMPLATE_WITHHOLDINGLIST_XLS);

		// ヘッダー
		poi.prtItem(     9,  1, dto.getAdjustYear_YY());		// 対象和暦年度年度(左枠外タイトル)

		Line   = 1;
		poi.prtItem( Line ,  4, dto.getStationName());			// 所属名
		poi.prtItem( Line ,  9, dto.getPositionName());		// 職名
		poi.prtItem( Line , 17, dto.getPostalCode());			// 郵便番号
		poi.prtItem( Line , 33, dto.getFName());				// フリガナ
		poi.prtItem( Line , 42, dto.getKCode());				// 整理番号
		
		Line   = 2;
		poi.prtItem( Line , 14, dto.getAddress());				// 住所
		poi.prtItem( Line , 33, dto.getKName());				// 氏名		
		
		poi.prtItem(    4 , 33, dto.getBirthDate());			// 生年月日		

		/* 給与 */
		// 支給月（給与）
		Line   = 7;
		Column = 4;
		if(null != dto.getPaymentMonth_01()) poi.prtItem( Line     , Column, dto.getPaymentMonth_01());
		if(null != dto.getPaymentMonth_02()) prtItem_chk( poi, Line +  2, Column, dto.getPaymentMonth_02());
		if(null != dto.getPaymentMonth_03()) prtItem_chk( poi, Line +  4, Column, dto.getPaymentMonth_03());
		if(null != dto.getPaymentMonth_04()) prtItem_chk( poi, Line +  6, Column, dto.getPaymentMonth_04());
		if(null != dto.getPaymentMonth_05()) prtItem_chk( poi, Line +  8, Column, dto.getPaymentMonth_05());
		if(null != dto.getPaymentMonth_06()) prtItem_chk( poi, Line + 10, Column, dto.getPaymentMonth_06());
		if(null != dto.getPaymentMonth_07()) prtItem_chk( poi, Line + 12, Column, dto.getPaymentMonth_07());
		if(null != dto.getPaymentMonth_08()) prtItem_chk( poi, Line + 14, Column, dto.getPaymentMonth_08());
		if(null != dto.getPaymentMonth_09()) prtItem_chk( poi, Line + 16, Column, dto.getPaymentMonth_09());
		if(null != dto.getPaymentMonth_10()) prtItem_chk( poi, Line + 18, Column, dto.getPaymentMonth_10());
		if(null != dto.getPaymentMonth_11()) prtItem_chk( poi, Line + 20, Column, dto.getPaymentMonth_11());
		if(null != dto.getPaymentMonth_12()) prtItem_chk( poi, Line + 22, Column, dto.getPaymentMonth_12());

		// 支給日（給与）
		Line   = 7;
		Column = 5;
		if(null != dto.getPaymentPayDay_01()) prtItem_chk( poi, Line     , Column, dto.getPaymentPayDay_01());
		if(null != dto.getPaymentPayDay_02()) prtItem_chk( poi, Line +  2, Column, dto.getPaymentPayDay_02());
		if(null != dto.getPaymentPayDay_03()) prtItem_chk( poi, Line +  4, Column, dto.getPaymentPayDay_03());
		if(null != dto.getPaymentPayDay_04()) prtItem_chk( poi, Line +  6, Column, dto.getPaymentPayDay_04());
		if(null != dto.getPaymentPayDay_05()) prtItem_chk( poi, Line +  8, Column, dto.getPaymentPayDay_05());
		if(null != dto.getPaymentPayDay_06()) prtItem_chk( poi, Line + 10, Column, dto.getPaymentPayDay_06());
		if(null != dto.getPaymentPayDay_07()) prtItem_chk( poi, Line + 12, Column, dto.getPaymentPayDay_07());
		if(null != dto.getPaymentPayDay_08()) prtItem_chk( poi, Line + 14, Column, dto.getPaymentPayDay_08());
		if(null != dto.getPaymentPayDay_09()) prtItem_chk( poi, Line + 16, Column, dto.getPaymentPayDay_09());
		if(null != dto.getPaymentPayDay_10()) prtItem_chk( poi, Line + 18, Column, dto.getPaymentPayDay_10());
		if(null != dto.getPaymentPayDay_11()) prtItem_chk( poi, Line + 20, Column, dto.getPaymentPayDay_11());
		if(null != dto.getPaymentPayDay_12()) prtItem_chk( poi, Line + 22, Column, dto.getPaymentPayDay_12());

		// 総支給金額（給与）
		Line   = 7;
		Column = 7;
		if(null != dto.getPayTotalAllowance_01()) prtItem_chk( poi, Line     , Column, dto.getPayTotalAllowance_01());
		if(null != dto.getPayTotalAllowance_02()) prtItem_chk( poi, Line +  2, Column, dto.getPayTotalAllowance_02());
		if(null != dto.getPayTotalAllowance_03()) prtItem_chk( poi, Line +  4, Column, dto.getPayTotalAllowance_03());
		if(null != dto.getPayTotalAllowance_04()) prtItem_chk( poi, Line +  6, Column, dto.getPayTotalAllowance_04());
		if(null != dto.getPayTotalAllowance_05()) prtItem_chk( poi, Line +  8, Column, dto.getPayTotalAllowance_05());
		if(null != dto.getPayTotalAllowance_06()) prtItem_chk( poi, Line + 10, Column, dto.getPayTotalAllowance_06());
		if(null != dto.getPayTotalAllowance_07()) prtItem_chk( poi, Line + 12, Column, dto.getPayTotalAllowance_07());
		if(null != dto.getPayTotalAllowance_08()) prtItem_chk( poi, Line + 14, Column, dto.getPayTotalAllowance_08());
		if(null != dto.getPayTotalAllowance_09()) prtItem_chk( poi, Line + 16, Column, dto.getPayTotalAllowance_09());
		if(null != dto.getPayTotalAllowance_10()) prtItem_chk( poi, Line + 18, Column, dto.getPayTotalAllowance_10());
		if(null != dto.getPayTotalAllowance_11()) prtItem_chk( poi, Line + 20, Column, dto.getPayTotalAllowance_11());
		if(null != dto.getPayTotalAllowance_12()) prtItem_chk( poi, Line + 22, Column, dto.getPayTotalAllowance_12());

		// 社会保険料等の控除額（給与）
		Line   = 7;
		Column = 10;
		if(null != dto.getPaySocInsDeduction_01()) prtItem_chk( poi, Line     , Column, dto.getPaySocInsDeduction_01());
		if(null != dto.getPaySocInsDeduction_02()) prtItem_chk( poi, Line +  2, Column, dto.getPaySocInsDeduction_02());
		if(null != dto.getPaySocInsDeduction_03()) prtItem_chk( poi, Line +  4, Column, dto.getPaySocInsDeduction_03());
		if(null != dto.getPaySocInsDeduction_04()) prtItem_chk( poi, Line +  6, Column, dto.getPaySocInsDeduction_04());
		if(null != dto.getPaySocInsDeduction_05()) prtItem_chk( poi, Line +  8, Column, dto.getPaySocInsDeduction_05());
		if(null != dto.getPaySocInsDeduction_06()) prtItem_chk( poi, Line + 10, Column, dto.getPaySocInsDeduction_06());
		if(null != dto.getPaySocInsDeduction_07()) prtItem_chk( poi, Line + 12, Column, dto.getPaySocInsDeduction_07());
		if(null != dto.getPaySocInsDeduction_08()) prtItem_chk( poi, Line + 14, Column, dto.getPaySocInsDeduction_08());
		if(null != dto.getPaySocInsDeduction_09()) prtItem_chk( poi, Line + 16, Column, dto.getPaySocInsDeduction_09());
		if(null != dto.getPaySocInsDeduction_10()) prtItem_chk( poi, Line + 18, Column, dto.getPaySocInsDeduction_10());
		if(null != dto.getPaySocInsDeduction_11()) prtItem_chk( poi, Line + 20, Column, dto.getPaySocInsDeduction_11());
		if(null != dto.getPaySocInsDeduction_12()) prtItem_chk( poi, Line + 22, Column, dto.getPaySocInsDeduction_12());

		// 社会保険料控除後の給与等の金額（給与）		
		Line   = 7;
		Column = 12;
		if(null != dto.getPayPayInsDeduction_01()) prtItem_chk( poi, Line     , Column, dto.getPayPayInsDeduction_01());
		if(null != dto.getPayPayInsDeduction_02()) prtItem_chk( poi, Line +  2, Column, dto.getPayPayInsDeduction_02());
		if(null != dto.getPayPayInsDeduction_03()) prtItem_chk( poi, Line +  4, Column, dto.getPayPayInsDeduction_03());
		if(null != dto.getPayPayInsDeduction_04()) prtItem_chk( poi, Line +  6, Column, dto.getPayPayInsDeduction_04());
		if(null != dto.getPayPayInsDeduction_05()) prtItem_chk( poi, Line +  8, Column, dto.getPayPayInsDeduction_05());
		if(null != dto.getPayPayInsDeduction_06()) prtItem_chk( poi, Line + 10, Column, dto.getPayPayInsDeduction_06());
		if(null != dto.getPayPayInsDeduction_07()) prtItem_chk( poi, Line + 12, Column, dto.getPayPayInsDeduction_07());
		if(null != dto.getPayPayInsDeduction_08()) prtItem_chk( poi, Line + 14, Column, dto.getPayPayInsDeduction_08());
		if(null != dto.getPayPayInsDeduction_09()) prtItem_chk( poi, Line + 16, Column, dto.getPayPayInsDeduction_09());
		if(null != dto.getPayPayInsDeduction_10()) prtItem_chk( poi, Line + 18, Column, dto.getPayPayInsDeduction_10());
		if(null != dto.getPayPayInsDeduction_11()) prtItem_chk( poi, Line + 20, Column, dto.getPayPayInsDeduction_11());
		if(null != dto.getPayPayInsDeduction_12()) prtItem_chk( poi, Line + 22, Column, dto.getPayPayInsDeduction_12());
		
		// 扶養親族等の数（給与）		
		Line   = 7;
		Column = 14;
		if(null != dto.getPayDependentCount_01()) prtItem_chk( poi, Line     , Column, dto.getPayDependentCount_01());
		if(null != dto.getPayDependentCount_02()) prtItem_chk( poi, Line +  2, Column, dto.getPayDependentCount_02());
		if(null != dto.getPayDependentCount_03()) prtItem_chk( poi, Line +  4, Column, dto.getPayDependentCount_03());
		if(null != dto.getPayDependentCount_04()) prtItem_chk( poi, Line +  6, Column, dto.getPayDependentCount_04());
		if(null != dto.getPayDependentCount_05()) prtItem_chk( poi, Line +  8, Column, dto.getPayDependentCount_05());
		if(null != dto.getPayDependentCount_06()) prtItem_chk( poi, Line + 10, Column, dto.getPayDependentCount_06());
		if(null != dto.getPayDependentCount_07()) prtItem_chk( poi, Line + 12, Column, dto.getPayDependentCount_07());
		if(null != dto.getPayDependentCount_08()) prtItem_chk( poi, Line + 14, Column, dto.getPayDependentCount_08());
		if(null != dto.getPayDependentCount_09()) prtItem_chk( poi, Line + 16, Column, dto.getPayDependentCount_09());
		if(null != dto.getPayDependentCount_10()) prtItem_chk( poi, Line + 18, Column, dto.getPayDependentCount_10());
		if(null != dto.getPayDependentCount_11()) prtItem_chk( poi, Line + 20, Column, dto.getPayDependentCount_11());
		if(null != dto.getPayDependentCount_12()) prtItem_chk( poi, Line + 22, Column, dto.getPayDependentCount_12());
		
		// 算出税額（所得税額）（給与）
		Line   = 7;
		Column = 17;
		if(null != dto.getPayIncomeTax_01()) prtItem_chk( poi, Line     , Column, dto.getPayIncomeTax_01());
		if(null != dto.getPayIncomeTax_02()) prtItem_chk( poi, Line +  2, Column, dto.getPayIncomeTax_02());
		if(null != dto.getPayIncomeTax_03()) prtItem_chk( poi, Line +  4, Column, dto.getPayIncomeTax_03());
		if(null != dto.getPayIncomeTax_04()) prtItem_chk( poi, Line +  6, Column, dto.getPayIncomeTax_04());
		if(null != dto.getPayIncomeTax_05()) prtItem_chk( poi, Line +  8, Column, dto.getPayIncomeTax_05());
		if(null != dto.getPayIncomeTax_06()) prtItem_chk( poi, Line + 10, Column, dto.getPayIncomeTax_06());
		if(null != dto.getPayIncomeTax_07()) prtItem_chk( poi, Line + 12, Column, dto.getPayIncomeTax_07());
		if(null != dto.getPayIncomeTax_08()) prtItem_chk( poi, Line + 14, Column, dto.getPayIncomeTax_08());
		if(null != dto.getPayIncomeTax_09()) prtItem_chk( poi, Line + 16, Column, dto.getPayIncomeTax_09());
		if(null != dto.getPayIncomeTax_10()) prtItem_chk( poi, Line + 18, Column, dto.getPayIncomeTax_10());
		if(null != dto.getPayIncomeTax_11()) prtItem_chk( poi, Line + 20, Column, dto.getPayIncomeTax_11());
		if(null != dto.getPayIncomeTax_12()) prtItem_chk( poi, Line + 22, Column, dto.getPayIncomeTax_12());
		
		// 年末調整による過不足税額（給与）
		Line   = 7;
		Column = 21;
		if(null != dto.getPayAdjCalcGap_01()) prtItem_chk( poi, Line     , Column, dto.getPayAdjCalcGap_01());
		if(null != dto.getPayAdjCalcGap_02()) prtItem_chk( poi, Line +  2, Column, dto.getPayAdjCalcGap_02());
		if(null != dto.getPayAdjCalcGap_03()) prtItem_chk( poi, Line +  4, Column, dto.getPayAdjCalcGap_03());
		if(null != dto.getPayAdjCalcGap_04()) prtItem_chk( poi, Line +  6, Column, dto.getPayAdjCalcGap_04());
		if(null != dto.getPayAdjCalcGap_05()) prtItem_chk( poi, Line +  8, Column, dto.getPayAdjCalcGap_05());
		if(null != dto.getPayAdjCalcGap_06()) prtItem_chk( poi, Line + 10, Column, dto.getPayAdjCalcGap_06());
		if(null != dto.getPayAdjCalcGap_07()) prtItem_chk( poi, Line + 12, Column, dto.getPayAdjCalcGap_07());
		if(null != dto.getPayAdjCalcGap_08()) prtItem_chk( poi, Line + 14, Column, dto.getPayAdjCalcGap_08());
		if(null != dto.getPayAdjCalcGap_09()) prtItem_chk( poi, Line + 16, Column, dto.getPayAdjCalcGap_09());
		if(null != dto.getPayAdjCalcGap_10()) prtItem_chk( poi, Line + 18, Column, dto.getPayAdjCalcGap_10());
		if(null != dto.getPayAdjCalcGap_11()) prtItem_chk( poi, Line + 20, Column, dto.getPayAdjCalcGap_11());
		if(null != dto.getPayAdjCalcGap_12()) prtItem_chk( poi, Line + 22, Column, dto.getPayAdjCalcGap_12());
		
		// 差引徴収税額（給与）		
		Line   = 7;
		Column = 23;
		if(null != dto.getPayPaymentTax_01()) prtItem_chk( poi, Line +  0, Column, dto.getPayPaymentTax_01());
		if(null != dto.getPayPaymentTax_02()) prtItem_chk( poi, Line +  2, Column, dto.getPayPaymentTax_02());
		if(null != dto.getPayPaymentTax_03()) prtItem_chk( poi, Line +  4, Column, dto.getPayPaymentTax_03());
		if(null != dto.getPayPaymentTax_04()) prtItem_chk( poi, Line +  6, Column, dto.getPayPaymentTax_04());
		if(null != dto.getPayPaymentTax_05()) prtItem_chk( poi, Line +  8, Column, dto.getPayPaymentTax_05());
		if(null != dto.getPayPaymentTax_06()) prtItem_chk( poi, Line + 10, Column, dto.getPayPaymentTax_06());
		if(null != dto.getPayPaymentTax_07()) prtItem_chk( poi, Line + 12, Column, dto.getPayPaymentTax_07());
		if(null != dto.getPayPaymentTax_08()) prtItem_chk( poi, Line + 14, Column, dto.getPayPaymentTax_08());
		if(null != dto.getPayPaymentTax_09()) prtItem_chk( poi, Line + 16, Column, dto.getPayPaymentTax_09());
		if(null != dto.getPayPaymentTax_10()) prtItem_chk( poi, Line + 18, Column, dto.getPayPaymentTax_10());
		if(null != dto.getPayPaymentTax_11()) prtItem_chk( poi, Line + 20, Column, dto.getPayPaymentTax_11());
		if(null != dto.getPayPaymentTax_12()) prtItem_chk( poi, Line + 22, Column, dto.getPayPaymentTax_12());

		Line   = 31;
		prtItem_chk( poi, Line ,   7, dto.getTotalPayTotalAllowance());		// 総支給金額計（給与）
		prtItem_chk( poi, Line ,  10, dto.getTotalPaySocInsDeduction());		// 給与社会保険料合計（給与）
		prtItem_chk( poi, Line ,  12, dto.getTotalPayPayInsDeduction());		// 給与社会保険料控除後の給与等の金額合計（給与）
		prtItem_chk( poi, Line ,  17, dto.getTotalPayIncomeTax());			// 給与所得税合計（給与）
		prtItem_chk( poi, Line ,  21, dto.getTotalPayAdjCalcGap());			// 給与年調による過不足合計（給与）
		prtItem_chk( poi, Line ,  23, dto.getTotalPayIncomeTax() + dto.getTotalPayAdjCalcGap()); // 差引徴収税額（給与）		

		/* 賞与 */
		// 支払月（賞与）
		Line   = 33;
		Column = 3;
		if(null != dto.getBonusMonth_01())   prtItem_chk( poi, Line +  0, Column, dto.getBonusMonth_01());
		if(null != dto.getBonusMonth_02())   prtItem_chk( poi, Line +  2, Column, dto.getBonusMonth_02());
		if(null != dto.getBonusMonth_03())   prtItem_chk( poi, Line +  4, Column, dto.getBonusMonth_03());
		if(null != dto.getBonusMonth_04())   prtItem_chk( poi, Line +  6, Column, dto.getBonusMonth_04());
		if(null != dto.getBonusMonth_05())   prtItem_chk( poi, Line +  8, Column, dto.getBonusMonth_05());
//		if(null != dto.getBonusMonth_06())   prtItem_chk( poi, Line + 10, Column, dto.getBonusMonth_06());
		Column = 4;
		if(null != dto.getBonusMonth_01())   prtItem_chk( poi, Line +  0, Column, dto.getBonusMonth_01());
		if(null != dto.getBonusMonth_02())   prtItem_chk( poi, Line +  2, Column, dto.getBonusMonth_02());
		if(null != dto.getBonusMonth_03())   prtItem_chk( poi, Line +  4, Column, dto.getBonusMonth_03());
		if(null != dto.getBonusMonth_04())   prtItem_chk( poi, Line +  6, Column, dto.getBonusMonth_04());
		if(null != dto.getBonusMonth_05())   prtItem_chk( poi, Line +  8, Column, dto.getBonusMonth_05());
//		if(null != dto.getBonusMonth_06())   prtItem_chk( poi, Line + 10, Column, dto.getBonusMonth_06());

		// 支払日（賞与）
		Column = 5;
		if(null != dto.getBonusPayDay_01())  prtItem_chk( poi, Line +  0, Column,  dto.getBonusPayDay_01());
		if(null != dto.getBonusPayDay_02())  prtItem_chk( poi, Line +  2, Column,  dto.getBonusPayDay_02());
		if(null != dto.getBonusPayDay_03())  prtItem_chk( poi, Line +  4, Column,  dto.getBonusPayDay_03());
		if(null != dto.getBonusPayDay_04())  prtItem_chk( poi, Line +  6, Column,  dto.getBonusPayDay_04());
		if(null != dto.getBonusPayDay_05())  prtItem_chk( poi, Line +  8, Column,  dto.getBonusPayDay_05());
//		if(null != dto.getBonusPayDay_06())  prtItem_chk( poi, Line + 10, Column,  dto.getBonusPayDay_06());

		//総支給金額（賞与）
		Line   = 33;
		Column = 7;
		if(null != dto.getBonTotalAllowance_01())  prtItem_chk( poi, Line +  0, Column,   dto.getBonTotalAllowance_01());
		if(null != dto.getBonTotalAllowance_02())  prtItem_chk( poi, Line +  2, Column,   dto.getBonTotalAllowance_02());
		if(null != dto.getBonTotalAllowance_03())  prtItem_chk( poi, Line +  4, Column,   dto.getBonTotalAllowance_03());
		if(null != dto.getBonTotalAllowance_04())  prtItem_chk( poi, Line +  6, Column,   dto.getBonTotalAllowance_04());
		if(null != dto.getBonTotalAllowance_05())  prtItem_chk( poi, Line +  8, Column,   dto.getBonTotalAllowance_05());
//		if(null != dto.getBonTotalAllowance_06())  prtItem_chk( poi, Line + 10, Column,   dto.getBonTotalAllowance_06());

		// 
		// 社会保険料等の控除額（賞与）
		Line   = 33;
		Column = 10;
		if(null != dto.getBonSocInsDeduction_01())  prtItem_chk( poi, Line +  0, Column,   dto.getBonSocInsDeduction_01());
		if(null != dto.getBonSocInsDeduction_02())  prtItem_chk( poi, Line +  2, Column,   dto.getBonSocInsDeduction_02());
		if(null != dto.getBonSocInsDeduction_03())  prtItem_chk( poi, Line +  4, Column,   dto.getBonSocInsDeduction_03());
		if(null != dto.getBonSocInsDeduction_04())  prtItem_chk( poi, Line +  6, Column,   dto.getBonSocInsDeduction_04());
		if(null != dto.getBonSocInsDeduction_05())  prtItem_chk( poi, Line +  8, Column,   dto.getBonSocInsDeduction_05());
//		if(null != dto.getBonSocInsDeduction_06())  prtItem_chk( poi, Line + 10, Column,   dto.getBonSocInsDeduction_06());
		
		// 社会保険料控除後の給与等の金額（賞与）		
		Line   = 33;
		Column = 12;
		if(null != dto.getBonPayInsDeduction_01()) prtItem_chk( poi, Line +  0, Column,   dto.getBonPayInsDeduction_01());
		if(null != dto.getBonPayInsDeduction_02()) prtItem_chk( poi, Line +  2, Column,   dto.getBonPayInsDeduction_02());
		if(null != dto.getBonPayInsDeduction_03()) prtItem_chk( poi, Line +  4, Column,   dto.getBonPayInsDeduction_03());
		if(null != dto.getBonPayInsDeduction_04()) prtItem_chk( poi, Line +  6, Column,   dto.getBonPayInsDeduction_04());
		if(null != dto.getBonPayInsDeduction_05()) prtItem_chk( poi, Line +  8, Column,   dto.getBonPayInsDeduction_05());
//		if(null != dto.getBonPayInsDeduction_06()) prtItem_chk( poi, Line + 10, Column,   dto.getBonPayInsDeduction_06());
		
		// 扶養親族等の数（賞与）
		Line   = 33;
		Column = 14;
		if(null != dto.getBonDependentCount_01()) prtItem_chk( poi, Line +  0, Column,   dto.getBonDependentCount_01());
		if(null != dto.getBonDependentCount_02()) prtItem_chk( poi, Line +  2, Column,   dto.getBonDependentCount_02());
		if(null != dto.getBonDependentCount_03()) prtItem_chk( poi, Line +  4, Column,   dto.getBonDependentCount_03());
		if(null != dto.getBonDependentCount_04()) prtItem_chk( poi, Line +  6, Column,   dto.getBonDependentCount_04());
		if(null != dto.getBonDependentCount_05()) prtItem_chk( poi, Line +  8, Column,   dto.getBonDependentCount_05());
//		if(null != dto.getBonDependentCount_06()) prtItem_chk( poi, Line + 10, Column,   dto.getBonDependentCount_06());
		
		// 算出税額（所得税額）（賞与）
		Line   = 34;
		Column = 17;
		if(null != dto.getBonIncomeTax_01()) prtItem_chk( poi, Line +  0, Column,   dto.getBonIncomeTax_01());
		if(null != dto.getBonIncomeTax_02()) prtItem_chk( poi, Line +  2, Column,   dto.getBonIncomeTax_02());
		if(null != dto.getBonIncomeTax_03()) prtItem_chk( poi, Line +  4, Column,   dto.getBonIncomeTax_03());
		if(null != dto.getBonIncomeTax_04()) prtItem_chk( poi, Line +  6, Column,   dto.getBonIncomeTax_04());
		if(null != dto.getBonIncomeTax_05()) prtItem_chk( poi, Line +  8, Column,   dto.getBonIncomeTax_05());
//		if(null != dto.getBonIncomeTax_06()) prtItem_chk( poi, Line + 10, Column,   dto.getBonIncomeTax_06());
		
		
		// 年末調整による過不足税額（賞与）
		Line   = 33;
		Column = 21;
		if(null != dto.getBonAdjCalcGap_01()) prtItem_chk( poi, Line +  0, Column,   dto.getBonAdjCalcGap_01());
		if(null != dto.getBonAdjCalcGap_02()) prtItem_chk( poi, Line +  2, Column,   dto.getBonAdjCalcGap_02());
		if(null != dto.getBonAdjCalcGap_03()) prtItem_chk( poi, Line +  4, Column,   dto.getBonAdjCalcGap_03());
		if(null != dto.getBonAdjCalcGap_04()) prtItem_chk( poi, Line +  6, Column,   dto.getBonAdjCalcGap_04());
		if(null != dto.getBonAdjCalcGap_05()) prtItem_chk( poi, Line +  8, Column,   dto.getBonAdjCalcGap_05());
//		if(null != dto.getBonAdjCalcGap_06()) prtItem_chk( poi, Line + 10, Column,   dto.getBonAdjCalcGap_06());
		
		// 差引徴収税額（賞与）		
		Line   = 33;
		Column = 23;
		if(null != dto.getBonPaymentTax_01()) prtItem_chk( poi, Line +  0, Column, dto.getBonPaymentTax_01());
		if(null != dto.getBonPaymentTax_02()) prtItem_chk( poi, Line +  2, Column, dto.getBonPaymentTax_02());
		if(null != dto.getBonPaymentTax_03()) prtItem_chk( poi, Line +  4, Column, dto.getBonPaymentTax_03());
		if(null != dto.getBonPaymentTax_04()) prtItem_chk( poi, Line +  6, Column, dto.getBonPaymentTax_04());
		if(null != dto.getBonPaymentTax_05()) prtItem_chk( poi, Line +  8, Column, dto.getBonPaymentTax_05());
//		if(null != dto.getBonPaymentTax_06()) prtItem_chk( poi, Line + 10, Column, dto.getBonPaymentTax_06());

		// 所得税税率
		Line   = 33;
		Column = 18;
		if(null != dto.getBonIncomeTaxRate_01()) prtItem_chk( poi, Line +  0, Column, dto.getBonIncomeTaxRate_01());
		if(null != dto.getBonIncomeTaxRate_02()) prtItem_chk( poi, Line +  2, Column, dto.getBonIncomeTaxRate_02());
		if(null != dto.getBonIncomeTaxRate_03()) prtItem_chk( poi, Line +  4, Column, dto.getBonIncomeTaxRate_03());
		if(null != dto.getBonIncomeTaxRate_04()) prtItem_chk( poi, Line +  6, Column, dto.getBonIncomeTaxRate_04());
		if(null != dto.getBonIncomeTaxRate_05()) prtItem_chk( poi, Line +  8, Column, dto.getBonIncomeTaxRate_05());
//		if(null != dto.getBonIncomeTaxRate_06()) prtItem_chk( poi, Line + 10, Column, dto.getBonIncomeTaxRate_06());
		
		Line   = 43;
		prtItem_chk( poi, Line ,   7, dto.getTotalBonTotalAllowance());	// 総支給金額計（賞与）
		prtItem_chk( poi, Line ,  10, dto.getTotalBonSocInsDeduction());	//給与社会保険料合計（賞与）
		prtItem_chk( poi, Line ,  12, dto.getTotalBonPayInsDeduction());	// 給与社会保険料控除後の給与等の金額合計（賞与）
		prtItem_chk( poi, Line ,  17, dto.getTotalBonIncomeTax());			// 給与所得税合計（賞与）
		prtItem_chk( poi, Line ,  21, dto.getTotalBonAdjCalcGap());		// 給与年調による過不足合計
		prtItem_chk( poi, Line ,  23, dto.getTotalBonIncomeTax() + dto.getTotalBonAdjCalcGap()); // 差引徴収税額（賞与）		

		/* 前年繰越 */
		Line   = 7;
		prtItem_chk( poi, Line ,  31, 0);	// 還付又は徴収した税額 仮：0
		prtItem_chk( poi, Line ,  35, 0);	// 差引残高 仮：0
		prtItem_chk( poi, Line ,  40, 0);	// 還付又は徴収した税額		
		prtItem_chk( poi, Line ,  43, 0);	// 差引残高

		/* 扶養控除等の申告 */
		// 扶養親族		
		Line   = 12;
		if(null != dto.	getGeneralDependent()) prtItem_chk( poi, Line ,  31, dto.getGeneralDependent());	// 還付又は徴収した税額 仮：0
		if((null != dto.getSpouseGe()) && (dto.getSpouseGe().equals(PayrollConst.ADJ_APPLICABLE))){	// 控除対象配偶者(一般配偶者（その他）有無)
			prtItem_chk( poi, Line ,  28, PayrollConst.PRESENCE_ON);
		}else{
			prtItem_chk( poi, Line ,  28, PayrollConst.PRESENCE_OFF);
		}
		if((null != dto.getSpouseEl()) && (dto.getSpouseEl().equals(PayrollConst.ADJ_APPLICABLE))){	// 控除対象配偶者(老人配偶者有無)
			prtItem_chk( poi, Line ,  30, PayrollConst.PRESENCE_ON);
		}else{
			prtItem_chk( poi, Line ,  30, PayrollConst.PRESENCE_OFF);
		}
		if(null !=  dto.getGeneralDependent())	prtItem_chk( poi, Line ,  31, dto.getGeneralDependent());	// 一般の扶養親族		
		if(null !=  dto.getSpecificDependent())	prtItem_chk( poi, Line ,  33, dto.getSpecificDependent());	// 特定扶養親族	
		if(null !=  dto.getLiveWithEldRel())	prtItem_chk( poi, Line ,  35, dto.getLiveWithEldRel());		// 老人扶養親族(同居老親等)
		if(null !=  dto.getElderlyDependent())	prtItem_chk( poi, Line ,  37, dto.getElderlyDependent());	// 老人扶養親族(その他)
		if(null !=  dto.getTotallHandicap())	prtItem_chk( poi, Line ,  39, dto.getTotallHandicap());		// 障害者計		

		if(null !=  dto.getTotallDeduction())	prtItem_chk( poi,   14 ,  43, dto.getTotallDeduction());		// 従たる給与から控除対象配偶者と扶養親族の合計数
		if(null !=  dto.getConsortFlg())		prtItem_chk( poi,   15 ,  45, dto.getConsortFlg());			// 配偶者の有無

		/* 年末調整 */
		Line   = 18;
		prtItem_chk( poi, Line +  0 , 35, dto.getTotalPayTotalAllowance());		// 給与・手当等：金額
		prtItem_chk( poi, Line +  0 , 41, dto.getTotalPayIncomeTax());			// 給与・手当等：税額
		prtItem_chk( poi, Line +  1 , 35, dto.getTotalBonTotalAllowance());		// 賞与等：金額
		prtItem_chk( poi, Line +  1 , 41, dto.getTotalBonIncomeTax());			// 賞与等：税額
		prtItem_chk( poi, Line +  2 , 35, dto.getTotalAllowance());				// 金額計
		prtItem_chk( poi, Line +  2 , 41, dto.getIncomeTax());					// 税額計
		Column = 35;
		prtItem_chk( poi, Line +  3 , Column , dto.getAfterDeductIncome());		// 給与所得控除後の給与等の金額	
		prtItem_chk( poi, Line +  4 , Column , dto.getPayInsDeduction());		// 社会保険料等控除額：給与等からの控除分
		prtItem_chk( poi, Line +  5 , Column , 0 );								// 社会保険料等控除額：申告による社会保険料の控除分(仮:0)
		prtItem_chk( poi, Line +  6 , Column , 0 );								// 社会保険料等控除額：申告による小規模企業共済等掛金の控除分(仮:0)
		prtItem_chk( poi, Line +  8 , Column , dto.getLifeInsDeduction());		// 生命保険料の控除額
		prtItem_chk( poi, Line +  9 , Column , dto.getEarthquakeIns());			// 地震保険料の控除額
		prtItem_chk( poi, Line + 10 , Column , dto.getSpouseSpDeduction());		// 配偶者特別控除額
		prtItem_chk( poi, Line + 11 , Column , dto.getDependentsDeduction());	// 配偶者控除額、扶養控除額、基礎控除額及び障害者等の控除額の合計額

		// 所得控除額の合計
		Sum_tmp = dto.getPayInsDeduction() + dto.getLifeInsDeduction() + dto.getEarthquakeIns() + dto.getSpouseSpDeduction() + dto.getDependentsDeduction();
		prtItem_chk( poi, Line + 13 , 35, Sum_tmp );								// 所得控除額の合計額
		// 差引課税給与所得		
		Sum_tmp = (int)round( dto.getAfterDeductIncome() - Sum_tmp, -3, BigDecimal.ROUND_DOWN);
		prtItem_chk( poi, Line + 16 , 35, Sum_tmp );								// 差引課税給与所得金額

		Line   = 22;
		Column = 41;
		prtItem_chk( poi, Line +  0 , Column , dto.getSpouseSumIncome());		// 配偶者の合計所得金額		
		prtItem_chk( poi, Line +  2 , Column , dto.getPrivatePension());			// 個人年金保険料支払額		
		prtItem_chk( poi, Line +  4 , Column , dto.getLongTermDamageIns()); 		// 旧長期損害保険料支払額					
		prtItem_chk( poi, Line +  7 , Column , dto.getMutualAidDeduction());		// 小規模企業共済等掛金の金額					
		prtItem_chk( poi, Line + 10 , Column , 0 );								// 国民年金保険					
		prtItem_chk( poi, Line + 12 , Column , dto.getCalcIncomeTax());			// 算出年税額
		prtItem_chk( poi, Line + 13 , Column , dto.getHouseLoanDeduction());		// 住宅借入金等特別控除額
		prtItem_chk( poi, Line + 14 , Column , dto.getAdjustedIncomeTax());		// 年調年税額		

		// 差引額
		int Sum_tmp_sashihiki = dto.getAdjustedIncomeTax() - dto.getIncomeTax();
		prtItem_chk( poi, Line + 15 , Column , Sum_tmp_sashihiki);							// 差引額
		if(0 < Sum_tmp_sashihiki ){
			prtItem_chk( poi, Line + 15 , 29 , PayrollConst.BALANCE_LOW);		// 差引：不足額
		}else{
			prtItem_chk( poi, Line + 15 , 29 , PayrollConst.BALANCE_OVER);		// 差引：超過額
		}

		Line   = 38;
		Column = 41;
		prtItem_chk( poi, Line +  0 , Column , 0);		// 本年最後の給与から徴収する税額に充当する金額
		prtItem_chk( poi, Line +  1 , Column , 0);		// 未払給与に係る未徴収の税額に充当する金額
		
		// 還付する金額
		// （差引金額）−（本年最後の給与から徴収する税額に充当する金額）−（未払給与に係る未徴収の税額に充当する金額）
		Sum_tmp = Sum_tmp_sashihiki - 0 - 0;
		prtItem_chk( poi, Line +  2 , Column , Sum_tmp);		// 差引還付する金額
		prtItem_chk( poi, Line +  3 , Column , Sum_tmp);		// 本年中に還付する金額
		prtItem_chk( poi, Line +  3 , Column , 0);			// 翌年において還付する金額
		prtItem_chk( poi, Line +  4 , Column , 0);			// 本年最後の給与から徴収する金額
		prtItem_chk( poi, Line +  5 , Column , 0);			// 翌年に繰り越して徴収する金額
		
		// 出力内容設定
		String fileName = String.valueOf(vo.getHidAdjustYear()) + 
										PayrollConst.FILE_NAME_SEPARATOR +
										dto.getKCode()	+
										PayrollConst.FILE_NAME_SEPARATOR +
										PayrollConst.FILE_WITHHOLDINGLIST_XLS;
		request.setAttribute(MospConst.ATT_FILE_NAME, fileName);
		request.setAttribute(MospConst.ATT_FILE_OBJECT, poi.getWorkbook());
	}


	/**
	 * 帳票出力処理を行う。(OpenOffice Calc)<br><br>
	 * @throws Exception 
	 */
	private void report(AdjustmentReferVo vo , WithholdingListDto dto) throws Exception {
		int Line;
		int Column;
		int Sum_tmp;

		// コネクション取得
		getConnection();
		// 帳票作成
		OdsBean odsBean = new OdsBean(cfg.getProperty(MospConst.PPT_APP_DOCBASE) + PayrollConst.TEMPLATE_WITHHOLDINGLIST_ODS);

		// ヘッダー
		odsBean.setValue(     1,  9, dto.getAdjustYear_YY());		// 対象和暦年度年度(左枠外タイトル)

		Line   = 1;
		setValue_chk( odsBean,  4, Line , dto.getStationName());			// 所属名
		setValue_chk( odsBean,  9, Line , dto.getPositionName());		// 職名
		setValue_chk( odsBean, 17, Line , dto.getPostalCode());			// 郵便番号
		setValue_chk( odsBean, 33, Line , dto.getFName());				// フリガナ
		setValue_chk( odsBean, 42, Line , dto.getKCode());				// 整理番号
		
		Line   = 2;
		setValue_chk( odsBean, 14, Line , dto.getAddress());				// 住所
		setValue_chk( odsBean, 33, Line , dto.getKName());				// 氏名		
		
		setValue_chk( odsBean, 33 ,  4, dto.getBirthDate());			// 生年月日		

		/* 給与 */
		// 支給月（給与）
		Line   = 7;
		Column = 4;
		if(null != dto.getPaymentMonth_01()) setValue_chk( odsBean, Column, Line     , dto.getPaymentMonth_01());
		if(null != dto.getPaymentMonth_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPaymentMonth_02());
		if(null != dto.getPaymentMonth_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPaymentMonth_03());
		if(null != dto.getPaymentMonth_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPaymentMonth_04());
		if(null != dto.getPaymentMonth_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPaymentMonth_05());
		if(null != dto.getPaymentMonth_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPaymentMonth_06());
		if(null != dto.getPaymentMonth_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPaymentMonth_07());
		if(null != dto.getPaymentMonth_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPaymentMonth_08());
		if(null != dto.getPaymentMonth_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPaymentMonth_09());
		if(null != dto.getPaymentMonth_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPaymentMonth_10());
		if(null != dto.getPaymentMonth_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPaymentMonth_11());
		if(null != dto.getPaymentMonth_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPaymentMonth_12());

		// 支給日（給与）
		Line   = 7;
		Column = 5;
		if(null != dto.getPaymentPayDay_01()) setValue_chk( odsBean, Column, Line     , dto.getPaymentPayDay_01());
		if(null != dto.getPaymentPayDay_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPaymentPayDay_02());
		if(null != dto.getPaymentPayDay_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPaymentPayDay_03());
		if(null != dto.getPaymentPayDay_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPaymentPayDay_04());
		if(null != dto.getPaymentPayDay_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPaymentPayDay_05());
		if(null != dto.getPaymentPayDay_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPaymentPayDay_06());
		if(null != dto.getPaymentPayDay_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPaymentPayDay_07());
		if(null != dto.getPaymentPayDay_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPaymentPayDay_08());
		if(null != dto.getPaymentPayDay_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPaymentPayDay_09());
		if(null != dto.getPaymentPayDay_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPaymentPayDay_10());
		if(null != dto.getPaymentPayDay_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPaymentPayDay_11());
		if(null != dto.getPaymentPayDay_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPaymentPayDay_12());

		// 総支給金額（給与）
		Line   = 7;
		Column = 7;
		if(null != dto.getPayTotalAllowance_01()) setValue_chk( odsBean, Column, Line     , dto.getPayTotalAllowance_01());
		if(null != dto.getPayTotalAllowance_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPayTotalAllowance_02());
		if(null != dto.getPayTotalAllowance_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPayTotalAllowance_03());
		if(null != dto.getPayTotalAllowance_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPayTotalAllowance_04());
		if(null != dto.getPayTotalAllowance_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPayTotalAllowance_05());
		if(null != dto.getPayTotalAllowance_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPayTotalAllowance_06());
		if(null != dto.getPayTotalAllowance_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPayTotalAllowance_07());
		if(null != dto.getPayTotalAllowance_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPayTotalAllowance_08());
		if(null != dto.getPayTotalAllowance_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPayTotalAllowance_09());
		if(null != dto.getPayTotalAllowance_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPayTotalAllowance_10());
		if(null != dto.getPayTotalAllowance_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPayTotalAllowance_11());
		if(null != dto.getPayTotalAllowance_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPayTotalAllowance_12());

		// 社会保険料等の控除額（給与）
		Line   = 7;
		Column = 10;
		if(null != dto.getPaySocInsDeduction_01()) setValue_chk( odsBean, Column, Line     , dto.getPaySocInsDeduction_01());
		if(null != dto.getPaySocInsDeduction_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPaySocInsDeduction_02());
		if(null != dto.getPaySocInsDeduction_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPaySocInsDeduction_03());
		if(null != dto.getPaySocInsDeduction_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPaySocInsDeduction_04());
		if(null != dto.getPaySocInsDeduction_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPaySocInsDeduction_05());
		if(null != dto.getPaySocInsDeduction_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPaySocInsDeduction_06());
		if(null != dto.getPaySocInsDeduction_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPaySocInsDeduction_07());
		if(null != dto.getPaySocInsDeduction_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPaySocInsDeduction_08());
		if(null != dto.getPaySocInsDeduction_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPaySocInsDeduction_09());
		if(null != dto.getPaySocInsDeduction_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPaySocInsDeduction_10());
		if(null != dto.getPaySocInsDeduction_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPaySocInsDeduction_11());
		if(null != dto.getPaySocInsDeduction_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPaySocInsDeduction_12());

		// 社会保険料控除後の給与等の金額（給与）		
		Line   = 7;
		Column = 12;
		if(null != dto.getPayPayInsDeduction_01()) setValue_chk( odsBean, Column, Line     , dto.getPayPayInsDeduction_01());
		if(null != dto.getPayPayInsDeduction_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPayPayInsDeduction_02());
		if(null != dto.getPayPayInsDeduction_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPayPayInsDeduction_03());
		if(null != dto.getPayPayInsDeduction_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPayPayInsDeduction_04());
		if(null != dto.getPayPayInsDeduction_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPayPayInsDeduction_05());
		if(null != dto.getPayPayInsDeduction_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPayPayInsDeduction_06());
		if(null != dto.getPayPayInsDeduction_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPayPayInsDeduction_07());
		if(null != dto.getPayPayInsDeduction_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPayPayInsDeduction_08());
		if(null != dto.getPayPayInsDeduction_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPayPayInsDeduction_09());
		if(null != dto.getPayPayInsDeduction_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPayPayInsDeduction_10());
		if(null != dto.getPayPayInsDeduction_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPayPayInsDeduction_11());
		if(null != dto.getPayPayInsDeduction_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPayPayInsDeduction_12());
		
		// 扶養親族等の数（給与）		
		Line   = 7;
		Column = 14;
		if(null != dto.getPayDependentCount_01()) setValue_chk( odsBean, Column, Line     , dto.getPayDependentCount_01());
		if(null != dto.getPayDependentCount_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPayDependentCount_02());
		if(null != dto.getPayDependentCount_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPayDependentCount_03());
		if(null != dto.getPayDependentCount_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPayDependentCount_04());
		if(null != dto.getPayDependentCount_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPayDependentCount_05());
		if(null != dto.getPayDependentCount_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPayDependentCount_06());
		if(null != dto.getPayDependentCount_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPayDependentCount_07());
		if(null != dto.getPayDependentCount_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPayDependentCount_08());
		if(null != dto.getPayDependentCount_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPayDependentCount_09());
		if(null != dto.getPayDependentCount_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPayDependentCount_10());
		if(null != dto.getPayDependentCount_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPayDependentCount_11());
		if(null != dto.getPayDependentCount_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPayDependentCount_12());
		
		// 算出税額（所得税額）（給与）
		Line   = 7;
		Column = 17;
		if(null != dto.getPayIncomeTax_01()) setValue_chk( odsBean, Column, Line     , dto.getPayIncomeTax_01());
		if(null != dto.getPayIncomeTax_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPayIncomeTax_02());
		if(null != dto.getPayIncomeTax_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPayIncomeTax_03());
		if(null != dto.getPayIncomeTax_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPayIncomeTax_04());
		if(null != dto.getPayIncomeTax_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPayIncomeTax_05());
		if(null != dto.getPayIncomeTax_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPayIncomeTax_06());
		if(null != dto.getPayIncomeTax_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPayIncomeTax_07());
		if(null != dto.getPayIncomeTax_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPayIncomeTax_08());
		if(null != dto.getPayIncomeTax_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPayIncomeTax_09());
		if(null != dto.getPayIncomeTax_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPayIncomeTax_10());
		if(null != dto.getPayIncomeTax_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPayIncomeTax_11());
		if(null != dto.getPayIncomeTax_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPayIncomeTax_12());
		
		// 年末調整による過不足税額（給与）
		Line   = 7;
		Column = 21;
		if(null != dto.getPayAdjCalcGap_01()) setValue_chk( odsBean, Column, Line     , dto.getPayAdjCalcGap_01());
		if(null != dto.getPayAdjCalcGap_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPayAdjCalcGap_02());
		if(null != dto.getPayAdjCalcGap_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPayAdjCalcGap_03());
		if(null != dto.getPayAdjCalcGap_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPayAdjCalcGap_04());
		if(null != dto.getPayAdjCalcGap_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPayAdjCalcGap_05());
		if(null != dto.getPayAdjCalcGap_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPayAdjCalcGap_06());
		if(null != dto.getPayAdjCalcGap_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPayAdjCalcGap_07());
		if(null != dto.getPayAdjCalcGap_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPayAdjCalcGap_08());
		if(null != dto.getPayAdjCalcGap_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPayAdjCalcGap_09());
		if(null != dto.getPayAdjCalcGap_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPayAdjCalcGap_10());
		if(null != dto.getPayAdjCalcGap_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPayAdjCalcGap_11());
		if(null != dto.getPayAdjCalcGap_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPayAdjCalcGap_12());
		
		// 差引徴収税額（給与）		
		Line   = 7;
		Column = 23;
		if(null != dto.getPayPaymentTax_01()) setValue_chk( odsBean, Column, Line +  0, dto.getPayPaymentTax_01());
		if(null != dto.getPayPaymentTax_02()) setValue_chk( odsBean, Column, Line +  2, dto.getPayPaymentTax_02());
		if(null != dto.getPayPaymentTax_03()) setValue_chk( odsBean, Column, Line +  4, dto.getPayPaymentTax_03());
		if(null != dto.getPayPaymentTax_04()) setValue_chk( odsBean, Column, Line +  6, dto.getPayPaymentTax_04());
		if(null != dto.getPayPaymentTax_05()) setValue_chk( odsBean, Column, Line +  8, dto.getPayPaymentTax_05());
		if(null != dto.getPayPaymentTax_06()) setValue_chk( odsBean, Column, Line + 10, dto.getPayPaymentTax_06());
		if(null != dto.getPayPaymentTax_07()) setValue_chk( odsBean, Column, Line + 12, dto.getPayPaymentTax_07());
		if(null != dto.getPayPaymentTax_08()) setValue_chk( odsBean, Column, Line + 14, dto.getPayPaymentTax_08());
		if(null != dto.getPayPaymentTax_09()) setValue_chk( odsBean, Column, Line + 16, dto.getPayPaymentTax_09());
		if(null != dto.getPayPaymentTax_10()) setValue_chk( odsBean, Column, Line + 18, dto.getPayPaymentTax_10());
		if(null != dto.getPayPaymentTax_11()) setValue_chk( odsBean, Column, Line + 20, dto.getPayPaymentTax_11());
		if(null != dto.getPayPaymentTax_12()) setValue_chk( odsBean, Column, Line + 22, dto.getPayPaymentTax_12());

		Line   = 31;
		setValue_chk( odsBean,   7, Line , dto.getTotalPayTotalAllowance());		// 総支給金額計（給与）
		setValue_chk( odsBean,  10, Line , dto.getTotalPaySocInsDeduction());		// 給与社会保険料合計（給与）
		setValue_chk( odsBean,  12, Line , dto.getTotalPayPayInsDeduction());		// 給与社会保険料控除後の給与等の金額合計（給与）
		setValue_chk( odsBean,  17, Line , dto.getTotalPayIncomeTax());			// 給与所得税合計（給与）
		setValue_chk( odsBean,  21, Line , dto.getTotalPayAdjCalcGap());			// 給与年調による過不足合計（給与）
		setValue_chk( odsBean,  23, Line , dto.getTotalPayIncomeTax() + dto.getTotalPayAdjCalcGap()); // 差引徴収税額（給与）		

		/* 賞与 */
		// 支払月（賞与）
		Line   = 33;
		Column = 3;
		if(null != dto.getBonusMonth_01())   setValue_chk( odsBean, Column, Line +  0, dto.getBonusMonth_01());
		if(null != dto.getBonusMonth_02())   setValue_chk( odsBean, Column, Line +  2, dto.getBonusMonth_02());
		if(null != dto.getBonusMonth_03())   setValue_chk( odsBean, Column, Line +  4, dto.getBonusMonth_03());
		if(null != dto.getBonusMonth_04())   setValue_chk( odsBean, Column, Line +  6, dto.getBonusMonth_04());
		if(null != dto.getBonusMonth_05())   setValue_chk( odsBean, Column, Line +  8, dto.getBonusMonth_05());
//		if(null != dto.getBonusMonth_06())   setValue_chk( odsBean, Column, Line + 10, dto.getBonusMonth_06());
		Column = 4;
		if(null != dto.getBonusMonth_01())   setValue_chk( odsBean, Column, Line +  0, dto.getBonusMonth_01());
		if(null != dto.getBonusMonth_02())   setValue_chk( odsBean, Column, Line +  2, dto.getBonusMonth_02());
		if(null != dto.getBonusMonth_03())   setValue_chk( odsBean, Column, Line +  4, dto.getBonusMonth_03());
		if(null != dto.getBonusMonth_04())   setValue_chk( odsBean, Column, Line +  6, dto.getBonusMonth_04());
		if(null != dto.getBonusMonth_05())   setValue_chk( odsBean, Column, Line +  8, dto.getBonusMonth_05());
//		if(null != dto.getBonusMonth_06())   setValue_chk( odsBean, Column, Line + 10, dto.getBonusMonth_06());

		// 支払日（賞与）
		Column = 5;
		if(null != dto.getBonusPayDay_01())  setValue_chk( odsBean, Column, Line +  0,  dto.getBonusPayDay_01());
		if(null != dto.getBonusPayDay_02())  setValue_chk( odsBean, Column, Line +  2,  dto.getBonusPayDay_02());
		if(null != dto.getBonusPayDay_03())  setValue_chk( odsBean, Column, Line +  4,  dto.getBonusPayDay_03());
		if(null != dto.getBonusPayDay_04())  setValue_chk( odsBean, Column, Line +  6,  dto.getBonusPayDay_04());
		if(null != dto.getBonusPayDay_05())  setValue_chk( odsBean, Column, Line +  8,  dto.getBonusPayDay_05());
//		if(null != dto.getBonusPayDay_06())  setValue_chk( odsBean, Column, Line + 10,  dto.getBonusPayDay_06());

		//総支給金額（賞与）
		Line   = 33;
		Column = 7;
		if(null != dto.getBonTotalAllowance_01())  setValue_chk( odsBean, Column, Line +  0,   dto.getBonTotalAllowance_01());
		if(null != dto.getBonTotalAllowance_02())  setValue_chk( odsBean, Column, Line +  2,   dto.getBonTotalAllowance_02());
		if(null != dto.getBonTotalAllowance_03())  setValue_chk( odsBean, Column, Line +  4,   dto.getBonTotalAllowance_03());
		if(null != dto.getBonTotalAllowance_04())  setValue_chk( odsBean, Column, Line +  6,   dto.getBonTotalAllowance_04());
		if(null != dto.getBonTotalAllowance_05())  setValue_chk( odsBean, Column, Line +  8,   dto.getBonTotalAllowance_05());
//		if(null != dto.getBonTotalAllowance_06())  setValue_chk( odsBean, Column, Line + 10,   dto.getBonTotalAllowance_06());

		// 
		// 社会保険料等の控除額（賞与）
		Line   = 33;
		Column = 10;
		if(null != dto.getBonSocInsDeduction_01())  setValue_chk( odsBean, Column, Line +  0,   dto.getBonSocInsDeduction_01());
		if(null != dto.getBonSocInsDeduction_02())  setValue_chk( odsBean, Column, Line +  2,   dto.getBonSocInsDeduction_02());
		if(null != dto.getBonSocInsDeduction_03())  setValue_chk( odsBean, Column, Line +  4,   dto.getBonSocInsDeduction_03());
		if(null != dto.getBonSocInsDeduction_04())  setValue_chk( odsBean, Column, Line +  6,   dto.getBonSocInsDeduction_04());
		if(null != dto.getBonSocInsDeduction_05())  setValue_chk( odsBean, Column, Line +  8,   dto.getBonSocInsDeduction_05());
//		if(null != dto.getBonSocInsDeduction_06())  setValue_chk( odsBean, Column, Line + 10,   dto.getBonSocInsDeduction_06());
		
		// 社会保険料控除後の給与等の金額（賞与）		
		Line   = 33;
		Column = 12;
		if(null != dto.getBonPayInsDeduction_01()) setValue_chk( odsBean, Column, Line +  0,   dto.getBonPayInsDeduction_01());
		if(null != dto.getBonPayInsDeduction_02()) setValue_chk( odsBean, Column, Line +  2,   dto.getBonPayInsDeduction_02());
		if(null != dto.getBonPayInsDeduction_03()) setValue_chk( odsBean, Column, Line +  4,   dto.getBonPayInsDeduction_03());
		if(null != dto.getBonPayInsDeduction_04()) setValue_chk( odsBean, Column, Line +  6,   dto.getBonPayInsDeduction_04());
		if(null != dto.getBonPayInsDeduction_05()) setValue_chk( odsBean, Column, Line +  8,   dto.getBonPayInsDeduction_05());
//		if(null != dto.getBonPayInsDeduction_06()) setValue_chk( odsBean, Column, Line + 10,   dto.getBonPayInsDeduction_06());
		
		// 扶養親族等の数（賞与）
		Line   = 33;
		Column = 14;
		if(null != dto.getBonDependentCount_01()) setValue_chk( odsBean, Column, Line +  0,   dto.getBonDependentCount_01());
		if(null != dto.getBonDependentCount_02()) setValue_chk( odsBean, Column, Line +  2,   dto.getBonDependentCount_02());
		if(null != dto.getBonDependentCount_03()) setValue_chk( odsBean, Column, Line +  4,   dto.getBonDependentCount_03());
		if(null != dto.getBonDependentCount_04()) setValue_chk( odsBean, Column, Line +  6,   dto.getBonDependentCount_04());
		if(null != dto.getBonDependentCount_05()) setValue_chk( odsBean, Column, Line +  8,   dto.getBonDependentCount_05());
//		if(null != dto.getBonDependentCount_06()) setValue_chk( odsBean, Column, Line + 10,   dto.getBonDependentCount_06());
		
		// 算出税額（所得税額）（賞与）
		Line   = 34;
		Column = 17;
		if(null != dto.getBonIncomeTax_01()) setValue_chk( odsBean, Column, Line +  0,   dto.getBonIncomeTax_01());
		if(null != dto.getBonIncomeTax_02()) setValue_chk( odsBean, Column, Line +  2,   dto.getBonIncomeTax_02());
		if(null != dto.getBonIncomeTax_03()) setValue_chk( odsBean, Column, Line +  4,   dto.getBonIncomeTax_03());
		if(null != dto.getBonIncomeTax_04()) setValue_chk( odsBean, Column, Line +  6,   dto.getBonIncomeTax_04());
		if(null != dto.getBonIncomeTax_05()) setValue_chk( odsBean, Column, Line +  8,   dto.getBonIncomeTax_05());
//		if(null != dto.getBonIncomeTax_06()) setValue_chk( odsBean, Column, Line + 10,   dto.getBonIncomeTax_06());
		
		
		// 年末調整による過不足税額（賞与）
		Line   = 33;
		Column = 21;
		if(null != dto.getBonAdjCalcGap_01()) setValue_chk( odsBean, Column, Line +  0,   dto.getBonAdjCalcGap_01());
		if(null != dto.getBonAdjCalcGap_02()) setValue_chk( odsBean, Column, Line +  2,   dto.getBonAdjCalcGap_02());
		if(null != dto.getBonAdjCalcGap_03()) setValue_chk( odsBean, Column, Line +  4,   dto.getBonAdjCalcGap_03());
		if(null != dto.getBonAdjCalcGap_04()) setValue_chk( odsBean, Column, Line +  6,   dto.getBonAdjCalcGap_04());
		if(null != dto.getBonAdjCalcGap_05()) setValue_chk( odsBean, Column, Line +  8,   dto.getBonAdjCalcGap_05());
//		if(null != dto.getBonAdjCalcGap_06()) setValue_chk( odsBean, Column, Line + 10,   dto.getBonAdjCalcGap_06());
		
		// 差引徴収税額（賞与）		
		Line   = 33;
		Column = 23;
		if(null != dto.getBonPaymentTax_01()) setValue_chk( odsBean, Column, Line +  0, dto.getBonPaymentTax_01());
		if(null != dto.getBonPaymentTax_02()) setValue_chk( odsBean, Column, Line +  2, dto.getBonPaymentTax_02());
		if(null != dto.getBonPaymentTax_03()) setValue_chk( odsBean, Column, Line +  4, dto.getBonPaymentTax_03());
		if(null != dto.getBonPaymentTax_04()) setValue_chk( odsBean, Column, Line +  6, dto.getBonPaymentTax_04());
		if(null != dto.getBonPaymentTax_05()) setValue_chk( odsBean, Column, Line +  8, dto.getBonPaymentTax_05());
//		if(null != dto.getBonPaymentTax_06()) setValue_chk( odsBean, Column, Line + 10, dto.getBonPaymentTax_06());

		// 所得税税率
		Line   = 33;
		Column = 18;
		if(null != dto.getBonIncomeTaxRate_01()) setValue_chk( odsBean, Column, Line +  0, dto.getBonIncomeTaxRate_01());
		if(null != dto.getBonIncomeTaxRate_02()) setValue_chk( odsBean, Column, Line +  2, dto.getBonIncomeTaxRate_02());
		if(null != dto.getBonIncomeTaxRate_03()) setValue_chk( odsBean, Column, Line +  4, dto.getBonIncomeTaxRate_03());
		if(null != dto.getBonIncomeTaxRate_04()) setValue_chk( odsBean, Column, Line +  6, dto.getBonIncomeTaxRate_04());
		if(null != dto.getBonIncomeTaxRate_05()) setValue_chk( odsBean, Column, Line +  8, dto.getBonIncomeTaxRate_05());
//		if(null != dto.getBonIncomeTaxRate_06()) setValue_chk( odsBean, Column, Line + 10, dto.getBonIncomeTaxRate_06());
		
		Line   = 43;
		setValue_chk( odsBean,   7, Line , dto.getTotalBonTotalAllowance());	// 総支給金額計（賞与）
		setValue_chk( odsBean,  10, Line , dto.getTotalBonSocInsDeduction());	//給与社会保険料合計（賞与）
		setValue_chk( odsBean,  12, Line , dto.getTotalBonPayInsDeduction());	// 給与社会保険料控除後の給与等の金額合計（賞与）
		setValue_chk( odsBean,  17, Line , dto.getTotalBonIncomeTax());			// 給与所得税合計（賞与）
		setValue_chk( odsBean,  21, Line , dto.getTotalBonAdjCalcGap());		// 給与年調による過不足合計
		setValue_chk( odsBean,  23, Line , dto.getTotalBonIncomeTax() + dto.getTotalBonAdjCalcGap()); // 差引徴収税額（賞与）		

		/* 前年繰越 */
		Line   = 7;
		setValue_chk( odsBean,  31, Line , 0);	// 還付又は徴収した税額 仮：0
		setValue_chk( odsBean,  35, Line , 0);	// 差引残高 仮：0
		setValue_chk( odsBean,  40, Line , 0);	// 還付又は徴収した税額		
		setValue_chk( odsBean,  43, Line , 0);	// 差引残高

		/* 扶養控除等の申告 */
		// 扶養親族		
		Line   = 12;
		if(null != dto.	getGeneralDependent()) setValue_chk( odsBean, Line ,  31, dto.getGeneralDependent());	// 還付又は徴収した税額 仮：0
		if((null != dto.getSpouseGe()) && (dto.getSpouseGe().equals(PayrollConst.ADJ_APPLICABLE))){	// 控除対象配偶者(一般配偶者（その他）有無)
			setValue_chk( odsBean, 28 , Line , PayrollConst.PRESENCE_ON);
		}else{
			setValue_chk( odsBean, 28 , Line , PayrollConst.PRESENCE_OFF);
		}
		if((null != dto.getSpouseEl()) && (dto.getSpouseEl().equals(PayrollConst.ADJ_APPLICABLE))){	// 控除対象配偶者(老人配偶者有無)
			setValue_chk( odsBean, 30 , Line , PayrollConst.PRESENCE_ON);
		}else{
			setValue_chk( odsBean, 30 , Line , PayrollConst.PRESENCE_OFF);
		}
		if(null !=  dto.getGeneralDependent())	setValue_chk( odsBean,  31, Line , dto.getGeneralDependent());	// 一般の扶養親族		
		if(null !=  dto.getSpecificDependent())	setValue_chk( odsBean,  33, Line , dto.getSpecificDependent());	// 特定扶養親族	
		if(null !=  dto.getLiveWithEldRel())	setValue_chk( odsBean,  35, Line , dto.getLiveWithEldRel());		// 老人扶養親族(同居老親等)
		if(null !=  dto.getElderlyDependent())	setValue_chk( odsBean,  37, Line , dto.getElderlyDependent());	// 老人扶養親族(その他)
		if(null !=  dto.getTotallHandicap())	setValue_chk( odsBean,  39, Line , dto.getTotallHandicap());		// 障害者計		

		if(null !=  dto.getTotallDeduction())	setValue_chk( odsBean,  43,   14 , dto.getTotallDeduction());		// 従たる給与から控除対象配偶者と扶養親族の合計数
		if(null !=  dto.getConsortFlg())		setValue_chk( odsBean,  45,   15 , dto.getConsortFlg());			// 配偶者の有無

		/* 年末調整 */
		Line   = 18;
		setValue_chk( odsBean, 35, Line +  0 , dto.getTotalPayTotalAllowance());		// 給与・手当等：金額
		setValue_chk( odsBean, 41, Line +  0 , dto.getTotalPayIncomeTax());			// 給与・手当等：税額
		setValue_chk( odsBean, 35, Line +  1 , dto.getTotalBonTotalAllowance());		// 賞与等：金額
		setValue_chk( odsBean, 41, Line +  1 , dto.getTotalBonIncomeTax());			// 賞与等：税額
		setValue_chk( odsBean, 35, Line +  2 , dto.getTotalAllowance());				// 金額計
		setValue_chk( odsBean, 41, Line +  2 , dto.getIncomeTax());					// 税額計
		Column = 35;
		setValue_chk( odsBean, Column , Line +  3 , dto.getAfterDeductIncome());		// 給与所得控除後の給与等の金額	
		setValue_chk( odsBean, Column , Line +  4 , dto.getPayInsDeduction());		// 社会保険料等控除額：給与等からの控除分
		setValue_chk( odsBean, Column , Line +  5 , 0 );								// 社会保険料等控除額：申告による社会保険料の控除分(仮:0)
		setValue_chk( odsBean, Column , Line +  6 , 0 );								// 社会保険料等控除額：申告による小規模企業共済等掛金の控除分(仮:0)
		setValue_chk( odsBean, Column , Line +  8 , dto.getLifeInsDeduction());		// 生命保険料の控除額
		setValue_chk( odsBean, Column , Line +  9 , dto.getEarthquakeIns());			// 地震保険料の控除額
		setValue_chk( odsBean, Column , Line + 10 , dto.getSpouseSpDeduction());		// 配偶者特別控除額
		setValue_chk( odsBean, Column , Line + 11 , dto.getDependentsDeduction());	// 配偶者控除額、扶養控除額、基礎控除額及び障害者等の控除額の合計額

		// 所得控除額の合計
		Sum_tmp = dto.getPayInsDeduction() + dto.getLifeInsDeduction() + dto.getEarthquakeIns() + dto.getSpouseSpDeduction() + dto.getDependentsDeduction();
		setValue_chk( odsBean, 35 , Line + 13 , Sum_tmp );								// 所得控除額の合計額
		// 差引課税給与所得		
		Sum_tmp = (int)round( dto.getAfterDeductIncome() - Sum_tmp, -3, BigDecimal.ROUND_DOWN);
		setValue_chk( odsBean, 35 , Line + 16 , Sum_tmp );								// 差引課税給与所得金額

		Line   = 22;
		Column = 41;
		setValue_chk( odsBean, Column , Line +  0 , dto.getSpouseSumIncome());		// 配偶者の合計所得金額		
		setValue_chk( odsBean, Column , Line +  2 , dto.getPrivatePension());			// 個人年金保険料支払額		
		setValue_chk( odsBean, Column , Line +  4 , dto.getLongTermDamageIns()); 		// 旧長期損害保険料支払額					
		setValue_chk( odsBean, Column , Line +  7 , dto.getMutualAidDeduction());		// 小規模企業共済等掛金の金額					
		setValue_chk( odsBean, Column , Line + 10 , 0 );								// 国民年金保険					
		setValue_chk( odsBean, Column , Line + 12 , dto.getCalcIncomeTax());			// 算出年税額
		setValue_chk( odsBean, Column , Line + 13 , dto.getHouseLoanDeduction());		// 住宅借入金等特別控除額
		setValue_chk( odsBean, Column , Line + 14 , dto.getAdjustedIncomeTax());		// 年調年税額		

		// 差引額
		int Sum_tmp_sashihiki = dto.getAdjustedIncomeTax() - dto.getIncomeTax();
		setValue_chk( odsBean, Column , Line + 15 ,  Sum_tmp_sashihiki);							// 差引額
		if(0 < Sum_tmp_sashihiki ){
			setValue_chk( odsBean, 29 , Line + 15 ,  PayrollConst.BALANCE_LOW);		// 差引：不足額
		}else{
			setValue_chk( odsBean, 29 , Line + 15 ,  PayrollConst.BALANCE_OVER);		// 差引：超過額
		}

		Line   = 38;
		Column = 41;
		setValue_chk( odsBean, Column , Line +  0 , 0);		// 本年最後の給与から徴収する税額に充当する金額
		setValue_chk( odsBean, Column , Line +  1 , 0);		// 未払給与に係る未徴収の税額に充当する金額
		
		// 還付する金額
		// （差引金額）−（本年最後の給与から徴収する税額に充当する金額）−（未払給与に係る未徴収の税額に充当する金額）
		Sum_tmp = Sum_tmp_sashihiki - 0 - 0;
		setValue_chk( odsBean, Column , Line +  2 , Sum_tmp);		// 差引還付する金額
		setValue_chk( odsBean, Column , Line +  3 , Sum_tmp);		// 本年中に還付する金額
		setValue_chk( odsBean, Column , Line +  3 , 0);			// 翌年において還付する金額
		setValue_chk( odsBean, Column , Line +  4 , 0);			// 本年最後の給与から徴収する金額
		setValue_chk( odsBean, Column , Line +  5 , 0);			// 翌年に繰り越して徴収する金額
		
		// 出力内容設定
		String fileName = String.valueOf(vo.getHidAdjustYear()) + 
										PayrollConst.FILE_NAME_SEPARATOR +
										dto.getKCode()	+
										PayrollConst.FILE_NAME_SEPARATOR +
										PayrollConst.FILE_WITHHOLDINGLIST_ODS;

		request.setAttribute(MospConst.ATT_FILE_NAME, fileName);
		request.setAttribute(MospConst.ATT_FILE_OBJECT, odsBean.getSpreadSheet());
	}

}
