<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<og:value command="SET" key="CLM" value="{@SYS.SYSTEM_ID}_{@CDANK}_{@CDSITSU}" />

<og:query command="{@command}" displayMsg="" maxRowCount="50000">
	select A.KVAL AN_{@CDANK}_{@CDSITSU}, A.KVAL, B.KUID, B.DYKAITO, B.NOKAITO from AN12 A inner join AN11 B
	on A.NOKAITO = B.NOKAITO
	where A.USERID = '{@USER.ID}'
	and A.CDANK = '{@CDANK}'
	and A.CDSITSU = '{@CDSITSU}'
	and A.FGOTHER = '1'
	and A.FGJ = '1'
	order by A.UNIQ DESC
</og:query>

<og:value command="SQL" action="ROW_APPEND">
	select A.UNIQ AN02_OTHER_UNIQS
	from AN02 A
	where A.CDANK = '{@CDANK}'
	and A.CDSITSU != '{@CDSITSU}'
	and A.FGKEY = '1'
	and A.FGJ = '1'
	order by A.SEQNO
</og:value>

<og:value command="SET" key="DISPKEYS" value="AN_{@CDANK}_{@CDSITSU},KUID,DYKAITO,NOKAITO" />

<c:forTokens items="${AN02_OTHER_UNIQS}" delims="," var="AN02_OTHER_UNIQ" varStatus="status">
	<og:value command="SQL">
		select '&lt;span title="'||A.NAIYO||'"&gt;'||{@DBF.SUBSTR}(A.NAIYO,1,10)||'...&lt;/span&gt;' NAIYO_OTHER, A.CDSITSU CDSITSU_OTHER
		from AN02 A
		where A.UNIQ = '{@AN02_OTHER_UNIQ}'
	</og:value>

	<og:query command="{@command}" displayMsg="" notfoundMsg="" maxRowCount="50000" quotCheck="false" scope="request">
		select
			A.NOKAITO
			,case when A.FGOTHER = '0' then KNAME else KVAL end KEY${status.count}
		from AN12 A
		where A.CDANK = '{@CDANK}'
		and A.CDSITSU = '{@CDSITSU_OTHER}'
		and A.FGJ = '1'
	</og:query>

	<og:tableMerge
		command="{@command}"
		action="GROUP"
		display="false"
		masterScope="request"
		scope="request"
		masterKeys="NOKAITO"
		groupAddClms="KEY${status.count}"
		separator="|" />
	<og:tableMerge
		command="{@command}"
		action="UNION_CLM"
		display="false"
		slaveScope="request"
		masterKeys="NOKAITO"
		unionClms="KEY${status.count}" />

	<og:columnEditor column="KEY${status.count}" label="{@NAIYO_OTHER}" />
	<og:value command="SET" key="DISPKEYS" value="{@DISPKEYS},KEY${status.count}" />
</c:forTokens>

<div style="padding-left: 50px;">
	<og:equals val1="{@DB.COUNT}" val2="0" operator="GT">
		&amp;nbsp;&amp;nbsp;
		<og:link href="download.jsp" keys="CDANK,CDSITSU,listId,DISPKEYS" vals="{@CDANK},{@CDSITSU},list,{@DISPKEYS}">
			<img src="{@SYS.JSP}/image/fileDownload.gif" alt="Download File" width="20px" height="20px" />
		</og:link>
	</og:equals>
	&amp;nbsp;&amp;nbsp;
	<og:link lbl="RETURN_CDSITSU" href="detail.jsp"
		keys="command,CDANK,CDSITSU,KEY,BACK_GAMENID" vals="NEW,{@CDANK},{@CDSITSU},{@KEY},{@BACK_GAMENID}" />
	<br /><br />
</div>

<og:columnEditor column="AN_{@CDANK}_{@CDSITSU}" label="KNAIYO" />

<div style="padding-left:20px;">
<og:text>{@LBL.NEWESTHND}</og:text>
<og:view
	viewFormType = "HTMLTable"
	command		= "{@command}"
	columnDisplay = "{@DISPKEYS}"
	checked		= "{@checked}"
	startNo		= "{@startNo}"
	pageSize	= "100"
	noMessage	= "true"
	selectedType= "NONE" />
</div>

</jsp:root>
