<!-- #include virtual="/sj4web/include.asp" -->

<%
'<!--
'################################################
'	 名称	:メール照会
'	 作成日:2002/9/18
'	 作成者:山崎
'	 目的 :メールの照会処理をする。
'	 概要	:
'		<<表示>>
'	・メールの表示
'
'################################################
'-->
'
%>

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

	Dim Query,Content
	Dim SakuseiKaisyaCD
	Dim MailCD, Sakuseibi, TorihikisakiCD, Kenmei, Naiyo, KaifuFlg, SakujyoFlg, HyojiyoAtesakiCD, HyojiyoAtesakiMei
	MailCD = Request("MailCD")
	TorihikisakiCD = Request("TorihikisakiCD")
	Dim PageType
	PageType = Request("PageType")

	Dim RouteType
	RouteType = Request("RouteType")

	If MailCD <> "" Then

		If TorihikisakiCD = "" Then
			Query = "exec SPNメール取得 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "', '" & MailCD & "'"
		Else
			Query = "exec SPNメール開封 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "', '" & MailCD & "'"
			Set Content = OpenQuery(Query)
			Query = "exec SPNメール取得 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "', '" & MailCD & "'"
		End If
		Set Content = OpenQuery(Query)

		If Not(Content.BOF Or Content.EOF) Then

			MailCD = Content.Fields("メールCD")
			Sakuseibi = Content.Fields("作成日")
			SakuseiKaisyaCD = Content.Fields("作成会社CD")
			Kenmei = Content.Fields("件名")
			Naiyo = Content.Fields("内容")
			KaifuFlg = Content.Fields("開封フラグ")
			SakujyoFlg = Content.Fields("削除フラグ")

			Dim tmps, i
			tmps = split(Content.Fields("表示用宛先CD"), ",")

			For i = 0 To UBound(tmps)
				If HyojiyoAtesakiMei <> "" Then
					HyojiyoAtesakiMei = HyojiyoAtesakiMei + ","
				End If
				If i mod 5 = 0 And i <> 0 Then
					HyojiyoAtesakiMei = HyojiyoAtesakiMei + ""
				End If
				HyojiyoAtesakiMei = HyojiyoAtesakiMei + ConvKaisyaRyakuMeisyo(tmps(i))
			Next
		End If
	End If


	If PageType = "" Then
		PageType = "メール作成"
	End If
%>
<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="/sj4web/binx/sj3web.css" rel="stylesheet" type="text/css">
<title><% = AppTitle %></title>
<script language="JScript" src="/sj4web/include.js"></script>
<script language="JScript" src="/sj4web/includesj.js"></script>
<script language="JScript.Encode" src="/sj4web/include_enc.js"></script>
<script language="JScript.Encode" src="/sj4web/includesj_enc.js"></script>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--
	ExitFlg = 1;
-->
</SCRIPT>

<body onkeydown="if(ExitFlg==2)ExitFlg=3;" onBeforeUnload="window.event.returnValue = ExitMsg(ExitFlg)" bgcolor="#5C70B6" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form OnKeyDown="FormKeyDown(this)"	 name="form1" method="POST" action="fn_mailsakusei_bin.asp">

<%
	If RouteType = "MailOnly" Then
		Response.Write(HtmlDesign(6))
	Else
		Response.Write(HtmlDesign(1))
	End If

	Response.Write(HttpL1(3))

	If RouteType = "MailOnly" Then
		Response.Write(HttpL2("メールウィンドウ" ,"", "", "", "", "", "" , "", "", "", "", ""))
	ElseIf GB_Gyosyu <> "B" Then
		Response.Write(HttpL2("会社選択" ,"tblbtn( '/sj4web/user/bk/')", GB_GyosyuMeisyo, "tblbtn( '/sj4web/user/bk/menu_" & GB_Gyosyu & ".asp')", "社長室・総務部", "tblbtn( '/sj4web/user/bk/menu_s4.asp')", "受発信文書", "tblbtn( '/sj4web/user/bk/jyuhasshinbunsyo/')", "メール" , "", "", ""))
	Else
		Response.Write(HttpL2("会社選択" ,"tblbtn( '/sj4web/user/bk/')", ConvKubunMeisyo("業種CD", GB_Gyosyu) , "tblbtn( '/sj4web/user/bk/menu_" & GB_Gyosyu & ".asp')", "受発信文書", "tblbtn( '/sj4web/user/bk/jyuhasshinbunsyo/')", "メール", "", "", "", "", ""))
	End If

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

	If TorihikisakiCD <> "" Then
		Response.Write(HttpL3_1("印刷", "PrintoutReal()", "返信","tblbtn( 'fn_mailsakusei.asp?RouteType=" & RouteType & "&TorihikisakiCD=" & TorihikisakiCD & "&MailCD=" & MailCD & "')", "", "", "", "" ,"", ""))
	Else
		Response.Write(HttpL3_1("印刷", "PrintoutReal()", "再作成", "tblbtn( 'fn_mailsakusei.asp?RouteType=" & RouteType & "&MailCD=" & MailCD & "')", "", "", "", "" ,"", ""))
	End If

	Response.Write(HttpL3_2("メール作成", "tblbtn( '/sj4web/user/bk/jyuhasshinbunsyo/fn_mailsakusei.asp?RouteType=" & RouteType & "')", "受信メール", "tblbtn( '/sj4web/user/bk/jyuhasshinbunsyo/fn_mailsakusei_ichiran.asp?PageType=受信メール&RouteType=" & RouteType & "')" ,"送信メール", "tblbtn( '/sj4web/user/bk/jyuhasshinbunsyo/fn_mailsakusei_ichiran.asp?PageType=送信メール&RouteType=" & RouteType & "')",	"", "", "", ""))

	Response.Write(HttpL4("照会", ""))

%>
<div id="L0" style="position: absolute; visibility: hidden; left: 0px; top: -2000px;">
						<table width="500" height="350" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF" STYLE="BORDER:solid 1px #000000">
							<tr>
								<td align="center" valign="top" background="/sj4web/images/window_bk.gif">
									<table width="465" height="325" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="100" align="center">
												<table width="100%" height="100" border="0" cellpadding="2" cellspacing="0" STYLE="BORDER:solid 2px #80AEFF">
													<tr>
														<td width="60" height="25" align="right" class="tx1416">受信者:</td>
														<td><input type="text" readonly value="<% = HyojiyoAtesakiMei %>" style="width:300px"></td>
													</tr>
													<tr>
														<td width="60" height="25" align="right" class="tx1416">送信者:</td>
														<td><input type="text" readonly value="<% = ConvKaisyaRyakuMeisyo(SakuseiKaisyaCD) %>" style="width:300px"></td>
														<td width="55" rowspan="3">
														<% If PageType = "メール作成" Or PageType = "送信メール" Then %>
														<img src="/sj4web/images/mltab_icon_snd.gif" width="45" height="45" align="absmiddle">
														<% Else %>
														<img src="/sj4web/images/mltab_icon_rcv.gif" width="45" height="45" align="absmiddle">
														<% End If %>
														</td>
													</tr>
													<tr>
														<td width="60" height="25" align="right" class="tx1416">送信日:</td>
														<td><input type="text" readonly value="<% = Sakuseibi %>" style="width:300px"></td>
													</tr>
													<tr>
														<td width="60" height="25" align="right" class="tx1416">件名:</td>
														<td><input type="text" readonly value="<% = Kenmei %>" style="width:300px"></td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td>
												<DIV ID="Layer1" STYLE="position:relative; left:0px; top:0px; width:100%; height:100%; z-index:1; border: 1px none #000000; overflow: auto;">
													<table border="1" width="100%" cellspacing="0" bordercolordark="#C0C0C0" bgcolor="#FFFFFF" bordercolorlight="#808080" height="100%">
														<tr>
															<td valign="top" CLASS="tx1416"><%
																Naiyo = Replace(Naiyo, "<br>", vbCrLf)
																Naiyo = Server.HTMLEncode(Naiyo)
																Naiyo = Replace(Naiyo, vbCrLf, "<br>" & vbCrLf)
																Response.Write(Naiyo)
																%></td>
														</tr>
													</table>
												</div>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>

</div>
</form>

</body>

<SCRIPT LANGUAGE="JavaScript">

	function SubmitCheck()
	{

		if(form1.Sakuseibi.value == "")
		{
			alert("取引日を入力して下さい");
			return false;
		}

		SubmitReal(form1);
		return true;
	}


</SCRIPT>

<% = HtmlFooter %>
</html>
<%
End Sub
%>