package cokr.xit.fims.cmmn.hwp.format;

import java.util.ArrayList;
import java.util.List;

import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;

/**
 * 납부확인서
 */
public class RcvmtConfirm extends HWPFormat {

	public RcvmtConfirm(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
		super(print, printOption, dataObjectList);

		this.maxRunCount = dataObjectList.size();
		this.formatFilePath = "template/hwp/rcvmtConfirm.hwp";
		print.setFormatKorName("납부확인서");
		print.setFormatName("rcvmtConfirm");
	}

	@Override
	public List<String> getDownloadDataNames() {
		List<String> list = new ArrayList<>();
		list.add("위반명");
		list.add("위반차량");
		list.add("대체차량");
		list.add("위반금액");
		list.add("단속일자");
		list.add("단속장소");
		list.add("소유자");
		list.add("주민번호");
		list.add("소유자주소");
		list.add("고지번호");
		list.add("수납일자");
		list.add("수납금액");
		return list;
	}



	@Override
	public void runAsWriter() {

		String instNm = OgdpUtil.getInstituteLeader((String) print.getPrintRequestUserInfo().getInfo().get("instNm"), false);


		DataObject one = data.get(currentRunCount);
		DataObject newObj = (DataObject) new DataObject()
		.set("위반명1", one.string("TASK_SE_NM"))
		.set("위반명2", one.string("TASK_SE_NM"))
		.set("위반차량", one.string("VHRNO"))
		.set("대체차량", one.string("RPM_SZR_VHRNO"))
		.set("위반금액", DataFormat.n_nn0(one.string("FFNLG_AMT")))
		.set("단속일자", DataFormat.yyyy_mm_dd(one.string("CRDN_YMD")))
		.set("단속장소", one.string("CRDN_PLC"))
		.set("소유자", one.string("RTPYR_NM"))
		.set("주민번호", one.string("RTPYR_NO"))
		.set("주소", one.string("RTPYR_FULL_ADDR"))
		.set("고지번호", one.string("GOJI_NO"))
		.set("수납일자", DataFormat.yyyy_mm_dd(one.string("RCVMT_YMD")))
		.set("수납금액", DataFormat.n_nn0(one.string("RCVMT_AMT")))
		.set("연월일시분초", DataFormat.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()))
		.set("확인자", print.getPrintRequestUserInfo().getName())
		.set("발신", instNm)
		;


		writer.table(0, 0, 12).setValues(List.of(newObj));


	}


}
