[selectRecords] select '請求明細書' as tait ,uh.den_no , uh.eigyou_tan_cd --#19180 2021.08.23 MOD STT -- , '担当:' || tan.tan_nm as eigyou_tan_nm_s , (case when(h99d.han_name = '1')then('')else('担当:' || tan.tan_nm)end) as eigyou_tan_nm_s --#19180 2021.08.23 MOD END --#19596 2021.06.24 MOD STT -- ,(1+um.row_no) as row_no ,(case when(h99a.han_name = '1')then(um.rel_row_no)else(1+um.row_no)end) as row_no --#19596 2021.06.24 MOD END ,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 --#10454 2021.06.18 MOD STT -- ,(case when('&12' = um.hin_cd)then(null)else(case when(mh.jan_cd != '')then(mh.jan_cd)else(um.hin_cd)end)end) as hin_cd --見出し品番 もしくは セット内訳であれば NULL --#19593 2021.06.18 MOD STT --JANコードの印字は止める -- ,(case when('&12' = um.hin_cd or um.set_row_no is not null)then(null)else(case when(mh.jan_cd != '')then(mh.jan_cd)else(um.hin_cd)end)end) as hin_cd ,(case when('&12' = um.hin_cd or um.set_row_no is not null)then(null)else(um.hin_cd)end) as hin_cd --#19593 2021.06.18 MOD END --#10454 2021.06.18 MOD END ,replace(um.hin_nm,chr(10),'')as hin_nm --#10454 2021.06.18 MOD STT -- ,(case when('&12' = um.hin_cd)then(null)else(case when(uh.jucyu_flg = 1)then(um.jucyu_su)else(um.suryo)end)end) as suryo --見出し品番 もしくは セット内訳であれば NULL ,(case when('&12' = 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 --#10454 2021.06.18 MOD END --見出し品番 もしくは 金額非表示であれば NULL ,(case when('&12' = um.hin_cd or '&14' = '1')then(null)else(um.tanka)end) as tanka --見出し品番 金額非表示 もしくは 標準単価非表示であれば NULL -- ,(case when('&12' = um.hin_cd)then(null)else(case when('&13' = 'n_htanka')then(null)else(um.htanka)end)end) as htanka --#20659 2021.09.12 MOD STT --掛率100%は印字しない -- ,(case when('&12' = um.hin_cd or '&15' = '1')then(null)else(um.htanka)end) as htanka -- ,(case when('&12' = um.hin_cd or '&15' = '1' or coalesce(um.disc_per,0) = 0)then(null)else(um.htanka)end) as htanka ,(case when('&12' = um.hin_cd or '&15' = '1')then(null)else(um.htanka)end) as htanka --#20659 2021.09.12 MOD END --見出し品番 もしくは セット内訳 もしくは 金額非表示であれば NULL --#10454 2021.06.18 MOD STT -- ,(case when('&12' = um.hin_cd or '&14' = '1')then(null)else(um.kingaku)end) as kingaku ,(case when('&12' = um.hin_cd or um.set_row_no is not null or '&14' = '1')then(null)else(um.kingaku)end) as kingaku --#10454 2021.06.18 MOD END -- ,(case when('&13' = 'n_htanka')then(null)else(coalesce(um.disc_per,0) end) as disc_per --金額非表示 もしくは レス率非表示であれば NULL --#20344 2021.08.19 MOD STT -- ,(case when('&12' = um.hin_cd or '&16' = '1')then(null)else(coalesce(um.disc_per,0))end) as disc_per --#20659 2021.09.12 MOD STT --掛率100%は印字しない -- ,(case when('&12' = um.hin_cd or '&16' = '1')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 ,(case when('&12' = um.hin_cd or '&16' = '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 --#20659 2021.09.12 MOD END --#20344 2021.08.19 MOD END --,coalesce(um.disc_per,0) as disc_per --2021.05.05 MOD STT ,COALESCE(um.hin_nm_ext,'')||COALESCE(um.meisai_biko,'')||(case when('&15' != '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(h99a.han_name = '1' and um.hosoku2 != '')then(um.hosoku2||' '||coalesce(um.hosoku3,'')||' / '||coalesce(um.hosoku4,''))else(um.meisai_biko)end) as meisai_biko --2021.05.05 MOD END --ロケーション非表示であればNULL ,(case when('&17' = '1')then(mh.loc_no)else('')end) as loc_no --以下納品先出力まとめ↓ ,uh.nonyu_no --#19543 2021.06.17 MOD STT -- , case when &9 = '1' then case (coalesce(uh.nonyu_tan,'')) -- when '' then -- case coalesce(uh.nonyu_nm,'') when '' then '' -- else coalesce(uh.nonyu_nm,'') || ' ' || '御中' end -- else coalesce(uh.nonyu_nm,'') ||' '||coalesce(uh.nonyu_tan,'') || ' ' || '様' -- end -- end as nonyu_nm , 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 --#19543 2021.06.17 MOD END --#19543 2021.06.17 MOD STT -- , case coalesce(uh.tok_nm,'') -- when '' then '' -- else uh.tok_nm ||' '|| (case coalesce(uh.tok_tan,'') -- when '' then (case coalesce(uh.keisyo,'') -- when '' then (case coalesce(t.keisyo,'') when '' then '' else t.keisyo end) -- else uh.keisyo end) -- else uh.tok_tan ||' '||(case coalesce(uh.keisyo,'') -- when '' then'' else uh.keisyo end)end) -- end as tok_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 --#19543 2021.06.17 MOD END --#20525 2021.08.30 MOD STT --#20756 2021.09.17 MOD STT -- , uh.tok_nm||' '||fnc_get_keisyo_1(uh.tok_nm, uh.tok_tan, uh.keisyo) as tok_nm_s -- , (case when(uh.tok_tan != '')then(uh.tok_tan||' '||fnc_get_keisyo_2(uh.tok_nm, uh.tok_tan, uh.keisyo))end) as tok_tan , (case when(t.hojin_nm != '' and '&21' = '')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 '&21' = '')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 '&21' = '')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 --#20756 2021.09.17 MOD END --#20525 2021.08.30 MOD END , case when &9 = '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 &9 = '1' then uh.nonyu_addr1 else '' end as addr1 , case when &9 = '1' then uh.nonyu_addr2 else '' end as addr2 , case when &9 = '1' then uh.nonyu_addr3 else '' end as addr3 , case when &9 = '1' then uh.nonyu_addr4 else '' end as addr4 , case when &9 = '1' then coalesce(uh.nonyu_tel_no,'') else '' end as nonyu_tel , case when &9 = '1' then coalesce(uh.nonyu_fax_no,'') else '' end as nonyu_fax --coalesce(uh.nonyu_nm,'') ||' '||coalesce(nonyu_tan,'') as nonyu_nm, /*(case uh.nonyu_zip_no when '' then '' else '〒'||left(uh.nonyu_zip_no,3)||'-'||right(uh.nonyu_zip_no,4) end) as zip_no*/ --,uh.nonyu_addr1 as addr1 --,uh.nonyu_addr2 as addr2 --,uh.nonyu_addr3 as addr3 --,uh.nonyu_addr4 as addr4 --,coalesce(uh.nonyu_tel_no,'') as nonyu_tel --,coalesce(uh.nonyu_fax_no,'') as nonyu_fax -- , uh.payment_term as tori_cond , 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 --#20423 2021.08.30 MOD STT , (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 '&12' != um_kei.hin_cd )else('')end) as suryo_kei_view --#20423 2021.08.30 MOD END --以下書類ヘッダ出力部分まとめ↓ , case when &11 = '0' then 'お客様コード:'||coalesce(uh.tok_cd,'') else '' end as tok_cd --#20525 2021.08.30 MOD STT -- ,(case coalesce(uh.tok_nm,'') -- when '' then '' -- else uh.tok_nm ||' '|| (case coalesce(uh.tok_tan,'') -- when '' then (case coalesce(uh.keisyo,'') -- when '' then (case coalesce(t.keisyo,'') when '' then '' else t.keisyo end) -- else uh.keisyo end) -- else uh.tok_tan ||' '||(case coalesce(uh.keisyo,'') -- when '' then'' else uh.keisyo end)end) -- end) as tok_nm --#20525 2021.08.30 MOD END , case when &9 = '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 &9 = '1' then uh.tok_addr1 --書類送付先機能がONの場合&9は1が入りtok_addrシリーズを使う else uh.nonyu_addr1 --書類送付先機能がOFFの場合&9は0が入りnonyu_addrシリーズを使う、画面上が空白なら空になる end as tok_addr1 , case when &9 = '1' then uh.tok_addr2 else uh.nonyu_addr2 end as tok_addr2 , case when &9 = '1' then uh.tok_addr3 else uh.nonyu_addr3 end as tok_addr3 , case when &9 = '1' then uh.tok_addr4 else uh.nonyu_addr4 end as tok_addr4 , case when &9 = '1' then coalesce(uh.tok_tel_no,'') else coalesce(uh.nonyu_tel_no,'') end as tok_tel , case when &9 = '1' then coalesce(uh.tok_fax_no,'') else coalesce(uh.nonyu_fax_no,'') end as tok_fax /*, uh.tok_addr1 , uh.tok_addr2 , uh.tok_addr3 , uh.tok_addr4 , coalesce(uh.tok_tel_no,'') as tok_tel , coalesce(uh.tok_fax_no,'') 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 = 'hsk2-v0210') 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') --#19180 2021.08.23 MOD STT 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') --#19180 2021.08.23 MOD END --#20423 2021.08.30 MOD STT left join m_hanyo h99f on (h99f.mst_kbn = '99' and h99f.han_cd = 'sttl-r0023') --#20423 2021.08.30 MOD END --left join m_hanyo j on (j.mst_kbn='90' and j.han_cd='jisya') --left join m_hanyo jf on (jf.mst_kbn='09' and jf.han_cd='0') --left join m_hanyo h1 on (h1.mst_kbn = '09' and h1.han_cd = (case when(t.furikikan != '')then(t.furikikan)else(j.koumoku9)end)) 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 --#20172 2021.08.04 MOD STT and uh.del_flg = 0 --#20172 2021.08.04 MOD END and uh.jucyu_flg = &8 --#19858 2021.07.09 MOD STT and COALESCE(uh.via_seq,0) = 0 --#19858 2021.07.09 MOD END and ((uh.syori_ymd >= '&1') or ('&1' = '')) and ((uh.syori_ymd <= '&2') or ('&2' = '')) and ((uh.input_ymd >= '&19') or ('&19' = '')) and ((uh.input_ymd <= '&20') or ('&20' = '')) and ((uh.den_no = fnc_to_number('&3')) or ('' = '&3')) and ((uh.tok_cd = '&4') or ('&4' = '')) and ((um.hin_nm like '%&5%') or ('&5' = '')) and (('&7' = '') or ( (uh.tok_cd,uh.seikyu_ymd) in (select tok_cd, seikyu_ymd from w_basr0030 w where w.s_id = fnc_to_number('&7')) )) and ((uh.eig_cd = '&18') or ('&18' = '')) order by uh.den_no,um.row_no [SelectRecords_Jisya] 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 --,'URL:' || j_url 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.* --#20519 2021.08.30 MOD STT --,replace(replace('&1','(定価非表示)',''),'(金額無し)','') as report_title --#20620 2021.09.04 MOD STT -- ,(case('&4')when('1')then('納品書')when('')then('請求書')else('&1')end) as report_title ,(case when('&5' != '')then('&5')else( (case('&4')when('1')then('納品書')when('')then('請求書')else('&1')end) )end) as report_title --#20620 2021.09.04 MOD END --#20519 2021.08.30 MOD END 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.koumoku9 as j_daihyo koumoku9の0がなんなのかわからないので救急措置 ,j.koumoku8 as j_email -- ,j.koumoku9 -- ,j.koumoku10 ,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 --1行目 ,case when coalesce(m1.koumoku2,'') = '' then '' else coalesce(m1.koumoku2,'') end as mongon2 --1行目 ,case when coalesce(m1.koumoku3,'') = '' then '' else coalesce(m1.koumoku3,'') end as mongon3 --2行目 ,case when coalesce(m1.koumoku4,'') = '' then '' else coalesce(m1.koumoku4,'') end as mongon4 --2行目 ,case when coalesce(m1.koumoku5,'') = '' then '' else coalesce(m1.koumoku5,'') end as mongon5 --3行目 /*,m1.koumoku1 as mongon1 ,m1.koumoku2 as mongon2 ,m1.koumoku3 as mongon3 ,m1.koumoku4 as mongon4 ,m1.koumoku5 as mongon5 , '毎度お引き立てくださいましてありがとうございます。' as mongon1 , '下記の通りご請求させて頂きます。' as mongon2 , '尚、締切日以降の入金は含まれておりませんのでご了承ください。' as mongon3 , '' as mongon4 , '' 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 --, case when coalesce(rev.han_name,'') = '1' then coalesce(sp1.han_name,'') , 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 = '&2') --文言マスタ mst_kbn=03,koumoku7(ex: r0020.s,r0020.n) 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('&3')) 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' --2021.04.21 MOD STT --少し判りづらい -- and j.han_cd = 'jisya' || (case (eig.han_name) when '1' then case (coalesce(t.eig_cd,'')) when '' then '' else ('_' || t.eig_cd) end else('') end) and j.han_cd = 'jisya' || (case when(eig.han_name = '1' and t.eig_cd != '')then('_' || t.eig_cd)else('')end) --2021.04.21 MOD END )w [SelectRecords_Furi] 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 = '&3') 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 [SelectLogo] 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' ; [SelectSyaban] 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' [SelectImage] select file_image from m_image where image_cd = '&1' ; [SelectImageList] select image_cd, file_image from m_image where image_cd like '&1%' order by image_cd