where a.ktktcd=:ktktcd
			and a.dcls='1'
			and a.adat>=to_date(:adats, 'yyyy/mm/dd')
			and a.adat<=to_date(:adate, 'yyyy/mm/dd')
			and (:cucd is null or (:cucd is not null and a.cucd = :cucd and (:cuscd is null or a.cuscd = :cuscd)))
			and (:ijan is null or a.ijan = :ijan)
			and ( :chgcd is null
				or (:chgcd is not null and (b.cuslcd = :chgcd
					or (nvl(:chk_kbn1, '0') = '1' and b.cuslcd2 = :chgcd)
					or (nvl(:chk_kbn2, '0') = '1' and b.cubscd = :chgcd) ))
			)
			and (:spktcd is null or a.spktcd = :spktcd)
			and a.cucd=b.cucd(+)
			and a.cucd=c.cucd(+) and a.cuscd=c.cuscd(+)
			and a.ktktcd=z.ktktcd(+)
			group by to_char(decode(d.cls,0,a.adat,null),'yyyy/mm/dd'),a.cucd,a.cuscd,b.cunm,c.spnm
	) z
) x
order by x.rnum
