--DELETE EXISTING RECORD FROM ITM2MENU FOR INVOICE AMENDMENT PROCESS
DELETE FROM ITM2MENU WHERE WIN_NAME = 'w_inv_amendment';

--INSERT NEW RECORD INTO ITM2MENU
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) values ('FIN',4,3,0,0,0,'w_inv_amendment','Invoice Amendment Process','Amend invoice to put additional information/change status','FIN.4.3.0.0.0',null,null,null,'P',null,null,null);

--DELETE EXISTING RECORD FROM TRANSETUP FOR INVOICE AMENDMENT PROCESS
DELETE FROM TRANSETUP WHERE tran_window = 'w_inv_amendment';

--INSERT NEW RECORD INTO TRANSETUP
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,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,TABLE_NAME,APPLICATION,TABLE_DESC,TRAN_DATE_COL,SALES_PERS_ACC_COL,CUST_ACC_COL,SUPP_ACC_COL,ITEM_SER_ACC_COL,EMP_ACC_COL,WORKFLOW_OPT,TRAN_ID__FROM,TRAN_ID__TO,MULTITIRE_OPT,REF_SER,VIEW_MODE,TABLE_NAME_DET1,TABLE_NAME_DET2,TABLE_NAME_DET3,TAX_FORMS,SIGN_STATUS,USER_TRAN_WINDOW,CUSTOM_PREVIEW_OBJ,CHILDDATA_ARGOPT,IGNOREERRLIST_ONLOAD,EDIT_TMPLT,WRKFLW_INIT,FORMAL_ARGS,EDIT_OPT,AUDIT_TRAIL_OPT,EDITTAX,CACHE_OPT,OPTIMIZE_MODE,EDIT_EXPR,TRANSFER_MODE,RATE_COL,QTY_COL,RCP_CACHE_STATUS,PRINT_CONTROL,ITEM_SER_ACC_CODE,PROFILE_ID__RES,PERIOD_OPTION,TRAN_COMPL_MSG,WRKFLW_PRIORITY,EXEC_TYPE,DISP_META_DATA,START_FORM,ISATTACHMENT) values ('w_inv_amendment','2','2','M',null,null,null,null,null,null,'N','15-MAR-12','Mahesh    ','BASE           ','0',null,null,null,'N',null,null,'N','N','invoice_id',null,'0',null,null,null,null,null,null,null,null,null,null,null,null,'0',null,null,null,null,'F',null,null,null,null,null,null,null,null,null,null,null,null,'3',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

--DELETE EXISTING RECORDS FROM OBJ_FORMS FOR INVOICE AMENDMENT PROCESS
DELETE FROM OBJ_FORMS WHERE win_name = 'w_inv_amendment';

--INSERT NEW RECORDS INTO OBJ_FORMS
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,AUTO_ACCEPT_SCAN,SCAN_METADATA,SCAN_FLAG,SCR_FLAG,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) values ('w_inv_amendment','Header','inv_amendment_brow','inv_amendment_edit',null,null,null,null,'1',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,AUTO_ACCEPT_SCAN,SCAN_METADATA,SCAN_FLAG,SCR_FLAG,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) values ('w_inv_amendment','Detail','inv_amendment_brow','inv_amendment_edit',null,null,null,null,'2',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

--DELETE EXISTING RECORDS FROM OBJ_ACTIONS FOR INVOICE AMENDMENT PROCESS
DELETE FROM OBJ_ACTIONS WHERE obj_name = 'inv_amendment';

--INSERT NEW RECORDS INTO OBJ_ACTIONS
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,RIGHTS_CHAR,INTERACTIVE,SERVICE_CODE,DESCRIPTION,TITLE,IMAGE,ACTION_TYPE,FORM_NO,SERVICE_HANDLER,PLACEMENT,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER) values ('inv_amendment',1,'R','a','get_data','Action Button for getting the data','GetData',null,'U','1','3',null,null,null,null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,RIGHTS_CHAR,INTERACTIVE,SERVICE_CODE,DESCRIPTION,TITLE,IMAGE,ACTION_TYPE,FORM_NO,SERVICE_HANDLER,PLACEMENT,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER) values ('inv_amendment',2,'R','a','process','Action Button for process the data','process','default.gif','U','2','3',null,null,null,null,null);

--DELETE EXISTING RECORDS FROM SYSTEM_EVENTS FOR INVOICE AMENDMENT PROCESS
DELETE FROM SYSTEM_EVENTS WHERE obj_name = 'inv_amendment';

--INSERT NEW RECORDS INTO SYSTEM_EVENTS
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,OVERWRITE_CORE,COMP_TYPE,COMP_NAME,COMM_FORMAT) values ('inv_amendment','get_data','1','inv_amdprs_getdata',null,null,null,null,'2','0','EJB','InvoiceAmdPrs',null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,OVERWRITE_CORE,COMP_TYPE,COMP_NAME,COMM_FORMAT) values ('inv_amendment','process','1','inv_amdprs_prc',null,null,null,null,'2','0','EJB','InvoiceAmdPrs',null);

--DELETE EXISTING RECORDS FROM SYSTEM_EVENT_SERVICES FOR INVOICE AMENDMENT PROCESS
DELETE FROM SYSTEM_EVENT_SERVICES where service_code = 'inv_amdprs_getdata' or service_code = 'inv_amdprs_prc';

--INSERT NEW RECORDS INTO SYSTEM_EVENT_SERVICES
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 ('inv_amdprs_getdata','Action to get the Data','http://192.168.0.124/BaseE12DotNetService/E12BusinessLogic.asmx','BASE','getData','String','S',null,null,'15-MAR-12','Mahesh    ','Base');
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 ('inv_amdprs_prc','Action to process the Data','http://192.168.0.124/BaseE12DotNetService/E12BusinessLogic.asmx','BASE','process','String','S',null,null,'15-MAR-12','Mahesh    ','Base');

--DELETE EXISTING RECORDS FROM SYSTEM_SERVICE_ARGS FOR INVOICE AMENDMENT PROCESS
DELETE FROM SYSTEM_SERVICE_ARGS where service_code = 'inv_amdprs_getdata' or service_code = 'inv_amdprs_prc';

--INSERT NEW RECORDS INTO SYSTEM_SERVICE_ARGS
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 ('inv_amdprs_prc',1,'COMPONENT_TYPE','I','Component Type','C.String',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_prc',2,'COMPONENT_NAME','I','Component Name','C.String',null,'15-MAR-12','Mahesh    ','BASE','InvoiceAmdPrs');
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 ('inv_amdprs_prc',3,'XML_DATA_1','I','XML data of form no 1','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_prc',4,'XML_DATA_ALL','I','XML data of form no 1','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_prc',5,'WINDOW_NAME','I','Object Context','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_prc',6,'XTRA_PARAMS','I','Extra Arguments','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_getdata',1,'COMPONENT_TYPE','I','Component Type','C.String',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_getdata',2,'COMPONENT_NAME','I','Component Name','C.String',null,'15-MAR-12','Mahesh    ','BASE','InvoiceAmdPrs');
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 ('inv_amdprs_getdata',3,'XML_DATA_1','I','XML data of form no 1','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_getdata',4,'XML_DATA_ALL','I','XML data of form no 1','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_getdata',5,'WINDOW_NAME','I','Window Name','S',null,'15-MAR-12','Mahesh    ','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 ('inv_amdprs_getdata',6,'XTRA_PARAMS','I','Extra Arguments','S',null,'15-MAR-12','Mahesh    ','BASE',null);

--DELETE EXISTING RECORDS FROM MESSAGES FOR INVOICE AMENDMENT PROCESS
DELETE FROM MESSAGES
WHERE msg_no = 'INVAMDDT0' OR
msg_no = 'INVAMCD0' OR
msg_no = 'INVAMCD1' OR
msg_no = 'VTRCPCON' OR
msg_no = 'INVAMDAVL0' OR
msg_no = 'VTEFF01' OR
msg_no = 'VTILRD' OR
msg_no = 'VTILRDATE' OR
msg_no = 'VTCURRCD1' OR
msg_no = 'INVAMDSTS0' OR
msg_no = 'INVAMCMP0';

--INSERT NEW RECORDS INTO MESSAGES
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 ('VTCURRCD1 ','Currency code Not Found!','The currency code you have entered is not found in the currency master.','E','Y',null,null,null,'07-DEC-05','BASE      ','BASE           ',null,null);
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 ('VTILRD    ','Invalid Lr Date !!','Lr Date Cannot Be Less Than Invoice Date Or  Diff. Between Lr Date And Invoice Date Cannot Be Greater Than ','E','Y',null,null,null,'07-DEC-05','BASE      ','BASE           ',null,null);
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 ('VTRCPCON  ','Receipt Already Confirmed!','Receipt for this Invoice has already confrimed.','E','Y',null,null,null,'07-DEC-05','BASE      ','BASE           ',null,null);
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 ('INVAMDSTS0','Invalid Status','Invalid status. Status must be B, D or S','E','Y',null,null,null,'21-MAR-12','Mahesh    ','base           ',null,null);
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 ('INVAMDAVL0','Row already Amended','Row already amended.','E','Y',null,null,null,'21-MAR-12','Mahesh    ','base           ',null,null);
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 ('INVAMCD1  ','Cust Code Null or Blank','Cust code required','E','Y',null,null,null,'21-MAR-12','Mahesh    ','Base           ',null,null);
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 ('INVAMCD0  ','Invalid Cust Code','Cust Code invalid ','E','Y',null,null,null,'21-MAR-12','Mahesh    ','Base           ',null,null);
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 ('INVAMDDT0 ','Invalid Dates','From date must be less than to Date','E','Y',null,null,null,'21-MAR-12','Mahesh    ','Base           ',null,null);
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 ('VTEFF01   ','Eff date Invalid','Eff date is must be greater than invoice eff date','E','Y',null,null,null,'21-MAR-12','Mahesh    ','Base           ',null,null);
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 ('VTILRDATE ','lr Date Required','lr Date Required and must be greater than invoice date','E','Y',null,null,null,'21-MAR-12','Mahesh    ','Base           ',null,null);
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 ('INVAMCMP0','Process Completed','Process completed for Selected Transaction.','P','Y',null,null,null,'21-MAR-12','Mahesh    ','Base           ',null,null);

