Commit 99b1b7d6 authored by lizhe's avatar lizhe

database修改

parent d05524c1
......@@ -214,7 +214,7 @@ SELECT to_char(add_months(trunc(t1.journal_date, 'Q'), 2), 'yyyymm') tax_month,
and exists (select 1
from gld_accounts g
where g.account_id = d.account_id
and g.account_code in ('6041001000'))
and g.account_code in ('6041001000','6041001100'))
and rownum = 1)
when ghd.je_template_code in ('HL_REPURCHASE_VAT') then
(select -1 * round(cc.ccr_due_amount -
......@@ -257,7 +257,7 @@ SELECT to_char(add_months(trunc(t1.journal_date, 'Q'), 2), 'yyyymm') tax_month,
and exists (select 1
from gld_accounts g
where g.account_id = d.account_id
and g.account_code in ('6041001000'))
and g.account_code in ('6041001000','6041001100'))
and rownum = 1)
when ghd.je_template_code in ('HL_REPURCHASE_VAT') then
(select -1 * round(cc.ccr_due_amount -
......@@ -596,12 +596,22 @@ SELECT h.period_year,
-- 'HL_CON_CHANGE_REPURCHASE_VAT',
-- to_number(l.reference7),
-- l.amount_cr) due_amount,
to_number(l.reference7) due_amount,
to_number(l.reference7)-
(select nvl(sum(cw.write_off_due_amount), 0)
from csh_write_off cw, con_contract cc
where cw.cashflow_id = l.cashflow_id
and cw.contract_id = cc.contract_id
and cw.write_off_date < cc.repurchase_date) due_amount,
-- decode(hd.je_template_code,
-- 'HL_CON_CHANGE_REPURCHASE_VAT',
-- to_number(l.reference7),
-- l.amount_cr) principal,
to_number(l.reference7) principal,
to_number(l.reference7)-
(select nvl(sum(cw.write_off_due_amount), 0)
from csh_write_off cw, con_contract cc
where cw.cashflow_id = l.cashflow_id
and cw.contract_id = cc.contract_id
and cw.write_off_date < cc.repurchase_date) principal,
0 interest,
l.amount_cr vat_due_amount,
case
......@@ -770,7 +780,15 @@ SELECT h.period_year,
nvl(ccc.interest, 0)
when ccc.cf_item = 1 and
cc.business_type != 'LEASEBACK' then
decode(hd.je_template_code,'HL_REPURCHASE_VAT_REVERSE',
ccc.due_amount
- (select nvl(sum(cw.write_off_due_amount), 0)
from csh_write_off cw, con_contract cc
where cw.cashflow_id = l.cashflow_id
and cw.contract_id = cc.contract_id
and cw.write_off_date < cc.repurchase_date),
ccc.due_amount
)
else
ccc.due_amount
end
......@@ -783,7 +801,15 @@ SELECT h.period_year,
0
when ccc.cf_item = 1 and
cc.business_type != 'LEASEBACK' then
decode(hd.je_template_code,'HL_REPURCHASE_VAT_REVERSE',
nvl(ccc.principal, 0)
- (select nvl(sum(cw.write_off_principal), 0)
from csh_write_off cw, con_contract cc
where cw.cashflow_id = l.cashflow_id
and cw.contract_id = cc.contract_id
and cw.write_off_date < cc.repurchase_date),
nvl(ccc.principal, 0)
)
else
ccc.principal
......@@ -793,8 +819,16 @@ SELECT h.period_year,
and ccc.contract_id = cc.contract_id) principal,
-1 * (select case
when ccc.cf_item = 1 then
nvl(ccc.interest, 0)
decode(hd.je_template_code,'HL_REPURCHASE_VAT_REVERSE',
nvl(ccc.interest, 0)
- (select nvl(sum(cw.write_off_interest), 0)
from csh_write_off cw, con_contract cc
where cw.cashflow_id = l.cashflow_id
and cw.contract_id = cc.contract_id
and cw.write_off_date < cc.repurchase_date),
nvl(ccc.interest, 0)
)
else
ccc.due_amount
end
......@@ -826,7 +860,7 @@ SELECT h.period_year,
h.je_transaction_code,
l.cashflow_id,
'Y' fixed_data_flag
FROM hls_journal_header h, hls_journal_detail l, gld_accounts ga
FROM hls_journal_header h, hls_journal_detail l, gld_accounts ga,gld_je_template_hds hd
WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
and h.total_amount_dr != 0
......@@ -834,15 +868,13 @@ SELECT h.period_year,
and ga.account_code in ('2221001020', '2221001023', '2221001024')
and h.reversed_flag = 'N' and h.post_gl_status = 'Y'
and h.internal_period_num <= to_number(${@base_period})
and exists (select 1
from gld_je_template_hds hd
where hd.je_template_hd_id = h.je_template_hd_id
and hd.je_template_hd_id = h.je_template_hd_id
and hd.je_template_code in
('HL_CON_VAT_REVERSE_REPURCHASE',
'HL_VAT_REVERSE_REPURCHASE_LB',
'HL_CON_VAT_REVERSE_ET',
'HL_CON_VAT_REVERSE_ET_LB',
'HL_REPURCHASE_VAT_REVERSE'))) t1
'HL_REPURCHASE_VAT_REVERSE')) t1
#WHERE_CLAUSE#
)
select * from (
......
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