Commit 87666780 authored by 25484's avatar 25484

[fix]合同结束功能完善

parent 3802f370
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: Feng
$Date: 2013-9-27 上午10:27:56
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_CONTRACT_V" defaultOrderBy="lease_end_date desc">
<bm:fields>
<bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_CONTRACT.CONTRACT_ID"/>
<bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="CON_CONTRACT.CONTRACT_NUMBER"/>
<bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="CON_CONTRACT.BUSINESS_TYPE"/>
<bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="CON_CONTRACT.DOCUMENT_TYPE"/>
<bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="CON_CONTRACT.DOCUMENT_CATEGORY"/>
<bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CON_CONTRACT.COMPANY_ID"/>
<bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION" prompt="CON_CONTRACT.LEASE_ORGANIZATION"/>
<bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL" prompt="CON_CONTRACT.LEASE_CHANNEL"/>
<bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION" prompt="CON_CONTRACT.DIVISION"/>
<bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT" prompt="CON_CONTRACT.BP_ID_TENANT"/>
<bm:field name="bp_name" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_tenant and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/>
<bm:field name="bp_id_agent_level1" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_AGENT_LEVEL1" prompt="CON_CONTRACT.BP_ID_AGENT_LEVEL1"/>
<bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_CONTRACT.OWNER_USER_ID"/>
<bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE" prompt="CON_CONTRACT.INCEPTION_OF_LEASE"/>
<bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_END_DATE" prompt="CON_CONTRACT.LEASE_END_DATE"/>
<bm:field name="lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_ITEM_AMOUNT" prompt="CON_CONTRACT.LEASE_ITEM_AMOUNT"/>
<bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS" prompt="CON_CONTRACT.CONTRACT_STATUS"/>
<!--<bm:field name="signing_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SIGNING_USER_ID" prompt="CON_CONTRACT.SIGNING_USER_ID"/>-->
<bm:field name="signing_location" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SIGNING_LOCATION" prompt="CON_CONTRACT.SIGNING_LOCATION"/>
<bm:field name="residual_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESIDUAL_VALUE" prompt="CON_CONTRACT.RESIDUAL_VALUE"/>
<bm:field name="signing_date" databaseType="DATE" datatype="java.util.Date" physicalName="SIGNING_DATE" prompt="CON_CONTRACT.SIGNING_DATE"/>
<!--<bm:field name="bp_id_vender" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_VENDER" prompt="CON_CONTRACT.BP_ID_VENDER"/>-->
<bm:field name="down_payment" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOWN_PAYMENT"/>
<!--<bm:field name="signing_user_id_n" expression="(select name from exp_employees where employee_id = t1.signing_user_id)" forInsert="false" forUpdate="false"/>-->
<bm:field name="lease_channel_desc" expression="(select description from hls_lease_channel where lease_channel = t1.lease_channel)" forInsert="false" forUpdate="false"/>
<!--<bm:field name="bp_vender" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_vender and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/>-->
<bm:field name="lease_organization_desc" expression="(select description from hls_lease_organization where lease_organization = t1.lease_organization)" forInsert="false" forUpdate="false"/>
<!--<bm:field name="owner_user_id_n" expression="(select description from sys_user where user_id = t1.created_by)" forInsert="false" forUpdate="false"/>-->
<bm:field name="is_terminate" expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item=1) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item=1)) = 0 THEN &apos;是&apos; ELSE &apos;否&apos; END)" forInsert="false" forUpdate="false"/>
<bm:field name="bp_id_agent_desc"/>
<bm:field name="business_type_n"/>
<bm:field name="division_n"/>
</bm:fields>
<bm:features>
<f:standard-who/>
<s:bm-script><![CDATA[
var cx = Packages.leaf.javascript.Context.getCurrentContext();
Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
]]></s:bm-script>
</bm:features>
<bm:primary-key>
<bm:pk-field name="contract_id"/>
</bm:primary-key>
<bm:query-fields>
<bm:query-field field="contract_number" queryExpression="contract_number like upper(&apos;%&apos;||${@contract_number}||&apos;%&apos;)"/>
<bm:query-field field="owner_user_id" queryOperator="="/>
<bm:query-field field="bp_id_tenant" queryOperator="="/>
<bm:query-field field="lease_organization" queryOperator="="/>
<bm:query-field field="bp_id_agent_desc" queryExpression="bp_id_agent_desc like upper(&apos;%&apos;||${@bp_id_agent_desc}||&apos;%&apos;)"/>
</bm:query-fields>
<bm:data-filters>
<bm:field name="is_terminate" expression="((select sum(ccc.due_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item = 1) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item = 1)) = 0"/>
<!-- <bm:data-filter enforceOperations="query" expression="t1.contract_status in (&apos;INCEPT&apos;,&apos;ETING&apos;,&apos;ADING&apos;) "/>-->
<!-- <bm:data-filter enforceOperations="query" expression="t1.lease_end_date &lt;= sysdate"/> -->
<bm:data-filter enforceOperations="query" expression="t1.data_class = &apos;NORMAL&apos;"/>
<bm:data-filter enforceOperations="query" expression="t1.contract_id = ${@contract_id}"/>
<!--<bm:data-filter enforceOperations="query" expression=" NOT EXISTS (SELECT 1 FROM con_contract_cashflow WHERE contract_id = t1.contract_id AND cf_item IN (1,8,52) AND (write_off_flag IN (&apos;PARTIAL&apos;, &apos;NOT&apos;) OR received_amount != due_amount))"/>-->
<!--<bm:data-filter enforceOperations="query" expression="exists (select 1 from con_contract where contract_id = t1.contract_id and created_by = ${/session/@user_id})"/>-->
</bm:data-filters>
</bm:model>
......@@ -10,8 +10,9 @@
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
con_contract_pkg.terminate_contract(
con_contract_closed_pkg.terminate_contract(
p_contract_id =>${@contract_id},
p_company_id =>${/session/@company_id},
p_user_id =>${/session/@user_id}
);
end;
......
......@@ -116,7 +116,9 @@
<a:dataSets>
<a:dataSet id="receivedAmountDs" autoQuery="true" model="cont.CON560.con_contract_received_amount"/>
<a:dataSet id="unreceivedAmountDs" autoQuery="true" model="cont.CON560.con_contract_unreceived_amount"/>
<a:dataSet id="con560_lease_organization_name_ds" loadData="true" model="basic.hls_lease_organization_for_lov"/>
<a:dataSet id="con560_contract_status_ds" lookupCode="CON500_CONTRACT_STATUS"/>
<a:dataSet id="con560_lease_organization_name_ds" loadData="true"
model="basic.hls_lease_organization_for_lov"/>
<a:dataSet id="con560_contract_query_ds" autoCreate="true">
<a:fields>
<a:field name="bp_name" autoComplete="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="cont.CON541.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="520" title="HLS.BP_TITLE">
......@@ -141,7 +143,15 @@
</a:field>
</a:fields>
</a:dataSet>
<a:dataSet id="con560_contract_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON560.con_contract_finish_for_query" queryDataSet="con560_contract_query_ds" queryUrl="${/request/@context_path}/autocrud/cont.CON560.con_contract_finish_for_query/query" selectable="true" selectionModel="single">
<a:dataSet id="con560_contract_result_ds" autoPageSize="true" autoQuery="true"
model="cont.CON560.con_contract_finish_for_query" queryDataSet="con560_contract_query_ds"
queryUrl="${/request/@context_path}/autocrud/cont.CON560.con_contract_finish_for_query/query"
selectable="true" selectionModel="single">
<a:fields>
<a:field name="contract_status_n" displayField="code_value_name"
options="con560_contract_status_ds" returnField="contract_status"
valueField="code_value"/>
</a:fields>
<a:events>
<a:event name="indexChange" handler="onIndexChange"/>
<a:event name="query" handler="aut_authority_list_validate_query"/>
......@@ -178,6 +188,7 @@
<a:column name="down_payment" align="right" footerRenderer="summaryRenderer" prompt="首付款" renderer="Leaf.formatMoney" width="120"/>
<!--<a:column name="owner_user_id_n" prompt="出单人" width="60"/>-->
<a:column name="lease_organization_desc" prompt="事业部" width="80"/>
<a:column name="contract_status_n" prompt="合同状态" width="80"/>
</a:columns>
</a:grid>
<a:tabPanel marginHeight="420" marginWidth="30">
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: LR
$Date: 2013-8-13 上午10:30:25
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
<a:init-procedure><![CDATA[
]]>
</a:init-procedure>
<a:view>
<a:link id="con_contract_terminate_link_id" model="cont.CON560.con_contract_terminate"
modelaction="batch_update"/>
<a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
<a:link id="con_contract_update_link_id"
url="${/request/@context_path}/modules/cont/CON500/con_contract_update.lview"/>
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<script type="text/javascript"><![CDATA[
function con560_con_contract_detail() {debugger;
var records = $('con560_contract_result_ds').getSelected();
if (!records.length) {
Leaf.showMessage('${l:PROMPT}', '请至少选择一条记录');
return;
}
var TerminateData = [];
for (var i = 0; i < records.length; i++) {
records[i].set('_status', 'update');
TerminateData.push(records[i].data);
}
// Leaf.showConfirm('${l:PROMPT}', '确认要结束?', function () {
Leaf.request({
url: $('con_contract_terminate_link_id').getUrl(),
para: TerminateData,
success: function () {
Leaf.SideBar.show({
msg: '合同已结束',
duration: 2000
});
$('con560_contract_result_ds').query();
},
scope: this
});
// }, function () {
// return;
// }, null, null);
}
function con560_render_contractMaintainDs_grid(value, record, name) {
if (name == 'contract_number') {
return '<a href="javascript:con560_contractMaintainDs_grid_update(' + record.id + ');">' + value + '</a>';
}
}
function con560_param_set_value(param) {debugger;
param['document_category'] = 'CONTRACT';
param['function_code'] = 'CON301';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY';
param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_update_link_id', 'con560_contract_result_ds');
}
function con560_contractMaintainDs_grid_update(id) {
var current_record = $('con560_contract_result_ds').findById(id);
var param = current_record.data;
param['document_id'] = current_record.get('contract_id');
con560_param_set_value(param);
}
function con560_con_contract_query() {
$('con560_contract_result_ds').query();
}
function con560_con_contract_reset() {
$('con560_contract_query_ds').reset();
}
function summaryRenderer(datas, name) {
var sum = 0;
var sum2 = 0;
for (var i = 0; i < datas.length; i++) {
record = datas[i];
if (name == "lease_item_amount") {
var t_1 = record.get("lease_item_amount");
var t_2 = parseFloat(t_1);
if (!isNaN(t_2)) {
sum += t_2;
}
}
if (name == "down_payment") {
var d_1 = record.get("down_payment");
var d_2 = parseFloat(d_1);
if (!isNaN(d_2)) {
sum2 += d_2;
}
}
}
if (name == "bp_vender") {
return '<div align="right">合计:</div>';
}
if (name == "lease_item_amount") {
return '<font color="red">' + Leaf.formatNumber(sum, 2) + '</font>';
}
if (name == "down_payment") {
return '<font color="red">' + Leaf.formatNumber(sum2, 2) + '</font>';
}
}
function onIndexChange(ds, record, name, value, oldvalue) {
$('receivedAmountDs').setQueryParameter('contract_id', record.get('contract_id'));
$('unreceivedAmountDs').setQueryParameter('contract_id', record.get('contract_id'));
$('receivedAmountDs').query();
$('unreceivedAmountDs').query();
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:screen-include
screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=CON560"/>
<a:dataSets>
<a:dataSet id="receivedAmountDs" autoQuery="true" model="cont.CON560.con_contract_received_amount"/>
<a:dataSet id="unreceivedAmountDs" autoQuery="true" model="cont.CON560.con_contract_unreceived_amount"/>
<a:dataSet id="con560_lease_organization_name_ds" loadData="true"
model="basic.hls_lease_organization_for_lov"/>
<a:dataSet id="con560_contract_query_ds" autoCreate="true">
<a:fields>
<a:field name="bp_name" autoComplete="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="100"
lovService="cont.CON541.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="520"
title="HLS.BP_TITLE">
<a:mapping>
<a:map from="bp_name" to="bp_name"/>
<a:map from="bp_id" to="bp_id_tenant"/>
</a:mapping>
</a:field>
<!-- <a:field name="contract_number" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="cont.CON531.con_contract_lov" lovWidth="500" title="HLS.CONTRACT_NUMBER">
<a:mapping>
<a:map from="contract_number" to="contract_number"/>
<a:map from="contract_id" to="contract_id"/>
</a:mapping>
</a:field> -->
<a:field name="contract_number" typeCase="Upper"/>
<a:field name="lease_organization_name" displayField="description"
options="con560_lease_organization_name_ds" returnField="lease_organization"
valueField="lease_organization"/>
<a:field name="owner_user_id_n" lovGridHeight="350" lovHeight="475"
lovService="cont.CON560.sys_user_for_lov" lovWidth="520" title="出单人选择">
<a:mapping>
<a:map from="user_id" to="owner_user_id"/>
<a:map from="description" to="owner_user_id_n"/>
</a:mapping>
</a:field>
</a:fields>
</a:dataSet>
<a:dataSet id="con560_contract_result_ds" autoPageSize="true" autoQuery="true"
model="cont.CON560.con_contract_finish_for_query_wfl" queryDataSet="con560_contract_query_ds"
queryUrl="${/request/@context_path}/autocrud/cont.CON560.con_contract_finish_for_query_wfl/query?contract_id=${/parameter/@contract_id}"
selectable="true" selectionModel="single">
<a:events>
<a:event name="indexChange" handler="onIndexChange"/>
<a:event name="query" handler="aut_authority_list_validate_query"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<!-- <a:screenTopToolbar>-->
<!-- <a:screenTitle/>-->
<!-- <a:gridButton click="con560_con_contract_query" text="HLS.QUERY"/>-->
<!-- <a:gridButton click="con560_con_contract_reset" text="HLS.RESET"/>-->
<!-- <a:gridButton click="con560_con_contract_detail" text="合同结束"/>-->
<!-- </a:screenTopToolbar>-->
<!-- <a:form column="3" labelWidth="100" marginWidth="30" title="CON301.CONTRACT_QUERY">-->
<!-- <a:textField name="contract_number" bindTarget="con560_contract_query_ds" prompt="HLS.CONTRACT_NUMBER"/>-->
<!-- <a:lov name="bp_name" bindTarget="con560_contract_query_ds" prompt="HLS.TENANT_CODE"/>-->
<!-- &lt;!&ndash;<a:lov name="owner_user_id_n" bindTarget="con560_contract_query_ds" prompt="出单人"/>&ndash;&gt;-->
<!-- <a:comboBox name="lease_organization_name" bindTarget="con560_contract_query_ds" prompt="事业部"/>-->
<!-- </a:form>-->
<a:grid id="con560_con_contract_grid_ds" bindTarget="con560_contract_result_ds" marginHeight="365"
marginWidth="30" navBar="true">
<a:columns>
<a:column name="contract_number" lock="true" prompt="HLS.CONTRACT_NUMBER"
renderer="con560_render_contractMaintainDs_grid" width="150"/>
<a:column name="bp_name" prompt="HLS.TENANT_NAME" width="100"/>
<a:column name="inception_of_lease" prompt="起租日期" renderer="Leaf.formatDate" width="100"/>
<a:column name="lease_end_date" prompt="合同预计结束日期" renderer="Leaf.formatDate" width="100"/>
<a:column name="is_terminate" prompt="租金是否结清" width="100"/>
<a:column name="residual_value" align="right" prompt="留购价" renderer="Leaf.formatMoney" width="50"/>
<!--<a:column name="signing_user_id_n" prompt="签约人" width="100"/>-->
<a:column name="signing_date" prompt="签约时间" renderer="Leaf.formatDate" width="100"/>
<a:column name="signing_location" prompt="签约地点" width="100"/>
<a:column name="lease_channel_desc" prompt="商业模式" width="70"/>
<!--<a:column name="bp_vender" align="center" footerRenderer="summaryRenderer" prompt="主供应商名称" width="200"/>-->
<a:column name="lease_item_amount" align="right" footerRenderer="summaryRenderer" prompt="租赁物总价"
renderer="Leaf.formatMoney" width="120"/>
<a:column name="down_payment" align="right" footerRenderer="summaryRenderer" prompt="首付款"
renderer="Leaf.formatMoney" width="120"/>
<!--<a:column name="owner_user_id_n" prompt="出单人" width="60"/>-->
<a:column name="lease_organization_desc" prompt="事业部" width="80"/>
<a:column name="contract_status" prompt="合同状态" width="80"/>
</a:columns>
</a:grid>
<a:tabPanel marginHeight="420" marginWidth="30">
<a:tabs>
<a:tab prompt="未收金额" width="110">
<a:grid bindTarget="unreceivedAmountDs" marginHeight="470" marginWidth="55" navBar="true">
<a:columns>
<a:column name="times" prompt="期数"/>
<a:column name="cf_type_dis" prompt="类型"/>
<a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatMoney"/>
<a:column name="received_amount" align="right" prompt="已收金额"
renderer="Leaf.formatMoney"/>
<a:column name="due_date" prompt="预定支付日期"/>
<a:column name="amount" align="right" prompt="未收金额" renderer="Leaf.formatMoney"/>
<a:column name="principal" align="right" prompt="未收本金" renderer="Leaf.formatMoney"/>
<a:column name="interest" align="right" prompt="未收利息" renderer="Leaf.formatMoney"/>
<!--<a:column name="termination_date" prompt="回购日"/>-->
<a:column name="cf_status_dis" prompt="现金流状态"/>
</a:columns>
</a:grid>
</a:tab>
<a:tab prompt="已收金额" width="110">
<a:grid bindTarget="receivedAmountDs" marginHeight="450" marginWidth="55" navBar="true">
<a:columns>
<a:column name="times" prompt="期数"/>
<a:column name="cf_type_dis" prompt="类型"/>
<a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatMoney"/>
<a:column name="received_amount" align="right" prompt="已收金额"
renderer="Leaf.formatMoney"/>
<a:column name="due_date" prompt="预定支付日期"/>
<a:column name="received_principal" align="right" prompt="已收本金"
renderer="Leaf.formatMoney"/>
<a:column name="received_interest" align="right" prompt="已收利息"
renderer="Leaf.formatMoney"/>
<!--<a:column name="termination_date" prompt="回购日"/>-->
<a:column name="cf_status_dis" prompt="现金流状态"/>
</a:columns>
</a:grid>
</a:tab>
</a:tabs>
</a:tabPanel>
</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