Commit b54f4891 authored by stone's avatar stone

[fix]修改应收明细打印

parent 197075b2
......@@ -4,86 +4,197 @@
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select * from (
SELECT cw.times,
cw.due_date,
cw.contract_id,
cw.due_amount,
nvl(cw.vat_due_amount, 0) vat_due_amount,
SELECT *
FROM (SELECT to_char(cw.times) times,
to_char(cw.due_date, 'yyyy-mm-dd') due_date,
to_char(cw.contract_id) contract_id,
cw.due_amount,
nvl(cw.vat_due_amount, 0) vat_due_amount,
--上下端利息
nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 2),
0) up_interest, --上端
nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 1),
0) down_interest, --下端
(SELECT nvl(SUM(cu.interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id) total_interest,
--上下段税利息
nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 2),
0) up_vat_interest, --上端
nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 1),
0) down_vat_interest, --下端
(SELECT nvl(SUM(cu.vat_interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id) total_vat_interest,
--不含税利息
(nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 2),
0) - nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 2),
0)) up_net_interest, --上端
(nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 1),
0) - nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 2),
0)) down_net_interest, --上端
((SELECT nvl(SUM(cu.interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id) -
(SELECT nvl(SUM(cu.vat_interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id)) total_net_interest,
--本期天数
nvl((SELECT cu.weight_factor
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 2),
0) up_weight_factor,
nvl((SELECT cu.weight_factor
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 1),
0) down_weight_factor,
nvl((SELECT cu.total_weight
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.seq_in_period = 1),
0) total_weight_factor
--上下端利息
nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) up_interest, --上端
nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0) down_interest, --下端
(SELECT nvl(SUM(cu.interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id) total_interest,
--上下段税利息
nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) up_vat_interest, --上端
nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0) down_vat_interest, --下端
(SELECT nvl(SUM(cu.vat_interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id) total_vat_interest,
--不含税利息
nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) up_net_interest,
nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0) down_net_interest,
(nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) + nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)
) total_net_interest,
--本期天数
nvl((SELECT cu.weight_factor
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) up_weight_factor,
nvl((SELECT cu.weight_factor
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0) down_weight_factor,
nvl((SELECT cu.total_weight
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0) total_weight_factor
FROM con_contract ct, con_contract_cashflow cw
WHERE ct.contract_id = cw.contract_id
AND cf_item <> 0
AND ct.contract_id = ${/parameter/@contract_id}
UNION ALL
SELECT '' times,
'合计' due_date,
'' contract_id,
nvl(SUM(cw.due_amount), 0) due_amount,
SUM(nvl(cw.vat_due_amount, 0)) vat_due_amount,
--上下端利息
SUM(nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)) up_interest, --上端
SUM(nvl((SELECT cu.interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)) down_interest, --下端
SUM((SELECT nvl(SUM(cu.interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id)) total_interest,
--上下段税利息
SUM(nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)) up_vat_interest, --上端
SUM(nvl((SELECT cu.vat_interest
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)) down_vat_interest, --下端
SUM((SELECT nvl(SUM(cu.vat_interest), 0)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id)) total_vat_interest,
--不含税利息
SUM(nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)) up_net_interest,
SUM(nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)) down_net_interest,
SUM((nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) + nvl((SELECT cu.unearned_finance_income
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)
)) total_net_interest,
--本期天数
SUM(nvl((SELECT cu.weight_factor
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)) up_weight_factor,
SUM(nvl((SELECT cu.weight_factor
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)) down_weight_factor,
SUM(nvl((SELECT cu.total_weight
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)) total_weight_factor
FROM con_contract ct, con_contract_cashflow cw
WHERE ct.contract_id = cw.contract_id
AND cf_item <> 0
AND ct.contract_id = ${/parameter/@contract_id}
) t
ORDER BY to_number(times)
FROM con_contract ct, con_contract_cashflow cw
WHERE ct.contract_id = cw.contract_id
order by times ) t
#WHERE_CLAUSE#
#ORDER_BY_CLAUSE#
......
......@@ -7,7 +7,7 @@
SELECT c.contract_number,
h.bp_name,
--机型
ccli.pattern,
ccli.modelcd pattern,
--合同签订日
to_char(c.inception_of_lease,'yyyy-mm-dd') inception_of_lease,
--c.rate
......@@ -16,8 +16,10 @@
--机号
ccli.machine_number,
c.contract_id,
to_char(c.lease_start_date,'yyyy-mm-dd')lease_start_date
to_char(c.lease_start_date,'yyyy-mm-dd')lease_start_date,
--期间
c.lease_times,
(to_number(c.int_rate_display)*100||'%')int_rate_display
from con_contract c,
hls_bp_master h,
hls_bp_master ch,
......
......@@ -2,7 +2,7 @@
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" xmlns:dr="leaf.plugin.excelreport" trace="true">
<a:init-procedure>
<a:model-query defaultWhereClause="contract_id=${/parameter/@contract_id}" fetchAll="true" model="cont.CON1300.get_contract_print_info" rootPath="/model/head_info"/>
<a:model-query defaultWhereClause="contract_id=${/parameter/@contract_id}" fetchAll="true" model="cont.CON1300.get_contract_print_grid_info" rootPath="/model/grid_data"/>
<a:model-query fetchAll="true" model="cont.CON1300.get_contract_print_grid_info" rootPath="/model/grid_data"/>
<s:server-script><![CDATA[
function getdate() {
var now = new Date()
......@@ -19,16 +19,20 @@
<dr:excel-report enableTask="false" fileName="${/parameter/@file_name}">
<styles>
<dr:cell-style name="title" align="ALIGN_CENTER">
<dr:font fontName="宋体" height="14" italic="false"/>
<dr:font fontName="黑体" height="12" italic="false"/>
</dr:cell-style>
<dr:cell-style name="left" align="ALIGN_LEFT">
<dr:font fontName="宋体" height="12" italic="false"/>
<dr:font fontName="黑体" height="10" italic="false"/>
</dr:cell-style>
<dr:cell-style name="cell_right" align="ALIGN_RIGHT">
<dr:font fontName="宋体" height="12" italic="false"/>
<dr:cell-style name="right" align="ALIGN_RIGHT">
<dr:font fontName="黑体" height="10" italic="false"/>
</dr:cell-style>
<dr:cell-style name="cell_center" align="ALIGN_CENTER" borderbottom="BORDER_THIN" borderleft="BORDER_THIN" borderTop="BORDER_THIN" borderRight="BORDER_THIN">
<dr:font fontName="宋体" height="12" italic="false"/>
<dr:cell-style name="grid_title" align="ALIGN_CENTER" borderbottom="BORDER_THIN" borderleft="BORDER_THIN" borderTop="BORDER_THIN" borderRight="BORDER_THIN">
<dr:font fontName="黑体" height="9" italic="false"/>
</dr:cell-style>
<dr:cell-style name="grid_cell" align="ALIGN_CENTER" borderbottom="BORDER_THIN" borderleft="BORDER_THIN" borderTop="BORDER_THIN" borderRight="BORDER_THIN">
<dr:font fontName="黑体" height="9" italic="false"/>
</dr:cell-style>
<dr:cell-style name="header" align="ALIGN_CENTER">
......@@ -50,48 +54,48 @@
<sheets>
<dr:sheet name="第一页" autoSizeColumns="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20" displayGridlines="true">
<dr:static-content>
<dr:cell-data cell="A" row="1" stylename="right" type="content" value="合同应收明细表"/>
<dr:cell-data cell="A" row="3" stylename="left" type="content" value="代理店:"/>
<dr:cell-data cell="A" row="1" stylename="title" type="content" value="合同应收明细表"/>
<dr:cell-data cell="A" row="3" stylename="right" type="content" value="代理店:"/>
<dr:cell-data cell="B" row="3" stylename="left" type="content" value="${/model/head_info/record/@bp_name}"/>
<dr:cell-data cell="J" row="3" stylename="left" type="content" value="业务伙伴号:"/>
<dr:cell-data cell="L" row="3" stylename="left" type="content" value="${/model/head_info/record/@client_bp_code}"/>
<dr:cell-data cell="A" row="4" stylename="left" type="content" value="合同编号:"/>
<dr:cell-data cell="J" row="3" stylename="right" type="content" value="业务伙伴号:"/>
<dr:cell-data cell="k" row="3" stylename="left" type="content" value="${/model/head_info/record/@client_bp_code}"/>
<dr:cell-data cell="A" row="4" stylename="right" type="content" value="合同编号:"/>
<dr:cell-data cell="B" row="4" stylename="left" type="content" value="${/model/head_info/record/@contract_number}"/>
<dr:cell-data cell="J" row="4" stylename="left" type="content" value="客户名称:"/>
<dr:cell-data cell="L" row="4" stylename="left" type="content" value="${/model/head_info/record/@client_bp_name}"/>
<dr:cell-data cell="J" row="4" stylename="right" type="content" value="客户名称:"/>
<dr:cell-data cell="k" row="4" stylename="left" type="content" value="${/model/head_info/record/@client_bp_name}"/>
<dr:cell-data cell="A" row="5" stylename="left" type="content" value="机型:"/>
<dr:cell-data cell="A" row="5" stylename="right" type="content" value="机型:"/>
<dr:cell-data cell="B" row="5" stylename="left" type="content" value="${/model/head_info/record/@pattern}"/>
<dr:cell-data cell="J" row="5" stylename="left" type="content" value="机号:"/>
<dr:cell-data cell="L" row="5" stylename="left" type="content" value="${/model/head_info/record/@machine_number}"/>
<dr:cell-data cell="J" row="5" stylename="right" type="content" value="机号:"/>
<dr:cell-data cell="k" row="5" stylename="left" type="content" value="${/model/head_info/record/@machine_number}"/>
<dr:cell-data cell="A" row="6" stylename="left" type="content" value="合同签订日:"/>
<dr:cell-data cell="A" row="6" stylename="right" type="content" value="合同签订日:"/>
<dr:cell-data cell="B" row="6" stylename="left" type="content" value="${/model/head_info/record/@inception_of_lease}"/>
<dr:cell-data cell="J" row="6" stylename="left" type="content" value="租赁开始日:"/>
<dr:cell-data cell="L" row="6" stylename="left" type="content" value="${/model/head_info/record/@lease_start_date}"/>
<dr:cell-data cell="J" row="6" stylename="right" type="content" value="租赁开始日:"/>
<dr:cell-data cell="k" row="6" stylename="left" type="content" value="${/model/head_info/record/@lease_start_date}"/>
<dr:cell-data cell="A" row="7" stylename="left" type="content" value="利率:"/>
<dr:cell-data cell="B" row="7" stylename="left" type="content" value="${/model/head_info/record/@inception_of_lease}"/>
<dr:cell-data cell="J" row="7" stylename="left" type="content" value="租赁期间:"/>
<dr:cell-data cell="L" row="7" stylename="left" type="content" value="${/model/head_info/record/@lease_start_date}"/>
<dr:cell-data cell="A" row="7" stylename="right" type="content" value="利率:"/>
<dr:cell-data cell="B" row="7" stylename="left" type="content" value="${/model/head_info/record/@int_rate_display}"/>
<dr:cell-data cell="J" row="7" stylename="right" type="content" value="租赁期间:"/>
<dr:cell-data cell="k" row="7" stylename="left" type="content" value="${/model/head_info/record/@lease_times}"/>
</dr:static-content>
<dr:dynamic-content cell="A" datamodel="/model/grid_data" row="8">
<dr:columns>
<dr:table-column cellStyle="cell_center" column_id="439" field="times" title="期数" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="440" field="due_date" title="预定收款日" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="441" field="due_amount" title="预定收款金额" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="448" field="total_interest" title="利息合计" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="442" field="up_interest" title="利息上端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="443" field="down_interest" title="利息下端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="444" field="total_net_interest" title="利息(不含税)合计" titlestyle="header" type="content" />
<dr:table-column cellStyle="cell_center" column_id="445" field="up_net_interest" title="利息(不含税)上端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="446" field="down_net_interest" title="利息(不含税)下端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="447" field="total_vat_interest" title="利息(增值税)合计" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="447" field="up_vat_interest" title="利息(增值税)上端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="447" field="down_vat_interest" title="利息(增值税)下端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="447" field="total_weight_factor" title="本期天数合计" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="447" field="up_weight_factor" title="本期天数下端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell_center" column_id="447" field="down_weight_factor" title="本期天数下端" titlestyle="header" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="439" field="times" title="期数" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="440" field="due_date" title="预定收款日" type="content" groupDesc="计数" />
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="441" field="due_amount" title="预定收款金额" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="448" field="total_interest" title="利息合计" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="442" field="up_interest" title="利息上段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="443" field="down_interest" title="利息下段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="444" field="total_net_interest" title="利息(不含税)合计" type="content" />
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="445" field="up_net_interest" title="利息(不含税)上段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="446" field="down_net_interest" title="利息(不含税)下段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="447" field="total_vat_interest" title="利息(增值税)合计" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="447" field="up_vat_interest" title="利息(增值税)上段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="447" field="down_vat_interest" title="利息(增值税)下段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="447" field="total_weight_factor" title="本期天数合计" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="447" field="up_weight_factor" title="本期天数上段" type="content"/>
<dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="447" field="down_weight_factor" title="本期天数下段" type="content"/>
</dr:columns>
</dr:dynamic-content>
</dr:sheet>
......
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