<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-15 上午11:06:04  
    $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="CON_CONTRACT_CHANGE_REQ" defaultOrderBy="t1.BATCH_ID desc,t1.CHANGE_REQ_NUMBER desc">
    <bm:fields>
        <bm:field name="change_req_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHANGE_REQ_ID" prompt="CON_CONTRACT_CHANGE_REQ.CHANGE_REQ_ID"/>
        <bm:field name="batch_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="${../@batch_id}" physicalName="BATCH_ID" prompt="CON_CONTRACT_CHANGE_REQ.BATCH_ID"/>
        <bm:field name="change_req_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_REQ_NUMBER" prompt="CON_CONTRACT_CHANGE_REQ.CHANGE_REQ_NUMBER"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="CON_CONTRACT_CHANGE_REQ.DOCUMENT_TYPE"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="CON_CONTRACT_CHANGE_REQ.DOCUMENT_CATEGORY"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="CON_CONTRACT_CHANGE_REQ.BUSINESS_TYPE"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="${/session/@company_id}" physicalName="COMPANY_ID" prompt="CON_CONTRACT_CHANGE_REQ.COMPANY_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_CONTRACT_CHANGE_REQ.CONTRACT_ID"/>
        <bm:field name="req_status" databaseType="VARCHAR2" datatype="java.lang.String" insertExpression="&apos;NEW&apos;" lookupCode="CON_CHANGE_REQ_STATUS" lookupField="req_status_desc" physicalName="REQ_STATUS" prompt="CON_CONTRACT_CHANGE_REQ.REQ_STATUS"/>
        <bm:field name="req_status_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="req_date" databaseType="DATE" datatype="java.util.Date" insertExpression="sysdate" physicalName="REQ_DATE" prompt="CON_CONTRACT_CHANGE_REQ.REQ_DATE"/>
        <bm:field name="change_req_profile" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_REQ_PROFILE" prompt="CON_CONTRACT_CHANGE_REQ.CHANGE_REQ_PROFILE"/>
        <bm:field name="reschedule_start_date" expression="to_char(t1.reschedule_start_date,&apos;yyyy-mm-dd&apos;)" forInsert="true" forQuery="true" forUpdate="true" insertExpression="to_date(${@reschedule_start_date},&apos;yyyy-mm-dd&apos;)" physicalName="RESCHEDULE_START_DATE" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_START_DATE" updateExpression="to_date(${@reschedule_start_date},&apos;yyyy-mm-dd&apos;)"/>
        <bm:field name="reschedule_start_times" physicalName="RESCHEDULE_START_TIMES" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_START_TIMES"/>
        <bm:field name="reschedule_new_date" expression="to_char(t1.reschedule_new_date,&apos;yyyy-mm-dd&apos;)" forInsert="true" forQuery="true" forUpdate="true" insertExpression="to_date(${@reschedule_new_date},&apos;yyyy-mm-dd&apos;)" physicalName="RESCHEDULE_NEW_DATE" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_NEW_DATE" updateExpression="to_date(${@reschedule_new_date},&apos;yyyy-mm-dd&apos;)"/>
        <bm:field name="reschedule_total_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_TOTAL_TIMES" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_TOTAL_TIMES"/>
        <bm:field name="reschedule_last_time" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESCHEDULE_LAST_TIME" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_LAST_TIME"/>
        <bm:field name="reschedule_balance" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RESCHEDULE_BALANCE" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_BALANCE"/>
        <bm:field name="reschedule_direction" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESCHEDULE_DIRECTION" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_DIRECTION"/>
        <bm:field name="reschedule_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESCHEDULE_DAYS" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_DAYS"/>
        <bm:field name="reschedule_fee" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RESCHEDULE_FEE" prompt="CON_CONTRACT_CHANGE_REQ.RESCHEDULE_FEE"/>
        <bm:field name="calculate_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CALCULATE_RATE" prompt="CON_CONTRACT_CHANGE_REQ.CALCULATE_RATE"/>
        <bm:field name="termination_date" databaseType="DATE" datatype="java.util.Date" physicalName="TERMINATION_DATE" prompt="CON_CONTRACT_CHANGE_REQ.TERMINATION_DATE"/>
        <bm:field name="overdue_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OVERDUE_AMOUNT" prompt="CON_CONTRACT_CHANGE_REQ.OVERDUE_AMOUNT"/>
        <bm:field name="penalty" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PENALTY" prompt="CON_CONTRACT_CHANGE_REQ.PENALTY"/>
        <bm:field name="rentals_payable" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RENTALS_PAYABLE" prompt="CON_CONTRACT_CHANGE_REQ.RENTALS_PAYABLE"/>
        <bm:field name="discount_total_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DISCOUNT_TOTAL_AMOUNT" prompt="CON_CONTRACT_CHANGE_REQ.DISCOUNT_TOTAL_AMOUNT"/>
        <bm:field name="undue_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNDUE_PRINCIPAL" prompt="CON_CONTRACT_CHANGE_REQ.UNDUE_PRINCIPAL"/>
        <bm:field name="et_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ET_INTEREST" prompt="CON_CONTRACT_CHANGE_REQ.ET_INTEREST"/>
        <bm:field name="mgt_fee_after_discount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="MGT_FEE_AFTER_DISCOUNT" prompt="CON_CONTRACT_CHANGE_REQ.MGT_FEE_AFTER_DISCOUNT"/>
        <bm:field name="et_fee" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ET_FEE" prompt="CON_CONTRACT_CHANGE_REQ.ET_FEE"/>
        <bm:field name="residual_value" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RESIDUAL_VALUE" prompt="CON_CONTRACT_CHANGE_REQ.RESIDUAL_VALUE"/>
        <bm:field name="et_total_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ET_TOTAL_AMOUNT" prompt="CON_CONTRACT_CHANGE_REQ.ET_TOTAL_AMOUNT"/>
        <bm:field name="last_paydue_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_PAYDUE_DATE" prompt="CON_CONTRACT_CHANGE_REQ.LAST_PAYDUE_DATE"/>
        <bm:field name="last_paydue_times" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LAST_PAYDUE_TIMES" prompt="CON_CONTRACT_CHANGE_REQ.LAST_PAYDUE_TIMES"/>
        <bm:field name="discount_days" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DISCOUNT_DAYS" prompt="CON_CONTRACT_CHANGE_REQ.DISCOUNT_DAYS"/>
        <bm:field name="submit_date" databaseType="DATE" datatype="java.util.Date" physicalName="SUBMIT_DATE" prompt="CON_CONTRACT_CHANGE_REQ.SUBMIT_DATE"/>
        <bm:field name="approved_date" databaseType="DATE" datatype="java.util.Date" physicalName="APPROVED_DATE" prompt="CON_CONTRACT_CHANGE_REQ.APPROVED_DATE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="CON_CONTRACT_CHANGE_REQ.DESCRIPTION"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="CON_CONTRACT_CHANGE_REQ.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="CON_CONTRACT_CHANGE_REQ.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="CON_CONTRACT_CHANGE_REQ.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="CON_CONTRACT_CHANGE_REQ.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="CON_CONTRACT_CHANGE_REQ.REF_V05"/>
        <bm:field name="ref_v06" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V06" prompt="CON_CONTRACT_CHANGE_REQ.REF_V06"/>
        <bm:field name="ref_v07" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V07" prompt="CON_CONTRACT_CHANGE_REQ.REF_V07"/>
        <bm:field name="ref_v08" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V08" prompt="CON_CONTRACT_CHANGE_REQ.REF_V08"/>
        <bm:field name="ref_v09" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V09" prompt="CON_CONTRACT_CHANGE_REQ.REF_V09"/>
        <bm:field name="ref_v10" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V10" prompt="CON_CONTRACT_CHANGE_REQ.REF_V10"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N01" prompt="CON_CONTRACT_CHANGE_REQ.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N02" prompt="CON_CONTRACT_CHANGE_REQ.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N03" prompt="CON_CONTRACT_CHANGE_REQ.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N04" prompt="CON_CONTRACT_CHANGE_REQ.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N05" prompt="CON_CONTRACT_CHANGE_REQ.REF_N05"/>
        <bm:field name="ref_n06" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N06" prompt="CON_CONTRACT_CHANGE_REQ.REF_N06"/>
        <bm:field name="ref_n07" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N07" prompt="CON_CONTRACT_CHANGE_REQ.REF_N07"/>
        <bm:field name="ref_n08" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N08" prompt="CON_CONTRACT_CHANGE_REQ.REF_N08"/>
        <bm:field name="ref_n09" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N09" prompt="CON_CONTRACT_CHANGE_REQ.REF_N09"/>
        <bm:field name="ref_n10" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N10" prompt="CON_CONTRACT_CHANGE_REQ.REF_N10"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="CON_CONTRACT_CHANGE_REQ.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="CON_CONTRACT_CHANGE_REQ.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="CON_CONTRACT_CHANGE_REQ.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="CON_CONTRACT_CHANGE_REQ.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="CON_CONTRACT_CHANGE_REQ.REF_D05"/>
        <bm:field name="ref_d06" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D06" prompt="CON_CONTRACT_CHANGE_REQ.REF_D06"/>
        <bm:field name="ref_d07" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D07" prompt="CON_CONTRACT_CHANGE_REQ.REF_D07"/>
        <bm:field name="ref_d08" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D08" prompt="CON_CONTRACT_CHANGE_REQ.REF_D08"/>
        <bm:field name="ref_d09" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D09" prompt="CON_CONTRACT_CHANGE_REQ.REF_D09"/>
        <bm:field name="ref_d10" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D10" prompt="CON_CONTRACT_CHANGE_REQ.REF_D10"/>
        <bm:field name="cashflow_item_desc" expression="(select hci.description   from hls_cashflow_item hci, con_change_req_profile crp          where crp.change_req_profile = t1.change_req_profile            and ((crp.inflow_resch_charge = hci.cf_item and                t1.reschedule_direction = &apos;BACKWARD&apos;) or                (crp.outflow_resch_charge = hci.cf_item and                t1.reschedule_direction = &apos;FORWARD&apos;)))" forInsert="false" forUpdate="false"/>
        <bm:field name="cf_direction" expression="(select hci.cf_direction   from hls_cashflow_item hci, con_change_req_profile crp          where crp.change_req_profile = t1.change_req_profile            and ((crp.inflow_resch_charge = hci.cf_item and                t1.reschedule_direction = &apos;BACKWARD&apos;) or                (crp.outflow_resch_charge = hci.cf_item and                t1.reschedule_direction = &apos;FORWARD&apos;)))" forInsert="false" forUpdate="false"/>
        <bm:field name="document_type_desc" expression="(select hdt.document_type_desc   from hls_document_type_v hdt  WHERE hdt.document_type=t1.document_type)" forinsert="false" forupdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="change_req_id"/>
    </bm:primary-key>
    <bm:relations>
        <bm:relation name="ref" joinType="LEFT OUTER" refAlias="c1" refModel="cont.CON500.con_contract_v">
            <bm:reference foreignField="contract_id" localField="contract_id"/>
        </bm:relation>
    </bm:relations>
    <bm:ref-fields>
        <bm:ref-field name="contract_number" relationName="ref" sourceField="contract_number"/>
        <bm:ref-field name="contract_name" relationName="ref" sourceField="contract_name"/>
        <bm:ref-field name="project_number" relationName="ref" sourceField="project_number"/>
        <bm:ref-field name="project_name" relationName="ref" sourceField="project_name"/>
    </bm:ref-fields>
    <bm:query-fields>
        <bm:query-field field="batch_id" queryOperator="="/>
        <bm:query-field name="project_number" queryExpression="c1.project_number = ${@project_number}"/>
        <bm:query-field name="project_name" queryExpression="c1.project_name like ${@project_name}"/>
        <bm:query-field name="contract_number" queryExpression="c1.contract_number = ${@contract_number}"/>
        <bm:query-field name="contract_name" queryExpression="c1.contract_name like ${@contract_name}"/>
        <bm:query-field name="batch_id_f" queryExpression="t1.batch_id &gt;= ${@batch_id_f}"/>
        <bm:query-field name="batch_id_t" queryExpression="t1.batch_id &lt;= ${@batch_id_t}"/>
        <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 field="req_status" queryOperator="="/>
        <bm:query-field field="document_type" queryExpression="t1.document_type=${@document_type}"/>
    </bm:query-fields>
</bm:model>
