Commit c02e856e authored by stone's avatar stone

【fix】修改罚息减免计算逻辑

parent 0228ec61
......@@ -148,9 +148,6 @@
return;
}
}
//判断所有的单据是否已经进行测算过
Leaf.request({
url: $('con_contract_penalty_reduction_link').getUrl(),
......
......@@ -35,7 +35,9 @@
if (res.result.header_result == 'success') {
var ds_id2 = 'CON_PENALTY_REDUCTION_MAINTAIN_G_PENALTY_DETAIL_con_contract_cashflow_ds';
$(ds_id2).setQueryParameter('copy_contract_id',record1.get('copy_contract_id'));
$(ds_id2).setQueryParameter('copy_contract_id',record1.get('copy_contract_id'));
$(ds_id2).query();
debugger
var records2 = $(ds_id2).getAll();
if (records2 && records2.length != 0) {
var param_list = [];
......@@ -222,17 +224,26 @@
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
if (value != old_value) {
if (update_falg != 'Y') {
if (name == 'reduce_amount_total') {
var ratio = parseFloat(Leaf.formatNumber(div(record.get('reduce_amount_total'), record.get('unreceived_overdue_amount')), 4));
update_falg = 'Y';
// record.set('reduce_amount_total',value>record.get('unreceived_overdue_amount') ?record.get('unreceived_overdue_amount'):value);
if(value>record.get('unreceived_overdue_amount')){
$L.showErrorMessage('提示','减免金额不能大于最大减免金额!');
record.set('reduce_amount_total',record.get('unreceived_overdue_amount'));
$(ds).getAt(0).set('reduce_amount_total','');
return;
}
var ratio = parseFloat(Leaf.formatNumber(div(record.get('reduce_amount_total'), record.get('total_overdue_amount')), 4));
// update_falg = 'Y';
record.set('reduce_amount_total_ratio', ratio);
}
if (name == 'reduce_amount_total_ratio') {
var amount = parseFloat(mul(record.get('reduce_amount_total_ratio'), record.get('unreceived_overdue_amount')), 2);
update_falg = 'Y';
var amount = parseFloat(mul(record.get('reduce_amount_total_ratio'), record.get('total_overdue_amount')), 2);
// update_falg = 'Y';
record.set('reduce_amount_total', amount);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:s="leaf.plugin.script" xmlns:msg="leaf.application.features.msg"
xmlns:a="http://www.leaf-framework.org/application" xmlns:dr="leaf.plugin.excelreport"
xmlns:excel="leaf.application.task.excel" xmlns:t="uncertain.composite.transform"
xmlns:mail="leaf.plugin.mail" xmlns:p="uncertain.proc" trace="true">
<a:init-procedure>
<s:server-script><![CDATA[
importPackage(java.io);
importPackage(Packages.hl.mail);
try {
var mail_server_bm = $bm('sys.SYS405.sys_get_mail_server');
var mail_server_result = mail_server_bm.queryAsMap().getChildren();
var mail_list_bm = $bm('sys.SYS405.zj_sys_mailing_list');
var mail_list_result = mail_list_bm.queryAsMap().getChildren();
println('###############' + mail_list_result.length + '###############');
for (var i = 0; i < mail_list_result.length; i++) {
var mb = new HlMailBean();
mb.setHost(mail_server_result[0].mail_smtp_host); // 设置SMTP主机(163),若用126,则设为:smtp.126.com
mb.setPort(mail_server_result[0].mail_port_number); //设置端口号
mb.setUsername(mail_server_result[0].mail_username); // 设置发件人邮箱的用户名
mb.setPassword(mail_server_result[0].mail_password); // 设置发件人邮箱的密码,需将*号改成正确的密码
mb.setFrom(mail_server_result[0].mail_address); // 设置发件人的邮箱
mb.setTo(mail_list_result[i].mail_to); // 设置收件人的邮箱
println(mail_list_result[i].mail_to);
if (mail_list_result[i].mail_cc) {
mb.setCc(mail_list_result[i].mail_cc); // 设置抄送人的邮箱
} else {
mb.setCc(mail_list_result[i].mail_to);
}
mb.setSubject(mail_list_result[i].subject); // 设置邮件的主题
mb.setContent(mail_list_result[i].body); // 设置邮件的正文
//mb.setContent(mail_list_result[i].content_type); // 设置邮件的格式 text/html为html,text/plain为纯文本
//设置附件
//mb.attachFile("D:\\abc.xlsx"); // 往邮件中添加附件
var mail_file_bm = $bm('sys.SYS405.zj_sys_mailing_file');
var mail_file_result = mail_file_bm.queryAsMap({
mailing_list_id: mail_list_result[i].mailing_list_id
}).getChildren();
for (var j = 0; j < mail_file_result.length; j++) {
mb.attachFile(mail_file_result[j].file_path);
}
var sm = new HlSendMail();
if (mail_list_result[i].content_type == "text/html") {
println(mail_list_result[i].mailing_list_id);
if (sm.sendHtmlMail(mb)) {
$bm('sys.SYS405.zj_sys_mailing_list').update({
mailing_list_id: mail_list_result[i].mailing_list_id
});
} else {
$bm('sys.SYS405.zj_sys_mailing_list').execute({
mailing_list_id: mail_list_result[i].mailing_list_id
});
}
} else {
if (sm.sendMail(mb)) {
$bm('sys.SYS405.zj_sys_mailing_list').update({
mailing_list_id: mail_list_result[i].mailing_list_id
});
} else {
$bm('sys.SYS405.zj_sys_mailing_list').execute({
mailing_list_id: mail_list_result[i].mailing_list_id
});
}
}
}
} catch (e) {
raise_app_error(e);
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:s="leaf.plugin.script" xmlns:msg="leaf.application.features.msg"
xmlns:a="http://www.leaf-framework.org/application" xmlns:dr="leaf.plugin.excelreport"
xmlns:excel="leaf.application.task.excel" xmlns:t="uncertain.composite.transform"
xmlns:mail="leaf.plugin.mail" xmlns:p="uncertain.proc" trace="true">
<a:init-procedure>
<s:server-script><![CDATA[
importPackage(java.io);
importPackage(Packages.hl.mail);
try {
var mail_server_bm = $bm('sys.SYS405.sys_get_mail_server');
var mail_server_result = mail_server_bm.queryAsMap().getChildren();
var mail_list_bm = $bm('sys.SYS405.zj_sys_mailing_list');
var mail_list_result = mail_list_bm.queryAsMap().getChildren();
println('###############' + mail_list_result.length + '###############');
for (var i = 0; i < mail_list_result.length; i++) {
var mb = new HlMailBean();
mb.setHost(mail_server_result[0].mail_smtp_host); // 设置SMTP主机(163),若用126,则设为:smtp.126.com
mb.setPort(mail_server_result[0].mail_port_number); //设置端口号
println(mail_server_result[0].mail_port_number);
mb.setUsername(mail_server_result[0].mail_username); // 设置发件人邮箱的用户名
mb.setPassword(mail_server_result[0].mail_password); // 设置发件人邮箱的密码,需将*号改成正确的密码
mb.setFrom(mail_server_result[0].mail_address); // 设置发件人的邮箱
mb.setTo(mail_list_result[i].mail_to); // 设置收件人的邮箱
println(mail_list_result[i].mail_to);
if (mail_list_result[i].mail_cc) {
mb.setCc(mail_list_result[i].mail_cc); // 设置抄送人的邮箱
} else {
mb.setCc(mail_list_result[i].mail_to);
}
mb.setSubject(mail_list_result[i].subject); // 设置邮件的主题
mb.setContent(mail_list_result[i].body); // 设置邮件的正文
//mb.setContent(mail_list_result[i].content_type); // 设置邮件的格式 text/html为html,text/plain为纯文本
//设置附件
//mb.attachFile("D:\\abc.xlsx"); // 往邮件中添加附件
var mail_file_bm = $bm('sys.SYS405.zj_sys_mailing_file');
var mail_file_result = mail_file_bm.queryAsMap({
mailing_list_id: mail_list_result[i].mailing_list_id
}).getChildren();
for (var j = 0; j < mail_file_result.length; j++) {
mb.attachFile(mail_file_result[j].file_path);
}
var sm = new HlSendMail();
if (mail_list_result[i].content_type == "text/html") {
println(mail_list_result[i].mailing_list_id);
if (sm.sendHtmlMail(mb)) {
$bm('sys.SYS405.zj_sys_mailing_list').update({
mailing_list_id: mail_list_result[i].mailing_list_id
});
} else {
$bm('sys.SYS405.zj_sys_mailing_list').execute({
mailing_list_id: mail_list_result[i].mailing_list_id
});
}
} else {
if (sm.sendMail(mb)) {
$bm('sys.SYS405.zj_sys_mailing_list').update({
mailing_list_id: mail_list_result[i].mailing_list_id
});
} else {
$bm('sys.SYS405.zj_sys_mailing_list').execute({
mailing_list_id: mail_list_result[i].mailing_list_id
});
}
}
}
} catch (e) {
raise_app_error(e);
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</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