Commit ccef17b5 authored by stone's avatar stone

【feat】增值税台账功能修改

parent 9d929793
...@@ -58,8 +58,7 @@ SELECT h.period_year, ...@@ -58,8 +58,7 @@ SELECT h.period_year,
WHERE cashflow_id = l.cashflow_id)) due_date, WHERE cashflow_id = l.cashflow_id)) due_date,
DECODE(h.je_transaction_code, DECODE(h.je_transaction_code,
'HL_CSH_CONSOLIDATION_DALAY', 'HL_CSH_CONSOLIDATION_DALAY',
SUM(decode(reference6, NULL, l.amount_dr, 0)), SUM(decode(reference6, NULL, nvl(l.amount_dr,0), 0)),
'HL_SALES_TAX_ACT_NEW',
(SELECT due_amount (SELECT due_amount
FROM con_contract_cashflow FROM con_contract_cashflow
WHERE cashflow_id = l.cashflow_id)) due_amount, WHERE cashflow_id = l.cashflow_id)) due_amount,
...@@ -109,14 +108,13 @@ SELECT h.period_year, ...@@ -109,14 +108,13 @@ SELECT h.period_year,
FROM hls_journal_header h, hls_journal_detail l FROM hls_journal_header h, hls_journal_detail l
WHERE h.journal_header_id = l.journal_header_id WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null and h.sbo_num is not null
AND h.je_transaction_code IN AND h.je_transaction_code ='HL_SALES_TAX_ACT_NEW'
('HL_SALES_TAX_ACT_NEW', 'HL_CSH_CONSOLIDATION_DALAY')
and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd')))) and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd'))))
AND not EXISTS (SELECT 1 AND not EXISTS (SELECT 1
FROM acr_invoice_hd hi, acr_invoice_ln li FROM acr_invoice_hd hi, acr_invoice_ln li
WHERE hi.invoice_hd_id = li.invoice_hd_id WHERE hi.invoice_hd_id = li.invoice_hd_id
AND hi.vat_interface_status = 'BACK' AND hi.vat_interface_status = 'BACK'
AND to_char(hi.invoice_date,'yyyymm') <= ${@base_period} AND to_char(hi.invoice_date,'yyyymm') < ${@base_period}
AND (li.cashflow_id = l.cashflow_id OR AND (li.cashflow_id = l.cashflow_id OR
li.ref_n04 = l.journal_line_id)) li.ref_n04 = l.journal_line_id))
GROUP BY l.reference1, GROUP BY l.reference1,
...@@ -216,7 +214,64 @@ SELECT h.period_year, ...@@ -216,7 +214,64 @@ SELECT h.period_year,
AND hi.vat_interface_status = 'BACK' AND hi.vat_interface_status = 'BACK'
AND to_char(hi.invoice_date,'yyyymm') <= ${@base_period} AND to_char(hi.invoice_date,'yyyymm') <= ${@base_period}
AND ((hi.contract_id = l.source_doc_id AND li.cf_item IN (2)))) AND ((hi.contract_id = l.source_doc_id AND li.cf_item IN (2))))
) t1
union
SELECT h.period_year,
h.period_num,
h.internal_period_num,
h.journal_date,
h.sbo_num journal_num,
reference3 contract_number,
reference1 bp_code,
(SELECT BP_NAME
FROM hls_bp_master
WHERE bp_code = reference1
AND ROWNUM = 1) bp_name,
l.journal_header_id,
(SELECT hi.invoice_date
FROM acr_invoice_hd hi, acr_invoice_ln li
WHERE hi.invoice_hd_id = li.invoice_hd_id
AND hi.reversed_flag = 'N'
AND (li.cashflow_id = l.cashflow_id OR
li.ref_n03 = l.journal_header_id)
AND ROWNUM = 1) invoice_date,
SUM(calc_tax_amount(l.amount_dr)) amount_tax,
'违约金' times,
h.journal_date due_date,
SUM(l.amount_dr) due_amount,
NULL principal,
SUM(l.amount_dr) interest,
SUM(calc_tax_amount(l.amount_dr)) vat_due_amount,
nvl(ROUND( SUM(calc_tax_amount(l.amount_dr))/
(SUM(amount_dr) -SUM(calc_tax_amount(l.amount_dr))
),
2) * 100,
0) || '%' vat_rate,
h.je_transaction_code
FROM hls_journal_header h, hls_journal_detail l
WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
AND h.je_transaction_code ='HL_CSH_CONSOLIDATION_DALAY'
AND l.amount_dr IS NOT NULL
and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd'))))
AND not EXISTS (SELECT 1
FROM acr_invoice_hd hi, acr_invoice_ln li
WHERE hi.invoice_hd_id = li.invoice_hd_id
AND hi.vat_interface_status = 'BACK'
AND to_char(hi.invoice_date,'yyyymm') < ${@base_period}
AND li.ref_n04 = l.journal_line_id)
GROUP BY l.reference1,
reference3,
reference4,
h.sbo_num,
l.cashflow_id,
l.journal_header_id,
h.je_transaction_code,
h.period_year,
h.period_num,
h.internal_period_num,
h.journal_date
) t1
#WHERE_CLAUSE# #WHERE_CLAUSE#
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
select * from ( select * from (
SELECT t.contract_id, SELECT t.contract_id,
t.invoice_hd_id, t.invoice_hd_id,
t.invoice_line_id,
(SELECT v.code_value_name (SELECT v.code_value_name
FROM sys_code_values_v v FROM sys_code_values_v v
WHERE v.code = 'ACR510_INVOICE_KIND' WHERE v.code = 'ACR510_INVOICE_KIND'
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
WHERE t.session_id=${/session/@session_id} WHERE t.session_id=${/session/@session_id}
) t1 ) t1
#WHERE_CLAUSE# #WHERE_CLAUSE#
order by invoice_hd_id order by invoice_hd_id,due_date ASC,invoice_line_id asc
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
<bm:operation name="update"> <bm:operation name="update">
......
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