<bm:fieldname="seq"databaseType="NUMBER"datatype="java.lang.Long"expression="(row_number() over(order by t1.contract_id))"/>
<bm:fieldname="seq"databaseType="NUMBER"datatype="java.lang.Long"expression="(row_number() over(order by t1.contract_id))"/>
<bm:fieldname="finance_amount"databaseType="NUMBER"datatype="java.lang.Double"expression="(select c.finance_amount from con_contract c where c.contract_id = t1.contract_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="interest"databaseType="NUMBER"datatype="java.lang.Double"expression="(select c.interest from con_contract_cashflow c where c.cashflow_id = t1.cashflow_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="int_rate_implicit"databaseType="NUMBER"datatype="java.lang.Double"expression="round((select nvl(c.int_rate,c.annual_mean_rate) from con_contract c where c.contract_id = t1.contract_id),4)"forInsert="false"forUpdate="false"/>
<bm:fieldname="vat_unearned_finance_income"databaseType="NUMBER"datatype="java.lang.Double"expression="(t1.unearned_finance_income*(select decode(t.tax_type_id,1,1,1+(select c.tax_type_rate from fnd_tax_type_codes c where c.tax_type_id = t.tax_type_id)) from con_contract t where t.contract_id = t1.contract_id))"forInsert="false"forUpdate="false"/>
<bm:fieldname="net_unearned_finance_income"expression="(t1.unearned_finance_income * (select decode(t.tax_type_id, 1, 1, 1 + (select c.tax_type_rate from fnd_tax_type_codes c where c.tax_type_id = t.tax_type_id)) from con_contract t where t.contract_id = t1.contract_id)-t1.unearned_finance_income)"forInsert="false"forUpdate="false"/>
<bm:fieldname="project_name"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select p.project_name from prj_project p ,con_contract c where c.contract_id = t1.contract_id and p.project_id = c.project_id)"forInsert="false"forUpdate="false"/>
<!-- <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select p.project_name from prj_project p ,con_contract c where c.contract_id = t1.contract_id and p.project_id = c.project_id)" forInsert="false" forUpdate="false"/> -->
<bm:fieldname="finance_amount"databaseType="NUMBER"datatype="java.lang.Double"expression="(select c.finance_amount from con_contract c where c.contract_id = t1.contract_id)"forInsert="false"forUpdate="false"/>
<!-- <bm:field name="period" databaseType="VARCHAR2" datatype="java.lang.String" expression="((SELECT TO_CHAR(cf1.due_date + 1, 'yyyy/mm/dd') FROM con_contract_cashflow cf1 WHERE cf1.contract_id = t1.contract_id AND cf1.cf_item = t1.cf_item AND cf1.times = (SELECT cf.times - 1 FROM con_contract_cashflow cf WHERE cf.cashflow_id = t1.cashflow_id )) || '-'||(SELECT TO_CHAR(cf.due_date, 'yyyy/mm/dd') FROM con_contract_cashflow cf WHERE cf.cashflow_id = t1.cashflow_id))" forInsert="false" forUpdate="false"/> -->
<bm:fieldname="period"databaseType="VARCHAR2"datatype="java.lang.String"expression="((SELECT TO_CHAR(cf1.due_date + 1, 'yyyy/mm/dd') FROM con_contract_cashflow cf1 WHERE cf1.contract_id = t1.contract_id AND cf1.cf_item = t1.cf_item AND cf1.times = (SELECT cf.times - 1 FROM con_contract_cashflow cf WHERE cf.cashflow_id = t1.cashflow_id )) || '-' || (SELECT TO_CHAR(cf.due_date, 'yyyy/mm/dd') FROM con_contract_cashflow cf WHERE cf.cashflow_id = t1.cashflow_id) )"forInsert="false"forUpdate="false"/>
<!-- <bm:field name="current_month_vat_income" databaseType="NUMBER" datatype="java.lang.Double" expression="ROUND((select sum(t.unearned_finance_income*(select decode(t.tax_type_id,1,1,1+(select c.tax_type_rate from fnd_tax_type_codes c where c.tax_type_id = t.tax_type_id)) from con_contract t where t.contract_id = t1.contract_id)) from con_unearned_finance_income t where t.contract_id =t1.contract_id and t.internal_period_num =${@internal_period_num} ),(select c.PRECISION from gld_currency c,con_contract ct where c.currency_code = ct.currency and ct.contract_id = t1.contract_id))" forInsert="false" forUpdate="false"/> -->
<bm:fieldname="interest"databaseType="NUMBER"datatype="java.lang.Double"expression="(select c.interest from con_contract_cashflow c where c.cashflow_id = t1.cashflow_id)"forInsert="false"forUpdate="false"/>
<!-- <bm:field name="current_month_income" databaseType="NUMBER" datatype="java.lang.Double" expression="(select sum(t.unearned_finance_income) from con_unearned_finance_income t where t.contract_id =t1.contract_id and t.internal_period_num =${@internal_period_num})" forInsert="false" forUpdate="false"/> -->
<bm:fieldname="int_rate_implicit"databaseType="NUMBER"datatype="java.lang.Double"expression="round((select c.int_rate from con_contract c where c.contract_id = t1.contract_id),4)"forInsert="false"forUpdate="false"/>
<!-- <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select t.contract_name from con_contract t where t.contract_id =t1.contract_id )" forInsert="false" forUpdate="false"/> -->
<bm:fieldname="vat_unearned_finance_income"databaseType="NUMBER"datatype="java.lang.Double"expression="(t1.unearned_finance_income*(select decode(t.tax_type_id,1,1,(select c.tax_type_rate from fnd_tax_type_codes c where c.tax_type_id = t.tax_type_id)) from con_contract t where t.contract_id = t1.contract_id))"forInsert="false"forUpdate="false"/>
<bm:fieldname="current_month_vat_income"databaseType="NUMBER"datatype="java.lang.Double"expression="ROUND((select sum(t.unearned_finance_income*(select decode(t.tax_type_id, 1, 1, 1+(select c.tax_type_rate from fnd_tax_type_codes c where c.tax_type_id = t.tax_type_id)) from con_contract t where t.contract_id = t1.contract_id)) from con_unearned_finance_income t where t.contract_id =t1.contract_id and t.internal_period_num =t1.internal_period_num),(select c.PRECISION from gld_currency c,con_contract ct where c.currency_code = ct.currency and ct.contract_id = t1.contract_id))"forInsert="false"forUpdate="false"/>
<bm:fieldname="current_month_income"databaseType="NUMBER"datatype="java.lang.Double"expression="(select sum(t.unearned_finance_income) from con_unearned_finance_income t where t.contract_id =t1.contract_id and t.internal_period_num =t1.internal_period_num)"forInsert="false"forUpdate="false"/>
<bm:fieldname="contract_number"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select t.contract_number from con_contract t where t.contract_id =t1.contract_id )"forInsert="false"forUpdate="false"/>
<bm:fieldname="contract_name"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select t.contract_name from con_contract t where t.contract_id =t1.contract_id )"forInsert="false"forUpdate="false"/>
<bm:fieldname="cf_item_desc"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select t.description from hls_cashflow_item t where t.cf_item =t1.cf_item )"forInsert="false"forUpdate="false"/>
<bm:fieldname="loan_contract_number"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select t.loan_contract_number from tre_loan_contract t,tre_loan_con_withdrawal_plan p where p.widthdrawal_plan_id =t1.contract_id and p.loan_contract_id = t.loan_contract_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="loan_amount"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select p.amount from tre_loan_con_withdrawal_plan p where p.widthdrawal_plan_id =t1.contract_id )"forInsert="false"forUpdate="false"/>
<bm:fieldname="full_received"databaseType="VARCHAR2"datatype="java.lang.String"expression="(select CASE WHEN nvl(ccc.write_off_flag, 'NOT') = 'FULL' THEN 'Y' ELSE 'N' END from con_contract_cashflow ccc where ccc.cashflow_id = t1.cashflow_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="unearned_finance_income_all"databaseType="NUMBER"datatype="java.lang.Double"expression="((t1.unearned_finance_income*(select decode(t.tax_type_id,1,1,(select c.tax_type_rate from fnd_tax_type_codes c where c.tax_type_id = t.tax_type_id)) from con_contract t where t.contract_id = t1.contract_id))+t1.unearned_finance_income)"forInsert="false"forUpdate="false"/>
<bm:fieldname="lease_execution_date"databaseType="DATE"datatype="java.util.Date"expression="(select c.lease_execution_date from con_contract c where c.contract_id = t1.contract_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="lease_end_date"databaseType="DATE"datatype="java.util.Date"expression="(select c.lease_end_date from con_contract c where c.contract_id = t1.contract_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="business_type_n"databaseType="VARCHAR2"datatype="java.lang.String"expression="(SELECT hbt.description FROM con_contract c,hls_business_type hbt WHERE c.contract_id = t1.contract_id and hbt.business_type = c.business_type)"forInsert="false"forUpdate="false"/>
<bm:fieldname="principal"databaseType="NUMBER"datatype="java.lang.Double"expression="(SELECT ccc.principal FROM con_contract_cashflow ccc WHERE ccc.cashflow_id = t1.cashflow_id)"forInsert="false"forUpdate="false"/>
<!-- <bm:field name="interest"/>-->
<bm:fieldname="principal_15"databaseType="NUMBER"datatype="java.lang.Double"expression="(SELECT ccc.principal FROM con_contract_cashflow ccc WHERE ccc.cashflow_id = t1.cashflow_id) * 0.15 "forInsert="false"forUpdate="false"/>
<!-- <bm:field name="interest" expression="(select t.contract_name from con_contract t where t.contract_id =t1.contract_id )" forInsert="false" forUpdate="false"/>-->
<bm:fieldname="net_principal"databaseType="NUMBER"datatype="java.lang.Double"expression="(SELECT ccc.net_principal FROM con_contract_cashflow ccc WHERE ccc.cashflow_id = t1.cashflow_id)"forInsert="false"forUpdate="false"/>
<bm:fieldname="net_principal_15"databaseType="NUMBER"datatype="java.lang.Double"expression="(SELECT ccc.net_principal FROM con_contract_cashflow ccc WHERE ccc.cashflow_id = t1.cashflow_id) * 0.15"forInsert="false"forUpdate="false"/>
<bm:query-fieldfield="contract_number"queryExpression="(select t.contract_number from con_contract t where t.contract_id =t1.contract_id ) = ${@contract_number}"/>
AND ccc.due_amount - nvl(ccc.received_amount, 0) >= 0
AND (add_months(to_date(${@internal_period_num},'yyyymm'),1)-1)- ccc.due_date BETWEEN 0 AND 89
AND ccc.cashflow_id = t1.cashflow_id),
0,
'N',
'Y')))= ${@contract_overdue_90}"/>
<bm:query-fieldfield="loan_contract_number"queryExpression="(select t.loan_contract_number from tre_loan_contract t,tre_loan_con_withdrawal_plan p where p.widthdrawal_plan_id =t1.contract_id and p.loan_contract_id = t.loan_contract_id) = ${@loan_contract_numbers}"/>
<bm:data-filterenforceOperations="query"expression="t1.internal_period_num = ${@internal_period_num} and t1.company_id IN (SELECT company_id FROM fnd_companies_vl WHERE (company_id = ${/session/@company_id} OR parent_biz_company_id = ${/session/@company_id}) AND enabled_flag = 'Y') and t2.data_class = 'NORMAL' and t2.contract_status in( 'INCEPT','SIGN','TERMINATE','ET') and nvl(t1.unearned_finance_income,0) !=0 "/>