create view vi_chargebackvoucherdetail as SELECT LRP.ID                                                              AS ID,
       LCI.CONTRACT_NO                                                     AS CONTRACT_NO,
       CIF.CUSTOMER_NUM                                                    AS CUSTOMER_NUM,
       CIF.CUSTOMERNAME                                                    AS CUSTOMERNAME,
       LRI.PLAN_LIST                                                       AS PLAN_LIST,
       LRI.HIRE_DATE                                                       AS HIRE_DATE,
       LRI.RENT                                                            AS RENT,
       LRI.CORPUS                                                          AS CORPUS,
       LRI.INTEREST                                                        AS INTEREST,
       LRI.PENALTY                                                         AS PENALTY,
       LRI.OWN_NUMBER                                                      AS OWN_NUMBER,
       (ifnull(LRI.RENT, 0) + ifnull(LRI.PENALTY, 0))                      AS SUMMONEY,
       CA.BANK_NAME                                                        AS BANK_NAME,
       CA.ACCOUNT                                                          AS ACCOUNT,
       CA.ACC_NUMBER                                                       AS ACC_NUMBER,
       LRI.ACCOUNTING_DATE                                                 AS ACCOUNTING_DATE,
       LRI.ID                                                              AS INCOME_ID,
       LCI.DISTRIBUTOR_ID                                                  AS DISTRIBUTORID,
       (CASE WHEN (LRP.COLLECT_STATUS = '批量收款') THEN '广州银联' ELSE '其它' END) AS CHANNEL,
       VSS.ACHIEVED_DATE                                                   AS ACHIEVED_DATE
FROM ((((((APZL.LC_RENT_PLAN LRP LEFT JOIN APZL.LC_RENT_INCOME LRI ON (((LRI.CONTRACT_ID = LRP.CONTRACT_ID) AND (LRI.PLAN_LIST = LRP.PLAN_LIST)))) LEFT JOIN APZL.LB_CONTRACT_INFO LCI ON ((LCI.ID = LRI.CONTRACT_ID))) LEFT JOIN APZL.LB_UNION_LESSEE LUL ON ((LUL.CONTRACT_ID = LCI.ID))) LEFT JOIN APZL.CUSTOMER_INFO CIF ON ((CIF.CUSTOMERID = LUL.CUSTOMER_ID))) LEFT JOIN APZL.CUSTOMER_ACCOUNT CA ON (((CA.CONTRACT_ID = LCI.ID) AND (CA.ACC_TYPE = 'Debit'))))
LEFT JOIN APZL.VERIFICATIONSPARE VSS ON ((VSS.SPARE_BATCH_NO = convert(LRI.SPARE_BATCH_NO USING UTF8))))
WHERE ((LRP.COLLECT_STATUS IN ('手工收款', '批量收款', '网银收款')) AND ((LRI.EBANK_NUMBER = '') OR isnull(LRI.EBANK_NUMBER)));

-- comment on column vi_chargebackvoucherdetail.ID not supported: 标识

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

-- comment on column vi_chargebackvoucherdetail.CUSTOMER_NUM not supported: 客户编码

-- comment on column vi_chargebackvoucherdetail.CUSTOMERNAME not supported: 客户名称

-- comment on column vi_chargebackvoucherdetail.PLAN_LIST not supported: 租金计划期次

-- comment on column vi_chargebackvoucherdetail.HIRE_DATE not supported: 核销日期

-- comment on column vi_chargebackvoucherdetail.RENT not supported: 回笼租金

-- comment on column vi_chargebackvoucherdetail.CORPUS not supported: 回笼本金

-- comment on column vi_chargebackvoucherdetail.INTEREST not supported: 回笼租息

-- comment on column vi_chargebackvoucherdetail.PENALTY not supported: 回笼罚息

-- comment on column vi_chargebackvoucherdetail.own_number not supported: 本方银行帐号

-- comment on column vi_chargebackvoucherdetail.BANK_NAME not supported: 开户银行

-- comment on column vi_chargebackvoucherdetail.ACCOUNT not supported: 帐户名称

-- comment on column vi_chargebackvoucherdetail.ACC_NUMBER not supported: 银行账号

-- comment on column vi_chargebackvoucherdetail.ACCOUNTING_DATE not supported: 会计处理日

-- comment on column vi_chargebackvoucherdetail.income_ID not supported: 标识

-- comment on column vi_chargebackvoucherdetail.distributorid not supported: 经销商IDid

