--UPDATE FROM 8.8.0.0 TO 8.8.1.0


DROP TABLE VERSION_8_8_0_0;



/*  VERSION_8_8_1_0  */
CREATE TABLE VERSION_8_8_1_0 (
	 DUMMY	NUMBER	    NULL
)
;

ALTER TABLE YPOS ADD YPOS_GROSSUNITPRICE NUMBER(30,4);

UPDATE YPOS Y SET YPOS_GROSSUNITPRICE=(SELECT SUM(YPOS_UNITPRICE) FROM YPOS YY WHERE YY.YPOS_TAXLINK_ID=Y.YPOS_TAXLINK_ID) WHERE YPOS_DT=1;

ALTER TABLE ZPOS ADD ZPOS_XCAC_ID NUMBER(30);

COMMENT ON COLUMN ZPOS.ZPOS_XCAC_ID IS 'ID of child age category in case multi guest and rate amount per guest is used, for reporting purpose only ';

ALTER TABLE YPRR ADD YPRR_ZDCO_ID NUMBER(30);

ALTER TABLE YFSC ADD YFSC_FREETEXT VARCHAR2(1000);

COMMENT ON COLUMN YFSC.YFSC_FREETEXT IS 'Free text';

ALTER TABLE YFSC ADD YFSC_PICTURE LONG RAW;

COMMENT ON COLUMN YFSC.YFSC_PICTURE IS 'Picture';

ALTER TABLE YSSL ADD YSSL_FREETEXT VARCHAR2(1000);

COMMENT ON COLUMN YSSL.YSSL_FREETEXT IS 'Free text';

ALTER TABLE YSSL ADD YSSL_PICTURE LONG RAW;

COMMENT ON COLUMN YSSL.YSSL_PICTURE IS 'Picture';

ALTER TABLE ZDCO ADD ZDCO_XCHFEE_MULTIPLYBYCHEQUES NUMBER(1);

COMMENT ON COLUMN ZDCO.ZDCO_XCHFEE_MULTIPLYBYCHEQUES IS 'Multiply by Number of Cheques when flatrate fee is set';

ALTER TABLE XADR MODIFY XADR_CITY VARCHAR2(60);

ALTER TABLE WZIP MODIFY WZIP_TOWN VARCHAR2(60);

ALTER TABLE YCAD ADD YCAD_WEEKDAY_WCOL_ID NUMBER(30);

ALTER TABLE YCAD ADD YCAD_WEEKEND_WCOL_ID NUMBER(30);

ALTER TABLE YCAD ADD YCAD_EMAIL VARCHAR2(30);

COMMENT ON COLUMN YCAD.YCAD_EMAIL IS 'sender email per hotel segment';

ALTER TABLE WRPS ADD WRPS_YCAD_ID NUMBER(30);

COMMENT ON COLUMN WRPS.WRPS_YCAD_ID IS 'Link report section to the hotel segment';

ALTER TABLE YGRT ADD YGRT_YCAD_ID NUMBER (30);

COMMENT ON COLUMN YGRT.YGRT_YCAD_ID IS 'Hotel segmentation link';

ALTER TABLE YGRP ADD YGRP_YCAD_ID NUMBER (30);

COMMENT ON COLUMN YGRP.YGRP_YCAD_ID IS 'Hotel segmentation link';

ALTER TABLE YSEA ADD YSEA_DISPLORDER NUMBER(3);

UPDATE YSEA SET YSEA_DISPLORDER = ROWNUM;

DROP VIEW V8_CCM_PRODUCTION;

COMMENT ON COLUMN ZINN.ZINN_TYPE IS ' 1 = invoices, 2 = user definable number cycles, 3 = currency exchange (zfag_type 3), 4 = autonumber for booth telephone charges paid cash, 5 = City Ledger Folio, 11 = autonumber zfag_type 1 (ar postings), 12 = autonumber zfag_type 2 (ar payments), 13 = void invoice, 14 = fattura (for italy), 15 = nota di credito (for italy or credit note for greece or portugal), 16 = proforma, 17 = fattura and nota di credito (for italy), 18 = nota korekta (for poland), 19 = Egyptian AR Invoice, 20 = AR Payment Receipt, 21 = registration cards, 22 = Ticket BarCode, 23 = Contract Numbers, 31 = automatic fa numbers (zfac_autonumber), 32 = lost and found, 33 = police export, 34 = tourist export, 35 = jetweb interface; 36= Voucher';

CREATE TABLE WEAD
(
  WEAD_ID NUMBER(30, 0) NOT NULL,
  WEAD_DESCRIPTION VARCHAR2(60),
  WEAD_WEAS_ROLE NUMBER(1), 
  CONSTRAINT WEAD_PK PRIMARY KEY (WEAD_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

COMMENT ON TABLE WEAD IS 'Easy Letter departments';

COMMENT ON COLUMN WEAD.WEAD_ID IS 'Unique ID';

COMMENT ON COLUMN WEAD.WEAD_DESCRIPTION IS 'Department';

COMMENT ON COLUMN WEAD.WEAD_WEAS_ROLE IS '0-General letter 1-Profile Letter 2-Reservation (confirmation) letter 3-Booking (confirmation) letter';

CREATE TABLE WEAL
(
  WEAL_ID NUMBER(30,0) NOT NULL,
  WEAL_WEAS_ID NUMBER(30,0) NOT NULL,
  WEAL_WEAD_ID NUMBER(30,0) NOT NULL,
  CONSTRAINT WEAL_PK PRIMARY KEY (WEAL_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

COMMENT ON TABLE WEAL IS 'Link Easy letter templates to departments';

COMMENT ON COLUMN WEAL.WEAL_ID IS 'Unique ID';

COMMENT ON COLUMN WEAL.WEAL_WEAS_ID IS 'Link to Easy letter template';

COMMENT ON COLUMN WEAL.WEAL_WEAD_ID IS 'Link to Easy letter department';

CREATE SEQUENCE SEQ_WEAD INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE SEQUENCE SEQ_WEAL INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN WEAS.WEAS_ROLE IS '0-General letter 1-Profile Letter 2-Reservation (confirmation) letter 3-Booking (confirmation) letter';

ALTER TABLE WEAD ADD WEAD_INACTIVE NUMBER(1);

COMMENT ON COLUMN WEAD.WEAD_INACTIVE IS '1=Inactive';

ALTER TABLE WEAD ADD WEAD_DISPLORDER NUMBER(3);

COMMENT ON COLUMN WEAD.WEAD_DISPLORDER IS 'Display order';

CREATE TABLE ZTAP 
  (ZTAP_ID       NUMBER(30) NOT NULL
  ,ZTAP_ZTAA_ID  NUMBER(30) NOT NULL
  ,ZTAP_ZTAK_ID  NUMBER(30) NOT NULL
  ,ZTAP_CUSTOMER_ZDCO_ID  NUMBER(30) NULL
  ,ZTAP_MASTER_ZDCO_ID  NUMBER(30) NULL
  ,ZTAP_VALUE 	 NUMBER(30,4) NOT NULL
  ,CONSTRAINT ZTAP_PK PRIMARY KEY (ZTAP_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
  
CREATE SEQUENCE SEQ_ZTAP INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

ALTER TABLE XPDC ADD XPDC_PRIMARY NUMBER(1);

COMMENT ON COLUMN XPDC.XPDC_PRIMARY IS 'Primary Personal Document';

UPDATE XPDC SET XPDC_PRIMARY=1 WHERE XPDC_ID IN (SELECT XPDC_ID  FROM (SELECT DISTINCT V.XPDC_XCMS_ID, (SELECT V1.XPDC_ID FROM XPDC V1 WHERE V1.XPDC_XCMS_ID=V.XPDC_XCMS_ID AND ROWNUM=1) XPDC_ID FROM XPDC V GROUP BY V.XPDC_XCMS_ID HAVING SUM(NVL(XPDC_PRIMARY,0))=0));

ALTER TABLE YCIT MODIFY YCIT_DESCRIPTION VARCHAR2(500);

ALTER TABLE YEBR ADD YEBR_DESCRIPTION VARCHAR2(500);

COMMENT ON COLUMN YEBR.YEBR_DESCRIPTION IS 'Misc. Item description';

UPDATE YEBR SET YEBR_DESCRIPTION=(SELECT YCIT_DESCRIPTION FROM YCIT WHERE YCIT_ID=YEBR_YCIT_ID) WHERE YEBR_YCIT_ID IN (SELECT YCIT_ID FROM YCIT WHERE YCIT_DESCRIPTION IS NOT NULL);

ALTER TABLE YEMN ADD YEMN_DESCRIPTION VARCHAR(500);

COMMENT ON COLUMN YEMN.YEMN_DESCRIPTION IS 'Std. Menu description';

ALTER TABLE YEVM ADD YEVM_DISPLORDER NUMBER(3);

COMMENT ON COLUMN YEVM.YEVM_DISPLORDER IS 'Event display order'; 

ALTER TABLE WSCT ADD WSCT_MODULE NUMBER(1);

COMMENT ON COLUMN WSCT.WSCT_MODULE IS '1=CRM|2=Tasks and Activities|3=PMS|4=CCM'; 

ALTER TABLE WSCT ADD WSCT_DEFAULT NUMBER(1);

COMMENT ON COLUMN WSCT.WSCT_DEFAULT IS 'Default= 1'; 

ALTER TABLE YRCH MODIFY YRCH_FOLIOTEXT VARCHAR2 (60);

ALTER TABLE MMOD ADD MMOD_COMBINE_DEF_TENT NUMBER(1,0);

COMMENT ON COLUMN MMOD.MMOD_COMBINE_DEF_TENT IS 'indicates whether we should upload definite and tentative avl in one field';

ALTER TABLE MMOD ADD MMOD_CHILD_RATE_BUCKETS NUMBER(1,0);

COMMENT ON COLUMN MMOD.MMOD_CHILD_RATE_BUCKETS IS 'Indicates use of child rate buckets for myfidelio';

ALTER TABLE XJET ADD XJET_ENCODING NUMBER(1);

CREATE TABLE MQU5
(
  MQU5_ID             NUMBER(30)                NOT NULL,
  MQU5_VENDOR_NO      NUMBER(30),
  MQU5_GUID           VARCHAR2(40 BYTE),
  MQU5_TYPE           VARCHAR2(5 BYTE),
  MQU5_PROPERTY_NAME  VARCHAR2(30 BYTE),
  MQU5_FILENAME       VARCHAR2(50 BYTE),
  MQU5_BUILDING       VARCHAR2(3 BYTE),
  MQU5_MESSAGE        CLOB,
  MQU5_HTTPVALUES     VARCHAR2(200 BYTE),
  MQU5_RECEIVED       DATE,
  CONSTRAINT MQU5_PK PRIMARY KEY (MQU5_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8LARGE;

COMMENT ON COLUMN MQU5.MQU5_ID IS 'unique id';

COMMENT ON COLUMN MQU5.MQU5_VENDOR_NO IS 'Vendor number of the vendor to whom the message belongs';

COMMENT ON COLUMN MQU5.MQU5_GUID IS 'GUID identifies message later for deletion';

COMMENT ON COLUMN MQU5.MQU5_TYPE IS 'Type of message like RES, RTAV etc.';

COMMENT ON COLUMN MQU5.MQU5_PROPERTY_NAME IS 'hotel code identifies the hotel to whom message belongs';

COMMENT ON COLUMN MQU5.MQU5_FILENAME IS 'file name of message used for file based interfaces for backups, request messages';

COMMENT ON COLUMN MQU5.MQU5_BUILDING IS 'only used by MyTravel';

COMMENT ON COLUMN MQU5.MQU5_MESSAGE IS 'request message send by the crs';

COMMENT ON COLUMN MQU5.MQU5_HTTPVALUES IS 'contains special query strings for http communication';

COMMENT ON COLUMN MQU5.MQU5_RECEIVED IS 'timestamp when message received';

CREATE SEQUENCE SEQ_MQU5 INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN ZINN.ZINN_TYPE IS ' 1 = invoices, 2 = user definable number cycles, 3 = currency exchange (zfag_type 3), 4 = autonumber for booth telephone charges paid cash, 5 = City Ledger Folio, 11 = autonumber zfag_type 1 (ar postings), 12 = autonumber zfag_type 2 (ar payments), 13 = void invoice, 14 = fattura (for italy), 15 = nota di credito (for Italy or credit note for Greece, Portugal or Spain), 16 = proforma, 17 = fattura and nota di credito (for italy), 18 = nota korekta (for poland), 19 = Egyptian AR Invoice, 20 = AR Payment Receipt, 21 = registration cards, 22 = Ticket BarCode, 23 = Contract Numbers, 31 = automatic fa numbers (zfac_autonumber), 32 = lost and found, 33 = police export, 34 = tourist export, 35 = jetweb interface; 36= Voucher';

CREATE TABLE RSPL
(
  RSPL_ID         NUMBER(30) NOT NULL, 
  RSPL_RRST_ID    NUMBER(30) NOT NULL,
  RSPL_PICTURE    LONG RAW,
  RSPL_NAME 	  VARCHAR2(30),
  RSPL_DEFAULT	  NUMBER(1),
  RSPL_DISPLORDER NUMBER(1),
  RSPL_PICTURE_C  VARCHAR2(2000)
  ,CONSTRAINT RSPL_PK PRIMARY KEY (RSPL_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8LARGE;
 
COMMENT ON TABLE RSPL IS 'Restaurant plan';  

CREATE SEQUENCE SEQ_RSPL INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE TABLE RSPT
(
  RSPT_ID         NUMBER(30) NOT NULL, 
  RSPT_RSPL_ID    NUMBER(30) NOT NULL,
  RSPT_STARTTIME  DATE,
  RSPT_ENDTIME 	  DATE
  ,CONSTRAINT RSPT_PK PRIMARY KEY (RSPT_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;
    
COMMENT ON TABLE RSPT IS 'Restaurant plan times';  

CREATE SEQUENCE SEQ_RSPT INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE TABLE YETG
(
  YETG_ID NUMBER(30) NOT NULL,
  YETG_SHORTDESC VARCHAR2(3),
  YETG_NAME VARCHAR2(60),
  YETG_VALIDFROM DATE,
  YETG_VALIDTO DATE,
  YETG_DISPLORDER NUMBER(3),
  YETG_INACTIVE NUMBER(1),
  CONSTRAINT YETG_PK PRIMARY KEY (YETG_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_YETG INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN YETG.YETG_ID IS 'Event template ID';

COMMENT ON COLUMN YETG.YETG_SHORTDESC IS 'Event template short description';

COMMENT ON COLUMN YETG.YETG_NAME IS 'Event template name';

COMMENT ON COLUMN YETG.YETG_VALIDFROM IS 'Event template valid start date';

COMMENT ON COLUMN YETG.YETG_VALIDTO IS 'Event template valid end date';

COMMENT ON COLUMN YETG.YETG_DISPLORDER IS 'Event template display order';

COMMENT ON COLUMN YETG.YETG_INACTIVE IS 'Event template inactive flag';

CREATE TABLE YETE
(
  YETE_ID NUMBER(30) NOT NULL,
  YETE_YETG_ID NUMBER(30) NOT NULL,
  YETE_YETY_ID NUMBER(30),
  YETE_STARTTIME DATE,
  YETE_ENDTIME DATE,
  YETE_FROMDAY NUMBER(3), 
  YETE_TODAY NUMBER(3),
  YETE_ZDCO_ID NUMBER(30),
  YETE_MASTER_YETE_ID NUMBER(30),  
  CONSTRAINT YETE_PK PRIMARY KEY (YETE_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_YETE INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN YETE.YETE_ID IS 'Event template Event ID';

COMMENT ON COLUMN YETE.YETE_YETG_ID IS 'Event Template ID';

COMMENT ON COLUMN YETE.YETE_YETY_ID IS 'Event Status ID';

COMMENT ON COLUMN YETE.YETE_STARTTIME IS 'Start time';

COMMENT ON COLUMN YETE.YETE_ENDTIME IS 'End time';

COMMENT ON COLUMN YETE.YETE_FROMDAY IS 'Start day';

COMMENT ON COLUMN YETE.YETE_TODAY IS 'End day';

COMMENT ON COLUMN YETE.YETE_ZDCO_ID IS 'Department code ID';

COMMENT ON COLUMN YETE.YETE_MASTER_YETE_ID IS 'Master Event ID';

ALTER TABLE WSQL ADD WSQL_HTMLFILE VARCHAR2(200);

ALTER TABLE WSQL ADD WSQL_HTMLIDFIELD VARCHAR2(60); 

ALTER TABLE YSME ADD YSME_DESCRIPTION_EX VARCHAR2(500);

CREATE TABLE WSQC (
    WSQC_ID NUMBER(30) NOT NULL
   ,WSQC_WSQL_ID NUMBER(30) NOT NULL 
   ,WSQC_FIELDNAME VARCHAR2(60) NOT NULL
   ,WSQC_SCREENNAME VARCHAR2(60) NOT NULL
   ,WSQC_DISPLORDER NUMBER(3) NOT NULL
   ,CONSTRAINT WSQC_PK PRIMARY KEY (WSQC_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_WSQC INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE WSQC IS 'custom sql columns on screen';

CREATE TABLE YETF
(
  YETF_ID NUMBER(30) NOT NULL,
  YETF_YETE_ID NUMBER(30) NOT NULL,
  YETF_YFSC_ID NUMBER(30) NOT NULL,
  YETF_YFSR_ID NUMBER(30),
  YETF_YSSL_ID NUMBER(30),
  CONSTRAINT YETF_PK PRIMARY KEY (YETF_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_YETF INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN YETF.YETF_ID IS 'Function Space ID';

COMMENT ON COLUMN YETF.YETF_YETE_ID IS 'Event Template ID';

COMMENT ON COLUMN YETF.YETF_YFSC_ID IS 'Linked Function Space ID';

COMMENT ON COLUMN YETF.YETF_YFSR_ID IS 'Linked Function Space Rate ID';

COMMENT ON COLUMN YETF.YETF_YSSL_ID IS 'Linked Function Space Seatting ID';

CREATE TABLE YETR
(
  YETR_ID NUMBER(30) NOT NULL,
  YETR_YETE_ID NUMBER(30) NOT NULL,
  YETR_YCIT_ID NUMBER(30) NOT NULL,
  YETR_YCIA_ID NUMBER(30) ,
  YETR_YCIR_ID NUMBER(30),
  YETR_QUANTITY NUMBER(5),
  CONSTRAINT YETR_PK PRIMARY KEY (YETR_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_YETR INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN YETR.YETR_ID IS 'Misc. Item ID';

COMMENT ON COLUMN YETR.YETR_YETE_ID IS 'Linked Event Template ID';

COMMENT ON COLUMN YETR.YETR_YCIT_ID IS 'Linked Catering Item ID';

COMMENT ON COLUMN YETR.YETR_YCIA_ID IS 'Linked Attributes ID';

COMMENT ON COLUMN YETR.YETR_YCIR_ID IS 'Linked Rate ID';

COMMENT ON COLUMN YETR.YETR_QUANTITY IS 'Quantity';

CREATE TABLE YETM
(
  YETM_ID NUMBER(30) NOT NULL,
  YETM_YETE_ID NUMBER(30) NOT NULL,
  YETM_YSME_ID NUMBER(30) NOT NULL,
  YETM_YSMR_ID NUMBER(30) ,
  YETM_QUANTITY NUMBER(5),
  CONSTRAINT YETM_PK PRIMARY KEY (YETM_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_YETM INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN YETM.YETM_ID IS 'Standard Menu ID';

COMMENT ON COLUMN YETM.YETM_YETE_ID IS 'Linked Event Template ID';

COMMENT ON COLUMN YETM.YETM_YSME_ID IS 'Linked Standard Menu ID';

COMMENT ON COLUMN YETM.YETM_YSMR_ID IS 'Linked Rate ID';

COMMENT ON COLUMN YETM.YETM_QUANTITY IS 'Quantity';

CREATE TABLE YETB
(
  YETB_ID NUMBER(30) NOT NULL,
  YETB_YBOM_ID NUMBER(30) NOT NULL,
  YETB_YETG_ID NUMBER(30) NOT NULL,
  YETB_NAME VARCHAR2(60),
  YETB_NOOFATTENDEES NUMBER(5),
  YETB_STARTTIME DATE,
  YETB_ENDTIME DATE,
  YETB_COPIEDFROM_YETB_ID NUMBER(30),
  CONSTRAINT YETB_PK PRIMARY KEY (YETB_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_YETB INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON COLUMN YETB.YETB_ID IS 'Booked Event template ID';

COMMENT ON COLUMN YETB.YETB_YBOM_ID IS 'Linked Booking ID';

COMMENT ON COLUMN YETB.YETB_YETG_ID IS 'Event template ID';

COMMENT ON COLUMN YETB.YETB_NAME IS 'Booked Event template Name';

COMMENT ON COLUMN YETB.YETB_NOOFATTENDEES IS 'Booked Event template Number of Attendees';

COMMENT ON COLUMN YETB.YETB_STARTTIME IS 'Booked Event Template Start Date';

COMMENT ON COLUMN YETB.YETB_ENDTIME IS 'Booked Event Template End Date';

COMMENT ON COLUMN YETB.YETB_COPIEDFROM_YETB_ID IS 'Booked Event template copied ID';

ALTER TABLE YEVM ADD YEVM_YETB_ID NUMBER(30);

COMMENT ON COLUMN YEVM.YEVM_YETB_ID IS 'Event template link ID';

ALTER TABLE YCIT ADD YCIT_NOOFPAX NUMBER(1);

COMMENT ON COLUMN YCIT.YCIT_NOOFPAX IS '1=yes';

ALTER TABLE YAFC ADD YAFC_REVERSEEXCHANGERATE NUMBER(1);

ALTER TABLE YETF ADD YETF_RATE NUMBER(30, 4);

ALTER TABLE YETF ADD YETF_PERHOUR NUMBER(1);

COMMENT ON COLUMN YETF.YETF_RATE IS 'function space rate';

COMMENT ON COLUMN YETF.YETF_PERHOUR IS 'function space rate ';

ALTER TABLE YETR ADD YETR_RATE NUMBER(30, 4);

ALTER TABLE YETR ADD YETR_PERHOUR NUMBER(1);

COMMENT ON COLUMN YETR.YETR_RATE IS 'catering item rate';

COMMENT ON COLUMN YETR.YETR_PERHOUR IS 'catering item rate';

ALTER TABLE YETM ADD YETM_RATE NUMBER(30, 4);

COMMENT ON COLUMN YETM.YETM_RATE IS 'standard menu rate';

ALTER TABLE YETR ADD YETR_ZDCO_ID NUMBER(30);

COMMENT ON COLUMN YETR.YETR_ZDCO_ID IS 'Linked Department Code';

ALTER TABLE YETF ADD YETF_ZDCO_ID NUMBER(30);

COMMENT ON COLUMN YETF.YETF_ZDCO_ID IS 'Linked Department Code';

ALTER TABLE YETM ADD YETM_FOOD_ZDCO_ID NUMBER(30);

COMMENT ON COLUMN YETM.YETM_FOOD_ZDCO_ID IS 'Linked Department Code';

ALTER TABLE YETM ADD YETM_BEVERAGE_ZDCO_ID NUMBER(30);

COMMENT ON COLUMN YETM.YETM_BEVERAGE_ZDCO_ID IS 'Linked Department Code';

ALTER TABLE YETM ADD YETM_FOOD_RATE NUMBER(30, 4);

COMMENT ON COLUMN YETM.YETM_FOOD_RATE IS 'Linked Department Code';

ALTER TABLE YETM ADD YETM_BEVERAGE_RATE NUMBER(30, 4);

COMMENT ON COLUMN YETM.YETM_BEVERAGE_RATE IS 'Linked Department Code';

CREATE TABLE WGSS (
    WGSS_ID NUMBER(30) NOT NULL
   ,WGSS_XCED_ID NUMBER(30) NOT NULL
   ,WGSS_NAME VARCHAR2(200) NOT NULL
   ,WGSS_DATA BLOB NOT NULL
   ,CONSTRAINT WGSS_PK PRIMARY KEY (WGSS_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8MAIN;

CREATE SEQUENCE SEQ_WGSS INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE WGSS IS 'grid setting storage';

COMMENT ON COLUMN WEAS.WEAS_ROLE IS '0-General letter 1-Profile Letter | 2-Reservation (confirmation) letter | 3-Booking (confirmation) letter | 4-Task and Activity';

COMMENT ON COLUMN WEAD.WEAD_WEAS_ROLE IS '0-General letter 1-Profile Letter | 2-Reservation (confirmation) letter | 3-Booking (confirmation) letter | 4-Task and Activity';

CREATE TABLE XCES (
    XCES_ID NUMBER(30) NOT NULL
   ,XCES_XCED_ID NUMBER(30) NOT NULL 
   ,XCES_SIGNATURE LONG
   ,CONSTRAINT XCES_PK PRIMARY KEY (XCES_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8LARGE;

CREATE SEQUENCE SEQ_XCES INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE XCES IS 'email signatures per user';

CREATE TABLE XCEE (
    XCEE_ID NUMBER(30) NOT NULL
   ,XCEE_XCED_ID NUMBER(30) NOT NULL 
   ,XCEE_WSCT_ID NUMBER(30) NOT NULL 
   ,XCEE_WLAN_ID NUMBER(30) NOT NULL 
   ,CONSTRAINT XCEE_PK PRIMARY KEY (XCEE_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

CREATE SEQUENCE SEQ_XCEE INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE XCEE IS 'default email bodies per user / role';

ALTER TABLE WSCT ADD (WSCT_XCED_ID NUMBER(30));

COMMENT ON COLUMN WSCT.WSCT_XCED_ID IS 'If filled, means that this template is private for the selected user' ;

CREATE TABLE WSCM (
    WSCM_ID NUMBER(30) NOT NULL
   ,WSCM_WSCT_ID NUMBER(30) NOT NULL
   ,WSCM_MODULE NUMBER(1)
   ,CONSTRAINT WSCM_PK PRIMARY KEY (WSCM_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

CREATE SEQUENCE SEQ_WSCM INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE UNIQUE INDEX WSCM_CHECK ON WSCM (WSCM_WSCT_ID, WSCM_MODULE) TABLESPACE V8INDEX;

COMMENT ON TABLE WSCM IS 'modules used by email body template';

COMMENT ON COLUMN WSCM.WSCM_MODULE IS '1=CRM|2=Tasks+Activities|3=PMS|4=CCM';

INSERT INTO WSCM (WSCM_ID, WSCM_WSCT_ID, WSCM_MODULE) (SELECT SEQ_WSCM.NEXTVAL, WSCT_ID, 1 FROM WSCT WHERE WSCT_ROLE = 2);

INSERT INTO WSCM (WSCM_ID, WSCM_WSCT_ID, WSCM_MODULE) (SELECT SEQ_WSCM.NEXTVAL, WSCT_ID, 2 FROM WSCT WHERE WSCT_ROLE = 2);

INSERT INTO WSCM (WSCM_ID, WSCM_WSCT_ID, WSCM_MODULE) (SELECT SEQ_WSCM.NEXTVAL, WSCT_ID, 3 FROM WSCT WHERE WSCT_ROLE = 2);

INSERT INTO WSCM (WSCM_ID, WSCM_WSCT_ID, WSCM_MODULE) (SELECT SEQ_WSCM.NEXTVAL, WSCT_ID, 4 FROM WSCT WHERE WSCT_ROLE = 2); 

ALTER TABLE WSCT DROP COLUMN WSCT_MODULE;

ALTER TABLE XCEE ADD XCEE_MODULE NUMBER(1);

COMMENT ON COLUMN XCEE.XCEE_MODULE IS 'See description of wscm_module';

ALTER TABLE WSCT ADD WSCT_DISPLORDER NUMBER(4);

COMMENT ON COLUMN ZCCS.ZCCS_SCHEMA IS 'Hardcoded Schema IDs, refer zccs_schema_name for description.';

COMMENT ON TABLE ZPO2 IS ' Storage for removed postings - used with the Parameter Polish Faktura Korekta';

UPDATE YCIT SET YCIT_NOOFPAX=0;

COMMENT ON COLUMN ZLOG.ZLOG_ZPOS_ID IS 'when moving posting the zpos_id is filled, but when deleting posting, the field is filled with the zpos_internalgroup_id';

ALTER TABLE XCAC ADD XCAC_XGCA_ID NUMBER(30);

ALTER TABLE ZLOG ADD (ZLOG_AMOUNT NUMBER(30,4), ZLOG_ZDCO_ID NUMBER(30), ZLOG_ZCAS_ID NUMBER(30));

COMMENT ON COLUMN ZLOG.ZLOG_AMOUNT IS 'posting amount, used on posting deletion';

COMMENT ON COLUMN ZLOG.ZLOG_ZDCO_ID IS 'posting dept code, used on posting deletion';

COMMENT ON COLUMN ZLOG.ZLOG_ZCAS_ID IS 'cashier id';

ALTER TABLE WADV ADD WADV_WEBENABLED NUMBER(1) DEFAULT 1;

ALTER TABLE WADV ADD WADV_RATEQUERY NUMBER(1);

CREATE TABLE WWSC
(
  WWSC_ID         NUMBER(30) NOT NULL, 
  WWSC_SHORTDESC  VARCHAR2(3) NOT NULL,
  WWSC_LONGDESC   VARCHAR2(30) NOT NULL,
  WWSC_START      DATE,
  WWSC_DEF_NIGHTS NUMBER(2),
  WWSC_MIN_NIGHTS NUMBER(2), 
  WWSC_ROLE    	  NUMBER(1) NOT NULL,
  WWSC_DISPLORDER NUMBER(4),
  WWSC_INACTIVE   NUMBER(1)
  ,CONSTRAINT WWSC_PK PRIMARY KEY (WWSC_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
  
COMMENT ON TABLE WWSC IS 'Suite 8 Homepage "Web Selling Categories"';

COMMENT ON COLUMN WWSC.WWSC_ROLE IS '1 = Room only,  2 = Arrangement, 3 = Last Minute';

CREATE SEQUENCE SEQ_WWSC INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE TABLE WWSP
(
   WWSP_ID         NUMBER(30) NOT NULL, 
   WWSP_WWSC_ID    NUMBER(30) NOT NULL,
   WWSP_YPAC_ID    NUMBER(30) NOT NULL
  ,CONSTRAINT WWSP_PK PRIMARY KEY (WWSP_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
  
COMMENT ON TABLE WWSP IS 'Suite 8 Homepage "Web Selling Categories" link to packages';

CREATE SEQUENCE SEQ_WWSP INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE TABLE WWSR
(
   WWSR_ID         NUMBER(30) NOT NULL, 
   WWSR_WWSC_ID    NUMBER(30) NOT NULL,
   WWSR_YRCH_ID    NUMBER(30) NOT NULL
  ,CONSTRAINT WWSR_PK PRIMARY KEY (WWSR_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;
  
COMMENT ON TABLE WWSR IS 'Suite 8 Homepage "Web Selling Categories" link to rate codes';

CREATE SEQUENCE SEQ_WWSR INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE TABLE WAVL (
    WAVL_ID NUMBER(30) NOT NULL
   ,WAVL_RANGE1 NUMBER(3) 
   ,WAVL_COLOR1 NUMBER(10) 
   ,WAVL_RANGE2 NUMBER(3) 
   ,WAVL_COLOR2 NUMBER(10) 
   ,WAVL_RANGE3 NUMBER(3) 
   ,WAVL_COLOR3 NUMBER(10)
   ,WAVL_COLOR4 NUMBER(10)
   ,WAVL_FULLYOCCUPIED_COLOR NUMBER(10) 
   ,CONSTRAINT WAVL_PK PRIMARY KEY (WAVL_ID) USING INDEX TABLESPACE V8INDEX) TABLESPACE V8CONF;

CREATE SEQUENCE SEQ_WAVL INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

COMMENT ON TABLE WAVL IS 'Avaialability colors for Suite 8 Homepage availability calendar';

ALTER TABLE WAVL ADD WAVL_NAME1 VARCHAR(30);

ALTER TABLE WAVL ADD WAVL_NAME2 VARCHAR(30);

ALTER TABLE WAVL ADD WAVL_NAME3 VARCHAR(30);

ALTER TABLE WAVL ADD WAVL_NAME4 VARCHAR(30);

ALTER TABLE WAVL ADD WAVL_NAME_FULLYOCCUPIED VARCHAR(30);

UPDATE WSCT SET WSCT_DEFAULT=0;

ALTER TABLE WATG MODIFY(WATG_DISPLORDER  NULL);

ALTER TABLE XCED MODIFY XCED_BADLOGIN NUMBER(5);
