-- Insert of standard default setup for mailing wizard


delete from wmwm where wmwm_id < 1000;
delete from wmwd where wmwd_id < 1000;
delete from wmwp where wmwp_id < 1000;
delete from wmwg where wmwg_id < 1000;
delete from wmwf where wmwf_id < 1000; 
commit;


Insert into WMWM (WMWM_ID,WMWM_SHORTDESC,WMWM_LONGDESC,WMWM_DISPLORDER,WMWM_REMARKS) values (200,'RES','Reservation',3,'Reservation related filter');
Insert into WMWM (WMWM_ID,WMWM_SHORTDESC,WMWM_LONGDESC,WMWM_DISPLORDER,WMWM_REMARKS) values (900,'POS','Posting',9,'Posting queries');
Insert into WMWM (WMWM_ID,WMWM_SHORTDESC,WMWM_LONGDESC,WMWM_DISPLORDER,WMWM_REMARKS) values (100,'MAR','Marketing',1,'Filter by Profile Marketing Information');
Insert into WMWM (WMWM_ID,WMWM_SHORTDESC,WMWM_LONGDESC,WMWM_DISPLORDER,WMWM_REMARKS) values (101,'INP','Individual Profile',2,'Individual Profile');

Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (900,'PNA','Posting by Article',900,'select zpos_xcms_id XCMS_ID from zpos,zart where zpos_zart_id=zart_id and zpos_postdate between :FROMPOSTDAY and :TOPOSTDAY and zart_numericdesc in (:PARA_ART)',21,'Guest has minimum one selected article posting on the folio in selected date range');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (205,'RS1','Reservation No of Stay',200,'select XX.XCMS_ID xcms_id 
from xcms XX 
where exists (select 1 from yres where yres_resstatus<>3 and yres_xcms_id=XX.XCMS_ID and yres_exparrtime between :STAYFROMDATE and :STAYTODATE group by yres_xcms_id having count(*) >:NOOFSTAYS)',20,'Filter for number of stays for selected date range');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (201,'RS2','Reservation Departure in Selected Range',200,'select XX.XCMS_ID xcms_id 
from xcms XX 
where exists (select 1 from yres where yres_resstatus<>3 and yres_xcms_id=XX.XCMS_ID and yres_exparrtime between :LASTSTAY_FROMDATE and :LASTSTAY_TODATE)',19,'Reservation Departure in Selected Range');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (126,'XYZ','Birthday AND Actioncode',101,'select 
xcid_id XCMS_ID
 from xcid 
 where xcid_birthtime is not null
 and
 to_date(decode(to_char(xcid_birthtime,''DD.MM''),''29.02'',''28.02'',to_char(xcid_birthtime,''DD.MM''))||''.''||to_char(:BIRTH_FROM,''YYYY''),''DD.MM.YYYY'') between to_date(to_char(:BIRTH_FROM,''DD.MM.YYYY''),''DD.MM.YYYY'') and to_date(to_char(:BIRTH_TO,''DD.MM.YYYY''),''DD.MM.YYYY'')
 and round((to_date(to_char(decode(to_char(xcid_birthtime,''DD.MM''),''29.02'',''28.02'',to_char(xcid_birthtime,''DD.MM'')))||''.''||to_char((select sysdate from dual),''YYYY''),''DD.MM.YYYY'')-XCID_BIRTHTIME)/365)=:PARA_AGE 
 and exists (select 1 from xpal,xpda where xpal_xcms_id=xcid_id and xpal_xpda_id=xpda_id and xpda_xpac_id=5 and xpda_shortdesc=:XPDA_SHORTDESC)',26,'Birthday and Actioncode');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (125,'BRA','Birthday in Date Range with age selection',101,'select 
xcid_id XCMS_ID
 from xcid 
 where xcid_birthtime is not null
 and
 to_date(decode(to_char(xcid_birthtime,''DD.MM''),''29.02'',''28.02'',to_char(xcid_birthtime,''DD.MM''))||''.''||to_char(:BIRTH_FROM,''YYYY''),''DD.MM.YYYY'') between to_date(to_char(:BIRTH_FROM,''DD.MM.YYYY''),''DD.MM.YYYY'') and to_date(to_char(:BIRTH_TO,''DD.MM.YYYY''),''DD.MM.YYYY'')
 and round((to_date(to_char(decode(to_char(xcid_birthtime,''DD.MM''),''29.02'',''28.02'',to_char(xcid_birthtime,''DD.MM'')))||''.''||to_char((select sysdate from dual),''YYYY''),''DD.MM.YYYY'')-XCID_BIRTHTIME)/365)=:PARA_AGE',25,'Birthday in Date Range with age selection');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (122,'BDR','Birthday in Date Range',101,'select 
xcid_id XCMS_ID
 from xcid 
 where xcid_birthtime is not null
 and
 to_date(decode(to_char(xcid_birthtime,''DD.MM''),''29.02'',''28.02'',to_char(xcid_birthtime,''DD.MM''))||''.''||to_char(:BIRTH_FROM,''YYYY''),''DD.MM.YYYY'') between to_date(to_char(:BIRTH_FROM,''DD.MM.YYYY''),''DD.MM.YYYY'') and to_date(to_char(:BIRTH_TO,''DD.MM.YYYY''),''DD.MM.YYYY'')',24,'Birthday in Date Range');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (121,'BIM','Birthday in Month',101,'select xcid_id XCMS_ID from xcid where to_number(to_char(xcid_birthtime,''MM''))=:BIRTHDAY_MONTH',23,'Birthday in Month XX');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (120,'BIR','Birthday',101,'select xcid_id XCMS_ID from xcid where to_char(xcid_birthtime,''DD.MM'')=to_char(:BIRTHDAY,''DD.MM'')',22,'Birthday on Day XX');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (118,'SPE','Specials',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=18 and XPDA.XPDA_SHORTDESC in (:CODE_SPE)',11,'Specials');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (117,'NEW','Newspaper',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=17 and XPDA.XPDA_SHORTDESC in (:CODE_NEW)',10,'Newspaper');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (116,'PRI','Priority',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=16 and XPDA.XPDA_SHORTDESC in (:CODE_PRI)',9,'Priority');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (115,'SOU','Source',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=15 and XPDA.XPDA_SHORTDESC in (:CODE_SOU)',8,'CODE_SOU');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (114,'PSO','Primary Sales Office',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=14 and XPDA.XPDA_SHORTDESC in (:CODE_PSO)',7,'Primary Sales Office');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (113,'MAI','Mailing Codes',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=13 and XPDA.XPDA_SHORTDESC in (:CODE_MAI)',6,'Mailing Codes');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (112,'SCM','Simple Commission',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=12 and XPDA.XPDA_SHORTDESC in (:CODE_SCM)',5,'Simple Commission');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (111,'VIP','VIP Codes',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=11 and XPDA.XPDA_SHORTDESC in (:CODE_VIP)',4,'VIP Codes');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (110,'STR','Sales Territory',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=10 and XPDA.XPDA_SHORTDESC in (:CODE_STR)',3,'Sales Territory');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (109,'RMP','Potential',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=9 and XPDA.XPDA_SHORTDESC in (:CODE_RMP)',2,'Potential');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (108,'SCC','Scope City',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=8 and XPDA.XPDA_SHORTDESC in (:CODE_SCC)',1,'Scope City');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (107,'PDM','Pref. Distribution',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=7 and XPDA.XPDA_SHORTDESC in (:CODE_PDM)',18,'Pref. Distribution');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (106,'INF','Influence',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=6 and XPDA.XPDA_SHORTDESC in (:CODE_INF)',17,'Influence');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (105,'ACT','Action Codes',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=5 and XPDA.XPDA_SHORTDESC in (:CODE_ACT)',16,'Action Codes');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (104,'PRO','Product Interest',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=4 and XPDA.XPDA_SHORTDESC in (:CODE_PRO)',15,'Product Interest');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (103,'SCO','Scope',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=3 and XPDA.XPDA_SHORTDESC in (:CODE_SCO)',14,'Scope');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (102,'COM','Competition Code',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=2 and XPDA.XPDA_SHORTDESC in (:CODE_COM)',13,'Competion Codes');
Insert into WMWD (WMWD_ID,WMWD_SHORTDESC,WMWD_LONGDESC,WMWD_WMWM_ID,WMWD_SQL_SETUP,WMWD_DISPLORDER,WMWD_REMARKS) values (101,'IND','Industry Codes',100,'select XPAL.XPAL_XCMS_ID xcms_id
from xpal,xpda 
where XPAL.XPAL_XPDA_ID=XPDA.XPDA_ID and XPAL.XPAL_XPAC_ID=1 and XPDA.XPDA_SHORTDESC in (:CODE_IND)',12,'Industry Codes');

Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (101,6,101,1,'XPDA','XPDA_SHORTDESC','CODE_IND','select xpda_id, xpda_shortdesc, xpda_longdesc 
from   xpda 
where  xpda_xpac_id=1','XPDA_SHORTDESC','XPDA_LONGDESC',null,1,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (102,6,102,1,'XPDA','XPDA_SHORTDESC','CODE_COM','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=2','XPDA_SHORTDESC','XPDA_LONGDESC',null,2,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (103,6,103,1,'XPDA','XPDA_SHORTDESC','CODE_SCO','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=3','XPDA_SHORTDESC','XPDA_LONGDESC',null,3,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (104,6,104,1,'XPDA','XPDA_SHORTDESC','CODE_PRO','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=4','XPDA_SHORTDESC','XPDA_LONGDESC',null,4,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (105,6,105,1,'XPDA','XPDA_SHORTDESC','CODE_ACT','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=5','XPDA_SHORTDESC','XPDA_LONGDESC',null,5,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (106,6,106,1,'XPDA','XPDA_SHORTDESC','CODE_INF','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=6','XPDA_SHORTDESC','XPDA_LONGDESC',null,6,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (107,6,107,1,'XPDA','XPDA_SHORTDESC','CODE_PDM','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=7','XPDA_SHORTDESC','XPDA_LONGDESC',null,7,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (108,6,108,1,'XPDA','XPDA_SHORTDESC','CODE_SCC','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=8','XPDA_SHORTDESC','XPDA_LONGDESC',null,8,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (109,6,109,1,'XPDA','XPDA_SHORTDESC','CODE_RMP','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=9','XPDA_SHORTDESC','XPDA_LONGDESC',null,9,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (110,6,110,1,'XPDA','XPDA_SHORTDESC','CODE_STR','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=10','XPDA_SHORTDESC','XPDA_LONGDESC',null,10,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (111,6,111,1,'XPDA','XPDA_SHORTDESC','CODE_VIP','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=11','XPDA_SHORTDESC','XPDA_LONGDESC',null,11,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (112,6,112,1,'XPDA','XPDA_SHORTDESC','CODE_SCM','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=12','XPDA_SHORTDESC','XPDA_LONGDESC',null,12,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (113,6,113,1,'XPDA','XPDA_SHORTDESC','CODE_MAI','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=13','XPDA_SHORTDESC','XPDA_LONGDESC',null,13,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (114,6,114,1,'XPDA','XPDA_SHORTDESC','CODE_PSO','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=14','XPDA_SHORTDESC','XPDA_LONGDESC',null,14,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (115,6,115,1,'XPDA','XPDA_SHORTDESC','CODE_SOU','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=15','XPDA_SHORTDESC','XPDA_LONGDESC',null,15,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (116,6,116,1,'XPDA','XPDA_SHORTDESC','CODE_PRI','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=16','XPDA_SHORTDESC','XPDA_LONGDESC',null,16,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (117,6,117,1,'XPDA','XPDA_SHORTDESC','CODE_NEW','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=17','XPDA_SHORTDESC','XPDA_LONGDESC',null,17,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (118,6,118,1,'XPDA','XPDA_SHORTDESC','CODE_SPE','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=18','XPDA_SHORTDESC','XPDA_LONGDESC',null,18,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (120,4,120,0,null,null,'BIRTHDAY',null,null,null,null,21,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (121,1,121,null,null,null,'BIRTHDAY_MONTH',null,null,null,null,22,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (122,4,122,0,null,null,'BIRTH_FROM',null,null,null,null,23,null,'Date from');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (123,4,122,0,null,null,'BIRTH_TO',null,null,null,null,24,null,'Date to');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (127,1,125,0,null,null,'PARA_AGE',null,null,null,null,27,null,'Age');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (126,4,125,0,null,null,'BIRTH_TO',null,null,null,null,26,null,'Date To');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (125,4,125,0,null,null,'BIRTH_FROM',null,null,null,null,25,null,'Date from');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (129,4,126,0,null,null,'BIRTH_FROM',null,null,null,null,37,null,'Date from');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (130,6,126,1,'xpda','xpda_shortdesc','CODE_ACT','select xpda_id, xpda_shortdesc, xpda_longdesc from xpda where  xpda_xpac_id=5','xpda_shortdesc','xpda_longdesc',null,38,null,'Actioncode');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (131,4,126,0,null,null,'BIRTH_TO',null,null,null,null,36,null,'Date to');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (128,1,126,0,null,null,'PARA_AGE',null,null,null,null,35,null,'Age');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (201,4,201,0,null,null,'LASTSTAY_FROMDATE',null,null,null,null,19,null,'Last stay from');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (202,4,201,0,null,null,'LASTSTAY_TODATE',null,null,null,null,28,null,'Last stay to');
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (207,1,205,0,null,null,'NOOFSTAYS',null,null,null,null,31,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (206,4,205,0,null,null,'STAYTODATE',null,null,null,null,30,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (205,4,205,0,null,null,'STAYFROMDATE',null,null,null,null,29,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (900,4,900,0,null,null,'FROMPOSTDAY',null,null,null,null,32,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (901,4,900,0,null,null,'TOPOSTDAY',null,null,null,null,33,null,null);
Insert into WMWP (WMWP_ID,WMWP_TYP,WMWP_WMWD_ID,WMWP_MULTIPLE,WMWP_TABLE_NAME,WMWP_TABLE_FIELD,WMWP_PARAMETERNAME,WMWP_INTERNAL_SQL,WMWP_FIELD1,WMWP_FIELD2,WMWP_FIELD3,WMWP_DISPLORDER,WMWP_REMARKS,WMWP_PARA_DESC) values (902,7,900,1,'ZART','ZART_NUMERICDESC','PARA_ART','select zart_id,zart_numericdesc,zart_longdesc from zart order by zart_displorder','zart_numericdesc','zart_longdesc',null,20,null,null);

Insert into WMWG (WMWG_ID,WMWG_SHORTDESC,WMWG_LONGDESC,WMWG_DISPLORDER,WMWG_REMARKS,WMWG_SQL_SETUP) values (102,'NOM','Active mailing flag',2,'Only guest which are marked to receive mailings','NVL(MainMwge.XCMS_NOMAILING, 0) <> 1');
Insert into WMWG (WMWG_ID,WMWG_SHORTDESC,WMWG_LONGDESC,WMWG_DISPLORDER,WMWG_REMARKS,WMWG_SQL_SETUP) values (103,'NOE','Active E-Mailing flag',3,'Only guest which are marked to receive E-Mail mailings','NVL(MainMwge.XCMS_NOEMAILING, 0) <> 1');
Insert into WMWG (WMWG_ID,WMWG_SHORTDESC,WMWG_LONGDESC,WMWG_DISPLORDER,WMWG_REMARKS,WMWG_SQL_SETUP) values (104,'BLK','Exclude profiles with credit status=B',4,'excludes profiles with Credit Status set to B.','NVL(MainMwge.XCMS_CREDITSTAT,'' '') <> ''B''');
Insert into WMWG (WMWG_ID,WMWG_SHORTDESC,WMWG_LONGDESC,WMWG_DISPLORDER,WMWG_REMARKS,WMWG_SQL_SETUP) values (101,'ACT','Only active profiles',5,'Only active profiles','MainMwge.XCMS_ACTIVE = 1');
Insert into WMWG (WMWG_ID,WMWG_SHORTDESC,WMWG_LONGDESC,WMWG_DISPLORDER,WMWG_REMARKS,WMWG_SQL_SETUP) values (100,'ALL','Active profiles',1,'Lists all active guest that are set to receive Mailings, E-mails without the ones which where the field Credit Status is set to B.','NVL(MainMwge.XCMS_NOMAILING, 0) <> 1 AND
NVL(MainMwge.XCMS_NOEMAILING, 0) <> 1 AND
NVL(MainMwge.XCMS_CREDITSTAT,'' '') <> ''B'' AND
MainMwge.XCMS_ACTIVE = 1');
Insert into WMWG (WMWG_ID,WMWG_SHORTDESC,WMWG_LONGDESC,WMWG_DISPLORDER,WMWG_REMARKS,WMWG_SQL_SETUP) values (105,'PAU','Primary address filled',6,'street and city of the primary address is filled.','exists (select 1 from xadr where xadr_xcms_id=MainMwge.XCMS_ID and xadr_primary=1 and xadr_city is not null and xadr_street1 is not null)');

Insert into WMWF (WMWF_ID,WMWF_SHORTDESC,WMWF_LONGDESC,WMWF_TYPE,WMWF_TABLE_NAME,WMWF_TABLE_LINK_FIELD,WMWF_DISPLORDER,WMWF_REMARKS,WMWF_SQL_SETUP) values (100,'GCI','Profile with Greeting, Lettergreeting and Birthday',1,null,null,1,'Address Details of individual profile','SELECT
    X5.XCMS_ID, 
    X5.XCMS_NAME1 LASTNAME, 
    X5.XCMS_NAME3 FIRSTNAME, 
    C5.XCID_ADDRGREET ADDR_GREETING, 
    C5.XCID_LETTGREET LETT_GREETING, 
    C5.XCID_BIRTHTIME
FROM 
    XCMS X5, XCID C5
WHERE 
    X5.XCMS_ID = {xcms_id} 
and X5.XCMS_ID = C5.XCID_ID(+)');
Insert into WMWF (WMWF_ID,WMWF_SHORTDESC,WMWF_LONGDESC,WMWF_TYPE,WMWF_TABLE_NAME,WMWF_TABLE_LINK_FIELD,WMWF_DISPLORDER,WMWF_REMARKS,WMWF_SQL_SETUP) values (200,'ADD','Primary address',2,null,null,2,'Address Details of primary address','SELECT 
    A2.XADR_XCMS_ID XCMS_ID, 
    A2.XADR_STREET1 STREET1, 
    A2.XADR_STREET2 STREET2,
    A2.XADR_STREET3 STREET3,
    A2.XADR_CITY CITY,
    A2.XADR_ZIP ZIP,
    C2.XCOU_LONGDESC COUNTRY,
    C2.XCOU_ISO2 COUNTRY_ISO2,
    C2.XCOU_ISO3 COUNTRY_ISO3
FROM XADR A2, XCMS X2, XCOU C2
WHERE A2.XADR_XCMS_ID = {xcms_id}
  AND NVL(A2.XADR_PRIMARY, 0) = 1
  AND A2.XADR_XCMS_ID = X2.XCMS_ID
  AND A2.XADR_XCOU_ID=C2.XCOU_ID');
commit;
