create view vi_lb_paymentofclaims_revoke as SELECT LPI.ID                                                 AS ID,
       LPI.CONTRACT_ID                                        AS CONTRACT_ID,
       LCI.CONTRACT_NUMBER                                    AS CONTRACT_NUMBER,
       LCI.PROJECT_DEPT                                       AS PROJECT_DEPT,
       LUL.CUSTOMER_NAME                                      AS CUSTOMER_NAME,
       LCC.CLEAN_LEASE_MONEY                                  AS CLEAN_LEASE_MONEY,
       LCC.NOMINAL_PRICE                                      AS NOMINAL_PRICE,
       `nvl`(BVRP.RENTOVER, 0)                                AS RENTOVER,
       `nvl`(BVRP.PENALTYOVER, 0)                             AS PENALTYOVER,
       `nvl`(AVRP.CORPUSOVER, 0)                              AS CORPUSOVER,
       `nvl`(AVRP.INTERESTOVER, 0)                            AS INTERESTOVER,
       HD.HIREDATE                                            AS HIREDATE,
       VRP.OVERNUMBER                                         AS OVERNUMBER,
       `nvl`(HD.RENT, 0)                                      AS RENT,
       round((LCC.CAUTION_MONEY - `nvl`(CT.FACTMONEY, 0)), 2) AS CAUTIONMONEY,
       0                                                      AS CHANNELCAUTIONMONEY
FROM (((((((((APZL.LB_PAYMENTOFCLAIMS_INFO LPI LEFT JOIN APZL.LC_CALC_CONDITION LCC ON ((LPI.CONTRACT_ID = LCC.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.VI_RENT_PLAN.CONTRACT_ID       AS CONTRACT_ID,
           sum(APZL.VI_RENT_PLAN.RENT_OVER)    AS RENTOVER,
           sum(APZL.VI_RENT_PLAN.PENALTY_OVER) AS PENALTYOVER
    FROM APZL.VI_RENT_PLAN
    WHERE (date_format(APZL.VI_RENT_PLAN.PLAN_DATE, '%Y/%m/%d') <= now())
    GROUP BY APZL.VI_RENT_PLAN.CONTRACT_ID
) BVRP ON ((BVRP.CONTRACT_ID = LPI.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.VI_RENT_PLAN.CONTRACT_ID        AS CONTRACT_ID,
           sum(APZL.VI_RENT_PLAN.CORPUS_OVER)   AS CORPUSOVER,
           sum(APZL.VI_RENT_PLAN.INTEREST_OVER) AS INTERESTOVER
    FROM APZL.VI_RENT_PLAN
    WHERE (str_to_date(APZL.VI_RENT_PLAN.PLAN_DATE, '%Y/%m/%d') > now())
    GROUP BY APZL.VI_RENT_PLAN.CONTRACT_ID
) AVRP ON ((AVRP.CONTRACT_ID = LPI.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.LC_RENT_INCOME.CONTRACT_ID AS CONTRACT_ID, max(APZL.LC_RENT_INCOME.HIRE_DATE) AS HIREDATE, sum(APZL.LC_RENT_INCOME.RENT) AS RENT
    FROM APZL.LC_RENT_INCOME
    WHERE (APZL.LC_RENT_INCOME.ROLL_BACK = '0')
    GROUP BY APZL.LC_RENT_INCOME.CONTRACT_ID
) HD ON ((HD.CONTRACT_ID = LPI.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.VI_RENT_PLAN.CONTRACT_ID AS CONTRACT_ID, count(1) AS OVERNUMBER
    FROM APZL.VI_RENT_PLAN
    WHERE ((str_to_date(APZL.VI_RENT_PLAN.PLAN_DATE, '%Y/%m/%d') <= now()) AND
           ((APZL.VI_RENT_PLAN.PENALTY_OVER > 0) OR (APZL.VI_RENT_PLAN.RENT_OVER > 0)))
    GROUP BY APZL.VI_RENT_PLAN.CONTRACT_ID
) VRP ON ((VRP.CONTRACT_ID = LPI.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.VI_LC_FUND_PLAN.CONTRACT_ID AS CONTRACT_ID, sum(APZL.VI_LC_FUND_PLAN.FACT_MONEY) AS FACTMONEY
    FROM APZL.VI_LC_FUND_PLAN
    WHERE (APZL.VI_LC_FUND_PLAN.FEE_TYPE = 'feetype16')
    GROUP BY APZL.VI_LC_FUND_PLAN.CONTRACT_ID
) CT ON ((CT.CONTRACT_ID = LPI.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.VI_LC_FUND_PLAN.CONTRACT_ID AS CONTRACT_ID, sum(APZL.VI_LC_FUND_PLAN.FACT_MONEY) AS FACTMONEY
    FROM APZL.VI_LC_FUND_PLAN
    WHERE (APZL.VI_LC_FUND_PLAN.FEE_TYPE = 'feetype29')
    GROUP BY APZL.VI_LC_FUND_PLAN.CONTRACT_ID
) CH ON ((CH.CONTRACT_ID = LPI.CONTRACT_ID))) LEFT JOIN APZL.LB_CONTRACT_INFO LCI ON ((LCI.ID = LPI.CONTRACT_ID)))
LEFT JOIN APZL.LB_UNION_LESSEE LUL ON (((LUL.CONTRACT_ID = LPI.CONTRACT_ID) AND (LUL.IS_MAIN = 'Y'))))
WHERE ((LPI.STATUS = 'normal') AND (VRP.OVERNUMBER <= 2));

-- comment on column vi_lb_paymentofclaims_revoke.id not supported: 标识

-- comment on column vi_lb_paymentofclaims_revoke.contract_id not supported: 合同编号

-- comment on column vi_lb_paymentofclaims_revoke.contract_number not supported: 业务合同号

-- comment on column vi_lb_paymentofclaims_revoke.project_dept not supported: 出单部门

-- comment on column vi_lb_paymentofclaims_revoke.customer_name not supported: 承租人名称

-- comment on column vi_lb_paymentofclaims_revoke.clean_lease_money not supported: 融资额

-- comment on column vi_lb_paymentofclaims_revoke.nominal_price not supported: 留购价款

-- comment on column vi_lb_paymentofclaims_revoke.hiredate not supported: 核销日期

