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

<%
'<!-- 
'################################################
' 	名称	:演習管理<小売販売設定>
' 	作成日	:2007/1/31
' 	作成者	:小野
' 	目的	:演習管理<小売販売設定>の閲覧画面を表示する
' 	概要	:
'###############################################
'-->



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

	Dim EnshuName, EnshuID, EnshuPassword
	Dim ErrMsg
	
	Dim Query
	Dim Content
	
	EnshuCD = Request("EnshuCD")
	
	Dim HanbaiShuruiSeigen
	Dim HanbaiSuryoSeigen
	Dim HanbaiTankaKijun
	Dim SeitoSu1
	Dim SeitoSu2
	Dim SeitoSu3
	Dim SeitoSu4
	Dim SeitoSu5
	Dim KakeritsuTop1
	Dim KakeritsuTop2
	Dim KakeritsuTop3
	Dim KakeritsuTop4
	Dim KakeritsuTop5
	Dim KakeritsuBot1
	Dim KakeritsuBot2
	Dim KakeritsuBot3
	Dim KakeritsuBot4
	Dim KakeritsuBot5

	If EnshuCD <> "" Then
		Query = "exec SPM演習取得 '" & GB_SystemCD & "','" & EnshuCD & "'" 
		Set Content = OpenQuery(Query)
		If Not(Content.BOF Or Content.EOF) Then
			EnshuName = Content.Fields("演習名称")
		End If	
		Query = "exec SPM演習取得_小売販売 '" & GB_SystemCD & "','" & EnshuCD & "'" 
		Set Content = OpenQuery(Query)
		If Not(Content.BOF Or Content.EOF) Then
			HanbaiShuruiSeigen = Content.Fields("販売種類制限")
			HanbaiSuryoSeigen = Content.Fields("販売数量制限")
			HanbaiTankaKijun = Content.Fields("販売単価算出基準")
			SeitoSu1 = Content.Fields("生徒数1")
			SeitoSu2 = Content.Fields("生徒数2")
			SeitoSu3 = Content.Fields("生徒数3")
			SeitoSu4 = Content.Fields("生徒数4")
			SeitoSu5 = Content.Fields("生徒数5")
			KakeritsuTop1 = Content.Fields("掛け率上限1")
			KakeritsuTop2 = Content.Fields("掛け率上限2")
			KakeritsuTop3 = Content.Fields("掛け率上限3")
			KakeritsuTop4 = Content.Fields("掛け率上限4")
			KakeritsuTop5 = Content.Fields("掛け率上限5")
			KakeritsuBot1 = Content.Fields("掛け率下限1")
			KakeritsuBot2 = Content.Fields("掛け率下限2")
			KakeritsuBot3 = Content.Fields("掛け率下限3")
			KakeritsuBot4 = Content.Fields("掛け率下限4")
			KakeritsuBot5 = Content.Fields("掛け率下限5")
		End If
	Else
	End If

	Dim RouteType
	RouteType = Request("RouteType")

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="-1">
<link href="../../binx/sj3web.css?<% = TimeUniq() %>" rel="stylesheet" type="text/css">
<title><% = AppTitle %></title>
<script language="JScript" src="../../include.js?<% = TimeUniq() %>"></script>
<script language="JScript" src="../../includesj.js?<% = TimeUniq() %>"></script>
<script language="JScript.Encode" src="../../include_enc.js?<% = TimeUniq() %>"></script>
<script language="JScript.Encode" src="../../includesj_enc.js?<% = TimeUniq() %>"></script>
<script type="text/javascript" src="../../javascript.js?<% = TimeUniq() %>"></script>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--
	HomeAlias = "<% = HomeAlias %>";
	HomeAliasSL = "<% = HomeAliasSL %>";
	ExitFlg = 2;
-->
</SCRIPT>

<body onkeydown="if(ExitFlg==2)ExitFlg=3;" onBeforeUnload="window.event.returnValue = ExitMsg(ExitFlg)" bgcolor="#5C70B6" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form OnKeyDown="FormKeyDown(this)"  method="GET" name="form1" action="fm_kourihanbai_bin.asp" autocomplete="off">
<input type="hidden" name="RouteType" value="<% = RouteType %>">
<input type="hidden" name="DbEnshuCD" value="<% = EnshuCD%>">

<% 
	Response.Write(HtmlDesign(1))
	
	Response.Write(HttpL1(4))

	If Request("RouteType") = "Kantan" Then
		Response.Write(HttpL2("運用管理メニュー" ,"tblbtn( '/" & HomeAlias & "/admin/admenu1.asp')", "演習管理", "", "", "", "", "", "", "", "", ""))
	Else
		Response.Write(HttpL2("運用管理メニュー" ,"tblbtn( '/" & HomeAlias & "/admin/admenu_w.asp')", "演習管理", "", "", "", "", "", "", "", "", ""))	
	End If

	Response.Write(HttpL3("", "" ,"",  "", "", "", "", "", "", "", "", "", "", "", "", ""))
	
	Response.Write(HttpL3_1("保存", "SubmitCheck()", "", "", "", "", "", "", "", ""))

	If GB_Admin = 1 Then
		Response.Write(HttpL3_2("一覧表示", "tblbtn( '/" & HomeAlias & "/admin/enshu/fm_enshu_ichiran.asp?EnshuCD=" & EnshuCD & "&RouteType=" & RouteType & "')", "前のページ", "tblbtn('fm_enshu4.asp?EnshuCD=" & EnshuCD & "')", "", "", "", "", "", ""))
	Else
		Response.Write(HttpL3_2("前のページ", "tblbtn('fm_enshu4.asp?EnshuCD=" & EnshuCD & "')", "", "", "", "", "", "", "", ""))
	End If

	Response.Write(HttpL4("演習管理", "小売販売設定"))

	Response.Write(HttpL5("<font color=""#FF0000"">" & ErrMsg & "</font>"))
%>

<div id="L0" style="position: absolute; visibility: hidden; left: 0px; top: -2000px;">

<table border="0" cellpadding="5" cellspacing="0" width="100%" height="100%">
	<tr>
		<TD ALIGN="CENTER">
			<TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" BGCOLOR="#FFFFFF" STYLE="BORDER:1px solid #000000" WIDTH="740" HEIGHT="100%">

				<TR>
					<TD HEIGHT="30" VALIGN="TOP" ALIGN="left" BACKGROUND="/<% = HomeAlias %>/images/window_bk.gif?<% = GB_STU %>">
						<TABLE WIDTH="800" BORDER="1" CELLPADDING="4" CELLSPACING="0" BORDERCOLOR="#000000" BGCOLOR="#FFFFCC" CLASS="tx1416" STYLE="border-collapse: collapse" width="740">
							<tr> 
								<td WIDTH="80" height="24" align="center" bgcolor="#FFEE88">演習コード</td>
								<td WIDTH="80" height="24"><% = EnshuCD %></td>
								<td WIDTH="80" height="24" align="center" bgcolor="#FFEE88">演習名称</td>
								<td height="24"><% = EnshuName %></td>
							</tr>
						</table>
						<input type="hidden" name="EnshuCD" value="<% = EnshuCD %>">



						<TABLE WIDTH="740" BORDER="0" CELLPADDING="0" CELLSPACING="0">
							<tr>
								<td valign="top">
									<TABLE WIDTH="800" HEIGHT="100%" BORDER="1" CELLPADDING="4" CELLSPACING="0" BORDERCOLOR="#000000" BGCOLOR="#FFFFCC" CLASS="tx1416" STYLE="border-collapse: collapse">
										<tr>
											<td WIDTH="290" height="24" bgcolor="#FFEE88">販売可能な商品種を制限する</td>
											<td WIDTH="510">
												<INPUT type='radio' name='HanbaiShuruiSeigenRadio' value="0" <% If HanbaiShuruiSeigen < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='HanbaiShuruiSeigenRadio' value="1" <% If HanbaiShuruiSeigen > 0 Then Response.Write(" checked") End If %>>制限する 
												制限数<input type="text" name='HanbaiShuruiSeigen' size="10" value="<% If HanbaiShuruiSeigen > 0 Then Response.Write(HanbaiShuruiSeigen) End If %>" class="tbox4" onKeyup="FormStrFloat(this,8,0);" onKeypress="FormStrFloat(this,8,0);" onBlur="FormStrFloatCutoff(this);">
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">一度に販売可能な商品の総数量を制限する</td>
											<td>
												<INPUT type='radio' name='HanbaiSuryoSeigenRadio' value="0" <% If HanbaiSuryoSeigen < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='HanbaiSuryoSeigenRadio' value="1" <% If HanbaiSuryoSeigen > 0 Then Response.Write(" checked") End If %>>制限する 
												制限数<input type="text" name='HanbaiSuryoSeigen' size="10" value="<% If HanbaiSuryoSeigen > 0 Then Response.Write(HanbaiSuryoSeigen) End If %>" class="tbox4" onKeyup="FormStrFloat(this,8,0);" onKeypress="FormStrFloat(this,8,0);" onBlur="FormStrFloatCutoff(this);">
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">販売単価の算出基準</td>
											<td>
												<INPUT type='radio' name='HanbaiTankaKijun' value="0" <% If HanbaiTankaKijun < 1 Then Response.Write(" checked") End If %>>標準仕入単価 
												<INPUT type='radio' name='HanbaiTankaKijun' value="1" <% If HanbaiTankaKijun > 0 Then Response.Write(" checked") End If %>>標準販売単価
											</td>
										</tr>
<% If 0 = 1 Then %>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階1の先着人数を制限する</td>
											<td>
												<INPUT type='radio' name='SeitoSu1Radio' value="0" <% If SeitoSu1 < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='SeitoSu1Radio' value="1" <% If SeitoSu1 > 0 Then Response.Write(" checked") End If %>>制限する 
												制限人数<input type="text" name='SeitoSu1' size="4" value="<% If SeitoSu1 > 0 Then Response.Write(SeitoSu1) End If %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階1の商品販売単価掛け率</td>
											<td>
												掛け率上限<input type="text" name='KakeritsuTop1' size="2" value="<% = KakeritsuTop1 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">% 
												掛け率下限<input type="text" name='KakeritsuBot1' size="2" value="<% = KakeritsuBot1 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">%
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階2の先着人数を制限する</td>
											<td>
												<INPUT type='radio' name='SeitoSu2Radio' value="0" <% If SeitoSu2 < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='SeitoSu2Radio' value="1" <% If SeitoSu2 > 0 Then Response.Write(" checked") End If %>>制限する 
												制限人数<input type="text" name='SeitoSu2' size="3" value="<% If SeitoSu2 > 0 Then Response.Write(SeitoSu2) End If %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">(3)
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階2の商品販売単価掛け率</td>
											<td>
												掛け率上限<input type="text" name='KakeritsuTop2' size="2" value="<% = KakeritsuTop2 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">% 
												掛け率下限<input type="text" name='KakeritsuBot2' size="2" value="<% = KakeritsuBot2 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">%
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階3の先着人数を制限する</td>
											<td>
												<INPUT type='radio' name='SeitoSu3Radio' value="0" <% If SeitoSu3 < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='SeitoSu3Radio' value="1" <% If SeitoSu3 > 0 Then Response.Write(" checked") End If %>>制限する 
												制限人数<input type="text" name='SeitoSu3' size="3" value="<% If SeitoSu3 > 0 Then Response.Write(SeitoSu3) End If %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">(3)
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階3の商品販売単価掛け率</td>
											<td>
												掛け率上限<input type="text" name='KakeritsuTop3' size="2" value="<% = KakeritsuTop3 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">% 
												掛け率下限<input type="text" name='KakeritsuBot3' size="2" value="<% = KakeritsuBot3 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">%
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階4の先着人数を制限する</td>
											<td>
												<INPUT type='radio' name='SeitoSu4Radio' value="0" <% If SeitoSu4 < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='SeitoSu4Radio' value="1" <% If SeitoSu4 > 0 Then Response.Write(" checked") End If %>>制限する 
												制限人数<input type="text" name='SeitoSu4' size="3" value="<% If SeitoSu4 > 0 Then Response.Write(SeitoSu4) End If %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">(3)
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階4の商品販売単価掛け率</td>
											<td>
												掛け率上限<input type="text" name='KakeritsuTop4' size="2" value="<% = KakeritsuTop4 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">% 
												掛け率下限<input type="text" name='KakeritsuBot4' size="2" value="<% = KakeritsuBot4 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">%
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階5の先着人数を制限する</td>
											<td>
												<INPUT type='radio' name='SeitoSu5Radio' value="0" <% If SeitoSu5 < 1 Then Response.Write(" checked") End If %>>制限しない 
												<INPUT type='radio' name='SeitoSu5Radio' value="1" <% If SeitoSu5 > 0 Then Response.Write(" checked") End If %>>制限する 
												制限人数<input type="text" name='SeitoSu5' size="3" value="<% If SeitoSu5 > 0 Then Response.Write(SeitoSu5) End If %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">(3)
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#FFEE88">設定段階5の商品販売単価掛け率</td>
											<td>
												掛け率上限<input type="text" name='KakeritsuTop5' size="2" value="<% = KakeritsuTop5 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">% 
												掛け率下限<input type="text" name='KakeritsuBot5' size="2" value="<% = KakeritsuBot5 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">%
											</td>
										</tr>
<% Else %>
										<tr>
											<td height="24" bgcolor="#FFEE88">商品販売単価掛け率</td>
											<td>
												<input type="hidden" name='SeitoSu1' value="<% If SeitoSu1 > 0 Then Response.Write(SeitoSu1) End If %>">
												掛け率上限<input type="text" name='KakeritsuTop1' size="2" value="<% = KakeritsuTop1 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">% 
												掛け率下限<input type="text" name='KakeritsuBot1' size="2" value="<% = KakeritsuBot1 %>" class="tbox4" onKeyup="FormStrFloat(this,3,0);" onKeypress="FormStrFloat(this,3,0);" onBlur="FormStrFloatCutoff(this);">%
												<input type="hidden" name='SeitoSu2' value="<% If SeitoSu2 > 0 Then Response.Write(SeitoSu2) End If %>">
												<input type="hidden" name='KakeritsuTop2' value="<% = KakeritsuTop2 %>">
												<input type="hidden" name='KakeritsuBot2' value="<% = KakeritsuBot2 %>">
												<input type="hidden" name='SeitoSu3' value="<% If SeitoSu3 > 0 Then Response.Write(SeitoSu3) End If %>">
												<input type="hidden" name='KakeritsuTop3' value="<% = KakeritsuTop3 %>">
												<input type="hidden" name='KakeritsuBot3' value="<% = KakeritsuBot3 %>">
												<input type="hidden" name='SeitoSu4' value="<% If SeitoSu4 > 0 Then Response.Write(SeitoSu4) End If %>">
												<input type="hidden" name='KakeritsuTop4' value="<% = KakeritsuTop4 %>">
												<input type="hidden" name='KakeritsuBot4' value="<% = KakeritsuBot4 %>">
												<input type="hidden" name='SeitoSu5' value="<% If SeitoSu5 > 0 Then Response.Write(SeitoSu5) End If %>">
												<input type="hidden" name='KakeritsuTop5' value="<% = KakeritsuTop5 %>">
												<input type="hidden" name='KakeritsuBot5' value="<% = KakeritsuBot5 %>">
											</td>
										</tr>
<% End If %>
									</TABLE>
								</td>
							</tr>
						</table>

					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
</TABLE>

</div>
</form>

</body>
<% = HtmlFooter %>
</html>
<SCRIPT LANGUAGE="JavaScript">

	function SubmitCheck()
	{
		if (form1.HanbaiShuruiSeigenRadio[0].checked == true || form1.HanbaiShuruiSeigen.value == '') {
			form1.HanbaiShuruiSeigen.value = "0";
		}
		if (form1.HanbaiSuryoSeigenRadio[0].checked == true || form1.HanbaiSuryoSeigen.value == '') {
			form1.HanbaiSuryoSeigen.value = "0";
		}
<% If 0 = 1 Then %>
		if (form1.SeitoSu1Radio[0].checked == true || form1.SeitoSu1.value == '') {
			form1.SeitoSu1.value = "0";
		}
		if (form1.SeitoSu2Radio[0].checked == true || form1.SeitoSu2.value == '') {
			form1.SeitoSu2.value = "0";
		}
		if (form1.SeitoSu3Radio[0].checked == true || form1.SeitoSu3.value == '') {
			form1.SeitoSu3.value = "0";
		}
		if (form1.SeitoSu4Radio[0].checked == true || form1.SeitoSu4.value == '') {
			form1.SeitoSu4.value = "0";
		}
		if (form1.SeitoSu5Radio[0].checked == true || form1.SeitoSu5.value == '') {
			form1.SeitoSu5.value = "0";
		}
<% Else %>
		form1.SeitoSu1.value = "0";
		form1.SeitoSu2.value = "0";
		form1.SeitoSu3.value = "0";
		form1.SeitoSu4.value = "0";
		form1.SeitoSu5.value = "0";
<% End If %>
		if (form1.KakeritsuTop1.value == '') {
			form1.KakeritsuTop1.value = "100";
		}
		if (form1.KakeritsuTop2.value == '') {
			form1.KakeritsuTop2.value = "100";
		}
		if (form1.KakeritsuTop3.value == '') {
			form1.KakeritsuTop3.value = "100";
		}
		if (form1.KakeritsuTop4.value == '') {
			form1.KakeritsuTop4.value = "100";
		}
		if (form1.KakeritsuTop5.value == '') {
			form1.KakeritsuTop5.value = "100";
		}
		if (form1.KakeritsuBot1.value == '') {
			form1.KakeritsuBot1.value = "100";
		}
		if (form1.KakeritsuBot2.value == '') {
			form1.KakeritsuBot2.value = "100";
		}
		if (form1.KakeritsuBot3.value == '') {
			form1.KakeritsuBot3.value = "100";
		}
		if (form1.KakeritsuBot4.value == '') {
			form1.KakeritsuBot4.value = "100";
		}
		if (form1.KakeritsuBot5.value == '') {
			form1.KakeritsuBot5.value = "100";
		}
		if (form1.KakeritsuTop1.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuTop1.focus();
			return false;
		}
		if (form1.KakeritsuTop2.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuTop2.focus();
			return false;
		}
		if (form1.KakeritsuTop3.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuTop3.focus();
			return false;
		}
		if (form1.KakeritsuTop4.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuTop4.focus();
			return false;
		}
		if (form1.KakeritsuTop5.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuTop5.focus();
			return false;
		}
		if (form1.KakeritsuBot1.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuBot1.focus();
			return false;
		}
		if (form1.KakeritsuBot2.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuBot2.focus();
			return false;
		}
		if (form1.KakeritsuBot3.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuBot3.focus();
			return false;
		}
		if (form1.KakeritsuBot4.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuBot4.focus();
			return false;
		}
		if (form1.KakeritsuBot5.value == '0') {
			alert("掛け率は 1 以上の数値を設定してください ");
			form1.KakeritsuBot5.focus();
			return false;
		}
		SubmitReal(form1);
		return true;
	}

</script>

<% 
End Sub
%>