1
|
=> penambahan CekLvDate di field OnInitExtensions di 'field[name=StartDate]': {
|
2
|
change: function (field) {
|
3
|
selectDate(field);
|
4
|
fillEndDate(field);
|
5
|
CekLvDate(); // penambahan
|
6
|
}
|
7
|
},
|
8
|
|
9
|
'field[name=AbsenceType]': {
|
10
|
select: function (field) {
|
11
|
selectAbsenceType(field);
|
12
|
fillEndDate(field);
|
13
|
CutiThn(); // penambahan
|
14
|
}
|
15
|
},
|
16
|
|
17
|
|
18
|
// penambahan field[name=TotalRemainingQuota]
|
19
|
'field[name=TotalRemainingQuota]': {
|
20
|
change: function () {
|
21
|
CekLvMin();
|
22
|
}
|
23
|
},
|
24
|
=> penambahan function di field OnMethodExtensions:
|
25
|
|
26
|
function CekLvDate() {
|
27
|
debugger;
|
28
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
29
|
var emp = MinovaUtil.WORKFLOW.getEmpId();
|
30
|
var StartDate = body.down('field[name=StartDate]').getValue();
|
31
|
var Lv = '';
|
32
|
var lv2 = '';
|
33
|
MinovaUtil.ExecuteParamQuery({
|
34
|
ID: 'LVCKDATE',
|
35
|
StartDate: StartDate,
|
36
|
EmpID: emp
|
37
|
}, function (s) {
|
38
|
d
|
39
|
var result = Ext.decode(s.responseText);
|
40
|
var dt = Ext.decode(Ext.decode(result.data));
|
41
|
if (dt.length == 0) {
|
42
|
Lv = '';
|
43
|
} else {
|
44
|
var val = dt[0].Tglrovr;
|
45
|
var val2 = dt[0].Tglrun;
|
46
|
Lv = val;
|
47
|
lv2 = val2;
|
48
|
}
|
49
|
});
|
50
|
if (Lv == '1') {
|
51
|
MinovaMessageError("ERROR", "CEK19LV", "", "");
|
52
|
body.down('field[name=StartDate]').setValue('');
|
53
|
body.down('field[name=EndDate]').setValue('');
|
54
|
} else if (lv2 == '1') {
|
55
|
MinovaMessageError("ERROR", "CEKRUNLV", "", "");
|
56
|
body.down('field[name=StartDate]').setValue('');
|
57
|
body.down('field[name=EndDate]').setValue('');
|
58
|
}
|
59
|
}
|
60
|
function CekLvMin() {
|
61
|
var Body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
62
|
var ttlquo = Body.down('[name=TotalRemainingQuota]').getValue();
|
63
|
if (ttlquo < 0) {
|
64
|
MinovaMessageError("ERROR", "CEKLVQUO", "", "");
|
65
|
Body.down('field[name=EndDate]').setValue('');
|
66
|
}
|
67
|
}
|
68
|
function CutiThn() {
|
69
|
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
|
70
|
var abs = body.down('[name=AbsenceType]').getValue();
|
71
|
var StartDate = body.down('[name=StartDate]');
|
72
|
var StartD = body.down('[name=StartDate]').getValue();
|
73
|
var EndDate = body.down('[name=EndDate]');
|
74
|
var ss = '19000101';
|
75
|
var ee = '99991231';
|
76
|
var now = MinovaUtil.GetNowDate();
|
77
|
var abss = body.down('[name=TotalAbsenceTaken]');
|
78
|
var res = '';
|
79
|
MinovaUtil.ExecuteParamQuery({
|
80
|
ID: 'CEKTWOWEEKLEAVE'
|
81
|
}, function (s) {
|
82
|
var result = Ext.decode(s.responseText);
|
83
|
var dt = Ext.decode(Ext.decode(result.data));
|
84
|
var val = dt[0].res;
|
85
|
res = val;
|
86
|
});
|
87
|
if (abs == '1000') {
|
88
|
StartDate.setMinValue(res.substring(6, 8) + '/' + res.substring(4, 6) + '/' + res.substring(0, 4));
|
89
|
StartDate.setMaxValue(ee.substring(6, 8) + '/' + ee.substring(4, 6) + '/' + ee.substring(0, 4));
|
90
|
EndDate.setMinValue(StartD.substring(6, 8) + '/' + StartD.substring(4, 6) + '/' + StartD.substring(0, 4));
|
91
|
EndDate.setMaxValue(ee.substring(6, 8) + '/' + ee.substring(4, 6) + '/' + ee.substring(0, 4));
|
92
|
} else {
|
93
|
StartDate.setMinValue(ss.substring(6, 8) + '/' + ss.substring(4, 6) + '/' + ss.substring(0, 4));
|
94
|
EndDate.setMaxValue(ee.substring(6, 8) + '/' + ee.substring(4, 6) + '/' + ee.substring(0, 4));
|
95
|
}
|
96
|
}
|
97
|
|
98
|
=> tambah Data di table [dbo].[PCMWFCUSTPARAM] :
|
99
|
1)
|
100
|
ID : LVCKDATE
|
101
|
|
102
|
Value :
|
103
|
DECLARE @Regidtbl TABLE(RegID VARCHAR(20)) INSERT INTO @Regidtbl SELECT RegID FROM dbo.PCMWFRUNMAIN WHERE BizflowID ='MD_Leave_AJTM' AND EmpIDAs=@EmpID DECLARE @TglRun TABLE(Tglrun VARCHAR(20)) INSERT INTO @TglRun SELECT DISTINCT CASE WHEN NOT EXISTS (SELECT DISTINCT Value FROM PCMWFRUNBIZDATA DATA INNER JOIN @Regidtbl reg ON reg.RegID = data.RegID WHERE FieldID ='StartDate' AND Value =@StartDate ) THEN '0' ELSE '1' END DECLARE @TglOvr TABLE(Tglrovr VARCHAR(20)) INSERT INTO @TglOvr SELECT DISTINCT CASE WHEN NOT EXISTS (SELECT DISTINCT StartDate FROM PHRPA0019 WHERE EmployeeID = @EmpID AND StartDate =@StartDate) THEN '0' ELSE '1' END SELECT * FROM @TglOvr, @TglRun
|
104
|
|
105
|
CommandType : sqlstring
|
106
|
|
107
|
2)
|
108
|
ID : CEKTWOWEEKLEAVE
|
109
|
|
110
|
Value :
|
111
|
DECLARE @Days VARCHAR(20) = (SELECT Value1 FROM dbo.PCMEPGENPARAM WHERE Parameter='MINIMALHARIPENGAJUANCUTITAHUNAN') DECLARE @Now VARCHAR(20) = (SELECT FORMAT (getdate(), 'yyyymmdd') ) DECLARE @Two DATETIME = (SELECT DATEADD(DAY,CAST(@Days AS int) , GETDATE())) SELECT FORMAT (@Two,'yyyyMMdd') AS res
|
112
|
|
113
|
CommandType : sqlstring
|