1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2015-1-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="birt_print_path.js"><![CDATA[
$ctx.parameter.birt_print_path = birt_print_path['birt_print_path'];
]]></s:server-script>
<a:model-query autoCount="false" defaultWhereClause=" document_category='PAYMENT_REQ' and document_type='STD_PREPAYMENT_REQ'" fetchAll="true" model="hls.HLS003.hls_document_type" rootPath="default_prepayment_document_type"/>
<a:model-query autoCount="false" defaultWhereClause=" document_category='PAYMENT_REQ' and document_type='STD_PAYMENT_REQ'" fetchAll="true" model="hls.HLS003.hls_document_type" rootPath="default_payment_document_type"/>
<a:model-query autoCount="false" fetchAll="true" model="basic.current_bp_category" rootPath="current_bp_category"/>
</a:init-procedure>
<a:view>
<a:link id="csh_req_ddct_link" url="${/request/@context_path}/modules/csh/CSH504/csh_payment_req_ln_ddct.lview"/>
<a:link id="csh_payment_prepayment_dk" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_prepayment_dk.lview"/>
<a:link id="csh_payment_req_prepayment_dk_detail_link_id" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_prepayment_dk_detail.lview"/>
<a:link id="csh_payment_req_ln_del_link" model="csh.CSH504.csh_payment_req_ln_del" modelaction="batch_update"/>
<a:link id="csh501d_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="csh_payment_req_pay_win_link" url="${/request/@context_path}/modules/csh/CSH502/csh_payment_req_pay.lview"/>
<a:link id="csh501_csh_payment_auto_ddct" model="csh.CSH501.auto_allocation_ddct" modelaction="execute"/>
<a:link id="csh_payment_auto_dt_link" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_auto_dk.lsc"/>
<a:link id="csh501_csh_payment_req_hd_del_link" model="csh.CSH504.csh_payment_req_hd_del" modelaction="update"/>
<a:link id="con_rd_wfl_link" url="${/request/@context_path}/modules/cont/CON501N/con_contract_modify.lview"/>
<a:link id="csh_payment_req_ln_reject_link" model="csh.CSH504.csh_payment_req_ln_reject" modelaction="batch_update"/>
<a:link id="csh_payment_req_ln_atm_reject_link" model="csh.CSH504.csh_payment_req_ln_atm_reject" modelaction="batch_update"/>
<a:link id="csh_payment_post_nc_link" model="csh.CSH501.csh_payment_post_nc" modelaction="update"/>
<a:link id="csh_payment_pay_nc_link" model="csh.CSH501.csh_payment_post_nc" modelaction="execute"/>
<a:link id="csh_payment_bank_link" model="csh.CSH502.csh_pay_send" modelaction="update"/>
<script type="text/javascript"><![CDATA[
if ('${/parameter/@payment_req_id}') {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
}
window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
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, ln_ds, lineRecords, currency_code, currency_name;
if (hdds_id) {
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
}
if (lnds_id && $L.CmpManager.get(lnds_id)) {
ln_ds = $(lnds_id);
lineRecords = ln_ds.getAll();
}
if (hdds_id && ds.id == hdds_id) {
if (name == 'req_date') {
for (var i = 0;i < lineRecords.length;i++) {
lineRecords[i].set('apply_pay_date', value);
}
}/* else if (name == 'bp_id' || name == 'bp_id_n' || name == 'bp_bank_account_id' || name == 'bp_bank_account_id_n' || name == 'bp_bank_account_num' || name == 'bp_bank_account_name' || name == 'bp_name' || name == 'bp_category' || name == 'bp_category_desc') {
for (var j = 0;j < lineRecords.length;j++) {
var lineRecord = lineRecords[j];
if (name == 'bp_id' && first_load_flag == 'N') {
lineRecord.set('bp_bank_account_id', null);
lineRecord.set('bp_bank_account_id_n', null);
lineRecord.set('bp_bank_account_num', null);
lineRecord.set('bp_bank_account_name', null);
}
lineRecord.set(name, record.get(name));
}
first_load_flag = 'N';
} */
if (name == 'compensatory_flag') {
var compensatory_flag = record.get('compensatory_flag');
if (compensatory_flag == 'Y') {
hdrecord.getField('las_compensatory_amount').setReadOnly(false);
} else {
hdrecord.getField('las_compensatory_amount').setReadOnly(true);
hdrecord.set('las_compensatory_amount', null);
}
}
} else if (lnds_id && lnds_id == ds.id) {
if (name == 'amount') {
var amount = 0;
for (var m = 0;m < lineRecords.length;m++) {
var lineRecord = lineRecords[m];
currency_code = lineRecord.get('currency_code');
currency_name = lineRecord.get('currency_name');
if (hdrecord.get('currency_code') != currency_code) {
hdrecord.set('amount', null);
hdrecord.set('currency_code', null);
return;
} else {
current_amount = lineRecord.get('due_amount') || 0;
amount = plus(amount, current_amount);
}
}
hdrecord.set('amount', amount);
hdrecord.set('currency_code', currency_code);
hdrecord.set('currency_name', currency_name);
record.set('act_amount', minus(record.get('amount'), record.get('sum_ddct_amount') || 0));
} else if (name == 'act_amount') {
hdrecord.set('sum_act_amount', plus(minus(hdrecord.get('sum_act_amount') || 0, old_value || 0), value || 0));
}
if (lineRecords.length == 1) {
if (name == 'bp_id' || name == 'bp_id_n' || name == 'bp_name' || name == 'bp_bank_account_id' || name == 'bp_bank_account_id_n' || name == 'bp_category' || name == 'bp_category_desc') {
hdrecord.set(name, record.get(name));
}
}
}
};
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 hd_ds, lineRecords, currency_code;
if (hdds_id) {
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
}
if (record) {
if ('${/parameter/@function_code}' == 'CSH502D') {
record.getField('pay_amount').setReadOnly(false);
}
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
var first_load_flag = 'N';
window['${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function(ds, record, config_records, bp_seq) {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
if (!'${/parameter/@payment_req_id}' && hdds_id) {
var hd_ds = $(hdds_id);
var hd_record = hd_ds.getCurrentRecord();
var amount = hd_record.get('amount') || 0;
var unreceived_amount = record.get('unreceived_amount') || 0;
var sum_act_amount = hd_record.get('sum_act_amount') || 0;
hd_record.set('currency_code', record.get('currency_code'));
hd_record.set('currency_name', record.get('currency_name'));
hd_record.set('amount', plus(amount, record.get('amount')));
hd_record.set('sum_act_amount', plus(sum_act_amount, record.get('act_amount')));
if (Ext.isEmpty(hd_record.get('irr')) && record.get('irr')) {
hd_record.set('irr', record.get('irr'));
}
if (Ext.isEmpty(record.get('act_amount'))) {
record.set('act_amount', minus(record.get('amount'), record.get('sum_ddct_amount') || 0));
}
if (ds.getAll().length == 1) {
first_load_flag = 'Y';
hdrecord.set('bp_id', record.get('bp_id'));
hdrecord.set('bp_id_n', record.get('bp_id_n'));
hdrecord.set('bp_name', record.get('bp_name'));
hdrecord.set('bp_bank_account_id', record.get('bp_bank_account_id'));
hdrecord.set('bp_bank_account_id_n', record.get('bp_bank_account_id_n'));
hdrecord.set('bp_bank_account_name', record.get('bp_bank_account_id_n'));
hdrecord.set('bp_name', record.get('bp_bank_account_id_n'));
hdrecord.set('bp_bank_account_num', record.get('bp_bank_account_num'));
hdrecord.set('bp_category', record.get('bp_category'));
hdrecord.set('bp_category_desc', record.get('bp_category_desc'));
hdrecord.set('bank_full_name', record.get('bank_full_name'));
hdrecord.set('amount', record.get('due_amount'));
hdrecord.set('price', record.get('price'));
hdrecord.set('sum_act_amount', record.get('unreceived_amount'));
}
}
};
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];
if (!record.get('apply_pay_date')) {
record.set('apply_pay_date', Leaf.formatDate(new Date()));
}
$(lnds_id).create(Ext.apply({}, record.data));
}
}
}
function csh_payment_req_submit_finally() {
var win = 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');
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']();
});
win.on('close', function() {
Leaf.SideBar.enable = true;
});
}
//打印
function csh501_print() {
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 records_l = $(lnds_id).getAll();
var hd_record = $(hdds_id).getCurrentRecord();
if (records_l.length > 0) {
// var birt_print_path = '${/parameter/@birt_print_path}';
var birt_print_path = '${/request/@context_path}/reports';
// var url_1 = 'http://199.10.10.65:8180/reportapp/frameset?__report=reports/req/new/' + 'con_payment_req.rptdesign' + '&&__format=PDF';
var url_1 = birt_print_path + '?__report=reports/req/new/' + 'con_payment_req.rptdesign' + '&&__format=PDF';
var url_1_param = '&&batch_id=' + ${/session/@session_id} + '&&payment_req_id=' + hd_record.get('payment_req_id');
window.open(url_1 + url_1_param);
}
}
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 {
Leaf.request({
url: '${/request/@context_path}/autocrud/csh.CSH504.csh_payment_print/execute',
para: {
payment_req_id: hd_record.get('payment_req_id'),
_status: 'execute'
},
success: function(res) {
csh501_print();
},
sync: true,
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
}, Leaf.Masker.unmask(Ext.getBody()));
}
};
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var ln_ds = $(lnds_id);
ln_ds.showEditorByRecord(ln_ds.create());
};
window['${/parameter/@layout_code}_user_button2_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 Array = ln_ds.getSelected();
if (Array.length < 1) {
Leaf.showMessage('${l:PROMPT}', '${l:CHOOSE_ONE_RECORD}');
}
if (Array.length == ln_ds.getAll().length) {
window['${/parameter/@layout_code}_user_button7_layout_dynamic_click']();
} else {
Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS.DELETE_CONFIRM}', function okFun() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
var hdrecord = hd_ds.getCurrentRecord();
for (var i = 0,
length = Array.length;i < length;i++) {
if (Array[i].isNew) {
ln_ds.removeLocal(Array[i]);
hdrecord.set('amount', minus(hdrecord.get('amount') || 0, Array[i].act_amount || 0));
}
}
if (Array.length > 0) {
var param = ln_ds.getJsonData(true);
Leaf.request({
url: $('csh_payment_req_ln_del_link').getUrl(),
para: param,
success: function() {
if (hd_ds.getCurrentRecord().get('payment_req_id')) {
for (var i = 0;i < param.length;i++) {
hdrecord.set('amount', minus(hdrecord.get('amount') || 0, param[i].act_amount || 0));
}
ln_ds.query(ln_ds.currentPage);
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
failure: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
} else {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
});
}
};
window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var ln_ds = $(lnds_id);
var records = ln_ds.getSelected();
if (records.length == 0) {
Leaf.showMessage('${l:PROMPT}', '请先选择要抵扣预付款的行明细!');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return;
}
if (!records[0].get('payment_req_ln_id')) {
Leaf.showMessage('${l:PROMPT}', '请先保存数据!');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return;
}
var param = {};
if ('${/parameter/@function_usage}' == 'QUERY') {
param['function_code'] = 'CSH501_PRE_DK_READONLY';
param['function_usage'] = 'QUERY';
} else {
param['function_code'] = 'CSH501_PRE_DK';
param['function_usage'] = 'UPDATE';
}
param['payment_req_id'] = records[0].get('payment_req_id');
param['winid'] = 'csh501_csh_payment_req_link_winid';
param['url_title'] = '预付款抵扣';
param['screen_width'] = '800';
param['screen_height'] = '500';
hls_doc_get_layout_code('csh501d_get_layout_code_link_id', param, 'csh_payment_prepayment_dk', lnds_id, '${/parameter/@layout_code}');
};
//支付按钮
window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd'),
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(),
line_records = ln_ds.getSelected();
var payment_req_id = hd_record.get('payment_req_id');
if (line_records.length == 0) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
Leaf.showMessage('${l:PROMPT}', '请先选择要支付的行明细!');
return;
}
var current_bp_id;
var bp_bank_account_code;
var bp_bank_account_num;
var bp_bank_account_code_n;
var bp_bank_account_id;
for (var i = 0;i < line_records.length;i++) {
var line_record = line_records[i];
if (!current_bp_id && line_record.get('bp_id')) {
current_bp_id = line_record.get('bp_id');
}
if (current_bp_id && line_record.get('bp_id') && current_bp_id != line_record.get('bp_id')) {
Leaf.showMessage('${l:PROMPT}', '付款对象必须相同!');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return;
}
if (Ext.isEmpty(line_record.get('pay_amount'))) {
Leaf.showMessage('${l:PROMPT}', '本次支付金额为空!');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return;
}
if (line_record.get('payment_status') == 'FULL') {
Leaf.showMessage('${l:PROMPT}', '存在已全部付款的付款行,请核查付款明细!');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return;
}
}
bp_bank_account_code = line_record.get('bp_bank_account_code');
bp_bank_account_num = line_record.get('bp_bank_account_num');
bp_bank_account_code_n = line_record.get('bp_bank_account_code_n');
bp_bank_account_id = line_record.get('bp_bank_account_id');
var win = new Leaf.Window({
id: 'csh_payment_req_pay_win',
url: $('csh_payment_req_pay_win_link').getUrl(),
params: {
payment_req_id: payment_req_id,
winid: 'csh_payment_req_pay_win',
hdds_id: hdds_id,
lnds_id: lnds_id,
bp_bank_account_code: bp_bank_account_code,
bp_bank_account_num: bp_bank_account_num,
bp_bank_account_code_n: bp_bank_account_code_n,
bp_bank_account_id: bp_bank_account_id
},
title: '${l:CSH502.CSH_PAYMENT_REQ_PAY}',
fullScreen: true
});
win.on('close', function() {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
$(hdds_id).query();
});
};
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}');
} 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}');
}
}
if (hdds_id == ds.id) {
if ('${/parameter/@function_usage}' == 'READONLY') {
} else {
var compensatory_flag = record.get('compensatory_flag');
if (compensatory_flag == 'Y') {
record.getField('las_compensatory_amount').setReadOnly(false);
} else {
record.getField('las_compensatory_amount').setReadOnly(true);
}
}
}
};
function csh504_ddct_link(record_id, name) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][record_id + '---' + name];
if (record.dirty) {
Leaf.showMessage('${l:PROMPT}', '请先保存数据!');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return;
}
var payment_req_ln_id = record.get('payment_req_ln_id'),
apply_amount = record.get('amount'),
contract_number = record.get('contract_number'),
ref_doc_id = record.get('ref_doc_id');
var win = new Leaf.Window({
id: 'csh_req_ddct_link_winid',
url: $('csh_req_ddct_link').getUrl(),
params: {
apply_amount: apply_amount,
payment_req_id: '${/parameter/@payment_req_id}',
payment_req_ln_id: payment_req_ln_id,
contract_number: contract_number,
contract_id: ref_doc_id,
winid: 'csh_req_ddct_link_winid',
function_usage: '${/parameter/@function_usage}'
},
title: '坐扣',
width: 1000,
height: 500
});
win.on('close', 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_record = $(hdds_id).getCurrentRecord();
var payment_req_id = hd_record.get('payment_req_id');
if (payment_req_id) {
$(hdds_id).setQueryParameter('payment_req_id', payment_req_id);
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存数据');
return;
}
$(hdds_id).query();
// $(lnds_id).query($(lnds_id).currentPage);
});
}
//保存submitsuccess调用
window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
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');
if (payment_req_id) {
$(hdds_id).setQueryParameter('payment_req_id', payment_req_id);
$(hdds_id).query();
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存数据');
}
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
};
function csh504_prepayment_dk_link(record_id, name) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][record_id + '---' + name];
var payment_req_ln_id = record.get('payment_req_ln_id');
var win = new Leaf.Window({
id: 'csh_payment_req_prepayment_dk_detail_link_winid',
url: $('csh_payment_req_prepayment_dk_detail_link_id').getUrl(),
params: {
bp_id: record.get('bp_id'),
payment_req_ln_id: payment_req_ln_id,
payment_req_id: record.get('payment_req_id'),
winid: 'csh_payment_req_prepayment_dk_detail_link_winid',
function_usage: '${/parameter/@function_usage}'
},
title: '预付款抵扣明细',
width: 650,
height: 500
});
win.on('close', function() {
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
$(lnds_id).query($(lnds_id).currentPage);
});
}
function open_con_contract_readonly_win(record_id, ds_id) {
//创建明细页面根据条件表TBL_LA11字段 function_code、bp_class匹配布局代码layout_code BCML_CONTRACT_NP_MAINTAIN、BCML_CONTRACT_ORG_MAINTAIN
var record = $(ds_id).findById(record_id);
var param = record.data;
param.function_code = 'CON301';
param.function_usage = 'QUERY';
param.url_title = '合同查询';
param.winid = 'con_rd_wfl_link_winid';
//param.layout_debugger_flag = 'Y';
hls_doc_get_layout_code('csh501d_get_layout_code_link_id', param, 'con_rd_wfl_link', ds_id, '${/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 == 'ddct_link') {
link_function = 'csh504_ddct_link';
if (record.get('payment_req_ln_id')) {
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
} else {
return '';
}
} else if (name == 'act_amount') {
var act_amount = record.get('act_amount');
return Leaf.formatMoney(act_amount);
} else if (name == 'prepayment_dk') {
link_function = 'csh504_prepayment_dk_link';
if (record.get('payment_req_ln_id')) {
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
} else {
return '';
}
} else if (name == 'contract_number' && value) {
return '<a href="javascript:open_con_contract_readonly_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
qpara['payment_req_id'] = hd_record.get('payment_req_id');
if (hd_record.get('bp_id_vender_n')) {
qpara['bp_id_vender_n'] = hd_record.get('bp_id_vender_n');
}
};
function on_csh_payment_req_temp_ln_ds_query(ds, qpara) {
qpara['payment_bp_id'] = '${/parameter/@payment_bp_id}';
}
Leaf.onReady(function() {
var bp_category = '${/model/current_bp_category/record/@bp_category}';
if (bp_category == 'AGENT') {
Ext.get("CSH501D_QUERY_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_IRR").setStyle({
display: "none"
});
}
btnInterval = setInterval(function() {
for (var id in $L.CmpManager.cache) {
if ($L.CmpManager.cache[id] instanceof $L.Grid) {
if (id.match(/csh_payment_req_ln_layout_grid_id$/)) {
var grid = $(id);
if ('${/parameter/@function_usage}' != 'QUERY') {
grid.hideColumn('pay_amount');
}
}
}
clearInterval(btnInterval);
btnInterval = null;
}
}, 10);
});
function sumFunction(datas, name) {
var sum = 0;
for (var i = 0;i < datas.length;i++) {
var r = datas[i];
var d = r.get(name);
var n = parseFloat(d);
if (!isNaN(n)) {
sum = plus(sum, n);
}
}
var total = (typeof(sum) == 'undefined' ? '' : parseFloat(sum));
return '<font>' + Leaf.formatMoney(total) + '</font>';
}
window['${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function(ds, record, bp_seq) {
if (record.get('payment_status') != 'FULL' && Ext.isEmpty(record.get('pay_amount'))) {
record.set('pay_amount', record.get('act_amount'));
}
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_unselect'] = function(ds, record, bp_seq) {
record.set('pay_amount', '');
};
window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function() {
Leaf.showConfirm('${l:HLS.PROMPT}', '是否确定提起银行付款', function() {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('csh_payment_bank_link').getUrl(),
para: {
payment_req_id: hd_record.get('payment_req_id')
},
success: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
error: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
failure: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
});
};
]]></script>
<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_ln_bond_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>