Commit 86e988bc authored by Spencer Chang's avatar Spencer Chang

[feat] 新增保证金-代垫清单功能

parent eaf7429f
create or replace package cus_con_deposit_pkg is
-- Author : Spencer 3893
-- Created : 2019/10/14 20:51:45
-- Purpose : 保证金
--罚息测算
procedure calc_overdue_dayend(p_calc_date date,
p_session_id number,
p_user_id number);
end cus_con_deposit_pkg;
/
create or replace package body cus_con_deposit_pkg is
g_currency_precision constant number := 2;
procedure log(p_log_desc varchar2, p_error_message varchar2) is
begin
hls_dayend_pkg.log(p_log_desc => p_log_desc,
p_error_message => p_error_message);
end;
procedure f_calc_penalty(p_calc_amount number,
p_contract_rec con_contract%rowtype,
p_calc_date date,
p_penalty_calc_date date,
p_user_id number,
p_total_penalty_amt out number) is
v_penalty_days number;
v_penalty_amt number;
v_total_penalty_amt number := 0;
begin
v_penalty_days := trunc(p_calc_date) - trunc(p_penalty_calc_date) -
nvl(p_contract_rec.grace_period, 0);
-- 未核销金额 * 延迟天数 * 延迟履行金率
if v_penalty_days <= 0 then
v_penalty_amt := 0;
else
v_penalty_days := v_penalty_days +
nvl(p_contract_rec.grace_period, 0);
v_penalty_amt := p_calc_amount * (v_penalty_days) *
p_contract_rec.penalty_rate;
end if;
/*log(p_log_desc => '未收金额'||to_char(p_cashflow_rec.due_amount - nvl(p_cashflow_rec.received_amount,0)),
p_error_message => '延迟天数='||v_penalty_days||',延迟金'||v_penalty_amt);
*/
v_total_penalty_amt := v_total_penalty_amt + v_penalty_amt;
p_total_penalty_amt := round(v_total_penalty_amt,
nvl(p_contract_rec.currency_precision,
g_currency_precision));
end;
procedure calc_penalty(p_cashflow_rec con_contract_cashflow%rowtype,
p_contract_rec con_contract%rowtype,
p_calc_date date,
p_user_id number,
p_total_penalty_amt out number) is
v_penalty_days number;
v_penalty_amt number;
v_total_penalty_amt number := 0;
v_last_creation_date date;
begin
select trunc(max(a.penalty_calc_date))
into v_last_creation_date
from csh_write_off a
where a.cashflow_id = p_cashflow_rec.cashflow_id;
--modify by wcs
if not (p_cashflow_rec.penalty_process_status = 'NORMAL') then
--不满足计算条件
return;
end if;
--已收部分
for c_write_off in (select a.*
from csh_write_off a
where a.contract_id = p_contract_rec.contract_id
and a.cashflow_id = p_cashflow_rec.cashflow_id
and trunc(a.penalty_calc_date) <=
trunc(p_calc_date)
order by a.penalty_calc_date, a.write_off_date) loop
--核销金额 * 延迟天数 * 延迟履行金率
v_penalty_days := trunc(c_write_off.penalty_calc_date) -
trunc(nvl(p_cashflow_rec.ln_user_col_d01,
p_cashflow_rec.due_date)) -
nvl(p_contract_rec.grace_period, 0);
if v_penalty_days <= 0 then
v_penalty_amt := 0;
else
v_penalty_days := v_penalty_days +
nvl(p_contract_rec.grace_period, 0);
v_penalty_amt := c_write_off.write_off_due_amount * v_penalty_days *
p_contract_rec.penalty_rate;
end if;
/*log(p_log_desc => to_char(c_write_off.penalty_calc_date,'YYYYMMDD')||'收款核销'||c_write_off.write_off_due_amount,
p_error_message => '延迟天数='||v_penalty_days||',延迟金'||v_penalty_amt);
*/
v_total_penalty_amt := v_total_penalty_amt + v_penalty_amt;
end loop;
--未收部分
if nvl(p_cashflow_rec.received_amount, 0) < p_cashflow_rec.due_amount then
v_penalty_days := trunc(p_calc_date) -
trunc(nvl(p_cashflow_rec.ln_user_col_d01,
p_cashflow_rec.due_date)) -
nvl(p_contract_rec.grace_period, 0);
-- 未核销金额 * 延迟天数 * 延迟履行金率
if v_penalty_days <= 0 then
v_penalty_amt := 0;
else
v_penalty_days := v_penalty_days +
nvl(p_contract_rec.grace_period, 0);
v_penalty_amt := (p_cashflow_rec.due_amount -
nvl(p_cashflow_rec.received_amount, 0)) *
(v_penalty_days) * p_contract_rec.penalty_rate;
end if;
/*log(p_log_desc => '未收金额'||to_char(p_cashflow_rec.due_amount - nvl(p_cashflow_rec.received_amount,0)),
p_error_message => '延迟天数='||v_penalty_days||',延迟金'||v_penalty_amt);
*/
v_total_penalty_amt := v_total_penalty_amt + v_penalty_amt;
end if;
p_total_penalty_amt := round(v_total_penalty_amt,
nvl(p_contract_rec.currency_precision,
g_currency_precision));
end;
procedure overdue_dayend(p_contract_cashflow_rec con_contract_cashflow%rowtype,
p_contract_rec con_contract%rowtype,
p_calc_date date,
p_session_id number,
p_user_id number) is
v_total_penalty_amt number;
v_total_penalty_amt_tmp number;
v_last_creation_date date;
v_deposit_calc_overdue_tmp_rec CUS_DEPOSIT_CALC_OVERDUE_TMP%rowtype;
begin
select trunc(max(a.penalty_calc_date))
into v_last_creation_date
from csh_write_off a
where a.cashflow_id = p_contract_cashflow_rec.cashflow_id;
--计算营业数据overdue
--逾期
if p_contract_cashflow_rec.overdue_status = 'Y' then
--已逾期
if p_contract_cashflow_rec.due_amount >
nvl(p_contract_cashflow_rec.received_amount, 0) then
--未收完款
v_deposit_calc_overdue_tmp_rec.calc_id := CUS_DEPOSIT_CALC_OVERDUE_TMP_s.Nextval;
v_deposit_calc_overdue_tmp_rec.session_id := p_session_id;
v_deposit_calc_overdue_tmp_rec.calc_date := p_calc_date;
v_deposit_calc_overdue_tmp_rec.due_date := p_contract_cashflow_rec.due_date;
v_deposit_calc_overdue_tmp_rec.contract_id := p_contract_rec.contract_id;
v_deposit_calc_overdue_tmp_rec.cashflow_id := p_contract_cashflow_rec.cashflow_id;
v_deposit_calc_overdue_tmp_rec.overdue_max_days := trunc(p_calc_date) -
trunc(p_contract_cashflow_rec.due_date);
v_deposit_calc_overdue_tmp_rec.overdue_amount := p_contract_cashflow_rec.due_amount -
nvl(p_contract_cashflow_rec.received_amount,
0);
v_deposit_calc_overdue_tmp_rec.overdue_principal := p_contract_cashflow_rec.principal -
nvl(p_contract_cashflow_rec.received_principal,
0);
v_deposit_calc_overdue_tmp_rec.overdue_interest := p_contract_cashflow_rec.interest -
nvl(p_contract_cashflow_rec.received_interest,
0);
v_deposit_calc_overdue_tmp_rec.created_by := p_user_id;
v_deposit_calc_overdue_tmp_rec.creation_date := sysdate;
insert into CUS_DEPOSIT_CALC_OVERDUE_TMP
values v_deposit_calc_overdue_tmp_rec;
end if;
else
--未逾期
if p_contract_cashflow_rec.due_amount >
nvl(p_contract_cashflow_rec.received_amount, 0) then
v_deposit_calc_overdue_tmp_rec.calc_id := CUS_DEPOSIT_CALC_OVERDUE_TMP_s.Nextval;
v_deposit_calc_overdue_tmp_rec.session_id := p_session_id;
v_deposit_calc_overdue_tmp_rec.calc_date := p_calc_date;
v_deposit_calc_overdue_tmp_rec.due_date := p_contract_cashflow_rec.due_date;
v_deposit_calc_overdue_tmp_rec.contract_id := p_contract_rec.contract_id;
v_deposit_calc_overdue_tmp_rec.cashflow_id := p_contract_cashflow_rec.cashflow_id;
v_deposit_calc_overdue_tmp_rec.overdue_max_days := trunc(p_calc_date) -
trunc(p_contract_cashflow_rec.due_date);
v_deposit_calc_overdue_tmp_rec.overdue_amount := p_contract_cashflow_rec.due_amount -
nvl(p_contract_cashflow_rec.received_amount,
0);
v_deposit_calc_overdue_tmp_rec.overdue_principal := p_contract_cashflow_rec.principal -
nvl(p_contract_cashflow_rec.received_principal,
0);
v_deposit_calc_overdue_tmp_rec.overdue_interest := p_contract_cashflow_rec.interest -
nvl(p_contract_cashflow_rec.received_interest,
0);
v_deposit_calc_overdue_tmp_rec.created_by := p_user_id;
v_deposit_calc_overdue_tmp_rec.creation_date := sysdate;
insert into CUS_DEPOSIT_CALC_OVERDUE_TMP
values v_deposit_calc_overdue_tmp_rec;
end if;
end if;
--计算会计逾期数据,取会计核销的最大期与营业现金流数据比较
for c_f in (select gwo.cf_item,
gwo.times,
sum(gwo.write_off_amount) write_off_amount,
gwo.penalty_calc_date
from GLD_WRITE_OFF gwo
where /*gwo.create_je_flag = 'Y'
AND */
gwo.reversed_flag = 'N'
and gwo.contract_id = p_contract_rec.contract_id
and gwo.times =
(select max(gwo.times) max_times
from GLD_WRITE_OFF gwo
where /*gwo.create_je_flag = 'Y'
AND */
gwo.reversed_flag = 'N'
and gwo.contract_id = p_contract_rec.contract_id)
group by gwo.cf_item, gwo.times, gwo.penalty_calc_date) loop
--会计出凭证的数据同类型同期现金流,并营业应收金额大于会计出凭证的和及营业应收日小于计算日。就视为这一期现金流 会计逾期
if p_contract_cashflow_rec.cf_item = c_f.cf_item and
p_contract_cashflow_rec.times = c_f.times and
p_contract_cashflow_rec.due_amount > c_f.write_off_amount and
p_contract_cashflow_rec.due_date < p_calc_date then
--会计已收收计算罚息
f_calc_penalty(p_calc_amount => c_f.write_off_amount,
p_contract_rec => p_contract_rec,
p_calc_date => p_calc_date,
p_penalty_calc_date => c_f.penalty_calc_date,
p_user_id => p_user_id,
p_total_penalty_amt => v_total_penalty_amt_tmp);
--会计未收计算罚息
f_calc_penalty(p_calc_amount => p_contract_cashflow_rec.due_amount -
c_f.write_off_amount,
p_contract_rec => p_contract_rec,
p_calc_date => p_calc_date,
p_penalty_calc_date => p_contract_cashflow_rec.due_date,
p_user_id => p_user_id,
p_total_penalty_amt => v_total_penalty_amt);
--更新会计逾期租金=营业应收租金-会计核销租金
update CUS_DEPOSIT_CALC_OVERDUE_TMP t
set t.f_overdue_amount = p_contract_cashflow_rec.due_amount -
c_f.write_off_amount,
t.f_overdue_penalty_amt = round(v_total_penalty_amt_tmp +
v_total_penalty_amt,
2)
where t.cashflow_id = p_contract_cashflow_rec.cashflow_id
and t.contract_id = p_contract_rec.contract_id
and t.session_id = p_session_id;
--会计出凭证的数据同类型及会计未来期现金流,并营业应收日小于计算日。就视为这一期现金流 会计逾期
elsif p_contract_cashflow_rec.cf_item = c_f.cf_item and
p_contract_cashflow_rec.times > c_f.times and
p_contract_cashflow_rec.due_date < p_calc_date then
--会计未收计算罚息
f_calc_penalty(p_calc_amount => p_contract_cashflow_rec.due_amount,
p_contract_rec => p_contract_rec,
p_calc_date => p_calc_date,
p_penalty_calc_date => p_contract_cashflow_rec.due_date,
p_user_id => p_user_id,
p_total_penalty_amt => v_total_penalty_amt);
--更新会计逾期租金=营业应收租金
update CUS_DEPOSIT_CALC_OVERDUE_TMP t
set t.f_overdue_amount = p_contract_cashflow_rec.due_amount,
t.f_overdue_penalty_amt = v_total_penalty_amt
where t.cashflow_id = p_contract_cashflow_rec.cashflow_id
and t.contract_id = p_contract_rec.contract_id
and t.session_id = p_session_id;
end if;
end loop;
--计算penalty
if p_contract_cashflow_rec.write_off_flag <> 'FULL' then
calc_penalty(p_cashflow_rec => p_contract_cashflow_rec,
p_contract_rec => p_contract_rec,
p_calc_date => p_calc_date,
p_total_penalty_amt => v_total_penalty_amt,
p_user_id => p_user_id);
update CUS_DEPOSIT_CALC_OVERDUE_TMP
set OVERDUE_PENALTY_AMT = v_total_penalty_amt
where calc_id = v_deposit_calc_overdue_tmp_rec.calc_id;
end if;
end;
procedure overdue_dayend(p_contract_id number,
p_calc_date date,
p_session_id number,
p_user_id number) is
v_contract_rec con_contract%rowtype;
begin
begin
select *
into v_contract_rec
from con_contract
where contract_id = p_contract_id
and contract_status = 'INCEPT'
for update nowait;
exception
when no_data_found then
return;
end;
for c_contract_cashflow in (select a.*
from con_contract_cashflow a,
con_contract_cf_item b
where a.contract_id = p_contract_id
and a.cf_status = 'RELEASE'
and a.due_date <= p_calc_date
--只有正常的才计算罚息。
and a.penalty_process_status = 'NORMAL'
and a.cf_direction = 'INFLOW'
and a.contract_id = b.contract_id
and a.cf_item = b.cf_item
and b.calc_penalty = 'Y'
order by times, due_date
for update nowait) loop
overdue_dayend(p_contract_cashflow_rec => c_contract_cashflow,
p_contract_rec => v_contract_rec,
p_calc_date => p_calc_date,
p_session_id => p_session_id,
p_user_id => p_user_id);
end loop;
end;
--罚息测算
procedure calc_overdue_dayend(p_calc_date date,
p_session_id number,
p_user_id number) is
v_count number;
begin
-- 同样的罚息测算日如果存在数据,不在进行计算
select count(*)
into v_count
from CUS_DEPOSIT_CALC_OVERDUE_TMP t
where t.calc_date = p_calc_date
--and t.session_id = p_session_id
;
if v_count >= 1 then
null;
else
-- 之前的计算数据
delete from CUS_DEPOSIT_CALC_OVERDUE_TMP t
where t.calc_date <= p_calc_date;
--t.session_id = p_session_id;
--根据测算日重算罚息
for c_con in (select *
from con_contract t
where t.contract_status = 'INCEPT') loop
overdue_dayend(p_contract_id => c_con.contract_id,
p_calc_date => p_calc_date,
p_session_id => p_session_id,
p_user_id => p_user_id);
end loop;
end if;
end calc_overdue_dayend;
end cus_con_deposit_pkg;
/
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
spool REGISTER_CUS_DEPOSIT120.log
set feedback off
set define off
begin
--页面注册
sys_function_assign_pkg.service_load('modules/cus_deposit/CUS_DEPOSIT120/cus_deposit_advance_list.lview','保证金-代垫清单',1,1,0);
sys_function_assign_pkg.service_load('modules/cus_deposit/CUS_DEPOSIT120/cus_deposit_advance_list.lview','保证金-代垫清单',1,1,0);
--功能定义
SYS_LOAD_SYS_FUNCTION_PKG.SYS_FUNCTION_LOAD('CUS_DEPOSIT120','保证金-代垫清单','保证金-代垫清单','120','','','modules/cus_deposit/CUS_DEPOSIT120/cus_deposit_advance_list.lview','ZHS',-1);
SYS_LOAD_SYS_FUNCTION_PKG.SYS_FUNCTION_LOAD('CUS_DEPOSIT120','保证金-代垫清单','保证金-代垫清单','120','','','modules/cus_deposit/CUS_DEPOSIT120/cus_deposit_advance_list.lview','US',-1);
--分配页面
sys_function_assign_pkg.func_service_load('CUS_DEPOSIT120','modules/cus_deposit/CUS_DEPOSIT120/cus_deposit_advance_list.lview');
--分配bm
sys_function_assign_pkg.func_bm_load('CUS_DEPOSIT120','cus_deposit.CUS_DEPOSIT120.cus_deposit_calc_overdue_list_query');
sys_function_assign_pkg.func_bm_load('CUS_DEPOSIT120','cus_deposit.CUS_DEPOSIT120.cus_deposit_calc_overdue_list');
sys_function_assign_pkg.func_bm_load('CUS_DEPOSIT120','basic.hls_bp_master_v_for_lov');
--分配菜单
sys_load_sys_function_grp_pkg.sys_function_group_item_load(p_function_group_code=>'DEPOSIT',p_function_code=>'CUS_DEPOSIT120',p_enabled_flag=>'Y',P_USER_ID=>-1);
end;
/
commit;
set feedback on
set define on
spool off
exit
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
spool CUS_DEPOSIT_CALC_OVERDUE_TMP_S.log
prompt
prompt Creating sequence CUS_DEPOSIT_CALC_OVERDUE_TMP_S
prompt ====================================
prompt
whenever sqlerror continue
drop sequence CUS_DEPOSIT_CALC_OVERDUE_TMP_S;
whenever sqlerror exit failure rollback
Create sequence CUS_DEPOSIT_CALC_OVERDUE_TMP_S;
spool off
exit
alter table CSH_TRANSACTION add (transfer_amount number);
comment on column CSH_TRANSACTION.transfer_amount is '已划转金额(hlcm保证金)';
alter table CSH_TRANSACTION add (offset_amount number);
comment on column CSH_TRANSACTION.offset_amount is '已冲抵金额(hlcm保证金)';
alter table CSH_TRANSACTION add (return_amount number);
comment on column CSH_TRANSACTION.return_amount is '已退款金额(hlcm保证金)';
alter table CSH_TRANSACTION add (deposit_balance number);
comment on column CSH_TRANSACTION.deposit_balance is '保证金余额(hlcm保证金)';
alter table CSH_TRANSACTION add (deposit_source_tran_id number);
comment on column CSH_TRANSACTION.deposit_source_tran_id is '保证金上级现金事务id(hlcm保证金)';
alter table CSH_WRITE_OFF add (operation_type number);
comment on column CSH_WRITE_OFF.operation_type is '操作类型:入账、划转、冲抵租金、冲抵违约金(hlcm保证金)';
\ No newline at end of file
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
spool CUS_DEPOSIT_CALC_OVERDUE_TMP.log
PROMPT
PROMPT CREATING TABLE CUS_DEPOSIT_CALC_OVERDUE_TMP
PROMPT ============================
PROMPT
WHENEVER SQLERROR CONTINUE
DROP TABLE CUS_DEPOSIT_CALC_OVERDUE_TMP;
WHENEVER SQLERROR EXIT FAILURE ROLLBACK
-- Create table
create table CUS_DEPOSIT_CALC_OVERDUE_TMP
(
calc_id NUMBER not null,
session_id NUMBER,
calc_date DATE,
due_date DATE,
contract_id NUMBER,
cashflow_id NUMBER,
f_overdue_amount NUMBER,
f_overdue_penalty_amt NUMBER,
overdue_principal NUMBER,
overdue_interest NUMBER,
overdue_amount NUMBER,
overdue_max_days NUMBER,
overdue_penalty_amt NUMBER,
created_by NUMBER,
creation_date DATE
);
-- Add comments to the table
comment on table CUS_DEPOSIT_CALC_OVERDUE_TMP
is '保证金代垫清单-罚息测算';
-- Add comments to the columns
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.calc_id
is 'PK';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.session_id
is 'session_id';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.calc_date
is '计算日';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.due_date
is '到期日';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.contract_id
is '合同id';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.cashflow_id
is '现金流id';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.overdue_principal
is '逾期本金';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.overdue_interest
is '逾期利息';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.overdue_amount
is '逾期租金';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.overdue_max_days
is '最大逾期天数';
comment on column CUS_DEPOSIT_CALC_OVERDUE_TMP.overdue_penalty_amt
is '逾期违约金';
-- Create/Recreate indexes
create index CUS_DEPT_CALC_OVERDUE_TMP_N1 on CUS_DEPOSIT_CALC_OVERDUE_TMP (SESSION_ID);
create index CUS_DEPT_CALC_OVERDUE_TMP_N2 on CUS_DEPOSIT_CALC_OVERDUE_TMP (CONTRACT_ID);
-- Create/Recreate primary, unique and foreign key constraints
alter table CUS_DEPOSIT_CALC_OVERDUE_TMP
add constraint CUS_DEPT_CALC_OVERDUE_TMP_PK primary key (CALC_ID);
/
SPOOL OFF
EXIT
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
cus_con_deposit_pkg.calc_overdue_dayend(p_calc_date => to_date(${@calc_overdue_date},'yyyy-mm-dd'),
p_session_id => ${/session/@session_id},
p_user_id => ${/session/@user_id});
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[select * from (
select v1.*,v1.due_rental_deposit-v1.received_rental_deposit undue_rental_deposit from (
select cc.bp_id_agent_level1,
(select hbm.bp_name
from HLS_BP_MASTER HBM
where cc.bp_id_agent_level1 = hbm.bp_id) agent_name,
cc.contract_number,
cc.bp_id_tenant,
(select hbm.bp_name
from HLS_BP_MASTER HBM
where cc.bp_id_tenant = hbm.bp_id) bp_name,
t.session_id,
t.overdue_max_days,
f.times,
to_char(t.calc_date,'yyyy-mm-dd') calc_date,
to_char(f.due_date,'yyyy-mm-dd') due_date,
nvl(t.f_overdue_amount,0) f_overdue_amount,
nvl(t.f_overdue_penalty_amt,0) f_overdue_penalty_amt,
nvl(t.overdue_principal, 0) overdue_principal,
nvl(t.overdue_interest, 0) overdue_interest,
nvl(t.overdue_amount, 0) overdue_amount,
nvl(t.overdue_penalty_amt, 0) overdue_penalty_amt,
nvl(t.f_overdue_amount, 0) due_rental_deposit,
(select nvl(sum(cwo.write_off_due_amount),0)
from csh_transaction ctr, csh_write_off cwo
where cwo.contract_id = t.contract_id
AND cwo.cashflow_id = t.cashflow_id
AND cwo.csh_transaction_id = ctr.transaction_id
and ctr.transaction_type = 'DEPOSIT') received_rental_deposit
from CUS_DEPOSIT_CALC_OVERDUE_TMP t,
CON_CONTRACT CC,
con_contract_cashflow f
where t.cashflow_id = f.cashflow_id
and f.contract_id = cc.contract_id
and t.contract_id = cc.contract_id
and cc.data_class = 'NORMAL')v1
order by v1.contract_number,v1.times)v
#WHERE_CLAUSE#
#ORDER_BY_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="contract_number" queryExpression="v.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
<bm:query-field name="bp_id_agent_level1" queryExpression="v.bp_id_agent_level1 = ${@bp_id_agent_level1}"/>
<bm:query-field name="bp_id_tenant" queryExpression="v.bp_id_tenant =${@bp_id_tenant}"/>
<bm:query-field name="overdue_max_days_from" queryExpression="v.overdue_max_days &lt;= ${@overdue_max_days_from}"/>
<bm:query-field name="overdue_max_days_to" queryExpression="v.overdue_max_days &gt;= ${@overdue_max_days_to}"/>
<bm:query-field name="due_date_from" queryExpression="v.due_date &lt;= ${@due_date_from}"/>
<bm:query-field name="due_date_to" queryExpression="v.due_date &gt;= ${@due_date_to}"/>
</bm:query-fields>
<!-- <bm:data-filters>-->
<!-- <bm:data-filter name="session_id" expression="${/session/@session_id}"/>-->
<!-- </bm:data-filters>-->
</bm:model>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure/>
<a:view>
<script type="text/javascript"><![CDATA[
function dateValidator(record, name, value) { //日期校验方法
if (name == 'transaction_date_from' || name == 'transaction_date_to') {
var start_date = Leaf.formatDate(record.get('transaction_date_from'));
var end_date = Leaf.formatDate(record.get('transaction_date_to'));
if (!!end_date) { //由于结束日期非必填,只有在结束日期填了才进行比较
if (!compareDate(start_date, end_date)) {
return '${l:CSH510.CSH_RECEIPT_DATE_CHECK}'; //校验不通过返回字符串
}
}
return true; //校验通过返回true
}
}
function compareDate(start, end) {
if (start > end) {
return false;
}
return true;
}
function cus_deposit120_query() {
$('cus_deposit120_result_ds').query();
}
function cus_deposit120_reset() {
$('cus_deposit120_query_ds').reset();
}
function cus_deposit120_calc_overdue() {
$('cus_deposit120_calc_btn').disable();
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
var record = $('cus_deposit120_calc_overdue_date_ds').getAt(0);
var calc_overdue_date = record.get('calc_overdue_date');
if(calc_overdue_date){
Leaf.request({
url:"${/request/@context_path}/autocrud/cus_deposit.CUS_DEPOSIT120.cus_deposit_calc_overdue_list/execute",
para:{calc_overdue_date:calc_overdue_date},
scope:this,
success:function (res) {
$('cus_deposit120_calc_btn').enable();
Leaf.Masker.unmask(Ext.getBody()); //解锁
if (res.success) {
cus_deposit120_query();
}
},
failure: function() {
$('cus_deposit120_calc_btn').enable();
Leaf.Masker.unmask(Ext.getBody()); //解锁
},
error: function() {
$('cus_deposit120_calc_btn').enable();
Leaf.Masker.unmask(Ext.getBody()); //解锁
}
});
}else{
$('cus_deposit120_calc_btn').enable();
Leaf.Masker.unmask(Ext.getBody()); //解锁
Leaf.showMessage('${l:HLS.PROMPT}', '请先维护罚息测算日!');
return;
}
}
]]></script>
<a:dataSets>
<a:dataSet id="cus_deposit120_query_ds">
<a:fields>
<a:field name="agent_name" lovGridHeight="350" lovHeight="500"
lovService="basic.hls_bp_master_v_for_lov?bp_category=AGENT" lovWidth="500" title="HLS.BP_TITLE">
<a:mapping>
<a:map from="bp_id" to="bp_id_agent_level1"/>
<a:map from="bp_name" to="agent_name"/>
</a:mapping>
</a:field>
<a:field name="bp_id_agent_level1"/>
<a:field name="bp_id_tenant_name" lovGridHeight="350" lovHeight="500"
lovService="basic.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="500" title="HLS.BP_TITLE">
<a:mapping>
<a:map from="bp_id" to="bp_id_tenant"/>
<a:map from="bp_name" to="bp_id_tenant_name"/>
</a:mapping>
</a:field>
<a:field name="bp_id_tenant"/>
<a:field name="due_date_from"/>
<a:field name="due_date_to"/>
</a:fields>
</a:dataSet>
<a:dataSet id="cus_deposit120_calc_overdue_date_ds" autoCreate="true">
<a:fields>
<a:field name="calc_overdue_date"/>
</a:fields>
</a:dataSet>
<a:dataSet id="cus_deposit120_result_ds" autoPageSize="true" autoQuery="true"
model="cus_deposit.CUS_DEPOSIT120.cus_deposit_calc_overdue_list_query" queryDataSet="cus_deposit120_query_ds"
selectable="true" selectionModel="single"/>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton id="cus_deposit120_calc_btn" click="cus_deposit120_calc_overdue" text="罚息测算"/>
<a:gridButton click="cus_deposit120_query" text="HLS.QUERY"/>
<a:gridButton click="cus_deposit120_reset" text="HLS.RESET"/>
</a:screenTopToolbar>
<a:form bindTarget="cus_deposit120_query_ds" column="4" labelWidth="130" marginWidth="80" title="逾期合同查询">
<a:lov name="agent_name" bindTarget="cus_deposit120_query_ds" prompt="代理店"/>
<a:textField name="contract_number" bindTarget="cus_deposit120_query_ds" prompt="合同编号"/>
<a:lov name="bp_id_tenant_name" bindTarget="cus_deposit120_query_ds" prompt="承租人"/>
<a:numberField name="overdue_max_days_from" allowDecimals="false" allowNegative="false" bindTarget="cus_deposit120_query_ds" prompt="合同逾期天数从"/>
<a:numberField name="overdue_max_days_to" allowDecimals="false" allowNegative="false" bindTarget="cus_deposit120_query_ds" prompt="合同逾期天数到"/>
<a:datePicker name="due_date_from" bindTarget="cus_deposit120_query_ds" prompt="HLS.TRANSACTION_DATE_FROM"/>
<a:datePicker name="due_date_to" bindTarget="cus_deposit120_query_ds" prompt="HLS.TRANSACTION_DATE_TO"/>
</a:form>
<a:fieldSet title="罚息测算">
<a:datePicker name="calc_overdue_date" bindTarget="cus_deposit120_calc_overdue_date_ds" prompt="罚息测算日"/>
</a:fieldSet>
<a:grid id="cus_deposit120_grid_ds" bindTarget="cus_deposit120_result_ds" marginHeight="295" marginWidth="80" navBar="true">
<a:toolBar>
<a:button prompt="PROMPT.EXPORT_EXCEL" type="excel"/>
</a:toolBar>
<a:columns>
<a:column name="agent_name" prompt="代理店" width="120"/>
<a:column name="contract_number" prompt="合同编号" width="100"/>
<a:column name="bp_name" prompt="承租人" width="100"/>
<a:column name="overdue_max_days" prompt="合同逾期天数" width="80"/>
<a:column name="times" prompt="期数" width="40"/>
<a:column name="calc_date" prompt="罚息测算日" width="100" renderer="Leaf.formatDate"/>
<a:column name="due_date" prompt="到期日" width="100" renderer="Leaf.formatDate"/>
<a:column prompt="会计">
<!-- <a:column name="" prompt="逾期本金" align="right" width="100" renderer="Leaf.formatMoney"/>-->
<!-- <a:column name="" prompt="逾期利息" align="right" width="100" renderer="Leaf.formatMoney"/>-->
<a:column name="f_overdue_amount" prompt="逾期租金" align="right" width="100" renderer="Leaf.formatMoney"/>
<a:column name="f_overdue_penalty_amt" prompt="逾期违约金" align="right" width="100" renderer="Leaf.formatMoney"/>
</a:column>
<a:column prompt="营业">
<a:column name="overdue_principal" prompt="逾期本金" align="right" width="100" renderer="Leaf.formatMoney"/>
<a:column name="overdue_interest" prompt="逾期利息" align="right" width="100" renderer="Leaf.formatMoney"/>
<a:column name="overdue_amount" prompt="逾期租金" align="right" width="100" renderer="Leaf.formatMoney"/>
<a:column name="overdue_penalty_amt" prompt="逾期违约金" align="right" width="100" renderer="Leaf.formatMoney"/>
</a:column>
<a:column prompt="租金保证金">
<a:column name="due_rental_deposit" prompt="应垫" align="right" width="100" renderer="Leaf.formatMoney"/>
<a:column name="received_rental_deposit" prompt="已垫" align="right" width="100" renderer="Leaf.formatMoney"/>
<a:column name="undue_rental_deposit" prompt="未垫" align="right" width="100" renderer="Leaf.formatMoney"/>
</a:column>
</a:columns>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>
\ No newline at end of file
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