Commit 78d1f4fd authored by 18083's avatar 18083

经租付款改造

parent 87880cd4
......@@ -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>
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