create view vi_contract_overdue as SELECT VRPS.CONTRACT_ID    AS CONTRACT_ID,
       LCI.CONTRACT_NUMBER AS CONTRACT_NUMBER,
       LCI.CONTRACT_STATUS AS CONTRACT_STATUS,
       VRPS.OVER_LIST      AS OVER_LIST,
       VRPS.OVER_DAYS      AS OVER_DAYS,
       VRPS.OVER_MONEY     AS OVER_MONEY,
       VRPS.OVER_PENALTY   AS OVER_PENALTY
FROM (APZL.VI_OVERDUE_RENT_PLAN_SUM VRPS
LEFT JOIN APZL.LB_CONTRACT_INFO LCI ON ((LCI.ID = VRPS.CONTRACT_ID)))
WHERE ((VRPS.OVER_DAYS > 0) AND (VRPS.OVER_MONEY > 0) AND (LCI.CONTRACT_STATUS = '31') AND (NOT (LCI.CONTRACT_NUMBER IN (
    SELECT BS.CONTRACT_NUMBER
    FROM APZL.BUSINESS_STATUS BS
    WHERE ((BS.BUSINESS_STATUS = '46') AND (BS.OVER_DAYS = VRPS.OVER_DAYS) AND
           (left(BS.INPUTTIME, 10) = convert(date_format(sysdate(), '%Y/%m/%d') USING GBK)))
))));

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

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

-- comment on column vi_contract_overdue.CONTRACT_STATUS not supported: 合同状态

