

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 
('DIS',21,0,0,0,0,'w_despatchwiz','Sale Order Building',null,'DIS.21.0.0.0.0','e12_logo.gif',null,null,'W',sysdate,'BASE','BASE','Y');


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,ALLOW_ATTACH,START_FORM,ISATTACHMENT,HEADER_FORM_NO,CONFIRM_DATE_COL,CONFIRM_BY_COL,MSG_ONSAVE,WF_STATUS,RESTART_FORM) values 
('w_despatchwiz','A','2','A','_spsite_code,seq07','Y',null,null,null,null,'N',sysdate,'BASE','BASE','0',null,null,null,null,null,null,null,'Y','Y','DESP_ID','0','0','N',null,null,null,null,null,null,null,null,null,'despatch','DIS',null,null,null,null,null,null,null,null,'S-DSP','F',null,null,null,null,null,'2',null,null,null,null,'0',null,null,null,null,null,null,null,null,null,null,null,null,'M',null,null,null,null,null,null,'2',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,SCAN_DELIMITER,COLUMN_ON_SAVE,AFTER_SAVE,EXT_SETUP,EXT_METADATA,EXT_COM,AUTO_ACCEPT_WEIGHDATA,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,QTY_COL,RATE_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY) 
values ('w_despatchwiz','Sale Order Building',null,null,null,null,null,null,'1','F',null,null,'<SCAN_INFO><INPUT_SCAN ORDER="1"><SCAN_LABEL>Sale Order No. :</SCAN_LABEL><FIELDS SEPARATOR="" DELIMITER=""><FIELD>sale_order_no</FIELD></FIELDS></INPUT_SCAN></SCAN_INFO>',null,null,null,null,null,null,null,null,null,null,null,null,null,'E',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,SCAN_DELIMITER,COLUMN_ON_SAVE,AFTER_SAVE,EXT_SETUP,EXT_METADATA,EXT_COM,AUTO_ACCEPT_WEIGHDATA,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,QTY_COL,RATE_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY) 
values ('w_despatchwiz','Header',null,null,null,null,null,null,'2','F',null,null,null,null,null,null,null,null,null,null,null,null,'checkedImage@img<tran_id>',null,null,null,'A',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,SCAN_DELIMITER,COLUMN_ON_SAVE,AFTER_SAVE,EXT_SETUP,EXT_METADATA,EXT_COM,AUTO_ACCEPT_WEIGHDATA,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,QTY_COL,RATE_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY)
 values ('w_despatchwiz','Detail',null,null,null,null,null,null,'3','T',null,null,'',null,null,null,null,null,null,null,null,null,'checkedImage@img<tran_id>,<line_no>,<dist_order>,<item_code>,<loc_code>,<quantity>,<gross_weight>,<lot_no>,<lot_sl>',null,null,null,'A',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) 
values ('despatchwiz',1,null,'Next',null,null,'N','Next','1',null,null,'U',null,sysdate,'BASE','BASE',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)
 values ('despatchwiz',2,null,'Prev','a','a','P','Prev','2',null,null,'U',null,sysdate,'BASE','BASE',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) 
values ('despatchwiz',3,null,'Next','a','a','N','Next','2',null,null,'U',null,sysdate,'BASE','BASE',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) 
values ('despatchwiz',4,null,'Prev','a','a','P','Prev','3',null,null,'U',null,sysdate,'BASE','BASE',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) 
values ('despatchwiz',5,null,'Add Record',null,null,'A','Add','3',null,null,'U',null,sysdate,'BASE','BASE',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) 
values ('despatchwiz',6,null,'Saving',null,null,'S','Finish','3',null,null,'U',null,sysdate,'BASE','BASE',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 ('despatchwiz','default_data_wiz','1','poic_default_ejb',null,'0',sysdate,'BASE','BASE','2','EJB','DespatchWiz',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 ('despatchwiz','post_item_change','1','poic_default_ejb',null,'0',sysdate,'BASE','BASE','2','EJB','DespatchWiz',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 ('despatchwiz','pre_navigate_finish','1','dispatch_post_save',null,'0',sysdate,'BASE','BASE','2','EJB','DespatchPos',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 ('despatchwiz','pre_navigate_next','1','prv_default_ejb',null,'0',sysdate,'BASE ','BASE','2','EJB','DespatchWiz',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 ('despatchwiz','pre_validate','1','prv_default_ejb',null,'0',sysdate,'BASE','BASE','2','EJB','DespatchWiz',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 ('dispatch_post_save','Sale Order Building','http://localhost:9090/axis/services/ValidatorService',null,'postSave',null,'S',null,null,sysdate,'BASE','Base204');


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 ('dispatch_post_save',1,'COMPONENT_TYPE','I',null,'S',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 ('dispatch_post_save',2,'COMPONENT_NAME','I',null,'S',null,sysdate,'BASE','BASE','DespatchPos');
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 ('dispatch_post_save',3,'WIN_NAME','I',null,'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 ('dispatch_post_save',4,'EDIT_FLAG','I',null,'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 ('dispatch_post_save',5,'<desp_id>','I','desp_id','B.String',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 ('dispatch_post_save',6,'XTRA_PARAMS','I',null,'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 ('dispatch_post_save',7,'DB_CONN','I',null,'S.Connection',null,sysdate,'BASE','BASE',null);


Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('despatchwiz','1','itm_default',null);
Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('despatchwiz','2','itm_default',null);

Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('despatchwiz','3','itm_default',null);
Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('despatchwiz','3','lot_sl',null);
Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('despatchwiz','3','itm_default_add',null);






update obj_forms set scan_metadata='<SCAN_INFO><INPUT_SCAN ORDER="1"><SCAN_LABEL>LPN (LOT SL) :</SCAN_LABEL><FIELDS SEPARATOR="" DELIMITER=""><FIELD>lot_sl</FIELD></FIELDS></INPUT_SCAN></SCAN_INFO>'
where win_name ='w_despatchwiz' and form_no=3;


Insert into  user_obj_fav (OBJ_NAME,USER_ID,CHG_DATE,CHG_USER,CHG_TERM) values ('despatchwiz','BASE',sysdate,'BASE','BASE');

Insert into   user_rights(PROFILE_ID,APPLICATION,MENU_ROW,MENU_COL,MENU_SUBCOL,LEVEL_4,LEVEL_5,MENU_NAME,RIGHTS,ACC_FILT,DEF_FILT,OBJ_NAME,FAV_OPTION,FAV_ORDER) 
values ('SUN','DIS',19,0,0,0,0,'Sale Order Building','*',null,null,'despatchwiz','Y',null);



insert into pophelp(FIELD_NAME,MOD_NAME,SQL_STR,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM)
values('SALE_ORDER_NO','W_DESPATCHWIZ','SELECT SALE_ORDER,ORDER_TYPE,ORDER_DATE,CUST_CODE,CUST_CODE__BIL FROM SORDER WHERE CONFIRMED=''Y''','SALE ORDER',0,0,sysdate,'Dadaso','BASE');

insert into pophelp(FIELD_NAME,MOD_NAME,SQL_STR,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM)
values('TRAN_CODE','W_DESPATCHWIZ','SELECT TRAN_CODE,TRAN_NAME FROM TRANSPORTER','TRAN CODE',0,0,sysdate,'Dadaso','BASE');




insert into messages(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) values 
('VTSORDNNN','Mandatory field','Sale Order No can not be blank, please enter Sale Order No','E',sysdate,'Deepak','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTSORDNND','Invalid Sale Order No','Entered Sale Order No is not exist in sorder master','E',sysdate,'BASE','BASE');



insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTSORDNNC','Unconfirmed Sale Order No','Entered Sale Order No not confirmed','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTSORDSNP','Despatch cannot be done','Entered Sale Order No have been Cancelled (X) or on Hold (H)','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTSORDDEF','Already done!','Entered Sale order No despatch is already done','E',sysdate,'BASE','BASE');

--add on 10/08/14
update pophelp set sql_str='SELECT SALE_ORDER AS
SALE_ORDER_NO,ORDER_TYPE,ORDER_DATE,CUST_CODE,CUST_CODE__BIL FROM SORDER
WHERE CONFIRMED=''Y'''
where mod_name='W_DESPATCHWIZ'and field_name='SALE_ORDER_NO';

alter table despatch add( add_date date, add_user char(10), add_term char(15)) ;

update itm2menu set comments='',descr='Loading (Despatch)' where win_name='w_despatchwiz' and application='DIS';
update user_rights set MENU_NAME='Loading (Despatch)' where PROFILE_ID='SUN' and APPLICATION='DIS' and OBJ_NAME='despatchwiz';

Update obj_forms set title ='Loading (Sale Order)' where form_no='1' and win_name='w_despatchwiz';
Update obj_forms set title ='Despatch Header' where form_no='2' and win_name='w_despatchwiz';
Update obj_forms set title ='Despatch Inventory' ,
scan_metadata='<SCAN_INFO><INPUT_SCAN ORDER="1"><SCAN_LABEL>LPN No. :</SCAN_LABEL><FIELDS SEPARATOR="" DELIMITER=""><FIELD>lot_sl</FIELD></FIELDS></INPUT_SCAN></SCAN_INFO>'
where form_no='3' and win_name='w_despatchwiz';



--added on 11-AUG-14
update itm2menu set comments=' ' where  WIN_NAME='w_despatchwiz';

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTDPCCMPQ','Invalid Quantity','Despatch can not be created more than pending quantity','E',sysdate,'BASE','BASE');

insert into messages
(msg_no,msg_str,msg_descr,msg_type,chg_date,chg_user,chg_term) 
values 
('VTDPCCSQ','Invalid Quantity','Entered detail quantity sum is greater than sale order detail sum quantity','E',sysdate,'BASE','BASE');

--added on 15/09/14 
update pophelp set sql_str='SELECT SALE_ORDER AS SALE_ORDER_NO,ORDER_TYPE,ORDER_DATE,CUST_CODE,CUST_CODE__BIL FROM SORDER WHERE STATUS = ''P'' AND CONFIRMED=''Y'' AND SALE_ORDER NOT IN (SELECT SORD_NO FROM DESPATCH)'
where mod_name='W_DESPATCHWIZ'and field_name='SALE_ORDER_NO';

update obj_forms set disp_metadata='checkedImage@img<item_code>,<loc_code>,<lot_no>,<lot_sl>,<quantity>' where  win_name='w_despatchwiz' and form_no='3';

update system_event_services set method_name='postSaveWiz' where service_code='dispatch_post_save';

update system_service_args set arg_name='XML_DATA_ALL' where service_code='dispatch_post_save' and line_no=3;
update obj_forms set 
scan_metadata = '<SCAN_INFO><INPUT_SCAN ORDER="1"><SCAN_LABEL>LPN NO :</SCAN_LABEL><FIELDS SEPARATOR="" DELIMITER=""><FIELD>lot_sl</FIELD></FIELDS></INPUT_SCAN><SCAN_CONDITION field="lot_sl">lot_sl =="null" ||lot_sl== ""</SCAN_CONDITION></SCAN_INFO>'
where form_no = '3' and win_name = 'w_despatchwiz';










