Commit 270de4b9 authored by lizhe's avatar lizhe

database中回租本金都改成0

parent 3524fa8b
......@@ -878,35 +878,89 @@ SELECT h.period_year,
#WHERE_CLAUSE#
)
select * from (
select '合计' tax_month,
sum(sale_amount) sale_amount,
1 order_seq,
null period_year,
null period_num,
null internal_period_num,
null journal_date,
null journal_num,
null reference2,
null line_description,
null journal_number,
null contract_number,
null bp_code,
null bp_name,
null journal_header_id,
null invoice_date,
sum(amount_tax) amount_tax,
null times,
null due_date,
sum(due_amount) due_amount,
sum(principal) principal,
sum(interest) interest,
sum(vat_due_amount) vat_due_amount,
null vat_rate,
null je_transaction_code,
null cashflow_id,
null fixed_data_flag from temp
select '合计' tax_month,
sum(sale_amount) sale_amount,
1 order_seq,
null period_year,
null period_num,
null internal_period_num,
null journal_date,
null journal_num,
null reference2,
null line_description,
null journal_number,
null contract_number,
null bp_code,
null bp_name,
null journal_header_id,
null invoice_date,
sum(amount_tax) amount_tax,
null times,
null due_date,
sum(decode((select cc.business_type
from con_contract_cashflow ca, con_contract cc
where ca.cashflow_id = t.cashflow_id
and ca.contract_id = cc.contract_id),
'LEASEBACK',
due_amount -nvl(t.principal,0),
t.due_amount)) due_amount,
sum(decode((select cc.business_type
from con_contract_cashflow ca, con_contract cc
where ca.cashflow_id = t.cashflow_id
and ca.contract_id = cc.contract_id),
'LEASEBACK',
0,
t.principal)) principal,
sum(interest) interest,
sum(vat_due_amount) vat_due_amount,
null vat_rate,
null je_transaction_code,
null cashflow_id,
null fixed_data_flag
from temp t
union
select * from temp) data order by data.order_seq
select tax_month,
sale_amount,
order_seq,
period_year,
period_num,
internal_period_num,
journal_date,
journal_num,
reference2,
line_description,
journal_number,
contract_number,
bp_code,
bp_name,
journal_header_id,
invoice_date,
amount_tax,
times,
due_date,
decode((select cc.business_type
from con_contract_cashflow ca, con_contract cc
where ca.cashflow_id = t.cashflow_id
and ca.contract_id = cc.contract_id),
'LEASEBACK',
due_amount -nvl(t.principal,0),
t.due_amount) due_amount,
decode((select cc.business_type
from con_contract_cashflow ca, con_contract cc
where ca.cashflow_id = t.cashflow_id
and ca.contract_id = cc.contract_id),
'LEASEBACK',
0,
t.principal) principal,
interest,
vat_due_amount,
vat_rate,
je_transaction_code,
cashflow_id,
fixed_data_flag
from temp t
) data order by data.order_seq
]]></bm:query-sql>
</bm:operation>
</bm:operations>
......
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