 /* SQL Updated by Priyanka Shinde on 26/MAR/14 for Freight Rate(DI3GSUN047)  */
ALTER TABLE FREIGHT_RATE ADD TRANS_MODE  CHAR(1);
ALTER TABLE FREIGHT_RATE ADD MIN_WEIGHT  NUMBER(14,3);
ALTER TABLE FREIGHT_RATE ADD MAX_WEIGHT  NUMBER(14,3);


Update system_events SET COMP_TYPE='EJB',COMP_NAME='FreightRateIC',SERVICE_CODE='prv_default_ejb',CHG_DATE=sysdate where obj_name='frt_rate' and EVENT_CODE='pre_validate'; 

Update system_events SET COMP_TYPE='EJB',COMP_NAME='FreightRateIC',SERVICE_CODE='poic_default_ejb',CHG_DATE=sysdate where obj_name='frt_rate' and EVENT_CODE='post_item_change';

INSERT INTO itm2menu (application,level_1,level_2,level_3,level_4,level_5,win_name,descr,comments,menu_path,icon_path,obj_type,chg_user,chg_term,chg_date,open_icon,mob_deploy,close_icon)
VALUES ('FRT',1,5,0,0,0,'w_frt_rate','Freight Rate',NULL,'FRT.1.5.0.0.0','e12_logo.gif','T',NULL,NULL,NULL,NULL,NULL,NULL);

INSERT INTO transetup (tran_window,save_flag,val_flag,key_flag,key_string,repeate_add,chg_date,chg_user,chg_term,edi_option,site_acc_col,confirm_col,
confirm_val,auto_confirm,ledg_post_conf,tran_id_col,workflow_opt,ref_ser,tax_forms,wrkflw_init,audit_trail_opt) 
VALUES ('w_frt_rate','2','2','M',NULL,'N',TO_DATE('20-11-2008 19:22:59','DD-MM-YYYY HH24:MI:SS'),'BASE      ','BASE           ','0',NULL,NULL,NULL,'N','N',NULL,NULL,'F-RAT',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 ('frt_rate',1,'add.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 ('frt_rate',2,'edit.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 ('frt_rate',4,'save.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 ('frt_rate',21,'menu.bmp','View Audit Trail','audit_trail','1','X','View Audit','1','1','1','U',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 )
VALUES ('w_frt_rate','FrtRt','d_frt_rate_brow','d_frt_rate_edit',NULL,NULL,NULL,NULL,'1');

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 )
VALUES ('w_frt_rate','Details','d_frt_rate_det_brow','d_frt_rate_det_edit',NULL,NULL,NULL,NULL,'2');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VTFMTOTMVD', 'Invalid To Day/Time','To Day/Time Can not be less than From Day/Time !', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VMCHGAMT', 'Invalid Amount','Amount should be greater than Zero. !', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VMSEQ2', 'Invalid Sequence','Sequence should not be Zero. !', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VMMINWGT', 'Invalid Weight','Min weight should be less than max weight.. !', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VTFRLNTEXT', 'Invalid FreightList','Freight List does not exists', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VTTRMODE', 'Invalid TransporterMode','Transporter Mode cannot be empty.', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VTMINWGT', 'Invalid MinimumWeight','Minimum Weight cannot be empty.', 'E', 'Y', SYSDATE, 'BASE', 'BASE');

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VTMAXWGT', 'Invalid MaximumWeight','MaximumW Weight cannot be empty.', 'E', 'Y', SYSDATE, 'BASE', 'BASE')

INSERT INTO MESSAGES (msg_no , msg_str , msg_descr ,  msg_type ,  msg_opt , chg_date , chg_user , chg_term )
VALUES ('VMFLTVLD', 'Invalid LoadType','Load type not defined for freight list master.', 'E', 'Y', SYSDATE, 'BASE', 'BASE')
 
INSERT INTO pophelp (FIELD_NAME,MOD_NAME,SQL_STR,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM,DIST_OPT,HELP_OPTION)
VALUES ('TRANS_MODE','X','select rtrim(fld_value),descr from gencodes where fld_name = ''TRANS_MODE'' and mod_name = ''X''','TRANSPORTER MODE',0,0,SYSDATE,'BASE','BASE','0','0');

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 ('VMSTNCDFR ','Invalid station Code From !','station Code from cannot be blank. !','E','Y',null,null,null,to_timestamp('25-DEC-13','DD-MON-RR HH.MI.SSXFF AM'),'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 ('VMSTNCDTO ','Invalid station Code To','station Code to cannot be blank. !','E','Y',null,null,null,to_timestamp('25-DEC-13','DD-MON-RR HH.MI.SSXFF AM'),'BASE ','BASE',null,null);

UPDATE MESSAGES SET msg_descr='Minimum Weight cannot be left blank' where msg_no='VTMINWGT';

UPDATE MESSAGES SET msg_descr='MaximumW Weight cannot be left blank' where msg_no='VTMAXWGT';

UPDATE MESSAGES SET msg_descr='Transporter Mode cannot be left blank' where msg_no='VTTRMODE';

UPDATE MESSAGES SET msg_descr='Load Type cannot be left blank',msg_str='Invalid Load Type' where msg_no='VMLOADTY';











--------------added by cpatil sql on 18-apr-14 for shipment local migration


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 ('shipment_loc',10,null,'Action Button for Default Item','act_default','a','R','Default','2','3',null,'U',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 ('shipment_loc',11,null,'recalculate','rec_shipmentloc','a','R','Recal','1','2',null,'U',null,null,null,null,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_TYPE,COMP_NAME,COMM_FORMAT) 
values ('shipment_loc','act_default','1','default_shipment_loc',null,'0',sysdate,'BASE','BASE','2','EJB','ShipmentLocDefaultAct',null);

update system_events set SERVICE_CODE = 'poic_default_ejb' , COMP_TYPE = 'EJB',COMP_NAME = 'ShipmentLocIC' where OBJ_NAME = 'shipment_loc'  and EVENT_CODE ='post_item_change';
update system_events set SERVICE_CODE = 'prcm_default_ejb' , COMP_TYPE = 'EJB',COMP_NAME = 'ShipmentLocConf' where OBJ_NAME = 'shipment_loc'  and EVENT_CODE = 'pre_confirm';
update system_events set SERVICE_CODE = 'prv_default_ejb' , COMP_TYPE = 'EJB',COMP_NAME = 'ShipmentLocIC' where OBJ_NAME = 'shipment_loc'  and EVENT_CODE = 'pre_validate';

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_TYPE,COMP_NAME,COMM_FORMAT) 
values ('shipment_loc','rec_shipmentloc','1','recal_shipmentloc',null,'0',sysdate,'BASE ','BASE','2','EJB','RecalFrtAct',null);



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 ('default_shipment_loc','Action To Get Default Item','http://localhost:9090/axis/services/ActionHandlerService','Base Information','actionHandler','String','S',null,null,sysdate,'BASE','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 ('recal_shipmentloc','recal shipment loc','http://localhost:9090/base/services/ValidatorService','BaseInformation','actionHandler','String','S',null,null,sysdate,'BASE','BASE');




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 ('default_shipment_loc',1,'COMPONENT_TYPE','I','Component Type','C.String',null,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 ('default_shipment_loc',2,'COMPONENT_NAME','I','Component Name','C.String',null,sysdate,'BASE','Base','ShipmentLocDefaultAct');
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 ('default_shipment_loc',3,'ACTION_TYPE','I','Action Type','C.String',null,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 ('default_shipment_loc',4,'XML_DATA','I','XML data for Current form','S',null,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 ('default_shipment_loc',5,'XML_DATA_1','I','XML data of form no 1','S',null,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 ('default_shipment_loc',6,'XML_DATA__ALL','I','XML data of all form ','S',null,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 ('default_shipment_loc',7,'OBJ_CONTEXT','I','Object context','S',null,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 ('default_shipment_loc',8,'XTRA_PARAMS','I','Extra Arguments','S',null,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 ('recal_shipmentloc',1,'COMPONENT_TYPE','I',null,'S',null,sysdate,'BASE','BASE111','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 ('recal_shipmentloc',2,'COMPONENT_NAME',null,null,'S',null,sysdate,'BASE','BASE111','RecalFrtAct');
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 ('recal_shipmentloc',3,'<tran_id>',null,null,'B.String',null,sysdate,'BASE','BASE111',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 ('recal_shipmentloc',4,'XTRA_PARAMS',null,null,'S',null,sysdate,'BASE','BASE111',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 ('recal_shipmentloc',5,'FORCED_FLAG',null,null,'S',null,sysdate,'BASE','BASE111',null);


Insert into messages (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,CHG_DATE,CHG_USER,CHG_TERM) 
values ('VMRECALSUC','Recalculate Successfully.','Recalculate Successfully.','P','Y',sysdate,'BASE','BASE');





COMMIT
