CREATE SEQUENCE INV_SEQ START WITH 1 INCREMENT BY 1;

alter table invoice_amendment add tran_id varchar2(10) DEFAULT '1' NOT NULL ;

UPDATE INVOICE_AMENDMENT SET TRAN_ID=INV_SEQ.NEXTVAL;

ALTER TABLE invoice_amendment drop CONSTRAINT INVOICE_AMENDMENT_X;

ALTER TABLE invoice_amendment ADD CONSTRAINT INVOICE_AMENDMENT_X PRIMARY KEY (TRAN_ID);

CREATE TABLE INVOICE_AMENDMENTDET (TRAN_ID CHAR(10) NOT NULL, LINE_NO CHAR(3) NOT NULL , TRACKING_NO VARCHAR2(40), STATUS CHAR(1), STATUS_DATE DATE)

ALTER TABLE invoice_amendmentDET ADD CONSTRAINT INVOICE_AMENDMENTDET_X PRIMARY KEY (TRAN_ID,LINE_NO);


--DELETE EXISTING RECORD FROM ITM2MENU 
DELETE FROM ITM2MENU WHERE WIN_NAME = 'w_invoice_amd';

--INSERT NEW RECORD INTO ITM2MENU TABLE
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 ('SFA',1,52,0,0,0,'w_invoice_amd','Invoice Amendment','Invoice Amendment','SFA.1.52.0.0.0','e12_logo.gif',null,null,null,'01/jun/12','Mahesh','BASE      ');

--DELETE EXISTING RECORD FROM TRANSETUP 
DELETE FROM TRANSETUP WHERE TRAN_WINDOW = 'w_invoice_amd';

--INSERT NEW RECORD INTO TRANSETUP TABLE
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,ALLOW_ATTACH) values ('w_invoice_amd','2','2','M','seq10',null,null,null,null,null,'N','01/jun/12','Mahesh    ','Base           ','0',null,null,null,'Y',null,'N','Y',null,'tran_id','0','0',null,null,null,'invoice_amendment','WMS','Invoice Amendment',null,null,null,null,null,null,'0',null,null,null,null,'F',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,'M',null,null,null,null,null,null,null);

--DELETE EXISTING RECORD FROM OBJ_FORMS 
DELETE FROM OBJ_FORMS WHERE WIN_NAME = 'w_invoice_amd';

--INSERT NEW RECORDS INTO OBJ_FORMS TABLE
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,STORAGE_KEY_METADATA) values ('w_invoice_amd','Header',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);
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,STORAGE_KEY_METADATA) values ('w_invoice_amd','Detail',null,null,null,null,null,null,'2',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);

--DELETE EXISTING RECORD FROM OBJ_ACTIONS 
DELETE FROM OBJ_ACTIONS WHERE OBJ_NAME = 'invoice_amd';

--INSERT NEW RECORDS INTO OBJ_ACTIONS TABLE
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 ('invoice_amd',1,'A','a','a','Adding New','Add','add.gif','S','1',null,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 ('invoice_amd',2,'E','a','a','Editing Existing Record','Edit','edit.gif','S','1',null,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 ('invoice_amd',4,'S','a','a','Saving','Save','save.gif','S','1',null,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 ('invoice_amd',21,'X','1','audit_trail','View Audit Trail','View Audit','menu.bmp','U','1','1','1',null,null,null,null);

--DELETE EXISTING RECORD FROM SYSTEM_EVENTS 
DELETE FROM SYSTEM_EVENTS WHERE OBJ_NAME = 'invoice_amd';

--INSERT NEW RECORDS INTO SYSTEM_EVENTS TABLE
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 ('invoice_amd','audit_trail','1','project_audit_trail',null,'01/jun/12','Mahesh    ','BASE','2','0',null,null,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 ('invoice_amd','post_item_change','1','poic_default_ejb',null,'01/jun/12','Mahesh    ','BASE','2','0','EJB','InvoiceAmendmentIC',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 ('invoice_amd','post_validate','1','post_gen_val',null,'01/jun/12','Mahesh    ','BASE','2','0','EJB','GenValidate',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 ('invoice_amd','pre_validate','1','prv_default_ejb',null,'01/jun/12','Mahesh    ','BASE','2','0','EJB','InvoiceAmendmentIC',null);

--DELETE EXISTING RECORD FROM SYSTEM_EVENT_SERVICES
DELETE FROM SYSTEM_EVENT_SERVICES where service_code = 'project_audit_trail' or 
service_code = 'poic_default_ejb' or 
service_code = 'post_gen_val' or 
service_code = 'prv_default_ejb' ;

--INSERT NEW RECORDS INTO SYSTEM_EVENT_SERVICES TABLE
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 ('poic_default_ejb',null,'http://192.168.0.124/BaseE12DotNetService6-3-0-003/E12BusinessLogic6-3-0-003.asmx',null,'itemChanged','String','S',null,null,'01/jun/12','Subrata   ','Subu');
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 ('post_gen_val','validation','http://localhost:9090/axis/services/ValidatorService','BASE iformation','wfValData','String','S',null,null,'01/jun/12','ALKA      ','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 ('project_audit_trail','calling audit log jsp','http://localhost:9090/ibase/webitm/jsp/ITMAuditForms.jsp',null,'doPost',null,null,null,null,'01/jun/12','Base      ','Base91');
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 ('prv_default_ejb',null,'http://192.168.0.124/BaseE12DotNetService6-3-0-003/E12BusinessLogic6-3-0-003.asmx',null,'wfValData','String','S',null,null,'01/jun/12','Subrata   ','Subu');

--DELETE EXISTING RECORD FROM SYSTEM_SERVICE_ARGS
DELETE FROM SYSTEM_SERVICE_ARGS where service_code = 'project_audit_trail' or 
service_code = 'poic_default_ejb' or 
service_code = 'post_gen_val' or 
service_code = 'prv_default_ejb' ;

--INSERT NEW RECORDS INTO SYSTEM_SERVICE_ARGS TABLE
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 ('poic_default_ejb',1,'COMPONENT_TYPE','I',null,'S',null,null,null,null,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 ('poic_default_ejb',2,'COMPONENT_NAME','I',null,'S',null,null,null,null,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 ('poic_default_ejb',3,'XML_DATA','I',null,'S',null,null,null,null,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 ('poic_default_ejb',4,'XML_DATA_1','I',null,'S',null,null,null,null,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 ('poic_default_ejb',5,'XML_DATA_ALL','I',null,'S',null,null,null,null,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 ('poic_default_ejb',6,'OBJ_CONTEXT','I',null,'S',null,null,null,null,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 ('poic_default_ejb',7,'FOCUSED_COLUMN','I',null,'S',null,null,null,null,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 ('poic_default_ejb',8,'EDIT_FLAG','I',null,'S',null,null,null,null,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 ('poic_default_ejb',9,'XTRA_PARAMS','I',null,'S',null,null,null,null,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 ('post_gen_val',1,'COMPONENT_TYPE','I',null,'C.String',null,'01/jun/12','Jiten     ','Base218','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 ('post_gen_val',2,'COMPONENT_NAME','I',null,'C.String',null,'01/jun/12','Jiten     ','Base218','GenValidate');
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 ('post_gen_val',3,'XML_DATA','I',null,'S',null,'01/jun/12','Jiten     ','Base218',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 ('post_gen_val',4,'XML_DATA_ALL','I',null,'S',null,'01/jun/12','Jiten     ','Base218',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 ('post_gen_val',5,'XML_DATA_ALL','I',null,'S',null,'01/jun/12','Jiten     ','Base218',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 ('post_gen_val',6,'OBJ_CONTEXT','I',null,'S',null,'01/jun/12','Jiten     ','Base218',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 ('post_gen_val',7,'WIN_NAME','I',null,'S',null,'01/jun/12','Jiten     ','Base218',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 ('post_gen_val',8,'XTRA_PARAMS','I',null,'S',null,'01/jun/12','Jiten     ','Base218',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 ('prv_default_ejb',1,'COMPONENT_TYPE','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',2,'COMPONENT_NAME','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',3,'XML_DATA','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',4,'XML_DATA_1','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',5,'XML_DATA_ALL','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',6,'OBJ_CONTEXT','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',7,'EDIT_FLAG','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',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 ('prv_default_ejb',8,'XTRA_PARAMS','I',null,'S',null,'01/jun/12','Manohar   ','Manohar',null);

--DELETE EXISTING RECORD FROM OBJ_ITEMCHANGE
DELETE FROM OBJ_ITEMCHANGE WHERE obj_name = 'invoice_amd';

--INSERT NEW RECORDS INTO OBJ_ITEMCHANGE TABLE
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','invoice_id',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','shipment_id',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','trans_mode',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','tran_code',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','stan_code__init',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','status',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','2','itm_default',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','curr_code__frt',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('invoice_amd','1','curr_code__ins',null);

--DELETE EXISTING RECORD FROM POPHELP
DELETE FROM POPHELP WHERE mod_name = 'W_INVOICE_AMD';

--INSERT NEW RECORDS INTO POPHELP TABLE
Insert into POPHELP (FIELD_NAME,MOD_NAME,SQL_STR,DW_OBJECT,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM,DIST_OPT,FILTER_STRING,SQL_INPUT,DEFAULT_COL,POP_ALIGN,QUERY_MODE,PAGE_CONTEXT,POPHELP_COLS,POPHELP_SOURCE,MULTI_OPT,HELP_OPTION) values ('INVOICE_ID        ','W_INVOICE_AMD','SELECT INVOICE_ID,SITE_CODE FROM INVOICE',null,'INVOICE ID',null,null,'01/jun/12','MAHESH    ','BASE           ','1',null,null,null,null,null,null,null,null,null,null);
Insert into POPHELP (FIELD_NAME,MOD_NAME,SQL_STR,DW_OBJECT,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM,DIST_OPT,FILTER_STRING,SQL_INPUT,DEFAULT_COL,POP_ALIGN,QUERY_MODE,PAGE_CONTEXT,POPHELP_COLS,POPHELP_SOURCE,MULTI_OPT,HELP_OPTION) values ('SHIPMENT_ID       ','W_INVOICE_AMD','SELECT SHIPMENT_ID FROM SHIPMENT',null,'SHIPMENT ID',null,null,'01/jun/12','MAHESH    ','BASE           ','1',null,null,null,null,null,null,null,null,null,null);

--DELETE EXISTING RECORD FROM POPHELP
DELETE FROM MESSAGES where msg_no = 'VMINVCD1' or
msg_no = 'VTRCPCON' or
msg_no = 'VTINVCD01' or
msg_no = 'VTDIFFST' or
msg_no = 'VMINVIDNL' or
msg_no = 'VMTRAN1' or
msg_no = 'VMTRANCD1' or
msg_no = 'VTITMOD' or
msg_no = 'VTILRDATE' or
msg_no = 'VTEFF01' or
msg_no = 'VTSHIPIDEX'  or
msg_no = 'VTRDPS'  or
msg_no = 'VTCURRCD1' or
msg_no = 'VTSHIPID'   or
msg_no = 'VESTACD2' or
msg_no = 'VTETDETA'   or
msg_no = 'VMSTAT'    or
msg_no = 'VMTRACKCD' or
msg_no = 'VMSTSCD1' or
msg_no = 'VTILRD' ;

--INSERT NEW RECORDS INTO MESSAGES TABLE
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 ('VESTACD2  ','Invalid station code !','Station code can not be empty when paymode Demand Draft.','E',null,null,null,null,'01/jun/12','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 ('VMINVCD1  ','Invoice Cannot be empty!','Invoice cannot be empty. Enter a valid invoice number.','E','Y',null,null,null,'01/jun/12','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 ('VMSTAT    ','Status cannot be blank','Status cannot be blank','E','Y',null,null,null,'01/jun/12','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 ('VMTRANCD1 ','Transporter Code Empty!','The transporter code cannot be empty.','E','Y',null,null,null,'01/jun/12','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 ('VTETDETA  ','VTETDETA','Estimated date of arrival should be greater than estimated date of departure ','W',null,null,null,null,'01/jun/12','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 ('VTCURRCD1 ','Currency code Not Found!','The currency code you have entered is not found in the currency master.','E','Y',null,null,null,'01/jun/12','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 ('VTINVCD01 ','Invalid Invoiceid','Invoice already amended with status as callback','W','Y',null,null,null,'01/jun/12','BASE      ','192.168.2.27   ',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 ('VTITMOD   ','Invalid Transporter Mode!','Transporter Mode Cannot Be Empty.','E','Y',null,null,null,'01/jun/12','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 ','W','Y',null,null,null,'01/jun/12','BASE      ','192.168.2.236  ',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,'01/jun/12','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 ('VTSHIPID  ','Empty Shipment Id !','Shipment Id should not be blank.','E','Y',null,null,null,'01/jun/12','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 ('VTSHIPIDEX','Invalid Shipment Id !','Shipment Id does not exists or not Confirmed in Shipment.','E','Y',null,null,null,'01/jun/12','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 ('VMINVIDNL ','Invoice Id Can''t be NULL','Invoice Id Can''t be NULL','E',null,null,null,null,'01/jun/12','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 ('VMTRAN1   ','Invalid transporter!','Transporter code entered does not exist. Please enter valid/defined transporter code.','E','Y',null,null,null,'01/jun/12','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 ('VMTRACKCD ','TRACKING NO CANNOT BE BLANK','TRACKING NO CANNOT BE BLANK OR NULL','E','Y',null,null,null,null,null,null,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 ('VMSTSCD1  ','Status Date cannot be null','Status Date cannot be null','E','Y',null,null,null,null,null,null,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 ('VTDIFFST  ','Invalid site code for Invoice','Invoice site code is not a login site for seleted invoice','E','Y',null,null,null,null,null,null,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 must be greater then invoice eff date','E','Y',null,null,null,null,null,null,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 ('VTRDPS    ','Invalid road permit no','Invalid road permit no','E','Y',null,null,null,null,null,null,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 cannot be null','Lr date cannot be null','E','Y',null,null,null,null,null,null,null,null);
