create view vi_maindata_paypass_info as (
SELECT LCI.ID                   AS ID,
       LCI.CONTRACT_NO          AS CONTRACT_NO,
       CI.CUSTOMERID            AS CUSTOMERID,
       CI.CUSTOMERNAME          AS CUSTOMERNAME,
       CL1.ITEMNAME             AS ITEMNAME,
       UI.USERNAME              AS USERNAME,
       CP.FULLNAME              AS FULLNAME,
       CC.CERTID                AS CERTID,
       LGU.FULLNAME             AS GUAR,
       CF1.NAME                 AS GONGTONG,
       CF2.NAME                 AS PEIOU,
       LEC.MODEL                AS MODEL,
       LCC.CONTRACT_PLAN_NUMBER AS CONTRACT_PLAN_NUMBER,
       LRP.PLAN_LIST            AS PLAN_LIST,
       LFP.PLAN_MONEY           AS PLAN_MONEY,
       LCF.FUND_OUT             AS FUND_OUT,
       CAT.ACCOUNT              AS ACCOUNT,
       LCCS.PLAN_STATUS         AS PLAN_STATUS
FROM (((((((((((((((((((APZL.LB_CONTRACT_INFO LCI LEFT JOIN APZL.LB_UNION_LESSEE LUL ON (((LCI.ID = LUL.CONTRACT_ID) AND (LUL.IS_MAIN = 'Y')))) LEFT JOIN APZL.CUSTOMER_INFO CI ON ((CI.CUSTOMERID = LUL.CUSTOMER_ID))) LEFT JOIN APZL.CUSTOMER_TYPE CT ON ((CI.CUSTOMERID = CT.CUSTOMERID))) LEFT JOIN APZL.CODE_LIBRARY CL1 ON (((CL1.ITEMNO = CT.CUSTTYPE) AND (CL1.CODENO = 'cust_type')))) LEFT JOIN APZL.CUSTOMER_ATTRIBUTION CA ON ((CI.CUSTOMERID = CA.CUSTOMERID))) LEFT JOIN APZL.USER_INFO UI ON ((CA.USERID = UI.USERID))) LEFT JOIN APZL.CUSTOMER_PERSON CP ON ((CI.CUSTOMERID = CP.CUSTOMERID))) LEFT JOIN APZL.CUSTOMER_CERT CC ON (((CI.CUSTOMERID = CC.CUSTOMERID) AND (CC.STATUS = 'valid')))) LEFT JOIN APZL.LB_GUARANTEE_UNIT LGU ON ((LGU.CONTRACT_ID = convert(LCI.ID USING UTF8)))) LEFT JOIN APZL.CUSTOMER_FAMILY CF1 ON (((CF1.CONTRACT_ID = LCI.ID) AND (CF1.SPOUSE_ <> 'Y')))) LEFT JOIN APZL.CUSTOMER_FAMILY CF2 ON (((CF2.CONTRACT_ID = LCI.ID) AND (CF2.SPOUSE_ = 'Y')))) LEFT JOIN APZL.LB_EQUIPMENT_CAR LEC ON ((LEC.CONTRACT_ID = convert(LCI.ID USING UTF8)))) LEFT JOIN APZL.LC_CALC_CONDITION LCC ON ((LCC.CONTRACT_ID = LCI.ID))) LEFT JOIN APZL.LC_RENT_PLAN LRP ON (((LRP.CONTRACT_ID = LCI.ID) AND (LRP.PLAN_LIST = 1)))) LEFT JOIN APZL.LC_FUND_PLAN LFP ON (((LFP.CONTRACT_ID = convert(LCI.ID USING UTF8)) AND (LFP.FEE_TYPE = 'feetype10')))) LEFT JOIN APZL.LC_FUND_INCOME LFI ON (((LFI.PLAN_ID = LFP.ID) AND (LFI.ROLL_BACK = 0) AND (LFI.PAY_STATUS = 'have_paid')))) LEFT JOIN APZL.LC_CASH_FLOW LCF ON (((LCF.CONTRACT_ID = LCI.ID) AND (LCF.FUND_OUT > 0)))) LEFT JOIN APZL.CUSTOMER_ACCOUNT CAT ON ((CAT.CONTRACT_ID = LCI.ID)))
LEFT JOIN APZL.LC_CALC_CONDITION_STATUS LCCS ON ((LCCS.CONTRACT_ID = LCI.ID)))
WHERE (LCI.CONTRACT_STATUS = '31'));

-- comment on column vi_maindata_paypass_info.ID not supported: 编号

-- comment on column vi_maindata_paypass_info.contract_NO not supported: 合同号

-- comment on column vi_maindata_paypass_info.customerid not supported: 客户编号

-- comment on column vi_maindata_paypass_info.customername not supported: 客户名称

-- comment on column vi_maindata_paypass_info.username not supported: 用户姓名

-- comment on column vi_maindata_paypass_info.FULLNAME not supported: 姓名

-- comment on column vi_maindata_paypass_info.certid not supported: 证件编号

-- comment on column vi_maindata_paypass_info.guar not supported: 担保人姓名

-- comment on column vi_maindata_paypass_info.gongtong not supported: 姓名

-- comment on column vi_maindata_paypass_info.peiou not supported: 姓名

-- comment on column vi_maindata_paypass_info.model not supported: 型号/规格

-- comment on column vi_maindata_paypass_info.contract_PLAN_NUMBER not supported: 合同方案编号

-- comment on column vi_maindata_paypass_info.plan_list not supported: 期次

-- comment on column vi_maindata_paypass_info.PLAN_MONEY not supported: 计划金额

-- comment on column vi_maindata_paypass_info.fund_out not supported: 流出量

-- comment on column vi_maindata_paypass_info.account not supported: 帐户名称

-- comment on column vi_maindata_paypass_info.plan_status not supported: 状态

