--UPDATE FROM 8.9.4.0 TO 8.9.4.1


DROP TABLE VERSION_8_9_4_0;



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

UPDATE YRCH SET YRCH_INACTIVE=0 WHERE YRCH_INACTIVE IS NULL; 

ALTER TABLE YRDT MODIFY YRDT_SHORTDESC VARCHAR2(6);

ALTER TABLE YRDT ADD YRDT_ROLE NUMBER (1);

COMMENT ON COLUMN YRDT.YRDT_ROLE IS 'null, 0 = Normal Daytype;  1=BAR Daytype';

ALTER TABLE YRDT ADD YRDT_BARCODE VARCHAR2 (30);

COMMENT ON COLUMN YRDT.YRDT_BARCODE IS 'BAR Interface Bar Code Linkage';

ALTER TABLE WLOG ADD WLOG_WPHS_ID NUMBER(30);

COMMENT ON COLUMN WLOG.WLOG_WPHS_ID IS 'In central db this shows which hotel made changes using xml interface';

ALTER TABLE YRCF ADD YRCF_BOOKINGDATE DATE;

ALTER TABLE XCID MODIFY XCID_FAM_NAME VARCHAR2(100);

ALTER TABLE ZINS ADD ZINS_MANUALNUMBER NUMBER(1) DEFAULT 0;

UPDATE YRCH SET YRCH_AVAIL_YRCH_ID = NULL WHERE YRCH_AVAIL_YRCH_ID = 0;

ALTER TABLE XMNR ADD XMNR_TAX_OFFICE VARCHAR2(30);

COMMENT ON COLUMN XMNR.XMNR_TAX_OFFICE IS 'Tax Office';

ALTER TABLE XCID MODIFY XCID_BIRTHPLACE VARCHAR2(50);

ALTER TABLE XPDC MODIFY XPDC_BIRTHPLACE VARCHAR2(50);

ALTER TABLE W8HP ADD W8HP_DEPOSIT_ZDCO_ID NUMBER(30);

CREATE TABLE WSAL (
    WSAL_ID NUMBER(30) NOT NULL
   ,WSAL_APP VARCHAR2(30) NOT NULL
   ,WSAL_SERVERACTIVITY VARCHAR2(30) NOT NULL
   ,WSAL_TIMESTAMP DATE NOT NULL
   ,WSAL_COMPLETIONTIMESTAMP DATE
   ,WSAL_WPCA_ID NUMBER(30)
   ,WSAL_XCED_ID NUMBER(30)
   ,WSAL_FIDELIODATE DATE NOT NULL
   ,WSAL_AUTOMATIC NUMBER(1) NOT NULL
   ,WSAL_TEXT VARCHAR2(2000)
   ,WSAL_FULLLOG CLOB
   ,CONSTRAINT WSAL_PK PRIMARY KEY (WSAL_ID) USING INDEX TABLESPACE V8INDEX
) TABLESPACE V8MAIN;
  
COMMENT ON TABLE WSAL IS 'Server activity log';

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

ALTER TABLE XMTY ADD XMTY_LASTREQUESTVALUE VARCHAR2(100);

ALTER TABLE ZFST ADD ZFST_SIMPLIFIEDINVOICE NUMBER(1) DEFAULT 0;

COMMENT ON COLUMN ZFST.ZFST_SIMPLIFIEDINVOICE IS '1 = Portugal Simplified Invoice';

COMMENT ON COLUMN ZINN.ZINN_YEARLY IS '1 - it will be reset every year on the month/day set in the resetdate field;  0 - will be reset once, only on the date marked in resetdate; 2 - it will be reset every month on the day set in the resetdate field';

COMMENT ON COLUMN ZINV.ZINV_ROLE IS ' 0 or null = regular invoice | 1 = Deposit Folio | 2 = City Ledger Folio (not yet implemented) | 3 = Credit Note, 31=Faktura Korekta (polish credit note)| 10 = Fattura Riepilogativa (used for Italy)| 4 - Egyptian A/R Invoice | 5 - AR Ricevuta Fiscale | 6 - Stored Info/Proforma Invoice ';

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, 6 = Information 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, 37 = membership numbers, 38 = AR Compressions';

ALTER TABLE ZINV ADD ZINV_FISCALINVOICE NUMBER(1) DEFAULT 0;

COMMENT ON COLUMN ZINV.ZINV_FISCALINVOICE IS '1 = Turkey e-invoice';

ALTER TABLE WERR ADD WERR_USER VARCHAR2(60);

ALTER TABLE ZFST DROP COLUMN ZFST_SIMPLIFIEDINVOICE CASCADE CONSTRAINTS; 

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, 6 = Information Folio, 7 = Simplified Invoice (Portugal),  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, 37 = membership numbers, 38 = AR Compressions';

CREATE TABLE YCRG (
   YCRG_ID NUMBER(30) NOT NULL
  ,YCRG_CRSID VARCHAR2(60) NOT NULL
  ,YCRG_GLOBALID NUMBER(30) NOT NULL
  ,YCRG_TIMESTAMP DATE NOT NULL
  ,YCRG_LASTTRY DATE
  ,CONSTRAINT YCRG_PK PRIMARY KEY (YCRG_ID) USING INDEX TABLESPACE V8INDEX
) TABLESPACE V8MAIN;
  
COMMENT ON TABLE YCRG IS 'CRS needs to transfer xcms globalids listed here';

CREATE SEQUENCE SEQ_YCRG 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, 6 = Information Folio, 7 = Simplified Invoice (Portugal),  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, 37 = membership numbers, 38 = AR Compressions 
  40 = Portugal Manual Invoice, 41 = Portugal Manual Credit Note, 42 = Portugal Manual Void Invoice, 43 = Portugal Manual Simple Invoice';

ALTER TABLE ZINS DROP COLUMN ZINS_KEYVERSION;

ALTER TABLE ZINS ADD ZINS_KEYVERSION varchar2(40 char);

UPDATE ZINS SET ZINS_KEYVERSION = '1';

ALTER TABLE YRES MODIFY YRES_CRSRESNR VARCHAR2(50);

CREATE TABLE ZPI2
(
  ZPI2_ID       NUMBER(30)  NOT NULL,
  ZPI2_ZINV_ID  NUMBER(30)  NOT NULL,
  ZPI2_ZPOS_ID  NUMBER(30)  ,
  ZPI2_ZPO2_ID  NUMBER(30)  ,
  CONSTRAINT ZPI2_PK PRIMARY KEY (ZPI2_ID) USING INDEX TABLESPACE V8INDEX 
) TABLESPACE V8MAIN;

COMMENT ON TABLE ZPI2 IS ' link between postings and saved information/proforma invoices';

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

ALTER TABLE XCAC MODIFY XCAC_XGCA_ID NUMBER(30) DEFAULT 0; 

ALTER TABLE YRCH MODIFY YRCH_XGCA_ID NUMBER(30) DEFAULT 0; 
