--UPDATE FROM 8.6.1.0 TO 8.6.1.1


DROP TABLE VERSION_8_6_1_0;



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


/*  WBCF  */
CREATE TABLE WBCF (
	 WBCF_CATEGORY		NUMBER(2)	NOT NULL
	,WBCF_BACKUP_TYPE	NUMBER(1)	NOT NULL
	,WBCF_BACKUP_DAYS	NUMBER(4)	NULL
	,WBCF_DELETE		NUMBER(1)	NULL
	,WBCF_DELETE_DAYS	NUMBER(4)	NULL
	,WBCF_INACTIVE		NUMBER(1)	NULL
)
PCTFREE  10
PCTUSED  40
INITRANS 1
MAXTRANS 255
TABLESPACE V8MAIN
    STORAGE (
	INITIAL 64K
	NEXT 64K
	MINEXTENTS 1
	MAXEXTENTS 2147483645
	PCTINCREASE 50
	FREELISTS 1 FREELIST GROUPS 1
        )
;

ALTER TABLE WBCF ADD (
	CONSTRAINT WBCF_PK
	PRIMARY KEY
	            (
	             WBCF_CATEGORY
	            )
	USING INDEX
	PCTFREE    10
	INITRANS   2
	MAXTRANS   255
	TABLESPACE V8INDEX
)
;

COMMENT ON COLUMN WBCF.WBCF_CATEGORY IS '0,null=bcNone, 1=bcBillingHistory, 2=bcGuestChecks, 3=bcUserlog, 4=bcCorrespondence, 5=bcCashierClosure, 6=bcMoveLog, 7=bcINvoiceLink, 8=bcPostingComment';

COMMENT ON COLUMN WBCF.WBCF_BACKUP_TYPE IS '1=MOVE TO BACKUP USER, 2=DELETE FROM DB';

COMMENT ON COLUMN WBCF.WBCF_BACKUP_DAYS IS 'OLDER THAN (SYSTEMDATE - DAY)   WILL BE PROCESSED';

COMMENT ON COLUMN WBCF.WBCF_DELETE IS 'DELETE FROM BACKUP USER';

COMMENT ON COLUMN WBCF.WBCF_DELETE_DAYS IS 'OLDER THAN (SYSTEMDATE - DAY)   WILL BE PROCESSED';

ALTER TABLE YRCH ADD ( YRCH_XPDA_ID NUMBER(30) NULL  );

COMMENT ON COLUMN YRCH.YRCH_XPDA_ID IS 'Interest Code'; 

ALTER TABLE WPHS ADD ( WPHS_CONFERENCEDIARY NUMBER(1) NULL  );

COMMENT ON COLUMN WPHS.WPHS_CONFERENCEDIARY IS 'Display in conference diary';

ALTER TABLE YOUT ADD ( YOUT_INACTIVE NUMBER(1) NULL  );

COMMENT ON COLUMN YOUT.YOUT_INACTIVE IS '1= inactive';

ALTER TABLE YOUT DROP COLUMN YOUT_DEVICE_DEV_ID;

ALTER TABLE YCMC DROP COLUMN YCMC_PRODUKTGRUPPE_ID;

ALTER TABLE YCMI DROP COLUMN YCMI_PRODUKT_PRO_PLU;

ALTER TABLE MMOD ADD ( MMOD_WDAYS_OFFSET NUMBER(1) NULL  );

ALTER TABLE MMOD ADD ( MMOD_VAT NUMBER(5,2) NULL  );

COMMENT ON COLUMN MMOD.MMOD_WDAYS_OFFSET IS 'weekend days offset. In V8 start the week with Monday=1. Other CRS starts with Sunday=1';

COMMENT ON COLUMN MMOD.MMOD_VAT IS 'in case we get net values from CRS but we need gross, you can set the VAT percentage';

ALTER TABLE AINV ADD ( AINV_TRANSFER_INFO VARCHAR2(50) NULL  );

COMMENT ON COLUMN AINV.AINV_TRANSFER_INFO IS 'Transaction transfer information (from account, to account)';

UPDATE MCNV SET MCNV_PMS_DEFAULT=1 WHERE NVL(MCNV_PMS_DEFAULT,0)=0;

ALTER TABLE YCMI MODIFY ( YCMI_ARTICLENUMBER VARCHAR(15)  );

COMMENT ON COLUMN ZPOS.ZPOS_LEDGERSTATUS IS '0= posting made in the guest ledger;   1= posting made in the PreArrival ledger;   2= posting made in the PreArrival ledger and transferred to the guest ledger (at check-in for reservations, manually for fin. acc.);   3= adjustment and payment posting made in the city ledger (accounts receivable);   4= internal negative payment when city ledger gets paid (accounts receivable);   5= advance posting;   6= when advance posting is moved to guest ledger;';

UPDATE ZPOS SET ZPOS_LEDGERSTATUS=3 WHERE ZPOS_ZDCO_ID=(SELECT WUSS_VALUE FROM WUSS WHERE WUSS_NAME='ARINTERNALPOSTINGDEPT' AND WUSS_XCMS_ID=0) AND ZPOS_LEDGERSTATUS=4;

UPDATE AINV SET AINV_TRANSFER_INFO=AINV_DESCRIPT WHERE AINV_TRANSFER_INFO IS NULL AND SUBSTR(AINV_DESCRIPT,1,2) IN ('->','<-');

