------------------------------------------------------------------------------------- [Success]2021/10/17 20:10:35 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:10:38 select 'TEL:' || j_tel as j_tel_s ,'FAX:' || j_fax as j_fax_s ,(case j_url when '' then '' else 'URL:' || j_url end) as j_url_s ,(case j_daihyo when '' then '' else '担当者:' || j_daihyo end) as j_daihyo_s ,(case j_email when '' then '' else 'EMAIL:' ||j_email end) as j_email_s ,w.* ,(case when('' != '')then('')else( (case('1')when('1')then('納品書')when('')then('請求書')else('納品書')end) )end) as report_title from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_daihyo ,j.koumoku8 as j_email ,j.sort_key as sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case when coalesce(m1.koumoku1,'') = '' then '' else coalesce(m1.koumoku1,'') end as mongon1 ,case when coalesce(m1.koumoku2,'') = '' then '' else coalesce(m1.koumoku2,'') end as mongon2 ,case when coalesce(m1.koumoku3,'') = '' then '' else coalesce(m1.koumoku3,'') end as mongon3 ,case when coalesce(m1.koumoku4,'') = '' then '' else coalesce(m1.koumoku4,'') end as mongon4 ,case when coalesce(m1.koumoku5,'') = '' then '' else coalesce(m1.koumoku5,'') end as mongon5 , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as uri_tokadr_kbn , case when coalesce(sp1.han_name,'') = '1' then coalesce(sp1.han_name,'') else '0' end as tok_cd_FLG , case when coalesce(sp2.han_name,'') = '1' then coalesce(sp2.han_name,'') else '0' end as hin_cd_FLG , rev.koumoku2 as rev , (case when(h98a.han_name != '')then(h98a.han_name)else('発行日')end)||':' as syori_ymd_label , (case when(h98b.han_name != '')then(h98b.han_name)else('管理番号')end)||':' as den_no_label , (case when(h98c.han_name != '')then(h98c.han_name)else('定価')end) as htanka_label , (case when(h99a.han_name != '')then(cast(h99a.han_name as int))else(0)end) as uri_tn_dec from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo m1 on (m1.mst_kbn = '90' and m1.han_cd = '') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-tokadr') left join m_hanyo sp1 on (sp1.mst_kbn='99' and sp1.han_cd='sp-r0020-1') left join m_hanyo sp2 on (sp2.mst_kbn='99' and sp2.han_cd='sp-r0020-2') left join t_uri t on (t.den_no = fnc_to_number('1558158')) left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo rev on (rev.mst_kbn = '99' and rev.han_cd = 'tok-disc') left join m_hanyo h98a on (h98a.mst_kbn = '98' and h98a.han_cd = 'r0023-symd') left join m_hanyo h98b on (h98b.mst_kbn = '98' and h98b.han_cd = 'r0023-denn') left join m_hanyo h98c on (h98c.mst_kbn = '98' and h98c.han_cd = 'r0023-htan') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-tn-dec') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and t.eig_cd != '')then('_' || t.eig_cd)else('')end) )w ------------------------------------------------------------------------------------- [Error]2021/10/17 20:10:38 ERROR: 42601: syntax error at or near "=" select '請求明細書' as tait ,uh.den_no , uh.eigyou_tan_cd , (case when(h99d.han_name = '1')then('')else('担当:' || tan.tan_nm)end) as eigyou_tan_nm_s ,(case when(h99a.han_name = '1')then(um.rel_row_no)else(1+um.row_no)end) as row_no ,to_char(to_date(uh.input_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as input_ymd ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd ,uh.zeinuki_gaku ,uh.zei_gaku ,uh.zeikomi_gaku ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(um.hin_cd)end) as hin_cd ,replace(um.hin_nm,chr(10),'')as hin_nm ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(case when(uh.jucyu_flg = 1)then(um.jucyu_su)else(um.suryo)end)end) as suryo ,(case when('' = um.hin_cd or '0' = '1')then(null)else(um.tanka)end) as tanka ,(case when('' = um.hin_cd or '1' = '1')then(null)else(um.htanka)end) as htanka ,(case when('' = um.hin_cd or um.set_row_no is not null or '0' = '1')then(null)else(um.kingaku)end) as kingaku ,(case when('' = um.hin_cd or '1' = '1' or coalesce(um.disc_per,0) = 0)then(null)else(case when(h99c.koumoku2 = 'rev')then(100 - coalesce(um.disc_per,0))else(coalesce(um.disc_per,0))end)end) as disc_per ,COALESCE(um.hin_nm_ext,'')||COALESCE(um.meisai_biko,'')||(case when('1' != '1' and h99e.han_name = '1' and um.htanka != 0 and COALESCE(um.zei_kbn,0) = 0)then('税込定価 '||to_char(um.htanka + fnc_get_zei(um.htanka,uh.syori_ymd),'FM999,999,990'))else('')end) as meisai_biko ,(case when('0' = '1')then(mh.loc_no)else('')end) as loc_no ,uh.nonyu_no , uh.nonyu_nm || (case when(uh.nonyu_tan != '')then(' '||uh.nonyu_tan)else('')end)||' '||fnc_get_keisyo(uh.nonyu_nm, uh.nonyu_tan, '') as nonyu_nm , uh.tok_nm || (case when(uh.tok_tan != '')then(' '||uh.tok_tan)else('')end)||' '||fnc_get_keisyo(uh.tok_nm, uh.tok_tan, uh.keisyo) as tok_nm , (case when(t.hojin_nm != '' and '1' = '')then(t.hojin_nm)else( uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo) )end) as tok_nm_s , (case when(t.hojin_nm != '' and '1' = '')then(uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo))else( (case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end) )end) as tok_tan , (case when(t.hojin_nm != '' and '1' = '')then((case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end))else( '' )end) as tok_nm_add , case when = '1' then ( case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) else '' end as zip_no , case when = '1' then uh.nonyu_addr1 else '' end as addr1 , case when = '1' then uh.nonyu_addr2 else '' end as addr2 , case when = '1' then uh.nonyu_addr3 else '' end as addr3 , case when = '1' then uh.nonyu_addr4 else '' end as addr4 , case when = '1' then coalesce(uh.nonyu_tel_no,'') else '' end as nonyu_tel , case when = '1' then coalesce(uh.nonyu_fax_no,'') else '' end as nonyu_fax , fnc_get_report_multiline(uh.payment_term) as tori_cond , replace(replace(uh.biko1,chr(13)||chr(10),chr(10)),chr(10),chr(13)||chr(10)) as biko1 , trunc(um.row_no / 15) as page_no , mh.tani , (case when(h99f.han_name = '1')then( select '合計数量 '||to_char(sum(um_kei.suryo),'FM999,990') from t_uri_m um_kei where um_kei.den_no = uh.den_no and '' != um_kei.hin_cd )else('')end) as suryo_kei_view , case when = '0' then 'お客様コード:'||coalesce(uh.tok_cd,'') else '' end as tok_cd , case when = '1' then (case uh.tok_zip_no when '' then '' else '〒'||left(uh.tok_zip_no,3)||'-'||right(uh.tok_zip_no,4) end) else (case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) end as tok_zip_no , case when = '1' then uh.tok_addr1 else uh.nonyu_addr1 end as tok_addr1 , case when = '1' then uh.tok_addr2 else uh.nonyu_addr2 end as tok_addr2 , case when = '1' then uh.tok_addr3 else uh.nonyu_addr3 end as tok_addr3 , case when = '1' then uh.tok_addr4 else uh.nonyu_addr4 end as tok_addr4 , case when = '1' then coalesce(uh.tok_tel_no,'') else coalesce(uh.nonyu_tel_no,'') end as tok_tel , case when = '1' then coalesce(uh.tok_fax_no,'') else coalesce(uh.nonyu_fax_no,'') end as tok_fax ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_email ,'TEL:' || j.koumoku5 as j_tel_s ,'FAX:' || j.koumoku6 as j_fax_s ,(case when j.koumoku7 != '' then 'URL:' || j.koumoku7 else '' end) as j_url_s ,(case when j.koumoku8 != '' then 'EMAIL:' || j.koumoku8 else '' end) as j_email_s ,uh.eig_cd ,(case when(h99b.han_name = '1')then('お客様注文No:'||COALESCE(uh.tok_hacyu_no,''))else('')end) as tok_hacyu_no_h from t_uri uh left join m_tokui t on(uh.tok_cd = t.tok_cd) left join t_uri_m um on(uh.den_no = um.den_no) left join m_hin mh on (mh.hin_cd = um.hin_cd) left join m_hanyo h5 on (h5.mst_kbn = '98' and h5.han_cd = 'r-nonyunm') left join m_tanto tan on (uh.eigyou_tan_cd = tan.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-relrow') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'aith-r0023') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'tok-disc' and h99c.han_name = '1') left join m_hanyo h99d on (h99d.mst_kbn = '99' and h99d.han_cd = 'heta-r0023') left join m_hanyo h99e on (h99e.mst_kbn = '99' and h99e.han_cd = 'sp-r0023-1') left join m_hanyo h99f on (h99f.mst_kbn = '99' and h99f.han_cd = 'sttl-r0023') left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo j on (j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and uh.eig_cd != '')then('_' || uh.eig_cd)else('')end)) where 1 = 1 and uh.del_flg = 0 and uh.jucyu_flg = 0 and COALESCE(uh.via_seq,0) = 0 and ((uh.syori_ymd >= '') or ('' = '')) and ((uh.syori_ymd <= '') or ('' = '')) and ((uh.input_ymd >= '') or ('' = '')) and ((uh.input_ymd <= '') or ('' = '')) and ((uh.den_no = fnc_to_number('1558158')) or ('' = '1558158')) and ((uh.tok_cd = '') or ('' = '')) and ((um.hin_nm like '%%') or ('' = '')) and (('' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('')) )) and ((uh.eig_cd = '') or ('' = '')) order by uh.den_no,um.row_no ------------------------------------------------------------------------------------- [Success]2021/10/17 20:13:06 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:13:08 select 'TEL:' || j_tel as j_tel_s ,'FAX:' || j_fax as j_fax_s ,(case j_url when '' then '' else 'URL:' || j_url end) as j_url_s ,(case j_daihyo when '' then '' else '担当者:' || j_daihyo end) as j_daihyo_s ,(case j_email when '' then '' else 'EMAIL:' ||j_email end) as j_email_s ,w.* ,(case when('' != '')then('')else( (case('1')when('1')then('納品書')when('')then('請求書')else('納品書')end) )end) as report_title from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_daihyo ,j.koumoku8 as j_email ,j.sort_key as sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case when coalesce(m1.koumoku1,'') = '' then '' else coalesce(m1.koumoku1,'') end as mongon1 ,case when coalesce(m1.koumoku2,'') = '' then '' else coalesce(m1.koumoku2,'') end as mongon2 ,case when coalesce(m1.koumoku3,'') = '' then '' else coalesce(m1.koumoku3,'') end as mongon3 ,case when coalesce(m1.koumoku4,'') = '' then '' else coalesce(m1.koumoku4,'') end as mongon4 ,case when coalesce(m1.koumoku5,'') = '' then '' else coalesce(m1.koumoku5,'') end as mongon5 , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as uri_tokadr_kbn , case when coalesce(sp1.han_name,'') = '1' then coalesce(sp1.han_name,'') else '0' end as tok_cd_FLG , case when coalesce(sp2.han_name,'') = '1' then coalesce(sp2.han_name,'') else '0' end as hin_cd_FLG , rev.koumoku2 as rev , (case when(h98a.han_name != '')then(h98a.han_name)else('発行日')end)||':' as syori_ymd_label , (case when(h98b.han_name != '')then(h98b.han_name)else('管理番号')end)||':' as den_no_label , (case when(h98c.han_name != '')then(h98c.han_name)else('定価')end) as htanka_label , (case when(h99a.han_name != '')then(cast(h99a.han_name as int))else(0)end) as uri_tn_dec from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo m1 on (m1.mst_kbn = '90' and m1.han_cd = '') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-tokadr') left join m_hanyo sp1 on (sp1.mst_kbn='99' and sp1.han_cd='sp-r0020-1') left join m_hanyo sp2 on (sp2.mst_kbn='99' and sp2.han_cd='sp-r0020-2') left join t_uri t on (t.den_no = fnc_to_number('1558158')) left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo rev on (rev.mst_kbn = '99' and rev.han_cd = 'tok-disc') left join m_hanyo h98a on (h98a.mst_kbn = '98' and h98a.han_cd = 'r0023-symd') left join m_hanyo h98b on (h98b.mst_kbn = '98' and h98b.han_cd = 'r0023-denn') left join m_hanyo h98c on (h98c.mst_kbn = '98' and h98c.han_cd = 'r0023-htan') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-tn-dec') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and t.eig_cd != '')then('_' || t.eig_cd)else('')end) )w ------------------------------------------------------------------------------------- [Error]2021/10/17 20:13:08 ERROR: 42703: column t.hojin_nm does not exist select '請求明細書' as tait ,uh.den_no , uh.eigyou_tan_cd , (case when(h99d.han_name = '1')then('')else('担当:' || tan.tan_nm)end) as eigyou_tan_nm_s ,(case when(h99a.han_name = '1')then(um.rel_row_no)else(1+um.row_no)end) as row_no ,to_char(to_date(uh.input_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as input_ymd ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd ,uh.zeinuki_gaku ,uh.zei_gaku ,uh.zeikomi_gaku ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(um.hin_cd)end) as hin_cd ,replace(um.hin_nm,chr(10),'')as hin_nm ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(case when(uh.jucyu_flg = 1)then(um.jucyu_su)else(um.suryo)end)end) as suryo ,(case when('' = um.hin_cd or '0' = '1')then(null)else(um.tanka)end) as tanka ,(case when('' = um.hin_cd or '1' = '1')then(null)else(um.htanka)end) as htanka ,(case when('' = um.hin_cd or um.set_row_no is not null or '0' = '1')then(null)else(um.kingaku)end) as kingaku ,(case when('' = um.hin_cd or '1' = '1' or coalesce(um.disc_per,0) = 0)then(null)else(case when(h99c.koumoku2 = 'rev')then(100 - coalesce(um.disc_per,0))else(coalesce(um.disc_per,0))end)end) as disc_per ,COALESCE(um.hin_nm_ext,'')||COALESCE(um.meisai_biko,'')||(case when('1' != '1' and h99e.han_name = '1' and um.htanka != 0 and COALESCE(um.zei_kbn,0) = 0)then('税込定価 '||to_char(um.htanka + fnc_get_zei(um.htanka,uh.syori_ymd),'FM999,999,990'))else('')end) as meisai_biko ,(case when('0' = '1')then(mh.loc_no)else('')end) as loc_no ,uh.nonyu_no , uh.nonyu_nm || (case when(uh.nonyu_tan != '')then(' '||uh.nonyu_tan)else('')end)||' '||fnc_get_keisyo(uh.nonyu_nm, uh.nonyu_tan, '') as nonyu_nm , uh.tok_nm || (case when(uh.tok_tan != '')then(' '||uh.tok_tan)else('')end)||' '||fnc_get_keisyo(uh.tok_nm, uh.tok_tan, uh.keisyo) as tok_nm , (case when(t.hojin_nm != '' and '1' = '')then(t.hojin_nm)else( uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo) )end) as tok_nm_s , (case when(t.hojin_nm != '' and '1' = '')then(uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo))else( (case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end) )end) as tok_tan , (case when(t.hojin_nm != '' and '1' = '')then((case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end))else( '' )end) as tok_nm_add , case when 1 = '1' then ( case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) else '' end as zip_no , case when 1 = '1' then uh.nonyu_addr1 else '' end as addr1 , case when 1 = '1' then uh.nonyu_addr2 else '' end as addr2 , case when 1 = '1' then uh.nonyu_addr3 else '' end as addr3 , case when 1 = '1' then uh.nonyu_addr4 else '' end as addr4 , case when 1 = '1' then coalesce(uh.nonyu_tel_no,'') else '' end as nonyu_tel , case when 1 = '1' then coalesce(uh.nonyu_fax_no,'') else '' end as nonyu_fax , fnc_get_report_multiline(uh.payment_term) as tori_cond , replace(replace(uh.biko1,chr(13)||chr(10),chr(10)),chr(10),chr(13)||chr(10)) as biko1 , trunc(um.row_no / 15) as page_no , mh.tani , (case when(h99f.han_name = '1')then( select '合計数量 '||to_char(sum(um_kei.suryo),'FM999,990') from t_uri_m um_kei where um_kei.den_no = uh.den_no and '' != um_kei.hin_cd )else('')end) as suryo_kei_view , case when 0 = '0' then 'お客様コード:'||coalesce(uh.tok_cd,'') else '' end as tok_cd , case when 1 = '1' then (case uh.tok_zip_no when '' then '' else '〒'||left(uh.tok_zip_no,3)||'-'||right(uh.tok_zip_no,4) end) else (case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) end as tok_zip_no , case when 1 = '1' then uh.tok_addr1 else uh.nonyu_addr1 end as tok_addr1 , case when 1 = '1' then uh.tok_addr2 else uh.nonyu_addr2 end as tok_addr2 , case when 1 = '1' then uh.tok_addr3 else uh.nonyu_addr3 end as tok_addr3 , case when 1 = '1' then uh.tok_addr4 else uh.nonyu_addr4 end as tok_addr4 , case when 1 = '1' then coalesce(uh.tok_tel_no,'') else coalesce(uh.nonyu_tel_no,'') end as tok_tel , case when 1 = '1' then coalesce(uh.tok_fax_no,'') else coalesce(uh.nonyu_fax_no,'') end as tok_fax ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_email ,'TEL:' || j.koumoku5 as j_tel_s ,'FAX:' || j.koumoku6 as j_fax_s ,(case when j.koumoku7 != '' then 'URL:' || j.koumoku7 else '' end) as j_url_s ,(case when j.koumoku8 != '' then 'EMAIL:' || j.koumoku8 else '' end) as j_email_s ,uh.eig_cd ,(case when(h99b.han_name = '1')then('お客様注文No:'||COALESCE(uh.tok_hacyu_no,''))else('')end) as tok_hacyu_no_h from t_uri uh left join m_tokui t on(uh.tok_cd = t.tok_cd) left join t_uri_m um on(uh.den_no = um.den_no) left join m_hin mh on (mh.hin_cd = um.hin_cd) left join m_hanyo h5 on (h5.mst_kbn = '98' and h5.han_cd = 'r-nonyunm') left join m_tanto tan on (uh.eigyou_tan_cd = tan.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-relrow') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'aith-r0023') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'tok-disc' and h99c.han_name = '1') left join m_hanyo h99d on (h99d.mst_kbn = '99' and h99d.han_cd = 'heta-r0023') left join m_hanyo h99e on (h99e.mst_kbn = '99' and h99e.han_cd = 'sp-r0023-1') left join m_hanyo h99f on (h99f.mst_kbn = '99' and h99f.han_cd = 'sttl-r0023') left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo j on (j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and uh.eig_cd != '')then('_' || uh.eig_cd)else('')end)) where 1 = 1 and uh.del_flg = 0 and uh.jucyu_flg = 0 and COALESCE(uh.via_seq,0) = 0 and ((uh.syori_ymd >= '') or ('' = '')) and ((uh.syori_ymd <= '') or ('' = '')) and ((uh.input_ymd >= '') or ('' = '')) and ((uh.input_ymd <= '') or ('' = '')) and ((uh.den_no = fnc_to_number('1558158')) or ('' = '1558158')) and ((uh.tok_cd = '') or ('' = '')) and ((um.hin_nm like '%%') or ('' = '')) and (('' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('')) )) and ((uh.eig_cd = '') or ('' = '')) order by uh.den_no,um.row_no ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:21 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:23 select 'TEL:' || j_tel as j_tel_s ,'FAX:' || j_fax as j_fax_s ,(case j_url when '' then '' else 'URL:' || j_url end) as j_url_s ,(case j_daihyo when '' then '' else '担当者:' || j_daihyo end) as j_daihyo_s ,(case j_email when '' then '' else 'EMAIL:' ||j_email end) as j_email_s ,w.* ,(case when('' != '')then('')else( (case('1')when('1')then('納品書')when('')then('請求書')else('納品書')end) )end) as report_title from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_daihyo ,j.koumoku8 as j_email ,j.sort_key as sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case when coalesce(m1.koumoku1,'') = '' then '' else coalesce(m1.koumoku1,'') end as mongon1 ,case when coalesce(m1.koumoku2,'') = '' then '' else coalesce(m1.koumoku2,'') end as mongon2 ,case when coalesce(m1.koumoku3,'') = '' then '' else coalesce(m1.koumoku3,'') end as mongon3 ,case when coalesce(m1.koumoku4,'') = '' then '' else coalesce(m1.koumoku4,'') end as mongon4 ,case when coalesce(m1.koumoku5,'') = '' then '' else coalesce(m1.koumoku5,'') end as mongon5 , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as uri_tokadr_kbn , case when coalesce(sp1.han_name,'') = '1' then coalesce(sp1.han_name,'') else '0' end as tok_cd_FLG , case when coalesce(sp2.han_name,'') = '1' then coalesce(sp2.han_name,'') else '0' end as hin_cd_FLG , rev.koumoku2 as rev , (case when(h98a.han_name != '')then(h98a.han_name)else('発行日')end)||':' as syori_ymd_label , (case when(h98b.han_name != '')then(h98b.han_name)else('管理番号')end)||':' as den_no_label , (case when(h98c.han_name != '')then(h98c.han_name)else('定価')end) as htanka_label , (case when(h99a.han_name != '')then(cast(h99a.han_name as int))else(0)end) as uri_tn_dec from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo m1 on (m1.mst_kbn = '90' and m1.han_cd = '') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-tokadr') left join m_hanyo sp1 on (sp1.mst_kbn='99' and sp1.han_cd='sp-r0020-1') left join m_hanyo sp2 on (sp2.mst_kbn='99' and sp2.han_cd='sp-r0020-2') left join t_uri t on (t.den_no = fnc_to_number('1558158')) left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo rev on (rev.mst_kbn = '99' and rev.han_cd = 'tok-disc') left join m_hanyo h98a on (h98a.mst_kbn = '98' and h98a.han_cd = 'r0023-symd') left join m_hanyo h98b on (h98b.mst_kbn = '98' and h98b.han_cd = 'r0023-denn') left join m_hanyo h98c on (h98c.mst_kbn = '98' and h98c.han_cd = 'r0023-htan') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-tn-dec') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and t.eig_cd != '')then('_' || t.eig_cd)else('')end) )w ------------------------------------------------------------------------------------- [Error]2021/10/17 20:14:23 ERROR: 42883: function fnc_get_report_multiline(character varying) does not exist select '請求明細書' as tait ,uh.den_no , uh.eigyou_tan_cd , (case when(h99d.han_name = '1')then('')else('担当:' || tan.tan_nm)end) as eigyou_tan_nm_s ,(case when(h99a.han_name = '1')then(um.rel_row_no)else(1+um.row_no)end) as row_no ,to_char(to_date(uh.input_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as input_ymd ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd ,uh.zeinuki_gaku ,uh.zei_gaku ,uh.zeikomi_gaku ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(um.hin_cd)end) as hin_cd ,replace(um.hin_nm,chr(10),'')as hin_nm ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(case when(uh.jucyu_flg = 1)then(um.jucyu_su)else(um.suryo)end)end) as suryo ,(case when('' = um.hin_cd or '0' = '1')then(null)else(um.tanka)end) as tanka ,(case when('' = um.hin_cd or '1' = '1')then(null)else(um.htanka)end) as htanka ,(case when('' = um.hin_cd or um.set_row_no is not null or '0' = '1')then(null)else(um.kingaku)end) as kingaku ,(case when('' = um.hin_cd or '1' = '1' or coalesce(um.disc_per,0) = 0)then(null)else(case when(h99c.koumoku2 = 'rev')then(100 - coalesce(um.disc_per,0))else(coalesce(um.disc_per,0))end)end) as disc_per ,COALESCE(um.hin_nm_ext,'')||COALESCE(um.meisai_biko,'')||(case when('1' != '1' and h99e.han_name = '1' and um.htanka != 0 and COALESCE(um.zei_kbn,0) = 0)then('税込定価 '||to_char(um.htanka + fnc_get_zei(um.htanka,uh.syori_ymd),'FM999,999,990'))else('')end) as meisai_biko ,(case when('0' = '1')then(mh.loc_no)else('')end) as loc_no ,uh.nonyu_no , uh.nonyu_nm || (case when(uh.nonyu_tan != '')then(' '||uh.nonyu_tan)else('')end)||' '||fnc_get_keisyo(uh.nonyu_nm, uh.nonyu_tan, '') as nonyu_nm , uh.tok_nm || (case when(uh.tok_tan != '')then(' '||uh.tok_tan)else('')end)||' '||fnc_get_keisyo(uh.tok_nm, uh.tok_tan, uh.keisyo) as tok_nm , (case when(t.hojin_nm != '' and '1' = '')then(t.hojin_nm)else( uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo) )end) as tok_nm_s , (case when(t.hojin_nm != '' and '1' = '')then(uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo))else( (case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end) )end) as tok_tan , (case when(t.hojin_nm != '' and '1' = '')then((case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end))else( '' )end) as tok_nm_add , case when 1 = '1' then ( case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) else '' end as zip_no , case when 1 = '1' then uh.nonyu_addr1 else '' end as addr1 , case when 1 = '1' then uh.nonyu_addr2 else '' end as addr2 , case when 1 = '1' then uh.nonyu_addr3 else '' end as addr3 , case when 1 = '1' then uh.nonyu_addr4 else '' end as addr4 , case when 1 = '1' then coalesce(uh.nonyu_tel_no,'') else '' end as nonyu_tel , case when 1 = '1' then coalesce(uh.nonyu_fax_no,'') else '' end as nonyu_fax , fnc_get_report_multiline(uh.payment_term) as tori_cond , replace(replace(uh.biko1,chr(13)||chr(10),chr(10)),chr(10),chr(13)||chr(10)) as biko1 , trunc(um.row_no / 15) as page_no , mh.tani , (case when(h99f.han_name = '1')then( select '合計数量 '||to_char(sum(um_kei.suryo),'FM999,990') from t_uri_m um_kei where um_kei.den_no = uh.den_no and '' != um_kei.hin_cd )else('')end) as suryo_kei_view , case when 0 = '0' then 'お客様コード:'||coalesce(uh.tok_cd,'') else '' end as tok_cd , case when 1 = '1' then (case uh.tok_zip_no when '' then '' else '〒'||left(uh.tok_zip_no,3)||'-'||right(uh.tok_zip_no,4) end) else (case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) end as tok_zip_no , case when 1 = '1' then uh.tok_addr1 else uh.nonyu_addr1 end as tok_addr1 , case when 1 = '1' then uh.tok_addr2 else uh.nonyu_addr2 end as tok_addr2 , case when 1 = '1' then uh.tok_addr3 else uh.nonyu_addr3 end as tok_addr3 , case when 1 = '1' then uh.tok_addr4 else uh.nonyu_addr4 end as tok_addr4 , case when 1 = '1' then coalesce(uh.tok_tel_no,'') else coalesce(uh.nonyu_tel_no,'') end as tok_tel , case when 1 = '1' then coalesce(uh.tok_fax_no,'') else coalesce(uh.nonyu_fax_no,'') end as tok_fax ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_email ,'TEL:' || j.koumoku5 as j_tel_s ,'FAX:' || j.koumoku6 as j_fax_s ,(case when j.koumoku7 != '' then 'URL:' || j.koumoku7 else '' end) as j_url_s ,(case when j.koumoku8 != '' then 'EMAIL:' || j.koumoku8 else '' end) as j_email_s ,uh.eig_cd ,(case when(h99b.han_name = '1')then('お客様注文No:'||COALESCE(uh.tok_hacyu_no,''))else('')end) as tok_hacyu_no_h from t_uri uh left join m_tokui t on(uh.tok_cd = t.tok_cd) left join t_uri_m um on(uh.den_no = um.den_no) left join m_hin mh on (mh.hin_cd = um.hin_cd) left join m_hanyo h5 on (h5.mst_kbn = '98' and h5.han_cd = 'r-nonyunm') left join m_tanto tan on (uh.eigyou_tan_cd = tan.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-relrow') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'aith-r0023') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'tok-disc' and h99c.han_name = '1') left join m_hanyo h99d on (h99d.mst_kbn = '99' and h99d.han_cd = 'heta-r0023') left join m_hanyo h99e on (h99e.mst_kbn = '99' and h99e.han_cd = 'sp-r0023-1') left join m_hanyo h99f on (h99f.mst_kbn = '99' and h99f.han_cd = 'sttl-r0023') left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo j on (j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and uh.eig_cd != '')then('_' || uh.eig_cd)else('')end)) where 1 = 1 and uh.del_flg = 0 and uh.jucyu_flg = 0 and COALESCE(uh.via_seq,0) = 0 and ((uh.syori_ymd >= '') or ('' = '')) and ((uh.syori_ymd <= '') or ('' = '')) and ((uh.input_ymd >= '') or ('' = '')) and ((uh.input_ymd <= '') or ('' = '')) and ((uh.den_no = fnc_to_number('1558158')) or ('' = '1558158')) and ((uh.tok_cd = '') or ('' = '')) and ((um.hin_nm like '%%') or ('' = '')) and (('' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('')) )) and ((uh.eig_cd = '') or ('' = '')) order by uh.den_no,um.row_no ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:40 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:41 select 'TEL:' || j_tel as j_tel_s ,'FAX:' || j_fax as j_fax_s ,(case j_url when '' then '' else 'URL:' || j_url end) as j_url_s ,(case j_daihyo when '' then '' else '担当者:' || j_daihyo end) as j_daihyo_s ,(case j_email when '' then '' else 'EMAIL:' ||j_email end) as j_email_s ,w.* ,(case when('' != '')then('')else( (case('1')when('1')then('納品書')when('')then('請求書')else('納品書')end) )end) as report_title from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_daihyo ,j.koumoku8 as j_email ,j.sort_key as sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case when coalesce(m1.koumoku1,'') = '' then '' else coalesce(m1.koumoku1,'') end as mongon1 ,case when coalesce(m1.koumoku2,'') = '' then '' else coalesce(m1.koumoku2,'') end as mongon2 ,case when coalesce(m1.koumoku3,'') = '' then '' else coalesce(m1.koumoku3,'') end as mongon3 ,case when coalesce(m1.koumoku4,'') = '' then '' else coalesce(m1.koumoku4,'') end as mongon4 ,case when coalesce(m1.koumoku5,'') = '' then '' else coalesce(m1.koumoku5,'') end as mongon5 , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as uri_tokadr_kbn , case when coalesce(sp1.han_name,'') = '1' then coalesce(sp1.han_name,'') else '0' end as tok_cd_FLG , case when coalesce(sp2.han_name,'') = '1' then coalesce(sp2.han_name,'') else '0' end as hin_cd_FLG , rev.koumoku2 as rev , (case when(h98a.han_name != '')then(h98a.han_name)else('発行日')end)||':' as syori_ymd_label , (case when(h98b.han_name != '')then(h98b.han_name)else('管理番号')end)||':' as den_no_label , (case when(h98c.han_name != '')then(h98c.han_name)else('定価')end) as htanka_label , (case when(h99a.han_name != '')then(cast(h99a.han_name as int))else(0)end) as uri_tn_dec from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo m1 on (m1.mst_kbn = '90' and m1.han_cd = '') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-tokadr') left join m_hanyo sp1 on (sp1.mst_kbn='99' and sp1.han_cd='sp-r0020-1') left join m_hanyo sp2 on (sp2.mst_kbn='99' and sp2.han_cd='sp-r0020-2') left join t_uri t on (t.den_no = fnc_to_number('1558158')) left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo rev on (rev.mst_kbn = '99' and rev.han_cd = 'tok-disc') left join m_hanyo h98a on (h98a.mst_kbn = '98' and h98a.han_cd = 'r0023-symd') left join m_hanyo h98b on (h98b.mst_kbn = '98' and h98b.han_cd = 'r0023-denn') left join m_hanyo h98c on (h98c.mst_kbn = '98' and h98c.han_cd = 'r0023-htan') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-tn-dec') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and t.eig_cd != '')then('_' || t.eig_cd)else('')end) )w ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:43 select '請求明細書' as tait ,uh.den_no , uh.eigyou_tan_cd , (case when(h99d.han_name = '1')then('')else('担当:' || tan.tan_nm)end) as eigyou_tan_nm_s ,(case when(h99a.han_name = '1')then(um.rel_row_no)else(1+um.row_no)end) as row_no ,to_char(to_date(uh.input_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as input_ymd ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd ,uh.zeinuki_gaku ,uh.zei_gaku ,uh.zeikomi_gaku ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(um.hin_cd)end) as hin_cd ,replace(um.hin_nm,chr(10),'')as hin_nm ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(case when(uh.jucyu_flg = 1)then(um.jucyu_su)else(um.suryo)end)end) as suryo ,(case when('' = um.hin_cd or '0' = '1')then(null)else(um.tanka)end) as tanka ,(case when('' = um.hin_cd or '1' = '1')then(null)else(um.htanka)end) as htanka ,(case when('' = um.hin_cd or um.set_row_no is not null or '0' = '1')then(null)else(um.kingaku)end) as kingaku ,(case when('' = um.hin_cd or '1' = '1' or coalesce(um.disc_per,0) = 0)then(null)else(case when(h99c.koumoku2 = 'rev')then(100 - coalesce(um.disc_per,0))else(coalesce(um.disc_per,0))end)end) as disc_per ,COALESCE(um.hin_nm_ext,'')||COALESCE(um.meisai_biko,'')||(case when('1' != '1' and h99e.han_name = '1' and um.htanka != 0 and COALESCE(um.zei_kbn,0) = 0)then('税込定価 '||to_char(um.htanka + fnc_get_zei(um.htanka,uh.syori_ymd),'FM999,999,990'))else('')end) as meisai_biko ,(case when('0' = '1')then(mh.loc_no)else('')end) as loc_no ,uh.nonyu_no , uh.nonyu_nm || (case when(uh.nonyu_tan != '')then(' '||uh.nonyu_tan)else('')end)||' '||fnc_get_keisyo(uh.nonyu_nm, uh.nonyu_tan, '') as nonyu_nm , uh.tok_nm || (case when(uh.tok_tan != '')then(' '||uh.tok_tan)else('')end)||' '||fnc_get_keisyo(uh.tok_nm, uh.tok_tan, uh.keisyo) as tok_nm , (case when(t.hojin_nm != '' and '1' = '')then(t.hojin_nm)else( uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo) )end) as tok_nm_s , (case when(t.hojin_nm != '' and '1' = '')then(uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo))else( (case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end) )end) as tok_tan , (case when(t.hojin_nm != '' and '1' = '')then((case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end))else( '' )end) as tok_nm_add , case when 1 = '1' then ( case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) else '' end as zip_no , case when 1 = '1' then uh.nonyu_addr1 else '' end as addr1 , case when 1 = '1' then uh.nonyu_addr2 else '' end as addr2 , case when 1 = '1' then uh.nonyu_addr3 else '' end as addr3 , case when 1 = '1' then uh.nonyu_addr4 else '' end as addr4 , case when 1 = '1' then coalesce(uh.nonyu_tel_no,'') else '' end as nonyu_tel , case when 1 = '1' then coalesce(uh.nonyu_fax_no,'') else '' end as nonyu_fax , fnc_get_report_multiline(uh.payment_term) as tori_cond , replace(replace(uh.biko1,chr(13)||chr(10),chr(10)),chr(10),chr(13)||chr(10)) as biko1 , trunc(um.row_no / 15) as page_no , mh.tani , (case when(h99f.han_name = '1')then( select '合計数量 '||to_char(sum(um_kei.suryo),'FM999,990') from t_uri_m um_kei where um_kei.den_no = uh.den_no and '' != um_kei.hin_cd )else('')end) as suryo_kei_view , case when 0 = '0' then 'お客様コード:'||coalesce(uh.tok_cd,'') else '' end as tok_cd , case when 1 = '1' then (case uh.tok_zip_no when '' then '' else '〒'||left(uh.tok_zip_no,3)||'-'||right(uh.tok_zip_no,4) end) else (case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) end as tok_zip_no , case when 1 = '1' then uh.tok_addr1 else uh.nonyu_addr1 end as tok_addr1 , case when 1 = '1' then uh.tok_addr2 else uh.nonyu_addr2 end as tok_addr2 , case when 1 = '1' then uh.tok_addr3 else uh.nonyu_addr3 end as tok_addr3 , case when 1 = '1' then uh.tok_addr4 else uh.nonyu_addr4 end as tok_addr4 , case when 1 = '1' then coalesce(uh.tok_tel_no,'') else coalesce(uh.nonyu_tel_no,'') end as tok_tel , case when 1 = '1' then coalesce(uh.tok_fax_no,'') else coalesce(uh.nonyu_fax_no,'') end as tok_fax ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_email ,'TEL:' || j.koumoku5 as j_tel_s ,'FAX:' || j.koumoku6 as j_fax_s ,(case when j.koumoku7 != '' then 'URL:' || j.koumoku7 else '' end) as j_url_s ,(case when j.koumoku8 != '' then 'EMAIL:' || j.koumoku8 else '' end) as j_email_s ,uh.eig_cd ,(case when(h99b.han_name = '1')then('お客様注文No:'||COALESCE(uh.tok_hacyu_no,''))else('')end) as tok_hacyu_no_h from t_uri uh left join m_tokui t on(uh.tok_cd = t.tok_cd) left join t_uri_m um on(uh.den_no = um.den_no) left join m_hin mh on (mh.hin_cd = um.hin_cd) left join m_hanyo h5 on (h5.mst_kbn = '98' and h5.han_cd = 'r-nonyunm') left join m_tanto tan on (uh.eigyou_tan_cd = tan.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-relrow') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'aith-r0023') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'tok-disc' and h99c.han_name = '1') left join m_hanyo h99d on (h99d.mst_kbn = '99' and h99d.han_cd = 'heta-r0023') left join m_hanyo h99e on (h99e.mst_kbn = '99' and h99e.han_cd = 'sp-r0023-1') left join m_hanyo h99f on (h99f.mst_kbn = '99' and h99f.han_cd = 'sttl-r0023') left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo j on (j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and uh.eig_cd != '')then('_' || uh.eig_cd)else('')end)) where 1 = 1 and uh.del_flg = 0 and uh.jucyu_flg = 0 and COALESCE(uh.via_seq,0) = 0 and ((uh.syori_ymd >= '') or ('' = '')) and ((uh.syori_ymd <= '') or ('' = '')) and ((uh.input_ymd >= '') or ('' = '')) and ((uh.input_ymd <= '') or ('' = '')) and ((uh.den_no = fnc_to_number('1558158')) or ('' = '1558158')) and ((uh.tok_cd = '') or ('' = '')) and ((um.hin_nm like '%%') or ('' = '')) and (('' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('')) )) and ((uh.eig_cd = '') or ('' = '')) order by uh.den_no,um.row_no ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:43 select koumoku2 as image_cd , koumoku3 as logo_row , koumoku4 as logo_col from m_hanyo where 1=1 and mst_kbn = '99' and han_cd = 'logo-r0020' and han_name = '1' ; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:44 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0023' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 20:14:44 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:36 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:38 select 'TEL:' || j_tel as j_tel_s ,'FAX:' || j_fax as j_fax_s ,(case j_url when '' then '' else 'URL:' || j_url end) as j_url_s ,(case j_daihyo when '' then '' else '担当者:' || j_daihyo end) as j_daihyo_s ,(case j_email when '' then '' else 'EMAIL:' ||j_email end) as j_email_s ,w.* ,(case when('' != '')then('')else( (case('')when('1')then('納品書')when('')then('請求書')else('請求書')end) )end) as report_title from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_daihyo ,j.koumoku8 as j_email ,j.sort_key as sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case when coalesce(m1.koumoku1,'') = '' then '' else coalesce(m1.koumoku1,'') end as mongon1 ,case when coalesce(m1.koumoku2,'') = '' then '' else coalesce(m1.koumoku2,'') end as mongon2 ,case when coalesce(m1.koumoku3,'') = '' then '' else coalesce(m1.koumoku3,'') end as mongon3 ,case when coalesce(m1.koumoku4,'') = '' then '' else coalesce(m1.koumoku4,'') end as mongon4 ,case when coalesce(m1.koumoku5,'') = '' then '' else coalesce(m1.koumoku5,'') end as mongon5 , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as uri_tokadr_kbn , case when coalesce(sp1.han_name,'') = '1' then coalesce(sp1.han_name,'') else '0' end as tok_cd_FLG , case when coalesce(sp2.han_name,'') = '1' then coalesce(sp2.han_name,'') else '0' end as hin_cd_FLG , rev.koumoku2 as rev , (case when(h98a.han_name != '')then(h98a.han_name)else('発行日')end)||':' as syori_ymd_label , (case when(h98b.han_name != '')then(h98b.han_name)else('管理番号')end)||':' as den_no_label , (case when(h98c.han_name != '')then(h98c.han_name)else('定価')end) as htanka_label , (case when(h99a.han_name != '')then(cast(h99a.han_name as int))else(0)end) as uri_tn_dec from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo m1 on (m1.mst_kbn = '90' and m1.han_cd = '') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-tokadr') left join m_hanyo sp1 on (sp1.mst_kbn='99' and sp1.han_cd='sp-r0020-1') left join m_hanyo sp2 on (sp2.mst_kbn='99' and sp2.han_cd='sp-r0020-2') left join t_uri t on (t.den_no = fnc_to_number('1558158')) left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo rev on (rev.mst_kbn = '99' and rev.han_cd = 'tok-disc') left join m_hanyo h98a on (h98a.mst_kbn = '98' and h98a.han_cd = 'r0023-symd') left join m_hanyo h98b on (h98b.mst_kbn = '98' and h98b.han_cd = 'r0023-denn') left join m_hanyo h98c on (h98c.mst_kbn = '98' and h98c.han_cd = 'r0023-htan') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-tn-dec') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and t.eig_cd != '')then('_' || t.eig_cd)else('')end) )w ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:40 select '請求明細書' as tait ,uh.den_no , uh.eigyou_tan_cd , (case when(h99d.han_name = '1')then('')else('担当:' || tan.tan_nm)end) as eigyou_tan_nm_s ,(case when(h99a.han_name = '1')then(um.rel_row_no)else(1+um.row_no)end) as row_no ,to_char(to_date(uh.input_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as input_ymd ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd ,uh.zeinuki_gaku ,uh.zei_gaku ,uh.zeikomi_gaku ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(um.hin_cd)end) as hin_cd ,replace(um.hin_nm,chr(10),'')as hin_nm ,(case when('' = um.hin_cd or um.set_row_no is not null)then(null)else(case when(uh.jucyu_flg = 1)then(um.jucyu_su)else(um.suryo)end)end) as suryo ,(case when('' = um.hin_cd or '0' = '1')then(null)else(um.tanka)end) as tanka ,(case when('' = um.hin_cd or '1' = '1')then(null)else(um.htanka)end) as htanka ,(case when('' = um.hin_cd or um.set_row_no is not null or '0' = '1')then(null)else(um.kingaku)end) as kingaku ,(case when('' = um.hin_cd or '1' = '1' or coalesce(um.disc_per,0) = 0)then(null)else(case when(h99c.koumoku2 = 'rev')then(100 - coalesce(um.disc_per,0))else(coalesce(um.disc_per,0))end)end) as disc_per ,COALESCE(um.hin_nm_ext,'')||COALESCE(um.meisai_biko,'')||(case when('1' != '1' and h99e.han_name = '1' and um.htanka != 0 and COALESCE(um.zei_kbn,0) = 0)then('税込定価 '||to_char(um.htanka + fnc_get_zei(um.htanka,uh.syori_ymd),'FM999,999,990'))else('')end) as meisai_biko ,(case when('0' = '1')then(mh.loc_no)else('')end) as loc_no ,uh.nonyu_no , uh.nonyu_nm || (case when(uh.nonyu_tan != '')then(' '||uh.nonyu_tan)else('')end)||' '||fnc_get_keisyo(uh.nonyu_nm, uh.nonyu_tan, '') as nonyu_nm , uh.tok_nm || (case when(uh.tok_tan != '')then(' '||uh.tok_tan)else('')end)||' '||fnc_get_keisyo(uh.tok_nm, uh.tok_tan, uh.keisyo) as tok_nm , (case when(t.hojin_nm != '' and '' = '')then(t.hojin_nm)else( uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo) )end) as tok_nm_s , (case when(t.hojin_nm != '' and '' = '')then(uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo))else( (case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end) )end) as tok_tan , (case when(t.hojin_nm != '' and '' = '')then((case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end))else( '' )end) as tok_nm_add , case when 1 = '1' then ( case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) else '' end as zip_no , case when 1 = '1' then uh.nonyu_addr1 else '' end as addr1 , case when 1 = '1' then uh.nonyu_addr2 else '' end as addr2 , case when 1 = '1' then uh.nonyu_addr3 else '' end as addr3 , case when 1 = '1' then uh.nonyu_addr4 else '' end as addr4 , case when 1 = '1' then coalesce(uh.nonyu_tel_no,'') else '' end as nonyu_tel , case when 1 = '1' then coalesce(uh.nonyu_fax_no,'') else '' end as nonyu_fax , fnc_get_report_multiline(uh.payment_term) as tori_cond , replace(replace(uh.biko1,chr(13)||chr(10),chr(10)),chr(10),chr(13)||chr(10)) as biko1 , trunc(um.row_no / 15) as page_no , mh.tani , (case when(h99f.han_name = '1')then( select '合計数量 '||to_char(sum(um_kei.suryo),'FM999,990') from t_uri_m um_kei where um_kei.den_no = uh.den_no and '' != um_kei.hin_cd )else('')end) as suryo_kei_view , case when 0 = '0' then 'お客様コード:'||coalesce(uh.tok_cd,'') else '' end as tok_cd , case when 1 = '1' then (case uh.tok_zip_no when '' then '' else '〒'||left(uh.tok_zip_no,3)||'-'||right(uh.tok_zip_no,4) end) else (case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) end as tok_zip_no , case when 1 = '1' then uh.tok_addr1 else uh.nonyu_addr1 end as tok_addr1 , case when 1 = '1' then uh.tok_addr2 else uh.nonyu_addr2 end as tok_addr2 , case when 1 = '1' then uh.tok_addr3 else uh.nonyu_addr3 end as tok_addr3 , case when 1 = '1' then uh.tok_addr4 else uh.nonyu_addr4 end as tok_addr4 , case when 1 = '1' then coalesce(uh.tok_tel_no,'') else coalesce(uh.nonyu_tel_no,'') end as tok_tel , case when 1 = '1' then coalesce(uh.tok_fax_no,'') else coalesce(uh.nonyu_fax_no,'') end as tok_fax ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,j.koumoku2 as j_address ,j.koumoku3 as j_address2 ,j.koumoku4 as j_address3 ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_email ,'TEL:' || j.koumoku5 as j_tel_s ,'FAX:' || j.koumoku6 as j_fax_s ,(case when j.koumoku7 != '' then 'URL:' || j.koumoku7 else '' end) as j_url_s ,(case when j.koumoku8 != '' then 'EMAIL:' || j.koumoku8 else '' end) as j_email_s ,uh.eig_cd ,(case when(h99b.han_name = '1')then('お客様注文No:'||COALESCE(uh.tok_hacyu_no,''))else('')end) as tok_hacyu_no_h from t_uri uh left join m_tokui t on(uh.tok_cd = t.tok_cd) left join t_uri_m um on(uh.den_no = um.den_no) left join m_hin mh on (mh.hin_cd = um.hin_cd) left join m_hanyo h5 on (h5.mst_kbn = '98' and h5.han_cd = 'r-nonyunm') left join m_tanto tan on (uh.eigyou_tan_cd = tan.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'uri-relrow') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'aith-r0023') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'tok-disc' and h99c.han_name = '1') left join m_hanyo h99d on (h99d.mst_kbn = '99' and h99d.han_cd = 'heta-r0023') left join m_hanyo h99e on (h99e.mst_kbn = '99' and h99e.han_cd = 'sp-r0023-1') left join m_hanyo h99f on (h99f.mst_kbn = '99' and h99f.han_cd = 'sttl-r0023') left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'uri-eig') left join m_hanyo j on (j.mst_kbn = '90' and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and uh.eig_cd != '')then('_' || uh.eig_cd)else('')end)) where 1 = 1 and uh.del_flg = 0 and uh.jucyu_flg = 0 and COALESCE(uh.via_seq,0) = 0 and ((uh.syori_ymd >= '') or ('' = '')) and ((uh.syori_ymd <= '') or ('' = '')) and ((uh.input_ymd >= '') or ('' = '')) and ((uh.input_ymd <= '') or ('' = '')) and ((uh.den_no = fnc_to_number('1558158')) or ('' = '1558158')) and ((uh.tok_cd = '') or ('' = '')) and ((um.hin_nm like '%%') or ('' = '')) and (('' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('')) )) and ((uh.eig_cd = '') or ('' = '')) order by uh.den_no,um.row_no ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:40 select koumoku2 as image_cd , koumoku3 as logo_row , koumoku4 as logo_col from m_hanyo where 1=1 and mst_kbn = '99' and han_cd = 'logo-r0020' and han_name = '1' ; ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:40 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0023' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:40 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 20:15:40 select h09.han_name || ' ' || h09.koumoku1 || ' ' || h09.koumoku2 || ' ' || h09.koumoku3 as furikikan from m_hanyo h09 left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') left join t_uri uh on (uh.den_no = '1558158') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = uh.eig_cd)) order by h09.sort_key, h09.han_cd ------------------------------------------------------------------------------------- 2021/10/17 21:47:52 ERROR execute select fnc_update_sum_3years_sir(76966, '201601', '', '', '', '', '', '', '', '', '', '', '', 'admin') ERROR: 42883: function fnc_update_sum_3years_sir(integer, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:21 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:21 select w.* ,(case coalesce(j_tel,'') when '' then '' else 'TEL:' || j_tel end) as j_tel_s ,(case coalesce(j_fax,'') when '' then '' else 'FAX:' || j_fax end) as j_fax_s ,(case coalesce(j_url,'') when '' then '' else 'URL:' || j_url end) as j_url_s ,(case coalesce(j_mail,'') when '' then '' else 'EMAIL:' || j_mail end) as j_mail_s from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,coalesce(j.koumoku2,'') || coalesce(j.koumoku3,'') as j_address ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_mail ,j.sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case coalesce(r.koumoku1,'') when '' then '毎度お引き立てくださいましてありがとうございます。' else r.koumoku1 end as mongon1 ,case coalesce(r.koumoku2,'') when '' then '下記の通りご請求させて頂きます。' else r.koumoku2 end as mongon2 ,case coalesce(r.koumoku3,'') when '' then '尚、締切日以降の入金は含まれておりませんのでご了承ください。' else r.koumoku3 end as mongon3 ,case coalesce(r.koumoku4,'') when '' then '※お振込手数料はお客様にてご負担願います。' else r.koumoku4 end as mongon4 , '' as mongon5 , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as midasi_kbn , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(m3.han_name,'') = '1' then coalesce(m3.han_name,'') else '0' end as sp1_FLG , case when coalesce(m4.han_name,'') = '1' then coalesce(m4.han_name,'') else '0' end as sp2_FLG , case when coalesce(m5.han_name,'') = '1' then coalesce(m5.han_name,'') else '0' end as meisai_row_kbn , case when coalesce(uritndec.han_name,'0') = '' then '0' when coalesce(uritndec.han_name,'0') = '0' then '0' else '1' end as uritndec , (case when(m6.han_name = '1')then(0)else(1)end) as head_furi_flg , (case when(f.koumoku1 != '')then(1)else(0)end) as footer_flg , f.koumoku1 as footer1 , f.koumoku2 as footer2 , f.koumoku3 as footer3 , replace('請求明細書','(単独)','') as tait from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-jknrno') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo m3 on (m3.mst_kbn = '99' and m3.han_cd = 'sp-r0030-1') left join m_hanyo m4 on (m4.mst_kbn = '99' and m4.han_cd = 'sp-r0030-2') left join m_hanyo m5 on (m5.mst_kbn = '99' and m5.han_cd = 'sp-r0030-3') left join m_hanyo m6 on (m6.mst_kbn = '99' and m6.han_cd = 'nfur-r0033') left join m_hanyo uritndec on (uritndec.mst_kbn='99' and uritndec.han_cd='uri-tn-dec') left join m_hanyo r on (r.mst_kbn = '90' and r.han_cd = 'r0030') left join m_hanyo f on (f.mst_kbn = '90' and f.han_cd = 'r0033.f') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' )w ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:21 select w.tok_cd , w.tan_nm_s , w.seikyu_ymd_s , w.zen_seikyu_ymd , (case when('' != '1' and w.group_cd != '')then(w.g_zen_seikyu_zan)else(w.zen_seikyu_zan)end) as zen_seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_nyukin_gaku)else(w.nyukin_gaku)end) as nyukin_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_kurikoshi_gaku)else(w.kurikoshi_gaku)end) as kurikoshi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeinuki_gaku)else(w.zeinuki_gaku)end) as zeinuki_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zei_gaku)else(w.zei_gaku)end) as zei_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeikomi_gaku)else(w.zeikomi_gaku)end) as zeikomi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_seikyu_zan)else(w.seikyu_zan)end) as seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_den_cnt)else(w.den_cnt)end) as den_cnt , w.tok_nm , (case when(mt.hojin_nm != '')then(mt.hojin_nm)else( w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo) )end) as tok_nm_s , (case when(mt.hojin_nm != '')then(w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo))else( (case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end) )end) as tok_tan , (case when(mt.hojin_nm != '')then((case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end))else( '' )end) as tok_nm_add , w.tel_no , w.keisyo , w.yubin_no , w.address1 , w.address2 , w.address3 , to_char(w.den_dt, 'mm/dd') as den_dt , w.den_dt_view , w.den_no_view , w.kbn_view , w.den_no , case when '' = w.hin_cd then w.kbn else w.kbn end as kbn , case when '' = w.hin_cd then null else w.hin_cd end as hin_cd , w.hin_nm , case when '' = w.hin_cd then null else w.suryo end as suryo , case when '' = w.hin_cd then null else w.tanka end as tanka , (case when('' = w.hin_cd and w.m_row >= 0)then(null)else(w.kingaku)end) as kingaku , w.zei_per , w.color , w.sunpo , w.sort , w.m_row , w.tani , w.meisai_biko , w.hosoku1 , w.meisai_biko_s , (case when(w.den_dt is not null)then(cast(w.den_dt as varchar))else('')end) as den_dt_sort , COALESCE(case when(h99a.han_name = '1')then(h99a.koumoku5)else('')end,'')||jis.han_name as jis_nm , jis.koumoku1 as jis_post_s , coalesce(jis.koumoku2,'') || coalesce(jis.koumoku3,'') as jis_address , (case when(jis.koumoku5 != '')then('TEL:' || jis.koumoku5)else('')end) as jis_tel_s , (case when(jis.koumoku6 != '')then('FAX:' || jis.koumoku6)else('')end) as jis_fax_s , (case when(jis.koumoku7 != '')then('URL:' || jis.koumoku7)else('')end) as jis_url_s , (case when(jis.koumoku8 != '')then('EMAIL:' || jis.koumoku8)else('')end) as jis_mail_s , w.c_tok_cd , w.c_tok_nm , mt.eig_cd , w.group_cd , w.g_zen_seikyu_zan , w.g_nyukin_gaku , w.g_kurikoshi_gaku , w.g_zeinuki_gaku , w.g_zei_gaku , w.g_zeikomi_gaku , w.g_seikyu_zan , w.g_den_cnt from( select (case when('' != '1' and mt.group_cd != '')then(mt.group_cd)else(t.tok_cd)end) as tok_cd , '担当:' || (case when('' != '1' and mt.group_cd != '')then(gta.tan_nm)else(t.tan_nm)end) as tan_nm_s , to_char(to_date(t.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd_s , t.zen_seikyu_ymd as zen_seikyu_ymd , t.zen_seikyu_zan as zen_seikyu_zan , t.nyukin_gaku as nyukin_gaku , t.kurikoshi_gaku as kurikoshi_gaku , t.zeinuki_gaku as zeinuki_gaku , t.zei_gaku as zei_gaku , t.zeikomi_gaku as zeikomi_gaku , t.seikyu_zan as seikyu_zan , t.den_cnt as den_cnt , (case when('' != '1' and mt.group_cd != '')then(g.tok_nm)else(t.tok_nm)end) as tok_nm , (case when('' != '1' and mt.group_cd != '')then(g.tel_no)else(t.tel_no)end) as tel_no , (case when('0' = '1')then('')else( (case when('' != '1' and mt.group_cd != '')then(g.tok_tan)else(t.tok_tan)end) )end) as tok_tan , (case when('' != '1' and mt.group_cd != '')then(g.keisyo)else(t.keisyo)end) as keisyo ,'〒'||(case when('' != '1' and mt.group_cd != '')then(substr(replace(g.zip_no,'-',''),1,3)||'-'||substr(replace(g.zip_no,'-',''),4,6))else(substr(replace(t.zip_no,'-',''),1,3)||'-'||substr(replace(t.zip_no,'-',''),4,6))end) as yubin_no , (case when('' != '1' and mt.group_cd != '')then(g.addr1)else(t.address1)end) as address1 , (case when('' != '1' and mt.group_cd != '')then(g.addr2)else(t.address2)end) as address2 , (case when('' != '1' and mt.group_cd != '')then(g.addr3)else(t.address3)end) as address3 ,t.den_dt as den_dt ,t.den_dt_view ,t.den_no_view ,t.kbn_view ,t.den_no as den_no ,t.kbn as kbn ,t.hin_cd as hin_cd ,t.hin_nm as hin_nm ,t.suryo as suryo ,t.tanka as tanka ,t.kingaku as kingaku ,t.zei_per as zei_per ,t.color as color ,t.sunpo as sunpo , t.sort as sort , t.m_row as m_row , t.tani , t.meisai_biko , t.hosoku1 , t.meisai_biko_s ,t.c_tok_cd ,t.c_tok_nm ,mt.group_cd ,(select sum(uk.zen_seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zen_seikyu_zan ,(select sum(uk.nyukin_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_nyukin_gaku ,(select sum(uk.kurikoshi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_kurikoshi_gaku ,(select sum(uk.zeinuki_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeinuki_gaku ,(select sum(uk.zei_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zei_gaku ,(select sum(uk.zeikomi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeikomi_gaku ,(select sum(uk.seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_seikyu_zan ,(select sum(uk.den_cnt) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_den_cnt from w_basr0030 w inner join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_tokui g on (g.tok_cd = mt.group_cd) left join m_tanto gta on (gta.tan_cd = g.tan_cd) inner join( select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,(case when(h99c.han_name = '1')then('')else(to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD'))end) as den_dt_view ,(case when(h99c.han_name = '1')then('')else(cast(uh.den_no as varchar))end) as den_no_view ,(case when(h99c.han_name = '1')then('')when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,um.hin_cd as hin_cd ,(case when('' = um.hin_cd)then('')when(h99b.han_name = '1')then(coalesce(um.hin_cd,'')||' ')else('')end)||um.hin_nm as hin_nm ,um.suryo ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.tanka)end) as tanka ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.kingaku)end) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , um.row_no as m_row , um.tani , um.meisai_biko , um.hosoku1 , coalesce(hin_nm_ext,'')||coalesce(meisai_biko,'')||(case when(COALESCE(h99a.han_name,'') != '1')then(um.hosoku1)else('')end) as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join t_uri_m um on (uh.den_no = um.den_no) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nhs1-r0033') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'hinc-r0033') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'urih-r0033') left join m_hanyo h0f on (h0f.mst_kbn = '0F' and h0f.han_cd = um.dtl_kbn) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(uh.den_no as varchar) as den_no_view ,(case when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,'' as hin_cd ,(case when('' != '1' and m1.group_cd != '')then(uh.tok_nm)else('納品先:'||uh.nonyu_nm)end) as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,cast(null as numeric(12,2)) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , uh.biko1 as meisai_biko , '' as hosoku1 , coalesce(uh.tok_hacyu_no,'') as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) inner join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'urih-r0033' and h99a.han_name = '1') left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' kbn ,'' as hin_cd ,uh.tok_cd||' '||uh.tok_nm||'【御買上計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(uh.zeinuki_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , '' as meisai_biko , '' as hosoku1 , '' as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , uh.tok_cd , uh.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(n.nyukin_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(n.nyukin_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(n.nyukin_no as varchar) as den_no_view ,'御入金' as kbn_view ,coalesce(n.nyukin_no::varchar,'') as den_no ,'御入金' as kbn ,'御入金' as hin_cd ,' ('||COALESCE( case when(han.koumoku6 != '')then(han.koumoku6)else(han.han_name)end ,'')||')' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,n.total_gaku as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,n.biko as meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') AND COALESCE(h99a.han_name,'') != '1' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' as kbn ,'' as hin_cd ,n.tok_cd||' '||n.tok_nm||'【御入金計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(n.total_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,'' meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , n.tok_cd , n.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.zeinuki_gaku,'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.zeinuki_gaku),'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.nyukin_gaku,'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.nyukin_gaku),'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1 = 1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 ) t on (t.seikyu_ymd = w.seikyu_ymd and t.tok_cd = w.tok_cd) where 1=1 and w.s_id = 76967 ) w left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'mtok-eig') left join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_hanyo jis on (jis.mst_kbn = '90' and jis.han_cd = 'jisya' || (case when(eig.han_name = '1' and mt.eig_cd != '')then('_' || mt.eig_cd)else('')end)) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'logo-r0033') where 1 = 1 order by tok_cd, sort, c_tok_cd, den_dt_sort, den_no, m_row ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:21 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:22 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:22 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'logo-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:22 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '0200100582') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 select w.* ,(case coalesce(j_tel,'') when '' then '' else 'TEL:' || j_tel end) as j_tel_s ,(case coalesce(j_fax,'') when '' then '' else 'FAX:' || j_fax end) as j_fax_s ,(case coalesce(j_url,'') when '' then '' else 'URL:' || j_url end) as j_url_s ,(case coalesce(j_mail,'') when '' then '' else 'EMAIL:' || j_mail end) as j_mail_s from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,coalesce(j.koumoku2,'') || coalesce(j.koumoku3,'') as j_address ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_mail ,j.sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case coalesce(r.koumoku1,'') when '' then '毎度お引き立てくださいましてありがとうございます。' else r.koumoku1 end as mongon1 ,case coalesce(r.koumoku2,'') when '' then '下記の通りご請求させて頂きます。' else r.koumoku2 end as mongon2 ,case coalesce(r.koumoku3,'') when '' then '尚、締切日以降の入金は含まれておりませんのでご了承ください。' else r.koumoku3 end as mongon3 ,case coalesce(r.koumoku4,'') when '' then '※お振込手数料はお客様にてご負担願います。' else r.koumoku4 end as mongon4 , '' as mongon5 , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as midasi_kbn , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(m3.han_name,'') = '1' then coalesce(m3.han_name,'') else '0' end as sp1_FLG , case when coalesce(m4.han_name,'') = '1' then coalesce(m4.han_name,'') else '0' end as sp2_FLG , case when coalesce(m5.han_name,'') = '1' then coalesce(m5.han_name,'') else '0' end as meisai_row_kbn , case when coalesce(uritndec.han_name,'0') = '' then '0' when coalesce(uritndec.han_name,'0') = '0' then '0' else '1' end as uritndec , (case when(m6.han_name = '1')then(0)else(1)end) as head_furi_flg , (case when(f.koumoku1 != '')then(1)else(0)end) as footer_flg , f.koumoku1 as footer1 , f.koumoku2 as footer2 , f.koumoku3 as footer3 , replace('請求明細書','(単独)','') as tait from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-jknrno') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo m3 on (m3.mst_kbn = '99' and m3.han_cd = 'sp-r0030-1') left join m_hanyo m4 on (m4.mst_kbn = '99' and m4.han_cd = 'sp-r0030-2') left join m_hanyo m5 on (m5.mst_kbn = '99' and m5.han_cd = 'sp-r0030-3') left join m_hanyo m6 on (m6.mst_kbn = '99' and m6.han_cd = 'nfur-r0033') left join m_hanyo uritndec on (uritndec.mst_kbn='99' and uritndec.han_cd='uri-tn-dec') left join m_hanyo r on (r.mst_kbn = '90' and r.han_cd = 'r0030') left join m_hanyo f on (f.mst_kbn = '90' and f.han_cd = 'r0033.f') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' )w ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 select w.tok_cd , w.tan_nm_s , w.seikyu_ymd_s , w.zen_seikyu_ymd , (case when('' != '1' and w.group_cd != '')then(w.g_zen_seikyu_zan)else(w.zen_seikyu_zan)end) as zen_seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_nyukin_gaku)else(w.nyukin_gaku)end) as nyukin_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_kurikoshi_gaku)else(w.kurikoshi_gaku)end) as kurikoshi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeinuki_gaku)else(w.zeinuki_gaku)end) as zeinuki_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zei_gaku)else(w.zei_gaku)end) as zei_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeikomi_gaku)else(w.zeikomi_gaku)end) as zeikomi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_seikyu_zan)else(w.seikyu_zan)end) as seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_den_cnt)else(w.den_cnt)end) as den_cnt , w.tok_nm , (case when(mt.hojin_nm != '')then(mt.hojin_nm)else( w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo) )end) as tok_nm_s , (case when(mt.hojin_nm != '')then(w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo))else( (case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end) )end) as tok_tan , (case when(mt.hojin_nm != '')then((case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end))else( '' )end) as tok_nm_add , w.tel_no , w.keisyo , w.yubin_no , w.address1 , w.address2 , w.address3 , to_char(w.den_dt, 'mm/dd') as den_dt , w.den_dt_view , w.den_no_view , w.kbn_view , w.den_no , case when '' = w.hin_cd then w.kbn else w.kbn end as kbn , case when '' = w.hin_cd then null else w.hin_cd end as hin_cd , w.hin_nm , case when '' = w.hin_cd then null else w.suryo end as suryo , case when '' = w.hin_cd then null else w.tanka end as tanka , (case when('' = w.hin_cd and w.m_row >= 0)then(null)else(w.kingaku)end) as kingaku , w.zei_per , w.color , w.sunpo , w.sort , w.m_row , w.tani , w.meisai_biko , w.hosoku1 , w.meisai_biko_s , (case when(w.den_dt is not null)then(cast(w.den_dt as varchar))else('')end) as den_dt_sort , COALESCE(case when(h99a.han_name = '1')then(h99a.koumoku5)else('')end,'')||jis.han_name as jis_nm , jis.koumoku1 as jis_post_s , coalesce(jis.koumoku2,'') || coalesce(jis.koumoku3,'') as jis_address , (case when(jis.koumoku5 != '')then('TEL:' || jis.koumoku5)else('')end) as jis_tel_s , (case when(jis.koumoku6 != '')then('FAX:' || jis.koumoku6)else('')end) as jis_fax_s , (case when(jis.koumoku7 != '')then('URL:' || jis.koumoku7)else('')end) as jis_url_s , (case when(jis.koumoku8 != '')then('EMAIL:' || jis.koumoku8)else('')end) as jis_mail_s , w.c_tok_cd , w.c_tok_nm , mt.eig_cd , w.group_cd , w.g_zen_seikyu_zan , w.g_nyukin_gaku , w.g_kurikoshi_gaku , w.g_zeinuki_gaku , w.g_zei_gaku , w.g_zeikomi_gaku , w.g_seikyu_zan , w.g_den_cnt from( select (case when('' != '1' and mt.group_cd != '')then(mt.group_cd)else(t.tok_cd)end) as tok_cd , '担当:' || (case when('' != '1' and mt.group_cd != '')then(gta.tan_nm)else(t.tan_nm)end) as tan_nm_s , to_char(to_date(t.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd_s , t.zen_seikyu_ymd as zen_seikyu_ymd , t.zen_seikyu_zan as zen_seikyu_zan , t.nyukin_gaku as nyukin_gaku , t.kurikoshi_gaku as kurikoshi_gaku , t.zeinuki_gaku as zeinuki_gaku , t.zei_gaku as zei_gaku , t.zeikomi_gaku as zeikomi_gaku , t.seikyu_zan as seikyu_zan , t.den_cnt as den_cnt , (case when('' != '1' and mt.group_cd != '')then(g.tok_nm)else(t.tok_nm)end) as tok_nm , (case when('' != '1' and mt.group_cd != '')then(g.tel_no)else(t.tel_no)end) as tel_no , (case when('0' = '1')then('')else( (case when('' != '1' and mt.group_cd != '')then(g.tok_tan)else(t.tok_tan)end) )end) as tok_tan , (case when('' != '1' and mt.group_cd != '')then(g.keisyo)else(t.keisyo)end) as keisyo ,'〒'||(case when('' != '1' and mt.group_cd != '')then(substr(replace(g.zip_no,'-',''),1,3)||'-'||substr(replace(g.zip_no,'-',''),4,6))else(substr(replace(t.zip_no,'-',''),1,3)||'-'||substr(replace(t.zip_no,'-',''),4,6))end) as yubin_no , (case when('' != '1' and mt.group_cd != '')then(g.addr1)else(t.address1)end) as address1 , (case when('' != '1' and mt.group_cd != '')then(g.addr2)else(t.address2)end) as address2 , (case when('' != '1' and mt.group_cd != '')then(g.addr3)else(t.address3)end) as address3 ,t.den_dt as den_dt ,t.den_dt_view ,t.den_no_view ,t.kbn_view ,t.den_no as den_no ,t.kbn as kbn ,t.hin_cd as hin_cd ,t.hin_nm as hin_nm ,t.suryo as suryo ,t.tanka as tanka ,t.kingaku as kingaku ,t.zei_per as zei_per ,t.color as color ,t.sunpo as sunpo , t.sort as sort , t.m_row as m_row , t.tani , t.meisai_biko , t.hosoku1 , t.meisai_biko_s ,t.c_tok_cd ,t.c_tok_nm ,mt.group_cd ,(select sum(uk.zen_seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zen_seikyu_zan ,(select sum(uk.nyukin_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_nyukin_gaku ,(select sum(uk.kurikoshi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_kurikoshi_gaku ,(select sum(uk.zeinuki_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeinuki_gaku ,(select sum(uk.zei_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zei_gaku ,(select sum(uk.zeikomi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeikomi_gaku ,(select sum(uk.seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_seikyu_zan ,(select sum(uk.den_cnt) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_den_cnt from w_basr0030 w inner join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_tokui g on (g.tok_cd = mt.group_cd) left join m_tanto gta on (gta.tan_cd = g.tan_cd) inner join( select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,(case when(h99c.han_name = '1')then('')else(to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD'))end) as den_dt_view ,(case when(h99c.han_name = '1')then('')else(cast(uh.den_no as varchar))end) as den_no_view ,(case when(h99c.han_name = '1')then('')when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,um.hin_cd as hin_cd ,(case when('' = um.hin_cd)then('')when(h99b.han_name = '1')then(coalesce(um.hin_cd,'')||' ')else('')end)||um.hin_nm as hin_nm ,um.suryo ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.tanka)end) as tanka ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.kingaku)end) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , um.row_no as m_row , um.tani , um.meisai_biko , um.hosoku1 , coalesce(hin_nm_ext,'')||coalesce(meisai_biko,'')||(case when(COALESCE(h99a.han_name,'') != '1')then(um.hosoku1)else('')end) as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join t_uri_m um on (uh.den_no = um.den_no) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nhs1-r0033') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'hinc-r0033') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'urih-r0033') left join m_hanyo h0f on (h0f.mst_kbn = '0F' and h0f.han_cd = um.dtl_kbn) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(uh.den_no as varchar) as den_no_view ,(case when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,'' as hin_cd ,(case when('' != '1' and m1.group_cd != '')then(uh.tok_nm)else('納品先:'||uh.nonyu_nm)end) as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,cast(null as numeric(12,2)) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , uh.biko1 as meisai_biko , '' as hosoku1 , coalesce(uh.tok_hacyu_no,'') as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) inner join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'urih-r0033' and h99a.han_name = '1') left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' kbn ,'' as hin_cd ,uh.tok_cd||' '||uh.tok_nm||'【御買上計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(uh.zeinuki_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , '' as meisai_biko , '' as hosoku1 , '' as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , uh.tok_cd , uh.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(n.nyukin_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(n.nyukin_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(n.nyukin_no as varchar) as den_no_view ,'御入金' as kbn_view ,coalesce(n.nyukin_no::varchar,'') as den_no ,'御入金' as kbn ,'御入金' as hin_cd ,' ('||COALESCE( case when(han.koumoku6 != '')then(han.koumoku6)else(han.han_name)end ,'')||')' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,n.total_gaku as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,n.biko as meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') AND COALESCE(h99a.han_name,'') != '1' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' as kbn ,'' as hin_cd ,n.tok_cd||' '||n.tok_nm||'【御入金計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(n.total_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,'' meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , n.tok_cd , n.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.zeinuki_gaku,'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.zeinuki_gaku),'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.nyukin_gaku,'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.nyukin_gaku),'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76967 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1 = 1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 ) t on (t.seikyu_ymd = w.seikyu_ymd and t.tok_cd = w.tok_cd) where 1=1 and w.s_id = 76967 ) w left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'mtok-eig') left join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_hanyo jis on (jis.mst_kbn = '90' and jis.han_cd = 'jisya' || (case when(eig.han_name = '1' and mt.eig_cd != '')then('_' || mt.eig_cd)else('')end)) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'logo-r0033') where 1 = 1 order by tok_cd, sort, c_tok_cd, den_dt_sort, den_no, m_row ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'logo-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 21:51:57 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- 2021/10/17 22:08:18 ERROR execute select fnc_update_basv0700(76974, '201512', 10, 'admin') The Connection is broken. ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:40 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:40 select w.* ,(case coalesce(j_tel,'') when '' then '' else 'TEL:' || j_tel end) as j_tel_s ,(case coalesce(j_fax,'') when '' then '' else 'FAX:' || j_fax end) as j_fax_s ,(case coalesce(j_url,'') when '' then '' else 'URL:' || j_url end) as j_url_s ,(case coalesce(j_mail,'') when '' then '' else 'EMAIL:' || j_mail end) as j_mail_s from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,coalesce(j.koumoku2,'') || coalesce(j.koumoku3,'') as j_address ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_mail ,j.sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case coalesce(r.koumoku1,'') when '' then '毎度お引き立てくださいましてありがとうございます。' else r.koumoku1 end as mongon1 ,case coalesce(r.koumoku2,'') when '' then '下記の通りご請求させて頂きます。' else r.koumoku2 end as mongon2 ,case coalesce(r.koumoku3,'') when '' then '尚、締切日以降の入金は含まれておりませんのでご了承ください。' else r.koumoku3 end as mongon3 ,case coalesce(r.koumoku4,'') when '' then '※お振込手数料はお客様にてご負担願います。' else r.koumoku4 end as mongon4 , '' as mongon5 , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as midasi_kbn , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(m3.han_name,'') = '1' then coalesce(m3.han_name,'') else '0' end as sp1_FLG , case when coalesce(m4.han_name,'') = '1' then coalesce(m4.han_name,'') else '0' end as sp2_FLG , case when coalesce(m5.han_name,'') = '1' then coalesce(m5.han_name,'') else '0' end as meisai_row_kbn , case when coalesce(uritndec.han_name,'0') = '' then '0' when coalesce(uritndec.han_name,'0') = '0' then '0' else '1' end as uritndec , (case when(m6.han_name = '1')then(0)else(1)end) as head_furi_flg , (case when(f.koumoku1 != '')then(1)else(0)end) as footer_flg , f.koumoku1 as footer1 , f.koumoku2 as footer2 , f.koumoku3 as footer3 , replace('請求明細書','(単独)','') as tait from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-jknrno') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo m3 on (m3.mst_kbn = '99' and m3.han_cd = 'sp-r0030-1') left join m_hanyo m4 on (m4.mst_kbn = '99' and m4.han_cd = 'sp-r0030-2') left join m_hanyo m5 on (m5.mst_kbn = '99' and m5.han_cd = 'sp-r0030-3') left join m_hanyo m6 on (m6.mst_kbn = '99' and m6.han_cd = 'nfur-r0033') left join m_hanyo uritndec on (uritndec.mst_kbn='99' and uritndec.han_cd='uri-tn-dec') left join m_hanyo r on (r.mst_kbn = '90' and r.han_cd = 'r0030') left join m_hanyo f on (f.mst_kbn = '90' and f.han_cd = 'r0033.f') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' )w ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:41 select w.tok_cd , w.tan_nm_s , w.seikyu_ymd_s , w.zen_seikyu_ymd , (case when('' != '1' and w.group_cd != '')then(w.g_zen_seikyu_zan)else(w.zen_seikyu_zan)end) as zen_seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_nyukin_gaku)else(w.nyukin_gaku)end) as nyukin_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_kurikoshi_gaku)else(w.kurikoshi_gaku)end) as kurikoshi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeinuki_gaku)else(w.zeinuki_gaku)end) as zeinuki_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zei_gaku)else(w.zei_gaku)end) as zei_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeikomi_gaku)else(w.zeikomi_gaku)end) as zeikomi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_seikyu_zan)else(w.seikyu_zan)end) as seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_den_cnt)else(w.den_cnt)end) as den_cnt , w.tok_nm , (case when(mt.hojin_nm != '')then(mt.hojin_nm)else( w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo) )end) as tok_nm_s , (case when(mt.hojin_nm != '')then(w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo))else( (case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end) )end) as tok_tan , (case when(mt.hojin_nm != '')then((case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end))else( '' )end) as tok_nm_add , w.tel_no , w.keisyo , w.yubin_no , w.address1 , w.address2 , w.address3 , to_char(w.den_dt, 'mm/dd') as den_dt , w.den_dt_view , w.den_no_view , w.kbn_view , w.den_no , case when '' = w.hin_cd then w.kbn else w.kbn end as kbn , case when '' = w.hin_cd then null else w.hin_cd end as hin_cd , w.hin_nm , case when '' = w.hin_cd then null else w.suryo end as suryo , case when '' = w.hin_cd then null else w.tanka end as tanka , (case when('' = w.hin_cd and w.m_row >= 0)then(null)else(w.kingaku)end) as kingaku , w.zei_per , w.color , w.sunpo , w.sort , w.m_row , w.tani , w.meisai_biko , w.hosoku1 , w.meisai_biko_s , (case when(w.den_dt is not null)then(cast(w.den_dt as varchar))else('')end) as den_dt_sort , COALESCE(case when(h99a.han_name = '1')then(h99a.koumoku5)else('')end,'')||jis.han_name as jis_nm , jis.koumoku1 as jis_post_s , coalesce(jis.koumoku2,'') || coalesce(jis.koumoku3,'') as jis_address , (case when(jis.koumoku5 != '')then('TEL:' || jis.koumoku5)else('')end) as jis_tel_s , (case when(jis.koumoku6 != '')then('FAX:' || jis.koumoku6)else('')end) as jis_fax_s , (case when(jis.koumoku7 != '')then('URL:' || jis.koumoku7)else('')end) as jis_url_s , (case when(jis.koumoku8 != '')then('EMAIL:' || jis.koumoku8)else('')end) as jis_mail_s , w.c_tok_cd , w.c_tok_nm , mt.eig_cd , w.group_cd , w.g_zen_seikyu_zan , w.g_nyukin_gaku , w.g_kurikoshi_gaku , w.g_zeinuki_gaku , w.g_zei_gaku , w.g_zeikomi_gaku , w.g_seikyu_zan , w.g_den_cnt from( select (case when('' != '1' and mt.group_cd != '')then(mt.group_cd)else(t.tok_cd)end) as tok_cd , '担当:' || (case when('' != '1' and mt.group_cd != '')then(gta.tan_nm)else(t.tan_nm)end) as tan_nm_s , to_char(to_date(t.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd_s , t.zen_seikyu_ymd as zen_seikyu_ymd , t.zen_seikyu_zan as zen_seikyu_zan , t.nyukin_gaku as nyukin_gaku , t.kurikoshi_gaku as kurikoshi_gaku , t.zeinuki_gaku as zeinuki_gaku , t.zei_gaku as zei_gaku , t.zeikomi_gaku as zeikomi_gaku , t.seikyu_zan as seikyu_zan , t.den_cnt as den_cnt , (case when('' != '1' and mt.group_cd != '')then(g.tok_nm)else(t.tok_nm)end) as tok_nm , (case when('' != '1' and mt.group_cd != '')then(g.tel_no)else(t.tel_no)end) as tel_no , (case when('0' = '1')then('')else( (case when('' != '1' and mt.group_cd != '')then(g.tok_tan)else(t.tok_tan)end) )end) as tok_tan , (case when('' != '1' and mt.group_cd != '')then(g.keisyo)else(t.keisyo)end) as keisyo ,'〒'||(case when('' != '1' and mt.group_cd != '')then(substr(replace(g.zip_no,'-',''),1,3)||'-'||substr(replace(g.zip_no,'-',''),4,6))else(substr(replace(t.zip_no,'-',''),1,3)||'-'||substr(replace(t.zip_no,'-',''),4,6))end) as yubin_no , (case when('' != '1' and mt.group_cd != '')then(g.addr1)else(t.address1)end) as address1 , (case when('' != '1' and mt.group_cd != '')then(g.addr2)else(t.address2)end) as address2 , (case when('' != '1' and mt.group_cd != '')then(g.addr3)else(t.address3)end) as address3 ,t.den_dt as den_dt ,t.den_dt_view ,t.den_no_view ,t.kbn_view ,t.den_no as den_no ,t.kbn as kbn ,t.hin_cd as hin_cd ,t.hin_nm as hin_nm ,t.suryo as suryo ,t.tanka as tanka ,t.kingaku as kingaku ,t.zei_per as zei_per ,t.color as color ,t.sunpo as sunpo , t.sort as sort , t.m_row as m_row , t.tani , t.meisai_biko , t.hosoku1 , t.meisai_biko_s ,t.c_tok_cd ,t.c_tok_nm ,mt.group_cd ,(select sum(uk.zen_seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zen_seikyu_zan ,(select sum(uk.nyukin_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_nyukin_gaku ,(select sum(uk.kurikoshi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_kurikoshi_gaku ,(select sum(uk.zeinuki_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeinuki_gaku ,(select sum(uk.zei_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zei_gaku ,(select sum(uk.zeikomi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeikomi_gaku ,(select sum(uk.seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_seikyu_zan ,(select sum(uk.den_cnt) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_den_cnt from w_basr0030 w inner join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_tokui g on (g.tok_cd = mt.group_cd) left join m_tanto gta on (gta.tan_cd = g.tan_cd) inner join( select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,(case when(h99c.han_name = '1')then('')else(to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD'))end) as den_dt_view ,(case when(h99c.han_name = '1')then('')else(cast(uh.den_no as varchar))end) as den_no_view ,(case when(h99c.han_name = '1')then('')when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,um.hin_cd as hin_cd ,(case when('' = um.hin_cd)then('')when(h99b.han_name = '1')then(coalesce(um.hin_cd,'')||' ')else('')end)||um.hin_nm as hin_nm ,um.suryo ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.tanka)end) as tanka ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.kingaku)end) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , um.row_no as m_row , um.tani , um.meisai_biko , um.hosoku1 , coalesce(hin_nm_ext,'')||coalesce(meisai_biko,'')||(case when(COALESCE(h99a.han_name,'') != '1')then(um.hosoku1)else('')end) as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join t_uri_m um on (uh.den_no = um.den_no) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nhs1-r0033') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'hinc-r0033') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'urih-r0033') left join m_hanyo h0f on (h0f.mst_kbn = '0F' and h0f.han_cd = um.dtl_kbn) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(uh.den_no as varchar) as den_no_view ,(case when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,'' as hin_cd ,(case when('' != '1' and m1.group_cd != '')then(uh.tok_nm)else('納品先:'||uh.nonyu_nm)end) as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,cast(null as numeric(12,2)) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , uh.biko1 as meisai_biko , '' as hosoku1 , coalesce(uh.tok_hacyu_no,'') as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) inner join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'urih-r0033' and h99a.han_name = '1') left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' kbn ,'' as hin_cd ,uh.tok_cd||' '||uh.tok_nm||'【御買上計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(uh.zeinuki_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , '' as meisai_biko , '' as hosoku1 , '' as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , uh.tok_cd , uh.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(n.nyukin_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(n.nyukin_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(n.nyukin_no as varchar) as den_no_view ,'御入金' as kbn_view ,coalesce(n.nyukin_no::varchar,'') as den_no ,'御入金' as kbn ,'御入金' as hin_cd ,' ('||COALESCE( case when(han.koumoku6 != '')then(han.koumoku6)else(han.han_name)end ,'')||')' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,n.total_gaku as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,n.biko as meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') AND COALESCE(h99a.han_name,'') != '1' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' as kbn ,'' as hin_cd ,n.tok_cd||' '||n.tok_nm||'【御入金計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(n.total_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,'' meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , n.tok_cd , n.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.zeinuki_gaku,'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.zeinuki_gaku),'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.nyukin_gaku,'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.nyukin_gaku),'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1 = 1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 ) t on (t.seikyu_ymd = w.seikyu_ymd and t.tok_cd = w.tok_cd) where 1=1 and w.s_id = 76976 ) w left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'mtok-eig') left join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_hanyo jis on (jis.mst_kbn = '90' and jis.han_cd = 'jisya' || (case when(eig.han_name = '1' and mt.eig_cd != '')then('_' || mt.eig_cd)else('')end)) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'logo-r0033') where 1 = 1 order by tok_cd, sort, c_tok_cd, den_dt_sort, den_no, m_row ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:41 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:41 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:41 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'logo-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:41 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:42 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:43 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:43 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:44 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:45 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:46 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:47 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:48 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:49 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:50 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:22:51 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:03 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:03 select w.* ,(case coalesce(j_tel,'') when '' then '' else 'TEL:' || j_tel end) as j_tel_s ,(case coalesce(j_fax,'') when '' then '' else 'FAX:' || j_fax end) as j_fax_s ,(case coalesce(j_url,'') when '' then '' else 'URL:' || j_url end) as j_url_s ,(case coalesce(j_mail,'') when '' then '' else 'EMAIL:' || j_mail end) as j_mail_s from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,coalesce(j.koumoku2,'') || coalesce(j.koumoku3,'') as j_address ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_mail ,j.sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case coalesce(r.koumoku1,'') when '' then '毎度お引き立てくださいましてありがとうございます。' else r.koumoku1 end as mongon1 ,case coalesce(r.koumoku2,'') when '' then '下記の通りご請求させて頂きます。' else r.koumoku2 end as mongon2 ,case coalesce(r.koumoku3,'') when '' then '尚、締切日以降の入金は含まれておりませんのでご了承ください。' else r.koumoku3 end as mongon3 ,case coalesce(r.koumoku4,'') when '' then '※お振込手数料はお客様にてご負担願います。' else r.koumoku4 end as mongon4 , '' as mongon5 , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as midasi_kbn , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(m3.han_name,'') = '1' then coalesce(m3.han_name,'') else '0' end as sp1_FLG , case when coalesce(m4.han_name,'') = '1' then coalesce(m4.han_name,'') else '0' end as sp2_FLG , case when coalesce(m5.han_name,'') = '1' then coalesce(m5.han_name,'') else '0' end as meisai_row_kbn , case when coalesce(uritndec.han_name,'0') = '' then '0' when coalesce(uritndec.han_name,'0') = '0' then '0' else '1' end as uritndec , (case when(m6.han_name = '1')then(0)else(1)end) as head_furi_flg , (case when(f.koumoku1 != '')then(1)else(0)end) as footer_flg , f.koumoku1 as footer1 , f.koumoku2 as footer2 , f.koumoku3 as footer3 , replace('請求明細書','(単独)','') as tait from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-jknrno') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo m3 on (m3.mst_kbn = '99' and m3.han_cd = 'sp-r0030-1') left join m_hanyo m4 on (m4.mst_kbn = '99' and m4.han_cd = 'sp-r0030-2') left join m_hanyo m5 on (m5.mst_kbn = '99' and m5.han_cd = 'sp-r0030-3') left join m_hanyo m6 on (m6.mst_kbn = '99' and m6.han_cd = 'nfur-r0033') left join m_hanyo uritndec on (uritndec.mst_kbn='99' and uritndec.han_cd='uri-tn-dec') left join m_hanyo r on (r.mst_kbn = '90' and r.han_cd = 'r0030') left join m_hanyo f on (f.mst_kbn = '90' and f.han_cd = 'r0033.f') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' )w ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:04 select w.tok_cd , w.tan_nm_s , w.seikyu_ymd_s , w.zen_seikyu_ymd , (case when('' != '1' and w.group_cd != '')then(w.g_zen_seikyu_zan)else(w.zen_seikyu_zan)end) as zen_seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_nyukin_gaku)else(w.nyukin_gaku)end) as nyukin_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_kurikoshi_gaku)else(w.kurikoshi_gaku)end) as kurikoshi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeinuki_gaku)else(w.zeinuki_gaku)end) as zeinuki_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zei_gaku)else(w.zei_gaku)end) as zei_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeikomi_gaku)else(w.zeikomi_gaku)end) as zeikomi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_seikyu_zan)else(w.seikyu_zan)end) as seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_den_cnt)else(w.den_cnt)end) as den_cnt , w.tok_nm , (case when(mt.hojin_nm != '')then(mt.hojin_nm)else( w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo) )end) as tok_nm_s , (case when(mt.hojin_nm != '')then(w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo))else( (case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end) )end) as tok_tan , (case when(mt.hojin_nm != '')then((case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end))else( '' )end) as tok_nm_add , w.tel_no , w.keisyo , w.yubin_no , w.address1 , w.address2 , w.address3 , to_char(w.den_dt, 'mm/dd') as den_dt , w.den_dt_view , w.den_no_view , w.kbn_view , w.den_no , case when '' = w.hin_cd then w.kbn else w.kbn end as kbn , case when '' = w.hin_cd then null else w.hin_cd end as hin_cd , w.hin_nm , case when '' = w.hin_cd then null else w.suryo end as suryo , case when '' = w.hin_cd then null else w.tanka end as tanka , (case when('' = w.hin_cd and w.m_row >= 0)then(null)else(w.kingaku)end) as kingaku , w.zei_per , w.color , w.sunpo , w.sort , w.m_row , w.tani , w.meisai_biko , w.hosoku1 , w.meisai_biko_s , (case when(w.den_dt is not null)then(cast(w.den_dt as varchar))else('')end) as den_dt_sort , COALESCE(case when(h99a.han_name = '1')then(h99a.koumoku5)else('')end,'')||jis.han_name as jis_nm , jis.koumoku1 as jis_post_s , coalesce(jis.koumoku2,'') || coalesce(jis.koumoku3,'') as jis_address , (case when(jis.koumoku5 != '')then('TEL:' || jis.koumoku5)else('')end) as jis_tel_s , (case when(jis.koumoku6 != '')then('FAX:' || jis.koumoku6)else('')end) as jis_fax_s , (case when(jis.koumoku7 != '')then('URL:' || jis.koumoku7)else('')end) as jis_url_s , (case when(jis.koumoku8 != '')then('EMAIL:' || jis.koumoku8)else('')end) as jis_mail_s , w.c_tok_cd , w.c_tok_nm , mt.eig_cd , w.group_cd , w.g_zen_seikyu_zan , w.g_nyukin_gaku , w.g_kurikoshi_gaku , w.g_zeinuki_gaku , w.g_zei_gaku , w.g_zeikomi_gaku , w.g_seikyu_zan , w.g_den_cnt from( select (case when('' != '1' and mt.group_cd != '')then(mt.group_cd)else(t.tok_cd)end) as tok_cd , '担当:' || (case when('' != '1' and mt.group_cd != '')then(gta.tan_nm)else(t.tan_nm)end) as tan_nm_s , to_char(to_date(t.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd_s , t.zen_seikyu_ymd as zen_seikyu_ymd , t.zen_seikyu_zan as zen_seikyu_zan , t.nyukin_gaku as nyukin_gaku , t.kurikoshi_gaku as kurikoshi_gaku , t.zeinuki_gaku as zeinuki_gaku , t.zei_gaku as zei_gaku , t.zeikomi_gaku as zeikomi_gaku , t.seikyu_zan as seikyu_zan , t.den_cnt as den_cnt , (case when('' != '1' and mt.group_cd != '')then(g.tok_nm)else(t.tok_nm)end) as tok_nm , (case when('' != '1' and mt.group_cd != '')then(g.tel_no)else(t.tel_no)end) as tel_no , (case when('0' = '1')then('')else( (case when('' != '1' and mt.group_cd != '')then(g.tok_tan)else(t.tok_tan)end) )end) as tok_tan , (case when('' != '1' and mt.group_cd != '')then(g.keisyo)else(t.keisyo)end) as keisyo ,'〒'||(case when('' != '1' and mt.group_cd != '')then(substr(replace(g.zip_no,'-',''),1,3)||'-'||substr(replace(g.zip_no,'-',''),4,6))else(substr(replace(t.zip_no,'-',''),1,3)||'-'||substr(replace(t.zip_no,'-',''),4,6))end) as yubin_no , (case when('' != '1' and mt.group_cd != '')then(g.addr1)else(t.address1)end) as address1 , (case when('' != '1' and mt.group_cd != '')then(g.addr2)else(t.address2)end) as address2 , (case when('' != '1' and mt.group_cd != '')then(g.addr3)else(t.address3)end) as address3 ,t.den_dt as den_dt ,t.den_dt_view ,t.den_no_view ,t.kbn_view ,t.den_no as den_no ,t.kbn as kbn ,t.hin_cd as hin_cd ,t.hin_nm as hin_nm ,t.suryo as suryo ,t.tanka as tanka ,t.kingaku as kingaku ,t.zei_per as zei_per ,t.color as color ,t.sunpo as sunpo , t.sort as sort , t.m_row as m_row , t.tani , t.meisai_biko , t.hosoku1 , t.meisai_biko_s ,t.c_tok_cd ,t.c_tok_nm ,mt.group_cd ,(select sum(uk.zen_seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zen_seikyu_zan ,(select sum(uk.nyukin_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_nyukin_gaku ,(select sum(uk.kurikoshi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_kurikoshi_gaku ,(select sum(uk.zeinuki_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeinuki_gaku ,(select sum(uk.zei_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zei_gaku ,(select sum(uk.zeikomi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeikomi_gaku ,(select sum(uk.seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_seikyu_zan ,(select sum(uk.den_cnt) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_den_cnt from w_basr0030 w inner join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_tokui g on (g.tok_cd = mt.group_cd) left join m_tanto gta on (gta.tan_cd = g.tan_cd) inner join( select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,(case when(h99c.han_name = '1')then('')else(to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD'))end) as den_dt_view ,(case when(h99c.han_name = '1')then('')else(cast(uh.den_no as varchar))end) as den_no_view ,(case when(h99c.han_name = '1')then('')when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,um.hin_cd as hin_cd ,(case when('' = um.hin_cd)then('')when(h99b.han_name = '1')then(coalesce(um.hin_cd,'')||' ')else('')end)||um.hin_nm as hin_nm ,um.suryo ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.tanka)end) as tanka ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.kingaku)end) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , um.row_no as m_row , um.tani , um.meisai_biko , um.hosoku1 , coalesce(hin_nm_ext,'')||coalesce(meisai_biko,'')||(case when(COALESCE(h99a.han_name,'') != '1')then(um.hosoku1)else('')end) as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join t_uri_m um on (uh.den_no = um.den_no) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nhs1-r0033') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'hinc-r0033') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'urih-r0033') left join m_hanyo h0f on (h0f.mst_kbn = '0F' and h0f.han_cd = um.dtl_kbn) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(uh.den_no as varchar) as den_no_view ,(case when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,'' as hin_cd ,(case when('' != '1' and m1.group_cd != '')then(uh.tok_nm)else('納品先:'||uh.nonyu_nm)end) as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,cast(null as numeric(12,2)) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , uh.biko1 as meisai_biko , '' as hosoku1 , coalesce(uh.tok_hacyu_no,'') as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) inner join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'urih-r0033' and h99a.han_name = '1') left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' kbn ,'' as hin_cd ,uh.tok_cd||' '||uh.tok_nm||'【御買上計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(uh.zeinuki_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , '' as meisai_biko , '' as hosoku1 , '' as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , uh.tok_cd , uh.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(n.nyukin_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(n.nyukin_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(n.nyukin_no as varchar) as den_no_view ,'御入金' as kbn_view ,coalesce(n.nyukin_no::varchar,'') as den_no ,'御入金' as kbn ,'御入金' as hin_cd ,' ('||COALESCE( case when(han.koumoku6 != '')then(han.koumoku6)else(han.han_name)end ,'')||')' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,n.total_gaku as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,n.biko as meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') AND COALESCE(h99a.han_name,'') != '1' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' as kbn ,'' as hin_cd ,n.tok_cd||' '||n.tok_nm||'【御入金計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(n.total_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,'' meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , n.tok_cd , n.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.zeinuki_gaku,'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.zeinuki_gaku),'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.nyukin_gaku,'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.nyukin_gaku),'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1 = 1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 ) t on (t.seikyu_ymd = w.seikyu_ymd and t.tok_cd = w.tok_cd) where 1=1 and w.s_id = 76976 ) w left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'mtok-eig') left join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_hanyo jis on (jis.mst_kbn = '90' and jis.han_cd = 'jisya' || (case when(eig.han_name = '1' and mt.eig_cd != '')then('_' || mt.eig_cd)else('')end)) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'logo-r0033') where 1 = 1 order by tok_cd, sort, c_tok_cd, den_dt_sort, den_no, m_row ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:04 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:04 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:04 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'logo-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:04 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:05 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:07 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:08 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:10 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:11 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:12 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:14 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:15 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:16 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:18 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:24:19 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:40 connect string: Server=v133-18-54-31.vir.kagoya.net;Port=52345;User Id=sgs_user;Password=sgs;Database=sgsdb;SSL=True; ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:40 select w.* ,(case coalesce(j_tel,'') when '' then '' else 'TEL:' || j_tel end) as j_tel_s ,(case coalesce(j_fax,'') when '' then '' else 'FAX:' || j_fax end) as j_fax_s ,(case coalesce(j_url,'') when '' then '' else 'URL:' || j_url end) as j_url_s ,(case coalesce(j_mail,'') when '' then '' else 'EMAIL:' || j_mail end) as j_mail_s from( select j.mst_kbn ,j.han_cd ,j.han_name as j_nm ,j.koumoku1 as j_post_s ,coalesce(j.koumoku2,'') || coalesce(j.koumoku3,'') as j_address ,j.koumoku5 as j_tel ,j.koumoku6 as j_fax ,j.koumoku7 as j_url ,j.koumoku8 as j_mail ,j.sort_key ,j2.mst_kbn ,j2.han_cd ,j2.han_name ,j2.koumoku1 as koumoku1 ,j2.koumoku2 as koumoku2 ,j2.koumoku3 as koumoku3 ,j2.koumoku4 as koumoku4 ,j2.koumoku5 as koumoku5 ,j2.koumoku6 as koumoku6 ,j2.koumoku7 as koumoku7 ,j2.koumoku8 as koumoku8 ,j2.koumoku9 as koumoku9 ,j2.koumoku10 as koumoku10 ,case coalesce(r.koumoku1,'') when '' then '毎度お引き立てくださいましてありがとうございます。' else r.koumoku1 end as mongon1 ,case coalesce(r.koumoku2,'') when '' then '下記の通りご請求させて頂きます。' else r.koumoku2 end as mongon2 ,case coalesce(r.koumoku3,'') when '' then '尚、締切日以降の入金は含まれておりませんのでご了承ください。' else r.koumoku3 end as mongon3 ,case coalesce(r.koumoku4,'') when '' then '※お振込手数料はお客様にてご負担願います。' else r.koumoku4 end as mongon4 , '' as mongon5 , case when coalesce(ar1.han_name,'') = '1' then coalesce(ar1.han_name,'') else '0' end as midasi_kbn , case when coalesce(m2.koumoku1,'') != '' then coalesce(m2.koumoku1,'') else '' end as midasi_FLG , case when coalesce(m3.han_name,'') = '1' then coalesce(m3.han_name,'') else '0' end as sp1_FLG , case when coalesce(m4.han_name,'') = '1' then coalesce(m4.han_name,'') else '0' end as sp2_FLG , case when coalesce(m5.han_name,'') = '1' then coalesce(m5.han_name,'') else '0' end as meisai_row_kbn , case when coalesce(uritndec.han_name,'0') = '' then '0' when coalesce(uritndec.han_name,'0') = '0' then '0' else '1' end as uritndec , (case when(m6.han_name = '1')then(0)else(1)end) as head_furi_flg , (case when(f.koumoku1 != '')then(1)else(0)end) as footer_flg , f.koumoku1 as footer1 , f.koumoku2 as footer2 , f.koumoku3 as footer3 , replace('請求明細書','(単独)','') as tait from m_hanyo j left join m_hanyo j2 on (j2.mst_kbn = '90' and j2.han_cd = 'jisya2') left join m_hanyo ar1 on (ar1.mst_kbn='99' and ar1.han_cd='uri-jknrno') left join m_hanyo m2 on (m2.mst_kbn = '90' and m2.han_cd = 'hin-title') left join m_hanyo m3 on (m3.mst_kbn = '99' and m3.han_cd = 'sp-r0030-1') left join m_hanyo m4 on (m4.mst_kbn = '99' and m4.han_cd = 'sp-r0030-2') left join m_hanyo m5 on (m5.mst_kbn = '99' and m5.han_cd = 'sp-r0030-3') left join m_hanyo m6 on (m6.mst_kbn = '99' and m6.han_cd = 'nfur-r0033') left join m_hanyo uritndec on (uritndec.mst_kbn='99' and uritndec.han_cd='uri-tn-dec') left join m_hanyo r on (r.mst_kbn = '90' and r.han_cd = 'r0030') left join m_hanyo f on (f.mst_kbn = '90' and f.han_cd = 'r0033.f') where 1=1 and j.mst_kbn = '90' and j.han_cd = 'jisya' )w ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:40 select w.tok_cd , w.tan_nm_s , w.seikyu_ymd_s , w.zen_seikyu_ymd , (case when('' != '1' and w.group_cd != '')then(w.g_zen_seikyu_zan)else(w.zen_seikyu_zan)end) as zen_seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_nyukin_gaku)else(w.nyukin_gaku)end) as nyukin_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_kurikoshi_gaku)else(w.kurikoshi_gaku)end) as kurikoshi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeinuki_gaku)else(w.zeinuki_gaku)end) as zeinuki_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zei_gaku)else(w.zei_gaku)end) as zei_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_zeikomi_gaku)else(w.zeikomi_gaku)end) as zeikomi_gaku , (case when('' != '1' and w.group_cd != '')then(w.g_seikyu_zan)else(w.seikyu_zan)end) as seikyu_zan , (case when('' != '1' and w.group_cd != '')then(w.g_den_cnt)else(w.den_cnt)end) as den_cnt , w.tok_nm , (case when(mt.hojin_nm != '')then(mt.hojin_nm)else( w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo) )end) as tok_nm_s , (case when(mt.hojin_nm != '')then(w.tok_nm||' '||fnc_get_keisyo_1(w.tok_nm, w.tok_tan, w.keisyo))else( (case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end) )end) as tok_tan , (case when(mt.hojin_nm != '')then((case when(w.tok_tan != '')then(w.tok_tan||' '||fnc_get_keisyo_2(w.tok_nm, w.tok_tan, w.keisyo))end))else( '' )end) as tok_nm_add , w.tel_no , w.keisyo , w.yubin_no , w.address1 , w.address2 , w.address3 , to_char(w.den_dt, 'mm/dd') as den_dt , w.den_dt_view , w.den_no_view , w.kbn_view , w.den_no , case when '' = w.hin_cd then w.kbn else w.kbn end as kbn , case when '' = w.hin_cd then null else w.hin_cd end as hin_cd , w.hin_nm , case when '' = w.hin_cd then null else w.suryo end as suryo , case when '' = w.hin_cd then null else w.tanka end as tanka , (case when('' = w.hin_cd and w.m_row >= 0)then(null)else(w.kingaku)end) as kingaku , w.zei_per , w.color , w.sunpo , w.sort , w.m_row , w.tani , w.meisai_biko , w.hosoku1 , w.meisai_biko_s , (case when(w.den_dt is not null)then(cast(w.den_dt as varchar))else('')end) as den_dt_sort , COALESCE(case when(h99a.han_name = '1')then(h99a.koumoku5)else('')end,'')||jis.han_name as jis_nm , jis.koumoku1 as jis_post_s , coalesce(jis.koumoku2,'') || coalesce(jis.koumoku3,'') as jis_address , (case when(jis.koumoku5 != '')then('TEL:' || jis.koumoku5)else('')end) as jis_tel_s , (case when(jis.koumoku6 != '')then('FAX:' || jis.koumoku6)else('')end) as jis_fax_s , (case when(jis.koumoku7 != '')then('URL:' || jis.koumoku7)else('')end) as jis_url_s , (case when(jis.koumoku8 != '')then('EMAIL:' || jis.koumoku8)else('')end) as jis_mail_s , w.c_tok_cd , w.c_tok_nm , mt.eig_cd , w.group_cd , w.g_zen_seikyu_zan , w.g_nyukin_gaku , w.g_kurikoshi_gaku , w.g_zeinuki_gaku , w.g_zei_gaku , w.g_zeikomi_gaku , w.g_seikyu_zan , w.g_den_cnt from( select (case when('' != '1' and mt.group_cd != '')then(mt.group_cd)else(t.tok_cd)end) as tok_cd , '担当:' || (case when('' != '1' and mt.group_cd != '')then(gta.tan_nm)else(t.tan_nm)end) as tan_nm_s , to_char(to_date(t.seikyu_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as seikyu_ymd_s , t.zen_seikyu_ymd as zen_seikyu_ymd , t.zen_seikyu_zan as zen_seikyu_zan , t.nyukin_gaku as nyukin_gaku , t.kurikoshi_gaku as kurikoshi_gaku , t.zeinuki_gaku as zeinuki_gaku , t.zei_gaku as zei_gaku , t.zeikomi_gaku as zeikomi_gaku , t.seikyu_zan as seikyu_zan , t.den_cnt as den_cnt , (case when('' != '1' and mt.group_cd != '')then(g.tok_nm)else(t.tok_nm)end) as tok_nm , (case when('' != '1' and mt.group_cd != '')then(g.tel_no)else(t.tel_no)end) as tel_no , (case when('0' = '1')then('')else( (case when('' != '1' and mt.group_cd != '')then(g.tok_tan)else(t.tok_tan)end) )end) as tok_tan , (case when('' != '1' and mt.group_cd != '')then(g.keisyo)else(t.keisyo)end) as keisyo ,'〒'||(case when('' != '1' and mt.group_cd != '')then(substr(replace(g.zip_no,'-',''),1,3)||'-'||substr(replace(g.zip_no,'-',''),4,6))else(substr(replace(t.zip_no,'-',''),1,3)||'-'||substr(replace(t.zip_no,'-',''),4,6))end) as yubin_no , (case when('' != '1' and mt.group_cd != '')then(g.addr1)else(t.address1)end) as address1 , (case when('' != '1' and mt.group_cd != '')then(g.addr2)else(t.address2)end) as address2 , (case when('' != '1' and mt.group_cd != '')then(g.addr3)else(t.address3)end) as address3 ,t.den_dt as den_dt ,t.den_dt_view ,t.den_no_view ,t.kbn_view ,t.den_no as den_no ,t.kbn as kbn ,t.hin_cd as hin_cd ,t.hin_nm as hin_nm ,t.suryo as suryo ,t.tanka as tanka ,t.kingaku as kingaku ,t.zei_per as zei_per ,t.color as color ,t.sunpo as sunpo , t.sort as sort , t.m_row as m_row , t.tani , t.meisai_biko , t.hosoku1 , t.meisai_biko_s ,t.c_tok_cd ,t.c_tok_nm ,mt.group_cd ,(select sum(uk.zen_seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zen_seikyu_zan ,(select sum(uk.nyukin_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_nyukin_gaku ,(select sum(uk.kurikoshi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_kurikoshi_gaku ,(select sum(uk.zeinuki_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeinuki_gaku ,(select sum(uk.zei_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zei_gaku ,(select sum(uk.zeikomi_gaku) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_zeikomi_gaku ,(select sum(uk.seikyu_zan) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_seikyu_zan ,(select sum(uk.den_cnt) from m_tokui g inner join t_urikake uk on (uk.tok_cd = g.tok_cd and uk.seikyu_ymd = w.seikyu_ymd) where g.group_cd = mt.group_cd and '' != '1' and mt.group_cd != '') as g_den_cnt from w_basr0030 w inner join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_tokui g on (g.tok_cd = mt.group_cd) left join m_tanto gta on (gta.tan_cd = g.tan_cd) inner join( select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,(case when(h99c.han_name = '1')then('')else(to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD'))end) as den_dt_view ,(case when(h99c.han_name = '1')then('')else(cast(uh.den_no as varchar))end) as den_no_view ,(case when(h99c.han_name = '1')then('')when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,um.hin_cd as hin_cd ,(case when('' = um.hin_cd)then('')when(h99b.han_name = '1')then(coalesce(um.hin_cd,'')||' ')else('')end)||um.hin_nm as hin_nm ,um.suryo ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.tanka)end) as tanka ,(case when(h0f.koumoku2 = '1')then(cast(null as numeric(12,2)))else(um.kingaku)end) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , um.row_no as m_row , um.tani , um.meisai_biko , um.hosoku1 , coalesce(hin_nm_ext,'')||coalesce(meisai_biko,'')||(case when(COALESCE(h99a.han_name,'') != '1')then(um.hosoku1)else('')end) as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join t_uri_m um on (uh.den_no = um.den_no) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nhs1-r0033') left join m_hanyo h99b on (h99b.mst_kbn = '99' and h99b.han_cd = 'hinc-r0033') left join m_hanyo h99c on (h99c.mst_kbn = '99' and h99c.han_cd = 'urih-r0033') left join m_hanyo h0f on (h0f.mst_kbn = '0F' and h0f.han_cd = um.dtl_kbn) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(uh.syori_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(uh.syori_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(uh.den_no as varchar) as den_no_view ,(case when(uh.henpin_flg = 1)then('御返品')else('御買上')end) as kbn_view ,case when 0 = '1' then (case when coalesce(uh.kanri_no,'') = '' then coalesce(uh.den_no::varchar,'') else coalesce(uh.kanri_no,'') end) else coalesce(uh.den_no::varchar,'') end as den_no ,case (uh.henpin_flg) when '1' then '御返品' else case (coalesce(uh.den_no::varchar,'')) when '' then '' else '御買上' end end as kbn ,'' as hin_cd ,(case when('' != '1' and m1.group_cd != '')then(uh.tok_nm)else('納品先:'||uh.nonyu_nm)end) as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,cast(null as numeric(12,2)) as kingaku ,case when uh.zei_kbn = '2' then '' else'(8.00%)' end as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , uh.biko1 as meisai_biko , '' as hosoku1 , coalesce(uh.tok_hacyu_no,'') as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) inner join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'urih-r0033' and h99a.han_name = '1') left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' kbn ,'' as hin_cd ,uh.tok_cd||' '||uh.tok_nm||'【御買上計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(uh.zeinuki_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , -1 as m_row , '' as tani , '' as meisai_biko , '' as hosoku1 , '' as meisai_biko_s , uh.tok_cd as c_tok_cd , uh.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join t_uri uh on (v.seikyu_ymd = uh.seikyu_ymd and m2.tok_cd = uh.tok_cd and uh.jucyu_flg = 0) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and uh.del_flg = 0 and COALESCE(uh.kobetsu_kbn,'') = '' and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , uh.tok_cd , uh.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,to_date(n.nyukin_ymd, 'YYYYMMDD') as den_dt ,to_char(to_date(n.nyukin_ymd, 'YYYYMMDD'),'MM/DD') as den_dt_view ,cast(n.nyukin_no as varchar) as den_no_view ,'御入金' as kbn_view ,coalesce(n.nyukin_no::varchar,'') as den_no ,'御入金' as kbn ,'御入金' as hin_cd ,' ('||COALESCE( case when(han.koumoku6 != '')then(han.koumoku6)else(han.han_name)end ,'')||')' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,n.total_gaku as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,n.biko as meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') AND COALESCE(h99a.han_name,'') != '1' union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null as den_dt ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null as den_no ,'' as kbn ,'' as hin_cd ,n.tok_cd||' '||n.tok_nm||'【御入金計】' as hin_nm ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,sum(n.total_gaku) as kingaku ,'' as zei_per ,'' as color ,'' as sunpo , 1 as sort , null as m_row ,'' as tani ,'' as meisai_biko ,'' as hosoku1 ,'' meisai_biko_s , n.tok_cd as c_tok_cd , n.tok_nm as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tokui m2 on ((case when(m2.sei_cd != '''')then(m2.sei_cd)else(m2.tok_cd)end) = v.tok_cd) left join v_nyukin n on (v.seikyu_ymd = n.seikyu_ymd and m2.tok_cd = n.tok_cd) left join m_hanyo han on (n.nyukin_kbn = han.han_cd and han.mst_kbn = '13') left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and n.nyukin_gaku is not null and '' = '' AND not exists (select 1 from t_nyu_keshi nk inner join t_uri uh on (uh.den_no = nk.uri_no) where nk.nyukin_no = n.nyukin_no and nk.keshi_kind = 1 and COALESCE(uh.kobetsu_kbn,'') != '') and exists (select 1 from m_tokui m3 where m3.sei_cd = v.tok_cd and m3.tok_cd != v.tok_cd) group by v.seikyu_ymd , v.tok_cd , ta.tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 , n.tok_cd , n.tok_nm union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.zeinuki_gaku,'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,'' ,'' ,'御買上計'  ,'                 【御買上計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.zeinuki_gaku),'0') as kingaku ,'' ,'' ,'' , 2 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) where 1 = 1 and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 union all select v.seikyu_ymd , v.tok_cd , ta.tan_nm as tan_nm , v.zen_seikyu_ymd , v.zen_seikyu_zan , v.nyukin_gaku , v.kurikoshi_gaku , v.zeinuki_gaku , v.zei_gaku , v.zeikomi_gaku , v.seikyu_zan , v.den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(v.nyukin_gaku,'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = v.tok_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1=1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and (('' = '1') or (COALESCE(m1.group_cd,'') = '')) union all select v.seikyu_ymd , m1.tok_cd , ta.tan_nm as tan_nm , max(v.zen_seikyu_ymd) as zen_seikyu_ymd , sum(v.zen_seikyu_zan) as zen_seikyu_zan , sum(v.nyukin_gaku) as nyukin_gaku , sum(v.kurikoshi_gaku) as kurikoshi_gaku , sum(v.zeinuki_gaku) as zeinuki_gaku , sum(v.zei_gaku) as zei_gaku , sum(v.zeikomi_gaku) as zeikomi_gaku , sum(v.seikyu_zan) as seikyu_zan , sum(v.den_cnt) as den_cnt , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') as tok_tan , m1.keisyo ,m1.zip_no as zip_no ,m1.addr1 as address1 ,m1.addr2 as address2 ,m1.addr3||m1.addr4 as address3 ,null ,'' as den_dt_view ,'' as den_no_view ,'' as kbn_view ,null ,'' ,'御入金計' ,'                 【御入金計】' ,cast(null as numeric(9,2)) as suryo ,cast(null as numeric(12,2)) as tanka ,coalesce(sum(v.nyukin_gaku),'0') as kingaku ,'' ,'' ,'' , 3 as sort , null as m_row ,'' ,'' , '' , '' , '' as c_tok_cd , '' as c_tok_nm from t_urikake v inner join w_basr0030 w on (w.s_id = 76976 and w.seikyu_ymd = v.seikyu_ymd and w.tok_cd = v.tok_cd) left join m_tokui m2 on (m2.tok_cd = v.tok_cd) left join m_tokui m1 on (m1.tok_cd = m2.group_cd) left join m_tanto ta on (m1.tan_cd = ta.tan_cd) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'nnkn-r0033') where 1 = 1 and '' = '' AND COALESCE(h99a.han_name,'') != '1' and '' != '1' and COALESCE(m2.group_cd,'') != '' group by v.seikyu_ymd , m1.tok_cd , ta.tan_nm , m1.tok_nm , m1.tel_no , coalesce(m1.tok_tan,'') , m1.keisyo ,m1.zip_no ,m1.addr1 ,m1.addr2 ,m1.addr3||m1.addr4 ) t on (t.seikyu_ymd = w.seikyu_ymd and t.tok_cd = w.tok_cd) where 1=1 and w.s_id = 76976 ) w left join m_hanyo eig on (eig.mst_kbn = '99' and eig.han_cd = 'mtok-eig') left join m_tokui mt on (mt.tok_cd = w.tok_cd) left join m_hanyo jis on (jis.mst_kbn = '90' and jis.han_cd = 'jisya' || (case when(eig.han_name = '1' and mt.eig_cd != '')then('_' || mt.eig_cd)else('')end)) left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'logo-r0033') where 1 = 1 order by tok_cd, sort, c_tok_cd, den_dt_sort, den_no, m_row ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:40 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'syab-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:40 select image_cd, file_image from m_image where image_cd like 'kakuin%' order by image_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:40 select koumoku2 as image_cd , koumoku3 as img_row , koumoku4 as img_col from m_hanyo where 1 = 1 and mst_kbn = '99' and han_cd = 'logo-r0033' and han_name = '1' ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:41 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:44 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:45 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:46 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:47 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:49 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:50 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:51 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:53 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:54 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:55 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- [Success]2021/10/17 22:25:57 select han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan from( select h09.mst_kbn, h09.han_cd, h09.han_name, h09.koumoku1 as furikikan1, h09.koumoku2 as furikikan2, h09.koumoku3 as furikikan3, h09.koumoku4, h09.koumoku5, coalesce(h09.koumoku6,''), h09.koumoku7, h09.koumoku8, h09.koumoku9, h09.koumoku10, h09.sort_key from m_hanyo h09 left join m_tokui mt on (mt.tok_cd = '04') left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f') where 1 = 1 and h09.mst_kbn = '09' and coalesce(h09.koumoku6,'') = '' and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd)) ) w order by han_cd ------------------------------------------------------------------------------------- 2021/10/17 22:34:04 ERROR selectDb select w.* , (case(w.motocyo_kind)when(0)then('繰越')when(1)then('集計')when(2)then('売上')when(3)then('売上')when(4)then('入金')when(5)then('入金')when(6)then('締め')end) as motocyo_kind_nm , (case when(w.motocyo_kind = 2 and um.mng1_flg = 1)then(1)when(w.motocyo_kind = 3 and uh.mng1_flg = 1)then(1)when(w.motocyo_kind = 4 and nm.mng1_flg = 1)then(1)else(0)end) as keshi_flg , (case when(w.motocyo_kind = 2 and um.mng1_flg = 1)then('X')when(w.motocyo_kind = 3 and uh.mng1_flg = 1)then('X')else('')end) as keshi_uri , (case when(w.motocyo_kind = 4 and nm.mng1_flg = 1)then('X')else('')end) as keshi_nyu , (case when(w.motocyo_kind = 2)then(um.kingaku)when(w.motocyo_kind = 3)then(uh.soto_gaku)else(null)end) as keshi_gaku_uri , (case when(w.motocyo_kind = 4)then(nm.nyukin_gaku)else(null)end) as keshi_gaku_nyu from w_uri_motocyo w left join t_uri uh on (uh.den_no = w.den_no and w.motocyo_kind = 3) left join t_uri_m um on (um.den_no = w.den_no and um.row_no = w.row_no and w.motocyo_kind = 2) left join t_nyukin_m nm on (nm.nyukin_no = w.den_no and nm.row_no = w.row_no and w.motocyo_kind = 4) where w.s_id = 76988 and w.tok_cd = '02' order by s_id, tok_cd, syori_ymd, (case(motocyo_kind)when(5)then(4)when(3)then(2)else(motocyo_kind)end), motocyo_key1, motocyo_key2, motocyo_kind ERROR: 42703: column um.mng1_flg does not exist ------------------------------------------------------------------------------------- 2021/10/17 22:35:08 ERROR selectDb select w.* , (case(w.motocyo_kind)when(0)then('繰越')when(1)then('集計')when(2)then('売上')when(3)then('売上')when(4)then('入金')when(5)then('入金')when(6)then('締め')end) as motocyo_kind_nm , (case when(w.motocyo_kind = 2 and um.mng1_flg = 1)then(1)when(w.motocyo_kind = 3 and uh.mng1_flg = 1)then(1)when(w.motocyo_kind = 4 and nm.mng1_flg = 1)then(1)else(0)end) as keshi_flg , (case when(w.motocyo_kind = 2 and um.mng1_flg = 1)then('X')when(w.motocyo_kind = 3 and uh.mng1_flg = 1)then('X')else('')end) as keshi_uri , (case when(w.motocyo_kind = 4 and nm.mng1_flg = 1)then('X')else('')end) as keshi_nyu , (case when(w.motocyo_kind = 2)then(um.kingaku)when(w.motocyo_kind = 3)then(uh.soto_gaku)else(null)end) as keshi_gaku_uri , (case when(w.motocyo_kind = 4)then(nm.nyukin_gaku)else(null)end) as keshi_gaku_nyu from w_uri_motocyo w left join t_uri uh on (uh.den_no = w.den_no and w.motocyo_kind = 3) left join t_uri_m um on (um.den_no = w.den_no and um.row_no = w.row_no and w.motocyo_kind = 2) left join t_nyukin_m nm on (nm.nyukin_no = w.den_no and nm.row_no = w.row_no and w.motocyo_kind = 4) where w.s_id = 76988 and w.tok_cd = '02' order by s_id, tok_cd, syori_ymd, (case(motocyo_kind)when(5)then(4)when(3)then(2)else(motocyo_kind)end), motocyo_key1, motocyo_key2, motocyo_kind ERROR: 42703: column nm.mng1_flg does not exist