<?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" />

<div style="padding-left: 50px;">
	<og:equals val1="{@KCNT}" val2="0" operator="GT">
		<og:link href="output.jsp" useGamenId="false" keys="command,CDANK,CDSITSU,CLM" vals="NEW,{@CDANK},{@CDSITSU},KNAME">
			<img src="{@SYS.JSP}/image/fileDownload.gif" alt="Download File" width="20px" height="20px" />
		</og:link>
	</og:equals>

	<og:value command="REMOVE" key="FGOTHER" />
	<og:value command="SQL">
		select FGOTHER
		from AN03 A
		where A.CDANK = '{@CDANK}'
		and A.CDSITSU = '{@CDSITSU}'
		and A.FGOTHER = '1'
		and A.FGJ = '1'
	</og:value>
	<og:equals val1="{@FGOTHER}" val2="1">
		&amp;nbsp;&amp;nbsp;
		<og:link lbl="DETAILOTHER" href="detail.jsp"
			keys="command,CDANK,CDSITSU,KEY,BACK_GAMENID,VIEW_TYPE" vals="NEW,{@CDANK},{@CDSITSU},{@KEY},{@BACK_GAMENID},OTHER" />
	</og:equals>
	<br /><br />
</div>

<og:text><b>{@LBL.KEYVALGRAPH}</b></og:text>
<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>

<ul style="list-style-type:none;">

<c:forTokens items="${AN02_OTHER_UNIQS}" delims="," var="AN02_OTHER_UNIQ" >
	<og:value command="SQL">
		select A.NAIYO NAIYO_OTHER, A.CDSITSU CDSITSU_OTHER
		from AN02 A
		where A.UNIQ = '{@AN02_OTHER_UNIQ}'
	</og:value>

	<og:value command="SQL">
		select count(*) KSCNT_OTHER, floor(count(*)*100/{@KCNT}) KRITSU_OTHER
		from AN12 A
		where A.CDANK = '{@CDANK}'
		and A.CDSITSU = '{@CDSITSU_OTHER}'
		and A.KVAL is not null and A.KVAL != coalesce('',' ')
		and A.FGOTHER = '0'
		and A.FGJ = '1'
	</og:value>

	<li style="margin-top:10px;">
		Q . <og:column name="DUMMY" value="{@NAIYO_OTHER}" td="false" writable="false" />
		&amp;nbsp&amp;nbsp
		(<og:text>
		{@LBL.KCNT}:<og:column name="KCNT" value="{@KSCNT_OTHER}" td="false" writable="false" />
		&amp;nbsp
		{@LBL.KRITSU}:<og:column name="KRITSU" value="{@KRITSU_OTHER}" td="false" writable="false" />%
		</og:text>)
	</li>

	<og:value command="SQL" action="ROW_APPEND">
		select A.UNIQ AN03_OTHER_UNIQS
		from AN03 A
		where A.USERID = '{@USER.ID}'
		and A.CDANK = '{@CDANK}'
		and A.CDSITSU = '{@CDSITSU_OTHER}'
		and A.FGJ = '1'
		and exists( select 'x'
				from AN12 B
				where A.CDSITSU = B.CDSITSU
				and A.KVAL = B.KVAL
				and B.USERID = '{@USER.ID}'
				and B.CDANK = '{@CDANK}'
				and B.CDSITSU = '{@CDSITSU_OTHER}'
				and B.FGOTHER = '0'
				and B.FGJ = '1' )
		order by A.SEQNO
	</og:value>

	<li style="margin-top:10px;">
	<table>
	<tr>
		<c:forTokens items="${AN03_OTHER_UNIQS}" delims="," var="AN03_OTHER_UNIQ" >
			<og:value command="SQL">
				select A.KVAL KVAL_OTHER, A.KNAME KNAME_OTHER, A.IMGKVAL IMGVAL_OTHER
				from AN03 A
				where A.UNIQ = '{@AN03_OTHER_UNIQ}'
			</og:value>

			<og:value command="SQL">
				select count(*) KHCNT_OTHER, floor(count(*)*100/{@KCNT}) KHRITSU_OTHER
				from AN12 A
				where A.USERID = '{@USER.ID}'
				and A.CDANK = '{@CDANK}'
				and A.CDSITSU = '{@CDSITSU_OTHER}'
				and A.KVAL = '{@KVAL_OTHER}'
				and A.FGOTHER = '0'
				and A.FGJ = '1'
			</og:value>

			<td>
				A. <og:column name="DUMMY" value="{@KNAME_OTHER}" renderer="SLABEL" param="50" td="false" writable="false" />
				&amp;nbsp&amp;nbsp
				(<og:text>
				{@LBL.KCNT}:<og:column name="KCNT" value="{@KHCNT_OTHER}" td="false" writable="false" />
				&amp;nbsp
				{@LBL.KHRITSU}:<og:column name="KHRITSU" value="{@KHRITSU_OTHER}" td="false" writable="false" />%
				</og:text>)
			</td>
		</c:forTokens>
	</tr>

	<tr>
		<c:forTokens items="${AN03_OTHER_UNIQS}" delims="," var="AN03_OTHER_UNIQ" >
			<og:value command="SQL">
				select A.KVAL KVAL_OTHER
				from AN03 A
				where A.UNIQ = '{@AN03_OTHER_UNIQ}'
			</og:value>

			<td>
			<og:chartCreate
				width		= "300"
				height		= "250">
				<og:chartDataset chartType="Pie">
					select A.KNAME||'('||count(*)||')('||floor(count(*)*100/{@KCNT})||'%)',count(*) KCNT
					from AN12 A
					where A.USERID = '{@USER.ID}'
					and A.CDANK = '{@CDANK}'
					and A.CDSITSU = '{@CDSITSU}'
					and A.FGOTHER = '0'
					and exists( select 'x'
							from AN12 B
							where A.NOKAITO = B.NOKAITO
							and B.USERID = '{@USER.ID}'
							and B.CDANK = '{@CDANK}'
							and B.CDSITSU = '{@CDSITSU_OTHER}'
							and B.KVAL = '{@KVAL_OTHER}'
							and B.FGOTHER = '0'
							and B.FGJ = '1' )
					group by A.KVAL, A.KNAME
					order by count(*) desc, A.KVAL
				</og:chartDataset>
			</og:chartCreate>
			</td>
		</c:forTokens>
	</tr>
	</table>
	</li>
</c:forTokens>

</ul>

</jsp:root>
