<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT t1.COMPANY_ID,
       t1.PROJECT_ID,
       t1.PROJECT_NUMBER,
       t1.PROJECT_NAME,
       t1.CONTRACT_ID,
       t1.CONTRACT_NUMBER,
       t1.CONTRACT_NAME,
       t1.INCEPTION_OF_LEASE,
       t1.CONTRACT_STATUS,
       t1.CONTRACT_STATUS_DESC,
       t1.BILLING_METHOD,
       t1.BILLING_METHOD_DESC,
       t1.BILLING_OBJECT_ID,
       t1.BILLING_OBJECT_CODE,
       decode(t2.cf_item,
              301,
              (SELECT cc.bp_id_agent_level1_n
                 FROM con_contract_lv cc
                WHERE cc.contract_id = t1.contract_id),
              nvl(t2.billing_object_name,
                  (SELECT cc.bp_id_tenant_n
                     FROM con_contract_lv cc
                    WHERE cc.contract_id = t1.contract_id))) BILLING_OBJECT_NAME,
       decode(t2.cf_item,
              301,
              (select h.taxpayer_type
                 from hls_bp_master h, con_contract cc
                where cc.contract_id = t1.contract_id
                  and cc.bp_id_agent_level1 = h.bp_id),
              t1.object_taxpayer_type) OBJECT_TAXPAYER_TYPE,
       decode(t2.cf_item,
              301,
              (select v.code_value_name
                 from hls_bp_master h, con_contract cc, sys_code_values_v v
                where v.code = 'HLS211_TAXPAYER_TYPE'
                  AND v.code_value = h.taxpayer_type
                  and cc.contract_id = t1.contract_id
                  and cc.bp_id_agent_level1 = h.bp_id),
              t1.object_taxpayer_type_desc) OBJECT_TAXPAYER_TYPE_DESC,
       decode(t2.cf_item,
              301,
              (select h.tax_registry_num
                 from hls_bp_master h, con_contract cc
                where cc.contract_id = t1.contract_id
                  and cc.bp_id_agent_level1 = h.bp_id),
              t2.tax_registry_num) OBJECT_TAX_REGISTRY_NUM,
       nvl(t2.bill_object_bp_class,t1.BILL_OBJECT_BP_CLASS) BILL_OBJECT_BP_CLASS,
       nvl(t2.bill_object_bp_class_DESC,t1.BILL_OBJECT_BP_CLASS_DESC) BILL_OBJECT_BP_CLASS_DESC,
       t1.TAX_TYPE_VAT,
       t1.DESCRIPTION,
       --t1.INVOICE_TITLE,
       --t1.INVOICE_BP_ADDRESS_PHONE_NUM,
       --t1.INVOICE_BP_BANK_ACCOUNT,
       -- t1.TAX_REGISTRY_NUM,
       decode(t2.cf_item,
              301,
              (select h.invoice_title
                 from hls_bp_master h, con_contract cc
                where cc.contract_id = t1.contract_id
                  and cc.bp_id_agent_level1 = h.bp_id),
              t2.invoice_title) invoice_title,
       decode(t2.cf_item,
              301,
              (select (h.invoice_bp_address || '' || h.invoice_bp_phone_num)
                 from hls_bp_master h, con_contract cc
                where cc.contract_id = t1.contract_id
                  and cc.bp_id_agent_level1 = h.bp_id),
              t2.invoice_bp_address_phone_num) invoice_bp_address_phone_num,
       decode(t2.cf_item,
              301,
              (select (h.invoice_bp_bank || '' || h.invoice_bp_bank_account_id)
                 from hls_bp_master h, con_contract cc
                where cc.contract_id = t1.contract_id
                  and cc.bp_id_agent_level1 = h.bp_id),
              t2.invoice_bp_bank_account) invoice_bp_bank_account,
       t2.TAX_REGISTRY_NUM,
       t1.PRJ_SEARCH_TERM_1,
       t1.PRJ_SEARCH_TERM_2,
       t1.CON_SEARCH_TERM_1,
       t1.CON_SEARCH_TERM_2,
       t1.DOCUMENT_TYPE,
       t1.BP_NAME,
       t2.CASHFLOW_ID,
       t2.CF_ITEM,
       t2.CF_ITEM_DESC,
       t2.TIMES,
       t2.LAST_RECEIVED_DATE,
       t2.DUE_DATE,
       t2.DUE_AMOUNT,
       t2.PRINCIPAL,
       t2.INTEREST,
       t2.RECEIVED_AMOUNT,
       t2.RECEIVED_PRINCIPAL,
       t2.RECEIVED_INTEREST,
       t2.NOTRECEIVED_AMOUNT,
       t2.NOTRECEIVED_PRINCIPAL,
       t2.NOTRECEIVED_INTEREST,
       t2.BILLING_AMOUNT,
       t2.BILLING_PRINCIPAL,
       t2.BILLING_INTEREST,
       t2.NOTBILLING_AMOUNT,
       t2.NOTBILLING_PRINCIPAL,
       t2.NOTBILLING_INTEREST,
       nvl(t2.VAT_DUE_AMOUNT, 0) VAT_DUE_AMOUNT,
       nvl(t2.VAT_PRINCIPAL, 0) VAT_PRINCIPAL,
       nvl(t2.VAT_INTEREST, 0) VAT_INTEREST,
       nvl(t2.NET_DUE_AMOUNT, 0) NET_DUE_AMOUNT,
       nvl(t2.NET_PRINCIPAL, 0) NET_PRINCIPAL,
       nvl(t2.NET_INTEREST, 0) NET_INTEREST,
       t2.CURRENCY,
       t2.CURRENCY_DESC,
       t2.EXCHANGE_RATE,
       t2.EXCHANGE_RATE_TYPE,
       t2.EXCHANGE_RATE_TYPE_DESC,
       t2.EXCHANGE_RATE_QUOTATION,
       t2.EXCHANGE_RATE_QUOTATION_DESC,
       t1.lease_channel_desc,
       t1.business_type,
       t1.business_type_desc,
       t1.division,
       t1.division_desc,
       t1.billing_frequency,
       t1.billing_frequency_n,
       t1.billing_way,
       t1.billing_way_n,
       decode(t2.cf_item,
              '2',
              (t2.due_amount - nvl(t2.billing_amount, 0)),
              '3',
              (t2.due_amount - nvl(t2.billing_amount, 0)),
              (t2.received_amount - nvl(t2.billing_amount, 0))) need_bill_amount,
       t1.inv_billing_object_name,
       t1.small_scale_taxpayer
  FROM ACR_INVOICE_CONTRACT_V t1, ACR_INVOICE_CONTRACT_CF_V t2
    #WHERE_CLAUSE#

                ORDER BY
                    t1.contract_id,
                    t2.times,
                    t2.due_date,
                    t2.cf_item

            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="billing_frequency"/>
        <bm:field name="billing_frequency_n"/>
        <bm:field name="billing_way"/>
        <bm:field name="billing_way_n"/>
        <bm:field name="inv_billing_object_name"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="PROJECT_NUMBER" prompt="HLS.PROJECT_NUMBER"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"
                  prompt="HLS.PROJECT_NAME"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_NUMBER" prompt="HLS.CONTRACT_NUMBER"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME"
                  prompt="HLS.CONTRACT_NAME"/>
        <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date"
                  physicalName="INCEPTION_OF_LEASE" prompt="ACR.INCEPTION_OF_LEASE"/>
        <bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_STATUS" prompt="HLS.CONTRACT_STATUS"/>
        <bm:field name="contract_status_desc" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_STATUS_DESC" prompt="HLS.CONTRACT_STATUS"/>
        <bm:field name="billing_method" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BILLING_METHOD"/>
        <bm:field name="billing_method_desc" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BILLING_METHOD_DESC" prompt="HLS.BILLING_RULE"/>
        <bm:field name="billing_object_id" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="BILLING_OBJECT_ID"/>
        <bm:field name="billing_object_code" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BILLING_OBJECT_CODE"/>
        <bm:field name="billing_object_name" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BILLING_OBJECT_NAME" prompt="ACR.BILLING_OBJECT_NAME"/>
        <bm:field name="object_taxpayer_type" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="OBJECT_TAXPAYER_TYPE"/>
        <bm:field name="object_taxpayer_type_desc" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="OBJECT_TAXPAYER_TYPE_DESC" prompt="ACR.OBJECT_TAXPAYER_TYPE"/>
        <bm:field name="object_tax_registry_num" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="OBJECT_TAX_REGISTRY_NUM" prompt="ACR.OBJECT_TAX_REGISTRY_NUM"/>
        <bm:field name="bill_object_bp_class" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BILL_OBJECT_BP_CLASS"/>
        <bm:field name="bill_object_bp_class_desc" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BILL_OBJECT_BP_CLASS_DESC"/>
        <bm:field name="tax_type_vat" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAX_TYPE_VAT"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION"
                  prompt="HLS.COMMENT"/>
        <bm:field name="invoice_title" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_TITLE"
                  prompt="ACR.INVOICE_TITLE"/>
        <bm:field name="invoice_bp_address_phone_num" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="INVOICE_BP_ADDRESS_PHONE_NUM" prompt="ACR.INVOICE_BP_ADDRESS_PHONE_NUM"/>
        <bm:field name="invoice_bp_bank_account" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="INVOICE_BP_BANK_ACCOUNT" prompt="ACR.INVOICE_BP_BANK_ACCOUNT"/>
        <bm:field name="tax_registry_num" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="TAX_REGISTRY_NUM"/>
        <bm:field name="prj_search_term_1" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="PRJ_SEARCH_TERM_1"/>
        <bm:field name="prj_search_term_2" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="PRJ_SEARCH_TERM_2"/>
        <bm:field name="con_search_term_1" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CON_SEARCH_TERM_1"/>
        <bm:field name="con_search_term_2" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="CON_SEARCH_TERM_2"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="DOCUMENT_TYPE"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID"/>
        <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM"
                  prompt="ACR510.ACR_INVOICE_CONTRACT_CF_V.CF_ITEM"/>
        <bm:field name="cf_item_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_ITEM_DESC"
                  prompt="HLS.RECEIVE_PROJECT"/>
        <bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TIMES"
                  prompt="HLS.PERIOD_NUMBER"/>
        <bm:field name="last_received_date" databaseType="DATE" datatype="java.util.Date"
                  physicalName="LAST_RECEIVED_DATE" prompt="ACR.RECEIVED_DATE"/>
        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" physicalName="DUE_DATE"
                  prompt="ACR.DUE_DATE"/>
        <bm:field name="due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DUE_AMOUNT"
                  prompt="ACR.DUE_AMOUNT"/>
        <bm:field name="principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PRINCIPAL"
                  prompt="HLS.PRINCIPAL_AMOUNT"/>
        <bm:field name="interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST"
                  prompt="HLS.PAYMENT_INTEREST_AMT"/>
        <bm:field name="received_amount" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="RECEIVED_AMOUNT" prompt="ACR.RECEIVED_AMOUNT"/>
        <bm:field name="received_principal" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="RECEIVED_PRINCIPAL" prompt="ACR.RECEIVED_PRINCIPAL"/>
        <bm:field name="received_interest" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="RECEIVED_INTEREST" prompt="ACR.RECEIVED_INTEREST"/>
        <bm:field name="notreceived_amount" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="NOTRECEIVED_AMOUNT"/>
        <bm:field name="notreceived_principal" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="NOTRECEIVED_PRINCIPAL"/>
        <bm:field name="notreceived_interest" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="NOTRECEIVED_INTEREST"/>
        <bm:field name="billing_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BILLING_AMOUNT"
                  prompt="ACR.BILLING_AMOUNT"/>
        <bm:field name="billing_principal" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="BILLING_PRINCIPAL" prompt="ACR.BILLING_PRINCIPAL"/>
        <bm:field name="billing_interest" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="BILLING_INTEREST" prompt="ACR.BILLING_INTEREST"/>
        <bm:field name="notbilling_amount" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="NOTBILLING_AMOUNT"/>
        <bm:field name="notbilling_principal" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="NOTBILLING_PRINCIPAL"/>
        <bm:field name="notbilling_interest" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="NOTBILLING_INTEREST"/>
        <bm:field name="vat_due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_DUE_AMOUNT"
                  prompt="ACR.TAX_AMOUNT"/>
        <bm:field name="vat_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_PRINCIPAL"
                  prompt="ACR.VAT_PRINCIPAL"/>
        <bm:field name="vat_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_INTEREST"
                  prompt=""/>
        <bm:field name="net_due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_DUE_AMOUNT"
                  prompt=""/>
        <bm:field name="net_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_PRINCIPAL"
                  prompt=""/>
        <bm:field name="net_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_INTEREST"
                  prompt=""/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY"
                  prompt="HLS.CURRENCY"/>
        <bm:field name="currency_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_DESC"
                  prompt="HLS.CURRENCY"/>
        <bm:field name="exchange_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="EXCHANGE_RATE"
                  prompt="HLS.EXCHANGE_RATE"/>
        <bm:field name="exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="EXCHANGE_RATE_TYPE" prompt="HLS.EXCHANGE_RATE_TYPE"/>
        <bm:field name="exchange_rate_type_desc" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="EXCHANGE_RATE_TYPE_DESC" prompt="HLS.EXCHANGE_RATE_TYPE_DESC"/>
        <bm:field name="exchange_rate_quotation" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="EXCHANGE_RATE_QUOTATION"/>
        <bm:field name="exchange_rate_quotation_desc" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="EXCHANGE_RATE_QUOTATION_DESC" prompt="汇率报价方式"/>
        <bm:field name="lease_channel_desc"/>
        <bm:field name="need_bill_amount"/>
        <bm:field name="division"/>
        <bm:field name="division_desc"/>
        <bm:field name="business_type_desc"/>
        <bm:field name="small_scale_taxpayer"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="inv_billing_object_name" queryExpression="t1.inv_billing_object_name like ${@inv_billing_object_name}"/>
        <!--   <bm:query-field name="part_bill_flag"
                           queryExpression="((${@part_bill_flag} = &apos;N&apos;) or (${@part_bill_flag} = &apos;Y&apos; and (t2.billing_amount!=0 or t2.due_amount &lt; t2.received_amount)))"/>-->
        <bm:query-field name="project_number_from" queryExpression="t1.project_number &gt;=${@project_number_from}"/>
        <bm:query-field name="project_number_to" queryExpression="t1.project_number &lt;=${@project_number_to}"/>
        <bm:query-field name="contract_number_from" queryExpression="t1.contract_number &gt;=${@contract_number_from}"/>
        <bm:query-field name="contract_number_to" queryExpression="t1.contract_number &lt;=${@contract_number_to}"/>
        <bm:query-field name="contract_number"
                        queryExpression="t1.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos; "/>

        <bm:query-field name="bp_code_tenant_from"
                        queryExpression="t1.billing_object_code &gt;=${@bp_code_tenant_from}"/>
        <bm:query-field name="bp_code_tenant_to" queryExpression="t1.billing_object_code &lt;=${@bp_code_tenant_to}"/>
        <bm:query-field name="lease_start_date_from"
                        queryExpression="t1.lease_start_date &gt;= to_date(${@lease_start_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="lease_start_date_to"
                        queryExpression="t1.lease_start_date &lt;= to_date(${@lease_start_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="document_type" queryExpression="t1.document_type=${@document_type}"/>
        <bm:query-field name="billing_method" queryExpression="t1.billing_method=${@billing_method}"/>
        <bm:query-field name="billing_frequency" queryExpression="t1.billing_frequency=${@billing_frequency}"/>
        <bm:query-field name="prj_search_term_1" queryExpression="t1.prj_search_term_1=${@prj_search_term_1}"/>
        <bm:query-field name="prj_search_term_2" queryExpression="t1.prj_search_term_2=${@prj_search_term_2}"/>
        <bm:query-field name="con_search_term_1" queryExpression="t1.con_search_term_1=${@con_search_term_1}"/>
        <bm:query-field name="con_search_term_2" queryExpression="t1.con_search_term_2=${@con_search_term_2}"/>
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos; "/>
        <bm:query-field name="project_name"
                        queryExpression="t1.project_name like &apos;%&apos;||${@project_name}||&apos;%&apos; "/>
        <bm:query-field name="contract_name"
                        queryExpression="t1.contract_name like &apos;%&apos;||${@contract_name}||&apos;%&apos; "/>
        <bm:query-field name="document_type" queryExpression="t1.document_type=${@document_type}"/>
        <bm:query-field name="cf_item" queryExpression="t2.cf_item = ${@cf_item}"/>
        <bm:query-field name="last_received_date_from"
                        queryExpression="t2.last_received_date &gt;= to_date(${@last_received_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="last_received_date_to"
                        queryExpression="t2.last_received_date &lt; to_date(${@last_received_date_to},&apos;yyyy-mm-dd&apos;)+1"/>
        <!--
                <bm:query-field name="final_bill_flag" queryExpression="((${@final_bill_flag}=&apos;N&apos; and (t1.billing_method != &apos;LB_EQUIP_INT&apos; or (t1.billing_method = &apos;LB_EQUIP_INT&apos; and (t2.cf_item=1 and t2.interest &gt;nvl(billing_interest,0)or (t2.cf_item!=1))))) or (${@final_bill_flag}=&apos;Y&apos; and t1.billing_method = &apos;LB_EQUIP_INT&apos; and t2.cf_item=1 and  (not exists (select 1 from con_contract_cashflow b where t1.contract_id = b.contract_id and b.cf_item = 1 and b.cf_direction = &apos;INFLOW&apos; and b.write_off_flag in (&apos;NOT&apos;,&apos;PARTIAL&apos;)) or t1.legal_status=&apos;SELL&apos;)))"/>
        -->
        <!-- <bm:query-field name="residue_flag"
                         queryExpression="((${@residue_flag}=&apos;N&apos; and t2.cf_item != 8) or (${@residue_flag}=&apos;Y&apos; and t2.cf_item = 8 and not exists (select 1 from con_contract_cashflow ca where ca.cf_item in (&apos;1&apos;,&apos;9&apos;) and (ca.due_amount -nvl(ca.received_amount,0)) &gt;50 and ca.contract_id=t1.contract_id and ca.write_off_flag!=&apos;FULL&apos;)))"/>-->
        <bm:query-field name="lease_channel" queryExpression="t1.lease_channel=${@lease_channel}"/>
        <bm:query-field name="business_type" queryExpression="t1.business_type=${@business_type}"/>
        <bm:query-field name="division" queryExpression="t1.division=${@division}"/>
        <!-- <bm:query-field name="serial_number" queryExpression="t1.serial_number=${@serial_number}"/>-->
        <bm:query-field name="termination_date_from"
                        queryExpression="t1.termination_date &gt;= to_date(${@termination_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="termination_date_to"
                        queryExpression="t1.termination_date &lt;= to_date(${@termination_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="due_date_from"
                        queryExpression="t2.due_date &gt;= to_date(${@due_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="due_date_to"
                        queryExpression="t2.due_date &lt;= to_date(${@due_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="bill_flag"
                        queryExpression="(${@bill_flag} = 'Y'  and t1.billing_frequency in (${@times_bill_flag},${@mid_bill_flag},${@final_bill_flag},${@et_bill_flag}) )"/>


        <bm:query-field name="all_contract_number"
                        queryExpression="(t1.contract_number in (Select regexp_substr( replace(replace(replace(${@all_contract_number},chr(32)),chr(10)),chr(13)), '[^,]+', 1, Level) From dual Connect By regexp_substr(replace(replace(replace(${@all_contract_number},chr(32)),chr(10)),chr(13)), '[^,]+', 1, Level) Is Not Null) )"/>
        <bm:query-field name="notreceived_amount_from"
                        queryExpression="t2.notreceived_amount &gt;=${@notreceived_amount_from}"/>
        <bm:query-field name="notreceived_amount_to"
                        queryExpression="t2.notreceived_amount &lt;=${@notreceived_amount_to}"/>
        <bm:query-field name="notbilling_amount_from"
                        queryExpression="t2.notbilling_amount &gt;=${@notbilling_amount_from}"/>
        <bm:query-field name="notbilling_amount_to"
                        queryExpression="t2.notbilling_amount &lt;=${@notbilling_amount_to}"/>
        <bm:query-field name="billing_way"
                        queryExpression="t1.billing_way = ${@billing_way}"/>

        <bm:query-field name="bill_object_bp_class"
                        queryExpression="t1.bill_object_bp_class = ${@bill_object_bp_class}"/>
        <bm:query-field name="contract_status"
                        queryExpression="t1.contract_status = ${@contract_status}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query"
                        expression="t2.contract_id = t1.contract_id AND t1.billing_status IN (&apos;NOT&apos;, &apos;PARTIAL&apos;)    AND t1.contract_status not in (&apos;CLOSED&apos;,&apos;CANCEL&apos;)  AND t2.cf_status = &apos;RELEASE&apos; "/>
        <bm:data-filter enforceOperations="query" expression="t2.write_off_flag != &apos;NOT&apos;"/>
        <bm:data-filter enforceOperations="query"
                        expression="t2.billing_status != &apos;FULL&apos; and t2.cf_direction=&apos;INFLOW&apos;"/>
        <!-- <bm:data-filter enforceOperations="query"
                         expression="t2.contract_id = t1.contract_id    AND t1.billing_status IN (&apos;NOT&apos;, &apos;PARTIAL&apos;)    AND t1.contract_status not in (&apos;NEW&apos;,&apos;CANCEL&apos;)    AND t2.cf_status = &apos;RELEASE&apos;"/>

         <bm:data-filter enforceOperations="query" expression="(t2.times != 0)"/>-->

        <!--        <bm:data-filter enforceOperations="query"-->
        <!--                        expression="not (t2.cf_item = 301 and nvl(direct_sales_agent_flag,'N') = 'Y')"/>-->
        <bm:data-filter name="query" expression="rownum &lt;=1000"/>
        <bm:data-filter name="query" expression="exists(select 1 from con_contract_cashflow ccc where (ccc.due_date &lt;= sysdate and ccc.cashflow_id = t2.cashflow_id and t1.inv_object_taxpayer_type != 'GENERAL_TAXPAYER') or (t1.bill_object_bp_class = 'ORG' and ccc.cashflow_id = t2.cashflow_id and t1.inv_object_taxpayer_type = 'GENERAL_TAXPAYER'))" />
    </bm:data-filters>
</bm:model>
