Commit baca385d authored by 王炜's avatar 王炜

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

parent d3a1136d
......@@ -453,7 +453,7 @@ SELECT h.period_year,
0
end
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,
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
......@@ -463,7 +463,9 @@ SELECT h.period_year,
AND to_char(ah.invoice_date,'yyyymm') <= ${@base_period}
and ah.invoice_status = 'CONFIRM'),0) vat_due_amount,
(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)
else
null
......@@ -487,7 +489,13 @@ SELECT h.period_year,
('HL_CON_TAX_ET',
'HL_CON_TAX_ET_N',
'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'))))
union
......@@ -560,7 +568,9 @@ SELECT h.period_year,
'HL_FIN_INCOME_REPURCHASE_N',
'HL_FIN_INCOME_REPURCHASE_ET',
'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'))))
union
......
......@@ -487,7 +487,7 @@ SELECT h.period_year,
0
end
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,
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
......@@ -497,7 +497,9 @@ SELECT h.period_year,
AND to_char(ah.invoice_date,'yyyymm') <= ${@base_period}
and ah.invoice_status = 'CONFIRM'),0) vat_due_amount,
(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)
else
null
......@@ -522,7 +524,13 @@ SELECT h.period_year,
('HL_CON_TAX_ET',
'HL_CON_TAX_ET_N',
'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 ( not EXISTS (SELECT 1
FROM acr_invoice_hd hi, acr_invoice_ln li
......@@ -607,7 +615,9 @@ SELECT h.period_year,
'HL_FIN_INCOME_REPURCHASE_N',
'HL_FIN_INCOME_REPURCHASE_ET',
'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 not EXISTS (SELECT 1
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