queryExpression="(t.bp_id_tenant = ${@bp_id} or t.bp_id_agent_level1 = ${@bp_id} or ((select bp_category from hls_bp_master where bp_id = ${@bp_id}) = 'VENDER'))"/>-->
<bm:query-fieldname="bp_id"
queryExpression="( (t.bp_id_tenant In
decode((Select h.bp_category
<bm:query-fieldname="bp_id"queryExpression="(Exists (Select 1 From (Select h.bp_id From hls_bp_master h Where h.bp_name = (Select hbm.bp_name From hls_bp_master hbm Where hbm.bp_id = ${@bp_id})) t1 Where t1.bp_id = t.bp_id_tenant) Or Exists
(Select 1
From (Select h.bp_id
From hls_bp_master h
Where h.bp_id = ${@bp_id}),
'TENANT',
decode(decode((Select h.bp_class
From hls_bp_master h
Where h.bp_id = ${@bp_id}),
'NP',
(Select Count(1)
From hls_bp_master hb
Where Trim(hb.bp_name) =
(Select Trim(hbm.bp_name)
From hls_bp_master hbm
Where hbm.bp_id = ${@bp_id})
Group By Trim(hb.bp_name), Trim(hb.id_card_no)),
'ORG',
(Select Count(1)
From hls_bp_master hb
Where Trim(hb.bp_name) =
(Select Trim(hbm.bp_name)
From hls_bp_master hbm
Where hbm.bp_id = ${@bp_id})
Group By Trim(hb.bp_name),
Trim(nvl(hb.social_code, 'N')))),
1,
${@bp_id},
(Select hbm.bp_id
From hls_bp_master hbm
Where hbm.bp_name =
(Select hbm.bp_name
From hls_bp_master hbm
Where hbm.bp_id = ${@bp_id})))))
Or (t.bp_id_agent_level1 In
decode((Select h.bp_category
From hls_bp_master h
Where h.bp_id = ${@bp_id}),
'AGENT',
decode(decode((Select h.bp_class
From hls_bp_master h
Where h.bp_id = ${@bp_id}),
'NP',
(Select Count(1)
From hls_bp_master hb
Where Trim(hb.bp_name) =
(Select Trim(hbm.bp_name)
From hls_bp_master hbm
Where hbm.bp_id = ${@bp_id})
Group By Trim(hb.bp_name), Trim(hb.id_card_no)),
'ORG',
(Select Count(1)
From hls_bp_master hb
Where Trim(hb.bp_name) =
(Select Trim(hbm.bp_name)
From hls_bp_master hbm
Where hbm.bp_id = ${@bp_id})
Group By Trim(hb.bp_name),
Trim(nvl(hb.social_code, 'N')))),
1,
${@bp_id},
(Select hbm.bp_id
From hls_bp_master hbm
Where hbm.bp_name =
Where h.bp_name =
(Select hbm.bp_name
From hls_bp_master hbm
Where hbm.bp_id = ${@bp_id})))))
Or ((Select bp_category From hls_bp_master Where bp_id = ${@bp_id}) =
'VENDER') )"/>
Where hbm.bp_id = ${@bp_id})) t2
Where t2.bp_id = t.bp_id_agent_level1) Or Exists
(Select 1
From con_contract_lease_item ccli, hls_lease_item hli
Where ccli.lease_item_id = hli.lease_item_id
And hli.vender_id = ${@bp_id}
And t.contract_id = ccli.contract_id))"/>
<bm:query-fieldname="bp_name"queryExpression="t.bp_name like '%' || ${@bp_name} || '%'"/>
<!-- <bm:query-field name="due_date_to" queryExpression="t.due_date between nvl(to_date(${@due_date_from},'yyyy-mm-dd'),t.due_date) and to_date(${@due_date_to},'yyyy-mm-dd')"/>-->