53 lines
3.5 KiB
SQL
53 lines
3.5 KiB
SQL
create view vi_li_invoice_rent_direct as SELECT LCI.ID AS CONTRACT_ID,
|
|
LCI.CONTRACT_NO AS CONTRACT_NO,
|
|
LRI.PAYMENT_NUMBER AS PAYMENT_NUMBER,
|
|
LUL.CUSTOMER_ID AS CUSTOMER_ID,
|
|
LUL.CUSTOMER_NAME AS CUSTOMER_NAME,
|
|
LRI.PLAN_LIST AS PLAN_LIST,
|
|
LRI.PLAN_ID AS PLAN_ID,
|
|
max(LRI.HIRE_DATE) AS PLAN_DATE,
|
|
sum(LRI.RENT) AS PLAN_MONEY,
|
|
sum(LRI.RENT) AS INVOICE_MONEY,
|
|
'租金' AS TAX_TYPE,
|
|
'rent' AS TAX_TYPES,
|
|
CI.CERTID AS CERT_ID,
|
|
CAC.ACCOUNT AS ACCOUNT,
|
|
CAC.ACC_NUMBER AS ACC_NUMBER,
|
|
CAC.BANK_NAME AS BANK_NAME,
|
|
(CASE WHEN (CI.CUSTOMERTYPE = '03') THEN CP.MOBILE ELSE CF.TEL END) AS TELEPHONE,
|
|
CI.CUSTOMERTYPE AS CUSTOMER_TYPE
|
|
FROM ((((((APZL.LC_RENT_INCOME LRI 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 CI ON ((CI.CUSTOMERID = LUL.CUSTOMER_ID))) LEFT JOIN APZL.CUSTOMER_PERSON CP ON ((CP.CUSTOMERID = CI.CUSTOMERID))) LEFT JOIN APZL.CUSTOMER_FAMILY CF ON ((CF.CUSTOMERID = CI.CUSTOMERID)))
|
|
LEFT JOIN APZL.CUSTOMER_ACCOUNT CAC ON ((CAC.CUSTOMERID = CI.CUSTOMERID)))
|
|
WHERE ((LCI.LEAS_FORM = '01') AND (LCI.CONTRACT_STATUS = '31') AND (LCI.BUSINESSTYPE = '1') AND (LUL.IS_MAIN = 'Y') AND (LRI.INTEREST <> 0.00) AND
|
|
(NOT (LRI.PLAN_ID IN (
|
|
SELECT APZL.LI_RENT_INVOICE_INFO.PLAN_ID FROM APZL.LI_RENT_INVOICE_INFO WHERE (APZL.LI_RENT_INVOICE_INFO.INVOICE_STATUS <> '2')
|
|
))))
|
|
GROUP BY LRI.CONTRACT_ID, LRI.PLAN_LIST;
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.contract_id not supported: 编号
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.contract_no not supported: 合同号
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.payment_number not supported: 投放编号
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.customer_id not supported: 承租人编号
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.customer_name not supported: 承租人名称
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.plan_list not supported: 租金计划期次
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.plan_id not supported: 计划id
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.plan_date not supported: 核销日期
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.cert_id not supported: 证件号
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.account not supported: 帐户名称
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.acc_number not supported: 银行账号
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.bank_name not supported: 开户银行
|
|
|
|
-- comment on column vi_li_invoice_rent_direct.customer_type not supported: 客户类别
|
|
|