<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_TAX_ACT_CONFIRM" needAccessControl="false">
<bm:fields>
        <bm:field name="instance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSTANCE_ID"/>
        <bm:field name="workflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WORKFLOW_ID"/>
        <bm:field name="workflow_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORKFLOW_CODE"/>
        <bm:field name="workflow_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORKFLOW_DESC"/>
        <bm:field name="current_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CURRENT_SEQ"/>
        <bm:field name="current_node_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENT_NODE_DESC"/>
        <bm:field name="last_approve_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LAST_APPROVE_DATE"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="company_info" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="instance_status" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="instance_status_desc" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="approve_user_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVE_USER_CODE"/>
        <bm:field name="approve_user_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVE_USER_NAME"/>
        <bm:field name="created_by"/>
        <bm:field name="submitted_by"/>
        <bm:field name="document_info"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[select t1.instance_id,
				       t1.workflow_id,
				       t1.workflow_code,
				       t1.workflow_desc,
				       t1.current_seq,
				       t1.created_by,
				       t1.submitted_by,
				       t1.instance_status,
				       t1.instance_status_desc,
				       t1.current_node_desc,
				       t1.last_approve_date,
				       t1.company_id,
				       t1.company_info,
				       --t1.approve_user_code,
				       --t1.approve_user_name,
				        (select t.approve_user_code from zj_wfl_workflow_instance_v t where t.instance_id=t1.instance_id and rownum=1 AND exists (select 1 from sys_user sy where sy.user_id=${/session/@user_id} and sy.bp_category<>'AGENT'))approve_user_code,
              (select t.approve_user_name from zj_wfl_workflow_instance_v t where t.instance_id=t1.instance_id and rownum=1 AND exists (select 1 from sys_user sy where sy.user_id=${/session/@user_id} and sy.bp_category<>'AGENT'))approve_user_name,
				       t1.document_info
				  from zj_wfl_workflow_instance_v t1
					where t1.workflow_code = 'HLS_MONTHLY_SETTLEMENT_WFL'
					and t1.instance_id in (select c.wfl_instance_id from con_monthly_statement c where c.monthly_date =${@date})
				  order by t1.instance_id desc

			]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
