Project

General

Profile

Bug #2057 » fnGenMD_20230310.js

Tri Rizqiaty, 03/10/2023 04:19 PM

 
1
if (mdcode == "") {
2
    var md = cmbMasterData.getValue();
3
} else {
4
    var md = mdcode;
5
}
6
var _idTab = program + '_tab_' + md;
7
if (pnlMDbody.findById(_idTab) != null) {
8
    pnlMDbody.findById(_idTab).show();
9
    return;
10
} else {
11

    
12
    var empid = hidEmpId.getValue();
13
    var percode = perCode.getValue();
14
    var accesscode = accessCode.getValue();
15
    var mdcat = mdCat.getValue();
16
    var gen = percode + mdcat + accesscode + md + empid;
17
    //alert(gen);
18
    var spload = "0";
19
    var spval = "0";
20

    
21
    datacmbMasterData.each(function (rec) {
22
        var id = rec.get('code');
23
        if (md == id) {
24
            spload = rec.get('load');
25
            spval = rec.get('val');
26
        }
27
    });
28

    
29
    var stringArray = new Array();
30
    stringArray[gen] = new Ext.data.JsonStore({
31
        fields: ["field_name", "column_name", "class", "gridview", "read_only", "required", "max_size", "min_value", "max_value", "default_value", "controller_store", "width", "anchor", "column_no", "popup_func", "select_func", "change_func", "grid_renderer_func", "select_func_target", "change_func_target", "submit_value"]
32
    });
33
    var stringPrimaryKey = new Array();
34
    stringPrimaryKey[gen] = new Ext.data.JsonStore({
35
        fields: ["field_name", "column_name"]
36
    });
37

    
38
    $.ajax({
39

    
40
        url: "Devt/getStructureMD",
41
        data: {
42
            md_code: md,
43
            per_code: percode
44
        },
45
        async: false,
46
        success: function (result) {
47

    
48
            stringArray[gen].loadData(result.data.column);
49
            stringPrimaryKey[gen].loadData(result.data.PK);
50

    
51
            if (result.success == false) {
52
                alert("Error On Save");
53
            }
54
        }
55

    
56
    });
57

    
58
    var jsGetGrid = new Array();
59
    jsGetGrid[gen] = new Ext.data.JsonStore({
60
        metaData: true,
61
        root: 'rows',
62
        url: 'Devt/getDataMDLimit',
63
        baseParams: {
64
            start: 0,
65
            limit: 25,
66
            cmd: 'save',
67
            emp_id: '00000001',
68
            md_cat: '0001',
69
            per_code: 'emp',
70
            from_period: '',
71
            to_period: ''
72
        }
73
    });
74
    jsGetGrid[gen].on('render', function () {
75
        new Ext.data.JsonReader();
76
    });
77
    jsGetGrid[gen].on('beforeload', function () {
78

    
79
        var o4 = Ext.getCmp("start_period_" + gen)
80
            var o5 = Ext.getCmp("end_period_" + gen)
81
            var val4 = ''
82
            var val5 = ''
83
            if (o4 != undefined)
84
                val4 = o4.getValue();
85
            if (o5 != undefined)
86
                val5 = o5.getValue();
87
            if (val4 != '')
88
                val4 = val4.format('d/m/Y');
89
            if (val5 != '')
90
                val5 = val5.format('d/m/Y');
91

    
92
            jsGetGrid[gen].setBaseParam('cmd', 'save')
93
            jsGetGrid[gen].setBaseParam('emp_id', empid)
94
            jsGetGrid[gen].setBaseParam('md_cat', md)
95
            jsGetGrid[gen].setBaseParam('per_code', percode)
96
            jsGetGrid[gen].setBaseParam('from_period', val4)
97
            jsGetGrid[gen].setBaseParam('to_period', val5)
98

    
99
    });
100

    
101
    var btnhide = false;
102
    if (accesscode == "main") {
103
        btnhide = false;
104
    }
105

    
106
    if (accesscode == "disp") {
107
        btnhide = true;
108
    }
109

    
110
    var btnRefresh = new Array();
111
    btnRefresh[gen] = new Ext.Button({
112
        text: 'Refresh',
113
        hidden: btnhide,
114
        iconCls: 'icon-database_refresh'
115
    });
116
    btnRefresh[gen].on('click', function () {
117
        pnlMDGrid[gen].el.mask("Loading Data...", "x-mask-loading");
118
        refreshgrid();
119
        pnlMDGrid[gen].el.unmask();
120
    });
121

    
122
    var btnAdd = new Array();
123
    btnAdd[gen] = new Ext.Button({
124
        text: 'Add',
125
        hidden: btnhide,
126
        iconCls: 'icon-add'
127
    });
128
    btnAdd[gen].on('click', function () {
129
        addclick();
130
        pnlForm[gen].getForm().reset();
131
        _pnlTemp.layout.setActiveItem(1);
132
        action[gen].setValue("insert");
133
        actionCode.setValue("insert");
134
        copyCode[gen].setValue("no");
135
        initload();
136
    });
137

    
138
    var btnCopy = new Array();
139
    btnCopy[gen] = new Ext.Button({
140
        text: 'Copy',
141
        hidden: btnhide,
142
        iconCls: 'icon-page_copy'
143
    });
144
    btnCopy[gen].on('click', function () {
145
        _pnlTemp.layout.setActiveItem(1);
146
        pnlForm[gen].getForm().reset();
147
        action[gen].setValue("insert");
148
        actionCode.setValue("insert");
149
        copyCode[gen].setValue("yes");
150
        var selected = pnlMDGrid[gen].getSelectionModel().getSelected();
151
        pnlForm[gen].getForm().loadRecord(selected);
152
        md_type[gen].setValue(md_temp);
153
        initload();
154
    });
155

    
156
    var btnDel = new Array();
157
    btnDel[gen] = new Ext.Button({
158
        text: 'Delete',
159
        hidden: btnhide,
160
        iconCls: 'icon-delete'
161
    });
162
    btnDel[gen].on('click', function () {
163
        delclick();
164
    });
165

    
166
    var btnSave = new Array();
167
    btnSave[gen] = new Ext.Button({
168
        text: 'Save',
169
        hidden: btnhide,
170
        iconCls: 'icon-table_save'
171
    });
172
    btnSave[gen].on('click', function () {
173
        saveclick();
174
    });
175

    
176
    var btnCancel = new Array();
177
    btnCancel[gen] = new Ext.Button({
178
        text: 'Cancel',
179
        iconCls: 'icon-arrow_undo'
180
    });
181
    btnCancel[gen].on('click', function () {
182
        refreshgrid();
183
        _pnlTemp.layout.setActiveItem(0);
184
        action[gen].setValue("update");
185
    });
186

    
187
    var btnComplete = new Array();
188
    btnComplete[gen] = new Ext.Button({
189
        text: 'Activity Completed',
190
        iconCls: 'icon-tick'
191
    });
192
    btnComplete[gen].on('click', function () {
193
        completeclick();
194
    });
195

    
196
    var btnFollowUp = new Array();
197
    btnFollowUp[gen] = new Ext.Button({
198
        text: 'Follow-Up Activity',
199
        iconCls: 'icon-page_forward'
200
    });
201
    btnFollowUp[gen].on('click', function () {
202
        followupclick();
203
    });
204

    
205
    var pnlFormleft = new Array();
206
    pnlFormleft[gen] = new Ext.Panel({
207
        bodyStyle: 'padding:5px 5px 0',
208
        border: false,
209
        isForm: true,
210
        layout: 'form',
211
        height: 380,
212
        width: 350
213
    });
214

    
215
    var pnlFormright = new Array();
216
    pnlFormright[gen] = new Ext.Panel({
217
        bodyStyle: 'padding:5px 5px 0',
218
        border: false,
219
        isForm: true,
220
        layout: 'form',
221
        height: 380,
222
        width: 350
223
    });
224

    
225
    var pnlFormTop = new Array();
226
    pnlFormTop[gen] = new Ext.Panel({
227
        bodyStyle: 'padding:5px 5px 0',
228
        labelWidth: 120,
229
        border: false,
230
        isForm: true,
231
        layout: 'hbox',
232
        height: 380,
233
        items: [pnlFormleft[gen], pnlFormright[gen]]
234
    });
235

    
236
    var pnlFormBottom = new Array();
237
    pnlFormBottom[gen] = new Ext.Panel({
238
        layout: 'fit',
239
        border: false,
240
        height: 500,
241
        collapsible: true,
242
        autoScroll: true,
243
        id: "pnlFormBottom" + gen
244
    });
245

    
246
    var pnlForm = new Array(); //-- Modif by Muchlis
247
    pnlForm[gen] = new Ext.form.FormPanel({
248
        border: false,
249
        autoScroll: true,
250
        fileUpload: true,
251
        frame: false,
252
        labelWidth: 120,
253
        layout: 'anchor',
254
        items: [pnlFormTop[gen]]
255
    });
256
    pnlForm[gen].on('beforeaction', function () {
257
        if (!pnlForm[gen].getForm().isValid()) {
258
            //alert("One or more fields are empty, please fill data to continue."); return
259
            Ext.Msg.show({
260
                title: 'Error',
261
                msg: 'One or more fields are empty, please fill data to continue.',
262
                buttons: Ext.Msg.OK,
263
                animEl: 'elId',
264
                icon: Ext.MessageBox.ERROR
265
            });
266
        }
267
    }); // add by irwan 20110502
268

    
269
    var pnlParentForm = new Array();
270
    pnlParentForm[gen] = new Ext.Panel({
271
        frame: false,
272
        autoScroll: true,
273
        layout: 'anchor',
274
        height: 1000,
275
        region: 'north',
276
        bbar: [btnSave[gen], btnDel[gen], btnCancel[gen]],
277
        items: [pnlForm[gen], pnlFormBottom[gen]]
278
    });
279

    
280
    var paging = new Array();
281
    paging[gen] = {
282
        xtype: 'paging',
283
        store: jsGetGrid[gen],
284
        displayInfo: true,
285
        pageSize: 25,
286
        prependButtons: true
287
    };
288

    
289
    if (md == '0027' && accesscode == 'main') {
290
        var pnlMDGrid = new Array();
291
        pnlMDGrid[gen] = new Ext.grid.GridPanel({
292
            store: jsGetGrid[gen],
293
            columns: '[]',
294
            height: 160,
295
            loadMask: 'true',
296
            region: 'center',
297
            split: 'true',
298
            tbar: [btnAdd[gen], btnCopy[gen], {
299
                    xtype: 'tbfill'
300
                }, {
301
                    xtype: 'tbseparator'
302
                }, btnRefresh[gen]],
303
            bbar: [btnComplete[gen], btnFollowUp[gen], paging[gen]]
304
        });
305
        pnlMDGrid[gen].on('rowdblclick', function (thisGrid, rowIndex) {
306
            action[gen].setValue("update");
307
            actionCode.setValue("update");
308
            copyCode[gen].setValue("no");
309
            _pnlTemp.layout.setActiveItem(1);
310
            var selected = pnlMDGrid[gen].getSelectionModel().getSelected();
311
            pnlForm[gen].getForm().loadRecord(selected);
312
            var record = thisGrid.getStore().getAt(rowIndex);
313
            assignPK(record);
314
            md_type[gen].setValue(md_temp);
315
            initload();
316
        });
317
    } else {
318
        var pnlMDGrid = new Array();
319
        pnlMDGrid[gen] = new Ext.grid.GridPanel({
320
            store: jsGetGrid[gen],
321
            columns: '[]',
322
            height: 165,
323
            loadMask: 'true',
324
            region: 'center',
325
            split: 'true',
326
            tbar: [btnAdd[gen], btnCopy[gen], {
327
                    xtype: 'tbfill'
328
                }, {
329
                    xtype: 'tbseparator'
330
                }, btnRefresh[gen]],
331
            bbar: [paging[gen]]
332
        });
333
        pnlMDGrid[gen].on('rowdblclick', function (thisGrid, rowIndex) {
334
            action[gen].setValue("update");
335
            actionCode.setValue("update");
336
            copyCode[gen].setValue("no");
337
            _pnlTemp.layout.setActiveItem(1);
338
            var selected = pnlMDGrid[gen].getSelectionModel().getSelected();
339
            pnlForm[gen].getForm().loadRecord(selected);
340
            var record = thisGrid.getStore().getAt(rowIndex);
341
            assignPK(record);
342
            md_type[gen].setValue(md_temp);
343
            initload();
344
            specialload();
345
        });
346
    }
347

    
348
    var formPanelGrid = Array();
349
    formPanelGrid[gen] = {
350
        xtype: 'panel',
351
        height: 200,
352
        region: 'north',
353
        layout: {
354
            type: 'border'
355
        },
356
        items: [{
357
                xtype: 'panel',
358
                height: 35,
359
                layout: {
360
                    type: 'column'
361
                },
362
                region: 'north',
363
                items: [{
364
                        xtype: 'panel',
365
                        height: 35,
366
                        width: 220,
367
                        layout: {
368
                            type: 'form'
369
                        },
370
                        bodyStyle: 'padding:5px 5px 0',
371
                        border: false,
372
                        flex: 1,
373
                        items: [{
374
                                xtype: 'datefield',
375
                                format: 'd/m/Y',
376
                                fieldLabel: 'Start Period',
377
                                id: 'start_period_' + gen
378
                            }
379
                        ]
380
                    }, {
381
                        xtype: 'panel',
382
                        height: 35,
383
                        width: 220,
384
                        layout: {
385
                            type: 'form'
386
                        },
387
                        bodyStyle: 'padding:5px 5px 0',
388
                        border: false,
389
                        flex: 1,
390
                        items: [{
391
                                xtype: 'datefield',
392
                                format: 'd/m/Y',
393
                                fieldLabel: 'End Period',
394
                                id: 'end_period_' + gen
395
                            }
396
                        ]
397
                    }, {
398
                        xtype: 'panel',
399
                        height: 35,
400
                        bodyStyle: 'padding:5px 5px 0',
401
                        border: false,
402
                        flex: 1,
403
                        items: [{
404
                                xtype: 'button',
405
                                text: 'Search',
406
                                listeners: {
407
                                    click: function () {
408
                                        jsGetGrid[gen].load();
409
                                    }
410
                                }
411
                            }
412
                        ]
413
                    }
414
                ]
415
            },
416
            pnlMDGrid[gen]
417
        ]
418
    }
419

    
420
    if (spload == '0') {
421
        pnlFormBottom[gen].hide();
422
    } else if (spload == '1') {
423
        if (md == '0021') {
424
            eval("fn_spec_" + md + "('load',gen,accesscode,fldReimburseID.getValue());");
425
        } else {
426
            eval("fn_spec_" + md + "('load',gen,accesscode,'','','','');");
427
        }
428
    }
429

    
430
    //fnGenerateForm(md,empid);
431

    
432
    var clearColumnModel = new Ext.grid.ColumnModel([]);
433

    
434
    pnlMDGrid[gen].reconfigure(pnlMDGrid[gen].getStore(), clearColumnModel);
435

    
436
    var cm = pnlMDGrid[gen].getColumnModel();
437
    var curColConfig = cm.config;
438
    var Fields = [];
439
    var i = 0;
440
    var tabIndex = 100;
441

    
442
    var md_id = "id" + percode + mdcat + accesscode + md + empid;
443
    var md_temp = percode + "md" + md;
444
    var md_type = new Array();
445
    md_type[gen] = new Ext.form.Hidden({
446
        name: "md_type",
447
        id: md_id,
448
        value: md_temp
449
    });
450

    
451
    var act_id = "act" + percode + mdcat + accesscode + md + empid;
452
    var action = new Array();
453
    var queryCode = new Array();
454
    var copyCode = new Array();
455
    action[gen] = new Ext.form.Hidden({
456
        name: "action",
457
        id: act_id,
458
        value: "update"
459
    });
460
    queryCode[gen] = new Ext.form.Hidden({
461
        id: "query_wt" + percode + mdcat + accesscode + md + empid,
462
        value: "000"
463
    });
464
    copyCode[gen] = new Ext.form.Hidden({
465
        id: "copy" + percode + mdcat + accesscode + md + empid,
466
        value: ""
467
    });
468
    pnlFormleft[gen].add(queryCode[gen]);
469
    pnlFormleft[gen].add(copyCode[gen]);
470

    
471
    stringArray[gen].each(function (rec) {
472

    
473
        var name = rec.get('field_name');
474
        var header = rec.get('column_name');
475
        var id = name + percode + mdcat + accesscode + md + empid;
476
        var iddate = percode + mdcat + accesscode + md + empid + name;
477
        var columnno = rec.get('column_no');
478
        var gridview = rec.get('gridview');
479
        var hidden = false;
480
        var required = rec.get('required');
481
        var blank_status = true;
482
        var css_class = 'minova-blank'
483
            var _class = rec.get('class');
484
        var max_size = rec.get('max_size');
485
        var min_value = rec.get('min_value');
486
        var max_value = rec.get('max_value');
487
        var default_value = rec.get('default_value');
488
        var controller = rec.get('controller_store');
489
        var popup_func = rec.get('popup_func');
490
        var select_func = rec.get('select_func');
491
        var change_func = rec.get('change_func');
492
        var grid_renderer_func = rec.get('grid_renderer_func');
493
        var select_func_target = rec.get('select_func_target');
494
        var change_func_target = rec.get('change_func_target');
495
        var submit_value = rec.get('submit_value');
496
        var _readonly = rec.get('read_only');
497
        var display = false;
498

    
499
        if (default_value.indexOf("p:") != -1) {
500
            default_value = fnGetParam(default_value, "emp_id:" + empid);
501
        }
502
        if (required.indexOf("p:") != -1) {
503
            required = fnGetParam(required, "emp_id:" + empid);
504
        }
505
        if (_readonly.indexOf("p:") != -1) {
506
            _readonly = fnGetParam(_readonly, "emp_id:" + empid);
507
        }
508

    
509
        if (Ext.util.Format.trim(min_value) == "") {
510
            min_value = 0;
511
        }
512
        if (Ext.util.Format.trim(max_value) == "") {
513
            max_value = 999;
514
        }
515

    
516
        var prefix_id = percode + mdcat + accesscode + md + empid;
517

    
518
        var submitValue = false;
519
        if (submit_value == "1") {
520
            submitValue = true;
521
        }
522

    
523
        if (_readonly == "1") {
524
            display = true;
525
            css_class = 'minova-readonly'
526
        }
527

    
528
        if (accesscode == "disp") {
529
            display = true;
530
            css_class = 'minova-readonly'
531
        }
532

    
533
        if (required == "1") {
534
            blank_status = false;
535
            css_class = 'minova-mandatory'
536
        }
537
        if (gridview == "0")
538
            hidden = true;
539

    
540
        if (_class == "hidden") {
541
            if (name == "emp_id") {
542
                Fields[i] = new Ext.form.Hidden({
543
                    name: name,
544
                    id: id,
545
                    value: empid
546
                });
547
            } else {
548
                var target_id = change_func_target + prefix_id;
549

    
550
                Fields[i] = new Ext.form.Hidden({
551
                    name: name,
552
                    id: id,
553
                    value: default_value,
554
                    submitValue: submitValue,
555
                    listeners: {
556
                        change: function (fld, nval, oval) {
557
                            if (change_func != "" && change_func_target != "") {
558
                                eval(change_func + "('" + id + "','" + target_id + "','" + nval + "');");
559
                            }
560
                        }
561
                    }
562
                });
563
            }
564
        } else if (_class == "datefield") {
565
            Fields[i] = new Ext.form.DateField({
566
                fieldLabel: header,
567
                allowBlank: blank_status,
568
                cls: css_class,
569
                msgTarget: 'side',
570
                readOnly: display,
571
                width: '150',
572
                id: iddate,
573
                format: 'd/m/Y',
574
                tabIndex: tabIndex,
575
                listeners: {
576
                    change: function (fld, nval, oval, toFld) {
577
                        fnDateChg(fld, nval, oval, id);
578
                        if (change_func != "") {
579
                            eval(change_func + "('" + prefix_id + "');");
580
                        }
581
                    },
582
                    select: function (fld, dt, toFld) {
583
                        fnDateSelect(fld, dt, id);
584
                        if (select_func != "") {
585
                            eval(select_func + "('" + prefix_id + "');");
586
                        }
587
                    },
588
                    specialkey: function (field, e) {
589
                        if (e.getKey() == e.ENTER) {
590
                            focusNextField(name, prefix_id);
591
                        }
592
                    }
593
                }
594
            });
595

    
596
            if (columnno == "1") {
597
                pnlFormleft[gen].add(Fields[i]);
598
            } else if (columnno == "2") {
599
                pnlFormright[gen].add(Fields[i]);
600
            }
601
            i++;
602

    
603
            Fields[i] = new Ext.form.Hidden({
604
                name: name,
605
                id: id,
606
                value: default_value,
607
                listeners: {
608
                    change: function (fld, nval, oval, toFld) {
609
                        fnDateHidChg(fld, nval, oval, iddate);
610
                    }
611
                }
612
            });
613
            pnlFormleft[gen].add(Fields[i]);
614
        } else if (_class == "timefield") {
615
            Fields[i] = new Ext.form.TimeField({
616
                //minValue: min_value,
617
                //maxValue: max_value,
618
                fieldLabel: header,
619
                allowBlank: blank_status,
620
                cls: css_class,
621
                msgTarget: 'side',
622
                readOnly: display,
623
                name: name,
624
                format: 'Hi',
625
                id: id,
626
                tabIndex: tabIndex,
627
                listeners: {
628
                    change: function (fld, nval, oval) {
629
                        if (change_func != "") {
630
                            eval(change_func + "('" + prefix_id + "');");
631
                        }
632
                    },
633
                    specialkey: function (field, e) {
634
                        if (e.getKey() == e.ENTER) {
635
                            focusNextField(name, prefix_id);
636
                        }
637
                    }
638
                }
639
            });
640
        } else if (_class == "combobox") {
641
            var target_id = select_func_target + prefix_id;
642

    
643
            var str = new Ext.data.JsonStore({
644
                fields: [
645
                    'code',
646
                    'desc'
647
                ],
648
                url: controller
649
            });
650
            str.load();
651

    
652
            Fields[i] = new Ext.form.ComboBox({
653
                forceSelection: true,
654
                fieldLabel: header,
655
                allowBlank: blank_status,
656
                cls: css_class,
657
                msgTarget: 'side',
658
                readOnly: display,
659
                hiddenName: name,
660
                id: id,
661
                tabIndex: tabIndex,
662
                typeAhead: true,
663
                triggerAction: 'all',
664
                lazyRender: true,
665
                mode: 'local',
666
                store: str,
667
                value: default_value,
668
                valueField: 'code',
669
                displayField: 'desc',
670
                listeners: {
671
                    select: function (cmb, rec) {
672
                        if (select_func != "" && target_id != "") {
673
                            eval(select_func + "('" + id + "','" + target_id + "','" + rec.get('code') + "');");
674
                        }
675
                    },
676
                    specialkey: function (field, e) {
677
                        if (e.getKey() == e.ENTER) {
678
                            focusNextField(name, prefix_id);
679
                        }
680
                    }
681
                }
682
            });
683

    
684
        } else if (_class == "lookupfld") {
685
            //var target_id = change_func_target + prefix_id;
686
            var extendedQuery = change_func_target == ''
687
                 ? undefined : change_func_target;
688

    
689
            if (md == "0004" || md == "0005")
690
                queryCode[gen].setValue(controller);
691

    
692
            var fieldLook = new Ext.form.TextField({
693
                minLength: min_value,
694
                maxLength: max_value,
695
                fieldLabel: header,
696
                allowBlank: blank_status,
697
                cls: css_class,
698
                value: default_value,
699
                msgTarget: 'side',
700
                readOnly: display,
701
                name: name,
702
                width: '150',
703
                id: id,
704
                tabIndex: tabIndex,
705
                listeners: {
706
                    change: function (fld, nval, oval) {
707
                        if (change_func != "") {
708
                            eval(change_func + "('" + fld.id + "','" + fld.getValue() + "','" + extendedQuery + "');");
709
                        }
710
                    },
711
                    specialkey: function (field, e) {
712
                        if (e.getKey() == e.ENTER) {
713
                            if (change_func != "") {
714
                                eval(change_func + "('" + field.id + "','" + field.getValue() + "','" + extendedQuery + "');");
715
                            }
716
                        }
717
                    }
718
                }
719
            })
720

    
721
                Fields[i] = LookUpFieldGen(name, 150, 120, header, 500, 500, controller,
722
                    false, true, extendedQuery, false, id, prefix_id + 'end_date');
723
        } else if (_class == "popup") {
724
            var target_id = change_func_target + prefix_id;
725

    
726
            var txtDesc = new Array();
727
            txtDesc[gen] = new Ext.form.TextField({
728
                fieldLabel: header,
729
                readOnly: true,
730
                width: 158,
731
                cls: 'minova-readonly',
732
                msgTarget: 'side',
733
                name: name,
734
                id: id,
735
                listeners: {
736
                    change: function (fld, nval, oval) {
737
                        if (change_func != "" && change_func_target != "") {
738
                            eval(change_func + "('" + id + "','" + target_id + "','" + nval + "');");
739
                        }
740
                    },
741
                    specialkey: function (field, e) {
742
                        if (e.getKey() == e.ENTER) {
743
                            focusNextField(name, prefix_id);
744
                        }
745
                    }
746
                }
747
            });
748
            var pnlTxt = new Array();
749
            pnlTxt[gen] = new Ext.Panel({
750
                border: false,
751
                isForm: true,
752
                layout: 'form',
753
                items: [txtDesc[gen]]
754
            });
755
            var btnLookUp = new Array();
756
            btnLookUp[gen] = new Ext.Button({
757
                iconCls: 'icon-magnifier',
758
                hidden: display,
759
                listeners: {
760
                    click: function () {
761
                        if (popup_func != "") {
762
                            //alert(popup_func+"('"+id+"','"+prefix_id+"');");
763
                            eval(popup_func + "('" + id + "','" + prefix_id + "');");
764
                        }
765
                    }
766
                }
767
            });
768
            //btnLookUp[gen].on('click', function(){alert("LookUp");});
769
            Fields[i] = new Ext.Panel({
770
                border: false,
771
                layout: 'column',
772
                region: 'north',
773
                items: [pnlTxt[gen], btnLookUp[gen]]
774
            });
775
        } else if (_class == "radio") {
776
            var radioItems = new Array();
777
            var radioData = new Ext.data.JsonStore({
778
                fields: [
779
                    'code',
780
                    'desc'
781
                ],
782
                url: controller
783
            })
784
                radioData.load();
785
            var j = 0;
786
            radioData.each(function (rec) {
787

    
788
                var code = rec.get('code');
789
                var desc = rec.get('desc');
790
                radioItems[j] = new Ext.form.Radio({
791
                    id: name + code + gen,
792
                    boxLabel: desc,
793
                    inputValue: code,
794
                    name: name
795
                });
796
                j++;
797
            });
798

    
799
            Fields[i] = new Ext.form.RadioGroup({
800
                columns: 1,
801
                items: radioItems
802
            });
803
        } else if (_class == "textarea") {
804
            var target_id = change_func_target + prefix_id;
805

    
806
            Fields[i] = new Ext.form.TextArea({
807
                fieldLabel: header,
808
                allowBlank: blank_status,
809
                cls: css_class,
810
                msgTarget: 'side',
811
                readOnly: display,
812
                name: name,
813
                width: '200',
814
                height: '100',
815
                id: id,
816
                value: default_value,
817
                tabIndex: tabIndex,
818
                listeners: {
819
                    change: function (fld, nval, oval) {
820
                        if (change_func != "" && change_func_target != "") {
821
                            eval(change_func + "('" + id + "','" + target_id + "','" + nval + "');");
822
                        }
823
                    },
824
                    specialkey: function (field, e) {
825
                        if (e.getKey() == e.ENTER) {
826
                            focusNextField(name, prefix_id);
827
                        }
828
                    }
829
                }
830

    
831
            });
832
        } else if (_class == "number") {
833
            var target_id = change_func_target + prefix_id;
834

    
835
            Fields[i] = new Ext.form.NumberField({
836
                minLength: min_value,
837
                maxLength: max_value,
838
                fieldLabel: header,
839
                allowBlank: blank_status,
840
                cls: css_class,
841
                msgTarget: 'side',
842
                readOnly: display,
843
                name: name,
844
                width: '150',
845
                id: id,
846
                value: default_value,
847
                tabIndex: tabIndex,
848
                listeners: {
849
                    change: function (fld, nval, oval) {
850
                        if (change_func != "" && change_func_target != "") {
851
                            eval(change_func + "('" + id + "','" + target_id + "','" + nval + "');");
852
                        }
853
                    },
854
                    specialkey: function (field, e) {
855
                        if (e.getKey() == e.ENTER) {
856
                            focusNextField(name, prefix_id);
857
                        }
858
                    }
859
                }
860

    
861
            });
862
        } else if (_class == "fileupload") {
863
            Fields[i] = {
864
                xtype: 'fileuploadfield',
865
                emptyText: 'Select a file',
866
                fieldLabel: header,
867
                name: name,
868
                id: id,
869
                width: '200',
870
                buttonText: 'Browse'
871
            }
872
        } else {
873
            var target_id = change_func_target + prefix_id;
874

    
875
            Fields[i] = new Ext.form.TextField({
876
                minLength: min_value,
877
                maxLength: max_value,
878
                fieldLabel: header,
879
                allowBlank: blank_status,
880
                cls: css_class,
881
                value: default_value,
882
                msgTarget: 'side',
883
                readOnly: display,
884
                name: name,
885
                width: '150',
886
                id: id,
887
                tabIndex: tabIndex,
888
                listeners: {
889
                    change: function (fld, nval, oval) {
890
                        if (change_func != "" && change_func_target != "") {
891
                            eval(change_func + "('" + id + "','" + target_id + "','" + nval + "');");
892
                        }
893
                    },
894
                    specialkey: function (field, e) {
895
                        if (e.getKey() == e.ENTER) {
896
                            focusNextField(name, prefix_id);
897
                        }
898
                    }
899
                }
900

    
901
            });
902

    
903
        }
904

    
905
        if (_class == "datefield") {
906
            curColConfig.push({
907
                sortable: true,
908
                header: header,
909
                width: 100,
910
                dataIndex: name,
911
                hidden: hidden,
912
                renderer: function (val) {
913
                    return fnGrid_Date8(val);
914
                }
915
            });
916
        } else if (_class == "combobox") {
917
            curColConfig.push({
918
                sortable: true,
919
                header: header,
920
                width: 100,
921
                dataIndex: name,
922
                hidden: hidden,
923
                renderer: function (val) {
924
                    var cmbStore = Ext.getCmp(id).getStore();
925
                    if (cmbStore.getCount() == 0) {
926
                        cmbStore.load();
927
                    }
928

    
929
                    var index = cmbStore.find('code', val);
930

    
931
                    if (index != -1) {
932
                        var rec = cmbStore.getAt(index);
933

    
934
                        return rec.get("desc");
935
                    } else {
936
                        return val;
937
                    }
938
                }
939
            });
940
        } else if (_class == "lookupfld") {
941
            curColConfig.push({
942
                sortable: true,
943
                header: header,
944
                width: 100,
945
                dataIndex: name,
946
                hidden: hidden,
947
                renderer: function (val, metaData, record, rowIndex, colIndex, store) {
948
                    var keyDate = (new Date()).format('d/m/Y');
949
                    if ((record.get("end_date") != "") && (record.get("end_date").length == 8)) {
950
                        keyDate = fnGrid_Date8(record.get("end_date"));
951
                    }
952
                    var res = GetDescription(val, controller, keyDate,
953
                            extendedQuery);
954
                    if (res == "")
955
                        res = val;
956
                    return res;
957
                }
958
            });
959
        } else if (name == "last_change") {
960
            curColConfig.push({
961
                sortable: true,
962
                header: header,
963
                width: 100,
964
                dataIndex: name,
965
                hidden: hidden,
966
                renderer: function (val) {
967
                    return fnGrid_Date14(val);
968
                }
969
            });
970
        } else if (grid_renderer_func != "") {
971
            curColConfig.push({
972
                sortable: true,
973
                header: header,
974
                width: 100,
975
                dataIndex: name,
976
                hidden: hidden,
977
                renderer: function (val) {
978
                    var ret = eval(grid_renderer_func + "('" + id + "','" + val + "');");
979
                    return ret;
980
                }
981
            });
982
        } else {
983
            curColConfig.push({
984
                sortable: true,
985
                header: header,
986
                width: 100,
987
                dataIndex: name,
988
                hidden: hidden
989
            });
990
        }
991

    
992
        if (name == "seq" || name == "user_change" || name == "last_change") {
993
            Ext.getCmp(id).setReadOnly(true);
994
        }
995

    
996
        tabIndex++;
997
        if (columnno == "1" && _class != "datefield") {
998
            pnlFormleft[gen].add(Fields[i]);
999
        } else if (columnno == "2" && _class != "datefield") {
1000
            pnlFormright[gen].add(Fields[i]);
1001
        }
1002
        i++;
1003
    });
1004
    pnlFormleft[gen].add(md_type[gen]);
1005

    
1006
    var i = 0;
1007
    stringPrimaryKey[gen].each(function (rec) {
1008
        var data = rec.get('field_name');
1009
        var key = "key_" + data;
1010

    
1011
        Fields[i] = new Ext.form.Hidden({
1012

    
1013
            name: key,
1014
            width: '150',
1015
            id: key + gen
1016

    
1017
        });
1018

    
1019
        pnlFormleft[gen].add(Fields[i]);
1020
        i++;
1021

    
1022
    });
1023

    
1024
    cm.setConfig(curColConfig, true);
1025

    
1026
    pnlMDGrid[gen].reconfigure(pnlMDGrid[gen].getStore(), new Ext.grid.ColumnModel(curColConfig));
1027

    
1028
    pnlFormright[gen].doLayout();
1029
    pnlFormleft[gen].doLayout();
1030
    pnlForm[gen].doLayout();
1031

    
1032
    /*
1033
    $.ajax({
1034

    
1035
    url : "Devt/getDataMD",
1036
    data : {md_cat:md, per_code:percode , emp_id:empid},
1037
    async:false,
1038
    success : function(result){
1039

    
1040

    
1041
    jsGetGrid[gen].loadData(result);
1042

    
1043

    
1044

    
1045
    if(result.success==false){
1046
    alert("Error On Save");
1047
    }
1048

    
1049
    }
1050

    
1051
    })
1052
     */
1053

    
1054
    //finish GenerateForm
1055
    var _title = "";
1056
    if (mdcode == "") {
1057
        _title = cmbMasterData.getRawValue();
1058
    } else {
1059
        datacmbMasterData.each(function (rec) {
1060
            var idmd = rec.get('code');
1061
            if (mdcode == idmd) {
1062
                _title = rec.get('desc');
1063
            }
1064
        });
1065
    }
1066

    
1067
    var _idTemp = program + '_temp_' + md;
1068
    var _idBottom = program + '_bottom_' + md;
1069
    //pnlMDGrid formPanelGrid
1070
    var _pnlTemp = new Ext.Panel({
1071
        closable: true,
1072
        activeItem: 0,
1073
        layout: 'card',
1074
        title: _title,
1075
        id: _idTab,
1076
        items: [formPanelGrid[gen], pnlParentForm[gen]],
1077
        listeners: {
1078
            afterrender: function () {
1079
                jsGetGrid[gen].load();
1080
            }
1081
        }
1082
    });
1083

    
1084
    pnlMDbody.add(_pnlTemp);
1085
    pnlMDbody.doLayout();
1086

    
1087
    console.log(jsGetGrid);
1088
    //jsGetGrid[gen].load();
1089

    
1090
    function focusNextField(name, prefix_id) {}
1091

    
1092
    function addclick() {
1093
        pnlForm[gen].getForm().reset();
1094

    
1095
        if (md == '0032') {
1096
            dataMD0033_Grid.removeAll(false);
1097
            dataMD0034_Grid.removeAll(false);
1098
            dataMD0035_Grid.removeAll(false);
1099
        }
1100
    }
1101

    
1102
    function refreshgrid() {
1103
        /*
1104
        $.ajax({
1105

    
1106
        url : "Devt/getDataMD",
1107
        data : {md_cat:md, per_code:percode , emp_id:empid},
1108
        async:false,
1109
        success : function(result){
1110

    
1111
        jsGetGrid[gen].loadData(result);
1112

    
1113
        if(result.success==false){
1114
        //alert("Error On Get Grid");
1115
        fnShowMsg(result.message,null);
1116
        }
1117

    
1118
        }
1119

    
1120
        });
1121
         */
1122

    
1123
        jsGetGrid[gen].load();
1124
    }
1125

    
1126
    function delclick() {
1127
        Ext.Msg.show({
1128
            title: 'Delete Record Confirmation',
1129
            msg: 'The Record specified will be deleted from the Master Data. \nAre you sure to process the deletion?',
1130
            buttons: Ext.Msg.YESNO,
1131
            fn: function (btn) {
1132
                if (btn == 'yes') {
1133
                    delclickProcess();
1134
                }
1135
            },
1136
            animEl: 'elId',
1137
            icon: Ext.MessageBox.QUESTION
1138
        });
1139
    }
1140

    
1141
    function delclickProcess() {
1142
        pnlForm[gen].el.mask("Deleting...", "x-mask-loading");
1143

    
1144
        pnlForm[gen].getForm().submit({
1145
            clientValidation: true,
1146
            params: {
1147
                force: "0"
1148
            },
1149
            url: "HR_PA_Ext/DeleteLoggingMD",
1150
            success: function (result) {}
1151

    
1152
        });
1153

    
1154
        pnlForm[gen].getForm().submit({
1155
            url: "HR_PA/DeletePersonMasterData",
1156
            success: function (form, action) {
1157
                pnlForm[gen].el.unmask();
1158
                var result = action.result;
1159
                pnlForm[gen].getForm().reset();
1160
                refreshgrid();
1161
                _pnlTemp.layout.setActiveItem(0);
1162
            },
1163
            failure: function (form, action) {
1164
                pnlForm[gen].el.unmask();
1165
                var result = action.result;
1166

    
1167
                if (result.success == false) {
1168
                    fnShowMsg(result.message, null);
1169
                }
1170
            }
1171
        });
1172
    }
1173

    
1174
    function assignPK(record) {
1175
        stringPrimaryKey[gen].each(function (rec) {
1176
            var data = rec.get('field_name');
1177
            var key = "key_" + data + gen;
1178
            var item = record.get(data);
1179

    
1180
            Ext.getCmp(key).setValue(item);
1181

    
1182
        });
1183
    }
1184

    
1185
    function saveclick() {
1186
        if (spval == '1') {
1187
            var _beforeSave = eval("fn_spec_" + md + "('beforeSave');");
1188
            if (_beforeSave) {
1189
                saveclickbtn("0");
1190
            }
1191
        } else {
1192
            saveclickbtn("0");
1193
        }
1194
    }
1195

    
1196
    function saveclickbtn(force) {
1197
        //update by nana 20180326
1198
        var c = true;
1199
        if (md == '0018' && action[gen].getValue() == 'update') {
1200
            var start_date = Ext.getCmp('start_date' + gen).getValue();
1201
            var end_date = Ext.getCmp('end_date' + gen).getValue();
1202
            var start_date_ref = Ext.getCmp('start_date_ref' + gen).getValue();
1203
            var end_date_ref = Ext.getCmp('end_date_ref' + gen).getValue();
1204
            if (start_date != start_date_ref || end_date != end_date_ref) {
1205
                c = false;
1206
                Ext.Msg.show({
1207
                    title: 'Information',
1208
                    msg: "Data Start Date dan End Date Tidak Boleh diubah saat Melakukan Edit Data!",
1209
                    buttons: Ext.Msg.CANCEL,
1210
                    animEl: 'elId',
1211
                    icon: Ext.MessageBox.CANCEL
1212
                });
1213
            }
1214
        }
1215
        if (md == '0017' && action[gen].getValue() == 'update') {
1216
            var start_date = Ext.getCmp('start_date' + gen).getValue();
1217
            var end_date = Ext.getCmp('end_date' + gen).getValue();
1218
            var start_date_ref = Ext.getCmp('start_date_ref' + gen).getValue();
1219
            var end_date_ref = Ext.getCmp('end_date_ref' + gen).getValue();
1220
            if (start_date != start_date_ref || end_date != end_date_ref) {
1221
                c = false;
1222
                Ext.Msg.show({
1223
                    title: 'Information',
1224
                    msg: "Data Start Date dan End Date Tidak Boleh diubah saat Melakukan Edit Data!",
1225
                    buttons: Ext.Msg.CANCEL,
1226
                    animEl: 'elId',
1227
                    icon: Ext.MessageBox.CANCEL
1228
                });
1229
            }
1230
        }
1231
        if (c) {
1232
            var employeeid = "emp_id" + percode + mdcat + accesscode + md + empid;
1233
            pnlForm[gen].el.mask("Processing Data...", "x-mask-loading");
1234
            md_type[gen].setValue(md_temp);
1235
            var log_url = "HR_PA_Ext/EditLoggingMD";
1236
            var url = "/HR_PA/EditMasterData/";
1237
            if (action[gen].getValue() == "insert") {
1238
                url = "/HR_PA/AddMasterData/";
1239
                Ext.getCmp(employeeid).setValue(empid);
1240

    
1241
                log_url = "HR_PA_Ext/AddLoggingMD"
1242
            }
1243
            pnlForm[gen].getForm().submit({
1244
                clientValidation: true,
1245
                params: {
1246
                    force: force
1247
                },
1248
                url: log_url,
1249
                success: function (result) {}
1250

    
1251
            });
1252

    
1253
            pnlForm[gen].getForm().submit({
1254
                clientValidation: true,
1255
                params: {
1256
                    force: force
1257
                },
1258
                url: url,
1259
                success: function (form, action) {
1260
                    pnlForm[gen].el.unmask();
1261
                    refreshgrid();
1262
                    _pnlTemp.layout.setActiveItem(0);
1263
                    if (spval == '1') {
1264
                        eval("fn_spec_" + md + "('afterSave');");
1265
                    }
1266

    
1267
                },
1268
                failure: function (form, action) {
1269
                    //alert("error on : "+ action.failureType);
1270
                    pnlForm[gen].el.unmask();
1271
                    //refreshgrid();
1272
                    //_pnlTemp.layout.setActiveItem(0);
1273
                    var result = action.result;
1274
                    if (result.success == false) {
1275
                        if (result.message.action == "1") {
1276
                            Ext.Msg.show({
1277
                                title: 'Confirmation',
1278
                                msg: result.message.text,
1279
                                buttons: Ext.Msg.YESNO,
1280
                                fn: function (btn) {
1281
                                    if (btn == 'yes') {
1282
                                        saveclickbtn("1");
1283
                                    }
1284
                                },
1285
                                animEl: 'elId',
1286
                                icon: Ext.MessageBox.QUESTION
1287
                            });
1288
                        } else
1289
                            fnShowMsg(result.message, null);
1290
                    }
1291
                }
1292
            });
1293
        }
1294
    }
1295

    
1296
    function completeclick() {
1297
        //GET GRID
1298
        action[gen].setValue("update");
1299
        _pnlTemp.layout.setActiveItem(1);
1300
        var selected = pnlMDGrid[gen].getSelectionModel().getSelected();
1301
        selected.set("applicant_status", "02");
1302
        assignPK(selected);
1303
        pnlForm[gen].getForm().loadRecord(selected);
1304
        md_type[gen].setValue(md_temp);
1305

    
1306
        //SAVE
1307
        var employeeid = "emp_id" + percode + mdcat + accesscode + md + empid;
1308
        pnlForm[gen].el.mask("Loading Data...", "x-mask-loading");
1309
        md_type[gen].setValue(md_temp);
1310
        var url = "/HR_PA/EditMasterData/";
1311

    
1312
        pnlForm[gen].getForm().submit({
1313
            clientValidation: true,
1314
            url: url,
1315
            success: function (form, action) {
1316
                pnlForm[gen].el.unmask();
1317
                refreshgrid();
1318
                _pnlTemp.layout.setActiveItem(0);
1319
                if (spval == '1') {
1320
                    eval("fn_spec_" + md + "('afterSave');");
1321
                }
1322

    
1323
            },
1324
            failure: function (form, action) {
1325
                alert("error on : " + action.failureType);
1326
                pnlForm[gen].el.unmask();
1327
            }
1328
        });
1329

    
1330
    }
1331

    
1332
    function followupclick() {
1333
        //Add by Kindy Confirmation Follow-Up 10/05/2011
1334
        Ext.Msg.show({
1335
            title: 'Follow-Up Confirmation',
1336
            msg: 'The Activity specified will be followed-up even the last activity has NOT been Passed. \nAre you sure want to Follow-up Activity?',
1337
            buttons: Ext.Msg.YESNO,
1338
            fn: function (btn) {
1339
                if (btn == 'yes') {
1340
                    fnfollowup();
1341
                }
1342
            },
1343
            animEl: 'elId',
1344
            icon: Ext.MessageBox.QUESTION
1345
        });
1346
    }
1347
    function fnfollowup() {
1348
        //GET GRID
1349
        action[gen].setValue("insert");
1350
        _pnlTemp.layout.setActiveItem(1);
1351
        var selected = pnlMDGrid[gen].getSelectionModel().getSelected();
1352
        //selected.set("applicant_status","01");
1353
        var _enddate = selected.get("end_date");
1354
        var act_type = selected.get("activity_type");
1355
        //alert (parseInt(act_type)+1);
1356
        //assignPK(selected);
1357
        //pnlForm[gen].getForm().loadRecord(selected);
1358
        pnlForm[gen].getForm().reset();
1359
        Ext.getCmp("start_date" + gen).setValue(_enddate);
1360
        Ext.getCmp("end_date" + gen).setValue(_enddate);
1361
        Ext.getCmp("activity_type" + gen).setValue(parseInt(act_type) + 1);
1362
        Ext.getCmp("applicant_status" + gen).setValue("01");
1363
        md_type[gen].setValue(md_temp);
1364
    }
1365

    
1366
    function initload() {
1367
        console.log('initload');
1368
        if ((md == '0004') || (md == '0005')) {
1369
            try {
1370
                var wtCmp = Ext.getCmp('wage_type' + gen);
1371
                var btnLookupWT = Ext.getCmp('buttonLookup_wage_type' + gen);
1372
                if (action[gen].getValue() == 'update') {
1373
                    wtCmp.setReadOnly(true);
1374
                    fnSetWTFlag(wtCmp.getValue(), gen);
1375
                    fnSetOverwriteWT(wtCmp.getValue(), gen);
1376
                    if (btnLookupWT != undefined) {
1377
                        btnLookupWT.setVisible(false);
1378
                    }
1379
                } else {
1380
                    if (accesscode == 'main') {
1381
                        wtCmp.setReadOnly(false);
1382
                        if (btnLookupWT != undefined) {
1383
                            btnLookupWT.setVisible(true);
1384
                        }
1385
                    }
1386
                }
1387
            } catch (e) {}
1388
        }
1389
        if (md == '0032') {
1390
            try {
1391
                var loanTypeCmp = Ext.getCmp('loan_type' + gen);
1392
                if (action[gen].getValue() == 'update') {
1393
                    loanTypeCmp.setReadOnly(true);
1394
                } else {
1395
                    if (accesscode == 'main')
1396
                        loanTypeCmp.setReadOnly(false);
1397
                }
1398
            } catch (e) {}
1399
        }
1400
        if (md == '0018') {
1401
            try {
1402
                var act = action[gen].getValue();
1403
                if (act == 'update') {
1404
                    var start_date = Ext.getCmp('start_date' + gen);
1405
                    var end_date = Ext.getCmp('end_date' + gen);
1406
                    console.log(start_date);
1407
                    var sd = start_date.getValue();
1408
                    var ed = end_date.getValue();
1409
                    Ext.getCmp('start_date_ref' + gen).setValue(sd);
1410
                    Ext.getCmp('end_date_ref' + gen).setValue(ed);
1411
                }
1412
            } catch (e) {}
1413
        }
1414
        if (md == '0017') {
1415
            try {
1416
                var act = action[gen].getValue();
1417
                if (act == 'update') {
1418
                    var start_date = Ext.getCmp('start_date' + gen);
1419
                    var end_date = Ext.getCmp('end_date' + gen);
1420
                    console.log(start_date);
1421
                    var sd = start_date.getValue();
1422
                    var ed = end_date.getValue();
1423
                    Ext.getCmp('start_date_ref' + gen).setValue(sd);
1424
                    Ext.getCmp('end_date_ref' + gen).setValue(ed);
1425
                }
1426
            } catch (e) {}
1427
        }
1428
		if (md == '0007') { // add by Tri nwh 20230310
1429
            try { 
1430
                var act = action[gen].getValue(); console.log(act);
1431
				if (act == 'insert') {
1432
                    Ext.getCmp('seq' + gen).setValue('');
1433
                }
1434
            } catch (e) {}
1435
        }
1436
    }
1437

    
1438
    function specialload() {
1439
        if (md == '0021') {
1440
            try {
1441
                var idre = Ext.getCmp('reimbursement_id' + gen).getValue();
1442
                fldReimburseID.setValue(idre);
1443
                fn_spec_0021('reload', gen, accesscode, idre);
1444
            } catch (e) {}
1445
        } else if (md == '0032') {
1446
            try {
1447
                var stdate = Ext.getCmp('start_date' + gen).getValue();
1448
                var edate = Ext.getCmp('end_date' + gen).getValue();
1449
                var lntype = Ext.getCmp('loan_type' + gen).getValue();
1450
                var seq = Ext.getCmp('seq' + gen).getValue();
1451
                fn_spec_0032('reload', gen, accesscode, stdate, edate, lntype, seq);
1452

    
1453
                // remove by adi, not load balance in edit mode.
1454
                /*
1455
                // add by irwan
1456
                var empid2 = hidEmpId.getValue();
1457
                $.ajax({
1458
                url : "/HR_PA/GetLoanBalance",
1459
                data : {md_type:"empmd0035", emp_id:empid2, start_date:stdate, end_date:edate, loan_type:lntype, seq:seq},
1460
                async:false,
1461
                success : function(result){
1462
                if (result.success)
1463
            {
1464
                dataMD0035_Grid.loadData(result.data);
1465
                }
1466
                }
1467
                });
1468
                 */
1469
            } catch (e) {}
1470
        } else {}
1471
    }
1472

    
1473
    fnInitForm();
1474
}
(4-4/4)