<?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 vv.*,(select v.code_value_name value_name from sys_code_values_v v where v.code ='YES_NO' and v.code_value = vv.rl_flag) rl_flag_n
     FROM (select t2.journal_line_id,
                  t2.journal_header_id,
                  cc.company_id,
                  cc.project_id,
                  cc.contract_id,
                  cc.contract_number,
                  cc.contract_name,
                  cc.inception_of_lease,
                  cc.contract_status,
                  (SELECT sc.code_value_name
                   FROM sys_code_values_v sc
                   WHERE sc.code = 'CON500_CONTRACT_STATUS'
                     AND sc.code_value = cc.contract_status) contract_status_desc,
                  t2.account_name,
                  cc.billing_method,
                  (SELECT b.description
                   FROM hls_billing_method b
                   WHERE b.billing_method = cc.billing_method) billing_method_desc,
                  t2.bill_object_bp_id billing_object_id,
                  hbm.bp_code billing_object_code,
                  hbm.bp_name billing_object_name,
                  hbm.taxpayer_type object_taxpayer_type,
                  (SELECT v.code_value_name
                   FROM sys_code_values_v v
                   WHERE v.code = 'HLS211_TAXPAYER_TYPE'
                     AND v.code_value = hbm.taxpayer_type) object_taxpayer_type_desc,
                  hbm.tax_registry_num object_tax_registry_num,
                  hbm.bp_class bill_object_bp_class,
                  (SELECT v.code_value_name
                   FROM sys_code_values_v v
                   WHERE v.code = 'HLS211_BP_CLASS'
                     AND v.code_value = hbm.bp_class) bill_object_bp_class_desc,
                  hbm.REF_V07 description,
                  nvl(hbm.invoice_title, hbm.bp_name) invoice_title,
                  (hbm.invoice_bp_address || '' || hbm.invoice_bp_phone_num) invoice_bp_address_phone_num,
                  (hbm.invoice_bp_bank || ' ' || hbm.invoice_bp_bank_account) invoice_bp_bank_account,
                  hbm.tax_registry_num tax_registry_num,
                  cc.document_type,
                  t2.cashflow_id,
                  t2.cf_item,
                  (Select i.description
                   From hls_cashflow_item i
                   Where i.cf_item = t2.cf_item) As cf_item_desc,
                  t2.times,
                  to_char(t2.last_received_date, 'yyyy-mm-dd') last_received_date,
                  to_char(t2.due_date, 'yyyy-mm-dd') due_date,
                  t2.due_amount,
                  t2.principal principal,
                  t2.interest interest,
                  t2.received_amount,
                  t2.received_principal,
                  t2.received_interest,
                  t2.billing_amount,
                  t2.billing_principal,
                  t2.billing_interest,
                  t2.vat_due_amount,
                  t2.vat_principal,
                  t2.vat_interest,
                  t2.net_due_amount,
                  t2.net_principal,
                  t2.net_interest,
                  t2.exchange_rate,
                  t2.exchange_rate_type,
                  t2.exchange_rate_quotation,
                  t2.overdue_status,
                  t2.overdue_max_days,
                  cc.bp_id_agent_level1,
                  (Select m.bp_name
                   From hls_bp_master m
                   Where m.bp_id = cc.bp_id_agent_level1) bp_id_agent_level1_n,
                  cc.termination_date,
                  cc.lease_channel,
                  t2.cf_direction,
                  nvl(t2.billing_status,'NOT') billing_status,
                 (select v.code_value_name value_name from sys_code_values_v v where v.code ='CON_BILLING_STATUS' and v.code_value = nvl(t2.billing_status,'NOT')) billing_status_n,
                 case when acr_invoice_pkg.check_rl_cf_flag(cc.contract_id,t2.cf_item,t2.times)= 'Y' and
                     acr_invoice_pkg.check_rl_flag(cc.contract_id) = 'Y'
                     then
                     'Y'
                       when acr_invoice_pkg.check_rl_cf_flag(cc.contract_id,t2.cf_item,t2.times)= 'Y' and
                     acr_invoice_pkg.check_rl_flag(cc.contract_id) = 'N'
                     then
                     'N' 
                     else
                     ''
                    end rl_flag,
                  t2.cf_status,
                  cc.business_type,
                  (SELECT bt.description
                   FROM hls_business_type bt
                   WHERE bt.business_type = cc.business_type) business_type_desc,
                  t2.write_off_flag,
                  case nvl(t2.write_off_flag, 'NOT')
                      when 'NOT' then
                          '未核销'
                      when 'PARTIAL' then
                          '部分核销'
                      when 'FULL' then
                          '全部核销'
                      end as write_off_flag_desc,
                  t2.ccr_document_type,
                  (select t.description
                   FROM hls_document_type t
                   where t.document_type = t2.ccr_document_type) ccr_document_type_desc,
                  t2.je_transaction_code,
				                  --add by lihh 20210409
                hbm.invoice_type,
                (select v.code_value_name value_name from sys_code_values_v v where v.code_value = hbm.invoice_type) invoice_type_n,
                hbm.invoice_method,
                (SELECT v.code_value_name value_name
                FROM sys_code_values_v v
                WHERE v.code = 'INVOICE_METHOD'
                AND v.code_value = hbm.invoice_method
                AND v.code_enabled_flag = 'Y') invoice_method_n,
                cc.division,
                (SELECT v.code_value_name value_name
                FROM sys_code_values_v v
                WHERE v.code = 'DIVISION'
                AND v.code_value = cc.division
                AND v.code_enabled_flag = 'Y') division_n,
			   hbm.full_elec_invoice_flag,
			  (select v.code_value_name value_name from sys_code_values_v v where v.code = 'YES_NO' and v.code_value = hbm.full_elec_invoice_flag) full_elec_invoice_flag_n
         
           from con_contract cc, hls_bp_master hbm, CUS_ACR_INVOICE_V t2
           where cc.contract_id = t2.contract_id
             and hbm.bp_wfl_status = 'APPROVED'
             and hbm.invoice_wfl_status = 'APPROVED'
             and hbm.bp_id = t2.bill_object_bp_id
             and nvl(t2.billing_status, 'NOT') != 'FULL'
      --合同状态为结束中（不论是否做过提前结清或解约回购）、提前结清中、提前结清完成、正常结清的合同
   and 
		((t2.cf_item = 2 and cc.payment_deduction in ('TRI_AGREEMENT','TRADE_IN')
        and ((cc.contract_status in ('TERMINATING', 'ETING','ET','INCEPT', 'TERMINATE','REPURING','REPUR') and hbm.invoice_method = 'BILLING')
        or (cc.contract_status in ('TERMINATING', 'ETING', 'ETING', 'TERMINATE') and hbm.invoice_method = 'NO_BILLING'))
        )
		
        or
		(cc.contract_status in
       ('TERMINATING', 'ET', 'ETING', 'TERMINATE')
       --合同状态为起租做过承租人变更的合同
       or
       (cc.contract_status = 'INCEPT' and t2.document_type = 'LEASE_CHAG' and
       trunc(t2.due_date) < trunc(cc.CCR_LEASE_DATE))
       --合同状态为解约回购中、解约回购完成的合同
       or (cc.contract_status in ('REPUR', 'REPURING') and(
       trunc(t2.due_date) < trunc(cc.REPURCHASE_DATE) or t2.je_transaction_code='CON_REPURCHASE') or (t2.document_type = 'REPUR_CHAG'and t2.write_off_flag = 'FULL' ) ) --update by xsh35973 添加解约回购提前结清完全核销数据
       --合同状态为起租→开票对象：非深圳美鹏HCS小规模纳税人（自然人）→暂不开票→按季度展示未开票现金流
       or
       (cc.contract_status = 'INCEPT' and
       trunc(t2.due_date) >= trunc(nvl(cc.CCR_LEASE_DATE, t2.due_date)) and
       t2.inv_billing_object_code <> 'D00010001' and hbm.bp_class = 'NP' and
       hbm.taxpayer_type = 'SMALL_SCALE_TAXPAYER' and
       hbm.invoice_method = 'NO_BILLING' and
       ((to_number(to_char(sysdate, 'MM')) in (3, 6, 9, 12) and
       trunc(t2.due_date) <= sysdate

       and ((to_number(to_char(t2.due_date, 'MM')) in (3, 6, 9, 12)) or
       (to_number(to_char(t2.due_date, 'MM')) in (1, 4, 7, 10) and
       nextduedate(t2.due_date, 2, 1) <= sysdate) or
       (to_number(to_char(t2.due_date, 'MM')) in (2, 5, 8, 11) and
       nextduedate(t2.due_date, 1, 1) <= sysdate))

       ) or (to_number(to_char(sysdate, 'MM')) in (1, 2) and
       trunc(t2.due_date) <= (trunc(sysdate, 'yyyy') - 1)) or
       (to_number(to_char(sysdate, 'MM')) in (4, 5) and
       t2.due_date <=
       last_day(to_date(to_char(sysdate, 'yyyy') || '-03', 'yyyy-mm'))) or
       (to_number(to_char(sysdate, 'MM')) in (7, 8) and
       t2.due_date <=
       last_day(to_date(to_char(sysdate, 'yyyy') || '-06', 'yyyy-mm'))) or
       (to_number(to_char(sysdate, 'MM')) in (10, 11) and
       t2.due_date <=
       last_day(to_date(to_char(sysdate, 'yyyy') || '-09', 'yyyy-mm')))))
       --合同状态为起租、解约回购中、解约回购完成→开票对象：一般纳税人（法人）→按期开票→核销完展现现金流
       or
       (((cc.contract_status = 'INCEPT' and
       trunc(t2.due_date) >= trunc(nvl(cc.CCR_LEASE_DATE, t2.due_date))) or
       (cc.contract_status in ('REPUR', 'REPURING') and
       trunc(t2.due_date) >=
       trunc(nvl(cc.REPURCHASE_DATE, t2.due_date)))) and
       hbm.taxpayer_type = 'GENERAL_TAXPAYER' and hbm.bp_class = 'ORG' and
       hbm.invoice_method = 'BILLING' and
       nvl(t2.write_off_flag, 'NOT') = 'FULL')
       --合同状态为起租→开票对象：小规模纳税人（法人/自然人）→按期开票→到应收日即展示，不论是否核销
       or
       (cc.contract_status = 'INCEPT' and
       trunc(t2.due_date) >= trunc(nvl(cc.CCR_LEASE_DATE, t2.due_date)) and
       hbm.taxpayer_type = 'SMALL_SCALE_TAXPAYER' and
       hbm.invoice_method = 'BILLING' 
	    and
       nvl(t2.write_off_flag, 'NOT') = 'FULL'
	  /* and
       trunc(t2.due_date) <= trunc(sysdate)*/
	   )))
      --合同状态为起租→开票对象:一般纳税人(法人),小规模纳税人(法人)和深圳美鹏HCS小规模纳税人(自然人)→暂不开票→暂不展示
   and not exists
 (select 1
          from dual
         where hbm.invoice_method = 'NO_BILLING'
           and cc.contract_status = 'INCEPT'
           and (hbm.bp_class = 'ORG' or
               (hbm.taxpayer_type = 'SMALL_SCALE_TAXPAYER' and
               hbm.bp_class = 'NP' and
               t2.inv_billing_object_code = 'D00010001')))
           ORDER BY cc.contract_id, t2.due_date




          ) vv

         #WHERE_CLAUSE#

 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
<!--    <bm:fields>-->
<!--&lt;!&ndash;        <bm:field name="spv_company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SPV_COMPANY_ID"/>&ndash;&gt;-->
<!--        <bm:field name="journal_header_id" databaseType="NUMBER" datatype="java.lang.Long"/>-->
<!--        <bm:field name="journal_line_id" databaseType="NUMBER" datatype="java.lang.Long"/>-->
<!--        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" required="true"/>-->
<!--        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>-->
<!--        &lt;!&ndash;        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER"/>&ndash;&gt;-->
<!--        &lt;!&ndash;        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"/>&ndash;&gt;-->
<!--        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" required="true"/>-->
<!--        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER"/>-->
<!--        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME"/>-->
<!--        <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE"/>-->
<!--        <bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS" required="true"/>-->
<!--        <bm:field name="contract_status_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS_DESC"/>-->
<!--&lt;!&ndash;        <bm:field name="account_name" databaseType="VARCHAR2" datatype="java.lang.String"/>&ndash;&gt;-->
<!--        <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"/>-->
<!--&lt;!&ndash;        <bm:field name="inv_object_taxpayer_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="inv_object_taxpayer_type"/>&ndash;&gt;-->
<!--&lt;!&ndash;        <bm:field name="inv_object_taxpayer_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="inv_object_taxpayer_type_desc"/>&ndash;&gt;-->
<!--        <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"/>-->
<!--        <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"/>-->
<!--        <bm:field name="object_tax_registry_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="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"/>-->
<!--&lt;!&ndash;        <bm:field name="tax_type_vat" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAX_TYPE_VAT"/>&ndash;&gt;-->
<!--        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION"/>-->
<!--        <bm:field name="invoice_title" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_TITLE"/>-->
<!--        <bm:field name="invoice_bp_address_phone_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_BP_ADDRESS_PHONE_NUM"/>-->
<!--        <bm:field name="invoice_bp_bank_account" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_BP_BANK_ACCOUNT"/>-->
<!--        <bm:field name="tax_registry_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAX_REGISTRY_NUM"/>-->
<!--        &lt;!&ndash;        <bm:field name="prj_search_term_1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRJ_SEARCH_TERM_1"/>&ndash;&gt;-->
<!--        &lt;!&ndash;        <bm:field name="prj_search_term_2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRJ_SEARCH_TERM_2"/>&ndash;&gt;-->
<!--        &lt;!&ndash;        <bm:field name="con_search_term_1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CON_SEARCH_TERM_1"/>&ndash;&gt;-->
<!--        &lt;!&ndash;        <bm:field name="con_search_term_2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CON_SEARCH_TERM_2"/>&ndash;&gt;-->
<!--        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" required="true"/>-->
<!--&lt;!&ndash;        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>&ndash;&gt;-->
<!--&lt;!&ndash;        <bm:field name="invoice_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_TYPE_DESC"/>&ndash;&gt;-->
<!--        <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" required="true"/>-->
<!--        <bm:field name="cf_item_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_ITEM_DESC"/>-->
<!--        <bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TIMES"/>-->
<!--        <bm:field name="last_received_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_RECEIVED_DATE"/>-->
<!--        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" physicalName="DUE_DATE"/>-->
<!--        <bm:field name="due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DUE_AMOUNT"/>-->
<!--        <bm:field name="principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PRINCIPAL"/>-->
<!--        <bm:field name="interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST"/>-->
<!--        <bm:field name="received_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_AMOUNT"/>-->
<!--        <bm:field name="received_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_PRINCIPAL"/>-->
<!--        <bm:field name="received_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_INTEREST"/>-->
<!--        <bm:field name="billing_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BILLING_AMOUNT"/>-->
<!--        <bm:field name="billing_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BILLING_PRINCIPAL"/>-->
<!--        <bm:field name="billing_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BILLING_INTEREST"/>-->
<!--        <bm:field name="vat_due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_DUE_AMOUNT"/>-->
<!--        <bm:field name="vat_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_PRINCIPAL"/>-->
<!--        <bm:field name="vat_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_INTEREST"/>-->
<!--        <bm:field name="net_due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_DUE_AMOUNT"/>-->
<!--        <bm:field name="net_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_PRINCIPAL"/>-->
<!--        <bm:field name="net_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_INTEREST"/>-->
<!--        &lt;!&ndash;        <bm:field name="currency" databaseType="CHAR" datatype="java.lang.String" physicalName="CURRENCY"/>&ndash;&gt;-->
<!--        &lt;!&ndash;        <bm:field name="currency_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_DESC"/>&ndash;&gt;-->
<!--        <bm:field name="exchange_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXCHANGE_RATE"/>-->
<!--        <bm:field name="exchange_rate_type" databaseType="CHAR" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE"/>-->
<!--        &lt;!&ndash;        <bm:field name="exchange_rate_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE_DESC"/>&ndash;&gt;-->
<!--        <bm:field name="exchange_rate_quotation" databaseType="CHAR" datatype="java.lang.String" physicalName="EXCHANGE_RATE_QUOTATION"/>-->
<!--        &lt;!&ndash;        <bm:field name="exchange_rate_quotation_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_QUOTATION_DESC"/>&ndash;&gt;-->
<!--        <bm:field name="overdue_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="OVERDUE_STATUS"/>-->
<!--        <bm:field name="overdue_max_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OVERDUE_MAX_DAYS"/>-->
<!--        <bm:field name="bp_id_agent_level1"/>-->
<!--        <bm:field name="bp_id_agent_level1_n"/>-->
<!--        <bm:field name="termination_date"/>-->
<!--        <bm:field name="lease_channel"/>-->
<!--        <bm:field name="business_type_desc"/>-->
<!--        <bm:field name="business_type"/>-->
<!--        <bm:field name="write_off_flag"/>-->
<!--        <bm:field name="write_off_flag_desc"/>-->
<!--    </bm:fields>-->
    <bm:query-fields>
        <bm:query-field name="billing_object_code" queryExpression="vv.billing_object_code = ${@billing_object_code}"/>
<!--        <bm:query-field name="billing_object_name" queryExpression="vv.billing_object_name = ${@billing_object_name}"/>-->
        <bm:query-field name="cf_item" queryExpression="vv.cf_item = ${@cf_item}"/>
        <bm:query-field name="due_date_from" queryExpression="to_date(vv.due_date,&apos;yyyy-mm-dd&apos;) &gt;= to_date(${@due_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="due_date_to" queryExpression="to_date(vv.due_date,&apos;yyyy-mm-dd&apos;) &lt;= to_date(${@due_date_to},&apos;yyyy-mm-dd&apos;)"/>
<!--        <bm:query-field name="overdue_max_days_from" queryExpression="vv.overdue_max_days &gt;= ${@overdue_max_days_from}"/>-->
<!--        <bm:query-field name="overdue_max_days_to" queryExpression="vv.overdue_max_days &lt;= ${@overdue_max_days_to}"/>-->
<!--        <bm:query-field name="overdue_status" queryExpression="vv.overdue_status=${@overdue_status} and vv.write_off_flag != &apos;FULL&apos;"/>-->
        <bm:query-field name="bill_object_bp_class" queryExpression="vv.bill_object_bp_class = ${@bill_object_bp_class}"/>
<!--        <bm:query-field name="invoice_type_desc" queryExpression="vv.invoice_type_desc like ${@invoice_type_desc}"/>-->
<!--        <bm:query-field name="invoice_title" queryExpression="vv.invoice_title like ${@invoice_title}"/>-->
<!--        <bm:query-field name="project_number_from" queryExpression="vv.project_number &gt;=${@project_number_from}"/>-->
<!--        <bm:query-field name="project_number_to" queryExpression="vv.project_number &lt;=${@project_number_to}"/>-->
        <bm:query-field name="contract_number" queryExpression="vv.contract_number  like ${@contract_number}"/>
<!--        <bm:query-field name="bp_code_tenant_from" queryExpression="vv.billing_object_code &gt;=${@bp_code_tenant_from}"/>-->
<!--        <bm:query-field name="bp_code_tenant_to" queryExpression="vv.billing_object_code &lt;=${@bp_code_tenant_to}"/>-->
<!--        <bm:query-field name="lease_start_date_from" queryExpression="vv.inception_of_lease &gt;= to_date(${@lease_start_date_from},&apos;yyyy-mm-dd&apos;)"/>-->
        <bm:query-field name="last_received_date_from" queryExpression="to_date(vv.last_received_date,&apos;yyyy-mm-dd&apos;) &gt;= to_date(${@last_received_date_from},&apos;yyyy-mm-dd&apos;)"/>
<!--        <bm:query-field name="lease_start_date_to" queryExpression="vv.inception_of_lease &lt;= to_date(${@lease_start_date_to},&apos;yyyy-mm-dd&apos;)"/>-->
        <bm:query-field name="last_received_date_to" queryExpression="to_date(vv.last_received_date,&apos;yyyy-mm-dd&apos;) &lt;= to_date(${@last_received_date_to},&apos;yyyy-mm-dd&apos;)"/>
<!--        <bm:query-field name="document_type" queryExpression="vv.document_type=${@document_type}"/>-->
<!--        <bm:query-field name="billing_method" queryExpression="vv.billing_method=${@billing_method}"/>-->
<!--        <bm:query-field name="prj_search_term_1" queryExpression="vv.prj_search_term_1=${@prj_search_term_1}"/>-->
<!--        <bm:query-field name="prj_search_term_2" queryExpression="vv.prj_search_term_2=${@prj_search_term_2}"/>-->
<!--        <bm:query-field name="con_search_term_1" queryExpression="vv.con_search_term_1=${@con_search_term_1}"/>-->
<!--        <bm:query-field name="con_search_term_2" queryExpression="vv.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="vv.project_name like &apos;%&apos;||${@project_name}||&apos;%&apos; "/>-->
<!--        <bm:query-field name="contract_name" queryExpression="vv.contract_name like &apos;%&apos;||${@contract_name}||&apos;%&apos; "/>-->
<!--        <bm:query-field name="document_type" queryExpression="vv.document_type=${@document_type}"/>-->
        <bm:query-field name="business_type" queryExpression="vv.business_type=${@business_type}"/>
        <bm:query-field name="write_off_flag" queryExpression="vv.write_off_flag=${@write_off_flag}"/>
        <bm:query-field name="contract_status" queryExpression="vv.contract_status = ${@contract_status}"/>
        <bm:query-field name="bp_id_agent_level1" queryExpression="vv.bp_id_agent_level1 = ${@bp_id_agent_level1}"/>
<!--        <bm:query-field name="bp_id_agent_level1_n" queryExpression="vv.bp_id_agent_level1_n like &apos;%&apos;||${@bp_id_agent_level1_n}||&apos;%&apos;"/>-->
<!--        <bm:query-field name="termination_date_from" queryExpression="to_date(t1.termination_date,&apos;yyyy-mm-dd&apos;) &gt;= to_date(${@termination_date_from},&apos;yyyy-mm-dd&apos;)"/>-->
<!--        <bm:query-field name="termination_date_to" queryExpression="to_date(t1.termination_date,&apos;yyyy-mm-dd&apos;) &lt;= to_date(${@termination_date_to},&apos;yyyy-mm-dd&apos;)"/>-->
<!--        <bm:query-field name="lease_channel" queryExpression="t1.lease_channel=${@lease_channel}"/>-->
<!--        <bm:query-field name="project_number" queryExpression="t1.project_number like &apos;%&apos;|| ${@project_number}||&apos;%&apos;"/>-->
<!--        <bm:query-field name="inv_object_taxpayer_type" queryExpression="vv.inv_object_taxpayer_type =${@inv_object_taxpayer_type}"/>-->
        <bm:query-field name="object_taxpayer_type" queryExpression="vv.object_taxpayer_type =${@object_taxpayer_type}"/>
        <bm:query-field name="ccr_document_type" queryExpression="vv.ccr_document_type =${@ccr_document_type}"/>
		<bm:query-field name="invoice_method" queryExpression="vv.invoice_method = ${@invoice_method}"/>
        <bm:query-field name="division" queryExpression="vv.division = ${@division}"/>
        <bm:query-field name="invoice_type" queryExpression="vv.invoice_type = ${@invoice_type}"/>
        <bm:query-field name="rl_flag" queryExpression="vv.rl_flag = ${@rl_flag}"/>
        <bm:query-field name="billing_status" queryExpression="vv.billing_status = ${@billing_status}"/>
		<bm:query-field name="full_elec_invoice_flag" queryExpression="vv.full_elec_invoice_flag = ${@full_elec_invoice_flag}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="vv.contract_status not in ('CANCEL')"/>
        <!--<bm:data-filter enforceOperations="query" expression="t1.contract_id = vv.contract_id"/>-->
        <!--        <bm:data-filter name="contract_status" enforceOperations="query" expression="vv.contract_status in(&apos;NEW&apos;,&apos;INCEPT&apos;,&apos;ETING&apos;,&apos;REPURING&apos;,&apos;CLOSED&apos;)"/>-->

    </bm:data-filters>
</bm:model>
