<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-11-23 下午3:22:39  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_CONTRACT_CHANGE_REQ_V" defaultOrderBy="t1.change_req_number">
    <bm:fields>
        <bm:field name="change_req_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHANGE_REQ_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.CHANGE_REQ_ID"/>
        <bm:field name="batch_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BATCH_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.BATCH_ID"/>
        <bm:field name="change_req_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_REQ_NUMBER" prompt="CON_CONTRACT_CHANGE_REQ_V.CHANGE_REQ_NUMBER"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="CON_CONTRACT_CHANGE_REQ_V.DOCUMENT_TYPE"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="CON_CONTRACT_CHANGE_REQ_V.DOCUMENT_CATEGORY"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="CON_CONTRACT_CHANGE_REQ_V.BUSINESS_TYPE"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.COMPANY_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.CONTRACT_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="CON_CONTRACT_CHANGE_REQ_V.CONTRACT_NUMBER"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME" prompt="CON_CONTRACT_CHANGE_REQ_V.CONTRACT_NAME"/>
        <bm:field name="search_term_1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEARCH_TERM_1" prompt="CON_CONTRACT_CHANGE_REQ_V.SEARCH_TERM_1"/>
        <bm:field name="search_term_2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEARCH_TERM_2" prompt="CON_CONTRACT_CHANGE_REQ_V.SEARCH_TERM_2"/>
        <bm:field name="req_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REQ_STATUS" prompt="CON_CONTRACT_CHANGE_REQ_V.REQ_STATUS"/>
        <bm:field name="req_status_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REQ_STATUS_DESC" prompt="CON_CONTRACT_CHANGE_REQ_V.REQ_STATUS_DESC"/>
        <bm:field name="req_date" databaseType="DATE" datatype="java.util.Date" physicalName="REQ_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.REQ_DATE"/>
        <bm:field name="change_req_profile" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_REQ_PROFILE" prompt="CON_CONTRACT_CHANGE_REQ_V.CHANGE_REQ_PROFILE"/>
        <bm:field name="reschedule_start_date" databaseType="DATE" datatype="java.util.Date" physicalName="RESCHEDULE_START_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_START_DATE"/>
        <bm:field name="reschedule_start_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_START_TIMES" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_START_TIMES"/>
        <bm:field name="reschedule_new_date" databaseType="DATE" datatype="java.util.Date" physicalName="RESCHEDULE_NEW_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_NEW_DATE"/>
        <bm:field name="reschedule_total_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_TOTAL_TIMES" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_TOTAL_TIMES"/>
        <bm:field name="reschedule_last_time" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESCHEDULE_LAST_TIME" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_LAST_TIME"/>
        <bm:field name="reschedule_balance" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_BALANCE" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_BALANCE"/>
        <bm:field name="reschedule_direction" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESCHEDULE_DIRECTION" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_DIRECTION"/>
        <bm:field name="reschedule_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_DAYS" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_DAYS"/>
        <bm:field name="reschedule_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_FEE" prompt="CON_CONTRACT_CHANGE_REQ_V.RESCHEDULE_FEE"/>
        <bm:field name="calculate_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CALCULATE_RATE" prompt="CON_CONTRACT_CHANGE_REQ_V.CALCULATE_RATE"/>
        <bm:field name="termination_date" databaseType="DATE" datatype="java.util.Date" physicalName="TERMINATION_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.TERMINATION_DATE"/>
        <bm:field name="overdue_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OVERDUE_AMOUNT" prompt="CON_CONTRACT_CHANGE_REQ_V.OVERDUE_AMOUNT"/>
        <bm:field name="penalty" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PENALTY" prompt="CON_CONTRACT_CHANGE_REQ_V.PENALTY"/>
        <bm:field name="rentals_payable" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RENTALS_PAYABLE" prompt="CON_CONTRACT_CHANGE_REQ_V.RENTALS_PAYABLE"/>
        <bm:field name="discount_total_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISCOUNT_TOTAL_AMOUNT" prompt="CON_CONTRACT_CHANGE_REQ_V.DISCOUNT_TOTAL_AMOUNT"/>
        <bm:field name="undue_principal" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNDUE_PRINCIPAL" prompt="CON_CONTRACT_CHANGE_REQ_V.UNDUE_PRINCIPAL"/>
        <bm:field name="et_interest" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ET_INTEREST" prompt="CON_CONTRACT_CHANGE_REQ_V.ET_INTEREST"/>
        <bm:field name="mgt_fee_after_discount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MGT_FEE_AFTER_DISCOUNT" prompt="CON_CONTRACT_CHANGE_REQ_V.MGT_FEE_AFTER_DISCOUNT"/>
        <bm:field name="et_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ET_FEE" prompt="CON_CONTRACT_CHANGE_REQ_V.ET_FEE"/>
        <bm:field name="residual_value" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESIDUAL_VALUE" prompt="CON_CONTRACT_CHANGE_REQ_V.RESIDUAL_VALUE"/>
        <bm:field name="et_total_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ET_TOTAL_AMOUNT" prompt="CON_CONTRACT_CHANGE_REQ_V.ET_TOTAL_AMOUNT"/>
        <bm:field name="last_paydue_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_PAYDUE_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.LAST_PAYDUE_DATE"/>
        <bm:field name="last_paydue_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LAST_PAYDUE_TIMES" prompt="CON_CONTRACT_CHANGE_REQ_V.LAST_PAYDUE_TIMES"/>
        <bm:field name="discount_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISCOUNT_DAYS" prompt="CON_CONTRACT_CHANGE_REQ_V.DISCOUNT_DAYS"/>
        <bm:field name="submit_date" databaseType="DATE" datatype="java.util.Date" physicalName="SUBMIT_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.SUBMIT_DATE"/>
        <bm:field name="approved_date" databaseType="DATE" datatype="java.util.Date" physicalName="APPROVED_DATE" prompt="CON_CONTRACT_CHANGE_REQ_V.APPROVED_DATE"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V05"/>
        <bm:field name="ref_v06" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V06" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V06"/>
        <bm:field name="ref_v07" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V07" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V07"/>
        <bm:field name="ref_v08" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V08" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V08"/>
        <bm:field name="ref_v09" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V09" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V09"/>
        <bm:field name="ref_v10" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V10" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_V10"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N05"/>
        <bm:field name="ref_n06" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N06" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N06"/>
        <bm:field name="ref_n07" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N07" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N07"/>
        <bm:field name="ref_n08" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N08" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N08"/>
        <bm:field name="ref_n09" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N09" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N09"/>
        <bm:field name="ref_n10" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N10" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_N10"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D05"/>
        <bm:field name="ref_d06" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D06" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D06"/>
        <bm:field name="ref_d07" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D07" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D07"/>
        <bm:field name="ref_d08" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D08" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D08"/>
        <bm:field name="ref_d09" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D09" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D09"/>
        <bm:field name="ref_d10" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D10" prompt="CON_CONTRACT_CHANGE_REQ_V.REF_D10"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="CON_CONTRACT_CHANGE_REQ_V.DESCRIPTION"/>
        <bm:field name="wfl_instance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WFL_INSTANCE_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.WFL_INSTANCE_ID"/>
        <bm:field name="calc_session_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CALC_SESSION_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.CALC_SESSION_ID"/>
        <bm:field name="change_quotation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_QUOTATION" prompt="CON_CONTRACT_CHANGE_REQ_V.CHANGE_QUOTATION"/>
        <bm:field name="change_lease_item" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_LEASE_ITEM" prompt="CON_CONTRACT_CHANGE_REQ_V.CHANGE_LEASE_ITEM"/>
        <bm:field name="change_bp" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_BP" prompt="CON_CONTRACT_CHANGE_REQ_V.CHANGE_BP"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_CONTRACT_CHANGE_REQ_V.OWNER_USER_ID"/>
        <bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CODE" prompt="CON_CONTRACT_CHANGE_REQ_V.BP_CODE"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME" prompt="CON_CONTRACT_CHANGE_REQ_V.BP_NAME"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <s:bm-script><![CDATA[
            var cx = Packages.leaf.javascript.Context.getCurrentContext();
            Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
        ]]></s:bm-script>
    </bm:features>
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
					  con_contract_history_pkg.cancel_change_req(p_change_req_id => ${@change_req_id},
					                                             p_user_id       => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="change_req_number_f" queryExpression="t1.change_req_number &gt; = ${@change_req_number_f}"/>
        <bm:query-field name="change_req_number_t" queryExpression="t1.change_req_number &lt; = ${@change_req_number_t}"/>
        <bm:query-field name="req_date_f" queryExpression="t1.req_date &gt; = to_date(${@req_date_f},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="req_date_t" queryExpression="t1.req_date &lt; = to_date(${@req_date_t},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="contract_number" queryExpression="t1.contract_number like ${@contract_number}"/>
        <bm:query-field name="contract_name" queryExpression="t1.contract_name like ${@contract_name}"/>
        <bm:query-field name="search_term_1" queryExpression="t1.search_term_1 like ${@search_term_1}"/>
        <bm:query-field name="search_term_2" queryExpression="t1.search_term_2 like ${@search_term_2}"/>
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like ${@bp_name}"/>
        <bm:query-field name="req_status" queryExpression="t1.req_status = ${@req_status}"/>
    </bm:query-fields>
</bm:model>
