CREATE TABLE device_auth 
(
	device_id char(50),
	descr char(200),
	user_id__def char(10),
	name char(40),
	chg_date date,
	chg_user char(10),
	chg_term char(15)
	);
	
alter table device_auth add constraint pk_device primary key(device_id);
alter table device_auth add constraint fk_device foreign key(user_id__def) references users(code);

INSERT INTO transetup 
(
	tran_window ,
	save_flag ,
	val_flag ,
	key_flag ,
	key_string ,
	repeate_add ,
	chg_date ,
	chg_user ,
	chg_term ,
	edi_option ,
	confirm_mode ,
	mail_option ,
	garbage_opt ,
	table_name ,
		tran_id__from ,
		ref_ser 
		)
		 VALUES 
 (
	'w_deviceauth',
	'2',
	'2',
	'M',
	'seq10',
	'N',
	sysdate,
	'BASE      ',
	'1              ',
	'0',
		'0',
	'0',
	'N',
		'device_auth',
		'device_id',
		'T-DEV'	
	);
	--system entry for obj forms
	INSERT INTO obj_forms 
(
	win_name ,
	title ,
	obj_brow_name ,
	obj_edit_name ,
	form_no 
		)
		VALUES 
(
	'w_deviceauth',
	'Header',
	'd_deviceauth11',
	'd_deviceauth21',
		'1'
		);
--system entry for obj actions		
INSERT INTO obj_actions (
	obj_name ,
	line_no ,
	rights_char ,
	interactive ,
	service_code,
	description ,
	title ,
	image ,
	action_type ,
	form_no 	
	)
  VALUES (
	'deviceauth',
	1,
	'A',
	'a',
	'a',
	'Adding new',
	'Add',
	'add.gif',
	'S',
	'1'	
	);

INSERT INTO obj_actions (
	obj_name ,
	line_no ,
	rights_char ,
	interactive ,
	service_code,
	description ,
	title ,
	image ,
	action_type ,
	form_no 	
	)
	VALUES (
	'deviceauth',
	2,
	'E',
	'a',
	'a',
	'Editing Existing Record',
	'Add',
	'edit.gif',
	'S',
	'1'	
	);
	
	--system entry for system events
	INSERT INTO system_events
(
	obj_name ,
	event_code ,
	event_context ,
	service_code ,
	chg_date ,
	chg_user ,
	chg_term ,
	result_handle ,
	overwrite_core ,
	comp_type ,
	comp_name 
		)
 VALUES 
 (
 'deviceauth',
	'post_item_change',
	'1',
	'poic_default_ejb1',
		sysdate,
	'chitranjan',
	'BASE',
	'2',
	'0',
	'EJB',
	'DeviceAuthentication'
		);
		
INSERT INTO system_events
(
	obj_name ,
	event_code ,
	event_context ,
	service_code ,
	chg_date ,
	chg_user ,
	chg_term ,
	result_handle ,
	overwrite_core ,
	comp_type ,
	comp_name 
		)		
 VALUES (
	'deviceauth',
	'pre_validate',
	'1',
	'prv_default_ejb1',
		sysdate,
	'chitranjan',
	'BASE',
	'2',
	'0',
	'EJB',
	'DeviceAuthentication'	
	);
--system entry for obj-itemchange
INSERT INTO obj_itemchange  (
	obj_name ,
	form_no ,
	field_name ,
	mandatory 
	)
VALUES (
	'deviceauth',
	'1',
	'user_id__def',
	'Y'
	);
INSERT INTO obj_itemchange  (
	obj_name ,
	form_no ,
	field_name ,
	mandatory 
	)
 VALUES (
	'deviceauth',
	'1',
	'user_id__def',
	'Y'
	);
--system entry for pophelp
INSERT INTO pophelp 
(
field_name,
mod_name,
sql_str,
msg_title ,
width ,
height ,
chg_date,
chg_user,
chg_term 
)
VALUES 
(
'USER_ID__DEF',
'W_DEVICEAUTH',
'SELECT CODE ,NAME FROM USERS',
'USER ID ',
NULL,
NULL,
sysdate,
'CHITRANJAN',
'CHITRANJAN '
);

-- system entry for itm2menu

INSERT INTO itm2menu
(
	application ,
	level_1 ,
	level_2 ,
	level_3 ,
	level_4 ,
	level_5 ,
	win_name ,
	descr ,
	comments ,
	menu_path ,
	icon_path ,
		chg_date ,
	chg_term ,
	chg_user 
	)
 VALUES 
(
	'RDY',
	7,
	2,
	0,
	0,
	0,
	'w_deviceauth',
	'Device',
	'Device Authentication',
	'RDY.7.2.0.0.0',
	'e12_logo.gif',
		sysdate,
	'Base',
	'chitranjan'
	);

	--system entry for messages
	INSERT INTO messages
 (
	msg_no ,
	msg_str ,
	msg_descr ,
	msg_type 
		)
VALUES 
(
	'VMDID     ',
	'Device Can Not Be Null',
	'Please Enter Device Id',
	'E'	
	);
	
	INSERT INTO messages
 (
	msg_no ,
	msg_str ,
	msg_descr ,
	msg_type 
		)
	VALUES (
	'VMDDI     ',
	'Duplicate Device Id',
	'Enter Unique Device Id',
	'E'
	);
	
	INSERT INTO messages
 (
	msg_no ,
	msg_str ,
	msg_descr ,
	msg_type 
		)
	VALUES (
	'VMDEVD    ',
	'Description Can Not Be Null',
	'Enter Description ',
	'E'
	);
	
	INSERT INTO messages
 (
	msg_no ,
	msg_str ,
	msg_descr ,
	msg_type 
		)
	VALUES (
	'VMUIDN    ',
	'User Code Can Not Be Blank',
	'Enter Valid User Code',
	'E'
	);
	
	INSERT INTO messages
 (
	msg_no ,
	msg_str ,
	msg_descr ,
	msg_type 
		)
	 VALUES (
	'VMUIDD    ',
	'Invalid User Code ',
	'Enter Existing User Code',
	'E'
	);


	


	



 
