<?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 *
  from CON_CONTRACT_CASHFLOW_V t
   #WHERE_CLAUSE#
 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <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" forDisplay="true" forQuery="true" physicalName="CONTRACT_NUMBER" prompt="HLS.CONTRACT_NUMBER"/>
        <bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="spv_company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SPV_COMPANY_ID"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>
        <bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"/>
        <bm:field name="prj_short_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRJ_SHORT_NAME"/>
        <bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CODE"/>
        <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"/>
        <bm:field name="cf_item_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="100" forDisplay="true" forQuery="true" physicalName="CF_ITEM_NAME" prompt="HLS.CF_ITEM_DESC"/>
        <bm:field name="cf_type" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_TYPE"/>
        <bm:field name="cf_type_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_TYPE_NAME"/>
        <bm:field name="cf_direction" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_DIRECTION"/>
        <bm:field name="cf_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_STATUS"/>
        <bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" displayWidth="50" forDisplay="true" forQuery="true" physicalName="TIMES" prompt="HLS.TIMES"/>
        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" displayWidth="80" forDisplay="true" physicalName="DUE_DATE" prompt="CSH710.DUE_DATE"/>
        <bm:field name="due_amount" databaseType="NUMBER" datatype="java.lang.Double" forDisplay="true" physicalName="DUE_AMOUNT" prompt="CON500.CON_CONTRACT_CASHFLOW.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="due_amount_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DUE_AMOUNT_CNY"/>
        <bm:field name="principal_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PRINCIPAL_CNY"/>
        <bm:field name="interest_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST_CNY"/>
        <bm:field name="penalty" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PENALTY"/>
        <bm:field name="penalty_cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PENALTY_CASHFLOW_ID"/>
        <bm:field name="outstanding_rental" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OUTSTANDING_RENTAL"/>
        <bm:field name="outstanding_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OUTSTANDING_PRINCIPAL"/>
        <bm:field name="outstanding_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OUTSTANDING_INTEREST"/>
        <bm:field name="interest_accrual_balance" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST_ACCRUAL_BALANCE"/>
        <bm:field name="principal_implicit_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PRINCIPAL_IMPLICIT_RATE"/>
        <bm:field name="interest_implicit_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST_IMPLICIT_RATE"/>
        <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"/>
        <bm:field name="equal_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EQUAL_FLAG"/>
        <bm:field name="manual_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MANUAL_FLAG"/>
        <bm:field name="fix_principal_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIX_PRINCIPAL_FLAG"/>
        <bm:field name="fix_rental_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIX_RENTAL_FLAG"/>
        <bm:field name="salestax" databaseType="NUMBER" datatype="java.lang.Double" physicalName="SALESTAX"/>
        <bm:field name="calc_line_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CALC_LINE_ID"/>
        <bm:field name="overdue_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="OVERDUE_STATUS"/>
        <bm:field name="overdue_book_date" databaseType="DATE" datatype="java.util.Date" physicalName="OVERDUE_BOOK_DATE"/>
        <bm:field name="overdue_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OVERDUE_AMOUNT"/>
        <bm:field name="overdue_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OVERDUE_PRINCIPAL"/>
        <bm:field name="overdue_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OVERDUE_INTEREST"/>
        <bm:field name="overdue_remark" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="OVERDUE_REMARK"/>
        <bm:field name="received_amount" databaseType="NUMBER" datatype="java.lang.Double" forDisplay="true" physicalName="RECEIVED_AMOUNT" prompt="已收金额"/>
        <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="received_amount_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_AMOUNT_CNY"/>
        <bm:field name="received_principal_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_PRINCIPAL_CNY"/>
        <bm:field name="received_interest_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_INTEREST_CNY"/>
        <bm:field name="write_off_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_FLAG"/>
        <bm:field name="full_write_off_date" databaseType="DATE" datatype="java.util.Date" physicalName="FULL_WRITE_OFF_DATE"/>
        <bm:field name="penalty_process_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PENALTY_PROCESS_STATUS"/>
        <bm:field name="unreceived_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNRECEIVED_AMOUNT" prompt="CSH513.UNRECEIVED_AMOUNT"/>
        <bm:field name="unreceived_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNRECEIVED_PRINCIPAL"/>
        <bm:field name="unreceived_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNRECEIVED_INTEREST"/>
        <bm:field name="unreceived_amount_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNRECEIVED_AMOUNT_CNY"/>
        <bm:field name="unreceived_principal_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNRECEIVED_PRINCIPAL_CNY"/>
        <bm:field name="unreceived_interest_cny" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNRECEIVED_INTEREST_CNY"/>
        <bm:field name="write_off_order" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_ORDER"/>
        <bm:field name="write_off_order100" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_ORDER100"/>
        <bm:field name="write_off_order101" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_ORDER101"/>
    </bm:fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t.contract_status = &apos;INCEPT&apos;    and t.cf_status = &apos;RELEASE&apos;    and t.write_off_flag !=&apos;FULL&apos;    and t.due_amount !=0"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field name="contract_id" queryExpression="(${@contract_id} is null or t.contract_id = ${@contract_id})"/>
        <bm:query-field field="cf_direction" queryOperator="="/>
        <bm:query-field field="times" queryOperator="="/>
        <bm:query-field field="cf_item_name" queryOperator="like"/>
        <bm:query-field name="bp_id" queryExpression="(${bp_id} is null or exists (select 1 from con_contract_bp cb where cb.contract_id = t.contract_id and  cb.bp_id = ${@bp_id} and cb.bp_category in  (&apos;TENANT&apos;,&apos;GUARANTOR&apos;)))"/>
    </bm:query-fields>
</bm:model>
