--- A14CSUN001.SQL.Start ---
SET DEFINE OFF

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 
('FIN',5,31,0,0,0,'w_sales_comm','X. Sales Incentive','Sales incentive','FIN.5.31.0.0.0',null,null,null,'T',FN_SYSDATE(),'BASE','BASE',null);

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

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,CMS_PATH,BROW_DATA_DEF) 
VALUES 
('w_sales_comm','2','2','A','_spsite_code,SI,_pptran_date,seq04',null,null,null,null,null,'Y',FN_SYSDATE(),'BASE','BASE','0','SITE_CODE','CONFIRMED','Y',null,null,null,null,'N','N','TRAN_ID','0','0',null,null,null,null,null,null,null,null,null,null,'SALES_COMM_HDR',null,null,null,null,null,null,null,null,null,'S-COMM','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,null,null);

UPDATE TRANSETUP SET WORKFLOW_OPT = 0, APPLICATION='FIN', REF_SER = 'S-COMM' , edit_opt = '3', AUDIT_TRAIL_OPT = CASE WHEN AUDIT_TRAIL_OPT IS NULL THEN '0' ELSE AUDIT_TRAIL_OPT END, TABLE_NAME='SALES_COMM_HDR' , TRAN_ID_COL = 'TRAN_ID' , SITE_ACC_COL = 'SITE_CODE' , CONFIRM_COL = 'CONFIRMED' , CONFIRM_VAL = 'Y' WHERE TRAN_WINDOW = 'w_sales_comm' ;

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_sales_comm','SalesHdr','d_sales_comm_hdr_brow','d_sales_comm_hdr_edit',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);
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_sales_comm','SalesDet','d_sales_comm_det_brow','d_sales_comm_det_edit','[amount]','[2..D.amount]','[1.1.D.amount]','Updates Amount of Header by adding Amount of 1st Child.','2',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

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,SEP_DUTY_OPT,RE_AUTH_OPT) 
VALUES 
('sales_comm',1,'add.gif','Adding New','a','a','A','Add','1',null,null,'S',null,null,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,SEP_DUTY_OPT,RE_AUTH_OPT) 
VALUES 
('sales_comm',2,'edit.gif','Editing Existing Record','a','a','E','Edit','1',null,null,'S',null,null,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,SEP_DUTY_OPT,RE_AUTH_OPT) 
VALUES 
('sales_comm',4,'save~normal.gif','Saving','a','a','S','Save','1',null,null,'S',null,null,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,SEP_DUTY_OPT,RE_AUTH_OPT) 
VALUES 
('sales_comm',5,'confirm~normal.gif','Confirmation','pre_confirm','a','F','Confirm','1','2',null,'U',null,null,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,SEP_DUTY_OPT,RE_AUTH_OPT) 
VALUES 
('sales_comm',7,null,'Action Button for Default Data','act_default','a','R','Default','2','3',null,'U',null,null,null,null,null,null,null);

COMMIT;

INSERT INTO OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) 
VALUES 
('sales_comm','1','itm_default',null);

INSERT INTO OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) 
VALUES 
('sales_comm','1','site_code',null);

INSERT INTO OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) 
VALUES 
('sales_comm','1','item_ser',null);

INSERT INTO OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) 
VALUES 
('sales_comm','1','prd_code',null);

INSERT INTO OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) 
VALUES 
('sales_comm','2','itm_default',null);

INSERT INTO OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) 
VALUES 
('sales_comm','2','sales_pers',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 
('sales_comm','act_default','1','adef_sales_comm',null,'0',FN_SYSDATE(),'BASE','BASE','2','SalesCommAct','EJB',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 
('sales_comm','post_item_change','1','poic_default_1',null,'0',FN_SYSDATE(),'BASE','BASE','2','nvo_bo_sales_comm','WSR',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 
('sales_comm','pre_confirm','1','prcm_default_1',null,'0',FN_SYSDATE(),'BASE','BASE','2','nvo_business_object_fin_sales_comm','WSR',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 
('sales_comm','pre_validate','1','prv_default_1',null,'0',FN_SYSDATE(),'BASE','BASE','2','nvo_bo_sales_comm','WSR',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 (
	'sales_comm',
	'post_validate',
	'1',
	'post_gen_val',
	NULL,
	'0',
	fn_sysdate(),
	'BASE',
	'BASE',
	'2',
	'GenValidate',
	'EJB',
	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 (
	'sales_comm',
	'audit_trail',
	'1',
	'project_audit_trail',
	NULL,
	'0',
	fn_sysdate(),
	'BASE',
	'BASE',
	'2',
	NULL,
	NULL,
	NULL);

UPDATE SYSTEM_EVENTS SET COMP_TYPE = 'WSR', COMP_NAME = 'nvo_bo_sales_comm'  WHERE OBJ_NAME = 'sales_comm' AND EVENT_CODE IN ('post_item_change' , 'pre_validate');

COMMIT;

INSERT INTO SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM) 
VALUES 
('adef_sales_comm','Action To Get Default Data','http://localhost:9090/axis/services/ActionHandlerService','Base Information','actionHandler','String','S',null,null,FN_SYSDATE(),'BASE','BASE');

COMMIT;

INSERT INTO SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) 
VALUES 
('adef_sales_comm',1,'COMPONENT_TYPE','I','Component Type','C.String',null,FN_SYSDATE(),'BASE','BASE','EJB');

INSERT INTO SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) 
VALUES 
('adef_sales_comm',2,'COMPONENT_NAME','I','Component Name','C.String',null,FN_SYSDATE(),'BASE','BASE','SalesCommAct');

INSERT INTO SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) 
VALUES 
('adef_sales_comm',3,'ACTION_TYPE','I','Action Type','C.String',null,FN_SYSDATE(),'BASE','BASE','Default');

INSERT INTO SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) 
VALUES 
('adef_sales_comm',4,'XML_DATA_1','I','XML data of form no 1','S',null,FN_SYSDATE(),'BASE','BASE',null);

INSERT INTO SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) 
VALUES 
('adef_sales_comm',5,'OBJ_CONTEXT','I','Object context','S',null,FN_SYSDATE(),'BASE','BASE',null);

INSERT INTO SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) 
VALUES 
('adef_sales_comm',6,'XTRA_PARAMS','I','Extra Arguments','S',null,FN_SYSDATE(),'BASE','BASE',null);

COMMIT;

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 
(
	'VTINCPST01',
	'Error in posting!',
	'No row found at detail level of selected incentive transaction',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;

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 
(
	'VTINCPST02',
	'Error in posting!',
	'Period is not defined for current date, please first define period for current date',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;

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 
(
	'VTINCPST03',
	'Error in posting!',
	'Could not process payroll projection for current period as payroll is posted for current period',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;

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 
(
	'VTINCPST04',
	'Error in posting!',
	'Some error came in payroll projection',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;

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 
(
	'VTINCPST05',
	'Error in posting!',
	'Accounting period is not defined for current date',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;


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 
(
	'VTINCPST15',
	'Error in posting!',
	'Some error came in income tax processing',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;

INSERT INTO FINPARM (
	PRD_CODE,
	VAR_NAME,
	VAR_TYPE,
	VAR_VALUE,
	DESCR,
	VAR_SUBS,
	CHG_DATE,
	CHG_USER,
	CHG_TERM )
VALUES (
	'999999',
	'DEDUCT_IT_FRM_SALINC',
	'S',
	'N',
	'Indicates whether Income Tax to be calculated and deducted from Sales Incentive or not',
	NULL,
	FN_SYSDATE(),
	'BASE',
	'BASE');
COMMIT;

INSERT INTO PAYRPARM (
	PRD_CODE,
	VAR_NAME,
	VAR_TYPE,
	VAR_VALUE,
	DESCR,
	VAR_SUBS,
	CHG_DATE,
	CHG_USER,
	CHG_TERM )
VALUES (
	'999999',
	'TAXABLE_AMT_ADCODE',
	'S',
	' ',
	'AD Code of taxable amount on which income tax to be calculated',
	NULL,
	FN_SYSDATE(),
	'PIYUSH',
	'BASE');

COMMIT;

INSERT INTO PAYRPARM (
	PRD_CODE,
	VAR_NAME,
	VAR_TYPE,
	VAR_VALUE,
	DESCR,
	VAR_SUBS,
	CHG_DATE,
	CHG_USER,
	CHG_TERM )
VALUES (
	'999999',
	'ITAX_REFUND_ADCODE',
	'S',
	' ',
	'AD Code of tax refunded in payroll voucher',
	NULL,
	FN_SYSDATE(),
	'PIYUSH',
	'BASE');

COMMIT;

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 
(
	'VPITXPRC01',
	'Payroll Variable!',
	'Either payroll variable TAXABLE_AMT_ADCODE is not defined or value for the variable is empty',
	'E',
	'Y',
	NULL,
	NULL,
	NULL,
	fn_sysdate(),
	'BASE',
	'BASE',
	NULL,
	NULL
);

COMMIT;

--- A14CSUN001.SQL.Start ---
