Commit 49c0e461 authored by 18083's avatar 18083

营业月结跨月核销及划转提示

parent 8517d77f
......@@ -26,9 +26,7 @@
}
function init() {
if ('${/parameter/@collection_classes}' == 'COMBINED' && '${/parameter/@transaction_type}' !== 'DEPOSIT') {
if ('${/parameter/@collection_classes}' == 'COMBINED' && '${/parameter/@transaction_type}' !== 'DEPOSIT') {
document.getElementById('write_off_deposit').style.display = 'block';
document.getElementById('write_off_operat').style.display = 'block';
}
......@@ -680,6 +678,72 @@
}
}
}
//获取当前日期的上一个月
function getPreMonth(date) {
var arr = date.split('-');
var year = arr[0]; //获取当前日期的年份
var month = arr[1]; //获取当前日期的月份
var day = arr[2]; //获取当前日期的日
var days = new Date(year, month, 0);
days = days.getDate(); //获取当前日期中月的天数
var year2 = year;
var month2 = parseInt(month) - 1;
if (month2 == 0) {
year2 = parseInt(year2) - 1;
month2 = 12;
}
var day2 = day;
var days2 = new Date(year2, month2, 0);
days2 = days2.getDate();
if (day2 > days2) {
day2 = days2;
}
if (month2 < 10) {
month2 = '0' + month2;
}
var t2 = year2 + '-' + month2 + '-' + day2;
return t2;
}
//获取月结期间是否关闭
function get_period_closed(date){
var csh_confirm_flag;
$L.request({
url: '${/request/@context_path}/autocrud/csh.CSH531N.csh_data_confirm/query',
para: {
transaction_date: date
},
sync: true,
success: function (res) {
csh_confirm_flag=res.result.record.csh_confirm_flag;
},
error: function () {
},
failure: function () {
},
scope: this,
sync: true,
});
if(csh_confirm_flag=='N'){
return false;
}
return true;
}
function check_transaction(){
var transaction_ds = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord();
var paid_byother_flag=transaction_ds.get('paid_byother_flag');
var collection_classes=transaction_ds.get('collection_classes');
var guarantor_name_duty=transaction_ds.get('guarantor_name_duty');
var transaction_type=transaction_ds.get('transaction_type');
if(paid_byother_flag=='T' && collection_classes=='COMBINED'
&& guarantor_name_duty=='NULL' && transaction_type=='ADVANCE_RECEIPT'){
return false;
}
return true;
}
function csh531n_write_off_submit() {
var returning_amount = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord().get('returning_amount') || 0;
......@@ -732,8 +796,49 @@
Leaf.showInfoMessage('提示', '经营性租赁合同收款核销当天的系统日期不得早于应收日!');
return;
}
//收款核销为融租保证金和经租保证金时:校验收款日期和核销日期存在跨月且收款日期所在月份的营业月结未确认时 18083 2024/7/15
var depositRs_date_count=0;
var operatRs_date_count=0;
var interfaceRs_date_count=0;
var transaction_date = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord().get('transaction_date');
var transaction_type = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord().get('transaction_type');
//核销为融租保证金
for(var j=0;j<depositRs.length;j++){
if(!get_period_closed(transaction_date) &&check_transaction()
&&(depositRs[j].get('write_off_date').getFullYear() !=transaction_date.getFullYear()||depositRs[j].get('write_off_date').getMonth()+1 !=transaction_date.getMonth()+1)){
depositRs_date_count = plus(depositRs_date_count, 1);
}
}
//核销为经租保证金
for(var j=0;j<operatRs.length;j++){
if(!get_period_closed(transaction_date) &&check_transaction()
&&(operatRs[j].get('write_off_date').getFullYear() !=transaction_date.getFullYear()||operatRs[j].get('write_off_date').getMonth()+1 !=transaction_date.getMonth()+1)){
operatRs_date_count = plus(operatRs_date_count, 1);
}
}
//保证金抵扣为债券
if(transaction_type == 'DEPOSIT'){
for(var j=0;j<interfaceRs.length;j++){
var Rs_write_date = Leaf.formatDate(interfaceRs[j].get('write_off_date'));
var interfaceRs_date = getPreMonth(Leaf.formatDate(interfaceRs[j].get('write_off_date')));
if(!get_period_closed(interfaceRs_date)
&&(Rs_write_date.split('-')[0] !=transaction_date.getFullYear() || Rs_write_date.split('-')[1]!=transaction_date.getMonth()+1)){
interfaceRs_date_count = plus(interfaceRs_date_count, 1);
break;
}
}
}
var promt;
if(depositRs_date_count>0 ||operatRs_date_count>0){
promt =(transaction_date.getMonth()+1)+'月营业月结未确认,收款日期为'+Leaf.formatDate(transaction_date)+',与当前选择<br/>保证金的核销日期存在跨月,会影响会计凭证日期,确认<br/>要提交吗?'
}else if(interfaceRs_date_count>0){
promt = interfaceRs_date.split('-')[0]+'-'+interfaceRs_date.split('-')[1]+'月营业月结未确认,与当前选择的核销日期存在<br/>跨月,会影响会计凭证日期,确认要提交吗?'
}else{
promt = '确认提交复核吗?'
}
var createConfirm = Leaf.showConfirm('提示', '确认提交复核吗', function () {
var createConfirm = Leaf.showConfirm('提示',promt, function () {
$('csh531n_write_off_submit_btn_id').disable();
csh511_save_all();
});
......
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