create or replace view vw_bq13_ybzhxx as
select
  X.ZYID00,
  X.RYCWH0,
  X.XB0000,
  X.XM0000,
  X.DQBQ00,
  X.DQKS00,
  X.BRZT00,
  X.ZYH000,
  SF_BQ13_KYJE00(X.ZYID00,B.BRID00,2)KYJE00,
  L.YBMC00,
  L.YBQFBZ,
  L.YBZFBL,
  B.BRID00,
  J.JFLBMC,
  Z.JFLBID,
  Z.SFDJ00,
  Z.ZYE000,
  Z.YKZYE0,
  Z.WJSJE0,
  Z.TYJE00,
  Z.BJJE00,
  SF_BQ13_YXQF00(NULL,B.BRID00)YXQFJE,
  Z.YBYJS0,
  Z.YBYZF0,
  Z.YBZHYE,
  SF_SF_QDYJE0(X.ZYID00,to_char(sysdate,'YYYYMMDD')) YJJE00,
  SF_SF_QDFYLJ(X.ZYID00,to_char(sysdate,'YYYYMMDD')) FYLJ00,
  nvl((select SUM(HJJE00) from VW_BQ13_RQDMX0 K where X.ZYH000=K.ZYH000  and TO_Char(SYSDATE-1,'YYYYMMDD')=K.QDH000),0) QRFYZE,
  nvl((select SUM(HJJE00) from VW_BQ13_RQDMX0 K where X.ZYH000=K.ZYH000  and TO_Char(SYSDATE,'YYYYMMDD')=K.QDH000),0) JRFYZE
from ZY_BRZHXX Z,ZY_BRXXB0 X,BM_BRJFLB J,BM_BRXXB0 B,VW_BQ13_YBZFBL L
where Z.BRID00=X.BRID00 and Z.JFLBID=J.JFLBID and Z.BRID00=B.BRID00  and
      B.BRID00=X.BRID00 and x.YBLB00=L.YBLB00 and x.YBBRLB=L.YBBRLB  and
      J.SYBZ00='1' and J.SFYX00='Y'
      and x.FBBH00=L.FBBH00;
