(select v.code_value_name value_name from sys_code_values_v v where v.code = 'YES_NO' and v.code_value = hbm.full_elec_invoice_flag) full_elec_invoice_flag_n
(select v.code_value_name value_name from sys_code_values_v v where v.code = 'YES_NO' and v.code_value = hbm.full_elec_invoice_flag) full_elec_invoice_flag_n
from con_contract cc, hls_bp_master hbm, CUS_ACR_INVOICE_V t2
from con_contract cc, hls_bp_master hbm, CUS_ACR_INVOICE_V t2
where cc.contract_id = t2.contract_id
where cc.contract_id = t2.contract_id
and hbm.bp_wfl_status = 'APPROVED'
and hbm.bp_wfl_status = 'APPROVED'
...
@@ -141,15 +141,12 @@
...
@@ -141,15 +141,12 @@
and hbm.bp_id = t2.bill_object_bp_id
and hbm.bp_id = t2.bill_object_bp_id
and nvl(t2.billing_status, 'NOT') != 'FULL'
and nvl(t2.billing_status, 'NOT') != 'FULL'
--合同状态为结束中(不论是否做过提前结清或解约回购)、提前结清中、提前结清完成、正常结清的合同
--合同状态为结束中(不论是否做过提前结清或解约回购)、提前结清中、提前结清完成、正常结清的合同
and
and ((t2.cf_item = 2 and cc.division !='95' and cc.payment_deduction in ('TRI_AGREEMENT','TRADE_IN')
((t2.cf_item = 2 and cc.payment_deduction in ('TRI_AGREEMENT','TRADE_IN')
and ((cc.contract_status in ('TERMINATING', 'ETING','ET','INCEPT', 'TERMINATE','REPURING','REPUR') and hbm.invoice_method = 'BILLING')
and ((cc.contract_status in ('TERMINATING', 'ETING','ET','INCEPT', 'TERMINATE','REPURING','REPUR') and hbm.invoice_method = 'BILLING')
or (cc.contract_status in ('TERMINATING', 'ETING', 'ETING', 'TERMINATE') and hbm.invoice_method = 'NO_BILLING'))
or (cc.contract_status in ('TERMINATING', 'ETING', 'ETING', 'TERMINATE') and hbm.invoice_method = 'NO_BILLING'))
)
)
or (cc.division !='95' and cc.contract_status in
or
('TERMINATING', 'ETING', 'ETING', 'TERMINATE')
(cc.contract_status in
('TERMINATING', 'ET', 'ETING', 'TERMINATE')
--合同状态为起租做过承租人变更的合同
--合同状态为起租做过承租人变更的合同
or
or
(cc.contract_status = 'INCEPT' and t2.document_type = 'LEASE_CHAG' and
(cc.contract_status = 'INCEPT' and t2.document_type = 'LEASE_CHAG' and
...
@@ -199,12 +196,12 @@
...
@@ -199,12 +196,12 @@
(cc.contract_status = 'INCEPT' and
(cc.contract_status = 'INCEPT' and
trunc(t2.due_date) >= trunc(nvl(cc.CCR_LEASE_DATE, t2.due_date)) and
trunc(t2.due_date) >= trunc(nvl(cc.CCR_LEASE_DATE, t2.due_date)) and
hbm.taxpayer_type = 'SMALL_SCALE_TAXPAYER' and
hbm.taxpayer_type = 'SMALL_SCALE_TAXPAYER' and
hbm.invoice_method = 'BILLING'
hbm.invoice_method = 'BILLING' and
and
trunc(t2.due_date) <= trunc(sysdate))
nvl(t2.write_off_flag, 'NOT') = 'FULL'
--产品线为经营性租赁,并且全部核销
/* and
or
trunc(t2.due_date) <= trunc(sysdate)*/
(cc.division = '95' and nvl(t2.write_off_flag,'NOT') = 'FULL')
decode(con.contract_number,'HLL23120001','租赁费',decode(t.cf_item,250,'设备款','融资租赁费')) as product_name,
decode(con.division,95,'*经营租赁*',decode(t.cf_item,250,'融资租赁挖掘机','融资租赁费')) as product_name,
decode(con.division,95,'*经营租赁*',decode(t.cf_item,250,'融资租赁挖掘机','融资租赁费')) as product_name_desc,
con.contract_status contract_status,
con.contract_status contract_status,
cf.cf_status cf_status,
cf.cf_status cf_status,
t.invoice_kind_type,
t.invoice_kind_type,
...
@@ -124,8 +126,9 @@
...
@@ -124,8 +126,9 @@
decode(con.division,95,'高空作业平台','') as pur_model,
decode(con.division,95,'高空作业平台','') as pur_model,
decode(con.division,95,'台','') as pur_unit,
decode(con.division,95,'台','') as pur_unit,
con.business_type,
con.business_type,
t.full_elec_invoice_flag,
(select v.code_value_name from sys_code_values_v v where v.code = 'BUSINESS_TYPE' and v.code_value = con.business_type) business_type_desc,
(select v.code_value_name value_name from sys_code_values_v v where v.code = 'YES_NO' and v.code_value = t.full_elec_invoice_flag) full_elec_invoice_flag_n
t.full_elec_invoice_flag,
(select v.code_value_name value_name from sys_code_values_v v where v.code = 'YES_NO' and v.code_value = t.full_elec_invoice_flag) full_elec_invoice_flag_n
ORDER BY t1.invoice_date DESC, t1.document_number DESC) t1 #WHERE_CLAUSE#
ORDER BY t1.invoice_date DESC, t1.document_number DESC) t1 #WHERE_CLAUSE#
ORDER BY invoice_date DESC, document_number DESC
ORDER BY invoice_date DESC, document_number DESC
...
@@ -116,8 +116,10 @@
...
@@ -116,8 +116,10 @@
-->
-->
<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-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-fieldname="query_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_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-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-fieldname="invoice_apply_num"queryExpression="(exists(select 1 from acr_invoice_apply ap, acr_invoice_hd_wfl aw where ap.wfl_apply_status = 'APPROVED' and ap.apply_mode = 'APPLY' and ap.invoice_apply_id = aw.invoice_apply_id and aw.invoice_hd_id = t1.invoice_hd_id and ap.invoice_apply_num=${@invoice_apply_num}) or exists(select ap.invoice_apply_num from acr_invoice_apply ap, acr_invoice_hd_wfl aw where ap.wfl_apply_status = 'APPROVED' and ap.apply_mode = 'REVERSE' and ap.invoice_apply_id = aw.invoice_apply_id and aw.invoice_hd_id = t1.source_invoice_header_id and ap.invoice_apply_num=${@invoice_apply_num}) )"/>
<bm:query-fieldname="invoice_apply_num"queryExpression="(exists(select 1 from acr_invoice_apply ap, acr_invoice_hd_wfl aw where ap.wfl_apply_status = 'APPROVED' and ap.apply_mode = 'APPLY' and ap.invoice_apply_id = aw.invoice_apply_id and aw.invoice_hd_id = t1.invoice_hd_id and ap.invoice_apply_num=${@invoice_apply_num}) or exists(select ap.invoice_apply_num from acr_invoice_apply ap, acr_invoice_hd_wfl aw where ap.wfl_apply_status = 'APPROVED' and ap.apply_mode = 'REVERSE' and ap.invoice_apply_id = aw.invoice_apply_id and aw.invoice_hd_id = t1.source_invoice_header_id and ap.invoice_apply_num=${@invoice_apply_num}) )"/>