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

<%
'<!--
'################################################
'	名称	:送信メール一覧
'	作成日	:2011/11/24
'	作成者	:小野
'	目的	:送信メール一覧画面を表示する
'	概要	:
'################################################
'-->
%>
<%
main()
Sub main()

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


	'会社セッション初期化(演習状況記帳チェック後の対処)
	KaisyaCD = ""
	GB_KaisyaCD = ""
	KaisyaMeisyo = ""
	GB_KaisyaMeisyo = ""
	KaisyaRyakuMeisyo = ""
	GB_KaisyaRyakuMeisyo = ""
	Session(HomeAlias & "KaisyaCD") = ""
	Session(HomeAlias & "Gyosyu") = ""
	Session(HomeAlias & "GyosyuMeisyo") = ""
	Session(HomeAlias & "KaisyaMeisyo") = ""
	Session(HomeAlias & "KaisyaRyakuMeisyo") = ""
	Session(HomeAlias & "JisyaFlag") = ""
	Session(HomeAlias & "ShijyoCD") = ""


	Dim HyojiFlg
	HyojiFlg = Request("HyojiFlg")

	Dim	EnshuName
	Dim Query
	Dim Content

	Dim TmpEnshuKubun
	TmpEnshuKubun = ConvEnshuKubun(EnshuCD)


	Dim SortMode
	SortMode = Request("SortMode")
	If SortMode = "" Then
		SortMode = "2"
	End If

	Dim Keyword
	Keyword = Request("Keyword")



	Dim Page
	Page = Request("Page")
	If Page <> "" Then
		Page = ConvMoneyToInt(Page)
	Else
		Page = 0
	End If
	Dim PageRow
	PageRow = 100

%>

<html>
<% = HtmlHeader("") %>
<SCRIPT LANGUAGE="JavaScript">
<!--
	HomeAlias = "<% = HomeAlias %>";
	HomeAliasSL = "<% = HomeAliasSL %>";
	ExitFlg = 1;
-->
</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)"	name="form1" method="GET" action="fm_mail_ichiran.asp" onSubmit="return SubmitCheck();">
<input type="hidden" name="HyojiFlg" value="<% = HyojiFlg %>">
<input type="hidden" name="Page" value="<% = Page %>">

<%
	Response.Write(HtmlDesign(1))

	Response.Write(HttpL1(4))

	Response.Write(HttpL2("運用管理メニュー" ,"tblbtn( '/" & HomeAlias & "/admin/admenu_w.asp')", "送信メール一覧", "", "", "", "", "", "", "", "", ""))

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

	'Response.Write(HttpL3_1("再表示", "tblbtn('fm_mail_ichiran.asp?EnshuCD=" & EnshuCD & "&HyojiFlg=" & HyojiFlg & "')", "印刷", "PrintoutRealInline('" & Replace(Request.ServerVariables("URL"), ".asp", "_print.asp") & "?EnshuCD=" & EnshuCD & "&HyojiFlg=" & HyojiFlg & "&SortMode=" & SortMode & "');", "", "", "", "", "", ""))
	Response.Write(HttpL3_1("再表示", "tblbtn('fm_mail_ichiran.asp?EnshuCD=" & EnshuCD & "&HyojiFlg=" & HyojiFlg & "&SortMode=" & SortMode & "&Keyword=" & Keyword & "')", "", "", "", "", "", "", "", ""))
	'Response.Write(HttpL3_1("", "", "", "", "", "", "", "", "", ""))

	If TmpEnshuKubun = "P" Then
		If HyojiFlg = "1" Then
			Response.Write(HttpL3_2("マスター会社を非表示", "tblbtn('fm_mail_ichiran.asp?EnshuCD=" & EnshuCD & "&SortMode=" & SortMode & "&Keyword=" & Keyword & "')", "書類一覧", "tblbtn('fm_tyohyo.asp')", "", "", "", "", "", ""))
		Else
			Response.Write(HttpL3_2("マスター会社を表示", "tblbtn('fm_mail_ichiran.asp?EnshuCD=" & EnshuCD & "&SortMode=" & SortMode & "&Keyword=" & Keyword & "&HyojiFlg=1')", "書類一覧", "tblbtn('fm_tyohyo.asp')", "", "", "", "", "", ""))
		End If
	Else
		Response.Write(HttpL3_2("書類一覧", "tblbtn('fm_tyohyo.asp')", "", "", "", "", "", "", "", ""))
	End If

	Response.Write(HttpL4("送信メール一覧", ""))

	Response.Write(HttpL5(""))
%>

<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 height="10">
					<td valign="top">
						<TABLE WIDTH="930" HEIGHT="30" BORDER="1" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="#000000" BGCOLOR="#FFFFCC" CLASS="tx1416" STYLE="border-collapse: collapse">
							<TR ALIGN="CENTER">
								<TD HEIGHT="30" align="center">対象演習名</TD>
								<TD height="30" align="left">
								<% If GB_Admin = 2 Then %>
									<input type="hidden" name="EnshuCD" value="<% = EnshuCD %>">
									<% = EnshuMeisyo %>
								<% Else %>
									&nbsp;<select size="1" name="EnshuCD" class="tbox4_w" onChange="form1.Page.value='0';SetSyokaiList();">
										<option value=""><< 対象演習を選択して下さい >></option>
										<%
											Query = "exec SPM演習一覧 '" & GB_SystemCD & "',4"
											Set Content = OpenQuery(Query)
											Do While Not(Content.BOF Or Content.EOF)
												If (PackageMode = 1 And "" & Content.Fields("パッケージ区分") = "CA" And "" & Content.Fields("演習区分") = "G") Or (PackageMode = 0 And "" & Content.Fields("パッケージ区分") <> "CA") Then
													Response.Write("<option value=""" & Content.Fields("演習CD") & """")
													If Content.Fields("演習CD") = EnshuCD Then
														Response.Write(" selected")
													End If
													Response.Write(">" & Content.Fields("演習名称") & "</option>" & vbCrLf)
												End If
												Content.MoveNext
											Loop
										%>
									</select>
								<% End If %>
								</TD>
								<TD HEIGHT="30" align="center">ソート基準</TD>
								<TD height="30" align="left">
									&nbsp;<select size="1" name="SortMode" class="tbox4_w" onChange="SetSyokaiList();">
										<option value="1"<% If SortMode = "1" Then %> selected<% End If %>><% If TmpEnshuKubun = "P" Then %>学生氏名<% Else %>会社コード<% End If %></option>
										<option value="2"<% If SortMode = "2" Then %> selected<% End If %>>会社名称</option>
										<option value="3"<% If SortMode = "3" Then %> selected<% End If %>>件名</option>
									</select>
								</TD>
							</TR>
						</table>
						<TABLE WIDTH="930" HEIGHT="30" BORDER="1" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="#000000" BGCOLOR="#FFFFCC" CLASS="tx1416" STYLE="border-collapse: collapse">
							<TR>
								<TD HEIGHT="30" align="center">&nbsp;検索キーワード&nbsp;</TD>
								<TD height="30" align="left">
									&nbsp;<input type="text" name="Keyword" size="120" value="<% = Keyword %>" onBlur="FormStrLeftIME(this,255,true);" class="tbox4_ime_w">
									<input type="button" value="抽 出" CLASS="tx1416" style="width:80px;" onClick="form1.Page.value='0';SetSyokaiList();">
								</TD>
							</TR>
						</table>
						<span class="tx1012"><br></span>
						<table BORDER="0" CELLPADDING="0" CELLSPACING="0">
							<TR>
								<TD VALIGN="BOTTOM" WIDTH="700">
									<TABLE WIDTH="930" BORDER="1" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="#000000" BGCOLOR="#FFFFCC" CLASS="tx1416" STYLE="border-collapse: collapse">
										<TR ALIGN="CENTER">
										<% If TmpEnshuKubun = "P" Then %>
											<TD WIDTH="154">学生氏名</TD>
										<% Else %>
											<TD WIDTH="154">会社コード</TD>
										<% End If %>
											<TD WIDTH="184" HEIGHT="20">会社名称</TD>
											<TD WIDTH="280">件名</TD>
											<TD>本文</TD>
										</TR>
									</TABLE>
								</TD>
							</TR>
						</table>
					</TD>
				</TR>
				<TR>
					<TD VALIGN="TOP">
									<DIV ID="Layer1" STYLE="position:relative; left:0px; top:0px; width:950px; height:100%; z-index:1; border: 1px none #000000; overflow: auto;">
										<TABLE ID="SyoukaiList" BORDER="1" WIDTH="930" CELLSPACING="0" CELLPADDING="2" BGCOLOR="#FFFFFF" CLASS="tx1416" STYLE="border-collapse: collapse;cursor:pointer;" BORDERCOLOR="#000000">
											<% If Page > 0 Then %>
											<TR ALIGN="CENTER" onClick="form1.Page.value='<% = Page - 1 %>';SetSyokaiList();">
												<TD ALIGN="CENTER" COLSPAN="4">
													前 の ペ ー ジ を 表 示
												</TD>
											</TR>
											<% End If %>
										<%
											Dim ii, jj, wcol
											ii = 0

											Query = "exec SPM演習状況メール送信一覧 '" & GB_SystemCD & "','" & EnshuCD & "','" & SortMode & "', '" & Keyword & "'"
'Response.Write(Query)
'Exit Sub
											Set Content = OpenQuery(Query)

											'ページ送り
											For jj = 1 To PageRow * Page
												If Not(Content.BOF Or Content.EOF) Then
													Content.MoveNext
												End If
											Next

											For ii = 1 To PageRow
												If Not(Content.BOF Or Content.EOF) Then
'											Do While Not(Content.BOF Or Content.EOF)

												'同時同業マスター会社を除く
												If  HyojiFlg = "1" And TmpEnshuKubun = "P" And ConvKaisyaGakuseiNo(EnshuCD, Content.Fields("会社CD")) = "" Then
												'同時同業生徒会社のうち自社設定会社以外を除く
												ElseIf HyojiFlg <> "1" And TmpEnshuKubun = "P" And "" & ConvKaisyaJisyaFlg(EnshuCD, Content.Fields("会社CD")) <> "1" Then

												Else

													Dim KaisyaGakusei
													'KaisyaGakusei = "" & ConvGakuseiShimei(ConvKaisyaGakuseiNo(EnshuCD, Content.Fields("会社CD")))
													KaisyaGakusei = "" & Content.Fields("氏名")

													'同時同業では削除されたユーザーの会社は表示しない
													If TmpEnshuKubun = "P" And KaisyaGakusei = "" Then

													Else

														Response.Write("<TR onClick=""tblbtn('fm_mail_view.asp?EnshuCD=" & EnshuCD & "&KaisyaCD=" & Content.Fields("会社CD") & "&MailCD=" & Content.Fields("メールCD") & "&SortMode=" & SortMode & "&HyojiFlg=" & HyojiFlg & "&Keyword=" & Keyword & "&Page=" & Page & "')"" style=""cursor:pointer;"">" & vbCrLf)
														If TmpEnshuKubun = "P" Then
															Response.Write("<TD WIDTH=""150"" ALIGN=""LEFT"">" & KaisyaGakusei & "</TD>" & vbCrLf)
														Else
															Response.Write("<TD WIDTH=""150"" ALIGN=""LEFT"">" & Content.Fields("会社CD") & "</TD>" & vbCrLf)
														End If
														Response.Write("<TD WIDTH=""180"" HEIGHT=""23"" ALIGN=""LEFT"">" & Content.Fields("会社名称") & "</TD>" & vbCrLf)

														Response.Write("<TD WIDTH=""276"" ALIGN=""LEFT""><span style=""width:276px;height:17px;overflow:hidden;"">" & HardWrap(Content.Fields("件名")) & "</span></TD>" & vbCrLf)
														Response.Write("<TD ALIGN=""LEFT""><span style=""width:100%;height:17px;overflow:hidden;"">" & HardWrap(Replace(Content.Fields("内容"), "<br>", "")) & "</span></TD>" & vbCrLf)
														Response.Write("</TD>" & vbCrLf)
														Response.Write("</TR>")

													End If
												End If

												Content.MoveNext
'											Loop
												End If
											Next

											If Not(Content.BOF Or Content.EOF) Then
											%>
											<TR ALIGN="CENTER" onClick="form1.Page.value='<% = Page + 1 %>';SetSyokaiList();">
												<TD ALIGN="CENTER" COLSPAN="4">
													次 の ペ ー ジ を 表 示
												</TD>
											</TR>
											<%
											End If
											%>
										</TABLE>
									</DIV>
					</TD>
				</TR>
			</TABLE>
		</td>
	</tr>
</table>
</DIV>
</form>

</body>

<SCRIPT LANGUAGE="JavaScript">

	function SetSyokaiList()
	{
		if (form1.EnshuCD.value == "")
		{
			alert("対象演習を選択して下さい");
			return false;
		}

		SubmitReal(form1);
		return false;
	}


	function SubmitCheck(Kubun)

	{
		if (form1.EnshuCD.value == "")
		{
			alert("対象演習を選択して下さい");
			return false;
		}
		return true;
	}


</script>

<% = HtmlFooter %>
</html>

<%
End Sub
%>