<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="update">
            <bm:parameters>
                <bm:parameter name="prj_close_id" output="true"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
                BEGIN
                    ${@prj_close_id}:=hn_prj_project_pkg.hn_get_prj_close_id(p_project_id =>${@project_id},
                    p_user_id      =>${/session/@user_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                BEGIN
                    hn_prj_project_pkg.hn_project_close_submit(p_project_id =>${@project_id},
                                    p_prj_close_id =>${@prj_close_id},
                                    p_close_reason =>${@close_reason},
                                    p_company_id   =>${/session/@company_id},
                                    p_user_id      =>${/session/@user_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    pp.project_id,
                    pp.project_number,
                    pp.project_name,
                    hbm.bp_name,
                    pp.hn_industry_classification,
                    hpcw.close_reason,
                    (SELECT e.name FROM exp_employees e WHERE e.employee_id = pp.employee_id
                    ) AS employee_id_n,
                    (SELECT
                        e.name
                    FROM
                        exp_employees e
                    WHERE
                        e.employee_id = pp.employee_id_of_manager
                    ) AS employee_id_of_manager_n
                FROM
                    prj_project pp,
                    hn_project_close_wfl hpcw,
                    hls_bp_master hbm
                WHERE
                    pp.project_id     = hpcw.project_id AND
                    pp.bp_id_tenant   = hbm.bp_id AND
                    hpcw.prj_close_id = ${@prj_close_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>