<%

Function KouriRyoshusho(EnshuCD, KaisyaCD, SakuseiKaisyaCD, BunsyoSyuruiCD, BunsyoNaiyoCD, AutoFlg, PrintFlg)

	Dim RouteType
	RouteType = Request("RouteType")
	Dim Action
	Action = Request("Action")
	Dim PageType
	PageType = Request("PageType")

'	Dim SakuseiKaisyaCD
'	SakuseiKaisyaCD = Request("SakuseiKaisyaCD")
'	Dim BunsyoSyuruiCD
'	BunsyosyuruiCD = Request("BunsyoSyuruiCD")
'	Dim BunsyoNaiyoCD
'	BunsyoNaiyoCD = Request("BunsyoNaiyoCD")

	Dim Title
	Title = "領収書"

	Dim Query, Content

	Dim Kaisyamei
	Dim KaisyaRyakumei
	Dim kaisyaKanamei
	Dim ZipCode
	Dim Adr1
	Dim Adr2
	Dim Tel
	Dim Fax
	Dim GyosyuCD
	Dim Set_ShijyoCD

	Dim jj,tmps

	Dim ShohinMeisyo, ShohinMeisyoListWidth, ShijyoListWidth

	'↓市場・商品表示幅の指定及び商品名称・商品略名称の指定?
	ShohinMeisyo = "商品名称"
	ShohinMeisyoListWidth = "width: 155;"
	ShijyoListWidth = "width:85"

' For Debug
'Response.Write("GB_SystemCD:" & GB_SystemCD & "<br>")
'Response.Write("EnshuCD:" & EnshuCD & "<br>")
'Response.Write("KaisyaCD:" & KaisyaCD & "<br>")
'Response.Write("SakuseiKaisyaCD:" & SakuseiKaisyaCD & "<br>")
'Response.Write("BunsyoSyuruiCD:" & BunsyoSyuruiCD & "<br>")
'Response.Write("BunsyoNaiyoCD:" & BunsyoNaiyoCD & "<br>")
'Response.Write("RouteType:" & RouteType & "<br>")

'販売会社名の情報取得
	Query = "exec SPM会社取得 '" & GB_SystemCD & "','" & EnshuCD & "','" & KaisyaCD & "'"
	Set Content = OpenQuery(Query)
	If Not(Content.BOF Or Content.EOF) Then
		Kaisyamei = Content.Fields("会社名称")
		KaisyaRyakumei = Content.Fields("会社略名称")
		kaisyaKanamei = Content.Fields("会社カナ名称")
		ZipCode = Content.Fields("郵便番号")
		Adr1 = Content.Fields("住所1")
		Adr2 = Content.Fields("住所2")
		Tel = Content.Fields("TEL")
		Fax = Content.Fields("FAX")
		GyosyuCD = Content.Fields("業種CD")
		Set_ShijyoCD = Content.Fields("市場CD")
	End If

	Dim KaiageTensu								'買上点数
	Dim KaiageKingaku							'買上金額
	Dim ShohiZei								'消費税
	Dim GokeiKingaku							'合計金額
	Dim Unsohi								'運送費
	Dim KyakuShimei								'客氏名
	Dim Tekiyo								'摘要
	Dim GakuseiShimei							'学生氏名
	Dim GakuseiBango							'学生番号
	Dim GakuseiRyakusho							'学生略称(印)
	Dim Kaiagebi								'買上日
	Dim KaiagehyoF								'買上票印刷フラグ
	Dim RyoshusyoF								'領収書印刷フラグ
	Dim ShukkaF								'出荷フラグ
	Dim NyuShukkoF								'入出庫フラグ
	Dim SakujyoF								'削除フラグ
	Dim kitakuSokoF								'寄託倉庫利用フラグ

' 小売販売テーブル読み込み(TTL部)
	Query = "exec SPK小売販売取得_合計 '" & GB_SystemCD & "'"		'システムCD
	Query = Query & ",'" & EnshuCD & "'"					'演習CD
	Query = Query & ",'" & KaisyaCD & "'"					'会社CD
	Query = Query & ",'" & KaisyaCD & "'"					'作成会社CD
	Query = Query & ",'" & BunsyoSyuruiCD & "'"				'文書種類CD
	Query = Query & ",'" & BunsyoNaiyoCD & "'"				'文書内容CD

	Set Content = OpenQuery(Query)

	If Not(Content.BOF Or Content.EOF) Then
		KaiageTensu = Content.Fields("買上点数")
		KaiageKingaku = Content.Fields("買上金額")
		ShohiZei = Content.Fields("消費税")
		GokeiKingaku = Content.Fields("合計金額")
		Tekiyo = Content.Fields("摘要")
		Unsohi = Content.Fields("送料")
		KyakuShimei = Content.Fields("客氏名")
		GakuseiBango = Content.Fields("学生番号")
		GakuseiShimei = Content.Fields("学生氏名")
		Tekiyo = Content.Fields("摘要")
		Kaiagebi = Content.Fields("買上日")
		KaiagehyoF = Content.Fields("買上票印刷フラグ")			'買上票印刷フラグ
		RyoshusyoF = Content.Fields("領収書印刷フラグ")			'領収書印刷フラグ
		ShukkaF = Content.Fields("出荷フラグ")				'出荷フラグ
		NyuShukkoF = Content.Fields("入出庫更新フラグ")			'入出庫フラグ
		SakujyoF = Content.Fields("削除フラグ")				'削除フラグ
		kitakuSokoF = Content.Fields("寄託倉庫利用")			'寄託倉庫利用フラグ
	End If
%>

<table width="654" height="390" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td align="center" valign="center">
	<%
		If PrintFlg = 1 Then
			Response.Write(PrintHeader(AutoFlg, ""))
		End if
	%>

						<table width="700" height="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td align="center" valign="middle">
									<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="240" STYLE="border-left: 1px solid #111111;">
										<tr>
											<td width="175" bgcolor="#FEFFF1" align="center" STYLE="border-top: 1px solid #111111;border-right: 1px solid #111111;border-bottom: 1px solid #111111;">
												<table border="0" width="90%" cellspacing="0" cellpadding="0" class="tx1416">
													<tr>
														<td><span class="tx1214">NO.</span><% = BunsyoNaiyoCD %><div style="border-bottom-style: solid; border-bottom-width: 1;"></div></td>
													</tr>
													<tr>
														<td>日付:<br><% = SetDate(Kaiagebi, 3) %><div style="border-bottom-style: solid; border-bottom-width: 1;"></div></td>
													</tr>
													<tr>
														<td>領収先:<br><% = KyakuShimei %><div style="border-bottom-style: solid; border-bottom-width: 1;"></div></td>
													</tr>
													<tr>
														<td>金額:<% = ConvIntToMoney(GokeiKingaku, false, false) %><div style="border-bottom-style: solid; border-bottom-width: 1;"></div></td>
													</tr>
													<tr>
														<td><span style="width:157px; height:48px; overflow:hidden;">摘要:<BR><% = Tekiyo %></span><div style="border-bottom-style: solid; border-bottom-width: 1;"></div></td>
													</tr>
												</table>
											</td>
<%
' 領収書印刷フラグを判断し、右辺の有無により表示制御を行う。
					
										If RyoshusyoF = 1 Then %>
											<td WIDTH="525" STYLE="border-top: 1px dotted #111111;border-right: 1px dotted #111111;border-bottom: 1px dotted #111111;"><img src="/<% = HomeAlias %>/images/spacer.gif?<% = GB_STU %>" width="1" height="1"></td>
										<% Else %>
											<td WIDTH="525" bgcolor="#FCF8DB" STYLE="border-top: 1px solid #111111;border-right: 1px solid #111111;border-bottom: 1px solid #111111;">
												<table border="0" width="100%"	HEIGHT="100%" cellspacing="0" cellpadding="0">
													<tr>
														<td height="30" valign="bottom">
															<table border="0" width="100%" cellspacing="0" cellpadding="0" CLASS="tx1820">
																<tr>
																	<td width="25"><br></td>
																	<td width="130"><br></td>
																	<td align="center"><% = Title %></td>
																	<td width="130" class="tx1416" align="left">
																		&nbsp;<span class="tx1214">NO.</span><% = BunsyoNaiyoCD %>
																	<div style="border-bottom-style: solid; border-bottom-width: 1;"></div></td>
																	<td width="25"><br></td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td height="10"><img src="/<% = HomeAlias %>/images/spacer.gif?<% = GB_STU %>" width="1" height="1"></td>
													</tr>
													<tr>
														<td>
															<table border="0" width="100%" cellspacing="0" cellpadding="0" class="tx1416" height="80%">
																<tr>
																	<td valign="middle" align="center">
																		<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" height="20" width="84%">
																			<tr>
																				<td height="10" align="center" class="tx1416" style="border-bottom:1 solid #000000;">&nbsp;<% = KyakuShimei %>&nbsp;</td>
																				<td height="10" align="right" class="tx1416" style="border-bottom:1 solid #000000;">御中</td>
																			</tr>
																		</table>
																	</td>
																	<td width="180">
																		<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="5"	WIDTH="100%" HEIGHT="20" class="tx1416" bordercolor="#000000">
																			<tr>
																				<td height="20" align="center" ><% = SetDate(Kaiagebi, 3) %></td>
																			</tr>
																		</table>
																	</td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td>
															<table border="0" width="100%" cellspacing="0" cellpadding="0" class="tx1416" height="100%">
																<tr>

																	<td valign="middle" align="center">
																		<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" height="40" width="90%">
																			<tr>
																				<td width="100%">
																					<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#F7F0C8" STYLE="border: 1px solid #111111" WIDTH="100%" HEIGHT="100%">
																						<tr>
																							<td width="100%" align="center">
																								<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" class="tx1416">
																									<tr>
																										<td align="right">金額 ¥</td>
																										<td><span class="tx1820"><% = ConvIntToMoney(GokeiKingaku, false, false) %></span> </td>
																										<td align="left">※</td>
																										</td>
																									</tr>
																								</table>
																							</td>
																						</tr>
																					</table>
																				</td>
																			</tr>

																		</table>
																	</td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td align="center">
															<table border="0" width="90%" height="100%" cellspacing="0" cellpadding="0" class="tx1416">
																<tr>
																	<td width="98" align="center">
																		<table border="0" width="84" height="95" cellspacing="0" cellpadding="0" style="border: 1px dotted #888888" class="tx1618">
																			<tr>
																				<td width="100%" valign="middle" align="center"><font color="#888888">印&nbsp;&nbsp;&nbsp;収<br><br>紙&nbsp;&nbsp;&nbsp;入</font></td>
																			</tr>
																		</table>
																	</td>
																	<td valign="middle" align="center">
																		<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" height="40" width="340">
																			<tr>
																				<td width="100%">
<div style="position:relative; width:100%;"><!--実印の親要素-->
<div style="position:absolute; left:170px; top:42px; z-index:2; overflow:visible;">
	<img src="/<% = HomeAlias %>/images/jitsuin.gif?<% = GB_STU %>">
</div>
																					<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" class="tx1416">
																						<tr>
																							<td width="388" align="left" style="border-bottom:1 solid #000000;" nowrap>&nbsp;ただし <span style="width:333px; height:16px; overflow:hidden;"><% = Tekiyo %></span></td>
																						</tr>
																						<tr>
																							<td align="right">上記のとおり領収いたしました。</td>
																						</tr>
																						</tr>
																							<td height="70" align="center" class="tx1820">
																								<% = Adr1 %><br>
																								<% = Kaisyamei %>
																							</td>
																						</tr>
																					</table>
</div><!--実印の親要素-->
																				</td>	
																			</tr>
																		</table>			
																	</td>
																</tr>
															</table>
														</td>
													</tr>	
												</table>		
											</td>
										<% End IF %>				
										</tr>				
									</table>														
								</td>																
							</tr>
						</table>
		<%
			If PrintFlg = 1 Then
				Response.Write(PrintFooter())
			End if
		%>
		</td>
	</tr>
</table>


<%
End Function
%>