[getSeikyuYmd] select fnc_get_seikyu_ymd(':taisyo_ym', :shime_dd) as seikyu_ymd [load_grdList] select distinct t.seikyu_ymd, fnc_get_shime_dd(t.seikyu_ymd) as shime_dd from t_kaikake t left join m_sir ms on (ms.sir_cd = t.sir_cd) where 1 = 1 and ((':eig_cd' = '') or (ms.eig_cd = ':eig_cd')) order by seikyu_ymd desc [load_grdList2] select t.sir_cd , t.seikyu_ymd , t.zen_seikyu_ymd , t.zen_seikyu_zan , t.syukin_gaku , t.kurikoshi_gaku , t.zeinuki_gaku , t.zei_gaku , t.zeikomi_gaku , t.seikyu_zan , t.den_cnt , t.syukin_yotei_ymd , m1.sir_nm , (case when(t.print_time is not null)then(to_char(t.print_time,'yyyymmdd'))else(null)end) as print_ymd , 1 as checkbox , m1.tori_cond from t_kaikake t left join m_sir m1 on (m1.sir_cd = t.sir_cd) where 1 = 1 and t.seikyu_ymd = ':seikyu_ymd' and ((':chk_zero' = '1') or (t.seikyu_zan != 0)) and ((':sir_cd' = '') or (t.sir_cd = ':sir_cd')) and ((':eig_cd' = '') or (m1.eig_cd = ':eig_cd')) union all select m1.sir_cd , null --seikyu_ymd , m1.seikyu_ymd --zen_seikyu_ymd , t2.seikyu_zan --zen_seikyu_zan , null --syukin_gaku , null --kurikoshi_gaku , null --zeinuki_gaku , null --zei_gaku , null --zeikomi_gaku , null --seikyu_zan , null --den_cnt , t2.syukin_yotei_ymd , m1.sir_nm , null --print_ymd , 1 as checkbox , m1.tori_cond from m_sir m1 left join t_kaikake t1 on (t1.sir_cd = m1.sir_cd and t1.seikyu_ymd = ':seikyu_ymd') left join t_kaikake t2 on (t2.sir_cd = m1.sir_cd and t2.seikyu_ymd = m1.seikyu_ymd) where 1 = 1 --and ((':chk_zero' = '1') or (1 = 0)) and t1.seikyu_ymd is null and m1.tori_kbn = '1' and m1.shime_dd = fnc_get_shime_dd(':seikyu_ymd') --#22859 2022.04.05 MOD STT and ((COALESCE(m1.sei_cd,'') = '') or (m1.sei_cd = m1.sir_cd)) --#22859 2022.04.05 MOD END and ((':sir_cd' = '') or (m1.sir_cd = ':sir_cd')) and ((':eig_cd' = '') or (m1.eig_cd = ':eig_cd')) --#21788 2022.06.22 MOD STT union all select m1.sir_cd , null --seikyu_ymd , m1.seikyu_ymd --zen_seikyu_ymd , t2.seikyu_zan --zen_seikyu_zan , null --syukin_gaku , null --kurikoshi_gaku , null --zeinuki_gaku , null --zei_gaku , null --zeikomi_gaku , null --seikyu_zan , null --den_cnt , t2.syukin_yotei_ymd , m1.sir_nm , null --print_ymd , 1 as checkbox , m1.tori_cond from m_sir m1 left join t_kaikake t1 on (t1.sir_cd = m1.sir_cd and t1.seikyu_ymd = ':seikyu_ymd') left join t_kaikake t2 on (t2.sir_cd = m1.sir_cd and t2.seikyu_ymd = m1.seikyu_ymd) where 1 = 1 and t1.seikyu_ymd is null and m1.tori_kbn = '1' and m1.shime_dd2 = fnc_get_shime_dd(':seikyu_ymd') and ((COALESCE(m1.sei_cd,'') = '') or (m1.sei_cd = m1.sir_cd)) and ((':sir_cd' = '') or (m1.sir_cd = ':sir_cd')) and ((':eig_cd' = '') or (m1.eig_cd = ':eig_cd')) union all select m1.sir_cd , null --seikyu_ymd , m1.seikyu_ymd --zen_seikyu_ymd , t2.seikyu_zan --zen_seikyu_zan , null --syukin_gaku , null --kurikoshi_gaku , null --zeinuki_gaku , null --zei_gaku , null --zeikomi_gaku , null --seikyu_zan , null --den_cnt , t2.syukin_yotei_ymd , m1.sir_nm , null --print_ymd , 1 as checkbox , m1.tori_cond from m_sir m1 left join t_kaikake t1 on (t1.sir_cd = m1.sir_cd and t1.seikyu_ymd = ':seikyu_ymd') left join t_kaikake t2 on (t2.sir_cd = m1.sir_cd and t2.seikyu_ymd = m1.seikyu_ymd) where 1 = 1 and t1.seikyu_ymd is null and m1.tori_kbn = '1' and m1.shime_dd3 = fnc_get_shime_dd(':seikyu_ymd') and ((COALESCE(m1.sei_cd,'') = '') or (m1.sei_cd = m1.sir_cd)) and ((':sir_cd' = '') or (m1.sir_cd = ':sir_cd')) and ((':eig_cd' = '') or (m1.eig_cd = ':eig_cd')) --#21788 2022.06.22 MOD END order by sir_cd [doUpdate] select fnc_update_basv0800(:s_id, ':taisyo_ym', :shime_dd, ':login_id') [cancelSeikyu] select fnc_cancel_kaikake(':sir_cd', ':seikyu_ymd', ':login_id') [deleteSeikyuWork] DELETE FROM w_basv0810 WHERE 1=1 AND s_id = :s_id [insertSeikyuWork] INSERT INTO w_basv0810( s_id ,sir_cd ,zen_seikyu_ymd ,seikyu_ymd ,seikyu_no ,del_flg ,cre_id ,cre_time ,upd_id ,upd_time ) SELECT :s_id ,w.sir_cd ,(select max(t.seikyu_ymd) from t_kaikake t where t.sir_cd = w.sir_cd and t.seikyu_ymd < w.seikyu_ymd) --zen_seikyu_ymd ,w.seikyu_ymd ,null --seikyu_no ,0 ,':login_id' ,now() ,':login_id' ,now() FROM ( SELECT cast(':sir_cd' as varchar) as sir_cd ,fnc_get_seikyu_ymd(':taisyo_ym', :shime_dd) as seikyu_ymd ) w [__delete_wk] delete from w_basr0030 where 1=1 and s_id = :s_id [__insert_wk] insert into w_basr0030(s_id, seikyu_ymd, sir_cd, del_flg, cre_id, cre_time, upd_id, upd_time) values(:s_id, ':seikyu_ymd', ':sir_cd', 0, ':login_id', now(), ':login_id', now()) [updatePrint] update t_kaikake set print_time = now() where (sir_cd, seikyu_ymd) in (select sir_cd, seikyu_ymd from w_basr0030 where s_id = :s_id)