找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 3047|回复: 9

[技巧] 手工设计的 报表 帮看看!

[复制链接]
发表于 2009-5-31 13:49:25 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
现在要加点 查询条件!别人做的!我现在想加 客户名称的查询条件 在那里修改呢!
select (select unitname
          from bd_corp
         where nvl(dr, 0) = 0
           and pk_corp = tsu.pk_corp) corpname,
       tsu.ryname ryname,
       tsu.custname custname,
       tsu.custcode custcode,
       tsu.trmname trmname,
       sum(tsu.qm) sumqm,
       sum(tsu.onemonth) + sum(tsu.wkp) sumone,
        sum(tsu.onemonth) + sum(tsu.wkp) sumone,
       sum(tsu.twomonth) sumtwo,
       sum(tsu.threemonth) sumthree,
       sum(tsu.fourtosixmonth) sumfortosix,
       sum(tsu.sevenmonth) sumseve,
        '' yjhk,
        '' bz
  from (
        
        select a.pk_corp,
                (select termname
                   from bd_payterm
                  where nvl(dr, 0) = 0
                    and pk_payterm =
                        (select cm.pk_payterm
                           from bd_cubasdoc cb, bd_cumandoc cm
                          where cb.pk_cubasdoc = cm.pk_cubasdoc
                            and nvl(cb.dr, 0) = 0
                            and nvl(cm.dr, 0) = 0
                            and cb.custcode =
                                (select distinct valuecode
                                   from gl_freevalue
                                  where checktype in
                                        (select pk_bdinfo
                                           from bd_bdinfo
                                          where refnodename = '客商辅助核算')
                                    and freevalueid = a.assid)
                            and cm.pk_corp = a.pk_corp
                            and cm.custflag = '2')) trmname,                                 
                (select psnname
                   from bd_psndoc
                  where pk_psndoc =
                        (select cm.pk_resppsn1
                           from bd_cubasdoc cb, bd_cumandoc cm
                          where cb.pk_cubasdoc = cm.pk_cubasdoc
                            and nvl(cb.dr, 0) = 0
                            and nvl(cm.dr, 0) = 0
                            and cb.custcode =
                                (select distinct valuecode
                                   from gl_freevalue
                                  where checktype in
                                        (select pk_bdinfo
                                           from bd_bdinfo
                                          where refnodename = '客商辅助核算')
                                    and freevalueid = a.assid)
                            and cm.pk_corp = a.pk_corp
                            and cm.custflag = '2')) ryname,
                (select valuename
                   from gl_freevalue
                  where checktype in
                        (select pk_bdinfo
                           from bd_bdinfo
                          where refnodename = '客商辅助核算')
                    and freevalueid = a.assid) custname,
                    
                (select distinct valuecode
                                   from gl_freevalue
                                  where checktype in
                                        (select pk_bdinfo
                                           from bd_bdinfo
                                          where refnodename = '客商辅助核算')
                                    and freevalueid = a.assid) custcode,
 楼主| 发表于 2009-5-31 13:51:50 | 显示全部楼层
1# 51nicholas
0 qc,
                0 jfby,
                0 jflj,
                0 dfby,
                0 dflj,
                sum(a.localdebitamount) - sum(a.localcreditamount) qm,
                0 wkp,
                0 onemonth,
                0 twomonth,
                0 threemonth,
                0 fourtosixmonth,
                0 sevenmonth
          from gl_balance a, bd_accsubj c
         where a.pk_accsubj = c.pk_accsubj
           and c.subjcode like '1131%'
           and c.subjcode <> '113103'
           and a.pk_corp in (#corp#)
           and a.year = substr(#dateto#, 0, 4)
           and a.period <= substr(#dateto#, 6, 2)
           and a.dr = 0
         group by a.assid, a.pk_corp
        union all
        select taa_ta.pk_corp,
               
               (select termname
                  from bd_payterm
                 where nvl(dr, 0) = 0
                   and pk_payterm = (select cm.pk_payterm
                                       from bd_cubasdoc cb, bd_cumandoc cm
                                      where cb.pk_cubasdoc = cm.pk_cubasdoc
                                        and nvl(cb.dr, 0) = 0
                                        and nvl(cm.dr, 0) = 0
                                        and cb.custcode = taa_ta.custcode
                                        and cm.pk_corp = taa_ta.pk_corp
                                        and cm.custflag = '2')) trmname,
               
               (select psnname
                  from bd_psndoc
                 where pk_psndoc = (select cm.pk_resppsn1
                                      from bd_cubasdoc cb, bd_cumandoc cm
                                     where cb.pk_cubasdoc = cm.pk_cubasdoc
                                       and nvl(cb.dr, 0) = 0
                                       and nvl(cm.dr, 0) = 0
                                       and cb.custcode = taa_ta.custcode
                                       and cm.pk_corp = taa_ta.pk_corp
                                       and cm.custflag = '2')) ryname,
                           
               taa_ta.custname custname,
               taa_ta.custcode custcode,
               0 qc,
               0 jfby,
               0 jflj,
               0 dfby,
               0 dflj,
               0 qm,
               round(sum(taa_ta.wkp) * 1.17, 2) wkp,
               0 onemonth,
               0 twomonth,
               0 threemonth,
               0 fourtosixmonth,
               0 sevenmonth
          from (select ic_general_h.pk_corp,
                       bd_cubasdoc.custcode as custcode,
                       bd_cubasdoc.custname as custname,
                       sum((ic_general_b.noutnum * ic_general_b.nsaleprice) -
                           nvl(ta.noriginalcurmny, 0)) as wkp
                  from ic_general_b,
                       ic_general_h,
                       bd_corp,
                       bd_cumandoc,
                       bd_cubasdoc,
                       bd_invmandoc,
                       bd_invbasdoc,
                       bd_stordoc,
                       (select ic_general_b.cgeneralbid as cgeneralbid,
                               sum(so_saleinvoice_b.nnumber) as nnumber,
                               sum(so_saleinvoice_b.noriginalcurmny) as noriginalcurmny
                          from ic_general_b,
                               ic_general_h,
                               bd_corp,
                               bd_cumandoc,
                               bd_cubasdoc,
                               bd_invmandoc,
                               bd_invbasdoc,
                               so_saleinvoice_b
                         where ic_general_b.cgeneralhid =
                               ic_general_h.cgeneralhid
                           and ic_general_h.pk_corp = bd_corp.pk_corp
                           and ic_general_h.ccustomerid =
                               bd_cumandoc.pk_cumandoc
                           and bd_cumandoc.pk_cubasdoc =
                               bd_cubasdoc.pk_cubasdoc
                           and ic_general_b.cinventoryid =
                               bd_invmandoc.pk_invmandoc
                           and bd_invmandoc.pk_invbasdoc =
                               bd_invbasdoc.pk_invbasdoc
                           and ic_general_b.cgeneralbid =
                               so_saleinvoice_b.cupsourcebillbodyid
                           and (nvl(ic_general_h.dr, 0) = 0)
                           and (nvl(ic_general_b.dr, 0) = 0)
                           and (nvl(so_saleinvoice_b.dr, 0) = 0)
                           and (nvl(bd_invbasdoc.dr, 0) = 0)
                           and (nvl(bd_invmandoc.dr, 0) = 0)
                           and (nvl(bd_cubasdoc.dr, 0) = 0)
                           and (nvl(bd_cumandoc.dr, 0) = 0)
                           and (ic_general_h.fbillflag = '3')
                           and ic_general_h.dbilldate <= #dateto#
                           and ic_general_h.pk_corp in (#corp#)
                         group by ic_general_b.cgeneralbid) ta
                 where ic_general_b.cgeneralhid = ic_general_h.cgeneralhid
                   and ic_general_h.pk_corp = bd_corp.pk_corp
                   and ic_general_h.ccustomerid = bd_cumandoc.pk_cumandoc
                   and bd_cumandoc.pk_cubasdoc = bd_cubasdoc.pk_cubasdoc
                   and ic_general_b.cinventoryid = bd_invmandoc.pk_invmandoc
                   and bd_invmandoc.pk_invbasdoc = bd_invbasdoc.pk_invbasdoc
                   and ic_general_h.cwarehouseid = bd_stordoc.pk_stordoc
                   and ta.cgeneralbid(+) = ic_general_b.cgeneralbid
                   and (nvl(ic_general_h.dr, 0) = 0)
                   and (nvl(ic_general_b.dr, 0) = 0)
                   and (ic_general_h.fbillflag = '3')
                   and (nvl(bd_invbasdoc.dr, 0) = 0)
                   and (nvl(bd_invmandoc.dr, 0) = 0)
                   and (nvl(bd_cubasdoc.dr, 0) = 0)
                   and (nvl(bd_cumandoc.dr, 0) = 0)
                   and (ic_general_h.cbilltypecode = '4C')
                   and ic_general_h.pk_corp in (#corp#)
                   and ic_general_h.dbilldate <=
                       (substr(#dateto#, 0, 7) || '-21')
                 group by ic_general_b.noutnum,
                          ta.nnumber,
                          bd_cubasdoc.custcode,
                          bd_cubasdoc.custname,
                          ta.noriginalcurmny,
                          ic_general_h.pk_corp
                having((ic_general_b.noutnum - nvl(ta.nnumber, 0)) != 0)) taa_ta
         group by taa_ta.custcode, taa_ta.custname, taa_ta.pk_corp
        union all
        select zl_ta.pk_corp,
 楼主| 发表于 2009-5-31 13:58:47 | 显示全部楼层
(select termname
                  from bd_payterm
                 where nvl(dr, 0) = 0
                   and pk_payterm =
                       (select cm.pk_payterm
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) termname,
               
               (select psnname
                  from bd_psndoc
                 where pk_psndoc =
                       (select cm.pk_resppsn1
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) ryname,
              
               (select bas.custname
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custname,
               (select bas.custcode
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custcode,
                  
               0 qc,
               0 jfby,
               0 jflj,
               0 dfby,
               0 dflj,
               0 qm,
               0 wkp,
               sum(zl_ta.ysje) onemonth,
               0 twomonth,
               0 threemonth,
               0 fourtosixmonth,
               0 sevenmonth
          from (select zb.dwbm pk_corp,
                       fb.ksbm_cl pk_cust,
                       fb.fb_oid fboid,
                       (fb.jfbbje -
                       nvl((select sum(clb.jfclbbje)
                              from arap_djclb clb
                             where clb.fb_oid = fb.fb_oid
                               and clb.djbh like 'YS%'
                               and clb.clrq >=
                                   (substr(#dateto#, 0, 7) || '-01')
                               and clb.clrq <= #dateto#
                               and clb.dwbm = fb.dwbm),
                            0)) ysje
                  from arap_djfb fb, arap_djzb zb
                 where zb.vouchid = fb.vouchid
                   and nvl(fb.dr, 0) = 0
                   and zb.djlxbm = 'D0'
                   and fb.dwbm in (#corp#)
                   and zb.djrq >= (substr(#dateto#, 0, 7) || '-01')
                   and zb.djrq <= (substr(#dateto#, 0, 7) || '-31')) zl_ta
         group by zl_ta.pk_corp, zl_ta.pk_cust, zl_ta.pk_corp
        union all
        select zl_ta.pk_corp,
               
               (select termname
                  from bd_payterm
                 where nvl(dr, 0) = 0
                   and pk_payterm =
                       (select cm.pk_payterm
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) termname,
               (select psnname
                  from bd_psndoc
                 where pk_psndoc =
                       (select cm.pk_resppsn1
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) ryname,
              
               (select bas.custname
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custname,
                (select bas.custcode
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custcode,
               0 qc,
               0 jfby,
               0 jflj,
               0 dfby,
               0 dflj,
               0 qm,
               0 wkp,
               0 onemonth,
               sum(zl_ta.ysje) twomonth,
               0 threemonth,
               0 fourtosixmonth,
               0 sevenmonth
          from (select zb.dwbm pk_corp,
                       fb.ksbm_cl pk_cust,
                       fb.fb_oid fboid,
                       (fb.jfbbje -
                       nvl((select sum(clb.jfclbbje)
                              from arap_djclb clb
                             where clb.fb_oid = fb.fb_oid
                               and clb.djbh like 'YS%'
                               and clb.clrq >=
                                   (select lastmonthbegin
                                      from shyw_datetime
                                     where bdate = substr(#dateto#, 0, 7))
                               and clb.clrq <=
                                   (substr(#dateto#, 0, 7) || '-31')
                               and clb.dwbm = fb.dwbm),
                            0)) ysje
                  from arap_djfb fb, arap_djzb zb
                 where zb.vouchid = fb.vouchid
                   and nvl(fb.dr, 0) = 0
                   and zb.djlxbm = 'D0'
                   and fb.dwbm in (#corp#)
                   and zb.djrq >=
 楼主| 发表于 2009-5-31 14:00:07 | 显示全部楼层
(select lastmonthbegin
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))
                   and zb.djrq <=
                       (select lastmonthend
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))) zl_ta
         group by zl_ta.pk_corp, zl_ta.pk_cust, zl_ta.pk_corp
        union all
        select zl_ta.pk_corp,
               (select termname
                  from bd_payterm
                 where nvl(dr, 0) = 0
                   and pk_payterm =
                       (select cm.pk_payterm
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) termname,
               
               (select psnname
                  from bd_psndoc
                 where pk_psndoc =
                       (select cm.pk_resppsn1
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) ryname,
 楼主| 发表于 2009-5-31 14:01:08 | 显示全部楼层
(select bas.custname
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custname,
                  
                    (select bas.custcode
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custcode,
                  
               0 qc,
               0 jfby,
               0 jflj,
               0 dfby,
               0 dflj,
               0 qm,
               0 wkp,
               0 onemonth,
               0 twomonth,
               sum(zl_ta.ysje) threemonth,
               0 fourtosixmonth,
               0 sevenmonth
          from (select zb.dwbm pk_corp,
                       fb.ksbm_cl pk_cust,
                       fb.fb_oid fboid,
                       (fb.jfbbje -
                       nvl((select sum(clb.jfclbbje)
                              from arap_djclb clb
                             where clb.fb_oid = fb.fb_oid
                               and clb.djbh like 'YS%'
                               and clb.clrq >=
                                   (select lasttwomonthbegin
                                      from shyw_datetime
                                     where bdate = substr(#dateto#, 0, 7))
                               and clb.clrq <=
                                   (substr(#dateto#, 0, 7) || '-31')
                               and clb.dwbm = fb.dwbm),
                            0)) ysje
                  from arap_djfb fb, arap_djzb zb
                 where zb.vouchid = fb.vouchid
                   and nvl(fb.dr, 0) = 0
                   and zb.djlxbm = 'D0'
                   and fb.dwbm in (#corp#)
                   and zb.djrq >=
                       (select lasttwomonthbegin
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))
                   and zb.djrq <=
                       (select lasttwomonthend
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))) zl_ta
         group by zl_ta.pk_corp, zl_ta.pk_cust, zl_ta.pk_corp
        union all
        select zl_ta.pk_corp,
               (select termname
                  from bd_payterm
                 where nvl(dr, 0) = 0
                   and pk_payterm =
                       (select cm.pk_payterm
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) termname,
               (select psnname
                  from bd_psndoc
                 where pk_psndoc =
                       (select cm.pk_resppsn1
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) ryname,
               
               (select bas.custname
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custname,
                                       (select bas.custcode
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custcode,
               0 qc,
               0 jfby,
               0 jflj,
               0 dfby,
               0 dflj,
               0 qm,
               0 wkp,
               0 onemonth,
               0 twomonth,
               0 threemonth,
               sum(zl_ta.ysje) fourtosixmonth,
               0 sevenmonth
          from (select zb.dwbm pk_corp,
                       fb.ksbm_cl pk_cust,
                       fb.fb_oid fboid,
                       (fb.jfbbje -
                       nvl((select sum(clb.jfclbbje)
                              from arap_djclb clb
                             where clb.fb_oid = fb.fb_oid
                               and clb.djbh like 'YS%'
                               and clb.clrq >=
                                   (select lastfivemonthbegin
                                      from shyw_datetime
                                     where bdate = substr(#dateto#, 0, 7))
                               and clb.clrq <=
                                   (substr(#dateto#, 0, 7) || '-31')
                               and clb.dwbm = fb.dwbm),
                            0)) ysje
                  from arap_djfb fb, arap_djzb zb
                 where zb.vouchid = fb.vouchid
                   and nvl(fb.dr, 0) = 0
                   and zb.djlxbm = 'D0'
                   and fb.dwbm in (#corp#)
                   and zb.djrq >=
                       (select lastfivemonthbegin
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))
                   and zb.djrq <=
                       (select lastthreemonthend
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))) zl_ta
         group by zl_ta.pk_corp, zl_ta.pk_cust, zl_ta.pk_corp
        union all
        select zl_ta.pk_corp,
               (select termname
                  from bd_payterm
                 where nvl(dr, 0) = 0
                   and pk_payterm =
                       (select cm.pk_payterm
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) termname,
               (select psnname
                  from bd_psndoc
                 where pk_psndoc =
                       (select cm.pk_resppsn1
                          from bd_cubasdoc cb, bd_cumandoc cm
                         where cb.pk_cubasdoc = cm.pk_cubasdoc
                           and nvl(cb.dr, 0) = 0
                           and nvl(cm.dr, 0) = 0
                           and cm.pk_cumandoc = zl_ta.pk_cust)) ryname,
               
               (select bas.custname
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custname,
                (select bas.custcode
                  from bd_cubasdoc bas, bd_cumandoc cum
                 where bas.pk_cubasdoc = cum.pk_cubasdoc
                   and nvl(bas.dr, 0) = 0
                   and nvl(cum.dr, 0) = 0
                   and cum.pk_corp = zl_ta.pk_corp
                   and cum.pk_cumandoc = zl_ta.pk_cust) custcode,
               0 qc,
               0 jfby,
               0 jflj,
               0 dfby,
               0 dflj,
               0 qm,
               0 wkp,
               0 onemonth,
               0 twomonth,
               0 threemonth,
               0 fourtosixmonth,
               sum(zl_ta.ysje) sevenmonth
          from (select zb.dwbm pk_corp,
                       fb.ksbm_cl pk_cust,
                       fb.fb_oid fboid,
                       (fb.jfbbje -
                       nvl((select sum(clb.jfclbbje)
                              from arap_djclb clb
                             where clb.fb_oid = fb.fb_oid
                               and clb.djbh like 'YS%'
                               and clb.clrq <=
                                   (substr(#dateto#, 0, 7) || '-31')
                               and clb.dwbm = fb.dwbm),
                            0)) ysje
                  from arap_djfb fb, arap_djzb zb
                 where zb.vouchid = fb.vouchid
                   and nvl(fb.dr, 0) = 0
                   and zb.djlxbm = 'D0'
                   and fb.dwbm in (#corp#)
                   and zb.djrq <=
                       (select lastsixmonthend
                          from shyw_datetime
                         where bdate = substr(#dateto#, 0, 7))) zl_ta
         group by zl_ta.pk_corp, zl_ta.pk_cust, zl_ta.pk_corp) tsu
group by tsu.pk_corp, tsu.ryname, tsu.trmname, tsu.custname,tsu.custcode
发表于 2011-5-26 21:02:12 | 显示全部楼层
老兄贴的辛苦不?上传个文件不好?
发表于 2011-5-26 21:57:07 | 显示全部楼层
发表于 2011-6-9 22:50:36 | 显示全部楼层
真长啊,看起来都麻烦
发表于 2011-6-22 08:42:20 | 显示全部楼层
发表于 2011-7-23 19:23:39 | 显示全部楼层
贴个文件看要更方便些的
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-6-1 21:32 , Processed in 0.040390 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表