<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                   SELECT COUNT(*) job_run_flag
                    from sch_concurrent_job t
                    WHERE t.task_code='CALC_IFRS9_COL_JOB'
                    AND t.job_status='RUNNING'
                    AND instr(t.what,${/parameter/@period_name})>0
                ]]>
            </bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:parameters>
                <bm:parameter name="job_id" input="false" output="true" outputPath="@job_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
            	begin
            	contract_item_query_pkg.calc_ifrs9_col_job(
        			 p_period_name =>${@period_name},
        			 p_job_id      =>${@job_id},
        			 p_user_id     =>${/session/@user_id}
        			 );
            	end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
        <bm:update-sql><![CDATA[
         begin
                csh_write_off_pkg.update_ifrs9_col_flag(
            	                  p_period_name =>${@period_name},
                                  p_user_id    =>${/session/@user_id});
          end;
            ]]></bm:update-sql>
    </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="period_name" queryExpression="t1.period_day=${@period_name}"/>
<!--        <bm:query-field name="journal_date_to" queryExpression="to_char(t.journal_date,&apos;yyyy-mm-dd&apos;) &lt;= ${@journal_date_to}"/>-->
<!--        <bm:query-field name="bp_id_agent_level1" queryExpression="t.bp_id_agent_level1=${@bp_id_agent_level1}"/>-->
    </bm:query-fields>
</bm:model>
