[load_grdList] select w.nyukin_no , w.tok_cd , w.nyukin_ymd , w.nyukin_kbn , w.nyukin_gaku , w.tesuryo , w.cyosei_gaku , w.total_gaku , w.biko , w.seikyu_flg , w.seikyu_ymd , w.nyukin_kbn_nm , w.tok_nm , w.nyukin_term_id , w.nyukin_term_nm , w.tan_nm , w.meisai_biko , w.nyukin_kbn_sort , w.keshi_gaku , COALESCE(w.total_gaku,0) - COALESCE(w.keshi_gaku,0) as keshi_zan , w.tegata_ymd , w.tegata_no --#24074 2022.06.13 MOD STT , w.input_ymd --#24074 2022.06.13 MOD END , w.eigyou_tan_cd , w.eigyou_tan_nm from ( --明細なし select t.nyukin_no , t.tok_cd , t.nyukin_ymd , t.nyukin_kbn , t.nyukin_gaku , t.tesuryo , t.cyosei_gaku , t.total_gaku , t.biko , t.seikyu_flg , t.seikyu_ymd , h1.han_name as nyukin_kbn_nm --2018.10.21 本来はt.tok_nmでよいが、登録済データのNULL値があるので、残念な対応 STT --, tk.tok_nm , COALESCE(t.tok_nm,tk.tok_nm) as tok_nm --2018.10.21 本来はt.tok_nmでよいが、登録済データのNULL値があるので、残念な対応 END , t.nyukin_term_id , h2.han_name as nyukin_term_nm , tan.tan_nm , '' as meisai_biko , h1.sort_key as nyukin_kbn_sort , (select COALESCE(sum(k.nyukin_gaku),0) from t_nyu_keshi k where k.nyukin_no = t.nyukin_no) as keshi_gaku , t.tegata_ymd , t.tegata_no --#24074 2022.06.13 MOD STT , t.input_ymd --#24074 2022.06.13 MOD END , uh.eigyou_tan_cd , utan.tan_nm as eigyou_tan_nm from t_nyukin t left join t_uri uh on (uh.den_no = t.pair_den_no) left join m_tokui tk on (tk.tok_cd = t.tok_cd) left join m_hanyo h1 on (h1.mst_kbn = '13' and h1.han_cd = t.nyukin_kbn) left join m_hanyo h2 on (h2.mst_kbn = '64' and h2.han_cd = t.nyukin_term_id) left join m_tanto tan on (t.tan_cd = tan.tan_cd) left join m_tanto utan on (uh.eigyou_tan_cd = utan.tan_cd) where 1 = 1 and ':meisai_mode' = '0' and t.del_flg = 0 and ((t.nyukin_no = fnc_to_number(':den_no')) or ('' = ':den_no')) and (('' = ':syori_ymd_fr') or (t.nyukin_ymd >= ':syori_ymd_fr')) and (('' = ':syori_ymd_to') or (t.nyukin_ymd <= ':syori_ymd_to')) and (('' = ':tok_cd') or (t.tok_cd = ':tok_cd')) AND ((fnc_translate_case(tk.tok_nm) LIKE '%'||fnc_translate_case(':tok_nm')||'%') or (fnc_translate_case(tk.tok_kana) LIKE '%'||fnc_translate_case(':tok_nm')||'%') or (fnc_translate_case(t.tok_nm) LIKE '%'||fnc_translate_case(':tok_nm')||'%') or (':tok_nm' = '')) and ((t.biko like '%:biko1%') or ('' = ':biko1')) and ((t.nyukin_term_id = ':nyukin_term_id') or ('' = ':nyukin_term_id')) and (('' = ':tan_cd') or (t.tan_cd = ':tan_cd')) and (('' = ':nyukin_kbn') or (t.nyukin_kbn = ':nyukin_kbn')) and (('' = ':eig_cd') or (t.eig_cd = ':eig_cd')) and (('' = ':tori_kbn') or (tk.tori_kbn = ':tori_kbn')) --#24074 2022.06.13 MOD STT and (('' = ':input_ymd_fr') or (t.input_ymd >= ':input_ymd_fr')) and (('' = ':input_ymd_to') or (t.input_ymd <= ':input_ymd_to')) --#24074 2022.06.13 MOD END --明細あり union all select t.nyukin_no , t.tok_cd , t.nyukin_ymd , m.nyukin_kbn , m.nyukin_gaku , cast(null as numeric(12,2)) as tesuryo , cast(null as numeric(12,2)) as cyosei_gaku , t.total_gaku , t.biko , t.seikyu_flg , t.seikyu_ymd , h1.han_name as nyukin_kbn_nm , COALESCE(t.tok_nm,tk.tok_nm) as tok_nm , t.nyukin_term_id , h2.han_name as nyukin_term_nm , tan.tan_nm , m.biko as meisai_biko , h1.sort_key as nyukin_kbn_sort , (select COALESCE(sum(k.nyukin_gaku),0) from t_nyu_keshi k where k.nyukin_no = t.nyukin_no) as keshi_gaku , t.tegata_ymd , t.tegata_no --#24074 2022.06.13 MOD STT , t.input_ymd --#24074 2022.06.13 MOD END , uh.eigyou_tan_cd , utan.tan_nm as eigyou_tan_nm from t_nyukin t inner join t_nyukin_m m on (m.nyukin_no = t.nyukin_no) left join t_uri uh on (uh.den_no = t.pair_den_no) left join m_tokui tk on (tk.tok_cd = t.tok_cd) left join m_hanyo h1 on (h1.mst_kbn = '13' and h1.han_cd = m.nyukin_kbn) left join m_hanyo h2 on (h2.mst_kbn = '64' and h2.han_cd = t.nyukin_term_id) left join m_tanto tan on (t.tan_cd = tan.tan_cd) left join m_tanto utan on (uh.eigyou_tan_cd = utan.tan_cd) where 1 = 1 and ':meisai_mode' = '1' and t.del_flg = 0 and ((t.nyukin_no = fnc_to_number(':den_no')) or ('' = ':den_no')) and (('' = ':syori_ymd_fr') or (t.nyukin_ymd >= ':syori_ymd_fr')) and (('' = ':syori_ymd_to') or (t.nyukin_ymd <= ':syori_ymd_to')) and (('' = ':tok_cd') or (t.tok_cd = ':tok_cd')) AND ((fnc_translate_case(tk.tok_nm) LIKE '%'||fnc_translate_case(':tok_nm')||'%') or (fnc_translate_case(tk.tok_kana) LIKE '%'||fnc_translate_case(':tok_nm')||'%') or (fnc_translate_case(t.tok_nm) LIKE '%'||fnc_translate_case(':tok_nm')||'%') or (':tok_nm' = '')) --#20051 2021.07.28 MOD STT --and ((m.biko like '%:biko1%') or ('' = ':biko1')) and ((t.biko like '%:biko1%') or (m.biko like '%:biko1%') or ('' = ':biko1')) --#20051 2021.07.28 MOD END and ((t.nyukin_term_id = ':nyukin_term_id') or ('' = ':nyukin_term_id')) and (('' = ':tan_cd') or (t.tan_cd = ':tan_cd')) and (('' = ':nyukin_kbn') or (m.nyukin_kbn = ':nyukin_kbn')) and (('' = ':eig_cd') or (t.eig_cd = ':eig_cd')) and (('' = ':tori_kbn') or (tk.tori_kbn = ':tori_kbn')) --#24074 2022.06.13 MOD STT and (('' = ':input_ymd_fr') or (t.input_ymd >= ':input_ymd_fr')) and (('' = ':input_ymd_to') or (t.input_ymd <= ':input_ymd_to')) --#24074 2022.06.13 MOD END ) w where 1 = 1 and ((':cond_keshi' != '0') or ((COALESCE(w.total_gaku,0) - COALESCE(w.keshi_gaku,0)) != 0)) and ((':cond_keshi' != '1') or ((COALESCE(w.total_gaku,0) - COALESCE(w.keshi_gaku,0)) = 0)) --order by nyukin_ymd desc, nyukin_no desc, nyukin_kbn_sort, nyukin_kbn --TODO --#24564 2022.07.28 MOD STT order by :order_by_sql nyukin_ymd desc, nyukin_no desc, nyukin_kbn_sort, nyukin_kbn --#24564 2022.07.28 MOD END --limit 10000 :list_limit