create view vi_invoice_rent_plan_confirm as SELECT LRII.ID                                   AS ID,
       LCI.ID                                    AS CONTRACT_ID,
       LCI.CONTRACT_NO                           AS CONTRACT_NO,
       LRII.PAYMENT_NUMBER                       AS PAYMENT_NUMBER,
       LUL.CUSTOMER_ID                           AS CUSTOMER_ID,
       LUL.CUSTOMER_NAME                         AS CUSTOMER_NAME,
       LRI.PLAN_LIST                             AS PLAN_LIST,
       LRI.HIRE_DATE                             AS PLAN_DATE,
       LRII.INVOICE_MONEY                        AS PLAN_MONEY,
       LRII.INVOICE_MONEY                        AS INVOICE_MONEY,
       (CASE LRII.TAX_TYPE
            WHEN 'gps' THEN 'GPS安装服务费'
            WHEN 'myhj' THEN '名义货价'
            WHEN 'sxf' THEN '手续费'
            WHEN 'interest' THEN '租息'
            WHEN 'overinterest' THEN '逾期利息' END) AS TAX_TYPE,
       LRII.TAX_REG_CODE                         AS TAX_REG_CODE,
       LRII.TAX_BANK                             AS TAX_BANK,
       LRII.TAX_ACC                              AS TAX_ACC,
       LRII.INVOICE_STATUS                       AS INVOICE_STATUS
FROM (((APZL.LI_RENT_INVOICE_INFO LRII LEFT JOIN APZL.LC_RENT_INCOME LRI ON (((LRI.CONTRACT_ID = LRII.CONTRACT_ID) AND (LRI.PLAN_ID = LRII.PLAN_ID)))) LEFT JOIN APZL.LB_CONTRACT_INFO LCI ON ((LCI.ID = LRII.CONTRACT_ID)))
LEFT JOIN APZL.LB_UNION_LESSEE LUL ON (((LUL.CONTRACT_ID = LCI.ID) AND (LUL.IS_MAIN = 'Y'))))
WHERE ((LRII.INVOICE_STATUS = '1') AND (LRII.BILL_TYPE = 'electronic') AND (LRII.INVOICE_OBJECT = 'back_rent'))
ORDER BY LCI.ID, LRI.PLAN_LIST;

-- comment on column vi_invoice_rent_plan_confirm.id not supported: 编号

-- comment on column vi_invoice_rent_plan_confirm.contract_id not supported: 编号

-- comment on column vi_invoice_rent_plan_confirm.CONTRACT_NO not supported: 合同号

-- comment on column vi_invoice_rent_plan_confirm.PAYMENT_NUMBER not supported: 投放编号

-- comment on column vi_invoice_rent_plan_confirm.CUSTOMER_ID not supported: 承租人编号

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

-- comment on column vi_invoice_rent_plan_confirm.plan_list not supported: 租金计划期次

-- comment on column vi_invoice_rent_plan_confirm.plan_date not supported: 核销日期

-- comment on column vi_invoice_rent_plan_confirm.plan_money not supported: 开票金额

-- comment on column vi_invoice_rent_plan_confirm.invoice_money not supported: 开票金额

-- comment on column vi_invoice_rent_plan_confirm.TAX_REG_CODE not supported: 纳税人识别号

-- comment on column vi_invoice_rent_plan_confirm.TAX_BANK not supported: 开户行

-- comment on column vi_invoice_rent_plan_confirm.TAX_ACC not supported: 开户账号

-- comment on column vi_invoice_rent_plan_confirm.invoice_status not supported: 发票状态

