<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Harry
	$Date: 2018/11/16 14:26
	$Revision: 1.0
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" accessControlMode="false" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                select  to_char(h.journal_header_id) JOURNAL_HEADER_ID,
						(select hp.INTERFACE_URL
						from hls_interface_parameter hp
						where hp.interface_code = ${@interface_code}) INTERFACE_URL,
						(select hp.INTERFACE_USERNAME
						from hls_interface_parameter hp
						where hp.interface_code = ${@interface_code}) INTERFACE_USERNAME,
						(select hp.INTERFACE_PASSWORD
						from hls_interface_parameter hp
						where hp.interface_code = ${@interface_code}) INTERFACE_PASSWORD,
						(select hp.ATTRIBUTE_1
						from hls_interface_parameter hp
						where hp.interface_code = ${@interface_code}) ATTRIBUTE_1
					from hls_journal_header h
					where
					  h.sap_belnr is null
				    AND h.post_gl_status = 'N'
				    and nvl(h.re_type,'N') != 'E'
				    and h.journal_date >= to_date('2019-01-01', 'yyyy-mm-dd')
				    and (h.reversed_flag ='N' or (
				         h.reversed_flag ='R' and exists(
                         SELECT 1
                           FROM hls_journal_header t
                         WHERE t.journal_header_id = h.reversed_journal_header_id
                           AND t.sap_belnr IS NOT NULL
                           and t.journal_date < to_date('2019-01-01', 'yyyy-mm-dd'))))
					and rownum <=20 for update nowait
                ]]>
            </bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>