Commit 02da46fe authored by 陆正友's avatar 陆正友

Merge remote-tracking branch 'origin/remote_dev' into remote_dev

parents 79b40b79 78d1f4fd
......@@ -112,7 +112,16 @@
p_ref_d03=>to_date(${@ref_d03},'yyyy-mm-dd hh24:mi:ss'),
p_ref_d04=>to_date(${@ref_d04},'yyyy-mm-dd hh24:mi:ss'),
p_ref_d05=>to_date(${@ref_d05},'yyyy-mm-dd hh24:mi:ss'),
p_int_rate_display=>v_int_rate_display,
p_lease_item_amount=>${@lease_item_amount},
p_insurance_fee =>${@insurance_fee},
p_int_rate_display=>${@int_rate_display},
p_deposit_ratio=>${@deposit_ratio},
p_first_pay_date=>to_date(${@first_pay_date},'yyyy-mm-dd hh24:mi:ss'),
p_pmt=>${@pmt},
p_hd_user_col_d01=>to_date(${@hd_user_col_d01},'yyyy-mm-dd hh24:mi:ss'),
p_deposit=>${@deposit},
p_lease_term_month=>${@lease_term_month},
p_total_rental=>${@total_rental},
p_btb_int_rate=>${@btb_int_rate},
p_hd_user_col_v06=>${@hd_user_col_v06}
);
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: WW
$Date: 2014-11-13 下午5:36:09
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT t1.user_id,t1.user_name FROM sys_user t1 #WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="user_id" queryExpression="t1.user_id=${@user_id}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: weiwuzhen
$Date: 2016-5-5 下午3:45:05
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select *
from prj_project_bp_operat_lv p
where p.project_id=${@project_id}
and p.bp_category='RENTER'
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-11-1 下午04:17:01
$Revision: 1.0
$Purpose: 采购单报价信息
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[SELECT T1.* FROM (SELECT * FROM prj_quotation a) T1 #WHERE_CLAUSE#]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="document_id" queryExpression="t1.document_id=${@document_id} and t1.document_category=&apos;PROJECT&apos;"/>
</bm:query-fields>
</bm:model>
......@@ -13,6 +13,8 @@
modelaction="update"/>
<a:link id="csh501_csh_payment_req_link1_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req.lview"/>
<a:link id="csh501_csh_payment_req_op_link1_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_op_req.lview"/>
<a:link id="delete_payment_req_link_id" model="csh.CSH501.delete_payment_req" modelaction="batch_update"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function () {
......@@ -227,6 +229,8 @@
function detail_link(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
//跳转根据产品线区分经营性租赁 18083 2023/10/10
var division_diff = record.get('division_diff');
var param = {};
param['payment_req_id'] = record.get('payment_req_id');
param['document_category'] = record.get('document_category');
......@@ -246,7 +250,16 @@
} else if (record.get('business_type') == 'PREPAYMENT') {
param['function_code'] = 'CSH501_PRE_D';
}
if(division_diff=='95'){
if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') {
param['function_usage'] = 'UPDATE';
param['function_code'] = 'CSH501H_OP';
} else {
param['function_usage'] = 'QUERY';
param['function_code'] = 'CSH501Q_OP';
param['download'] = 'Y';
}
}else{
if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') {
param['function_usage'] = 'UPDATE';
param['function_code'] = 'CSH501D';
......@@ -255,6 +268,7 @@
param['function_code'] = 'CSH501Q';
param['download'] = 'Y';
}
}
param['winid'] = 'csh_payment_update_window';
param['url_title'] = '付款申请';
if (record.get('ln_cf_item') == 0) {
......@@ -262,8 +276,11 @@
} else {
param['cond_para1'] = 'OTHER';
}
if(division_diff=='95'){
hls_doc_get_layout_code('get_layout_code_link_id', param, 'csh501_csh_payment_req_op_link1_id', ds_id, '${/parameter/@layout_code}');
}else{
hls_doc_get_layout_code('get_layout_code_link_id', param, 'csh501_csh_payment_req_link1_id', ds_id, '${/parameter/@layout_code}');
}
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-9-27 上午09:27:36
$Revision: 1.0
$Purpose: 经营性租赁付款
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
customizationEnabled="true" dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
<a:model-query autoCount="false"
defaultWhereClause=" document_category=&apos;PAYMENT_REQ&apos; and document_type=&apos;STD_PREPAYMENT_REQ&apos;"
fetchAll="true" model="hls.HLS003.hls_document_type"
rootPath="default_prepayment_document_type"/>
<a:model-query autoCount="false"
defaultWhereClause=" document_category=&apos;PAYMENT_REQ&apos; and document_type=&apos;STD_PAYMENT_REQ&apos;"
fetchAll="true" model="hls.HLS003.hls_document_type" rootPath="default_payment_document_type"/>
<a:model-query fetchAll="true" model="csh.CSH501.get_loan_flag" rootPath="loan_flag_path"/>
</a:init-procedure>
<a:view>
<a:link id="csh_payment_req_op_word_print_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_op_word_print.lsc"/>
<a:link id="csh501d_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="update_csh_payment_hd_info_link" model="csh.CSH501.csh_payment_req_get_num" modelaction="execute"/>
<a:link id="con_rd_wfl_link" url="${/request/@context_path}/modules/prj/PRJ2000/purchase_order_deteail.lview"/>
<link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
<script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
<script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/>
<script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
<!-- 生成Excel文件-->
<a:link id="tre_loan_con_print_excel_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_contract_export.lsc"/>
<script type="text/javascript"><![CDATA[
jQuery.noConflict();
function get_current_amount(amt) {
if (!Ext.isEmpty(amt)) {
return parseFloat(amt).toFixed(2);
} else {
return 0;
}
}
//如果头id 不为空,就使用自在定义的ds进行查询
Leaf.onReady(function () {
if ('${/parameter/@source_type}' == 'WFL') {
document.getElementById('${/parameter/@layout_code}_save').style.display = "none";
}
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var payment_req_id = '${/parameter/@payment_req_id}';
if (payment_req_id) {
$(lnds_id).setQueryUrl('${/request/@context_path}/autocrud/csh.CSH501.csh_payment_req_ln_op_query_after_save/query');
$(lnds_id).setQueryParameter("payment_req_id", payment_req_id);
$(lnds_id).query();
$(hdds_id).setQueryParameter("payment_req_id", payment_req_id);
$(hdds_id).query();
}
});
if ('${/parameter/@payment_req_id}') {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
}
var dirty_flag = 'N';
window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
//如果更新数据,将付款日期先置为空
debugger;
dirty_flag = 'Y';
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
hd_ds = $(hdds_id);
var hdrecord = hd_ds.getCurrentRecord();
var bank_account_name = hdrecord.get('third_bp_id_n');
var vender_bank_account_id = hdrecord.get('t_bank_account_id');
var bank_account_num = hdrecord.get('t_bank_account_num');
var bank_full_name = hdrecord.get('t_bank_full_name');
var hd_ds, ln_ds, lineRecords, currency_code, currency_name;
if (hdds_id) {
if((name == 't_bank_account_name'||name == 't_bank_account_name_n'||name == 't_bank_full_name'||name == 't_bank_account_id') && !Ext.isEmpty(hdrecord.get('t_bank_account_name_n')) && !Ext.isEmpty(hdrecord.get('third_bp_id_n'))&& !Ext.isEmpty(hdrecord.get('t_bank_full_name'))&& !Ext.isEmpty(hdrecord.get('t_bank_account_id'))){
var records = $(lnds_id).getAll();
for (var i = 0; i < records.length; i++) {
records[i].set('vender_bank_account_number', bank_account_num);
records[i].set('vender_bank_account_number_n', bank_account_num);
records[i].set('vender_bank_account_name', bank_account_name);
records[i].set('vender_bank_account_id', vender_bank_account_id);
records[i].set('vender_bank_full_name', bank_full_name);
records[i].getField('vender_bank_account_number').setReadOnly(true);
records[i].getField('vender_bank_account_number_n').setReadOnly(true);
}
}
if((name == 'third_bp_id'||name == 'third_bp_id_n') && (Leaf.isEmpty(record.get('document_number_t')) || bank_account_name=='')){
var records = $(lnds_id).getAll();
hdrecord.set('t_bank_account_num',null);
hdrecord.set('t_bank_branch_name',null);
hdrecord.set('t_bank_full_name',null);
hdrecord.set('t_bank_account_id',null);
for (var i = 0; i < records.length; i++) {
records[i].getField('vender_bank_account_number').setReadOnly(false);
records[i].getField('vender_bank_account_number_n').setReadOnly(false);
}
}
}
if (lnds_id && $L.CmpManager.get(lnds_id)) {
ln_ds = $(lnds_id);
lineRecords = ln_ds.getAll();
}
if (lnds_id && lnds_id == ds.id) {
if (name == 'amount') {
var due_amount =get_current_amount(record.get('due_amount'));
if (value < 0) {
Leaf.showMessage('${l:HLS.PROMPT}', '所填金额应大于等于0!');
setTimeout(function () {
record.set(name, null);
}, 5);
return;
}
if (value > due_amount) {
$L.showErrorMessage("提示", '所填金额不能大于应付金额!');
setTimeout(function () {
record.set(name, null);
}, 5);
}
//设置本次抵扣金额
//var insurance_fee_ddct = minus(due_amount,value);
record.set('insurance_fee_ddct',minus(due_amount,value));
}
if (name == 'insurance_fee_ddct') {
var insurance_fee =get_current_amount(record.get('insurance_fee'));
if (value > insurance_fee) {
$L.showErrorMessage("提示", '厂商质保金抵扣金额不能大于厂商质保金!');
setTimeout(function () {
record.set(name, insurance_fee);
}, 5);
}
}
}
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var hd_ds, lineRecords, currency_code;
if (hdds_id) {
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
var first_load_flag = 'N';
function on_csh_payment_req_temp_ln_ds_load(ds) {
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var records = ds.getAll();
if (!'${/parameter/@payment_req_id}' && lnds_id && '${/parameter/@business_type}' == 'PAYMENT') {
for (var i = 0; i < records.length; i++) {
var record = records[i];
$(lnds_id).create(Ext.apply({}, record.data));
}
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
function csh_payment_req_submit_finally() {
Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS.ARE_YOU_SURE_TO_SUBMIT}', function okFun() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(ds_id).getCurrentRecord();
var payment_req_id = hd_record.get('payment_req_id');
var line_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var line_record = $(line_ds_id).getAt(0);
Leaf.request({
url: '${/request/@context_path}/autocrud/csh.CSH501.upd_csh_payment_sub_flag/execute',
para: {
payment_req_id: payment_req_id,
_status: 'execute'
},
success: function (res) {
Leaf.SideBar.enable = true;
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function () {
Leaf.SideBar.enable = true;
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
Leaf.SideBar.enable = true;
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}, function cancelFun() {
Leaf.SideBar.enable = true;
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
});
}
//打印
function csh501_print() {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
var url_l = $('csh_payment_req_op_word_print_link_id').getUrl() + '?document_id=' + hd_record.get('payment_req_id') + '&document_table=CSH_PAYMENT_REQ&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
window.open(href = url_l, target = "_self");
}
window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function () {
Leaf.SideBar.enable = false;
window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](csh_payment_req_submit_finally);
};
window['${/parameter/@layout_code}_print_layout_dynamic_click'] = function () {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var hd_ds = $(hdds_id),
ln_ds = $(lnds_id);
var hd_record = hd_ds.getCurrentRecord(),
ln_records = ln_ds.getAll();
if (ln_records.length > 0 && !ln_records[0].get('payment_req_ln_id')) {
Leaf.showMessage('${HLS.PROMPT}', '请先保存!');
} else {
csh501_print();
}
};
//保存前调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
var check_flag = false;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var ds_line_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
if ($(ds_line_id).data.length <= 0) {
$L.showErrorMessage("错误", '无付款记录,不可提交审批!');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
check_flag = false;
return;
}
var total_apply_amount = 0;
var total_amount_vender = 0;
var this_apply_amount=0;
var lease_item_amount=0;
var total_insurance_fee_ddct=0;
//检验输入的数据是否符合要求
var check_due_amount_flag = true;
var line_datas = $(ds_line_id).data;
var head_record = $(ds_id).getAt(0);
for (var i = 0; i < line_datas.length; i++) {
var line_data = line_datas[i];
//付厂商金额
var amount_vender = get_current_amount(line_data.get('amount'));
//采购总额
var this_apply_amount = get_current_amount(line_data.get('due_amount'));
var lease_item_amount = get_current_amount(line_data.get('lease_item_amount'));
var insurance_fee_ddct = get_current_amount(line_data.get('insurance_fee_ddct'));
total_apply_amount = plus(total_apply_amount, this_apply_amount);
total_amount_vender = plus(total_amount_vender, amount_vender);
total_insurance_fee_ddct = plus(total_insurance_fee_ddct, insurance_fee_ddct);
}
if(plus(total_insurance_fee_ddct, total_amount_vender) != total_apply_amount){
$L.showErrorMessage("提示", '本次申请金额与厂商质保金抵扣金额和应等于申请总金额!',null,500,300);
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
//给头表赋值
$(ds_id).getAt(0).set('amount_vender_total', total_amount_vender);
$(ds_id).getAt(0).set('amount', total_amount_vender);
$(ds_id).getAt(0).set('company_id', '${/session/@company_id}');
$(ds_id).getAt(0).set('transaction_category', 'BUSINESS');
$(ds_id).getAt(0).set('submitted_flag', 'N');
$(ds_id).getAt(0).set('printed_flag', 'N');
$(ds_id).getAt(0).set('document_category', 'PAYMENT_REQ');
//$(ds_id).getAt(0).set('currency_code', 'CNY');
//确认保存
var hd_record = $(ds_id).getCurrentRecord();
var payment_req_id = hd_record.get('payment_req_id');
if (payment_req_id) {
Leaf.request({
url: $('${/parameter/@layout_code}csh511_csh_payment_req_hd_query').getUrl(),
para: {
payment_req_id: payment_req_id,
},
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
if (res.result.record.submitted_flag == 'Y' && '${/parameter/@source_type}' != 'WFL_Y') {
Leaf.showMessage('${l:PROMPT}', '该单据已经提交');
check_flag = false;
} else {
check_flag = true;
}
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
check_flag = false;
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
check_flag = false;
},
sync: true,
scope: this
});
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
} else {
check_flag = true;
}
return check_flag || false;
};
window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
if (hdds_id == ds.id && record.isNew) {
if ('${/parameter/@business_type}' == 'PAYMENT') {
record.set('business_type', '${/model/default_payment_document_type/record/@business_type}');
record.set('document_type', '${/model/default_payment_document_type/record/@document_type}');
record.set('document_type_n', '${/model/default_payment_document_type/record/@description}');
record.set('con_business_type', '${/parameter/@con_business_type}');
record.set('con_business_type_n', '${/parameter/@con_business_type_n}');
record.set('taxpayer_type', '${/parameter/@taxpayer_type}');
record.set('taxpayer_type_n', '${/parameter/@taxpayer_type_n}');
record.set('contract_id', '${/parameter/@contract_id}');
} else if ('${/parameter/@business_type}' == 'PREPAYMENT') {
record.set('business_type', '${/model/default_prepayment_document_type/record/@business_type}');
record.set('document_type', '${/model/default_prepayment_document_type/record/@document_type}');
record.set('document_type_n', '${/model/default_prepayment_document_type/record/@description}');
record.set('contract_id', '${/parameter/@contract_id}');
}
}
};
//保存submitsuccess调用
window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function (ds, record, res, bp_seq) {
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
dirty_flag = 'N';
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
var payment_req_id = hd_record.get('payment_req_id');
//获得相应的行信息
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
$(lnds_id).setQueryUrl('${/request/@context_path}/autocrud/csh.CSH501.csh_payment_req_ln_op_query_after_save/query');
var contract_id = '${/parameter/@contract_id}';
if (payment_req_id) {
//更新头信息
Leaf.Masker.mask(Ext.getBody(), '正在保存中。。。');
Leaf.request({
url: $('update_csh_payment_hd_info_link').getUrl(),
para: {
payment_req_id: payment_req_id
},
success: function () {
Leaf.Masker.unmask(Ext.getBody());
$(hdds_id).setQueryParameter('payment_req_id', payment_req_id);
$(hdds_id).query();
},
failure: function () {
Leaf.Masker.unmask(detail_mask);
},
error: function () {
Leaf.Masker.unmask(detail_mask);
},
scope: this
});
$(lnds_id).setQueryParameter('payment_req_id', payment_req_id);
$(lnds_id).query();
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存数据');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
//采购单编号超链接
function open_pur_project_readonly_win(record_id, ds_id) {
var record = $(ds_id).findById(record_id);
var project_id=record.get('project_id');
var param = record.data;
param.function_code = 'PRJ2000D_WFL';
param.function_usage = 'QUERY';
param.maintain_type = 'READONLY';
param.url_title = '采购申请单维护';
param['project_id'] = project_id;
hls_doc_get_layout_code('csh501d_get_layout_code_link_id', param, 'con_rd_wfl_link', '', '${/parameter/@layout_code}');
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'project_number' && value) {
return '<a href="javascript:open_pur_project_readonly_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function (ds, qpara, bp_seq) {
};
function on_csh_payment_req_temp_ln_ds_query(ds, qpara) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
qpara['payment_bp_id'] = '${/parameter/@payment_bp_id}';
}
]]></script>
<a:link id="${/parameter/@layout_code}csh511_csh_payment_req_hd_query" model="csh.CSH511.csh_payment_req_hd"
modelaction="query"/>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
<a:dataSet id="csh_payment_req_temp_ln_ds" autoQuery="true" fetchAll="true"
model="csh.CSH501.csh_payment_req_op_ln_query">
<a:events>
<a:event name="load" handler="on_csh_payment_req_temp_ln_ds_load"/>
<a:event name="query" handler="on_csh_payment_req_temp_ln_ds_query"/>
</a:events>
</a:dataSet>
</a:dataSets>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-9-28 下午03:50:31
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select rownum, v.*
from (select
(select cc.contract_number
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(c.project_id)) contract_number,
(select cc.search_term_1
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(c.project_id)) vender_contract_number,
(select pp.project_number from prj_project pp where pp.project_id=c.project_id) project_number,
c.contract_id,
c.bp_id_tenant,
c.project_id,
(select b.bp_name
from con_contract_bp b
where b.contract_id = c.contract_id
and b.bp_category = 'TENANT') bp_id_tenant_n,
hbm.bp_name,
(select cph.payment_req_number
from csh_payment_req_hd cph
where cpr.payment_req_id = cph.payment_req_id) payment_req_number,
cpr.ref_doc_line_id cashflow_id,
(select times
from con_contract_cashflow ccc
where ccc.cashflow_id = cpr.ref_doc_line_id) times,
(select ccc.due_amount
from con_contract_cashflow ccc
where ccc.cashflow_id = cpr.ref_doc_line_id) due_amount,
(select description
from hls_cashflow_item hci, con_contract_cashflow ccc
where hci.cf_item = ccc.cf_item
and hci.cf_type = ccc.cf_type
and ccc.cashflow_id = cpr.ref_doc_line_id) CF_DESCRIPTION,
cpr.vender_name vender_name,
cpr.vender_bank_account_id,
cpr.vender_bank_account_number vender_bank_account_number,
cpr.vender_bank_account_number vender_bank_account_number_n,
cpr.vender_bank_account_name vender_bank_account_name,
cpr.vender_bank_full_name vender_bank_full_name,
cpr.amount,
c.lease_item_amount,
--发票状态
acp_invoice_pkg.return_invoice_status(p_contract_id => c.contract_id) invoice_status_n,
(SELECT gc.currency_name
FROM gld_currency_v gc
WHERE gc.currency_code = cpr.currency_code) currency_name,
cpr.payment_req_ln_id,
cpr.payment_req_id,
cpr.payment_req_ln_type,
cpr.ref_doc_id,
cpr.ref_doc_line_id,
cpr.ref_doc_category,
c.division,
(select pp.ref_d10 from prj_project pp where pp.project_id=c.project_id) due_date,
(select count(*)
from prj_project_lease_item pp
where pp.project_id=c.project_id
) lease_item_count,
(select nvl(sum(nvl(pp.ACTUAL_PRICE, 0) * nvl(pp.BALLOON_RATIO,0)),0)
from prj_project_lease_item pp
where pp.project_id=c.project_id
) insurance_fee,
cpr.insurance_fee_ddct
from csh_payment_req_ln cpr,
con_contract c,
hls_bp_master hbm,
con_contract_cashflow ccc
where cpr.ref_doc_category = 'CONTRACT'
and c.contract_id = cpr.ref_doc_id
and hbm.bp_id = c.bp_id_tenant
AND ccc.contract_id = c.contract_id
AND ccc.cf_item = 0) v
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:data-filters>
<bm:data-filter enforceOperations="query" expression="v.payment_req_id =${@payment_req_id}"/>
</bm:data-filters>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-9-28 下午03:50:31
$Revision: 1.0
$Purpose:经营性租赁付款
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1"
baseTable="CSH_PAYMENT_REQ_LN" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT v.contract_id,
v.project_id,
'NEW' approval_status,
v.invoice_uploaded_flag,
v.invoice_uploaded_flag_n,
v.lease_item_count lease_item_count,
v.times,
v.cashflow_id,
v.cashflow_id ref_doc_line_id,
v.contract_id ref_doc_id,
v.document_category ref_doc_category,
v.contract_number,
v.vender_contract_number,
v.project_number,
v.insurance_fee,
v.tenant_bp_id,
v.tenant_bp_id bp_id_tenant,
v.bp_id_tenant_n,
v.cf_description,
v.due_amount,
v.currency_code,
v.currency_name,
v.due_date,
v.residual_amount,
v.bp_id,
v.bp_code bp_id_n,
v.bp_name,
v.bp_code,
v.applied_pay_amount,
v.amount amount,
v.insurance_fee_ddct insurance_fee_ddct,
v.bp_category_desc,
'' bank_full_name, --宏菱需要置为空 bank_key
v.irr,
--厂商账户
(SELECT hbbc.bank_account_name
FROM hls_bp_master_bank_account hbbc
WHERE hbbc.bank_account_id=v.bp_bank_account_id ) vender_bank_account_name,
v.bp_bank_account_id vender_bank_account_id,
--厂商账号
(SELECT hbbc.bank_account_num
FROM hls_bp_master_bank_account hbbc
WHERE hbbc.bank_account_id=v.bp_bank_account_id ) vender_bank_account_number,
--厂商账号
(SELECT hbbc.bank_account_num
FROM hls_bp_master_bank_account hbbc
WHERE hbbc.bank_account_id=v.bp_bank_account_id ) vender_bank_account_number_n,
(SELECT hbbc.bank_full_name
FROM hls_bp_master_bank_account hbbc
WHERE hbbc.bank_account_id=v.bp_bank_account_id ) vender_bank_full_name,
(SELECT hb.sap_bvtyp
FROM hls_bp_master_bank_account hb
WHERE hb.bank_account_id = v.bp_bank_account_id) sap_bvtyp,
(SELECT v.code_value_name
FROM sys_code_values_v v
WHERE v.code = 'HLS_SAP_BVTYP'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND v.code_value =
(SELECT hb.sap_bvtyp
FROM hls_bp_master_bank_account hb
WHERE hb.bank_account_id = v.bp_bank_account_id)) sap_bvtyp_n,
v.division,
v.finance_amount,
v.lease_item_amount
FROM (SELECT
t.contract_id,
--con_contract_pkg.get_first_contract_id(t.project_id) contract_id,
t.project_id,
(SELECT hbbc.bank_account_id
FROM hls_bp_master_bank_account hbbc
WHERE hbbc.bp_id=t.bp_id_tenant AND ROWNUM=1)bp_bank_account_id,
(SELECT DECODE(COUNT(1), 0, 'N', 'Y')
FROM acp_invoice_ln ai
WHERE ai.contract_id = t.contract_id) invoice_uploaded_flag,
(SELECT v.code_value_name AS value_name
FROM sys_code_values_v v
WHERE v.code = 'YES_NO'
AND v.code_enabled_flag = 'Y'
AND v.code_value_enabled_flag = 'Y'
AND v.code_value =
(SELECT DECODE(COUNT(1), 0, 'N', 'Y')
FROM acp_invoice_ln ai
WHERE ai.contract_id = t.contract_id)) invoice_uploaded_flag_n,
f.times,
f.cashflow_id,
(select cc.contract_number
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_number,
(select cc.search_term_1
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) vender_contract_number,
t.document_category,
(select pp.project_number from prj_project pp where pp.project_id=t.project_id) project_number,
t.bp_id_tenant tenant_bp_id,
h.description cf_description,
f.due_amount,
t.currency currency_code,
'' bp_bank_account_id_n,
(SELECT t.bank_branch_name
FROM hls_bp_master_bank_account_v t
WHERE t.bp_id =
NVL(${@payment_bp_id},
csh_payment_req_pkg.get_bp_id(t.contract_id))
AND t.enabled_flag = 'Y'
AND rownum = 1) bank_full_name,
(SELECT gc.currency_name
FROM gld_currency_v gc
WHERE gc.currency_code = t.currency) currency_name,
(select pp.ref_d10 from prj_project pp where pp.project_id=t.project_id) due_date,
NVL(f.due_amount, 0) - NVL(f.received_amount, 0) residual_amount,
--本次申请金额默认为采购总额-厂商质保金
NVL(f.due_amount, 0)-
(select nvl(sum(nvl(pp.ACTUAL_PRICE, 0) * nvl(pp.BALLOON_RATIO,0)),0)
from prj_project_lease_item pp
where pp.project_id=t.project_id
) amount,
--默认抵扣金额:厂商质保金
(select nvl(sum(nvl(pp.ACTUAL_PRICE, 0) * nvl(pp.BALLOON_RATIO,0)),0)
from prj_project_lease_item pp
where pp.project_id=t.project_id
) insurance_fee_ddct,
(select c.bp_id_tenant
from con_contract c
where c.contract_id=t.contract_id ) bp_id,
(SELECT b.bp_name
FROM hls_bp_master b
WHERE b.bp_id =
NVL(${@payment_bp_id},
csh_payment_req_pkg.get_bp_id(t.contract_id))) bp_name,
(SELECT hbm.bp_name
FROM hls_bp_master hbm
WHERE hbm.bp_id = t.bp_id_tenant) bp_id_tenant_n,
(SELECT b.bp_code
FROM hls_bp_master b
WHERE b.bp_id =
NVL(${@payment_bp_id},
csh_payment_req_pkg.get_bp_id(t.contract_id))) bp_code,
(SELECT b.bp_category_name
FROM hls_bp_master_v b
WHERE b.bp_id =
NVL(${@payment_bp_id},
csh_payment_req_pkg.get_bp_id(t.contract_id))) bp_category_desc,
(NVL((SELECT SUM(l.amount_paid)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVED'
AND NVL(h.closed_flag, 'N') = 'Y'),
0) +
NVL((SELECT SUM(l.amount)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVED'
AND NVL(h.closed_flag, 'N') <> 'Y'),
0) +
NVL((SELECT SUM(l.amount)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVING'),
0)) applied_pay_amount,
t.irr,
t.division,
t.finance_amount,
t.lease_item_amount,
(select count(*)
from prj_project_lease_item pp
where pp.project_id=t.project_id
) lease_item_count,
(select nvl(sum(nvl(pp.ACTUAL_PRICE, 0) * nvl(pp.BALLOON_RATIO,0)),0)
from prj_project_lease_item pp
where pp.project_id=t.project_id
) insurance_fee
FROM con_contract_cashflow f
join con_contract t
on t.contract_id = f.contract_id
join hls_cashflow_item h
on f.cf_item = h.cf_item
where EXISTS (SELECT 1
FROM CSH_PAYMENT_CASHFLOW_ID_TEMP tmp
WHERE tmp.session_id = ${/session/@session_id}
AND tmp.cashflow_id = f.cashflow_id)) v
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-9-26 下午03:42:50
$Revision: 1.0
$Purpose: 经营性租赁付款采购单查询
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:f="leaf.database.features"
xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select *
from (SELECT t.contract_id,
--con_contract_pkg.get_first_contract_id(t.project_id) contract_id,
(select cc.contract_number
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_number,
(select cc.search_term_1
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) vender_con_number,
(select cc.contract_status
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_status,
(select sc.code_value_name
from con_contract cc, sys_code_values_v sc
where sc.code_value = cc.contract_status
and sc.code = 'CON500_CONTRACT_STATUS'
and cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_status_desc,
f.cashflow_id,
f.times,
t.bp_id_tenant,
hbm.bp_id tenant_bp_id,
h.description cf_item_desc,
h.cf_item,
f.due_amount,
--发票状态
acp_invoice_pkg.return_invoice_status(p_contract_id => t.contract_id) invoice_status_n,
to_char(f.due_date, 'yyyy-mm-dd') due_date,
nvl(f.received_amount, 0) received_amount,
nvl(f.due_amount, 0) - nvl(f.received_amount, 0) residual_amount,
(nvl((SELECT SUM(l.amount_paid)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVED'
AND nvl(h.closed_flag, 'N') = 'Y'),
0) +
nvl((SELECT SUM(l.amount)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVED'
AND nvl(h.closed_flag, 'N') <> 'Y'),
0) +
nvl((SELECT SUM(l.amount)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVING'),
0)) applied_pay_amount,
(select pp.project_number
from prj_project pp
where pp.project_id = t.project_id) project_number,
(select bp.bp_name
from hls_bp_master bp, prj_project p
where bp.bp_id = p.bp_id_tenant
and p.project_id = t.project_id) vender_name_n,
(select nvl(sum(li.ACTUAL_PRICE), 0)
from prj_project_lease_item li
where li.project_id = t.project_id) lease_item_amount,
(select count(1)
from prj_project_lease_item li
where li.project_id = t.project_id) lease_item_count,
(select to_char(p.ref_d10, 'yyyy-mm-dd')
from prj_project p
where p.project_id = t.project_id) plan_order_date,
(SELECT nvl(sum(nvl(li.ACTUAL_PRICE, 0) *
nvl(li.BALLOON_RATIO, 0)),
0)
from prj_project_lease_item li
where li.project_id = t.project_id) insurance_fee
FROM con_contract_cashflow f,
hls_cashflow_item h,
hls_bp_master hbm,
con_contract t
WHERE t.contract_id = f.contract_id
and t.bp_id_tenant = hbm.bp_id(+)
AND f.cf_item = h.cf_item(+)
AND h.cf_direction(+) = 'OUTFLOW'
AND f.write_off_flag <> 'FULL'
AND f.cf_status IN ('RELEASE', 'BLOCK')
AND f.cf_direction = 'OUTFLOW'
and t.business_type = 'OTHERS'
and t.document_type = 'PUR_ORDER'
and t.division='95'
AND nvl(t.contract_status,'NEW') = 'INCEPT'
AND NOT EXISTS(SELECT 1
FROM csh_payment_req_ln l, csh_payment_req_hd hd
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.ref_doc_category = 'CONTRACT'
and l.payment_req_id = hd.payment_req_id
and hd.approval_status in
('NEW', 'REJECT', 'APPROVED', 'APPROVING', 'RETURN'))
AND t.data_class = 'NORMAL'
AND ('Y' = 'Y' AND EXISTS
(SELECT 1
FROM aut_trx_user_authorize a1, aut_owner_user_authorize a2
WHERE a1.trx_category = 'CONTRACT'
AND a1.trx_id = con_contract_pkg.get_first_contract_id(t.project_id)
AND trunc(SYSDATE) BETWEEN a1.start_date AND
nvl(a1.end_date, trunc(SYSDATE))
AND a1.user_id = a2.owner_user_id
AND a1.trx_category = a2.trx_category
AND a2.authorized_user_id = ${/session/@user_id}
AND trunc(SYSDATE) BETWEEN a2.start_date AND
nvl(a2.end_date, trunc(SYSDATE))))
AND f.cf_item in (0)) t1
#WHERE_CLAUSE#
#ORDER_BY_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="project_number"
queryExpression="t1.project_number like &apos;%&apos;||${@project_number}||&apos;%&apos;"/>
<bm:query-field name="plan_order_date_from"
queryExpression="t1.plan_order_date &gt;= ${@plan_order_date_from}"/>
<bm:query-field name="plan_order_date_to"
queryExpression="t1.plan_order_date &lt;= ${@plan_order_date_to}"/>
<bm:query-field name="lease_item_amount"
queryExpression="t1.due_amount&gt;=${@lease_item_amount}"/>
<bm:query-field name="vender_con_number" queryExpression="t1.vender_con_number=${@vender_con_number}"/>
<bm:query-field name="invoice_status_n"
queryExpression="t1.invoice_status_n like &apos;%&apos;||${@invoice_status_n}||&apos;%&apos;"/>
<bm:query-field name="contract_number" queryExpression="t1.contract_number=${@contract_number}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-update model="hls.HLS811.hls_doc_file_templet_get_atm"/>
<s:server-script import="contract_print_path.js"><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j);
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.org.apache.commons.io);
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
//生成pdf
function wordToPdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
wordToPdf.word2pdf(word_file_path, pdf_file_path_new);
//删除word文件
//deleteFile(word_file_path);
return pdf_file_path_new;
}
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
function transfer(file_path, os) {
println(file_path);
var fis = new FileInputStream(file_path);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function write_os_to_file(file, os) {
var fis = new FileInputStream(file);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function download_file(file_name, file_path) {
$ctx["__request_type__"] = 'file'; //to indicate this request is not a JSON_REQUEST
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
resp.setHeader("Pragma", "No-cache");
resp.setHeader("Cache-Control", "no-cache, must-revalidate");
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'UTF-8'));
var os = resp.getOutputStream();
//transfer(file_path, os);
write_os_to_file(file_path, os);
os.flush();
}
//按日期创建目录
function getDatePath() {
set_parameter_file_path();
var file_path = $ctx.parameter.pdf_path; //file_path = c:/hls_test_files/content_files/
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var datePath = file_path + y + "/" + m + "/";
return datePath; //datePath = d:/hls_test_files/fileupload/2018/04/
}
function collection_create_content() {
try {
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var attachment_batch_dl = $bm('hls.HLS811.hls_doc_file_templet_get_atm');
var result = attachment_batch_dl.queryAsMap({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table,
batch_flag: $ctx.parameter.batch_flag,
content_id: $ctx.parameter.content_id
});
var from_file_data = result.getChildren();
for (var i = 0;i < from_file_data.length;i++) {
if (!$ctx.parameter.file_path) {
set_parameter_file_path();
}
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
//if (record_data.file_exists_flag != 'Y') {
var to_file_name = record_data.to_file_name;
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = datePath + guid_file_name_tables[0].guid_file_name + 'doc' + record_data.content_id;
copyFile(from_file_path, to_file_path);
try {
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id.toString(), 'COMMON');
} catch (e) {
raise_app_error(e);
}
// word转pdf
var pdf_file_path=to_file_path;
var outputfilepath = wordToPdf(to_file_path,pdf_file_path);
//var outputfilename= record_data.to_file_name +'.pdf';
var filename_str = record_data.to_file_name;
var outputfilename= filename_str.substr(0, filename_str.length - 5) +'.pdf';
var pdf_file = new File(outputfilepath);
var file_size = 0;
if (pdf_file.exists()) {
file_size = pdf_file.length();
}
$bm('hls.HLS811.hls_file_content_copy_update').update({
table_name: 'HLS_DOC_FILE_CONTENT',
content_id: record_data.content_id,
file_name: outputfilename.toString(),
file_path: outputfilepath.toString(),
source_type: $ctx.parameter.source_type
});
//var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
//HlsFileUtil.downloadFile(encodeURI(to_file_path,'utf-8'),encodeURI(to_file_name,'utf-8'),resp);
//print(outputfilepath.toString());
//print(outputfilename.toString());
download_file(outputfilename.toString(),outputfilepath.toString());
}
$ctx.parameter.return_status = 'S';
$ctx.parameter.return_message = '执行成功';
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = 'E';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
raise_app_error(e);
}
var result = {
result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message
};
$ctx.parameter.json = JSON.stringify(result);
}
if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
collection_create_content();
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
......@@ -19,6 +19,8 @@
url="${/request/@context_path}/modules/csh/CSH504/csh_prepayment_update.lview"/>
<a:link id="csh501_csh_payment_req_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req.lview"/>
<a:link id="csh501_csh_payment_op_req_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_op_req.lview"/>
<a:link id="csh501_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
......@@ -33,19 +35,101 @@
$('${/parameter/@ds_id}').query();
}
function confirmFun_op(){
var a = $('csh_payment_req_op_selectedDs').getSelected();
var record = a[0];
var cashflow_id_list = [];
var param = {};
var contract_id_list = [];
if (record == undefined) {
Leaf.showMessage('${l:PROMPT_MESSAGE}', '至少选择一条现金流!', null, 250, 100);
return;
}
//对是否为同一个厂商进行检查
var vender_name = record.get('vender_name_n');
for (i = 0; i < a.length; i++) {
//检验厂商
if (a[i].get('vender_name_n') != vender_name) {
vender_flag = false;
$L.showErrorMessage("提示", '请选择厂商相同的现金流信息!');
return;
}
if(a[i].get('invoice_status_n')!='已确认'){
$L.showErrorMessage("提示",'请选择发票状态为已确认的现金流!');
return;
}
cashflow_id = a[i].get('cashflow_id');
var arr = {};
contract_id_list[i] = a[i].get('contract_id');
arr['_status'] = 'insert';
arr['cashflow_id'] = cashflow_id;
arr['contract_id'] = a[i].get('contract_id');
arr['session_id'] = '${/session/@session_id}';
cashflow_id_list.push(arr);
}
param['details'] = cashflow_id_list;
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
Leaf.request({
url: $('csh_payment_req_cashflow_id_link').getUrl(),
para: param,
success: function () {
if (cashflow_id != '') {
Leaf.Masker.unmask(Ext.getBody());
var param = {};
var query_record = $('csh_payment_req_op_query_ds').getCurrentRecord();
param['function_code'] = 'CSH501H_OP';
param['function_usage'] = 'CREATE';
param['document_category'] = 'PAYMENT_REQ';
param['business_type'] = 'PAYMENT';
param['business_type_n'] = '预付款申请';
param['payment_bp_id'] = query_record.get('bp_id');
//param['bp_id_tenant'] = record.get('bp_id_tenant');
//param['taxpayer_type'] = record.get('taxpayer_type');
//param['taxpayer_type_n'] = record.get('taxpayer_type_n');
//param['con_business_type'] = record.get('con_business_type');
//param['con_business_type_n'] = record.get('con_business_type_n');
param['contract_id'] = record.get('contract_id');
//add by 9188
if (a.length == 1) {
param['contract_number'] = record.get('contract_number');
//param['bp_id_tenant_n'] = record.get('bp_id_tenant_n');
}
param['winid'] = 'csh501_csh_payment_op_req_link_winid';
param['url_title'] = '付款申请';
hls_doc_get_layout_code('csh501_get_layout_code_link_id', param, 'csh501_csh_payment_op_req_link_id', 'csh_payment_req_op_selectedDs');
}
},
failure: function () {
Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
function confirmFun() {
debugger;
var a = $('csh_payment_req_selectedDs').getSelected();
var record = a[0];
var b = $('csh_payment_req_op_selectedDs').getSelected();
var record_b = b[0];
var cashflow_id_list = [];
var param = {};
var contract_id_list = [];
if (record == undefined) {
if (a.length == 0 && b.length==0) {
Leaf.showMessage('${l:PROMPT_MESSAGE}', '至少选择一条现金流!', null, 250, 100);
return;
}
if (a.length > 0 && b.length>0) {
Leaf.showMessage('${l:PROMPT_MESSAGE}', '经租合同与非经租合同不能同时勾选!', null, 250, 100);
return;
}
//非经租,保持原逻辑
if(a.length > 0 ){
//对是否为同一个厂商进行检查
var vender_name = record.get('vender_name_n');
//对铁甲和非铁甲的校验
......@@ -147,7 +231,67 @@
},
scope: this
});
// }
}else{
//对是否为同一个厂商进行检查
var vender_name = record_b.get('vender_name_n');
var vender_flag = true;
for (i = 0; i < b.length; i++) {
//检验厂商
if (b[i].get('vender_name_n') != vender_name) {
vender_flag = false;
$L.showErrorMessage("提示", '请选择厂商相同的现金流信息!');
return;
}
if(b[i].get('invoice_status_n')!='已确认'){
$L.showErrorMessage("提示",'请选择发票状态为已确认的现金流!');
return;
}
cashflow_id = b[i].get('cashflow_id');
var arr = {};
contract_id_list[i] = b[i].get('contract_id');
arr['_status'] = 'insert';
arr['cashflow_id'] = cashflow_id;
arr['contract_id'] = b[i].get('contract_id');
arr['session_id'] = '${/session/@session_id}';
cashflow_id_list.push(arr);
}
param['details'] = cashflow_id_list;
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
Leaf.request({
url: $('csh_payment_req_cashflow_id_link').getUrl(),
para: param,
success: function () {
if (cashflow_id != '') {
Leaf.Masker.unmask(Ext.getBody());
var param = {};
var query_record = $('csh_payment_req_op_query_ds').getCurrentRecord();
param['function_code'] = 'CSH501H_OP';
param['function_usage'] = 'CREATE';
param['document_category'] = 'PAYMENT_REQ';
param['business_type'] = 'PAYMENT';
param['business_type_n'] = '预付款申请';
param['payment_bp_id'] = query_record.get('bp_id');
param['contract_id'] = record_b.get('contract_id');
//add by 9188
if (a.length == 1) {
param['contract_number'] = record_b.get('contract_number');
//param['bp_id_tenant_n'] = record_b.get('bp_id_tenant_n');
}
param['winid'] = 'csh501_csh_payment_op_req_link_winid';
param['url_title'] = '付款申请';
hls_doc_get_layout_code('csh501_get_layout_code_link_id', param, 'csh501_csh_payment_op_req_link_id', 'csh_payment_req_op_selectedDs');
}
},
failure: function () {
Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
}
......@@ -166,6 +310,7 @@
function payment_req_query() {
$('csh_payment_req_selectedDs').query();
$('csh_payment_req_op_selectedDs').query();
}
function csh501_payment_maintain_update(ds, record, name, value, oldvalue) {
......@@ -215,6 +360,7 @@
function csh501_payment_reset() {
$('csh_payment_req_query_ds').reset();
$('csh_payment_req_op_query_ds').reset();
}
]]></script>
......@@ -351,6 +497,34 @@
<a:events>
<a:event name="query" handler="aut_authority_list_validate_query"/>
</a:events>
</a:dataSet>
<!--经营性租赁-->
<a:dataSet id="csh_payment_req_op_query_ds" autoCreate="true">
<a:fields>
<a:field name="project_number"/>
<a:field name="vender_name_n" lovGridHeight="300" lovHeight="450" lovLabelWidth="120"
lovService="basic.hls_bp_master_v_for_lov?bp_category=MAN_FACTURER" lovWidth="600" title="厂商">
<a:mapping>
<a:map from="bp_name" to="vender_name_n"/>
</a:mapping>
</a:field>
<a:field name="project_number"/>
<a:field name="plan_order_date_from"/>
<a:field name="plan_order_date_to"/>
<a:field name="lease_item_amount"/>
<a:field name="invoice_status_n"/>
<a:field name="vender_con_number"/>
</a:fields>
</a:dataSet>
<a:dataSet id="csh_payment_req_op_selectedDs" fetchAll="true" autoQuery="true"
model="csh.CSH501.csh_payment_req_op_selected" queryDataSet="csh_payment_req_op_query_ds"
selectable="true">
<a:field name="cf_item"/>
<a:field name="first_contract_day"/>
<a:field name="division"/>
<a:events>
<a:event name="query" handler="aut_authority_list_validate_query"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
......@@ -362,6 +536,9 @@
<a:gridButton id="csh511_receipt_posted_id" click="confirmFun" text="HAP_CONFIRM"/>
<!-- <a:gridButton id="csh511_receipt_prepayment_id" click="csh511_prepayment_create" text="预付款创建"/> -->
</a:screenTopToolbar>
<a:tabPanel height="700" Width="2000">
<a:tabs>
<a:tab id="payment_req" prompt="融资租赁" width="110">
<a:form column="4" labelWidth="100" marginWidth="40" title="CSH501.CSH_REQ_CREATE">
<!--<a:textField name="pay_contract_from" bindTarget="csh_payment_req_query_ds" prompt="支付表编号从" width="150"/>-->
<!--<a:textField name="pay_contract_to" bindTarget="csh_payment_req_query_ds" prompt="支付表编号从" width="150"/>-->
......@@ -463,6 +640,36 @@
<!--<a:column name="vat_flag" align="center" prompt="增值税标志" width="60"/>-->
</a:columns>
</a:grid>
</a:tab>
<a:tab id="payment_req_op" prompt="经营性租赁" width="110">
<a:form column="4" labelWidth="100" marginWidth="40" title="经营性租赁">
<a:textField name="project_number" bindTarget="csh_payment_req_op_query_ds" prompt="采购申请编号"/>
<a:lov name="vender_name_n" bindTarget="csh_payment_req_op_query_ds" prompt="厂商"></a:lov>
<a:datePicker name="plan_order_date_from" bindTarget="csh_payment_req_op_query_ds" prompt="预计采购日期从"/>
<a:datePicker name="plan_order_date_to" bindTarget="csh_payment_req_op_query_ds" prompt="预计采购日期到"/>
<a:numberField name="lease_item_amount" allowDecimals="true" allowFormat="true" bindTarget="csh_payment_req_op_query_ds" prompt="采购金额"/>
<a:textField name="invoice_status_n" bindTarget="csh_payment_req_op_query_ds" prompt="发票状态"/>
<a:textField name="vender_con_number" bindTarget="csh_payment_req_op_query_ds" prompt="厂商合同编号"/>
<a:textField name="contract_number" bindTarget="csh_payment_req_op_query_ds" prompt="合同编号"/>
</a:form>
<a:grid id="csh_payment_req_maintain_op_grid_ds" bindTarget="csh_payment_req_op_selectedDs" marginHeight="200"
marginWidth="40" navBar="true">
<a:columns>
<a:column name="project_number" prompt="采购单编号" width="120"/>
<a:column name="vender_name_n" prompt="厂商" width="150"/>
<a:column name="vender_con_number" prompt="厂商合同编号" width="150"/>
<a:column name="lease_item_amount" prompt="采购总额" renderer="Leaf.formatMoney" align="right" width="110"/>
<a:column name="lease_item_count" prompt="采购总数量" width="150"/>
<a:column name="plan_order_date" prompt="预计采购日期" width="150"/>
<a:column name="insurance_fee" prompt="厂商质保金" renderer="Leaf.formatMoney" align="right" width="110"/>
<a:column name="invoice_status_n" prompt="发票状态" width="150"/>
<a:column name="contract_number" prompt="合同编号" width="120"/>
<a:column name="contract_status_desc" prompt="首租合同状态" width="150"/>
</a:columns>
</a:grid>
</a:tab>
</a:tabs>
</a:tabPanel>
</a:screenBody>
</a:view>
</a:screen>
......@@ -16,6 +16,7 @@
<a:model-query defaultWhereClause="t1.company_id=${/session/@company_id}" fetchAll="true"
model="prj.PRJ500D.get_company_info" rootPath="company_info_path"/>
<a:model-query fetchAll="true" model="prj.PRJ500D.user_agent_description" rootPath="user_agent_description"/>
<a:model-query defaultWhereClause="t.user_id=${/session/@user_id}" model="hls.HLS214N.sys_division" rootPath="user_division"/>
</a:init-procedure>
<a:view>
<a:link id="prj_chance_create_link"
......@@ -25,10 +26,11 @@
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="prj500n_create_project_interface_link" model="prj.PRJ500N.ds_project_interface_query" modelaction="execute" />
<a:link id="prj_chance_operat_create_link"
url="${/request/@context_path}/modules/prj/PRJ500N/prj_project_create_operat.lview"/>
<script type="text/javascript"><![CDATA[
//确定
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
debugger;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var record = $(ds_id).getCurrentRecord();
if(record.data.division=='70'&&record.data.business_type!='LEASEBACK'){
......@@ -40,12 +42,23 @@
if(record.data.division=='92'&&record.data.business_type!='LEASEBACK'){
$L.showErrorMessage("提示", '租赁物为北京心诚的业务类型只能是售后回租!');
return false;
}
if(record.data.division=='95'&&record.data.business_type!='LEASEOPERAT'){
$L.showErrorMessage("提示", '租赁物为经租设备的业务类型只能是经营性租赁!');
return false;
}
if(record.data.division!='95'&&record.data.business_type=='LEASEOPERAT'){
$L.showErrorMessage("提示", '业务类型为经营性租赁只能选择经租设备!');
return false;
}
if ($(ds_id).validate()) {
var url;
if(record.data.is_constru_unit == 'Y' || '${/model/user_agent_description/record/@is_constru_unit}' == 'Y'){
record.set('function_code', 'PRJ500D_CONSTRU');
url = "prj_chance_constru_create_link";
}else if(record.data.division=='95'){
record.set('function_code', 'PRJ500D_OPERAT');
url = "prj_chance_operat_create_link";
}else{
record.set('function_code', 'PRJ500D');
url = "prj_chance_create_link";
......@@ -78,6 +91,17 @@
// head_record.set('invoice_agent_id_n', '${/model/prj_project_invoice_agent_id_dafault_value_path/record/@bp_id_n}');
head_record.set('invoice_agent_id', invoice_agent_id);
head_record.set('invoice_agent_id_n', invoice_agent_id_n);
//经营性租赁改造 18083 2023/8/24
if("${/model/user_division/record/@division}"==95){
head_record.set('business_type','LEASEOPERAT');
head_record.set('business_type_n','经营性租赁');
head_record.set('division','95');
head_record.set('division_n','经租设备');
head_record.getField('division').setReadOnly(true);
head_record.getField('division_n').setReadOnly(true);
head_record.set('bp_class','bp_class');
head_record.set('bp_class_n','法人');
}
if(!invoice_agent_id){
head_record.getField('invoice_agent_id_n').setReadOnly(false);
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: 18083
$Date: 2023/8/24 13:52:40
$Revision: 1.0
$purpose: 经营性租赁申请创建
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
customizationEnabled="true" dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
</a:init-procedure>
<a:view>
<a:link id="${/parameter/@layout_code}hls_bp_master_query_link"
url="${/request/@context_path}/modules/hls/HLS215N/hls_bp_master_query.lview"/>
<a:link id="bp_tenant_detail_query_link" model="prj.PRJ500D.bp_tenant_old_r_query" modelaction="query"/>
<a:link id="${/parameter/@layout_code}_tenant_rate_query_link"
url="${/request/@context_path}/modules/prj/PRJ902/prj_project_score_result.lview"/>
<a:link id="${/parameter/@layout_code}_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="get_special_fields_prj_link_id" model="prj.PRJ500.get_two_prj_number" modelaction="update"/>
<a:link id="hls_bp_master_billing_link" model="prj.PRJ500N.hls_bp_master_billing" modelaction="query"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id"
url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id"
url="${/request/@context_path}/uploadFile.lview"/>
<script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js"
type="text/javascript"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calc_quotation_header.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id"
url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_operat_update_n.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_for_deron_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation_for_deron.lsc"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation.lsc"/>
<a:link id="${/parameter/@layout_code}_hls_fin_calc_get_base_rate_link_id"
model="hls.HLS500.hls_fin_calc_get_base_rate" modelaction="update"/>
<a:link id="prj_approval_link_id" model="prj.PRJ501N.project_approval" modelaction="update"/>
<a:link id="${/parameter/@layout_code}tenant_rate_query_link"
url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_history_display.lview"/>
<a:link id="${/parameter/@layout_code}contract_number_query_link"
url="${/request/@context_path}/modules/cont/CON3200/con_re_incept_op_modify.lview"/>
<a:link id="prj_pur_order_deteail_link_id" url="${/request/@context_path}/modules/prj/PRJ2000/purchase_order_deteail.lview"></a:link>
<a:link id="get_pur_quotation_info_id" model="prj.PRJ501N.prj_pur_quotation_info" modelaction="query"/>
<script type="text/javascript"><![CDATA[
/* 时间戳转换为时间 */
function timestampToTime(timestamp) {
timestamp = timestamp ? timestamp : null;
var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
return Y + M + D;
};
window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function () {
var url;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CASHFLOW_NS', 'prj_quotation');
var lease_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var record = $(quotation_ds_id).getCurrentRecord();
var lease_record = $(lease_ds_id).getCurrentRecord();
var head_record = $(ds_id).getAt(0);
url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl();
if (head_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (lease_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if ($(quotation_ds_id).validate()) {
var parent_pk_value = head_record.get('project_id');
record.set('function_code', 'PRJ505_QUOTATION');
record.set('function_usage', 'UPDATE');
record.set('project_id', parent_pk_value);
//拆分合同可维护
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
//首次插入
if (!record.get('calc_session_id')) {
record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
var calc_recreate_L_formula;
calc_recreate_L_formula = 'Y';
record.set('_status', 'update');
record.set('from_doc_table', 'PRJ_QUOTATION');
record.set('from_doc_pk', record.get('quotation_id'));
record.set('calculate_flag', 'N');
if (!'${/parameter/@document_id}') {
record.set('document_id', parent_pk_value);
}
var saveData = [];
saveData.push(record.data);
Leaf.request({
url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(),
para: saveData,
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$(quotation_ds_id).query();
$(history_ds_id).query();
var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_link_winid',
params: {
layout_code:'${/parameter/@layout_code}',
document_id: parent_pk_value,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: res.result.record.calc_session_id,
quotation_id: quotation_id,
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_link_winid',
global_flag: 'Y',
id_num: 0,
calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
recreate_L_formula: calc_recreate_L_formula,
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
} else {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
var cal_lease_start_date = record.get('cal_lease_start_date');
var lease_start_date = timestampToTime(Date.parse(record.get('lease_start_date')));
var cal_first_pay_date = record.get('cal_first_pay_date');
var first_pay_date = timestampToTime(Date.parse(record.get('first_pay_date')));
var cal_lease_times = record.get('cal_lease_times');
var lease_times = record.get('lease_times');
var cal_hd_user_col_d01 = record.get('cal_hd_user_col_d01');
var hd_user_col_d01 = timestampToTime(Date.parse(record.get('hd_user_col_d01')));
if (cal_lease_start_date == lease_start_date && cal_first_pay_date==first_pay_date &&cal_hd_user_col_d01==hd_user_col_d01 &&cal_lease_times==lease_times) {
//直接进入报价页面
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_update_link_winid',
params: {
layout_code:'${/parameter/@layout_code}',
document_id: parent_pk_value,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: record.get('calc_session_id'),
quotation_id: record.get('quotation_id'),
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_update_link_winid',
global_flag: 'Y',
id_num: 0,
calc_type: '${/parameter/@calc_type}',
recreate_L_formula: 'N',
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
} else {
record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
var calc_recreate_L_formula;
calc_recreate_L_formula = 'Y';
record.set('_status', 'update');
record.set('from_doc_table', 'PRJ_QUOTATION');
record.set('from_doc_pk', record.get('quotation_id'));
record.set('calculate_flag', 'N');
if (!'${/parameter/@document_id}') {
record.set('document_id', parent_pk_value);
}
var saveData = [];
saveData.push(record.data);
Leaf.request({
url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(),
para: saveData,
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$(quotation_ds_id).query();
var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_link_winid',
params: {
document_id: parent_pk_value,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: res.result.record.calc_session_id,
quotation_id: quotation_id,
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_link_winid',
global_flag: 'Y',
id_num: 0,
calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
recreate_L_formula: calc_recreate_L_formula,
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}
}
}
};
function prj501n_upload_file(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if (record.get('check_id')) {
var url;
if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY') {
url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
} else {
url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'prj500_cdd_uploadFile_screen_id',
width: 850,
height: 400
});
win.on('close', function () {
record.ds.query();
});
} else {
Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
}
}
function prj501n_bp_code_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['bp_id'] = record.get('bp_id');
param['bp_class'] = record.get('bp_class');
if (record.get('bp_category') == 'AGENT') {
param['function_code'] = 'HLS303_Q';
param['function_usage'] = 'QUERY';
} else {
param['function_code'] = 'HLS215D';
param['function_usage'] = 'QUERY';
}
param['winid'] = '${/parameter/@layout_code}_bp_win_id';
param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_project_number_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['bp_id'] = record.get('project_id');
param['bp_class'] = record.get('bp_class');
param['function_code'] = 'PRJ501D';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['prj_bp_id'] = record.get('prj_bp_id');
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}project_number_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_contract_number_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['contract_id'] = record.get('contract_id');
param['function_code'] = 'CON3200Q_OP';
param['function_usage'] = 'QUERY';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}contract_number_query_link', record.ds.id, '${/parameter/@layout_code}');
}
/*保存前调用,生成项目编号*/
var count = 0;
var item_count = 0;
window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
debugger;
var check_flag = true;
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_record = $(prj_project_ds_id).getAt(0);
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var quotation_record = $(quotation_ds_id).getCurrentRecord();
var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var lease_item_ds_id = '${/parameter/@layout_code}' + '_G_CAR_INFO_prj_project_lease_item_ds';
var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var project_record = $(project_ds_id).getCurrentRecord();
var lease_item_ds_id_n = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
var lease_item_record = $(lease_item_ds_id_n).getCurrentRecord();
var project_lease_item_id = $(lease_item_ds_id).getAll();
if(project_lease_item_id.length<1 && item_count == 0){
$L.showErrorMessage('提示', '租赁物信息不能为空!');
item_count = item_count+1;
return false;
}else if(project_lease_item_id.length<1 && item_count != 0){
item_count = 0;
return false;
}
var project_id = project_record.get('project_id');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (prj_project_ds_id == ds.id && prj_project_ds_id) {
if ((record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') && record.get('deduction_limit') <=0) {
Leaf.showMessage('${l:HLS.PROMPT}', '扣款限额应大于0');
return false;
}
if (record.get('signing_city')){
if (record.get('signing_city').indexOf('州') == -1 && record.get('signing_city').indexOf('县') == -1 && record.get('signing_city').indexOf('区') == -1) {
Leaf.showConfirm('${HLS.PROMPT}', '合同签订地所填写内容,未细化到区/县/州级别,是否确认?', function () {});
}
}
}
if (prj_record.get('project_number')) {
return true;
}
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('get_special_fields_prj_link_id').getUrl(),
para: {
document_category: '${/parameter/@document_category}',
document_type: record.get('document_type'),
business_type: record.get('business_type'),
function_code: '${/parameter/@function_code}',
function_usage: '${/parameter/@function_usage}',
lease_channel: prj_record.get('lease_channel'),
first_flag: prj_record.get('first_flag'),
ka_prj_id: prj_record.get('ka_prj_id'),
quotation_ds_id: quotation_record.get('large_balance')
},
success: function (res) {
var document_number = res.result.document_number;
prj_record.set('project_number', document_number);
check_flag = true;
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
sync: true,
scope: this
});
return check_flag;
};
function prj501n_lease_renderer(id, name, query_only){
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var project_id=record.get('source_project_id');
var param = {};
var param = record.data;
param['function_code'] = 'PRJ2000D_WFL';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY'
param['url_title'] = '采购申请单维护';
param['project_id'] = project_id;
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, 'prj_pur_order_deteail_link_id', null, '${/parameter/@layout_code}');
}
//超链接渲染
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'attachment') {
link_function = 'prj501n_upload_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
} else if (name == 'attach_file_name') {
if (value != null) {
var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
var str = value.split(';;');
var url = '';
for (var i = 0; i < str.length; i++) {
var temp = str[i].split('--');
if (!Leaf.isEmpty(temp[0])) {
var file_name = temp[0].toUpperCase();
var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
if (file_name.indexOf('.PDF') >= 0) {
url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
} else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
} else {
url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
}
}
}
return url;
}
} else if (name == 'bp_link' && !record.isNew) {
link_function = 'prj501n_bp_code_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
} else if (name == 'project_number') {
link_function = 'prj501n_project_number_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
} else if (name == 'contract_number') {
link_function = 'prj501n_contract_number_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
}else if(name=='lease_detail'&& record.get('project_lease_item_id')!=null){
link_function = 'prj501n_lease_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' +'明细' + '</a>';
}
};
//保存submitsuccess调用
window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function (ds, record, res) {
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var bp_ds_ids = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
var prj_project_lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
var virtual_ds_id = '${/parameter/@layout_code}_virtual_ds';
if (ds_id == ds.id || virtual_ds_id == ds.id) {
$(cdd_item_ds_id).query();
$(bp_ds_id).query();
$(tenant_ds_id).query();
$(prj_project_lease_item_ds_id).query();
$(prj_quotation_ds_id).query();
}
if (prj_project_lease_item_ds_id==ds.id){
$(prj_quotation_ds_id).query();
}
var record = $(ds_id).getCurrentRecord();
var url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query?project_id=${/parameter/@project_id}&bp_id=' + record.get('bp_id_tenant');
$(tenant_ds_id).setQueryUrl(url);
$(tenant_ds_id).query();
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
//查询时调用(form,fieldboxcolumn)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_query'] = function (ds, qpara, bp_seq) {
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_INFO', 'prj_project_bp');
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
if (ds.id == tenant_ds_id) {
var prj_record = $(prj_project_ds_id).getCurrentRecord();
qpara['project_id'] = prj_record.get('project_id');
}
if (ds.id == quotation_ds_id) {
var prj_record = $(prj_project_ds_id).getCurrentRecord();
qpara['document_id'] = prj_record.get('project_id');
qpara['project_id'] = prj_record.get('project_id');
}
};
/*查询前调用*/
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function (ds, qpara, bp_seq) {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
if (ds.id == prj_project_ds_id) {
var prj_record = $(prj_project_ds_id).getCurrentRecord();
qpara.project_id = prj_record.get('project_id');
}
var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
if (ds.id == prj_project_ds_id) {
var prj_record = $(prj_project_ds_id).getCurrentRecord();
qpara['cdd_list_id'] = prj_record.get('cdd_list_id');
}
};
//选择事件(grid,attach,gridbox,table)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function (ds, record, bp_seq) {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
if (bp_ds_id == ds.id && bp_ds_id) {
if (record.get('bp_category') == 'RENTER') {
//实际为不选中
Leaf.showMessage('${l:HLS.PROMPT}', '无法删除租赁商!');
ds.unSelect(record);
ds.Select(record);
}
if (record.get('bp_category') == 'AGENT') {
//实际为不选中
Leaf.showMessage('${l:HLS.PROMPT}', '无法删除经销商!');
ds.unSelect(record);
ds.Select(record);
}
}
};
function jsGetAge(strBirthday) {
var returnAge;
var strBirthdayArr = strBirthday.split("-");
var birthYear = strBirthdayArr[0];
var birthMonth = strBirthdayArr[1];
var birthDay = strBirthdayArr[2];
var d = new Date();
var nowYear = d.getFullYear();
var nowMonth = d.getMonth() + 1;
var nowDay = d.getDate();
if (nowYear == birthYear) {
returnAge = 0;//同年 则为0岁  
} else {
var ageDiff = nowYear - birthYear; //年之差  
if (ageDiff > 0) {
if (nowMonth == birthMonth) {
var dayDiff = nowDay - birthDay;//日之差  
if (dayDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
} else {
var monthDiff = nowMonth - birthMonth;//月之差  
if (monthDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
}
} else {
returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天  
}
}
return returnAge;//返回周岁年龄  
}
var division='';
//新增和加载时调用(form)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
if (ds_id == ds.id && ds_id) {
division=record.get('division');
//新增 “限制金额”字段;
//“扣款限额”:“租金支付方式”为“建行扣款(三方)”或"建行扣款(两方)"时展示,必填,大于0,默认20万,可修改;
if (record.get('PAY_METHOD') == 'CCB_THREE'||record.get('PAY_METHOD') == 'CCB_TWO') {
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
}
record.getField('deduction_limit').setRequired(true);
} else {
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
}
record.getField('deduction_limit').setRequired(false);
}
}
//add by wangwei 非铁甲业务隐藏铁甲评分
var bp_tenant_rate_detail_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'bp_tenant_rate_detail');
if (bp_tenant_rate_detail_ds_id == ds.id && bp_tenant_rate_detail_ds_id) {
if (division != '70' && division != '') {
if(document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE')){
document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE').style.display = 'none';
}
}
}
};
//更新时调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var prj_project_history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
//选择承租人带出开票信息
if (prj_project_ds_id == ds.id && prj_project_ds_id) {
if (name == "payment_deduction" && value=="DOWN_PAYMENT_DEDUCTION") {
//业务类型回租时,默认只读“首付款抵扣”选项
if ($(prj_project_ds_id).getAt(0).get('business_type') == 'LEASE') {
Leaf.showInfoMessage("提示", "直租业务不能选择首付款抵扣");
setTimeout(function () {
$(prj_project_ds_id).getAt(0).set('payment_deduction', null);
$(prj_project_ds_id).getAt(0).set('payment_deduction_n', null);
}, 10);
}
}
if (name == "bp_id_tenant_n" && value) {
var bp_id_tenant = record.get('bp_id_tenant');
Leaf.Masker.mask(Ext.getBody());
Leaf.request({
url: $('hls_bp_master_billing_link').getUrl(),
para: {
bp_id: bp_id_tenant
},
success: function (res) {
var billing_into = res.result.record;
var prj_project_bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
$(prj_project_bp_ds_id).getAt(0).set('taxpayer_type_n', billing_into.taxpayer_type_n);
$(prj_project_bp_ds_id).getAt(0).set('taxpayer_type', billing_into.taxpayer_type);
$(prj_project_bp_ds_id).getAt(0).set('invoice_title', billing_into.invoice_title);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_address', billing_into.invoice_bp_address);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_phone_num', billing_into.invoice_bp_phone_num);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank', billing_into.invoice_bp_bank);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank_account', billing_into.invoice_bp_bank_account);
$(prj_project_bp_ds_id).getAt(0).set('tax_registry_num', billing_into.tax_registry_num);
$(prj_project_bp_ds_id).getAt(0).set('ref_v07', billing_into.ref_v07);
Leaf.Masker.unmask(Ext.getBody());
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
//根据承租人查找该承租人的历史合同信息
$(prj_project_history_ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query');
$(prj_project_history_ds_id).setQueryParameter("bp_id", bp_id_tenant);
$(prj_project_history_ds_id).query();
Leaf.Masker.mask(Ext.getBody());
$(score_ds_id).getCurrentRecord().set('score_name', value);
Leaf.request({
url: $('bp_tenant_detail_query_link').getUrl(),
para: {
bp_id: bp_id_tenant
},
success: function (res) {
var obj = res.result.record;
if (obj) {
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (bp_tenant_detail_r) {
for (var key in bp_tenant_detail_r.data) {
if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age') {
var vl = obj[key];
if (key == 'bp_birth' && obj[key]) {
vl = new Date(obj[key].toString());
}
if (vl != "null" && vl != "undefined") {
bp_tenant_detail_r.set(key, vl);
}
}
}
}
}
Leaf.Masker.unmask(Ext.getBody());
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
if(name == 'legal_person' && value){
$(score_ds_id).getCurrentRecord().set('score_name', value);
}
if(name == 'bp_id_tenant'){
if(!value){
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (bp_tenant_detail_r) {
for (var key in bp_tenant_detail_r.data) {
bp_tenant_detail_r.set(key,'');
}
}
}
record.getField('bank_account_id').setLovPara('bp_id_tenant', record.get('bp_id_tenant'));
}
if (name == 'pay_method') {
if (record.get('pay_method') == 'WIRE_TRANSFER') {
record.set('bank_account_id', null);
record.set('bank_account_id_n', null);
record.set('bank_branch_num', '');
record.set('bank_account_name', '');
record.getField('bank_account_id').setReadOnly(true);
record.getField('bank_account_id_n').setReadOnly(true);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
} else {
record.getField('bank_account_id').setReadOnly(false);
record.getField('bank_account_id_n').setReadOnly(false);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
}
}
//新增 “限制金额”字段;
//“扣款限额”:“租金支付方式”为“建行扣款(三方)或建行扣款(两方)”时展示,必填,大于0,默认20万,可修改;
if (name=='pay_method') {
if(value=='CCB_THREE'||value=='CCB_TWO'){
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
}
record.getField('deduction_limit').setRequired(true);
if(Ext.isEmpty(record.get('deduction_limit'))){
record.set('deduction_limit',200000);
}
}else{
record.getField('deduction_limit').setRequired(false);
record.set('deduction_limit',null);
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
}
}
}
}
if (score_ds_id == ds.id) {
if (name == 'bp_birth' && value) {
if (jsGetAge(value.format('yyyy-mm-dd').toString()) == -1) {
Leaf.showInfoMessage("提示", "出生日期不能大于当前日期");
setTimeout(function () {
record.set('bp_birth', old_value);
}, 0);
} else {
record.set('bp_age', jsGetAge(value.format('yyyy-mm-dd').toString()));
}
}
if(name=='third_guar_score'&&!Ext.isEmpty(value)){
if(value<0||value>10){
setTimeout(function () {
record.set('third_guar_score', '');
}, 0);
Leaf.showInfoMessage("提示", "第三方担保附件分数范围为0-10,请重新输入!");
}
}
}
var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
if (device_ds_id == ds.id) {
if (name == 'quantity') {
if (value <= 0) {
Leaf.showInfoMessage("提示", "数量必须大于0");
setTimeout(function () {
record.set('quantity', old_value);
}, 0);
}
}
}
if (lease_item_ds_id == ds.id && lease_item_ds_id) {
if (name == 'source_project_id') {
Leaf.request({
url: $('get_pur_quotation_info_id').getUrl(),
para: {
document_id: value
},
success: function (data) {
if (data.result.record && !data.result.record.length) {
//采购单报价信息
for (var name in data.result.record) {
$(prj_quotation_ds_id).getAt(0).set('lease_item_amount', data.result.record['lease_item_amount']);
$(prj_quotation_ds_id).getAt(0).set('lease_start_date', new Date(data.result.record['lease_start_date']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('int_rate_display', data.result.record['int_rate_display']);
$(prj_quotation_ds_id).getAt(0).set('deposit_ratio', data.result.record['deposit_ratio']);
$(prj_quotation_ds_id).getAt(0).set('first_pay_date', new Date(data.result.record['first_pay_date']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('annual_pay_times', data.result.record['annual_pay_times']);
$(prj_quotation_ds_id).getAt(0).set('pmt', data.result.record['pmt']);
$(prj_quotation_ds_id).getAt(0).set('hd_user_col_d01', new Date(data.result.record['hd_user_col_d01']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('deposit', data.result.record['deposit']);
$(prj_quotation_ds_id).getAt(0).set('lease_term_month', data.result.record['lease_term_month']);
$(prj_quotation_ds_id).getAt(0).set('total_rental', data.result.record['total_rental']);
$(prj_quotation_ds_id).getAt(0).set('lease_times', data.result.record['lease_times']);
}
}
},
failure: function () {
},
error: function () {
},
scope: this
});
}
}
};
//加载时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
if (bp_ds_id == ds.id && bp_ds_id) {
if (record.get('bp_category') == 'TENANT') {
record.getField('bp_category_n').setReadOnly(true);
record.getField('bp_id_n').setReadOnly(true);
}
if (record.get('bp_category') == 'AGENT') {
record.getField('bp_category_n').setReadOnly(true);
record.getField('bp_id_n').setReadOnly(true);
}
}
};
//序号自增 add by lijingjing
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function (ds, record, config_records, bp_seq) {
var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
var traffic_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_TRAFFIC', 'bp_tenant_rate_item');
if ((device_ds_id == ds.id && device_ds_id) || (traffic_ds_id == ds.id && traffic_ds_id)) {
//设置序号
var rs = ds.getAll(),
seq_num = 0;
if (rs.length) {
for (var j = 0; j < rs.length; j++) {
var r = rs[j],
rk = r.get('seq_num');
if (seq_num <= rk) {
seq_num = rk;
}
}
}
var rk_value = seq_num + 1;
record.set('seq_num', rk_value);
}
};
//客户评分
window['${/parameter/@layout_code}_user_button9_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var record = $(ds_id).getCurrentRecord();
if (record) {
var param = record.data;
if (record.get('project_id')) {
param['project_id'] = record.get('project_id');
param['winid'] = 'hl_tenant_score_rate_win_id';
param['url_title'] = '客户评分明细';
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var r = $(score_ds_id).getCurrentRecord();
if (r.dirty) {
Leaf.showInfoMessage('提示', '评分数据发生修改,请先保存再进行评分');
return;
}
if ($(ds_id).validate()) {
var win = new Leaf.Window({
id: param['winid'],
params: param,
url: $('${/parameter/@layout_code}_tenant_rate_query_link').getUrl(),
title: param['url_title'],
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(ds_id).setQueryParameter('project_id',record.get('project_id'));
$(ds_id).query();
});
}
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存');
return;
}
}
};
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
var record = $(quotation_ds_id).getCurrentRecord();
var current_record = $(ds_id).getCurrentRecord();
var lease_item_record = $(lease_item_ds_id).getCurrentRecord();
var bp_record = $(bp_ds_id).getCurrentRecord();
var project_id = current_record.get('project_id');
if (current_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (lease_item_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (bp_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if ($(ds_id).validate()) {
Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
var lease_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('prj_approval_link_id').getUrl(),
para: {
project_id: project_id
},
scope: this,
success: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
});
});
}
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: 18083
$Date: 2023-9-8 下午3:16:19
$Revision: 1.0
$purpose: 经营性租赁工作流页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
customizationEnabled="true" dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<a:model-query defaultWhereClause="t1.user_id=${/session/@user_id}" model="prj.PRJ500D.sys_user_lv"
rootPath="user_name_path"/>
<a:model-query
defaultWhereClause="v.role_id = ${/session/@role_id} and v.role_code in (&apos;HAND&apos;,&apos;0017&apos;,&apos;0019&apos;)"
model="zjwfl.sys_role_flag" rootPath="role_flag_path"/>
<a:model-query fetchAll="true" model="prj.PRJ500D.user_agent_description" rootPath="user_agent_description"/>
<a:model-query fetchAll="true" model="prj.PRJ500D.prj_project_get_description" rootPath="description"/>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
</a:init-procedure>
<a:view>
<a:link id="prj501N_prj_lease_item_maintain_link" model="prj.PRJ500N.prj_project_lease_item_delete" modelaction="execute"/>
<a:link id="hls_bp_master_billing_link" model="prj.PRJ500N.hls_bp_master_billing" modelaction="query"/>
<a:link id="bp_tenant_detail_query_link" model="prj.PRJ500D.bp_tenant_old_r_query" modelaction="query"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_special_fields_link_id"
model="cont.CON500.con_contract_get_special_fields" modelaction="update"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id"
url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id"
url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calc_quotation_header.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id"
url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_operat_update_n.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_for_deron_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation_for_deron.lsc"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation.lsc"/>
<a:link id="${/parameter/@layout_code}_principal_eq_pymt_adj_link_n" model="hls.HLS500N.query_principal_eq_pymt_adj" modelaction="update"/>
<a:link id="${/parameter/@layout_code}hls_bp_master_query_link"
url="${/request/@context_path}/modules/hls/HLS215N/hls_bp_master_query.lview"/>
<a:link id="${/parameter/@layout_code}contract_number_query_link"
url="${/request/@context_path}/modules/cont/CON3200/con_re_incept_op_modify.lview"/>
<a:link id="${/parameter/@layout_code}_tenant_rate_query_link"
url="${/request/@context_path}/modules/prj/PRJ902/prj_project_score_result.lview"/>
<a:link id="${/parameter/@layout_code}_hls_fin_calc_get_base_rate_link_id"
model="hls.HLS500.hls_fin_calc_get_base_rate" modelaction="update"/>
<a:link id="${/parameter/@layout_code}_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="${/parameter/@layout_code}lease_number_query_link"
url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_lease_import_details.lview"/>
<a:link id="${/parameter/@layout_code}_prj_project_update_status_link_id"
model="prj.PRJ505.prj_project_create_contract" modelaction="execute"/>
<a:link id="prj_approval_link_id" model="prj.PRJ501N.project_approval" modelaction="update"/>
<a:link id="check_prj_lease_item_link_id" model="prj.PRJ501N.project_approval" modelaction="execute"/>
<a:link id="check_machine_number_id" model="prj.PRJ501N.project_approval" modelaction="query"/>
<script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
<script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>-->
<a:link id="prj_check_prj_record_link_n" model="hls.HLS500N.check_prj_record" modelaction="execute"/>
<a:link id="get_prj_atch_download_link"
url="${/request/@context_path}/modules/batch_download/lease_atm_batch_dl.lsc"/>
<a:link id="get_pur_quotation_info_id" model="prj.PRJ501N.prj_pur_quotation_info" modelaction="query"/>
<a:link id="prj_pur_order_deteail_link_id" url="${/request/@context_path}/modules/prj/PRJ2000/purchase_order_deteail.lview"></a:link>
<link href="${/request/@context_path}/modules/viewerjs/viewer.css" rel="stylesheet"/>
<script src="${/request/@context_path}/modules/viewerjs/viewer.js"/>
<script src="${/request/@context_path}/modules/viewerjs/viewer_tool.js"/>
<script type="text/javascript"><![CDATA[
jQuery.noConflict();
/* 时间戳转换为时间 */
function timestampToTime(timestamp) {
timestamp = timestamp ? timestamp : null;
var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
return Y + M + D;
};
//add by zhuxianfei
window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function () {
var url;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CASHFLOW_NS', 'prj_quotation');
var lease_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var record = $(quotation_ds_id).getCurrentRecord();
var lease_record = $(lease_ds_id).getCurrentRecord();
var head_record = $(ds_id).getAt(0);
url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl();
if (head_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (lease_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if ($(quotation_ds_id).validate()) {
var parent_pk_value = head_record.get('project_id');
record.set('function_code', 'PRJ505_QUOTATION');
record.set('function_usage', 'UPDATE');
record.set('project_id', parent_pk_value);
//拆分合同可维护
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
//首次插入
if (!record.get('calc_session_id')) {
record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
var calc_recreate_L_formula;
calc_recreate_L_formula = 'Y';
record.set('_status', 'update');
record.set('from_doc_table', 'PRJ_QUOTATION');
record.set('from_doc_pk', record.get('quotation_id'));
record.set('calculate_flag', 'N');
if (!'${/parameter/@document_id}') {
record.set('document_id', parent_pk_value);
}
var price_list = record.get('price_list');
var saveData = [];
saveData.push(record.data);
Leaf.request({
url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(),
para: saveData,
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$(quotation_ds_id).query();
$(history_ds_id).query();
var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_link_winid',
params: {
layout_code: '${/parameter/@layout_code}',
document_id: parent_pk_value,
price_list: price_list,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: res.result.record.calc_session_id,
quotation_id: quotation_id,
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_link_winid',
global_flag: 'Y',
id_num: 1,
calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
recreate_L_formula: calc_recreate_L_formula,
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
} else {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
var cal_lease_start_date = record.get('cal_lease_start_date');
var lease_start_date = timestampToTime(Date.parse(record.get('lease_start_date')));
var cal_first_pay_date = record.get('cal_first_pay_date');
var first_pay_date = timestampToTime(Date.parse(record.get('first_pay_date')));
var cal_lease_times = record.get('cal_lease_times');
var lease_times = record.get('lease_times');
var cal_hd_user_col_d01 = record.get('cal_hd_user_col_d01');
var hd_user_col_d01 = timestampToTime(Date.parse(record.get('hd_user_col_d01')));
if (cal_lease_start_date == lease_start_date && cal_first_pay_date==first_pay_date &&cal_hd_user_col_d01==hd_user_col_d01 &&cal_lease_times==lease_times) {
//直接进入报价页面
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_update_link_winid',
params: {
layout_code: '${/parameter/@layout_code}',
document_id: parent_pk_value,
price_list: price_list,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: record.get('calc_session_id'),
quotation_id: record.get('quotation_id'),
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_update_link_winid',
global_flag: 'Y',
id_num: 1,
calc_type: '${/parameter/@calc_type}',
recreate_L_formula: 'N',
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
} else {
record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
var calc_recreate_L_formula;
calc_recreate_L_formula = 'Y';
record.set('_status', 'update');
record.set('from_doc_table', 'PRJ_QUOTATION');
record.set('from_doc_pk', record.get('quotation_id'));
record.set('calculate_flag', 'N');
if (!'${/parameter/@document_id}') {
record.set('document_id', parent_pk_value);
}
var price_list = record.get('price_list');
var saveData = [];
saveData.push(record.data);
Leaf.request({
url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(),
para: saveData,
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$(quotation_ds_id).query();
$(history_ds_id).query();
var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_link_winid',
params: {
layout_code: '${/parameter/@layout_code}',
document_id: parent_pk_value,
price_list: price_list,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: res.result.record.calc_session_id,
quotation_id: quotation_id,
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_link_winid',
global_flag: 'Y',
id_num: 1,
calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
recreate_L_formula: calc_recreate_L_formula,
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}
}
}
};
function prj501n_upload_file(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if (record.get('check_id')) {
var url;
if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY') {
url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
} else {
url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'prj500_cdd_uploadFile_screen_id',
width: 850,
height: 400
});
win.on('close', function () {
record.ds.query();
});
} else {
Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
}
}
function prj501n_bp_code_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['bp_id'] = record.get('bp_id');
param['bp_class'] = record.get('bp_class');
if (record.get('bp_category') == 'AGENT') {
param['function_code'] = 'HLS303_Q';
param['function_usage'] = 'QUERY';
} else {
param['function_code'] = 'HLS215D';
param['function_usage'] = 'QUERY';
}
param['winid'] = '${/parameter/@layout_code}_bp_win_id';
param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_project_number_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['bp_id'] = record.get('project_id');
param['bp_class'] = record.get('bp_class');
param['function_code'] = 'PRJ501D';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['prj_bp_id'] = record.get('prj_bp_id');
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}project_number_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_contract_number_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['contract_id'] = record.get('contract_id');
param['function_code'] = 'CON3200Q_OP';
param['function_usage'] = 'QUERY';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}contract_number_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_lease_renderer(id, name, query_only){
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var project_id=record.get('source_project_id');
var param = {};
var param = record.data;
param['function_code'] = 'PRJ2000D_WFL';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY'
param['url_title'] = '采购申请单维护';
param['project_id'] = project_id;
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, 'prj_pur_order_deteail_link_id', null, '${/parameter/@layout_code}');
}
//超链接渲染
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'attachment') {
link_function = 'prj501n_upload_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
} else if (name == 'attach_file_name') {
if (value != null) {
var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
var str = value.split(';;');
var url = '';
for (var i = 0; i < str.length; i++) {
var temp = str[i].split('--');
if (!Leaf.isEmpty(temp[0])) {
var file_name = temp[0].toUpperCase();
var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
link_function = 'show_viewer_more';
url = url + '<a href="javascript:window[\'' + link_function + '\'](\'' + link + '\',\'' + temp[1] + '\',\'' + temp[0] + '\',\'' + value + '\');">' + temp[0] + '</a>' + ',';
} else {
url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
}
}
}
return url;
}
} else if (name == 'bp_link' && !record.isNew) {
link_function = 'prj501n_bp_code_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
} else if (name == 'project_number') {
link_function = 'prj501n_project_number_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
} else if (name == 'contract_number') {
link_function = 'prj501n_contract_number_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
}else if(name=='lease_detail' && record.get('project_lease_item_id')!=null){
link_function = 'prj501n_lease_renderer';
//return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.ds.id + '\')">' + '明细' + '</a>';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' +'明细' + '</a>';
}
};
//保存submitsuccess调用
window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function (ds, record, res) {
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var bp_ds_ids = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
var prj_project_lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
var virtual_ds_id = '${/parameter/@layout_code}_virtual_ds';
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
if (ds_id == ds.id || virtual_ds_id == ds.id) {
$(cdd_item_ds_id).query();
$(bp_ds_id).query();
$(tenant_ds_id).query();
$(prj_project_lease_item_ds_id).query();
$(prj_quotation_ds_id).query();
$(score_ds_id).query();
}
if (prj_project_lease_item_ds_id==ds.id){
$(prj_quotation_ds_id).query();
}
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
//选择事件(grid,attach,gridbox,table)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function (ds, record, bp_seq) {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
if (bp_ds_id == ds.id && bp_ds_id) {
if (record.get('bp_category') == 'RENTER') {
//实际为不选中
Leaf.showMessage('${l:HLS.PROMPT}', '无法删除主承租人!');
setTimeout(function () {
ds.unSelect(record);
}, 1);
}
if (record.get('bp_category') == 'AGENT') {
//实际为不选中
Leaf.showMessage('${l:HLS.PROMPT}', '无法删除经销商!');
setTimeout(function () {
ds.unSelect(record);
}, 1);
}
}
};
function jsGetAge(strBirthday) {
var returnAge;
var strBirthdayArr = strBirthday.split("-");
var birthYear = strBirthdayArr[0];
var birthMonth = strBirthdayArr[1];
var birthDay = strBirthdayArr[2];
var d = new Date();
var nowYear = d.getFullYear();
var nowMonth = d.getMonth() + 1;
var nowDay = d.getDate();
if (nowYear == birthYear) {
returnAge = 0;//同年 则为0岁  
} else {
var ageDiff = nowYear - birthYear; //年之差  
if (ageDiff > 0) {
if (nowMonth == birthMonth) {
var dayDiff = nowDay - birthDay;//日之差  
if (dayDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
} else {
var monthDiff = nowMonth - birthMonth;//月之差  
if (monthDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
}
} else {
returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天  
}
}
return returnAge;//返回周岁年龄  
}
//更新时调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_project_history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
//选择承租人带出开票信息
if (prj_project_ds_id == ds.id && prj_project_ds_id) {
if (name == "payment_deduction" && value == "DOWN_PAYMENT_DEDUCTION") {
//业务类型回租时,默认只读“首付款抵扣”选项
if ($(prj_project_ds_id).getAt(0).get('business_type') == 'LEASE') {
Leaf.showInfoMessage("提示", "直租业务不能选择首付款抵扣");
setTimeout(function () {
$(prj_project_ds_id).getAt(0).set('payment_deduction', null);
$(prj_project_ds_id).getAt(0).set('payment_deduction_n', null);
}, 10);
}
}
if (name == "bp_id_tenant_n" && value) {
var bp_id_tenant = record.get('bp_id_tenant');
Leaf.Masker.mask(Ext.getBody());
Leaf.request({
url: $('hls_bp_master_billing_link').getUrl(),
para: {
bp_id: bp_id_tenant
},
success: function (res) {
var billing_into = res.result.record;
var prj_project_bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
$(prj_project_bp_ds_id).getAt(0).set('taxpayer_type_n', billing_into.taxpayer_type_n);
$(prj_project_bp_ds_id).getAt(0).set('taxpayer_type', billing_into.taxpayer_type);
$(prj_project_bp_ds_id).getAt(0).set('invoice_title', billing_into.invoice_title);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_address', billing_into.invoice_bp_address);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_phone_num', billing_into.invoice_bp_phone_num);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank', billing_into.invoice_bp_bank);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank_account', billing_into.invoice_bp_bank_account);
$(prj_project_bp_ds_id).getAt(0).set('tax_registry_num', billing_into.tax_registry_num);
$(prj_project_bp_ds_id).getAt(0).set('ref_v07', billing_into.ref_v07);
Leaf.Masker.unmask(Ext.getBody());
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
//根据承租人查找该承租人的历史合同信息
$(prj_project_history_ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query');
$(prj_project_history_ds_id).setQueryParameter("bp_id", bp_id_tenant);
$(prj_project_history_ds_id).query();
Leaf.Masker.mask(Ext.getBody());
$(score_ds_id).getCurrentRecord().set('score_name', value);
Leaf.request({
url: $('bp_tenant_detail_query_link').getUrl(),
para: {
bp_id: bp_id_tenant
},
success: function (res) {
var obj = res.result.record;
if (obj) {
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (bp_tenant_detail_r) {
for (var key in bp_tenant_detail_r.data) {
if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age') {
var vl = obj[key];
if (key == 'bp_birth' && obj[key]) {
vl = new Date(obj[key].toString());
}
if (vl != "null" && vl != "undefined") {
bp_tenant_detail_r.set(key, vl);
}
}
}
}
}
Leaf.Masker.unmask(Ext.getBody());
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
if (name == 'legal_person' && value) {
$(score_ds_id).getCurrentRecord().set('score_name', value);
}
if (name == 'pay_method') {
if (record.get('pay_method') == 'WIRE_TRANSFER') {
record.set('bank_account_id', null);
record.set('bank_account_id_n', null);
record.set('bank_branch_num', '');
record.set('bank_account_name', '');
record.getField('bank_account_id').setReadOnly(true);
record.getField('bank_account_id_n').setReadOnly(true);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
} else {
record.getField('bank_account_id').setReadOnly(false);
record.getField('bank_account_id_n').setReadOnly(false);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
}
}
if (name == 'payment_deduction') {
var quoation_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
var quoation_record = $(quoation_ds_id).getCurrentRecord();
var down_payment = quoation_record.get('down_payment') || 0;
var calc_session_id = quoation_record.get('calc_session_id');
var other_payment2;
if (value && calc_session_id && value == 'NO_DEDUCTION') {
other_payment2 = 0;
} else if (value && calc_session_id && value != 'NO_DEDUCTION') {
other_payment2 = down_payment;
}
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('${/parameter/@layout_code}_prj_project_update_status_link_id').getUrl(),
para: {
other_payment2: other_payment2,
calc_session_id: calc_session_id
},
success: function (arg) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}
if (name == 'bp_id_tenant') {
if (!value) {
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (bp_tenant_detail_r) {
for (var key in bp_tenant_detail_r.data) {
bp_tenant_detail_r.set(key, '');
}
}
}
record.getField('bank_account_id').setLovPara('bp_id_tenant', record.get('bp_id_tenant'));
}
//新增 “限制金额”字段;
//“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示,必填,大于0,默认20万,可修改;
if (name=='pay_method') {
if(value=='CCB_THREE'||value=='CCB_TWO'){
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
}
record.getField('deduction_limit').setRequired(true);
if(Ext.isEmpty(record.get('deduction_limit'))){
record.set('deduction_limit',200000);
}
}else{
record.getField('deduction_limit').setRequired(false);
record.set('deduction_limit',null);
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
}
}
}
}
if (score_ds_id == ds.id) {
if (name == 'bp_birth' && value) {
if (jsGetAge(value.format('yyyy-mm-dd').toString()) == -1) {
Leaf.showInfoMessage("提示", "出生日期不能大于当前日期");
setTimeout(function () {
record.set('bp_birth', old_value);
}, 0);
} else {
record.set('bp_age', jsGetAge(value.format('yyyy-mm-dd').toString()));
}
}
if(name=='third_guar_score'&&!Ext.isEmpty(value)){
if(value<0||value>10){
setTimeout(function () {
record.set('third_guar_score', '');
}, 0);
Leaf.showInfoMessage("提示", "第三方担保附件分数范围为0-10,请重新输入!");
}
}
}
var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
if (device_ds_id == ds.id) {
if (name == 'quantity') {
if (value <= 0) {
Leaf.showInfoMessage("提示", "数量必须大于0");
setTimeout(function () {
record.set('quantity', old_value);
}, 0);
}
}
}
if (lease_item_ds_id == ds.id && lease_item_ds_id) {
if (name == 'source_project_id') {
Leaf.request({
url: $('get_pur_quotation_info_id').getUrl(),
para: {
document_id: value
},
success: function (data) {
if (data.result.record && !data.result.record.length) {
//采购单报价信息
for (var name in data.result.record) {
$(prj_quotation_ds_id).getAt(0).set('lease_item_amount', data.result.record['lease_item_amount']);
$(prj_quotation_ds_id).getAt(0).set('lease_start_date', new Date(data.result.record['lease_start_date']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('int_rate_display', data.result.record['int_rate_display']);
$(prj_quotation_ds_id).getAt(0).set('deposit_ratio', data.result.record['deposit_ratio']);
$(prj_quotation_ds_id).getAt(0).set('first_pay_date', new Date(data.result.record['first_pay_date']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('annual_pay_times', data.result.record['annual_pay_times']);
$(prj_quotation_ds_id).getAt(0).set('pmt', data.result.record['pmt']);
$(prj_quotation_ds_id).getAt(0).set('hd_user_col_d01', new Date(data.result.record['hd_user_col_d01']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('deposit', data.result.record['deposit']);
$(prj_quotation_ds_id).getAt(0).set('lease_term_month', data.result.record['lease_term_month']);
$(prj_quotation_ds_id).getAt(0).set('total_rental', data.result.record['total_rental']);
$(prj_quotation_ds_id).getAt(0).set('lease_times', data.result.record['lease_times']);
}
}
},
failure: function () {
},
error: function () {
},
scope: this
});
}
}
};
//加载时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
if (bp_ds_id == ds.id && bp_ds_id) {
if (record.get('bp_category') == 'RENTER') {
record.getField('bp_category_n').setReadOnly(true);
record.getField('bp_id_n').setReadOnly(true);
}
if (record.get('bp_category') == 'AGENT') {
record.getField('bp_category_n').setReadOnly(true);
record.getField('bp_id_n').setReadOnly(true);
}
}
};
function arrToObject(arr) {
var strJs = '({';
for (var i = 0; i < arr.length; i += 1) {
var as = arr[i].split("=");
strJs = strJs + as[0] + ':' + '"' + as[1] + '"' + ',';
}
strJs = strJs.substr(0, strJs.length - 1) + '})';
return eval(strJs);
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
if (ds_id == ds.id && ds_id) {
if (record.get('pay_method') == 'WIRE_TRANSFER') {
record.getField('bank_account_id').setReadOnly(true);
record.getField('bank_account_id_n').setReadOnly(true);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
}
//新增 “限制金额”字段;
//“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示,必填,大于0,默认20万,可修改;
if (record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') {
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
record.getField('deduction_limit').setRequired(true);
} else {
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
record.getField('deduction_limit').setRequired(false);
}
}
//只读页面隐藏保存按钮
if('${/parameter/@function_usage}' == 'QUERY'){
if(document.getElementById('${/parameter/@layout_code}_save')){
document.getElementById('${/parameter/@layout_code}_save').style.display = "none";
}
}
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
if (score_ds_id == ds.id) {
if (!record.get('score_name')) {
if ($(ds_id).getCurrentRecord()) {
var score_name = $(ds_id).getCurrentRecord().get('legal_person') || $(ds_id).getCurrentRecord().get('bp_id_tenant_n');
record.set('score_name', score_name);
}
}
}
};
//pdf预览 add by zhuxianfei
function view_pdf(attachment_id) {
Leaf.request({
url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
para: {
attachment_id: attachment_id
},
success: function (res) {
var path = res.result.record.file_path;
path = path.substr(path.indexOf('hls_attachment'));
var tomcat_source = '${/parameter/@tomcat_source}';
var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
var oWin = window.open(source_path);
},
scope: this
});
}
Leaf.onReady(function () {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query?project_id=${/parameter/@project_id}&bp_id=${/parameter/@bp_id}';
$(bp_ds_id).setQueryUrl(url);
$(bp_ds_id).query();
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
$(quotation_ds_id).query();
var billing_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
var billing_url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_bp_operat/query?project_id=${/parameter/@project_id}';
$(billing_ds_id).setQueryUrl(billing_url);
$(billing_ds_id).query();
});
//序号自增 add by lijingjing
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function (ds, record, config_records, bp_seq) {
var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
var traffic_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_TRAFFIC', 'bp_tenant_rate_item');
if ((device_ds_id == ds.id && device_ds_id) || (traffic_ds_id == ds.id && traffic_ds_id)) {
//设置序号
var rs = ds.getAll(),
seq_num = 0;
if (rs.length) {
for (var j = 0; j < rs.length; j++) {
var r = rs[j],
rk = r.get('seq_num');
if (seq_num <= rk) {
seq_num = rk;
}
}
}
var rk_value = seq_num + 1;
record.set('seq_num', rk_value);
}
};
//客户评分
window['${/parameter/@layout_code}_user_button9_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var record = $(ds_id).getCurrentRecord();
if (record) {
var param = record.data;
if (record.get('project_id')) {
param['project_id'] = record.get('project_id');
param['winid'] = 'hl_tenant_score_rate_win_id';
param['url_title'] = '客户评分明细';
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var r = $(score_ds_id).getCurrentRecord();
if (r.dirty && '${/parameter/@function_usage}' == 'MODIFY') {
Leaf.showInfoMessage('提示', '评分数据发生修改,请先保存再进行评分');
return;
}
if ($(ds_id).validate()) {
var win = new Leaf.Window({
id: param['winid'],
params: param,
url: $('${/parameter/@layout_code}_tenant_rate_query_link').getUrl(),
title: param['url_title'],
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(ds_id).query();
});
}
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存');
}
}
};
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
var record = $(quotation_ds_id).getCurrentRecord();
var current_record = $(ds_id).getCurrentRecord();
var lease_item_record = $(lease_item_ds_id).getCurrentRecord();
var bp_record = $(bp_ds_id).getCurrentRecord();
var project_id = current_record.get('project_id');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (current_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (lease_item_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (bp_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if ($(ds_id).validate()) {
Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
var lease_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('prj_approval_link_id').getUrl(),
para: {
project_id: project_id
},
scope: this,
success: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
});
});
}
};
var bp_rate_flag;
/*保存前调用,生成项目编号*/
var count = 0;
window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (prj_project_ds_id == ds.id && prj_project_ds_id) {
if ((record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') && record.get('deduction_limit') <= 0) {
Leaf.showMessage('${l:HLS.PROMPT}', '扣款限额应大于0');
return false;
}
if (record.get('signing_city')){
if (record.get('signing_city').indexOf('州') == -1 && record.get('signing_city').indexOf('县') == -1 && record.get('signing_city').indexOf('区') == -1) {
Leaf.showConfirm('${HLS.PROMPT}', '合同签订地所填写内容,未细化到区/县/州级别,是否确认?', function () {});
}
}
}
return true;
};
//附件打包下载
window['${/parameter/@layout_code}_ACY_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_project_record = $(prj_project_ds_id).getAt(0);
var project_id = prj_project_record.get('project_id');
var project_number = prj_project_record.get('project_number');
var url_l = $('get_prj_atch_download_link').getUrl() + '?table_pk_value=' + project_id + '&table_name=PRJ_PROJECT' + '&doc_code=' + project_number;
window.open(href = url_l, target = "_self");
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: 18083
$Date: 2023/8/31 13:52:40
$Revision: 1.0
$purpose: 经营性租赁维护页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
customizationEnabled="true" dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
</a:init-procedure>
<a:view>
<a:link id="hls_bp_master_billing_link" model="prj.PRJ500N.hls_bp_master_billing" modelaction="query"/>
<a:link id="bp_tenant_detail_query_link" model="prj.PRJ500D.bp_tenant_old_r_query" modelaction="query"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_special_fields_link_id"
model="cont.CON500.con_contract_get_special_fields" modelaction="update"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id"
url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id"
url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calc_quotation_header.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id"
url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_operat_update_n.lview"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_for_deron_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation_for_deron.lsc"/>
<a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id"
url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation.lsc"/>
<a:link id="${/parameter/@layout_code}hls_bp_master_query_link"
url="${/request/@context_path}/modules/hls/HLS215N/hls_bp_master_query.lview"/>
<a:link id="${/parameter/@layout_code}contract_number_query_link"
url="${/request/@context_path}/modules/cont/CON3200/con_re_incept_op_modify.lview"/>
<a:link id="${/parameter/@layout_code}_tenant_rate_query_link"
url="${/request/@context_path}/modules/prj/PRJ902/prj_project_score_result.lview"/>
<a:link id="${/parameter/@layout_code}_hls_fin_calc_get_base_rate_link_id"
model="hls.HLS500.hls_fin_calc_get_base_rate" modelaction="update"/>
<a:link id="${/parameter/@layout_code}_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="${/parameter/@layout_code}_prj_project_update_status_link_id"
model="prj.PRJ505.prj_project_create_contract" modelaction="execute"/>
<a:link id="prj_approval_link_id" model="prj.PRJ501N.project_approval" modelaction="update"/>
<script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
<a:link id="get_prj_atch_download_link"
url="${/request/@context_path}/modules/batch_download/lease_atm_batch_dl.lsc"/>
<a:link id="get_pur_quotation_info_id" model="prj.PRJ501N.prj_pur_quotation_info" modelaction="query"/>
<a:link id="prj_pur_order_deteail_link_id" url="${/request/@context_path}/modules/prj/PRJ2000/purchase_order_deteail.lview"></a:link>
<link href="${/request/@context_path}/modules/viewerjs/viewer.css" rel="stylesheet"/>
<script src="${/request/@context_path}/modules/viewerjs/viewer.js"/>
<script src="${/request/@context_path}/modules/viewerjs/viewer_tool.js"/>
<script type="text/javascript"><![CDATA[
jQuery.noConflict();
/* 时间戳转换为时间 */
function timestampToTime(timestamp) {
timestamp = timestamp ? timestamp : null;
var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
return Y + M + D;
};
//add by zhuxianfei
window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function () {
var url;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CASHFLOW_NS', 'prj_quotation');
var lease_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var record = $(quotation_ds_id).getCurrentRecord();
var head_record = $(ds_id).getAt(0);
var lease_record = $(lease_ds_id).getCurrentRecord();
url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl();
if (head_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (lease_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if ($(quotation_ds_id).validate()) {
var parent_pk_value = head_record.get('project_id');
record.set('function_code', 'PRJ505_QUOTATION');
record.set('function_usage', 'UPDATE');
record.set('project_id', parent_pk_value);
//拆分合同可维护
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
//首次插入
if (!record.get('calc_session_id')) {
record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
var calc_recreate_L_formula;
calc_recreate_L_formula = 'Y';
record.set('_status', 'update');
record.set('from_doc_table', 'PRJ_QUOTATION');
record.set('from_doc_pk', record.get('quotation_id'));
record.set('calculate_flag', 'N');
if (!'${/parameter/@document_id}') {
record.set('document_id', parent_pk_value);
}
var price_list = record.get('price_list');
var saveData = [];
saveData.push(record.data);
Leaf.request({
url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(),
para: saveData,
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$(quotation_ds_id).query();
$(history_ds_id).query();
var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_link_winid',
params: {
layout_code: '${/parameter/@layout_code}',
document_id: parent_pk_value,
price_list: price_list,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: res.result.record.calc_session_id,
quotation_id: quotation_id,
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_link_winid',
global_flag: 'Y',
id_num: 1,
calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
recreate_L_formula: calc_recreate_L_formula,
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
} else {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
var cal_lease_start_date = record.get('cal_lease_start_date');
var lease_start_date = timestampToTime(Date.parse(record.get('lease_start_date')));
var cal_first_pay_date = record.get('cal_first_pay_date');
var first_pay_date = timestampToTime(Date.parse(record.get('first_pay_date')));
var cal_lease_times = record.get('cal_lease_times');
var lease_times = record.get('lease_times');
var cal_hd_user_col_d01 = record.get('cal_hd_user_col_d01');
var hd_user_col_d01 = timestampToTime(Date.parse(record.get('hd_user_col_d01')));
if (cal_lease_start_date == lease_start_date && cal_first_pay_date==first_pay_date &&cal_hd_user_col_d01==hd_user_col_d01 &&cal_lease_times==lease_times) {
//直接进入报价页面
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_update_link_winid',
params: {
layout_code: '${/parameter/@layout_code}',
document_id: parent_pk_value,
price_list: price_list,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: record.get('calc_session_id'),
quotation_id: record.get('quotation_id'),
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_update_link_winid',
global_flag: 'Y',
id_num: 1,
calc_type: '${/parameter/@calc_type}',
recreate_L_formula: 'N',
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
} else {
record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
var calc_recreate_L_formula;
calc_recreate_L_formula = 'Y';
record.set('_status', 'update');
record.set('from_doc_table', 'PRJ_QUOTATION');
record.set('from_doc_pk', record.get('quotation_id'));
record.set('calculate_flag', 'N');
if (!'${/parameter/@document_id}') {
record.set('document_id', parent_pk_value);
}
var price_list = record.get('price_list');
var saveData = [];
saveData.push(record.data);
Leaf.request({
url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(),
para: saveData,
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$(quotation_ds_id).query();
$(history_ds_id).query();
var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
var win = new Leaf.Window({
id: 'hls_fin_calc_quotation_link_winid',
params: {
layout_code: '${/parameter/@layout_code}',
document_id: parent_pk_value,
price_list: price_list,
document_category: 'PROJECT',
maintain_type: 'MODIFY',
business_type: head_record.get('business_type'),
calc_session_id: res.result.record.calc_session_id,
quotation_id: quotation_id,
dsId: quotation_ds_id,
winId: 'hls_fin_calc_quotation_link_winid',
global_flag: 'Y',
id_num: 1,
calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
recreate_L_formula: calc_recreate_L_formula,
division:'${/parameter/@division}'
},
url: url,
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(quotation_ds_id).query();
$(history_ds_id).query();
});
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}
}
}
};
function prj501n_upload_file(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if (record.get('check_id')) {
var url;
if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY') {
url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
} else {
url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'prj500_cdd_uploadFile_screen_id',
width: 850,
height: 400
});
win.on('close', function () {
record.ds.query();
});
} else {
Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
}
}
function prj501n_bp_code_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['bp_id'] = record.get('bp_id');
param['bp_class'] = record.get('bp_class');
if (record.get('bp_category') == 'AGENT') {
param['function_code'] = 'HLS303_Q';
param['function_usage'] = 'QUERY';
} else {
param['function_code'] = 'HLS215D';
param['function_usage'] = 'QUERY';
}
param['winid'] = '${/parameter/@layout_code}_bp_win_id';
param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_project_number_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['bp_id'] = record.get('project_id');
param['bp_class'] = record.get('bp_class');
param['function_code'] = 'PRJ501D';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['prj_bp_id'] = record.get('prj_bp_id');
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}project_number_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_contract_number_renderer(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = {};
param['contract_id'] = record.get('contract_id');
param['function_code'] = 'CON3200Q_OP';
param['function_usage'] = 'QUERY';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}contract_number_query_link', record.ds.id, '${/parameter/@layout_code}');
}
function prj501n_lease_renderer(id, name, query_only){
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var project_id=record.get('source_project_id');
var param = {};
var param = record.data;
param['function_code'] = 'PRJ2000D_WFL';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY'
param['url_title'] = '采购申请单维护';
param['project_id'] = project_id;
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, 'prj_pur_order_deteail_link_id', null, '${/parameter/@layout_code}');
}
//超链接渲染
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'attachment') {
link_function = 'prj501n_upload_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
} else if (name == 'attach_file_name') {
if (value != null) {
var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
var str = value.split(';;');
var url = '';
for (var i = 0; i < str.length; i++) {
var temp = str[i].split('--');
if (!Leaf.isEmpty(temp[0])) {
var file_name = temp[0].toUpperCase();
var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
link_function = 'show_viewer_more';
url = url + '<a href="javascript:window[\'' + link_function + '\'](\'' + link + '\',\'' + temp[1] + '\',\'' + temp[0] + '\',\'' + value + '\');">' + temp[0] + '</a>' + ',';
} else {
url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
}
}
}
return url;
}
} else if (name == 'bp_link' && !record.isNew) {
link_function = 'prj501n_bp_code_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
} else if (name == 'project_number') {
link_function = 'prj501n_project_number_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
} else if (name == 'contract_number') {
link_function = 'prj501n_contract_number_renderer';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
}else if(name=='lease_detail' && record.get('project_lease_item_id')!=null){
link_function = 'prj501n_lease_renderer';
//return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.ds.id + '\')">' + '明细' + '</a>';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' +'明细' + '</a>';
}
};
//保存submitsuccess调用
window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function (ds, record, res) {
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var bp_ds_ids = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
var prj_project_lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
var virtual_ds_id = '${/parameter/@layout_code}_virtual_ds';
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
if (ds_id == ds.id || virtual_ds_id == ds.id) {
$(cdd_item_ds_id).query();
$(bp_ds_id).query();
$(tenant_ds_id).query();
$(prj_project_lease_item_ds_id).query();
$(prj_quotation_ds_id).query();
$(score_ds_id).query();
}
if (prj_project_lease_item_ds_id==ds.id){
$(prj_quotation_ds_id).query();
}
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
//选择事件(grid,attach,gridbox,table)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function (ds, record, bp_seq) {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
if (bp_ds_id == ds.id && bp_ds_id) {
if (record.get('bp_category') == 'RENTER') {
//实际为不选中
Leaf.showMessage('${l:HLS.PROMPT}', '无法删除主承租人!');
setTimeout(function () {
ds.unSelect(record);
}, 1);
}
if (record.get('bp_category') == 'AGENT') {
//实际为不选中
Leaf.showMessage('${l:HLS.PROMPT}', '无法删除经销商!');
setTimeout(function () {
ds.unSelect(record);
}, 1);
}
}
};
function jsGetAge(strBirthday) {
var returnAge;
var strBirthdayArr = strBirthday.split("-");
var birthYear = strBirthdayArr[0];
var birthMonth = strBirthdayArr[1];
var birthDay = strBirthdayArr[2];
var d = new Date();
var nowYear = d.getFullYear();
var nowMonth = d.getMonth() + 1;
var nowDay = d.getDate();
if (nowYear == birthYear) {
returnAge = 0;//同年 则为0岁  
} else {
var ageDiff = nowYear - birthYear; //年之差  
if (ageDiff > 0) {
if (nowMonth == birthMonth) {
var dayDiff = nowDay - birthDay;//日之差  
if (dayDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
} else {
var monthDiff = nowMonth - birthMonth;//月之差  
if (monthDiff < 0) {
returnAge = ageDiff - 1;
} else {
returnAge = ageDiff;
}
}
} else {
returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天  
}
}
return returnAge;//返回周岁年龄  
}
//更新时调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_project_history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
//选择承租人带出开票信息
if (prj_project_ds_id == ds.id && prj_project_ds_id) {
if (name == "payment_deduction" && value == "DOWN_PAYMENT_DEDUCTION") {
//业务类型回租时,默认只读“首付款抵扣”选项
if ($(prj_project_ds_id).getAt(0).get('business_type') == 'LEASE') {
Leaf.showInfoMessage("提示", "直租业务不能选择首付款抵扣");
setTimeout(function () {
$(prj_project_ds_id).getAt(0).set('payment_deduction', null);
$(prj_project_ds_id).getAt(0).set('payment_deduction_n', null);
}, 10);
}
}
if (name == "bp_id_tenant_n" && value) {
var bp_id_tenant = record.get('bp_id_tenant');
Leaf.Masker.mask(Ext.getBody());
Leaf.request({
url: $('hls_bp_master_billing_link').getUrl(),
para: {
bp_id: bp_id_tenant
},
success: function (res) {
var billing_into = res.result.record;
var prj_project_bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
$(prj_project_bp_ds_id).getAt(0).set('taxpayer_type_n', billing_into.taxpayer_type_n);
$(prj_project_bp_ds_id).getAt(0).set('taxpayer_type', billing_into.taxpayer_type);
$(prj_project_bp_ds_id).getAt(0).set('invoice_title', billing_into.invoice_title);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_address', billing_into.invoice_bp_address);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_phone_num', billing_into.invoice_bp_phone_num);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank', billing_into.invoice_bp_bank);
$(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank_account', billing_into.invoice_bp_bank_account);
$(prj_project_bp_ds_id).getAt(0).set('tax_registry_num', billing_into.tax_registry_num);
$(prj_project_bp_ds_id).getAt(0).set('ref_v07', billing_into.ref_v07);
Leaf.Masker.unmask(Ext.getBody());
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
//根据承租人查找该承租人的历史合同信息
$(prj_project_history_ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query');
$(prj_project_history_ds_id).setQueryParameter("bp_id", bp_id_tenant);
$(prj_project_history_ds_id).query();
Leaf.Masker.mask(Ext.getBody());
$(score_ds_id).getCurrentRecord().set('score_name', value);
Leaf.request({
url: $('bp_tenant_detail_query_link').getUrl(),
para: {
bp_id: bp_id_tenant
},
success: function (res) {
var obj = res.result.record;
if (obj) {
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (bp_tenant_detail_r) {
for (var key in bp_tenant_detail_r.data) {
if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age') {
var vl = obj[key];
if (key == 'bp_birth' && obj[key]) {
vl = new Date(obj[key].toString());
}
if (vl != "null" && vl != "undefined") {
bp_tenant_detail_r.set(key, vl);
}
}
}
}
}
Leaf.Masker.unmask(Ext.getBody());
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
if (name == 'legal_person' && value) {
$(score_ds_id).getCurrentRecord().set('score_name', value);
}
if (name == 'pay_method') {
if (record.get('pay_method') == 'WIRE_TRANSFER') {
record.set('bank_account_id', null);
record.set('bank_account_id_n', null);
record.set('bank_branch_num', '');
record.set('bank_account_name', '');
record.getField('bank_account_id').setReadOnly(true);
record.getField('bank_account_id_n').setReadOnly(true);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
} else {
record.getField('bank_account_id').setReadOnly(false);
record.getField('bank_account_id_n').setReadOnly(false);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
}
}
if (name == 'payment_deduction') {
var quoation_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
var quoation_record = $(quoation_ds_id).getCurrentRecord();
var down_payment = quoation_record.get('down_payment') || 0;
var calc_session_id = quoation_record.get('calc_session_id');
var other_payment2;
if (value && calc_session_id && value == 'NO_DEDUCTION') {
other_payment2 = 0;
} else if (value && calc_session_id && value != 'NO_DEDUCTION') {
other_payment2 = down_payment;
}
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('${/parameter/@layout_code}_prj_project_update_status_link_id').getUrl(),
para: {
other_payment2: other_payment2,
calc_session_id: calc_session_id
},
success: function (arg) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}
if (name == 'bp_id_tenant') {
if (!value) {
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (bp_tenant_detail_r) {
for (var key in bp_tenant_detail_r.data) {
bp_tenant_detail_r.set(key, '');
}
}
}
record.getField('bank_account_id').setLovPara('bp_id_tenant', record.get('bp_id_tenant'));
}
//新增 “限制金额”字段;
//“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示,必填,大于0,默认20万,可修改;
if (name=='pay_method') {
if(value=='CCB_THREE'||value=='CCB_TWO'){
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
}
record.getField('deduction_limit').setRequired(true);
if(Ext.isEmpty(record.get('deduction_limit'))){
record.set('deduction_limit',200000);
}
}else{
record.getField('deduction_limit').setRequired(false);
record.set('deduction_limit',null);
if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
}
}
}
}
if (score_ds_id == ds.id) {
if (name == 'bp_birth' && value) {
if (jsGetAge(value.format('yyyy-mm-dd').toString()) == -1) {
Leaf.showInfoMessage("提示", "出生日期不能大于当前日期");
setTimeout(function () {
record.set('bp_birth', old_value);
}, 0);
} else {
record.set('bp_age', jsGetAge(value.format('yyyy-mm-dd').toString()));
}
}
if(name=='third_guar_score'&&!Ext.isEmpty(value)){
if(value<0||value>10){
setTimeout(function () {
record.set('third_guar_score', '');
}, 0);
Leaf.showInfoMessage("提示", "第三方担保附件分数范围为0-10,请重新输入!");
}
}
}
var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
if (device_ds_id == ds.id) {
if (name == 'quantity') {
if (value <= 0) {
Leaf.showInfoMessage("提示", "数量必须大于0");
setTimeout(function () {
record.set('quantity', old_value);
}, 0);
}
}
}
if (lease_item_ds_id == ds.id && lease_item_ds_id) {
if (name == 'source_project_id') {
Leaf.request({
url: $('get_pur_quotation_info_id').getUrl(),
para: {
document_id: value
},
success: function (data) {
if (data.result.record && !data.result.record.length) {
//采购单报价信息
for (var name in data.result.record) {
$(prj_quotation_ds_id).getAt(0).set('lease_item_amount', data.result.record['lease_item_amount']);
$(prj_quotation_ds_id).getAt(0).set('lease_start_date', new Date(data.result.record['lease_start_date']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('int_rate_display', data.result.record['int_rate_display']);
$(prj_quotation_ds_id).getAt(0).set('deposit_ratio', data.result.record['deposit_ratio']);
$(prj_quotation_ds_id).getAt(0).set('first_pay_date', new Date(data.result.record['first_pay_date']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('annual_pay_times', data.result.record['annual_pay_times']);
$(prj_quotation_ds_id).getAt(0).set('pmt', data.result.record['pmt']);
$(prj_quotation_ds_id).getAt(0).set('hd_user_col_d01', new Date(data.result.record['hd_user_col_d01']).format("yyyy-mm-dd"));
$(prj_quotation_ds_id).getAt(0).set('deposit', data.result.record['deposit']);
$(prj_quotation_ds_id).getAt(0).set('lease_term_month', data.result.record['lease_term_month']);
$(prj_quotation_ds_id).getAt(0).set('total_rental', data.result.record['total_rental']);
$(prj_quotation_ds_id).getAt(0).set('lease_times', data.result.record['lease_times']);
}
}
},
failure: function () {
},
error: function () {
},
scope: this
});
}
}
};
//加载时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
if (bp_ds_id == ds.id && bp_ds_id) {
if (record.get('bp_category') == 'RENTER') {
record.getField('bp_category_n').setReadOnly(true);
record.getField('bp_id_n').setReadOnly(true);
}
if (record.get('bp_category') == 'AGENT') {
record.getField('bp_category_n').setReadOnly(true);
record.getField('bp_id_n').setReadOnly(true);
}
}
};
function arrToObject(arr) {
var strJs = '({';
for (var i = 0; i < arr.length; i += 1) {
var as = arr[i].split("=");
strJs = strJs + as[0] + ':' + '"' + as[1] + '"' + ',';
}
strJs = strJs.substr(0, strJs.length - 1) + '})';
return eval(strJs);
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
if (ds_id == ds.id && ds_id) {
if (record.get('pay_method') == 'WIRE_TRANSFER') {
record.getField('bank_account_id').setReadOnly(true);
record.getField('bank_account_id_n').setReadOnly(true);
record.getField('bank_account_id').setRequired(false);
record.getField('bank_account_id_n').setRequired(false);
}
//新增 “限制金额”字段;
//“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示,必填,大于0,默认20万,可修改;
if (record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') {
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
record.getField('deduction_limit').setRequired(true);
} else {
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
record.getField('deduction_limit').setRequired(false);
}
}
//只读页面隐藏保存按钮
if('${/parameter/@function_usage}' == 'QUERY'){
if(document.getElementById('${/parameter/@layout_code}_save')){
document.getElementById('${/parameter/@layout_code}_save').style.display = "none";
}
}
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
if (score_ds_id == ds.id) {
if (!record.get('score_name')) {
if ($(ds_id).getCurrentRecord()) {
var score_name = $(ds_id).getCurrentRecord().get('legal_person') || $(ds_id).getCurrentRecord().get('bp_id_tenant_n');
record.set('score_name', score_name);
}
}
}
};
//pdf预览 add by zhuxianfei
function view_pdf(attachment_id) {
Leaf.request({
url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
para: {
attachment_id: attachment_id
},
success: function (res) {
var path = res.result.record.file_path;
path = path.substr(path.indexOf('hls_attachment'));
var tomcat_source = '${/parameter/@tomcat_source}';
var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
var oWin = window.open(source_path);
},
scope: this
});
}
Leaf.onReady(function () {
var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
var url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query?project_id=${/parameter/@project_id}&bp_id=${/parameter/@bp_id}';
$(bp_ds_id).setQueryUrl(url);
$(bp_ds_id).query();
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
$(quotation_ds_id).query();
var billing_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
var billing_url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_bp_operat/query?project_id=${/parameter/@project_id}';
$(billing_ds_id).setQueryUrl(billing_url);
$(billing_ds_id).query();
});
//序号自增 add by lijingjing
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function (ds, record, config_records, bp_seq) {
var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
var traffic_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_TRAFFIC', 'bp_tenant_rate_item');
if ((device_ds_id == ds.id && device_ds_id) || (traffic_ds_id == ds.id && traffic_ds_id)) {
//设置序号
var rs = ds.getAll(),
seq_num = 0;
if (rs.length) {
for (var j = 0; j < rs.length; j++) {
var r = rs[j],
rk = r.get('seq_num');
if (seq_num <= rk) {
seq_num = rk;
}
}
}
var rk_value = seq_num + 1;
record.set('seq_num', rk_value);
}
};
//客户评分
window['${/parameter/@layout_code}_user_button9_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var record = $(ds_id).getCurrentRecord();
if (record) {
var param = record.data;
if (record.get('project_id')) {
param['project_id'] = record.get('project_id');
param['winid'] = 'hl_tenant_score_rate_win_id';
param['url_title'] = '客户评分明细';
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var r = $(score_ds_id).getCurrentRecord();
if (r.dirty && '${/parameter/@function_usage}' == 'MODIFY') {
Leaf.showInfoMessage('提示', '评分数据发生修改,请先保存再进行评分');
return;
}
if ($(ds_id).validate()) {
var win = new Leaf.Window({
id: param['winid'],
params: param,
url: $('${/parameter/@layout_code}_tenant_rate_query_link').getUrl(),
title: param['url_title'],
fullScreen: true,
draggable: true
});
win.on('close', function () {
$(ds_id).query();
});
}
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存');
}
}
};
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
var record = $(quotation_ds_id).getCurrentRecord();
var current_record = $(ds_id).getCurrentRecord();
var lease_item_record = $(lease_item_ds_id).getCurrentRecord();
var bp_record = $(bp_ds_id).getCurrentRecord();
var project_id = current_record.get('project_id');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (current_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (lease_item_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if (bp_record.dirty == true) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
if ($(ds_id).validate()) {
Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
var lease_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('prj_approval_link_id').getUrl(),
para: {
project_id: project_id
},
scope: this,
success: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
});
});
}
};
var bp_rate_flag;
/*保存前调用,生成项目编号*/
var count = 0;
window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
if (prj_project_ds_id == ds.id && prj_project_ds_id) {
if ((record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') && record.get('deduction_limit') <= 0) {
Leaf.showMessage('${l:HLS.PROMPT}', '扣款限额应大于0');
return false;
}
if (record.get('signing_city')){
if (record.get('signing_city').indexOf('州') == -1 && record.get('signing_city').indexOf('县') == -1 && record.get('signing_city').indexOf('区') == -1) {
Leaf.showConfirm('${HLS.PROMPT}', '合同签订地所填写内容,未细化到区/县/州级别,是否确认?', function () {});
}
}
}
return true;
};
//附件打包下载
window['${/parameter/@layout_code}_ACY_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var prj_project_record = $(prj_project_ds_id).getAt(0);
var project_id = prj_project_record.get('project_id');
var project_number = prj_project_record.get('project_number');
var url_l = $('get_prj_atch_download_link').getUrl() + '?table_pk_value=' + project_id + '&table_name=PRJ_PROJECT' + '&doc_code=' + project_number;
window.open(href = url_l, target = "_self");
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>
......@@ -9,6 +9,7 @@
trace="true">
<a:init-procedure>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
<a:model-query defaultWhereClause="t1.user_id=${/session/@user_id}" model="prj.PRJ501N.get_user_info" rootPath="user_name_path"/>
</a:init-procedure>
<a:view>
<a:link id="prj_project_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
......@@ -17,6 +18,7 @@
url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_create_tree_n.lview"/>
<a:link id="car_modify_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain.lview"/>
<a:link id="car_modify_constru_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_constru.lview"/>
<a:link id="car_modify_operat_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_opreat.lview"/>
<a:link id="car_modify_dff_link"
url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain.lview"/>
<a:link id="car_modify_mananger_link"
......@@ -62,6 +64,9 @@
if(record.get('is_constru_unit') == 'Y'){
param['function_code'] = 'PRJ501_CONSTRU_WFL';
url = 'car_modify_constru_link';
}else if(record.get('division')=='95'){
param['function_code'] = 'PRJ501_OPERAT_WFL';
url = 'car_modify_operat_link';
}else{
param['function_code'] = 'PRJ501_WFL';
url = 'car_modify_link';
......@@ -81,6 +86,9 @@
if(record.get('is_constru_unit') == 'Y'){
param['function_code'] = 'PRJ500D_CONSTRU';
url = 'car_modify_constru_link';
}else if(record.get('division')=='95'){
param['function_code'] = 'PRJ500D_OPERAT';
url = 'car_modify_operat_link';
}else{
param['function_code'] = 'PRJ501D';
url = 'car_modify_link';
......@@ -172,6 +180,11 @@
window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var project_id = $(ds_id).getSelected()[0].get('project_id');
var division = $(ds_id).getSelected()[0].get('division');
if (division=='95'){
Leaf.showMessage('提示', '经营性租赁不支持报价单打印!');
return;
}
//根据是否是代理店打印不同的文本
var templet_code='';
// if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
......@@ -186,6 +199,11 @@
window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
var project_id = $(ds_id).getSelected()[0].get('project_id');
var division = $(ds_id).getSelected()[0].get('division');
if (division=='95'){
Leaf.showMessage('提示', '经营性租赁不支持租金支付计划表打印!');
return;
}
//根据是否是代理店打印不同的文本
var templet_code='';
templet_code = 'PROJECT_QUOTATION_N';
......@@ -204,11 +222,19 @@
//上级 btn4 可见
if("${/model/role_info/record/@role_code}"=="0019") {
$('PROJECT_MODIFY_ENTRANCE_user_button4').hide();
if("${/model/user_name_path/record/@user_name}"=="ZLSY001"||"${/model/user_name_path/record/@user_name}"=="ZLSY002"){
$('PROJECT_MODIFY_ENTRANCE_user_button4').hide();
$('PROJECT_MODIFY_ENTRANCE_user_button3').hide();
}
}else if("${/model/role_info/record/@role_code}"=="0018"){
var t= document.getElementById('PROJECT_MODIFY_ENTRANCE_user_button3').style.display="none";
t.remove();
$('PROJECT_MODIFY_ENTRANCE_user_button3').hide();
if("${/model/user_name_path/record/@user_name}"=="ZLSY001"||"${/model/user_name_path/record/@user_name}"=="ZLSY002"){
$('PROJECT_MODIFY_ENTRANCE_user_button4').hide();
$('PROJECT_MODIFY_ENTRANCE_user_button3').hide();
}
}
})
function check_isload() {
......
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