<!-- #include file="../../../include.asp" -->
<!-- #include file="../../../user/bk/denpyo/fk_nyukinsyukin_view_main_in.asp" -->
<%
'<!--
'################################################
'	名称	:入金・出金伝票照会
'	作成日:2002/8/25
'	作成者:川崎
'	目的 :入金・出金伝票画面を表示する。
'	概要	:
'	 <<表示>>
'	・伝票番号の伝票を表示
'################################################
'-->
'
%>

<%
main()

Sub main()
	Dim DenpyoNo, Torihikibi, DenpyoTekiyo
	Dim PageType
	Dim KanjyoCD(10)
	Dim Kanjyomei(10)
	Dim Kingaku(10)
	Dim TekiyoCD(10)
	Dim Tekiyo(10)
	Dim Gokei,i

	Dim Query
	Dim Content
	Dim Genkin, Toza
	Dim GakuseiShimei
	Dim SakujyoFlg
	Dim DenpyoKubun

	DenpyoNo = Request("DenpyoNo")
	PageType = Request("PageType")

	Dim RouteType
	RouteType = Request("RouteType")

	Dim ShowDel
	ShowDel = Request("ShowDel")

	Genkin = 0
	Toza = 0
	Gokei = 0
	SakujyoFlg = 0

	Dim Title, SenColor
	If PageType = "Nyukin" Then
		Title = "入金伝票"
		SenColor = "#FF2211"	'赤
		DenpyoKubun = "D1"
	Else
		Title = "出金伝票"
		SenColor = "#1133FF"	'青
		DenpyoKubun = "D2"
	End If

	If DenpyoNo <> "" Then

		'///////	1.「伝票」ヘッダ部・明細部のデータを取得。
		If PageType = "Nyukin" Then
			Query = "exec SPK伝票_入金伝票取得 '" & GB_SystemCD & "','" & EnshuCD & "','" & KaisyaCD & "', '" & DenpyoNo & "'"
		Else
			Query = "exec SPK伝票_出金伝票取得 '" & GB_SystemCD & "','" & EnshuCD & "','" & KaisyaCD & "', '" & DenpyoNo & "'"
		End If

		Set Content = OpenQuery(Query)

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

			Torihikibi = Content.Fields("取引日")
			DenpyoTekiyo = Content.Fields("伝票摘要")
			SakujyoFlg = Content.Fields("削除フラグ")
			GakuseiShimei = Content.Fields("氏名")


			i = 0
			Do While Not(Content.BOF Or Content.EOF)
				Dim DenpyoSEQ
				DenpyoSEQ = Content.Fields("伝票SEQ")

				If Content.Fields("特別勘定区分") <> "DA" Then

					i = i + 1
					KanjyoCD(i) = Content.Fields("勘定CD")
					Kanjyomei(i) = ConvKanjyoMeisyo(Content.Fields("勘定CD"))
					If PageType = "Nyukin" Then
						Kingaku(i) = Content.Fields("貸方金額")
						Gokei = Gokei + Content.Fields("貸方金額")
					Else
						Kingaku(i) = Content.Fields("借方金額")
						Gokei = Gokei + Content.Fields("借方金額")
					End If

					Tekiyo(i) = Content.Fields("摘要")
					TekiyoCD(i) = Content.Fields("摘要CD")

				End if
				Content.MoveNext
			Loop
		End If
	End If


	Dim NextDenpyoNo, PrevDenpyoNo

	Query = "exec SPK伝票次番号 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "', '" & DenpyoKubun & "', '1', '" & Torihikibi & "', '" & DenpyoNo & "'"
	Set Content = OpenQuery(Query)
	If Not(Content.BOF Or Content.EOF) Then
		NextDenpyoNo = Content.Fields("伝票番号")
	End If

	Query = "exec SPK伝票前番号 '" & GB_SystemCD & "','" & EnshuCD & "', '" & KaisyaCD & "', '" & DenpyoKubun & "', '1', '" & Torihikibi & "', '" & DenpyoNo & "'"
	Set Content = OpenQuery(Query)
	If Not(Content.BOF Or Content.EOF) Then
		PrevDenpyoNo = Content.Fields("伝票番号")
	End If

	Dim NextTitle, NextCmd, PrevTitle, PrevCmd
	If NextDenpyoNo <> "" Then
		NextTitle = "次へ"
		NextCmd = "tblbtn( '/" & HomeAlias & "/user/bk/denpyo/fk_nyukinsyukin_view.asp?PageType=" & PageType & "&RouteType=" & RouteType & "&DenpyoNo=" & NextDenpyoNo & "&ShowDel=" & ShowDel & "')"
	End If
	If PrevDenpyoNo <> "" Then
		PrevTitle = "前へ"
		PrevCmd = "tblbtn( '/" & HomeAlias & "/user/bk/denpyo/fk_nyukinsyukin_view.asp?PageType=" & PageType & "&RouteType=" & RouteType & "&DenpyoNo=" & PrevDenpyoNo & "&ShowDel=" & ShowDel & "')"
	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="../../../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 = 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">
<input type="hidden" name="PageType" value="<% = PageType %>">


<%
	If InStr(RouteType, "ViewOnly") > 0 Then
		Response.Write(HtmlDesign(4))
	Else
		Response.Write(HtmlDesign(1))
	End If

	Response.Write(HttpL1(2))

	If InStr(RouteType, "ViewOnly") > 0 And InStr(RouteType, "RMail") > 0 Then
		Response.Write(HttpL2("照会・集計ウィンドウ" ,"tblbtn( '/" & HomeAlias & "/user/bk/menu_s_viewonly.asp')", "受発信文書", "", "受信文書", "", "", "", "", "", "", ""))
	ElseIf InStr(RouteType, "ViewOnly") > 0 And InStr(RouteType, "SMail") > 0	Then
		Response.Write(HttpL2("照会・集計ウィンドウ" ,"tblbtn( '/" & HomeAlias & "/user/bk/menu_s_viewonly.asp')", "受発信文書", "", "発信文書", "", "", "", "", "", "", ""))
	ElseIf InStr(RouteType, "ViewOnly") > 0 Then
		Response.Write(HttpL2("照会・集計ウィンドウ" ,"tblbtn( '/" & HomeAlias & "/user/bk/menu_s_viewonly.asp')", "経理部", "", "伝票", "", Title, "", "", "", "", ""))
	ElseIf PackageMode = 1 Then
		Response.Write(HttpL2("メインメニュー" ,"tblbtn('/" & HomeAlias & "/user/bk/menu_cyac.asp')", "伝票", "tblbtn( '/" & HomeAlias & "/user/bk/menu_s11.asp')", Title, "", "", "", "", "", "", ""))
	ElseIf InStr(RouteType, "Hakushi") > 0 Then
		Response.Write(HttpL2("会社選択" ,"tblbtn( '/" & HomeAlias & "/user/bk/')", GB_GyosyuMeisyo, "tblbtn( '/" & HomeAlias & "/user/bk/menu_" & GB_Gyosyu & ".asp')", "社長室・総務部", "tblbtn( '/" & HomeAlias & "/user/bk/menu_s4.asp')", "白紙帳票", "tblbtn( '/" & HomeAlias & "/user/bk/menu_s42.asp')", Title, "", "", ""))
	ElseIf GB_Gyosyu <> "B" Then
		Response.Write(HttpL2("会社選択" ,"tblbtn( '/" & HomeAlias & "/user/bk/')", GB_GyosyuMeisyo, "tblbtn( '/" & HomeAlias & "/user/bk/menu_" & GB_Gyosyu & ".asp')", "経理部", "tblbtn( '/" & HomeAlias & "/user/bk/menu_s1.asp')", "伝票", "tblbtn( '/" & HomeAlias & "/user/bk/menu_s11.asp')", Title, "tblbtn( '/" & HomeAlias & "/user/bk/denpyo/fk_nyukinsyukin.asp?Pagetype=" & PageType & "&ShowDel=" & ShowDel & "')", "", ""))
	Else
		Response.Write(HttpL2("会社選択" ,"tblbtn( '/" & HomeAlias & "/user/bk/')", GB_GyosyuMeisyo , "tblbtn( '/" & HomeAlias & "/user/bk/menu_" & GB_Gyosyu & ".asp')", "経理業務", "tblbtn( '/" & HomeAlias & "/user/bk/menu_" & GB_Gyosyu & "1.asp')", "伝票", "tblbtn( '/" & HomeAlias & "/user/bk/menu_s11.asp')", Title, "tblbtn( '/" & HomeAlias & "/user/bk/denpyo/fk_nyukinsyukin.asp?Pagetype=" & PageType & "&ShowDel=" & ShowDel & "')", "", ""))
	End If


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

	If SakujyoFlg = "0" And RouteType <> "ViewOnly" And InStr(RouteType, "Hakushi") < 1 Then
		Response.Write(HttpL3_1("印刷", "PrintoutReal()", "修正", "tblbtn( '/" & HomeAlias & "/user/bk/denpyo/fk_nyukinsyukin.asp?PageType=" & PageType & "&DenpyoNo=" & DenpyoNo & "&ShowDel=" & ShowDel & "')", "削除", "SakujyoBtn()", "", "", "", ""))
	Else	'削除済みもしくは、InStr(RouteType, "ViewOnly") > 0
		Response.Write(HttpL3_1("印刷", "PrintoutReal()", "", "", "", "", "", "", "", ""))
	End If

	If InStr(RouteType, "Hakushi") > 0 Then
		Response.Write(HttpL3_2("", "", "", "", "", "", "", "", "", ""))
	ElseIf InStr(RouteType, "ViewOnly") > 0 And InStr(RouteType, "RMail") > 0	Then
		Response.Write(HttpL3_2("一覧表示", "tblbtn( '/" & HomeAlias & "/user/bk/jyuhasshinbunsyo/fn_jyuhasshinbunsyo.asp?RouteType=ViewOnly&PageType=受信文書')", "", "", "", "", "", "", "", ""))
	ElseIf InStr(RouteType, "ViewOnly") > 0 And InStr(RouteType, "SMail") > 0	Then
		Response.Write(HttpL3_2("一覧表示", "tblbtn( '/" & HomeAlias & "/user/bk/jyuhasshinbunsyo/fn_jyuhasshinbunsyo.asp?RouteType=ViewOnly&PageType=発信文書')", "", "", "", "", "", "", "", ""))
	ElseIf InStr(RouteType, "ViewOnly") > 0 Then
		Response.Write(HttpL3_2("一覧表示", "tblbtn( 'fk_nyukinsyukin_ichiran.asp?DenpyoNo=" & DenpyoNo & "&RouteType=" & RouteType & "&PageType=" & PageType & "&ShowDel=" & ShowDel & "')", PrevTitle, PrevCmd, NextTitle, NextCmd, "", "", "", ""))
	Else
		Response.Write(HttpL3_2("追加", "tblbtn( 'fk_nyukinsyukin.asp?PageType=" & PageType & "&ShowDel=" & ShowDel & "')", "一覧表示", "tblbtn( 'fk_nyukinsyukin_ichiran.asp?DenpyoNo=" & DenpyoNo & "&RouteType=" & RouteType & "&PageType=" & PageType & "&ShowDel=" & ShowDel & "')", PrevTitle, PrevCmd, NextTitle, NextCmd, "", ""))
	End If

	If InStr(RouteType, "Hakushi") > 0 Then
		Response.Write(HttpL4(Title, ""))
	Else
		Response.Write(HttpL4(Title, "照会"))
	End If

%>


<div id="L0" style="position: absolute; visibility: hidden; left: 0px; top: -2000px;">
<%
Dim AutoFlg
If RouteType = "Hakushi" Then
	AutoFlg = -1
Else
	AutoFlg = 0
End If
%>
<% = DenpyoNyusyukin(EnshuCD, KaisyaCD, KaisyaCD, DenpyoKubun, DenpyoNo, AutoFlg, 0) %>
</div>
</body>
<SCRIPT LANGUAGE="JavaScript">

function SakujyoBtn() {
	if (confirm("この操作は元に戻す事が出来ません。\r\n削除をしてもよろしいですか?")) {
		tblbtn('/<% = HomeAlias %>/user/bk/denpyo/fk_nyukinsyukin_bin.asp?PageType=<% = PageType %>&DenpyoNo=<% = DenpyoNo %>&BinType=Del&ShowDel=<% = ShowDel %>');
	}
}
</SCRIPT>
<% = HtmlFooter %>
</html>
<%
End Sub
%>