<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Icon  
    $Date: 2014-11-4 下午3:55:14  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="YONDA_DOC_STATUS_HISTORY_VL">
    <bm:fields>
        <bm:field name="status_history_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="STATUS_HISTORY_ID" prompt="YONDA_DOC_STATUS_HISTORY_VL.STATUS_HISTORY_ID"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="YONDA_DOC_STATUS_HISTORY_VL.DOCUMENT_CATEGORY"/>
        <bm:field name="document_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOCUMENT_ID" prompt="单据ID"/>
        <bm:field name="document_number" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" forSelect="true" physicalName="DOCUMENT_NUMBER" prompt="单据编号"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS" prompt="YONDA_DOC_STATUS_HISTORY_VL.STATUS"/>
        <bm:field name="status_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS_DESC" prompt="YONDA_DOC_STATUS_HISTORY_VL.STATUS_DESC"/>
        <bm:field name="user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="USER_ID" prompt="YONDA_DOC_STATUS_HISTORY_VL.USER_ID"/>
        <bm:field name="position_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POSITION_NAME" prompt="YONDA_DOC_STATUS_HISTORY_VL.POSITION_NAME"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="YONDA_DOC_STATUS_HISTORY_VL.DESCRIPTION"/>
        <bm:field name="operation_time" databaseType="DATE" datatype="java.lang.String" physicalName="OPERATION_TIME" prompt="YONDA_DOC_STATUS_HISTORY_VL.OPERATION_TIME"/>
        <bm:field name="action_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ACTION_TYPE_DESC" prompt="YONDA_DOC_STATUS_HISTORY_VL.ACTION_TYPE_DESC"/>
        <bm:field name="comment_text" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMMENT_TEXT" prompt="YONDA_DOC_STATUS_HISTORY_VL.COMMENT_TEXT"/>
        <bm:field name="current_status_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENT_STATUS_FLAG" prompt="YONDA_DOC_STATUS_HISTORY_VL.CURRENT_STATUS_FLAG"/>
        <bm:field name="current_status_flag_des" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select v.code_value_name from sys_code_values_v v where v.code=&apos;YES_NO&apos; and v.code_value=t1.current_status_flag ) " physicalName="CURRENT_STATUS_FLAG_DES" prompt="YONDA_DOC_STATUS_HISTORY_VL.CURRENT_STATUS_FLAG_DES"/>
        <bm:field name="company_id"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <!-- <bm:query-field field="document_number" queryOperator="="/> -->
        <!-- <bm:query-field name="contract_number" queryExpression="t1.document_number = ${@contract_number}"/> -->
        <bm:query-field field="user_id" queryOperator="="/>
        <bm:query-field field="description" queryOperator="like"/>
        <bm:query-field name="contract_id" queryExpression="t1.document_id in ((select cc.contract_id            from con_contract cc           where cc.contract_id = ${@contract_id} and cc.data_class=&apos;NORMAL&apos;),         (select pp.project_id            from prj_project pp, con_contract cc           where cc.project_id = pp.project_id             and cc.contract_id = ${@contract_id} and cc.data_class=&apos;NORMAL&apos;))"/>
        <bm:query-field name="project_id" queryExpression=" t1.document_id in ((select project_id from prj_project tt where tt.project_id = ${@project_id}),         (select cc.contract_id            from con_contract cc, prj_project tt           where tt.project_id = cc.project_id             and tt.project_id = ${@project_id} and cc.data_class=&apos;NORMAL&apos;))"/>
        <bm:query-field name="company_authority" queryExpression="t1.company_id in (select company_id from fnd_companies start with company_id =${@company_authority} connect by prior company_id = parent_biz_company_id)"/>
    </bm:query-fields>
</bm:model>
