[load_grdList]
select
  hin_cd
, hin_nm
, suryo
, 1 as rec_flg
from w_basv0510
where s_id = :s_id
order by row_no

[getExportList]
select
  m.hin_cd
, m.hin_nm
, m.hin_rnm
, m.jan_cd
, m.brand_cd
, h1.han_name as brand_nm
, m.htanka
, m.tanka
--, st.now_stock
, COALESCE(st.now_stock,0) + (case when(':hin-renkei' = '1')then(COALESCE(other_stock,0))else(0)end) as now_stock
, m.htanka + fnc_get_zei(m.htanka,to_char(now(),'yyyymmdd')) as htanka_komi
, vs.stanka1
, vs.stanka2
, vs.stanka3
, vs.stanka4
, vs.stanka5
, vu.utanka1
, vu.utanka2
, vu.utanka3
, vu.utanka4
, vu.utanka5
, w.suryo
from w_basv0510 w
inner join m_hin m on (m.hin_cd = w.hin_cd)
left join m_stock st on (st.hin_cd = m.hin_cd)
left join m_hanyo h1 on (h1.mst_kbn = '06' and h1.han_cd = m.brand_cd)
left join m_hanyo h2 on (h2.mst_kbn = '05' and h2.han_cd = m.cat_cd)
left join v_hin_stanka_rireki vs on (vs.hin_cd = w.hin_cd)
left join v_hin_utanka_rireki vu on (vu.hin_cd = w.hin_cd and vu.tok_cd = ':tok_cd')
where w.s_id = :s_id
order by w.row_no

[getSirDen]
select tm.komi_tanka as tanka_i
from t_sir_m tm
inner join t_sir th on (th.den_no = tm.den_no)
where tm.hin_cd = ':hin_cd'
--TODO
and th.sir_cd != '4999'
order by th.syori_ymd desc, tm.den_no desc, tm.row_no
limit 5

[getUriDen]
select tm.tanka as tanka_i
from t_uri_m tm
inner join t_uri th on (th.den_no = tm.den_no)
where tm.hin_cd = ':hin_cd'
and th.tok_cd = ':tok_cd'
order by th.syori_ymd desc, tm.den_no desc, tm.row_no
limit 5




