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

<!-- Required Parameter AN02_UNIQ(String),[Value Parameters] -->

<og:value command="SQL">
	select	A.USERID
			,A.CDANK
			,A.CDSITSU
			,A.KBUNRUI
			,'{@SYS.SYSTEM_ID}_'||A.CDANK||'_'||A.CDSITSU CLM
			,'{@SYS.SYSTEM_ID}_'||A.CDANK CLM_SCL
	from AN02 A
	where UNIQ = '{@AN02_UNIQ}'
</og:value>

<og:value command="REMOVE" key="SVALUE" />

<li>
	<og:equals val1="CHBOX|RADIO|MENU|SCALE" val2="{@KBUNRUI}" contains="true" notEquals="true">
		<og:value command="SET" key="SVALUE" action="APPEND">{@<og:value command="GET" key="CLM" />}</og:value>
		<og:equals val1="{@SVALUE}" nullCheck="true" notEquals="true">
			<b><og:column name="{@CLM}" value="{@SVALUE}" td="false" writable="false" param="4,60" /></b>
			<og:hidden name="{@CLM}" value="{@SVALUE}" />
		</og:equals>
	</og:equals>

	<og:equals val1="CHBOX|RADIO|MENU" val2="{@KBUNRUI}" contains="true">
		<og:value command="SET" key="SVALUE" action="APPEND">{@<og:value command="GET" key="CLM" />}</og:value>
		<og:equals val1="{@SVALUE}" nullCheck="true" notEquals="true">
			<c:forTokens items="${SVALUE}" delims="," var="SVAL" varStatus="status">

				<og:value command="REMOVE" key="IMGKVAL" />
				<og:value command="REMOVE" key="FGIMGK" />
				<og:value command="SQL">
					select
						A.KVAL,A.KNAME,A.IMGKVAL
						,case when A.IMGKVAL like '%.png' or A.IMGKVAL like '%.PNG'
							or A.IMGKVAL like '%.jpg' or A.IMGKVAL like '%.JPG'
							or A.IMGKVAL like '%.jpeg' or A.IMGKVAL like '%.JPEG'
							or A.IMGKVAL like '%.gif' or A.IMGKVAL like '%.GIF'
							or A.IMGKVAL like '%.bmp' or A.IMGKVAL like '%.BMP' then '1' else '0' end FGIMGK
					from AN03 A
					where A.USERID = '{@USERID}'
					and A.CDANK = '{@CDANK}'
					and A.CDSITSU = '{@CDSITSU}'
					and A.KVAL = '{@SVAL}'
					and A.FGJ = '1'
				</og:value>

				${(status.first) ? '' : '&lt;br /&gt;' }
				<og:equals val1="{@KNAME}" nullCheck="true" notEquals="true">
					<b><og:column name="{@CLM}" value="{@KNAME}" td="false" writable="false" /></b>
				</og:equals>
				<og:equals val1="{@KNAME}" nullCheck="true">
					<b><og:column name="{@CLM}" value="{@SVAL}" td="false" writable="false" /></b>
				</og:equals>
				<og:hidden name="{@CLM}" value="{@SVAL}" />

				<og:equals val1="{@IMGKVAL}" nullCheck="true" notEquals="true">
					<og:text>
					<a href="/{@SYS.CONTEXT_NAME}/ankimages/{@IMGKVAL}" target="IMAGE">
						<og:equals val1="{@FGIMGK}" val2="1">
							<img src="/{@SYS.CONTEXT_NAME}/ankimages/{@IMGKVAL}" width="50px" height="50px" alt="{@KNAME}" />
						</og:equals>
						<og:equals val1="{@FGIMGK}" val2="0">
							<img src="/{@SYS.CONTEXT_NAME}/jsp/image/text.gif" width="30px" height="30px" />
						</og:equals>
					</a>
					</og:text>
				</og:equals>

			</c:forTokens>
		</og:equals>
	</og:equals>

	<og:equals val1="SCALE" val2="{@KBUNRUI}">
		<og:value command="SQL" action="ROW_APPEND">
			select B.UNIQ AN03_UNIQS
			from AN02 A inner join AN03 B
			on A.USERID = B.USERID
			and A.CDANK = B.CDANK
			and A.CDSITSU = B.CDSITSU
			and B.FGJ in ('0','1')
			where A.UNIQ = '{@AN02_UNIQ}'
			and A.FGJ = '1'
			order by B.SEQNO
		</og:value>

		<table>
			<c:forTokens items="${AN03_UNIQS}" delims="," var="AN03_UNIQ" varStatus="status">
				<og:value command="SQL">
					select A.KVAL, A.KNAME, A.KSCALE
						, case when A.KSCALE &lt; 0 then -1*A.KSCALE else A.KSCALE end KSCALE_ABS
					from AN03 A
					where UNIQ = '{@AN03_UNIQ}'
				</og:value>
				<og:equals val1="${status.index}" val2="0">
					<tr>
						<th class="row_h"></th>
						<og:equals val1="{@KNOTE}" val2="," contains="true" notEquals="true">
							<th class="row_h" colspan="${KSCALE}"><og:text>{@KNOTE}</og:text></th>
						</og:equals>
						<og:equals val1="{@KNOTE}" val2="," contains="true">
							<c:forTokens items="${KNOTE}" delims="," var="KNT">
								<th class="row_h" style="font-size:small;"><og:text>{@KNT}</og:text></th>
							</c:forTokens>
						</og:equals>
					</tr>
				</og:equals>
				<tr class="row_${status.index%2}">
					<td><og:text>{@KNAME}</og:text></td>
					<og:value command="SET" key="SVALUE">{@<og:value command="GET" key="CLM_SCL" />_<og:value command="GET" key="KVAL" />}</og:value>
					<og:equals val1="{@SVALUE}" nullCheck="true" notEquals="true">
						<og:hidden name="{@CLM}" value="{@KVAL}" />
						<og:hidden name="{@CLM_SCL}_{@KVAL}" value="{@SVALUE}" />
						<c:forEach var="i" begin="0" end="${KSCALE_ABS-1}">
							<td align="center">
								&amp;nbsp;&amp;nbsp;
								&amp;nbsp;&amp;nbsp;
								<og:equals val1="{@KSCALE}" val2="{@KSCALE_ABS}">
									<b>${KSCALE_ABS-i == SVALUE ? SVALUE : ""}</b>
								</og:equals>
								<og:equals val1="{@KSCALE}" val2="{@KSCALE_ABS}" notEquals="true">
									<b>${i+1 == SVALUE ? SVALUE : ""}</b>
								</og:equals>
								&amp;nbsp;&amp;nbsp;
								&amp;nbsp;&amp;nbsp;
							</td>
						</c:forEach>
					</og:equals>
				</tr>
			</c:forTokens>
		</table>
	</og:equals>
</li>

</jsp:root>
