<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Mouse Chow  
    $Date: 2012-12-23 涓婂崍11:07:18  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="LCH_LEASE_CHANCE_HDS">
    <bm:fields>
        <bm:field name="lease_chance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_CHANCE_ID" prompt="LCH_LEASE_CHANCE_HDS.LEASE_CHANCE_ID"/>
        <bm:field name="lease_chance_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANCE_CODE" prompt="LCH_LEASE_CHANCE_HDS.LEASE_CHANCE_CODE"/>
        <bm:field name="lease_chance_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANCE_TYPE" prompt="LCH_LEASE_CHANCE_HDS.LEASE_CHANCE_TYPE"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" insertExpression="&apos;NEW&apos;" physicalName="STATUS" prompt="LCH_LEASE_CHANCE_HDS.STATUS"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" defaultValue="${/session/@company_id}" physicalName="COMPANY_ID" prompt="LCH_LEASE_CHANCE_HDS.COMPANY_ID"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION" prompt="LCH_LEASE_CHANCE_HDS.LEASE_ORGANIZATION"/>
        <bm:field name="lease_organization_desc" expression="(select lo.description from hls_lease_organization lo where lo.lease_organization = t1.lease_organization and lo.company_id=t1.company_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL" prompt="LCH_LEASE_CHANCE_HDS.LEASE_CHANNEL"/>
        <bm:field name="lease_channel_desc" expression="(select lc.description from hls_lease_channel lc where lc.lease_channel = t1.lease_channel)" forInsert="false" forUpdate="false"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION" prompt="LCH_LEASE_CHANCE_HDS.DIVISION_ID"/>
        <bm:field name="division_desc" expression="(select hd.description from hls_division hd where hd.division = t1.division)" forInsert="false" forUpdate="false"/>
        <bm:field name="potential_customer" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POTENTIAL_CUSTOMER" prompt="LCH_LEASE_CHANCE_HDS.POTENTIAL_CUSTOMER_ID"/>
        <bm:field name="salesman_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SALESMAN_ID" prompt="LCH_LEASE_CHANCE_HDS.SALESMAN_ID"/>
        <bm:field name="salesman" expression="(select distinct sv.employee_name  from HLS_SALESMAN_ASSIGN_V sv where sv.employee_id = t1.salesman_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="chance_source" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANCE_SOURCE" prompt="LCH_LEASE_CHANCE_HDS.CHANCE_SOURCE"/>
        <bm:field name="first_contact_date" databaseType="DATE" datatype="java.util.Date" physicalName="FIRST_CONTACT_DATE" prompt="LCH_LEASE_CHANCE_HDS.FIRST_CONTACT_DATE"/>
        <bm:field name="possibility" databaseType="NUMBER" datatype="java.lang.Long" physicalName="POSSIBILITY" prompt="LCH_LEASE_CHANCE_HDS.POSSIBILITY"/>
        <bm:field name="competitor" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMPETITOR" prompt="LCH_LEASE_CHANCE_HDS.COMPETITOR"/>
        <bm:field name="contact_person" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTACT_PERSON" prompt="LCH_LEASE_CHANCE_HDS.CONTACT_PERSON"/>
        <bm:field name="contact_phone_no" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTACT_PHONE_NO" prompt="LCH_LEASE_CHANCE_HDS.CONTACT_PHONE_NO"/>
        <bm:field name="currency_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_CODE" prompt="LCH_LEASE_CHANCE_HDS.CURRENCY_CODE"/>
        <bm:field name="province_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROVINCE_ID" prompt="LCH_LEASE_CHANCE_HDS.PROVINCE_ID"/>
        <bm:field name="province" expression="(select fpv.province_name from Hls_Fnd_Province_Vl fpv where fpv.province_id = t1.province_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="city_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CITY_ID" prompt="LCH_LEASE_CHANCE_HDS.CITY_ID"/>
        <bm:field name="city" expression="(select fcv.city_name from HLS_FND_CITY_VL fcv where fcv.city_id = t1.city_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="region_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REGION_ID" prompt="LCH_LEASE_CHANCE_HDS.REGION_ID"/>
        <bm:field name="region" expression="(select frv.region_name from hls_fnd_region_vl frv where frv.region_id = t1.region_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="detail_address" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DETAIL_ADDRESS" prompt="LCH_LEASE_CHANCE_HDS.DETAIL_ADDRESS"/>
        <bm:field name="customer_business_line" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CUSTOMER_BUSINESS_LINE" prompt="LCH_LEASE_CHANCE_HDS.CUSTOMER_BUSINESS_LINE"/>
        <bm:field name="is_listed_company" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="IS_LISTED_COMPANY" prompt="LCH_LEASE_CHANCE_HDS.IS_LISTED_COMPANY"/>
        <bm:field name="sales_revenue" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SALES_REVENUE" prompt="LCH_LEASE_CHANCE_HDS.SALES_REVENUE"/>
        <bm:field name="profit" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROFIT" prompt="LCH_LEASE_CHANCE_HDS.PROFIT"/>
        <bm:field name="employee_quantity" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_QUANTITY" prompt="LCH_LEASE_CHANCE_HDS.EMPLOYEE_QUANTITY"/>
        <bm:field name="market_position" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MARKET_POSITION" prompt="LCH_LEASE_CHANCE_HDS.MARKET_POSITION"/>
        <bm:field name="primary_business" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRIMARY_BUSINESS" prompt="LCH_LEASE_CHANCE_HDS.PRIMARY_BUSINESS"/>
        <bm:field name="vendor" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VENDOR" prompt="LCH_LEASE_CHANCE_HDS.VENDOR"/>
        <bm:field name="lease_item" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="lease_item" prompt="LCH_LEASE_CHANCE_HDS.LEASE_ITEM"/>
        <bm:field name="expect_contract_date" databaseType="DATE" datatype="java.util.Date" physicalName="EXPECT_CONTRACT_DATE" prompt="LCH_LEASE_CHANCE_HDS.EXPECT_CONTRACT_DATE"/>
        <bm:field name="expect_financing_date" databaseType="DATE" datatype="java.util.Date" physicalName="EXPECT_FINANCING_DATE" prompt="LCH_LEASE_CHANCE_HDS.EXPECT_FINANCING_DATE"/>
        <bm:field name="lease_period" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_PERIOD" prompt="LCH_LEASE_CHANCE_HDS.LEASE_PERIOD"/>
        <bm:field name="payment_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PAYMENT_METHOD" prompt="LCH_LEASE_CHANCE_HDS.PAYMENT_METHOD"/>
        <bm:field name="assets_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ASSETS_AMOUNT" prompt="LCH_LEASE_CHANCE_HDS.ASSETS_AMOUNT"/>
        <bm:field name="down_payment" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOWN_PAYMENT" prompt="LCH_LEASE_CHANCE_HDS.DOWN_PAYMENT"/>
        <bm:field name="lease_principal" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_PRINCIPAL" prompt="LCH_LEASE_CHANCE_HDS.LEASE_PRINCIPAL"/>
        <bm:field name="assets_location" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ASSETS_LOCATION" prompt="LCH_LEASE_CHANCE_HDS.ASSETS_LOCATION"/>
        <bm:field name="assets_usage" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ASSETS_USAGE" prompt="LCH_LEASE_CHANCE_HDS.ASSETS_USAGE"/>
        <bm:field name="lease_product_id"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
    				update lch_lease_chance_hds c
					   set c.status = 'CREATED'
					 where c.lease_chance_id = ${@lease_chance_id};

    			end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="lease_chance_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="lease_chance_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
