Commit d032d792 authored by gzj34291's avatar gzj34291

付款第三方

parent 4cb74d5c
......@@ -5,10 +5,9 @@
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
</a:init-procedure>
<a:view>
<a:link id="csh_payment_req_create_link"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_selected.lview"/>
<a:link id="csh_payment_req_history_print_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_history_pdf_print.lsc"/>
<a:link id="csh_payment_req_create_link" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_selected.lview"/>
<a:link id="csh_payment_req_history_print_link_id" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_history_pdf_print.lsc"/>
<a:link id="csh_payment_req_history_word_link_id" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_history_word_print.lsc"/>
<a:link id="get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="tre_loan_contact_cancel_change_link_id" model="lon.LON120.tre_loan_change_cancel"
modelaction="update"/>
......@@ -18,7 +17,7 @@
<script type="text/javascript"><![CDATA[
Leaf.onReady(function () {
//付款打印按钮只有会计担当和会计部长可见
if ("${/model/role_info/record/@role_code}" != "0013" && "${/model/role_info/record/@role_code}" != "0014" && "${/model/role_info/record/@role_code}" != "0010") {
if ("${/model/role_info/record/@role_code}" != "0013" && "${/model/role_info/record/@role_code}" != "0014" && "${/model/role_info/record/@role_code}" != "0010"&& "${/model/role_info/record/@role_code}" != "0006") {
//$('${/parameter/@layout_code}_user_button5').style.display='none';
Ext.fly('${/parameter/@layout_code}_user_button5').dom.style.display = "none";
} else {
......@@ -37,12 +36,24 @@
//获取该付款申请的头id
var payment_req_id = records[0].get('payment_req_id');
var payment_status = records[0].get('approval_status');
var division = records[0].get('con_division');
if (payment_status != "APPROVED") {
$L.showInfoMessage("提示", '只有审批通过的付款申请才能打印,且一次只能打印一个付款申请!');
return;
}
// var url_l = $('csh_payment_req_history_print_link_id').getUrl() + '?document_id=' + payment_req_id + '&document_table=CSH_PAYMENT_APPROVE&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
// window.open(href = url_l, target = "_self");
if(division == '30' || division == '50'){
var url_l = $('csh_payment_req_history_word_link_id').getUrl() + '?document_id=' + payment_req_id + '&document_table=CSH_PAYMENT_APPROVE&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
}else{
var url_l = $('csh_payment_req_history_print_link_id').getUrl() + '?document_id=' + payment_req_id + '&document_table=CSH_PAYMENT_APPROVE&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
}
window.open(href = url_l, target = "_self");
};
//新增
......@@ -217,8 +228,6 @@
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');
var param = {};
param['payment_req_id'] = record.get('payment_req_id');
param['document_category'] = record.get('document_category');
......@@ -236,6 +245,7 @@
} else if (record.get('business_type') == 'PREPAYMENT') {
param['function_code'] = 'CSH501_PRE_D';
}
if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') {
param['function_usage'] = 'UPDATE';
param['function_code'] = 'CSH501D';
......
......@@ -101,10 +101,36 @@
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 hd_ds, ln_ds, lineRecords, currency_code, currency_name;
if (hdds_id) {
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
if((name == 't_bank_account_name'||name == 't_bank_account_name_n') && !Ext.isEmpty(hdrecord.get('t_bank_account_name_n')) && !Ext.isEmpty(hdrecord.get('third_bp_id_n'))){
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].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);
......@@ -156,6 +182,21 @@
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
}
if (ds.id == ds_id) {
var handrecord = $(hdds_id).getCurrentRecord();
if (!Ext.isEmpty(handrecord)) {
var bank_account_name = handrecord.get('third_bp_id_n');
if (!Ext.isEmpty(hdrecord.get('third_bp_id_n'))) {
var records = $(ds_id).getAll();
for (var i = 0; i < records.length; i++) {
records[i].getField('vender_bank_account_number').setReadOnly(true);
records[i].getField('vender_bank_account_number_n').setReadOnly(true);
}
}
}
}
if (record) {
if ('${/parameter/@function_code}' == 'CSH502D') {
record.getField('pay_amount').setReadOnly(false);
......@@ -173,8 +214,15 @@
}
}
var lnds_records = $(ds_id).getAll();
if (ds.id == ds_id) {
for (var i = 0; i < lnds_records.length; i++) {
if (lnds_records[i].get('division') == '70' || lnds_records[i].get('division') == '92') {
lnds_records[i].getField('tenant_bank_account_number').setRequired(false);
lnds_records[i].getField('tenant_bank_account_number_n').setRequired(false);
}
}
}
if (con_business_type == 'LEASEBACK'){
debugger
if ('${/parameter/@division}' ==91||'${/parameter/@division}' =='神钢建机'){
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var records = $(ds_id).getAll();
......@@ -185,15 +233,6 @@
}
}
}
var lnds_records = $(ds_id).getAll();
if (ds.id == ds_id) {
for (var i = 0; i < lnds_records.length; i++) {
if (lnds_records[i].get('division') == '70' || lnds_records[i].get('division') == '92') {
lnds_records[i].getField('tenant_bank_account_number').setRequired(false);
lnds_records[i].getField('tenant_bank_account_number_n').setRequired(false);
}
}
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
......@@ -226,7 +265,6 @@
}
}
if ('${/parameter/@division}' ==91||'${/parameter/@division}' =='神钢建机'||'${/parameter/@division}' ==92||'${/parameter/@division}' =='北京卡家' ){
debugger
if (con_business_type == 'LEASEBACK'){
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var records = $(ds_id).getAll();
......@@ -292,7 +330,6 @@
//打印
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();
......@@ -341,6 +378,13 @@
var head_record = $(ds_id).getAt(0);
//高空作业车个数
var gk_contract_num = 0;
if(!Ext.isEmpty(head_record.get('t_bank_account_id'))){
for (var i = 0; i < line_datas.length; i++) {
var line_data = line_datas[i];
line_data.set('vender_bank_account_id',head_record.get('t_bank_account_id'));
}
}
for (var i = 0; i < line_datas.length; i++) {
var line_data = line_datas[i];
//应付我司金额
......@@ -478,6 +522,7 @@
record.set('contract_id', '${/parameter/@contract_id}');
}
}
var head_record = $(hdds_id).getAt(0);
if (hdds_id == ds.id) {
if ('${/parameter/@function_usage}' == 'READONLY') {
......@@ -489,6 +534,26 @@
record.getField('las_compensatory_amount').setReadOnly(true);
}
}
if(head_record.get('con_division') == '30' || head_record.get('con_division') == '50'||'${/parameter/@division}' == '50' || '${/parameter/@division}' == '30'){
// record.getField('third_bp_id').setRequired(true);
// record.getField('third_bp_id_n').setRequired(true);
// record.getField('t_bank_account_name').setRequired(true);
//record.getField('t_bank_account_name_n').setRequired(true);
}else{
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_THIRD_BP_ID_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_THIRD_BP_ID').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NAME_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NAME').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NUM_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NUM').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_FULL_NAME_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_FULL_NAME').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_BRANCH_NAME_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_BRANCH_NAME').style.display = 'none';
}
}
};
//保存submitsuccess调用
......
<?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="con_print_path.js"><![CDATA[
importPackage(Packages.hls.plugin.docx4j);
importPackage(java.io);
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 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);
os.flush();
}
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 = to_file_path + guid_file_name_tables[0].guid_file_name + 'doc' + record_data.content_id;
copyFile(from_file_path, to_file_path);
$bm('hls.HLS811.hls_file_content_copy_update').update({
table_name: 'HLS_DOC_FILE_CONTENT',
content_id: record_data.content_id,
file_name: to_file_name.toString(),
file_path: to_file_path.toString(),
source_type: $ctx.parameter.source_type
});
try {
$bm('csh.CSH501.csh_transaction_return_print').update({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table
});
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');
download_file(to_file_name, to_file_path);
} catch (e) {
raise_app_error(e);
}
}
]]></s:server-script>
</a:init-procedure>
</a:service>
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