Commit 2b853576 authored by 王炜's avatar 王炜

增值税台账修复

parent 8adc6930
......@@ -320,6 +320,11 @@ SELECT h.period_year,
where g.account_id = d.account_id
and g.account_code in ('6041001000'))
and rownum = 1)
when ghd.je_template_code in('HL_REPURCHASE_VAT') then
(select -1*round(cc.ccr_due_amount-cc.ccr_due_amount/(1+DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13))*DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13),2)
from con_contract cc
WHERE cc.contract_number = l.reference3
and cc.data_class = 'NORMAL')
else
(select nvl(d.amount_dr,d.amount_cr)
from hls_journal_detail d
......@@ -344,6 +349,11 @@ SELECT h.period_year,
where g.account_id = d.account_id
and g.account_code in ('6041001000'))
and rownum = 1)
when ghd.je_template_code in('HL_REPURCHASE_VAT') then
(select -1*round(cc.ccr_due_amount-cc.ccr_due_amount/(1+DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13))*DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13),2)
from con_contract cc
WHERE cc.contract_number = l.reference3
and cc.data_class = 'NORMAL')
else
(select nvl(d.amount_dr,d.amount_cr)
from hls_journal_detail d
......@@ -387,6 +397,7 @@ SELECT h.period_year,
'HL_CSH_CONSOLIDATION_DALAY' or
ghd.je_template_code in
('HL_GLD_BALANCE_REPURCHASE','HL_GLD_BALANCE_REPURCHASE_LB','HL_RECEIVABLES_AGENT_REPUR_LB','HL_RECEIVABLES_AGENT_REPUR','HL_GLD_BALANCE_PENALTY','HL_PENALTY_R_ET','HL_PENALTY_R_ET_LB')
or( ghd.je_template_code in('HL_REPURCHASE_VAT') and l.line_description like '%违约金销项税' )
)
and not exists (SELECT 1
FROM acr_invoice_hd hi, acr_invoice_ln li
......
......@@ -348,6 +348,12 @@ SELECT h.period_year,
where g.account_id = d.account_id
and g.account_code in ('6041001000'))
and rownum = 1)
when ghd.je_template_code in('HL_REPURCHASE_VAT') then
(select
-1*round(cc.ccr_due_amount-cc.ccr_due_amount/(1+DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13))*DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13),2)
from con_contract cc
WHERE cc.contract_number = l.reference3
and cc.data_class = 'NORMAL')
else
(select nvl(d.amount_dr,d.amount_cr)
from hls_journal_detail d
......@@ -372,6 +378,11 @@ SELECT h.period_year,
where g.account_id = d.account_id
and g.account_code in ('6041001000'))
and rownum = 1)
when ghd.je_template_code in('HL_REPURCHASE_VAT') then
(select -1*round(cc.ccr_due_amount-cc.ccr_due_amount/(1+DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13))*DECODE(CC.BUSINESS_TYPE, 'LEASEBACK', 0.06, 0.13),2)
from con_contract cc
WHERE cc.contract_number = l.reference3
and cc.data_class = 'NORMAL')
else
(select nvl(d.amount_dr,d.amount_cr)
from hls_journal_detail d
......@@ -402,7 +413,11 @@ SELECT h.period_year,
and cc.data_class = 'NORMAL') vat_rate,
h.je_transaction_code,
l.cashflow_id,
'N' fixed_data_flag
case when ghd.je_template_code in('HL_REPURCHASE_VAT') then
'Y'
else
'N'
end fixed_data_flag
FROM hls_journal_header h, hls_journal_detail l, gld_accounts ga,gld_je_template_hds ghd
WHERE h.journal_header_id = l.journal_header_id
and h.je_template_hd_id=ghd.je_template_hd_id
......@@ -416,6 +431,7 @@ SELECT h.period_year,
'HL_CSH_CONSOLIDATION_DALAY' or
ghd.je_template_code in
('HL_GLD_BALANCE_REPURCHASE','HL_GLD_BALANCE_REPURCHASE_LB','HL_RECEIVABLES_AGENT_REPUR_LB','HL_RECEIVABLES_AGENT_REPUR','HL_GLD_BALANCE_PENALTY','HL_PENALTY_R_ET','HL_PENALTY_R_ET_LB')
or( ghd.je_template_code in('HL_REPURCHASE_VAT') and l.line_description like '%违约金销项税' )
)
and ((trunc(h.journal_date) <=
trunc(to_date('2020-01-31', 'yyyy-mm-dd')) and
......
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