SET DEFINE OFF

------ Department MAster.Start -------
alter table department add dept_head_1 char(10);


INSERT INTO MESSAGES(
	MSG_NO,
	MSG_STR,
	MSG_DESCR,
	MSG_TYPE,
	MSG_OPT,
	MSG_TIME,
	ALARM,
	ERR_SOURCE,
	CHG_DATE,
	CHG_USER,
	CHG_TERM,
	OVERRIDE_INPUT,
	MAIL_OPTION
	) 
VALUES 
	(
	'VMDEPTHD01',
	'Invalid employee code',
	'The employee code entered in department head 1 does not exist in the employee master. First you have to define it in the master',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL);

COMMIT;

Insert into ITM2MENU (APPLICATION,LEVEL_1,LEVEL_2,LEVEL_3,LEVEL_4,LEVEL_5,WIN_NAME,DESCR,COMMENTS,MENU_PATH,ICON_PATH,CLOSE_ICON,OPEN_ICON,OBJ_TYPE,CHG_DATE,CHG_TERM,CHG_USER,MOB_DEPLOY) values ('ADM',2,2,0,0,0,'w_dept','B. Department','Define various departments','ADM.2.2.0.0.0',null,null,null,'M',null,null,null,null);

UPDATE ITM2MENU SET OBJ_TYPE = 'M' , ICON_PATH = 'e12_logo.gif' WHERE WIN_NAME='w_dept';

commit;

Insert into TRANSETUP (TRAN_WINDOW,SAVE_FLAG,VAL_FLAG,KEY_FLAG,KEY_STRING,UDF_1,UDF_2,UDF_3,UDF_4,UDF_5,REPEATE_ADD,CHG_DATE,CHG_USER,CHG_TERM,EDI_OPTION,SITE_ACC_COL,CONFIRM_COL,CONFIRM_VAL,REPEAT_ADD_DET,REPEATADDDET,LOAD_MODE,AUTO_CONFIRM,LEDG_POST_CONF,CHG_DATE_ON_CONF,TRAN_ID_COL,MAIL_OPTION,CONFIRM_MODE,GARBAGE_OPT,VAL_FLAG_EDI,VERIFY_PASSWORD,CUST_ACC_COL,SALES_PERS_ACC_COL,SUPP_ACC_COL,ITEM_SER_ACC_CODE,EMP_ACC_COL,ITEM_SER_ACC_COL,WORKFLOW_OPT,TABLE_NAME,APPLICATION,TABLE_DESC,TRAN_DATE_COL,TRAN_ID__FROM,TRAN_ID__TO,TABLE_NAME_DET1,TABLE_NAME_DET2,TABLE_NAME_DET3,MULTITIRE_OPT,REF_SER,VIEW_MODE,TAX_FORMS,SIGN_STATUS,USER_TRAN_WINDOW,CUSTOM_PREVIEW_OBJ,IGNOREERRLIST_ONLOAD,CHILDDATA_ARGOPT,EDIT_TMPLT,WRKFLW_INIT,EDITTAX,FORMAL_ARGS,AUDIT_TRAIL_OPT,EDIT_OPT,CACHE_OPT,OPTIMIZE_MODE,EDIT_EXPR,RATE_COL,QTY_COL,EDIT_EXPR_INP,RCP_CACHE_STATUS,PRINT_CONTROL,TRANSFER_MODE,PROFILE_ID__RES,TRAN_COMPL_MSG,PERIOD_OPTION,WRKFLW_PRIORITY,EXEC_TYPE,DISP_META_DATA,START_FORM,ISATTACHMENT,HEADER_FORM_NO,ALLOW_ATTACH,MSG_ONSAVE,CONFIRM_DATE_COL,CONFIRM_BY_COL,WF_STATUS,ISGWTINITIATED,RESTART_FORM) values ('w_dept','2','2','M','seq10',null,null,null,null,null,'Y',FN_SYSDATE(),'ADMIN','97NILESH12','1',null,null,null,'Y',null,'E','N','N',null,'DEPT_CODE','0','0',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'F',null,null,null,null,null,null,null,null,null,null,'0',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

update TRANSETUP set WORKFLOW_OPT = 0,TABLE_NAME = 'DEPARTMENT', APPLICATION='ADM',AUDIT_TRAIL_OPT = CASE WHEN AUDIT_TRAIL_OPT IS NULL THEN '0' ELSE AUDIT_TRAIL_OPT END where tran_window = 'w_dept' ;

commit;

Insert into OBJ_FORMS (WIN_NAME,TITLE,OBJ_BROW_NAME,OBJ_EDIT_NAME,CROSS_UPDATE_EXPR,EXPR_FLD_INFO,TARGET_FLD_INFO,EXPR_COMMENT,FORM_NO,SCR_FLAG,AUTO_ACCEPT_SCAN,SCAN_FLAG,SCAN_METADATA,PROPERTY_INFO,EXT_COM,EXT_METADATA,EXT_SETUP,AFTER_SAVE,COLUMN_ON_SAVE,SCAN_DELIMITER,AUTO_ACCEPT_WEIGHDATA,RATE_COL,QTY_COL,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY) values ('w_dept','Department',null,null,null,null,null,null,'1',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

update obj_forms set OBJ_BROW_NAME = 'd_dept_brow',OBJ_EDIT_NAME = 'd_dept_edit' 
where win_name='w_dept';

commit;

Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ) values ('dept',1,'add~normal.gif','Adding New','a','a','A','Add','1',null,null,'S',null,null,null,null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ) values ('dept',2,'edit~normal.gif','Editing Existing Record','a','a','E','Edit','1',null,null,'S',null,null,null,null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ) values ('dept',3,'delete~normal.gif','Deleting','a','a','D','Delete','1',null,null,'S',null,null,null,null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ) values ('dept',4,'save~normal.gif','Saving','a','a','S','Save','1',null,null,'S',null,null,null,null,null);
Insert into obj_actions (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ) values ('dept',5,null,'View Audit Trail','audit_trail','1','X','View Audit','1',1,1,'U',null,null,null,null,null);

commit;

INSERT INTO obj_itemchange (
	OBJ_NAME ,
	FORM_NO ,
	FIELD_NAME ,
	MANDATORY 
	)
VALUES (
	'dept',
	'1',
	'acct_code',
	NULL);

INSERT INTO obj_itemchange (
	OBJ_NAME ,
	FORM_NO ,
	FIELD_NAME ,
	MANDATORY 
	)
VALUES (
	'dept',
	'1',
	'acct_code__ap',
	NULL);

INSERT INTO obj_itemchange (
	OBJ_NAME ,
	FORM_NO ,
	FIELD_NAME ,
	MANDATORY 
	)
VALUES (
	'dept',
	'1',
	'cctr_code',
	NULL);

INSERT INTO obj_itemchange (
	OBJ_NAME ,
	FORM_NO ,
	FIELD_NAME ,
	MANDATORY 
	)
VALUES (
	'dept',
	'1',
	'cctr_code__ap',
	NULL);

INSERT INTO obj_itemchange (
	OBJ_NAME ,
	FORM_NO ,
	FIELD_NAME ,
	MANDATORY 
	)
VALUES (
	'dept',
	'1',
	'dept_head',
	NULL);


INSERT INTO obj_itemchange (
	OBJ_NAME ,
	FORM_NO ,
	FIELD_NAME ,
	MANDATORY 
	)
VALUES (
	'dept',
	'1',
	'dept_head_1',
	NULL);


commit;

Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_NAME,COMP_TYPE,COMM_FORMAT) values ('dept','post_item_change','1','poic_adm_default_1',null,'0',FN_SYSDATE(),'BASE','BASE','2','nvo_bo_dept','NVO',null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_NAME,COMP_TYPE,COMM_FORMAT) values ('dept','pre_validate','1','prv_adm_default_1',null,'0',FN_SYSDATE(),'BASE','BASE','2','nvo_bo_dept','NVO',null);

commit;

update system_events set service_code = 'poic_adm_default_1' , comp_type = 'WSR' where 
obj_name in (
'dept'
) and event_code = 'post_item_change' and service_code='poic_default_1';
commit;

update system_events set service_code = 'prv_adm_default_1' , comp_type = 'WSR'  where 
obj_name in (
'dept'
) and event_code = 'pre_validate' and service_code='prv_default_1';
commit;

update system_events set comp_type = 'WSR' where 
service_code in  ('poic_adm_default_1','prv_adm_default_1');
commit;




------ Department MAster.End -------

------ Transfer.Start -------------
Insert into itm2menu (APPLICATION,LEVEL_1,LEVEL_2,LEVEL_3,LEVEL_4,LEVEL_5,WIN_NAME,DESCR,COMMENTS,MENU_PATH,ICON_PATH,CLOSE_ICON,OPEN_ICON,OBJ_TYPE,CHG_DATE,CHG_TERM,CHG_USER,MOB_DEPLOY) values ('ADM',3,4,0,0,0,'w_transfer','C. Transfers','Transfer of employee from one site/dept to another','ADM.3.4.0.0.0',null,null,null,'T',null,null,null,null);

UPDATE ITM2MENU SET OBJ_TYPE = 'T' , ICON_PATH = 'e12_logo.gif' WHERE WIN_NAME='w_transfer';

commit;

Insert into TRANSETUP (TRAN_WINDOW,SAVE_FLAG,VAL_FLAG,KEY_FLAG,KEY_STRING,UDF_1,UDF_2,UDF_3,UDF_4,UDF_5,REPEATE_ADD,CHG_DATE,CHG_USER,CHG_TERM,EDI_OPTION,SITE_ACC_COL,CONFIRM_COL,CONFIRM_VAL,REPEAT_ADD_DET,REPEATADDDET,LOAD_MODE,AUTO_CONFIRM,LEDG_POST_CONF,CHG_DATE_ON_CONF,TRAN_ID_COL,MAIL_OPTION,CONFIRM_MODE,GARBAGE_OPT,VAL_FLAG_EDI,VERIFY_PASSWORD,CUST_ACC_COL,SALES_PERS_ACC_COL,SUPP_ACC_COL,ITEM_SER_ACC_CODE,EMP_ACC_COL,ITEM_SER_ACC_COL,WORKFLOW_OPT,TABLE_NAME,APPLICATION,TABLE_DESC,TRAN_DATE_COL,TRAN_ID__FROM,TRAN_ID__TO,TABLE_NAME_DET1,TABLE_NAME_DET2,TABLE_NAME_DET3,MULTITIRE_OPT,REF_SER,VIEW_MODE,TAX_FORMS,SIGN_STATUS,USER_TRAN_WINDOW,CUSTOM_PREVIEW_OBJ,IGNOREERRLIST_ONLOAD,CHILDDATA_ARGOPT,EDIT_TMPLT,WRKFLW_INIT,EDITTAX,FORMAL_ARGS,AUDIT_TRAIL_OPT,EDIT_OPT,CACHE_OPT,OPTIMIZE_MODE,EDIT_EXPR,RATE_COL,QTY_COL,EDIT_EXPR_INP,RCP_CACHE_STATUS,PRINT_CONTROL,TRANSFER_MODE,PROFILE_ID__RES,TRAN_COMPL_MSG,PERIOD_OPTION,WRKFLW_PRIORITY,EXEC_TYPE,DISP_META_DATA,START_FORM,ISATTACHMENT,HEADER_FORM_NO,ALLOW_ATTACH,MSG_ONSAVE,CONFIRM_DATE_COL,CONFIRM_BY_COL,WF_STATUS,ISGWTINITIATED,RESTART_FORM) values ('w_transfer','2','2','A','_sppay_site_from,TF,_ppord_date,seq04',null,null,null,null,null,'Y',to_timestamp('01-JAN-99','DD-MON-RR HH.MI.SSXFF AM'),'BASE      ','1              ','0','PAY_SITE_FROM','CONFIRMED','Y',null,null,null,null,'N','N','TRANS_NO','0','0',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'F',null,null,null,null,null,null,null,null,null,null,'0',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

update TRANSETUP set WORKFLOW_OPT = 0,TABLE_NAME = 'EMPTRANSFER', APPLICATION='ADM',AUDIT_TRAIL_OPT = CASE WHEN AUDIT_TRAIL_OPT IS NULL THEN '0' ELSE AUDIT_TRAIL_OPT END where tran_window = 'w_transfer' ;

COMMIT;

Insert into obj_forms (WIN_NAME,TITLE,OBJ_BROW_NAME,OBJ_EDIT_NAME,CROSS_UPDATE_EXPR,EXPR_FLD_INFO,TARGET_FLD_INFO,EXPR_COMMENT,FORM_NO,SCR_FLAG,AUTO_ACCEPT_SCAN,SCAN_FLAG,SCAN_METADATA,PROPERTY_INFO,EXT_COM,EXT_METADATA,EXT_SETUP,AFTER_SAVE,COLUMN_ON_SAVE,SCAN_DELIMITER,AUTO_ACCEPT_WEIGHDATA,RATE_COL,QTY_COL,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY) values ('w_transfer','Employee Transfer',null,null,null,null,null,null,'1',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

update obj_forms set OBJ_BROW_NAME = 'd_emptrans_brow',OBJ_EDIT_NAME = 'd_emptrans' 
where win_name='w_transfer';

COMMIT;

------ Transfer.End -------------
