Commit 0897e4b0 authored by lijingjing's avatar lijingjing

[feat]租赁收入计提功能

parent 59d8a494
...@@ -8,18 +8,26 @@ ...@@ -8,18 +8,26 @@
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_UNEARNED_FINANCE_INCOME"> <bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_UNEARNED_FINANCE_INCOME">
<bm:fields> <bm:fields>
<bm:field name="seq" databaseType="NUMBER" datatype="java.lang.Long" expression="(row_number() over(order by t1.contract_id))"/> <bm:field name="seq" databaseType="NUMBER" datatype="java.lang.Long" expression="(row_number() over(order by t1.contract_id))"/>
<bm:field name="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="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="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:field name="calc_period" databaseType="VARCHAR2" datatype="java.lang.String" expression="(to_char(t1.calc_start_date,&apos;yyyy/mm/dd&apos;)||&apos;-&apos;||to_char(t1.calc_end_date,&apos;yyyy/mm/dd&apos;))" forInsert="false" forUpdate="false"/>
<bm:field name="calc_date_count" databaseType="NUMBER" datatype="java.lang.Long" expression="(t1.calc_end_date-t1.calc_start_date+1)" forInsert="false" forUpdate="false"/>
<bm:field name="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:field name="unearned_finance_income" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNEARNED_FINANCE_INCOME" prompt="CON_UNEARNED_FINANCE_INCOME.UNEARNED_FINANCE_INCOME"/>
<bm:field name="finance_income_recognized" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FINANCE_INCOME_RECOGNIZED" prompt="CON_UNEARNED_FINANCE_INCOME.FINANCE_INCOME_RECOGNIZED"/>
<bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" prompt="CON_UNEARNED_FINANCE_INCOME.RECORD_ID"/> <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" prompt="CON_UNEARNED_FINANCE_INCOME.RECORD_ID"/>
<bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CON_UNEARNED_FINANCE_INCOME.COMPANY_ID"/> <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CON_UNEARNED_FINANCE_INCOME.COMPANY_ID"/>
<bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_UNEARNED_FINANCE_INCOME.CONTRACT_ID"/> <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_UNEARNED_FINANCE_INCOME.CONTRACT_ID"/>
<bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="CON_UNEARNED_FINANCE_INCOME.INTERNAL_PERIOD_NUM"/>
<bm:field name="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:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="CON_UNEARNED_FINANCE_INCOME.INTERNAL_PERIOD_NUM"/>
<bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM" prompt="CON_UNEARNED_FINANCE_INCOME.CF_ITEM"/> <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM" prompt="CON_UNEARNED_FINANCE_INCOME.CF_ITEM"/>
<bm:field name="seq_in_period" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQ_IN_PERIOD" prompt="CON_UNEARNED_FINANCE_INCOME.SEQ_IN_PERIOD"/> <bm:field name="seq_in_period" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQ_IN_PERIOD" prompt="CON_UNEARNED_FINANCE_INCOME.SEQ_IN_PERIOD"/>
<bm:field name="unearned_finance_income" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UNEARNED_FINANCE_INCOME" prompt="CON_UNEARNED_FINANCE_INCOME.UNEARNED_FINANCE_INCOME"/>
<bm:field name="financing_cost" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCING_COST" prompt="CON_UNEARNED_FINANCE_INCOME.FINANCING_COST"/> <bm:field name="financing_cost" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCING_COST" prompt="CON_UNEARNED_FINANCE_INCOME.FINANCING_COST"/>
<bm:field name="main_business_income" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MAIN_BUSINESS_INCOME" prompt="CON_UNEARNED_FINANCE_INCOME.MAIN_BUSINESS_INCOME"/> <bm:field name="main_business_income" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MAIN_BUSINESS_INCOME" prompt="CON_UNEARNED_FINANCE_INCOME.MAIN_BUSINESS_INCOME"/>
<bm:field name="main_business_cost" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MAIN_BUSINESS_COST" prompt="CON_UNEARNED_FINANCE_INCOME.MAIN_BUSINESS_COST"/> <bm:field name="main_business_cost" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MAIN_BUSINESS_COST" prompt="CON_UNEARNED_FINANCE_INCOME.MAIN_BUSINESS_COST"/>
<bm:field name="unearned_finance_income_balanc" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNEARNED_FINANCE_INCOME_BALANC" prompt="CON_UNEARNED_FINANCE_INCOME.UNEARNED_FINANCE_INCOME_BALANC"/> <bm:field name="unearned_finance_income_balanc" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNEARNED_FINANCE_INCOME_BALANC" prompt="CON_UNEARNED_FINANCE_INCOME.UNEARNED_FINANCE_INCOME_BALANC"/>
<bm:field name="finance_income_recognized" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FINANCE_INCOME_RECOGNIZED" prompt="CON_UNEARNED_FINANCE_INCOME.FINANCE_INCOME_RECOGNIZED"/>
<bm:field name="weight_factor" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WEIGHT_FACTOR" prompt="CON_UNEARNED_FINANCE_INCOME.WEIGHT_FACTOR"/> <bm:field name="weight_factor" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WEIGHT_FACTOR" prompt="CON_UNEARNED_FINANCE_INCOME.WEIGHT_FACTOR"/>
<bm:field name="total_weight" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_WEIGHT" prompt="CON_UNEARNED_FINANCE_INCOME.TOTAL_WEIGHT"/> <bm:field name="total_weight" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_WEIGHT" prompt="CON_UNEARNED_FINANCE_INCOME.TOTAL_WEIGHT"/>
<bm:field name="factor_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_DAYS" prompt="CON_UNEARNED_FINANCE_INCOME.FACTOR_DAYS"/> <bm:field name="factor_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_DAYS" prompt="CON_UNEARNED_FINANCE_INCOME.FACTOR_DAYS"/>
...@@ -31,53 +39,18 @@ ...@@ -31,53 +39,18 @@
<bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID" prompt="CON_UNEARNED_FINANCE_INCOME.CASHFLOW_ID"/> <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID" prompt="CON_UNEARNED_FINANCE_INCOME.CASHFLOW_ID"/>
<bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TIMES" prompt="CON_UNEARNED_FINANCE_INCOME.TIMES"/> <bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TIMES" prompt="CON_UNEARNED_FINANCE_INCOME.TIMES"/>
<bm:field name="cf_type" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_TYPE" prompt="CON_UNEARNED_FINANCE_INCOME.CF_TYPE"/> <bm:field name="cf_type" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_TYPE" prompt="CON_UNEARNED_FINANCE_INCOME.CF_TYPE"/>
<bm:field name="calc_start_date" databaseType="DATE" datatype="java.util.Date" physicalName="CALC_START_DATE" prompt="CON_UNEARNED_FINANCE_INCOME.CALC_START_DATE"/> <bm:field name="calc_start_date" databaseType="DATE" datatype="java.util.Date" physicalName="CALC_START_DATE" prompt="CON_UNEARNED_FINANCE_INCOME.CALC_START_DATE"/> -->
<bm:field name="calc_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="CALC_END_DATE" prompt="CON_UNEARNED_FINANCE_INCOME.CALC_END_DATE"/> <!-- <bm:field name="calc_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="CALC_END_DATE" prompt="CON_UNEARNED_FINANCE_INCOME.CALC_END_DATE"/> -->
<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: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:field name="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, &apos;yyyy/mm/dd&apos;) 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 )) || &apos;-&apos;||(SELECT TO_CHAR(cf.due_date, &apos;yyyy/mm/dd&apos;) FROM con_contract_cashflow cf WHERE cf.cashflow_id = t1.cashflow_id))" forInsert="false" forUpdate="false"/> -->
<bm:field name="period" databaseType="VARCHAR2" datatype="java.lang.String" expression="((SELECT TO_CHAR(cf1.due_date + 1, &apos;yyyy/mm/dd&apos;) 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 )) || &apos;-&apos; || (SELECT TO_CHAR(cf.due_date, &apos;yyyy/mm/dd&apos;) 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:field name="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:field name="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:field name="calc_period" databaseType="VARCHAR2" datatype="java.lang.String" expression="(to_char(t1.calc_start_date,&apos;yyyy/mm/dd&apos;)||&apos;-&apos;||to_char(t1.calc_end_date,&apos;yyyy/mm/dd&apos;))" forInsert="false" forUpdate="false"/> <!-- <bm:field name="search_term_1" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select t.search_term_1 from con_contract t where t.contract_id =t1.contract_id)" forInsert="false" forUpdate="false"/> -->
<bm:field name="calc_date_count" databaseType="NUMBER" datatype="java.lang.Long" expression="(t1.calc_end_date-t1.calc_start_date+1)" forInsert="false" forUpdate="false"/> <bm:field name="vat_interest" />
<bm:field name="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: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 =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: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 =t1.internal_period_num)" forInsert="false" forUpdate="false"/>
<bm:field name="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: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:field name="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:field name="loan_contract_id" databaseType="NUMBER" datatype="java.lang.Long" />
<bm:field name="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:field name="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:field name="full_received" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select CASE WHEN nvl(ccc.write_off_flag, &apos;NOT&apos;) = &apos;FULL&apos; THEN &apos;Y&apos; ELSE &apos;N&apos; END from con_contract_cashflow ccc where ccc.cashflow_id = t1.cashflow_id)" forInsert="false" forUpdate="false"/>
<bm:field name="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:field name="contract_overdue_90" databaseType="VARCHAR2" datatype="java.lang.String" expression="&apos;Y&apos;" forInsert="false" forUpdate="false"/>
<bm:field name="rental_overdue_90" databaseType="VARCHAR2" datatype="java.lang.String" expression="&apos;Y&apos;" forInsert="false" forUpdate="false"/>
<bm:field name="overdue_days" databaseType="VARCHAR2" datatype="java.lang.String" expression="
nvl((SELECT (add_months(to_date(${@internal_period_num},'yyyymm'),1)-1)- ccc.due_date
FROM con_contract_cashflow ccc
WHERE ccc.cf_item IN (1, 200)
AND ccc.due_amount - nvl(ccc.received_amount, 0) > 0
AND ccc.cashflow_id = t1.cashflow_id),0)" forInsert="false" forUpdate="false"/>
<!--<bm:field name="rental_overdue_90" databaseType="VARCHAR2" datatype="java.lang.String" expression="(DECODE((SELECT COUNT(*) FROM con_contract_cashflow ccc WHERE ccc.cf_item IN (1, 200) AND nvl(ccc.received_amount, 0) &lt; ccc.due_amount AND ccc.due_date + 90 &lt;= trunc(SYSDATE) AND ccc.cashflow_id = t1.cashflow_id),0,&apos;N&apos;,&apos;Y&apos;))" forInsert="false" forUpdate="false"/>-->
<bm:field name="tre_unearned_finance_income" databaseType="NUMBER" datatype="java.lang.Double" expression="(round(t1.unearned_finance_income * 1.16,2))" forInsert="false" forUpdate="false"/>
<bm:field name="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:field name="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:field name="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:field name="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:field name="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:field name="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:field name="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:fields> </bm:fields>
<bm:features> <bm:features>
...@@ -87,45 +60,21 @@ ...@@ -87,45 +60,21 @@
<bm:pk-field name="record_id"/> <bm:pk-field name="record_id"/>
</bm:primary-key> </bm:primary-key>
<bm:query-fields> <bm:query-fields>
<bm:query-field field="company_id" queryOperator="="/> <bm:query-field name="company_id" queryExpression="t1.company_id = ${@company_id}"/>
<bm:query-field field="contract_number" queryExpression="(select t.contract_number from con_contract t where t.contract_id =t1.contract_id ) = ${@contract_number}"/> <bm:query-field name="finance_income_recognized" queryExpression="nvl(t1.finance_income_recognized,'N') = ${@finance_income_recognized}"/>
<bm:query-field field="rental_overdue_90" queryExpression="
(decode((SELECT COUNT(1)
FROM con_contract_cashflow ccc
WHERE ccc.cf_item IN (1, 200)
AND ccc.due_amount - nvl(ccc.received_amount, 0) &gt; 0
AND ccc.due_date &lt;=
(SELECT MIN(f.due_date)
FROM con_contract_cashflow f
WHERE f.contract_id = t1.contract_id
AND f.cf_item IN (1, 200)
AND f.due_amount - nvl(ccc.received_amount, 0) &gt; 0) + 90
AND ccc.cashflow_id = t1.cashflow_id),0,&apos;N&apos;,&apos;Y&apos;)) =${@rental_overdue_90}"/>
<bm:query-field field="contract_overdue_90" queryExpression="
((DECODE((SELECT COUNT(*)
FROM con_contract_cashflow ccc
WHERE ccc.cf_item IN (1, 200)
AND ccc.due_amount - nvl(ccc.received_amount, 0) &gt;= 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,
&apos;N&apos;,
&apos;Y&apos;)))= ${@contract_overdue_90}"/>
<bm:query-field field="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:query-field name="buession_type" queryExpression=" ((${@buession_type} = 'LEASE'
AND t1.cf_item in (1,3) and t1.internal_period_num &lt;= ${@internal_period_num}
AND (select cc.data_class from con_contract cc where cc.contract_id = t1.contract_id) = 'NORMAL'
) OR (${@buession_type} = 'LOAN'
AND (
(t1.cf_item= 900
and t1.internal_period_num = ${@internal_period_num}
and not EXISTS (SELECT 1 FROM tre_loan_con_repayment_plan p WHERE EXISTS (SELECT 1 FROM tre_loan_con_repayment_dtl d
WHERE d.repayment_plan_id = p.repayment_plan_id AND d.repayment_amount = p.rental )
AND p.repayment_plan_id = t1.cashflow_id)) or (t1.cf_item= 901
and t1.internal_period_num = ${@internal_period_num} )
)))"/>
</bm:query-fields> </bm:query-fields>
<bm:data-filters> <bm:data-filters>
<bm:data-filter enforceOperations="query" expression="t1.cf_item = ${@cf_item} "/> <bm:data-filter enforceOperations="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 = &apos;Y&apos;) and t2.data_class = &apos;NORMAL&apos; and t2.contract_status in( &apos;INCEPT&apos;,&apos;SIGN&apos;,&apos;TERMINATE&apos;,&apos;ET&apos;) and nvl(t1.unearned_finance_income,0) !=0 "/>
</bm:data-filters> </bm:data-filters>
<bm:relations>
<bm:relation name="con_ref" joinType="LEFT OUTER" refAlias="t2" refModel="cont.CON500.con_contract">
<bm:reference foreignField="contract_id" localField="contract_id"/>
</bm:relation>
</bm:relations>
<bm:ref-fields>
<bm:ref-field name="contract_number" relationName="con_ref" sourceField="contract_number"/>
<bm:ref-field name="contract_name" relationName="con_ref" sourceField="contract_name"/>
<bm:ref-field name="contract_status" relationName="con_ref" sourceField="contract_status"/>
<bm:ref-field name="data_class" relationName="con_ref" sourceField="data_class"/>
</bm:ref-fields>
</bm:model> </bm:model>
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment