<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-6-8 下午02:48:34  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm"  baseTable="rsc_fin_statement_report">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT *
                    FROM
                        rsc_fin_statement_report_lv t1 #WHERE_CLAUSE#  order by t1.project_id desc
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:query-sql><![CDATA[
               begin
                rsc_fin_statement_prj_pkg.ins_rsc_fin_statement_report(p_bp_id      => ${@bp_id},
                                                                     p_report_num   => ${@report_num},
                                                                     p_status       => ${@status},
                                                                     p_user_id      => ${/session/@user_id});
               end;
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="project_id"></bm:field>
        <bm:field name="bp_id"></bm:field>
        <bm:field name="bp_name" forInsert="false" forUpdate="false" ></bm:field>
        <bm:field name="report_num"></bm:field>
        <bm:field name="status"></bm:field>
        <bm:field name="status_desc"  forInsert="false" forUpdate="false" ></bm:field>
        <bm:field name="workflow_id"></bm:field>
        <bm:field name="approved_date"></bm:field>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="report_num" queryOperator="="/>
        <bm:query-field field="status" queryOperator="="/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="status" enforceOperations="query" expression="t1.status = &apos;NEW&apos; and exists (select 1 from sys_user su where (su.bp_category = &apos;EMPLOYEE&apos; or ( t1.bp_id=su.bp_id AND su.bp_category in  (&apos;AGENT_DF&apos;))) and su.user_id = ${/session/@user_id})"/>
    </bm:data-filters>
</bm:model>
