--[@rs1] [selectRecords_hed] select m.row_no + 1 as row_no , u.den_no , trunc((m.row_no)/ 5) + 1 as row_page , u.jucyu_no , u.tan_cd , tan.tan_nm , m.jucyu_row_no , m.jucyu_su , m.tani , case when u.syori_ymd = '' then '日付を入力してください' else to_char(to_date(u.syori_ymd,'yyyymmdd'),'yyyy/mm/dd') end as syori_ymd , case u.nonyu_tan when '' then '御中' else '' end as keisyou_tok , case when coalesce(u.nonyu_tan,'') = '' then '' else '様' end as keisyou_tan , u.tok_cd , u.tok_nm , m.suryo , m.tanka , m.kingaku , u.zeinuki_gaku , u.zei_gaku , u.zeikomi_gaku , u.seikyu_ymd , u.nonyu_ymd , t.tok_nm as tokui_nm , case t.keisyo when '' then '様' else t.keisyo end as keisyo , t.tok_kana as tokui_kana , left(t.zip_no,3)||'-'||right(t.zip_no,4) as post_n , m.hin_nm , m.meisai_biko , u.biko1 , 0.8 as jimu_cost , coalesce(ts.unchin,0) as unchin from t_uri u left join t_uri_m m on (u.den_no = m.den_no) left join t_seizou ts on (m.den_no = ts.jucyu_no) and (m.row_no = ts.jucyu_row_no) left join t_shiyou_zairyo tsz on (ts.shiji_no = tsz.shiji_no) left join m_tokui t on (u.tok_cd = t.tok_cd) left join m_tanto tan on (u.tan_cd = tan.tan_cd) where 1=1 and u.del_flg = 0 and ((u.input_ymd >= '&1') or ('&1' = '')) and ((u.input_ymd <= '&2') or ('&2' = '')) and ((cast(u.den_no as varchar(8))= '&3') or ('&3' = '')) and ((t.tok_cd = '&4') or ('&4' = '')) and ((m.hin_nm like '&5') or ('&5' like '')) and ((cast(m.row_no as varchar(8))= '&10') or ('&10' = '')) order by den_no,tok_cd,syori_ymd,m.row_no; --[@rs2] [selectRecords_kounyu] select tsz.row_no + 1 as row_no , tsz.hin_nm , tsz.size_l , tsz.size_w , tsz.size_lw , tsz.weight , tsz.renryo , tsz.wtanka , tsz.tanka , tsz.calc_su , tsz.yobi_su , tsz.suryo , tsz.hacyu_leadtime , tsz.sir_nm , (coalesce(tsz.kingaku,0)) as kingaku from t_shiyou_zairyo tsz where 1=1 and ((cast(tsz.shiji_no as varchar(8))= '20000903') or ('20000903' = '')) --and ((cast(tsz.shiji_no as varchar(8))= '&1') or ('&1' = '')) order by row_no ; --[@rs3] [selectRecords_gaicyu] select tsz.row_no + 1 as row_no , tsz.zairyo_no , tsz.hin_nm , tsz.size_l , tsz.size_w , tsz.size_lw , tsz.weight , tsz.renryo , tsz.wtanka , tsz.tanka , tsz.calc_su , tsz.yobi_su , tsz.suryo , tsz.hacyu_leadtime , tsz.sir_nm , tsz.sir_tan , tsz.kingaku from t_shiyou_zairyo tsz where 1=1 and ((cast(tsz.shiji_no as varchar(8))= '20000903') or ('20000903' = '')) --and ((cast(tsz.shiji_no as varchar(8))= '&1') or ('&1' = '')) order by row_no ; --[@rs4] [selectRecords_kakou] select tsm.shiji_no , tsm.zairyo_no , tsm.koutei_no , tsm.koutei_cd , tsm.koutei_nm , tsm.kousu , tsm.seizou_tan_cd , tsm.seizou_biko , tsm.status , tsm.yotei_stt_time , tsm.yotei_end_time , tsm.stt_time , tsm.end_time , tsm.stop_time , tsm.restart_time , tsm.stop_kikan , tsm.stt_tan_cd , tsm.end_tan_cd , tsm.stop_tan_cd , tsm.restart_tan_cd , tsm.iko_key , tsm.del_flg , tsm.cre_id , tsm.cre_time , tsm.upd_id , tsm.upd_time , tsm.suryo , tsm.seizou_tan_cnt , tsm.tanka, kingaku , tsm.seizou_hosoku from t_seizou_m tsm where 1=1 and ((cast(tsm.shiji_no as varchar(8))= '20000903') or ('20000903' = '')) --and ((cast(tsz.shiji_no as varchar(8))= '&1') or ('&1' = '')) order by zairyo_no ; --[@rs5] [selectRecords_syukka] select tsm.shiji_no , tsm.zairyo_no , tsm.koutei_no , tsm.koutei_cd , tsm.koutei_nm , tsm.kousu , tsm.seizou_tan_cd , tsm.seizou_biko , tsm.status , tsm.yotei_stt_time , tsm.yotei_end_time , tsm.stt_time , tsm.end_time , tsm.stop_time , tsm.restart_time , tsm.stop_kikan , tsm.stt_tan_cd , tsm.end_tan_cd , tsm.stop_tan_cd , tsm.restart_tan_cd , tsm.iko_key , tsm.del_flg , tsm.cre_id , tsm.cre_time , tsm.upd_id , tsm.upd_time , tsm.suryo , tsm.seizou_tan_cnt , tsm.tanka, kingaku , tsm.seizou_hosoku from t_seizou_m tsm where 1=1 and ((cast(tsm.shiji_no as varchar(8))= '20000903') or ('20000903' = '')) --and ((cast(tsz.shiji_no as varchar(8))= '&1') or ('&1' = '')) order by zairyo_no ;