Commit 652f6b86 authored by stone's avatar stone

【feat】增加退款申请书功能

parent 105fa5ef
CREATE TABLE csh_transaction_return_print (
print_id NUMBER,
document_id NUMBER,
document_table VARCHAR2(100),
print_times NUMBER,
print_date DATE,
created_by NUMBER DEFAULT -1,
creation_date DATE DEFAULT SYSDATE,
last_updated_by NUMBER DEFAULT -1,
last_update_date DATE DEFAULT SYSDATE
);
COMMENT ON COLUMN csh_transaction_return_print.print_id IS '主键';
COMMENT ON COLUMN csh_transaction_return_print.document_id IS '单据id';
COMMENT ON COLUMN csh_transaction_return_print.document_table IS '表字段';
COMMENT ON COLUMN csh_transaction_return_print.print_times IS '打印次数';
COMMENT ON COLUMN csh_transaction_return_print.print_date IS '打印时间';
alter table csh_transaction_return_print
add CONSTRAINT csh_return_print_PK primary key (print_id);
CREATE SEQUENCE csh_return_print_s;
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: sf
$Date: 2019-12-06 上午09:52:30
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
CSH_TRANSACTION_CONTENT_PKG.csh_transaction_content_create(
p_return_id =>${@return_id},
p_user_id =>${/session/@user_id},
p_templet_code=>${@templet_code}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -14,10 +14,10 @@
--应付我司开户行
v.bp_bank_full_name agent_bank_name,
--代理商名称
(select bp.BP_NAME
from HLS_BP_MASTER bp
WHERE bp.BP_ID = t.bp_id_agent_level1
and bp.bp_category = 'AGENT') agent_name,
( SELECT b.bp_name
from con_contract_bp b
where b.contract_id=t.contract_id
AND b.bp_category = 'AGENT') agent_name,
--应付我司开户名
v.bp_bank_account_name agent_account_name,
--应付我司开户账号
......@@ -27,7 +27,11 @@
--厂商开户行
v.vender_bank_full_name vender_bank_name,
--厂商名称
v.vender_name vender_name,
(
SELECT hbm.bp_name
FROM hls_bp_master hbm,hls_bp_master_bank_account hbbc
WHERE hbm.bp_id=hbbc.bp_id
AND hbbc.bank_account_id= v.vender_bank_account_id ) vender_name ,
--应付我司开户账号
v.vender_bank_account_number VENDER_BANK_NUM,
(to_char(SYSDATE, 'yyyy') || '年' || to_char(SYSDATE, 'mm') || '月' ||
......
......@@ -17,9 +17,10 @@
ccli.pattern pattern,
ccli.machine_number machine_number,
--add 添加预付款的时间
(select hbm.bp_name
from hls_bp_master hbm
where hbm.bp_id = c.bp_id_tenant) bp_id_tenant_n,
(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,
to_char(cpr.apply_pay_date,'yyyy-mm-dd') apply_pay_date,
cpr.bp_bank_account_id,
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: sf
$Date: 2019-12-06 上午09:52:30
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
csh_transaction_return_pkg.csh_return_print(
p_document_id =>${@document_id},
p_user_id =>${/session/@user_id},
p_document_table=>${@document_table}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2015-6-10 下午03:17:55
$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
faa.file_name,
faa.file_type_code,
faa.file_path,
pp.content_id,
(SELECT
'Y'
FROM
fnd_atm_attachment_multi m1
WHERE
m1.table_name = 'HLS_DOC_FILE_TEMPLET' AND
m1.table_pk_value = ${/parameter/@return_id}
) file_exists_flag,
p.transaction_num || '-' || pp.content_number to_file_name
FROM
fnd_atm_attachment faa,
fnd_atm_attachment_multi m,
hls_doc_file_templet lt,
con_clause_templet t,
csh_transaction_return_content pp,
csh_transaction_return r,
csh_transaction p
WHERE
faa.attachment_id = m.attachment_id AND
m.table_name = 'HLS_DOC_FILE_TEMPLET' AND
m.table_pk_value = lt.templet_id AND
lt.templet_id = t.doc_template_id AND
t.doc_plugin_flag = 'Y' AND
p.transaction_id = r.transaction_id AND
r.return_id=pp.return_id AND
t.templet_id = pp.templet_id AND
(pp.content_id =${/parameter/@content_id} OR
(
pp.return_id =${/parameter/@return_id} AND
${/parameter/@batch_flag}='Y'
)
)
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="content_id"/>
<bm:field name="file_type_code"/>
<bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
<bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
<bm:field name="file_exists_flag" databaseType="VARCHAR2" datatype="java.lang.String"
physicalName="FILE_EXISTS_FLAG"/>
<bm:field name="to_file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_FILE_NAME"/>
</bm:fields>
</bm:model>
......@@ -8,79 +8,24 @@
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[select r.return_id,
r.this_return_amount,
t1.transaction_num,
to_char(transaction_date,'yyyy-mm-dd') transaction_date,
t1.currency_code,
b.bank_account_num,
b.bank_branch_name,
bank_slip_num,
t1.period_name,
(select gc.currency_name
from gld_currency_vl gc
where gc.currency_code = t1.currency_code) as currency_name,
t1.transaction_amount,
(select a.bank_account_code
from csh_bank_account a
where a.bank_account_id = t1.bank_account_id
and a.company_id = t1.company_id) as bank_account_code,
(select a.bank_account_name
from csh_bank_account a
where a.bank_account_id = t1.bank_account_id
and a.company_id = t1.company_id) as bank_account_name,
(select d.bp_name from hls_bp_master_v d where d.bp_id = t1.bp_id) as bp_name,
(select b.description
from hls_bp_category b
where b.bp_category = t1.bp_category) as bp_category_display,
<bm:query-sql><![CDATA[SELECT r.return_id,
r.this_return_amount,
to_char(r.return_date,'yyyy-mm-dd') transaction_date,
r.bp_bank_account_num bank_account_num,
r.bp_bank_account_name bank_branch_name,
t.bank_slip_num,
(select u.employee_name
from sys_user_v u
where u.user_id = r.created_by) user_desc,
t.transaction_num
FROM csh_transaction_return r,
csh_transaction t
--hls_bp_master_bank_account v
WHERE r.transaction_id= ${@return_from_csh_trx_id}
AND r.status='APPROVED'
AND t.transaction_id=r.return_transaction_id
(select cp.description
from csh_payment_method cp
where cp.payment_method_id = t1.payment_method_id) as payment_method_display,
t1.exchange_rate,
(select tv.type_name
from gld_exchangerate_types_vl tv
where tv.type_code = t1.exchange_rate_type) as exchange_rate_type_display,
(select a.bank_account_code
from csh_bank_account a
where a.bank_account_id = t1.bank_account_id
and a.company_id = t1.company_id) as bank_account_code,
(select a.bank_account_name
from csh_bank_account a
where a.bank_account_id = t1.bank_account_id
and a.company_id = t1.company_id) as bank_account_name,
(select a.bank_account_code
from hls_bp_master_bank_account a
where a.bank_account_id = t1.bp_bank_account_id) as bp_bank_account_code,
(select a.bank_account_name
from hls_bp_master_bank_account a
where a.bank_account_id = t1.bp_bank_account_id) as bp_bank_account_name,
(select u.employee_name
from sys_user_v u
where u.user_id = t1.created_by) user_desc,
r.notes,
(select h.bp_name
from hls_bp_master h
where h.bp_id = (select c.bp_id_tenant
from con_contract c
where contract_id = r.ref_contract_id)) bp_name_t,
(select h.bp_name
from hls_bp_master h
where h.bp_id = (select c.bp_id_agent_level1
from con_contract c
where contract_id = r.ref_contract_id)) agent_name_t,
(select c.contract_number
from con_contract c
where contract_id = r.ref_contract_id) contract_number_t
from csh_transaction t1,
csh_transaction_return r,
hls_bp_master_bank_account b
where
t1.transaction_id(+)= r.transaction_id
and r.bp_id = b.bp_id
and r.status = 'APPROVED'
and t1.transaction_id = ${@return_from_csh_trx_id}
]]></bm:query-sql>
</bm:operation>
......
......@@ -2,6 +2,9 @@
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:parameters>
<bm:parameter name="p_record_id" dataType="java.lang.Long" input="false" inputPath="@record_id" output="true" outputPath="/parameter/@record_id"/>
</bm:parameters>
<bm:update-sql><![CDATA[
BEGIN
hls_doc_file_templet_pkg.office_insert_fnd_atm(
......@@ -14,6 +17,7 @@
p_source_type =>nvl(${@source_type},'COMMON')
);
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
......
<?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);
importPackage(Packages.hls.plugin.docx4j)
importPackage(Packages.org.apache.commons.io);
function RandomString(length) {   
var str = '';   
for (;str.length < length;str += Math.random().toString(36).substr(2));   
return str.substr(0, length); 
}
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
......@@ -34,21 +18,9 @@
fos.close();
}
//按日期创建目录
function getDatePath() {
set_parameter_file_path();
var file_path = $ctx.parameter.file_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 write_os_to_file(file, os) {
var fis = new FileInputStream(file);
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) {
......@@ -57,90 +29,67 @@
fis.close();
}
function download_file(file_path, file_name) {
$ctx["__request_type__"] = 'file';
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.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'utf-8'));
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
try {
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'UTF-8'));
var os = resp.getOutputStream();
write_os_to_file(file_path, os);
//write_os_to_file(file_path+file_name, os);
transfer(file_path, os);
os.flush();
} catch (e) {
$logger("server-script").severe(e.message);
}
}
function collection_create_content() {
try {
//第一步生成合同文本
$bm('cont.CON620.create_content_for_collection').update({
payment_req_id: $ctx.parameter.payment_req_id,
templet_code: $ctx.parameter.templet_code
});
//获取日期目录
set_parameter_file_path();
var datePath = getDatePath();
$ctx.parameter.batch_flag='Y';
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var from_file_data_map = $bm('cont.CON500.con_doc_file_templet_get_atm').queryAsMap({
payment_req_id: $ctx.parameter.payment_req_id,
batch_flag:$ctx.parameter.batch_flag,
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 = from_file_data_map.getChildren();
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 + '.' + record_data.file_type_code || 'doc';
// 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 + 'con' + record_data.content_id;
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);
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);
} catch (e) {
raise_app_error(e);
}
$bm('cont.CON500.con_file_content_copy_update').update({
table_name: 'CON_CONTRACT_CONTENT',
$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()
file_path: to_file_path.toString(),
source_type: $ctx.parameter.source_type
});
var test=new File(to_file_path);
var test1=new File('D:'+to_file_path);
download_file(to_file_path.toString(),to_file_name.toString());
}
}
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');
$ctx.parameter.return_status = 'S';
$ctx.parameter.return_message = '执行成功';
$bm('csh.CSH501.csh_transaction_return_print').update({
p_document_id: $ctx.parameter.document_id,
p_document_table: $ctx.parameter.document_table
});
download_file(to_file_name, to_file_path);
} 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>
......@@ -14,10 +14,28 @@
<a:link id="${/parameter/@layout_code}_csh560_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="${/parameter/@layout_code}_csh560_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="transaction_return_uploadFile_link_id" url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="assignment_agreement_print_link"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_print.lsc"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function(){
// console.log('${/parameter}');
})
//退款申请书打印
// window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
//
// var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_transaction_return');
// var record=$(ds_id).getAt(0)
// if(!record.get("return_id")){
// $L.showErrorMessage("提示",'请先保存数据') ;
// return;
// }
// var templet_code = 'CSH_RETURN_INFO';
// // var document_id = record.get('ast_car_insurance_records_id');
// var url_l = $('assignment_agreement_print_link').getUrl() + '?document_id=' + record.get("return_id") + '&document_table=CSH_TRANSACTION_RETURN&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
// window.open(href = url_l, target = "_self");
// // var url = $('assignment_agreement_print_link').getUrl() + '?document_id=2550&document_table=CSH_TRANSACTION_RETURN';
// // window.open(url, '_self');
// }
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
/* var transaction_amount = ${/parameter/@transaction_amount}||0;
......
......@@ -13,6 +13,8 @@
url="${/request/@context_path}/modules/csh/CSH515/csh_transaction_return_detail.lview"/>
<!-- <a:model-query autoCount="false" defaultWhereClause=" payment_req_id=${/parameter/@payment_req_id}" fetchAll="true" model="csh.CSH515.csh_transaction_returned_list" rootPath="csh_payment_req_pay_query"/> -->
<a:link id="csh515_downloadFile_link_id" url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="assignment_agreement_print_link"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_print.lsc"/>
<script type="text/javascript"><![CDATA[
function csh515_returned_list_back() {
$('${/parameter/@winId}').close();
......@@ -27,7 +29,18 @@
return '<a href="javascript:openWindow1(\'' + url + '\');">' + value + '</a>';
}
}
//退款申请书打印
function csh_transaction_print(){
var records=$('csh_transaction_returned_list_ds').selected;
if(records.length!=1){
$L.showWarningMessage("提示",'只能选择一条退款记录进行打印!');
return;
}
var templet_code = 'CSH_RETURN_INFO';
// var document_id = record.get('ast_car_insurance_records_id');
var url_l = $('assignment_agreement_print_link').getUrl() + '?document_id=' + records[0].get("return_id") + '&document_table=CSH_TRANSACTION_RETURN&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
window.open(href = url_l, target = "_self");
}
function openWindow1(url) {
new Leaf.Window({
id: 'csh_transaction_return_detail_link_winid',
......@@ -60,7 +73,7 @@
]]></script>
<a:dataSets>
<a:dataSet id="csh_transaction_returned_list_ds" autoQuery="true" loadData="true"
<a:dataSet id="csh_transaction_returned_list_ds" autoQuery="true" loadData="true" selectable="true"
model="csh.CSH515.csh_transaction_returned_list"
queryUrl="${/request/@context_path}/autocrud/csh.CSH515.csh_transaction_returned_list/query?return_from_csh_trx_id=${/parameter/@return_from_csh_trx_id}">
<![CDATA[
......@@ -70,6 +83,7 @@
<a:screenBody>
<a:screenTopToolbar>
<a:gridButton id="csh515_returned_list_back_id" click="csh515_returned_list_back" text="HLS.EXIT"/>
<a:gridButton id="csh515_returned_apply_print" click="csh_transaction_print" text="退款申请书打印"/>
</a:screenTopToolbar>
<a:grid bindTarget="csh_transaction_returned_list_ds" marginHeight="130" marginWidth="30" navBar="true">
<a:columns>
......@@ -82,9 +96,9 @@
<a:column name="bank_account_num" prompt="退款账户" align="center"/>
<a:column name="bank_branch_name" prompt="CSH511.BANK_ACCOUNT_NAME" align="center"/>
<!-- <a:column name="bank_account_num" prompt="CSH511.BANK_ACCOUNT_NUM"/> -->
<a:column name="bp_name" prompt="HLS.BP_NAME" align="center"/>
<!-- <a:column name="bp_name" prompt="HLS.BP_NAME" align="center"/>
<a:column name="bp_category_display" prompt="CSH511.CSH_TRANSACTION.BP_CATEGORY" align="center"/>
<a:column name="bank_slip_num" prompt="银行流水号" align="center"/>
<a:column name="bank_slip_num" prompt="银行流水号" align="center"/>-->
<a:column name="user_desc" prompt="HLS.DOCUMENT_CREATED_BY" align="center"/>
<a:column align="center" prompt="附件查看" renderer="csh515_attachment_download" width="80"/>
</a:columns>
......
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