1
|
/*
|
2
|
Run this script on:
|
3
|
|
4
|
remote.minovais.com, 1452.Bintang_Temp - This database will be modified
|
5
|
|
6
|
to synchronize it with:
|
7
|
|
8
|
remote.minovais.com, 1452.MinovaHR_Indomobil_Prod
|
9
|
|
10
|
You are recommended to back up your database before running this script
|
11
|
|
12
|
Script created by SQL Data Compare version 15.0.9.23488 from Red Gate Software Ltd at 27/12/2023 19.14.35
|
13
|
|
14
|
*/
|
15
|
|
16
|
SET NUMERIC_ROUNDABORT OFF
|
17
|
GO
|
18
|
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON
|
19
|
GO
|
20
|
SET DATEFORMAT YMD
|
21
|
GO
|
22
|
SET XACT_ABORT ON
|
23
|
GO
|
24
|
SET TRANSACTION ISOLATION LEVEL Serializable
|
25
|
GO
|
26
|
BEGIN TRANSACTION
|
27
|
|
28
|
PRINT(N'Add rows to [dbo].[dev_object]')
|
29
|
INSERT INTO [dbo].[dev_object] ([instance], [name], [type], [version], [active], [locked], [application], [module], [submodule], [object], [view], [code_dev], [code_prod], [description], [create_by], [create_datetime], [change_by], [change_datetime]) VALUES (N'00000', N'controller.wf.leave.leave', N'controller', N'1.0.0.6', N'1', N'0', N'wf', N'leave', N'', N'leave', N'', N'Ext.define(''MinovaIS.ERP.Web.controller.wf.leave.leave'', {
|
30
|
extend: ''Ext.app.Controller'',
|
31
|
store: [''wf.leave.LeaveConf''],
|
32
|
views: [''wf.leave.leave''],
|
33
|
config: {
|
34
|
delegate_mode: 2
|
35
|
},
|
36
|
init: function () {
|
37
|
this.control({
|
38
|
''wf-leave-leave'': {
|
39
|
afterrender: this.onAfterRender
|
40
|
},
|
41
|
''wf-leave-leave button[action=lookupEmpOnDelegateLeave]'': {
|
42
|
click: this.showEmployeeLeave
|
43
|
},
|
44
|
''wf-leave-leave combobox[name=main_absence_type]'': {
|
45
|
select: this.selectAbsenceType
|
46
|
},
|
47
|
''wf-leave-leave textfield[name=main_start_date]'': {
|
48
|
change: this.ValidasiMaksimaPengajuan
|
49
|
},
|
50
|
''wf-leave-leave textfield[name=main_end_date]'': {
|
51
|
change: this.changeDateRange
|
52
|
},
|
53
|
''employee_id textfield[name=employee_id]'': {
|
54
|
change: this.changeDateRange
|
55
|
},
|
56
|
''wf-leave-leave combo[name=list_of_delegate]'': {
|
57
|
select: this.selecttDelegation
|
58
|
|
59
|
}
|
60
|
});
|
61
|
},
|
62
|
onDocumentInit: function (me) {
|
63
|
switch (me.config.delegate_mode) {
|
64
|
case 0:
|
65
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=lookup_of_delegate]'').hide();
|
66
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=list_of_delegate]'').hide();
|
67
|
break
|
68
|
case 1:
|
69
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=lookup_of_delegate]'').hide()
|
70
|
break
|
71
|
case 2:
|
72
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=list_of_delegate]'').hide();
|
73
|
break
|
74
|
default:
|
75
|
break
|
76
|
}
|
77
|
var btn_lookup_delegate = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=lookup_of_delegate]'');
|
78
|
btn_lookup_delegate.on(''click'', function () {
|
79
|
var popupEmployee = this.getController(''popup.employee.employee'');
|
80
|
popupEmployee.onSelect = function (recs) {
|
81
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=delegate_delegate_id]'').setValue(recs.data.code);
|
82
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=delegate_delegate_name]'').setValue(recs.data.desc);
|
83
|
|
84
|
}
|
85
|
popupEmployee.showPopup();
|
86
|
}, me)
|
87
|
|
88
|
},
|
89
|
onDocumentReady: function (me) {
|
90
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
91
|
var taskId = MinovaUtil.WORKFLOW.getTaskId();
|
92
|
var listTaskFormEnabled = ['''', ''create'', ''start'', ''revise_creator'', ''creator_confirm'', ''revise_after_confirm_dirspv'', ''revise_after_rd'', ''revise_creator_back'']
|
93
|
|
94
|
body.down(''[name=main_absence_type]'').store.load({
|
95
|
params: {
|
96
|
paramid: ''combobox_lv_absencetype'',
|
97
|
emp_id: MinovaUtil.WORKFLOW.getEmpId()
|
98
|
},
|
99
|
callback: function () {
|
100
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''combo[name=main_absence_type]'').setValue(MinovaUtil.WORKFLOW.getRegValuesByName(''main_absence_type''))
|
101
|
}
|
102
|
});
|
103
|
|
104
|
if (listTaskFormEnabled.indexOf(taskId) < 0) {
|
105
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
106
|
}
|
107
|
|
108
|
},
|
109
|
|
110
|
onDocumentBeforeSubmit: function (submit, taskId, me) {
|
111
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
112
|
var absence_type = body.down(''[name=main_absence_type]'').getValue();
|
113
|
var lvbolehbackdated = [''0001'', ''0002'', ''1100'', ''1200'', ''3900'', ''CL5'', ''CL6'', ''CL7''];
|
114
|
var qdeduc = body.down(''[name=main_quota_deduction]'').getValue();
|
115
|
|
116
|
if (qdeduc = ''Y'') {
|
117
|
MinovaUtil.executeParamQuery({
|
118
|
paramid: "leave_update_remaining_quota_save",
|
119
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
120
|
landscape: ''100'',
|
121
|
start_date: body.down(''[name=main_quota_start_date]'').getValue(),
|
122
|
end_date: body.down(''[name=main_quota_end_date]'').getValue(),
|
123
|
start_date2: body.down(''[name=main_quota_start_date_2]'').getValue(),
|
124
|
end_date2: body.down(''[name=main_quota_end_date_2]'').getValue(),
|
125
|
quota_type: body.down(''[name=main_quota_type]'').getValue(),
|
126
|
quota_taken: body.down(''[name=main_quota_taken]'').getValue(),
|
127
|
quota_taken2: body.down(''[name=main_quota_taken_2]'').getValue()
|
128
|
}, function (s) {
|
129
|
var data = Ext.decode(s.responseText).data[0];
|
130
|
var formLeave = body.down(''form[name=Leave_Main]'').getForm();
|
131
|
formLeave.setValues(data);
|
132
|
}, function (f) {});
|
133
|
}
|
134
|
|
135
|
if (taskId === ''start'' || taskId === '''' || taskId === ''create'') {
|
136
|
var sdate = body.down(''[name=main_start_date]'');
|
137
|
var edate = body.down(''[name=main_end_date]'');
|
138
|
var now = Ext.Date.format(new Date(), ''Ymd'');
|
139
|
|
140
|
if (lvbolehbackdated.indexOf(absence_type) < 0 && (sdate.getValue() < now || edate.getValue() < now)) {
|
141
|
alert("Leave Cannot be backdated. Please adjust field Start Date or End Date");
|
142
|
} else
|
143
|
me.validasi_cuti_tahunan(submit);
|
144
|
} else
|
145
|
me.validasi_cuti_tahunan(submit);
|
146
|
|
147
|
},
|
148
|
selecttDelegation: function (_this, recs, opt) {
|
149
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
150
|
Body.down(''textfield[name=delegate_delegate_id]'').setValue(recs[0].data.emp_id);
|
151
|
Body.down(''textfield[name=delegate_delegate_name]'').setValue(recs[0].data.fullname);
|
152
|
},
|
153
|
|
154
|
now8: function () {
|
155
|
Ext.global.console.log(''>>now8'');
|
156
|
return Ext.Date.format(new Date(), ''Ymd'');
|
157
|
},
|
158
|
GetDateDiff: function (EndDate, StartDate) {
|
159
|
var DateI = new Date(EndDate.substring(4, 6) + "/" + EndDate.substring(6, 8) + "/" + EndDate.substring(0, 4));
|
160
|
var Date2 = new Date(StartDate.substring(4, 6) + "/" + StartDate.substring(6, 8) + "/" + StartDate.substring(0, 4));
|
161
|
var DiffDays = parseInt((DateI - Date2) / (1000 * 60 * 60 * 24));
|
162
|
return DiffDays;
|
163
|
},
|
164
|
|
165
|
onAfterRender: function (_this) {
|
166
|
Ext.global.console.log(''>>onAfterRender'', _this);
|
167
|
var me = this;
|
168
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow()
|
169
|
|
170
|
body.down(''combo[name=main_absence_type]'').store.on(''beforeload'', function (store, operation, eOpts) {
|
171
|
store.proxy.extraParams = {
|
172
|
paramid: ''combobox_lv_absencetype'',
|
173
|
emp_id: MinovaUtil.WORKFLOW.getEmpId()
|
174
|
};
|
175
|
});
|
176
|
var header = _this.up(''panel[name=content]'').down(''panel[name=wf_form_header]'');
|
177
|
|
178
|
var taskId = header.down(''textfield[name=task_id_run]'');
|
179
|
var empId = header.down(''textfield[name=employee_id]'');
|
180
|
if (empId !== undefined)
|
181
|
empId.on(''change'', me.onBehalfEmpId, me);
|
182
|
Ext.global.console.log(''<<onAfterRender'', _this);
|
183
|
},
|
184
|
|
185
|
onBehalfEmpId: function (field, newValue, oldValue, eOpts) {
|
186
|
this.changeDelegate(field, newValue, oldValue, eOpts);
|
187
|
Ext.global.console.log(''>>onBehalfEmpId'', field);
|
188
|
this.getDelegate(field, newValue, oldValue, eOpts);
|
189
|
this.getStoreAbsence(field, newValue, oldValue, eOpts);
|
190
|
if (MinovaUtil.WORKFLOW.isRequest()) {
|
191
|
this.clearMainForm(field, newValue, oldValue, eOpts);
|
192
|
}
|
193
|
this.changeValue(
|
194
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_remaining_quota]'')[0], newValue, oldValue, eOpts);
|
195
|
Ext.global.console.log(''<<onBehalfEmpId'', field);
|
196
|
},
|
197
|
|
198
|
changeDelegate: function (_this, newVal, oldVal) {
|
199
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
200
|
var main_delegate = body.down(''textfield[name=main_delegate_emp_from]'');
|
201
|
main_delegate.setValue(newVal);
|
202
|
},
|
203
|
onBehalfTaskId: function (field, newValue, oldValue, eOpts) {
|
204
|
Ext.global.console.log(''>>onBehalfTaskId'', field);
|
205
|
this.leaveConfSet(field, newValue, oldValue, eOpts);
|
206
|
Ext.global.console.log(''<<onBehalfTaskId'', field);
|
207
|
},
|
208
|
|
209
|
leaveConfSet: function (field, newValue, oldValue, eOpts) {
|
210
|
Ext.global.console.log(''>>leaveConfSet'', field);
|
211
|
var leaveConf = field.up().up().up().query(''wf-leave-leave combobox[name=main_leave_confirmation]'')[0];
|
212
|
|
213
|
switch (newValue) {
|
214
|
case ''creator_confirm'':
|
215
|
leaveConf.show();
|
216
|
break;
|
217
|
case ''apv_ds2'':
|
218
|
leaveConf.show();
|
219
|
leaveConf.setReadOnly(true);
|
220
|
break;
|
221
|
}
|
222
|
Ext.global.console.log(''<<leaveConfSet'', field);
|
223
|
},
|
224
|
|
225
|
onLeaveInbox: function (field, newValue, oldValue, eOpts) {
|
226
|
Ext.global.console.log(''>>onLeaveInbox'', field);
|
227
|
this.getStoreAbsence(field, newValue, oldValue, eOpts);
|
228
|
Ext.global.console.log(''<<onLeaveInbox'', field);
|
229
|
},
|
230
|
|
231
|
clearMainForm: function (field, newValue, oldValue, eOpts) {
|
232
|
Ext.global.console.log(''>>beforedestroyleaveConf'', field);
|
233
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_leave_quota]'')[0].setValue(0);
|
234
|
|
235
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_remaining_quota]'')[0].setValue(0);
|
236
|
|
237
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_total_remaining_quota]'')[0].setValue(0);
|
238
|
|
239
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_absence_type]'')[0].setValue('''');
|
240
|
|
241
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_quota_type]'')[0].setValue('''');
|
242
|
Ext.global.console.log(''<<beforedestroyleaveConf'', field);
|
243
|
},
|
244
|
|
245
|
getStoreAbsence: function (field, newValue, oldValue, eOpts) {
|
246
|
var me = this;
|
247
|
Ext.global.console.log(''>>getStoreAbsence'', field);
|
248
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''combo[name=main_absence_type]'').store.load();
|
249
|
|
250
|
me.changeDateRange(field, newValue, oldValue, eOpts);
|
251
|
Ext.global.console.log(''<<getStoreAbsence'', field);
|
252
|
},
|
253
|
|
254
|
getDelegate: function (field, newValue, oldValue, eOpts) {
|
255
|
Ext.global.console.log(''<<getDelegate'', field);
|
256
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
257
|
var me = this;
|
258
|
Ext.Ajax.request({
|
259
|
scope: me,
|
260
|
url: ''/Workflow/LoadDataQuery'',
|
261
|
method: ''POST'',
|
262
|
params: {
|
263
|
paramid: ''##Autofill_leave_delegate'',
|
264
|
emp_id: newValue
|
265
|
},
|
266
|
success: function (response, opts) {
|
267
|
var obj = Ext.decode(response.responseText).data;
|
268
|
if (obj === undefined || obj.length === 0)
|
269
|
return;
|
270
|
try {
|
271
|
var cbDelegate = Body.down(''combo[name=list_of_delegate]'');
|
272
|
cbDelegate.store.loadData(obj);
|
273
|
if (MinovaUtil.WORKFLOW.getTaskId() === ''start'') {
|
274
|
cbDelegate.select(obj[0].emp_id);
|
275
|
Body.down(''textfield[name=delegate_delegate_id]'').setValue(obj[0].emp_id);
|
276
|
Body.down(''textfield[name=delegate_delegate_name]'').setValue(obj[0].fullname);
|
277
|
return;
|
278
|
}
|
279
|
|
280
|
} catch (comp) {}
|
281
|
},
|
282
|
failure: function (response, opts) {}
|
283
|
});
|
284
|
me.changeDateRange(field, newValue, oldValue, eOpts);
|
285
|
Ext.global.console.log(''>>getDelegate'', field);
|
286
|
},
|
287
|
|
288
|
changeValue: function (field, newValue, oldValue, eOpts) {
|
289
|
Ext.global.console.log(''>>changeValue'', field);
|
290
|
try {
|
291
|
var remainQuota = field.up().query(''textfield[name=main_remaining_quota]'')[0].value;
|
292
|
var totalTakenQuota = field.up().query(''textfield[name=main_total_quota_taken]'')[0].value;
|
293
|
field.up().query(''textfield[name=main_total_remaining_quota]'')[0].setValue(remainQuota - totalTakenQuota);
|
294
|
} catch (e) {}
|
295
|
|
296
|
Ext.global.console.log(''<<changeValue'', field);
|
297
|
},
|
298
|
|
299
|
changeDateRange: function (field, newValue, oldValue, eOpts) {
|
300
|
if (!MinovaUtil.WORKFLOW.isRequest())
|
301
|
if (Ext.isEmpty(oldValue) || oldValue == 0)
|
302
|
return;
|
303
|
|
304
|
var me = this;
|
305
|
me.calculate(field, newValue, oldValue, eOpts);
|
306
|
var taskid = MinovaUtil.WORKFLOW.getTaskId();
|
307
|
|
308
|
},
|
309
|
|
310
|
calculateCutiKhusus: function () {
|
311
|
|
312
|
var me = this;
|
313
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
314
|
var absence_type = Body.down(''[name=main_absence_type]'').getValue();
|
315
|
var start_cuti = Body.down(''[name=main_start_date]'').getValue();
|
316
|
var end_cuti = Body.down(''[name=main_end_date]'').getValue();
|
317
|
|
318
|
if (start_cuti !== '''' && end_cuti !== '''') {
|
319
|
MinovaUtil.executeParamQuery({
|
320
|
paramid: "leave_cuti_khusus_calculation",
|
321
|
absence_type: absence_type,
|
322
|
start_cuti: start_cuti,
|
323
|
end_cuti: end_cuti,
|
324
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
325
|
reg_id: MinovaUtil.WORKFLOW.getRegId()
|
326
|
}, function (s) {
|
327
|
var data = Ext.decode(s.responseText).data[0];
|
328
|
var formLeave = Body.down(''form[name=Leave_Main]'').getForm();
|
329
|
MinovaUtil.WORKFLOW.setViewBodyWorkflowFormContent(data);
|
330
|
|
331
|
}, function (f) {});
|
332
|
}
|
333
|
|
334
|
},
|
335
|
|
336
|
selectAbsenceType: function (combo, eOpts) {
|
337
|
Ext.global.console.log(''>>selectAbsenceType'', combo);
|
338
|
var me = this;
|
339
|
var fHeader = me.getFormHeader();
|
340
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
341
|
Body.down(''[name=main_start_date]'').setValue('''');
|
342
|
Body.down(''[name=main_end_date]'').setValue('''');
|
343
|
|
344
|
combo.up().up().query(''textfield[name=main_quota_type]'')[0].setValue(combo.displayTplData[0].quota_type);
|
345
|
Body.down(''[name=main_quota_deduction]'').setValue(combo.displayTplData[0].quotadeduction);
|
346
|
|
347
|
MinovaUtil.executeParamQuery({
|
348
|
paramid: "combobox_lv_block_continue",
|
349
|
emp_id: fHeader.requester_id,
|
350
|
now: me.now8(),
|
351
|
quota_type: combo.displayTplData[0].quota_type
|
352
|
}, function (s) {
|
353
|
var obj2 = Ext.decode(s.responseText).data[0];
|
354
|
Body.down(''[name=main_block_contain]'').setValue(obj2.result);
|
355
|
}, function (f) {});
|
356
|
|
357
|
me.changeDateRange(combo, '''', '''', '''');
|
358
|
Ext.global.console.log(''<<selectAbsenceType'', combo);
|
359
|
},
|
360
|
|
361
|
expandAbsenceType: function (field, eOpts) {
|
362
|
Ext.global.console.log(''<<expandAbsenceType'', field);
|
363
|
var me = this;
|
364
|
field.store.load({
|
365
|
params: {
|
366
|
emp_id: me.up().down(''wf-request-formHeader textfield[name=employee_id]'').value
|
367
|
}
|
368
|
});
|
369
|
Ext.global.console.log(''<<expandAbsenceType'', field);
|
370
|
},
|
371
|
|
372
|
showEmployeeLeave: function (_this) {
|
373
|
Ext.global.console.log(''<<showEmployeeLeave'', _this);
|
374
|
var me = this;
|
375
|
var viewID = _this.up(''wf-leave-leave'').id;
|
376
|
me.viewNYA = Ext.ComponentQuery.query(''wf-leave-leave[id='' + viewID + '']'')[0];
|
377
|
var _appname = ''MinovaIS.ERP.Web.'';
|
378
|
var _ctrlname = _appname + ''controller.popup.employee.employee'';
|
379
|
var _popUploadCtrl = this.getController(_ctrlname);
|
380
|
var tempAbout = _popUploadCtrl.about();
|
381
|
_popUploadCtrl.refCode = Ext.ComponentQuery.query(''wf-leave-leave textfield[name=wfl_txt_delegate_id]'')[0];
|
382
|
_popUploadCtrl.refDesc = Ext.ComponentQuery.query(''wf-leave-leave textfield[name=wfl_txt_delegate_name]'')[0];
|
383
|
|
384
|
var _popUploadView = Ext.create(_appname + ''view.'' + _popUploadCtrl.views[0]);
|
385
|
|
386
|
_popUploadView.show();
|
387
|
Ext.global.console.log(''<<showEmployeeLeave'', _this);
|
388
|
},
|
389
|
|
390
|
calculate: function (field, newValue, oldValue, eOpts) {
|
391
|
var reg = MinovaUtil.WORKFLOW.getRegId();
|
392
|
var reg_id = 0;
|
393
|
if (reg != "") {
|
394
|
reg_id = parseInt(reg);
|
395
|
}
|
396
|
|
397
|
function leaveCheckDate() {
|
398
|
var valSD = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_start_date]'').getValue();
|
399
|
var valED = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_end_date]'').getValue();
|
400
|
if (Ext.isEmpty(valSD) || Ext.isEmpty(valED))
|
401
|
return
|
402
|
|
403
|
MinovaUtil.executeParamQuery({
|
404
|
paramid: "leave_check_date",
|
405
|
emp_id: empid,
|
406
|
landscape: landscape,
|
407
|
start_date: sdt,
|
408
|
end_date: edt,
|
409
|
reg_id: reg_id
|
410
|
}, function (s) {
|
411
|
var obj = Ext.decode(s.responseText);
|
412
|
if (obj.data[0].res == ''1'') {
|
413
|
MinovaUtil.MESSAGE.error(obj.data[0].msg);
|
414
|
field.setValue('''');
|
415
|
} else {
|
416
|
abc();
|
417
|
}
|
418
|
}, function (f) {});
|
419
|
}
|
420
|
|
421
|
function abc() {
|
422
|
try {
|
423
|
scombo = field.up().query(''combobox[name=main_absence_type]'')[0].valueModels[0].data;
|
424
|
if (scombo.quotadeduction == ''Y'') {
|
425
|
var formLeave = MinovaUtil.WORKFLOW.getViewWorkflow().down(''form[name=Leave_Main]'').getForm();
|
426
|
if ((formLeave.getValues().main_absence_type !== '''') && (formLeave.getValues().main_start_date !== '''') && (formLeave.getValues().main_end_date !== '''')) {
|
427
|
me.leave_detail_and_block(formLeave);
|
428
|
}
|
429
|
} else {
|
430
|
field.up(''panel[name=content]'').down(''form[name=Leave_Main]'').getForm().setValues({
|
431
|
main_quota_lb_cont_2: ''1'',
|
432
|
main_quota_lb_cont: ''1'',
|
433
|
main_quota_sded: '''',
|
434
|
main_quota_eded: '''',
|
435
|
main_quota_sded2: '''',
|
436
|
main_quota_eded2: '''',
|
437
|
main_quota_start_date_2: '''',
|
438
|
main_quota_end_date_2: '''',
|
439
|
main_quota_seq_2: '''',
|
440
|
main_leave_quota: 0,
|
441
|
main_remaining_quota: 0,
|
442
|
main_quota_taken: 0,
|
443
|
main_total_remaining_quota: 0,
|
444
|
main_leave_quota_2: 0,
|
445
|
main_remaining_quota_2: 0,
|
446
|
main_quota_taken_2: 0,
|
447
|
main_total_remaining_quota_2: 0
|
448
|
|
449
|
})
|
450
|
|
451
|
me.calculateCutiKhusus();
|
452
|
}
|
453
|
|
454
|
} catch (scombo) {
|
455
|
Ext.global.console.log(''<<main_total_quota_taken'', 0);
|
456
|
me.changeValue(
|
457
|
field.up().query(''textfield[name=main_remaining_quota]'')[0], newValue, oldValue, eOpts);
|
458
|
}
|
459
|
Ext.global.console.log(''<<calculate'', field);
|
460
|
}
|
461
|
|
462
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
463
|
var taskid = MinovaUtil.WORKFLOW.getTaskId();
|
464
|
var sDate = Body.down(''datefield[name=main_start_date]'')
|
465
|
var eDate = Body.down(''datefield[name=main_end_date]'')
|
466
|
|
467
|
if (!sDate.isValid || !eDate.isValid)
|
468
|
return null;
|
469
|
|
470
|
if (Ext.isEmpty(taskid) || taskid === ''create'' || taskid === ''start'' || taskid === ''revise_creator'' || taskid === ''creator_confirm'' || taskid === ''revise_after_confirm_dirspv'' || taskid === ''revise_after_rd'' || taskid === ''revise_creator_back'') {
|
471
|
Ext.global.console.log(''>>calculate'', field);
|
472
|
var me = this;
|
473
|
var sdt = sDate.getValue();
|
474
|
var edt = eDate.getValue();
|
475
|
var empid = MinovaUtil.WORKFLOW.getEmpId();
|
476
|
var landscape = ''100'';
|
477
|
|
478
|
leaveCheckDate();
|
479
|
|
480
|
}
|
481
|
},
|
482
|
|
483
|
getFormHeader: function () {
|
484
|
Ext.global.console.log(''>>getFormHeader'');
|
485
|
var formHeader = Ext.ComponentQuery.query(''wf-request-formHeader'')[0];
|
486
|
if (formHeader !== undefined) {
|
487
|
formHeader = Ext.ComponentQuery.query(''wf-request-formHeader'')[0].getForm().getValues();
|
488
|
} else {
|
489
|
formHeader = Ext.ComponentQuery.query(''wf-run-formHeader'')[0].getForm().getValues();
|
490
|
}
|
491
|
Ext.global.console.log(''<<getFormHeader'');
|
492
|
return formHeader;
|
493
|
},
|
494
|
leave_detail_and_block: function (formLeave) {
|
495
|
var formValue = formLeave.getValues();
|
496
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
497
|
|
498
|
var reg = MinovaUtil.WORKFLOW.getRegId();
|
499
|
var reg_id = 0;
|
500
|
if (reg !== "") {
|
501
|
reg_id = parseInt(reg);
|
502
|
}
|
503
|
|
504
|
MinovaUtil.executeParamQuery({
|
505
|
paramid: "leave_detail_and_block",
|
506
|
absence_type: formValue.main_absence_type,
|
507
|
start_cuti: formValue.main_start_date,
|
508
|
end_cuti: formValue.main_end_date,
|
509
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
510
|
reg_id: reg_id,
|
511
|
leaveblock_ListAbsenceType: ''AL1|AL2|AL3|AL4''
|
512
|
}, function (Sxhr) {
|
513
|
var result = Ext.decode(Sxhr.responseText);
|
514
|
var data = result.data[0];
|
515
|
if (data.warning_type === ''1'') {
|
516
|
MinovaUtil.MESSAGE.error(data.warning_text);
|
517
|
body.down(''[name=main_start_date]'').setValue('''');
|
518
|
} else {
|
519
|
formLeave.setValues(data);
|
520
|
}
|
521
|
|
522
|
}, function (f) {});
|
523
|
},
|
524
|
validasiHariLibur: function (submit) {
|
525
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
526
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
527
|
var sdate = Body.down(''datefield[name=main_start_date]'').getValue();
|
528
|
var edate = Body.down(''datefield[name=main_end_date]'').getValue();
|
529
|
var me = this;
|
530
|
|
531
|
if (MinovaUtil.WORKFLOW.isRequest() || taskID === ''start'' || taskID === ''create'') {
|
532
|
MinovaUtil.executeParamQuery({
|
533
|
paramid: ''check_wc_like_off_by_dates'',
|
534
|
sdate: sdate,
|
535
|
edate: edate
|
536
|
}, function (s) {
|
537
|
try {
|
538
|
var value = Ext.decode(s.responseText).data[0].value;
|
539
|
if (value) {
|
540
|
MinovaUtil.MESSAGE.error("Tanggal cuti yang anda ajukan jatuh pada hari libur, mohon diperiksa kembali.");
|
541
|
return;
|
542
|
}
|
543
|
me.validasiProrateCuti(submit);
|
544
|
} catch (e) {}
|
545
|
|
546
|
}, function (e) {});
|
547
|
}
|
548
|
},
|
549
|
validasiProrateCuti: function (submit) {
|
550
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
551
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
552
|
var emp_id = MinovaUtil.WORKFLOW.getEmpId();
|
553
|
var startCuti = Body.down(''datefield[name=main_start_date]'').getValue();
|
554
|
var main_leave_quota = Body.down(''textfield[name=main_leave_quota]'').getValue();
|
555
|
var main_total_remaining_quota = Body.down(''numberfield[name=main_total_remaining_quota]'').getValue();
|
556
|
var totalCuti = parseInt(main_leave_quota) - parseInt(main_total_remaining_quota);
|
557
|
|
558
|
if (MinovaUtil.WORKFLOW.isRequest() || taskID === ''start'' || taskID === ''create'') {
|
559
|
MinovaUtil.executeParamQuery({
|
560
|
paramid: ''validasi_lv_prorate_cuti'',
|
561
|
emp_id: emp_id,
|
562
|
startCuti: startCuti,
|
563
|
totalCuti: totalCuti
|
564
|
}, function (s) {
|
565
|
try {
|
566
|
var warning = Ext.decode(s.responseText).data[0].warning;
|
567
|
if (warning === ''1'') {
|
568
|
var warning_text = Ext.decode(s.responseText).data[0].warning_text;
|
569
|
MinovaUtil.MESSAGE.error(warning_text);
|
570
|
return;
|
571
|
}
|
572
|
new submit();
|
573
|
} catch (e) {}
|
574
|
|
575
|
}, function (e) {});
|
576
|
}
|
577
|
},
|
578
|
validasiHariLibur2: function (submit) {
|
579
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
580
|
|
581
|
if (MinovaUtil.WORKFLOW.isRequest() || taskID === ''start'' || taskID === ''create'') {
|
582
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
583
|
var quotadeduc = body.down(''textfield[name=main_quota_deduction]'').getValue();
|
584
|
var totquotataken = body.down(''numberfield[name=main_total_quota_taken]'').getValue();
|
585
|
|
586
|
if (quotadeduc === "Y" && totquotataken === 0) {
|
587
|
MinovaUtil.MESSAGE.error("Cuti tidak dapat dilakukan pada hari libur");
|
588
|
} else {
|
589
|
submit();
|
590
|
}
|
591
|
}
|
592
|
},
|
593
|
|
594
|
onTask_apv_conf_dir_spv: function (me) {
|
595
|
me.disableConfirmation();
|
596
|
},
|
597
|
onTask_apv_ds3: function (me) {
|
598
|
me.disableConfirmation();
|
599
|
},
|
600
|
onTask_apv_dir_spv: function (me) {
|
601
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
602
|
},
|
603
|
onTask_apv_ds1: function (me) {
|
604
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
605
|
},
|
606
|
onTask_apv_direct_spv: function (me) {
|
607
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
608
|
},
|
609
|
onTask_apv_confirm_direct_spv: function (me) {
|
610
|
me.disableConfirmation();
|
611
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
612
|
},
|
613
|
onTask_conf_cond_revise_date_apv_dir_spv: function (me) {
|
614
|
me.disableConfirmation();
|
615
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
616
|
},
|
617
|
onTask_creator_confirm: function (me) {
|
618
|
me.showConfirmation();
|
619
|
},
|
620
|
showConfirmation: function () {
|
621
|
var view = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
622
|
view.down(''[name=main_leave_confirmation]'').show();
|
623
|
view.down(''[name=main_leave_confirmation]'').allowBlank = false;
|
624
|
},
|
625
|
disableConfirmation: function () {
|
626
|
this.showConfirmation();
|
627
|
var view = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
628
|
view.down(''[name=main_leave_confirmation]'').setReadOnly(true);
|
629
|
view.down(''[name=main_leave_confirmation]'').allowBlank = true;
|
630
|
},
|
631
|
validasi_cuti_tahunan: function (submit) {
|
632
|
var me = MinovaUtil.WORKFLOW.loadControllerByViewClass(MinovaUtil.WORKFLOW.getViewBodyWorkflow().$className)
|
633
|
var absenceType = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_absence_type]'').getValue();
|
634
|
var start_date = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_start_date]'').getValue();
|
635
|
var quota_type = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_quota_type]'').getValue();
|
636
|
|
637
|
if (absenceType === ''1000'') {
|
638
|
MinovaUtil.executeParamQuery({
|
639
|
paramid: ''leave_cek_cuti_tahunan'',
|
640
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
641
|
start_date: start_date,
|
642
|
quota_type: quota_type
|
643
|
}, function (s) {
|
644
|
var data = Ext.decode(s.responseText).data[0]
|
645
|
if (data.warning === ''1'') {
|
646
|
MinovaUtil.MESSAGE.error(data.warning_text);
|
647
|
} else {
|
648
|
submit()
|
649
|
}
|
650
|
}, function (f) {})
|
651
|
} else {
|
652
|
me.leave_validation(submit)
|
653
|
}
|
654
|
},
|
655
|
leave_validation: function (submit) {
|
656
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow()
|
657
|
var absenceType = body.down(''[name=main_absence_type]'').getValue();
|
658
|
var emp_id = MinovaUtil.WORKFLOW.getEmpId();
|
659
|
var sdate = body.down(''[name=main_start_date]'').getValue();
|
660
|
var qdec = body.down(''[name=main_quota_deduction]'').getValue();
|
661
|
|
662
|
if (qdec == ''Y'') {
|
663
|
submit();
|
664
|
} else {
|
665
|
MinovaUtil.executeParamQuery({
|
666
|
paramid: ''leave_validation'',
|
667
|
absence_type: absenceType,
|
668
|
start_cuti: sdate,
|
669
|
emp_id: emp_id,
|
670
|
reg_id: MinovaUtil.WORKFLOW.getRegId()
|
671
|
}, function (s) {
|
672
|
var data = Ext.decode(s.responseText).data[0]
|
673
|
if (data != null) {
|
674
|
if (data.warn > 0) {
|
675
|
MinovaUtil.MESSAGE.error(data.msg)
|
676
|
}
|
677
|
} else {
|
678
|
submit()
|
679
|
}
|
680
|
}, function (f) {})
|
681
|
}
|
682
|
},
|
683
|
ValidasiMaksimaPengajuan: function (submit) {
|
684
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
685
|
var BizprocId = MinovaUtil.WORKFLOW.getBizprocId();
|
686
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
687
|
var Sd = body.down(''[name=main_start_date]'').getValue();
|
688
|
var Ed = body.down(''[name=main_end_date]'').getValue();
|
689
|
var NDate = null;
|
690
|
var izin = '''';
|
691
|
var absence_type = body.down(''[name=main_absence_type]'').getValue();
|
692
|
if (taskID == ''start'' && BizprocId == ''leave'') {
|
693
|
MinovaUtil.executeParamQuery({
|
694
|
paramid: ''ValidasiLeaveSetahun'',
|
695
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
696
|
start_date: Sd
|
697
|
}, function (s) {
|
698
|
var result = Ext.decode(s.responseText);
|
699
|
var data = result.data[0];
|
700
|
var obju = data;
|
701
|
if (obju !== undefined) {
|
702
|
izin = obju.IZIN;
|
703
|
}
|
704
|
}, function (f) {})
|
705
|
if (absence_type == ''AL1'' || absence_type == ''AL2'') {
|
706
|
if (izin == ''no'' || izin == '''') {
|
707
|
MinovaUtil.MESSAGE.error("Anda belum diperkenankan untuk melakukan pengajuan cuti");
|
708
|
body.down(''[name=main_start_date]'').setValue('''');
|
709
|
}
|
710
|
}
|
711
|
}
|
712
|
|
713
|
MinovaUtil.executeParamQuery({
|
714
|
paramid: ''now_date''
|
715
|
}, function (s) {
|
716
|
var data = Ext.decode(s.responseText).data[0]
|
717
|
if (data != null) {
|
718
|
NDate = data.NowDate;
|
719
|
} else {
|
720
|
NDate = me.now8();
|
721
|
}
|
722
|
}, function (f) {})
|
723
|
var Duration = this.GetDateDiff(Sd, NDate);
|
724
|
|
725
|
var abs_type = body.down(''[name=main_absence_type]'').getValue();
|
726
|
|
727
|
var CountDt = null;
|
728
|
MinovaUtil.executeParamQuery({
|
729
|
paramid: ''wf_leave_get_absentype'',
|
730
|
abs_type: abs_type
|
731
|
}, function (s) {
|
732
|
var data = Ext.decode(s.responseText).data[0]
|
733
|
if (data != null) {
|
734
|
CountDt = data.Res;
|
735
|
}
|
736
|
}, function (f) {})
|
737
|
|
738
|
var Duration = this.GetDateDiff(Sd, NDate);
|
739
|
var quotadeduc = body.down(''textfield[name=main_quota_deduction]'').getValue();
|
740
|
|
741
|
if (taskID === ''start'' || taskID === ''revisess_creator'') {
|
742
|
if (CountDt >= 1 && Duration < 3) {
|
743
|
MinovaUtil.MESSAGE.error("Pengajuan ESS bisa dilakukan Maksimal 3 Hari berikutnya");
|
744
|
body.down(''[name=main_start_date]'').setValue('''');
|
745
|
} else {
|
746
|
this.changeDateRange();
|
747
|
}
|
748
|
}
|
749
|
}
|
750
|
});
|
751
|
Ext.apply(Ext.form.field.VTypes, {
|
752
|
|
753
|
block_leave: function (val, field) {
|
754
|
var wfv = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
755
|
var a = wfv.down(''textfield[name=main_quota_start_date_2]'');
|
756
|
var a1 = wfv.down(''textfield[name=main_quota_start_date]'');
|
757
|
var b = wfv.down(''textfield[name=main_quota_lb_cont_2]'');
|
758
|
var b1 = wfv.down(''textfield[name=main_quota_lb_cont]'');
|
759
|
var c = wfv.down(''textfield[name=main_total_remaining_quota_2]'');
|
760
|
var c1 = wfv.down(''textfield[name=main_total_remaining_quota]'');
|
761
|
var d1 = wfv.down(''[name=main_quota_taken]'');
|
762
|
var d = wfv.down(''[name=main_quota_taken_2]'');
|
763
|
var dt = wfv.down(''[name=main_total_quota_taken]'');
|
764
|
var absenceType = wfv.down(''[name=main_absence_type]'');
|
765
|
if (absenceType.getValue() === ''1000'') {
|
766
|
if ((a.getValue() !== '''' || a.getValue() !== ''0'') && b.getValue() === ''0'' && c.getValue() < 5 && c.getValue() !== null) {
|
767
|
if (c.getValue() < 5 && dt.getValue() < 5 && dt.getValue() !== null) {
|
768
|
return false;
|
769
|
}
|
770
|
} else if ((a.getValue() === '''' || a.getValue() === ''0'') && b1.getValue() === ''0'' && c1.getValue() < 5 && c1.getValue() !== null) {
|
771
|
if (c1.getValue() < 5 && dt.getValue() < 5 && dt.getValue() !== null) {
|
772
|
return false;
|
773
|
}
|
774
|
}
|
775
|
}
|
776
|
|
777
|
return true;
|
778
|
},
|
779
|
block_leaveText: ''Block leave must be taken'',
|
780
|
total_taken: function (val, field) {
|
781
|
var lv_block = Ext.ComponentQuery.query(''textfield[name=main_block_contain]'')[0];
|
782
|
try {
|
783
|
var q_taken = Ext.ComponentQuery.query(''textfield[name=main_total_quota_taken]'')[0];
|
784
|
var q_remain = Ext.ComponentQuery.query(''textfield[name=main_total_remaining_quota]'')[0];
|
785
|
if (lv_block.value === "0") {
|
786
|
try {
|
787
|
if (q_taken.value < 5 && q_remain.value < 5) {
|
788
|
return false;
|
789
|
}
|
790
|
} catch (e) {}
|
791
|
}
|
792
|
if (lv_block.value === "1") {
|
793
|
try {
|
794
|
if (q_taken.value >= 5) {
|
795
|
return false;
|
796
|
}
|
797
|
} catch (e) {}
|
798
|
}
|
799
|
} catch (e) {}
|
800
|
return true;
|
801
|
},
|
802
|
total_takenText: ''Types of absences are included in the block leave and unused. Mandatory quotas taken at least 5''
|
803
|
});
|
804
|
Ext.QuickTips.init();' COLLATE SQL_Latin1_General_CP1_CI_AS, N'Ext.define(''MinovaIS.ERP.Web.controller.wf.leave.leave'', {
|
805
|
extend: ''Ext.app.Controller'',
|
806
|
store: [''wf.leave.LeaveConf''],
|
807
|
views: [''wf.leave.leave''],
|
808
|
config: {
|
809
|
delegate_mode: 2
|
810
|
},
|
811
|
init: function () {
|
812
|
this.control({
|
813
|
''wf-leave-leave'': {
|
814
|
afterrender: this.onAfterRender
|
815
|
},
|
816
|
''wf-leave-leave button[action=lookupEmpOnDelegateLeave]'': {
|
817
|
click: this.showEmployeeLeave
|
818
|
},
|
819
|
''wf-leave-leave combobox[name=main_absence_type]'': {
|
820
|
select: this.selectAbsenceType
|
821
|
},
|
822
|
''wf-leave-leave textfield[name=main_start_date]'': {
|
823
|
change: this.ValidasiMaksimaPengajuan
|
824
|
},
|
825
|
''wf-leave-leave textfield[name=main_end_date]'': {
|
826
|
change: this.changeDateRange
|
827
|
},
|
828
|
''employee_id textfield[name=employee_id]'': {
|
829
|
change: this.changeDateRange
|
830
|
},
|
831
|
''wf-leave-leave combo[name=list_of_delegate]'': {
|
832
|
select: this.selecttDelegation
|
833
|
|
834
|
}
|
835
|
});
|
836
|
},
|
837
|
onDocumentInit: function (me) {
|
838
|
switch (me.config.delegate_mode) {
|
839
|
case 0:
|
840
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=lookup_of_delegate]'').hide();
|
841
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=list_of_delegate]'').hide();
|
842
|
break
|
843
|
case 1:
|
844
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=lookup_of_delegate]'').hide()
|
845
|
break
|
846
|
case 2:
|
847
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=list_of_delegate]'').hide();
|
848
|
break
|
849
|
default:
|
850
|
break
|
851
|
}
|
852
|
var btn_lookup_delegate = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=lookup_of_delegate]'');
|
853
|
btn_lookup_delegate.on(''click'', function () {
|
854
|
var popupEmployee = this.getController(''popup.employee.employee'');
|
855
|
popupEmployee.onSelect = function (recs) {
|
856
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=delegate_delegate_id]'').setValue(recs.data.code);
|
857
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=delegate_delegate_name]'').setValue(recs.data.desc);
|
858
|
|
859
|
}
|
860
|
popupEmployee.showPopup();
|
861
|
}, me)
|
862
|
|
863
|
},
|
864
|
onDocumentReady: function (me) {
|
865
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
866
|
var taskId = MinovaUtil.WORKFLOW.getTaskId();
|
867
|
var listTaskFormEnabled = ['''', ''create'', ''start'', ''revise_creator'', ''creator_confirm'', ''revise_after_confirm_dirspv'', ''revise_after_rd'', ''revise_creator_back'']
|
868
|
|
869
|
body.down(''[name=main_absence_type]'').store.load({
|
870
|
params: {
|
871
|
paramid: ''combobox_lv_absencetype'',
|
872
|
emp_id: MinovaUtil.WORKFLOW.getEmpId()
|
873
|
},
|
874
|
callback: function () {
|
875
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''combo[name=main_absence_type]'').setValue(MinovaUtil.WORKFLOW.getRegValuesByName(''main_absence_type''))
|
876
|
}
|
877
|
});
|
878
|
|
879
|
if (listTaskFormEnabled.indexOf(taskId) < 0) {
|
880
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
881
|
}
|
882
|
|
883
|
},
|
884
|
|
885
|
onDocumentBeforeSubmit: function (submit, taskId, me) {
|
886
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
887
|
var absence_type = body.down(''[name=main_absence_type]'').getValue();
|
888
|
var lvbolehbackdated = [''0001'', ''0002'', ''1100'', ''1200'', ''3900'', ''CL5'', ''CL6'', ''CL7''];
|
889
|
var qdeduc = body.down(''[name=main_quota_deduction]'').getValue();
|
890
|
|
891
|
if (qdeduc = ''Y'') {
|
892
|
MinovaUtil.executeParamQuery({
|
893
|
paramid: "leave_update_remaining_quota_save",
|
894
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
895
|
landscape: ''100'',
|
896
|
start_date: body.down(''[name=main_quota_start_date]'').getValue(),
|
897
|
end_date: body.down(''[name=main_quota_end_date]'').getValue(),
|
898
|
start_date2: body.down(''[name=main_quota_start_date_2]'').getValue(),
|
899
|
end_date2: body.down(''[name=main_quota_end_date_2]'').getValue(),
|
900
|
quota_type: body.down(''[name=main_quota_type]'').getValue(),
|
901
|
quota_taken: body.down(''[name=main_quota_taken]'').getValue(),
|
902
|
quota_taken2: body.down(''[name=main_quota_taken_2]'').getValue()
|
903
|
}, function (s) {
|
904
|
var data = Ext.decode(s.responseText).data[0];
|
905
|
var formLeave = body.down(''form[name=Leave_Main]'').getForm();
|
906
|
formLeave.setValues(data);
|
907
|
}, function (f) {});
|
908
|
}
|
909
|
|
910
|
if (taskId === ''start'' || taskId === '''' || taskId === ''create'') {
|
911
|
var sdate = body.down(''[name=main_start_date]'');
|
912
|
var edate = body.down(''[name=main_end_date]'');
|
913
|
var now = Ext.Date.format(new Date(), ''Ymd'');
|
914
|
|
915
|
if (lvbolehbackdated.indexOf(absence_type) < 0 && (sdate.getValue() < now || edate.getValue() < now)) {
|
916
|
alert("Leave Cannot be backdated. Please adjust field Start Date or End Date");
|
917
|
} else
|
918
|
me.validasi_cuti_tahunan(submit);
|
919
|
} else
|
920
|
me.validasi_cuti_tahunan(submit);
|
921
|
|
922
|
},
|
923
|
selecttDelegation: function (_this, recs, opt) {
|
924
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
925
|
Body.down(''textfield[name=delegate_delegate_id]'').setValue(recs[0].data.emp_id);
|
926
|
Body.down(''textfield[name=delegate_delegate_name]'').setValue(recs[0].data.fullname);
|
927
|
},
|
928
|
|
929
|
now8: function () {
|
930
|
Ext.global.console.log(''>>now8'');
|
931
|
return Ext.Date.format(new Date(), ''Ymd'');
|
932
|
},
|
933
|
GetDateDiff: function (EndDate, StartDate) {
|
934
|
var DateI = new Date(EndDate.substring(4, 6) + "/" + EndDate.substring(6, 8) + "/" + EndDate.substring(0, 4));
|
935
|
var Date2 = new Date(StartDate.substring(4, 6) + "/" + StartDate.substring(6, 8) + "/" + StartDate.substring(0, 4));
|
936
|
var DiffDays = parseInt((DateI - Date2) / (1000 * 60 * 60 * 24));
|
937
|
return DiffDays;
|
938
|
},
|
939
|
|
940
|
onAfterRender: function (_this) {
|
941
|
Ext.global.console.log(''>>onAfterRender'', _this);
|
942
|
var me = this;
|
943
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow()
|
944
|
|
945
|
body.down(''combo[name=main_absence_type]'').store.on(''beforeload'', function (store, operation, eOpts) {
|
946
|
store.proxy.extraParams = {
|
947
|
paramid: ''combobox_lv_absencetype'',
|
948
|
emp_id: MinovaUtil.WORKFLOW.getEmpId()
|
949
|
};
|
950
|
});
|
951
|
var header = _this.up(''panel[name=content]'').down(''panel[name=wf_form_header]'');
|
952
|
|
953
|
var taskId = header.down(''textfield[name=task_id_run]'');
|
954
|
var empId = header.down(''textfield[name=employee_id]'');
|
955
|
if (empId !== undefined)
|
956
|
empId.on(''change'', me.onBehalfEmpId, me);
|
957
|
Ext.global.console.log(''<<onAfterRender'', _this);
|
958
|
},
|
959
|
|
960
|
onBehalfEmpId: function (field, newValue, oldValue, eOpts) {
|
961
|
this.changeDelegate(field, newValue, oldValue, eOpts);
|
962
|
Ext.global.console.log(''>>onBehalfEmpId'', field);
|
963
|
this.getDelegate(field, newValue, oldValue, eOpts);
|
964
|
this.getStoreAbsence(field, newValue, oldValue, eOpts);
|
965
|
if (MinovaUtil.WORKFLOW.isRequest()) {
|
966
|
this.clearMainForm(field, newValue, oldValue, eOpts);
|
967
|
}
|
968
|
this.changeValue(
|
969
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_remaining_quota]'')[0], newValue, oldValue, eOpts);
|
970
|
Ext.global.console.log(''<<onBehalfEmpId'', field);
|
971
|
},
|
972
|
|
973
|
changeDelegate: function (_this, newVal, oldVal) {
|
974
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
975
|
var main_delegate = body.down(''textfield[name=main_delegate_emp_from]'');
|
976
|
main_delegate.setValue(newVal);
|
977
|
},
|
978
|
onBehalfTaskId: function (field, newValue, oldValue, eOpts) {
|
979
|
Ext.global.console.log(''>>onBehalfTaskId'', field);
|
980
|
this.leaveConfSet(field, newValue, oldValue, eOpts);
|
981
|
Ext.global.console.log(''<<onBehalfTaskId'', field);
|
982
|
},
|
983
|
|
984
|
leaveConfSet: function (field, newValue, oldValue, eOpts) {
|
985
|
Ext.global.console.log(''>>leaveConfSet'', field);
|
986
|
var leaveConf = field.up().up().up().query(''wf-leave-leave combobox[name=main_leave_confirmation]'')[0];
|
987
|
|
988
|
switch (newValue) {
|
989
|
case ''creator_confirm'':
|
990
|
leaveConf.show();
|
991
|
break;
|
992
|
case ''apv_ds2'':
|
993
|
leaveConf.show();
|
994
|
leaveConf.setReadOnly(true);
|
995
|
break;
|
996
|
}
|
997
|
Ext.global.console.log(''<<leaveConfSet'', field);
|
998
|
},
|
999
|
|
1000
|
onLeaveInbox: function (field, newValue, oldValue, eOpts) {
|
1001
|
Ext.global.console.log(''>>onLeaveInbox'', field);
|
1002
|
this.getStoreAbsence(field, newValue, oldValue, eOpts);
|
1003
|
Ext.global.console.log(''<<onLeaveInbox'', field);
|
1004
|
},
|
1005
|
|
1006
|
clearMainForm: function (field, newValue, oldValue, eOpts) {
|
1007
|
Ext.global.console.log(''>>beforedestroyleaveConf'', field);
|
1008
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_leave_quota]'')[0].setValue(0);
|
1009
|
|
1010
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_remaining_quota]'')[0].setValue(0);
|
1011
|
|
1012
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_total_remaining_quota]'')[0].setValue(0);
|
1013
|
|
1014
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_absence_type]'')[0].setValue('''');
|
1015
|
|
1016
|
field.up().up().up().query(''wf-leave-leave textfield[name=main_quota_type]'')[0].setValue('''');
|
1017
|
Ext.global.console.log(''<<beforedestroyleaveConf'', field);
|
1018
|
},
|
1019
|
|
1020
|
getStoreAbsence: function (field, newValue, oldValue, eOpts) {
|
1021
|
var me = this;
|
1022
|
Ext.global.console.log(''>>getStoreAbsence'', field);
|
1023
|
MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''combo[name=main_absence_type]'').store.load();
|
1024
|
|
1025
|
me.changeDateRange(field, newValue, oldValue, eOpts);
|
1026
|
Ext.global.console.log(''<<getStoreAbsence'', field);
|
1027
|
},
|
1028
|
|
1029
|
getDelegate: function (field, newValue, oldValue, eOpts) {
|
1030
|
Ext.global.console.log(''<<getDelegate'', field);
|
1031
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1032
|
var me = this;
|
1033
|
Ext.Ajax.request({
|
1034
|
scope: me,
|
1035
|
url: ''/Workflow/LoadDataQuery'',
|
1036
|
method: ''POST'',
|
1037
|
params: {
|
1038
|
paramid: ''##Autofill_leave_delegate'',
|
1039
|
emp_id: newValue
|
1040
|
},
|
1041
|
success: function (response, opts) {
|
1042
|
var obj = Ext.decode(response.responseText).data;
|
1043
|
if (obj === undefined || obj.length === 0)
|
1044
|
return;
|
1045
|
try {
|
1046
|
var cbDelegate = Body.down(''combo[name=list_of_delegate]'');
|
1047
|
cbDelegate.store.loadData(obj);
|
1048
|
if (MinovaUtil.WORKFLOW.getTaskId() === ''start'') {
|
1049
|
cbDelegate.select(obj[0].emp_id);
|
1050
|
Body.down(''textfield[name=delegate_delegate_id]'').setValue(obj[0].emp_id);
|
1051
|
Body.down(''textfield[name=delegate_delegate_name]'').setValue(obj[0].fullname);
|
1052
|
return;
|
1053
|
}
|
1054
|
|
1055
|
} catch (comp) {}
|
1056
|
},
|
1057
|
failure: function (response, opts) {}
|
1058
|
});
|
1059
|
me.changeDateRange(field, newValue, oldValue, eOpts);
|
1060
|
Ext.global.console.log(''>>getDelegate'', field);
|
1061
|
},
|
1062
|
|
1063
|
changeValue: function (field, newValue, oldValue, eOpts) {
|
1064
|
Ext.global.console.log(''>>changeValue'', field);
|
1065
|
try {
|
1066
|
var remainQuota = field.up().query(''textfield[name=main_remaining_quota]'')[0].value;
|
1067
|
var totalTakenQuota = field.up().query(''textfield[name=main_total_quota_taken]'')[0].value;
|
1068
|
field.up().query(''textfield[name=main_total_remaining_quota]'')[0].setValue(remainQuota - totalTakenQuota);
|
1069
|
} catch (e) {}
|
1070
|
|
1071
|
Ext.global.console.log(''<<changeValue'', field);
|
1072
|
},
|
1073
|
|
1074
|
changeDateRange: function (field, newValue, oldValue, eOpts) {
|
1075
|
if (!MinovaUtil.WORKFLOW.isRequest())
|
1076
|
if (Ext.isEmpty(oldValue) || oldValue == 0)
|
1077
|
return;
|
1078
|
|
1079
|
var me = this;
|
1080
|
me.calculate(field, newValue, oldValue, eOpts);
|
1081
|
var taskid = MinovaUtil.WORKFLOW.getTaskId();
|
1082
|
|
1083
|
},
|
1084
|
|
1085
|
calculateCutiKhusus: function () {
|
1086
|
|
1087
|
var me = this;
|
1088
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1089
|
var absence_type = Body.down(''[name=main_absence_type]'').getValue();
|
1090
|
var start_cuti = Body.down(''[name=main_start_date]'').getValue();
|
1091
|
var end_cuti = Body.down(''[name=main_end_date]'').getValue();
|
1092
|
|
1093
|
if (start_cuti !== '''' && end_cuti !== '''') {
|
1094
|
MinovaUtil.executeParamQuery({
|
1095
|
paramid: "leave_cuti_khusus_calculation",
|
1096
|
absence_type: absence_type,
|
1097
|
start_cuti: start_cuti,
|
1098
|
end_cuti: end_cuti,
|
1099
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
1100
|
reg_id: MinovaUtil.WORKFLOW.getRegId()
|
1101
|
}, function (s) {
|
1102
|
var data = Ext.decode(s.responseText).data[0];
|
1103
|
var formLeave = Body.down(''form[name=Leave_Main]'').getForm();
|
1104
|
MinovaUtil.WORKFLOW.setViewBodyWorkflowFormContent(data);
|
1105
|
|
1106
|
}, function (f) {});
|
1107
|
}
|
1108
|
|
1109
|
},
|
1110
|
|
1111
|
selectAbsenceType: function (combo, eOpts) {
|
1112
|
Ext.global.console.log(''>>selectAbsenceType'', combo);
|
1113
|
var me = this;
|
1114
|
var fHeader = me.getFormHeader();
|
1115
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1116
|
Body.down(''[name=main_start_date]'').setValue('''');
|
1117
|
Body.down(''[name=main_end_date]'').setValue('''');
|
1118
|
|
1119
|
combo.up().up().query(''textfield[name=main_quota_type]'')[0].setValue(combo.displayTplData[0].quota_type);
|
1120
|
Body.down(''[name=main_quota_deduction]'').setValue(combo.displayTplData[0].quotadeduction);
|
1121
|
|
1122
|
MinovaUtil.executeParamQuery({
|
1123
|
paramid: "combobox_lv_block_continue",
|
1124
|
emp_id: fHeader.requester_id,
|
1125
|
now: me.now8(),
|
1126
|
quota_type: combo.displayTplData[0].quota_type
|
1127
|
}, function (s) {
|
1128
|
var obj2 = Ext.decode(s.responseText).data[0];
|
1129
|
Body.down(''[name=main_block_contain]'').setValue(obj2.result);
|
1130
|
}, function (f) {});
|
1131
|
|
1132
|
me.changeDateRange(combo, '''', '''', '''');
|
1133
|
Ext.global.console.log(''<<selectAbsenceType'', combo);
|
1134
|
},
|
1135
|
|
1136
|
expandAbsenceType: function (field, eOpts) {
|
1137
|
Ext.global.console.log(''<<expandAbsenceType'', field);
|
1138
|
var me = this;
|
1139
|
field.store.load({
|
1140
|
params: {
|
1141
|
emp_id: me.up().down(''wf-request-formHeader textfield[name=employee_id]'').value
|
1142
|
}
|
1143
|
});
|
1144
|
Ext.global.console.log(''<<expandAbsenceType'', field);
|
1145
|
},
|
1146
|
|
1147
|
showEmployeeLeave: function (_this) {
|
1148
|
Ext.global.console.log(''<<showEmployeeLeave'', _this);
|
1149
|
var me = this;
|
1150
|
var viewID = _this.up(''wf-leave-leave'').id;
|
1151
|
me.viewNYA = Ext.ComponentQuery.query(''wf-leave-leave[id='' + viewID + '']'')[0];
|
1152
|
var _appname = ''MinovaIS.ERP.Web.'';
|
1153
|
var _ctrlname = _appname + ''controller.popup.employee.employee'';
|
1154
|
var _popUploadCtrl = this.getController(_ctrlname);
|
1155
|
var tempAbout = _popUploadCtrl.about();
|
1156
|
_popUploadCtrl.refCode = Ext.ComponentQuery.query(''wf-leave-leave textfield[name=wfl_txt_delegate_id]'')[0];
|
1157
|
_popUploadCtrl.refDesc = Ext.ComponentQuery.query(''wf-leave-leave textfield[name=wfl_txt_delegate_name]'')[0];
|
1158
|
|
1159
|
var _popUploadView = Ext.create(_appname + ''view.'' + _popUploadCtrl.views[0]);
|
1160
|
|
1161
|
_popUploadView.show();
|
1162
|
Ext.global.console.log(''<<showEmployeeLeave'', _this);
|
1163
|
},
|
1164
|
|
1165
|
calculate: function (field, newValue, oldValue, eOpts) {
|
1166
|
var reg = MinovaUtil.WORKFLOW.getRegId();
|
1167
|
var reg_id = 0;
|
1168
|
if (reg != "") {
|
1169
|
reg_id = parseInt(reg);
|
1170
|
}
|
1171
|
|
1172
|
function leaveCheckDate() {
|
1173
|
var valSD = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_start_date]'').getValue();
|
1174
|
var valED = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_end_date]'').getValue();
|
1175
|
if (Ext.isEmpty(valSD) || Ext.isEmpty(valED))
|
1176
|
return
|
1177
|
|
1178
|
MinovaUtil.executeParamQuery({
|
1179
|
paramid: "leave_check_date",
|
1180
|
emp_id: empid,
|
1181
|
landscape: landscape,
|
1182
|
start_date: sdt,
|
1183
|
end_date: edt,
|
1184
|
reg_id: reg_id
|
1185
|
}, function (s) {
|
1186
|
var obj = Ext.decode(s.responseText);
|
1187
|
if (obj.data[0].res == ''1'') {
|
1188
|
MinovaUtil.MESSAGE.error(obj.data[0].msg);
|
1189
|
field.setValue('''');
|
1190
|
} else {
|
1191
|
abc();
|
1192
|
}
|
1193
|
}, function (f) {});
|
1194
|
}
|
1195
|
|
1196
|
function abc() {
|
1197
|
try {
|
1198
|
scombo = field.up().query(''combobox[name=main_absence_type]'')[0].valueModels[0].data;
|
1199
|
if (scombo.quotadeduction == ''Y'') {
|
1200
|
var formLeave = MinovaUtil.WORKFLOW.getViewWorkflow().down(''form[name=Leave_Main]'').getForm();
|
1201
|
if ((formLeave.getValues().main_absence_type !== '''') && (formLeave.getValues().main_start_date !== '''') && (formLeave.getValues().main_end_date !== '''')) {
|
1202
|
me.leave_detail_and_block(formLeave);
|
1203
|
}
|
1204
|
} else {
|
1205
|
field.up(''panel[name=content]'').down(''form[name=Leave_Main]'').getForm().setValues({
|
1206
|
main_quota_lb_cont_2: ''1'',
|
1207
|
main_quota_lb_cont: ''1'',
|
1208
|
main_quota_sded: '''',
|
1209
|
main_quota_eded: '''',
|
1210
|
main_quota_sded2: '''',
|
1211
|
main_quota_eded2: '''',
|
1212
|
main_quota_start_date_2: '''',
|
1213
|
main_quota_end_date_2: '''',
|
1214
|
main_quota_seq_2: '''',
|
1215
|
main_leave_quota: 0,
|
1216
|
main_remaining_quota: 0,
|
1217
|
main_quota_taken: 0,
|
1218
|
main_total_remaining_quota: 0,
|
1219
|
main_leave_quota_2: 0,
|
1220
|
main_remaining_quota_2: 0,
|
1221
|
main_quota_taken_2: 0,
|
1222
|
main_total_remaining_quota_2: 0
|
1223
|
|
1224
|
})
|
1225
|
|
1226
|
me.calculateCutiKhusus();
|
1227
|
}
|
1228
|
|
1229
|
} catch (scombo) {
|
1230
|
Ext.global.console.log(''<<main_total_quota_taken'', 0);
|
1231
|
me.changeValue(
|
1232
|
field.up().query(''textfield[name=main_remaining_quota]'')[0], newValue, oldValue, eOpts);
|
1233
|
}
|
1234
|
Ext.global.console.log(''<<calculate'', field);
|
1235
|
}
|
1236
|
|
1237
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1238
|
var taskid = MinovaUtil.WORKFLOW.getTaskId();
|
1239
|
var sDate = Body.down(''datefield[name=main_start_date]'')
|
1240
|
var eDate = Body.down(''datefield[name=main_end_date]'')
|
1241
|
|
1242
|
if (!sDate.isValid || !eDate.isValid)
|
1243
|
return null;
|
1244
|
|
1245
|
if (Ext.isEmpty(taskid) || taskid === ''create'' || taskid === ''start'' || taskid === ''revise_creator'' || taskid === ''creator_confirm'' || taskid === ''revise_after_confirm_dirspv'' || taskid === ''revise_after_rd'' || taskid === ''revise_creator_back'') {
|
1246
|
Ext.global.console.log(''>>calculate'', field);
|
1247
|
var me = this;
|
1248
|
var sdt = sDate.getValue();
|
1249
|
var edt = eDate.getValue();
|
1250
|
var empid = MinovaUtil.WORKFLOW.getEmpId();
|
1251
|
var landscape = ''100'';
|
1252
|
|
1253
|
leaveCheckDate();
|
1254
|
|
1255
|
}
|
1256
|
},
|
1257
|
|
1258
|
getFormHeader: function () {
|
1259
|
Ext.global.console.log(''>>getFormHeader'');
|
1260
|
var formHeader = Ext.ComponentQuery.query(''wf-request-formHeader'')[0];
|
1261
|
if (formHeader !== undefined) {
|
1262
|
formHeader = Ext.ComponentQuery.query(''wf-request-formHeader'')[0].getForm().getValues();
|
1263
|
} else {
|
1264
|
formHeader = Ext.ComponentQuery.query(''wf-run-formHeader'')[0].getForm().getValues();
|
1265
|
}
|
1266
|
Ext.global.console.log(''<<getFormHeader'');
|
1267
|
return formHeader;
|
1268
|
},
|
1269
|
leave_detail_and_block: function (formLeave) {
|
1270
|
var formValue = formLeave.getValues();
|
1271
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1272
|
|
1273
|
var reg = MinovaUtil.WORKFLOW.getRegId();
|
1274
|
var reg_id = 0;
|
1275
|
if (reg !== "") {
|
1276
|
reg_id = parseInt(reg);
|
1277
|
}
|
1278
|
|
1279
|
MinovaUtil.executeParamQuery({
|
1280
|
paramid: "leave_detail_and_block",
|
1281
|
absence_type: formValue.main_absence_type,
|
1282
|
start_cuti: formValue.main_start_date,
|
1283
|
end_cuti: formValue.main_end_date,
|
1284
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
1285
|
reg_id: reg_id,
|
1286
|
leaveblock_ListAbsenceType: ''AL1|AL2|AL3|AL4''
|
1287
|
}, function (Sxhr) {
|
1288
|
var result = Ext.decode(Sxhr.responseText);
|
1289
|
var data = result.data[0];
|
1290
|
if (data.warning_type === ''1'') {
|
1291
|
MinovaUtil.MESSAGE.error(data.warning_text);
|
1292
|
body.down(''[name=main_start_date]'').setValue('''');
|
1293
|
} else {
|
1294
|
formLeave.setValues(data);
|
1295
|
}
|
1296
|
|
1297
|
}, function (f) {});
|
1298
|
},
|
1299
|
validasiHariLibur: function (submit) {
|
1300
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
1301
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1302
|
var sdate = Body.down(''datefield[name=main_start_date]'').getValue();
|
1303
|
var edate = Body.down(''datefield[name=main_end_date]'').getValue();
|
1304
|
var me = this;
|
1305
|
|
1306
|
if (MinovaUtil.WORKFLOW.isRequest() || taskID === ''start'' || taskID === ''create'') {
|
1307
|
MinovaUtil.executeParamQuery({
|
1308
|
paramid: ''check_wc_like_off_by_dates'',
|
1309
|
sdate: sdate,
|
1310
|
edate: edate
|
1311
|
}, function (s) {
|
1312
|
try {
|
1313
|
var value = Ext.decode(s.responseText).data[0].value;
|
1314
|
if (value) {
|
1315
|
MinovaUtil.MESSAGE.error("Tanggal cuti yang anda ajukan jatuh pada hari libur, mohon diperiksa kembali.");
|
1316
|
return;
|
1317
|
}
|
1318
|
me.validasiProrateCuti(submit);
|
1319
|
} catch (e) {}
|
1320
|
|
1321
|
}, function (e) {});
|
1322
|
}
|
1323
|
},
|
1324
|
validasiProrateCuti: function (submit) {
|
1325
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
1326
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1327
|
var emp_id = MinovaUtil.WORKFLOW.getEmpId();
|
1328
|
var startCuti = Body.down(''datefield[name=main_start_date]'').getValue();
|
1329
|
var main_leave_quota = Body.down(''textfield[name=main_leave_quota]'').getValue();
|
1330
|
var main_total_remaining_quota = Body.down(''numberfield[name=main_total_remaining_quota]'').getValue();
|
1331
|
var totalCuti = parseInt(main_leave_quota) - parseInt(main_total_remaining_quota);
|
1332
|
|
1333
|
if (MinovaUtil.WORKFLOW.isRequest() || taskID === ''start'' || taskID === ''create'') {
|
1334
|
MinovaUtil.executeParamQuery({
|
1335
|
paramid: ''validasi_lv_prorate_cuti'',
|
1336
|
emp_id: emp_id,
|
1337
|
startCuti: startCuti,
|
1338
|
totalCuti: totalCuti
|
1339
|
}, function (s) {
|
1340
|
try {
|
1341
|
var warning = Ext.decode(s.responseText).data[0].warning;
|
1342
|
if (warning === ''1'') {
|
1343
|
var warning_text = Ext.decode(s.responseText).data[0].warning_text;
|
1344
|
MinovaUtil.MESSAGE.error(warning_text);
|
1345
|
return;
|
1346
|
}
|
1347
|
new submit();
|
1348
|
} catch (e) {}
|
1349
|
|
1350
|
}, function (e) {});
|
1351
|
}
|
1352
|
},
|
1353
|
validasiHariLibur2: function (submit) {
|
1354
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
1355
|
|
1356
|
if (MinovaUtil.WORKFLOW.isRequest() || taskID === ''start'' || taskID === ''create'') {
|
1357
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1358
|
var quotadeduc = body.down(''textfield[name=main_quota_deduction]'').getValue();
|
1359
|
var totquotataken = body.down(''numberfield[name=main_total_quota_taken]'').getValue();
|
1360
|
|
1361
|
if (quotadeduc === "Y" && totquotataken === 0) {
|
1362
|
MinovaUtil.MESSAGE.error("Cuti tidak dapat dilakukan pada hari libur");
|
1363
|
} else {
|
1364
|
submit();
|
1365
|
}
|
1366
|
}
|
1367
|
},
|
1368
|
|
1369
|
onTask_apv_conf_dir_spv: function (me) {
|
1370
|
me.disableConfirmation();
|
1371
|
},
|
1372
|
onTask_apv_ds3: function (me) {
|
1373
|
me.disableConfirmation();
|
1374
|
},
|
1375
|
onTask_apv_dir_spv: function (me) {
|
1376
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
1377
|
},
|
1378
|
onTask_apv_ds1: function (me) {
|
1379
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
1380
|
},
|
1381
|
onTask_apv_direct_spv: function (me) {
|
1382
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
1383
|
},
|
1384
|
onTask_apv_confirm_direct_spv: function (me) {
|
1385
|
me.disableConfirmation();
|
1386
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
1387
|
},
|
1388
|
onTask_conf_cond_revise_date_apv_dir_spv: function (me) {
|
1389
|
me.disableConfirmation();
|
1390
|
MinovaUtil.WORKFLOW.setReadOnlyViewBodyWorkflow();
|
1391
|
},
|
1392
|
onTask_creator_confirm: function (me) {
|
1393
|
me.showConfirmation();
|
1394
|
},
|
1395
|
showConfirmation: function () {
|
1396
|
var view = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1397
|
view.down(''[name=main_leave_confirmation]'').show();
|
1398
|
view.down(''[name=main_leave_confirmation]'').allowBlank = false;
|
1399
|
},
|
1400
|
disableConfirmation: function () {
|
1401
|
this.showConfirmation();
|
1402
|
var view = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1403
|
view.down(''[name=main_leave_confirmation]'').setReadOnly(true);
|
1404
|
view.down(''[name=main_leave_confirmation]'').allowBlank = true;
|
1405
|
},
|
1406
|
validasi_cuti_tahunan: function (submit) {
|
1407
|
var me = MinovaUtil.WORKFLOW.loadControllerByViewClass(MinovaUtil.WORKFLOW.getViewBodyWorkflow().$className)
|
1408
|
var absenceType = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_absence_type]'').getValue();
|
1409
|
var start_date = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_start_date]'').getValue();
|
1410
|
var quota_type = MinovaUtil.WORKFLOW.getViewBodyWorkflow().down(''[name=main_quota_type]'').getValue();
|
1411
|
|
1412
|
if (absenceType === ''1000'') {
|
1413
|
MinovaUtil.executeParamQuery({
|
1414
|
paramid: ''leave_cek_cuti_tahunan'',
|
1415
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
1416
|
start_date: start_date,
|
1417
|
quota_type: quota_type
|
1418
|
}, function (s) {
|
1419
|
var data = Ext.decode(s.responseText).data[0]
|
1420
|
if (data.warning === ''1'') {
|
1421
|
MinovaUtil.MESSAGE.error(data.warning_text);
|
1422
|
} else {
|
1423
|
submit()
|
1424
|
}
|
1425
|
}, function (f) {})
|
1426
|
} else {
|
1427
|
me.leave_validation(submit)
|
1428
|
}
|
1429
|
},
|
1430
|
leave_validation: function (submit) {
|
1431
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow()
|
1432
|
var absenceType = body.down(''[name=main_absence_type]'').getValue();
|
1433
|
var emp_id = MinovaUtil.WORKFLOW.getEmpId();
|
1434
|
var sdate = body.down(''[name=main_start_date]'').getValue();
|
1435
|
var qdec = body.down(''[name=main_quota_deduction]'').getValue();
|
1436
|
|
1437
|
if (qdec == ''Y'') {
|
1438
|
submit();
|
1439
|
} else {
|
1440
|
MinovaUtil.executeParamQuery({
|
1441
|
paramid: ''leave_validation'',
|
1442
|
absence_type: absenceType,
|
1443
|
start_cuti: sdate,
|
1444
|
emp_id: emp_id,
|
1445
|
reg_id: MinovaUtil.WORKFLOW.getRegId()
|
1446
|
}, function (s) {
|
1447
|
var data = Ext.decode(s.responseText).data[0]
|
1448
|
if (data != null) {
|
1449
|
if (data.warn > 0) {
|
1450
|
MinovaUtil.MESSAGE.error(data.msg)
|
1451
|
}
|
1452
|
} else {
|
1453
|
submit()
|
1454
|
}
|
1455
|
}, function (f) {})
|
1456
|
}
|
1457
|
},
|
1458
|
ValidasiMaksimaPengajuan: function (submit) {
|
1459
|
var taskID = MinovaUtil.WORKFLOW.getTaskId();
|
1460
|
var BizprocId = MinovaUtil.WORKFLOW.getBizprocId();
|
1461
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1462
|
var Sd = body.down(''[name=main_start_date]'').getValue();
|
1463
|
var Ed = body.down(''[name=main_end_date]'').getValue();
|
1464
|
var NDate = null;
|
1465
|
var izin = '''';
|
1466
|
var absence_type = body.down(''[name=main_absence_type]'').getValue();
|
1467
|
if (taskID == ''start'' && BizprocId == ''leave'') {
|
1468
|
MinovaUtil.executeParamQuery({
|
1469
|
paramid: ''ValidasiLeaveSetahun'',
|
1470
|
emp_id: MinovaUtil.WORKFLOW.getEmpId(),
|
1471
|
start_date: Sd
|
1472
|
}, function (s) {
|
1473
|
var result = Ext.decode(s.responseText);
|
1474
|
var data = result.data[0];
|
1475
|
var obju = data;
|
1476
|
if (obju !== undefined) {
|
1477
|
izin = obju.IZIN;
|
1478
|
}
|
1479
|
}, function (f) {})
|
1480
|
if (absence_type == ''AL1'' || absence_type == ''AL2'') {
|
1481
|
if (izin == ''no'' || izin == '''') {
|
1482
|
MinovaUtil.MESSAGE.error("Anda belum diperkenankan untuk melakukan pengajuan cuti");
|
1483
|
body.down(''[name=main_start_date]'').setValue('''');
|
1484
|
}
|
1485
|
}
|
1486
|
}
|
1487
|
|
1488
|
MinovaUtil.executeParamQuery({
|
1489
|
paramid: ''now_date''
|
1490
|
}, function (s) {
|
1491
|
var data = Ext.decode(s.responseText).data[0]
|
1492
|
if (data != null) {
|
1493
|
NDate = data.NowDate;
|
1494
|
} else {
|
1495
|
NDate = me.now8();
|
1496
|
}
|
1497
|
}, function (f) {})
|
1498
|
var Duration = this.GetDateDiff(Sd, NDate);
|
1499
|
|
1500
|
var abs_type = body.down(''[name=main_absence_type]'').getValue();
|
1501
|
|
1502
|
var CountDt = null;
|
1503
|
MinovaUtil.executeParamQuery({
|
1504
|
paramid: ''wf_leave_get_absentype'',
|
1505
|
abs_type: abs_type
|
1506
|
}, function (s) {
|
1507
|
var data = Ext.decode(s.responseText).data[0]
|
1508
|
if (data != null) {
|
1509
|
CountDt = data.Res;
|
1510
|
}
|
1511
|
}, function (f) {})
|
1512
|
|
1513
|
var Duration = this.GetDateDiff(Sd, NDate);
|
1514
|
var quotadeduc = body.down(''textfield[name=main_quota_deduction]'').getValue();
|
1515
|
|
1516
|
if (taskID === ''start'' || taskID === ''revisess_creator'') {
|
1517
|
if (CountDt >= 1 && Duration < 3) {
|
1518
|
MinovaUtil.MESSAGE.error("Pengajuan ESS bisa dilakukan Maksimal 3 Hari berikutnya");
|
1519
|
body.down(''[name=main_start_date]'').setValue('''');
|
1520
|
} else {
|
1521
|
this.changeDateRange();
|
1522
|
}
|
1523
|
}
|
1524
|
}
|
1525
|
});
|
1526
|
Ext.apply(Ext.form.field.VTypes, {
|
1527
|
|
1528
|
block_leave: function (val, field) {
|
1529
|
var wfv = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
1530
|
var a = wfv.down(''textfield[name=main_quota_start_date_2]'');
|
1531
|
var a1 = wfv.down(''textfield[name=main_quota_start_date]'');
|
1532
|
var b = wfv.down(''textfield[name=main_quota_lb_cont_2]'');
|
1533
|
var b1 = wfv.down(''textfield[name=main_quota_lb_cont]'');
|
1534
|
var c = wfv.down(''textfield[name=main_total_remaining_quota_2]'');
|
1535
|
var c1 = wfv.down(''textfield[name=main_total_remaining_quota]'');
|
1536
|
var d1 = wfv.down(''[name=main_quota_taken]'');
|
1537
|
var d = wfv.down(''[name=main_quota_taken_2]'');
|
1538
|
var dt = wfv.down(''[name=main_total_quota_taken]'');
|
1539
|
var absenceType = wfv.down(''[name=main_absence_type]'');
|
1540
|
if (absenceType.getValue() === ''1000'') {
|
1541
|
if ((a.getValue() !== '''' || a.getValue() !== ''0'') && b.getValue() === ''0'' && c.getValue() < 5 && c.getValue() !== null) {
|
1542
|
if (c.getValue() < 5 && dt.getValue() < 5 && dt.getValue() !== null) {
|
1543
|
return false;
|
1544
|
}
|
1545
|
} else if ((a.getValue() === '''' || a.getValue() === ''0'') && b1.getValue() === ''0'' && c1.getValue() < 5 && c1.getValue() !== null) {
|
1546
|
if (c1.getValue() < 5 && dt.getValue() < 5 && dt.getValue() !== null) {
|
1547
|
return false;
|
1548
|
}
|
1549
|
}
|
1550
|
}
|
1551
|
|
1552
|
return true;
|
1553
|
},
|
1554
|
block_leaveText: ''Block leave must be taken'',
|
1555
|
total_taken: function (val, field) {
|
1556
|
var lv_block = Ext.ComponentQuery.query(''textfield[name=main_block_contain]'')[0];
|
1557
|
try {
|
1558
|
var q_taken = Ext.ComponentQuery.query(''textfield[name=main_total_quota_taken]'')[0];
|
1559
|
var q_remain = Ext.ComponentQuery.query(''textfield[name=main_total_remaining_quota]'')[0];
|
1560
|
if (lv_block.value === "0") {
|
1561
|
try {
|
1562
|
if (q_taken.value < 5 && q_remain.value < 5) {
|
1563
|
return false;
|
1564
|
}
|
1565
|
} catch (e) {}
|
1566
|
}
|
1567
|
if (lv_block.value === "1") {
|
1568
|
try {
|
1569
|
if (q_taken.value >= 5) {
|
1570
|
return false;
|
1571
|
}
|
1572
|
} catch (e) {}
|
1573
|
}
|
1574
|
} catch (e) {}
|
1575
|
return true;
|
1576
|
},
|
1577
|
total_takenText: ''Types of absences are included in the block leave and unused. Mandatory quotas taken at least 5''
|
1578
|
});
|
1579
|
Ext.QuickTips.init();' COLLATE SQL_Latin1_General_CP1_CI_AS, N'', N'minovais', '2021-11-18 09:35:44.360', N'minovais', '2021-11-18 15:19:33.197')
|
1580
|
PRINT(N'Operation applied to 1 rows out of 330')
|
1581
|
COMMIT TRANSACTION
|
1582
|
GO
|