[selectRecords] select wk.tok_cd ,wk.tok_nm ,wk.seikyu_ymd ,wk.nyukin_yotei_ymd ,wk.shime_dd ,wk.pay_m ,wk.pay_d ,wk.biko1 ,wk.tan_cd ,wk.tori_cond ,wk.zei_calc_kbn ,wk.keisyo ,wk.tok_rnm ,coalesce(sum(wk.zen_seikyu_zan),0) as zen_seikyu_zan ,coalesce(sum(wk.nyukin_gaku),0) as nyukin_gaku ,coalesce(sum(wk.kurikoshi_gaku),0) as kurikoshi_gaku ,coalesce(sum(wk.zeinuki_gaku),0) as zeinuki_gaku ,coalesce(sum(wk.zei_gaku),0) as zei_gaku ,coalesce(sum(wk.zeikomi_gaku),0) as zeikomi_gaku ,coalesce(sum(wk.seikyu_zan),0) as seikyu_zan ,coalesce(sum(wk.genkin),0) as genkin ,coalesce(sum(wk.kogitte),0) as kogitte ,coalesce(sum(wk.furikomi),0) as furikomi ,coalesce(sum(wk.tesuryo),0) as tesuryo ,coalesce(sum(wk.tegata),0) as tegata ,coalesce(sum(wk.sousai),0) as sousai ,coalesce(sum(wk.sonota),0) as sonota ,COALESCE(sum(wk.total_gaku),0) as total_gaku from( select --現金売上 --'1' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, t.nyukin_gaku as genkin, 0 as kogitte, 0 as furikomi, t.tesuryo as tesuryo, 0 as tegata, 0 as sousai, t.cyosei_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = 'genkin' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --入金(小切手) --'2' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, 0 as genkin, t.nyukin_gaku as kogitte, 0 as furikomi, t.tesuryo as tesuryo, 0 as tegata, 0 as sousai, t.cyosei_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = 'kogitte' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --入金(振込) --'3' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, 0 as genkin, 0 as kogitte, t.nyukin_gaku as furikomi, t.tesuryo as tesuryo, 0 as tegata, 0 as sousai, t.cyosei_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = 'furikomi' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --振込手数料 --'4' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, 0 as genkin, 0 as kogitte, 0 as furikomi, t.total_gaku as tesuryo, 0 as tegata, 0 as sousai, t.cyosei_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = 'tesuryo' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --入金(手形) --'5' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, 0 as genkin, 0 as kogitte, 0 as furikomi, t.tesuryo as tesuryo, t.nyukin_gaku as tegata, 0 as sousai, t.cyosei_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = 'tegata' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --相殺 --'6' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, 0 as genkin, 0 as kogitte, 0 as furikomi, t.tesuryo as tesuryo, 0 as tegata, t.nyukin_gaku as sousai, t.cyosei_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = 'sousai' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --その他 --'7' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, 0 as zen_seikyu_zan, 0 as nyukin_gaku, 0 as genkin, 0 as kogitte, 0 as furikomi, 0 as tesuryo, 0 as tegata, 0 as sousai, t.total_gaku as sonota, t.total_gaku as total_gaku, 0 as kurikoshi_gaku, 0 as zeinuki_gaku, 0 as zei_gaku, 0 as zeikomi_gaku, 0 as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) --#18001 2021.02.17 MOD STT --left join t_nyukin t on (t.tok_cd = v.tok_cd) left join v_nyukin t on (t.tok_cd = v.tok_cd) --#18001 2021.02.17 MOD END left join m_hanyo h13 on (h13.mst_kbn = '13' and h13.han_cd = t.nyukin_kbn) where 1=1 and v.del_flg= 0 and h13.koumoku1 = '' and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and ((v.seikyu_ymd >= coalesce(t.nyukin_ymd,'yyyymmdd')) and (v.zen_seikyu_ymd < coalesce(t.nyukin_ymd,'yyyymmdd'))) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END union all select --'8' as kbn, '請求一覧' as report_nm, v.tok_cd as tok_cd, to_char(to_date(v.zen_seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as zen_seikyu_ymd, to_char(to_date(v.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd, v.zen_seikyu_zan as zen_seikyu_zan, v.nyukin_gaku as nyukin_gaku, 0 as genkin, 0 as kogitte, 0 as furikomi, 0 as tesuryo, 0 as tegata, 0 as sousai, 0 as sonota, 0 as total_gaku, v.kurikoshi_gaku as kurikoshi_gaku, v.zeinuki_gaku as zeinuki_gaku, v.zei_gaku as zei_gaku, v.zeikomi_gaku as zeikomi_gaku, v.seikyu_zan as seikyu_zan, to_char(to_date(v.nyukin_yotei_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as nyukin_yotei_ymd, --#19607 2021.06.23 MOD STT -- mt.tok_nm as tok_nm, (case when(mt.tok_rnm != '')then(mt.tok_rnm)else(mt.tok_nm)end) as tok_nm, --#19607 2021.06.23 MOD END mt.shime_dd, mt.pay_m, mt.pay_d, mt.biko1, mt.tan_cd, mt.tori_cond, mt.zei_calc_kbn, mt.keisyo, mt.tok_rnm from t_urikake v inner join m_tokui mt on (v.tok_cd = mt.tok_cd) left join m_tanto tn on (tn.tan_cd = mt.tan_cd) where 1=1 and v.del_flg= 0 and (('' = '&2') or (tn.bu_cd = '&2')) and (('' = '&4') or (mt.cat_cd = '&4')) and (('1' = '&30') or (v.seikyu_zan <> 0)) and (('' = '&24') or (tn.tan_cd >= '&24')) and (('' = '&25') or (tn.tan_cd <= '&25')) and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) --and (('' = '&20') or (mt.tok_cd >= '&20')) and (('' = '&21') or (mt.tok_cd <= '&21')) and (('' = '&16') or (v.seikyu_ymd >= '&16')) and (('' = '&17') or (v.seikyu_ymd <= '&17')) and (('' = '&42') or (mt.eig_cd = '&42')) --#19816 2021.07.06 MOD STT and (('' = '&31') or (cast(mt.shime_dd as varchar) = '&31')) --#19816 2021.07.06 MOD END ) wk group by wk.tok_cd,wk.tok_nm,wk.seikyu_ymd,wk.nyukin_yotei_ymd,wk.shime_dd,wk.pay_m,wk.pay_d,wk.biko1,wk.tan_cd,wk.tori_cond,wk.zei_calc_kbn,wk.keisyo,wk.tok_rnm order by wk.seikyu_ymd,wk.tok_cd