Commit 58590fd3 authored by 王炜's avatar 王炜

增值税台账修复-提前结清凭证

parent 629d1a36
...@@ -464,7 +464,7 @@ SELECT h.period_year, ...@@ -464,7 +464,7 @@ SELECT h.period_year,
0 0
end end
from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) principal, from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) principal,
(select decode(ccc.cf_item,'200',0,ccc.due_amount) (select decode(ccc.cf_item,'200',ccc.interest,ccc.due_amount)
from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) interest, from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) interest,
l.amount_cr-nvl((select sum(al.tax_amount) from acr_invoice_hd ah,acr_invoice_ln al where l.amount_cr-nvl((select sum(al.tax_amount) from acr_invoice_hd ah,acr_invoice_ln al where
ah.invoice_hd_id=al.invoice_hd_id ah.invoice_hd_id=al.invoice_hd_id
...@@ -474,7 +474,9 @@ SELECT h.period_year, ...@@ -474,7 +474,9 @@ SELECT h.period_year,
AND to_char(ah.invoice_date,'yyyymm') <= ${@base_period} AND to_char(ah.invoice_date,'yyyymm') <= ${@base_period}
and ah.invoice_status = 'CONFIRM'),0) vat_due_amount, and ah.invoice_status = 'CONFIRM'),0) vat_due_amount,
(select (select
case when nvl(ccc.due_amount-ccc.vat_due_amount,0)!=0 then case when nvl(ccc.interest,0)!=0 then
round(ccc.vat_interest/ccc.interest,2)
when nvl(ccc.due_amount-ccc.vat_due_amount,0)!=0 then
round(ccc.vat_due_amount/(ccc.due_amount-ccc.vat_due_amount),2) round(ccc.vat_due_amount/(ccc.due_amount-ccc.vat_due_amount),2)
else else
null null
...@@ -498,7 +500,13 @@ SELECT h.period_year, ...@@ -498,7 +500,13 @@ SELECT h.period_year,
('HL_CON_TAX_ET', ('HL_CON_TAX_ET',
'HL_CON_TAX_ET_N', 'HL_CON_TAX_ET_N',
'HL_CON_FIN_ETFEE', 'HL_CON_FIN_ETFEE',
'HL_CON_FIN_ETFEE_N')) 'HL_CON_FIN_ETFEE_N',
'HL_CON_ETREPUR_TAX',
'HL_CON_ETREPUR_TAX_LB',
'HL_CON_ETFEE',
'HL_CON_ETFEE_LB',
'HL_CON_ET_TAX',
'HL_CON_ET_TAX_LB'))
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'))))
union union
...@@ -571,7 +579,9 @@ SELECT h.period_year, ...@@ -571,7 +579,9 @@ SELECT h.period_year,
'HL_FIN_INCOME_REPURCHASE_N', 'HL_FIN_INCOME_REPURCHASE_N',
'HL_FIN_INCOME_REPURCHASE_ET', 'HL_FIN_INCOME_REPURCHASE_ET',
'HL_CON_FIN_ETREPUR_INT', 'HL_CON_FIN_ETREPUR_INT',
'HL_CON_FIN_ETREPUR_INT_N')) 'HL_CON_FIN_ETREPUR_INT_N',
'HL_CON_ETREPUR_FEE',
'HL_CON_ETREPUR_FEE_LB'))
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'))))
union union
......
...@@ -503,7 +503,7 @@ SELECT h.period_year, ...@@ -503,7 +503,7 @@ SELECT h.period_year,
0 0
end end
from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) principal, from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) principal,
(select decode(ccc.cf_item,'200',0,ccc.due_amount) (select decode(ccc.cf_item,'200',ccc.interest,ccc.due_amount)
from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) interest, from con_contract_cashflow ccc where ccc.cashflow_id=l.cashflow_id) interest,
l.amount_cr-nvl((select sum(al.tax_amount) from acr_invoice_hd ah,acr_invoice_ln al where l.amount_cr-nvl((select sum(al.tax_amount) from acr_invoice_hd ah,acr_invoice_ln al where
ah.invoice_hd_id=al.invoice_hd_id ah.invoice_hd_id=al.invoice_hd_id
...@@ -513,7 +513,9 @@ SELECT h.period_year, ...@@ -513,7 +513,9 @@ SELECT h.period_year,
AND to_char(ah.invoice_date,'yyyymm') <= ${@base_period} AND to_char(ah.invoice_date,'yyyymm') <= ${@base_period}
and ah.invoice_status = 'CONFIRM'),0) vat_due_amount, and ah.invoice_status = 'CONFIRM'),0) vat_due_amount,
(select (select
case when nvl(ccc.due_amount-ccc.vat_due_amount,0)!=0 then case when nvl(ccc.interest,0)!=0 then
round(ccc.vat_interest/ccc.interest,2)
when nvl(ccc.due_amount-ccc.vat_due_amount,0)!=0 then
round(ccc.vat_due_amount/(ccc.due_amount-ccc.vat_due_amount),2) round(ccc.vat_due_amount/(ccc.due_amount-ccc.vat_due_amount),2)
else else
null null
...@@ -538,7 +540,13 @@ SELECT h.period_year, ...@@ -538,7 +540,13 @@ SELECT h.period_year,
('HL_CON_TAX_ET', ('HL_CON_TAX_ET',
'HL_CON_TAX_ET_N', 'HL_CON_TAX_ET_N',
'HL_CON_FIN_ETFEE', 'HL_CON_FIN_ETFEE',
'HL_CON_FIN_ETFEE_N')) 'HL_CON_FIN_ETFEE_N',
'HL_CON_ETREPUR_TAX',
'HL_CON_ETREPUR_TAX_LB',
'HL_CON_ETFEE',
'HL_CON_ETFEE_LB',
'HL_CON_ET_TAX',
'HL_CON_ET_TAX_LB'))
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
...@@ -623,7 +631,9 @@ SELECT h.period_year, ...@@ -623,7 +631,9 @@ SELECT h.period_year,
'HL_FIN_INCOME_REPURCHASE_N', 'HL_FIN_INCOME_REPURCHASE_N',
'HL_FIN_INCOME_REPURCHASE_ET', 'HL_FIN_INCOME_REPURCHASE_ET',
'HL_CON_FIN_ETREPUR_INT', 'HL_CON_FIN_ETREPUR_INT',
'HL_CON_FIN_ETREPUR_INT_N')) 'HL_CON_FIN_ETREPUR_INT_N',
'HL_CON_ETREPUR_FEE',
'HL_CON_ETREPUR_FEE_LB'))
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
......
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