1
|
Ext.define('MinovaES.controller.wizard.wizard', {
|
2
|
extend: 'Ext.app.ViewController',
|
3
|
alias: 'controller.wizard',
|
4
|
//typeWizard: undefined,
|
5
|
init: function () {
|
6
|
var typeWizard = null;
|
7
|
var selectionValues = null;
|
8
|
var wzFunc = null;
|
9
|
this.control({
|
10
|
|
11
|
//'wizard [name=ApplicantID]': {
|
12
|
// change: this.ApplicantIDChange
|
13
|
//},
|
14
|
'wizard [name=selectionForm]': {
|
15
|
//afterrender: this.afterrenderFunc
|
16
|
afterrender: this.cekMsg
|
17
|
},
|
18
|
'wizard [name=Action]': {
|
19
|
select: this.actionSelect
|
20
|
},
|
21
|
'wizard [name=search]': {
|
22
|
click: this.btnSearch
|
23
|
},
|
24
|
'wizard [name=execute]': {
|
25
|
click: this.execute
|
26
|
},
|
27
|
'wizard [name=processflow]': {
|
28
|
afterrender: this.processflowGrid
|
29
|
},
|
30
|
|
31
|
'runwizards [name=saveWizard]': {
|
32
|
click: this.saveWizard
|
33
|
},
|
34
|
'runwizards [name=prevWizard]': {
|
35
|
click: this.prevWizard
|
36
|
},
|
37
|
|
38
|
'runwizards [name=selectionFormDisplay]': {
|
39
|
afterrender: this.selectionFormDisplay
|
40
|
},
|
41
|
|
42
|
'runwizards [name=skipWizard]': {
|
43
|
click: this.skipMd
|
44
|
},
|
45
|
|
46
|
'runwizards [name=skipAllWizard]': {
|
47
|
click: this.skipAll
|
48
|
},
|
49
|
|
50
|
' [name=mainWizard]': {
|
51
|
afterrender: this.afterrenderMainWizard
|
52
|
},
|
53
|
' [name=ApplicantID]': {
|
54
|
change: this.ChangeApp
|
55
|
},
|
56
|
|
57
|
});
|
58
|
},
|
59
|
afterrenderMainWizard: function () {
|
60
|
setTimeout(function () {
|
61
|
if (getParam('wizard').toLowerCase() != 'a001') {
|
62
|
|
63
|
Ext.ComponentQuery.query('[name=Action]')[0].setRawValue(localStorage.getItem('Action'))
|
64
|
var CompanyID = Ext.ComponentQuery.query('displayfield[name=CompanyID]')[0];
|
65
|
if (CompanyID) {
|
66
|
var s = CompanyID.store;
|
67
|
var dt = s.findRecord(CompanyID.valueField, CompanyID.getValue());
|
68
|
var data_ = undefined;
|
69
|
Ext.Ajax.request({
|
70
|
async: false,
|
71
|
method: 'POST',
|
72
|
url: '/UserControl/GetStore',
|
73
|
params: {
|
74
|
tableName: 'PCMEPCOMPID',
|
75
|
param: 'StartDate[<=]' + MinovaUtil.GetNowDate() + ',EndDate[>=]' + MinovaUtil.GetNowDate() + ',CompanyID[=]' + CompanyID.getValue()
|
76
|
},
|
77
|
success: function (response) {
|
78
|
var results = Ext.decode(response.responseText);
|
79
|
data_ = results.data;
|
80
|
if (data_.length != 0) {
|
81
|
CompanyID.setValue(data_[0].CompanyDescription);
|
82
|
}
|
83
|
}
|
84
|
});
|
85
|
|
86
|
}
|
87
|
var PayrollGroup = Ext.ComponentQuery.query('displayfield[name=PayrollGroup]')[0];
|
88
|
if (PayrollGroup) {
|
89
|
Ext.Ajax.request({
|
90
|
async: false,
|
91
|
method: 'POST',
|
92
|
url: '/UserControl/GetStore',
|
93
|
params: {
|
94
|
tableName: 'PHRPYPGRUP',
|
95
|
param: 'StartDate[<=]' + MinovaUtil.GetNowDate() + ',EndDate[>=]' + MinovaUtil.GetNowDate() + ',PayrollGroup[=]' + PayrollGroup.getValue()
|
96
|
},
|
97
|
success: function (response) {
|
98
|
var results = Ext.decode(response.responseText);
|
99
|
data_ = results.data;
|
100
|
if (data_.length != 0) {
|
101
|
PayrollGroup.setValue(data_[0].PayrollGroupDescription);
|
102
|
}
|
103
|
}
|
104
|
});
|
105
|
}
|
106
|
} else {
|
107
|
Ext.ComponentQuery.query('displayfield[name=EmployeeID]')[0].labelEl.update('Employee ID');
|
108
|
Ext.ComponentQuery.query('displayfield[name=CompanyID]')[0].setHidden(true);
|
109
|
Ext.ComponentQuery.query('displayfield[name=PayrollGroup]')[0].setHidden(true);
|
110
|
}
|
111
|
}, 200);
|
112
|
Ext.ComponentQuery.query('[name=Action]')[0].setValue('');
|
113
|
var app = getParam('app');
|
114
|
if (app === "null") {
|
115
|
app = '';
|
116
|
}
|
117
|
if (app != '') {
|
118
|
Ext.ComponentQuery.query('[name=pnlProgress]')[0].setTitle('Applicant Movement');
|
119
|
}
|
120
|
if (getParam('wizard').toLowerCase().substr(0, 1) == 'a') {
|
121
|
if (Ext.ComponentQuery.query('[title=Employee Movement]')[0]) {
|
122
|
Ext.ComponentQuery.query('[title=Employee Movement]')[0].setTitle('Applicant Movement');
|
123
|
}
|
124
|
|
125
|
}
|
126
|
},
|
127
|
ApplicantIDChange: function () {
|
128
|
var ActF = Ext.ComponentQuery.query('[name=Action]')[0]
|
129
|
var Act = ActF.getValue();
|
130
|
var Return = false;
|
131
|
if (Act != null) {
|
132
|
var btn = Ext.ComponentQuery.query('[name=execute]')[0];
|
133
|
btn.setDisabled(false);
|
134
|
var app = Ext.ComponentQuery.query('[name=ApplicantID]')[0].getValue();
|
135
|
if (app != "") {
|
136
|
Ext.Ajax.request({
|
137
|
async: false,
|
138
|
method: 'POST',
|
139
|
url: '/UserControl/GetStore',
|
140
|
params: {
|
141
|
tableName: 'phrrc0002',
|
142
|
param: 'EmployeeID[equal]' + app + ',StartDate[<=]' + MinovaUtil.GetNowDate() + ',EndDate[>=]' + MinovaUtil.GetNowDate() + ',ApplicantAction[=]8'
|
143
|
},
|
144
|
success: function (response) {
|
145
|
var results = Ext.decode(response.responseText);
|
146
|
data_ = results.data;
|
147
|
if (Act == "A900") { // transfer to Employee
|
148
|
if (data_.length == 0) {
|
149
|
//app.setValue('');
|
150
|
MinovaMessage('', 'WZAPPNOFOUND', '', "E");
|
151
|
btn.setDisabled(true);
|
152
|
} else {
|
153
|
if (data_[0].ApplicantStatus != '05' && Act == "A900") {
|
154
|
MinovaMessage('', 'RCVALTEMP', '', "E");
|
155
|
btn.setDisabled(true);
|
156
|
}
|
157
|
}
|
158
|
} else {
|
159
|
Return = true;
|
160
|
}
|
161
|
|
162
|
}
|
163
|
});
|
164
|
}
|
165
|
}
|
166
|
return Return
|
167
|
},
|
168
|
execute: function () {
|
169
|
var me = this;
|
170
|
|
171
|
var Return = undefined;
|
172
|
var s = Ext.ComponentQuery.query('[name=Action]')[0].getStore();
|
173
|
var ActF = Ext.ComponentQuery.query('[name=Action]')[0]
|
174
|
var Act = ActF.getValue();
|
175
|
var wizFunc = '';
|
176
|
if (Act == '') {
|
177
|
wizFunc = s.findRecord('WizardDescription', Ext.ComponentQuery.query('[name=Action]')[0].rawValue).data.WizardFunction;
|
178
|
} else {
|
179
|
wizFunc = s.findRecord('Wizard', Act).data.WizardFunction;
|
180
|
}
|
181
|
|
182
|
if (wizFunc != 'APPI' && wizFunc != 'EMPI' && wizFunc != 'APPT' && wizFunc != 'EMP') {
|
183
|
if (Ext.ComponentQuery.query('[name=ApplicantID]')[0]) {
|
184
|
Return = me.ApplicantIDChange()
|
185
|
} else {
|
186
|
Return = me.empChange();
|
187
|
}
|
188
|
|
189
|
} else {
|
190
|
Return = true;
|
191
|
}
|
192
|
|
193
|
if (Return) {
|
194
|
me.btnexecute();
|
195
|
}
|
196
|
},
|
197
|
empChange: function () {
|
198
|
var ActF = Ext.ComponentQuery.query('[name=Action]')[0]
|
199
|
var Act = ActF.getValue();
|
200
|
var Return = false;
|
201
|
if (Act != null) {
|
202
|
var emp = Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue();
|
203
|
var btn = Ext.ComponentQuery.query('[name=execute]')[0];
|
204
|
btn.setDisabled(false);
|
205
|
if (emp != "") {
|
206
|
Ext.Ajax.request({
|
207
|
async: false,
|
208
|
method: 'POST',
|
209
|
url: '/UserControl/GetStore',
|
210
|
params: {
|
211
|
tableName: 'phrpa0002',
|
212
|
param: 'EmployeeID[equal]' + emp + ',StartDate[<=]' + MinovaUtil.GetNowDate() + ',EndDate[>=]' + MinovaUtil.GetNowDate() + ',EmployeeStatus[=]01'
|
213
|
|
214
|
},
|
215
|
success: function (response) {
|
216
|
var results = Ext.decode(response.responseText);
|
217
|
data_ = results.data;
|
218
|
if (data_.length > 0) {
|
219
|
Ext.ComponentQuery.query('[name=CompanyID]')[0].setValue(data_[0].CompanyID);
|
220
|
Ext.ComponentQuery.query('[name=PayrollGroup]')[0].setValue(data_[0].PayrollGroup);
|
221
|
Return = true;
|
222
|
} else {
|
223
|
if (Act != "E001") { // not hiring
|
224
|
//btn.setDisabled(true);
|
225
|
MinovaMessage('', 'WZEMPNOFOUND', '', "E");
|
226
|
}
|
227
|
}
|
228
|
|
229
|
}
|
230
|
});
|
231
|
}
|
232
|
}
|
233
|
return Return;
|
234
|
},
|
235
|
afterrenderFunc: function () {
|
236
|
var menuDt = undefined;
|
237
|
Ext.Ajax.request({
|
238
|
async: false,
|
239
|
method: 'POST',
|
240
|
url: '/UserControl/GetStore',
|
241
|
params: {
|
242
|
tableName: 'smenu',
|
243
|
param: 'MenuId[equal]' + MinovaUtil.GetMenuID()
|
244
|
|
245
|
},
|
246
|
success: function (response) {
|
247
|
var results = Ext.decode(response.responseText);
|
248
|
data_ = results.data[0];
|
249
|
if (data_ != undefined) {
|
250
|
menuDt = data_;
|
251
|
}
|
252
|
}
|
253
|
});
|
254
|
formSelection = Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm();
|
255
|
|
256
|
if (menuDt) {
|
257
|
typeWizard = menuDt.Variant;
|
258
|
|
259
|
if (typeWizard == '100') { // for empolyee md
|
260
|
formSelection.findField("ApplicantID").setVisible(false);
|
261
|
|
262
|
} else {
|
263
|
formSelection.findField("PayrollGroup").setVisible(false);
|
264
|
formSelection.findField("EmployeeID").setVisible(false);
|
265
|
|
266
|
}
|
267
|
} else {
|
268
|
formSelection.findField("ApplicantID").setVisible(false);
|
269
|
}
|
270
|
|
271
|
},
|
272
|
actionSelect: function (c) {
|
273
|
formSelection = Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm();
|
274
|
formValues_ = formSelection.getValues();
|
275
|
var storeFlow = Ext.ComponentQuery.query('[name=processflow]')[0];
|
276
|
storeFlow.mask('Loading...');
|
277
|
var result_ = undefined;
|
278
|
if (MinovaUtil.GetMenuID() != 'RC01') {
|
279
|
Ext.Ajax.request({
|
280
|
async: false,
|
281
|
method: 'POST',
|
282
|
url: '/UserControl/GetStore',
|
283
|
params: {
|
284
|
tableName: 'PDSPA0005',
|
285
|
param: 'Wizard[equal]' + formValues_.Action
|
286
|
|
287
|
},
|
288
|
success: function (response) {
|
289
|
var results = Ext.decode(response.responseText);
|
290
|
data_ = results.data;
|
291
|
if (data_ != undefined) {
|
292
|
//result_ = data_;
|
293
|
//sorting results
|
294
|
// result_ = data_.sort(MinovaUtil.SortBy("Sequence"))
|
295
|
result_ = data_;
|
296
|
}
|
297
|
}
|
298
|
});
|
299
|
|
300
|
} else {
|
301
|
Ext.Ajax.request({
|
302
|
async: false,
|
303
|
method: 'POST',
|
304
|
url: '/UserControl/GetStore',
|
305
|
params: {
|
306
|
tableName: 'PDSPA0005',
|
307
|
param: 'WizardDescription[equal]' + Ext.ComponentQuery.query('[name=Action]')[0].rawValue
|
308
|
|
309
|
},
|
310
|
success: function (response) {
|
311
|
var results = Ext.decode(response.responseText);
|
312
|
data_ = results.data;
|
313
|
if (data_ != undefined) {
|
314
|
//result_ = data_;
|
315
|
//sorting results
|
316
|
// result_ = data_.sort(MinovaUtil.SortBy("Sequence"))
|
317
|
result_ = data_;
|
318
|
}
|
319
|
}
|
320
|
});
|
321
|
|
322
|
}
|
323
|
|
324
|
storeFlow.getStore().loadData(result_);
|
325
|
storeFlow.unmask();
|
326
|
|
327
|
var cbStore = c.getStore();
|
328
|
var cbValue = c.getValue();
|
329
|
//find data
|
330
|
var data_ = cbStore.findRecord(c.valueField, cbValue);
|
331
|
//var WizardFunction = data_.data.WizardFunction;
|
332
|
var WizardFunction = result_[0].WizardFunction;
|
333
|
formSelection = Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm();
|
334
|
if (WizardFunction == 'APP') { // exsist aplicant
|
335
|
formSelection.findField("ApplicantID").allowBlank = false;
|
336
|
formSelection.findField("ApplicantID").setReadOnly(false);
|
337
|
//formSelection.findField("Reason").setHidden(true);
|
338
|
formSelection.findField("CompanyID").setHidden(true);
|
339
|
formSelection.findField("PayrollGroup").setHidden(true);
|
340
|
//formSelection.findField("Reason").allowBlank = true;
|
341
|
formSelection.findField("CompanyID").allowBlank = true;
|
342
|
formSelection.findField("PayrollGroup").allowBlank = true;
|
343
|
formSelection.findField("PayrollGroup").setHidden(true);
|
344
|
} else if (WizardFunction == 'APPI') { // new aplicant
|
345
|
formSelection.findField("ApplicantID").allowBlank = true;
|
346
|
formSelection.findField("ApplicantID").setReadOnly(true);
|
347
|
//formSelection.findField("Reason").setHidden(true)
|
348
|
formSelection.findField("CompanyID").setHidden(true);
|
349
|
formSelection.findField("PayrollGroup").setHidden(true);
|
350
|
//formSelection.findField("Reason").allowBlank = true;
|
351
|
formSelection.findField("CompanyID").allowBlank = true;
|
352
|
formSelection.findField("PayrollGroup").allowBlank = true;
|
353
|
formSelection.findField("PayrollGroup").setHidden(true);
|
354
|
//formSelection.findField("EmployeeID").setHidden(true)
|
355
|
|
356
|
} else if (WizardFunction == 'APPT') { // app to emp
|
357
|
formSelection.findField("ApplicantID").allowBlank = false;
|
358
|
formSelection.findField("ApplicantID").setValue('');
|
359
|
formSelection.findField("ApplicantID").setReadOnly(false);
|
360
|
//formSelection.findField("MovementType").setHidden(true)
|
361
|
formSelection.findField("CompanyID").setHidden(false);
|
362
|
formSelection.findField("PayrollGroup").setHidden(false);
|
363
|
|
364
|
} else if (WizardFunction == 'EMP') { // for exsist employee
|
365
|
formSelection.findField("EmployeeID").allowBlank = false;
|
366
|
formSelection.findField("EmployeeID").setReadOnly(false);
|
367
|
formSelection.findField("CompanyID").setHidden(true);
|
368
|
formSelection.findField("PayrollGroup").setHidden(true);
|
369
|
formSelection.findField("CompanyID").allowBlank = true;
|
370
|
formSelection.findField("PayrollGroup").allowBlank = true;
|
371
|
} else if (WizardFunction == 'EMPI') { // new employee
|
372
|
formSelection.findField("EmployeeID").setValue("");
|
373
|
formSelection.findField("EmployeeID").allowBlank = true;
|
374
|
formSelection.findField("EmployeeID").setReadOnly(true);
|
375
|
|
376
|
formSelection.findField("CompanyID").setHidden(false);
|
377
|
formSelection.findField("PayrollGroup").setHidden(false);
|
378
|
}
|
379
|
this.loadMoveReason();
|
380
|
//this.cekMsg();
|
381
|
},
|
382
|
loadMoveReason: function () {
|
383
|
var ActF = Ext.ComponentQuery.query('[name=Action]')[0]
|
384
|
var Act = ActF.getValue();
|
385
|
localStorage.setItem("Action", ActF.getRawValue());
|
386
|
|
387
|
if (Act != '') {
|
388
|
var s = Ext.ComponentQuery.query('[name=Action]')[0].getStore();
|
389
|
var actVal = s.findRecord('Wizard', Act).data.MovementType;
|
390
|
var Res = Ext.ComponentQuery.query('[name=Reason]')[0];
|
391
|
if (Res) {
|
392
|
var ResStore = Res.getStore();
|
393
|
ResStore.removeAll();
|
394
|
|
395
|
Ext.Ajax.request({
|
396
|
async: false,
|
397
|
method: 'POST',
|
398
|
url: '/UserControl/GetStore',
|
399
|
params: {
|
400
|
tableName: 'PCMEPMOVR',
|
401
|
param: 'MovementType[equal]' + actVal
|
402
|
|
403
|
},
|
404
|
success: function (response) {
|
405
|
var results = Ext.decode(response.responseText);
|
406
|
data_ = results.data;
|
407
|
if (data_ != undefined) {
|
408
|
ResStore.loadData(data_)
|
409
|
}
|
410
|
}
|
411
|
});
|
412
|
}
|
413
|
|
414
|
}
|
415
|
|
416
|
},
|
417
|
btnexecute: function () {
|
418
|
// get wizard func
|
419
|
var payrollStatus = true;
|
420
|
var ActF = Ext.ComponentQuery.query('[name=Action]')[0]
|
421
|
var Act = ActF.getValue();
|
422
|
var s = Ext.ComponentQuery.query('[name=Action]')[0].getStore();
|
423
|
//var wizFunc = s.findRecord('Wizard', Act).data.WizardFunction;
|
424
|
var wizFunc = '';
|
425
|
if (Act == '') {
|
426
|
wizFunc = s.findRecord('WizardDescription', Ext.ComponentQuery.query('[name=Action]')[0].rawValue).data.WizardFunction;
|
427
|
} else {
|
428
|
wizFunc = s.findRecord('Wizard', Act).data.WizardFunction;
|
429
|
}
|
430
|
//if (wizFunc == 'EMPI' || wizFunc == 'APPT') {
|
431
|
//if (wizFunc != 'EMPI' && wizFunc != 'APPT') {
|
432
|
//if (wizFunc == 'EMPI' || wizFunc == 'APPI') {
|
433
|
payrollStatus = this.cekPayrollStatus();
|
434
|
//if (payrollStatus == false && wizFunc != 'EMPI' && wizFunc != 'APPT' && wizFunc != 'APPI') {
|
435
|
//if (Ext.ComponentQuery.query('[name=PayrollGroup]')[0].getValue() == null) {
|
436
|
// MinovaMessage('', '000009', '', "E");
|
437
|
//} else {
|
438
|
// MinovaMessage('', 'PYVAL1', '', "E");
|
439
|
//}
|
440
|
//MinovaMessage('', 'PYVAL1', '', "E");
|
441
|
//}
|
442
|
if (payrollStatus == false) {
|
443
|
MinovaMessage('', 'PYVAL1', '', "E");
|
444
|
}
|
445
|
// }
|
446
|
|
447
|
|
448
|
var wzFunc = undefined;
|
449
|
selectionValues = Ext.ComponentQuery.query('[name=selectionForm]')[0].getValues();
|
450
|
if (Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm().isValid()) {
|
451
|
if (payrollStatus == true) {
|
452
|
|
453
|
Ext.Ajax.request({
|
454
|
async: false,
|
455
|
method: 'POST',
|
456
|
url: '/UserControl/GetStore',
|
457
|
params: {
|
458
|
tableName: 'PHRPAWIZMAIN',
|
459
|
param: 'Wizard[equal]' + selectionValues.Action
|
460
|
|
461
|
},
|
462
|
success: function (response) {
|
463
|
var results = Ext.decode(response.responseText);
|
464
|
data_ = results.data[0];
|
465
|
if (data_ != undefined) {
|
466
|
localStorage.setItem('wzFunc', JSON.stringify(results.data));
|
467
|
wzFunc = data_.WizardFunction;
|
468
|
}
|
469
|
}
|
470
|
});
|
471
|
|
472
|
oldID = null;
|
473
|
app_ = null;
|
474
|
|
475
|
var EffectiveYear = selectionValues.EffectiveDate.substr(2, 2);
|
476
|
var EffectiveMonth = selectionValues.EffectiveDate.substr(4, 2);
|
477
|
var EffectiveMonthYear = EffectiveMonth + EffectiveYear;
|
478
|
|
479
|
var nextSeq = '';
|
480
|
var act = '1';
|
481
|
var data_ = undefined;
|
482
|
|
483
|
if (wzFunc == 'APPT') {
|
484
|
/*Ext.Ajax.request({
|
485
|
async: false,
|
486
|
method: 'POST',
|
487
|
url: '/UserControl/GetLastID?class_=E',
|
488
|
|
489
|
success: function (response) {
|
490
|
oldID = response.responseText;
|
491
|
|
492
|
}
|
493
|
});*/
|
494
|
|
495
|
Ext.Ajax.request({
|
496
|
async: false,
|
497
|
method: 'POST',
|
498
|
url: '/UserControl/GetStore',
|
499
|
params: {
|
500
|
tableName: 'SEQEMPID2',
|
501
|
param: 'BulanTahun[=]' + EffectiveMonthYear
|
502
|
},
|
503
|
success: function (response) {
|
504
|
var results = Ext.decode(response.responseText);
|
505
|
data_ = results.data;
|
506
|
if (data_.length == 0) {
|
507
|
act = '0';
|
508
|
nextSeq = '0001';
|
509
|
data_ = [{
|
510
|
BulanTahun: EffectiveMonthYear,
|
511
|
Sequance: nextSeq
|
512
|
}
|
513
|
];
|
514
|
} else {
|
515
|
if (isNaN(parseInt(data_[0].Sequance)) == false) {
|
516
|
var s = "0000" + (parseInt(data_[0].Sequance) + 1);
|
517
|
nextSeq = s.substr(s.length - 4);
|
518
|
} else {
|
519
|
nextSeq = '0001';
|
520
|
}
|
521
|
data_[0].Sequance = nextSeq;
|
522
|
}
|
523
|
}
|
524
|
});
|
525
|
|
526
|
oldID = EffectiveMonthYear + nextSeq;
|
527
|
app_ = selectionValues.ApplicantID;
|
528
|
|
529
|
Ext.Ajax.request({
|
530
|
method: 'POST',
|
531
|
async: false,
|
532
|
url: '/Devt/SaveTable',
|
533
|
params: {
|
534
|
tableName: 'SEQEMPID2',
|
535
|
data: Ext.encode(data_[0]),
|
536
|
action: act
|
537
|
},
|
538
|
waitMsg: 'Saving Data...',
|
539
|
success: function (response) {
|
540
|
var result = Ext.decode(response.responseText);
|
541
|
console.log(result);
|
542
|
if (result.success) {
|
543
|
console.log('success');
|
544
|
} else {
|
545
|
console.log('not success');
|
546
|
}
|
547
|
},
|
548
|
failure: function (response) {
|
549
|
var result = Ext.decode(response.responseText);
|
550
|
console.log(result);
|
551
|
}
|
552
|
});
|
553
|
|
554
|
} else if (wzFunc == 'EMPI') {
|
555
|
/*Ext.Ajax.request({
|
556
|
async: false,
|
557
|
method: 'POST',
|
558
|
url: '/UserControl/GetLastID?class_=E',
|
559
|
|
560
|
success: function (response) {
|
561
|
oldID = response.responseText;
|
562
|
|
563
|
}
|
564
|
});*/
|
565
|
|
566
|
Ext.Ajax.request({
|
567
|
async: false,
|
568
|
method: 'POST',
|
569
|
url: '/UserControl/GetStore',
|
570
|
params: {
|
571
|
tableName: 'SEQEMPID2',
|
572
|
param: 'BulanTahun[=]' + EffectiveMonthYear
|
573
|
},
|
574
|
success: function (response) {
|
575
|
var results = Ext.decode(response.responseText);
|
576
|
data_ = results.data;
|
577
|
if (data_.length == 0) {
|
578
|
act = '0';
|
579
|
nextSeq = '0001';
|
580
|
data_ = [{
|
581
|
BulanTahun: EffectiveMonthYear,
|
582
|
Sequance: nextSeq
|
583
|
}
|
584
|
];
|
585
|
} else {
|
586
|
if (isNaN(parseInt(data_[0].Sequance)) == false) {
|
587
|
var s = "0000" + (parseInt(data_[0].Sequance) + 1);
|
588
|
nextSeq = s.substr(s.length - 4);
|
589
|
} else {
|
590
|
nextSeq = '0001';
|
591
|
}
|
592
|
data_[0].Sequance = nextSeq;
|
593
|
}
|
594
|
}
|
595
|
});
|
596
|
|
597
|
oldID = EffectiveMonthYear + nextSeq;
|
598
|
Ext.ComponentQuery.query('[name=EmployeeID]')[0].setValue(oldID);
|
599
|
|
600
|
Ext.Ajax.request({
|
601
|
method: 'POST',
|
602
|
async: false,
|
603
|
url: '/Devt/SaveTable',
|
604
|
params: {
|
605
|
tableName: 'SEQEMPID2',
|
606
|
data: Ext.encode(data_[0]),
|
607
|
action: act
|
608
|
},
|
609
|
waitMsg: 'Saving Data...',
|
610
|
success: function (response) {
|
611
|
var result = Ext.decode(response.responseText);
|
612
|
console.log(result);
|
613
|
if (result.success) {
|
614
|
console.log('success');
|
615
|
} else {
|
616
|
console.log('not success');
|
617
|
}
|
618
|
},
|
619
|
failure: function (response) {
|
620
|
var result = Ext.decode(response.responseText);
|
621
|
console.log(result);
|
622
|
}
|
623
|
});
|
624
|
|
625
|
} else if (wzFunc == 'APPI') {
|
626
|
Ext.Ajax.request({
|
627
|
async: false,
|
628
|
method: 'POST',
|
629
|
url: '/UserControl/GetLastID?class_=A',
|
630
|
|
631
|
success: function (response) {
|
632
|
oldID = response.responseText;
|
633
|
|
634
|
}
|
635
|
});
|
636
|
Ext.ComponentQuery.query('[name=ApplicantID]')[0].setValue(oldID)
|
637
|
} else {
|
638
|
if (selectionValues.ApplicantID) {
|
639
|
oldID = selectionValues.ApplicantID;
|
640
|
} else if (selectionValues.EmployeeID) {
|
641
|
oldID = selectionValues.EmployeeID
|
642
|
}
|
643
|
}
|
644
|
|
645
|
selectionValues = Ext.ComponentQuery.query('[name=selectionForm]')[0].getValues();
|
646
|
var wiz = selectionValues.Action;
|
647
|
if (wiz == '') {
|
648
|
wiz = s.findRecord('WizardDescription', Ext.ComponentQuery.query('[name=Action]')[0].rawValue).data.Wizard;
|
649
|
}
|
650
|
localStorage.setItem('selectionValues', JSON.stringify(selectionValues));
|
651
|
var nextUrl = MinovaUtil.GetMenuID() + '&wizard=' + wiz + '&id=' + oldID + '&app=' + app_;
|
652
|
var mb = new minovaBlowfish();
|
653
|
e = mb.minovaEncryptUrl(nextUrl);
|
654
|
//if (wizFunc == 'APPI' || wizFunc == 'APPT')
|
655
|
{
|
656
|
var EmployeeID = oldID;
|
657
|
}
|
658
|
window.open('runwizards?' + e, "_self");
|
659
|
}
|
660
|
}
|
661
|
|
662
|
},
|
663
|
cekMsg: function () {
|
664
|
formSelection = Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm();
|
665
|
formValues_ = formSelection.getValues();
|
666
|
if (Ext.ComponentQuery.query('[name=Reason]')[0]) {
|
667
|
Ext.ComponentQuery.query('[name=Reason]')[0].setHidden(true);
|
668
|
formSelection.findField("PayrollGroup").setHidden(true);
|
669
|
|
670
|
}
|
671
|
var flag = getParam('S');
|
672
|
if (flag == 'S') {
|
673
|
MinovaMessage('', '000006', '', 'S');
|
674
|
}
|
675
|
},
|
676
|
changeProgress: function (idx, idNext, skip) {
|
677
|
//$("#stepStatus" + idx).removeClass("active");
|
678
|
//$("#stepStatus" + idNext).addClass("active");
|
679
|
if (skip) {
|
680
|
//$("#checkStatus" + idx).addClass("fa fa-check");
|
681
|
} else {
|
682
|
$("#checkStatus" + idx).addClass("fa fa-check");
|
683
|
}
|
684
|
|
685
|
},
|
686
|
cekPayrollStatus: function () {
|
687
|
|
688
|
formSelection = Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm();
|
689
|
if (formSelection.isValid()) {
|
690
|
// cek payroll status by input payroll group
|
691
|
formValues_ = formSelection.getValues();
|
692
|
var result = undefined;
|
693
|
if (formValues_.PayrollGroup != "") {
|
694
|
Ext.Ajax.request({
|
695
|
async: false,
|
696
|
method: 'POST',
|
697
|
url: '/UserControl/GetStore',
|
698
|
params: {
|
699
|
tableName: 'PHRPYPGCTRL',
|
700
|
param: 'PayrollGroup[equal]' + formValues_.PayrollGroup
|
701
|
|
702
|
},
|
703
|
success: function (response) {
|
704
|
var results = Ext.decode(response.responseText);
|
705
|
data_ = results.data[0];
|
706
|
if (data_ != undefined) {
|
707
|
result = data_;
|
708
|
}
|
709
|
}
|
710
|
});
|
711
|
}
|
712
|
var cek = true;
|
713
|
if (result) {
|
714
|
if (result.PayrollControlStatus == "V") {
|
715
|
// massage corection
|
716
|
cek = false;
|
717
|
} else if (result.PayrollControlStatus == "S") {
|
718
|
// massage corection
|
719
|
cek = false;
|
720
|
}
|
721
|
|
722
|
}
|
723
|
if (cek) {
|
724
|
//var storeFlow = Ext.ComponentQuery.query('[name=processflow]')[0];
|
725
|
//storeFlow.mask('Loading...');
|
726
|
//var result_ = undefined;
|
727
|
//Ext.Ajax.request({
|
728
|
// async: false,
|
729
|
// method: 'POST',
|
730
|
// url: '/UserControl/GetStore',
|
731
|
// params: {
|
732
|
// tableName: 'PDSPA0005',
|
733
|
// param: 'Wizard[equal]' + formValues_.Action
|
734
|
|
735
|
// },
|
736
|
// success: function (response) {
|
737
|
// var results = Ext.decode(response.responseText);
|
738
|
// data_ = results.data;
|
739
|
// if (data_ != undefined) {
|
740
|
// //result_ = data_;
|
741
|
// //sorting results
|
742
|
// result_ = data_.sort(MinovaUtil.SortBy("Sequence"))
|
743
|
// }
|
744
|
// }
|
745
|
//});
|
746
|
|
747
|
//storeFlow.getStore().loadData(result_);
|
748
|
//storeFlow.unmask();
|
749
|
}
|
750
|
}
|
751
|
//else {
|
752
|
// //masih ada field mandtory yang kosong
|
753
|
//}
|
754
|
return cek;
|
755
|
},
|
756
|
processflowGrid: function (g) {
|
757
|
setTimeout(function () {
|
758
|
var g_ = Ext.ComponentQuery.query('[name=processflow]')[0];
|
759
|
g_.getStore().removeAll();
|
760
|
}, 200);
|
761
|
|
762
|
},
|
763
|
// fungsi ke form sebelumnya
|
764
|
prevWizard: function () {
|
765
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
766
|
var next_ = prog_.getNextMD() - 1;
|
767
|
var last_ = prog_.getNextMD() - 2;
|
768
|
if (last_ == 0) {
|
769
|
last_ = 1;
|
770
|
}
|
771
|
var currPage = Ext.ComponentQuery.query('[itemId=MD' + next_ + ']')[0];
|
772
|
var _last = Ext.ComponentQuery.query('[itemId=MD' + last_ + ']')[0];
|
773
|
currPage.setHidden(true);
|
774
|
_last.setHidden(false);
|
775
|
|
776
|
// set ulang next and prev page
|
777
|
prog_.setNextMD(next_);
|
778
|
prog_.setPrevMD(last_);
|
779
|
this.setButton(_last);
|
780
|
|
781
|
},
|
782
|
skipAll: function () {
|
783
|
var me = this;
|
784
|
// if (Formheader.isValid()) {
|
785
|
Ext.Msg.show({
|
786
|
title: "",
|
787
|
msg: MinovaMessageData('WD002', ''),
|
788
|
buttons: Ext.Msg.YESNO,
|
789
|
icon: Ext.Msg.QUESTION,
|
790
|
fn: function (choice) {
|
791
|
console.log(choice);
|
792
|
if (choice === 'yes') {
|
793
|
// me.saveMD();
|
794
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
795
|
var page = 'wizards';
|
796
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
797
|
page = 'rcwizards';
|
798
|
}
|
799
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
800
|
var mb = new minovaBlowfish();
|
801
|
e = mb.minovaEncryptUrl(nextUrl);
|
802
|
window.open(page + '?' + e, "_self");
|
803
|
|
804
|
}
|
805
|
|
806
|
}
|
807
|
});
|
808
|
|
809
|
// }
|
810
|
|
811
|
},
|
812
|
skipMd: function () {
|
813
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
814
|
var next_ = prog_.getNextMD(); // id form selanjutnya
|
815
|
var me = this;
|
816
|
if (prog_.totalPage < next_) { // md form sudah selesai
|
817
|
// run save data to md
|
818
|
//me.saveToLoacalStorage();
|
819
|
//if (Formheader.isValid()) {
|
820
|
Ext.Msg.show({
|
821
|
title: "",
|
822
|
msg: MinovaMessageData('WD001', ''),
|
823
|
buttons: Ext.Msg.YESNO,
|
824
|
icon: Ext.Msg.QUESTION,
|
825
|
fn: function (choice) {
|
826
|
console.log(choice);
|
827
|
if (choice === 'yes') {
|
828
|
document.getElementById("progressbar").style.width = '100%';
|
829
|
me.changeProgress(prog_.totalPage, next_, true)
|
830
|
//me.saveMD();
|
831
|
var page = 'wizards';
|
832
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
833
|
page = 'rcwizards';
|
834
|
}
|
835
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
836
|
var mb = new minovaBlowfish();
|
837
|
e = mb.minovaEncryptUrl(nextUrl);
|
838
|
window.open(page + '?' + e, "_self");
|
839
|
}
|
840
|
|
841
|
}
|
842
|
});
|
843
|
|
844
|
// }
|
845
|
|
846
|
} else {
|
847
|
var lastHide = next_ - 1;
|
848
|
var self_ = Ext.ComponentQuery.query('[itemId=MD' + lastHide + ']')[0]; // formm yang sedang activ
|
849
|
var nextPage = Ext.ComponentQuery.query('[itemId=MD' + next_ + ']')[0];
|
850
|
if (nextPage.WizardLayout == 'F') {
|
851
|
|
852
|
//formName = 'formWizard' + nextPage.tableName;
|
853
|
formName = 'MinovaGridFormEdit' + nextPage.tableName;
|
854
|
|
855
|
if (Ext.ComponentQuery.query('[name=' + formName + ']')[0].mandatory == '1') {
|
856
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
857
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
858
|
} else {
|
859
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(false);
|
860
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(false);
|
861
|
}
|
862
|
|
863
|
} else {
|
864
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + nextPage.tableName + ']')[0].mandatory) {
|
865
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
866
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
867
|
|
868
|
} else {
|
869
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(false);
|
870
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(false);
|
871
|
}
|
872
|
}
|
873
|
|
874
|
nextPage.setHidden(false);
|
875
|
self_.setHidden(true);
|
876
|
// set ulang next and prev page
|
877
|
this.changeProgress(next_, next_ + 1, true);
|
878
|
prog_.setNextMD(next_ + 1);
|
879
|
prog_.setPrevMD(next_);
|
880
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
881
|
document.getElementById("progressbar").style.width = total_ + '%';
|
882
|
}
|
883
|
|
884
|
},
|
885
|
selectionFormDisplay: function (me) {
|
886
|
var data_ = JSON.parse(localStorage.getItem('selectionValues'));
|
887
|
if (data_) {
|
888
|
if (data_ != null) {
|
889
|
me.getForm().setValues(data_);
|
890
|
}
|
891
|
if (data_.ApplicantID != "") {
|
892
|
me.getForm().findField('EmployeeID').setValue(data_.ApplicantID);
|
893
|
}
|
894
|
me.getForm().findField('EmployeeID').setValue(getParam('id'))
|
895
|
}
|
896
|
|
897
|
if (getParam('wizard').substr(0, 1) == 'A') {
|
898
|
|
899
|
if (getParam('app') != 'null') {
|
900
|
me.getForm().findField('ApplicantID').setHidden(true)
|
901
|
me.getForm().findField('EmployeeID').setFieldLabel('Employee ID');
|
902
|
} else {
|
903
|
setTimeout(function () {
|
904
|
me.getForm().findField('EmployeeID').setFieldLabel('Applicant ID');
|
905
|
}, 10);
|
906
|
me.getForm().findField('ApplicantID').setHidden(false);
|
907
|
me.getForm().findField('EmployeeID').setHidden(true)
|
908
|
}
|
909
|
} else {
|
910
|
me.getForm().findField('EmployeeID').setFieldLabel('Employee ID');
|
911
|
me.getForm().findField('ApplicantID').setHidden(true);
|
912
|
me.getForm().findField('EmployeeID').setHidden(false)
|
913
|
}
|
914
|
|
915
|
},
|
916
|
// funsi next dan save data
|
917
|
saveWizardold: function () {
|
918
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
919
|
var oldTableName = prog_.getTableName(); // nama table form yang sedang aktif
|
920
|
var oldTableData = prog_.getTableData(); // nama table untuk data set value form yang sedang aktif
|
921
|
var next_ = prog_.getNextMD(); // id form selanjutnya
|
922
|
var me = this;
|
923
|
if (prog_.totalPage < next_) { // md form sudah selesai
|
924
|
// run save data to md
|
925
|
//me.saveToLoacalStorage();
|
926
|
//if (Formheader.isValid()) {
|
927
|
Ext.Msg.show({
|
928
|
title: "",
|
929
|
msg: MinovaMessageData('WD001', ''),
|
930
|
buttons: Ext.Msg.YESNO,
|
931
|
icon: Ext.Msg.QUESTION,
|
932
|
fn: function (choice) {
|
933
|
console.log(choice);
|
934
|
if (choice === 'yes') {
|
935
|
document.getElementById("progressbar").style.width = '100%';
|
936
|
me.changeProgress(prog_.totalPage, next_, false)
|
937
|
me.saveMD();
|
938
|
|
939
|
}
|
940
|
|
941
|
}
|
942
|
});
|
943
|
|
944
|
//}
|
945
|
|
946
|
} else {
|
947
|
var lastHide = next_ - 1;
|
948
|
var cekValid = true;
|
949
|
var self_ = Ext.ComponentQuery.query('[itemId=MD' + lastHide + ']')[0]; // formm yang sedang activ
|
950
|
var tableName = self_.tableName;
|
951
|
var formName = undefined;
|
952
|
var nextPage = Ext.ComponentQuery.query('[itemId=MD' + next_ + ']')[0];
|
953
|
|
954
|
if (self_.WizardLayout == 'F') {
|
955
|
formName = 'MinovaGridFormEdit' + tableName;
|
956
|
frmSelf = Ext.ComponentQuery.query('[name=' + formName + ']')[0];
|
957
|
frmSelf.getForm().findField("EmployeeID").setValue(getParam('id'));
|
958
|
cekValid = frmSelf.getForm().isValid();
|
959
|
|
960
|
} else {
|
961
|
|
962
|
gridPnl = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + tableName + ']')[0].mandatory;
|
963
|
if (gridPnl == '1') {
|
964
|
var storeGrid = Ext.StoreMgr.lookup(tableName + "WizardStore");
|
965
|
var storeCount_ = storeGrid.getCount();
|
966
|
if (storeCount_ > 0) {
|
967
|
cekValid = true;
|
968
|
} else {
|
969
|
cekValid = false;
|
970
|
}
|
971
|
}
|
972
|
|
973
|
}
|
974
|
// disable button
|
975
|
if (cekValid) {
|
976
|
//me.saveToLoacalStorage();
|
977
|
if (nextPage.mandatory == "1") {
|
978
|
if (nextPage.nextMD == 1) {
|
979
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
980
|
//Ext.ComponentQuery.query('[name=saveWizard]')[0].setDisabled(true);
|
981
|
//Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setText("Finish")
|
982
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
983
|
|
984
|
} else {
|
985
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
986
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
987
|
|
988
|
}
|
989
|
|
990
|
} else {
|
991
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(false);
|
992
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(false);
|
993
|
}
|
994
|
nextPage.setHidden(false);
|
995
|
self_.skip_ = false;
|
996
|
|
997
|
if (Ext.ComponentQuery.query('[name=' + "MinovaGridFormEdit" + self_.tableName + ']')[0]) {
|
998
|
Ext.ComponentQuery.query('[name=' + "MinovaGridFormEdit" + self_.tableName + ']')[0].skip_ = false;
|
999
|
}
|
1000
|
if (Ext.ComponentQuery.query('[name=' + "MinovaGridFormEdit" + self_.tableName + ']')[0]) {
|
1001
|
Ext.ComponentQuery.query('[name=' + "MinovaGridFormEdit" + self_.tableName + ']')[0].skip_ = false;
|
1002
|
}
|
1003
|
self_.setHidden(true);
|
1004
|
// set ulang next and prev page
|
1005
|
prog_.setNextMD(next_ + 1);
|
1006
|
prog_.setPrevMD(next_);
|
1007
|
|
1008
|
//change progress bar
|
1009
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1010
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1011
|
var idx = next_ - 1;
|
1012
|
me.changeProgress(idx, next_, false);
|
1013
|
Ext.ComponentQuery.query('[name=prevWizard]')[0].setDisabled(false);
|
1014
|
var wzFunc = undefined
|
1015
|
//if (Ext.ComponentQuery.query('[name=selectionForm]')[0].getForm().isValid()) {
|
1016
|
Ext.Ajax.request({
|
1017
|
async: false,
|
1018
|
method: 'POST',
|
1019
|
url: '/UserControl/GetStore',
|
1020
|
params: {
|
1021
|
tableName: 'PHRPAWIZMAIN',
|
1022
|
param: 'Wizard[equal]' + getParam('wizard')
|
1023
|
|
1024
|
},
|
1025
|
success: function (response) {
|
1026
|
var results = Ext.decode(response.responseText);
|
1027
|
data_ = results.data[0];
|
1028
|
if (data_ != undefined) {
|
1029
|
wzFunc = data_.WizardFunction;
|
1030
|
}
|
1031
|
}
|
1032
|
});
|
1033
|
if (wzFunc == 'APPT') {
|
1034
|
if (nextPage.WizardLayout == "F") {
|
1035
|
var datatable = 'PHRRC' + nextPage.tableName.substring(5, 9);
|
1036
|
var nowDate = MinovaUtil.GetNowDate();
|
1037
|
var data_ = JSON.parse(localStorage.getItem(datatable));
|
1038
|
Ext.Ajax.request({
|
1039
|
async: false,
|
1040
|
method: 'POST',
|
1041
|
url: '/UserControl/GetStore',
|
1042
|
params: {
|
1043
|
tableName: datatable,
|
1044
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("app")
|
1045
|
|
1046
|
},
|
1047
|
success: function (response) {
|
1048
|
var results = Ext.decode(response.responseText);
|
1049
|
dataForm = results.data[0];
|
1050
|
var _form = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + nextPage.tableName + ']')[0]
|
1051
|
var form_ = _form.getForm();
|
1052
|
form_.setValues(dataForm);
|
1053
|
me.setValueFromParameter(_form);
|
1054
|
var temData = JSON.parse(localStorage.getItem('selectionValues'));
|
1055
|
|
1056
|
if (datatable == "phrpa0002" || datatable == "PHRPA0002") {
|
1057
|
form_.findField('StartDate').setValue(temData.EffectiveDate);
|
1058
|
form_.findField('CompanyID').setValue(temData.CompanyID);
|
1059
|
form_.findField('PayrollGroup').setValue(temData.PayrollGroup);
|
1060
|
form_.findField('MovementReason').setValue(temData.Reason);
|
1061
|
} else {
|
1062
|
form_.findField('StartDate').setValue(temData.EffectiveDate); console.log('chani');
|
1063
|
}
|
1064
|
}
|
1065
|
});
|
1066
|
} else {
|
1067
|
tbl = 'PHRRC' + nextPage.tableName.substring(5, 9)
|
1068
|
var data_ = JSON.parse(localStorage.getItem(tbl));
|
1069
|
var dataForm = undefined;
|
1070
|
var nowDate = MinovaUtil.GetNowDate()
|
1071
|
|
1072
|
Ext.Ajax.request({
|
1073
|
async: false,
|
1074
|
method: 'POST',
|
1075
|
url: '/UserControl/GetStore',
|
1076
|
params: {
|
1077
|
tableName: tbl,
|
1078
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("app")
|
1079
|
|
1080
|
},
|
1081
|
success: function (response) {
|
1082
|
var results = Ext.decode(response.responseText);
|
1083
|
dataForm = results.data;
|
1084
|
var gridStore = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + nextPage.tableName + ']')[0].getStore();
|
1085
|
gridStore.loadData(Ext.decode(dataForm));
|
1086
|
|
1087
|
}
|
1088
|
});
|
1089
|
}
|
1090
|
|
1091
|
} else if (wzFunc != 'APPI' && wzFunc != 'EMPI' && wzFunc != 'APPT') {
|
1092
|
var nowDate = MinovaUtil.GetNowDate();
|
1093
|
if (nextPage.WizardLayout == "F") {
|
1094
|
Ext.Ajax.request({
|
1095
|
async: false,
|
1096
|
method: 'POST',
|
1097
|
url: '/UserControl/GetStore',
|
1098
|
params: {
|
1099
|
tableName: nextPage.tableName,
|
1100
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("id")
|
1101
|
|
1102
|
},
|
1103
|
success: function (response) {
|
1104
|
var results = Ext.decode(response.responseText);
|
1105
|
dataForm = results.data[0];
|
1106
|
var _form = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + nextPage.tableName + ']')[0];
|
1107
|
var form_ = _form.getForm();
|
1108
|
form_.setValues(dataForm);
|
1109
|
me.setValueFromParameter(_form);
|
1110
|
var temData = JSON.parse(localStorage.getItem('selectionValues'));
|
1111
|
form_.findField('StartDate').setValue(temData.StartDate)
|
1112
|
}
|
1113
|
});
|
1114
|
} else {
|
1115
|
Ext.Ajax.request({
|
1116
|
async: false,
|
1117
|
method: 'POST',
|
1118
|
url: '/UserControl/GetStore',
|
1119
|
params: {
|
1120
|
tableName: nextPage.tableName,
|
1121
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("id")
|
1122
|
|
1123
|
},
|
1124
|
success: function (response) {
|
1125
|
var results = Ext.decode(response.responseText);
|
1126
|
dataForm = results.data;
|
1127
|
var gridStore = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + nextPage.tableName + ']')[0].getStore();
|
1128
|
gridStore.loadData(Ext.decode(dataForm));
|
1129
|
|
1130
|
}
|
1131
|
});
|
1132
|
}
|
1133
|
} else {
|
1134
|
//
|
1135
|
var frm_ = "MinovaGridFormEdit";
|
1136
|
if (nextPage.WizardLayout == "G") {
|
1137
|
frm_ = "formGridWizard";
|
1138
|
}
|
1139
|
var form_ = Ext.ComponentQuery.query('[name=' + frm_ + nextPage.tableName + ']')[0];
|
1140
|
var emp = form_.getForm().findField("EmployeeID");
|
1141
|
var temData = JSON.parse(localStorage.getItem('selectionValues'));
|
1142
|
form_.getForm().findField('StartDate').setValue(temData.StartDate)
|
1143
|
if (emp) {
|
1144
|
emp.setValue(getParam("id"));
|
1145
|
|
1146
|
} else {
|
1147
|
Ext.ComponentQuery.query('[name=' + frm_ + nextPage.tableName + ']')[0].getForm().findField("ApplicantID").setValue(getParam("id"))
|
1148
|
}
|
1149
|
}
|
1150
|
|
1151
|
//} else {
|
1152
|
// // message jika form tidak valid
|
1153
|
//}
|
1154
|
|
1155
|
}
|
1156
|
|
1157
|
}
|
1158
|
},
|
1159
|
// fungsi save data to md
|
1160
|
saveMD: function () {
|
1161
|
|
1162
|
var pnlProgress = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
1163
|
var mainWizard = Ext.ComponentQuery.query('[name=mainWizard]')[0];
|
1164
|
mainWizard.mask('Loading...');
|
1165
|
var allTable = pnlProgress.allTable;
|
1166
|
var allData = pnlProgress.allData;
|
1167
|
var wizardFunction = pnlProgress.wizardFunction;
|
1168
|
// md 15 boleh diinput jika statusMD1=true dan statusMD2=true
|
1169
|
var statusMD1 = false;
|
1170
|
var statusMD2 = false;
|
1171
|
var sukses = true;
|
1172
|
var i = 0;
|
1173
|
var data_ = undefined;
|
1174
|
var skip_ = undefined; // only grid or form with skip property is false will be save to md
|
1175
|
Ext.each(allData, function (rec) {
|
1176
|
//console.log(tbl)
|
1177
|
//var data_ = JSON.parse(localStorage.getItem(tbl));
|
1178
|
var tbl_ = rec.TableName
|
1179
|
if (wizardFunction == "APPT") {
|
1180
|
if (tbl_.substring(0, 5) == 'PHRRC') {
|
1181
|
tbl_ = 'PHRPA' + tbl_.substring(5, 9);
|
1182
|
}
|
1183
|
}
|
1184
|
|
1185
|
i++;
|
1186
|
if (rec.WizardLayout == 'F') { // jika layout form
|
1187
|
var formname = "MinovaGridFormEdit" + tbl_;
|
1188
|
var frm = Ext.ComponentQuery.query('[name=' + formname + ']')[0];
|
1189
|
var validForm_ = Ext.ComponentQuery.query('[name=' + formname + ']')[0].getForm().isValid();
|
1190
|
var formValues_ = frm.getValues();
|
1191
|
// if (formValues_.EmployeeID == "") {
|
1192
|
if (formValues_.EmployeeID == "") {
|
1193
|
formValues_["EmployeeID"] = getParam('id');
|
1194
|
}
|
1195
|
//}
|
1196
|
|
1197
|
if (wizardFunction == "APPT") {
|
1198
|
formValues_["EmployeeID"] = getParam('id');
|
1199
|
}
|
1200
|
//var end_ = formValues_.EndDate;
|
1201
|
//if (end_ == "") {
|
1202
|
// skip_ = true;
|
1203
|
//}
|
1204
|
if (validForm_) {
|
1205
|
skip_ = false;
|
1206
|
} else {
|
1207
|
skip_ = true;
|
1208
|
}
|
1209
|
data_ = Ext.encode(formValues_);
|
1210
|
|
1211
|
} else { // jika layout grid
|
1212
|
var gridName = "MinovaGridFormGrid" + tbl_;
|
1213
|
var grid_ = Ext.ComponentQuery.query('[name=' + gridName + ']')[0];
|
1214
|
var gridStore = grid_.getStore();
|
1215
|
|
1216
|
if (gridStore.count() > 0) {
|
1217
|
data_ = Ext.encode(Ext.pluck(gridStore.data.items, 'data'));
|
1218
|
skip_ = false;
|
1219
|
} else {
|
1220
|
skip_ = true;
|
1221
|
}
|
1222
|
|
1223
|
}
|
1224
|
// run save
|
1225
|
|
1226
|
if (skip_ == false && sukses == true) {
|
1227
|
Ext.Ajax.request({
|
1228
|
async: false,
|
1229
|
method: 'POST',
|
1230
|
url: '/Devt/SaveTable',
|
1231
|
params: {
|
1232
|
tableName: tbl_,
|
1233
|
data: data_,
|
1234
|
action: 0
|
1235
|
},
|
1236
|
waitMsg: 'Saving Data...',
|
1237
|
success: function (response) {
|
1238
|
var result = Ext.decode(response.responseText);
|
1239
|
if (result.success) {
|
1240
|
// MinovaMessage('Not Null', '000006', '', 'S');
|
1241
|
sukses = true;
|
1242
|
} else {
|
1243
|
MinovaMessage('', '000005', result.message.text, 'E');
|
1244
|
sukses = false;
|
1245
|
}
|
1246
|
},
|
1247
|
failure: function (response) {
|
1248
|
var result = Ext.decode(response.responseText);
|
1249
|
MinovaMessage('', '000005', result.message.text, 'E');
|
1250
|
sukses = false;
|
1251
|
}
|
1252
|
});
|
1253
|
}
|
1254
|
|
1255
|
});
|
1256
|
|
1257
|
//save md 0015
|
1258
|
if (wizardFunction == 'APPT' || wizardFunction == 'EMPI') {
|
1259
|
ApplicantID = '';
|
1260
|
if (wizardFunction == 'APPT') {
|
1261
|
ApplicantID = getParam('app')
|
1262
|
}
|
1263
|
var date_ = Ext.ComponentQuery.query('[name=MinovaGridFormEditPHRPA0002]')[0].getValues().StartDate;
|
1264
|
data = {
|
1265
|
EmployeeID: getParam('id'),
|
1266
|
PaymentUpTo: '',
|
1267
|
RetroDate: date_,
|
1268
|
HiringDate: date_,
|
1269
|
ApplicantID: ApplicantID,
|
1270
|
CorrectStatus: ''
|
1271
|
};
|
1272
|
dataDelete = {
|
1273
|
EmployeeID: getParam('id'),
|
1274
|
PaymentUpTo: '',
|
1275
|
RetroDate: '',
|
1276
|
//HiringDate: date_,
|
1277
|
ApplicantID: ApplicantID,
|
1278
|
CorrectStatus: ''
|
1279
|
};
|
1280
|
data_ = Ext.encode(data);
|
1281
|
dataDelete_ = Ext.encode(dataDelete);
|
1282
|
|
1283
|
Ext.Ajax.request({
|
1284
|
async: false,
|
1285
|
method: 'POST',
|
1286
|
url: '/Devt/SaveTable',
|
1287
|
params: {
|
1288
|
tableName: 'PHRPA0015',
|
1289
|
data: data_,
|
1290
|
action: 0
|
1291
|
},
|
1292
|
waitMsg: 'Saving Data...',
|
1293
|
success: function (response) {
|
1294
|
var result = Ext.decode(response.responseText);
|
1295
|
if (result.success) {
|
1296
|
MinovaMessage('Not Null', '000006', '', 'S');
|
1297
|
sukses = true;
|
1298
|
} else {
|
1299
|
MinovaMessage('Not Null', '000005', result.message.text, 'E');
|
1300
|
sukses = false;
|
1301
|
}
|
1302
|
},
|
1303
|
failure: function (response) {
|
1304
|
var result = Ext.decode(response.responseText);
|
1305
|
sukses = false;
|
1306
|
}
|
1307
|
});
|
1308
|
}
|
1309
|
mainWizard.unmask();
|
1310
|
if (sukses == true && allData.length == i) {
|
1311
|
var page = 'wizards';
|
1312
|
if (wizardFunction.substring(0, 1) == "A") {
|
1313
|
page = 'rcwizards';
|
1314
|
}
|
1315
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
1316
|
var mb = new minovaBlowfish();
|
1317
|
e = mb.minovaEncryptUrl(nextUrl);
|
1318
|
window.open(page + '?' + e, "_self");
|
1319
|
//window.open(nextUrl, "_self");
|
1320
|
}
|
1321
|
|
1322
|
},
|
1323
|
saveToLoacalStorage: function () {
|
1324
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
1325
|
var myID = prog_.getNextMD() - 1;
|
1326
|
var self_ = Ext.ComponentQuery.query('[itemId=MD' + myID + ']')[0];
|
1327
|
var tableName = self_.tableName;
|
1328
|
var WizardLayout = self_.WizardLayout;
|
1329
|
var valuesData = undefined;
|
1330
|
var formName = undefined;
|
1331
|
var mandatory = self_.mandatory
|
1332
|
|
1333
|
if (WizardLayout == 'F') { // jika tipe layout form
|
1334
|
formName = 'MinovaGridFormEdit' + tableName;
|
1335
|
frm = Ext.ComponentQuery.query('form[name=' + formName + ']')[0].getForm();
|
1336
|
if (frm.isValid()) { // cek semua field mandatory sudah diisi
|
1337
|
valuesData = frm.getValues();
|
1338
|
}
|
1339
|
|
1340
|
} else { // jika tipe layout grid
|
1341
|
formName = 'MinovaGridFormEdit' + tableName;
|
1342
|
var storeGrid = Ext.StoreMgr.lookup(tableName + "WizardStore");
|
1343
|
valuesData = Ext.encode(Ext.pluck(storeGrid.data.items, 'data'));
|
1344
|
}
|
1345
|
|
1346
|
//save to local storage
|
1347
|
//localStorage.setItem(tableName, JSON.stringify(valuesData));
|
1348
|
|
1349
|
},
|
1350
|
setValueFromParameter: function (_form) {
|
1351
|
// set value from wizard parameter
|
1352
|
var wizardID = _form.Wizard;
|
1353
|
var _tablename = _form.tableName;
|
1354
|
var form_ = _form.getForm();
|
1355
|
hasil = undefined;
|
1356
|
Ext.Ajax.request({
|
1357
|
async: false,
|
1358
|
method: 'POST',
|
1359
|
url: '/UserControl/GetStore',
|
1360
|
params: {
|
1361
|
tableName: 'PDSBS0010',
|
1362
|
param: 'Wizard[=]' + wizardID + ',TableName[=]' + _tablename
|
1363
|
},
|
1364
|
success: function (response) {
|
1365
|
var results = Ext.decode(response.responseText);
|
1366
|
hasil = results.data;
|
1367
|
}
|
1368
|
});
|
1369
|
|
1370
|
if (hasil.length > 0) {
|
1371
|
var value_ = undefined;
|
1372
|
Ext.each(hasil, function (rec) {
|
1373
|
|
1374
|
if (rec.DefaultValue.substring(0, 2) == 'fn' && rec.FunctionCode != '') {
|
1375
|
value_ = eval(rec.FunctionCode);
|
1376
|
} else {
|
1377
|
value_ = rec.DefaultValue;
|
1378
|
}
|
1379
|
if (form_.findField(rec.FieldName)) {
|
1380
|
form_.findField(rec.FieldName).setValue(value_);
|
1381
|
}
|
1382
|
});
|
1383
|
}
|
1384
|
// set value from wizard parameter
|
1385
|
},
|
1386
|
saveWizard: function () {
|
1387
|
var sukses = false;
|
1388
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
1389
|
var _self = prog_.getNextMD() - 1;
|
1390
|
if (_self == 0) {
|
1391
|
_self = 1;
|
1392
|
prog_.setNextMD(2);
|
1393
|
}
|
1394
|
var self_ = Ext.ComponentQuery.query('[itemId=MD' + _self + ']')[0];
|
1395
|
var type_ = self_.WizardLayout;
|
1396
|
|
1397
|
if (type_ == 'F') { // form layout
|
1398
|
if (self_.getForm().isValid()) {
|
1399
|
this.saveForm(self_);
|
1400
|
} else { // form not valid
|
1401
|
|
1402
|
}
|
1403
|
} else { // grid layout
|
1404
|
var cekData = false;
|
1405
|
storeCount = 0;
|
1406
|
dataStore = undefined;
|
1407
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + self_.tableName + ']')[0]) {
|
1408
|
dataStore = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + self_.tableName + ']')[0].getStore();
|
1409
|
storeCount = dataStore.count();
|
1410
|
} else {
|
1411
|
|
1412
|
dataStore = Ext.StoreMgr.lookup("store" + self_.tableName);
|
1413
|
storeCount = dataStore.count();
|
1414
|
}
|
1415
|
if (self_.mandatory == "1") {
|
1416
|
|
1417
|
if (storeCount > 0) {
|
1418
|
cekData = true;
|
1419
|
} else {
|
1420
|
cekData = false;
|
1421
|
// mesaage
|
1422
|
}
|
1423
|
} else {
|
1424
|
cekData = true;
|
1425
|
}
|
1426
|
//save grid data
|
1427
|
if (storeCount > 0) {
|
1428
|
sukses = true;
|
1429
|
var dtTableSet = null;
|
1430
|
Ext.Ajax.request({
|
1431
|
async: false,
|
1432
|
method: 'POST',
|
1433
|
url: '/UserControl/GetStore',
|
1434
|
params: {
|
1435
|
tableName: 'SDATATABLEFIELD',
|
1436
|
param: 'TableName[equal]' + self_.tableName + ',FormatRef[=]amountencrypt'
|
1437
|
//param : 'TableName[equal]' + self_.tableName
|
1438
|
},
|
1439
|
success: function (response) {
|
1440
|
var results = Ext.decode(response.responseText);
|
1441
|
dtTableSet = results.data;
|
1442
|
|
1443
|
}
|
1444
|
})
|
1445
|
for (var i = 0; i < storeCount; i++) {
|
1446
|
dataSub = dataStore.data.items[i].data;
|
1447
|
if (dataStore.data.items[i].data.Flag == '0') {
|
1448
|
if (dtTableSet.length > 0) {
|
1449
|
m = 0;
|
1450
|
for (var m = 0; m < dtTableSet.length; m++) {
|
1451
|
var valEnc = '';
|
1452
|
var f = dtTableSet[m].FieldName;
|
1453
|
eval('valEnc=dataSub.' + f)
|
1454
|
if (valEnc != '') {
|
1455
|
Ext.Ajax.request({
|
1456
|
async: false,
|
1457
|
method: 'POST',
|
1458
|
url: '/Devt/DecryptData',
|
1459
|
params: {
|
1460
|
dt: valEnc
|
1461
|
|
1462
|
},
|
1463
|
success: function (response) {
|
1464
|
var results = Ext.decode(response.responseText);
|
1465
|
value = results.data;
|
1466
|
eval('dataSub.' + f + '=' + value);
|
1467
|
|
1468
|
}
|
1469
|
|
1470
|
});
|
1471
|
}
|
1472
|
}
|
1473
|
}
|
1474
|
Ext.Ajax.request({
|
1475
|
async: false,
|
1476
|
method: 'POST',
|
1477
|
url: '/Devt/SaveTable',
|
1478
|
params: {
|
1479
|
tableName: self_.tableName,
|
1480
|
data: Ext.encode(dataSub),
|
1481
|
action: 0
|
1482
|
},
|
1483
|
waitMsg: 'Saving Data...',
|
1484
|
success: function (response) {
|
1485
|
var result = Ext.decode(response.responseText);
|
1486
|
if (result.success) {
|
1487
|
// MinovaMessage('Not Null', '000006', '', 'S');
|
1488
|
sukses = true;
|
1489
|
} else {
|
1490
|
MinovaMessage('', '000005', result.message.text, 'E');
|
1491
|
sukses = false;
|
1492
|
}
|
1493
|
},
|
1494
|
failure: function (response) {
|
1495
|
var result = Ext.decode(response.responseText);
|
1496
|
MinovaMessage('', '000005', result.message.text, 'E');
|
1497
|
sukses = false;
|
1498
|
}
|
1499
|
});
|
1500
|
}
|
1501
|
|
1502
|
}
|
1503
|
//send mail
|
1504
|
if (sukses) {
|
1505
|
var _param = {
|
1506
|
serviceName: 'ERecruitmentAuthentication.asmx',
|
1507
|
methodName: 'SendMailChangeMD',
|
1508
|
parameter: 'TableName=' + self_.tableName + '&EmployeeID=' + dataStore.data.items[0].data.EmployeeID
|
1509
|
|
1510
|
};
|
1511
|
|
1512
|
//var results = null;
|
1513
|
Ext.Ajax.request({
|
1514
|
method: 'post',
|
1515
|
type: 'ajax',
|
1516
|
params: _param,
|
1517
|
url: '/InvokeService/Invoke/',
|
1518
|
loadMask: {
|
1519
|
msg: 'please wait...'
|
1520
|
},
|
1521
|
success: function (response) {}
|
1522
|
});
|
1523
|
}
|
1524
|
|
1525
|
}
|
1526
|
if (cekData) {
|
1527
|
prog_.sukses = true;
|
1528
|
this.goNextMD(prog_, self_);
|
1529
|
//change progress bar
|
1530
|
total_ = ((prog_.getNextMD() - 1) / prog_.totalPage) * 100;
|
1531
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1532
|
var idx = prog_.getNextMD() - 1;
|
1533
|
this.changeProgress(idx, prog_.getNextMD(), false);
|
1534
|
|
1535
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1536
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1537
|
}
|
1538
|
if (sukses == true || total_ == 100) {
|
1539
|
if (_self == self_.nextMD) {
|
1540
|
Ext.Msg.show({
|
1541
|
title: "",
|
1542
|
msg: MinovaMessageData('WD001', ''),
|
1543
|
buttons: Ext.Msg.YESNO,
|
1544
|
icon: Ext.Msg.QUESTION,
|
1545
|
fn: function (choice) {
|
1546
|
console.log(choice);
|
1547
|
if (choice === 'yes') {
|
1548
|
document.getElementById("progressbar").style.width = '100%';
|
1549
|
if (sukses) {
|
1550
|
var page = 'wizards';
|
1551
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
1552
|
page = 'rcwizards';
|
1553
|
}
|
1554
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
1555
|
var mb = new minovaBlowfish();
|
1556
|
e = mb.minovaEncryptUrl(nextUrl);
|
1557
|
window.open(page + '?' + e, "_self");
|
1558
|
|
1559
|
}
|
1560
|
}
|
1561
|
|
1562
|
}
|
1563
|
});
|
1564
|
|
1565
|
}
|
1566
|
}
|
1567
|
|
1568
|
}
|
1569
|
|
1570
|
},
|
1571
|
saveForm: function (self_) {
|
1572
|
var me = this;
|
1573
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
1574
|
var next_ = prog_.getNextMD(); // id form selanjutnya
|
1575
|
var _self = prog_.getNextMD() - 1;
|
1576
|
if (self_ == undefined) {
|
1577
|
self_ = Ext.ComponentQuery.query('[itemId=MD' + _self + ']')[0]; // formm yang sedang activ
|
1578
|
}
|
1579
|
var data1 = undefined;
|
1580
|
var data2 = undefined;
|
1581
|
//cek apakah md PHRPA0001
|
1582
|
var cekKtp = true;
|
1583
|
var _tbl = self_.tableName.toLowerCase();
|
1584
|
|
1585
|
//cek ktp
|
1586
|
if (_tbl == 'phrpa0001' || _tbl == 'phrrc0001') {
|
1587
|
Ext.Ajax.request({
|
1588
|
async: false,
|
1589
|
method: 'POST',
|
1590
|
url: '/UserControl/GetStore',
|
1591
|
params: {
|
1592
|
tableName: 'PDSPAEMPIDCARD',
|
1593
|
param: 'WizardFunction[equal]' + self_.WizardFunction + ',BirthDate[=]' + Ext.ComponentQuery.query('[name=BirthDate]')[0].getValue() + ',IDCard[=]' + Ext.ComponentQuery.query('[name=IDCard]')[0].getValue()
|
1594
|
|
1595
|
},
|
1596
|
success: function (response) {
|
1597
|
var results = Ext.decode(response.responseText);
|
1598
|
data_ = results.data;
|
1599
|
if (data_ != undefined && data_.length > 0) {
|
1600
|
var MsgParam = "";
|
1601
|
Ext.each(data_, function (rec) {
|
1602
|
MsgParam = MsgParam + ' Type : ' + rec.Type + ' , Company : ' + rec.Company + ' , Status : ' + rec.Status + ' , Reason : ' + rec.Reason
|
1603
|
});
|
1604
|
/* MinovaMessage(' Message ', ' WIZRCIDCARD ', MsgParam, 'C', function (respone) {
|
1605
|
if (respone == "yes") {
|
1606
|
cekKtp = false;
|
1607
|
if (cekKtp) {
|
1608
|
if (self_.WizardFunction == "APPT" || self_.WizardFunction == "EMPI") {
|
1609
|
if (_tbl == 'phrpa0001') {
|
1610
|
// past
|
1611
|
if (self_.getForm().isValid()) {
|
1612
|
//change progress bar
|
1613
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1614
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1615
|
var idx = next_ - 1;
|
1616
|
me.changeProgress(idx, next_, false);
|
1617
|
me.goNextMD(prog_, self_);
|
1618
|
me.setFormValuesAfterNext(self_.wizardFunction, prog_);
|
1619
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1620
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1621
|
} else { // jika form error
|
1622
|
|
1623
|
}
|
1624
|
} else {
|
1625
|
// save data to md
|
1626
|
if (self_.getForm().isValid()) {
|
1627
|
if (_tbl == 'phrpa0002') {
|
1628
|
|
1629
|
Ext.Ajax.request({
|
1630
|
async: false,
|
1631
|
method: 'POST',
|
1632
|
url: '/UserControl/GetStore',
|
1633
|
params: {
|
1634
|
tableName: 'PDSPAWIZDEL',
|
1635
|
param: getParam("id")
|
1636
|
|
1637
|
},
|
1638
|
waitMsg: 'Saving Data...',
|
1639
|
success: function (response) { },
|
1640
|
failure: function (response) { }
|
1641
|
});
|
1642
|
|
1643
|
formName = 'MinovaGridFormEditPHRPA0001';
|
1644
|
data1 = Ext.ComponentQuery.query('[name=' + formName + ']')[0].getForm().getValues();
|
1645
|
var CreateDate = 'CreateDate';
|
1646
|
var CreateDateValue = "";
|
1647
|
var ChangeDate = 'ChangeDate';
|
1648
|
var ChangeDateValue = "";
|
1649
|
|
1650
|
data1[CreateDate] = CreateDateValue;
|
1651
|
data1[ChangeDate] = ChangeDateValue;
|
1652
|
data2 = self_.getForm().getValues();
|
1653
|
data2[CreateDate] = CreateDateValue;
|
1654
|
data2[ChangeDate] = ChangeDateValue;
|
1655
|
} else {
|
1656
|
data1 = self_.getForm().getValues();
|
1657
|
var CreateDate = 'CreateDate';
|
1658
|
var CreateDateValue = "";
|
1659
|
var ChangeDate = 'ChangeDate';
|
1660
|
var ChangeDateValue = "";
|
1661
|
|
1662
|
data1[CreateDate] = CreateDateValue;
|
1663
|
data1[ChangeDate] = ChangeDateValue;
|
1664
|
}
|
1665
|
|
1666
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1667
|
if (sukses) {
|
1668
|
//change progress bar
|
1669
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1670
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1671
|
var idx = next_ - 1;
|
1672
|
me.changeProgress(idx, next_, false);
|
1673
|
me.setFormValuesAfterNext(self_.wizardFunction, prog_);
|
1674
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1675
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1676
|
me.goNextMD(prog_, self_);
|
1677
|
|
1678
|
}
|
1679
|
|
1680
|
} else { // jika form error
|
1681
|
|
1682
|
}
|
1683
|
}
|
1684
|
} else {
|
1685
|
data1 = self_.getForm().getValues();
|
1686
|
//cek apakah form terakhir
|
1687
|
if (prog_.totalPage < next_) { // md form sudah selesai
|
1688
|
Ext.Msg.show({
|
1689
|
title: "",
|
1690
|
msg: MinovaMessageData('WD001', ''),
|
1691
|
//buttons: Ext.Msg.YESNO,
|
1692
|
icon: Ext.Msg.QUESTION,
|
1693
|
fn: function (choice) {
|
1694
|
console.log(choice);
|
1695
|
if (choice === 'yes') {
|
1696
|
document.getElementById("progressbar").style.width = '100%';
|
1697
|
|
1698
|
//me.saveDataToMD();
|
1699
|
|
1700
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1701
|
if (sukses) {
|
1702
|
var page = 'wizards';
|
1703
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
1704
|
page = 'rcwizards';
|
1705
|
}
|
1706
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
1707
|
var mb = new minovaBlowfish();
|
1708
|
e = mb.minovaEncryptUrl(nextUrl);
|
1709
|
window.open(page + '?' + e, "_self");
|
1710
|
|
1711
|
}
|
1712
|
}
|
1713
|
|
1714
|
}
|
1715
|
});
|
1716
|
} else {
|
1717
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1718
|
if (sukses) {
|
1719
|
//change progress bar
|
1720
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1721
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1722
|
var idx = next_ - 1;
|
1723
|
me.changeProgress(idx, next_, false);
|
1724
|
me.goNextMD(prog_, self_);
|
1725
|
me.setFormValuesAfterNext(self_.WizardFunction, prog_);
|
1726
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1727
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1728
|
|
1729
|
}
|
1730
|
}
|
1731
|
|
1732
|
}
|
1733
|
|
1734
|
}
|
1735
|
|
1736
|
} else {
|
1737
|
cekKtp = false;
|
1738
|
}
|
1739
|
});
|
1740
|
*/
|
1741
|
MinovaMessageError(' Message ', ' WIZRCIDCARD ', MsgParam)
|
1742
|
} else {
|
1743
|
cekKtp = true;
|
1744
|
if (cekKtp) {
|
1745
|
if (self_.WizardFunction == "APPT" || self_.WizardFunction == "EMPI") {
|
1746
|
if (_tbl == 'phrpa0001') {
|
1747
|
// past
|
1748
|
if (self_.getForm().isValid()) {
|
1749
|
//change progress bar
|
1750
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1751
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1752
|
var idx = next_ - 1;
|
1753
|
me.changeProgress(idx, next_, false);
|
1754
|
me.goNextMD(prog_, self_);
|
1755
|
me.setFormValuesAfterNext(self_.wizardFunction, prog_);
|
1756
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1757
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1758
|
} else { // jika form error
|
1759
|
|
1760
|
}
|
1761
|
} else {
|
1762
|
// save data to md
|
1763
|
if (self_.getForm().isValid()) {
|
1764
|
if (_tbl == 'phrpa0002') {
|
1765
|
|
1766
|
Ext.Ajax.request({
|
1767
|
async: false,
|
1768
|
method: 'POST',
|
1769
|
url: '/UserControl/GetStore',
|
1770
|
params: {
|
1771
|
tableName: 'PDSPAWIZDEL',
|
1772
|
param: getParam("id")
|
1773
|
|
1774
|
},
|
1775
|
waitMsg: 'Saving Data...',
|
1776
|
success: function (response) {},
|
1777
|
failure: function (response) {}
|
1778
|
});
|
1779
|
|
1780
|
formName = 'MinovaGridFormEditPHRPA0001';
|
1781
|
data1 = Ext.ComponentQuery.query('[name=' + formName + ']')[0].getForm().getValues();
|
1782
|
var CreateDate = 'CreateDate';
|
1783
|
var CreateDateValue = "";
|
1784
|
var ChangeDate = 'ChangeDate';
|
1785
|
var ChangeDateValue = "";
|
1786
|
|
1787
|
data1[CreateDate] = CreateDateValue;
|
1788
|
data1[ChangeDate] = ChangeDateValue;
|
1789
|
data2 = self_.getForm().getValues();
|
1790
|
data2[CreateDate] = CreateDateValue;
|
1791
|
data2[ChangeDate] = ChangeDateValue;
|
1792
|
} else {
|
1793
|
data1 = self_.getForm().getValues();
|
1794
|
var CreateDate = 'CreateDate';
|
1795
|
var CreateDateValue = "";
|
1796
|
var ChangeDate = 'ChangeDate';
|
1797
|
var ChangeDateValue = "";
|
1798
|
|
1799
|
data1[CreateDate] = CreateDateValue;
|
1800
|
data1[ChangeDate] = ChangeDateValue;
|
1801
|
}
|
1802
|
|
1803
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1804
|
if (sukses) {
|
1805
|
//change progress bar
|
1806
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1807
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1808
|
var idx = next_ - 1;
|
1809
|
me.changeProgress(idx, next_, false);
|
1810
|
me.setFormValuesAfterNext(self_.wizardFunction, prog_);
|
1811
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1812
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1813
|
me.goNextMD(prog_, self_);
|
1814
|
|
1815
|
}
|
1816
|
|
1817
|
} else { // jika form error
|
1818
|
|
1819
|
}
|
1820
|
}
|
1821
|
} else {
|
1822
|
data1 = self_.getForm().getValues();
|
1823
|
//cek apakah form terakhir
|
1824
|
if (prog_.totalPage < next_) { // md form sudah selesai
|
1825
|
Ext.Msg.show({
|
1826
|
title: "",
|
1827
|
msg: MinovaMessageData('WD001', ''),
|
1828
|
buttons: Ext.Msg.YESNO,
|
1829
|
icon: Ext.Msg.QUESTION,
|
1830
|
fn: function (choice) {
|
1831
|
console.log(choice);
|
1832
|
if (choice === 'yes') {
|
1833
|
document.getElementById("progressbar").style.width = '100%';
|
1834
|
|
1835
|
//me.saveDataToMD();
|
1836
|
|
1837
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1838
|
if (sukses) {
|
1839
|
var page = 'wizards';
|
1840
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
1841
|
page = 'rcwizards';
|
1842
|
}
|
1843
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
1844
|
var mb = new minovaBlowfish();
|
1845
|
e = mb.minovaEncryptUrl(nextUrl);
|
1846
|
window.open(page + '?' + e, "_self");
|
1847
|
|
1848
|
}
|
1849
|
}
|
1850
|
|
1851
|
}
|
1852
|
});
|
1853
|
} else {
|
1854
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1855
|
if (sukses) {
|
1856
|
//change progress bar
|
1857
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1858
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1859
|
var idx = next_ - 1;
|
1860
|
me.changeProgress(idx, next_, false);
|
1861
|
me.goNextMD(prog_, self_);
|
1862
|
me.setFormValuesAfterNext(self_.WizardFunction, prog_);
|
1863
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1864
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1865
|
|
1866
|
}
|
1867
|
}
|
1868
|
|
1869
|
}
|
1870
|
|
1871
|
}
|
1872
|
}
|
1873
|
}
|
1874
|
});
|
1875
|
} else {
|
1876
|
cekKtp = true; ;
|
1877
|
if (cekKtp) {
|
1878
|
if (self_.WizardFunction == "APPT" || self_.WizardFunction == "EMPI") {
|
1879
|
if (_tbl == 'phrpa0001') {
|
1880
|
// past
|
1881
|
if (self_.getForm().isValid()) {
|
1882
|
//change progress bar
|
1883
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1884
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1885
|
var idx = next_ - 1;
|
1886
|
me.changeProgress(idx, next_, false);
|
1887
|
me.goNextMD(prog_, self_);
|
1888
|
me.setFormValuesAfterNext(self_.wizardFunction, prog_);
|
1889
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1890
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1891
|
} else { // jika form error
|
1892
|
|
1893
|
}
|
1894
|
} else {
|
1895
|
// save data to md
|
1896
|
if (self_.getForm().isValid()) {
|
1897
|
if (_tbl == 'phrpa0002') {
|
1898
|
|
1899
|
Ext.Ajax.request({
|
1900
|
async: false,
|
1901
|
method: 'POST',
|
1902
|
url: '/UserControl/GetStore',
|
1903
|
params: {
|
1904
|
tableName: 'PDSPAWIZDEL',
|
1905
|
param: getParam("id")
|
1906
|
|
1907
|
},
|
1908
|
waitMsg: 'Saving Data...',
|
1909
|
success: function (response) {},
|
1910
|
failure: function (response) {}
|
1911
|
});
|
1912
|
|
1913
|
formName = 'MinovaGridFormEditPHRPA0001';
|
1914
|
data1 = Ext.ComponentQuery.query('[name=' + formName + ']')[0].getForm().getValues();
|
1915
|
var CreateDate = 'CreateDate';
|
1916
|
var CreateDateValue = "";
|
1917
|
var ChangeDate = 'ChangeDate';
|
1918
|
var ChangeDateValue = "";
|
1919
|
|
1920
|
data1[CreateDate] = CreateDateValue;
|
1921
|
data1[ChangeDate] = ChangeDateValue;
|
1922
|
data2 = self_.getForm().getValues();
|
1923
|
data2[CreateDate] = CreateDateValue;
|
1924
|
data2[ChangeDate] = ChangeDateValue;
|
1925
|
} else {
|
1926
|
data1 = self_.getForm().getValues();
|
1927
|
var CreateDate = 'CreateDate';
|
1928
|
var CreateDateValue = "";
|
1929
|
var ChangeDate = 'ChangeDate';
|
1930
|
var ChangeDateValue = "";
|
1931
|
|
1932
|
data1[CreateDate] = CreateDateValue;
|
1933
|
data1[ChangeDate] = ChangeDateValue;
|
1934
|
}
|
1935
|
|
1936
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1937
|
if (sukses) {
|
1938
|
//change progress bar
|
1939
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1940
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1941
|
var idx = next_ - 1;
|
1942
|
me.changeProgress(idx, next_, false);
|
1943
|
me.setFormValuesAfterNext(self_.wizardFunction, prog_);
|
1944
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1945
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1946
|
me.goNextMD(prog_, self_);
|
1947
|
|
1948
|
}
|
1949
|
|
1950
|
} else { // jika form error
|
1951
|
|
1952
|
}
|
1953
|
}
|
1954
|
} else {
|
1955
|
data1 = self_.getForm().getValues();
|
1956
|
//cek apakah form terakhir
|
1957
|
if (prog_.totalPage < next_) { // md form sudah selesai
|
1958
|
Ext.Msg.show({
|
1959
|
title: "",
|
1960
|
msg: MinovaMessageData('WD001', ''),
|
1961
|
buttons: Ext.Msg.YESNO,
|
1962
|
icon: Ext.Msg.QUESTION,
|
1963
|
fn: function (choice) {
|
1964
|
console.log(choice);
|
1965
|
if (choice === 'yes') {
|
1966
|
document.getElementById("progressbar").style.width = '100%';
|
1967
|
|
1968
|
//me.saveDataToMD();
|
1969
|
|
1970
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1971
|
if (sukses) {
|
1972
|
var page = 'wizards';
|
1973
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
1974
|
page = 'rcwizards';
|
1975
|
}
|
1976
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
1977
|
var mb = new minovaBlowfish();
|
1978
|
e = mb.minovaEncryptUrl(nextUrl);
|
1979
|
window.open(page + '?' + e, "_self");
|
1980
|
|
1981
|
}
|
1982
|
}
|
1983
|
|
1984
|
}
|
1985
|
});
|
1986
|
} else {
|
1987
|
var sukses = me.saveDataToMD(self_.tableName, data1, data2);
|
1988
|
if (sukses) {
|
1989
|
//change progress bar
|
1990
|
total_ = ((next_ - 1) / prog_.totalPage) * 100;
|
1991
|
document.getElementById("progressbar").style.width = total_ + '%';
|
1992
|
var idx = next_ - 1;
|
1993
|
me.changeProgress(idx, next_, false);
|
1994
|
me.goNextMD(prog_, self_);
|
1995
|
me.setFormValuesAfterNext(self_.WizardFunction, prog_);
|
1996
|
prog_.setNextMD(prog_.getNextMD() + 1);
|
1997
|
prog_.setPrevMD(prog_.getNextMD() - 1);
|
1998
|
|
1999
|
}
|
2000
|
}
|
2001
|
|
2002
|
}
|
2003
|
|
2004
|
}
|
2005
|
|
2006
|
}
|
2007
|
|
2008
|
},
|
2009
|
goNextMD: function (prog_, form_) {
|
2010
|
var me = this;
|
2011
|
var table_ = form_.tableName.toLowerCase();
|
2012
|
var next_ = prog_.getNextMD() - 1; // id form selanjutnya
|
2013
|
//var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
2014
|
/*
|
2015
|
if (prog_.totalPage <= next_) { // md form sudah selesai
|
2016
|
Ext.Msg.show({
|
2017
|
title: "",
|
2018
|
msg: MinovaMessageData('WD001', ''),
|
2019
|
buttons: Ext.Msg.YESNO,
|
2020
|
icon: Ext.Msg.QUESTION,
|
2021
|
fn: function (choice) {
|
2022
|
console.log(choice);
|
2023
|
if (choice === 'yes') {
|
2024
|
document.getElementById("progressbar").style.width = '100%';
|
2025
|
|
2026
|
//me.saveDataToMD();
|
2027
|
|
2028
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
2029
|
var page = 'wizards';
|
2030
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
2031
|
page = 'rcwizards';
|
2032
|
}
|
2033
|
nextUrl = page + '?' + MinovaUtil.GetMenuID() + '&S=S';
|
2034
|
window.open(nextUrl, "_self");
|
2035
|
}
|
2036
|
|
2037
|
}
|
2038
|
});
|
2039
|
}
|
2040
|
else
|
2041
|
*/
|
2042
|
{
|
2043
|
var next_ = form_.nextMD;
|
2044
|
var _me = next_ - 1;
|
2045
|
var nextPage = Ext.ComponentQuery.query('[itemId=MD' + form_.nextMD + ']')[0];
|
2046
|
var type_ = nextPage.WizardLayout;
|
2047
|
|
2048
|
if (prog_.sukses == true) {
|
2049
|
if (form_.nextMD != 1) {
|
2050
|
//set value form or grid from md
|
2051
|
hisTable = nextPage.tableName;
|
2052
|
var nowDate = MinovaUtil.GetNowDate();
|
2053
|
if (nextPage.WizardFunction == 'APPT') {
|
2054
|
hisTable = "PHRRC" + hisTable.substring(5, 9);
|
2055
|
}
|
2056
|
if (nextPage.WizardLayout == 'G') {
|
2057
|
var empID = getParam("app");
|
2058
|
if (getParam('wizard').substring(0, 1) == 'E') {
|
2059
|
empID = getParam('id');
|
2060
|
}
|
2061
|
var gridHis = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + nextPage.tableName + ']')[0];
|
2062
|
dataForm = null;
|
2063
|
if(hisTable == "PHRRC0008") //// add by Tri nwh 20241113
|
2064
|
{
|
2065
|
Ext.Ajax.request({
|
2066
|
//async: false,
|
2067
|
method: 'POST',
|
2068
|
url: '/UserControl/GetStore',
|
2069
|
params: {
|
2070
|
tableName: hisTable,
|
2071
|
param: 'EmployeeID[=]' + empID
|
2072
|
|
2073
|
},
|
2074
|
success: function (response) {
|
2075
|
var results = Ext.decode(response.responseText);
|
2076
|
dataForm = results.data;
|
2077
|
if (dataForm.length) {
|
2078
|
Ext.each(dataForm, function (rec) {
|
2079
|
rec["EmployeeID"] = getParam('id');
|
2080
|
rec["Flag"] = '0';
|
2081
|
});
|
2082
|
}
|
2083
|
if (gridHis) {
|
2084
|
var gridStore = gridHis.getStore();
|
2085
|
gridStore.loadData(dataForm);
|
2086
|
} else {
|
2087
|
var gridStore = Ext.StoreMgr.lookup("store" + nextPage.tableName);
|
2088
|
gridStore.loadData(dataForm);
|
2089
|
}
|
2090
|
|
2091
|
}
|
2092
|
});
|
2093
|
|
2094
|
}
|
2095
|
else
|
2096
|
{
|
2097
|
Ext.Ajax.request({
|
2098
|
//async: false,
|
2099
|
method: 'POST',
|
2100
|
url: '/UserControl/GetStore',
|
2101
|
params: {
|
2102
|
tableName: hisTable,
|
2103
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + empID
|
2104
|
|
2105
|
},
|
2106
|
success: function (response) {
|
2107
|
var results = Ext.decode(response.responseText);
|
2108
|
dataForm = results.data;
|
2109
|
if (dataForm.length) {
|
2110
|
Ext.each(dataForm, function (rec) {
|
2111
|
rec["EmployeeID"] = getParam('id');
|
2112
|
rec["Flag"] = '0';
|
2113
|
});
|
2114
|
}
|
2115
|
if (gridHis) {
|
2116
|
var gridStore = gridHis.getStore();
|
2117
|
gridStore.loadData(dataForm);
|
2118
|
} else {
|
2119
|
var gridStore = Ext.StoreMgr.lookup("store" + nextPage.tableName);
|
2120
|
gridStore.loadData(dataForm);
|
2121
|
}
|
2122
|
|
2123
|
}
|
2124
|
});
|
2125
|
}
|
2126
|
|
2127
|
} else {
|
2128
|
var form = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + nextPage.tableName + ']')[0];
|
2129
|
}
|
2130
|
form_.setHidden(true);
|
2131
|
nextPage.setHidden(false);
|
2132
|
me.setButton(nextPage);
|
2133
|
} else {
|
2134
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
2135
|
var page = 'wizards';
|
2136
|
if (prog_.wizardFunction.substring(0, 1) == "A") {
|
2137
|
page = 'rcwizards';
|
2138
|
}
|
2139
|
nextUrl = MinovaUtil.GetMenuID() + '&S=S';
|
2140
|
var mb = new minovaBlowfish();
|
2141
|
e = mb.minovaEncryptUrl(nextUrl);
|
2142
|
window.open(page + '?' + e, "_self");
|
2143
|
}
|
2144
|
|
2145
|
} else if (table_ == 'phrpa0001' || table_ == 'phrpa0002') {
|
2146
|
form_.setHidden(true);
|
2147
|
nextPage.setHidden(false);
|
2148
|
me.setButton(nextPage);
|
2149
|
}
|
2150
|
|
2151
|
}
|
2152
|
},
|
2153
|
saveDataToMD: function (tableName, data1, data2) {
|
2154
|
var prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
2155
|
var sukses = false;
|
2156
|
var TblApp = tableName.toLowerCase().substring(0, 5);
|
2157
|
if (getParam('wizard') == 'A900') {
|
2158
|
var EmployeeID = 'EmployeeID';
|
2159
|
var EmployeeIDValue = getParam('id');
|
2160
|
data1[EmployeeID] = EmployeeIDValue;
|
2161
|
if (data2 != undefined) {
|
2162
|
var EmployeeID = 'EmployeeID';
|
2163
|
var EmployeeIDValue = getParam('id');
|
2164
|
data2[EmployeeID] = EmployeeIDValue;
|
2165
|
}
|
2166
|
}
|
2167
|
|
2168
|
var CreateDate = 'CreateDate';
|
2169
|
var CreateDateValue = "";
|
2170
|
var ChangeDate = 'ChangeDate';
|
2171
|
var ChangeDateValue = "";
|
2172
|
data1[CreateDate] = CreateDateValue;
|
2173
|
data1[ChangeDate] = ChangeDateValue;
|
2174
|
if (data2 == undefined) {
|
2175
|
|
2176
|
if (prog_.sukses = true || TblApp == 'phrrc') {
|
2177
|
Ext.Ajax.request({
|
2178
|
async: false,
|
2179
|
method: 'POST',
|
2180
|
url: '/Devt/SaveTable',
|
2181
|
params: {
|
2182
|
tableName: tableName,
|
2183
|
data: Ext.encode(data1),
|
2184
|
action: 0
|
2185
|
},
|
2186
|
waitMsg: 'Saving Data...',
|
2187
|
success: function (response) {
|
2188
|
var result = Ext.decode(response.responseText);
|
2189
|
if (result.success) {
|
2190
|
// MinovaMessage('Not Null', '000006', '', 'S');
|
2191
|
sukses = true;
|
2192
|
//send mail
|
2193
|
var _param = {
|
2194
|
serviceName: 'ERecruitmentAuthentication.asmx',
|
2195
|
methodName: 'SendMailChangeMD',
|
2196
|
parameter: 'TableName=' + tableName + '&EmployeeID=' + data1.EmployeeID
|
2197
|
|
2198
|
};
|
2199
|
|
2200
|
//var results = null;
|
2201
|
Ext.Ajax.request({
|
2202
|
method: 'post',
|
2203
|
type: 'ajax',
|
2204
|
params: _param,
|
2205
|
url: '/InvokeService/Invoke/',
|
2206
|
loadMask: {
|
2207
|
msg: 'please wait...'
|
2208
|
},
|
2209
|
success: function (response) {}
|
2210
|
});
|
2211
|
} else {
|
2212
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2213
|
sukses = false;
|
2214
|
}
|
2215
|
},
|
2216
|
failure: function (response) {
|
2217
|
var result = Ext.decode(response.responseText);
|
2218
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2219
|
sukses = false;
|
2220
|
}
|
2221
|
});
|
2222
|
} else {}
|
2223
|
} else {
|
2224
|
data2[CreateDate] = CreateDateValue;
|
2225
|
data2[ChangeDate] = ChangeDateValue;
|
2226
|
Ext.Ajax.request({
|
2227
|
async: false,
|
2228
|
method: 'POST',
|
2229
|
url: '/Devt/SaveTable',
|
2230
|
params: {
|
2231
|
tableName: 'phrpa0001',
|
2232
|
data: Ext.encode(data1),
|
2233
|
action: 0
|
2234
|
},
|
2235
|
waitMsg: 'Saving Data...',
|
2236
|
success: function (response) {
|
2237
|
var result = Ext.decode(response.responseText);
|
2238
|
if (result.success) {
|
2239
|
// MinovaMessage('Not Null', '000006', '', 'S');
|
2240
|
sukses = true;
|
2241
|
} else {
|
2242
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2243
|
}
|
2244
|
},
|
2245
|
failure: function (response) {
|
2246
|
var result = Ext.decode(response.responseText);
|
2247
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2248
|
}
|
2249
|
});
|
2250
|
if (sukses) {
|
2251
|
Ext.Ajax.request({
|
2252
|
async: false,
|
2253
|
method: 'POST',
|
2254
|
url: '/Devt/SaveTable',
|
2255
|
params: {
|
2256
|
tableName: 'PHRPA0002',
|
2257
|
data: Ext.encode(data2),
|
2258
|
action: 0
|
2259
|
},
|
2260
|
waitMsg: 'Saving Data...',
|
2261
|
success: function (response) {
|
2262
|
var result = Ext.decode(response.responseText);
|
2263
|
if (result.success) {
|
2264
|
// MinovaMessage('Not Null', '000006', '', 'S');
|
2265
|
sukses = true;
|
2266
|
} else {
|
2267
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2268
|
sukses = false;
|
2269
|
}
|
2270
|
},
|
2271
|
failure: function (response) {
|
2272
|
var result = Ext.decode(response.responseText);
|
2273
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2274
|
}
|
2275
|
});
|
2276
|
}
|
2277
|
|
2278
|
//save md 15
|
2279
|
var app = getParam('app');
|
2280
|
if (app === "null") {
|
2281
|
app = '';
|
2282
|
}
|
2283
|
var _date = Ext.ComponentQuery.query('[name=MinovaGridFormEditPHRPA0002]')[0].getValues().StartDate;
|
2284
|
data = {
|
2285
|
EmployeeID: getParam('id'),
|
2286
|
PaymentUpTo: '',
|
2287
|
RetroDate: _date,
|
2288
|
HiringDate: _date,
|
2289
|
ApplicantID: app,
|
2290
|
CorrectStatus: '1'
|
2291
|
};
|
2292
|
Ext.Ajax.request({
|
2293
|
async: false,
|
2294
|
method: 'POST',
|
2295
|
url: '/Devt/SaveTable',
|
2296
|
params: {
|
2297
|
tableName: 'phrpa0015',
|
2298
|
data: Ext.encode(data),
|
2299
|
action: 0
|
2300
|
},
|
2301
|
waitMsg: 'Saving Data...',
|
2302
|
success: function (response) {
|
2303
|
var result = Ext.decode(response.responseText);
|
2304
|
if (result.success) {
|
2305
|
// MinovaMessage('Not Null', '000006', '', 'S');
|
2306
|
sukses = true;
|
2307
|
} else {
|
2308
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2309
|
sukses = false;
|
2310
|
}
|
2311
|
},
|
2312
|
failure: function (response) {
|
2313
|
var result = Ext.decode(response.responseText);
|
2314
|
MinovaMessage('', '000005', result.message.text, 'E');
|
2315
|
}
|
2316
|
});
|
2317
|
|
2318
|
}
|
2319
|
prog_.sukses = sukses;
|
2320
|
return (sukses);
|
2321
|
},
|
2322
|
|
2323
|
setFormValuesAfterNext: function (WizardFunction, prog_) {
|
2324
|
var nowDate = MinovaUtil.GetNowDate();
|
2325
|
//var data_ = JSON.parse(localStorage.getItem(datatable));
|
2326
|
var me = this;
|
2327
|
var next_ = prog_.getNextMD()
|
2328
|
|
2329
|
if (Ext.ComponentQuery.query('[itemId=MD' + next_ + ']')[0]) {
|
2330
|
var nextPage = Ext.ComponentQuery.query('[itemId=MD' + next_ + ']')[0];
|
2331
|
var type_ = nextPage.WizardLayout;
|
2332
|
var tabl_ = nextPage.tableName;
|
2333
|
switch (nextPage.WizardFunction) {
|
2334
|
case "APP":
|
2335
|
var tabl_ = nextPage.tableName;
|
2336
|
me.getLastValue(tabl_, type_);
|
2337
|
break
|
2338
|
case "APPI":
|
2339
|
|
2340
|
break
|
2341
|
case "APPT":
|
2342
|
var tabl_ = prog_.allTable[next_ - 1];
|
2343
|
tbl_ = "PHRRC" + tabl_.substring(5, 9);
|
2344
|
paData = "PHRPA" + tabl_.substring(5, 9);
|
2345
|
me.getLastValueAPPT(tbl_, type_, paData);
|
2346
|
break
|
2347
|
case "EMP":
|
2348
|
var tabl_ = nextPage.tableName;
|
2349
|
me.getLastValue(tabl_, type_);
|
2350
|
break
|
2351
|
case "EMPI":
|
2352
|
|
2353
|
break
|
2354
|
default:
|
2355
|
break
|
2356
|
}
|
2357
|
if (type_ == "F") {
|
2358
|
me.setValueFromParameter(nextPage);
|
2359
|
}
|
2360
|
|
2361
|
}
|
2362
|
},
|
2363
|
|
2364
|
getLastValueAPPT: function (nextTable, type_, paData) {
|
2365
|
var nowDate = MinovaUtil.GetNowDate();
|
2366
|
if (type_ == "F") {
|
2367
|
Ext.Ajax.request({
|
2368
|
async: false,
|
2369
|
method: 'POST',
|
2370
|
url: '/UserControl/GetStore',
|
2371
|
params: {
|
2372
|
tableName: nextTable,
|
2373
|
//param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("app")
|
2374
|
param: 'EmployeeID[=]' + getParam("app")
|
2375
|
|
2376
|
},
|
2377
|
success: function (response) {
|
2378
|
var results = Ext.decode(response.responseText);
|
2379
|
dataForm = results.data[0];
|
2380
|
var _form = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + paData + ']')[0]
|
2381
|
var form_ = _form.getForm();
|
2382
|
if (nextTable == 'PHRRC0002') {
|
2383
|
dataForm.Organization = '';
|
2384
|
dataForm.Position = '';
|
2385
|
dataForm.Job = '';
|
2386
|
dataForm.CostCenter = '';
|
2387
|
dataForm.CostCenter = '';
|
2388
|
}
|
2389
|
form_.setValues(dataForm);
|
2390
|
var temData = JSON.parse(localStorage.getItem('selectionValues'));
|
2391
|
console.log(nextTable);
|
2392
|
if (nextTable.toLowerCase == "phrpa0002") {
|
2393
|
form_.findField('StartDate').setValue(temData.EffectiveDate);
|
2394
|
form_.findField('CompanyID').setValue(temData.CompanyID);
|
2395
|
form_.findField('PayrollGroup').setValue(temData.PayrollGroup);
|
2396
|
form_.findField('MovementReason').setValue(temData.Reason);
|
2397
|
}
|
2398
|
else if (nextTable.toLowerCase == "phrpa0001" || nextTable.toLowerCase == "phrpa0003" || nextTable.toLowerCase == "phrpa0004") { console.log('woohyun');
|
2399
|
form_.findField('StartDate').setValue(temData.EffectiveDate); ////---- add by Tri nwh 20220419, for PA1,PA2,PA3,PA4,PA5 startdate sesuai effective date
|
2400
|
}
|
2401
|
else if (nextTable == 'PHRRC0002') { console.log('jinyoung');
|
2402
|
form_.findField('StartDate').setValue(temData.EffectiveDate); ////---- add by Tri nwh 20220425, untuk hiring date sesuai effective date
|
2403
|
}
|
2404
|
else { console.log('seunghyun');
|
2405
|
//form_.findField('StartDate').setValue(temData.EffectiveDate); ////---- comment by Tri nwh 20220419, selain PA1,PA2,PA3,PA4,PA5 startdate tidak sesuai effective date
|
2406
|
}
|
2407
|
}
|
2408
|
});
|
2409
|
} else {
|
2410
|
Ext.Ajax.request({
|
2411
|
async: false,
|
2412
|
method: 'POST',
|
2413
|
url: '/UserControl/GetStore',
|
2414
|
params: {
|
2415
|
tableName: nextTable,
|
2416
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("id")
|
2417
|
|
2418
|
},
|
2419
|
success: function (response) {
|
2420
|
var results = Ext.decode(response.responseText);
|
2421
|
var data_ = results.data;
|
2422
|
var gridStore = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + paData + ']')[0].getStore();
|
2423
|
gridStore.loadData(data_);
|
2424
|
|
2425
|
}
|
2426
|
});
|
2427
|
}
|
2428
|
},
|
2429
|
|
2430
|
getLastValue: function (nextTable, type_) {
|
2431
|
var nowDate = MinovaUtil.GetNowDate();
|
2432
|
if (type_ == "F") {
|
2433
|
Ext.Ajax.request({
|
2434
|
async: false,
|
2435
|
method: 'POST',
|
2436
|
url: '/UserControl/GetStore',
|
2437
|
params: {
|
2438
|
tableName: nextTable,
|
2439
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("id")
|
2440
|
|
2441
|
},
|
2442
|
success: function (response) {
|
2443
|
var results = Ext.decode(response.responseText);
|
2444
|
dataForm = results.data[0];
|
2445
|
var _form = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + nextTable + ']')[0]
|
2446
|
var form_ = _form.getForm();
|
2447
|
form_.setValues(dataForm);
|
2448
|
var temData = JSON.parse(localStorage.getItem('selectionValues'));
|
2449
|
|
2450
|
if (nextTable.toLowerCase == "phrpa0002") {
|
2451
|
form_.findField('StartDate').setValue(temData.EffectiveDate);
|
2452
|
form_.findField('CompanyID').setValue(temData.CompanyID);
|
2453
|
form_.findField('PayrollGroup').setValue(temData.PayrollGroup);
|
2454
|
form_.findField('MovementReason').setValue(temData.Reason);
|
2455
|
} else {
|
2456
|
form_.findField('StartDate').setValue(temData.EffectiveDate); console.log('jinyoung');
|
2457
|
}
|
2458
|
}
|
2459
|
});
|
2460
|
} else {
|
2461
|
Ext.Ajax.request({
|
2462
|
async: false,
|
2463
|
method: 'POST',
|
2464
|
url: '/UserControl/GetStore',
|
2465
|
params: {
|
2466
|
tableName: nextTable,
|
2467
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("id")
|
2468
|
|
2469
|
},
|
2470
|
success: function (response) {
|
2471
|
var results = Ext.decode(response.responseText);
|
2472
|
var data_ = results.data;
|
2473
|
var gridStore = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + nextTable + ']')[0].getStore();
|
2474
|
gridStore.loadData(data_);
|
2475
|
|
2476
|
}
|
2477
|
});
|
2478
|
}
|
2479
|
},
|
2480
|
|
2481
|
setButton: function (nextPage) {
|
2482
|
|
2483
|
prog_ = Ext.ComponentQuery.query('[name=pnlProgress]')[0];
|
2484
|
id_ = parseInt(nextPage.itemId.substring(2, 3));
|
2485
|
Ext.ComponentQuery.query('[name=prevWizard]')[0].setDisabled(false);
|
2486
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(false);
|
2487
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(false);
|
2488
|
|
2489
|
if (nextPage.mandatory == "1") {
|
2490
|
//if (nextPage.nextMD == 1) {
|
2491
|
// Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
2492
|
// Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
2493
|
|
2494
|
//} else {
|
2495
|
// Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
2496
|
// Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
2497
|
|
2498
|
//}
|
2499
|
|
2500
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
2501
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
2502
|
|
2503
|
} else {
|
2504
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(false);
|
2505
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(false);
|
2506
|
}
|
2507
|
|
2508
|
if (id_ == prog_.totalPage) {
|
2509
|
Ext.ComponentQuery.query('[name=skipWizard]')[0].setDisabled(true);
|
2510
|
Ext.ComponentQuery.query('[name=skipAllWizard]')[0].setDisabled(true);
|
2511
|
}
|
2512
|
},
|
2513
|
ChangeApp: function () {
|
2514
|
Ext.Ajax.request({
|
2515
|
async: false,
|
2516
|
method: 'POST',
|
2517
|
url: '/UserControl/GetStore',
|
2518
|
params: {
|
2519
|
tableName: "PHRRC0002",
|
2520
|
param: 'StartDate[<=]' + MinovaUtil.GetNowDate() + ',EndDate[>=]' + MinovaUtil.GetNowDate() + ',EmployeeID[=]' + Ext.ComponentQuery.query('[name=ApplicantID]')[0].getValue()
|
2521
|
|
2522
|
},
|
2523
|
success: function (response) {
|
2524
|
var results = Ext.decode(response.responseText);
|
2525
|
var data = results.data;
|
2526
|
if (data != null && data.length > 0) {
|
2527
|
var data_ = results.data[0];
|
2528
|
Ext.ComponentQuery.query('[name=CompanyID]')[0].setValue(data_.CompanyID);
|
2529
|
}
|
2530
|
}
|
2531
|
});
|
2532
|
},
|
2533
|
});
|