Commit b5f315ea authored by homunculus's avatar homunculus

Merge branch 'develop' of https://hel.hand-china.com/hlcm/leaf-hlcm into develop

parents 023726e0 cc8fa4ab
CREATE OR REPLACE VIEW PRJ_PROJECT_BP_TENANT_LV AS
SELECT t1."PRJ_BP_ID",
t1."PROJECT_ID",
t1."BP_CATEGORY",
t1."BP_ID",
t1."CONTRACT_SEQ",
t1."BP_SEQ",
t1."CREAT_BP_FLG",
t1."BP_CODE",
t1."BP_TYPE",
(select h.description from hls_bp_type h where h.enabled_flag = 'Y'
and h.bp_type = t1.bp_type) bp_typ_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS211_BP_CLASS'
and scv.code_value = t1.bp_class) bp_class_n,
t1."BP_CLASS",
t1."BP_NAME",
t1."EXTRA_NAM",
t1."EXTERNAL_BP_CODE",
t1."ID_TYPE",
t1."ID_CARD_NO",
t1."GENDER",
t1."AGE",
t1."DATE_OF_BIRTH",
t1."PLACE_OF_BIRTH",
t1."LIV_PROVINCE",
t1."LIV_CITY",
t1."LIV_DISTRICT",
t1."LIV_STREET",
t1."LIVING_ADDRESS",
t1."ADD_CITY",
t1."ADD_PROVINCE",
t1."RESIDENT_ADDRES",
t1."RESIDENT_STATUS",
t1."STATE_OF_HEALTH",
t1."ACADEMIC_BACKGROUND",
t1."MARITAL_STATUS",
t1."ETHNIC_GROUP",
t1."FERTILITY_STATUS",
t1."NUMBER_OF_CHILDREN",
t1."CONTACT_PERSON",
t1."POSITION",
t1."PHONE",
t1."PHONE_2",
t1."CELL_PHONE",
t1."FAX",
t1."ZIPCODE",
t1."EMAIL",
t1."CELL_PHONE_2",
t1."WEBSITE",
t1."E_MAIL",
t1."QQ",
t1."WEI_CHAT",
t1."SOURCE_OF_INCOME",
t1."ANNUAL_INCOME",
t1."OTHER_ANNUAL_INCOME",
t1."OTHER_ASSET",
t1."CAPITAL_OF_FAMILY",
t1."LIABILITY_OF_FAMILY",
t1."GUARANTEE_AMOUNT",
t1."OWNSHIP_OF_HOUSE",
t1."HOUSE_LOANS_FLAG",
t1."SEND_ADDRESS",
t1."WORK_TYPE",
t1."WORK_UNIT",
t1."WORK_PROVINCE",
t1."WORK_CITY",
t1."WORK_UNIT_ADDRESS",
t1."WORK_UNIT_PHONE",
t1."WORK_UNIT_ZIP",
t1."COMPANY_NATURE",
t1."INDUSTRY_WORK_EXPER",
t1."MAIN_DRIVER_OF_CAR",
t1."DRIVER_LICENSE_NO",
t1."LIVING_SITUATION",
t1."SOURCE_OF_INCOME_DB",
t1."RELEASE_FORM",
t1."BUSINESS_LICENSE_NUM",
t1."ORGANIZATION_CODE",
t1."TAX_REGISTRY_NUM",
t1."LOAN_CARD_NUM",
t1."TAXPAYER_TYPE",
t1."CORPORATE_CODE",
t1."REGISTERED_PLACE",
t1."FOUNDED_DATE",
t1."REGISTERED_CAPITAL",
t1."PAID_UP_CAPITAL",
t1."CURRENCY",
t1."LEGAL_FORM",
t1."INDUSTRY",
t1."ENTERPRISE_SCALE",
t1."SHAREHOLDERS_BACKGROUND",
t1."FOA_RATE",
t1."PORPORTION_OF_GUARANTEE",
t1."EARNINGS_CONDITION",
t1."MAIN_BUSINESS_GROWTH",
t1."ROE",
t1."CURRENT_RATIO",
t1."INTEREST_COVER_RATIO",
t1."DEBT_TO_ASSET_RATIO",
t1."BP_NAME_SP",
t1."CARD_TYPE_SP",
t1."ID_NO_SP",
t1."GENDER_SP",
t1."DATE_OF_BIRTH_SP",
t1."AGE_SP",
t1."CELL_PHONE_SP",
t1."ACADEMIC_BACKGROUND_SP",
t1."LIVING_ADD_CITY",
t1."LIVING_ADD_PROVINCE",
t1."LIVING_ADDRESS_SP",
t1."RESIDENT_ADD_PROVINCE",
t1."RESIDENT_ADD_CITY",
t1."RESIDENT_ADDRES_SP",
t1."WORK_TYPE_SP",
t1."INDUSTRY_SP",
t1."INDUSTRY_WORK_EXPERIENCE_SP",
t1."WORK_UNIT_NAME_SP",
t1."WORK_UNIT_PHONE_SP",
t1."WORK_PROVINCE_SP",
t1."WORK_CITY_SP",
t1."WORK_UNIT_ADDRESS_SP",
t1."POSITION_SP",
t1."SOURCE_OF_INCOME_SP",
t1."ANNUAL_INCOME_SP",
t1."OTHER_ANNUAL_INCOME_SP",
t1."RELATIONSHIP_SP",
t1."BANK_ID",
t1."BANK_ACCOUNT_NAME",
t1."BANK_ACCOUNT_NUM",
t1."INVOICE_BP_ADDRESS_PHONE_NUM",
t1."INVOICE_BP_BANK_ACCOUNT",
t1."INVOICE_TITLE",
t1."INVOICE_SEND_ADDRESS",
t1."BP_NAME_LEG",
t1."ID_CARD_NO_LEG",
t1."GENDER_LEG",
t1."DATE_OF_BIRTH_LEG",
t1."AGE_LEG",
t1."MARITAL_STATUS_LEG",
t1."ACADEMIC_BACKGROUND_LEG",
t1."YEARS_OF_LIVING_HOUSE_LEG",
t1."RESIDENT_STATUS_LEG",
t1."CELL_PHONE_LEG",
t1."EMAIL_LEG",
t1."START_WORK_LEG",
t1."LIV_PROVINCE_LEG",
t1."LIV_CITY_LEG",
t1."LIV_DISTRICT_LEG",
t1."LIV_STREET_LEG",
t1."NET_MONTHLY_INCOME_LEG",
t1."OWNERSHIP_OF_HOUSE_LEG",
t1."OTHER_ASSET_LEG",
t1."CAPITAL_OF_FAMILY_LEG",
t1."LIABILITY_OF_FAMILY_LEG",
t1."AGENT_TYPE",
t1."CREATED_BY",
t1."CREATION_DATE",
t1."LAST_UPDATED_BY",
t1."LAST_UPDATE_DATE",
t1."REF_V01",
t1."REF_V02",
t1."REF_V03",
t1."REF_V04",
t1."REF_V05",
t1."REF_V06",
t1."REF_N01",
t1."REF_N02",
t1."REF_N03",
t1."REF_N04",
t1."REF_N05",
t1."REF_N06",
t1."REF_N07",
t1."REF_N10",
t1."REF_D01",
t1."REF_D02",
t1."REF_D03",
t1."REF_D04",
t1."REF_D05",
t1."NET_MONTHLY_INCOME",
t1."YEARS_OF_LIVING_HOUSE",
t1."TOTAL_ASSETS",
t1."COMPANY_ID",
t1."WORK_DISTRICT",
t1."WOKR_STREET",
t1."NAME_LEGAL",
t1."WORK_STREET",
t1."ID_TYPE_LEG",
t1."NET_MONTHLY_INCOME_GUA",
t1."REGISTERED_CAPITAL_ORG",
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'SYS_SEX_TYPE'
and scv.code_value = t1.gender) gender_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_MARRIAGE_STATUS'
and scv.code_value = t1.marital_status) marital_status_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_SYS_EDUCATIONAL'
and scv.code_value = t1.academic_background) academic_background_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_SYS_HOUSEHOLD_CODE'
and scv.code_value = t1.RESIDENT_STATUS) RESIDENT_STATUS_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_HEALTH_STATUS'
and scv.code_value = t1.STATE_OF_HEALTH) STATE_OF_HEALTH_n,
(select fp.description
from fnd_province fp
where fp.province_id = t1.Liv_Province) Liv_Province_n,
(select fc.description
from fnd_city fc
where fc.city_id = t1.liv_city) liv_city_n,
(select fd.description
from fnd_district fD
where fD.District_Id = t1.LIV_DISTRICT) LIV_DISTRICT_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_WORK_TYPE'
and scv.code_value = t1.work_type) work_type_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'WORK_UNIT'
and scv.code_value = t1.WORK_UNIT) WORK_UNIT_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_SYS_LEGAL_UNIT_PROPERTY'
and scv.code_value = t1.COMPANY_NATURE) COMPANY_NATURE_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_WORKING_AGE_TYPE'
and scv.code_value = t1.INDUSTRY_WORK_EXPER) INDUSTRY_WORK_EXPER_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_HOUSE_OWNERSHIP'
and scv.code_value = t1.OWNSHIP_OF_HOUSE) OWNSHIP_OF_HOUSE_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'SYS_SEX_TYPE'
and scv.code_value = t1.GENDER_SP) GENDER_SP_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_WORK_TYPE'
and scv.code_value = t1.WORK_TYPE_SP) WORK_TYPE_SP_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_LIVE_DEADLINE'
and scv.code_value = t1.years_of_living_house) years_of_living_house_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_LIVE_DEADLINE'
and scv.code_value = t1.years_of_living_house_leg) years_of_living_house_leg_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS211_ID_TYPE'
and scv.code_value = t1.id_type) id_type_n,
(select scv.code_value_name
from sys_code_values_v scv
where scv.code = 'HLS211_ID_TYPE'
and scv.code_value = t1.card_type_sp) card_type_sp_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_SYS_UNIT_PROPERTY'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.legal_form) legal_form_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'ENTERPRISES_SCALE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.enterprise_scale) enterprise_scale_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'INDUSTRY'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.industry) industry_n,
(select p.description value_name
FROM fnd_province p
where p.province_id = t1.work_province) work_province_n,
(select f.description value_name
from fnd_city f
where f.enabled_flag = 'Y'
and f.city_id = t1.work_city) work_city_n,
(select fd.description value_name
from fnd_district fd
where fd.enabled_flag = 'Y'
and fd.district_id = t1.work_district) work_district_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_STOCKHOLDER_BACKGROUND'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.shareholders_background) shareholders_background_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_PRJ_LEASE_ASSET_RATE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.foa_rate) foa_rate_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_PRJ_GUARANT_ASSET_RATE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.porportion_of_guarantee) porportion_of_guarantee_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_FIN_PROFIT_CONDITION'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.earnings_condition) earnings_condition_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_MAIN_GROWTH'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.main_business_growth) main_business_growth_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_RIGHTS_NET_RATE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.roe) roe_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_CURRENT_RATIO'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.current_ratio) current_ratio_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_INTEREST_SAFEGUARD'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.interest_cover_ratio) interest_cover_ratio_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_ASSET_RATIO'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.debt_to_asset_ratio) debt_to_asset_ratio_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'SYS_SEX_TYPE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.gender_leg) gender_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_MARRIAGE_STATUS'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.marital_status_leg) marital_status_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_SYS_EDUCATIONAL'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.academic_background_leg) academic_background_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_SYS_HOUSEHOLD_CODE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.resident_status_leg) resident_status_leg_n,
(select p.description value_name
FROM fnd_province p
where p.province_id = t1.liv_province_leg) liv_province_leg_n,
(select f.description value_name
from fnd_city f
where f.enabled_flag = 'Y'
and f.city_id = t1.liv_city_leg) liv_city_leg_n,
(select fd.description as value_name
from fnd_district fd
where fd.enabled_flag = 'Y'
and fd.district_id = t1.liv_district_leg) liv_district_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_LEGAL_INCOME_TYPE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.net_monthly_income_leg) net_monthly_income_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_HOUSE_OWNERSHIP'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.ownership_of_house_leg) ownership_of_house_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_FAMILY_ASSET'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.capital_of_family_leg) capital_of_family_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_FAMILY_ASSET'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.liability_of_family_leg) liability_of_family_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS211_ID_TYPE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.id_type_leg) id_type_leg_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS_CUS_FAMILY_ASSET'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.registered_capital) registered_capital_n,
(select v.code_value_name value_name
from sys_code_values_v v
where v.code = 'HLS211_TAXPAYER_TYPE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.taxpayer_type) taxpayer_type_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_LEGAL_INCOME_TYPE'
and scv.code_value = t1.net_monthly_income_gua) net_monthly_income_gua_n,
t1.driving_flag,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'YES_NO'
and scv.code_value = t1.driving_flag) driving_flag_n,
t1.driving_provement,
--add by Harry 9952 2017/3/1
t1.credit_bank,
(select v.code_value_name
from sys_code_values_v v
where v.code = 'CREDIT_BANK'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = t1.credit_bank) credit_bank_n, --征信查询银行
(select v.code_value_name
from sys_code_values_v v, hls_bp_master hls
where v.code = 'PROPERTY_ATTRIBUTE'
and v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code_value = hls.property_attribute
and hls.bp_id = t1.bp_id) PROPERTY_ATTRIBUTE_n,
(select cc.bp_name from hls_bp_master cc where cc.bp_id = t1.bp_id) bp_name_n
(select cc.bp_name from hls_bp_master cc where cc.bp_id = t1.bp_id) bp_id_n
t1.number_of_car,
t1.manage_of_car,
t1.number_of_cus,
t1.period_of_year,
t1.asset_size,
t1.debt,
t1.revenue,
t1.net_profit,
t1.land_situation,
t1.mortgage_guarantee,
t1.estimation_lease,
t1.guarantee_of_repayment,
t1.risk_measure,
t1.credit_record,
t1.company_credit_record,
t1.criminal_record,
t1.executed_asset,
t1.house_area,
t1.house_property,
t1.mortgage_state,
t1.other_property,
t1.owner,
t1.ownership_nature,
t1.present_valuation,
t1.property_address,
t1.property_status,
t1.time_buying,
t1.bs_level,
t1.score_level,
t1.score_result,
t1.funnel_score,
t1.pay_method,
(select v.code_value_name from sys_code_values_v v where v.code = 'DS_PAYMENT_METHOD'
and v.code_value = t1.pay_method
) pay_method_n,
(select hb.description from hls_bp_category hb where hb.bp_category=t1.bp_category) bp_category_n
from prj_project_bp t1,prj_project t2
WHERE T1.BP_CATEGORY = 'TENANT'
and t1.bp_id = t2.bp_id_tenant
and t1.project_id = t2.project_id
;
CREATE OR REPLACE VIEW PRJ_PROJECT_LEASE_ITEM_HEAD_LV AS CREATE OR REPLACE VIEW PRJ_PROJECT_LEASE_ITEM_HEAD_LV AS
select t.vehicle_class, select t.vehicle_class,
t.Lease_Item_Seq, t.Lease_Item_Seq,
t.Brand_Id, t.Brand_Id,
...@@ -89,4 +89,5 @@ select t.vehicle_class, ...@@ -89,4 +89,5 @@ select t.vehicle_class,
t.full_name full_name_n t.full_name full_name_n
--end --end
from prj_project_lease_item t; from prj_project_lease_item t
\ No newline at end of file ;
CREATE OR REPLACE VIEW PRJ_PROJECT_LV AS
SELECT t1.sign_condition,
t1.pay_condition,
t1.after_pay_affairs,
t1.other_affairs,
t1.project_attribute,
t1.submit_date,
to_char((SELECT zi.creation_date
FROM zj_wfl_workflow_instance zi
WHERE zi.instance_id = t1.wfl_instance_id)) submit_date_detail,
t1.bp_id_tenant,
(SELECT hm.bp_name
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) bp_id_tenant_n,
(SELECT hm.bp_name
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) bp_id_tenant_n_n,
(SELECT hm.bp_name
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) bp_id_tenant_name,
t1.bp_id_tenant bp_id,
(SELECT hm.bp_name
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) bp_id_n,
(SELECT hm.id_card_no
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) id_card_no,
(SELECT hm.organization_code
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) organization_code,
(SELECT h1.code_value_name value_code
FROM sys_code_values_v h1
WHERE h1.code = 'PRJ501_PROJECT_ATTRIBUTE'
AND t1.project_attribute = h1.code_value) project_attribute_n,
t1.apply_date,
t1.purchase_type,
(SELECT h1.code_value_name value_code
FROM sys_code_values_v h1
WHERE h1.code = 'PRJ501_PURCHASE_TYPE'
AND 10 = h1.code_value) purchase_type_n,
t1.project_id,
t1.guide_price,
t1.financial_range_code,
t1.district,
t1.unit_code,
nvl(t1.bp_class,(select bm.bp_class from hls_bp_master bm where bm.bp_id=t1.bp_id_tenant )) AS bp_class,
--(select bm.bp_class from hls_bp_master bm where bm.bp_id=t1.bp_id_tenant ) bp_class,
t1.business_type,
t1.document_type,
t1.company_id,
t1.lease_organization,
t1.division,
t1.lease_channel,
t1.employee_tel,
t1.employee_id,
t1.sale_consultant,
t1.sale_consultant_tel,
t1.owner_user_id,
t1.owner_user_tel,
t1.wfl_instance_id, -- add by liukang
(SELECT d.description
FROM fnd_district d
WHERE d.district_id = t1.district) district_n,
(SELECT h2.description
FROM exp_org_unit_vl h2
WHERE h2.enabled_flag = 'Y'
AND h2.org_unit_type = '4S'
AND t1.unit_code = h2.unit_code) unit_code_n,
(SELECT h3.code_value_name
FROM sys_code_values_v h3,
hls_bp_master bm
WHERE h3.code = 'HLS211_BP_CLASS'
AND h3.code_enabled_flag = 'Y'
AND bm.bp_id = t1.bp_id_tenant
AND bm.bp_class = h3.code_value
AND h3.code_value_enabled_flag = 'Y') bp_class_n,
(SELECT h4.description
FROM hls_business_type_v h4
WHERE h4.enabled_flag = 'Y'
AND t1.business_type = h4.business_type) business_type_n,
(SELECT h5.document_type_desc
FROM hls_document_type_v h5
WHERE h5.document_category = 'PROJECT'
AND h5.enabled_flag = 'Y'
AND t1.document_type = h5.document_type) document_type_n,
(SELECT h6.company_short_name
FROM fnd_companies_vl h6
WHERE h6.start_date_active < SYSDATE
AND (h6.end_date_active IS NULL OR h6.end_date_active < SYSDATE)
AND t1.company_id = h6.company_id) company_id_n,
(SELECT h7.description
FROM hls_lease_organization h7
WHERE h7.enabled_flag = 'Y'
AND t1.lease_organization = h7.lease_organization) lease_organization_n,
(SELECT h8.description
FROM hls_division h8
WHERE h8.enabled_flag = 'Y'
AND t1.division = h8.division) division_n,
(SELECT h9.description
FROM hls_lease_channel h9
WHERE h9.enabled_flag = 'Y'
AND t1.lease_channel = h9.lease_channel) lease_channel_n,
t1.sale_consultant sale_consultant_n,
(SELECT h13.description
FROM sys_user h13
WHERE h13.user_id = t1.owner_user_id) owner_user_id_n,
(SELECT h14.name value_name
FROM exp_employees h14
WHERE t1.employee_id = h14.employee_id) employee_id_n,
t1.invoice_agent_id,
(SELECT a.bp_name value_name
FROM hls_bp_master_lv a
WHERE a.bp_category = 'AGENT'
AND t1.invoice_agent_id = a.bp_id) invoice_agent_id_n,
(SELECT scv.code_value_name
FROM sys_code_values_v scv
WHERE scv.code = 'PRJ500D_PLATE_RESOURCE'
AND t1.plate_resource = scv.code_value) plate_resource_n,
(SELECT h16.code_value_name
FROM hls_price_list_conds_financial h15,
sys_code_values_v h16
WHERE h15.price_list = t1.price_list
AND h15.financial_code = h16.code_value
AND h16.code = 'HLS_052_FINANCIAL_SCALE'
AND t1.financial_range_code = h16.code_value) financial_range_code_n,
--t1.down_payment_ratio,
(SELECT down_payment_ratio
FROM prj_quotation p
WHERE p.document_category = 'PROJECT'
AND p.document_id = t1.project_id) down_payment_ratio,
t1.residual_value,
t1.invoice_price,
t1.preferential_price,
t1.purchase_tax,
t1.plate_price,
t1.plate_resource,
t1.insurance_price,
t1.nonlocal_plate_desc,
t1.project_number,
t1.project_name,
t1.short_name,
t1.document_category,
t1.project_status,
t1.search_term_1,
t1.search_term_2,
t1.chance_id,
(SELECT c.chance_number
FROM prj_chance c
WHERE c.chance_id = t1.chance_id) chance_number,
t1.unit_id,
t1.employee_id_of_manager,
--t1.finance_amount,
(SELECT finance_amount
FROM prj_quotation p
WHERE p.document_category = 'PROJECT'
AND p.document_id = t1.project_id) finance_amount,
t1.financing_purpose,
t1.description,
t1.cdd_list_id,
t1.summary_bp,
t1.description_summary_bp,
t1.summary_guarantee,
t1.description_summary_guarantee,
--modify by zlf
nvl(t1.description_lease_item_clob,
t1.description_lease_item) description_lease_item_clob,
t1.description_mortgage,
t1.desc_quotation,
t1.risk_analysis_tenant,
t1.risk_analysis_project,
t1.analysis_primary_product,
t1.forecast_sales,
t1.forecast_profitability,
t1.description_feasibility,
t1.superiority,
t1.weakness,
t1.opportunity,
t1.threat,
t1.description_swot,
t1.risk_market,
t1.risk_operating,
t1.risk_finance,
t1.description_risk,
t1.summarize,
t1.description_summarize,
t1.number_of_tenant,
t1.number_of_guarantor,
t1.number_of_actual_controller,
t1.number_of_quotation,
t1.lease_subject,
t1.created_by,
t1.creation_date create_date,
t1.last_updated_by,
t1.last_update_date,
t1.ref_v01,
t1.ref_v02,
t1.ref_v03,
t1.ref_v04,
t1.ref_v05,
t1.ref_v06,
(SELECT v.code_value_name
FROM sys_code_values_v v
WHERE v.code = 'LEASE_HOHD'
AND v.code_value = t1.ref_v06
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y') AS ref_v06_n,
t1.ref_v07,
t1.ref_v08,
t1.ref_v09,
t1.ref_v10,
t1.ref_n01,
t1.ref_n02,
t1.ref_n03,
t1.ref_n04,
t1.ref_n05,
t1.ref_n06,
t1.ref_n07,
t1.ref_n08,
t1.ref_n09,
t1.ref_n10,
t1.ref_d01,
t1.ref_d02,
t1.ref_d03,
t1.ref_d04,
t1.ref_d05,
t1.ref_d06,
t1.ref_d07,
t1.ref_d08,
t1.ref_d09,
t1.ref_d10,
t1.declare_flag,
t1.currency,
t1.price_list,
--t1.lease_times,
(SELECT lease_times
FROM prj_quotation p
WHERE p.document_category = 'PROJECT'
AND p.document_id = t1.project_id) lease_times,
(SELECT to_number(h17.code_value_name) value_name
FROM sys_code_values_v h17
WHERE h17.code = 'PRJ500D_LEASE_TIMES'
AND (SELECT lease_times
FROM prj_quotation p
WHERE p.document_category = 'PROJECT'
AND p.document_id = t1.project_id) = h17.code_value) lease_times_n,
to_char(t1.approved_date,
'yyyy-mm-dd hh24:mi:ss') approved_date,
t1.int_rate_type,
t1.risk_rating_t,
t1.industry_status_t,
t1.industry_cost_stru_t,
t1.industry_maturity_t,
t1.industry_periodicity_t,
t1.industry_profitability_t,
t1.industry_dependency_t,
t1.industry_substitute_t,
t1.industry_regulation_t,
t1.energy_saving_factor_t,
t1.risk_rating_p,
t1.industry_status_p,
t1.industry_cost_stru_p,
t1.industry_maturity_p,
t1.industry_periodicity_p,
t1.industry_profitability_p,
t1.industry_dependency_p,
t1.industry_substitute_p,
t1.industry_regulation_p,
t1.energy_saving_factor_p,
t1.production_flow,
t1.material_future,
t1.technology_future,
t1.energy_utilization_future,
t1.product_life_period,
t1.primary_product_future,
t1.competitiveness_product,
t1.trend_profit_product,
t1.profitability_future,
t1.profitability_project,
t1.cf_forecast,
t1.financing_purposes_an,
t1.repayment_ability_an,
t1.summary__feasibility,
t1.so_info,
t1.wo_info,
t1.st_info,
t1.wt_info,
(SELECT d.description
FROM hls_document_category d
WHERE d.document_category = t1.document_category) document_category_n,
(SELECT v.code_value_name
FROM sys_code_values_v v
WHERE v.code = 'PRJ501_PRJ_STATUS'
AND v.code_value = t1.project_status) AS project_status_n,
(select u.unit_name
from exp_org_unit_v u
where u.unit_id = t1.unit_id) as unit_id_n,
/* (SELECT h.bp_name
FROM hls_bp_master h
WHERE h.enabled_flag = 'Y'
AND h.bp_id = t1.unit_id
AND h.bp_category = 'VENDER') unit_id_n,*/
(SELECT e.name
FROM exp_employees e
WHERE e.employee_id = t1.employee_id_of_manager) AS employee_id_of_manager_n,
(SELECT t.currency_name
FROM gld_currency_v t
WHERE t.currency_code = t1.currency) currency_n,
(SELECT t.description
FROM hls_price_list t
WHERE t.price_list = t1.price_list) price_list_n,
(SELECT sv.code_value_name
FROM sys_code_values_v sv
WHERE sv.code = 'CON500_INT_RATE_TYPE'
AND sv.code_value = t1.int_rate_type) int_rate_type_n,
t1.lease_start_date,
t1.annual_pay_times,
--add by zlf
t1.prj_project_special_id,
t1.license_provider_name,
t1.license_provider_code,
(SELECT ps.special_retail_number
FROM prj_special_retail ps
WHERE ps.special_retail_id = t1.prj_project_special_id) prj_project_special_id_n,
(SELECT v.code_value_name
FROM sys_code_values_v v
WHERE v.code = 'HLS500_ANNUAL_PAY_TIMES'
AND v.code_value = t1.annual_pay_times) annual_pay_times_n,
(SELECT a.bp_name
FROM prj_project_bp a
WHERE a.project_id = t1.project_id
AND a.bp_category = 'TENANT'
AND rownum = 1) bp_name,
(SELECT bm.bp_code
FROM hls_bp_master bm
WHERE bm.bp_id = t1.bp_id_tenant) bp_code,
t1.organization_id,
(SELECT t.organization_name value_name
FROM hls_car_organization t
WHERE t.enabled_flag = 'Y'
AND t1.organization_id = t.organization_id) organization_id_n,
t1.payment_file_check,
(SELECT a.code_value_name
FROM sys_code_values_v a
WHERE a.code_enabled_flag = 'Y'
AND a.code_value_enabled_flag = 'Y'
AND a.code = 'PAYMENT_FILE_CHECK'
AND a.code_value = t1.payment_file_check) payment_file_check_n,
t1.project_source,
t1.special_permit_flag,
t1.creation_date,
t1.first_trial_opinion,
t1.second_trial_opinion,
t1.risk_manager_opinion,
t1.insurance_flag,
(SELECT a.code_value_name value_name
FROM sys_code_values_v a
WHERE a.code = 'YES_NO'
AND t1.insurance_flag = a.code_value) insurance_flag_n,
t1.insurance_company,
(SELECT v.code_value_name value_name
FROM sys_code_values_v v
WHERE v.code = 'INSURANCE_COMPANY'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND t1.insurance_company = v.code_value) insurance_company_n,
t1.tci_place,
(SELECT
p.description AS value_name
FROM fnd_province p
WHERE t1.tci_place = to_char(p.province_id)) tci_place_n,
t1.vci_palce,
(SELECT
p.description AS value_name
FROM fnd_province p
WHERE t1.vci_palce = to_char(p.province_id)) vci_palce_n,
t1.tci_type,
(SELECT v.code_value_name value_name
FROM sys_code_values_v v
WHERE v.code = 'INSURANCE_ISSUE_TYPE'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND t1.tci_type = v.code_value) tci_type_n,
t1.vci_type,
(SELECT v.code_value_name value_name
FROM sys_code_values_v v
WHERE v.code = 'INSURANCE_ISSUE_TYPE'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND t1.vci_type = v.code_value) vci_type_n,
t1.insurance_pay_type,
(SELECT v.code_value_name value_name
FROM sys_code_values_v v
WHERE v.code = 'INSURANCE_PAY_TYPE'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND t1.insurance_pay_type = v.code_value) insurance_pay_type_n,
t1.insurance_commission_type,
(SELECT v.code_value_name value_name
FROM sys_code_values_v v
WHERE v.code = 'COMMISSION_BALANCE_TYPE'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND t1.insurance_commission_type = v.code_value) insurance_commission_type_n,
t1.prj_con_date, --项目审批通过时间
(SELECT pp.division
FROM prj_project pp
WHERE pp.project_id = t1.project_id) division1, -- 产品线1
t1.car_type, --车辆类型
(SELECT v.code_value_name value_name
FROM sys_code_values_v v
WHERE v.code = 'CAR_TYPE'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND t1.car_type = v.code_value) car_type_n,
t1.note,
(SELECT MAX(zw.last_update_date)
FROM zj_wfl_approve_record_v zw
WHERE zw.instance_id = t1.wfl_instance_id
AND zw.action_type = 2) reject_date,
(SELECT zw.comment_text
FROM zj_wfl_approve_record_v zw
WHERE zw.instance_id = t1.wfl_instance_id
AND zw.action_type = 2
AND zw.creation_date = (SELECT MAX(b.creation_date)
FROM zj_wfl_approve_record_v b
WHERE b.action_type = 2
AND b.instance_id = t1.wfl_instance_id)) reject_comment_in,
(SELECT zw.comment_text_out
FROM zj_wfl_approve_record_v zw
WHERE zw.instance_id = t1.wfl_instance_id
AND zw.action_type = 2
AND zw.creation_date = (SELECT MAX(b.creation_date)
FROM zj_wfl_approve_record_v b
WHERE b.action_type = 2
AND b.instance_id = t1.wfl_instance_id)) reject_comment_out,
t1.agent_general_comments,
(SELECT scv.code_value_name
FROM sys_code_values_v scv
WHERE scv.code = 'HLS_CUS_DEALER_EVALUATION'
AND scv.code_value = t1.agent_general_comments) agent_general_comments_n,
t1.fin_manager fin_manager,
(SELECT ee.name
FROM exp_employees ee
WHERE ee.employee_id = t1.fin_manager) fin_manager_n,
t1.created_by user_id,
t1.check_flag,
t1.create_con_date,
t1.return_flag,
(SELECT pc.credit_flag
FROM prj_project_credit pc
WHERE pc.project_id = t1.project_id) credit_flag,
(SELECT zv.comment_text_out
FROM zj_wfl_approve_history_v zv
WHERE zv.instance_id = t1.wfl_instance_id
AND zv.record_id = (SELECT MAX(z.record_id)
FROM zj_wfl_approve_history_v z
WHERE z.instance_id = zv.instance_id)) comment_text_out,
(CASE
WHEN t1.return_flag = 'Y'
AND t1.project_status = 'APPROVING' THEN
'Y'
ELSE
'N'
END) second_submit,
t1.bd_customer_score,
t1.bd_score_results,
(SELECT scv.code_value_name
FROM sys_code_values_v scv
WHERE scv.code = 'PD_SCORE_RESULTS'
AND scv.code_value = t1.bd_score_results) bd_score_results_n,
t1.guaranty_mode,
t1.mortgage_or_not,
t1.mortgagee,
t1.other_mortgage,
t1.other_guarantee,
(SELECT scv.code_value_name
FROM sys_code_values_v scv
WHERE scv.code = 'GUARANTY_MODE'
AND scv.code_value = t1.bd_score_results) guaranty_mode_n,
(SELECT scv.code_value_name
FROM sys_code_values_v scv
WHERE scv.code = 'YES_NO'
AND scv.code_value = t1.bd_score_results) mortgage_or_not_n,
(SELECT scv.code_value_name
FROM sys_code_values_v scv
WHERE scv.code = 'YES_NO'
AND scv.code_value = t1.bd_score_results) other_mortgage_n,
(SELECT mor.register_day
FROM mor_register mor
WHERE mor.district_id = t1.district) register_day,
t1.province,
t1.city,
(SELECT p.description
FROM fnd_province p
WHERE p.province_id = t1.province) province_n,
(SELECT c.description
FROM fnd_city c
WHERE c.city_id = t1.city) city_n,
/*(SELECT pb.prj_bp_id
FROM prj_project_bp pb
WHERE pb.project_id = t1.project_id
AND pb.bp_id = t1.bp_id_tenant
AND pb.bp_type = 'TENANT'
) prj_bp_id,*/
t1.ratify_date,
(SELECT hd.deposit
FROM hls_fin_calculator_hd hd,
prj_quotation q
WHERE q.document_id = t1.project_id
AND t1.document_category = 'PROJECT'
AND hd.calc_session_id = q.calc_session_id) deposit,
decode((SELECT p.price_list
FROM prj_quotation p
WHERE p.document_category = 'PROJECT'
AND p.document_id = t1.project_id),
'DR_PRICE_10',
(SELECT ln.rental
FROM hls_fin_calculator_ln ln,
prj_quotation q
WHERE q.document_id = t1.project_id
AND t1.document_category = 'PROJECT'
AND ln.calc_session_id = q.calc_session_id
AND ln.times = 1),null) rental_1,
(SELECT hd.lease_charge
FROM hls_fin_calculator_hd hd,
prj_quotation q
WHERE q.document_id = t1.project_id
AND t1.document_category = 'PROJECT'
AND hd.calc_session_id = q.calc_session_id) lease_charge,
(SELECT hd.lease_item_amount
FROM hls_fin_calculator_hd hd,
prj_quotation q
WHERE q.document_id = t1.project_id
AND t1.document_category = 'PROJECT'
AND hd.calc_session_id = q.calc_session_id) lease_item_amount,
--add by chenlingfeng
t1.product_name,
t1.product_code,
t1. product_type,
t1.approve_note,
t1.sign_method,
t1.Sales_method,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'DS_SALES_METHOD'
and t1.Sales_method = v.code_value) Sales_method_n,
t1.Sales_method_note,
t1.nature_of_work,
t1.Engineering_area,
t1.Actual_user,
t1.outsider_work_flag,
t1.work_income,
t1.work_term,
t1.work_Settlement_cycle,
t1.work_Settlement_method,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'WORK_SETTLEMENT_METHOD'
and t1.work_Settlement_method = v.code_value) work_Settlement_method_n,
t1.signing_people,
t1.signing_note,
t1.billing_method,
t1.sub_price_list,--商品名称2
(select v.code_value_name
from sys_code_values_v v
where v.code = 'PRICE_LIST_NAME'
and v.code_value=t1.sub_price_list)sub_price_list_n,
t1.finance_type,--系统单据默认为0
--add by lijingjing
t1.lease_item_location,
t1.delivery_address,
t1.occu_object,
t1.payment_deduction,
t1.send_message,
t1.secondary_lease,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'OCCU_OBJECT'
and t1.occu_object = v.code_value) occu_object_n,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'PAYMENT_DEDUCTION'
and t1.payment_deduction = v.code_value) payment_deduction_n,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'SEND_MESSAGE'
and t1.send_message = v.code_value) send_message_n,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'SECONDARY_LEASE'
and t1.secondary_lease = v.code_value) secondary_lease_n,
t1.pay_method,
(select v.code_value_name as value_name
from sys_code_values_v v
where v.code = 'PAY_METHODS'
and t1.pay_method = v.code_value) pay_method_n,
t1.bank_branch_name,
t1.bank_branch_name bank_branch_name_n,
t1.bank_branch_num,
t1.bank_account_name,
(select description
from hls_bp_category t
where t.bp_category =
(select h.bp_category from hls_bp_master h where h.bp_id = bp_id_tenant)) bp_category_n,
/* (SELECT hm.bp_category
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) bp_category,
(select hls.description from hls_bp_category hls where hls.bp_category= (SELECT hm.bp_category
FROM hls_bp_master hm
WHERE hm.bp_id = t1.bp_id_tenant) ) bp_category_n*/
--end
--add by t 20190924
t1.score_level,
t1.score_result
FROM prj_project t1
;
create or replace view bp_tenant_rate_detail_lv as
select "BP_DETAL_ID",
"PROJECT_ID",
"BP_BIRTH",
"BP_MARRIAGE",
"BP_HEALTH",
"BP_BORN",
"PROPERTY_BELONG",
"OWN_PROPERTY_ADDRESS",
"HOUSE_AREA",
"HOUSE_VALUE",
"OWN_MONEY",
"BANK_CREDIT_APPROVAL",
"OTHER_OWN_ASSETS",
"FAMILY_SOURCE_INCOME",
"FAMILY_AVG_INCOME",
"FAMILY_MONTH_AVG_OUTCOME",
"BANK_LOAN",
"OTHER_LOAN",
"FIXED_ASSETS",
"CAPITAL",
"CAPITAL_PLACE",
"CAR_TYPE",
"CAR_BRAND",
"CAR_NUM",
"CAR_BUY_DATE",
"CAR_BUY_MONEY",
"WORK_EXPERIENCE",
"WORK_OPERATOR",
"WORK_TYPE",
"WORK_AVG_MONTH_INCOME",
"WORK_AVG_MONTH_OUTCOME",
"OTHER_DESCRIPTION",
"PAYMENT_SOURCE",
"E_PLACE",
"E_CONTRACT_AMOUNT",
"CONTRACT_COPY",
"E_CON_AUTHENTICITY",
"SURVEY_FIT",
"DAILY_CREDIT",
"BORROW_SITUATION",
"RENT_REPAYMENT",
"RENTAL_BALANCE",
"LIQUIDATED_DAMAGES",
"GUAR_MORTGAGE_STATUS",
"PAST_CONT_EXE_STATUS",
"INDUSTRY_JUDGEMENT",
"THIRD_PARTY_GUARANTEE",
"THIRD_PARTY_CREDIBILITY",
(select code_value_name
from sys_code_values_v scv
where scv.code = 'MARITAL_STATUS'
and scv.code_value = t1.bp_marriage
and scv.code_enabled_flag='Y') bp_marriage_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HEALTH_STATUS'
and scv.code_value = t1.bp_health
and scv.code_enabled_flag='Y') bp_health_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HOUSEHOLD_CODE'
and scv.code_value = t1.bp_born
and scv.code_enabled_flag='Y') bp_born_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'A51000000'
and scv.code_value = t1.property_belong
and scv.code_enabled_flag='Y') property_belong_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HOUSEHOLD_ASSET'
and scv.code_value = t1.house_value
and scv.code_enabled_flag='Y') house_value_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'BANK_CREDIT_APPROVAL'
and scv.code_value = t1.bank_credit_approval
and scv.code_enabled_flag='Y') bank_credit_approval_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_YEARLY_INCOME'
and scv.code_value = t1.family_avg_income
and scv.code_enabled_flag='Y') family_avg_income_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HLS_CUS_WORKING_AGE_TYPE'
and scv.code_value = t1.work_experience
and scv.code_enabled_flag='Y') work_experience_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'WORK_OPERATOR'
and scv.code_value = t1.work_operator
and scv.code_enabled_flag='Y') work_operator_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'WORK_STYLE'
and scv.code_value = t1.work_type
and scv.code_enabled_flag='Y') work_type_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'WORK_AVG_MONTH_INCOME'
and scv.code_value = t1.work_avg_month_income
and scv.code_enabled_flag='Y') work_avg_month_income_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'HOUSEHOLD_CODE'
and scv.code_value = t1.e_place
and scv.code_enabled_flag='Y') e_place_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'E_CONTRACT_AMOUNT'
and scv.code_value = t1.e_contract_amount
and scv.code_enabled_flag='Y') e_contract_amount_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'YES_OR_NO'
and scv.code_value = t1.contract_copy
and scv.code_enabled_flag='Y') contract_copy_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'E_CON_AUTHENTICITY'
and scv.code_value = t1.e_con_authenticity
and scv.code_enabled_flag='Y') e_con_authenticity_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'SURVEY_FIT'
and scv.code_value = t1.survey_fit
and scv.code_enabled_flag='Y') survey_fit_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'BP_CREDIT_CONSCIOUS'
and scv.code_value = t1.daily_credit
and scv.code_enabled_flag='Y') daily_credit_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'REPAYMENT_STATE'
and scv.code_value = t1.borrow_situation
and scv.code_enabled_flag='Y') borrow_situation_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'YES_OR_NO'
and scv.code_value = t1.guar_mortgage_status
and scv.code_enabled_flag='Y') guar_mortgage_status_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'PAST_CONT_EXE_STATUS'
and scv.code_value = t1.past_cont_exe_status
and scv.code_enabled_flag='Y') past_cont_exe_status_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'INDUSTRY_JUDGEMENT'
and scv.code_value = t1.industry_judgement
and scv.code_enabled_flag='Y') industry_judgement_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'YES_OR_NO'
and scv.code_value = t1.third_party_guarantee
and scv.code_enabled_flag='Y') third_party_guarantee_n,
(select code_value_name
from sys_code_values_v scv
where scv.code = 'THIRD_PARTY_CREDIBILITY'
and scv.code_value = t1.third_party_credibility
and scv.code_enabled_flag='Y') third_party_credibility_n
from bp_tenant_rate_detail t1;
create or replace view con_contract_sign_lv as
Select t1.data_class,
(Select sc.code_value_name
From sys_code_values_v sc
Where sc.code = 'HLS_DATA_CLASS'
And sc.code_value = t1.data_class) data_class_n,
t1.contract_id,
t1.calc_session_id,
t1.contract_number,
t1.contract_name,
t1.business_type,
t1.district,
t1.finance_amount, --融资金额
(Select p.province
From prj_project p
Where p.project_id = t1.project_id) As province,
(Select tg.description
From fnd_province tg
Where tg.province_id =
(Select p.province
From prj_project p
Where p.project_id = t1.project_id)) As province_n, --省
(Select p.city From prj_project p Where p.project_id = t1.project_id) As city,
(Select tc.description
From fnd_city tc
Where tc.city_id =
(Select p.city
From prj_project p
Where p.project_id = t1.project_id)) As city_n, --市
t1.departing_date,
t1.departed_date,
t1.depart_status,
--li.item_frame_number,
(Select v.code_value_name
From sys_code_values_v v
Where v.code = 'DEPART_STATUS'
And v.code_value = t1.depart_status) As depart_status_n,
(Select h1.code_value_name
From sys_code_values_v h1
Where h1.code = 'PRJ500N_DISTRICT_AREAS'
And t1.district = h1.code_value) district_n,
(Select bt.description
From hls_business_type bt
Where bt.business_type = t1.business_type) As business_type_n,
t1.document_type,
(Select p.document_type
From prj_project p
Where p.project_id = t1.project_id) As prj_document_type,
(Select dt.description
From hls_document_type dt
Where dt.document_type = t1.document_type) As document_type_n,
t1.document_category,
(Select dc.description
From hls_document_category dc
Where dc.document_category = t1.document_category) As document_category_n,
t1.project_id,
(Select p.project_number
From prj_project p
Where t1.project_id = p.project_id) As project_id_c,
(Select p.project_name
From prj_project p
Where t1.project_id = p.project_id) As project_id_n,
t1.company_id,
(Select c.company_short_name
From fnd_companies_vl c
Where c.company_id = t1.company_id) As company_id_n,
t1.spv_company_id,
(Select c.company_code
From fnd_companies_vl c
Where c.company_id = t1.spv_company_id) As spv_company_code,
(Select c.company_short_name
From fnd_companies_vl c
Where c.company_id = t1.spv_company_id) As spv_company_id_n,
t1.lease_organization,
(Select o.description
From hls_lease_organization o
Where o.lease_organization = t1.lease_organization) As lease_organization_n,
t1.lease_channel,
(Select p.lease_channel
From prj_project p
Where p.project_id = t1.project_id) As prj_lease_channel,
(Select p.special_permit_flag
From prj_project p
Where p.project_id = t1.project_id) As special_permit_flag,
(Select ch.description
From hls_lease_channel ch
Where ch.lease_channel = t1.lease_channel) As lease_channel_n,
t1.division,
(Select d.description
From hls_division d
Where d.division = t1.division) As division_n,
t1.bp_id_tenant,
(Select m.bp_code
From hls_bp_master m
Where m.bp_id = t1.bp_id_tenant) As bp_code,
(Select m.bp_name
From hls_bp_master m
Where m.bp_id = t1.bp_id_tenant) As bp_id_tenant_n,
(Select m.bp_name
From hls_bp_master m
Where m.bp_id = t1.bp_id_tenant) As bp_name,
(Select ma.bp_name
From hls_bp_master ma
Where ma.bp_id = t1.bp_id_tenant) bp_id_tenant_name,
t1.bp_id_agent_level1,
(Select m.bp_name
From hls_bp_master m
Where m.bp_id = t1.bp_id_agent_level1) As bp_id_agent_level1_n,
t1.bp_id_agent_level2,
(Select m.bp_code
From hls_bp_master m
Where m.bp_id = t1.bp_id_agent_level2) As bp_id_agent_level2_n,
t1.bp_id_agent_level3,
(Select m.bp_code
From hls_bp_master m
Where m.bp_id = t1.bp_id_agent_level3) As bp_id_agent_level3_n,
t1.owner_user_id,
(Select a.description
From sys_user a
Where a.user_id = t1.owner_user_id) owner_user_id_n,
t1.employee_id,
(Select e.name
From exp_employees e
Where e.employee_id = t1.employee_id) As employee_id_n,
t1.unit_id,
(Select h.bp_name From hls_bp_master h Where h.bp_id = t1.unit_id) As unit_id_n,
t1.employee_id_of_manager,
(Select e.name
From exp_employees e
Where e.employee_id = t1.employee_id_of_manager) As employee_id_of_manager_n,
t1.factoring_type,
t1.description,
t1.price_list,
(Select l.description
From hls_price_list l
Where l.price_list = t1.price_list) As price_list_n,
t1.calc_method,
to_date(to_char(t1.inception_of_lease, 'yyyy-mm-dd'), 'yyyy-mm-dd') inception_of_lease, --起租日
t1.contract_status, ------------------------
(Select v.code_value_name
From sys_code_values_v v
Where v.code = 'CON500_CONTRACT_STATUS'
And v.code_value = t1.contract_status) As contract_status_n, ----------------------
t1.con_maintain_flag, ------------------------
(Select a.project_number
From prj_project a
Where a.project_id = t1.project_id) project_number,
(Select a.document_type
From prj_project a
Where a.project_id = t1.project_id) project_document_type, -----------------
(Select bm.bp_class
From hls_bp_master bm
Where bm.bp_id = t1.bp_id_tenant) bp_class, -----------------
(Select bm.bp_class_n
From hls_bp_master_lv bm
Where bm.bp_id = t1.bp_id_tenant) bp_class_n, -------------------
Null version_number,
(Select su.description
From sys_user su
Where su.user_id = t1.owner_user_id) owner, -- 单据所有者
-- t1.cancel_reason, --合同取消原因
t1.closed_date, -- 合同取消日期----------------------------------
(Select to_date(to_char(pp.create_con_date, 'yyyy-mm-dd'),
'yyyy-mm-dd')
From prj_project pp
Where pp.project_id = t1.project_id) contract_creation_date, -- 项目创建合同时间--------------------------------
t1.wfl_instance_id, --------------------------
(Select to_date(to_char(zi.creation_date, 'yyyy-mm-dd'), 'yyyy-mm-dd')
From zj_wfl_workflow_instance zi
Where zi.instance_id = t1.wfl_instance_id) submit_date_detail, ---------------------------
nvl(t1.archive_status, '10') archive_status, -------------------
nvl((Select v.code_value_name As value_name
From sys_code_values_v v
Where v.code = 'ARCHIVE_STATUS'
And v.code_value = t1.archive_status),
'未归档') archive_status_n, ------------------------
--add by chenlingfeng
(Select hbm.large_area
From hls_bp_master hbm
Where hbm.bp_id = t1.bp_id_tenant) large_area,
--end
t1.content_type,
(Select v.code_value_name
From sys_code_values_v v
Where v.code = 'CON1010_CONTENT_TYPE'
And v.code_value = t1.content_type) content_type_n,
t1.sys_level,
t1.bs_level,
t1.lease_execution_date,--执行日期
(Select m.extra_nam
From hls_bp_master m
Where m.bp_id = t1.bp_id_agent_level1) As extra_nam,
t1.wfl_contract_status,
(Select v.code_value_name
From sys_code_values_v v
Where v.code = 'HLS303_WFL_STATUS'
And v.code_value = t1.wfl_contract_status
and v.code_enabled_flag='Y'
and v.code_value_enabled_flag='Y') wfl_contract_status_n
From con_contract t1
Where t1.data_class = 'NORMAL'
--t1.contract_status In ('NEW','SIGN','INCEPT')
-- And
order by t1.creation_date desc
;
create or replace view hls_document_use_seal_vl as create or replace view hls_document_use_seal_vl as
select t.document_use_seal_id, select t.document_use_seal_id,
t.document_table, t.document_table,
t.document_id AS contract_id, t.document_id AS contract_id,
...@@ -37,5 +37,12 @@ select t.document_use_seal_id, ...@@ -37,5 +37,12 @@ select t.document_use_seal_id,
from sys_code_values_v v from sys_code_values_v v
where v.code_value = t.supervisio_seal where v.code_value = t.supervisio_seal
and v.code = 'YES_OR_NO') as supervisio_seal_n, and v.code = 'YES_OR_NO') as supervisio_seal_n,
t.seal_number as SEAL_QUANTITY t.seal_number as SEAL_QUANTITY,
t.seal_number,
(select v.code_value_name
from sys_code_values_v v
where v.code_value = t.seal_number
and v.code = 'SEAL_NUMBER'
and v.code_enabled_flag='Y'
and v.code_value_enabled_flag='Y') seal_number_n
from HLS_DOCUMENT_USE_SEAL t; from HLS_DOCUMENT_USE_SEAL t;
create or replace view prj_hls_fin_calculator_ln_lv as
select ln.times,
ln.calc_date,
ln.RENTAL_EQ_PYMT_RAW,
LN.RENTAL,
LN.PRINCIPAL,
LN.INTEREST,
LN.OUTSTANDING_PRIN_TAX_INCLD,
LN.CALC_SESSION_ID,
pq.document_id project_id,
pq.quotation_id
from hls_fin_calculator_ln ln, hls_fin_calculator_hd hd, prj_quotation pq
where hd.calc_session_id = ln.calc_session_id
and pq.calc_session_id = hd.calc_session_id
and pq.document_category = 'PROJECT'
ORDER BY (ln.times+0)
;
create or replace view prj_project_detail_bp_lv as
Select t1.project_id,
t1.prj_bp_id,
t1.bp_id,
(select hls.bp_name from hls_bp_master hls where hls.bp_id = t1.bp_id) bp_id_n,
t1.bp_category,
(select b.description
from hls_bp_category b
where b.bp_category = t1.bp_category) bp_category_n,
(Select bt.description
From hls_bp_type bt, hls_bp_master hls
Where bt.bp_type = hls.bp_type
And hls.bp_id = t1.bp_id) As bp_type_n,
(Select scv.code_value_name
From sys_code_values_v scv, hls_bp_master hls
Where scv.code = 'HLS_SYS_UNIT_PROPERTY'
And scv.code_value = hls.legal_form
And hls.bp_id = t1.bp_id) legal_form_n,
(select hls.legal_form from hls_bp_master hls where hls.bp_id = t1.bp_id) legal_form,
(Select hls.bp_code
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) bp_code,
(Select hls.bp_class
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) bp_class,
(Select v.code_value_name
From sys_code_values_v v, hls_bp_master hls
Where v.code = 'HLS211_BP_CLASS'
And v.code_value = hls.bp_class
And hls.bp_id = t1.bp_id) As bp_class_n,
(Select hls.founded_date
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) founded_date,
(Select hls.registered_capital
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) registered_capital,
(Select hls.work_force
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) work_force,
(Select hls.work_unit_phone
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) work_unit_phone,
(Select hls.office_space
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) office_space,
(Select v.code_value_name
From sys_code_values_v v, hls_bp_master hls
Where v.code = 'PROPERTY_ATTRIBUTE'
And v.code_enabled_flag = 'Y'
And v.code_value_enabled_flag = 'Y'
And v.code_value = hls.property_attribute
And hls.bp_id = t1.bp_id) property_attribute_n,
(select hls.property_attribute from hls_bp_master hls where hls.bp_id = t1.bp_id) property_attribute,
(Select hls.source_of_income_db
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) source_of_income_db,
(Select hls.business_license_num
From hls_bp_master hls
Where hls.bp_id = t1.bp_id) business_license_num,
t1.Number_Of_Car,
t1.Manage_Of_Car,
t1.Number_Of_Cus,
t1.PERIOD_OF_YEAR,
t1.ASSET_SIZE,
t1.Debt,
t1.Revenue,
t1.Net_Profit,
t1.Land_Situation,
t1.Mortgage_Guarantee,
t1.Estimation_Lease,
t1.Guarantee_Of_Repayment,
t1.Risk_Measure,
t1.CREDIT_RECORD,
t1.Company_Credit_Record,
t1.Criminal_Record,
t1.EXECUTED_ASSET
From prj_project_bp t1;
create or replace view prj_project_history_lv as
select (select pp.project_number
from prj_project pp
where pp.project_id = bp.project_id) project_number,
(select cc.contract_number
from con_contract cc
where cc.project_id = bp.project_id) contract_number,
(select cc.contract_id
from con_contract cc
where cc.project_id = bp.project_id) contract_id,
bp.bp_code,
bp.bp_name,
(select cc.overdue_max_days
from con_contract cc
where cc.project_id = bp.project_id) overdue_max_days,
(select max(cc.overdue_amount)
from con_contract cc
where cc.project_id = bp.project_id) overdue_max_amount,
bp.bp_type,
bp.bp_id,
bp.project_id,
bp.bp_class,
(select hbt.description
from hls_bp_type hbt
where hbt.bp_type = bp.bp_type) description
from prj_project_bp bp;
create or replace view prj_quotation_new_lv as
select "QUOTATION_ID",
t1.document_category,
t1.calc_session_id,
"DOCUMENT_ID",
t1.lease_start_date,
t1.price_list,
(select l.description as value_name
from hls_price_list l
where l.price_list = t1.price_list) price_list_n,
t1.lease_times,
t1.annual_pay_times,
"DOWN_PAYMENT",
t1.down_payment_ratio,
t1.residual_value,
t1.guide_price,
t1.invoice_price,
t1.purchase_tax,
t1.insurance_price,
t1.plate_price,
"LEASE_CHARGE",
"LEASE_CHARGE_RATIO",
"MAIN_CONTRACT_FLAG",
"DOCUMENT_NUMBER",
"LEASE_ITEM_AMOUNT",
"REVERSE_FLAG",
"WFL_STATUS",
t1.wfl_instance_id,
"REVIEW_FLAG",
"DOCUMENT_STATUS",
"REVIEW_BY",
"REVERSE_DATE",
"RENT_TYPE",
"RENT_DATE",
"RENT_DAY",
"INSURANCE_FEE",
"BP_ID_INSURE",
"INSURE_TYPE",
"CREATED_CONTRACT_FLAG",
"HD_USER_COL_V09",
"HD_USER_COL_N06",
"HD_USER_COL_N15",
"HD_USER_COL_N14",
"HD_USER_COL_N13",
"DEPOSIT_DEDUCTION",
"TOTAL_SALESTAX",
"HD_USER_COL_N08",
"INT_RATE_DISPLAY",
"PAY_TYPE",
"HD_USER_COL_N02",
"HD_USER_COL_N07",
"LEASE_ITEM_PRICE_AGENT",
"GPS_INSTALL",
"HD_USER_COL_N05",
"GPS_FEE_PAY",
"GPS_FEE",
"INVESTIGATION_FEE",
"FIRST_INSURANCE_FEE",
"OTHER_FEE",
"LEASE_TERM",
"HD_USER_COL_V01",
"HD_USER_COL_N12",
"HD_USER_COL_N04",
"BTB_TOTAL_FEE_PV",
"BTB_INTEREST_MARGIN",
"DEPOSIT_RATIO",
"NOTARIAL_FEE_PAYABLE",
"OTHER_FEE3",
t1.btb_fee_after_tax,
(select h1.code_value_name value_code
from sys_code_values_v h1
where h1.code = 'HLS500_ANNUAL_PAY_TIMES'
and t1.annual_pay_times = h1.code_value) annual_pay_times_n,
-- (select h1.code_value_name value_code
-- from sys_code_values_v h1
-- where h1.code = 'HLS500_ANNUAL_PAY_TIMES'
-- and t1.btb_fee_after_tax = h1.code_value) btb_fee_after_tax_n,
(select h1.code_value_name value_code
from sys_code_values_v h1
where h1.code = 'HLS500_ANNUAL_PAY_TIMES'
and h1.code_value = t1.btb_fee_after_tax) btb_fee_after_tax_n,
(select h1.code_value_name value_code
from sys_code_values_v h1
where h1.code = 'HLS_052_FINANCIAL_SCALE'
and t1.hd_user_col_v01 = h1.code_value) hd_user_col_v01_n,
/* decode(t1.lease_times, 12, 12, 24, 24, 36, 36, 48, 48) lease_times_n,*/
(select h1.code_value_name value_code
from sys_code_values_v h1
where h1.code = 'TIMES'
and t1.lease_times = h1.code_value) lease_times_n,
a.project_id,
t1.product_id,
(select t2.special_note
from hls_product_plan_definition t2
where t2.product_plan_id = t1.product_id) product_id_n,
(select t2.if_self_definition
from hls_product_plan_definition t2
where t2.product_plan_id = t1.product_id) if_self_definition, --是否自定义产品
(select decode(t2.if_self_definition, 'N', '否', 'Y', '是', '否')
from hls_product_plan_definition t2
where t2.product_plan_id = t1.product_id) if_self_definition_n, --是否自定义产品
t1.base_rate t1.base_rate_type,
(select d.description
from fnd_base_rate_type d
where d.base_rate_type = t1.base_rate_type) base_rate_type_n,
t1.currency,
t1.btb_net_finance_amount,
t1.btb_finance_amount,
(select hd.deposit
from hls_fin_calculator_hd hd
where hd.calc_session_id = t1.calc_session_id) deposit,
(select hd.irr
from hls_fin_calculator_hd hd
where hd.calc_session_id = t1.calc_session_id) irr,
t1.third_party_deposit,
(select b.code_value_name value_name
from sys_code_values_v b
where b.code = 'HLS500_DEPOSIT_DEDUCTION'
and b.code_value = t1.deposit_deduction) deposit_deduction_n,
a.business_type,
t1.commission_receivable,
t1.finance_amount,
t1.other_payment3,
t1.btb_total_fee,
t1.hd_user_col_v03,
t1.hd_user_col_v05,
(select b.code_value_name
from sys_codes a, sys_code_values_vl b
where b.code_id = a.code_id
and a.code = 'MORTGAGE_TIME'
and b.code_value = t1.hd_user_col_v05) hd_user_col_v05_n,
nvl(t1.promise_to_pay, 0) promise_to_pay,
decode(t1.price_list, 'DR_PRICE_25', 'Y', 'N') quote_rent,
--add by chenlingfeng
t1.pmt_first,
t1.direct_lease_charge,
t1.cus_charge_allocate_flag,
t1.insurance_pck_flag,
t1.product_name,
t1.product_type,
t1.INSURANCE_METHOD,
(select v.code_value_name
from sys_code_values_v v
where v.code = 'INSURANCE_METHOD' and
v.code_value = t1.INSURANCE_METHOD) INSURANCE_METHOD_n,
(select h.price_list from hls_fin_calculator_hd h where h.calc_session_id= t1.calc_session_id) cal_hd_price_list,
t1.sub_price_list,--商品名2type
(select v.code_value_name
from sys_code_values_v v
where v.code = 'PRICE_LIST_NAME'
and v.code_value=t1.sub_price_list)sub_price_list_n,
t1.lease_mgt_fee_ratio,--代理商手续费比例
--add by lijingjing
t1.other_fee2,
t1.total_rental,
t1.hd_user_col_n11
-- t1.lease_start_date
from prj_quotation t1, prj_project a
where t1.document_id = a.project_id
and t1.document_category = 'PROJECT'
;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment