Commit f7f8c93a authored by 王炜's avatar 王炜

增值税台账-追加回购凭证

parent a6162774
......@@ -776,7 +776,68 @@ where 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')
)
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,
null invoice_date,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') amount_tax,
(select
to_char(ccc.times)
from
con_contract_cashflow ccc where
ccc.cashflow_id=l.cashflow_id) times,
h.journal_date due_date,
to_number(l.reference7) due_amount,
null principal,
to_number(l.reference7) interest,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_due_amount,
(select
cc.vat_rate_of_interest
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_rate,
h.je_transaction_code,
l.cashflow_id
FROM hls_journal_header h, hls_journal_detail l,gld_accounts ga
WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
and h.total_amount_dr!=0
and ga.account_id=l.account_id
and ga.account_code in('2221001020','2221001023','2221001024')
and h.reversed_flag='N'
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_code='HL_REPURCHASE_INTEREST_REVERSE')
and l.reference6 is not null
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 hi.invoice_status='CONFIRM'
AND to_char(hi.invoice_date,'yyyymm') < =${@base_period}
and li.cashflow_id=l.cashflow_id )
) t1
#WHERE_CLAUSE#
]]></bm:query-sql>
......
......@@ -874,7 +874,72 @@ SELECT h.period_year,
'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')
union
SELECT h.period_year,
h.period_num,
h.internal_period_num,
h.journal_date,
h.sbo_num journal_num,
l.reference2,
l.line_description,
h.journal_num journal_number,
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,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') amount_tax,
(select
to_char(ccc.times)
from
con_contract_cashflow ccc where
ccc.cashflow_id=l.cashflow_id) times,
h.journal_date due_date,
to_number(l.reference7) due_amount,
null principal,
to_number(l.reference7) interest,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_due_amount,
(select
cc.vat_rate_of_interest
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_rate,
h.je_transaction_code,
l.cashflow_id,
'Y' fixed_data_flag
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
and ga.account_id = l.account_id
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 hd.je_template_hd_id = h.je_template_hd_id
and hd.je_template_code='HL_REPURCHASE_INTEREST_REVERSE'
and l.reference6 is not null
) t1
#WHERE_CLAUSE#
)
select * from (
......@@ -965,7 +1030,7 @@ select tax_month,
</bm:operation>
</bm:operations>
<bm:data-filters>
<!-- <bm:data-filter enforceOperations="query" expression="(t1.amount_tax > 0 or t1.fixed_data_flag='Y')"/>-->
<!-- <bm:data-filter enforceOperations="query" expression="(t1.amount_tax > 0 or t1.fixed_data_flag='Y')"/>-->
<bm:data-filter enforceOperations="query" expression="(exists(select 1 from con_contract cc where cc.contract_number=t1.contract_number and cc.contract_status!='CANCEL' and cc.data_class='NORMAL') or t1.fixed_data_flag='Y')"/>
</bm:data-filters>
<bm:query-fields>
......
......@@ -860,6 +860,69 @@ where 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')
)
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,
null invoice_date,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') amount_tax,
(select
to_char(ccc.times)
from
con_contract_cashflow ccc where
ccc.cashflow_id=l.cashflow_id) times,
h.journal_date due_date,
to_number(l.reference7) due_amount,
null principal,
to_number(l.reference7) interest,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_due_amount,
(select
cc.vat_rate_of_interest
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_rate,
h.je_transaction_code,
l.cashflow_id,
'Y' fixed_data_flag
FROM hls_journal_header h, hls_journal_detail l,gld_accounts ga
WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
and h.total_amount_dr!=0
and ga.account_id=l.account_id
and ga.account_code in('2221001020','2221001023','2221001024')
and h.reversed_flag='N'
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_code='HL_REPURCHASE_INTEREST_REVERSE')
and l.reference6 is not null
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 hi.invoice_status='CONFIRM'
AND to_char(hi.invoice_date,'yyyymm') <= ${@base_period}
and li.cashflow_id=l.cashflow_id )
) t1
#WHERE_CLAUSE#
]]></bm:query-sql>
......
......@@ -781,7 +781,69 @@ where 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')
)
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,
null invoice_date,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') amount_tax,
(select
to_char(ccc.times)
from
con_contract_cashflow ccc where
ccc.cashflow_id=l.cashflow_id) times,
h.journal_date due_date,
to_number(l.reference7) due_amount,
null principal,
to_number(l.reference7) interest,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_due_amount,
(select
cc.vat_rate_of_interest
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_rate,
h.je_transaction_code,
l.cashflow_id
FROM hls_journal_header h, hls_journal_detail l,gld_accounts ga
WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
and h.total_amount_dr!=0
and ga.account_id=l.account_id
and ga.account_code in('2221001020','2221001023','2221001024')
and h.reversed_flag='N'
and h.internal_period_num<=to_number(${@end_period})
and h.internal_period_num>=to_number(${@start_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_code='HL_REPURCHASE_INTEREST_REVERSE')
and l.reference6 is not null
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 hi.invoice_status='CONFIRM'
AND to_char(hi.invoice_date,'yyyymm') < =${@end_period}
and li.cashflow_id=l.cashflow_id )
) t1
#WHERE_CLAUSE#
]]></bm:query-sql>
......
......@@ -857,6 +857,69 @@ where 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')
)
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,
null invoice_date,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') amount_tax,
(select
to_char(ccc.times)
from
con_contract_cashflow ccc where
ccc.cashflow_id=l.cashflow_id) times,
h.journal_date due_date,
to_number(l.reference7) due_amount,
null principal,
to_number(l.reference7) interest,
(select
round(l.reference7/(1+cc.vat_rate_of_interest)*cc.vat_rate_of_interest,2)
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_due_amount,
(select
cc.vat_rate_of_interest
from
con_contract cc where
cc.contract_number=l.reference3
and cc.data_class='NORMAL') vat_rate,
h.je_transaction_code,
l.cashflow_id,
'Y' fixed_data_flag
FROM hls_journal_header h, hls_journal_detail l,gld_accounts ga
WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
and h.total_amount_dr!=0
and ga.account_id=l.account_id
and ga.account_code in('2221001020','2221001023','2221001024')
and h.reversed_flag='N'
and h.internal_period_num <to_number(${@start_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_code='HL_REPURCHASE_INTEREST_REVERSE')
and l.reference6 is not null
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 hi.invoice_status='CONFIRM'
AND to_char(hi.invoice_date,'yyyymm') <= ${@end_period}
and li.cashflow_id=l.cashflow_id )
) t1
#WHERE_CLAUSE#
]]></bm:query-sql>
......
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