Project

General

Profile

Bug #1021 » bintangupdate.txt

Saswanto Tampan, 04/13/2022 04:50 PM

 
1

    
2
if (fldTransempid.getValue() == "" )
3
{
4
	fnGetLastEmpID();
5
}
6

    
7
PanelWizardData.setActiveTab(1);
8
PanelWizardData.el.mask("Loading...", "x-mask-loading");
9

    
10
var _count = dataWizInfo.getCount();
11
fldWizItemTotal.setValue(_count); 
12
fldWizItemActive.setValue('0');
13
fldTitleActive.setValue('0');
14
var k = 1;
15

    
16
var txtdesc = LookUpGetValue('txtDesc').getValue();
17
//hidEmpId.setValue(fldWizempid.getValue());
18

    
19
if (_count > 0){
20

    
21
	var i = 0;
22
	dataWizInfo.each(function(_rec){
23
		
24
		var _cols = _rec.json;
25
		var _code = _cols.code;
26
		var _seq = _cols.seq;
27
		var _desc = _cols.desc;
28
		var _md = _cols.md;
29
		var _mandatory = _cols.mandatory;
30
		
31
		//--- Tab Management
32
		//var _pnlName = 'pnlMD' + _md + '_Data';
33
		//var _pnlTemp = eval("(" + _pnlName + ")");
34
		
35
		var employeeid = txtdesc;
36
		var md = _cols.md;
37
		var empid = fldTransempid.getValue();
38
		var percode = perCode.getValue(); 
39
		var accesscode = accessCode.getValue();
40
		var mdcat = mdCat.getValue();
41
		var gen = percode+mdcat+accesscode+md+empid;
42

    
43
		var stringArray = new Array();
44
			stringArray[gen] = new Ext.data.JsonStore({
45
		        fields: ["field_name", "column_name", "class", "gridview", "read_only", "required", "max_size", "min_value", "max_value", "default_value", "controller_store", "width", "anchor", "column_no", "popup_func", "select_func", "change_func", "grid_renderer_func", "select_func_target", "change_func_target", "submit_value"]
46
		    });
47
		var stringPrimaryKey = new Array();
48
			stringPrimaryKey[gen] = new Ext.data.JsonStore({
49
		        fields: ["field_name", "column_name"]
50
		    });
51
			
52
		var btnSave = new Array();
53
			btnSave[gen] = new Ext.Button({
54
				text : 'Save',
55
				iconCls : 'icon-forward_blue'
56
			});
57
		btnSave[gen].on('click', function(){saveclick();});
58
		
59
		var btnSkip = new Array();
60
			btnSkip[gen] = new Ext.Button({
61
				text : 'Next',
62
				iconCls : 'icon-next_blue'
63
			});
64
		btnSkip[gen].on('click', function(){skipalert();});
65
		
66
		var btnBack = new Array();
67
			btnBack[gen] = new Ext.Button({
68
				text : 'Cancel',
69
				iconCls: 'icon-arrow_undo'
70
			});
71
		btnBack[gen].on('click', function(){backclick();});
72
		
73
		var btnAdd = new Array();
74
			btnAdd[gen] = new Ext.Button({
75
				text : 'Add',
76
				iconCls: 'icon-add'
77
			});
78
		btnAdd[gen].on('click', function(){addclick(); });
79
			
80
		var btnExitDiscard = new Array();
81
			btnExitDiscard[gen] = new Ext.Button({
82
				text : 'Finished & Exit',
83
				iconCls : 'icon-delete'
84
			});
85
		btnExitDiscard[gen].on('click', function(){exitclick();});
86
		
87
		var btnSkipSave = new Array();
88
			btnSkipSave[gen] = new Ext.Button({
89
				text : 'Skip & Save All',
90
				iconCls : 'icon-book_next'
91
			});
92
		btnSkipSave[gen].on('click', function(){skipsaveclick();});
93
		
94
		//creategrid & js
95
		var jsGetData = new Array();
96
			jsGetData[gen] = new Ext.data.JsonStore({
97
		        metaData: true,
98
		        root: 'rows'
99
		    });
100
		jsGetData[gen].on('render', function(){new Ext.data.JsonReader();});
101
		if (k == _count)
102
		{
103
			var pnlDataGrid = new Array();	
104
				pnlDataGrid[gen] = new Ext.grid.GridPanel({
105
					store:jsGetData[gen],
106
					columns:'[]',
107
					height:200,
108
					loadMask:'true',
109
					split:'true',
110
					bbar:[btnAdd[gen],btnExitDiscard[gen]]
111
				});
112
			pnlDataGrid[gen].on('rowdblclick', function(thisGrid, rowIndex){clickgrid();});
113
		}
114
		else
115
		{
116
		var pnlDataGrid = new Array();	
117
				pnlDataGrid[gen] = new Ext.grid.GridPanel({
118
					store:jsGetData[gen],
119
					columns:'[]',
120
					height:200,
121
					loadMask:'true',
122
					split:'true',
123
					bbar:[btnAdd[gen],btnSkip[gen],btnSkipSave[gen]]
124
				});
125
			pnlDataGrid[gen].on('rowdblclick', function(thisGrid, rowIndex){clickgrid();});
126
		}
127
		
128
		//finishcreategrid
129

    
130
		$.ajax({
131
		       
132
		    url : "Devt/getStructureMD",
133
		    data : {md_code:_md, per_code:"emp"},
134
		    async:false,
135
		    success : function(result){
136
		    
137
			stringArray[gen].loadData(result.data.column);
138
			stringPrimaryKey[gen].loadData(result.data.PK);
139
			
140
		    if(result.success==false)
141
		    {
142
		       alert("Error On Save");
143
		    }
144
		    }
145

    
146
		});
147
		
148
		try
149
		{
150
			//alert(_md);
151
				$.ajax({		       
152
			    url : "Devt/getDataMD",
153
			    data : {md_cat:_md, per_code:percode , emp_id:employeeid},
154
			    async:false,
155
			    success : function(result){
156
				//alert("play success");
157
				//alert(result);
158
					jsGetData[gen].loadData(result);
159
					//alert("start test");
160
					//fnTest();
161
					//alert("end test");
162
				    if(result.success==false)
163
					    {
164
					      alert("Error On Save");
165
					    }
166
					}
167
				});	
168
		}
169
		catch(e)
170
		{
171
		//alert("Error On Save");
172
		}
173
		
174
		var btnClose = new Array();
175
			btnClose[gen] = new Ext.Button({
176
				text : 'Save',
177
				iconCls : 'icon-disk_black'
178
			});
179
		btnClose[gen].on('click', function(){closeclick();});
180
		
181
		function closeclick()
182
		{
183
			var _total = parseInt(fldWizItemTotal.getValue());
184
			var _active = parseInt(fldWizItemActive.getValue());
185
			pnlForm[gen].el.mask("Loading Data...","x-mask-loading");
186
			md_type[gen].setValue(md_temp);
187
			var url = "/HR_PA/AddMasterData/";
188
					
189
			pnlForm[gen].getForm().submit({
190
				clientValidation: true,
191
				url : url,
192
				success : function(form, action){
193
					pnlForm[gen].el.unmask();
194
					pnlWizData.removeAll();
195
					PanelWizardDetail.getForm().reset();
196
					dataWizInfo.removeAll();
197
					PanelWizardData.setActiveTab(0);
198
								  
199
				},
200
				failure : function(form, action){
201
					alert(action.failureType);
202
					pnlForm[gen].el.unmask(); 
203
					var result = action.result;
204
					if (result.success == false){
205
			            fnShowMsg(result.message,null);            
206
						}   		  
207
				    }
208
				});
209
		}
210
				
211
		function saveclick()
212
		{
213
			var _total = parseInt(fldWizItemTotal.getValue());
214
			var _active = parseInt(fldWizItemActive.getValue());
215
			var _title = parseInt(fldTitleActive.getValue());
216
			pnlForm[gen].el.mask("Loading Data...","x-mask-loading");	
217
			var url = "/HR_PA/AddMasterData/";
218
			var titlesaved = dataWizInfo.getAt(_title).json.desc;
219
			
220
			var generate = percode+mdcat+accesscode+md+empid;
221
			Ext.getCmp("emp_id" + generate).setValue(empid);
222

    
223
			pnlForm[gen].getForm().submit({
224
				clientValidation: true,
225
				url : url,
226
				success : function(form, action){
227
					var _hdate = fldTranseffdate.getValue();
228
					var _hdateconvert = _hdate.format("Ymd");
229
					$.ajax({
230

    
231
					    url : "HR_Core/TransAppEmp",
232
						async:false,
233
					    data : {lscape:'100', empid:empid, pay:'', hdate:_hdateconvert, cstat:'0', appid:employeeid},
234
					    success : function(result){
235
					    if(result.success==false)
236
					    {
237
					       alert("Error On Save");
238
					    }
239
						}
240
					});
241
					alert('Applicant Number : [' + employeeid + '] '+titlesaved+' has been Transferred to : ['+ empid +'] ');
242
					
243
					pnlForm[gen].el.unmask();
244
					if( md == '0001'|| md == '0002'|| md == '0003')
245
					{
246
						_active++;
247
						_title++;
248
					}
249
					else
250
					{
251
						_active--;
252
					}
253
					pnlWizData.layout.setActiveItem(_active);
254
					pnlWizData.setTitle('Data Processing - ' + dataWizInfo.getAt(_title).json.desc);
255
					fldWizItemActive.setValue(_active);
256
					fldTitleActive.setValue(_title);
257
				  
258
				},
259
				failure : function(form, action){
260
					alert(action.failureType);
261
					pnlForm[gen].el.unmask(); 
262
					var result = action.result;
263
					if (result.success == false){
264
			            fnShowMsg(result.message,null);            
265
						}   		  
266
				    }			
267
			})
268
		}
269
		
270
		function skipalert()
271
		{
272
			var _title = parseInt(fldTitleActive.getValue());
273
			Ext.Msg.show({
274
				title:'Skip Transfer?',
275
				msg: 'Are you sure you want to CONTINUE transferring '+ dataWizInfo.getAt(_title).json.desc +' ?',
276
				buttons: Ext.Msg.YESNO,
277
				fn: function(btn) {
278
				if(btn=='yes') {skipclick();};
279
				if(btn=='no') return false;
280
				},   
281
				icon: Ext.MessageBox.WARNING
282
			});
283
		}
284
		
285
		function skipclick()
286
		{
287
			var _total = parseInt(fldWizItemTotal.getValue());
288
			var _active = parseInt(fldWizItemActive.getValue());
289
			var _title = parseInt(fldTitleActive.getValue());
290
			//alert(_total);
291
			//alert("active"+_active);
292
			//alert(_title);
293
		
294
			md_type[gen].setValue(md_temp);
295
			_active = _active+2;
296
			_title++;
297
			console.log(pnlWizData);
298
			pnlWizData.layout.setActiveItem(_active);
299
			pnlWizData.setTitle('Data Processing - ' + dataWizInfo.getAt(_title).json.desc);
300
			fldWizItemActive.setValue(_active);
301
			fldTitleActive.setValue(_title);
302
			//alert("after"+_active);	
303
		}
304
		
305
		function backclick()
306
		{
307
			var _total = parseInt(fldWizItemTotal.getValue());
308
			var _active = parseInt(fldWizItemActive.getValue());
309
			var _title = parseInt(fldTitleActive.getValue());
310
			//alert("active"+_active);
311
		
312
			md_type[gen].setValue(md_temp);
313
			_active = _active-1;
314
			pnlWizData.layout.setActiveItem(_active);
315
			pnlWizData.setTitle('Data Processing - ' + dataWizInfo.getAt(_title).json.desc);
316
			fldWizItemActive.setValue(_active);
317
			//alert("after"+_active);	
318
		}
319
		
320
		var btnExit = new Array();
321
			btnExit[gen] = new Ext.Button({
322
				text : 'Finished & Exit',
323
				iconCls : 'icon-delete'
324
			});
325
		btnExit[gen].on('click', function(){exitclick();});
326
		
327
		function exitclick()
328
		{
329
			debugger;
330
			//saswanto 13april2022
331
			if (PanelWizardData.id=='obj_transfer_app_emp_PanelWizardData')
332
			{
333
				try
334
				{
335
					$.ajax({
336

    
337
						url : "HR_Core_Ext/CopyFileData",
338
						async:false,
339
						data : {emp_id:empid, rec_id:employeeid },
340
						success : function(result){
341
						if(result.success==false)
342
						{
343
						   alert("Error On Save");
344
						}
345
						}
346
					});
347
				}
348
				catch(e)
349
				{
350
				}
351
			}
352
			//tabs.un('beforeremove', confirmTabPanelTrans);
353
			//tabs.on('beforeremove', confirmTabPanelClosed);
354
			pnlWizInfo.enable();
355
			btnTransView.enable();
356
			pnlWizData.removeAll();
357
			PanelTransferDetail.getForm().reset();
358
			PanelWizardDetail.getForm().reset();
359
			dataWizInfo.removeAll();
360
			PanelWizardData.setActiveTab(0);
361
		}
362
		
363
		function clickgrid()
364
		{
365
			action[gen].setValue("insert"); 
366
			
367
			var _active = fldWizItemActive.getValue(); 
368
			_active++; pnlWizData.layout.setActiveItem(_active); 
369
			fldWizItemActive.setValue(_active); 
370
			
371
			var selected =pnlDataGrid[gen].getSelectionModel().getSelected(); 
372
			pnlForm[gen].getForm().loadRecord(selected); 
373
			md_type[gen].setValue("emp"+"md"+md); 
374
			
375
			var _hdate = fldTranseffdate.getValue(); 
376
			var _edate = new Date(); 
377
			
378
			_enddate = Date.parseDate("99991231","Ymd"); 
379
			_edate = _enddate.format("Ymd"); 
380
			var _hdateconvert = _hdate.format("Ymd");
381
			var dotd = Date.parseDate(_hdateconvert,"Ymd");
382
			var yyyy = dotd.getFullYear()+1;
383
			var mmx = dotd.getMonth()+1;
384
			var mm = String(mmx).padStart(2, '0')
385
			var ddx = dotd.getDate();
386
			var dd = String(ddx).padStart(2, '0')
387

    
388
			var today2 = dd+'-'+mm+'-'+yyyy;
389
			console.log(today2);
390
			var today3 = Date.parseDate(today2,"d-m-Y");
391
			console.log(today3);
392
			var yesterday = new Date (today3 - 864e5)
393
			console.log(yesterday);
394
			var today4 = yesterday.format("Ymd")
395
			console.log(today4);
396

    
397
			if( md == '0001'|| md == '0002'|| md == '0003')
398
			{
399
				
400
				Ext.getCmp("end_date" + gen).setValue(_edate);
401
				
402
				if (md == '0001')
403
				{
404
					Ext.getCmp("start_date" + gen).setValue(_hdateconvert);
405
					Ext.getCmp("nationality" + gen).setValue("IDN");
406
						//Ext.getCmp("position" + gen).setValue("");
407
						//Ext.getCmp("costcenter" + gen).setValue("");
408
						//Ext.getCmp("organization" + gen).setValue("");
409
						//Ext.getCmp("job" + gen).setValue("");
410
				}
411
				if (md == '0002')
412
				{
413
					Ext.getCmp("start_date" + gen).setValue(_hdateconvert); 
414
					Ext.getCmp("date_of_task" + gen).setValue(today4);
415
				}
416
			}
417
		}
418
		
419
		function addclick()
420
		{
421
			pnlForm[gen].getForm().reset(); 
422
			var _active = fldWizItemActive.getValue(); 
423
			_active++; 
424
			pnlWizData.layout.setActiveItem(_active); 
425
			fldWizItemActive.setValue(_active); 
426
			action[gen].setValue("insert");
427
			md_type[gen].setValue("emp"+"md"+md);
428
			
429
			var _hdate = fldTranseffdate.getValue(); 
430
			var _edate = new Date(); 
431
			
432
			_enddate = Date.parseDate("99991231","Ymd"); 
433
			_edate = _enddate.format("Ymd"); 
434
			var _hdateconvert = _hdate.format("Ymd");
435
			
436
			Ext.getCmp("start_date" + gen).setValue(_hdateconvert); 
437
			Ext.getCmp("end_date" + gen).setValue(_edate);
438
		}
439
		
440
		function skipsaveclick()
441
		{
442
			Ext.Msg.show({
443
			title : 'Skip and Save All Confirmation',
444
			msg : 'Are you sure want to Skip and Save All Remaining Master Data?',
445
			buttons : Ext.Msg.YESNO,
446
			fn : function(btn) {
447
				if (btn == 'yes') {
448
					//alert('play');
449
					//tabs.un('beforeremove', confirmTabPanelTrans);
450
					//tabs.on('beforeremove', confirmTabPanelClosed);
451
					fnsaveallmd();
452
					
453
					
454
				}
455
			},
456
			animEl : 'elId',
457
			icon : Ext.MessageBox.QUESTION
458
			});
459
		}
460
		
461
		function fnsaveallmd()
462
		{
463
		//getDataMD
464
			var _total = parseInt(fldWizItemTotal.getValue());
465
			var _active = parseInt(fldWizItemActive.getValue());
466
			var _active2 = _active / 2;
467
			var _emp_id = fldHireempid.getValue();
468
			//console.log(_total);
469
			//console.log(_active);
470
			//console.log(_active2);
471
			
472
			_active = _active+2;
473
			//console.log(pnlWizData);
474
			var _colOfGrid = pnlWizData.items;
475
			//console.log(_colOfGrid);
476
			//console.log(dataWizInfo);
477
			//console.log(stringPrimaryKey);
478
			//console.log(gen);
479
			for (var i = _active2; i< _total; i++)
480
			{
481
				console.log(i);
482
				var _gridData = _colOfGrid.items[i*2].store;
483
				console.log(_gridData);
484
				var _wizAttribute = dataWizInfo.getAt(i);
485
				console.log(_wizAttribute);
486
				var _md = _wizAttribute.get('md');
487
				console.log(_md);
488
				//console.og(_
489
				//console.log(_code);
490
				
491
				var _pkData = new Ext.data.JsonStore({
492
					fields: ["field_name", "column_name"]
493
				});
494
				$.ajax({
495
					url : "Devt/getStructureMD",
496
					data : {md_code:_md, per_code:"emp"},
497
					async:false,
498
					success : function(result){
499
						if(result.success == true)
500
							_pkData.loadData(result.data.PK);
501

    
502
					}
503
				});
504
				
505
				if (_gridData.getCount() > 0 && _pkData.getCount() > 0)
506
				{
507
					for (var j=0; j < _gridData.getCount(); j++)
508
					{
509
						var _postedData = _gridData.getAt(j).data;
510
						_postedData.emp_id = _emp_id;
511
						_postedData.md_type = 'empmd' + _md;
512
						_postedData.force = '0';
513
						
514
						_pkData.each(function(_rec){
515
							var _keyName = _rec.get('field_name');
516
							var _evalCommand = '_postedData.key_' + _keyName + '=""';
517
							eval(_evalCommand);
518
						});
519
						
520
						console.log(_postedData);
521
						Ext.Ajax.request({
522
							//clientValidation: true,
523
							url: 'HR_PATemp/AddMasterData',
524
							params: _postedData,
525
							method: 'POST',
526
							success: function(_xhr){
527
								_result = Ext.decode(_xhr.responseText);
528
								if (_result.success)
529
								{
530
									console.log('success for ' + i + ' record ' + j);									
531
								}
532
								else
533
								{
534
									console.log('error for ' + i + ' record ' + j + ' with message: ' + _result.message.text);
535
								}
536
							}
537
						});
538
					}
539
				}
540
				pnlWizInfo.enable();
541
				btnTransView.enable();
542
			}
543
				//update MD 0015
544
				var _hdate = fldTranseffdate.getValue();
545
				var _hdateconvert = _hdate.format("Ymd");
546
				$.ajax({
547

    
548
					url : "HR_Core/TransAppEmp",
549
					async:false,
550
					data : {lscape:'100', empid:_emp_id, pay:'', hdate:_hdateconvert, cstat:'0', appid:employeeid},
551
					success : function(result){
552
					if(result.success==false)
553
					{
554
					   alert("Error On Save");
555
					}
556
					}
557
				});
558
				
559
				//copy foto
560
				try
561
				{
562
					$.ajax({
563

    
564
						url : "HR_Core_Ext/CopyPhotoApptoEmp",
565
						async:false,
566
						data : {emp_id:_emp_id, rec_id:employeeid },
567
						success : function(result){
568
						if(result.success==false)
569
						{
570
						   alert("Error On Save");
571
						}
572
						}
573
					});
574
				}
575
				catch(e)
576
				{
577
				}
578
				//copy MD37
579
				try
580
				{
581
					$.ajax({
582

    
583
						url : "HR_Core_Ext/CopyFileData",
584
						async:false,
585
						data : {emp_id:_emp_id, rec_id:employeeid },
586
						success : function(result){
587
						if(result.success==false)
588
						{
589
						   alert("Error On Save");
590
						}
591
						}
592
					});
593
				}
594
				catch(e)
595
				{
596
				}
597
				//clear screen
598
				alert('Done/Sukses');
599
				pnlWizData.removeAll();
600
				PanelTransferDetail.getForm().reset();
601
				PanelWizardDetail.getForm().reset();
602
				dataWizInfo.removeAll();
603
				PanelWizardData.setActiveTab(0);
604
		}
605
		
606
		var pnlFormleft = new Array();
607
			pnlFormleft[gen] = new Ext.Panel({
608
				bodyStyle:'padding:5px 5px 0',
609
				border:false,
610
				isForm:true,
611
				layout:'form',
612
				height:450,
613
				width:350
614
		    });
615
			
616
		var pnlFormright = new Array();
617
			pnlFormright[gen] = new Ext.Panel({
618
				bodyStyle:'padding:5px 5px 0',
619
				border:false,
620
				isForm:true,
621
				layout:'form',
622
				height:450,
623
				width:350
624
		    });
625
			
626
		if (k == _count)
627
		{
628
			var pnlForm = new Array();
629
					pnlForm[gen] = new Ext.form.FormPanel({
630
						autoScroll:true,
631
						bodyStyle:'padding:5px 5px 0',
632
						labelWidth:120,
633
						region:'north',
634
						border:false,
635
						fileUpload: true,
636
						isForm:true,
637
						layout:'hbox',
638
						height:350,
639
						bbar:[btnSave[gen],btnBack[gen]],
640
						//bbar:[btnClose[gen],btnExit[gen]],
641
						items:[pnlFormleft[gen], pnlFormright[gen]]
642
				    });
643
		}
644
		else
645
		{
646
			var pnlForm = new Array();
647
					pnlForm[gen] = new Ext.form.FormPanel({
648
						autoScroll:true,
649
						bodyStyle:'padding:5px 5px 0',
650
						labelWidth:120,
651
						region:'north',
652
						border:false,
653
						isForm:true,
654
						layout:'hbox',
655
						height:350,
656
						fileUpload: true,
657
						bbar:[btnSave[gen],btnBack[gen]],
658
						items:[pnlFormleft[gen], pnlFormright[gen]]
659
				    });
660
		}
661
			
662
		var clearColumnModel = new Ext.grid.ColumnModel([]);
663

    
664
		pnlDataGrid[gen].reconfigure(pnlDataGrid[gen].getStore(), clearColumnModel);
665

    
666
		var cm = pnlDataGrid[gen].getColumnModel();
667
		var curColConfig = cm.config;	
668
		var Fields = [];
669
		var i = 0;
670
		var tabIndex = 100;
671

    
672
		var md_id = "id" +percode+mdcat+accesscode+md+empid;
673
		var md_temp = percode+"md"+md;
674
		var md_type = new Array();	
675
			md_type[gen] = new Ext.form.Hidden({
676
			name : "md_type",
677
			id : md_id,
678
			value : md_temp
679
			});
680
			
681
		var act_id = "act" +percode+mdcat+accesscode+md+empid;
682
		var action = new Array();	
683
			action[gen] = new Ext.form.Hidden({
684
			name : "action",
685
			id : act_id,
686
			value : "update"
687
			});
688
			
689
		// add queryCode
690
		var queryCode = new Array();
691
		queryCode[gen] = new Ext.form.Hidden({
692
			id: "query_wt" + percode + mdcat + accesscode + md + empid,
693
			value: "000"
694
		});
695
		pnlFormleft[gen].add(queryCode[gen]);
696

    
697
		
698
		stringArray[gen].each(function(rec){
699

    
700
		  var name = rec.get('field_name');
701
		  var header = rec.get('column_name');
702
		  var id = name +percode+mdcat+accesscode+md+empid;
703
		  var _id = name +'emp'+mdcat+'main'+md+empid;
704
		  var iddate = percode+mdcat+accesscode+md+empid + name;
705
		  var columnno = rec.get('column_no');
706
		  var gridview = rec.get('gridview');
707
		  var hidden = false;
708
		  var required = rec.get('required');
709
		  var blank_status = true;
710
		  var css_class = 'minova-blank'
711
		  var _class = rec.get('class');
712
		  var max_size = rec.get('max_size');
713
		  var min_value = rec.get('min_value');
714
		  var max_value = rec.get('max_value');
715
		  var default_value = rec.get('default_value');
716
		  var controller = rec.get('controller_store');
717
		  var popup_func = rec.get('popup_func');
718
		  var select_func = rec.get('select_func');
719
		  var change_func = rec.get('change_func');
720
		  var grid_renderer_func = rec.get('grid_renderer_func');
721
		  var select_func_target = rec.get('select_func_target');
722
		  var change_func_target = rec.get('change_func_target');
723
		  var submit_value = rec.get('submit_value');
724
		  var _readonly = rec.get('read_only');
725
		  var display = false;
726
		  
727
		  var prefix_id = percode + mdcat + accesscode + md + empid;
728
		  var _prefix_id = 'emp' + mdcat + 'main' + md + empid;		  
729
		
730
		 if(_readonly == "1")
731
		  {
732
			display = true;
733
			css_class = 'minova-readonly'
734
		  }
735
  
736
		  if(accesscode == "disp")
737
		  {
738
			display = true;
739
			css_class = 'minova-readonly'
740
		  }
741
		  
742
		  if(required == "1")
743
		  {     
744
			blank_status = false;
745
			css_class = 'minova-mandatory'
746
		  }
747
		  if (gridview=="0")
748
			hidden = true;  
749
		
750
		  if( _class == "hidden")
751
		  {
752
			if(name == "emp_id")
753
			{
754
				Fields[i] = new Ext.form.Hidden({
755
				name: name,
756
				id:id,
757
				value:empid
758
				});
759
			}
760
			else
761
			{
762
			    Fields[i] = new Ext.form.Hidden({
763
				name: name,
764
				id:id
765
				});
766
			}
767
		  }
768
		  else if(_class == "datefield")
769
		  {
770
				Fields[i] = new Ext.form.DateField({
771
				fieldLabel: header,
772
				allowBlank: blank_status,
773
				cls: css_class,
774
				msgTarget: 'side',
775
				readOnly: display,
776
				width: '150',
777
				id:iddate,
778
				format:'d/m/Y',
779
				tabIndex : tabIndex
780
				,listeners:{
781
					change: function(fld, nval, oval, toFld){ fnDateChg(fld, nval, oval, id ); },
782
					select: function(fld, dt, toFld){ fnDateSelect(fld, dt, id ); }
783
				}
784
				});
785
				
786
				if (columnno == "1")
787
				{
788
					pnlFormleft[gen].add(Fields[i]);
789
				}
790
				else if (columnno == "2")
791
				{
792
					pnlFormright[gen].add(Fields[i]);
793
				}
794
				i++;
795
				
796
				Fields[i] = new Ext.form.Hidden({
797
				name: name,
798
				id:id,
799
				value: default_value,
800
				listeners:{
801
					change: function(fld, nval, oval, toFld){ fnDateHidChg(fld, nval, oval, iddate ); }
802
				}
803
				});
804
				pnlFormleft[gen].add(Fields[i]);
805
		  }
806
		  else if(_class == "timefield" )
807
		  {
808
			   Fields[i] = new Ext.form.TimeField({
809
		       fieldLabel: header,
810
			   allowBlank: blank_status,
811
			   cls: css_class,
812
			   msgTarget: 'side',
813
			   readOnly: display,
814
		       name: name,
815
		       format: 'Hi',
816
		       id:id,
817
			   tabIndex : tabIndex
818
			   });
819
		  }
820
		  else if(_class == "combobox" )
821
		  {
822
				var target_id = select_func_target + prefix_id;
823
				
824
				Fields[i] = new Ext.form.ComboBox({
825
				fieldLabel: header,
826
				allowBlank: blank_status,
827
				cls: css_class,
828
				msgTarget: 'side',
829
				readOnly: display,
830
				hiddenName: name,
831
				id:id,
832
				tabIndex : tabIndex,
833
			    typeAhead: true,
834
			    triggerAction: 'all',
835
			    lazyRender:true,
836
				value: default_value,
837
			    mode: 'local',
838
			    store: new Ext.data.JsonStore({
839
			        fields: [
840
			            'code',
841
			            'desc'
842
			        ],
843
			        url: controller
844
			    }),
845
			    valueField: 'code',
846
			    displayField: 'desc',
847
				listeners:{
848
					render: function(){ Ext.getCmp(id).getStore().load();},
849
					select: function(cmb, rec){ 
850
						if (select_func != "" && target_id != "")
851
						{
852
							eval(select_func+"('"+id+"','"+target_id+"','"+rec.get('code')+"');");
853
						}
854
					}
855
				}
856
			});
857

    
858
		  }
859
		  else if (_class == "lookupfld")
860
		  {
861
			//var target_id = change_func_target + prefix_id;
862
			var extendedQuery = change_func_target == ''
863
				 ? undefined : change_func_target;
864

    
865
			if (md == "0004" || md == "0005")
866
				queryCode[gen].setValue(controller);
867

    
868
			var fieldLook = new Ext.form.TextField({
869
					minLength: min_value,
870
					maxLength: max_value,
871
					fieldLabel: header,
872
					allowBlank: blank_status,
873
					cls: css_class,
874
					value: default_value,
875
					msgTarget: 'side',
876
					readOnly: display,
877
					name: name,
878
					width: '150',
879
					id: id,
880
					tabIndex: tabIndex,
881
					listeners: {
882
						change: function (fld, nval, oval) {
883
							if (change_func != "") {
884
								eval(change_func + "('" + fld.id + "','" + fld.getValue() + "','" + extendedQuery + "');");
885
							}
886
						},
887
						specialkey: function (field, e) {
888
							if (e.getKey() == e.ENTER) {
889
								if (change_func != "") {
890
									eval(change_func + "('" + field.id + "','" + field.getValue() + "','" + extendedQuery + "');");
891
								}
892
							}
893
						}
894
					}
895
				})
896

    
897
				Fields[i] = LookUpFieldGen(name, 150, 120, header, 500, 500, controller,
898
					false, true, extendedQuery, false, _id, _prefix_id + 'end_date');
899
		}
900
		  else if(_class == "popup")
901
		  {
902
			    var target_id = change_func_target + prefix_id;
903
				
904
				var txtDesc = new Array();
905
					txtDesc[gen] = new Ext.form.TextField({
906
						fieldLabel : header,
907
						readOnly : true,
908
						width : 158,
909
						cls: 'minova-readonly',
910
					    msgTarget: 'side',
911
					    name: name,
912
				        id:id,
913
					    listeners:{
914
							change: function(fld, nval, oval){
915
								if (change_func != "" && change_func_target != "")
916
								{
917
									eval(change_func+"('"+id+"','"+target_id+"','"+nval+"');");
918
								}
919
							}
920
						}
921
				});		
922
				var pnlTxt = new Array();
923
					pnlTxt[gen] = new Ext.Panel({
924
						border: false,
925
						isForm: true,
926
						layout: 'form',
927
						items: [txtDesc[gen]]
928
				});
929
				var btnLookUp = new Array();
930
					btnLookUp[gen] = new Ext.Button({
931
						iconCls: 'icon-magnifier',
932
						listeners:{
933
							click: function(){
934
								if (popup_func != "")
935
								{
936
									eval(popup_func+"('"+id+"','"+prefix_id+"');");
937
								}
938
							}
939
						}
940
				});
941
				//btnLookUp[gen].on('click', function(){alert("LookUp");});
942
				Fields[i] = new Ext.Panel({
943
					border: false,
944
					layout: 'column',
945
					region: 'north',
946
					items: [pnlTxt[gen],btnLookUp[gen]]
947
				});
948
		  }
949
		  else
950
		  {
951
			   var target_id = change_func_target + prefix_id;
952
			   
953
			   Fields[i] = new Ext.form.TextField({
954
		       fieldLabel: header,
955
			   allowBlank: blank_status,
956
			   cls: css_class,
957
			   msgTarget: 'side',
958
			   readOnly: display,
959
		       name: name,
960
		       width: '150',
961
		       id:id,
962
			   tabIndex : tabIndex,
963
			   listeners:{
964
					change: function(fld, nval, oval){
965
						if (change_func != "" && change_func_target != "")
966
						{
967
							eval(change_func+"('"+id+"','"+target_id+"','"+nval+"');");
968
						}
969
					}
970
				}
971
		        
972
		    });
973

    
974
		  } 
975
		  
976
		  if (_class == "datefield")
977
		  {
978
			curColConfig.push({
979
			header: header,
980
			width: 100,
981
			dataIndex:  name,
982
			hidden: hidden,
983
			renderer: function(val){
984
				return fnGrid_Date8(val);
985
			}
986
			});
987
		  }
988
		  else if (_class == "combobox")
989
		  {
990
			curColConfig.push({
991
			header: header,
992
			width: 100,
993
			dataIndex:  name,
994
			hidden: hidden,
995
			renderer: function(val){
996
				var cmbStore = Ext.getCmp(id).getStore();
997
				cmbStore.load();
998
				
999
				var index = cmbStore.find('code',val);
1000

    
1001
				if (index != -1)
1002
				{
1003
					var rec = cmbStore.getAt(index);
1004

    
1005
					return rec.get("desc");
1006
				}
1007
				else
1008
				{
1009
					return val;
1010
				}
1011
			}
1012
			});
1013
		  } 
1014
		  else if (_class == "textarea")
1015
		  {
1016
			  var target_id = change_func_target + prefix_id;
1017

    
1018
			Fields[i] = new Ext.form.TextArea({
1019
					fieldLabel: header,
1020
					allowBlank: blank_status,
1021
					cls: css_class,
1022
					msgTarget: 'side',
1023
					readOnly: display,
1024
					name: name,
1025
					width: '200',
1026
					height: '100',
1027
					id: id,
1028
					tabIndex: tabIndex,
1029
					listeners: {
1030
						change: function (fld, nval, oval) {
1031
							if (change_func != "" && change_func_target != "") {
1032
								eval(change_func + "('" + id + "','" + target_id + "','" + nval + "');");
1033
							}
1034
						},
1035
						specialkey: function (field, e) {
1036
							if (e.getKey() == e.ENTER) {
1037
								focusNextField(name, prefix_id);
1038
							}
1039
						}
1040
					}
1041

    
1042
				});
1043
		  }
1044
		  else if (_class == "fileupload")
1045
		  {
1046
			  Fields[i] = {
1047
				xtype: 'fileuploadfield',
1048
				emptyText: 'Select a file',
1049
				fieldLabel: header,
1050
				name: name,
1051
				id: id,
1052
				width: '200',
1053
				buttonText: 'Browse'
1054
			}
1055
		  }		  
1056
		  else if (name == "last_change")
1057
		  {
1058
			curColConfig.push({
1059
			header: header,
1060
			width: 100,
1061
			dataIndex:  name,
1062
			hidden: hidden,
1063
			renderer: function(val){
1064
				return fnGrid_Date14(val);
1065
			}
1066
			});
1067
		  }
1068
		  else if (grid_renderer_func != "")
1069
		  {
1070
			curColConfig.push({
1071
			header: header,
1072
			width: 100,
1073
			dataIndex:  name,
1074
			hidden: hidden,
1075
			renderer: function(val){
1076
				var ret = eval(grid_renderer_func+"('"+id+"','"+val+"');");
1077
				return ret;
1078
			}
1079
			});
1080
		  }
1081
		  else
1082
		  {
1083
			curColConfig.push({
1084
			header: header,
1085
			width: 100,
1086
			dataIndex:  name,
1087
			hidden: hidden
1088
			});
1089
		  }
1090
		  
1091
		    if(name == "seq" || name == "user_change" || name == "last_change")
1092
				{
1093
					Ext.getCmp(id).setReadOnly(true);
1094
				}   
1095
				
1096
			tabIndex++;
1097
			if (columnno == "1" && _class != "datefield" )
1098
				{
1099
				pnlFormleft[gen].add(Fields[i]);
1100
				}
1101
			else if (columnno == "2" && _class != "datefield" )
1102
				{
1103
				pnlFormright[gen].add(Fields[i]);
1104
				}
1105
			i++;
1106
		});
1107
		pnlFormleft[gen].add(md_type[gen]);
1108
		
1109
		var i=0;
1110
		stringPrimaryKey[gen].each(function(rec){
1111
		   var data = rec.get('field_name');
1112
		   var key = "key_"+data;
1113
		   
1114
		   Fields[i] = new Ext.form.Hidden({
1115
		     
1116
		     name: key,
1117
		     width: '150',
1118
		     id:key
1119
		        
1120
		    });
1121

    
1122
			
1123
			pnlFormleft[gen].add(Fields[i]);
1124
			i++;
1125

    
1126
		});
1127
		
1128
		//md exception
1129
		/*
1130
		if(md=="0002")
1131
		{
1132
			btnSkip[gen].setDisabled(true);
1133
			btnAdd[gen].setDisabled(true);
1134
		}
1135
		else if(md=="0001")
1136
		{
1137
			btnSkip[gen].setDisabled(true);
1138
			btnAdd[gen].setDisabled(true);
1139
		}
1140
		else
1141
		{
1142
			btnSkip[gen].setDisabled(false);
1143
			btnAdd[gen].setDisabled(false);
1144
		}
1145
		*/
1146
		
1147
		//exception btn Skip & Save all by Kindy 20111009
1148
		if (_mandatory == "1")
1149
		{
1150
			btnSkip[gen].setDisabled(true);
1151
			btnAdd[gen].setDisabled(true);
1152
			btnSkipSave[gen].setDisabled(true);
1153
		}
1154
		else
1155
		{
1156
			btnSkip[gen].setDisabled(false);
1157
			btnAdd[gen].setDisabled(false);
1158
			btnSkipSave[gen].setDisabled(false);
1159
		}
1160
				
1161
		//setvalue
1162
		
1163
		cm.setConfig(curColConfig, true);
1164

    
1165
		pnlDataGrid[gen].reconfigure(pnlDataGrid[gen].getStore(), new Ext.grid.ColumnModel(curColConfig));
1166
		
1167
		var record = pnlDataGrid[gen].getStore().getAt(0);  
1168
		
1169
		//finish setvalue
1170
		
1171
		pnlFormright[gen].doLayout();
1172
		pnlFormleft[gen].doLayout();
1173
		pnlForm[gen].doLayout();
1174
		pnlDataGrid[gen].doLayout();
1175
		//alert(record);
1176
		try
1177
		{
1178
		pnlForm[gen].getForm().loadRecord(record);
1179
		}
1180
		catch(e)
1181
		{
1182
		}
1183
		pnlWizData.add(pnlDataGrid[gen],pnlForm[gen]);
1184
		//pnlWizData.add(pnlForm[gen]);
1185
		k++;		
1186
	});
1187
	
1188
	var _firstTitle = dataWizInfo.getAt(0).json.desc;
1189
	pnlWizData.setTitle('Data Processing - ' + _firstTitle);
1190
	pnlWizData.layout.setActiveItem(0);
1191
	pnlWizData.doLayout();
1192
	PanelWizardData.el.unmask();
1193
};
(3-3/3)