--UPDATE FROM 8.11.0.1 TO 8.11.1.0


 	
DROP TABLE VERSION_8_11_0_1;


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



alter table ycrf modify ycrf_crossref_2 VARCHAR2(80);

alter table ycrf modify ycrf_crossref_3 VARCHAR2(80);

alter table ycrf modify ycrf_crossref_4 VARCHAR2(80);

alter table ycrf modify ycrf_crossref_5 VARCHAR2(80);

alter table ycrf modify ycrf_crossref_6 VARCHAR2(80);

alter table ycrf modify ycrf_crossref_7 VARCHAR2(80);

alter table ycrf modify ycrf_crossref_8 VARCHAR2(80);

COMMENT ON COLUMN XCMS.XCMS_ACTIVE is '1 = Yes | 0 = No | 3 = Terminated (emplyoees) | 4 = Merged | 5 = Anonymized';

alter table ztxc add ztxc_tax_bucket_code varchar2(2);

comment on column ztxc.ztxc_tax_bucket_code is 'Tax Bucket Code to group Indian GST Taxes.';

CREATE TABLE ZDCF
(
	ZDCF_ID NUMBER(30) NOT NULL,
	ZDCF_ZDCO_ID NUMBER(30) NOT NULL,
	ZDCF_FIELDNAME VARCHAR2(30) NOT NULL,
	ZDCF_FIELDTYPE NUMBER(2) NOT NULL,
	ZDCF_NUMVALUE NUMBER(30) NULL,
	ZDCF_FLOATVALUE NUMBER(30,4) NULL,
	ZDCF_STRINGVALUE VARCHAR2(255) NULL
) tablespace v8conf ;

comment on table ZDCF is 'User defined fields linked to department Codes';

COMMENT ON COLUMN ZDCF.zdcf_fieldname IS 'Description of the field';

COMMENT ON COLUMN ZDCF.zdcf_zdco_id IS 'Link to department code';

COMMENT ON COLUMN ZDCF.zdcf_fieldtype IS '0-number, 1-float, 2-string';

COMMENT ON COLUMN ZDCF.zdcf_numvalue IS 'Numeric value';

COMMENT ON COLUMN ZDCF.zdcf_floatvalue IS 'Floating point value';

COMMENT ON COLUMN ZDCF.zdcf_stringvalue IS 'String value';

create sequence seq_zdcf increment by 1 start with 1000 nomaxvalue nocycle nocache noorder;

CREATE TABLE ZPIS
(
ZPIS_ID NUMBER(30) NOT NULL,
ZPIS_ZPOS_ID NUMBER(30) NULL,
ZPIS_ZTIS_ID NUMBER(30) NULL
) tablespace v8main ;

ALTER TABLE ZPIS ADD CONSTRAINT ZPIS_PK PRIMARY KEY (ZPIS_ID) using index tablespace v8index;

create sequence seq_zpis increment by 1 start with 1000 nomaxvalue nocycle nocache noorder;

Alter table zdco add zdco_saft_taxexemption_code VARCHAR2(5);

comment on column zdco.zdco_saft_taxexemption_code is 'Tax Exemption code to be used in SAF-T export, in case department code is tax exempted.' ;

COMMENT ON COLUMN ZDTL.ZDTL_CALCRULE IS 'Indian Luxury Tax / tax % calculation rule for this tax / 0 Not assigned, 1 - Charged Rate (not used anymore), 2 - Rack Rate, 3 - Higher Rate, 4 - Higher Rate Excluding Discount';

ALTER TABLE ZDTL ADD ZDTL_APPLICABLERULE NUMBER(1,0);
COMMENT ON COLUMN ZDTL.ZDTL_APPLICABLERULE IS 'Indian Luxury Tax / applicable rule for this tax / 0 Not assigned, 1 - Charged Rate, 2 - Charged Rate Excluding Discount';

ALTER TABLE ZDTL ADD ZDTL_ON_PHYSICAL_ROOM NUMBER(1,0);
COMMENT ON COLUMN ZDTL.ZDTL_ON_PHYSICAL_ROOM IS 'Indian Luxury Tax / rule caluclated onthe physical room Yes/No';

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 Number for ZINV_CITYLEDGERNUMBER, 6 = Information Folio, 7 = Simplified Invoice (Portugal), 8 = 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, 24 = Turkish Manual Invoice Number 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
  44 = Manual City Ledger Invoice 45 = Indian Credit Invoice 46 = Indian Debit Invoice';

alter table zfst add zfst_numbertemplate Varchar2(60);

COMMENT ON COLUMN zfst.zfst_numbertemplate is 'Template to create an invoice number you can use fixed text plus placeholder like YYYYMMDD';

create table xval (
    xval_id number(30) not null
   ,xval_systemname varchar2(60) not null
   ,xval_tablename varchar2(60) not null
   ,xval_table_id number(30) not null
   ,xval_fieldname varchar2(30) not null
   ,xval_value varchar2(30) not null
   ,constraint xval_pk primary key (xval_id) using index tablespace v8index) tablespace V8Main;

create sequence seq_xval increment by 1 start with 1000 nomaxvalue nocycle nocache noorder;

