<bm:query-field name="contract_number" queryExpression="exists (select 1 from hls_document_flow_all_v df, con_contract cc where df.contract_id = cc.contract_id and df.ar_invoice_hd_id = t1.invoice_hd_id and cc.contract_number between nvl(${@contract_number_f}, cc.contract_number) and nvl(${@contract_number_t}, cc.contract_number))"/>
-->
<bm:query-fieldname="query_project_number"queryExpression="exists (select 1 from hls_document_flow_all_v df, prj_project pp where df.ar_invoice_hd_id = t1.invoice_hd_id and df.project_id = pp.project_id and pp.project_number between nvl(${@project_number_f}, pp.project_number) and nvl(${@project_number_t}, pp.project_number))"/>
<bm:query-field name="contract_number" queryExpression="exists (select 1 from hls_document_flow_all_v df, con_contract cc where df.contract_id = cc.contract_id and df.ar_invoice_hd_id = t1.invoice_hd_id and cc.contract_number between nvl(${@contract_number_f}, cc.contract_number) and nvl(${@contract_number_t}, cc.contract_number))"/>
-->
<bm:query-fieldname="query_project_number"queryExpression="exists (select 1 from hls_document_flow_all_v df, prj_project pp where df.ar_invoice_hd_id = t1.invoice_hd_id and df.project_id = pp.project_id and pp.project_number between nvl(${@project_number_f}, pp.project_number) and nvl(${@project_number_t}, pp.project_number))"/>
<!--<bm:field name="bp_vender" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_vender and enabled_flag='Y')" forInsert="false" forUpdate="false"/>-->
<bm:fieldname="lease_organization_desc"expression="(select description from hls_lease_organization where lease_organization = t1.lease_organization)"forInsert="false"forUpdate="false"/>
<!--<bm:field name="owner_user_id_n" expression="(select description from sys_user where user_id = t1.created_by)" forInsert="false" forUpdate="false"/>-->
<bm:fieldname="is_terminate"expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0)) = 0 THEN '是' ELSE '否' END)"forInsert="false"forUpdate="false"/>
<bm:fieldname="is_terminate"expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0)) = 0 THEN '是' ELSE '否' END)"forInsert="false"forUpdate="false"/>
<bm:fieldname="amount_total"expression="(select sum(ccc.due_amount) from con_contract_cashflow ccc where ccc.contract_id=t1.contract_id and ccc.cf_status<>'BLOCK' and ccc.cf_item=1)"forInsert="false"forUpdate="false"/>
<bm:fieldname="amount_principal"expression="(select sum(nvl(ccc.principal,0)) from con_contract_cashflow ccc where ccc.contract_id=t1.contract_id and ccc.cf_status<>'BLOCK')"forInsert="false"forUpdate="false"/>
<bm:fieldname="amount_interest"expression="(select sum(nvl(ccc.interest,0)) from con_contract_cashflow ccc where ccc.contract_id=t1.contract_id and ccc.cf_status<>'BLOCK' and cf_item=1)"forInsert="false"forUpdate="false"/>
<!--<bm:field name="bp_vender" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_vender and enabled_flag='Y')" forInsert="false" forUpdate="false"/>-->
<bm:fieldname="lease_organization_desc"expression="(select description from hls_lease_organization where lease_organization = t1.lease_organization)"forInsert="false"forUpdate="false"/>
<!--<bm:field name="owner_user_id_n" expression="(select description from sys_user where user_id = t1.created_by)" forInsert="false" forUpdate="false"/>-->
<bm:fieldname="is_terminate"expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0)) = 0 THEN '是' ELSE '否' END)"forInsert="false"forUpdate="false"/>
<bm:fieldname="is_terminate"expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status<>'BLOCK' and ccc.cf_item<>0)) = 0 THEN '是' ELSE '否' END)"forInsert="false"forUpdate="false"/>
<bm:fieldname="receipt_type_des"expression="(select v.code_value_name from sys_code_values_v v where v.code='RECEIPT_TYPE' and v.code_value=t1.receipt_type)"/>
<bm:fieldname="ref_n01"/>
<bm:fieldname="approval_status"expression="nvl((select nvl(cw.approval_status, 'NEW') from csh_transaction_wfl cw where cw.transaction_wfl_id = t1.transaction_wfl_id), 'NEW')"/>
<bm:fieldname="approval_status_desc"expression="(Select v.code_value_name From sys_code_values_v v Where v.code = 'COST_SUPPORT_STATUS' And v.code_value = nvl((Select cw.approval_status From csh_transaction_wfl cw Where cw.transaction_wfl_id = t1.transaction_wfl_id), 'NEW'))"/>
<bm:fieldname="approval_status"expression="decode(nvl((Select nvl(cw.approval_status, 'NEW') From csh_transaction_wfl cw Where cw.transaction_wfl_id = t1.transaction_wfl_id), 'NEW'), 'APPROVED', decode(nvl(t1.reversed_flag, 'N'), 'N', 'NEW', 'APPROVED'), nvl((Select nvl(cw.approval_status, 'NEW') From csh_transaction_wfl cw Where cw.transaction_wfl_id = t1.transaction_wfl_id), 'NEW'))"/>
<bm:fieldname="approval_status_desc"expression="(Select v.code_value_name From sys_code_values_v v Where v.code = 'WFL_STATUS' And v.code_value = decode(nvl((Select nvl(cw.approval_status, 'NEW') From csh_transaction_wfl cw Where cw.transaction_wfl_id = t1.transaction_wfl_id), 'NEW'), 'APPROVED', decode(nvl(t1.reversed_flag, 'N'), 'N', 'NEW', 'APPROVED'), nvl((Select nvl(cw.approval_status, 'NEW') From csh_transaction_wfl cw Where cw.transaction_wfl_id = t1.transaction_wfl_id), 'NEW')))"/>