<!-- #include file="../../include.asp" -->

<%
'<!--
'################################################
'	名称 :元号マスタ設定
'	作成日:2017/11/1
'	作成者:小野
'################################################
'-->
'
%>

<%
main()
Sub main()

	If Not(SessionCheck()) Then
		Exit Sub
	End If

	Dim Query
	Dim Content

%>

<html>
<% = HtmlHeader("") %>
<SCRIPT LANGUAGE="JavaScript">
<!--
	HomeAlias = "<% = HomeAlias %>";
	HomeAliasSL = "<% = HomeAliasSL %>";
	ExitFlg = 2;
-->
</SCRIPT>

<body onkeydown="if(ExitFlg==2)ExitFlg=3;" onBeforeUnload="if(ExitFlg!=0)window.event.returnValue = ExitMsg(ExitFlg)" bgcolor="#5C70B6" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form OnKeyDown="FormKeyDown(this)"	method="POST" action="fm_gengo_bin.asp" name="form1" onSubmit="return SubmitCheck();" autocomplete="off">
<input type="hidden" name="Command" value="">
<input type="hidden" name="DeleteGengo" value="">
<input type="hidden" name="UpdateGengo" value="">

<%
	'Response.Write(DefFolder)
	Response.Write(HtmlDesign(1))

	Response.Write(HttpL1(4))

	Response.Write(HttpL2("運用管理メニュー" ,"tblbtn( '/" & HomeAlias & "/admin/admenu_w.asp');", "システム情報", "tblbtn('/" & HomeAlias & "/admin/kihon/fm_kihon_view.asp');", "元号の設定" , "", "", "", "", "", "", ""))

	Response.Write(HttpL3("","" ,"", "", "", "", "", "", "", "", "", "", "", "", "", ""))

	Response.Write(HttpL3_1("", "", "", "", "", "", "", "", "", ""))

	Response.Write(HttpL3_2("戻る", "tblbtn('/" & HomeAlias & "/admin/kihon/fm_kihon_view.asp');", "", "", "", "", "", "", "", ""))

	Response.Write(HttpL4("元号マスタ", "設定"))
%>

<div id="L0" style="position: absolute; visibility: hidden; left: 0px; top: -2000px;">
<table width="650" height="100%" border="0" cellspacing="5" cellpadding="5" bgcolor="#ffffff" style="border:1px solid #000000">
	<tr>
		<td align="center" background="/<% = HomeAlias %>/images/window_bk.gif">
			<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td valign="top">
						<DIV ID="Layer1" STYLE="position:relative; left:0px; top:0px; width:628px; height:100%; z-index:1; border: 1px none #000000; overflow: auto;">
						<table border="0" cellpadding="0" cellspacing="2" class="tx1416">
							<tr>
								<td align="center">
									&nbsp;
								</td>
								<td align="center">
									元号
								</td>
								<td align="center">
									開始年月日
								</td>
								<td align="center">
									&nbsp;
								</td>
							<tr>
							<tr>
								<td align="center">
									新規
								</td>
								<td align="center">
									<input type="text" name="Gengo0" size="9" value="" onBlur="FormStrLeftIME(this,8,true);" class="tbox4_ime">
								</td>
								<td align="center">
									<input type="text" name="Kaishibi0" size="12" value="" onkeyup="FormStrDate(this);" onKeypress="FormStrDate(this);" onBlur="SetDate(this, 1, false);" class="tbox4">
								</td>
								<td align="center">
									<input type="button" class="tx1416" style="cursor:pointer;" value="追 加" onClick="GengoAdd();">
								</td>
							<tr>

<%
		Query = " SELECT * FROM TC9元号M WHERE システムCD = '" & GB_SystemCD & "' ORDER BY 開始日 DESC "
		Set Content = OpenQuery(Query)
		Do While Not(Content.BOF Or Content.EOF)
			If "" & Content.Fields("元号") <> "" And "" & Content.Fields("開始日") <> "" Then
%>
							<tr>
								<td align="center">
									<input type="button" value="削除" class="tx1416" style="cursor:pointer;" onClick="GengoDelete('<% = Content.Fields("元号CD") %>');">
								</td>
								<td align="center">
									<input type="text" name="Gengo<% = Content.Fields("元号CD") %>" size="9" value="<% = Content.Fields("元号") %>" onBlur="FormStrLeftIME(this,8,true);" class="tbox4_ime">
								</td>
								<td align="center">
									<input type="text" name="Kaishibi<% = Content.Fields("元号CD") %>" size="12" value="<% = SetTimeYYYYMMDD(Content.Fields("開始日")) %>" onkeyup="FormStrDate(this);" onKeypress="FormStrDate(this);" onBlur="SetDate(this, 1, false);" class="tbox4">
								</td>
								<td align="center">
									<input type="button" value="更 新" class="tx1416" style="cursor:pointer;" onClick="GengoUpdate('<% = Content.Fields("元号CD") %>');">
								</td>
							<tr>
<%
			End If
			Content.MoveNext
		Loop

%>
						</table>
						</div>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</div>

</form>
</body>
<% = HtmlFooter %>

</html>

<SCRIPT LANGUAGE="JavaScript">

	function GengoAdd() {
		form1.Command.value = "";
		if (form1.Gengo0.value == "") {
			alert("元号を入力してください ");
			return false;
		}
		if (form1.Kaishibi0.value == "") {
			alert("開始年月日を入力してください ");
			return false;
		}
		form1.Command.value = "Add";
		SubmitReal(form1);
		return true;
	}

	function GengoDelete(Seq) {
		form1.Command.value = "";
		if (Seq != "") {
			if (confirm("削除してよろしいですか? ")) {
				form1.Command.value = "Delete";
				form1.DeleteGengo.value = Seq;
				SubmitReal(form1);
				return true;
			}
		}
	}

	function GengoUpdate(Seq) {
		form1.Command.value = "";
		if (Seq != "") {
			if (form1["Gengo" + Seq].value == "") {
				alert("元号を入力してください ");
				return false;
			}
			if (form1["Kaishibi" + Seq].value == "") {
				alert("開始年月日を入力してください ");
				return false;
			}
			form1.Command.value = "Update";
			form1.UpdateGengo.value = Seq;
			SubmitReal(form1);
			return true;
		}
	}

</script>

<%
End Sub
%>