--UPDATE FROM 8.13.12.0 TO 8.13.13.0


 	
DROP TABLE VERSION_8_13_12_0;


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


CREATE TABLE YBIL(
   YBIL_ID           NUMBER(30)                  NOT NULL
  ,YBIL_YRES_ID      NUMBER(30)
  ,YBIL_ZFAC_ID      NUMBER(30)
  ,YBIL_YBIS_ID      NUMBER(30)                  NOT NULL 
  ,CONSTRAINT YBIL_PK PRIMARY KEY (YBIL_ID) USING INDEX TABLESPACE v8index) TABLESPACE v8main;
  
COMMENT ON TABLE YBIL is 'Link table for Billing Instruction to Reservation/Financial Account';  
COMMENT ON COLUMN YBIL.YBIL_YRES_ID is 'ID of the Reservation for which the Billing Instruction was created';
COMMENT ON COLUMN YBIL.YBIL_ZFAC_ID is 'ID of the Financial Account for which the Billing Instruction was created';
COMMENT ON COLUMN YBIL.YBIL_YBIS_ID is 'ID of the Billing Instruction';

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

INSERT INTO YCLR (YCLR_ID, YCLR_SHORTDESC, YCLR_LONGDESC, YCLR_DISPLORDER,
            YCLR_CCMDISPLORDER, YCLR_CANCELORREINSTATE, YCLR_YRES,YCLR_YBOMCONF, YCLR_YBOMROOMS, YCLR_INACTIVE, YCLR_WALKED)
SELECT SEQ_YCLR.NEXTVAL,'WCC','Cancellation via WebConnect',(SELECT MAX(YCLR_DISPLORDER) from yclr)+1,
        (SELECT MAX(YCLR_CCMDISPLORDER) from yclr)+1, 1, 1, 1, 1, 0, 0 FROM DUAL 
        WHERE NOT EXISTS (SELECT * FROM YCLR WHERE YCLR_SHORTDESC = 'WCC');

INSERT INTO WJAC (WJAC_ID, WJAC_SHORT_DESC, WJAC_CODE, WJAC_DESC, WJAC_ALT_DESC, WJAC_WJAG_ID, WJAC_ENABLED) 
(SELECT seq_WJAC.nextval,'jaNumberCycleChange','270', 'Number Cycle Change','', WJAG_ID,1 from WJAG where WJAG_CODE='jgSystem' and 
NOT EXISTS (SELECT 1 FROM WJAC where WJAC_DESC = 'Number Cycle Change' AND WJAC_SHORT_DESC= 'jaNumberCycleChange'));




