Project

General

Profile

Bug #2851 » empList.js

shofwan shiddiq, 07/04/2024 03:54 PM

 
1
objMain.layout = 'border';
2

    
3
var userid = localStorage['MyuserIdLogin'] 
4

    
5
var status_grid = new Ext.data.JsonStore({
6
	autoLoad : true,
7
	fields : ["code", "desc", 'code_desc'],
8
	method : 'GET',
9
	sortInfo : {
10
		field : "code",
11
		direction : "ASC"
12
	},
13
	url : "/UserControl/DataCombo/?tableName=base_cust_ref_emp_status&value=emp_status&display=description",
14
	listeners: {
15
        load: function(store, records) {
16
            // Once store is loaded, set default value for combo box
17
            var combo = Ext.getCmp(program + 'emp_status2'); // Assuming you can get combo by id
18
            if (combo) {
19
                combo.setValue('01'); // Set default value to '01'
20
                // You may also set the display value here if needed
21
                // combo.setRawValue(records[0].get('desc')); // Example: Sets the display text of the combo
22
            }
23
        }
24
    }
25
});
26

    
27
var empType = new Ext.data.JsonStore({
28
	autoLoad: true,
29
	fields: ['code', 'desc'],
30
	method: 'GET',
31
	url: "/UserControl/DataCombo/?tableName=base_cust_ref_emp_type&value=emp_type&display=description"
32
});	
33

    
34
var store_year = new Ext.data.ArrayStore({
35
			id : "dataPeriodMonth",
36
			data : [["1"], ["2"], ["3"], ["4"],
37
					["5"], ["6"], ["7"], ["8"], ["9"], ["10"],
38
					["11"], ["12"], ["13"], ["14"], ["15"], ["16"], ["17"], ["18"], ["19"], ["20"], ["21"], ["22"], ["23"], ["24"], ["25"], ["26"], ["27"], ["28"], ["29"], ["30"]],
39
			fields : ["code"]
40
		});
41
		
42
var store_month = new Ext.data.ArrayStore({
43
			id : "dataPeriodMonth",
44
			data : [["0"],["1"], ["2"], ["3"], ["4"],
45
					["5"], ["6"], ["7"], ["8"], ["9"], ["10"],
46
					["11"], ["12"],],
47
			fields : ["code"]
48
		});
49

    
50
var SearchPanel = new Ext.Panel({
51
	id : program + 'idSearchPanel',
52
	title : 'Report Filter',
53
	region : 'north',
54
	height : 255,
55
	frame : true,
56
	layout:'column',
57
	border : false,
58
	split : true,
59
	collapsible : true,
60
	collapseMode : 'mini',
61
	bbar : [{
62
		xtype : 'button',
63
		text : 'View Report',
64
		iconCls : 'icon-table_save',
65
		handler : viewreport
66
	}]
67
});
68

    
69
var MainPanel = new Ext.Panel({
70
			id : program + 'idReportPanel',
71
			region : 'center',
72
			layout : 'fit'
73
		});
74

    
75
var Searchparam2 = new Ext.FormPanel({
76
	id : program + 'idgetparam2',
77
	//method : 'POST',
78
	bodyStyle : {
79
		padding : '5px 10px 0'
80
	},
81
	labelWidth : 200,
82
	border : false,
83
	items : [
84
			{
85
				id : program + 'emp_status2',
86
				name : 'emp_status2',
87
				width : 200,
88
				fieldLabel : 'Employee Status',
89
				xtype : 'combo',
90
				store : status_grid,
91
				mode : 'local',
92
				displayField : "desc",
93
				valueField : "code",
94
				triggerAction : 'all',
95
				hiddenName : 'emp_status2',
96
				listeners : {}
97
			},{
98
				id : program + 'employee_type2',
99
				name : 'employee_type2',
100
				width : 200,
101
				fieldLabel : 'Employee Type',
102
				xtype : 'combo',
103
				store : empType,
104
				mode : 'local',
105
				displayField : "desc",
106
				valueField : "code",
107
				triggerAction : 'all',
108
				hiddenName : 'employee_type2',
109
				listeners : {}
110
			},{
111
				id : program + 'sk2',
112
				xtype     : 'textfield',
113
				width	  : 200,
114
				name      : 'sk2',
115
				fieldLabel: 'SK Number',
116
				readOnly: false,
117
			},{
118
				xtype: 'panel',
119
				fieldLabel: 'Masa Kerja (Hire)',
120
				layout: 'column',
121
				items:[{
122
						id: program + 'masa_kerja_hire_years2'
123
						, title: 'Year'
124
						, name: 'masa_kerja_hire_years2'
125
						//, cls : 'minova-mandatory'
126
						, xtype: 'combo'
127
						, store: store_year
128
						, width: 100
129
						, mode: 'local'
130
						, triggerAction: 'all'
131
						, displayField: "code"
132
						, valueField: "code"
133
					},
134
					{
135
						id: program + 'masa_kerja_hire_months2'
136
						, title: 'Month'
137
						, name: 'masa_kerja_hire_months2'
138
						//, cls : 'minova-mandatory'
139
						, xtype: 'combo'
140
						, store: store_month
141
						, width: 100
142
						, mode: 'local'
143
						, triggerAction: 'all'
144
						, displayField: "code"
145
						, valueField: "code"
146
					}]
147
			},{
148
				xtype: 'panel',
149
				fieldLabel: 'Masa Kerja (Join)',
150
				layout: 'column',
151
				items:[{
152
						id: program + 'masa_kerja_join_years2'
153
						, title: 'year'
154
						, name: 'masa_kerja_join_years2'
155
						//, cls : 'minova-mandatory'
156
						, xtype: 'combo'
157
						, store: store_year
158
						, width: 100
159
						, mode: 'local'
160
						, triggerAction: 'all'
161
						, displayField: "code"
162
						, valueField: "code"
163
					},
164
					{
165
						id: program + 'masa_kerja_join_months2'
166
						, title: 'Month'
167
						, name: 'masa_kerja_join_months2'
168
						//, cls : 'minova-mandatory'
169
						, xtype: 'combo'
170
						, store: store_month
171
						, width: 100
172
						, mode: 'local'
173
						, triggerAction: 'all'
174
						, displayField: "code"
175
						, valueField: "code"
176
					}]
177
			},{	
178
				xtype : 'datefield',
179
				format : 'd/m/Y',
180
				name : 'j_date2',
181
				id : program + 'j_date2',
182
				fieldLabel : 'Join Date',
183
				width: 200
184
			},{
185
				xtype : 'hidden',
186
				name : 'join_date2',
187
				id : program + 'join_date2'
188
			},{	
189
				xtype : 'datefield',
190
				format : 'd/m/Y',
191
				name : 'e_date2',
192
				id : program + 'e_date2',
193
				fieldLabel : 'Effective Date',
194
				width: 200,
195
value: new Date()
196
			},{
197
				xtype : 'hidden',
198
				name : 'effective_date2',
199
				id : program + 'effective_date2'
200
			}			
201
			]
202
});	
203

    
204
var Searchparam = new Ext.FormPanel({
205
	id : program + 'idgetparam',
206
	method : 'POST',
207
	bodyStyle : {
208
		padding : '5px 10px 0'
209
	},
210
	labelWidth : 200,
211
	border : false,
212
	items : [
213
			{
214
				id : program + 'txtReportID',
215
				name : 'report_id',
216
				xtype : 'hidden',
217
				value : '6640029',
218
				hiddenName : 'ReportID'
219
			},
220
			LookUpField(program + 'emp', 150, 500, 500, 'NIP Minova', 'md01', true),
221
			{
222
				id : program + 'emp_id',
223
				name : 'emp_id',
224
				xtype : 'hidden'
225
			},
226
			{
227
				id : program + 'nip_proint',
228
				xtype     : 'textfield',
229
				width	  : 200,
230
				name      : 'nip_proint',
231
				fieldLabel: 'NIP Proint',
232
				readOnly: false,
233
			},
234
			{
235
				id : program + 'emp_name',
236
				xtype     : 'textfield',
237
				width	  : 200,
238
				name      : 'emp_name',
239
				fieldLabel: 'Full Name',
240
				readOnly: false,
241
			},
242
			{	
243
						xtype : 'datefield',
244
						format : 'd/m/Y',
245
						name : 'h_date_from',
246
						id : program + 'h_date_from',
247
						fieldLabel : 'Hiring Date From',
248
						width	  : 200,
249
			},
250
			{
251
						xtype : 'hidden',
252
						name : 'hiring_date_from',
253
						id : program + 'hiring_date_from'
254
			},{	
255
						xtype : 'datefield',
256
						format : 'd/m/Y',
257
						name : 'h_date_to',
258
						id : program + 'h_date_to',
259
						fieldLabel : 'Hiring Date To',
260
						width	  : 200,
261
			},
262
			{
263
						xtype : 'hidden',
264
						name : 'hiring_date_to',
265
						id : program + 'hiring_date_to'
266
			},
267
			{	
268
						xtype : 'datefield',
269
						format : 'd/m/Y',
270
						name : 'r_date_from',
271
						id : program + 'r_date_from',
272
						fieldLabel : 'Resign Date From',
273
						width	  : 200,
274
			},
275
			{
276
						xtype : 'hidden',
277
						name : 'resign_date_from',
278
						id : program + 'resign_date_from'
279
			},{	
280
						xtype : 'datefield',
281
						format : 'd/m/Y',
282
						name : 'r_date_to',
283
						id : program + 'r_date_to',
284
						fieldLabel : 'Resign Date To',
285
						width	  : 200,
286
			},
287
			{
288
						xtype : 'hidden',
289
						name : 'resign_date_to',
290
						id : program + 'resign_date_to'
291
			},
292
			{
293
				id : program + 'user_id',
294
				name : 'user_id',
295
				xtype: 'hidden',
296
				value : userid,
297
			},
298
			// Data Get dari SearchParam2 //
299
			{
300
				id : program + 'emp_status',
301
				name : 'emp_status',
302
				xtype : 'hidden'
303
			},
304
			{
305
				id : program + 'employee_type',
306
				name : 'employee_type',
307
				xtype : 'hidden'
308
			},
309
			{
310
				id : program + 'sk',
311
				name : 'sk',
312
				xtype : 'hidden'
313
			},
314
			{
315
				id : program + 'masa_kerja_hire_years',
316
				name : 'masa_kerja_hire_years',
317
				xtype : 'hidden'
318
			},
319
			{
320
				id : program + 'masa_kerja_hire_months',
321
				name : 'masa_kerja_hire_months',
322
				xtype : 'hidden'
323
			},
324
			{
325
				id : program + 'masa_kerja_join_years',
326
				name : 'masa_kerja_join_years',
327
				xtype : 'hidden'
328
			},
329
			{
330
				id : program + 'masa_kerja_join_months',
331
				name : 'masa_kerja_join_months',
332
				xtype : 'hidden'
333
			},
334
			{
335
				id : program + 'join_date',
336
				name : 'join_date',
337
				xtype : 'hidden'
338
			},
339
			{
340
				id : program + 'effective_date',
341
				name : 'effective_date',
342
				xtype : 'hidden'
343
			}
344
			]
345
});
346

    
347
function viewreport() {
348
	if (Ext.getCmp(program + 'idgetparam').getForm().isValid()) {
349
		
350
		
351
		Ext.getCmp(program + 'emp_id').setValue(LookUpGetValue(program + 'emp').getValue());
352
		
353
		var hdf = Ext.getCmp(program + 'h_date_from').getValue();
354
		var hdt = Ext.getCmp(program + 'h_date_to').getValue();
355
		if (hdf != "") {
356
			Ext.getCmp(program + 'hiring_date_from').setValue(hdf.format('Ymd'));
357
		} else {
358
			Ext.getCmp(program + 'hiring_date_from').setValue("");
359
		}
360
		
361
		if (hdt != "") {
362
			Ext.getCmp(program + 'hiring_date_to').setValue(hdt.format('Ymd'));
363
		} else {
364
			Ext.getCmp(program + 'hiring_date_to').setValue("");
365
		};
366
		
367
		var rdf = Ext.getCmp(program + 'r_date_from').getValue();
368
		var rdt = Ext.getCmp(program + 'r_date_to').getValue();
369
		if (rdf != "") {
370
			Ext.getCmp(program + 'resign_date_from').setValue(rdf.format('Ymd'));
371
		} else {
372
			Ext.getCmp(program + 'resign_date_from').setValue("");
373
		}
374
		
375
		if (rdt != "") {
376
			Ext.getCmp(program + 'resign_date_to').setValue(rdt.format('Ymd'));
377
		} else {
378
			Ext.getCmp(program + 'resign_date_to').setValue("");
379
		};
380
		
381
		var jd = Ext.getCmp(program + 'j_date2').getValue();
382
		if (jd != "") {
383
			Ext.getCmp(program + 'join_date2').setValue(jd.format('Ymd'));
384
		} else {
385
			Ext.getCmp(program + 'join_date2').setValue("");
386
		};
387
		
388
		var ed = Ext.getCmp(program + 'e_date2').getValue();
389
		if (ed != "") {
390
			Ext.getCmp(program + 'effective_date2').setValue(ed.format('Ymd'));
391
		} else {
392
			Ext.getCmp(program + 'effective_date2').setValue("");
393
		};
394
		
395
		var rep_id = Ext.getCmp(program + 'txtReportID').getValue();
396

    
397
		var htmlVal = '<iframe style="overflow:auto;width:100%;height:100%;" frameborder="0"  src="/Base/ViewReportInline/'
398
				+ rep_id + '"></iframe>';
399

    
400
		var _reportBody = new Ext.Panel({
401
					border : false,
402
					height : 900,
403
					html : htmlVal
404
				});
405

    
406
// Set Value dari Search Param2 ke Param1 //
407
Ext.getCmp(program + 'emp_status').setValue(Ext.getCmp(program + 'emp_status2').getValue());		
408
Ext.getCmp(program + 'employee_type').setValue(Ext.getCmp(program + 'employee_type2').getValue());		
409
Ext.getCmp(program + 'sk').setValue(Ext.getCmp(program + 'sk2').getValue());		
410
Ext.getCmp(program + 'masa_kerja_hire_years').setValue(Ext.getCmp(program + 'masa_kerja_hire_years2').getValue());		
411
Ext.getCmp(program + 'masa_kerja_hire_months').setValue(Ext.getCmp(program + 'masa_kerja_hire_months2').getValue());
412
Ext.getCmp(program + 'masa_kerja_join_years').setValue(Ext.getCmp(program + 'masa_kerja_join_years2').getValue());
413
Ext.getCmp(program + 'masa_kerja_join_months').setValue(Ext.getCmp(program + 'masa_kerja_join_months2').getValue());
414
Ext.getCmp(program + 'join_date').setValue(Ext.getCmp(program + 'join_date2').getValue());	
415
Ext.getCmp(program + 'effective_date').setValue(Ext.getCmp(program + 'effective_date2').getValue());
416

    
417
		Ext.getCmp(program + 'idgetparam').getForm().submit({
418
					url : "/Base/SetParamReport",
419
					success : function(form, action) {
420

    
421
						Ext.getCmp(program + 'idReportPanel').removeAll();
422
						Ext.getCmp(program + 'idReportPanel').add(_reportBody);
423
						Ext.getCmp(program + 'idReportPanel').doLayout();
424

    
425
					},
426
					failure : function(form, action) {
427

    
428
						alert("Error...");
429

    
430
					}
431
				});
432
	}
433
}
434

    
435
SearchPanel.add(Searchparam);
436
SearchPanel.add(Searchparam2);
437
objMain.add(SearchPanel);
438
objMain.add(MainPanel);
(1-1/2)