<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Chris  
    $Date: 2017-8-11 下午2:19:39  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    begin
  -- Call the procedure
  prj_meeting_confirm_pkg.submit_prj_meeting_confirm(p_request_id => ${@request_id},
                                                     p_user_id => ${/session/@user_id});
end;
    
    ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.request_id,
                    t1.project_id,
                    t1.approval_id,
                    t1.prj_instance_id,
                    t1.wfl_instance_id,
                    t1.wfl_status,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code        = 'HN_MEETING_CONFIRM_STATUS' AND
                        t1.wfl_status = v.code_value
                    ) wfl_status_n,
                    t1.request_date,
                    t1.approval_date,
                    t1.creation_date,
                    t2.project_number,
                    t2.project_name,
                    t2.bp_name,
                    t2.division,
                    t2.division_n,
                    t2.document_type,
                    t2.document_type_n,
                    t2.project_type,
                    t2.project_type_n,
                    t2.hn_industry_classification,
                    t2.hn_industry_classification_n,
                    t2.employee_id,
                    t2.employee_id_n,
                    t2.employee_id_of_manager,
                    t2.employee_id_of_manager_n,
                    t2.lease_organization,
                    t2.lease_organization_n,
                    t2.prj_wfl_status,
                    t2.prj_wfl_status_n,
                    t2.creation_date_n,
                    bgfl_special_parameter_pkg.get_attachment_file_names(p_document_table => 'PRJ_PROJECT_MEETING_CONFIRM',
                                                                  p_document_id => t1.request_id) file_name
                FROM
                    prj_project_meeting_confirm t1,
                    prj_project_lv t2 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <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:query-fields>
        <bm:query-field name="prj_wfl_status" queryExpression="t2.prj_wfl_status = ${@prj_wfl_status}"/>
        <bm:query-field name="document_type" queryExpression="t2.document_type = ${@document_type}"/>
        <bm:query-field name="employee_id" queryExpression="t2.employee_id = ${@employee_id}"/>
        <bm:query-field name="lease_organization" queryExpression="t2.lease_organization = ${@lease_organization}"/>
        <bm:query-field name="project_name" queryExpression="t2.project_name like &apos;%&apos;||${@project_name}||&apos;%&apos;"/>
        <bm:query-field name="bp_name" queryExpression="t2.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
        <bm:query-field name="prj_creation_date_from" queryExpression="t2.creation_date &gt;= to_date(${@prj_creation_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="prj_creation_date_to" queryExpression="t2.creation_date &lt;= to_date(${@prj_creation_date_to},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter expression="t1.project_id = t2.PROJECT_ID"/>
    </bm:data-filters>
</bm:model>
