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>
...
...
@@ -292,91 +288,94 @@ select *
<bm:fieldname="small_scale_taxpayer"/>
</bm:fields>
<bm:query-fields>
<bm:query-fieldname="inv_billing_object_name"queryExpression="t.inv_billing_object_name like ${@inv_billing_object_name}"/>
<bm:query-fieldname="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} = 'N') or (${@part_bill_flag} = 'Y' and (t2.billing_amount!=0 or t2.due_amount < t2.received_amount)))"/>-->
<bm:query-field name="final_bill_flag" queryExpression="((${@final_bill_flag}='N' and (t.billing_method != 'LB_EQUIP_INT' or (t1.billing_method = 'LB_EQUIP_INT' and (t2.cf_item=1 and t2.interest >nvl(billing_interest,0)or (t2.cf_item!=1))))) or (${@final_bill_flag}='Y' and t1.billing_method = 'LB_EQUIP_INT' 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 = 'INFLOW' and b.write_off_flag in ('NOT','PARTIAL')) or t1.legal_status='SELL')))"/>
<bm:query-field name="final_bill_flag" queryExpression="((${@final_bill_flag}='N' and (t1.billing_method != 'LB_EQUIP_INT' or (t1.billing_method = 'LB_EQUIP_INT' and (t2.cf_item=1 and t2.interest >nvl(billing_interest,0)or (t2.cf_item!=1))))) or (${@final_bill_flag}='Y' and t1.billing_method = 'LB_EQUIP_INT' 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 = 'INFLOW' and b.write_off_flag in ('NOT','PARTIAL')) or t1.legal_status='SELL')))"/>
-->
<!-- <bm:query-field name="residue_flag"
queryExpression="((${@residue_flag}='N' and t2.cf_item != 8) or (${@residue_flag}='Y' and t2.cf_item = 8 and not exists (select 1 from con_contract_cashflow ca where ca.cf_item in ('1','9') and (ca.due_amount -nvl(ca.received_amount,0)) >50 and ca.contract_id=t1.contract_id and ca.write_off_flag!='FULL')))"/>-->
queryExpression="(${@bill_flag} = 'Y' and t.billing_frequency in (${@times_bill_flag},${@mid_bill_flag},${@final_bill_flag},${@et_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-fieldname="all_contract_number"
queryExpression="(t.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) )"/>
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) )"/>
<!-- expression="t.contract_id = t.contract_id AND t.billing_status IN ('NOT', 'PARTIAL') AND t1.contract_status not in ('CLOSED','CANCEL') AND t.cf_status = 'RELEASE' "/>-->
<!-- expression="t.billing_status != 'FULL' and t.cf_direction='INFLOW'"/>-->
<!-- <bm:data-filter enforceOperations="query"-->
<!-- expression="t.contract_id = t.contract_id AND t.billing_status IN ('NOT', 'PARTIAL') AND t1.contract_status not in ('NEW','CANCEL') AND t.cf_status = 'RELEASE'"/>-->
<bm:data-filters>
<bm:data-filterenforceOperations="query"
expression="t2.contract_id = t1.contract_id AND t1.billing_status IN ('NOT', 'PARTIAL') AND t1.contract_status not in ('CLOSED','CANCEL') AND t2.cf_status = 'RELEASE' "/>
expression="t2.billing_status != 'FULL' and t2.cf_direction='INFLOW'"/>
<!-- <bm:data-filter enforceOperations="query"
expression="t2.contract_id = t1.contract_id AND t1.billing_status IN ('NOT', 'PARTIAL') AND t1.contract_status not in ('NEW','CANCEL') AND t2.cf_status = 'RELEASE'"/>
<bm:data-filtername="query"expression="exists(select 1 from con_contract_cashflow ccc where (ccc.due_date <= 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'))"/>