[selectRecords]
select 
	uh.den_no,
	(1+um.row_no) as row_no,
	to_char(to_date(uh.input_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as input_ymd,
	to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd,
	uh.zeinuki_gaku,
	uh.zei_gaku,
	uh.zeikomi_gaku,
--	um.hin_cd,
	(case when(mh.jan_cd != '')then(mh.jan_cd)else(um.hin_cd)end) as hin_cd,
	replace(um.hin_nm,chr(10),'')as hin_nm,
	um.suryo,
	um.tanka,
	um.kingaku,
	uh.tok_cd,
	t.tok_nm,
	t.zip_no,
	t.addr1,
	t.addr2,
	t.addr3,
	t.addr4,
	uh.payment_term as tori_cond,
--	uh.biko1
	replace(replace(uh.biko1,chr(13)||chr(10),chr(10)),chr(10),chr(13)||chr(10)) as biko1
from t_uri uh
left join m_tokui t on(uh.tok_cd = t.tok_cd)
left join t_uri_m um on(uh.den_no = um.den_no)
left join m_hin mh on (mh.hin_cd = um.hin_cd)
where 1 = 1
and uh.jucyu_flg = 0
and ((uh.syori_ymd >= '&1') or ('&1' = ''))
and ((uh.syori_ymd <= '&2') or ('&2' = ''))
and ((uh.den_no = fnc_to_number('&3')) or ('' = '&3'))
and ((uh.tok_cd = '&4') or ('&4' = ''))
and ((um.hin_nm like '%&5%') or ('&5' = ''))
and (('&7' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('&7')) ))
order by uh.den_no,um.row_no




